My Journey to Programmer.

I grew up in small town New Zealand. I was a geek from an early age.

At the tender age of 10 years my first experience of “programming” was typing out “huge” BASIC programs from old magazines into my Atari 800XL’s BASIC interpreter. At the time I didn’t know what I was doing. I just wanted to play the games described in the magazine. They sounded great, but they rarely worked. My first “debugging” experience was pouring over long dot matrix print-outs of these programs comparing them line by line with the original magazine source code and correcting my typos.

After years of playing video games on my Atari, Sega and then PC, I decided I wanted to learn how these magical things were made. Being pre-Internet at the time, I had very little access to information about how computer software was made.

I came upon the idea of asking Sierra Online, my favourite games company at the time, for help. I did this by sending many letters and faxes to Sierra customer support. Every time I just got back a standard “thanks for being a fan” form letter.

Undeterred, I tried again and again. Eventually deciding I should address the letter to an actual programmer at Sierra. I found the name of the Lead Programmer from the credits of one of my favourite Sierra games and addressed my letter directly to him. I even stamped it “confidential” in bold red lettering with one of my mum’s office stamps.

I got a response! Not from the programmer I had addressed my letter to, but his replacement.

I thank that now forgotten programmer from the bottom of my heart for answering my letter. In his long and detailed response he told me exactly what I needed to know. Learn C/C++ or Pascal.

By reading magazines I went about discovering what these mysterious things were. I learned that I needed a compiler and a book to teach me how to use it.

At 15 years of age I began saving my paper route money as fast so that I could buy Borland C++ 3.1 and the book Mastering Borland C++ by Tom Swan. Even at the academic discount, it required a whopping $600. Not exactly chump change for a teenager in the early 90’s. After months of saving I had my treasure in my hands. Only then did I discover my lowly 286 couldn’t run the compiler. Oh the heartbreak.

So after further furious flogging of my cherished video games, consoles, and even my existing 286 I could afford to buy (with more than a little parental help) a brand spanking new 486SX with 4MB of memory and a 512MB Hard Disk. Four thousand dollars down on some flash new gear so I could run my expensive new compiler.

In Tom Swan’s gentle care I ventured forth into the uncharted territory that was C++. I’ve never looked back.

Apple’s mod_bonjour is broken in Snow Leopard, so I fixed it.

I was playing about with Apache on my iMac and I noticed a little file tucked away in /etc/apache2/other called bonjour.conf.  Intrigued I set about figuring out what it was for.

This file had some directives relating to an Apache module called mod_bonjour.  The purpose of which is to register URLs with Apple’s Boujour service.  This service lets systems and services publish their existence on a local area network so other systems and applications can find them without configuration.  Boujour is just Apple’s marketing speak for Zeroconf style networking.  It is also known as multicast DNS and is common on Linux and Apple systems.

Safari on MacOS even has a Bonjour menu that displays services or devices that are advertising themselves via the Bonjour service.  An example of this is my QNAP NAS.  I can always easily access the Admin interface of my NAS (and other services the NAS provides) because it advertises itself with Bonjour.

I thought that using Bonjour would be rather handy for advertising some web applications I had configured on my iMac to other systems on my home network.  So I added them to the bonjour.conf configuration file like so:

RegisterUserSite customized-users
RegisterResource “Confluence” “/confluence”
RegisterResource “TeamCity” “/teamcity”

Unfortunately after restarting Apache I was dismayed to discover that only the last RegisterResource directive seemed to be working (TeamCity), as it was the only resource showing up in the Bonjour menu in Safari.

However after a quick search for mod_bonjour with Google I discovered two posts detailing the problem.  There is a bug in mod_bonjour.

Joe Maller found the bug and supposedly reported it to Apple in 2007, and Chuck Houpt even created and released a patch for the Leopard release of Mac OS X.

Now I’m running Snow Leopard so I didn’t want to just use the patched binary Chuck provided, so I set about patching the Snow Leopard version of this module.  Fortunately Apple provide the source code to this module on their open source site.  So I took what appears to be the code from Snow Leopard, applied Chuck’s patch and produced a version for Snow Leopard.

In order to share this updated code with the wider Internet I’ve created a GitHub code repository for it.  In order to build this code and update your Mac you will need the Apple Developer Tools installed.

Is Iron Man made of Lego?

I was re-watching Iron Man recently and noticed something interesting.  During Iron Man’s first “boot up sequence”, in the “terrorist” caves of Nowhereistan, some butchered C code is displayed on a faked up laptop screen.

C source code from Iron Man Movie

The code displayed on screen, although missing some syntactically important characters such as semi-colons, is actual valid C source code.  So valid in fact that I wondered where it came from.

