TO THE NEW Blog PAGES

Grails

Client side validation for Number values

Hi, Recently in my project , i needed to validate an input (whether it is a integer or not) on client side. I tried many codes but they are bit lengthy. Then I encountered the simplest way as given below, which worked. For any input value, it checks whether it is an Integer or not. […]

Grails

Injecting method to convert String number to number (Having , $ brackets)

Recently in my project we have use case where users have the habit of entering number as 100,000 and they write the -ve numbers as (100,000). Some times they also pur $ with the number field Initially when we were not aware of this we were populating the object like Expense expense =new Expense(params) This […]

Grails

Embedding JBPM 4.3 in a Grails 1.2.2 Application

Hi, In one of our projects, we had a requirement for using some existing Business Process Management tool. JBPM is one such tool that we are evaluating. Our first step was to run a “Hello World” process from inside the grails application. On searching over the internet, I didn’t find any helpful article/blog on integrating […]

Grails

Ordering using Grails CreateCriteria

Recently, in my project I had to implement search functionality. I used grails createCriteria to implement it.Now I needed to apply the sorting on the result returned. My domain was something like this : class MyEntity { OrganizationName orgName PersonName personName static constraints = { orgName(‘nullable’, true) personName(‘nullable’, true) } } class OrganizationName { String […]

Grails

Handy g:uploadForm

It is very easy and handy to use Grails <g:uploadForm> tag insteed of using HTML <form> tag or grails <g:form> tag, as you don’t need to set the enctype attritbute to multipart/form-data (as in case of HTML <form> tag or grails <g:form> tag) to work with file upload. for example insteed of using: … ,We […]

niraj
niraj
Read

Grails

Serializing objects to XML

XStream is a simple Java library to serialize objects to XML and back again. Suppose we have a Person class as follows: public class Person { private String name private int age private Address address } public class Address { private String street private String city private String state private String country } The following […]

Grails

Grails : Difference b/w two dates with fine-grained details

Hi Friends, To retrieve difference between two dates with finer details which would display their difference as 2 years 7 weeks 3 days 2 hours 5 mins ago is given below. /** * Returns differnce b/w new Date and old date as Map holding difference in years, weeks, days, hrs, mins & secs */ public […]

Technology

Vi Editor

I will try my best to give you some tips to make Vi look more interesting and easy to use for all you guys. I have read few articles and tutorials about Vi and will try to summarize some key points here. First things, first : WHAT IS Vi? Vi is NOT just an editor. […]

Grails

Create JSON object Using Grails converter (Only selective fields from lists of objects)

This post might help you if you want to get JSON (JavaScript Object Notation) Object on browser. Grails framework provides you very efficient way to achieve this. For this you need to import grails JSON convertor in your code. import grails.converters.JSON Below is the code snapshot which converts java based lists of Objects to JSON […]

Salil
Salil
Read

Technology

How to allow non-root user to start/stop Apache process on a *nix server

Recently, I had to write a script to deploy a Grails application on a cluster of 7 servers without prompting for any kind of passwords. The load balancer was configured so as NOT to direct any request to the node, if the Apache process is not running on the server. So, my script to do […]

Grails

Grails : Save time while writing Integration tests

Hi Friends, I always used to spend lot of time writing integration tests as running even a single test involves loading the complete application, which includes loading complete database every time. Then I realized that data which I use for testing is always the same, why can’t we restore the database once created, before we […]

Technology

Jasper report – Pattern for Negative Numbers

Recently had a requirement to print Currency values with a condition that negative numbers must be inside brackets. It can be done by using pattern property in tag. the part before semicolon is for positive numbers and part following semicolon is for negative number. ____________________ Hitesh hitesh@intelligrape.com Intelligrape Software ____________________