TO THE NEW Blog PAGES

Technology

Using Inject method in Groovy 2.0

A very useful enhanced method in Groovy 2.0 is inject method whose key purpose is to pass the outcome of first iteration to next iteration and keep on passing till all the elements of collections are processed. Lets start with an example, consider a class Employee with name and salary as attributes: [java] class Employee{ […]

Divya Setia
Divya Setia
Read

Technology

@Log annotation

@Log : This annotation provides the log object in groovy class. By using it you don’t need to create the Logger object, it automatically provides log object. Example: [groovy] import groovy.util.logging.Log @Log class Person { String name String address String city public void logDetails(){ log.info("Name:::${name}—>Address ::: ${address}—> city :::${city}") } } new Person(name:"Mohit Garg",address:"Address",city: "city").logDetails() […]

Mohit Garg
Mohit Garg
Read

Grails

Get recent twitter followers using Twitter4j

Hi, In the previous blog we saw how to fetch twitter users based on some search criteria using the Twitter4j library, a java wrapper available for Twitter API calls. In the same grails project, i had the requirement to display the recent twitter followers of authenticated twitter accounts. Twitter4j library provides a way to get […]

Vishal Sahu
Vishal Sahu
Read

Grails

Search Twitter Users using Twitter4j

Hi, In the previous blog we saw how to fetch tweets based on some search criteria using the Twitter4j, a java wrapper library available for Twitter API calls. In the same grails project, i had the requirement to search users based of their name or words. Twitter4j library provides a cool way to search users […]

Vishal Sahu
Vishal Sahu
Read

Technology

TupleConstructor annotation in Groovy

@TupleConstructor annotation provides the classical constructor with default properties. It will create the constructor with first parameter as address, second parameter as name etc. Constructor implementation depends upon the order of the variable declaration. One thing you need to ensure that you need to pass the value in same order as used in variable declaration. […]

Mohit Garg
Mohit Garg
Read

Grails

Searching tweets on Twitter using Twitter4j

Hi, In the previous blog we saw how to fetch tweets posted by a particular user using the Twitter4j,a java wrapper library available for Twitter API calls. In the same grails project, i had the requirement to display the based on some search criteria or words. Twitter4j library provides a cool way to search tweets […]

Vishal Sahu
Vishal Sahu
Read

Grails

Get tweets posted by user using Twitter4j

Hi, In the previous blog we saw how to fetch tweets in which a particular user is mentioned, using the Twitter4j java wrapper library available for Twitter API calls. In the same project, i had the requirement to display the tweets posted by particular user including retweets. I searched for it and found a cool […]

Vishal Sahu
Vishal Sahu
Read

Grails

Fetching twitter user mentions using Twitter4j

Hi, In the last blog, we saw how to retrieve the tweets from user timeline which the user has marked as favorite using Twitter4j java wrapper for making twitter API calls. In the same grails project, i had the requirement to fetch all the tweets in which the current user in mentioned in the tweet […]

Vishal Sahu
Vishal Sahu
Read

Grails

Fetching twitter user ‘Favorite’ tweets using Twitter4j

Hi, In the previous bog, we saw how to fetch the Retweets by any twitter using using Twitter4j Java library for making twitter API calls. I had the requirement to fetch latest tweets from user timeline which user has marked as ‘Favorite’ and show them in our application. So, in this blog we will see […]

Vishal Sahu
Vishal Sahu
Read

Grails

Executing Groovy scripts at runtime

A very useful Groovy class GroovyScriptEngine can be used to execute Groovy scripts at runtime. For understanding purpose, lets start with an example. We have a script named as Area.groovy that calculates the area of circle. [java] // Area.groovy Float r = "${radius}".toFloat() //radius will be passed as an argument to this script. return "Area […]

Divya Setia
Divya Setia
Read

Grails

Few Simple steps for integrating Rabbit MQ with Grails

Rabbit MQ as defined by rabbitmq.com is a robust messaging for applications. We used RabbitMQ to achieve asynchronous communication between two parts of the application. I would like to share the same in a step by step fashion. Here are few simple steps that I followed to make my grails application use rabbitmq: 1.Install rabbitmq […]

Mohd Farid
Mohd Farid
Read

Grails

Redis: Heavyweight Tags – an awesome use-case for caching with Redis

Redis plugin provides a beautiful way to cache the html tags. Using this plugin we can make big savings on the time taken to render the gsp tags. [java] <redis:memoize key="someKey" expire="3600" > //Some heavy weight tags rendering // Lots of db / network operations. </redis:memoize> [/java] I found this tag extremely helpful in rendering […]

Mohd Farid
Mohd Farid
Read