Everyday JS: Part 4 – Asynchronous Programming.

In my last post we discussed how nodejs can be used to create a http server, but it had some practical problems associated with it. Our ready to deploy server can listen to incoming request on designated port, but it simply didn’t know what to do next ! We...

Integrate jasper report with grails

I used Jasper report for the first time in my Grails project and i faced many issues. I am sharing some tips with you which will help you to solve common problems. 1. Use jasper plugin. Go to this link and add jasper plugin in your BuildConfig.groovy like this....

Everyday JS : Part 3 – A Simple HTTP Server

Part 1: Introduction to NodeJS Part 2: NPM and modules in NodeJS This will be a very long post, so I’m dividing it further to make it easier. ExpressJS is a great utility for Node, it can be precisely defined in its own words ” a minimal and flexible...

Grails 2.3.0 Redirects In URL Mappings

Prior to Grails 2.3.0 redirects were not supported in URL Mappings and the available solutions were not DRY. There have been various discussions on stackoverflow, Mailing List , Jira and on the blogs to add redirect in URLMapping.groovy. Grails team has finally added...

Read file in Grails service

Whenever I required to put  file in Application and read content from that file I create a directory e.g. resources in the web-app directory and read content in service like: [php]import org.codehaus.groovy.grails.web.context.ServletContextHolder as SCH class...

Parse Date in Java using a list of formats.

In extension to the parse-date-in-grails-2-x-x-regardless-format We’ll parse date from a list of available formats to java.util.Date using apache’s commons lang library. This can be used in the service layer like: String[] datesFormats = new...

Capture login event in grails

There are several use cases where we are require to capture the login event such as storing the login history, set user related data like name and email in session(so that no database hit to get this basic information), etc. In my project I asked to maintain user...

Play MP3 files in Java using JLayer

Recently, I was trying some media API and found the JDK 1.6 doesn’t play MP3 files out of the box. So, I searched a little and found JLayer that can play mp3 format, you only have to include its jar file. Other than JLayer there’s Java Media Framework...

Convert string params to list

Grails 2.x added a new method in params object “list”. This method is used in case you are not sure weather you got a string(single request parameters of a name) or a list(multiple request parameters of the same name) in params. This method always return a...

Create Java project with Maven from terminal.

Install maven on your system and run the following command: mvn archetype:generate -DgroupId=com.jft.prashant -DartifactId=MavenSample -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false This will generate the required directory structure with...

reCAPTCHA: the human element of digitization

Most of us stumble upon different Spam-protection techniques, while there are few which are relatively very easy, there are also some wicked one which ask you to solve proper calculus problems ! Spam protection techniques are aptly very common in our day to day usage,...

Fetch data from multiple datasource in grails

Please refer to my other blog titled “Configuring Multiple datasources in Grails” to know how to configure multiple datasources in Grails application. Now here I am writing about how to make finders work with multiple datasources in Grails. Lets say there...