We have a nice culture in our company where we sit together on every alternate Saturday and either share new things or we just learn about the technology we are using. This time we discussed about Groovy Meta Programming tricks and we watched the Meta Programming video of Jeff Brown. In that video the handling […]
We had a requirement that a template PDF which had Acroform fields had to be pre-populated (like name, email id etc) and sent to the end user so that he/she only needed to fill in the details which were expected to be filled by him/her. After going through the iText library, we found that the […]
keyword “in” is used in Groovy to check whether element exists in Collection. Example List [groovy] String str = "this is me " List list = str.tokenize(" ") String word = "this" assert word in list == true assert "hello" in list == false [/groovy] Example with Set [groovy] Set set = ["this","is","me"] String word […]
Recently in one of my projects, I had to bring the content of old-forgotten-deleted file back to the application code base using Git. The problem took a ‘fancy’ turn as the path to the file was no more a valid path in Git as there had been a major refactorings in our project esp. renaming […]
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() […]
In my recent Project, I wanted to create a domain class in which records could only be added and read and no update was to be allowed on any of the records and I found a very nice way of doing it. Adding [java] static mapping = { cache usage: ‘read-only’ version false } [/java] […]
These are few basic steps which will help you to integrate your java application with facebook using facebook graph api. Steps : 1) Register your application at http://www.facebook.com/developers/ 2) Facebook will return Consumer Key and Consumer Secret for your application. 3) Create a login action: String facebookPermissions = FacebookPermissions // Login Action String callbackUrl = […]
Hi, In my recent grails project, i needed to write unit test cases for testing custom validators which i created in command objects. To test validators, there is a method provided by grails “mockForConstraintsTests()” for validating constraints on Domain as well as Command-Object fields. Let us take a scenario where we needed to use command […]
In recent week, i got to know about really good way of collaborating the screen in a linux. Let us take a scenario, Suppose User having name ‘B’ on the 5th floor of the company is having a problem/difficulty related to code execution, unable to figure out what to do?, and then he call […]
Grails applications can define their own codecs and Grails will load them along with the standard codecs. A custom codec class must be defined in the grails-app/utils/ directory and the class name must end with ‘Codec’. For more information see Dynamic Encoding Methods. [java] import java.security.MessageDigest import sun.misc.BASE64Encoder class PasswordCodec { static encode = { […]
The clearfix hack, or “easy-clearing” hack, is a useful method of clearing float(left, right) effort. The clearfix hack works great, but the browsers that it targets are either obsolete or well on their way. Specifically, Internet Explorer 5 for Mac is now history, so there is no reason to bother with it when using the […]
(Xdotool is a tool that simulates user key movements.) Usually when we start to work , we usually require some apps to be running. In my case I have to run a grails app, sql , subversion and IDE in different tabs of same terminal. Normally it would take almost 1-2 minutes if I do […]