Archive for June, 2009

Stay hungry, Stay foolish

Stay hungry = never get complacent with anything in life
Stay foolish = never be afraid of taking new steps even if people around you thinks it is foolish.

Comments (1)

Begining Scala

What is this hype about scala? I am trying to figure out. Weirdness of human brain;what else can I say! Man! it would be definitely difficult to change the OO mindset to quickly think up solutions in scala. So, here is the first piece of apple – how to read what is written in scala?

def main(args:Array[String]) : Unit => {
}

“main” is a function that returns a “Unit” (void for all practical purposes). It takes arguments denoted by name “args” of type Array; the elements in Array “args” is of type “String”

Leave a Comment

Command line parsing in Java

https://args4j.dev.java.net/

is a neat annotations based library

Leave a Comment

vim search replace with back reference – I

Suppose you have a list of numbers

2,5,10,13 that you want to add double quotes to. That is, you want the result to look like: “2″,”5″,”10″,”13″

Ok, you might open notepad, type double quote around each number and get to the result. Well what if you have about 100 numbers to deal with? Then you ought to use some powerful editor like gvim

Using gvim(or vim or vi) the way to replace is ( in command mode)

%s/[0-9]*/"\0"/g

That is – globally substitue any number pattern with a quoted version of it. The “slash and zero” is called back reference, which denotes the match that was found using preceding regular expression. Happy vimming.

Leave a Comment

Using subversion while behind an http proxy

This is very straight forward. Locate the “servers” file under your home directory.

In Unix(Linux/Mac/Solaris) it is ~/.servers

and in windows it is under application data\Subversion – in a windows XP machine it will be at:

C:\Documents and Settings\<USER ID>\Application Data\Subversion\servers

This is a self explanatory file with ample documentation on it. Provide values for

http-proxy-host =
http-proxy-port =
http-proxy-username =
http-proxy-password =

And you are ready to roll!

Comments off

hta = html application (windows only)

Ok, so this one works only on windows. Edit a file with some HTML content, throw in some vb script if you can, and save the file with an extension of “.hta”

Now double click on the file, and lo, an application window pops up with your content on it and triggers vb script code. The application window is basically an internet explorer window without its bells and whistles.

Interesting, but mostly, useless :)

Comments (1)

vim command to change case of a character

This works in command mode as well as visual mode. Instead of typing <ESC>r and then the character in desired case, just type tilda – “~”

Leave a Comment