Remy Porter

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

Jan 2016

I Hate the Lord of the Rings

by in Feature Articles on

Today, we're breaking out something a little different. I put this together more for fun than anything else, and we piloted it around in the Side Bar, along with a few other shares.

After some feedback, we're happy to bring this to the front page, and we plan to produce more of videos in this vein as a recurring periodic feature.


Utter Filth

by in CodeSOD on

Terrell inherited some database stored procedures. Like all good, Enterprisey stored procedures, it was written in PL/SQL. Unlike most Enterprisey procedures, it had a clear purpose: to clean your dirty inputs.

The actual problem: based on user input, the PL/SQL code needed to write a temporary file to the filesystem. Since user input is full of filthy, illicit characters, this procedure needs to clean them up.


The Productivity Leader

by in Feature Articles on

Jane took a job at a big financials company. The pay and the benefits were the first draw, but she was really sucked in by the visions of building analytics and juggling billions of dollars with cutting edge data mangling techniques. “Big data” came up in the interview many times, along with “cloud”.

The first cold blast of reality was when she was given her developer desktop: a Windows XP box with 4GB of RAM and a CPU that could get lapped by the processor in a BlackBerry. “Oh, is this just a dumb terminal I use to connect to your cloud?” Jane asked.

Productivity versus hours worked, showing a steady decline year over year.

The Helpful Customer

by in CodeSOD on

Sven built a PHP-based website on contract then handed it off to his customer, Bob.

“You won’t be getting a lot of support calls from me,” Bob said, “because I actually know a thing or two about PHP. I’ll be maintaining this myself.”


Reloaded Commands

by in CodeSOD on

William Heimbinger joins the ranks of developers who come to us to confess their sins. This particular sin was committed when he was but a young child of fifteen years old, which raises more questions than it answers.

Young William was writing Perl and building an anti-spam bot for IRC channels. As he wrote code, he wanted to quickly reload the module to test it, but actually learning how to reload modules looked like too much work. William decided to reinvent that wheel, using a hammer he already knew.


The Flasher

by in CodeSOD on

Michael H sends us some code that probably deserves a NSFW warning for exhibitionism. This code is a confusing bit of metaprogramming that… well, shouldn’t be allowed near schools or playgrounds.

function load_class_public($class) {
        static $classes;
        if (! $classes)
                $classes = array();
        $classname = $class . '_Publicified';
        if ($classes[$classname])
                return $classname;
        $codez = file_get_contents(PATH . '/classes/class.' . $class . '.php');
        $codez = preg_replace('/\bprivate\b/', 'public', $codez);
        $codez = preg_replace('/\bprotected\b/', 'public', $codez);
        $codez = preg_replace('/\bclass\s+' . $class . '\b/', 'class ' . $class . '_Publicified', $codez);
        $codez = preg_replace('/\<\?php/', '', $codez);
        eval($codez);
        $classes[$classname] = $classname;
        return $classname;
}

Ch-ch-ch-changes

by in CodeSOD on

Archie poked around in his company’s billing system. This was a mistake, because that system is implemented largely in PL/SQL, and only a developer made from the sternest stuff can deal with PL/SQL.

Like most PL/SQL applications, the Oracle database is the closest thing they have to version control. Each developer makes changes in the live dev environment and then hopes for the best. They don’t use TOAD or SQLPlus or any “normal” tool for making these changes- they have to use an in-house developed GUI, because that GUI tracks their changes and writes rows into a database called “VersionDB”. When they finish a patch and want to release the changes to their customer sites, they send a copy of the VersionDB and let a simple script apply all of those changes.

It works about as well as you’d expect.


Good Idea, Bad Idea

by in CodeSOD on

After years of neglecting their command line tools, Microsoft decided to try and build a grown-up set of administrative tools, and released PowerShell. Nearly a decade later, and many of their flagship services still don’t integrate neatly with PowerShell. Good Idea, Bad Idea The syntax is a bit messy, and the promises of an object-oriented shell never quite came to fruition. PowerShell is a great idea, executed poorly. For all that, it still offers certain advantages compared to the Unix family of shells, and is certainly worlds better than ol’ CMD.EXE.

Speaking of good ideas executed poorly: backups aren’t a good idea, they’re a great idea. And when Tommy took over as an Active Directory engineer, he was happy to hear that his predecessor had left behind a script that backed up all their user data on a daily basis. Tommy was significantly less happy when he saw the script.


TDWTF API

by in Announcements on

Happy New Year! Have we got some great news for you. Subramanian has contributed a RESTful API for accessing our articles, which we’ve deployed. So now you can get started on your New Year’s resolution of writing and sharing more code.