The Scent of a Woman

by in Error'd on

While Error'd and TDWTF do have an international following, and this week's offerings are truly global, we are unavoidably mired in American traditions. Tomorrow, we begin the celebration of that most-revered of all such traditions: consumerist excess. In its honor, here are a half-dozen exemplary excesses or errors, curated from around the globe. They're not necessarily bugs, per se. Some are simply samples of that other great tradition: garbage in.

Opening from Poland, Michal reported recently of a small purchase that "The estimated arrival was October 27th. But, for a not-so-small additional fee, AliExpress offered to make an extra effort and deliver it as soon as... November 3rd."


Classic WTF: When Comments go Wild

by in Feature Articles on
It's a holiday in the US, so while we're gathering with friends and family, reminiscing about old times, let's look back on the far off year of 2004, with this classic WTF. Original -- Remy

Bil Simser comments on comments ...

I'm always pleased when I see developers commenting code. It means there's something there that should be commented so the next guy will know WTF whoever wrote it was thinking. However much like any FOX special, there are times when "Comments Gone Wild". I present some production code that contains some more, err, useful comments that I've found.


Counting Arguments

by in CodeSOD on

Lucio C inherited a large WordPress install, complete with the requisite pile of custom plugins to handle all the unique problems that the company had. Problems, of course, that weren't unique at all, and probably didn't need huge custom plugins, but clearly someone liked writing custom plugins.

One of those plugins found a need to broadcast the same method invocation across a whole pile of objects. Since this is PHP, there's no guarantee of any sort of type safety, so they engineered this solution:


Templated Comments

by in CodeSOD on

Mike's company likes to make sure their code is well documented. Every important field, enumeration, method, or class has a comment explaining what it is. You can see how much easier it makes understanding this code:

/// <summary> /// Provides clear values for Templates /// </summary> public enum TemplateType { /// <summary> /// 1 /// </summary> TEMPLATE_1 = 1, /// <summary> /// 2 /// </summary> TEMPLATE_2 = 2, /// <summary> /// 3 /// </summary> TEMPLATE_3 = 3, /// <summary> /// 6 /// </summary> TEMPLATE_6 = 6, /// <summary> /// 8 /// </summary> TEMPLATE_8 = 8, /// <summary> /// 10 /// </summary> TEMPLATE_10 = 10, /// <summary> /// 12 /// </summary> TEMPLATE_12 = 12, /// <summary> /// 17 /// </summary> TEMPLATE_17 = 17, /// <summary> /// 18 /// </summary> TEMPLATE_18 = 18, /// <summary> /// 20 /// </summary> TEMPLATE_20 = 20, /// <summary> /// 32 /// </summary> TEMPLATE_32 = 32, /// <summary> /// 42 /// </summary> TEMPLATE_42 = 42, /// <summary> /// 54 /// </summary> TEMPLATE_54 = 54, /// <summary> /// 55 /// </summary> TEMPLATE_55 = 55, /// <summary> /// 57 /// </summary> TEMPLATE_57 = 57, /// <summary> /// 73 /// </summary> TEMPLATE_73 = 73, /// <summary> /// 74 /// </summary> TEMPLATE_74 = 74, /// <summary> /// 177 /// </summary> TEMPLATE_177 = 177, /// <summary> /// 189 /// </summary> TEMPLATE_189 = 189 }

A Sort of Random

by in CodeSOD on

Linda found some C# code that generates random numbers. She actually found a lot of code which does that, because the same method was copy/pasted into a half dozen places. Each of those places was a View Model object, and each of those View Models contained thousands of lines of code.

There's a lot going on here, so we'll start with some highlights. First, the method signature:


Largely middling

by in Error'd on

Jani P. relates "I ran into this appropriate CAPTCHA when filling out a lengthy, bureaucratic visa application form." (For our readers unfamiliar with the Anglo argot, "fricking" is what we call a minced oath: a substitute for a more offensive phrase. You can imagine which one - or google it.)


Efficiently Waiting

by in CodeSOD on

Alan was recently reviewing some of the scriptlets his company writes to publish their RPM installers. Some of the script quality has been… questionable in the past, so Alan wanted to do some code review.

In the uninstallation code, in the branch for AIX systems specifically, Alan found a block that needs to check that a service has successfully shut down. Since properly shutting down may take time, the check includes a pause- implemented in an unusual way.


A Binary Choice

by in Feature Articles on

As a general rule, don't invent your own file format until you have to, and even then, probably don't. But sometimes, you have to.

Tim C's company was building a format they called "generic raw format". It was solving a hard problem: they were collecting messages from a variety of organizations, in a mix of binary and plaintext, and dumping them into a flat file. Each file might contain many messages, and they needed to be able to split those messages and timestamp them correctly.


Archives