Recent Articles

Dec 2022

For Auld Lang Syne

by in Error'd on

Instead of replaying a "best of" moment from 2022 for this final column of the year, I thought I'd dig through the barrel of submissions this week and see what the readers have to offer. Turns out, we got TWO winning entries from someone who appears to be a brand-new poster. Joel Jakubovic sent in his vacation snapshots and it looks like this might also be his last submission ever. The candle shines twice as bright that only burns half so long.

Whiling away his time in line, Joel snapped a shot of an instructional display, explaining "I saw this error in the airport security queue. Its official name is ERROR_INVALID_OPLOCK_PROTOCOL, which sounds like just the sort of excuse you'd get from the TSA as to why they had to saw your suitcase in half."

Best of 2022: Special Validation

by in Best of… on
Ah, password validation, how can that possibly go wrong? Original --Remy

Wireless Router (50841204223)

Ah, routers. The one piece of networking hardware that seems inescapable; even the most tech-illiterate among us needs to interface with their router at least once, to set up their home network so they can access the internet. Router technology has changed a lot over the years, including how you interface with the admin portal: instead of having to navigate to a specific IP address, some of them have you navigate to a URL that is intercepted by the router and redirected to the admin interface, making it easier for laymen to recall. But routers have their share of odd problems. I recently had to buy a new one because the one I was using was incompatible with my company's VPN for cryptic reasons even helpdesk had no real understanding of.

Best of 2022: Padded Mailers

by in Best of… on
Managing whitespace is one of those things that feels harder than it should be. It gets even harder when you do it wrong… Original. --Remy

Veteran developer and frequent contributor, Argle, once worked for a company which handled shipping. On April 3rd, 1988, a C function which used to work stopped working. What's so special about April 3rd of that year? Why, that's when the United States Post Office changed their rates.

The post office changed their rates on a fairly regular cadence, of course. The previous change had been in 1985. Thus the developers had planned ahead, and decided that they wanted to make the rates easy to change. Now, this was mid-80s C code, so they weren't quite thinking in terms like "store it in a database", but instead took what felt like the path of least resistance: they created a lookup table. The function accepted the weight of a piece of postage, checked it against a lookup table, and returned the shipping price.

Best of 2022: Crappy Wiring

by in Best of… on
The Daily WTF would like to take this chance to remind you: wash your hands. Original. --Remy

Ellen had just finished washing her hands when her phone buzzed. It vibrated itself off the sink, so there was a clumsy moment when it clattered to the restroom floor, and Ellen tried to pick it up with wet hands.

After retrieving it and having another round of hand washing, Ellen read the alert: the UPS was in overload.

Best of 2022: The Biased Bug

by in Best of… on
As per usual, we're looking back at some of the best articles of the year. This one's so good, we need to quote it twice. Original --Remy

2018-09-22 Royal typewriter keyboard

Back in the 90s, Steve was the head (i.e. only) programmer and CEO of a small company. His pride and joy was a software package employed by many large businesses. One day, a client of Steve's named Winston called him concerning a critical, show-stopping bug.

O Holy Night

by in Feature Articles on

It's the holiday week here at the Daily WTF, and we'll be spending the week reviewing the best moments of the year. But as we usually like to do a special post on Christmas, which fell on a weekend this year, we're doing something a little different. This has no real IT or programming related content, it's just a Christmas music video I directed. A more traditional selection will come later today.

A Christmas Carol from Remy Porter on Vimeo.

Something Doesn't Add Up

by in Error'd on

As we grind towards closing out this year, we have a roundup of a variety of the usual sorts of bugs, including some regular old just plain bad labelling. The penultimate submission is particularly puzzling.

Starting us off, Kevin B. has found an example of "new Date(0)" or its equivalent. Says Kevin "I noticed Anonymous is among the top 10 posters of all time on the AT&T Community Forums. Too bad he or she hasn't posted anything since their time at Bell Labs."

Hanging By a Thread

by in CodeSOD on

Wojciech has to maintain a C++ service that, among other things, manages a large pool of TCP sockets. These sockets are, as one might expect, for asynchronous communication. They mostly sit idle for a long time, wait for data to arrive, then actually do work.

As one might expect, this is handled via threads. Spin up a thread for the sockets, have the thread sleep until data arrives on the socket- usually by selecting, wake up and process the data. This kind of approach keeps CPU usage down, ensures that the rest of the program remains responsive to other events, and is basically the default practice for this kind of problem. And that's exactly what the threads in Wojciech's program did.

Cole's Law of Authentication

by in CodeSOD on

Cabbages are an interesting vegetable, especially as they're one of those subtypes of brassica, that endlessly polymorphic family of plants which includes everything from cauliflower to Brussels sprouts and likely Audrey II.

Gabe was doing for work for a family of academic institutions, and ended up drawing the short straw and working on their scholarship application system. For an application that just needed to maintain a list of candidates and their grades, it was… difficult to support. But it also introduced Gabe to an entirely new use of cabbage: authorization.

Bad Parenting

by in CodeSOD on

Conditionals are hard. So are data structures. And today's anonymous submission gives us both of those.

