Instantiating and populating a list or collection

November 20th, 2006

In Java it always irks me when I have to create a collection and then populate it in separate steps as follows:

List states = new ArrayList();
state.add(State.CA);
state.add(State.WY);

Then today I read about using an anonymous subclass with instance initializer to initialize a collection which appeals to the block loving Rubyist in me:
Read the rest of this entry »

Using Ruby’s timout to keep the user experience snappy

October 25th, 2006

On a my Ruby on Rails based San Francisco Sailing Weather website I make calls out to flickr.rb to retrieve photos.
Read the rest of this entry »

Upgrading to Spring 2.0 and Hibernate 3.2

October 19th, 2006

Tonight I just completed the upgrade from Spring 1.2 and Hibernate 3.1 to Spring 2.0 and Hibernate 3.2 for work. I was expecting a rough upgrade but was pleasantly surprised how easily it went.
Read the rest of this entry »

Xalan XSL transformations in the 1.4 JDK can be VERY slow

October 13th, 2006

At work as part of our XML data feed product we end up doing XSLT transformations on XML files starting a a few MB all the way up to several hundred MB. Using the 1.4.2 JDK it took over 4 days to do the XSL transformation on the largest file so over lunch one day we started brainstorming our troubleshooting approach. When we tried it on the 1.5 JDK the same transformation took a couple of minutes as opposed to 4 days. Talk about an improvement!
Read the rest of this entry »

Deferring ad loading on your pages to avoid unnecessary outages

October 3rd, 2006

At GreatSchools we’ve had 3rd party ad server outages or slowness effectively make our site unusable as users browsers waited for certain ads to render before rendering the rest of the page. I had originally thought just specifying height and width of the div element around the ad would be enough for the browser to move on given a slow ad load but in my tests with various ad servers that turned out not to be the case. After some research I discovered that the trick that some sites (such as Digg.com) employ is called source ordered content where you put the content in the order you’d really like it in (be it for SEO or for deferring ad calls) and then using CSS or Javascript to move it to the proper place.
Read the rest of this entry »

SQL statements mysteriously not replicating with MySQL replication

September 13th, 2006

If you’re using MySQL replication there’s a feature/bug that you should be aware of. The following SQL statement would not replicate to the slave servers:
Read the rest of this entry »

MySQL ODBC Driver issues and Excel

September 12th, 2006

Caveat: this post is probably only of interest if you’re running into this particular MySQL ODBC Driver problem. Hopefully other people running into this issue will find this useful or please add a comment if you find a better way!

Today I had to get an Excel document that was loaded with ODBC database queries that connect to multiple MySQL databases working on a new machine. The problem I ran into is that if there are any MySQL permission issues such as a missing grant, authentication problems, etc… you’ll always get the following completely meaningless error message:
Read the rest of this entry »

Making your Rails app mobile with WAP and WML

August 31st, 2006

I’d been wanting to make my Ruby on Rails based San Francisco Sailing Weather site available for mobile / cell phones. Now that I’m on vacation in Germany I had a stretch on a train ride where I was able to crank out a simple working version. Here are the steps I took:
Read the rest of this entry »

Trafeoffs of aggressive filesystem partitioning

August 23rd, 2006

Most systems administrators will tell you it’s important to partition your install into anywhere from 4-7 discrete patitions (or slices if you’re in the BSD camp). While I think it’s good advice in certain cases, the headaches of mis-guessing disk space requirements have bitten me so many times that I’ve grown jaded and only create a new partition for a filesystem if there’s a really good reason such as:
Read the rest of this entry »

Encrypting sensitive files on Mac OS X

August 20th, 2006

I was looking for a solution to keep my financial data (quickbooks, excel, important documents, etc…) encrypted on OS X so that if my laptop were stolen, lost, etc… I wouldn’t have to worry about it. I also like to backup my data to my colocated Linux server so in the event that that machine were compromised I wanted to be protected. As it turns out, Mac OS X has the perfect solution for this: read-write encrypted disk images. Here’s how you do it:
Read the rest of this entry »