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.

Tuesday, April 8, 2008

Timestamp dependent task in Ant

Sometimes we need to do certain task in Ant that only need to be run if certain file or files has been updated. javac task has time dependency built-in already, but other tasks do not. Good thing we have ant-contrib library which has outofdate tasks.

Recently we have a need to do some manipulation on the content of an EAR file which require the EAR file to be expanded first. We do not want to keep expanding the EAR file if there is no update on the EAR file itself. This is a perfect situation to utilize the ant-contrib's outofdate task in combination with built-in ant's touch task.

So we have setup like this:
<target name="extract-source">
<ac:outofdate>
<sourcefiles>
<pathelement path="${app.name}.ear"/>
</sourcefiles>
<targetfiles path="${input.dir}/extract.ts"/>
<sequential>
<unjar src="${app.name}.ear"
dest="${input.dir}"
overwrite="yes"/>
<touch file="${input.dir}/extract.ts"/>
</sequential>
</ac:outofdate>
</target>

Where we have the timestamp of the ear file compared against a timestamp file that we generate/touch after the ear expansion. So if at any time there is a new ear file which is newer then it was last expanded we'll expand it again else we just go on with our life.

With so many built-in tasks in Ant, I wonder why a lot of the ant-contrib tasks are not merged into ant already.

Thursday, April 3, 2008

Redmine with Mercurial

Redmine just released a 0.7RC1 version. For those who does not know, Redmine is project management tools like Trac. It is developed using Ruby on Rails.

At the moment redmine has much more features that have been in Trac's request list for a while.

Some of the important features:
  • Multi projects support
  • Built-in support for numerable version controls. Pretty much most of the known open source tools out there, like: cvs, subversion, git, mercurial, bazaar, darcs.
This makes redmine one of my favorites tools at the moment.

Anyway, current integration between Redmine and mercurial has a slight incomplete feature where it does not able to show the different activities on the files between versions/revisions. So I had created a patch to mercurial_adapter.rb file to support that feature. The patch can be found here.

At the moment I am using hg status to pull the information, but it is not very efficient as it requires multiple calls to hg status for each revisions it processes. Originally I try to keep the original code calls to utilize the hg log which require 1 call and just parse the data. Unfortunately the regular hg log does not provide the file action information and I am unable to get the file_adds and files_dels to show anything on hg log --template.

I am currently running on Ubuntu 7.10 with standard ubuntu package of mercurial version 0.9.4. If anyone know how to get the file_adds and file_dels to work, please drop me a note.

Sunday, March 9, 2008

Singapore Language Study Group is born

Singapore Language Study Group are gathering of programming language enthusiasts in Singapore who would like to learn and share their experience.

Everyone is welcome to join. Currently we are setup on Google Group. Follow this link to check it out.

Thursday, February 21, 2008

About books

Living in too many places run havoc with our belongings; especially with books which my wife and I treasure so much.

We only brought the bare essential to Singapore. The rest of our belongings were left in Jakarta. We still have gazillion of boxes at my brother's basement in Westminster, Colorado. There was once that his basement was flooded from a burst pipe. We have no idea what is the status of our belonging there, especially the twenty something boxes of book. We definitely need to go there and sort out our stuffs.

At least I know some of the treasured books, like the signed copy of Object Oriented Analysis and Design by Grady Booch and Knuth's The Art of Programming, are safe in Jakarta.

Talking about book, I finally start reading Peopleware after a long time of sitting in my to-read list. I am also currently reading Living Proof by Jim Petterson. On the fiction side I am re-reading A Song of Ice and Fire series by George RR Martin. I love the series and can't wait for the next book to come out. And yes, I do read all three at th moment...just not at the exact same time :P.

What books are you reading now?

Enjoying Singapore

As a developer I love having all the choices of technologies and tools available to me. I also enjoy the choices of lifestyle and events that are going on here in Singapore.

This week we have the Singapore Air Show 2008. Last week there was Chingay Parade, which I missed and I still don't know what it was about. F1 Grand Prix is taking place very soon.

On lifestyle, there are tons of things to do and participate in all year rounds. Musicals, operas, dances, theatres, recitals, art shows, etc. My wife and I had been to a couple of shows at the Esplanade.

Next month we are going to watch Disney on Ice show called Mickey's Amazing Journey. I was enticed to watch it because the ads was using Fantasmic's theme song. It brought back sweet memory when I watched the Fantasmic premiere at DisneyLand in 1992. That was when I first found out about Disney's Imagineer because there are a bunch of them around with their Imagineering jacket. Because I didn't know about them then, I thought the jacket was so cool and I asked one of them where I can get one. That's how I found out that Imagineering is a division of Disney, so the jacket is for employee only.

I have to say those wonderful people really live up to their title as Imagineer.

Well, enough of the trips down the memory lane. In conclusion, I am enjoying my life in Singapore right now.