Recent Articles

Sep 2022

Oneth things frist

by in Error'd on

... or maybe oneth things snecod, as it turns out. This week, two unique anonymeese have brought something to share, and our alien friend Skippy piles on to the Lenovo laugh-in. Guten Morgen!

Decisive Michael R. is flummoxed by the law of the excluded middle. "YES," he assures us, "yes, those were checkboxes. And, no, not radios."


The Misleading PIN

by in CodeSOD on

Tina needs to write some software that integrates with a hardware device. Thatdevice controls access via behind a PIN, and thus Tina's team needs to track the valid PIN, so that they can, via software, update or alter the PIN.

There's just one problem. That device has some opinions about how a Personal Identification Number should be represented:


Top Slots

by in CodeSOD on

Picking random items without repetition is its own special challenge. It's one of those things that's not actually hard, but some programmers have a difficult time coming up with solutions to the problem. Abraham has found these two examples in some code he maintains:

//pick 3 out of 4 int alreadyUsed = 0; while (alreadyUsed < 3) { int rand = random()%4; if(!m_AllOptions[rand]->used) { m_AllOptions[rand]->used = true; alreadyUsed++; } }

Containerization

by in CodeSOD on

A large company with facilities all over the Asia-Pacific region opted to modernize. They'd just finished a pile of internal development that extended the functionality of a 3rd party package, and they wanted to containerize the whole shebang.

That's where Fred came in, about 9 months into a 12 month effort. Things hadn't gone well, but a lot of the struggles were growing pains. Many of the containers were built as gigantic monoliths. A lot of the settings you might need to do a Kubernetes deployment weren't properly configured. It was a mess, but it wasn't a WTF, just a lot of work.


A Valid Call

by in CodeSOD on

"Never trust your inputs" is a generally good piece of advice for software development. We can, however, get carried away.

Janice inherited a system which, among many other things, stores phone numbers. Like most such systems, the database validates phone numbers, and guarantees that numbers are stored in a canonical format, as text.


Ixnay

by in Error'd on

I know that I recently implied a fondness for cooked corvid, but if this keeps up I'm going to turn vegan. It will be a sad day if I have to turn in the barnyard puns.

Reader Ruthless R. goes in HAM, crowing "Daily WTF goes WTF with its RSS Feed." It's getting to be less funny.


Model Years

by in Feature Articles on

Caleb (previously) continues to work for a vehicle finance company. Most recnetly, he was working on a data ingestion application. Its job was to pull in a big ol' pile of CSVs from a mix of vendors and customers and feed it into a central database to keep things up to date.

"Application", however, is misleading. In reality, it was a suite of Access databases scattered around various network shares. Each represented a custom data loading pathway for a kind of data. It wasn't true that each was isolated from every other- frequently, the data flow would be "Open database \\fileserver\processing\vendor01.mdb, use the form to load the CSV file, then open \\fileserver\processing\process01.mdb, but only AFTER you've deleted the CSV file."


The Base Model

by in CodeSOD on

Penny uses a Python ORM. Like most ORMs, it involves a lot of "inherit from a BaseModel class, and get all your database access stuff for "free". Or at least, it used to. They've released an update.

def __init__(self, *args, **kwargs): if hasattr(self, "ACCESS_POLICY_VIEWSET_NAME"): deprecation_logger.warn( f"The model {self.__class__} defines the 'ACCESS_POLICY_VIEWSET_NAME' class " f"attribute which is no longer required and is discouraged to be set." ) return super().__init__(*args, **kwargs)

TODO: Post an Article

by in Editor's Soapbox on

Yesterday, I briefly mentioned the "TODO" comment as part of the WTF. Anyone who develops software for long enough is going to develop some pet peeves. Lord knows, my feelings on Hungarian Notation are well established. Or ternaries, though honestly, for ternaries, I mostly am in it for the puns.

But, I've got another pet peeve that's crawling up my butt far enough that I felt the need to do a soapbox about it.


Bitmaps and Streams

by in CodeSOD on

Robert has inherited a .NET application. It's a big-ball-of-mud, full of monstrous classes of thousands of lines and no coherent purpose, complete with twenty constructors.

It's ugly and messy, but it's mostly just generically bad. This method, however, is a lot of bad choices in very few lines.


Taking the Piss

by in Error'd on

In case anyone is wondering "is there anything so lame that it's not even good enough to get published by Error'd", the answer is yes. There is a category of submissions that is very common, but in the completely capricious opinion of this editor, just not very funny. That category is clearly broken listings on amazon.com. We usually get two or three of these every week. We save them up, and maybe someday the news will be so slow that we have no choice but to run an entire column of nothing but Amazon bloopers. This week was no different from the usual, except that this time the September stress has struck a nerve and so you get to see what the brink of madness looks like from the inside.

Tippler Matthias poured one out for us. "Seems someone already tried some of the good stuff while uploading the images to Amazons catalog."


Version Numbers

by in Feature Articles on

