Subscribe: The Daily WTF
http://syndication.thedailywtf.com/TheDailyWtf
Preview: The Daily WTF

The Daily WTF



Curious Perversions in Information Technology



Last Build Date: Sun, 25 Sep 2016 02:32:43 GMT

 



Error'd: Surprise!

Fri, 23 Sep 2016 10:00:00 GMT

"In life, there are good surprises and bad surprises, but Microsoft fails to differentiate," writes Rob

(image)

 

"Now I know how people from New Foundland feel," writes Chris B.

(image)

 

Austin S. writes, "Who knew that doing squats was the secret to bypassing *nix security?"

(image)

 

Paweł wrote, "I think WolframAlpha should fix its own problems before generating new ones."

(image)

 

"£0? I'll take one. Hell, I'll take ten!" writes Will K.

(image)

 

Rick R. wrote, "What happened with Detroit? Did they run around the bases in the wrong direction?"

(image)

 

Alex F. wrote, "Sometimes I guess string casting is like throwing spaghetti and hoping that it sticks."

(image)

 

(image) [Advertisement] Otter enables DevOps best practices by providing a visual, dynamic, and intuitive UI that shows, at-a-glance, the configuration state of all your servers. Find out more and download today!
(image)



CodeSOD: As The World Ternaries

Thu, 22 Sep 2016 10:30:00 GMT

Ah, the ternary operator. At their worst they’re a way to obfuscate your code. At their best, they’re a lovely short-hand.

For example, you might use the ternary operator to validate the inputs of a function or handle a flag.

Adam Spofford found this creative use of the ternary operator in a game he’s developing for:

    this.worldUuid = builder.worldId == null ? null : builder.worldId;
    this.position = builder.position == null ? null : builder.position;
    this.rotation = builder.rotation == null ? null : builder.rotation;
    this.scale = builder.scale == null ? null : builder.scale;

    this.worldUuid = builder.worldId;
    this.position = builder.position;
    this.rotation = builder.rotation;
    this.scale = builder.scale;

Curious about how this specific block came to be, Adam poked through the Git history. For starters, the previous version of the code was the last four lines- the sane lines. According to git blame, the project lead added the four ternary lines, with a git comment that simply read: “Constructing world details”. That explains everything.

(image) [Advertisement] Release! is a light card game about software and the people who make it. Play with 2-5 people, or up to 10 with two copies - only $9.95 shipped!
(image)