❯ Guillaume Laforge

Java

Back from JavaOne

After some trouble getting to San Francisco because of strikes, transportation issues, burnt control tower, and more… I managed to land to JavaOne! I missed my own first talk and I was glad and grateful that Cédric could present it for me. At JavaOne, the Groovy project received the award from ZeroTurnaround / RebelLabs, for the “Best Tech - Geek Choice Award” : Youpi mon projet a reçu un prix de l’innovation ! Read more...

How to remove accents from a String

My little puzzle of the day is to find how to remove accents from a String. There are different alternatives, different strategies, but none really suits my needs – or my taste. The naive approach is to use String.replace() to replace manually all characters, with a correspondance table, like “é” should be replaced with “e”, etc. That’s fine for some languages I know, like French or German, or even some latin languages, since we share the same alphabet. Read more...

Castor tip: generating Java classes for XSD simple types

At work, I’m using Castor XML to Java binding to marshall/unmarshall messages in my Web Services, inside a custom framework (Struts, OJB, JAXM, etc). I have defined my messages as XSD Schemas, and I’m using Castor’s Maven plugin to auto-generate my Java classes at build time. All is good and well… Hmm, almost! Castor’s SourceGenerator generates Java classes for complex types and elements, but not for simple types, and unfortunately, I badly needed to marshall those simple types as well. Read more...

First OSS-Get Together in Paris

For the first time in Paris, an Open Source Software Get-Together was organized by Vincent Massol of Cactus fame and author of JUnit in Action book. It was a lot of fun to meet him and other French OSS developers. I though we weren’t numerous to work on Open Source projects in France, but after all, it seems I was wrong. Moreover, I was stunned to meet someone working for the same company as myself, and I didn’t even know him! Read more...

Groovy-JDK doc: Parsing Java with QDox

Perhaps you noticed recently that there’s a new interesting page on Groovy’s website ? Well, all pages are interesting of course! But there’s a new page describing the Groovy methods enhancing the core JDK classes. In groovy, you have additional methods that you can call on standard Java classes. For instance, you can use the eachLine() method on java.io.File. With this method, you’ll be able to easily read a text file line after line, and do whatever with this line inside a closure without having to care about things like closing streams. Read more...

Some good rules for an efficient ant build script

Some time ago I came across an interesting article on Apache’s wiki entitled (Apache Wiki: The Elements Of Ant Style. It’s a very thourough overview of good practices for writing clean, readable, reusable and efficient Ant build files. Today, through magpiebrain, I read on OnJava another very interesting and concise article giving 15 Ant best practices. It’s much shorter than the previous article on Apache’s wiki, but still, with those 15 practices you’ll manage to improve some messy build scripts. Read more...

IntelliJ IDEA : ShowEncoding plugin

A bit more than a year ago, I wrote some utility classes related to file encodings/charsets. Those classes got integrated to IntelliJ IDEA. Those classes are useful for knowing the encoding of a byte array, or a file, or an input stream. You’ll be able to know whether your file is encoded using UTF-8, or whether it used ISO-8859-1, or windows’ specific windows-1252. Unfortunately, inside IntelliJ IDEA, it is not currently possible to know the charset of the files edited. Read more...

Apache XML-RPC, côté client

Pour le fun, j’ai eu envie d’essayer l’API XML-RPC de la fondation Apache. Pour être précis, je vouais expérimenter avec les APIs de Blogger et MetaWeblog qui permettent de mettre à jour les Weblogs à distance. Ce sont des APIs standardisées que la pluspart des Weblog comprennent. Ainsi, par exemple, l’outil de publication w.Bloggar permet de éditer/modifier/créer des nouvelles entrées dans votre blog. Pour cela, il fait appel aux procédures distantes (Remote Procedure) du serveur hébergeant votre blog. Read more...