Friday, December 31, 2010

vim tip: searching for word under cursor

I was motivated to use vim a few years ago, after watching Corey Haines do his number to LCD kata at the Simple Design and Testing Conference (SDTConf). Although I learned the basics while I was in college, I never really tried to progress beyond that until recently.

Now I try to make a habit of whenever I am doing something that just seems like it's the hard way, I'll google it and learn how to do it better.

Today, I was thinking: there has to be a better way to search for things rather than typing "/thing_to_search_for". So I found out how to search for the word under the cursor, which is # for searching backwards, and * for searching forwards.

Hope this helps, and motivates you to keep learning something new everyday.

Thursday, December 23, 2010

Installing ruby 1.9.2 with rvm

I've been having trouble installing ruby 1.9.2 with rvm on Mac OS X.
Although there are lots of great blog posts with solutions, for some reason, none of them worked for me.

The rvm page and many posts say to pass --with-iconv-dir to rvm install.
However, I kept getting errors about Tcl/Tk not being 64-bit, and iconv also not being 64-bit.
Why would it be complaining about iconv, especially since I used rvm to install it?

I noticed the config.log spit this out:

configure: WARNING: unrecognized options: --with-iconv-dir

I tried many options that were in configure, but none of them pointed the makefile to rvm's version of iconv.

So I took a look at /usr/local/lib/libiconv.2.dylib and noticed it was a symlink.
Perhaps this is taking the easy way out, but I backed it up by renaming it, and relinking that to the version inside $rvm_path.
After that, I recompiled by running:

 rvm install 1.9.2 -C --enable-shared

The output:

Hopefully, this helps some of you out there with similar problems.

Sunday, December 05, 2010

Installing Nokogiri with bundler

I recently decided to start contributing to open source, so I chose to look at one of my favorite Ruby gems, rspec.
The instructions to get you started are fairly straightforward; however, in the rspec-core repository, bundler was failing to install nokogiri.  Although the instructions here worked for some, it didn't work for me.  So based on the instructions on the Nokogiri homepage, I used macports to install libxml2 and libxlst, re-ran rake, and finally, bundler was able to install nokogiri, with no problems.

Friday, October 15, 2010

"Failure of State" by Uncle Bob - SCNA 2010

This is the first of many blog posts to come, with my notes on the talks given at SCNA 2010.

This morning, on the first day, Uncle Bob gave a talk titled "Failure of State." My notes on the talk are below.

SICP - Uncle Bob has mentioned this book many times, and I finally put it on my Kindle today. As a craftsman, you should definitely read this book. It's free but if you can, buy it to support the authors. There are also free lectures available as well.

The substitution model - you can replace function calls repeatedly, ending up with a "silly" version but one that is also stateless and thread-safe. The example given was a program that printed the squares of the first twenty (20) integers.

Many stateful programs exhibit temporal coupling; that is one statement (function/method/etc) must be called before another. In other words, time matters. For example, opening a file, then closing it.

However; in functional programming, y=f(x) no matter when you call it and every time you call it.

Programming has seen three failures so far: 1) the GOTO statement; 2) pointers to functions, and 3) state. Finally, Uncle Bob showed the CQRS pattern, where CRUD is separated into CUD and R.

Tuesday, September 28, 2010

JavaScript documentation

I am doing my part to help others find good JavaScript documentation and tutorials.

Googling "JavaScript tutorial" or "JavaScript documentation" doesn't provide any good links.

The Promote JS campaign aims to change this, so that we all can find better JavaScript documentation, such as the docs here.

Please spread the word! Go to for more information, and place a link and banner on your blog or homepage.
JavaScript JS Documentation: JS Function length, JavaScript Function length, JS Function .length, JavaScript Function .length