Initech was the big customer for Chops's company. And like a lot of big customers, they had requests and they had the weight to throw around to get their requests fulfilled. When they wanted a new feature, they got a new feature. When they found a bug, they got the patch ASAP.

No matter how special Initech thought they were, they were mostly requesting things that other customers wanted anyway, so it worked pretty well.


Walking is your Duty

by in CodeSOD on

Embedded chip documentation is sometimes very bad, and very confusing. Frequently it's difficult to really understand the ins and outs of a given chip without simply getting experience.

Which is why Mr. Scrith was a bit surprised with this code, which came from someone who definitely should have known better.


Up the Garden Path

by in CodeSOD on

Sam worked on an application which needed to parse files out of a directory. There was a ticket to change the search path for those files to search an additional directory. That didn't turn out to be terribly hard, but the existing code raised some serious eyebrows.

def get_info_for_identifier(base_name: str, identifier: str) -> dict: ... all_ids = os.listdir(base_name) ... results = {} for i in all_ids: results.update(parse_identifier(base_name, i)) ... return results[identifier]

Undefined Variable

by in CodeSOD on

Robert H was trawling through the JavaScript front-end for his team's ASP.NET MVC application. The goal was to prepare for a complete rewrite of the front-end, because, well, it had problems and wasn't reliable or maintainable.

As an example, Robert sends this:


Crowneisseurship

by in Error'd on

Never let it be said that we at TDWTF don't enjoy the taste of our own medicine. Andrew I. shares with us a little taste of his own crow, and then we share with you a little taste of Remy's. It's not quite a full meal, but you can call it an amuse bouche.

But first, Sam B. serves up some sure fled pie. "This Brexit business is getting out of hand. Lenovo says even the United Kingdom has left the UK."


Oh, Poop

by in CodeSOD on

Pearl was paying down some technical debt. She was trawling through their NodeJS application with a search for TODO and console.log. She was triaging the TODOs, and replacing the logs with a real logging framework.

The application was old, had many complicated routes for requests to be handled, and buried deep in a file was this code, which was clearly testing code that was never meant to end up in production:


Enumerating Your Plants

by in CodeSOD on

Usually, we don't pick on game code, as it's frequently bad because of the time constraints under which it's developed and because the concerns are more around "making a fun, performant game," and not "writing good reusable code".

But there are some egregious exceptions, like what happened to Patrick. He was handed some C# game code, and told, "Good luck!"


Not-so-Simple Network Management Protocol

by in Feature Articles on

"Phillip, are you familiar with SNMP? Do you know Python?" asked Phillip's new boss.

"No."


Classic WTF: Security By Oblivity

by in Feature Articles on
It's a holiday in the US, so once again, it's time to reach back into the archives. Two-Factor Authentication is pretty standard these days, but once upon a time, it felt far more cumbersome to use. This story from 2006 highlights some… unique solutions to the problem. Original --Remy

Laptops are blessing for many corporate workers: never before has it been so easy to bring work home and neglect one's family to get in a few extra hours of unpaid overtime. As eager as employees are to do this, the mean ole' folks in IT Security are not. They cite all these news stories about sensitive data being lost as a result of laptops and remote access, and say it's just not safe to bring the company work home.

Thankfully, the IT Security director at MK's company (a fairly large banking institution) knows that the ability to conveniently work remotely is much more important than working securely. Shortly after some mean ole' regulatory agency mandated that remote access is secured with a VPN that requires typing in a constantly changing passcode from a physical token, the director had just the solution for everyone ...


Pub Kick

by in Error'd on

Last week's article nearly exposed to the public the lowest-key techreligious war that has been waging for decades. PEBKAC versus PEBCAK completely underwhelms the emacs vs vi war, the GUI vs CUI massacre, the tabs vs spaces schism, and even the -- + // alliance against the /* and (* comment markers. Scratch a PEBCAK partisan and all you'll find is a bit of blood and a response of "OW! Why did you do that?! There isn't any war!!" Even the partisans deny it exists but it simmers. It's PEBKAC, I tell you. PEBKAC! Wait, I forgot. Which did I use in last week's article?

Plotzed publican Peter G. has tired of his local and decided he'd rather pop round to das Lokal for a schnitzel. Researching reviews, he was surprised by an unexpected mountain PICNIC (Problem In Chair Not In Computer). "Dumont Travel seem to think the Anschluss is still in effect, or at least this is what you get when you ask for travel info for Austria (Österreich)."


Latrinalia

by in CodeSOD on

My favorite bar in Pittsburgh is a bit of a dive. Like any good dive, the bathroom is covered in the incoherent scrawl of thousands of drunks. It's a mix of jokes, political flamewars, and just absolute nonsense. My favorite part about it, though, is that it just makes me think about the long history of latrinalia. For as long as there have been humans, we've been scribbling on whatever surface was at hand, and a lot of those scribbles have been made while we answer nature's call.

Programmers have their own form of latrinalia: code comments. They're frequently vulgar, they're sometimes comprehensible only to the person who wrote them, and we all like to pretend that they're more meaningful than they are.