Remy Porter

Computers were a mistake, which is why I'm trying to shoot them into space. Editor-in-Chief for TDWTF.

Dec 2023

Best of 2023: Modular Dependencies

by in Best of… on
SQL is hard, but it's a lot harder when you're "clever". This tale highlights an… interesting solution to code reuse. --Remy

Many years ago, Valts and his spouse both worked for the same company. The company had an ERP system that started its life as a product back when ERP systems were novel and new. It was written in Delphi, and it was huge- so huge that the company needed to hack the Delphi linker to handle its size.

Well, their company got swallowed up by Initech, and after the buyout, things changed. Valts left, and a few years later so did his spouse. But they kept in touch with their colleagues, so it was over dinner that former co-worker Viktorija related the recent disaster she had stumbled across.


Best of 2023: Around the World (Around the World)

by in Best of… on
Poor Sandra, this article is but one bad day in a slew of bad days dealing with geographic data and WTFs. --Remy

Sandra has ongoing issues. When we last checked in, we had some problems with geography, and those problems haven't been solved.

Now, one truth of geographic points is that they're bounded. We know, for example, that longitudes cover the range (-180,180), and latitudes are always (-90,90). Even if we change the coordinate system, it will still have bounds, as the Earth is a closed shape with finite boundaries.


Best of 2023: The Microservice Migration

by in Best of… on
It's the last week of the year, and as per tradition, we look back at some of the best stories of the year. We start with this charmer, from February, a… little slice of brillant architecture. --Remy

"Why aren't we using microservices?"

It was an odd way to start a meeting, but it got Mr. TA's attention. TA was contracting with a client, and sitting in a meeting with their senior architects. TA and one of his peers exchanged a glance and a small eye-roll. They knew exactly what had happened: Alvin, the senior architect, had learned about a new fad.


Christmas in the Server Room

by in Feature Articles on

It's the Holiday Season, so we're going to take a break from our usual content, and talk about holiday movies and TV specials. But we can't just completely abandon what The Daily WTF is about, so we're going to rate these holiday classics for the accuracy of their portrayal of the IT industry. We'll rate each on a scale of 5 floppy disks, where 5 has the documentary accuracy of Office Space.

A Charlie Brown Christmas

The story of A Charlie Brown Christmas focuses on the conflict between Christmas spirit and commercialism. The story contains no computers or IT professionals, and instead focuses on the annual Christmas play which the children are producing. In that regard, it's a story of a poorly scoped, poorly resourced project, with the actual responsibility for the project's success being left in the hands of unqualified children, while any sort of managerial oversight by adults is expressed as sad trombone noises.


Vestigial Organs

by in CodeSOD on

Matt inherited some C# code that reads from a JSON config file.

public ServerJsonLoader(string configFile)
{
	using (StreamReader reader = File.OpenText(configFile))
	{
		JObject config = ... //snip

		if (config.GetValue("inputs") != null)
		{
			this.mixedConfig = config;

			//Inputs
			var inputs = ... //snip

			//Outputs
			if (config.GetValue("outputs") != null)
			{
				var outputs = ... //snip
			}                
		}
		else
		{                 
			if(config.GetValue("inputs") != null)
				this.serverConfig = config;

			if (config.GetValue("outputs") != null)
				this.clientConfig = config; 
			
		}                    
	}
}

Misunderstood the Assignment

by in CodeSOD on

Benjamin doesn't have a lot of complaints about the project he works on. "There is," he writes, "no tale of daily woe." But even an otherwise healthy project isn't immune to WTFs.

BOOL CCache::CalculateBmpImageSize(SIZE BackgroundControl, SIZE& NewImageSize)
{
        BOOL    bRes = TRUE;

        try
        {
                NewImageSize = BackgroundControl;
        }
        catch(...)
        {
                bRes = FALSE;
        }

        return bRes;
}

A Reckless Driver

by in CodeSOD on

For a variety of reasons, Robert's company needed to ship a small linux box with a USB ethernet adapter. The driver for said adapter was giving him some issues with their setup, but fortunately the driver was open source, so Robert could at least try and diagnose the problems.

In the file inst.c, he found this:


No Lifeguard in this Connection Pool

by in CodeSOD on

Michael was debugging a system where the J2EE service would just… crash. It was running on a Windows host set to restart the service when this happened, so the outages were brief, but it was a serious problem.

He eventually tracked down the problem to a class called JdbcSchema, which is about 1,100 lines of homebrew database management code. It does "fun" things, like create extra tables in the database to track "foreign key metadata".


Monthly Totals

by in CodeSOD on

Daniel spotted an array called $months in a PHP application. The data being stored in the array was some total of the sales of some commodity, for the past 5 months.

That much all made sense. What didn't make sense was how the array was indexed.


Secure Mentorship

by in CodeSOD on

Sophia entered the software development industry through an "alternative" path. In Germany, they have a tradition of Ausbildung. Instead of going to university, you focus on on-the-job training with some classes mixed in. There are still exams and all the traditional academic trappings, but with one huge bonus: you're working closely with an Ausbilder- an experienced industry veteran who can show you the ropes.

Sophia's Ausbilder was named Tim, and at the company she was working at, he was widely hailed as a genius. He had designed their entire web system from the ground up in Java, which given that every other developer at the company only worked in Delphi, that made him a pretty unique talent. Everyone was pretty convinced he was brillant.


Padding the Amount

by in CodeSOD on

Matt's co-worker needed to handle some currency values coming in as strings. As this was in C++, we're already in a fraught territory of having to worry about whether the callers and various APIs we're using handle C-style strings or C++ std::string.

Or, you can just mix-and-match in code and hope for the best, while having some interesting approaches to handling your inputs. That's what this developer did.


A Nice Break

by in CodeSOD on

Once upon a time, HTML had tags like <marquee>, which scrolled text across your page, and when combined with animated GIF backgrounds basically defined the Geocities aesthetic.

Since then, the HTML specification has been refined, and the choice has been made that HTML tags should (mostly) be about semantics- describing the structure of a page, the meaning of elements, and the relationship between those elements. It generally shouldn't describe the presentation of those elements (CSS should do that)- even though the semantics generally imply something about the display (paragraphs and divisions are block elements, for example).


Evaluating Perks

by in CodeSOD on

Today's anonymous submitter works for a company that handles customer rewards perks. It's handling thousands of dollars of transactions a day, which isn't a huge amount, but it's certainly non-trivial.

Now, there's a conversion formula from points to dollars: points/100*1.7. Now how would someone implement this complex formula in PHP? Well, our submitter's predecessor did it this way:


TrUe Romance

by in CodeSOD on

Mario's predecessor was writing some Java code that parsed textual input. Thus, it needed to be able to turn the string "true" into the boolean value true, but also needed to handle "True" and "TRUE".

Now, in Java, the obvious answer would be to use the equalsIgnoresCase String member function. if (value.equalsIgnoresCase("true"))…. I mean, obvious to you or me, anyway.


Capitalizing on Memories

by in CodeSOD on

Gavin inherited some "very old" C code, originally developed for old Windows systems. The code is loaded with a number of reinvented wheels.

For example, they needed to do a case insensitive string comparison. Now, instead of using stricmp, the case insensitive string comparison, they wrote this: