Vivek Krishna

Open Source Enthusiast, Agile Practitioner, Grails Lover, jQuery Worshiper.

Grails

ISO-8859 Based URL Encoding in Grails

The web application we are developing at the moment interacts with quite a few third party services via REST calls. Most of the third party services use UTF-8 encoding and there was no issues with using the URLCodec, that grails provides out of the box. However, one of the applications our application interacts with, was using ISO-8859-1...

11-Apr-2011

Technology

Using Google Analytics for tracking Multiple Steps of a Webflow

In one of our projects, we are using a webflow for an order wizard. We needed to track the number of users converting a draft to a confirmed order using Google Analytics. This would have been simple if the URLs were different for each step. However, that is not the way webflows work and a similar URL is generated for multiple steps. After...

28-Feb-2011

Grails

Grails Mail Plugin with DB Driven configuration

We have been coming across a certain use case in a couple of projects that the Email credentials/settings used for sending email should be different based on the from address. This is because the applications act as software services that are used by different organizations, which operate in the same business. And each needed their own...

03-Feb-2011

Grails

Request Mocking to use groovyPagesTemplateEngine in backend threads

We have a setup where a backend thread, fired by the Spring Events, does some processing, generates a PDF and emails the result to the user. The code we were using to generate the HTML from a GSP to be converted to a PDF using iText was as follows : [java] def webRequest = RequestContextHolder.getRequestAttributes() ...

27-Dec-2010

Technology

Using iText PdfStamper to insert Images in PDFs while preserving Acroforms

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 PdfStamper class was the best way to go...

29-Nov-2010

Grails

Datamatrix for unique identification of Documents on Server Side with libdmtx

I had earlier written a post on how to use QR Code to take care of identification of printed documents and updating the DB based on the QR Code detection. However, we had to abandon the use of QR Codes in the document because the library wasn't performing reliable, even with QR Codes from image files, which were direct screenshots of the...

22-Oct-2010

Grails

GORM Batch Deletes Made Easy with Load Method

We are using the grails asynchronous mail plugin in our project and noticed that the sent mails never gets deleted from the database. This was an issue because we were sending out a lot of mails and all of them had PDF attachments of about 500 KB to 1 MB each. A sure recipe for disaster because our DB was growing exponentially. To take...

29-Sep-2010

Technology

Creating a New Git Branch on the Local Machine and Pushing it to a Remote

Our project went into production a few weeks back and was on Grails 1.3.1. Since the code was stable, we decided that it was time to upgrade to grails 1.3.4. However, we didn't want to push it straight to the QA Server or Production server because that would've meant that the maintenance of the existing production code would become a...

09-Sep-2010

Technology

Git Stash : A very useful command

We have been using GitHub for version control in one of our projects and I am absolutely loving it! There are quite many advantages over a concurrent version control system like subversion. One of the commands I found useful was the stash command. It is of use when we are working on a piece of functionality, which is not in a state to...

31-Aug-2010

Grails

QR Code on PDF Documents for Identification and Detection on Server Side

In one of our projects, we needed to include QR Code on the PDF documents, which were to be sent out to the user and the printed version was to be received back from them. Once the documents were received, we were going to scan each sheet into an image file and then, these files were going to be read by the grails application, identify...

12-Aug-2010

Grails

Sharing Session Information between WordPress and Grails using Cookies and base64 encoding

A scenario arose in one of our projects that we had to share some information between the grails application (which was taking care of dynamic content) and wordpress (which was used to maintain the static pages about the application). The information was the logged in user's name so that we could display that on the header. After giving...

03-Aug-2010

Technology

Creating Paged Media with Different Paged Modes Using CSS3

In one of our projects, we had to create PDF documents from HTML. The iText renderer was an excellent solution to do that. However, the tricky part was that the cover page had to be of portrait orientation and the rest of the document, of landscape orientation. After doing a fair share of searching on the web, I came across the...

30-Jul-2010