Topic: Groovy lessons

Layout Mechanisms in Grails

Grails is a powerful framework for building cool stuff in Groovy. This post is about structuring the layout of web applications to avoid copy-paste. Grails contains several powerful mechanisms for this purpose. The official documentation on some of them is strangely vague. This note is a snapshot of my own understanding, a work in progress.
Continue »

The Groovy Mode for Emacs

Over the years there has been no shortage of Groovy modes for Emacs. They all had an irritating tendency to stumble even on common language constructs. I was very happy to find a new version that seems to get things right.
Continue »

“Stealth” Groovy Methods

Groovy has a number of simple and useful methods that are almost impossible to find by a web search. Try as you wish, googling for any, find, or count just gets you a giant haystack hiding the proverbial buried needle. And… hey, what was the name of that method that lets you insert a value into an iteration, kind of?

This post is about those Groovy methods that are all over the place, and yet hard to find. I wrote it as a reminder to myself.
Continue »

Grails: Controller and Action Names in GSP

Grails is a powerful framework for building web applications in Groovy. This post is about a tiny little corner of Grails development.

The presentation layer in Grails, also known as views, is built from Groovy Server Pages (GSP). The names of the controller and action that spawned a view are not automatically available in the view. This post shows you a very simple way to provide those names to views.
Continue »

Network versus Relational

It’s time for the long awaited Network versus Relational database head-to-head, no-mercy showdown. Network databases is represented by Neo4j 1.0, relational by Apache Derby 10.5.3.0.
Continue »

Neo4j vs. Relational: The Relational Combatant

A previous post promised a head-to-head no-mercy Neo4j vs. relational showdown. It also provided Groovy programs to store and retrieve file system data in a Neo4j graph database. Neo4j was recently released in a 1.0 version (see the Neo4j site).

Now it’s time for the relational combatant to enter the scene: Apache Derby.
We will write another Groovy program to store file system data, this time using a Derby relational database. To make the task more interesting we will try to earn a “nosql” medal by not using SQL.
Continue »

Groovy and Neo4j More Seriously

Neo4j is a graph database, recently released in a 1.0 version (see the Neo4j site). A previous post showed a trivial example of using Neo4j from Groovy.

This post contains an example somewhat closer to real life. It is also the first entry in a Neo vs. relational head-to-head no-mercy showdown.
Continue »

Basic Neo4j through Groovy

Neo4j is a graph database, recently released in a 1.0 version (see the Neo4j site). The main programming interface is Java. A lot of Java stuff looks much groovier when run from Groovy. Why not give Neo4j a try?

This post takes the little “Hello world” program from the Neo4j Getting Started Guide and makes it somewhat groovier. A later post will demonstrate a more complete program.
Continue »

Groovy: Regular Expressions At Work

After a previous post, covering the basics, we’ll go on with another geek-level look at regular expressions in Groovy. This time we will examine groups. Groups is about parsing, how to pick up parts of what a regular expression matches. We will also uncover a few more gotchas. Continue »

Groovy: Regular Expressions Basics

The Groovy programming language simplifies many common tasks, including regular expressions. This post shows common uses made easy by Groovy. However, regular expressions in Groovy are not free from irregularities. This geek level post will explain one of them. Continue »