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

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"/>

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”

Windows 8 New Shortcut Keys

Windows 8

Windows 8Windows 8 Consumer Preview is out and with it comes a host of new keyboard shortcuts to help navigate across the new Metro UI. Here’s a short list of the shortcut keys introduced with Windows 8.

Shortcut keys Description
Windows key Brings up the Metro start screen. You can start typing to search for an app, just like the Windows 7 start menu.
Win + D Brings up the old Windows desktop.
Win + C Brings up the Charms menu, where you can search, share, and change settings.
Win + I Opens the settings panel, where you can change settings for the current app, change volume, wireless networks, shut down, or adjust the brightness.
Win + Z Opens the App Bar for the current Metro application.
Win + H Opens the Metro Share panel.
Win + Q Brings up the Metro App Search screen.
Win + W Brings up the Metro Settings search screen.
Win + F Brings up the Metro File search screen.
Win + K Opens the Devices panel (for connecting to a projector or some other device)
Win + , (comma) Aero Peek at the desktop.
Win + . (period) Snaps the current Metro application to one side of the screen. (Right side)
Win + Shift + . (period) Snaps the current Metro application to the other side of the screen. (Left side)
Win + J Switches focus between snapped Metro applications.
Win + Page Up (or) Down Moves the current app to the other monitor.
Win + Tab Opens the Metro application switcher menu, switches between applications.
Win + O Lock device orientation..

PC World has a complete list of keyboard shortcuts available in Windows 8, along with the ones carried forward from Windows 7.