Recent Articles

27 Jan 2015

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

64 Comments - Last Comment @ 08:59
26 Jan 2015
23 Jan 2015

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."

87 Comments - Last Comment @ 2015-01-27
22 Jan 2015

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

84 Comments - Last Comment @ 2015-01-27
21 Jan 2015
20 Jan 2015

Images...Why Settle for Just One?

by snoofle in CodeSOD on 2015-01-20

Grab a 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
19 Jan 2015
16 Jan 2015

For Those Who Insist on Zapping Their Tongues

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

"Cool! Amazon now apparently offers a battery that comes in various flavors to enhance the experience," writes Evan C.

74 Comments - Last Comment @ 2015-01-19
15 Jan 2015

The Java Purist

by Jane Bailey in CodeSOD on 2015-01-15

THIS IS PUREAli was what they like to call "Purist". You know the type by now: the man who's never met a piece of Java code that didn't need a refactor for the sake of "style". Too bad for him he was assigned to work on some code that had been ported to Java from other languages. It worked, but it wasn't Pure.

Nor was he sensitive to budget constraints or scheduling issues. On one fateful Friday afternoon, he couldn't take the impurity any longer. Over the course of around 6 hours, he committed dozens of minor revisions to source control, touching nearly every file in the codebase:

Revision Author Message
2345 Ali Replacing underscores with mixed case function names, as per Java standards.
2346 Ali Renamed function today() to now(), to better document the functionality of the code.
2347 Ali Replacing spaces with tabs, as per Java standards.
2348 Ali More replacement of spaces with tabs, as per Java standards.
2349 Ali Removed spaces at the ends of lines, as per Java standards.
2350 Ali Renamed unclear variables trigger_nm and table_nm to trigger and table.
2351 Ali Variable names MUST begin with a lowercase, as per Java standards.
2352 Ali Constants declared with final MUST be all uppercase, as per Java standards.
2353 Ali Alphabetized table listing, for readability.
2354 Ali Mass correction of indentation using Eclipse, as per Java standards.
2355 Ali Alphabetized function listing, as per Java standards.

148 Comments - Last Comment @ 2015-01-23
14 Jan 2015
13 Jan 2015

Today is Special

by TJ Mott in CodeSOD on 2015-01-13

march-2011-whateverShawn's company needed a critical piece of software developed ASAP. The development team estimated six weeks of time to build it from scratch, but those in charge felt that was far too excessive. The devs had a track record of missing features--"Management NEVER told us we needed that feature!", botched rollouts--"What?! You told $newClient their site would go live on Monday? The product won't be ready until August and it's only February!", and going over-budget--"We developed it for SQL Server Express, I don't know why $phb bought us an enterprise Oracle instance."

Against the objections of everyone who did the actual work within the company, management partnered with the local University to have graduate students, most of whom had zero experience outside of academia, develop the new system for internship credit. Unpaid, of course. The plan then was that Shawn would spend "an hour or two" to polish the code up a bit and get it going in production.

89 Comments - Last Comment @ 2015-01-25
12 Jan 2015
09 Jan 2015

Savings That You Wouldn't Believe

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

"Apparently this subscription service will stop at nothing to keep my business," writes Mike F.

0 Comments - Last Comment @ 04:07
08 Jan 2015

Structured Exceptions

by Remy Porter in CodeSOD on 2015-01-08

These days, most languages have some variation on the “structured exception handling” concept. Exceptions get thrown inside of a “try” block, and then a search begins for a matching “catch” block, specific to that kind of exception. cru d'exceptionEach type of exception can be handled differently, which allows minor errors to print messages for the user, while fatal, state-corrupting errors can lead to the application exiting and hopefully not damaging any data.

A good developer catches all of the possible exceptions. By that standard, the contractor who gave Martina this code must be one of the best :

86 Comments - Last Comment @ 2015-01-13
07 Jan 2015
06 Jan 2015

Jack and the Beanstalk

by Jane Bailey in CodeSOD on 2015-01-06

beanOnce upon a time, in a far off kingdom named 1996, there was a developer named Jack. Jack worked for a poor company that could barely afford to buy grain with which to bake objects; they had to make do with Delphi forms, pinching and scraping what they could into an application. Instead of methods, they were stuck with button events, from which they milked database tables.

One day, Jack came to realize that the button events were growing old, and soon, no more good could be wrung from them. Sadly, he knew it was time to retire his old Delphi code. But what could he live on?

27 Comments - Last Comment @ 2015-01-14
05 Jan 2015
02 Jan 2015

Everything Californian Be Found On The Internet

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

"You wouldn't think that anyone would ever make such a clbuttic mistake as replacing every instance of 'ca' with 'California' on a page, yet, here we are," John S. writes.

42 Comments - Last Comment @ 2015-01-06
01 Jan 2015

Classic WTF - The Long Way

by Mark Bowytz in Coded Smorgasbord on 2015-01-01

2014 was a great year for us and hopefully for you too! Happy 2015 everybody! Enjoy this popular WTF from all the way back in May.

Sometimes, a developer just needs to take the long way around. Sure, a line of code like DateTime StartTime = DateTime.Now looks simple and readable, but what happens if you want the StartTime variable to be not exactly now?

0 Comments - Last Comment @ 04:07
01 Jan 2015

Classic WTF - A Pentester's Paradise

by Mark Bowytz in CodeSOD on 2015-01-01

To help ring in the new year, here - enjoy this "Best of WTF" classic that ran in 2014!

Tom works as a pentester and, as such, gets paid big bucks for finding flaws in his clients' websites usually because he has to find less than obvious 'gotcha'-level flaws.

131 Comments - Last Comment @ 2015-01-26
01 Jan 2015

Happy New Year Everybody!

by Mark Bowytz in Announcements on 2015-01-01


Wow! Awesome! This is the year we finally get the flying cars and hoverboards that we were promised. I can't wait! It's officially the future.

0 Comments - Last Comment @ 04:07