Amit Jain

Grails

Remote-pagination : support for javascript events added

Hi Friends, I have released the version 0.2.5 of Remote-Pagination, which now provides the support for all the events as supported by grails tags like remote-link.  Events supported are listed below : onSuccess  - The javascript function to call if successful onFailure  - The javascript function to call if the call failed ...

14-Mar-2011

Grails

Using Groovy execute bash scripts

Hi Friends, Recently I had to execute bash script using groovy on a windows server. Though I could easily make the similar script run on linux, but on windows it just didn't work as it was unable to recognize the internal DOS commands like cp, rm etc. On linux the following code worked but not on windows: [bash] File script =...

15-Feb-2011

Grails

Grails criteria query : ‘createAlias’ made it easy

Hello friends, In my grails project, I was finding it difficult to write a query using criteria which can be read as 'list all customers whose current account balance is more than minimum account balance of that customer'. The simplified form of the domain is given below : [java] class Customer { String name Account account ...

17-Jan-2011

Technology

Database Backup Script for windows

In one of the project I am working on, the application needs to be deployed on windows server. To take the database backup, I wrote the script which does the following : Takes database dump and copy it to the backup folder. Zip that backup file and rename it to the format "YYYYMMDD_HHMMSS" Removes  all the backups older than 30...

14-Dec-2010

Technology

Jquery : map and grep functions

Hi friends, I was going through some utility funcitons being provided by jQuery. Found few methods like grep, map very userful that saves me from writing loops. I could relate them with grep, collect respectively as provided by Groovy, thought would share with you. I will be taking examples with JSON objects say Student. grep() ...

15-Nov-2010

Grails

Grails Liquibase plugin: dbDiff tool workaround

The current project I am working on, is going through QA. At the same time development of the new features and bug fixing is on and we couldn't afford to loose the test data. So synchronizing the state of the QA database with the development was becoming a pain. So we decided to use grails liquibase plugin. I found one great article by...

12-Oct-2010

Technology

jQuery: Floating message box which disappears in few seconds

Hi Friends, Recently in one of the project I was working on, had a long web page and updates used to happen only through ajax calls that means no page refresh. The status messages used to appear on the top of the page, the user had no way but to scroll up to see the status message. There we thought of using floating message that always...

14-Sep-2010

Grails

Grails : load proxy domain objects

Hi Friends, I was going through grails docs, encountered a method called load(), found it really useful thought would share with you. What load() does is, it creates a proxy object and doesn't retrieve the record from the database until property other than id is accessed. Let us consider a scenario, where we have id of a Object...

26-Jul-2010

Grails

Grails: Change number of records displayed with Remote-Pagination

Hi Friends, I have released version 0.2.3 of remote-pagination plugin, which includes an option to enable user to change page sizes out of the given options. As given in the documentation, lets have a look at the example below : //Example Domain: class Book { String title String author } //Example controller: class...

29-Jun-2010

Grails

Password validation with certain conditions

Hi Friends, I needed to validate password for certain conditions. As per the requirements, any valid must password must pass the following conditions: Minimum of 7 characters Must have numbers and letters Must have at least a one special characters- "!,@,#,$,%,&,*,(,),+" I wrote the following method to meet the...

14-Jun-2010

Technology

JQuery: Send JSON Objects with an Ajax Request

Through my blog, I will discuss about sending JSON objects with ajax request using JQuery. We have number of functions in jQuery to kick-off an ajax request. But for sending JSON objects along with the request, I chose jQuer.ajax(). It takes various parameters url, type, data, dataType, beforeSend etc. Its API can be found here. Lets...

11-Jun-2010

Technology

jQuery : Chaining of your custom function calls

Hi Friends, I always used to think how jQuery provides the chaining mechanism, must be something really complex so never cared to find it out. Though there was a desire to to use the same concept in my own custom javascript functions. Recently I realised how easy it is, so thought would share with you with the help of an example. ...

04-Jun-2010