TO THE NEW Blog PAGES

Grails

Integrating Spring AOP with Grails Application

AOP means Aspect Oriented Programming Enables encapsulation of functionality that affects multiple classes in separate units. Complements Object Oriented Programming. Cross Cutting Concerns : Functionality whose implementation spans multiple modules. Different From OOPS Sometimes we want to implement common functionality through out some classes, through out some common method. We can achieve that functionality by […]

Mohit Garg
Mohit Garg
Read

Grails

What is Delegate ??

Suppose a scenario, where User and Account classes are linked as below: [groovy] class Account { String email String password // … other fields } class User { Account account String name String address // … other fields } [/groovy] At the time of creating a new User, and accessing the user members, we write […]

Amit Kumar
Amit Kumar
Read

Grails

Integrating LinkedIn Groups in grails application.

Hi, In one of my recent Grails application, i needed to integrate LinkedIn groups with the application. In my previous post, we discussed about Integrating LinkedIn API in any grails application. To add a LinkedIn Group, we first need to authorize the LinkedIn account which has either created that group or is the member/admin of […]

Vishal Sahu
Vishal Sahu
Read

Grails

Using Data URLs for embedding images in Flying Saucer generated PDFs

We extensively use Flying Saucer to generate PDFs from GSPs in our grails applications. However, there is always the issue of embedding images from within the application because the URLs are usually relative to the environment and as such, embedding them in PDFs with a URL in the src attribute is cumbersome. To get around […]

Technology

Replace All using JQuery and Regex

I recently found out that use of Regex with jQuery and replace function can turn out to be a very powerful tool for replacing/loading data in html dynamically The use of replace is made like [js] var a = "Some text here text"; a=a.replace(/text/g,"one") [/js] This will replace all “text” with “one” Now imagine how […]

Grails

Login with Twitter

This application saves user’s time for registration by providing a way through which user can login into application with its twitter credentials. Application will get the user details from his corresponding twitter account and will do the registration programmatically, so user can easily manage account through his twitter account. Five simple steps to connect with […]

Amit Kumar
Amit Kumar
Read

Grails

Manage Multiple Log File

Different Levels of Logging to Different Appenders or Files: When a project is running, then lot of log messages (all type of log messages e.g. Error, Fatal, Warning, Info, Debug etc.) are logged into a single log file. Many times we try to find the error messages only, instead of debugging the complete application. In […]

Amit Kumar
Amit Kumar
Read

Grails

Grails 2.1 command line alias

I am a linux user and like to do everything on command line, I find it more productive. Anytime I need to write long command or use any command frequently, I always create an alias for that, for example while running the test cases I need to run the command so I created alias for […]

Grails

Auto Completion for Grails Scripts with Dynamic Version Determination

We are constantly striving to be more productive by minimizing key-strokes for a lot of commonly used shell commands. Alias is one way of achieving it, but it isn’t always the answer. Bash auto completion is one feature that I use a lot. To avoid the hassles of working with multiple grails projects, I use […]

Grails

Using Initialization bean to set properties

Using Grails, we often set some application wide constants or config properties or execute certain tasks in bootstrap.groovy when the application starts . A better approach is to create a new class in src/groovy and have it implement Initialization bean interface [java] import org.springframework.beans.factory.InitializingBean class MyClass implements InitializingBean { void afterPropertiesSet() { // do you stuff here. } […]

Sachin
Sachin
Read

Technology

Saving system when it refuses to boot

So, most of the users here around me are ubuntu users, and it’s not something uncommon that a recent upgrade broke your system and now you are just pulling your hair and cursing the time when you clicked that “Upgrade” button. So, what is it that you can do from saving yourself in such scenarios. […]

avinash
avinash
Read

Grails

Send Mail via Log4j with SMTP Appender

Grails supports sending all log messages(error,fatal etc.) to a support team or to yourself, by email (gmail account), via log4j with SMTP Appender. 1. For this we have to do some configration in Config.groovy as shown below: [groovy] // import SMTPAppender and Log4j Lever classes import org.apache.log4j.net.SMTPAppender import org.apache.log4j.Level … // Mail server Configration mail.error.server […]

Amit Kumar
Amit Kumar
Read