Remy Porter

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

Oct 2012

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.


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.


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]];

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.


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.


            

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.