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!
...
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...
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...
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...
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...
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...
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.
...
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...
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?
...
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 ...
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...
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...
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...
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
...
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
...
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...
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...
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):
...
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...
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...