Recent CodeSOD

Code Snippet Of the Day (CodeSOD) features interesting and usually incorrect code snippets taken from actual production code in a commercial and/or open source software projects.

Oct 2011

Count The WTF: Conversion Go-Round

by in CodeSOD on

Dave G. writes, "I stumbled across this fairly innocent-looking line while implementing some new features:"

int _applicationId = SetApplicationId();

The Query of Despair

by in CodeSOD on

Jeroen's colleague had the misfortune of being assigned to debug an intermittent, unspecified error in the one of the oldest of the legacy applications. "The good news is that I've isolated it to a database query," he told Jeroen, "the bad news is that I've isolated it to a database query."

Knowing that his colleague wasn't a big fan of databases, Jeroen offered his assistance. In response, he received the following image.


The Suuuuuuuuuupppperrrrr Geeeeeeeeennniuuuuusssss

by in CodeSOD on

"The application I've relevantly been assigned to maintain has quite the legacy," writes Jon Beebe, "it's been around since 1997 and has gone through dozens of different hands. Some might say that the work I do to it is built on the shoulders of giants, but not me. It's built squarely on the shoulders of Walker E. Richardson, Suuuuuuuuuupppperrrrr Geeeeeeeeennniuuuuusssss."

"I know Walker E. Richardson only through his code, but still, I feel that I know him quite well. After all, his code is everywhere, and it's often prefixed with something like this.


The Jammed Killswitch

by in CodeSOD on

László van den Hoek was treated to a bit of nostalgia when his client asked him for some help. The company hired a markeiting firm to create a promotional website for them, but they were having some trouble getting it working. Although László was primarily a Java Enterprise developer, he used to do quite a bit of LAMP development in his university days, and he knew his way around PHP.

The marketing company had delivered the site with minimal documentation: essentially, and e-mail saying "the code's attached - good luck with it!" Unpacking the attached zip file into the web root gave a database error, but László recognized that the site was based Drupal and quickly figured out which file to change to get the database setup. After commeting out the development settings that were left in, adding a database user, and executing a SQL script, the error finally went away. Instead, he was greeted with...


Loopless

by in CodeSOD on

"Our company's product is designed to help analysts aggregate all sorts of different data together," Charles writes, "we take a snapshot (a zipfile of the working directory) at various times, and create a few backup versions for good measure."

"From a programming standpoint, there are a few ways I could imagine implementing this functionality. This was not one of them."


Seeking The Summoner

by in CodeSOD on

"One of our clients was having 'issues' with their mission-critical, flagship web application," writes Mark Doyle, "and of course, it was on me to fix them."

"I knew it was going to be a fun day when I saw this as the entirety of deafult.aspx. The code does absolutely nothing."