Remy Porter

Remy is a veteran developer who writes software for space probes.

He's often on stage, doing improv comedy, but insists that he isn't doing comedy- it's deadly serious. You're laughing at him, not with him. That, by the way, is usually true- you're laughing at him, not with him.

The File Transfer

by in CodeSOD on

SQL Server Information Services is Microsoft's ETL tool. It provides a drag-and-drop interface for describing data flows from sources to sinks, complete with transformations and all sorts of other operations, and is useful for migrating data between databases, linking legacy mainframes into modern databases, or doing what most people seem to need: migrating data into Excel spreadsheets.

It's essentially a full-fledged scripting environment, with a focus on data-oriented operations. The various nodes you can drag-and-drop in are database connections, queries, transformations, file system operations, calls to stored procedures, and so on. It even lets you run .NET code inside of SSIS.


A JSON Serializer

by in CodeSOD on

Carol sends us today's nasty bit of code. It does the thing you should never do: serializes by string munging.

public string ToJSON()
{
    double unixTimestamp = ConvertToMillisecondsSinceEpoch(time);
    string JSONString = "{\"type\":\"" + type + "\",\"data\":{";
    foreach (string key in dataDict.Keys)
    {
        string value = dataDict[key].ToString();

        string valueJSONString;
        double valueNumber;
        bool valueBool;

        if (value.Length > 2 && value[0].Equals('(') && value[value.Length - 1].Equals(')')) //tuples
        {
            char[] charArray = value.ToCharArray();
            charArray[0] = '[';
            charArray[charArray.Length - 1] = ']';
            if (charArray[charArray.Length - 2].Equals(','))
                charArray[charArray.Length - 2] = ' ';
            valueJSONString = new string(charArray);
        }
        else if ((value.Length > 1 && value[0].Equals('{') && value[value.Length - 1].Equals('}')) ||
                    (double.TryParse(value, out valueNumber))) //embedded json or numbers
        {
            valueJSONString = value;
        }
        else if (bool.TryParse(value, out valueBool)) //bools
        {
            valueJSONString = value.ToLower();
        }
        else //everything else is a string
        {
            valueJSONString = "\"" + value + "\"";
        }
        JSONString = JSONString + "\"" + key + "\":" + valueJSONString + ",";
    }
    if (dataDict.Count > 0) JSONString = JSONString.Substring(0, JSONString.Length - 1);
    JSONString = JSONString + "},\"time\":" + unixTimestamp.ToString() + "}";
    return JSONString;
}

A Unique Mistake

by in Feature Articles on

Henrik spent too many hours, staring at the bug, trying to understand why the 3rd party service they were interacting with wasn't behaving the way he expected. Henrik would send updates, and then try and read back the results, and the changes didn't happen. Except sometimes they did. Reads would be inconsistent. It'd work fine for weeks, and then suddenly things would go off the rails, showing values that no one from Henrik's company had put in the database.

The vendor said, "This is a problem on your side, clearly." Henrik disagreed.


Listing Off the Problems

by in Representative Line on

Today, Mike sends us a Java Representative Line that is, well, very representative. The line itself isn't inherently a WTF, but it points to WTFs behind it. It's an omen of WTFs, a harbinger.

ArrayList[] data = new ArrayList[dataList.size()];

A Monthly Addition

by in CodeSOD on

In the ancient times of the late 90s, Bert worked for a software solutions company. It was the kind of company that other companies hired to do software for them, releasing custom applications for each client. Well, "each" client implies more than one client, but in this company's case, they only had one reliable client.

One day, the client said, "Hey, we have an application we built to handle scheduling helpdesk workers. Can you take a look at it and fix some problems we've got?" Bert's employer said, "Sure, no problem."


Tic Tac Whoa

by in Tales from the Interview on

Usually, when we have a "Tales from the Interview" we're focused on bad interviewing practices. Today, we're mixing up a "Tales" with a CodeSOD.

Today's Anonymous submitter does tech screens at their company. Like most companies do, they give the candidate a simple toy problem, and ask them to solve it. The goal here is not to get the greatest code, but as our submitter puts it, "weed out the jokers".


Property Flippers

by in CodeSOD on

Kleyguerth was having a hard time tracking down a bug. A _hasPicked flag was "magically" toggling itself to on. It was a bug introduced in a recent commit, but the commit in question was thousands of lines, and had the helpful comment "Fixed some stuff during the tests".

In several places, the TypeScript code checks a property like so:


A Date with Gregory

by in CodeSOD on

Calendars today may be controlled by a standards body, but that's hardly an inherent fact of timekeeping. Dates and times are arbitrary and we structure them to our convenience.

If we rewind to ancient Rome, you had the role of Pontifex Maximus. This was the religious leader of Rome, and since honoring the correct feasts and festivals at the right time was part of the job, it was also the standards body which kept the calendar. It was, ostensibly, not a political position, but there was also no rule that an aspiring politician couldn't hold both that post and a political post, like consul. This was a loophole Julius Caesar ruthlessly exploited; if his political opposition wanted to have an important meeting on a given day, whoops! The signs and portents tell us that we need to have a festival and no work should be done!


Archives