Thursday 30 September 2010

Grails & 'Grails in Action' - some notes & comments

I have just started playing with grails.
I am using 'Grails in Action' as my reference.
My current version of grails is 1.3.4
I am using the STS eclipse IDE with their built in grails plugin

Here are some initial notes on GOTCHAs I have found with the book and grails itself.
NB I will continue to update this one page with other gotchas, instaed of creating many pages.

Comments on 'Grails in Action'

1) p28, list 1.22
'render' should be 'response.outputStream <<'

2) logo.png & snazzy.css are needed for chapt 1 & can be got from github



Comments on Grails 1.3.4

1) can not create integration tests - getting error
Error executing script CreateIntegrationTest: No such property: type for class: CreateIntegrationTest
No such property: type for class: CreateIntegrationTest

edit the file scripts/CreateIntegrationTest.groovy in your grails installation
and add the line
def type = "Tests"
after the line
depends(checkVersion, parseArguments)

NB this is fixed in 1.3.5

2) when running the test via 'grails test-app' the url for the report is incorrect
and is missing the trailing 's' from the URL

edit the file scripts/_GrailsTest.groovy line 402 and add a space after the the closing brace of testReportsDir and before the double quote
msg += " - view reports in ${testReportsDir} "



3) 1.3.5 bug - add a contraint that specifies the size of the field then it does not check for null.
IE This will allow a nulll value in name:
static constraints = {
name (size:3..8)
}

The work around is to do this:


static constraints = {
name (size:3..8, blank:false)
}

bug GRAILS-6821 has been raised on version 1.3.5

Tuesday 21 September 2010

keepass and dropbox combined.

A while ago I blogged about using keepass as a secure password & data storage tool.
The blog entry is here.

The issue I have always had is keeping the keepass db in sync between my different PCs at work & at home and on the move. I used to use a memory stick but decided that was prone to getting lost or damaged.

I have recently started using dropbox. This tool provides online storage allowing sync between any number of devices and supports linux, i-phones, android, iPad as well as Microsoft platforms. It is free for the first 2GB and you get to earn additional storage by either nominating others or getting nominated by an existing member.

From the reviews I have read it appears secure so I have started using it for my keepass database as well as any every day stuff I want to share.

As for reviewing keepass I am still very pleased and impressed with it.
My family now all have their own keepass databases to keep their personal data.

So if you want to try dropbox, follow this referral link and try it out.


Thursday 16 September 2010

tomcat IE and parse locale Exceptions

I have just done an upgrade for a customer that involved new java, tomcat as well as a new version of our application software.


The webapp was failing with the following Exception:


Caused by: javax.servlet.jsp.JspException: In &lt;parseNumber&gt;, a parse locale can not be established
at org.apache.taglibs.standard.tag.common.fmt.ParseNumberSupport.doEndTag(ParseNumberSupport.java:134)
at org.apache.jsp.tag.web.shared.paging_tag._jspx_meth_fmt_005fparseNumber_005f0(paging_tag.java:598)
at org.apache.jsp.tag.web.shared.paging_tag.doTag(paging_tag.java:241)
at org.apache.jsp.pages.jsp.type3Footer_jsp._jspx_meth_tag_005fpaging_005f0(type3Footer_jsp.java:220)
at org.apache.jsp.pages.jsp.type3Footer_jsp._jspService(type3Footer_jsp.java:114)
... 73 more


Some googling pointed me to adding locale java options:
This just shifted the problem to Oracle Exceptions complaining about NLS_LANG and suggesting
After all the application worked fine before.

So what was my final solution.

Very simple. In IE go to Tools->Internet Options->General/Languages.
  • found out there were no languages set
  • Add the appropriate one
  • English (United Kingdom) [en-gb] in my case.