groovy

How to add age to ageList =[12,13,23]

may be too simple groovy question but....please help i have a list like this: def ageList =[12,13,23] i want to get this: def newAgeList =[age:12,age:13,age:23] could some one help me out? thank you so much! ...

Compare associations between domain objects in Grails

I am not sure if I am going about this the best way, but I will try to explain what I am trying to do. I have the following domain classes class User { static hasMany = [goals: Goal] } So each User has a list of Goal objects. I want to be able to take an instance of User and return 5 Users with the highest number of matching Goal o...

groovy, merge two lists : listA is [[Name: mr good, note: good, rating:9], [Name: mr bad, note: bad, rating:5]]

I have two lists: listA: [[Name: mr good, note: good,rating:9], [Name: mr bad, note: bad, rating:5]] listB: [[Name: mr good, note: good,score:77], [Name: mr bad, note: bad, score:12]] I want to get this one listC: [[Name: mr good, note: good,, rating:9, score:77], [Name: mr bad, note: bad, rating:5,score:12]] how could I do it...

Black Magic in Grails Data Binding!?

As described in http://n4.nabble.com/Grails-Data-Binding-for-One-To-Many-Relationships-with-REST-tp1754571p1754571.html i'm trying to automatically bind my REST data. I understand now that for one-to-many associations the map that is required for the data binding must have a list of ids of the many side such as: [propName: propValue, m...

Groovy and annotations - what is wrong with this example?

According to Guillaume Laforge, it is possible in Groovy 1.6.1 (and I would presume later versions) to define annotations directly in Groovy. However, I cannot make sense of the simple example below. I try to run this in the 1.7.1 version of the Groovy Console: @Bar @Foo class A { } @interface Bar { } @interface Foo { } for(ann in new...

Can anyone get app-engine plugin working with Grails on mac os x?

I have been trying for 4 days to get app-engine and grails working together on my mac to no avail. I am using latest groovy/grails and appengine sdk versions. Im following the app-engine plugin step by step on the grails site.. http://grails.org/plugin/app-engine Groovy Version: 1.7.1 JVM: 1.5.0_22 Grails 1.3.0.RC1 echo $APPENGINE_HOME...

groovy: how to escape "(" regex etc in textarea?

I have some text area field in my grails application. I got the following errors: .PatternSyntaxException: Unmatched closing ')' near index 36 Name: note: 1) data listing .... how could i escape the regular expressions in the text area field? thanks. ...

Simple cross platform GUI app

I would like to know if there is any way that I could build a very simple GUI app (it doesn't even have to look good) that will run on a fresh install of Windows Vista and OS X with no other installations needed by the user. I would perfer not to use Java (just out of personal programming preference). I will use it though, if it is the o...

Can i easily use EJB3 Remote with a RAD framework?

Hello, I'm planning to make a webapp and just wonder if someone ever tried to use remote EJBs with a RAD framework like Grails, Play... was it easy? ...

Applying pagination options to a one-to-many list in Grails

I have a User class that hasMany = [friends:User] Now I am trying to display the friends list - ${user.friends} However, I'd like to be able to apply parameters like I can with, for example, User.findAllBy(user, [max:10, sort: 'dateCreated', order: 'desc"]) Can someone kindly tell me how to do this on a one-to-many in Grails / Groovy ...

Knowing the fundamentals of Java what is the right approach to learn Groovy?

As my question already implies I want to learn a new language and have read several articles about groovy and its more pragmatic syntax. SO I have choosen Groovy as the language of my choice. What is a good way to learn a new language like Groovy when I already know the fundamentals of Java. When I understand correctly Groovy will be r...

What makes Groovy+Grails a more productive setup than J2EE?

I'm coming across references to 'Grails' and 'Groovy' quite often these days.. mostly on how great a productivity booster it is as opposed to standard J2EE, or things like JSF, Struts etc.. And there's also an impressive set of case studies in support of this on their web site too. So I just thought I would explore some of it.. As I st...

groovy: how to replaceAll ')' with ' '

i tried this: def str1="good stuff 1)" def str2 = str1.replaceAll('\)',' ') but i got this: Exception org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, Script11.groovy: 3: unexpected char: '\' @ line 3, column 29. 1 error at org.codehaus.groovy.control.ErrorCollector(failIfErrors:296) question: how to d...

Groovy load .csv files

Hi all, How to read and import .csv file in groovy on grails. I have .csv file with data and need to import in to db using user interface . thanks in advance, srinath ...

Write a PLIST file in Groovy

I have a Groovy application for Windows and am trying to convert a Hash object to an Apple plist file. What is the best way to go about this? Seems like this is something that must already be solved in Java but I can't seem to find any examples. Thanks in advance ...

hasErrors with indexed property

I am having hard time getting hasErrors to work with indexed properties. For example class Order { String prop1 String prop2 static hasMany = [items: Item] } class Item { String name static constraints = { name(blank:false) } } Validation works properly and on item.name being blank I do get an error with <g:renderE...

Best way to unit-test WCF REST/SOAP service while dynamically generating stubs

I have a webservice written with WCF 4.0 that exposes REST and SOAP functions, and I want to set up my unit tests so that as I work on my web services I can quickly test by having the test framework start up the service, outside of IIS, and then do the tests. I want it to be dynamically generated as I am not certain what the interface w...

Scala closure context

I am not a Groovy expert, but I did read the book "Groovy in Action". In Groovy, each closure comes with a "context", where the items inside the closure can get access to pseudo-variables like "this", "owner", and "delegate", that let the items know who called the closure. This allows one to write DSLs like this (from Groovy in Action): ...

Should I be so enthusiastic about Groovy?

I'm currently working on my project which consists of front and back-end written in PHP and desktop app written in Java, and that's what the plan was before I discovered Groovy and later on Grails. Now after rewriting my desktop client and sketching some back-end functionality in Groovy I'm considering to drop PHP altogether in favor of...

Using Groovy as a scripting language...

I prefer to use scripting languages for short tasks, anything such as a really simple http bot, bulk importing/exporting data to/from somewhere, etc etc... Basic throw-away scripts and simple stuff. The point being, that a scripting language is just an efficient tool to write quick programs with. As for my understanding of Groovy at this...