TO THE NEW Blog PAGES

Technology

Load Testing Made Easy with a Simple JMeter Utility

Load Testing is one of the major aspect which we all do for our applications, especially for those which have publicly available pages and has very heavy traffic. JMeter is a very commonly used tool for doing load testing. As developers, it is a very good tool to have in our skill set.   However […]

Vivek Krishna
Vivek Krishna
Read

Grails

Grails productivity enhancer. The unsung hero ‘grails interactive mode’

Of late, I have been thinking about the popularity of grails interactive mode amongst developers. I found that though most of us are aware of this mode but we don’t use it as often, as it should be. Where should I use grails –interactive mode while developing in grails? The answer may vary from person […]

Mohd Farid
Mohd Farid
Read

Grails

Grails:Domain Design Via Intellij Idea’s Diagrams

Here is an example of how to design Grails domain class with Intellij Idea.For this we need to have blank domain classes. So lets say we created  three Domain Classes Company,Book,Author To see relationship diagram, Selected Domain Class, and selected tab Domain Class Dependencies.It should look like this Lets assume the relation that publication has many […]

Hitesh Bhatia
Hitesh Bhatia
Read

Grails

uploading multiple files with same name

Grails does not support accessing multiple file input fields with same name using params.fieldName. We need to use request.multiFileMap (available in Spring 3.0) instead of request.fileMap. The blog provides sample code to achieve this feature via Grails Filter.

Bhagwat Kumar
Bhagwat Kumar
Read

Grails

Writing JSON APIs : Part I – Creating a secure JSON API with Grails and Spring Security in 3 easy steps

We had a requirement in a recent project to expose some of the functionality we had via a JSON API. The functionality needed to be secure, as was the initial web interface which exposed the functionality. We were using Spring Security for the security aspect of our application. The spring security plugin, together with a […]

Vivek Krishna
Vivek Krishna
Read

Grails

Validating emails, urls and date using Java API

Using commons-validator jar for validation emails, date, url, credit card etc. This jar file is bundled with the grails jar files. So writing regular expressions or creating command objects/domains for the single field validation is overkilling. The jar file has a special class GenericValidator for validating well-known data types.

Bhagwat Kumar
Bhagwat Kumar
Read

Grails

Grails Spring Security Plugin: User Switcher

If you are using Grails Spring Security in your application, one killer functionality that we can easily provide is a simple user switcher Add this to your admin layout: [html] <sec:ifAllGranted roles=’ROLE_ADMIN’> <form action=’/j_spring_security_switch_user’ method=’POST’> Switch: <g:select from="${users}" optionKey="username" optionValue="displayInfo" name=’j_username’/> <input type=’submit’ value=’Switch’/> </form> </sec:ifAllGranted> <sec:ifSwitched> <a href=’${request.contextPath}/j_spring_security_exit_user’> Resume as <sec:switchedUserOriginalUsername/> </a> </sec:ifSwitched> [/html] In […]

Himanshu Seth
Himanshu Seth
Read

AWS

How to delete all contents/objects of Amazon S3 bucket

If you have an S3 bucket with a huge number of files, and you want to delete the bucket, you need to empty the bucket first. If the bucket has a handful of files, then it is easy enough from the AWS interface, but if the bucket has a large number of files, then AWS […]

Deepak Mittal
Deepak Mittal
Read

AWS

Groovy : Find Index of Element in Map

Groovier way of finding index of element from Map. It can be obtained with findIndexOf Method, which accepts closure as argument. [groovy] Map map=["groovy":1,"grails":2,"index":3,"element":4] assert 3 == map.findIndexOf{it.key=="element"} assert 0 == map.findIndexOf{it.value==1} [/groovy]

Hitesh Bhatia
Hitesh Bhatia
Read

Grails

Grails: Find number of queries executed for a particular request

When response time of a page is slow, we might be interested in viewing database queries executed on that page. Enabling SQL Logging shows all queries but we are interested in queries for that particular request only. We can get this information by just simply adding the following filter to our application(Filters in Grails) [groovy] […]

Himanshu Seth
Himanshu Seth
Read

Grails

Criteria Query with Left Outer Join

In Grails app development, when using criteria queries, we often find cases for Outer joins. Lets take an example. We have two domain classes with us: [java] class Blog { String title String content static hasMany = [comments: Comment] static constraints = { } } [/java] and [java] class Comment { String text static belongsTo […]

Himanshu Seth
Himanshu Seth
Read
Services