Recent Articles

Aug 2014

Netflix is Smarter than You Are

by in Error'd on

"I never thought that The Princess Diaries and The Shining had anything in common, but who am I to argue with Netflix's magic algorithms?" Neal L. wrote.


Issue History

by in Feature Articles on

Ladies and gentlemen: the story you are about to read is true. Only the names have been changed to protect the innocent. The guilty are too obtuse to recognize themselves in the story, even if their names hadn't been changed.

Playing the part of Alex in this story is you. Your current employer is a stock fund. Your current engagement: to work on FLASH, the in-house developed stock trading system. That's 'stock', the financial instrument, not 'stock', the live kind you find on farms.


The Database Gazes Also Into You

by in CodeSOD on

When Simon asked us to consider this code from his predecessor's custom-built PHP CMS, we weren't terribly impressed:

$rs = new RecordSet("SELECT * FROM moduleData WHERE moduleID = '".$moduleID."' ORDER BY displayOrder ASC");

Pittsburgh WTFers: A Storytelling Workshop

by in Announcements on

Part of what brought me into writing and editing for The Daily WTF was my love of telling stories. I’ve had a very successful career working inside of corporate IT shops, and a huge part of that success comes from my ability to take a complex technical topic and explain it simply. To do that, I fall back on the same storytelling techniques that I use here.

A lot of real-world WTFs could be avoided through better communication, and while I hate the idea of losing out on more fodder for the site, it’s my duty as an IT drone to try and stamp out WTFs.


The Data Migration

by in Feature Articles on

Consider a small European country with more than 20 social insurance institutions, each using their own proprietary software. Now consider sharing data between them. After decades of integration failures, these institutions decided to standardize on a handful of applications. One of these institutions hired Philipp’s firm to migrate their data to DB2.

Philipp’s boss gave him the assignment with a clear conscience. “They have a data transfer interface already established. This should be a quick process.”

However, Philipp’s dreams of webservices, integration end-points, clean XML, and a well organized workflow were shattered when he was handed a few examples of the COBOL-generated flat files the company currently used for data transfer, via FTP. There was no documentation regarding the schema. Philipp sat down with William, an employee at the client site who had worked with this data for the better part of a generation, and had discovered its quirks through trial and error.


An Attempt at Proper JSP

by in CodeSOD on

When developers first got access to those new-fangled gadgets called computers, memory was a very precious resource. Applications were frequently written as a main controller that would load module overlays into memory, call a function, and then repeat as additional functions were called. It was a horrible way to code, but it was all we had. Unfortunately, as computers came equipped with more and more RAM, this habit of repeating the controller code in every file seems to be quite resilient...

Fast forward several decades, and Jeremy, like the rest of us at some point, was a newbie at his first position as a developer. The application that he was tasked with maintaining had been written by an engineer whose training apparently included learning basic JSP control-structures, and how to perform cut-n-pasting of code from A to B.


Nulltastic!

by in Error'd on

"I'm kind of surprised to see these kinds of positive ratings for soundtracks that may or may not exist," writes Bobby S.


Non-Restorative Restoration

by in Feature Articles on

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.


Misguided Optimization

by in CodeSOD on

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

by in Feature Articles on

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

by in CodeSOD on

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";

The Ouroboros Request

by in Error'd on

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

by in CodeSOD on

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...


Day After Übermorgen

by in CodeSOD on

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

by in Feature Articles on

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

by in CodeSOD on

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!

by in Error'd on

"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..


Too Much of a Bad Thing

by in CodeSOD on

The question of whether you should include in-line comments in your code is a running one in the development community. To some, they are part of the process of ensuring the ongoing maintainability of a codebase. To others, comments are the spawn of satan, lower than cockroach droppings, or slightly above a Justin Bieber song.

Regardless of where you fall on this spectrum, it's reasonably certain that the following isn't considered 'acceptable'.


Schrödinger's Attendee and more Best of Emails

by in Feature Articles on

99% of terrible emails are just that. Horrible. However, there's that glimmering 1% of terrible emails that are so bad that they end up being pretty good. Here are a few of them. And, as always, remember - send us your (best) worst emails. We love them!


Schrödinger's Attendee (From Aaron S.)


Don't Speak

by in Feature Articles on

“Are you Greg?” asked the burly man with a scar from eyebrow to chin. “I’m Mark, your manager.”

Greg’s wait in the lobby ended with a jolt of fear- and possibly a broken bone or two from Mark’s handshake. An awkward elevator ride and brief tour ended at Greg’s cubicle. It was a quad- four workspaces sharing a common center. Two corners were occupied, and Mark positioned Greg at the third.
Quiet (1923809578)
“You’ll be supporting an internal application called PPP- taking over for Lenny, here.” Mark pointed toward one of the other cube-dwellers. “It already works, you just need to keep it that way. Learn the ropes here, and we’ll get you something newer and more interesting real soon. Lenny! Give Greg the PPP source code and backlog.”


The Thread Mismanager

by in CodeSOD on

We've all heard of threads. No, not the stuff hanging loosely from your clothes. I mean threads, as in multitasking. Most modern languages have all sorts of nifty facilities that allow you to create, manipulate and destroy them at will and with minimal effort. There are even abstractions that will manage a set of threads for you, so that you can spawn a bunch of tasks, and let them tell you when they're done. You can synchronize them yourself. You can put up cyclic barriers to make them all wait at a specific point in the code. You can make them return a value when they're done. Or you can just spawn them and let them run all by their lonesome. Of course, not everyone trusts the built-in facilities... Now you might expect this sort of thing from Joe Offshore, but not from certain huge, blue companies.

Baron inherited something written by such a huge, blue company. Basically, it monitors a database, does some work for each changed record and then deletes the record from the database. Unfortunately, this little beast suffers from horrific performance problems and requires frequent server reboots to get things running again.


nullnull, nullnullnull, and null

by in Error'd on

"Wow! The IEEE takes privacy so seriously that they redacted the entire table of contents!" Jeremy R. wrote.