Hitesh Bhatia

I am tech-enthusiast who likes to get his hands dirty with the latest technologies.

Technology

GIT –pretty

git log is one of most useful commands to see information about commit , author , date and subject(comment)  while using GIT.This displays information in blocks and hardly 5 - 7 can be listed on normal screen size. But git provides --pretty option , so that we can format the output of git log; Here are some ways to do that ...

18-Feb-2011

Technology

Git – Grep

Still in my early days of using Git. Recently just to make sure that I have merged two branches  and have pushed changes to QA server successfully,I often used command "find | xargs grep" .But to deal with this kind of situations Git provides "grep" command. Just as name suggests this commands searches for regex pattern passed to it. ...

22-Jan-2011

Grails

Mysql Dump multipurpose script.

Taking MYSQL dump is usual requirement in my project . And Since some of the tables in project are huge so often I have to take dumps of selected tables and often have to ignore some tables. since we had to do it frequently in our project so I created a script  which does following for me. Takes database dump Takes dump of...

12-Jan-2011

Grails

“In” Keyword -Groovy

keyword "in" is used in Groovy to check whether element exists in Collection. Example List [groovy] String str = "this is me " List list = str.tokenize(" ") String word = "this" assert word in list == true assert "hello" in list == false [/groovy] Example with Set [groovy] Set set...

29-Nov-2010

Technology

Startup Script Using XdoTool

(Xdotool is a tool that simulates user key movements.) Usually when we start to work , we usually require some apps to be running. In my case I have to run a grails app, sql , subversion and IDE in different tabs of same terminal. Normally it would take almost 1-2 minutes if I do it manually.So I created a shell script using...

13-Nov-2010

Grails

Grails Pdf Viewer Plugin

In one of our recent Grails project we had to provide support for Viewing Pdf even if end user's browser did not have any pdf viewer plugin or add on installed. So we decided that we would open our pdf on Google Doc's pdf viewer. This will behave in same manner as Gmail does , when it has a pdf as attachment to mail , It provides two...

14-Oct-2010

Grails

Handling Password Protected Pdf with PdfReader

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...

19-Aug-2010

Technology

Compiled List of Some handy firefox shortcuts

Auto complete .com Address Ctrl+Enter Auto complete .net Address Shift+Enter Auto complete .org Address Ctrl+Shift+Enter Back Alt+Left Bookmark All Tabs Ctrl+Shift+D Bookmark This Page Ctrl+D Bookmarks Ctrl+B Copy Ctrl+C Cut Ctrl+X Clear Recent History Ctrl+Shift+Del ...

23-Jul-2010

Grails

Open Pdf in Google Docs using Time Based Cache in Grails

Recently, we had a requirement where secure URLs were to be made accessible to Google. Our implementation was to send a url with token valid for 10 seconds. The token expired automatically after 10 seconds. We used time based cache for this as described here: T set max time to 10 seconds , I set default MaxAge to 10 millis in above...

23-Jun-2010

Technology

Jasper report – Pattern for Negative Numbers

Recently had a requirement to print Currency values with a condition that negative numbers must be inside brackets. It can be done by using pattern property in tag. the part before semicolon is for positive numbers and part following semicolon is for negative number. ____________________ Hitesh ...

03-May-2010