Journal
Feeling much better today, thank you. This is for two reasons:

Yesterday I was awarded a Featured position at SheezyArt, a site feature that I didn't know existed until someone pointed it out to me, and I was constantly refreshing my page at work to watch an avalanche of messages come in (and this just after I'd given up on getting listeners there). I'm trying to leave comments back as I think it's the polite thing to do, but they're coming in faster than I can think up different ways to say "Thanks for the favourite". The next time someone says I should form a real band, I may snap and actually do it.

And today, the first article on Worse Than Failure to make me laugh out loud at work was posted. Rather than direct people there and risk them being fatally injured from the discharge as the high-voltage overinflated egos scrape against each other, I thought I would reproduce it here. Now, amazingly enough, there may be people who read this who just can't find Java source code amusing, so I've improved it a bit by highlighting the comment lines (if the background of your page is blue you're out of luck). Think of it as like winding through Denis Norden on Alright on the Night to get to the funny bits.

Don't be scared by the code if you don't understand it (actually, if do understand it you're in danger of working with this man so you should probably be very scared indeed) - the best bit are the schizophrenic notes he leaves himself that signal a confident cruise into complete madness.



// I'll only ask one more question and then I think I am
// going to flip burgers for a living because I just
// can't figure this out!


// kludge, once in a blue this isn't set..


/**
* Tag to email the user. There is a seperate doc on the details on this tag somewhere...
*/


// new day is dawning or we re-booted, start count over

catch(Exception e) {
// hell what to say? Programmer not user error here!

}

return false;
//added by me


// oddity, can't figure out elegant solution

if (da.getServer().toLowerCase().equals("devdbsrv1"))
cmd.append("\\SQL2000");

catch(Exception e) {};
// sometimes its best to be quiet


// I don't get this why substracting 1 from the month is giving
// 1 YEAR ago. Would appear bad, so watch this

gc.add(Calendar.YEAR, -1);

private int rowCount = 0;
// due the nature of this "current row" isn't current row


// not sure why this needs to be a HashMap - and I wrote the damn thing

private HashMap applications = new HashMap();

//if we're not getting the database, just return some random numbers instead

System.out.println("db error: "+e);
Random r = new Random();
int randInt = Math.abs(r.nextInt()) % 11;
return Integer.toString(randInt);

//just tack on anything to make sure the result has no spaces or returns after it.

xmlOutput.append("&a=b");

// ooh baby is this check going to cause more issues then it's worth?

Core uc = (Core)findAncestorWithClass(this, Core.class);

// take a look at the content type

String type = "FIIN"; // f**k if I know

catch(Exception e) {
// what can we do? Printing an error as already failed!

}

// Don't let the command line get to big for it's britches

if (classNames.size() == 15 || j == nList.getLength() -1) {
String file = writeCommandFile(javaDir, classPath, tempDir, tomcatDir, classNames);
docBuff.append(runCommand(file));
classNames = new ArrayList();
}

int index = agent.indexOf("Windows");
// is it the 10,000LD Gorilla?


// don't ask.... okay you wanna know. Make unique URLs based on the image
// update count so when people change images it refelecs (else the page
// is cached

private static HashMap imagePageCount = new HashMap();

// just need get the &#$*ing class name of a string array

String[] blah = new String[1];
Class[] cos = { blah.getClass() };

// this check in abstract should not be needed,
// but abstract is often too abstrat for me to postive about

if (df == null && rf == null)
continue;

// smart, stupid? Strugglign with the fact I dont know
// the prices without doing a DB query, and that will lots of DB queries

public static HashMap retailPrices = new HashMap();
public static HashMap dealerPrices = new HashMap();
public static ArrayList badParts = new ArrayList();

// massage the sucker so as to not confused my little po' head

int eot = pstrResponse.indexOf("^~000EOT");
if (eot > 0)
pstrResponse = pstrResponse.substring(0,eot);
eot = pstrResponse.indexOf("^~EOT");
if (eot > 0)
pstrResponse = pstrResponse.substring(0,eot);

// how many fields of repeatable data do we have, this handy dany calucalation tells us

int totalCols = tok.countTokens() - dataTok.countTokens() - singularFields + 1;

private String TRANSACTION_CODE="DLRORD ";
// complete guess, havnen't gotten anything from Jerry yet


// really a big &*&*& kludge, sick, hurry, tied, and worked 10 hours..

String spd = (String)dbFields.get("start_pay_month");
String epd = (String)dbFields.get("end_pay_month");

catch(Exception e) {
// not that big deal..

}

// one can question if this is the "best" way.
// I first take the information and throw into objects, then I create hashtables
// and then I make a view out that....
// okay maybe I should go strait to hash tables I see that now!


// abstractly this should be 0, but.. just accept 1.

if (count == 1)
return "Y";

// okay a little corny, but create new object to keep the
// the values field of this object untouched....

ItNutsAndNotes t = new ItNutsAndNotes();

/**
* Gets a list of invoices for orders with the given criteria
* @.attribute status: The status of s**t
*/


catch(Exception ex) {
System.out.println("CAN'T DO S**T");
};

// never happes, can't figure the f**k out why

if (action != null && action.toUpperCase().equals("CANCEL")) {
return EVAL_PAGE;
}

F**K <- Who wrote that???

if (r != EVAL_BODY_AGAIN) {
System.out.println("AAA....");
pageContext.getOut().print("F**KME");
}

//This is a miserable hack I am about to perform.
//Since the POCheck happens in the super class, and uses the user to do so,
//I need to temporarily set the order of the user to the deleted order, then switch
//it back to what it was after the POCheck is complete. The hand is quicker than the eye!


I haven't encountered anything quite as glorious as that lot in my work, but there was one that came pretty close. You'll have seen a couple of "catch {}" blocks in the code above, which are meant to be used for deciding what to do if an error occurs and hopefully recovering from it. Instead, the entire contents of one of the catch blocks in our system reads "// Oh well".

2007-06-23 00:02:00