TO THE NEW Blog PAGES

Grails

Redis: Tag Cloud using Redis

I would like to share a simple and efficient way of creating tagclouds that I discovered very recently. A Tag Cloud is a pictorial representation of some tags/text. The size of the tag/text is drirectly proportional to the weightage of that tag/text. A sample tag cloud could be seen on our blogs site. How to […]

Mohd Farid
Mohd Farid
Read

Grails

Retrieving retweets by twitter user using Twitter4j

Hi, In the previous blog we saw how to fetch Twitter user’s Timeline using API calls with the help of Twitter4j library. I had a requirement to display all the retweets by the authenticating user and display them in our application. In this blog we will see how to retrieve the retweets by any twitter […]

Vishal Sahu
Vishal Sahu
Read

Grails

Fetching User’s Home Timeline using Twitter4j

Hi, In the previous blog we saw how to post status update on Twitter using Twitter4j library. In the same project i had the requirement to show Twitter home timeline inside our application. I used the same java wrapper library to retrieve tweets from the user twitter account. In this blog we will see how […]

Vishal Sahu
Vishal Sahu
Read

Grails

Static Type Checking in Groovy 2.0

Groovy is a dynamic language. We can’t check any typo error, method or property missing error at compile time. To check typo error, method or  property missing at compile time, Groovy 2.0 introduces new features named as Static Type Checking which helps to check errors at compile time. To use static type checker in groovy […]

Mohit Garg
Mohit Garg
Read

Technology

Changing the order of the elements of List in random manner

I found a very interesting method in java to change the order of elements in a list randomly, also called shuffling of elements in list. Actually I got the requirement to show a random product details out of 5 products, each time user refreshes the page. I came out with the solution using Collections.shuffle(<list>) For […]

Divya Setia
Divya Setia
Read

Grails

How to implement AOP Profiling in Grails application

In one of my recent project, i want to profile method execution time. I have used Spring AOP to profile method execution time. It’s very easy to implement AOP profiling in grails 1. Suppose we have below mentioned service class, we want to log execution time of method saveDataStudent,saveDataUpdated methods in service class. We need […]

Mohit Garg
Mohit Garg
Read

Grails

Attributes of Spring Cache

In my previous blog, i have mentioned how to integrate spring cache plugin in grails. In this blog we will see how we can use different attributes of cache. Different attributes of cache :- maxElementsInMemory- How many elements you can store in cache overflowToDisk-The attribute overflowToDisk is true, meaning that whenever the maximum number of […]

Mohit Garg
Mohit Garg
Read

Grails

How to integrate Spring cache plugin with Grails

In one of my recent project, i want to cache  method output. For implementing method level cache, i have used spring cache. For implement Spring cache, we can use grails cache plugin. It’s very easy to integrate cache plugin with grails. 1. Add following plugin dependency in BuildConfig.groovy. [groovy]compile ":springcache:1.3.1" [/groovy] 2.  We need to […]

Mohit Garg
Mohit Garg
Read

Technology

JavaScript: Currying in JavaScript

Hi,   Currying is a very simple and useful concept in JavaScript. Here we can set the context of the function to any object or variable.   So let us study this concept using the practical examples and code as follows: [js] //Let us first create a function "curry" function curry(thisObject, func){ return function(){ return […]

Kushal Likhi
Kushal Likhi
Read

Grails

Querying Domain class with hasMany String Type

In my recent project there was a use case where I had to query domain’s hasMany but relationship was not with any domain class but rather String type. Consider example [java] class Blog { static hasMany = [tags: String] } [/java] Now to find all the blogs with tag “grails” , our normal way of […]

Puneet Behl
Puneet Behl
Read

Technology

JavaScript: Replacing Logically using String:replace() method

Hi,   When working with JavaScript, we might sometimes require to run some regEx on a string and replace its matches logically. This can be easily done using the String:replace() method.   Lets Take an example to understand the concept: Suppose we want to write a function which converts the normal string to CamelCase String, […]

Kushal Likhi
Kushal Likhi
Read

Grails

Inject Methods/Properties to be available in all GSP Pages

Hi,   There could be cases where we would need to inject some methods or properties in all GSP pages.   As we know that the GSP pages extends GroovyPage class, hence injecting properties/methods in GroovyPage class can solve out purpose.   Example: Lets add appVersion property and a method to provide logo link irrespective […]

Kushal Likhi
Kushal Likhi
Read