Monday, June 9, 2008

Josh Bloch - Be well rounded

I had been a fan of Josh Bloch since the first time I met him in JavaOne 2001. His book, Effective Java, has definitely made me a better developer. In the recent interview with Josh Bloch I learn that he has recently published the second edition of the book. I am so excited and looking forward to get a copy of the book when it is available in Singapore.

Another part that I like from the interview, which is something that I have been sharing with other younger generation (I'm not old yet okay :P), is his advice on getting a good breadth of knowledge and experience.

Q: What are some things you wish you'd learned in engineering school?

A: I wish I'd learned to play guitar better than I do, which isn't very well. I wish I'd learned a foreign language. And art history. Also, it would have been nice to learn something about business and finance. That said, Columbia did very well by me. But I would encourage undergraduates to take the opportunity to acquire breadth while they still have time for it. They'll have plenty of time for depth later.

Friday, June 6, 2008

activerecord-jdbc now supports SQLite3

Nick Seager just released Activerecord-jdbc-adapter 0.8.1 which now includes support for SQLite3. This is great news, since SQLite3 had become the default database for rails starting 2.0.2.

To use it of course you'll need the newly released activerecord-jdbc-adapter and the sqlite3 adapter.
   gem install activerecord-jdbcsqlite3-adapter

I believe the above command should get all necessary dependent gems install also. And the configuration for the database.yml:
production:
adapter: jdbcsqlite3
url: jdbc:sqlite:<path to sqlite3 dbfile>

The path can be relative path from your rails app directory or absolute path. The rest of the configuration is the same as other jruby on rails' setup.

One thing that I hope they will add is to allow the database.yml to accept dbfile parameter, so it will be easy to switch between RoR or JRoR for SQLite3.

Update on May 06, 2008 at 14:08 GMT+8
After checking out the source code for the sqlite support, I found that it indeed support regular config for sqlite3. So you can just have the following database.yml:
production:
adapter: jdbcsqlite3
database: <path to sqlite3 dbfile>

The only differentiation is the adapter, either sqlite3 or jdbcsqlite3.