Sunday, June 7, 2009

grails-debug run-app

This is the target to debug the app

Tuesday, April 28, 2009

Left Shift Operation

Recently I tried to use the operator "<<" on a a list,

List contactGroups = ['b','c','d']
List displayContactGroupList = ['a']
displayContactGroupList << contactGroups


I was expecting that at the end of the execution, I will have

displayContactGroupList = ['a', 'b','c','d' ]


However, I was surprised to find that the value was

displayContactGroupList = ['a', ['b','c','d'] ]


Learned a new thing today, So to get the effect of what I wanted to get, I will have to use

displayContactGroupList.addAll(contactGroups)

Monday, April 13, 2009

Run grails on port other than 8080

grails -Dserver.port=9090 run-app

Tuesday, September 9, 2008

Unit testing the Controllers

As you develop the action methods in a Controller, it is highly recommended that you write the unit test for this code. To run the whole test suite:

> grails test-app

To run all tests for a single controller:

>grails test-app MyController

You can even run a single test

>grails test-app MyController testValidData

The results can be seen here:
./test/reports/html/all-tests.html

Friday, August 29, 2008

Awesome Groovy Collections!

There is a short cut for:

if (errorMap?.size() > 0) {
// do something
}

to
if (errorMap) {
// do something
}



same thing in JSP, you can use:



sublist

def devices
int start
int end
def subdevices = devices[start..end]