Archive for the 'groovy' Category
How Elvis showed me a neat way of using operators in Ruby
5 Comments Published by peter December 19th, 2007 in groovy, ruby.Recently the Groovy team introduced a new operator to the Groovy language. It is called the Elvis operator. There is one thing I particularly like about this operator. It's name.
To bad the Elvis operator is only a shortening of Java's ternary operator, written like ?:. One use-case for the operator is returning a 'sensible default' [...]
Using propertyMissing to enhance Date (in Groovy)
0 Comments Published by peter December 2nd, 2007 in groovy.In my previous post I had a go at dates and ranges in Groovy. I wasn't to enthusiastic about the fact that it felt a bit verbose and Java-ish. So I took the opportunity to have a go at the new meta-programming stuff in Groovy >= 1.1beta3.
Say I want to be able to do something [...]
During my previous ramblings with Groovy I didn't touch anything fancy in the Date/Calendar API; no need for it. But after reading a lengthy blogpost on the topic I just needed to have a look at it.
Consider the following code:
PLAIN TEXT
GROOVY:
sdf = new java.text.SimpleDateFormat("dd-MM-yyyy")
bd_daan = sdf.parse("23-01-1980")
bd_peter = sdf.parse("18-01-1979")
t = Calendar.instance [...]
Grails Video Plugin (flv transcoding & asset management)
0 Comments Published by peter November 13th, 2007 in flash, grails, groovy, video.During the years I've been involved in digital media related projects quite a bit. With the current dominance of flash video stuff has become a bit more straightforward; you don't have to support multiple proprietary formats in parallel anymore.
I met and read about quite a lot of people building their own mini-youtube on top of [...]
Grails and tests - Part II: Testing dynamic taglibs using XmlSlurper
0 Comments Published by peter October 2nd, 2007 in grails, groovy, testing.A couple of days ago I wrote my first post on TDD using Grails. Now let's move on to something more interesting: testing dynamic taglibs.
In another post I showed how to create a simple tag. Which looked like this:
PLAIN TEXT
GROOVY:
import com.plink.plextile.*;
class TextileTagLib {
TextParser textileParser
def textile = { attrs ->
out <<textileParser.parseTextile(attrs.text, true)
[...]
Grails and tests - Part I: Getting started with TDD
2 Comments Published by peter September 26th, 2007 in grails, groovy, testing.Writing tests for a Grails applications is really simple. In Groovy code actually compiles when non-existing methods of objects are referenced (as opposed to Java) which makes it possible exercise TDD (test driven development).
Grails supports two types of tests out of the box, unittests and integrationtests. Tests are located in the test folder of [...]
Yesterday I presented at the Battle of the Geeks 2007 organized by my employer. 4 presentations where given and people in the audience where asked to rate each presentation using special cards. (I translated this post to Dutch for the Finalist developer blog)
19.15 Presentation 1: CMS Container
Freek Punt talked about Finalists' own MMBase based [...]
Groovy 1.1. beta 3 was announced a couple of days ago and includes some interesting additions to the groovy language, like a real method missing. Grails' lead developer Graeme Rocher has a simple example of the way it works in his blog:
PLAIN TEXT
GROOVY:
Foo.metaClass.methodMissing = { String name, args ->
Foo.metaClass."$name" = { Object[] varArgs [...]
Since working with, or creating WebServices is something webdevelopers will probably do regularly (or stumble upon in the very near future) I decided to have a look at Grails' support for SOAP.
First thing I wanted to see was how to expose a Grails service via Soap. Due to the excellent documentation at the Grails website [...]
Grails - Render method & Markup builder
0 Comments Published by peter August 26th, 2007 in grails, groovy, java.During Graemes' demo of Grails at javasummercamp he briefly pointed out the fact that one can implicitly use the Groovy MarkupBuilder (Similar to the Markaby DSL for Ruby) within the render method of an action for generating markup.
Which makes writing an RSS feed for you application really easy:
PLAIN TEXT
GROOVY:
def feed = {
def results [...]



















