Recent Articles

Apr 2022

Time is Time in Time and Your Time

by in Error'd on

Shocked sharer Rob J. blurts "I feel like that voltage is a tad high."


Counting References

by in CodeSOD on

If you're working in a research field, references matter- specifically, the citations made by your paper and the citations eventually made against yours. But when programming, references can be hard.
Dorothy is a scientist, and understands that code itself is a valuable artifact- it's not enough to just to get the solution, but the code itself needs to be maintanable and readable. So when her peers get into trouble, they frequently come to Dorothy to figure out why.

This Java code is one such example:


Never Don't Stop Not Doing This

by in CodeSOD on

It's not nothing to never write confusing English. And it doesn't never influence the code that we write. Don't fail to look at this anti-pattern from today's un-named submitter.

If Not port Is Nothing Then portUnAvailable = False End If

A Slice of Spam

by in Feature Articles on

In addition to being a developer, Beatrix W manages a few small email servers, which means she sometimes needs to evaluate the kinds of messages arriving and their origins, especially when they're suspicious. One such suspicious message arrived, complete with a few malicious links, and some hints of possibly being the start of a spear-phishing attack.

That was concerning, and as it turns out, the email came through a vendor who specializes in sending marketing emails- but the requested sort (or at least the sort where you got confused about which box to uncheck at checkout and accidentially signed yourself up for a newsletter). So Beatrix tracked down the contact form on the company website.


Confessions of a Deep Copy

by in CodeSOD on

While JavaScript (and TypeScript) may have conquered the world, those languages have… unusual conventions relative to some lower level languages you might encounter. I recently was having a debate with a C-guru, who lamented all the abstractions and promised that well written C-code would forever be faster, more compact, and easier to read that the equivalent code in a higher level language.

