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

December 2012

Jan 13 »
C is a double edged sword. On one hand, it's simple and powerful enough that, given enough effort, you can accomplish just about anything you want. However, this power is limited insomuch that you don't have many of the friendly helper-functions that exist in higher level languages, such as string manipulation for example, unless you go ahead and create them yourself.

Ancestors

2012-12-17
It’s important to have an understanding of genealogy; it can give you a connection to history. Even in code, we find a need to connect with our parents and their ancestors.

Time Flies

2012-12-12
Alan's supervisor forwarded him a curious ticket - a recently hired employee was training on how to use the customer profile web page and the new user felt that that the countdown timer on the page wasn't behaving quite right.

One Version

2012-12-10
Brian browsed the most recent check-in by the lead architect, and noticed that it referenced a file called TagFile.java, which didn’t actually exist. A quick search of source control showed that pretty much every project had its own version of this file. They were all basically identical, aside from the values in the static initializers:

A Bit Misguided

2012-12-04
It’s hard to get too far as a programmer without dealing with bit-masks at some point in your career. Barry’s co-worker made sure to build a nice, easily re-usable block of code to help with that. This simple block can simply be copy-pasted anywhere bit-masks are used. And it is.