A Shining Perl

by Jane Bailey in CodeSOD on 2015-01-29

Pan paniscus06Ah, Perl. Often derided as a "write-only language", Perl nevertheless enjoys some level of popularity among WTF-savvy workplaces. So when David inherited a codebase through the purchase of a company staffed entirely with, what he had dubbed "mentally challenged chimpanzees", it seemed only natural that the code was entirely in Perl.

Dealing with financial transactions is one of the key features required for any online shopping or banking applications, and as such, it's more or less a solved problem by now. So of course, the perl gurus at ChimpanCorp reinvented the wheel with their Real-time Financial Processing app. It would calculate the user's balance every ten minutes by compiling all data posted since the last calculation, leading to a balance that was never more than ten minutes out of date! Of course, that's as good as you can possibly get when the calculation takes nine minutes to run. Still, the client was wondering if maybe the could speed up the calculations so it could run, say, every five minutes? Or maybe, hypothetically speaking, immediately after every transaction?

34 Comments - Last Comment @ 19:30

When You Really Want to be Sure it's an INT

by TJ Mott in CodeSOD on 2015-01-27

Datatypes are difficult. So is typecasting. And if you don't understand one, you probably don't get the other either. And if you don't get either, you should probably give up on writing code and find a new career. You may get a slight pay cut for doing so, but at least you can quit spending half your salary on all those expensive reconstruction surgeries every time your coworkers go on a cluebat rampage against your face. And your coworkers will certainly appreciate not having to lose brain cells to your poorly-written functions, like these submitted by Kevin.

private int GetClassRoomArea(Int32 StudentCount) {
  return ((int)(Convert.ToInt32(StudentCount)) * 2 / 1000); 
} 

82 Comments - Last Comment @ 2015-01-28

Flying is Easier than Math

by Mark Bowytz in Error'd on 2015-01-23

"I travel a lot for work and watch my 'premier (elite) qualification' with United fairly closely," writes Lincoln, "Imagine my surprise when I was looking at my account and United was showing 4,100 qualifying segments as my beginning balance. Sadly, like many aspects of the new United, 4100 plus 37 equals....78."

89 Comments - Last Comment @ 2015-01-28

Backwards Interview

by Remy Porter in CodeSOD on 2015-01-22

There are a lot of different schools of thought on administering programming tests to new hires. On one hand, you’re hiring them to program, so it might be nice to see if they can actually do it. On the other hand, given the time constraints of most interviews , it’s nearly impossible to give them a meaningful test.

Rot a renegade, wed a generator

85 Comments - Last Comment @ 16:49

Images...Why Settle for Just One?

by snoofle in CodeSOD on 2015-01-20

Grab a handful...you know you want to!We've all seen folks who have trouble dealing with for-switch statements, exception handling, dates/times and so forth. As such, it should come as no surprise that people have at least as much trouble dealing with images.

In practice, there are only so many things you can do with an image. You can load it from a file or URL. You can calculate its size. You can stuff it into some buffer. You can even display it in a variety of ways. As long as you have a graphics library handy, one would think that these things would be fairly straightforward tasks.

20 Comments - Last Comment @ 2015-01-26
View Article Archives »