All posts by Harvey

Sniffing TCP Packets With Python

Inspired by this StackOverflow question, “How do I sniff on a port for log messages using python?”, I decided to figure out how to capture and process packets in Python. It turns out to be quite easy once you work out the kinks. Except the kinks were a pain to determine.

Sample output:

Continue reading Sniffing TCP Packets With Python

Qt XML Parsing Continued

In a previous post, I compared the different methods for parsing XML in Qt. After a comment about XQuery’s performance, I added some code to test performance using a simple, but large (304MB) XML file. Times are sorted and normalized to the smallest value.

Run Time Method
1 XQmlStreamReader – processElementsByTagNameHierarchy – text()
1.1 XQmlStreamReader – processElementsByTagNameHierarchy
1.1 XQmlStreamReader – processElementsByTagName
2.2 QDomDocument
4.0 XQuery

Continue reading Qt XML Parsing Continued

Emacs Tramp and Speedier SSH Access

Tramp

I often find myself editing files in terminals on remote machines, and I really need to add Tramp to my muscle memory. Tramp is an Emacs package (installed by default?) for editing remote files via ssh. It allows you to open files with urls like this: /ssh:user@host#port:/path/to/file.

Note: I use ssh instead of scp (used in all of the examples) because the webpage says it’s faster and also because it supports the #port piece while scp does not. Also, the user@ and #port pieces are optional. So feel free to use the minimum: /ssh:host:/path/to/file.

Continue reading Emacs Tramp and Speedier SSH Access

Formatting SD Cards for Speed and Lifetime

Have you ever re-formatted an SD card and noticed the performance degrade? You formatted it FAT32 just like it came from the factory, but it runs slower. Except you didn’t actually format it like the factory. The following is a document I wrote mid-2013 about formatting microSD cards with a single FAT32 partition with a layout that is optimized for speed and lifetime. It also includes details about using this card as a bootloader source for TI OMAP3/4 processors.

Continue reading Formatting SD Cards for Speed and Lifetime

Three Ways To Parse XML in Qt

Update 1/12/2015: I’ve written a follow-up to this post comparing the performance of the different parsers. I’ve also fixed a few mistakes in the code and text below. I’ve also changed my mind about QXmlSimpleReader now that I’ve found a simple way to use it.

For this past February’s CoderNight meetup, I thought I would write the solution using Qt and take the time to explore qdoc, Qt’s excellent documentation tool. So, of course, I spent all my timeĀ  figuring out the three native ways to parse XML using Qt and completely ran out of time for qdoc. While researching the XML parsing, I couldn’t find any webpages addressing and comparing the methods all at once. Since then, I’ve discovered that the documentation for Qt 5 has an XBEL bookmarks example for each of the methods and you can compare those examples to get a feel for the differences, but there’s still no Qt XML parsing rosetta stone page. Here’s a shorter, incomplete comparison of the three methods.

Continue reading Three Ways To Parse XML in Qt

Replacing the Battery in a Boogie Board

Boogie Board My son’s Boogie Board from Brookstone recently stopped working and I suspected that he had given it the stated 6 years of use in 2 years time. Unfortunately, Improv Electronics, the manufacturer, chose to save a few cents and used a soldered battery. I needed to solder something for my work, so I thought fixing his board might provide a dry run of my soldering skills before I ruin a customer’s hardware. Continue reading Replacing the Battery in a Boogie Board