Secret Horror

by in Error'd on

Casanova Matt swings for the fences. "OKCupid (they don't capitalize the K, but I do, for propriety) must have migrated their match questions through Excel during a recent site revamp. These answers should obviously be 1-2 and 3-4, but maybe I could have 2 with Jan and 4 with Margaret (Mar to friends)."


Halfway to a Date

by in CodeSOD on

Roger took on a contract to fix up a PHP website. During the negotiations, he asked some questions about the design, like, "Is it object-oriented or more procedural?" "No, it's PHP," said the developer.

Which about sums it up, I suppose. Have some date handling code:


Brushing Up

by in CodeSOD on

Keige inherited some code which seems to be part of a drawing application. It can load brush textures from image files- at least, sometimes it can.

static public Brush GetImageBrush(string serviceCode, string imageName, string language)
{
	Brush BorderChannelGroupBrush;
	BitmapImage image = null;

	int point = imageName.LastIndexOf('.');
	string languageImagename = imageName.Substring(0, point) + "-" + language + imageName.Substring(point);

	try
	{
		image = FrameWork.ServicePageImageUrlOnContentServer(serviceCode, languageImagename);
	}
	catch { }

	if (image == null)
	{
		try
		{
			image = FrameWork.ServicePageImageUrlOnContentServer(serviceCode, imageName);
		}
		catch { }
	}

	if (image != null)
	{
		BorderChannelGroupBrush = new ImageBrush(image);
	}
	else
	{
		BorderChannelGroupBrush = Brushes.White;
	}
	return BorderChannelGroupBrush;
}

The Whole Thing

by in Representative Line on

David was integrating a new extension into their ecommerce solution, and found this un-representative line:

$this->model_sale_manageorder->exportOrder(substr($selectid,0,strlen($selectid)-1));

Irritants Make Perls

by in CodeSOD on

Grün works for a contracting company. It's always been a small shop, but a recent glut of contracts meant that they needed to staff up. Lars, the boss, wanted more staff, but didn't want to increase the amount paid in salaries any more than absolutely necessary, so he found a "clever" solution. He hired college students, part time, and then threw them in the deep end of Perl code, a language some of them had heard of, but none of them had used.

It didn't go great.


Not Impossible

by in Error'd on

Someone online said we run a Mickey Mouse outfit. Angered beyond words, we consulted [email protected] and they threatened to find that guy and sue him. So to anyone else who thinks this column is Goofy, you should know that the world's definitive authorities insist that it absolutely is not.

But these guys? This website actually is kind of goofy, according to resolutioner Adam R. who crowed "Someone forgot to localize some text for the new year!"


Crossly Joined

by in CodeSOD on

Antonio's team hired some very expensive contractors and consultants to help them build a Java based application. These contractors were very demure, very mindful, about how using ORMs could kill performance.

So they implemented a tool that would let them know any time the Hibernate query generator attempted to perform a cross join.


My Identification

by in CodeSOD on

Bejamin's team needed to generate a unique session ID value that can't easily be guessed. The traditional way of doing this would be to generate cryptographically secure random bytes. Most languages, including PHP, have a solution for doing that.

But you could also do this:


Archives