Hi, In my recent grails project, i needed to check the occurrence of a word in a string. I could have used contains() method of groovy , but the problem with contains() is that it also matches the word if the word is contained as a substring in any word. I searched a lot, but nothing worked out so i decided to use Regular expression...
The current project I am working on, is going through QA. At the same time development of the new features and bug fixing is on and we couldn't afford to loose the test data. So synchronizing the state of the QA database with the development was becoming a pain. So we decided to use grails liquibase plugin. I found one great article by...
Today while working on a project, I paired up with my colleague (Uday) and we found that we can render a gsp template in a different manner also. Grails provide us a "tmpl" namespace for rendering the GSP templates. The old way that we use to render a gsp template The other way for rendering the template. Like me,...
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...
While implementing Security in my Sample Application I have read various types of Injection attacks that an application may suffer. Reference: Grails In Action 1. SQL Injection Attack: def username="gautam" Post.findAll(" from Post as post WHERE post.user.username='${username}' ") This Query uses a local username property to...
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 or not , we used "Boolean...
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...
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...
Hi Friends, I was going through grails docs, encountered a method called load(), found it really useful thought would share with you. What load() does is, it creates a proxy object and doesn't retrieve the record from the database until property other than id is accessed. Let us consider a scenario, where we have id of a Object...
While using searchable plugin for the first time, I wasn't aware that lucene implements only lexicographic comparisons for searching on indexed values (even on numeric fields). Before I learned this, I kept on wondering why a Person of age 6 always appeared in search results when I look for People more than 20 years of age. The solution...
Hi Friends, I have released version 0.2.3 of remote-pagination plugin, which includes an option to enable user to change page sizes out of the given options. As given in the documentation, lets have a look at the example below : //Example Domain: class Book { String title String author } //Example controller: class...