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

October 2012

Nov 12 »

Real Security

2012-10-31
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

2012-10-29
We’ve all had the moment when we search for an answer to a technical question and our search engine suggests a trip to ExpertSexchange.com. Er, ExpertsExchange.com. 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

2012-10-17
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

2012-10-15
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

2012-10-08
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

2012-10-03
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.

Determined

2012-10-01
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 »