Sunday, May 4, 2008
Lol
Wednesday, April 23, 2008
Bug: Facebook Advertising Application

and here is step three after a few clicks (select all users with relationship status):

What is the difference you may ask? In the second panel the user has selected each relationship status and according to the "people" count in the top of the page, the site is losing advertising reach of 1 million users.
EDIT: I changed this post as I didn't like the tone of it.
Thursday, April 17, 2008
The sweetest thing
I was trying to find a bug in a binary tree and the problem would not manifest itself immediately. The code worked for a seemingly arbitrary period of time, but at a depth of N a get out clause needed to be true and it wasn't. Therefore it kept on recursing until it either could not create any more branch-nodes or it generated a stack-overflow.
I attempted to step through my code trying to find my bug, but I find it hard to debug recursive code. You’re never too sure how deep you need to go before the problem manifests. After missing the bug I pondered how I could represent the tree to find the bug. One of the things I have been teaching myself to do of late, is when I have a hard to reproduce bug, ask myself the question "How can I best model my data to visualise the bug?". It is not quite changing my work practices to stop bugs before they occur, but it really helps once they do manifest.
XML came to my rescue. I added a dump routine that iterated the tree dumping it out in well formed xml. I then used Notepad++ to display the xml with indenting and the bug was immediately visible.
So the moral of the story is: I love xml and am glad somebody else thought of it a long time ago. It’s a sweet way to visualise certain types of data and with the assistance of text indentation it is even better.
Just so you don’t think I’m blinded by xml-lust: Xml for network messaging formats is still a bad idea. Seriously, any format where you spend 50% of your bandwidth describing the data being sent is wasteful.
p.s. I am aware that this is a bit of an odd post.
Wednesday, February 27, 2008
An unusual bug
I gave a deploy of a test application to a friend the other day to test. Whenever he ran the application it would shutdown (not crash) almost immediately. The logs reported no issues and the very same deploy works on every other computer I tried and as a matter of fact this runtime code works on just about every platform I have tried to date. Just not his.
I created a debug build, turned on every scrap of instrumentation I have and sent it back to my friend. Nothing in the instrumentation logs. No exceptions, no errors being thrown. Standard execution paths, it shuts down early, but gracefully.
I went around to my friends place and checked out the code base, installed visual studio and built the lot from scratch on his machine. Still no luck, so I traced through every step the program makes before it shuts down and found the "problem" or more accurately the cause.
The application is receiving a WM_QUIT message before it should. It handles it appropriately and performs the standard shutdown. Now the user did not close the application and no exceptions were thrown so I am at a bit of a loss why the message was added to my application pump.
The only thing I can think of is a personal firewall application has its heart set on blocking my application. So I checked that and there was a few installed. So I uninstalled them and killed any dormant processes that were left lying around (don't get me started on how offensively intrusive virus scanners and software firewalls are, the only reason they work is because there are no system resources left for the user to use their system let alone install a virus).
Back to my story, fresh reboot and no processes running on the OS that I didn't want (the OS happens to be Windows Home SP2). No windows firewall, no random process, just a bare-bones execution. Ran my test application (in debug mode again) and the same problem occurred. Now I really don't know why the quit message is being sent.
So far the interwub has borne no answers on this problem, the code is lightweight, vanilla win32 and the only major difference I can think of on this box is that it is running XP Home rather than XP Pro. I have an XP Home CD around here somewhere that came with my laptop. While I do remember testing this code on XP Home previously, it has been a while.
If it also fails on my XP Home install then that is the problem (no solution though). If it doesn't then I suspect I'll be slowly deconstructing the application until the solution reveals itself. As painful as all this will be, it's a boon in some regards (not enough to make it fun though). There is a problem somewhere and I am just glad it came up in test rather than in prod.
