

30
Sep, 13
Create a maven project with quick-start template, refer to this post in case you don’t know how to create one. Next, open the pom.xml and enter these spring dependencies which will be used by our sample app....

27
Sep, 13
Everyday JS : Part 5 – Explaining events using a simple Web Scrapper in Node
Sure we all do know what a web scrapper is, and how illegitimate it is, but for personal use you can always code one ! I was required to make a simple app using django Python to scrap off content from this blog and find the number of post written by each author in a...

27
Sep, 13
jQuery Select2 with ajax in grails
jQuery Select2 is an awesome jQuery plugin. It provides very interactive UI for select drop downs. Select2 comes with AJAX support built in. Instead of giving list to select you can make ajax request and get dynamic data. Following are the steps to get the dynamic...

26
Sep, 13
Call grails service methods from src/groovy
In a project I was asked to maintain the user login history. I wrote all my business logic in a service say “UtilityService” and captured the login event successfully then I required to call this service. For that I used the following code to call the...

26
Sep, 13
Grails 2.3.0 Declarative Controller Exception Handling
This feature of Grails 2.3.0 has made my day. I can already see lot of scope of refactoring my controller code and make it more concise. Till date the usual of writing code inside Grails controllers was to make a service call and put that inside try/catch block and...

25
Sep, 13
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...

25
Sep, 13
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....

24
Sep, 13
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...

24
Sep, 13
Everyday JS : Part 1 – My Experience with a New World
I’ve been fiddling with so many things since last two weeks, everything from Node.js, ExpressJs, Angular, and trust me it’s a big big mixed bag. The problem with working on a new technology ( which get updates so frequently ) is that you read something...

24
Sep, 13
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...

23
Sep, 13
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...

23
Sep, 13
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: [php]String[] datesFormats = new...

23
Sep, 13
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...

23
Sep, 13
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...

23
Sep, 13
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...

23
Sep, 13
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...

19
Sep, 13
Accessing messages.properties/i18n in grails services
To read messages from messages.proprties you need locale. You can get locale like Locale.ITALY or you can get it from request object request.getLocale(). Suppose following is entry in messages.properties [php]user.admin=Hello Admin[/php] 1 [php]user.admin=Hello...

18
Sep, 13
request, response and session object in grails service
Request, response and session objects are implicitly available in controllers, views and tag libraries and hence we can easily set or get data from these objects but in services these objects are not implicitly available. If you want to set or get data from these...

17
Sep, 13
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,...

17
Sep, 13
Grails 2.3.0 Binding Date in Grails using BindingFormat
I was reading a blog post titled Parse date in grails 2.x.x regardless format by Amit Pandey where he explained how we can parse dates automatically inside a controller. I realized that Grails 2.3.0 introduced a new annotation named as “BindingFormat”...
Recent Comments