CJCOOK: 0.14: Bulk of Jakarta References Removed

This is a quick follow-up to release 0.13. Most of the references to Jakarta are now removed from the book. Some projects, like the now defunct Slide or the very inactive ORO, are still in Jakarta. Projects like Lucene and HttpClient which were both parts of Jakarta when the original book was published have been updated, and I’m pointing to the project sites for Apache Lucene and Apache HttpClient (or is it HttpComponents? See a later update.)

Read Commons Java Cookbook Release 0.14 Online

Next steps:

  1. Changing all internal link elements to xrefs and getting rid of hard-coded section references. For some reason, the XML I got back from O’Reilly has hard-coded text in link elements that reference section numbers. So if you see a reference to Section 1.4, click on it, and end up looking at Section 1.2, this is because I must have deleted a section. DocBook has the facility to generate XRef text at render time so I have to modify all the internal link elements to xrefs and set the label style.
  2. Write a Unit Test that compares the text of a ulink element with the target URL. If the text of a ulink begins with “http://”, I need to make sure that the anchor tag is going to link to the exact same URL. There are already a few examples in the book where there are inconsistencies between the URL that is printed and the URL that is being linked to.
  3. Write a Unit Test that tests all ulinks for 404s. This is important for consistency, I need to figure out a way to do this automatically for other books as well, so I’m thinking about a way to do this in a Maven plugin.

Long Term:

I can’t tell if the hc.apache.org project has actually released 4.0 or if we’re stuck in a perpetual beta. I don’t want to update the book to talk about httpcore until I’m sure it isn’t going to change. I do know that I have to circle back at some point and:

  1. Update the Http/DAV chapter: Change it to reference the new Http Components Project
  2. Update the Http/DAV chapter: Change the sections that discuss Jakarta Slide to reference Apache Jackrabbit
  3. Update the Lucene Samples to use the Latest Release: Right now this part of the book references version 1.9.1 because there was an API change wrt configuring the Document.

Issue Tracker

I need an issue tracker for this project, and I can’t decide between Trac and JIRA. On the one hand, I like Trac’s simplicity, but, on the other hand, I’m pretty sure I could benefit from some of the subtask stuff that is available in Jira. Decisions, decisions, decisions….

CJCOOK: Removing References to Jakarta (up to ch5)

If you haven’t noticed, Jakarta was dismantled. It now contains a shell of projects which are largely inactive. The community which was Jakarta once contained hundreds of committers and was the center of open source Java. It was Jakarta that produced Ant, Maven, Struts, Log4J, Lucene… among others. While Jakarta was an interesting crucible for innovation, it didn’t scale very well and there were an endless series of flamewars and management problems due to the fact that it was just too large for its own good. Sometime in 2003 or 2004, a decision was made to split Jakarta into separate TLPs and Commons eventually moved to Apache Commons (http://commons.apache.org).

Release 0.13 of Common Java Cookbook updates everything up to Chapter 5, removing references to “Jakarta Commons” components in favor of “Apache Commons”. Where a project was called “Jakarta Commons Collections” it is now called “Commons Collections”.

Next step: I’ll follow this release up with a 0.14 that removes all of the references to Jakarta XYZ.

CJCOOK: Updated All Component Versions

I did a quick pass to Common Java Cookbook to update some of the version numbers. Current release version is now 0.12, and you can expect a 0.13 release on Monday that is going to remove most of the references to “Jakarta”. This book uses the following versions of components:

Component Version Notes
Commons Beanutils 1.8.0
Commons Collections 3.2.1
Commons Digester 1.8
Commons HttpClient 3.1 Will update to 4 as soon as the HttpCore stuff is released
Commons JEXL 1.1
Commons JXPath 1.3
Commons Lang 2.4
Commons Logging 1.0.4
Log4J 1.2.15
Commons CLI 1.1
Commons Configuration 1.6
Commons IO 1.4
Commons Math 1.2
Commons Net 2.0
Velocity 1.6.1
Slide 2.1 We’re replacing this with Jackrabbit
Freemarker 2.3.15
Commons Betwixt 0.8
Lucene 1.9.1 We need to upgrade this item.
Component Version Notes

Common Java Cookbook: Release 0.10: Book Examples ZIP

Release 0.10 – the book’s example project is now published as a ZIP file. There are some missing resource files that I will try to address in the next few releases, but all of the Java Source code that accompanies the book is now available as a Maven 2 project. (For more information about Maven 2, see Maven: The Definitive Guide).

  1. Go to the Online Common Java Cookbook.
  2. Click on “Download Book Examples” in the upper right-hand of the page header

Unless someone gives me a good reason to, I’m not going to publish a “tar.gz” or “tar.bz2” in addition to the “zip” archive. Every machine I use, regardless of OS has some utility that can unzip a ZIP archive: Linux, OSX, Windows. Does anyone have a compelling reason for me to publish a bunch of different archive formats?

What happened to release 0.9?, you ask. Nothing, I mistakenly deployed the 0.9 release only to realize that I hadn’t added the examples file. Since Maven makes it so easy to cut another release, I simply reran the release process to fix the issue.

Making an Ass of Myself: Episode I

Today, I recorded my first podcast, you can see the result over on the Sonatype blog. In the first minute, I sound like Wharf from Star Trek: The Next Generation, and during the book update I just sound like a jerk.

I’ll be regularly making an ass of myself for “Sonatype Week in Review” over the coming months, if you would like to subscribe to the Podcast feed in iTunes click here.

Flex Countdown Timer with Warning Color/Expiration Event

I had to create a simple little Flex countdown timer, so I stumbled upon thie post from Flex Examples. I took that source and expanded it a bit to create a configurable CountdownTimer component. Now, I’m sure there’s an even easier way to do this, but this seems to do the job for me. Here’s the result CountdownTimer.mxml:

<?xml version="1.0" encoding="utf-8"?>
<mx:Label xmlns:mx="http://www.adobe.com/2006/mxml"
    import mx.binding.utils.BindingUtils;
    import flash.utils.Timer;
    import flash.events.TimerEvent;

    public var timerInterval:int = 100;
    public var maxSeconds:uint = 10;

    public var pattern:String = "N:SS";

    public var warningSeconds:uint = 5;
    public var warningColor:uint = 0xff0000;

    private var baseTimer:int;

    private var t:Timer;

    private function init():void {
      t = new Timer(timerInterval);
      t.addEventListener(TimerEvent.TIMER, updateTimer);

    private function updateTimer(evt:TimerEvent):void {
      var renderTime:int = ((maxSeconds * 1000) - (getTimer() - baseTimer));
      if( renderTime <= 0 ) {
        renderTime = 1;
        dispatchEvent( new Event("timesUp",true) );
      var seconds:int = renderTime / 1000;
      if( seconds < warningSeconds ) {
        this.setStyle("color", warningColor );
      var d:Date = new Date(renderTime);
      this.text = dateFormatter.format(d);

    public function startTimer():void {
      baseTimer = getTimer();

    public function stopTimer():void {

  <mx:DateFormatter id="dateFormatter" formatString="{pattern}" />


And, a silly little test application…

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"

    import mx.controls.Alert;
    private function timeExpired(event:Event):void {
      Alert.show( "Yo!  Times Up!" );

  <mx:ApplicationControlBar dock="true">
    <mx:Button label="Start timer" click="counter.startTimer()" />
    <mx:Button label="Stop timer" click="counter.stopTimer()" />

  <local:CountdownTimer id="counter" fontSize="96" 
                           pattern="Time Remaining: N:SS"