This is the second article in a twelve-part series that discusses the twelve finalists and their calculator submissions for the OMGWTF Programming Contest. The entries are being presented in the order submitted, and the winner will be announced on June 18, 2007.

It should come as no surprise that, after asking the WTF community to build a fairly useless calculator application on an operating system that already has a perfectly good, built-in calculator, there were some pretty interesting cases of code reuse. Or, more accurately, “application reuse.” Out of all of the “Window’s Calculator” wrappers, none were quite as spectacular as Entry #100066, or Dan U’s FileSystemHashMapNotepadCalculator. Let’s take a look at it in action (make sure you have Flash enabled):


In case you missed that, the FileSystemHashMapNotepadCalculator calculation engine works by loading Windows Calculator (how else could one guarantee a correct calculation?), copying the answer to the Clipboard, loading notepad, pasting it into notepad, saving a file to the folder with the appropriate Hash Key (C:\1.0000-ADD-2.0000 in this case), and then reading the resulting file to display the answer. It couldn’t be simpler!

If you want to see this first hand, go ahead and download and run the executable. It’s safe and pretty fun to see. Once you initiate a non-cached calculation, be careful not to change focus, move the mouse, or really, do anything but sit back and wait 10-14 seconds. Oh, and you may want to delete the directories afterwards. Or, keep them around for fast, future calculations.

I asked Dan how and why he came up with the concept:

Well, when the contest said calculator, I knew that I didn’t want to waste any brain cells writing math code. There’s a perfectly good built-in calculator for that stuff! I wanted my application to perform as fast as possible, so I decided on using a construct I thought up called the FileSystemHashMap. The only real challenge was getting Calc.exe to save its result to a file. Thankfully, Notepad.exe does a great job at handling that task.
Difficulty Viewing? Direct Link to SWF

As for Dan’s background:

I got my start in QBasic (too bad we couldn’t have used that for the contest!) back in 7th or 8th grade and kept coding all the way through college at the University of Idaho. It was slightly less in the middle of nowhere than my hometown of Orofino, ID. These days I’m working for TopCoder, Inc. as a Deployment Engineer.

And the answer I'm sure you all are dying to know: would Dan replace calc.exe on Windows with his calculator?

hmmm... That would put my calculator into a never-ending recursive loop, wouldn't it?

Download Entry #100066, FileSystemHashMapNotepadCalculator (ZIP File)