10/31/2010

Split a string in Java

If you have a string as follows:

Lorem Ipsum   Foo Bar

and you want to split it by whitespaces, you can't do

myString.split(" ");

because the output would be ("Lorem", "Ipsum", " ", "Foo", "Bar")

Obviously the desired output would be: ("Lorem", "Ipsum", "Foo", "Bar")

To do that in java use: myString.split("\\s+");

9/16/2010

top - you should use u

I was looking at tops output to observe apache, and was thinking to myself how useful it would be to just go ahead and filter by user, and well...turns out that I should have thought of this years ago (RTFM?): while viewing top, just press u, now enter desired user, hit enter and be amazed ;-)

9/12/2010

Using tabs in vim

Starting with vim 7 you can use tabs, which is especially handy if you're a developer. The tabs are displayed in the first line (requires to have more than one tab open), highlighting the active tab. A + marks the tab as having unsaved changes.

Some useful commands:

I wish I would have known these a few years back, I guess I should have RTFM ;-)

9/11/2010

Drupal 6 and jQuery Update

After a long time of debugging the annoying error that popped up in my firefox error console:

Error: Unrecognized Syntax (...

I finally managed to trace it down! Turns out that jQuery 1.2.6 still allowed the selector syntax [@, which starting from jQuery 1.3 was removed. After figuring that out I grepped through all modules and was able to blame lightbox2! Yes, lightbox2! For some reason the current official version has not fixed those, but after downloading the dev version the dreaded error was gone.

3/07/2010

2/23/2010

Know thy vim!

Real short post! If you use vim, check this out:

9/15/2009

Using VIM color schemes with putty

My eyes are always grateful if I can spare them terrible color schemes. The other day I stumbled on what seemed to be a really nice color scheme called wombat, so I decided to allot five minutes of my time to quickly change the color scheme...or so I thought ;-)

Turns out that when using putty, not all colors are available, and most good looking vim color schemes will not work. After googling, I found that someone has converted the theme for 88 and 256 color xterms. So I downloaded that one too. Surely, now it would work, right?

Well, almost, after some more googling, I finally found the solution. In your vimrc file, simply add the following line

and presto, now you can use the wombat256 theme ;-)