Friday, December 25, 2009

Nissan Altima Air Bag light

I have an old 95 Model Nissan Altima and after I got the battery and alternator replaced a few months back my Air Bag light used to keep blinking

Doing the below steps fixed it!

Saturday, December 5, 2009

whereis in windows

The *nix whereis command is very useful at times and helps you find where a given executable is located in the path.Here is a one written in python which can be easily used on windows

Copy the below code into a file called whereis.bat.Add the path where whereis.bat is kept to your windowds PATH variable



Copy the below code in whereis.py and keep it somewhere on your local file system

Thursday, December 3, 2009

Lame Java Trivia

       Snippet 1:

        start = runtime.freeMemory();
        int i=1,j=2,k=3;
        end =  runtime.freeMemory();
        System.out.println("That took " + (start-end) + " bytes.");


        Snippet 2:

        start = runtime.freeMemory();
        int array[] ={1,2,3};
        end =  runtime.freeMemory();
        System.out.println("That took " + (start-end) + " bytes.");


Assuming GC doesn't run inbetween the start and end variable assignments, Snippet 1 will also say 0 bytes used whereas snippet 2 will always have a non zero positive value - though both seem to have the same three numbers being created 1,2 and 3 - why?

ack

Finally a command line tool for windows which will recursively search for  some text from a given directory and to boot you can actually remember the syntax for  recursive searching.I never ever could remember the combination of find and grep that is needed to search recursively with grep.

Ladies and Gentlemen, Please welcome ack .

Here is the syntax for searching all the sub directories from the parent directory containing Java source files for something

ack --java pattern  //doh that was simple!


All I had to do to install was


Install Perl from here  http://strawberryperl.com/

Then type the below from my windows command prompt
C:\>cpan App::Ack