Tuesday, April 29, 2008

Vim and Windows

This is just a note for those who are searching the web...

So, today I was on someone else's machine, and noticed he used "File -> Open" from gVim... and I never do that!  I just right-click and say "open with vim".

"Well," he explained, "when the file I'm opening is on the network, I don't get my _vimrc loaded".

This has never happened to me on my machine, so we looked into it.  Turns out that gVim loads _vimrc from your %HOME% environment variable, but it does so from whatever drive your file is in.  My %HOME% was specific about C:\, and his--actually just a reference to %HOMEPATH%--had no drive designation.  When we added it, all was well.

The error message we were getting only came up when you quit gVim, and was something along the lines of "can't write _vimrc" or some-such.

Web Developers, PLEASE USE DATES

If I could teach the world of web development one thing, it would be have a date on every relevant page.

Whether you like to admit it or not, someday your page is going to go stale, and the visitor needs some indication of this.  I can't tell you how many times a month I'm at a site, find some interesting information, and later find out that it's totally useless because the page it came from is three years old.

Date everything.

...If you could teach webdevs one thing, what would it be?

Thursday, April 17, 2008

Seeing Red (or Not)

It's always interesting to have one's beliefs paddled over the head by science.

Today I learned that our blood is not blue, even when deoxygenated [via, via].  Who'd'a thunk?!?

In short, it turns out that our venous blood is actually deep maroon... ie, not much different from arterial blood.  When vessels are close to the surface of our skin, we see the red.  ...Which is why pale folk like me look vaguely pink.  But as the vessels get deeper (to about .5 mm), some measure of absorbing and reflecting of light takes place, and you end up with a purple color.  Thus, when compared to the pink of your skin, our eyes interpret that purple as blue.

Whacky!  ...And humbling.  There are still too many urban myths that I believe, even if I have become increasingly skeptical over the years.

Monday, April 14, 2008

Design Ideas from Nature

Tonight I watched a series of videos on TED. One in particular got me thinking about how code should have more responsibility on a smaller level (the idea of the sticky foot doing everything it needs to on its own), and how failover might work (the idea of the leg acting as "foot" as needed).

Janine Benyus is not the most engaging public speaker, but it might be worth watching her speech as well, since there are some really huge ideas in there that could be applied to software. Lots of ideas of self-assembly... could data "flow" over code that captured the bits that belong there? Is this kind of what mapreduce is doing?

And this one is still one of my favorites... but that's more eye-candy than biomimicry:

Getting Ruby to Run on Tiger (as if you haven't heard that before)

Today I had the [ahem] pleasure of getting ruby to run in Tiger.

I had been using Locomotive... but that appears to be terribly out-of-date (May 2007).

I had hopes that sakuzaku's script would do the trick... but it failed in several places. Afterwards, nothing worked.  Honestly, I wasn't paying very close attention to it as it ran, and didn't crack it open to see what was going on... but that was my starting point.

I think the basic problem was that I had two other installations of ruby: one in /sw/bin/ruby, and the second in /usr/bin/ruby.  ...So, after the script failed, I went and nuked those two executables and made them symlinks to /usr/local/bin/ruby.

But my gems were still miffed (I was trying to write a very, very simple script to go grab some XML from a web-app, and I was parsing it with hpricot).  That turned out to be an easy fix:
export PATH=$GEM_HOME/bin:$PATH
export RUBYOPT=rubygems
export RUBYLIB=$GEM_HOME/lib/ruby/site_ruby/1.8/
(clearly, this is in bash) ...And that did the trick.

Yes, yes, I know: I need to upgrade to Leopard.  But I'm running on a G5, and I've heard the performance hit is considerable... so I'm dragging my feet.