After a quick Google I found it. This code is in fact as follows:

    send[0] = 0x65;
    send[1] = 1;
    send[2] = 3;
    send[3] = 5;
    send[4] = 7;
    send[5] = 11;

    if (rcx_sendrecv(fd, send, 6, recv, 1, 50, RETRIES, use_comp) != 1) {
	fprintf(stderr, "%s: delete firmware failed\n", progname);

    /* Start firmware download */
    send[0] = 0x75;
    send[1] = (start >> 0) & 0xff;
    send[2] = (start >> 8) & 0xff;
    send[3] = (cksum >> 0) & 0xff;
    send[4] = (cksum >> 8) & 0xff;
    send[5] = 0;

    if (rcx_sendrecv(fd, send, 6, recv, 2, 50, RETRIES, use_comp) != 2) {
	fprintf(stderr, "%s: start firmware download failed\n", progname);

    /* Transfer data */
    addr = 0;
    index = 1;
    for (addr = 0, index = 1; addr < len; addr += size, index++) {

The code above comes from a firmware downloader for the RCX (a programmable, microcontroller-based Lego brick), written in 1998 at Stanford University by Kekoa Proudfoot. You can get the full source file here and it is distributed under the Mozilla Public License.  This is the same license used by Firefox and many other Open Source software products.

The sequence in the film in which this code appears suggests that the code is either being downloaded as firmware to the Iron Man suit or being used to upload firmware to an RCX Lego brick that is somehow involved in the operation of Iron Man.

So it appears that Iron Man is either powered by Open Source software or made of Lego.  I’m not sure which is cooler.

MSBuild, assembly dependencies and the GAC

Today, while doing some .Net development I noticed something about MSBuild that is really annoying.  I’ve seen his before but didn’t know the reason behind it.  Now I do and it is a little frustrating.

If you have assembly A that depends on assembly B that depends on assembly C and assembly C exists in the GAC (Global Assembly Cache).  When assembly B is copied into assembly A’s “bin” directory during build, assembly C is not copied, even if you specify that assembly C is a “private” (copy local) dependency of assembly B.

The problem is that by default MSBuild’s ResolveAssemblyReference task will not copy referenced assemblies that are in the GAC to the build output directory unless the referenced assembly is specifically tagged as “private” by the build project being built.

So even though assembly A doesn’t directly reference assembly C in its code, it only uses C through the intermediate dependency B, you still need to add C to A’s referenced assemblies set for C to be copied into the build output of A.

There is a discussion of this issue here, on Microsoft’s developer forums.

Telestream Screenflow e-Commerce FAIL & Twitter

Screenflow LogoRecently I had a need to create a screencast to help my father learn how to use his new Mac. I’d seen Telestream Screenflow used in the past and from that, and a little play with the trial version, I decided I’d purchase the app for my Mac.

Although Screenflow is a bit expensive at 99USD, it has a lot of cool features, so I was all prepped and waving my credit card around ready to buy. Unfortunately when I went to Telestream’s eSellerate powered store it didn’t even list the application for sale.

Epic sales FAIL.

The chaps at Telestream however had made the smart decision to list their Twitter name on their site (@screenflow). So I tweeted a little note about how their store was broken when I had wanted to buy and that they had lost a sale.

I then went on to use Snapz Pro X, which I already own, to make my little screencast.

The next day, @screenflow tweeted me a little direct message asking for my email address, which I provided. Lo-and-behold, in response they send me a coupon code for a 100% discount for my troubles. Nice.

Thanks Telestream, that’s what I call customer service.

Programmer Humour.


How do I update controls on my UI thread from the Asyncronous Delegate? I understand it’s not safe to just try to update it directly from the asynchronous thread, but I need to figure out how to update it somehow. Specifically I need to increment a ProgressBar and update text in a Label.

Michael C.


My name is Tyrone Hernandez. I grew up on the streets, so I’m familiar with this kind of shiznit. I am down with this, and I’m going to keep it real by top-posting.

In my hood, I have a homie named Shaniqua and some times she calls me on the phone in an asynchronous fashion. Now I’m hip to her jive, so I don’t wanna just hang up. If I feels like talkin to Shaniqua, I talk to her. If not, I use my power of “Control” to check “IsInvokeRequired” and if it is, I call Control.BeginInvoke() to upgrade my progress bar.

Well, I’d be likin’ to talk more, but my crack dealer is here so I’m going to call some of his methods. Peace out!

Made me laugh. And he’s correct. Found, here.

Blast from the past.

While saving a document in Word 2003 the other day, my colleague Phil witnessed Word spit the dummy and display this dialog.

Format what?
Format what?

It appears to be some sort of vestigial error dialog from Word 6.0 for Windows 3.1.  Check out the awesome ASCII art bullet points and encouragement to format another floppy disk.

Sure I’ll just whip out and pop in a 3.5″ floppy and do that right away.