The first sign something was wrong was the JVM bombing out with a “java.lang.OutOfMemoryError: PermGen space” error. All I’d done was change a gsp, so I restarted and after a long wait the same thing happened and it was then I noticed that the compiler just kept recompiling 4 classes in a loop until the JVM bombed.

This had happened to me once before when I’d managed to set the time incorrectly on my PC so some of my files appeared to be modified in the future. However this time I’d not done anything of the sort.

Read the rest of this entry »

I’ve been lookin for this keyboard shortcut for ages; in Visual Studio it’s “Show in Solution Explorer” – Ctrl+Alt+L, in Eclipse it’s “Show In” – Alt+Shift+w (Alt+W) but I couldn’t work out what it was in Intellij Idea.

It should allow you to find the file you’re currently editing in the project view and as soon as a project gets at all big it’s essential.

Turns out it’s a terminology thing – it’s called “Select current file or symbol in any view” and the shortcut is:

Read the rest of this entry »

It’s 2am, but I’m on a roll (though my typing is suffering somewhat and focussing has started to become an effort) and I’ve just discovered how to get the action and controller names in a Grails GSP. Read the rest of this entry »

The Grails Spring Security plugin is a wonderful thing and certainly worthy of more time spent on it than in this quick post. It saves days, if not weeks of work, plumbing in the standard security model of most websites. Notwithstanding its obvious benefits, I have noticed that many people struggle with some features of it, especially when retro-fitting it to an existing database schema and I can only assume it’s because the best examples of performing common tasks are only seen when generating the classes from scratch, using the generate-registration and generate-manager scripts.

Read the rest of this entry »

Grails Filter Fail (Update)

February 18, 2010

[sigh] Some days just seem to be wasted trying to work out why some apparently simple task cannot be accomplished. The frequency of such days has increased somewhat since I started using Grails – while I am a fan of the framework it is still occasionally buggy and badly documented and I seem to stumble into issues every week.

Read the rest of this entry »

I’m no Javascript expert and I couldn’t work out why it seemed to be so difficult to test to see if a function existed before I called it. In the end Google provided a better way though it wasn’t the most popular suggestion out there, to me it seems the most sensible way:

    if (window.myFunctionName) {
        myFunctionName();
    }

Where myFunctionName is the function you’re testing for, of course.

So far I’ve shown how to produce JSON from simple collections and how to convert domain objects to JSON, in this final post in my three-part look at rendering JSON from Grails controllers, we’ll take a look at customising the way objects are rendered by the JSON converter. Read the rest of this entry »

Why Won’t My Data Bind!

February 12, 2010

I love having the ability to create property getter and setter methods in Groovy and it really simplifies all those bean accessors in Grails domain classes. At least, it does until you define one incorrectly and spend an embarrassingly long time trying to work out why data in your Grails controller isn’t being bound… Read the rest of this entry »

I’ve been using the Grails RichUI plugin and have found a few of the tags it provides to be very useful. The one I’m using the most is the AutoComplete tag which I may well be writing more about in the near future. However, tonight I found a potential issue with the way it creates the YUI data source for the component – it seems it always gives it the same name: ‘autoCompleteDataSource’.

Read the rest of this entry »

Occasionally I need to use a message from an i18n resource in a service or domain object and every time I forget how. It’s a piece of cake in a controller or GSP because the message method is available, but when it’s not what do I do? Read the rest of this entry »

Follow

Get every new post delivered to your Inbox.