Recent Articles

Jan 2015

You Can't Beat This High Score

by in Error'd on

"According to Rocksmith's global stats, it looks like there's no point attempting to beat the arcade high score," Andrew M. wrote.


A Shining Perl

by in CodeSOD on

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?


Common Sense Not Found

by in Feature Articles on

Mike was a server admin at your typical everyday Initech. One day, project manager Bill stopped by his cube with questions from Jay, the developer of an internal Java application.

“Hello there- thanks for your time!” Bill dropped into Mike’s spare chair. “We needed your expertise on this one.”


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

by in CodeSOD on

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

We're Not Gonna Pay It..Anymore

by in Feature Articles on

TWISTED SISTER!! DEE SNYDER!!!!In the world of software development, you have customers, who request and ultimately use the software, and development organizations, who build and test said software. Of course, it's never that simple. At some point, the customer has to try using the software in order to sign off on it.

At least in a sane business arrangement. Sometimes, things get all twisted around.


Flying is Easier than Math

by in Error'd on

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


Backwards Interview

by in CodeSOD on

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


FAP it Good

by in Feature Articles on

Francis was at the start of what was sure to be a challenging and rewarding journey towards a degree in Computer Science. One of his first classes was a group study course built around cross-departmental education. It forced together a Business major named Suzanna to play the role of Project Manager, Francis and Carlos, another CS student, as developers, and a Music major named Johann, as a tester. Assignments and interaction with the instructor were all online, but the group met in person to work on their project.


Images...Why Settle for Just One?

by in CodeSOD on

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.


The Backend

by in Feature Articles on

Andrei had just moved to a new country, and was looking for work. With the ideal job not immediately forthcoming, he jumped when an interesting opportunity opened at a small tech company: OldIsNewCo.

OldIsNewCo was one of the pioneers bridging the gap between old methods of communication (e.g. paper) and new methods of communication (i.e. the Internet), and was looking to overhaul their entire infrastructure. Their existing backend was built in C++, and according to The Big Boss: “C++ developers are expensive and hard to find. PHP developers are plentiful and cheap. Therefore, we need to re-implement everything in PHP.”

This seemed fishy to Andrei right from the start, but he figured it would be a good opportunity to brush up on his C++ and PHP skills and experience, and “a job’s a job”. So he accepted the position and met with his development tour guide to start diving into the sources and seeing how the backend applications worked.


For Those Who Insist on Zapping Their Tongues

by in Error'd on

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


The Java Purist

by in CodeSOD on

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.

You Will Be Admin-similated

by in Feature Articles on

Come and join the flock!Peter Drucker said "Culture eats strategy for breakfast," and you'll never see a better example of what that means than when a big company tries to digest a small one. As a helpdesk support tech, Woody had a front-row seat for the merger between his employer, a 100-person shop named Initech, and Megatrode, a hulking giant of a corporation that saw Initech as (according to the stirring on-boarding speech given to Woody's team by one of Megatrode's seven-dozen VPs) "a strategic acquisition in the enterprise space." Drucker's remark became more than just a pithy witticism when the time came to bring Initech's systems in line with Megatrode's Byzantine corporate policies. First on the long list of blanket edicts: "local admin rights for all users".

Woody's boss, Ryan, stumbled into Woody's cube and poured himself into the spare chair. He delivered the new policy with a cheerful "what could go wrong?" But Woody had never seen him look less cheerful: since the merger, Ryan's days had been an endless series of conference calls with Megatrode's Hydra-headed IT departments, trying to address their disparate and frequently contradictory support procedures. Woody was sorry to burst his boss's bubble. "Something already has," he said, pointing to his inbox. "Eleven—make that twelve—users have reported that the shortcuts to the network databases have gone missing from their desktops."


Today is Special

by in CodeSOD on

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.


Getting the Green Light

by in Feature Articles on

greenlightTests. What can you really say about them? They are a royal pain to write and an even bigger pain to keep current as code changes. Nevertheless, we all (should) write them because they help verify that changes to the code don't break something and that the code works properly.

Of course, in order to be of any real value, the tests need to be useful tests. For example, a test to verify that setting the value of an integer to 5 and then immediately reading that integer to see if it's actually 5 doesn't really add any value. The same applies to tests like this:


Savings That You Wouldn't Believe

by in Error'd on

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


Structured Exceptions

by in CodeSOD on

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 :


Stalled for Time

by in Feature Articles on

Drew worked for a petite e-commerce company, where his primary responsibility was to keep everything running. He saw to day-to-day maintenance, as well as backup and disaster recovery.

The small shop’s resources were limited. Critical data remained tied up in onsite legacy systems- and of course, the “supply closet” was full of relics from a clunkier, floppier era. Drew did the best he could to shield the company from server outages, power outages, backup failures, and other common scenarios.


Jack and the Beanstalk

by in CodeSOD on

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?


Papers, Please

by in Feature Articles on

Border Guard"Glory to Arstotzka!"

It was already 7pm, and Jeff was almost finished packing his things and heading home. He was looking forward to a nice can of local beer and a video chat with his girlfriend, which he had to leave a few timezones away when an unexpected government contract popped up. American at heart, but eager to explore different cultures, he agreed to provide technical support for Arstotzkan foreign affairs department – and a hefty pay helped to seal the deal.


Everything Californian Be Found On The Internet

by in Error'd on

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


Classic WTF - The Long Way

by in Coded Smorgasbord on

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?


Classic WTF - A Pentester's Paradise

by in CodeSOD on

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.


Happy New Year Everybody!

by in Announcements on

happy-new-year-gentlefolk

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.