Remy Porter

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

Mar 2016

A Meaty Problem

by in Feature Articles on

“The scales are down again, where the heck is Andre?”

Roger had heard this cry often enough that he didn’t bother to poke his head out of his cubicle to see what the issue was. He worked for a meat-packing company. Sides of beef came in one side of the building, where they were sectioned and cut into smaller, grocery-store-friendly portions, and then shipped out the other side in refrigerated trucks. Along the way, the pieces of meat needed to be weighed multiple times. When the scales went down, production stopped.


Scrubbed Inputs

by in CodeSOD on

In this age of JavaScript everywhere, developers have to come up with all sorts of ways to work around the uglier segments of JavaScript. For example, Aaron found this block, which promises to scrub “false-y” fields.

require _ = require("underscore");

// recurses, use with care
var scrubFalseyFields = function (obj) {
    return  _.chain(obj)
        .pairs()
        .filter(function (pair) {
            var val = pair[1];
            if (_.isObject(pair[1])) {
                // recurse!
                pair[1] = scrubFalseyFields(val);
            }
            return val;
        })
        .object()
        .value();
};

Tested Backups

by in Feature Articles on

The “Big Boss” of Initech’s Australian division ran the Sydney office as his own personal kingdom. Work- or workers- he didn’t care for was banished to the hinterlands of the Melbourne office. For example, IT services was a “useless sack of morons who only know how to spend money,” and thus the entire department was banished to Melbourne.

Stewart C. lived in Melbourne, and was a new hire not long after the exile. The Melbourne office, with a 900km buffer zone protecting it from the whims of upper management, was actually a decent place to work. At least, until Brendan arrived.


Finding the File

by in CodeSOD on

There’s one challenge we rarely think about when writing file-handling code: how do we know where the file actually is? Josh H. inherited some C# code that puts a lot of thought into that. A lot.


            

String Cheese

by in CodeSOD on

Imagine you’re a Java programmer. You need to iterate across a list of strings. Your natural instinct might be to just use a for loop, and that’s proof that you’re not a true enterprise Java programmer.

Diether’s company is home to true enterprise developers, and they know how to get things done.


Encryption By Analogy

by in Editor's Soapbox on

Last week, US President Obama said something that is usually the sort of line we give the “idiot boss” character in one of our stories. From Ars Technica:

“I am not a software engineer,” Obama made his beliefs wholly clear. “You cannot take an absolutist view on this. If your view is strong encryption no matter what and we can and should create black boxes, that does not strike the balance that we’ve lived with for 200 or 300 years. And it’s fetishizing our phones above every other value. That can’t be the right answer.”


Code Changes Over Time

by in CodeSOD on

Code changes over time. Most of what developers do is manage changes to code. Dana inherited some pretty awful PHP, and decided to take some time to improve performance and make sure any errors thrown by the PHP were actually displayed nicely for the user.

While looking at the file-upload module, Dana found this:


JavaScript Obfuscation

by in CodeSOD on

We have to be careful about the articles we publish on TDWTF. We have a responsibility to our submitters, to protect their identity and anonymize the details of their stories. We have a responsibility to our readers- mostly to be entertaining.

Last week’s JSF–k story failed one of our readers. Poor Blazej didn’t find it entertaining- it gave him upsetting flashbacks to his own experience with a similar event.


The Swamp Cooler

by in Feature Articles on

Joe took a job as a programmer at a small shop. It was a huge pay cut, but his current employer was locked in a death-spiral of declining revenue, declining collections, and declining sales. It was time to get out, and his local market didn’t have a lot of options.

“We’re a small shop, so we’ll need you to help out with general IT stuff,” Joe’s boss, Jimmy, said. By “help out”, what Jimmy actually meant was “be the helpdesk tech, server tech, and if you have time, write some code”. On an average day, Joe’d be running from user desktop to user desktop, installing Excel or removing malware, before hustling to the server room to manually reboot a locked up box, then on his way out the door, he’d push some changes to the company’s website and pray nothing was wrong.


The Monthly Report

by in CodeSOD on

Karen, you need to run the monthly report while Ivan is on vacation,” Bruno asked.

“Wait, isn’t that just a scheduled job?”