Apple Halwa

Ingredients:

  • 3 big apples
  • 1/2 cup brown sugar/normal sugar
  • 1 cup milk
  • 2tbsp ghee/ clarified butter
  • 1 tsp cinnamon powder
  • For garnish:
    • Few thinly cut slices of apple
    • Few mint springs

Method:

  1. Coarsely grate the apples. (P.S. be careful with your finger, almost grated mine :p)
  2. In a large bottom pan, add ghee and heat it on a medium flame then add the grated apples.
  3. Saute it for a minute then add the sugar, let the sugar mix with apples and dry out the moisture.
    (TIP: You need to let the sugar melt completely and then add milk. Otherwise the acids from the apple may split the milk and you may get clumps everywhere.)
  4. Add the milk and stir well. Let the mixture dry completely. You may add dry fruits for that extra crunch.
    (TIP: If you feel the mixture is way too watery, just add 1tbsp of semolina/rava)
  5. Add the cinnamon and cook for 1min. Serve hot!!!

GIT: Get Tag Details of Current Checkout

About two weeks ago I migrated a project from CVS to git. After migration when we tried to build the project it kept failing.

On debugging, I figured that in build.xml (it’s a legacy project with a complex ANT build script) they were trying to figure out from which tag it has been checked out by reading the Tag file in the .CVS folder.

Since this file wasn’t going to be there in the cloned git repo, I started looking ways to achieve this in git. I finally found a git command which gives the tag details of the current checkout, and it’s:

git describe

This command gives the details about the most recent tag reachable from it. You can read more about it at https://git-scm.com/docs/git-describe

To use it in ANT all one has to do is create a an executable git target and pass describe as its argument. Below is how we are getting the details:

<target name="tag-details" >
	<!-- Get the closest tag string using git describe if possible -->
	<echo message="Getting git tag details"/>
	<exec executable="git" outputproperty="project.tag.details" failifexecutionfails="false">
		<arg value="describe"/>
	</exec>
</target>

Hibernate: Dynamic Insert

While doing code-review I came across hibernate’s dynamic-insert property and found it really useful. dynamic-insert is a boolean attribute of class element as defined in hibernate-mapping-3.0.dtd. This is an optional attribute of the class element and if not defined explicitly defaults to false.

As the name says, setting this property to true makes insert query generated by hibernate dynamic i.e. it will include only non-null values of DTO in the prepared statement.

Let’s explore this with the help of an example, for which I’m using PostgreSQL 9 and Hibernate 5.1.0.
Continue reading “Hibernate: Dynamic Insert”