Archive for September, 2007

Weekly Links

Wednesday, September 19th, 2007

Here are some misc. links I found interesting/thought provoking this week.
Excellent article by Steve McConnell on How to Self-Study for a Computer Programming Job. I’m still mulling through Code Complete (Go buy it).

Donald Boudreaux one of the writers for Cafe Hayek, a favorite Libertarian political blog of mine, sums up nicely how I feel and many pro-freetrade/humanitarians feel on immigration. (It has nothing to do with the Republican party).
Funny stuff…
Laughable.

Even funnier, I’ll be running in the Great Columbia crossing this October, my goal is to just finish.


Vim Tip #1 - Deleting Multiple Lines

Wednesday, September 19th, 2007

I know I have been very bad lately at posting on this site. I’m really not trying to neglect my dear old blog, but nothing inspiring as of yet has led me write anything useful. Well in the last couple of weeks I have discovered some interesting Vim tips, which I hope someone out there may find useful.

:g/^\(.*\)\(\r\?\n\1\)\+$/d

That’s it. A simple “:help :g” will reveal that this is an ex command in Vim, which performs a global match operation. How this command could become useful is when incorporated with the above regex.  Simply, what we’re doing is searching the entire buffer (default is 1,$) and looking for matches. The regex also has the special /d modifier which directs Vim that with any match found to delete that line. The regex broken down is basically looking for any character anchored to the beginning of the line, followed by an optional carriage return (\r - ), followed by a new line (\n), followed by another line that matches the first grouping (first line) and if exists 1 or more times (this is what the + sign is for). Whooo. Ok, have fun and until next time.

Cheers!