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.

Tuesday, February 19, 2008

Ben Alex @ Singapore Java MeetUp

This month Singapore Java MeetUp was graciously hosted by Ivan from Standard Chartered. And as usual it was organized by Chris, despite his busy schedule and having 5 months old baby at home.

Ben Alex of SpringSource (previously Interface21) gave a talk on Spring Security 2.0 (currently Milestone 1). Which is not surprising as he is the creator of Spring Security aka Acegi. For those who do not know, Spring Security / Acegi is a security framework for Java application which provides powerful and configurable authentication and authorization functions. It makes our life as developer much easier, as security is one of the tough problems in application development. Of course by using Spring Security alone does not make our application secure, it just help us to secure it easier. It is still up to us to design and configure it properly.

Ben started with the basic introduction on authentication and authorization mechanism. Along the way he did a few demos that show a few different ways of access authorization, from URL filtering, programmatic role checking, to use of annotation on methods or class; and it all took only one or two line changes in the configuration files or source codes.

I believe the most welcome update from version 1.0 to 2.0 is the changes on how the xml configuration is done. Version 1.0 is already quite powerful and has most of the features needed for developing an application, but the configuration file is quite verbose where most of the times we need to declare every single configuration to the lowest level. With version 2.0 of Spring Security, in line with the rest of 2.x Spring portfolios, the configuration is simplified and allows convention over configuration. From the demonstration Ben showed a similarly configured application will have only 16 lines of configuration with Spring Security 2.0 and requires around 130 lines of configuration with Spring Security 1.0.

After the presentation, a bunch of us retired to Penny Black at Clarke Quay. We had a great time discussing different issues from open source licensing and business models to managing and running a company. Ben is such a fun person and very passionate about the issues that were thrown around the tables. I'm looking forward for another opportunity to hear him talk again.

Wednesday, September 12, 2007

Nick Carroll @ Singapore Java Meetup

Singapore Java Meetup on 11th of September featured Nick Carroll from ThoughtWorks Australia. It took place at Brewerkz at 19:30. It was my first time attending Singapore Java Meetup and I am very impressed with the setup; it has high projector screen which is easily seen from anywhere in the room, has great ambiance, food, and drinks..which you can guess what kind from the name of the place itself. As I understand it, we owes them to Christopher Marsh-Bourdon's hard work to make it happen; even though he must be dead tired for just having a new baby just few days back. Thanks a lot and congrats Chris!

Nick gave overview of Agile & Lean development practice. He also explained some practices that ThoughtWorks does religiously, such as Continuous Integration. The highlight for me was Mingle demonstration; which is something that I have wanted to try but haven't get around to.

Unfortunately there wasn't enough time for Nick to go more in depth on the topics that he presented. Nick, I hope you find Singapore is charming enough to come back and speak again here.