That may or may not be true (it's not), but I understand his point of view.


Horned Megafauna

by in Error'd on

While we don't know the precise taxonomy of the fabled dilemma, this week's submissions include a few wild examples.

Jon has captured a classic sample of the anticancelling cancel, reporting "While bulk-deleting files from an S3 bucket, Amazon dangled a carrot in front of me only to cruelly whip it away at the last moment."


Keeping Things Simple

by in Feature Articles on

1 Queue

Sandra from Initrovent, previously featured here on the site, has finally left that job, finding herself at InitAg instead. InitAg is a small agricultural tech startup, a little rough around the edges for a data science company, but overall functional. With one notable exception: The customer portal.


Optimized Database Access Patterns for Dummies

by in Feature Articles on

Initech sold some expensive devices which supported location tracking. Their customers wanted to track the location of these devices, with full history of all previous locations, down to five minute increments.

When Eurydice F joined the team, she understood that it would be a lot of data to manage. She was an experienced DBA, and had all sorts of ideas about how you might partition the database to make that scale of data manageable, and the ways you would index it to make access and retrieval efficient.


The Squawk Card

by in Feature Articles on

Article-Feedback-Post-Your-Comment-No-Thanks

In 1981, Mark was hired at a company that produced minicomputers widely used in retail establishments and small/medium businesses. On the first day, Roger gave him a tour of the plant and introduced him to his new coworkers. After shaking hands and parting ways with Walt, the Manufacturing QA manager, Roger beckoned Mark to lean in close with an impish smirk.


Classic WTF: Scratch One Inevitability

by in Feature Articles on
Since this weekend was a holiday, and today is Tax Day in the US, we're reaching back into the archives for this classic that fits the theme. Original -- Remy

Before Curtis even got to sit down at his desk, he was accosted by a frenzied, sweating junior developer. "OhmygodCurtis," he began. Curtis extended his hand in a "calm the hell down" gesture and allowed him to continue. "A whole bunch of our stores had no data posted last night and I'm not sure why orwhat to doabout it or whoIshouldtalktoand-" Curtis gestured again, to which the developer handed him a thin stack of papers. After a deep breath, the developer continued. "It's a list of the stores that didn't post last night."

The stores in question were part of what we'll call Hewitt & Liberty Block – a reasonably large tax preparation company serving a handful of states with over 2,000 retail locations. Each of the locations was set up to post tax data and sales records to the central computer at the main facility. According to Curtis's list of stores that hadn't posted any data, it was nearly 1/4. It was going to be a long day.


Trauma Bonding

by in Error'd on

During this, America's national season of shared trauma, our regular contributor Mr. Bargle shares a bit of levity which may lighten your mood ever so slightly.

Argle Bargle explains

"My girlfriend is Thai. She speaks English, but not on an advanced level, so when we chat, I typically translate to Thai. I learned long ago to reverse the translation to make sure the translation says what I meant. My girlfriend took a leave of absence from her research position to be an entrepreneur. April 13-15 is the holiday of Songkran: Thailand's New Year celebration. She said she would too busy to chat with me until the 15th. I mentioned that the 15th is America's tax day. As a precaution, I translated it and then reversed. The attached image is clearly not an error, but it's a helluva WTF. On the left is LOL... tax day in the USA in Thai. On the right is.... OMG."

Anti-Injection

by in CodeSOD on

SQL injection attacks are, in most environments, easy to avoid. Pass user input through parameterized commands and never do any string munging to build your SQL queries. And yet, we constantly see places where people fail to do this correctly.

Eric's co-worker is one of "those" people. They were aware of what SQL injection was, and why it was a risk, but instead of using PHP's built-in functionality for avoiding it, they reinvented the wheel- now in a triangular shape!


A Careless Comment

by in CodeSOD on

Today is a short hit, as there's a comment I want to highlight. This comes to us from Benjamin Urquhart. It's his comment, it's his code, and it's his confession.

// See #ISSUE // This is not the place to monkey patch this // issue, but it's like 2am and quite frankly // I don't care anymore.

Modus Pwned

by in CodeSOD on

Conditionals are a constant source of problems for some developers. Russell F inherited some code which needed to take a list of parts and filter the list of parts down to something which customers could actually order.

The specific rule was that they needed to include only parts that were: not in stock and not in close out, in stock and not in close out, or in close out but also available. Which, given that business rule, that's exactly what the developer implemented:


Starting Your Date

by in CodeSOD on

So much bad date-handling code is based in people reinventing methods that already exist, badly. That's code that solves a problem people have, that's already solved. But the really special code solves a problem nobody understands or wants solved.

Take this C# function from Luke's co-worker.


Time is Fleeting

by in Error'd on

It's astounding...

The madness took its toll on Chris N. who highlighted Monday "Your Microsoft Teams is out of date! This is after pressing Calendar."


Valuable Comments

by in CodeSOD on

When we share code comments, it's usually because they demonstrate some lack of awareness or some carelessness about what's going on. A comment warning "I know I shouldn't do this" or a comment that contradicts the code in a funny way, that's usually what we share.

But today's submission, from Dewey, is a bit different. Dewey wrote the comment, and it was in preparation for some serious refactoring. So this comment is the product of someone spending time to accurately analyze and understand a method, documenting its behavior, and explaining it so the code could be changed to something better. The WTF here isn't the comment, but the code it describes.


Old File

by in CodeSOD on

Let's say you've got an older PHP application. Once upon a time, it was wired together by a pile of includes with no real organization or planning behind the organization. A developer went through and cleaned up the file organization.

That's a happy ending, isn't it? No, it isn't, not for Scott. Because the developer doing the cleanup didn't want to risk breaking any files, and thus didn't actually do any final cleanup. Instead, in the labirynth of a thousand include files, many of them are dead ends containing only:


Playing a Role

by in Feature Articles on

Initech's latest offering, IniPrints, was a secure automation system for document management. The target audience was the banking industry, which meant that the system was sold as having robust and fine-grained role-based access control systems. As far as any one could tell, that was exactly what Initech was shipping, which meant IniPrints gained a reputation within IniTech as being a "good product", with "low maintenance".

When Alan was assigned support on IniPrints, he expected it to be pretty quiet. So he was surprised when three of the veterans of the project, Carole, Larry, and Arthur desceded on his cube with grim tidings.


A Little History

by in CodeSOD on

Source control history can go a long way to telling a story. Take Cassi, who needed to run some PHP software which depended on a few binaries and shell calls to do its job. We can see the initial attempt to locate the path of a binary:

function findPathOf($path)
{
    if (file_exists("/usr/bin/$path")) return "/usr/bin/$path";
    return "/usr/local/bin/$path";
}

Time's Up

by in Error'd on

Aspirational Caleb Su thinks this birth-year chooser is a WTF. "You have to be in at least 8th grade to join, meaning at the very latest you could be born in 2009." Not so, Caleb, not so! A precocious 8th grader might have been born as late as 2013. It could happen.