Archive for March, 2005

NYU & student suicides: treat the symptom, not the problem.

Wednesday, March 30th, 2005

From an article in the NY Daily News:

New York University is cutting off balcony access in two high-rise dorms in a bid to prevent student suicides, school officials said yesterday.

At least four NYU students have jumped to their deaths since 2003, though none from dorm balconies.

Unfortunately, acknowledging and treating the actual problem is often significantly more difficult than slapping a band-aid on a symptom that may or may not be related.

Unit Testing article at ADC

Tuesday, March 29th, 2005

The Apple Developer Connection has published an article covering Unit Testing of Objective-C with OCUnit.

I have been using OCUnit for quite a while to tremendous benefit. Having OCUnit integrated into the development process in such an intimate fashion has resulted in much higher quality products with a lot less churn– integration churn, regression churn, cluelessness churn– and, overall, significantly more pleasant development cycles.

While I choose to use OCUnit for a variety of reasons, not the least of which is that I have been using it for many years, the recently (by comparison) released UnitKit is also quite nice. And, as Duncan said, “If you don’t test with UnitKit [or OCUnit, TestKit, JUnit, PyUnit, etc..] please at least test. Unit testing is probably the single most effective thing that you can do to improve the quality of your code.”

Speaking of PyUnit, you can also unit test Objective-C from Python via PyObjC. Jiva DeVoe wrote an excellent article on doing just that. Python based unit testing have the advantage of an extremely quick turnaround time, but suffer from the inability to debug in the same language that the code being tested is written in.

Good stuff.

8.* quake off Northern Sumatra

Monday, March 28th, 2005

News links: The Pacific Tsunami Warning Center Notice issued a bulletin. Reuters has also published an initial report that contains links to the growing collection of stories.

There was an 8.something quake off of Sumatra at 8:09pm PST. This is in the same fault system where a magnitude 9.0 quake caused a massive tsunami that killed hundreds of thousands of people while displacing millions more.

Like the earlier quake, this quake was also situated along an undersea ridge. Depending on the movement of the earth’s crust, this quake may also have unleashed a tsunami.

That this second quake happened was expected. Maybe not of such a great magnitude, but any given event of the magnitude of the original 9.0 quake causes enough motion within the earth’s crust that it takes a long, long time for the fault system to settle again.

And the impact is not limited to that local fault system. With the original 9.0 event, the quake was felt in the south eastern United States.

Similar events have happened before. When the New Madrid Quake of 1811-1812 hit, it caused damage on the east coast of the United States and there were strong aftershocks for nearly a year.

So, unfortunately, it looks like the Indian Ocean and the surrounding countries are at high risk for further earthquake related damages. Hopefully, the December 26th, 2004 event will have put people on alert such that the various countries can react a little more quickly.

Someone asked how I knew about the earthquake before it had hit any major news services. The USGS has a site that provides maps dotted (squared?) with global earthquake information. There are also maps for specific regions. The global page has an RSS feed.

I happened to have been reading my morning feeds via NetNewsWires about 10 minutes after the initial tremor hit.

Penny Structures

Thursday, March 17th, 2005

Someone built a series of really cool structures made entirely of pennies.

In other structural news, the gigantic ice sculpture in Alaska collapsed in the past few days. There are also some pretty weird rants regarding the state of the local news agencies included as a bonus.

Google for drinks seems appropriately random for this entry.

httpflow; tcpflow parser to help debug http

Wednesday, March 16th, 2005

I ran across this article mentioning something called httpflow and was momentarily confused as I co-authored something called httpflow at one point.

It is still useful, so a quick rehash (to update the Google cache):

A really long time ago, Ben Holt and I wrote a little python script that parses the output of tcpflow and reconstructs HTTP conversations from the raw data. Furthermore, it can easily be configured to detect and display or exclude specific headers as well as optionally squelching the body of the HTTP request/repsonses.

