Hi everyone, Ever wished for a 'groovier' way to iterate through two distinct dates? Well, Groovy 2.2 gives you two methods via the 'DateGroovyMethods' class to do exactly that: upto() and downto(). Here is the code showing the usage: [java] Date startDate = new Date() - 7 Date endDate = new Date() startDate.upto(endDate) { it...
The day one at GGX 2013 London was really awesome. The atmosphere, the sessions and the speakers really made the day wonderful. We could feel the buzz and energy of the thriving and closely knitted Groovy/Grails community all day long. The show was very well managed by Skills Matter and nicely driven by Peter Ledbrook. Here are some...
The other day I was reading the Grails docs and I came across a useful GSP tag: grep. I have been using Grails for over 3 years now but just recently got to see this new tag which has eased my life a bit in situations where the list of objects have to be filtered and iterated at the same time to perform some operations on them. The GSP...
In one of the shell scripts I was reading I saw a usage of mutt text-based command line email client. Mutt can be used to send out the emails from the production machines or any other servers where you do not have access to the browsers or UI based email clients. Sometimes it is essential to send out a particular log file to certain...
Hi Folks, Recently I came across a cool way to compare differences between two branches, two tags, or between two commits on Github. Many a times in our project we have to thoroughly see what has been a specific change in the code base before we push it on our production branch. Here is how you can view the differences in commits: On...
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 of the packages as well as the folder structure...
In one of our recent project, we made quite a good use of Grails Jasper plugin (v-0.9.7) to generate reports in the form of PDFs and Excel sheets. The reports contain sub-reports, which in many cases, contain sub-reports again. The way to pass parameters to sub-reports at the deeper level is to use the following tag in the .jrxml file:...
Hi All, Here is how you can implement a new transaction in an already executing transaction in Grails which uses nothing but Spring framework's Transaction mechanism as an underlying implementation. Spring provides @Transactional annotations to provide declarative transactions. We can use the same in our Grails project to achieve the...
Hi All, Here are the few basic steps that you need to follow in order to achieve the in-memory session replication between two or more Tomcat 6 instances. This blog refers the Apache Tomcat documentation as found here: http://tomcat.apache.org/tomcat-6.0-doc/cluster-howto.html. The Tomcat documentation provides more detailed...
In one of our recent projects, we needed to save the HTTP session in the database. This blog refers the Apache documentation as found here: http://tomcat.apache.org/tomcat-6.0-doc/config/manager.html These are the following steps that need to be followed: Step 1: Create a database named tomcat (as shown in our example in Step 3...
There are situations where you might want to know the Locale of the user as set in the session in your GSP so that you can show text in a particular language/manner. Here the Spring framework's SessionLocaleResolver can come to the rescue. In one of our recent Grails projects, we did the following in one of our GSPs to display the content...
In one of the recent projects, we had to set up a system where emails for different purposes (i.e registration, error reporting etc.) were to be sent out from different email accounts. We were using the Grails Mail plugin which does not provide a clear way to set-up or configure multiple email addresses. With the help of my colleague,...