Vivek Krishna

Open Source Enthusiast, Agile Practitioner, Grails Lover, jQuery Worshiper.

Grails

Grails 2.2.0 : Namespacing to resolve between controllers of same name

Grails 2.2.0.RC1 was released last week and a new feature to make an entry into the version of the framework is the support for namespaces for controllers and services so that there is no naming conflicts while adding artefacts of the same name from different plugins or within the application. I created a sample app and installed the...

24-Sep-2012

Grails

GroovyShell.evaluate() : The magician behind Grails Console

Grails console is one plugin that we install as soon as we create a new application. The power and the purpose of the utility is too good to be missed. On one such occasion, I decided to dig the code in the plugin and discovered the magic trick that executes the string that we type in the web interface. Turned out that...

05-Sep-2012

Grails

Using Data URLs for embedding images in Flying Saucer generated PDFs

We extensively use Flying Saucer to generate PDFs from GSPs in our grails applications. However, there is always the issue of embedding images from within the application because the URLs are usually relative to the environment and as such, embedding them in PDFs with a URL in the src attribute is cumbersome. To get around this, we...

24-Aug-2012

Grails

Auto Completion for Grails Scripts with Dynamic Version Determination

We are constantly striving to be more productive by minimizing key-strokes for a lot of commonly used shell commands. Alias is one way of achieving it, but it isn't always the answer. Bash auto completion is one feature that I use a lot. To avoid the hassles of working with multiple grails projects, I use this script and for auto...

16-Aug-2012

Grails

Overriding properties in a Spring Bean with BeanFactoryPostProcessor

I was going through the source code of one of the Grails Plugins where I found the use of Spring's BeanDefinitionRegistryPostProcessor to override some configurations that are available in DataSource.groovy. That involved a complete over riding of a PropertyValue definition.   It set me thinking about whether there is a way to...

12-May-2012

Grails

Writing sentences with Groovy 2.0

Groovy 2.0 comes with some amazing new features, which prompted a numbering scheme jump from 1.9.x to 2.0. One of the key features that I took note while going through  Guillaume Laforge's presentation at 33rd Degree was the support for plain language sentences made possible by optional parentheses,  and dots. We love the language...

22-Mar-2012

Grails

My Top 9 Features from Grails 2.0

The groovy world is abuzz about the latest release from the Grails Stable, Grails 2.0, which packs a lot more punch than its predecessors, which by themselves were productivity enhancers and wonderful to develop our web applications with. The new version brings with itself a lot of changes compared to the previous releases and...

18-Jan-2012

Grails

Grails Custom Data Binding in 3 Simple Steps

The other day, Farid came with an interesting problem of binding a Time String to java.sql.Time. We straight away found the answer in using a CustomTimeEditor and registering it using a CustomPropertyEditorRegistrar bean. We were able to come arrive at this solution, thanks to this StackOverflow thread. This set me thinking into using...

29-Dec-2011

Grails

Writing JSON APIs : Part II – Creating JSON Named Configs to Control What You Render

In the 1st part of the series, we looked at how to secure our application with Spring Security Basic Authentication and modifying the JSON Marshaller. However, it could often be the case that the same set of fields shouldn't be returned on every JSON response. For example, we could very well have a summary JSON for Book, which just...

29-Dec-2011

Technology

Load Testing Made Easy with a Simple JMeter Utility

Load Testing is one of the major aspect which we all do for our applications, especially for those which have publicly available pages and has very heavy traffic. JMeter is a very commonly used tool for doing load testing. As developers, it is a very good tool to have in our skill set.   However we, as lazy productive...

30-Nov-2011

Grails

Writing JSON APIs : Part I – Creating a secure JSON API with Grails and Spring Security in 3 easy steps

We had a requirement in a recent project to expose some of the functionality we had via a JSON API. The functionality needed to be secure, as was the initial web interface which exposed the functionality. We were using Spring Security for the security aspect of our application. The spring security plugin, together with a secured...

16-Nov-2011

Technology

Mounting an EBS Volume to an Instance and Soft Linking a Growing Directory to it

We were having a crisis on our project the other day. The VPS on which we were running our application had some issues with kernel and Tomcat, for that matter, any java process was running unpredictably. Tomcat would explode the WAR file once in a while and even if it did, it would just pause at "Deploying app.war" forever. After spending...

05-May-2011