Archive for March, 2007

Without insurance

Friday, March 9th, 2007

I saw this disturbing story (via the wesabe blog) about a woman who can’t buy health insurance because she had a bout with cancer. Being without dental insurance bothers me enough, ( i still kick myself for not picking up the COBRA coverage before the deadline - the thought of paying for a root canal out of pocket gives me the shivers) but the thought of no health insurance is terrifying.

I can’t believe that we, as a country can’t solve this problem and make it easier for individuals to obtain insurance. By insuring everyone, even the young and relatively healthy, the risk is spread around enough that it is overall more affordable for everyone. Surely having portable insurance would allow people to start their own businesses or just take extended time off to do something different, which would have to be a boost to the economy. It seems like the anti-health care forces would have us believe that any insurance changes would be bad for small business, but I can’t believe that is truly the case if we do it right.

Recursive deletes

Friday, March 9th, 2007

Posting this little ruby snippet so i can reference it later. Need to recursively delete directories with a certain name in a large tree? The simplest example is scrubbing those pesky .svn directories in a subversion repository, which can be done like so:

require ‘fileutils’
Dir.glob(”**/.svn/”) {|fname| FileUtils.rm_r(fname) }

another use case I have here at work is to scrub extra maven generated versions of code out of each java project (so as to keep eclipse sane). In this case, we want to delete all directories (and their contents) named “target” except for the target directory at the root (because mvn clean is “too clean” in this instance):

require ‘fileutils’
Dir.glob(”**/target/”) {|fname| FileUtils.rm_r(fname) unless /^target.*/ =~ fname}

It gets a bit more complicated if you want to exclude list of directories from the operation. Here I found Ruby’s Enumerable module detect method quite handy to short circuit evaluate all the directories to exclude regex on each directory.


require 'fileutils'
@exclude= [/^foo.*/ , /^bar.*/ , /^james.*/, /^target.*/]
Dir.glob(”**/target/”) do |fname|
@erase = @exclude.detect{ |r| r =~ fname }.nil?
if @erase
puts “erasing #{fname}”
FileUtils.rm_r(fname)
else
puts “skipping #{fname}”
end
end

Note: this code won’t copy and paste well because wordpress replaces quotes with smartquotes. I also really need to fix my stylesheet for code samples.

Rails Development - Tracks

Thursday, March 8th, 2007

I’ve resolved to learn Ruby on Rails this spring in lieu of the grad school class that I would normally be taking (rather than letting any free time slide by playing Wii Sports). I think the best way to learn is by doing, and since I don’t have any containable project ideas, I’ve been tinkering with an open source project called Tracks, which is a web based organization application in the mold of the getting things done philosophy.

Even though I’m still painfully slow as a ruby developer, I’m really amazed how easy to work with and powerful some of the frameworks in rails are compared to the (clunky and slow to work with by comparison) Java/JSP/Struts stack I’m accustomed to. One of the features I love so far is the ability to reuse page chunks (”partials”, which could roughly be compared to tag-files in JSP land) in rails javascript templates which make it really simple togenerate javascript that will update multiple sections of a web page (as opposed to one container, which is easy to do with prototype alone from the client). I figured out enough in no time at all to submit a patch to enhance the project pages. Pretty cool.

Arcade Fire

Thursday, March 8th, 2007

There was a good article about The Arcade Fire in last Sunday’s New York Times magazine. It made me sign up for a trial eMusic account to get their old and new album (though I later realized I had acquired “Funeral” some time ago). It turns out its actually quite good. I wonder what kind of sales bump a band would get from being profiled in the times these days?

I hadn’t used eMusic before - I went there to get some DRM-free mp3s before I knew there was a free trial option. I don’t know what to think of their subscription model - pay $10 a month to get 30 mp3 downloads, which works out to just 33 cents, but I don’t think I would want to commit to another subscription somewhere.

Speaking of subscriptions, some months I weigh the value of subscribing to the Times - its about $22/mo for just the Sunday issue. No wonder no one takes a paper anymore! There’s something lost in reading on the internet though - harder to lay in bed and read with a significant other and not as portable for reading on the go. I guess its worth it for now - until someone comes up with a fantastic e-Reader.

I think the publisher of the Times said in an interview recently that he wouldn’t be surprised if they stopped printing at all within 5 years. That’s a bit alarming to me from a historical point of view - one can go to the library and look at Times articles from the civil war etc - surely the format issues involved in making digital copies of a paper available to readers 150 years from now are nontrivial compared to keeping paper dry and in the dark.