In one of our grails project , we had to attach cover to Pdf file . But since some of pdf’s uploaded were password protected. To handle this scenario we added bouncyCastle.jar , so our version of iText was able to handle password protected pdf . And Then to check whether pdf is password protected […]
A while back I was trying to debug an error in our application logic. For that I had to analyze the results of a query This analysis was getting pretty tough to do on the command line. So, I tried to find a way to transfer the results of a query to a text file […]
Sometimes we want to know which line of codes or methods in the JavaScript is taking time which slows up the page load. Many times our browser gets hanged due to the execution of JavaScript. Firebug allows us to profile the JavaScript. Following are the two methods that are used for profiling JavaScript: console.profile() console.profileEnd() […]
In one of our projects, we need to compare images which comes from various sources and remove the duplicate one. The below algo helps us to remove the duplicate images. boolean compareImage(String firstPhotoUrl, String secondPhotoUrl) { boolean result = true; BufferedImage bi1 = ImageIO.read(new URL(firstPhotoUrl)) BufferedImage bi2 = ImageIO.read(new URL(secondPhotoUrl)) int size1 = bi1.getData().getDataBuffer().size; int […]
The CSS transform property allows developers to rotate, scale, and skew blocks of HTML via CSS. Although you can do the same thing with images in Photoshop or The GIMP, using CSS transforms allows developers to do the same thing with any HTML markup and allows users to select the text within the transformed object. […]
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 […]
Recently as part of POC, I need to apply the Google web optimizer on various parts of the page to determine which content user clicked to best and will be most effective in getting conversions. For this you need to keep track of the various conversions, but how? That’s where Google web optimizer come handy, providing […]
In one of my projects, I was working on rest calls, and one of the requirement was such that I had to pass the XML to service and then parse it and bind the relevant details to an instance of a domain object. In essence I had to call bindData in service after creating a […]
Hi, In one of my projects i needed to create a select-input tag with OPTGROUP options. I searched a lot about it and found that g:select tag do not support OPTGROUP So to solve this problem, i created a simple optgroup tag using Html and grails taglib. I created a Map for the values to […]
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 […]
In one of my recent grails project, I had a requirement to get unique objects from a list based on more than one field. Now, this can be done by passing the list to closure unique. I had a list of dates of a couple of years, and what I needed was a unique combination […]
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 […]