IntelliGrape recently started its new vertical of e-commerce sites development using Magento. Our ethos has been on choosing a leading technology/platform for whatever we do – be it custom web development or mobile apps development or ecommerce site development using packaged solution. Also, emphasis is not only on choosing a great technology but also be […]
I had two applications that communicate with each other through web-services. There I had a requirement to send multi-part file from one application to another. After searching I came out with the following solution and thought to share: [java] import org.apache.http.entity.mime.MultipartEntity import org.apache.http.entity.mime.HttpMultipartMode import org.apache.http.entity.mime.content.InputStreamBody import org.apache.http.entity.mime.content.StringBody import groovyx.net.http.* void sendMultiPartFile(CommonsMultipartFile multipartImageFile, String cityName) { […]
Some of the commonly faced problems are: 1) In case we give different width combinations for cells of different rows, the width combination of first row is accepted and subsequent combinations are neglected. [html] <tr> <td width="30%">1.1</td> <td width="50%">1.2</td> <td width="20%">1.3</td> </tr> <tr><td width="50%">2.1</td> <td width="40%">2.2</td> <td width="10%">2.3</td> </tr> [/html] In this case width of […]
While writing a test case, we are generally interested in executing only the one we are working on. With JUnit test case in grails we could say “grails test-app <ClassName>.<currentTestCase>”. However it doesn’t work with spock specification’s. Spock framework provides multiple cool annotations, following two annotations can be used to speed up writing/executing test case […]
We usually specify validation constraints in domain classes and command objects. But, if it is required to provide validation in other classes(like classes in src/groovy), we can do so in two ways : 1. Defining a static constraints property in the class and using the @validateable annotation. 2. Defining a static constraints propery in the […]
Hi, Recently I had come across one of the cool grails redirect parameter named ‘fragment’ providing cool feature of forming relative link with an anchor tag/name. Generally, we can simply call [groovy]window.location.href=http://yourLink#anchorName[/groovy] It will focus you to the anchor name specified in relative link means scroll the page to the anchored tag who’s anchor name […]
Recently in a project i used tinymce where i needed to modify the image/link dialog of tinymce. To modify tinymce firstly make it inline/custom plugin means download and paste in javascript folder. To modify image dialog , create a gsp that you want to show in dialog box and paste in [java] /web-app/js/plugins/tinymce/jscripts/tiny_mce/plugins/advimage [/java] I […]
Using modules in Geb testing can help to avoid repetition of same code/ sections in Geb test pages. In this blog I want to talk about repeating data structures such as tables and how to avoid this repition by modelling them.In Geb testing if there is some content which is used in multiple pages then […]
We can use PostConstruct with Grails Services and injected Spring Beans. This PostConstruct annotation can be used to annotate a method which needs to be executed after dependency injection to perform any initialization. [code] import javax.annotation.PostConstruct class PostConstructDemoService { @PostConstruct private void init() { println "Initializing" //your initialization code goes here. e.g connect to some […]
A few days ago I faced a problem of evaluating dynamic expressions on domain objects. The scenario was that, depending upon the user input, I needed to sort a list of objects on some properties, which were nested deep in the object, e.g., [java] student.course?.college?.name // if a user chose to sort students by college […]
Let’s say you have a login page which contains a form with username and password field in it (offcourse, along with a submit button). Let’s say being much focussed towards user convenience with the user interface, you want to put the cursor in the username field of your form as soon as the page loads. […]
In our applications we generally make use of try-catch blocks to handle exceptions. Since JDK-7 , It has certain new features. These features are quite good , I must say. Some of the new changes in try/catch bloack are : 1. Multiple exceptions handling in only one catch block. 2. Finally out of scope. (Try-Catch […]