TO THE NEW Blog PAGES

Grails

Generating Dynamic charts in Grails

In my project we need to generate dynamic Pie charts & Area charts. I had various options to do so. 1. Use Google charts API 2. Use Grails Eastwood Chart plugins. 3. Use jFreeChart API. In case of Google charts, the application only generates the required URL & get the chart from google server , […]

Technology

Client side date validation using jQuery plugins

I have been facing problem of validating a text input field for a valid date. We are using two popular jquery plugins : jQuery validation and jQuery UI datepicker for client side validation. I googled it and found a good solution here http://stackoverflow.com/questions/511439/custom-date-format-with-jquery-validation-plugin but it was validating only the formatting i.e. 30-Feb-2010 is a valid […]

Technology

XmlSlurper made it simple

Hi! We had a myForm.html file (accessible only from the third party) where in we needed to update the form containing input/select/check boxes with the values we had in the request params and then render it. So we used xmlslurper for the same. Without much effort, it just worked great. Following is the code we […]

Amit Jain
Amit Jain
Read

Grails

Creating image thumbnails through Grails ImageTools plugin

In one of the projects recently, we had to generate the thumbnails dynamically from the client-provided images. We decided to use the Grails plugin named: ImageTools. This is a very basic plugin but provided very quick and stable solution to our use-case. You can read more about the plugin and how to install it here […]

Grails

Tracking Errors/Exceptions during ajax calls in a view

If you want to keep track of the errors and exceptions on the view, after making an ajax call, then this might be something of your interest : jQuery().ready(function() { jQuery.ajaxSetup({ error: function(x, e) { if (x.status == 0) { alert(‘You are offline!!\n Please Check Your Network.’); } else if (x.status == 404) { alert(‘Requested […]

Imran Mir
Imran Mir
Read

Grails

Grails JMS Plugin and Redelivery Policy

On a project, we needed to configure the redelivery mechanism for the JMS queue. That is, a poisonous message was to be sent to a Dead Letter Queue if a set number of attempts failed, so that the other messages in the queue could be processed. The JMS Plugin version used was 0.5 Merely configuring […]

Grails

Compiling sub-reports in Jasper reports

In my project we needed to generate pdf reports. The tool we used to design reports is IReport 2.0.5 & the plugin used is grails jasper plugin.The plugin works fine with simple reports but fails when it come to complex report which uses subreport.The problem is that the plugin compiles .jrxml file to .jasper file […]

Grails

Grails: handling StaleObjectStateException and making executeUpdate transactional

Recently I encountered a StaleObjectStateException which said “Row was updated or deleted by another transaction.” We were just updating multiple objects of the same domain inside a loop. So we used executeUpdate statement instead of myClass.save() method to update the records, which worked. ReserveAccount.executeUpdate(“update ReserveAccount set currentBalance=(:balance) where id=(:id)”, [balance: currBalance, id: reserveAccount.id]) Later we […]

Grails

Programmatically logging in user in jsecurity plugin

In our current project we are using jsecurity plugin and some of our bootstrap code required a user to be logged in. I found a nice blog http://www.tothenew.com/blog/?p=335 on this topic but it was using groovy metaprogramming to override the normal behaviour of SecurityUtils.getSubject() which is suitable for test environment. After a few minutes of […]

Technology

Monitoring ajax call response

Recently I have faced a problem of monitoring all the ajax calls. Based on the response from server I have to perform some task depending on the contents of response. If the html response contains some text input field, the first text input field should be automatically focused otherwise leave the response as it is. […]