Swimming with the Razorfishes

Saturday, July 30, 2005

And who knew there was a CoffeeGeek podcast. I may be one of those people, but I don't want to be one of those people, if you know what I mean.

I hope Derek realizes that when I called him a dumbass, it was a term of endearment. I meant dumbass in the best possible way. I have much better names for people I don't like.

Friday, July 29, 2005

The New York Times is reporting that the Brooks Institute, a rather well-known photography school in California, is accused of misleading students during the recruitment process.

"The California bureau, in addition to finding violations in Brooks's records, sent an employee to the school, posing as a prospective student. The report said she was told that she could expect her starting salary to be "$50,000 to $150,000" in her first year after graduation from Brooks - enough to pay off the debt she would take on as a student. "The sky's the limit," the admissions official said of her prospects, according to the report."

Were any of the students actually stupid and naive enough to believe this line?

Every two days for the past two years more civilians have died in Iraq than in the July 7 London bombings.

Thursday, July 28, 2005

So cool. Edmund Leveckis also posts to Flickr. I love his photos. I also really like how mysterious he is.

My friend Bob's widget, ChessPuzzle, is Apple's featured widget today.

If you are into chess, and are running MacOS X 10.4, it is really nice.

Wednesday, July 27, 2005

I forgot to mention some things about the code in my previous post.

That class makes some serious assumptions. Big ones. It will only work when running inside a Weblogic J2EE container, using Weblogic pooled database connections, and only when running against an Oracle database. Note the lack of error checking around all the casts and reflection. It wouldn't be too difficult to modify it to use different databases or make it more generic.

Using that class in any other situation won't work. In fact, it will probably blow up in some spectacular ways. Used outside these very specific parameters, it may cause your genitals to shrivel up and make that just-bit-into-a-lemon puckering sound.

Other than that, I'm sure it is rock solid.

I recently found myself needing to stick Unicode text into a table in an Oracle database built with an ASCII character set. Two things were unclear at that time: could an ASCII Oracle database hold Unicode without screwing it up; could I tell Hibernate (the underlying OR mapping tool) to treat a few columns as Unicode, treating the rest as ASCII.

It turns out that the answer to the first question is "yes." The standard NCHAR and NVARCHAR seem to work fine, even in an ASCII database. The code below solves the second problem. This is a subclass of a Hibernate Type. Using this type in the Hibernate mapping file instead of the standard String type was all that I needed.

I'm sticking this example out here in case anyone else needs to do something similar. If anyone sees any issues with the code, let me know.

public class UnicodeStringType extends org.hibernate.type.StringType

{
private static final String WEBLOGIC_NATIVE_ACCESSOR = "getVendorObj";
private Method oracleNativeStatementAccessor;


public void set(PreparedStatement st, Object value, int index) throws SQLException
{
super.set(st, value, index);

PreparedStatement nativeStatement = null;

try
{
this.oracleNativeStatementAccessor
= st.getClass().getMethod(WEBLOGIC_NATIVE_ACCESSOR, (Class[]) null);
nativeStatement = this.getNativePreparedStatement(st);
}
catch (Exception e)
{
e.printStackTrace();
throw new ApplicationException(e);
}

((OraclePreparedStatement) nativeStatement).setFormOfUse(index, OraclePreparedStatement.FORM_NCHAR);
}


/**
* Retrieve the PreparedStatemtn via WebLogic's getVendorObj method.
*/
private PreparedStatement getNativePreparedStatement(PreparedStatement con)
throws IllegalAccessException, InvocationTargetException
{
return (PreparedStatement) this.oracleNativeStatementAccessor.invoke(con, (Object[]) null);
}
}

Photos on Flickr tagged with "emo glasses": 5

Photos on Flickr tagged with "little man": 298

POTD

Curb
click for high-res

Yuck. This is gross.

Weather Forecast

I'll see you guys in September. I'll be in my apartment until then.

Tuesday, July 26, 2005

Taking photographs in New York City can be dangerous, especially if your color is brown.

POTD

Curb
click for high-res

I can't get enough black.

Monday, July 25, 2005

Play. Repeat.

Now you know what my life is like.

For the Java developers out there...

I've been using early build of IntelliJ's Idea 5.0 for a while now, and, wow. Idea has a number of really impressive features, but, somehow, IntelliJ manages to make Idea do the shitwork of Java development really well.

I just refactored a method, adding a parameter to a constructor. I had previously stubbed out some code so that the needed extra parameter was available in all the places this class is instantiated. Idea's "add parameter" refactoring didn't just change the constructor signature; it went through usages of the class and updated the calling code to pull in the new parameter.

That is pretty impressive.

There are many examples of things like this "just working." Idea really saves me time, which is much, much more than I can say for other tools.

Other good stuff: XML and JSP editing are much better (including validation, refactoring, and formatting); Java 5 support works well; the static code analysis is far more useful in 5.0

Spolsky: Design adds value faster than it adds cost

It's not just a matter of "10 times more productive." It's that the "average productive" developer never hits the high notes that make great software.

Freaky. I was about 100 meters away, and didn't hear anything.

POTD

Mist
click for high-res

Mist.

I am going to start peppering conversations with the phrase, "fuck you, robot."

Cop: "So, what you been doin' there?"

Perp: "Uh....nothin?"

[via The Smoking Gun]

For the Mac-Heads: Yahoo acquires Konfabulator, gives it away for free. I have no idea why they would do this.