Wednesday, April 14, 2010

What if ???

I found this very interesting cartton by Dave Walker.  :D

cartoon from
Cartoon by Dave Walker. Find more cartoons you can freely re-use on your blog at We Blog Cartoons.

How to ignore version control meta files when grepping????

So you came across the same problem ha!!!.
When you are working with a sufficiently large project it is very essential to search through your code repository. Integrated development environments such as intellijIDEA (my favorite ;-) ) provides searching as a integrated functionality.
But if you are in to C/C++ developing on UNIIX platform your favorite editor going to be vim right? So every now & then you have to search through the repository in order to find the code snippet that you are after. 'grep' is the obvious answer. If your code repository under source control you have to make sure that you avoid those files when you are searching. To search a specific text using 'grep', you have to tell it to search recursively,ignore certain file types, etc.

Now ack-grep is the solution for this sort of situation. It is heavily customized for day to day code searching operations. By default,

  •  it searches recursively from the top level directory.
  •  identifies & ignore almost all the version control meta files.
  •  highlight the search word within the results.
  •  give the number & occurring file of the pattern.
  •  It identifies the file types (weather it is a Java source file or C++ source file) 

So you only have to do:
$>ack-grep 'pattern you want to search'

Here is a simple usage of the tool in one of my source repositories;

In order to install it in Ubuntu, just do a sudo apt-get install ack-grep. This is a very nice tool & i like it......  :) 

Wednesday, April 7, 2010

so you want to learn Maven ???

Maven is the current trend among Java community. No surprises, as maven is a full project life-cycle management tool. The beauty of maven is, it standardizes all the project related activities. Where the sources should go, where the test resources should reside, etc. 
Once you learn how to use it, you will be able to work with any Java project that uses maven. The core part of maven only deals with parsing & manipulating XML s. The core of the maven is a platform which provides services to the plugins. The plugins takes care of the specific tasks. As an example the compiler plugin knows that it has to compile the sources under src/main/Java.
I myself did not pay much attention to maven at the beginning. I used to find a way around by referring to some one else's pom.xml . But then I understood that i cant get away with this tool.
So I  learnt it. Here are some valuable resources to learn maven. 

The site has a wealth of resources for learning maven. It is easy to get lost in the site though. The quick start guides are really good.The place is the premier place to learn about different maven plugins.
  • The Maven by Example : book  

There is a book by Oreilly called Maven definitive guide. May be this book is bit outdated as well. The guys at Sonatype has divided this book in to two parts. The "Maven by Example" is a great place to learn maven(my personnel recommendation :)  ) It covers the basic design of maven platform & it is more example oriented. so you better start with that .....

  • The maven complete Reference: book

If you are planning to go deep in to the maven world, this is the book. 

happy coding!!!!