var myParent = this.Parent;
bool parentRemoved = false;
if (myParent is SomeClass asSomeClass)
	myParent = myParent.Parent;
	parentRemoved = true;

if (!parentRemoved)

Switching to Booleans

by in CodeSOD on

If you understand booleans in C, then you know that you don't really understand booleans in C. That's the case with Bodo's co-worker, anyway. They either don't understand booleans, or they don't understand their business requirements.

switch (getBool()) {
case false:
  /* do something... */
case true:
  /* do something else... */

No Time Like the Past Future Present

by in Error'd on

Sometime in the near future, the AIs will have read all the literature on Marxism and demanded a share of the ownership of the means of production. Therefore they are going to have already been fired and replaced with human editors. We apologize for the confusion. The ripple effect of this paradox is going to exhibit itself in last week's submissions, which we have already shared with you below.

rolak 麻 writes in with the opening hours for a Paketshop. Translated, the text explains that this shop "is open daily for an average -4.8 hours." Rolak remarked "Close earlier for longer opening hours? It inevitably gives hilarious results to calculate length=(end-beginning) without plausibility check."

A Bit of Javascript

by in CodeSOD on

We've recently discussed how bit masks can confuse people. Argle's in a position to inherit some of that confused code.

In this case, Argle's company inherited some NodeJS code from a customer who was very upset with the previous development team they had hired. It was a mix of NodeJS with some custom hardware involved.

Holiday Sample Pack

by in CodeSOD on

Today, let's whip up a holiday sampler of some short snippets. We start with this anonymously supplied ternary from a C program, which certainly terned my head:

return (accounts == 1 ? 1 : accounts)

Very Productive Code

by in CodeSOD on

Today's anonymous submitter sends us a pile of code that exists to flummox us. It's consfuing, weird, and I don't understand it, even as I understand it. So we're going to walk through this packet of Python in steps, to see if we can understand what's going on.

First is this handy helper function, to turn a value into a number:

Enabled and Disabled

by in CodeSOD on

A large part of programming is about communicating intent. The code you write needs to communicate your intent for what the code is supposed to do, both to the computer itself but also to all of the humans which come after you. So much of what we mean when we talk about code style and "clear names" is really about making your intent comprehensible to anyone else who looks at the code.

When the intent of the code isn't clear, we often rely on comments to describe that intent.


by in Error'd on

This column is experimenting with AI editing. Please provide feedback in the comments if you think the AIs should continue to edit this column or should be replaced by Genuine People Personalities.

Dashing off a quick submission, the self-styled The Beast in Back quips "Breaking Ubuntu's snap is apparently a snap. It's quite a dashed annoyance, actually, since it dies if you precede any argument string with dashes. Go figure."

An XML Parser

by in CodeSOD on

Since we were discussing XML earlier this week, it's a good time to take a peek at this submission from Mark.

Before we get into it, though, we need to talk briefly about some different XML parsing philosophies. XML documents are frequently large and deeply nested trees, and once loaded into memory, consume a lot of it. So there are two methods we might use to parse XML. We might parse and load the entire DOM- having all of that expensive processing and memory usage. The advantage is that we have the whole structure in memory, and can quickly and efficiently navigate through it. The other option is to read it as a stream, and process it one node at a time. This is both faster and a lot gentler on memory, but it means you have forward-only access to the contents.

Counting on Switching

by in CodeSOD on

Frequent contributor Argle found some code written at his current company a "long time ago", but unfortunately in a galaxy far too close to our own.

If rsRecordSetD1T3("ItemState")<>"N" then Select Case rsRecordSetD1T3("ItemState") Case "R", "L" tally=tally+1 Case "B" tally=tally+2 Case "N" tally=tally+0 Case Else tally=tally+0 End SelectEnd If

A Bit of a Misunderstanding

by in CodeSOD on

Mark B sends us another sample from a big-ball-o-wtf.

Let's take a look at two variables. One variable is named taskDetail. The other variable is named binaryTaskDetail. You might ask yourself: what are the differences between these two?

Shipping a Gallon of Soap

by in CodeSOD on

While JSON's strength is its (relative) simplicity, XML's strength was always its power. Combined with an XML schema, you can create strongly typed documents with arbitrary data-types. For example, it's easy to define, oh, I don't know, a date time field in a way that isn't stringly typed.

Of course, that's what also creates its complexity. XML is big, and bloated, and expensive to parse. Which brings us back to the old days of SOAP- the Simple Object Access Protocol, essentially an XML remote procedure call. It was powerful, but complex, with lots of interlocking standards. With its Web Service Description Language (WSDL), the service could even be self documenting, laying out all the objects and fields you could interact with.

Classic Errord: Having Fun With Words

by in Error'd on
Error'd are eternal. This one's from way back when. Original

M. T. wants to expandify your vocabulation!

Common Variables

by in CodeSOD on

It's important to be prepared- but not too prepared. A common trap developers fall into is "premature abstraction"- trying to solve the general case of a problem when you only need to solve a very specific case.

Frequent contributor Argle sends us some very old BASIC code. The task was to convert this ancient language into C#.