In my project, we needed a support for multiple paginations on the same page. For the same, we maintained the state of offset of different pagination tags and let tag use its specific offset rather than the general i.e from param.offset. Assuming, we need two paginations on the same page. Lets assume the scenario where […]
At Intelligrape we face many challenges while developing web-applications. One of the small challenge was to test the web pages that contains file input field <input type=”File”>(to upload files). After few hours drilling with Canoo webtest plugin I decided to use the new fabulous plugin, Grails functional Testing by Marc Palmer (http://www.grails.org/Grails+Functional+Testing). The syntax for […]
I have recently started using the marvelous plugin Grails function Testing by Marc Palmer (http://www.grails.org/Grails+Functional+Testing).I would like to share few things with you about this plugin. The purpose of testing get defeated if we keep on doing for the same values. The method below let you to do it for the different values each time. […]
In this use case we are using the jamesDump.sql stored at /home/gaurav/Desktop/jamesDump.sql file to create a new database named intelligrape. First of all we need to login to the mysql prompt. gaurav@gaurav:~$ mysql -u root -p Enter Password: ****** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is […]
In this post i will try to explain how to dump a mysql database so that it can be migrated with same state.In my project i face this situation every week and thanks to dumpfiles that they save lot of time and make the process whole lot easier. What is a dumpfile ? A dumpfile […]
Lets discuss how can we upload a file and store it in a database, along with that how do we render it on the gsp page. I am taking an example to upload and render the image in this blog, though the code would be same for any other file. So Lets consider I have a […]
I want to quickly share how you can sort a Map by its key/value/field of valueObject; in either ascending or descending order using Groovy I created a Map<String, Person> as follows: class Person { String name Date dateOfBirth static constraints = { } } Map people = [:] [*(11..20), *(1..10)].each { Person person = new […]
Often I found it painful working on dates when I had to find a past/future date based on weeks, months or years. Groovy class org.codehaus.groovy.runtime.TimeCategory has very helpful & intutive syntax for working on dates. I am sure I need not to explain what each of the following statements will do: Date date = new […]
public Map groupBy(Closure closure) Going through Groovy Collection, I found this powerful method which takes a Closure as parameter & based on the closure, it returns a map in which all unique values returned by closure act as keys. Lets take an example: If you want to group integers between 1 to 100 based on […]
While going through the grails-users mailing list, I found a question about restricting all URLs to end with ‘.html’ & returning Error 404 for the default mappings. After spending some time, I was able to build a sample CRUD application restricting URLs to end with .html. I did the following steps for the same: 1. […]