For more fun-but-not-necessarily-bad code, check out the previous episode: Coded Smorgasboard: Muhahahahaha


It's not that Thorsten doesn't have a sense of humor, it's just that finding this function (which simply processes a list of names and converts them to proper case) after hours of debugging several similarly named functions, it gets a little tiring ...

function castration($willy) { ... }

 

Oscar found this during a recent, and apparently much needed, clean up of the codebase for an application. Good for when the number line reverses itself I suppose?

if (Math.max(1, 2) == 2) return;

 

A maintenance programmer working on Jim T's 700+ line Perl script found only a single comment in the code. Though Jim can't remember what the fix was, he hopes that, by admitting his mistake here, his coworker will finally let him live it down ...

# F--k it, I'll use the fix.

 

Bryan Ross really wanted to make sure that it was not a PostBack ...

If Not IsPostBack Then
  If Not IsPostBack Then
    LoadReport()
  End If
End If

 

Nikita Zhuk thought there might be a deeper, more fundamental lack of understanding when she came across this question posted on Experts Exchange ...

hi all,

IntTemp = Int((255 * Rnd()) + 1)

I used above ASP.NET code. Problem is in " Rnd() "
Rnd() value is changing everytime.

What is the alternative for Rnd()? 
OR How will stop Rnd() value changes at everytime?

 

Working at a company with development locations around the world, Stephan Knuth has learned to deal with coworkers who use their native language when coding. He just wishes he could figure out what they were trying to do here ...

/*Added by Jiang W */
void ji_suan (int ni_hao)
{
    int yi_shi  = 0;
    // yi_shi = 3 /*erase by Li K */
    yi_shi = 3;
    return;
}

 

A.B. discovered the source of the random failure of their billing system ...

int invoiceId = new Random().nextInt();

 

As a programmer for military contractor, Alex didn't quite expect to find this in the code for a weapons launch system ...

private static final Logger logger 
     = Logger.getLogger("DickBagMcButtMunch");

 

I guess in Ryan Patterson's company, use of equipment changes the basic laws of mathematics?

IF 0 > 0
BEGIN
  SELECT 'Equipment is in use'
  RETURN
END

 

From the Jan-Feb 1982 of Computer Gaming World (as discovered by Jaliya Jayawardena), here's how we used to patch games before that whole Internet thing was around ...


Full Size: http://img.thedailywtf.com/images/200611/1982_0102_issue2.gif

 

Brandon strapped on his seatbelt and braced himself. He was prepared for return ...

  ...

  /* Prepare for return. */
  return;
}

 

From A, I guess this just gives a whole new meaning to "Infinity Plus One" ...

#define INFINITE	10000

 

I wonder if this next one (discovered by Andy Goth) is from the same codebase ...

#define ZERO -1

 

Gabriel Aubut-Lussier's colleague is aparently a fan of the "long way" of writing "false" ...

existingCustomerForm.setError(Boolean.FALSE.booleanValue());

 

I suppose we'll wrap things up with O.K., who found this comment block at the beginning of a stored procedure while doing some debugging. Turns out MBolton was right ...

-------------------------------------------------------------
-- MBolton 2006-01-13
--   The //HACK to determine program's parent is very 
--   brittle.  Someone should probably fix that.  In fact 
--   if you're reading this, it's probably already broken.
--   Good luck.
-------------------------------------------------------------
[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!