Hi, I'm using Groovy and Grails and am trying to take a parameter passed to a controller, parse it, and add each individual element into a list. I thought this would work, but it is adding the whole string into the list, leaving me with only one element.
list = []
list.add(params["firstNames"].split())
is returning a list with size ...
In my grails project I'm moving all calculations to java classes.
Here is the link to source code (i've saved it in Google Docs).
Main purpose is to format current time into string(in two languages). Examples:
1 day 2 hours 3 seconds
1 день 2 часа 3 секунды
But i have one method:
private static boolean endsWith(final long num, fin...
Groovy Beans are great but I'm just curious if it's possible to declare a class member private and not generate accessors for it easily? The Groovy Beans page doesn't cover this topic. The only thing that I can think of would be to define the accessors and make them private.
...
So, I wish to parse an xml schema and list all the elements along with their annotation and type. I looked at some java possibilities - the closest was XSOM. It seems like driving a truck trailer to get some milk from the neighborhood store.
I looked at JAXB, but there's no parse and list all elements against schemata.
I don't want to ...
Hi,
I've been googling my ass off without any success. So I came here. Hope someone can help me out!
Im using Groovy to do some LDAP searches but when a person has å, ä or ö in their names I get for example Jens R√§fteg√•rd.
I've tried:
new String(attrs.get("name")?.get(0)?.getBytes(), "UTF-8")
And even tried:
def charsets = Charset....
Hello Comrades,
I've faced with a problem of sending complex requests with GroovyWS.
This is sample request generated by soapUI:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:dex="http://www.temp.com/com/dex"
>
<soapenv:Header/>
<soapenv:Body>
<dex:executeRequest>
<!--Optional:--...
i know this sounds totally ridiculous at the moment but trust me, i want something like "$variable" in php or "def" in groovy, by means of my approach is an automatic variable "data type" identification to IMPLEMENT into c language.
for example:
"def" is a replacement for a type name. In variable definitions it is used to indicate that...
Last time I had to deal with Java was 2005 and I forgot almost everything about it since then.
Today I need to build a GUI app on the top of Java. I guess it is better to use one of Scala/Groovy/Clojure languages.
The question is: which of them is better for desktop GUI programming? My program will transform and display a series of jpe...
I am unable to use the fabulous tr() at the moment as I can only use Groovy 1.7.1 and wanted to know if there is an elegant way of going backwards and forwards between string and number encoded with Base32, but with the values A to Z then 2 to 7, rather than 0 to 9 then A to V.
This is to remove customer error in typing in a human reada...
I am working with a learning management system that runs on JBoss, using JDK 1.5_18.
There is a way to write classes that it will load at runtime, using reflection, in order to react to set events.
When I write the class in POJO the application will successfully find the class.
I am always using the full name of the class, and I ensur...
I've used Selenium ide to record test cases, export them to Groovy source, modify as necessary and run them. The default code expects a server on localhost, I'd like to use a server on a remote machine. How can I do this? When looking at the doc for GroovySeleneseTestCase it does not appear there is a setUp() method that allows you to us...
public updateList(lst) {
lst += "a"
}
List lst = []
updateList(lst)
println(lst)
This prints an empty list. However;
public updateList(lst) {
lst.add("a")
}
List lst = []
updateList(lst)
println(lst)
, will print "a" as desired.
I always assumed += was the same as .add(), but obviously not. I assume += is creating a new List,...
I am having problems persisting domain objects where I have a many-to-many relationship with a join table
class A{
String name
static hasMany = [bs:B]
}
class B{
String surname
static belongsTo=A
static hasMany=[as:A]
}
A a = new A(name:'Test')
B b = new B(surname:'user')
a.addToBs(b)
a.save(flush:true)
Then what I would expec...
Let's say I've compiled a Groovy script using Groovyc, which has generated one or more .class files in the file system. From a Java application, how do I add those classes to the classpath dynamically in order to load them and call their methods? The goal is to pre-compile Groovy scripts and store them into the database, so evaluation ca...
I have a file log that I would like to parse and am having some issues. At first it seemed it would be simple. I'll go ahead and post the source I have come up with and then explain what I am trying to do.
The file I'm trying to parse contains this data:
HDD Device 0 : /dev/sda
HDD Model ID : ST3160815A
HDD Serial No : 5RA020QY
HDD Re...
I was wondering if anybody else had experienced problems when installing the drools plugin for grails, becuase I had to do several manual steps to get this working and I thought that it would just install and work straight away.
To get this working I had to do the following steps:
Step 1 - Install drools plugin
grails install-plugin d...
I love hadoop streaming for it's ability to quickly pump out quick and dirty one off map reduce jobs. I also love groovy for making all my carefully coded java accessible to a scripting language. Now I'd like to put the 2 together. I'd like to take a jar with some of my java classes, and utilize these in groovy-based mappers and reducers...
I'm trying to extract a closure from a groovy script. I define the closure as
def printMe = {str ->println str}
in my groovy file, and then try to use it by grabbing it from the binding as follows:
GroovyScriptEngine gse = new GroovyScriptEngine(new String[] { "scripts" });
Binding binding = new Binding();
gse.run("test.groovy", bin...
I've noticed there is like a 10 second hit using a groovy script with Grape annotations on my OSX box. Is it always this way? Can I make grape favor its cache (the depedencies are definitely already on the system in ~/.groovy/grapes...).
...
I am going to have some spare time and I'm looking in good ways to invest and improve my IT knowledge. The groovy langage seems to become more and more popular and I am a bit struggling to understand why.
Could someone explain me what makes groovy a langage to know ? Is it currently used in real projects ?
Thanks !
...