[Tutorial] Log4J with Maven profiles

Here is a quick tutorial to get your hands dirty with the Log4j logging framework.
Log4j allows logging requests to print to multiple output destinations, also known as appenders.
There are several output destinations: console, files, sockets, emails …
First create a Maven project :
mvn archetype:generate
Choose archetype number 109 (quickstart)

Read more

[GWT] Reduce the number of permutations

Here is a tip that I found on other blogs and I think is worth mentioning again. I tried it, it reduced the number of permutations from 15 to 3 only (1 permutation for IE, 1 permutation for the FR locale, 1 permutation for the EN locale). That means a compilation time of 1:05.750s instead … Read more

Java puzzlers

This week I attended the very first and very well organized conference What’s Next ? in Paris and one of the speakers was Neil Gafter, co-author of the book “Java™ Puzzlers: Traps, Pitfalls, and Corner Cases” (2005).
He shared with us 2 or 3 puzzlers which I will share here too :
Question 1) What will the following program print ?

import java.util.Random;

public class Rhymes {
    private static Random rnd = new Random();

    public static void main(String[] args) {
        StringBuffer word = null;
        switch(rnd.nextInt(2)) {
            case 1: word = new StringBuffer('P');
            case 2: word = new StringBuffer('G');
            default: word = new StringBuffer('M');
        }
        word.append('a');
        word.append('i');
        word.append('n');
        System.out.println(word);
    }
}

Read more

Eclipse Dali vs Hibernate Tools

The process of mapping tables to entities is greatly simplified with tools like Eclipse Dali and Hibernate Tools, both available as Eclipse plugins. It avoids mapping them by hand, which in my opinion is prone to mapping errors and takes more time. And I really do not see why one should map them by hand when great tools like Eclipse Dali and Hibernate Tools are available.
In my book, I describe the use of the Eclipse Dali plugin to automatically generate the entities.
Lately I have also used Hibernate Tools and I have already noticed a few differences between these two tools.
I am going to list some of these differences.

Read more

[GWT] Table with pagination and one sortable column

I just added a very basic GWT project to my github account to display a table with pagination and one sortable column. The code is mostly based on the official GWT tutorial : http://code.google.com/intl/en/webtoolkit/doc/latest/DevGuideUiCellTable.html I basically just added the SimplePage element to handle pagination : SimplePager pager = new SimplePager(); pager.setDisplay(table); Source : https://github.com/longbeach/MyFirstCellTable Demo … Read more

How to rollback a transaction in GAE

This has nothing to do with JPA. I was trying to deploy a GWT webapp to GAE when I suddenly got an error. As a remedy, i got the message : “java.io.IOException: Error posting to URL: https://appengine.google.com/api/appversion/create?app_id=tableaupagination&version=2& 409 Conflict Another transaction by user xxxxx is already in progress for this app and major version. That … Read more

Assembla

I found another cool website that offers free workspaces that can be managed with Subversion, Git, Mercurial etc…
Of course it also offers various plans with monthly payments.
Anyway, I just put an empty project in my workspace. Check out the screenshots :

Read more

[Tutorial] Create a Web Service with Apache CXF and JBoss 6

I have recently started studying Apache CXF, the open source web service framework. I am familiar with developing Web Services using EJB 3, Axis or Glue. But not with CXF. Until now.
CXF is a mix of two projects : Celtix and XFire, which explains the name CXF.
It provides support for the JAX-WS, JAX-RS and JAX-RPC specifications.
Developing Web Services using CXF and JBoss is quite easy. The only annoying part is to figure out which JARs libraries
to include in the classpath and which JARs libraries to exclude.

Read more

[Book review] Pro HTML5 Programming

I heard about this book after attending a presentation on HTML5 by one of its authors, Peter Lubbers. I found his demonstration about the offline cache, a new feature in HTML5, very interesting and so I wanted to know more about HTML5.
The book has an official site : http://www.prohtml5.com
In my opinion, this book is a good introduction in the new features of HTML5.

Read more

CanIuse.com and fmbip.com

Here are two very useful sites : http://www.caniuse.com/ Like it says, it shows “compatibility tables for features in HTML5, CSS3, SVG and other upcoming web technologies”. Another one is http://fmbip.com. It displays a table showing exactly what browser you’re using and what CSS3 & HTML5 capabilities the browser supports. http://fmbip.com/litmus displays test results showing when … Read more