This is the fifth 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.


All Real Applications these days have a few things in common: a Client/Server Model, a Web 2.0 Interface, and good amount of outsourcing. Entry #100123 - Dave C.'s WTF Web Calc - managed to accomplish that with an impressively minimalistic approach.

Being that goal of this contest was to create a desktop calculator, it took a bit of creativity on Dave's part to make it Web 2.0-y and meet the submission guidelines. When the WTF Web Calc is launched, it starts up a "web server" and then opens up a FireFox browser pointed to http://localhost:12345. When the user presses a calculator button, an AJAX call (XmlHttpRequest) is sent to the web server, which builds up an expression that gets submitted to Google when the "=" button is pressed. Dynamically generated Javascript is returned to the client and then executed to update the display.

There's not a whole lot to show off with Dave's code: it's compact (weighing in at around 350 lines of code) and well written. It is written entirely in C and uses no third-party libraries (Dave provided an old "netutil" library wrote back around 1996). And if you knew Dave, that'd probably come as no surprise.

Dave has been programming since age six, starting with BASIC on a TI99/4A. Not quite sure what kind of program one would write at six, but surely it would be less advanced than my first program, circa ten years old:

10 PRINT "ALEX IS COOL"
20 GOTO 10

Dave moved on to program C on an Amiga in his early teens and then into Unix, Linux, and, eventually, the Internet. His first “paid” programming job was for an Internet provider in the early 90’s, where he developed a text editor in VAX/VMS BASIC, and attended Worcester Polytechnic Institute shortly thereafter.

This was Dave’s first very web server. As for whether or not he’d replace Windows Calculator with the WTF Web Calc…

Definitely! Perhaps it would be an incentive for Microsoft to include Firefox with Windows? ;)

Download Entry #100123, WTF Web Calc (ZIP File)