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.
« Sep 12

October 2012

Nov 12 »

Real Security

Emmett had been contracted to maintain the curb appeal of The Website of Judy S. Kirkland (#1 Realtor in Townhouse Resales in the Upper Eastern Greater Metro Area, February 2009).

Blame Peter

We’ve all had the moment when we search for an answer to a technical question and our search engine suggests a trip to Er, And when we realize that they expect us to pay to see the answer, our instincts take over- we scrub our way through the page source hoping to see a way around the paywall.
"If I told you that I work for a primarily Microsoft coding shop that hires on non-Microsoft developers, you'd think that it would be an unending, seething mass of WTF code," writes Hank, "but really, it isn't."
Some code demands a little breathing room. Phil found this block of C#, which makes sure it has plenty of space to do its work.

The White Flag

Handling dates is hard. Kevin sends us this attempt at building it from scratch, found in a third-party library. It was shaped with a Tab key that wishes nightly for death.

Ask the Index

Different tasks call for different conventions. At least, that’s the excuse some people use for switching between 0-based and 1-based array indexes. That still doesn’t explain why Phillip’s co-worker did this.

The GNDN Protocol

The sort of software that’s used for research is the sort of software designed by engineers, not developers. With tight deadlines, corners get cut. This creates software that supports more shell injections, sql injections, and venous injections than useful functions. That’s bad, but all too common. This block that Koen found, on the other hand, is special.

Known Bad Code

Juho was skimming around code, searching for a bug, when saw the following PHP code. In my opinion, its purpose was probably as a workaround for a bug in MySQL 5.0. I mean, I hope it was.


There are a large number of programming problems that involve the use of matrices and linear algebra. And when you have a matrix, there may be times where you need to know its determinant. For calculating the determinant of a 2x2, or a 3x3 matrix, there’s a fairly straightforward formula. On the other hand, if you need a generic solution for a matrix of any size, you have to get a little more complicated.
« Sep 12

October 2012

Nov 12 »