GrailsTechnology

Closure Delegate using Groovy “with” Method and decorating code with multiple assignments

Groovy is an expressive language, that is what we are going to talk about making the usage of “with” method for specifying closure delegate and making our code more succinct (brief and clearly expressed). In my recent project, I was writing a code to resolve tenant and setting some properties to object tenant. resolver.tenant.subdomain = “india” resolver.tenant.username […]

GrailsJava/JVMTechnology

Image Scaling With imgscalr – Java Image Scaling Library

imgscalr is a simple and efficient image scaling library implemented purely in java and provides a handful of operations for image manipulation. This library can be useful in creating thumbnail or preview images of various sizes from larger uploaded images or performing basic image manipulation operation, incuding scaling, cropping, rotation etc. imagescalr is a set […]

GrailsTechnology

Groovy collectEntries to get a Map from a Collection

Dealing with collections is a part of a Developer’s daily life. However, sometimes it becomes quite cumbersome when we have to iterate through each collection every time we want a manipulated Collection. Ever thought of a groovier way to manipulate a collection and get a Map in a single line? Well, multiple iterations to convert […]

GrailsJava/JVM

HTML to PDF using PhantomJs and Grails

Converting an html or web page into a pdf is never easy and you might face similar problem in your project as well. There is  a solution that works out of the box for this problem and all you need is installing PhantomJs on your system and calling it from your Grails or Java code. Just follow below steps one […]

GrailsTechnology

Migrating stored procedures with Grails Database Migration Plugin

Stored procedures are often preferred over writing long inline queries for getting reports from database. But they tend to change constantly depending on the business logic. The database migration plugin handles the changes in domain structure effectively but too bad the default management of changes in stored procedures is not as effective. We can manage […]

GrailsTechnology

Externalize and reload grails Log4j configuration

In Grails 2.x and in some earlier versions, the log4j configuration resides in grails-app/conf/Config.groovy. We can modify log4j closure here to add new categories and tweak the log levels. In development environemnt any changes to log4j closure are loaded automatically without bouncing the application, but not when the application is running from a war. Our […]

AWSGrails

Cloud Infrastructure Monitoring Using Datadog

Infrastructure monitoring in the cloud is the topmost priority for any application running in the cloud. This includes monitoring the web servers, databases, applications & various tools being used. Datadog not only provides monitoring but also has alerts integrated so that you get notified for certain type of issues which occur. For example a lot […]

AWSGrailsTechnology

AWS S3 file upload with progress bar using javascript sdk

You can upload files on AWS S3 using a server side solution, but in case of larger files it is advisable to use a client side solution. You can probably use JavaScript file upload feature of AWS S3. This is simple three step feature as described below: Step 1 : In the head section of your page include javascript sdk […]

GrailsTesting

Writing test cases for Domain class Using Spock

The agenda of this blog is to demonstrate how to write basic validation test cases for domain class in grails application. Create a domain class User with some basic constraints. [java] package com.ttn.testing class User { String emailId String name static constraints = { emailId nullable: false, blank: false name nullable: true, blank: false, minSize: […]

Sanchit
Sanchit
Read
Services