OR 

Representative Line: Aggregation of Concatenation

A few years back, JSON crossed the ‘really good hammer‘ threshold. It has a good balance of being human readable, relatively compact, and simple to parse. It thus has become the go-to format for everything. ‘KoHHeKT‘ inherited a service which generates some JSON from an in-memory tree structure. This is exactly the kind of situation where JSON shines, and it would be trivial to employ one of the many JSON serialization lib

favicon of http://thedailywtf.com

Error‘d: Version-itis

No thanks, Im holding out for version greater than or equal to 3.6 before upgrading, writes Geoff G. Looks like Twilio sent me John Does receipt by mistake, wrote Charles L. Little do they know that I went back in time and submitted my resume via punch card! Jim M. writes. Richard S. wrote, I went to request a password reset from an old site that is sending me birthday emails, but it looks like the reCAPTCHA is no longer available and the s

favicon of http://thedailywtf.com

CodeSOD: A Quick Replacement

Lucio Crusca was doing a bit of security auditing when he found this pile of code, and it is indeed a pile. It is PHP, which doesn‘t automatically make it bad, but it makes use of a feature of PHP so bad that they‘ve deprecated it in recent versions: the create_function method. Before we even dig into this code, the create_function method takes a string, runs eval on it, and returns the name of the newly created anonymous function. P

favicon of http://thedailywtf.com

CodeSOD: Return of the Mask

Sometimes, you learn something new, and you suddenly start seeing it show up anywhere. The Baader-Meinhof Phenomenon is the name for that. Sometimes, you see one kind of bad code, and the same kind of bad code starts showing up everywhere. Yesterday we saw a nasty attempt to use bitmasks in a loop. Today, we have Michele‘s contribution, of a strange way of interacting with bitmasks. The culprit behind this code was a previous PLC programme

favicon of http://thedailywtf.com

The New Guy (Part I)

After working mind-numbing warehouse jobs for several years, Jesse was ready for a fresh start in Information Technology. The year 2015 brought him a newly-minted Computer and Networking Systems degree from Totally Legit Technical Institute. It would surely help him find gainful employment, all he had to do was find the right opportunity. Seeking the right opportunity soon turned in to any opportunity. Jesse came across a posting for an IT Sys

favicon of http://thedailywtf.com

CodeSOD: The Same Date

Oh, dates. Oh, dates in Java. They‘re a bit of a dangerous mess, at least prior to Java 8. That‘s why Java 8 created its own date-time libraries, and why JodaTime was the gold standard in Java date handling for many years. But it doesn‘t really matter what date handling you do if you‘re TRWTF. An Anonymous submitter passed along this method, which is meant to set the start and end date of a search range, based on a number

favicon of http://thedailywtf.com

Exponential Backup

The first day of a new job is always an adjustment. Theres a fine line between explaining that youre unused to a procedure and constantly saying At my old company.... After all, nobody wants to be that guy, right? So you proceed with caution, trying to learn before giving advice. But some things warrant the extra mile. When Samantha started her tenure at a mid-sized firm, it all started out fine. She got a computer right away, which is a nice

favicon of http://thedailywtf.com

CodeSOD: A Bit Masked

The ‘for-case‘ or ‘loop-switch‘ anti-pattern creates some hard to maintain code. You know the drill: the first time through the loop, do one step, the next time through the loop, do a different step. It‘s known as the ‘Anti-Duff‘s Device‘, which is a good contrast: Duff‘s Device is a clever way to unroll a loop and turn it into a sequential process, while the ‘loop-switch‘ takes a

favicon of http://thedailywtf.com

CodeSOD: A Password Generator

Every programming language has a *bias* which informs their solutions. Object-oriented languages are biased towards objects, and all the things which follow on. Clojure is all about function application. Haskell is all about type algebra. Ruby is all about monkey-patching existing objects. In any language, these things can be taken too far. Javas infamous Spring framework leaps to mind. Perl, being biased towards regular expressions, has earned

favicon of http://thedailywtf.com

Yes == No

For decades, I worked in an industry where you were never allowed to say no to a user, no matter how ridiculous the request. You had to suck it up and figure out a way to deliver on insane requests, regardless of the technical debt they inflicted. Users are a funny breed. They say things like I dont care if the input dialog you have works; the last place I worked had a different dialog to do the same thing, and I want that dialog here! With

favicon of http://thedailywtf.com

CodeSOD: CONDITION_FAILURE

Oliver Smith sends this representative line: bool long_name_that_maybe_distracted_someone() { return (execute() ? CONDITION_SUCCESS : CONDITION_FAILURE); } Now, we‘ve established my feelings on the if (condition) { return true; } else { return false; } pattern. This is just an iteration on that theme, using a ternary, right? That‘s certainly what it looks like. But Oliver was tracking down an unusual corner-case bug and things jus

favicon of http://thedailywtf.com

An Obvious Requirement

Requirements. That magical set of instructions that tell you specifically what you need to build and test. Users cant be bothered to write them, and even if they could, they have no idea how to tell you what they want. It doesnt help that many developers are incapable of following instructions since they rarely exist, and when they do, they usually arent worth the coffee-stained napkin upon which theyre scribbled. That said, we try our best

favicon of http://thedailywtf.com

CodeSOD: CHashMap

There‘s a phenomenon I think of as the ‘evolution of objects‘ and it impacts novice programmers. They start by having piles of variables named things like userName0, userName1, accountNum0, accountNum1, etc. This is awkward and cumbersome, and then they discover arrays. string* userNames, int[] accountNums. This is also awkward and cumbersome, and then they discover hash maps, and can do something like Mapstring, string* users.

favicon of http://thedailywtf.com

Error‘d: Perfectly Technical Difficulties

David G. wrote, For once, Im glad to see technical issues being presented in a technical way. Springer has a very interesting pricing algorithm for downloading their books: buy the whole book at some 10% of the sum of all its individual chapters, writes Bernie T. While browsing PlataGO! forums, I noticed the developers are erasing technical debt...and then some, Dariusz J. writes. Bill K. wrote, Hooray! Its an opposite sale on Adidas websit

favicon of http://thedailywtf.com

CodeSOD: Philegex

Last week, I was doing some graphics programming without a graphics card. It was low resolution, so I went ahead and re-implemented a few key methods from the Open GL Shader Language in a fashion which was compatible with NumPy arrays. Lucky for me, I was able to draw off many years of experience, I understood both technologies, and they both have excellent documentation which made it easy. After dozens of lines of code, I was able to whip up som

favicon of http://thedailywtf.com

Improv for Programmers: Inventing the Toaster

We always like to change things up a little bit here at TDWTF, and thanks to our sponsor Raygun, weve got a chance to bring you a little treat, or at least something a little different. Were back with a new podcast, but this one isnt a talk show or storytelling format, or even a radio play. Remy rounded up some of the best comedians in Pittsburgh who were also in IT, and bundled them up to do some improv, using articles from our site and real-wo

favicon of http://thedailywtf.com

Error‘d: Kind of...but not really

On occasion, SQL Server Management Studios estimates can be just a little bit off, writes Warrent B. Jay D. wrote, On the surface, yeah, it looks like a good deal, but you know, pesky laws of physics spoil all the fun. When opening a new tab in Google Chrome I saw a link near the bottom of the screen that suggested I Explore the worlds iconic locations in 3D, writes Josh M., Unfortunately, Googles API felt differently. Stuart H. wrote, I th

favicon of http://thedailywtf.com