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.

Dec 2009

SQL Error 191: Nested Way Too F#%&ing Deeply

by in CodeSOD on

There are a few interesting things in software development that you’ll generally only learn about by working on “certain” types of applications. Take, for example, the HTTP 414 “Way Too F#%&ing Long” response: there’s no standardized upper limit and many web servers don’t even document how long GET requests may be.

While working with his company's service desk application, Ben noticed a similar type of error message come from SQL Server.


The Do Not Click Button

by in CodeSOD on

“My company has an enormous, in-house built network management application that has every conceivable feature,” Matthew E wrote. “It has everything and does anything that you can imagine... including nothing. And it accomplishes the latter feature with a small-but-conspicuous button labeled Do Not Click.”

“Following is an excerpt from the several-thousand-line include-file that forms the bulk of each page load.”


Amazingly Brilliant or Incredibly Stupid

by in CodeSOD on

When it comes to clever coding, there’s a fine line between amazingly brilliant and incredibly stupid. Take DocumentDotWrite.js, for example. It's a single-line JavaScript file that’s served (http://rmd.atdmt.com/tl/DocumentDotWrite.js) seemingly all the time by Microsoft’s Atlas advertising platform.

function DocumentDotWrite(s){document.write(s);}

Thank You for Enabling JavaScript!

by in CodeSOD on

Clean data makes me smile.

No really! When I have a finite number of brain cycles to dedicate to some process that receives user data, it makes me quite the happy guy knowing that it has been pre-scrubbed for such nasties as newline characters, the occasional , or worse, the dreaded ಠ_ಠ.


A Spacy Problem

by in CodeSOD on

Like most of his past jobs, Don R started at a new company with high hopes and low expectations. And also like many of his past jobs, his dreams were quickly whisked away. This time, it happened on his first support ticket.

"This'll be an easy one," his programmer-turned-manager boss said, "this used to happen quite a bit, and I've fixed it a few times. Sometimes we'll get descriptions with extra spaces, and when we send a datafeed to the processing company, it can mess up their systems. But I'm sure you'll be able to figure it out, it's in the clean-up routines."


The "Who Knows?" Code

by in CodeSOD on

When Vladimir first received his orders, the blood drained from his face. He was to take the legacy VB5 application, a system used daily by scores of users daily, and uplift it to C++.

After reviewing a few parts of the application, things began looking hopeless, however there was some good news! Vladimir had a department full of developers at his disposal and most of them had a hand in the creating and maintenance of the application.