Archive for June, 2012

JavaOne 2012 content catalog available

June 28, 2012 Leave a comment

I will attend JavaOne in San Francisco this year.

After the conference tracks were outlined a while ago, the JavaOne Content Catalog is now available and has information about individual sessions, demos, labs, user groups, exhibitors and more.

Oracle announced this on their JavaOne blog earlier this month (June 2012).

Categories: conference, javaone

Doing HTML5

June 28, 2012 Leave a comment

It’s refreshing to take a Dive Into HTML5.

Reading the HTML5 spec is even more fun. It’s only 600+ pages after all … :)

My personal “IT résumé” website at has recently become HTML5 compliant (using W3C validator). It was mostly a matter of changing the doctype and cleaning up the existing XHTML somewhat.

While I was at it, I also added in some CSS3 to make it look a little nicer. The result is tested on most browsers.

Categories: html, odoepner

Generic Apache Ant build.xml for webapps with JUnit tests

June 27, 2012 2 comments

This post is about a build.xml file for Apache Ant that compiles, unit tests and packages a typical web application. The main build artifact is a timestamped WAR file.

Standardized directory layout

The build file assumes that your project uses the following directories:

  • src : Java sources and classpath resources
  • test : JUnit test sources and classpath resources
  • web : Web resources (JSP, HTML, CSS, etc.)
  • web/WEB-INF/lib : jars required by the web application at runtime
  • devlib/provided : jars provided by the web container at runtime
  • devlib/test : jars required for test compilation or execution

Transient build directories

The build will create these transient output directories for each stage of the build process. You should configure the version control of your project to ignore them.

  • build/classes : Compiled Java code and classpath resources (compile)
  • build/test-classes : Compiled JUnit tests (test-compile)
  • build/test-reports : JUnit test reports (test)
  • dist : WAR file (dist)

Run ant clean to delete them after you grabbed the WAR file.

The build.xml file

<project name="PROJECT_NAME" default="dist">

    <property name="classes" location="build/classes"/>
    <property name="test-classes" location="build/test-classes"/>
    <property name="test-reports" location="build/test-reports"/>

    <path id="classpath">
        <fileset dir="devlib/provided">
            <include name="*.jar"/>
        <fileset dir="web/WEB-INF/lib">
            <include name="*.jar"/>

    <path id="test-classpath">
        <path refid="classpath"/>
        <pathelement location="${classes}"/>
        <pathelement location="${test-classes}"/>
        <fileset dir="devlib/test">
            <include name="*.jar"/>

    <target name="clean">
        <delete dir="dist"/>
        <delete dir="build"/>

    <target name="compile">
        <mkdir dir="${classes}"/>
        <javac destdir="${classes}">
            <classpath refid="classpath"/>
            <src path="src"/>
            <src path="common/src"/>
        <copy todir="${classes}">
            <fileset dir="src" excludes="**/*.java"/>

    <target name="test-compile" depends="compile">
        <mkdir dir="${test-classes}"/>
        <javac destdir="${test-classes}">
            <src path="common/test"/>
            <src path="test"/>
            <classpath refid="test-classpath"/>

    <target name="test" depends="test-compile">
        <mkdir dir="${test-reports}"/>
        <junit printsummary="yes">
            <classpath refid="test-classpath"/>
            <formatter type="brief" usefile="false"/>
            <formatter type="xml"/>
            <batchtest todir="${test-reports}" failureproperty="failed"
                <fileset dir="${test-classes}" includes="**/*Test.class"/>

        <format property="timestamp" pattern="yyyy-MM-dd_hh-mm"/>

    <target name="dist" depends="clean, compile, test">
        <mkdir dir="dist"/>
        <war destfile="dist/${}_${timestamp}.war"
            <classes dir="${classes}"/>

Categories: java Tags: , ,

Configure prefix-based bash history search in inputrc

June 27, 2012 Leave a comment

I always add these two lines to ${HOME}/.inputrc (just for me) or /etc/inputrc (all users) to enable prefix-based bash history search using the Page-Up and Page-Down keys:

"\e[5~": history-search-backward
"\e[6~": history-search-forward

After editing the inputrc you have log out and in again for the changes to take effect.

Categories: bash, linux, mac os

Common entries in .bash_aliases

June 27, 2012 Leave a comment

I keep my bash aliases grouped in separate files. I include them from .bashrc like this:

# Alias definitions that should work everywhere
if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases

# Alias definitions that are specific to your distro
# e.g. Cygwin-only stuff, apt-get shortcuts on Debian, etc.
if [ -f ~/.bash_aliases.distro-specific ]; then
    . ~/.bash_aliases.distro-specific

This is the ~/.bash_aliases that I commonly use:

# Interactive verbose operation...
alias rm='rm -iv'
alias cp='cp -iv'
alias mv='mv -iv'

# Default to human readable figures
alias df='df -h'
alias du='du -h'

# Misc :)
alias less='less -r'                          # raw control characters
alias whence='type -a'                        # where, of a sort
alias grep='grep --color'                     # show differences in colour
alias egrep='egrep --color=auto'              # show differences in colour
alias fgrep='fgrep --color=auto'              # show differences in colour

# Some shortcuts for different directory listings
alias ls='ls -hF --color=tty'                 # classify files in colour
alias dir='ls --color=auto --format=vertical'
alias vdir='ls --color=auto --format=long'
alias ll='ls -l'                              # long list
alias la='ls -A'                              # all but . and ..
alias l='ls -CF'                              #

This is the ~/.bash_aliases.distro-specific that I use on Debian (or other APT-based distros):

alias show='apt-cache show'
alias search='apt-cache search'

alias files='dpkg -L'
alias selections='dpkg --get-selections'

alias install='sudo apt-get install'
alias reinstall='sudo apt-get install --reinstall'

alias update='sudo apt-get update'
alias upgrade='sudo apt-get upgrade'

alias remove='sudo apt-get remove'
alias purge='sudo apt-get remove --purge'
alias autoremove='sudo apt-get autoremove'
Categories: bash, debian, mac os

Class and evolutions

June 24, 2012 Leave a comment

In my current humble opinion, a Java class should go through at least 10 evolutions in its life-span: Think about it, take notes, code, unit test, review, refactor, document, share, refine, reuse.

Categories: java

Klassikradio MP3 streams [2012/06/23]

June 23, 2012 8 comments

This post has been rewritten and republished in 2016.

Categories: bash, music