Recent Articles

Oct 2012

Real Security

by in CodeSOD on

Emmett had been contracted to maintain the curb appeal of The Website of Judy S. Kirkland (#1 Realtor in Townhouse Resales in the Upper Eastern Greater Metro Area, February 2009).

"It's a charming homepage," he was told by Judy S. Kirkland (Bay Street Diamond Award recipient, thrice). "I got in on the ground floor with this The Internet thing way back when. After all, one only becomes as recognizably successful as myself by staying ahead of the trends."


Quitters Never Win

by in Feature Articles on

Lawrence’s interview started with Mark, the new MIS manager. A recruiter had hooked them up. The company was a medium sized organization, with four large locations and a few thousand employees. There was an AS/400 serving as their main back-end, and a small collection of other servers pitched in to provide extra ecommerce applications.

Despite the large userbase and the fact the company claimed to be “growing and dynamic”, their IT offices were strangely empty. Lawrence made a comment about that as a joke. “Is everyone out for a retreat or training? Must be nice.”


Blame Peter

by in CodeSOD on

We’ve all had the moment when we search for an answer to a technical question and our search engine suggests a trip to ExpertSexchange.com. Er, ExpertsExchange.com. And when we realize that they expect us to pay to see the answer, our instincts take over- we scrub our way through the page source hoping to see a way around the paywall.

If your question was, “Who do I blame?”, that’s one answer ExpertsExchange will give you for free.


Illinois Has Left the Universe

by in Error'd on

"Not only has my zip code seceded from the union, but it apparently has left the universe, as well," writes Mark, "I should really consider going to more neighborhood association meetings."


Confessions: Hacker Proof Boolean

by in Feature Articles on

"Years ago, long before I'd actually started programming, I spent my time learning about computers and data concepts by messing around with, believe it or not, cheat devices for video games," wrote Rena K., "The one I used primarily provided a RAM editor and some other tools which allowed me to tool around with the internal game files and I even get into muddling around with the game data all in the interest of seeing what would happen."

"As such, by the time my inflated hacker ego and I got into programming professionally, I was already pretty familiar with basic things like data types and binary. I was feeling pretty darn L33T."


Not Good Enough for Paul

by in CodeSOD on

"If I told you that I work for a primarily Microsoft coding shop that hires on non-Microsoft developers, you'd think that it would be an unending, seething mass of WTF code," writes Hank, "but really, it isn't."

"The new hires that the company brings on are usually eager to learn and their diverse backgrounds and experiences make our team more well-rounded overall."


Space: The Final NOP

by in CodeSOD on

Some code demands a little breathing room. Phil found this block of C#, which makes sure it has plenty of space to do its work.

public string AddSpace(string value)
       {
            string space = " ";
           if (value.Equals(space))
           {
               return space;
           }

           return value;
       }

The Wrong Route

by in Feature Articles on

“We’ve invested quite a bit of money in our new network,” the bureaucrat said. His desk was tiny and so cheap that it sagged under the weight of the CRT and tower resting on it. “That’s why it’s probably a more rigorous interview than you’re used to.”

In practice, the interview wasn’t anything unusual to Karen, who had already done a great deal of contracting work with local government offices. This particular interview was for a contract position with the county courts.


All Steam Edition

by in Error'd on

The number of Steam errors that get sent to The Daily WTF's Inbox is somewhat unnerving. So, naturally, the only thing to do is to turn a bunch of 'em into an all-Steam edition of Error'd!



The Angry MD

by in Tales from the Interview on

After a few weeks of searching, Steven M's job prospects were looking pretty grim.

So, in a bid to find more exciting work than his small hometown could offer, he packed up and moved to London.


The White Flag

by in CodeSOD on

Handling dates is hard. Kevin sends us this attempt at building it from scratch, found in a third-party library. It was shaped with a Tab key that wishes nightly for death.

Protected Shared Function dateTimeFromJavaXml(ByVal dt As String) As DateTime  
   Dim datetime1 As DateTime = DateTime.get_Now()  
   If (dt.EndsWith(" GMT-12:00")) Then
       dt = dt.Replace(" GMT-12:00", "-12:00")  
   ElseIf (dt.EndsWith(" GMT-11:00")) Then
       dt = dt.Replace(" GMT-11:00", "-11:00")
       GoTo label1
       If (dt.EndsWith(" WSST")) Then
           dt = dt.Replace(" WSST", "-11:00")
       ElseIf (dt.EndsWith(" SDT")) Then
           dt = dt.Replace(" SDT", "-11:00")
           GoTo label2
           If (dt.EndsWith(" NUST")) Then
               dt = dt.Replace(" NUST", "-11:00")
           ElseIf (dt.EndsWith(" GMT-10:00")) Then
               dt = dt.Replace(" GMT-10:00", "-10:00")
               GoTo label3  
'SNIP: Let's skip ahead, retaining the indenting…      scroll that way ->                                                  ->                       keep going                                               ->                                                                        and going                                                oh, there it is!
                                                                                                                                                                                                                                                                                                                                                               If (Else.EndsWith(" TOST")) Then
                                                                                                                                                                                                                                                                                                                                                                   dt = dt.Replace(" TOST", "+13:00")
                                                                                                                                                                                                                                                                                                                                                               ElseIf (dt.EndsWith(" GMT+14:00")) Then
                                                                                                                                                                                                                                                                                                                                                                   dt = dt.Replace(" GMT+14:00", "+14:00")
                                                                                                                                                                                                                                                                                                                                                                   GoTo label88
                                                                                                                                                                                                                                                                                                                                                                   If (Else.EndsWith(" LINST")) Then
                                                                                                                                                                                                                                                                                                                                                                       dt = dt.Replace(" LINST", "+14:00")
                                                                                                                                                                                                                                                                                                                                                                   Else
                                                                                                                                                                                                                                                                                                                                                                       dt = dt.Substring(0, (dt.LastIndexOf(" ") - 1))
                                                                                                                                                                                                                                                                                                                                                                   End If
                                                                                                                                                                                                                                                                                                                                                               End If  

'SNIP: we'll just skip past the sea of End Ifs and hope to find shore  
End If  
   Try
       label1:
       label2:
       label3:
       label4:
       label5:
       label6:
       label7:
       label8:
       label9:  
'SNIP  
       label88:
         datetime1 = DateTime.Parse(dt)  
   Catch exception As Exception
       exception  
   End Try  
   Return datetime1  
End Function

Equals

by in Feature Articles on

Dan had a business object. It represented a user’s Dashboard, a screen which had a collection of widgets that displayed some user specified data. The application needed to be able to compare these Dashboard objects to tell if two instances were the same, so someone had written a custom Equals method, back in the Cambrian epoch.

As often happens, the business requirements mutated. Dan added a thumbnail property. Now users could browse a collection of Dashboards and get a sense of what they might look like without actually switching to that Dashboard layout. Two otherwise identical Dashboards might have different thumbnails, so Dan didn’t add code to the Equals method. To make the rules quite explicit, he added a comment, instead: previewImage should NOT participate in business equals. He also added appropriate assertions to the unit tests.


Ask the Index

by in CodeSOD on

Different tasks call for different conventions. At least, that’s the excuse some people use for switching between 0-based and 1-based array indexes. That still doesn’t explain why Phillip’s co-worker did this.

var panelIndexes = {  
   "1" : 0,  
   "2": 1,  
   "3": 3,  
   "4": 4,  
   "5": 5,  
   "6": 6,  
   "7": 7,  
   "8": 8,  
   "10": 9,  
   "11" : 2,  
   "12" : 10 //Don't ask  
};
/* snip */  
var activePanel = panels[panelIndexes[i]];

Sausage Mystery Ingredient

by in Error'd on

"I found that Tesco puts some interesting ingredients in their 'Half-Fat Pork Sausages'," writes Simon.


The Secret Squirrel Club, a Gun, and More

by in Coded Smorgasbord on

"I guess the developer wanted to make make sure that all his bases were covered!" wrote Ryan.

/// <summary>
/// Returns True if the input string is 
/// null, empty, "undefined", or "null".
/// </summary>
/// 

Server Dump

by in Feature Articles on

When he arrived, the first thing Florian checked for was his box of rubber gloves. It was a daily ritual, but most important on the days when he had server room duty. The new hires got quite a laugh out of his odd behavior, but that’s only because they hadn’t been there on… that day.

It was a few years earlier, when Florian was himself a new hire with the company. It had started as a normal, if gloomy day. Clouds had moved in spent the week dumping rain and depression on the city. Florian was fairly certain he had forgotten what the sun looked like, not that it mattered- he had server room duty that day.


My Dearest Amy

by in Feature Articles on

Like any website with a contact form, The Daily WTF gets its share of spam. In addition to saying the darndest things, spammers will often push SEO services with a message like this.

From: [email protected] 
Sent: Wednesday, June 20, 2012 7:03 PM
To: Alex Papadimoulis
Subject: let's succeed together
--------------------------------------------------------------------

Hi,

My name is Amy Thompson and I would really love to tell you 
how thedailywtf.com can rank even better in Google.

I'm a SEO expert working at SEO Search Results and while doing
a research for some of my colleagues I found your email address and
decided to contact you immediately.

If you are interested I will be happy to send the additional 
information and all the details needed to make it happen.

Thanks a lot,

Amy
seosearchresults.net

The GNDN Protocol

by in CodeSOD on

The sort of software that’s used for research is the sort of software designed by engineers, not developers. With tight deadlines, corners get cut. This creates software that supports more shell injections, sql injections, and venous injections than useful functions. That’s bad, but all too common. This block that Koen found, on the other hand, is special.


            

Literal DVD Burner

by in Error'd on
foo

"I was looking for an external DVD burner for my notebook computer," writes John Snape, "I guess they took the design literally when they made this one!"


Best of Email: Career Limiting Email, That's What the BCC Field is for, and More

by in Feature Articles on

Don't forget, The Daily WTF loves terrible emails. Got one your self? Then mail in your mail!


Career Limiting Email (from Ben)


Known Bad Code

by in CodeSOD on

Juho was skimming around code, searching for a bug, when saw the following PHP code. In my opinion, its purpose was probably as a workaround for a bug in MySQL 5.0. I mean, I hope it was.

At least the original author knew it was bad code.


Ask WTF: Salary

by in Alex's Soapbox on

Some IT problems are easier to solve than others. And some might be downright impossible, like this letter:

Dear WTF, I am a female web developer. That’s not the WTF. I’m honestly worried that I really am making only 71% of what my male co-workers are making. How can I know if this is true?


Determined

by in CodeSOD on

There are a large number of programming problems that involve the use of matrices and linear algebra. And when you have a matrix, there may be times where you need to know its determinant. For calculating the determinant of a 2x2, or a 3x3 matrix, there’s a fairly straightforward formula. On the other hand, if you need a generic solution for a matrix of any size, you have to get a little more complicated.

One of Jarrod’s co-workers had their own “optimized” solution for this. It’s optimized in the sense that it doesn’t always return the right answer. This particular sample is for 3x3 matrices, but don’t worry: it’s been copy/pasted into all the spots that need to work with 4x4 matrices too.