Search
Tweets
Recent Changes
Friday
Nov192004

MySQL Query Cache

Symlinking tables across database in MySQL is a really bad idea.

That is all.
Wednesday
Nov172004

JDBC Annoyance

I like JDBC more than even DBI, which has always been my favorite database abstraction doodad. But this irritates the crap out of me. setLong()! Consider the following:

Connection conn = ...
PreparedStatement ps = conn.prepareStatement("SELECT name FROM customers WHERE customerid=?");
ps.setLong(1, someVar);

That works great, as long as someVar is a long and not a Long. If someVar is a Long you have to call longValue() on your Long since setLong()'s signature is (int, long). But what if someVar is null? NPE!

So you could fix that with:

if(someVar != null) {
ps.setLong(1, someVar);
} else {
ps.setNull(2, Types.INTEGER);
}

But that's so wordy! As I wrote this I decided that maybe this code would work:

ps.setObject(1, someVar, Types.INTEGER);

It should handle the null. Let's hope so!
Tuesday
Nov162004

More S40 Fun

The first day I had my baby back, I filled it up with gas. The next morning my garage smelled strongly of gasoline. I inspected the floor and found a quarter sized wet spot from under the gas tank.

I assumed that Volvo had borked reinstalling the tank so I scheduled service again. This time I have a pinhole in the tube that goes from the filler to the tank. I get the car back tomorrow. Yay.
Monday
Nov152004

Comment Defense

I get a pile of comment spam every time I post. I've added some Wordpress plugins that will hopefully defend against this.
Monday
Nov152004

I'm A Bad, Bad Programmer

I admit it: I'm completely not writing unit tests for our current code.

Why? Well, Eclipse is writing all the setters and getters, and the backend database stuff is a PITA to test. Unfortunately, pretty much all the logic in this app is based arond those inserts, updates, and deletes.

Update: We now have unit tests. I bent to your collective will.