It was written because we were faced with a really nasty bug where certain cookies were being arbitrarily dropped. It turned out to be a bug in Apache’s mod_track.

The script is still available as a part of the sourceforge tcpflow project. I have also added it to my repository of hacques.

The original article:

Quite some time ago, Ben Holt and I wrote a useful little Python script that can parse the output of tcpflow (available in Fink as well as via just about every Linux package manager around) captured HTTP sessions and reconstitute them into actual requests and responses. We were motivated by the need to track down a handful of bugs related to Cookie handling in some WebObjects applications we were working on (turned out to be a bug in an Apache module) and the best way to do that is at the wire.

Well, of course, if you have ever captured every byte of a raw HTTP conversation, it is only slightly less painful than wading through the reams of raw data produced by simply capturing every bloody packet that goes across the pipe. Since most browsers are threaded, there was also the challenge of putting everything back into sequence.

So, we gradually added some options to the script that would allow one to filter for particular headers, turn on/off dumping of the bodies, and output to indicate which request caused a particular response to be generated.

In the end, this proved to be far easier to do than reconfiguring the machine to use some random logging/analysis proxy (which sucked at the time anyway) or otherwise disrupting our development environment.

It is a total hack and completely dependent on the format of the output of tcpflow. It has proven to be extremely useful in many situations over the years.

Recently, I wanted to capture the sequence of URLs passed from a web services client to a server.

So, this version of adds the ‘–terse’ option which will cause httpflow to emit only the GET/POST/HEAD/*method* line from the request/response. Very useful for seeing the sequence of URLs fired against a [known] server.

Example captures of searching for “fried catfish” via Google (including loading follow.


% sudo tcpflow -c -p -i en0 | ./ --terse
HTTPFlow Running (--help for usage/help)...
tcpflow[3160]: listening on en0
GET / HTTP/1.1
GET /images/logo.gif HTTP/1.1
GET /search?hl=en&ie=ISO-8859-1&q=fried+catfish&btnG=Google+Search HTTP/1.1
^Ctcpflow[3160]: terminating


% sudo tcpflow -c -p -i en0 | ./
HTTPFlow Running (--help for usage/help)...
tcpflow[3162]: listening on en0
--- begin header ---
Source: : 55937 (-unknown-)
Destination: : 80 (-unknown-)

GET / HTTP/1.1
Connection: keep-alive
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/73 (KHTML, like Gecko) Safari/73
If-Modified-Since: Wed, 30 Apr 2003 04:44:52 GMT
Accept: */*
Accept-Language: en-us, ja;q=0.33, en;q=0.67
Cookie: PREF=***secret stuff deleted***
---- end header ----

--- begin header ---
From request: GET / HTTP/1.1
Source: : 80 (-unknown-)
Destination: : 55937 (-unknown-)

HTTP/1.1 304 Not Modified
Date: Wed, 30 Apr 2003 04:45:12 GMT
Content-Type: text/html
Server: GWS/2.0
Content-Length: 0
---- end header ----

--- begin header ---
Source: : 55937 (-unknown-)
Destination: : 80 (-unknown-)

