Instantiating and populating a list or collection

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();

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:
Continue reading

Posted in Java, Ruby, Software Engineering | 12 Comments

Using Ruby’s timout to keep the user experience snappy

On a my Ruby on Rails based San Francisco Sailing Weather website I make calls out to flickr.rb to retrieve photos.
Continue reading

Posted in Ruby on Rails, Software Engineering, Web | Comments Off on Using Ruby’s timout to keep the user experience snappy

Upgrading to Spring 2.0 and Hibernate 3.2

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.
Continue reading

Posted in Database, Java, Software Engineering | 3 Comments

Xalan XSL transformations in the 1.4 JDK can be VERY slow

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!
Continue reading

Posted in Java, Software Engineering, XML | 1 Comment

Deferring ad loading on your pages to avoid unnecessary outages

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 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.
Continue reading

Posted in CSS, Design, Javascript, Software Engineering, Web | 2 Comments

SQL statements mysteriously not replicating with MySQL replication

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:
Continue reading

Posted in Database, MySQL | 2 Comments

MySQL ODBC Driver issues and Excel

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:
Continue reading

Posted in Desktop, MySQL | 2 Comments

Making your Rails app mobile with WAP and WML

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:
Continue reading

Posted in Ruby, Ruby on Rails, Software Engineering, WAP and WML | 6 Comments

Trafeoffs of aggressive filesystem partitioning

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:
Continue reading

Posted in FreeBSD, Linux, Systems Administration | 2 Comments

Encrypting sensitive files on Mac OS X

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:
Continue reading

Posted in Desktop, OSX | 1 Comment