Git Feature : Squash

Hi welcome. This blog is one of the git cool feature “Squash”. Note : Because this is an advance feature of git, I am expecting that you have basic knowledge of git like push, commit, checkout, branching etc. When we shall hear Squash first time, we would get three...

Assign List Entries To Multiple Variables

One of the Groovy’s sexy feature is that we can assign list entries to multiple variables. One of the scenario I faced that my method returns a list and I have to assign that list entries to different variables As: def myMethod(){ ['Abdullah', 'Mohd'] } def...

Configure tomcat to support SSL / https

Hello Everyone, following are the simple steps to configure tomcat to support SSL / https locally. 1. Generate Keystore First, uses “keytool” command to create a self-signed certificate. During the keystore creation process, you need to assign a password and fill in...

Getting Started with LESS

I am back with a new post titled “Getting Started with LESS”. We have often used CSS for designing layout of our web pages but there is a new buzzword in the web designing industry which is LESS. Less is a dynamic stylesheet language which offers various...

PERFORMING HIBERNATE LOCKING

Hibernate provides two strategies of locking for performing secure read/write operations. Hibernate achieves this by database locking mechanism and abstains locking object in memory. So, basically hibernate locking depends on database for there operations. The two...

Date manipulation using SQL query

I have written some useful query. When you need some customization in date format and find some prior date using SQL then below query might be useful for you. Find prior/future date from the current/given date: SELECT now()::date + 2 AS date1, current_date -1 AS date2...

Custom sorting in sql

Order by with a particular value on TOP or Custom sorting in order by clause. ORDER clause can be used to sort the results returned by SELECT statement in SQL Server. It orders the result set by specified column list. When used with character data type columns it...

Command Object And Its Benefits

Today, I am going to explain how to use command object in grails application to validate the client information without using domain class. You will see the benefits of using command object in this blog. The command object’s purpose is to bind the data from web-form...

AC Power Measurement

Introduction A whole house energy monitor measures the energy used by appliances connected to the house mains. To understand how it does this work, it is useful to know something about how appliances interact with the electrical system. Not all appliances interact...

Grails app static resource on https

In my recent project I have setup ssl and deployed it on server. All the applications page were being served over https but some static contents were being served from http and it showed that the application is not secure. After lot of searching I found the solution....

Loops In Groovy

There are several types of loops in groovy. Following are some of the ways: List list = [4, 2, 9, 6, 7, 8, 2] for loop: for (int i = 0; i < list.size(); i++) { print list.get(i) } output = 4296782 for (int i : list) { print i } output = 4296782 for (int i in list)...

SSL on Nginx

Last week i was installing SSL certificate on an Nginx server which was acting as front-end for tomcat and the basic set up was that our Grails WAR file was deployed in tomcat which was running on port 8080 and Nginx server was running on port 80. We ordered SSL...

Sort List In Groovy

If we have a simple list like List list = [4, 2, 9, 6, 7, 8, 2] We can easily sort this list using assert list.sort() == [2, 2, 4, 6, 7, 8, 9] or by using closure like assert list.sort { it } == [2, 2, 4, 6, 7, 8, 9] Both gives us a list sorted in ascending order....

Dealing with LazyInitializationException

Hi Guys! I am back with a new Post titled “Dealing with LazyInitializationException”. In Hibernate “lazy initialization” is one of the key feature of Hibernate which allows it to lazily initialize associated properties of an object. For...

Accessing indirect properties using Criteria

Hi Guys! I am back with a new post titled “Accessing indirect properties using Criteria”. In Hibernate Criteria when we try to reference an indirect property of an object(A property that is part of another mapped object) then we get the following...