GET /search?hl=en&ie=ISO-8859-1&q=fried+catfish&btnG=Google+Search HTTP/1.1
Connection: keep-alive
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/73 (KHTML, like Gecko) Safari/73
If-Modified-Since: Wed, 30 Apr 2003 04:44:59 GMT
Accept: */*
Accept-Language: en-us, ja;q=0.33, en;q=0.67
Cookie: PREF=
---- end header ----

--- begin header ---
From request: GET /search?hl=en&ie=ISO-8859-1&q=fried+catfish&btnG=Google+Search HTTP/1.1
Source: : 80 (-unknown-)
Destination: : 55937 (-unknown-)

HTTP/1.1 200 OK
Date: Wed, 30 Apr 2003 04:45:20 GMT
Cache-control: private
Transfer-Encoding: chunked
Server: GWS/2.0
---- end header ----

Not pretty, but works well enough….

iMovie rocks!

Sunday, March 13th, 2005

Yesterday, my son played his first game of T-Ball. We, of course, took a bunch of pictures.

Instead of doing a boring old slide show, Christine decided to throw together a presentation in Keynote to tell a bit of a story.

We then exported the slides from Keynote as PNG images and imported the images into iMovie HD so we could sync the soundtrack to the slides and add a variety of transitions.

From there, the movie could be exported into iDVD to enable burning to a no-thinking-required DVD to share with the family. Better yet, the DVD also contains all of the original photos used to create the movie.

I can’t get over how easy this was to do. It just worked and was, actually, quite a bit of fun.

From the dept of silly disclaimers: PopCorn

Friday, March 11th, 2005

PopCorn is a handy little software package that makes it really easy to compress and burn non-protected DVDs down to a single sided piece of media. The PopCorn product page contains this little ditty: USE OF THIS SOFTWARE TO MAKE UNAUTHORIZED COPIES OF MOVIES AND OTHER CONTENT MAY REQUIRE THE PERMISSION OF THE COPYRIGHT OWNER.


If I were to receive permission to copy a movie or other content, how could it still be “unauthorized”?

Or is the assumption that all copies, regardless of legality or permission, are to be considered unauthorized?

Probably the latter. More sad than silly, really.

Quality: G5 LED Hack

Saturday, March 5th, 2005

Hack a Day and Make collect various random, often hardware oriented, hacks from the world over. Very cool stuff.

Every now and then, a particular hack really stands out. The kind of thing that [almost] inspires me to actually clean the damned garage and set up my hackbench. In this case, it is the G5 Clock hack.


For the quality of it. First, he/she/they used an off the shelf clock and then etched a custom circuit board to hold the LEDs in the exact spacing necessary to mount in the front panel of the G5.

When I first saw the hack, I fully expected to see a big mass o’ nasty wires behind the very clean front panel of the G5. Nope. One custom circuit board later, and he/she/they achieved one very clean hack.

Nice! It also reminded me that I need to dig out my board etching stuff. Well, replace it, more likely given that the chemicals are probably pretty funky after about a decade of improper storage.

Paper Shredding Update

Saturday, March 5th, 2005

Quite a while ago, I posted about the horrendously stupid industrial design of a Xerox shredder we owned. In that post, I mentioned that we picked up a Michael Graves shredder from Target for all of $35.

A little over 1 year later, the Graves shredder is still going strong. It has started to not shred quite so much stuff at once as it appears the blades are either dulling or have moved away from each other slightly. No complaints here as we have horribly abused the device over the last year, feeding it all kinds of plastic and types of waste it simply was not designed to consume.

Of coincidental interest, Ron Johnson was responsible for launching the Michael Graves at Target. Ron is now the senior vice president of retail at Apple and was the person in charge of the launch of the Apple stores.

Now, what do you use when you have an industrial sized shredding problem? SSI’s industrial shredders, of course. Check out the videos. This thing eats boats, washing machines and tree stumps.

I might have to explore building my own shredder. It appears that high torque, slow speed, is the way to go. Then again, a lawn mower based shredder could be pretty entertaining.

pdf2png — using Quartz to convert PDF to PNG

Saturday, March 5th, 2005

I am often taking screenshots on Mac OS X via the shortcuts that Steve describes.

And, like Steve, it bugged me that screenshots were written as PDF with no obvious means of converting them to PNG without going through Preview. At least, none that I’m aware of (which may mean nothing — I have been known to miss the obvious).

It turns out to be rather easy. Panther includes Python bindings for Quartz and Quartz includes all the API necessary to do just about anything desired with PDF, PNG and other bitmap formats.

Here is a tiny python script that takes PDF files as arguments and converts each into one or more PNG images, one page per PNG file (with appropriate numbering scheme).

It works well enough for solving the problem of converting screen shots, but seems to generate rather trashy PNG files if processing anything other than PDF based bitmaps.