Skip to main content.

Archive for December, 2008

January coming up…

Tuesday, December 23rd, 2008

Not been blogging much lately, but that doesn’t mean we’ve not been busy!

As often happens this time of year, people tend to slow down from their regular activities,
and in the case of GroovyMag, that meant a slowing down of posting here. We’ll
try to get back on a more regular schedule soon.

We’ve been putting together the January issue, which is almost complete, and are
now trying to determine when it will go on sale. If it’s complete by January 1, then it
will likely be available then. However, due to the holiday schedule at that time,
the January GroovyMag might not be available until the following Monday. We’ll do our best to get
it to you on January 1 and keep your January as Groovy as possible :)

Update your GroovyMag profile with interests!

Friday, December 5th, 2008

I’ve just added a bit more functionality to the GroovyMag profile/account page. This page will now
let you indicate your technical interests as well as what you’re using day to day.

I added this so that we can get a better idea of readership, and what sorts of articles might make sense to publish in future
editions. I’ll be adding more places in this area to help round out your profile in the coming weeks.

Please take a few moments to log in and visit your account page to
update your interest information. It’ll help us give you more of what you want!

Groovy tweeple you should follow

Friday, December 5th, 2008

I’ve seen similar lists in other technologies, but have not seen a list for
Groovy and Grails people. If one exists, let me know and I’ll link to it. If
there’s someone on this list we should know about, let me know too, or add that
person yourself in the comments below.

Groovy/Grails people you should follow on Twitter

In no particular order…

UPDATED DEC 6, 2008

Andres Almiray

Dave Klein

Robert Fischer

Graeme Rocher

Guillaume LaForge

James Ervin

Shawn Hartsock

Play! Framework

Andrew Glover

Dierk Koenig

Scott Davis

Sven Haiges

Grails Podcast

Glen Smith

Peter Ledbrook

Venkat Subramaniam

Groovy Eclipse

Jeff Brown

Danno Ferrin

Matthew Taylor

Mac Palmer

Dmitriy Kopylenko

Paul King

Luke Daley

Jason Dillon

James Williams

This is mainly a preliminary list. I’m sure I’ve forgotten some ‘must follow’ people –
who would you add? Who do you follow for your Groovy tweets?

A metaClass example of getting a random arraylist element

Tuesday, December 2nd, 2008

Yeah, yeah, OK, I can’t name blog post titles very creatively :)

This is simply a repost of a blog post I did a few months ago, but I’m not sure many people here have read my other more generalized blog,
so I’ll repost the Groovyish content here now and then.

Someone recently asked how to get a random element from an array. In PHP it’s pretty straightforward – array_rand($x) – but there’s not (AFAICT) a built-in way in Groovy to do this. So I wrote a little something which should hopefully demonstrate the power of the metaClass stuff to boot.

ArrayList.metaClass.getRand = { number -> if(number==0) { return delegate[new Random().nextInt(delegate.size)] } else { def tempList = [] def counter = 0 while(counter>number) { tempList.add(delegate[new Random().nextInt(delegate.size)]) counter } return tempList } } def names = ['mike','matt','mark','lesley','jean','ron','jeff','martine'] println names.getRand() println names.getRand(5)

The first call to getRand() on the names list will just return one name from the list. The second will return 5 random entries (and some could theoretically be repeated). I’ve added this getRand() method to the base ArrayList class at runtime, even though it’s likely declared ‘final’ in Java’s base libraries. This is one of the core powers of Groovy, and is pretty slick, imo.

New upcoming book – Groovy and Grails Recipes

Monday, December 1st, 2008

I just learned about a new upcoming book from Apress about Groovy and Grails – Groovy and Grails Recipes, by Bashar Abdul Jawad You can preorder
the book from that link. From what I gather, it’s supposed to get released December 14th, just a couple weeks from now!
This would make a great holiday gift for that Groovy developer in your life! I only wish someone from Apress would have let
us know about this sooner – would loved to have done some sort of promotional tie in with GroovyMag!

December GroovyMag is available!

Monday, December 1st, 2008

The December issue of GroovyMag is out – go grab it now!

This issue has some great articles in it, including Christopher Judd’s article on iPhone development with
Grails and the iUI plugin, Andres Almiray’s continuing series on Swing applications in Groovy, and more. Just read
the above link or watch the video there to get an idea of what you’ll be getting.

Andres, Christopher and myself will all be presenting at codemash in January,
so if you’re interested in meeting some of the GroovyMag writers, book your ticket now.

We’ve got some great content lined up for the next few issues, including a look at Grails webflows, Groovy regular expressions,
and a sneak preview of the upcoming “Grails in Action” book (Manning) from Glen Smith and Peter Ledbrook. If you’re
not in to Groovy and Grails yet, now’s a perfect time to jump on board. It’s getting better all the time!