groovy

Grails app is hanging randomly

I have noticed the past couple of weeks that every once in awhile my Grails app will hang on a request. There is nothing in the logs, no exceptions/stack. Also, the page doesn't time out, it just attempts to load without end. I have been unable to determine how to definitely reproduce this problem and that's why I say it appears to be ra...

Groovy Properties list from HashTable

I am setting an external file to hold some persistent variables as Properties() Is there an easy way to list these in the same way that System.Properties() does?? to produce a list of Properties I have set. ...

Groovy expando dynamic set name

Is it possibly to dynamically set the class of an expando?? Having set jr = new Expando() Is there a way to def end = 'name' so that jr.end will actually give me the value stored in jr.name ...

STS Grails Command Popup to launch commands using grails-debug instead of grails?

Howdy, I'm using STS 2.3.3.CI-R5473-B24 with Grails 1.1. When launching the Type Grails command... yellow popup, is there a way to use grails-debug, rather than grails to run the commands? ...

String comparison passing through if statement when it shouldn't...

Hello, I'm comparing values of an excel sheet to record values returned from a database and one record is passing through the if statement when it should fail the if statement. The if statement looks like this: if (record.value.equals(cellVal) == false) { record.value = cellVal record.modifyUser = userId ...

Progress Bar using jQuery with a Grails backend?

Hello, I've written an excel upload function that allows a user to upload an excel sheet through a web interface and it will commit it to a table. The problem is that with a table with many records, it takes some time to go through each record and check for changes, so it tends to hang. What would be the best solution for a progress ba...

Groovy: Groovy Bean creating is longer than java.util.Map creating ?

class Test { String field int num public Test (String field, int num) { this.field = field this.num = num } } def start = System.currentTimeMillis() def testObj = new Test("i'm field", 1) println "Beans: ${System.currentTimeMillis() - start}" def start2 = System.currentTimeMillis() def map = [:] map....

Is Grails a viable option for large scale enterprise web apps?

Coming from a J2EE dev background, I love the idea of Grails....all the benefits of using enterprise Java (Spring, Hibernate, etc. ), but with the simplicity of Rails (scaffolding, convention over configuration, Groovy scripting, etc.). My company is considering rolling out a new enterprise scale web application built on top of Grails. I...

Access the request XML in a SOAP UI mock response script

Hello, I have a mock response, which needs to return a value that was in the request. For example, this request can come in: <myReqest><myValue>123</myValue></myRequest> I already have a mockResponse: <myResponse><yourValue>${theValue}</yourValue></myResponse> I know how to set the value of ${theValue} through the context variable...

Groovy map - keys with space

I have a map in groovy that looks like the following... def book = [Title of Book: "Groovy Recipes", Author: "Scott Davis", Number of Pages: "241"] I add my each 'book' into a BookList and would like to be able to get each value later on but when I try something like... BookList.Title of Book[0] //prints something like Title[0] inste...

Transferring data from one grails action to another

For our grails application, I've written a method that lets you upload a CSV file full of contacts, and it will parse the file and create contacts out of the data. I've used a test file of my own (hard-coding which fields mean what) and it works great. But of course I can't leave the field references hard-coded like that, so my next ste...

Grails - how to enforce at least one in a one to many relationship

Hi, Please can you help with the example below: class Car { static hasMany = [cd:Cd, fluffyDice:FluffyDice, wheel:Wheel] } class Wheel{ static belongsTo = [car:Car] } How do I enforce that a car has at least one wheel? ...

In groovy [].sum() returns null when I expect 0

In groovy [].sum() returns null when I expect 0 ...

Slashy String Literal not working in println

When i try execute the following code, which should just print a slashy string in groovy console version 1.7.4 i get a compilation error: println /slashy string/ if i change this to: def s = /slashy string/; println s everything is fine and the expected string is printed. Any ideas what i am doing wrong? ...

Appropriate use of Grails, Rails, etc?

We've got an Excel spreadsheet floating around right now (globally) at my company to capture various pieces of information about each countries technology usage. The problem is that it goes out, gets changes, but they're never obvious, and often conflicting - and then we have to smash them together. To me, the workbook is no more than a ...

Grails TimeZone issue, application wise and in Gorm entiteis

Okay, I've the strangest problem that I've just started to experience in a grails application working just fine for 2 months. Application is deployed on Linux/Tomcat 6 and MySQL is the DBMS at back end. When I type date on linux prompt, I get following output: $>date Sun Aug 8 03:52:06 PKT 2010 Where as in Grails application new Da...

Comparison of Groovy and Scala against Java

I have recently come across the languages Groovy and Scala which are built on the JVM. But I dont know much beyond that. Are those languages going to overtake Java at some point? Do these languages serve for any special purpose? Which of them is faster and more powerful? For what type of applications should I choose Groovy/Scala? Will it...

Groovy delete a tag in a XMLSlurper, replaceNode {} does nothing

I am parsing some XML with XMLSlurper (groovy 1.7.4) and I need to delete a tag (not make it empty!). Here is a code sample illustrating it: import groovy.xml.StreamingMarkupBuilder def CAR_RECORDS = ''' <records> <car name='HSV Maloo' make='Holden' year='2006'> <country>Australia</country> <record type='speed...

Is it possible to customize the hibernate-plugin autogenerated CRUD methods on my grails app?

My project's copy contains the following snippet in HibernateGrailsPlugin.groovy : def doWithDynamicMethods = { def dynamicMethods = HibernatePluginSupport.doWithDynamicMethods dynamicMethods.delegate = delegate dynamicMethods.call(it) // aids in generating appropriate documentation in plugin.xml since ...

Append to an existing groovy.util.Node with groovy.xml.MarkupBuilder syntax?

I'm working with an API that returns a groovy.util.Node, allowing me to customize its generated XML. I need to append a child element into the Node, and I'm wondering if I can use MarkupBuilder syntax to modify the Node. For example, here's something that works, but seems klunky: withXml { rootNode -> def appendedNode = new Node...