Open Source Consultant, Software Developer and System Administrator

If you are interrested in hiring a consultant for the effective use of open source software on an enterprise grade, take a look around in the About section to see, what I have to offer.

Blog and snippets

Various snippets or code parts I found useful, so I keep them here for reference.

Add an expression dialect to thymeleaf to access groovy's collate

Easy way to add collate for separting lists into rows with a certain size

class Groovy {
    List<List> collate(List list, Integer columns) {
        return list.collate(columns)

class GroovyDialect extends AbstractDialect implements IExpressionEnhancingDialect {

    Map<String, Object> getAdditionalExpressionObjects(IProcessingContext processingContext) {
        return [ groovy: new Groovy() ]

    String getPrefix() {
        return "groovy"

Add dialects to TemplateEngine (code based approach), see additionalDialects in XML:

def templateEngine = new TemplateEngine().with{
    // ...
    setAdditionalDialects([new GroovyDialect()] as Set<IDialect>)
    return it

Use in template:

<div th:each="row : ${#groovy.collate(entries, 4)}" class="row-fluid">
    <ul class="thumbnails">
        <li th:each="entry : ${row}" class="span3">
            <div class="thumbnail">...</div>

Run(-app) Grails 2.3 non-forked with reloading in IntelliJ 12

Add these VM options to the run-app to get class reloading working in IntelliJ 12

-javaagent:${GRAILS_HOME}/lib/org.springframework/springloaded/jars/springloaded-1.1.5.RELEASE.jar -Xverify:none  -noverify -Dspringloaded.synchronize=true -Djdk.reflect.allowGetCallerClass=true -Dspringloaded=profile=grails;cacheDir=/tmp/slcache

Note, that the version (1.1.5) depends on your Grails version (this is for 2.3.7) and the cache location is changed to /tmp/slcache - the default is ~/.grails/<verison>/.slcache).