Archive for May, 2009

Yuuuuh!!!! We got Grails 1.1.1! 0

As I said earlier, we got Grails 1.1.1 today!!

Take a look in the links below:

But watch out! People in the grails mailing list noticed some broken stuff in the build when trying to upgrade. A little workaround is availabe in this mail thread, just keep looking this Thread, probably we’ll get something here!

Thanks!!

Looking forward Grails 1.1.1 1

Hi,

Yesterday Guillaume Laforge annouced that finally groovy 1.6.3 is out. That means we’ll have the Grails 1.1.1 release in a few days (hoping this for today). Graeme Rocher said that with groovy 1.6.3 released, Grails 1.1.1 is imminent.

So let’s wait!

I’m specially waiting this release since it corrects a little bug in WAR generation using the –nojars options.
Ohhh, and of course, with Grails 1.1.1 we’ll have support to use Grails in the Google Java App Engine!!

Thanks Guillaume and Graeme!

[]s,

Esperando o Grails 1.1.1 0

Hum,

Ontem saiu oficialmente o Groovy 1.6.3, e isto quer dizer que hoje ou no máximo ainda essa semana estaremos com a release oficial do Grails 1.1.1.

Como disse o Graeme Rocher ontem no twitter, com o release do Groovy 1.6.3, o Grails 1.1.1 é iminente. :P
Estou esperando esta versão pois corrige um bug na criação de WARs usando a opção –nojars

Além de que é claro, com o Grails 1.1.1 poderemos usar o plugin do GAE para criar aplicações Grails no Google Java App Engine!!

Estamos aguardando ansiosamente.

[]s,

Understanding Groovy Categories 5

Have you ever used Groovy Categories? Do you even know what its stands for?

Groovy Categories is a great feature from Groovy (inherted from Objective-C) that allows you to have some kind of “extended” control on a class. The category just “add” some more funcionality to your class when you want. It’s different from creating another class that extends from the first one, this approach holds a little more functionality-oriented talk… :)

Categories is nothing more than a Groovy class that you’ve implemented before that effectly adds your functionality. The syntax is very simple and all you have to do, is tell to the runtime environment you’re now using the category.

use (the category class you want to use) {
    //all your code here can access the category funcionality
}
//back to normal code

That’s it. Groovy Core comes with some Categories (ServletCategory, DOMCategory and TimeCategory). The one we use more is the TimeCategory, that adds some calculation methods for us.

Let’s imagine we want to add some days in our current date, using Java you remember how you should do, don’t you?

Get a Calendar Instance, retrieve this calendar’s date, add the ammount of days using the strangest and creepiest method ever and then get the calendar’s date again (actually, get only its time and create a date with it):

//creepiest method
myCalendarInstance.add(Calendar.DAY_OF_MONTH, 10);

You can see in the TimeCategory’s javadoc (link above) that it defines some methods like “getHours(), getDays(), getMinutes()”. This methods we don’t have in some usual Date class, but when we use the TimeCategory object, they just get available for us. The example below show us what should happen when we use the TimeCategory:

Date now = new Date()
println now //just show when am I :) 

use(org.codehaus.groovy.runtime.TimeCategory) {
    now = now + 15.days
}

println now //shows us when we'll be in 15 days!

This will be our output after running this small script:

Sat May 02 02:25:57 BRT 2009
Sun May 17 02:25:57 BRT 2009

That’s it, try the code above and the others methods the TimeCategory gives to you: years, months, hours, minutes and seconds.

Thanks! Be the first to know when I publish some interesting article signing up my feed and following me on twitter!

Web Analytics