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.
$ sudo python capture.py
10:27:44.016601 hello ('127.0.0.1', 61129)
10:27:44.016614 hello ('127.0.0.1', 61129)
10:27:54.019731 hello ('127.0.0.1', 61137)
10:27:54.019741 hello ('127.0.0.1', 61137)
Continue reading Sniffing TCP Packets With Python
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.
||XQmlStreamReader – processElementsByTagNameHierarchy – text()
||XQmlStreamReader – processElementsByTagNameHierarchy
||XQmlStreamReader – processElementsByTagName
Continue reading Qt XML Parsing Continued
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:
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
#port pieces are optional. So feel free to use the minimum:
Continue reading Emacs Tramp and Speedier SSH Access
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
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
I wanted to build the minimum set of adapters necessary to connect an RS-232 USB-to-Serial adapter to any other board with a DB-9 connector. It turns out that you only need two:
- Male-Female Null Adapter
- Female-Female Gender Changer
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
Something that was not obvious (to me) in the hgsubversion documentation is that you can clone any part of a subversion repository. Continue reading With hgsubversion, you can pick and choose.
Update: Added optional code to show how you would put feature in a branch first rather than just committing directly to the trunk. Continue reading Pushing a new feature from a mercurial repo into an SVN repo
It’s like a broken record. It’s like a broken record. Here’s another example.