Jeremy’s employer, SwissMedia, were upgrading their proprietary CMS to run on new, shiny, PHP5. They planned for bumps in the road, but assembled a rugged upgrade plan with a steel chassis. When the time came to upgrade their largest client, French-Haitian News, Jeremy was behind the wheel.

The first step in the plan was for Jeremy to take a copy of their production database that he could experiment with and work out the kinks. He would then prove it worked with the PHP5 application, and get the stamp of approval to go to production. SwissMedia outsourced their data storage, so he contacted Sebastien at Datamaniaks to handle that part.

Somewhere between getting the data and making it work with the PHP5 application, Jeremy committed the dreaded “forgotten WHERE clause” boner. His local copy of the French-Haitian News DB became unusable. He immediately reached out to Sebastien to help remedy the situation.

States and their abbreviations are among my favorite kinds of data - they almost never ever change and, as such, you can hard code all that information into your app. I mean, why bother fetching it from the database every page load? That's just wasted CPU cycles.

So, I can find merit in the hard-coded approach that the below code takes that Alex E. sent our way. However, I definitely believe that it takes guts for anybody to make a claim about the efficiency of strcmp() when you perform a linear search on an ordered list.

Inheritance

2014-08-19

In life, you will inherit all sorts of things: traits from your direct ancestors, knick-knacks from relatives you tolerated, and sometimes, even money! Of course, there are other things in life that you inherit that you might not even want. The gene for some debilitating disease. The urn filled with the ashes of a relative you particularly despised. Code.

Gerhardt was employed at a C++ shop. Their main product used a third party library. Perhaps used is not quite right; abused is more apt. Every single field that was public (whether it looked like it should be public or not) was ab/used to the max.

The Constant Bomb

2014-08-18

On one hand, this Java class Jim found is just another instance where somebody made constants like this:

	public static final String NO_SPACE = "";
	public static final String SINGLE_SPACE = " ";
	public static final String DOUBLE_SPACE = "  ";
	public static final String ZERO = "0";
	public static final String FLAG_Y = "Y";
	public static final String FLAG_N = "N";

Rob wrote, "I was trying to raise a service request for an Office 365 issue but the service request functionality was broken. I could of course try and report this... by raising a service request."

Securing Input

2014-08-14

We all know that many developers have difficulty in dealing with built-in concepts like dates and times, and that for and switch statements don't necessarily have to be used with each other. However, validating a piece of input is usually more straightforward. You compare what you got to what was expected.

Mathieu was tasked with migrating some Groovy scripts. While the technical migration was fairly easy, he found it necessary to rewrite certain portions of the input validation routines. For example, the task of validating the month portion of a date string seemed straightforward enough...

While working on his company's reservation manager, Stephaan stumbled upon some PHP code that calculated the date values for tomorrow ($morgen) and the day after tomorrow ($ubermorgen). Something about the code struck him as ... wrong.

``` // FORMAT DATE // detect this day and this month (without 0) $today = date("j") ; $thismonth = date("n") ; $manyday = date("t") ;

Nuclear Internship

2014-08-12

Before he could graduate, Grigori’s Russian university program required him to complete a large-scale, real-world project. Like most of his peers, he planned to use this as an opportunity for job experience, which meant partnering with an outside company. Since Grigori did low-level development and microelectronic engineering, he found a paid internship position with the Russian Automation Institute. RAI has one major client: the company responsible for managing Russia’s nuclear reactors and supply parts for nuclear weapons.

Before Grigori could start working, his soon-to-be mentor assigned him a “test”. “Before you begin, you must implement this conversion.” The conversion in question was to turn IEEE754 floating points into a “secret” format. The spec document was a three column spreadsheet- a floating point number, a binary32 floating point number, and the “secret” format.
From wikimedia commons: http://commons.wikimedia.org/wiki/File:Haigerloch-nuclear-reactor.JPG “Can I have more details?” Grigori asked Aleksandr. “Is there any documentation about the format?”

Literal Scripting

2014-08-11

The HR team at Initrode were a happy bunch, casting their nets into the perpetual stream of eager undergrads from nearby WTF U. It was a summer tradition at Initrode to invite a school of juniors to get a taste of their future by spending the long, sun-drenched afternoons of their dwindling youth hunched in cubicles.

Chris was on the Dev Tools Team at Initrode, building widgets and gizmos to help his fellow developers be more productive. Since few of his colleagues were willing to unleash students on production code, the duds among the summer-student pool tended to end up on Chris's team. And that's why the intern at the center of this SOD bears the pseudonym Dudley.

Welcome to Word!

2014-08-08

"The first time I started up Word 2013, it offered to give me a tour. Upon reflection, this probably is a pretty accurate tour," writes Matt M..

View Article Archives >>