Opportunity Lost

$ whois ihaveawidestance.com
Registered through: GoDaddy.com, Inc. (http://www.godaddy.com)
Domain Name: IHAVEAWIDESTANCE.COM
Created on: 02-Sep-07
Expires on: 03-Sep-08
Last Updated on: 02-Sep-07

I had a good idea; looks like someone else got there right after the fact, though.

Posted in Uncategorized | Leave a comment

revetkn.com library

Spent some time converting my old Books library (in which I had entered all of my technical books a year or so ago) to Delicious Library format using a Groovy script. It’s incomplete right now, but what the hell. Take a look: library.revetkn.com.

Posted in Uncategorized | Leave a comment

Waltham and Half

Just recently made another trip up to the Intuit offices in Waltham, MA.  If you’re a good engineer and are looking for work, you can’t go too far wrong there – the Innovation Lab has a playroom with an HDTV, Wii/Guitar Hero, fussball table, and pool table. Good stuff!

Also found out while flipping through the xmog design portfolio today that “our” Ed was the guy who did the original half.com logo years ago (and they still use it today – follow the link and see for yourself).

Posted in Uncategorized | Leave a comment

Returning soon…

Still fooling around with Slicehost right now.

Posted in Uncategorized | Leave a comment

Compressing Your Javascript

Definitely give YUI Compressor a try if you’re writing a webapp with a non-trivial amount of Javascript.  It’s under pretty active development and I’ve had better experiences with it than Dojo’s ShrinkSafe.  The plan is to try and integrate it into Billing Manager if I get some free time soon. 

Posted in Javascript | Leave a comment

isitchristmas?

it is christmas?

Posted in Humor | Leave a comment

Realfield

Realfield is hilarious. This one’s my favorite:Realfield

Posted in Humor | Tagged | Leave a comment

Javascript Performance Tips: Never Use onload

Don’t do the following:

<body onload='myFunction()'>

…unless you really know what you’re doing or have a good reason to do so.

Why? Because browsers don’t fire onload until all page elements have loaded (this includes images). Generally speaking, all your code should care about is knowing when the DOM is ready to be manipulated. Like just about every other useful web coding trick, hooking the “DOM is ready” event is nonstandard and browser-specific. Luckily for us, the hard work of building a unified interface for this has been done by Dean Edwards, John Resig, and others – see this discussion on Dean’s site for some background. Concrete implementations are provided by jQuery, MooTools, and others.

Using jQuery’s ready event, the above code can be simplified to:

$(myFunction)
Posted in Javascript | Tagged , , , | Leave a comment

JRuby at Sun

Charles Nutter and Thomas Enebo, co-developers of JRuby, are taking full-time positions at Sun.

This is a big deal because:

  • Assuming that JRuby becomes mature and efficient with Sun's help, there is a much greater potential for enterprise-targeted Ruby systems. Java's greatest asset is its established base of 'heavy lifting' code, and being able to interact with that seamlessly means a lot. Imagine writing a Rails app that uses EJBs and performs distributed transactions…
  • The old is new again – dynamic language features are becoming more prevalent. Java has language support for closures in the works for Java 7, and C# has become everything and the kitchen sink as of 3.0. If you write code for a living, these are signs that it's time to start getting familiar with dynamic language features if you haven't already.

Somewhat related comment: The older I get, the more I find myself using closure-like 'nested one-method interface designed to be used by passing anonymous implementations to the enclosing class' constructs to do work in Java.

Somewhat-related open question: what happens to Rails when DHH decides it's time to move on?

Posted in General | Leave a comment

Handling Oracle BLOBs with Hibernate and Spring

Oracle BLOBs have traditionally been a pain to deal with because of driver issues. It’s frustrating to work on a project where a lot of effort is directed toward overcoming technical problems instead of concentrating on the real problem domain – implementing a custom Hibernate UserType for mapping a BLOB to a byte[] is one such example.


Spring has a concept of a pluggable LobHandler, a strategy interface for its data access framework that allows for custom handling of BLOBs and CLOBs where necessary. The standard LobHandler usage scenario is handing it to Spring JDBC code that executes SQL or calls a stored procedure, but you can also use it when configuring a SessionFactory:

<bean id="sessionFactory"
  class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
  <property name="dataSource" ref="dataSource" />
  <property name="lobHandler">
    <bean class="org.springframework.jdbc.support.lob.OracleLobHandler">
      <property name="nativeJdbcExtractor">
        <bean class="org.springframework.jdbc.support.nativejdbc.CommonsDbcpNativeJdbcExtractor" />
      </property>
    </bean>
  </property>
  ... etc. ...
</bean>

Then, in the mapping file for the domain object that needs to map bytes to a BLOB, you can use the out-of-the-box BlobByteArrayType:

<!-- Make sure to use bytecode instrumentation for per-property lazy loading! -->
<property name="myByteArrayProperty"
  type="org.springframework.orm.hibernate3.support.BlobByteArrayType"
  lazy="true">
  <column name="SOME_BLOB" />
</property>

It’s like anything else: use what’s already there instead of reinventing the wheel to keep your code simple and relevant to the real problem you’re trying to solve.

Posted in General | 7 Comments