Practical Ruby Projects

My Ruby book Practical Ruby Projects: Ideas for the Eclectic Programmer is in stores!


(Practical Ruby Projects)

I've been writing for the past year, and I'm crazy about the result. This is the sort of book that I love to read, and hopefully that shines through.

Practical Ruby Projects is based on a few ideas:

  • "Hands on" is always better.
  • You can cover more if you trust your reader to know the basics.
  • Programming can be creative and exciting.
  • Getting started is hard. Anything that makes that easy is good.

This book covers a lot of projects (all done in Ruby, of course!):

  • Animation
  • Music
  • Simulation
  • Turn Based Startegy Games
  • RubyCocoa
  • Genetic Algorithms
  • Implementing Lisp
  • Parsing

PS- All the source code is available under the MIT license!

posted on: 01/04/2008 | path: /tech

National Album Recording Month 2007

Holy Album Recording Month, Batman!

This blog post is oh-so late, but my server crashed taking down both this blog and the National Album Recording Month webite. What a mess!


(Let me sing you a little song, it's about National Album Recording Month...)

But we're back up, and National Album Recording Month is ready to go. Last year's participants are re-signing up and we're looking for new blood. Here are the rules:

  • Record 31 minutes in the 31 days in May.
  • Pick a title and make some cover art.
  • Anything goes. Original songs, covers, spoke word, comedy, or essay. Just make an album!

It's time to put aside our fears, ranging from "I don't know anything about music" to "I don't have the time to do it right." Wouldn't you rather have recorded an album by May 31st than made excuses?


(Putting aside your fear means willingness to look like a total idiot.)

The greatest thing about NARMo you can actually do it! You could finish in just 36 minutes (a straight 31 minute recording session and 5 minutes to draw a cover on a cocktail napkin). Of course, the best albums will take a little longer. ;-) But seriously, over 20 people finished last year and we recorded hundreds of minutes all together.

Hope to see you on the NARMO sign up page! Spread the word.

posted on: 04/26/2007 | path: /life

I am the Walrus: Brew, Brew, G'brew

After years of talking about it, I made my first batch of beer last night (with a ton of help from Anna).


(Unpacking my kit.)

The process was a little more intense than I anticipated, but I don't think we messed up to badly. It reminded me of high school chemistry, where you spent half the time just trying to remember which step you were on and re-scanning the directions for what you were supposed to do next.


(You wouldn't believe how good this smells.)

Oh yeah, and I need to collect enough bottles to hold 5 gallons of beer in the next week or so, so if you've got any empty 12 ounces left over, let me know!

posted on: 04/15/2007 | path: /life

H1-B Visas: Going, Going, Gone.

After one day, the H1-B Visa cap has already been reached.

What is an H1-B?

It's a special kind of visa that lets foreign workers with specific knowledge and eduction work in the United States. This year, in one single day, over 150,000 applicants applied for just 65,000 visas. Compare that to last year when the applications took a little under two months to cap out.

And what's crazy is we're turning away these smart, educated individuals that want to come contribute to the American economy and telling them to go work for competitors in other countries.


(A tag two blocks from my apartment.)

Admittedly, there are serious moral questions surrounding the brain drain of developing nations. But that's not why the H1-B visa limit wasn't increased last year. Instead, there's a growing perception that these workers are "stealing" American jobs, and that's resulted in a backlash of public opinion.

Which just doesn't jive with my economic intuition. It reminds me of the antiquated view that wealth is constant (every gain must have a corresponding loss), instead of created. These people aren't job stealers, they're job creators.


(The rest of it.)

Or at least, that's what it looks like to me. Luckily, it's possible to study this sort of thing (although, potentially difficult to experiment with), so hopefully we'll have some answers someday soon.

Unfortunately, in the meantime, there are also some real problems with the current H1-B program. Particularly disconcerting is the way workers are bound to their company in an asymetrical power relationship. The law specifies that "H-1B aliens may only work for the petitioning U.S. employer and only in the H-1B activities described in the petition."

This gives companies extra leverage, since the worker's residency depends on his or her company. Interestingly, the law prevents companies from paying H1-B workers less than the prevaling wage, thus protecting American workers from being undercut (although there have been some cases where this provision was violated).

But despite that, an H1-B removes a worker's power to "vote with their feet" (well, unless they want to leave the country). It's a right we sometimes take for granted, but the ability to leave a bad job not only protects us as individuals, but forces companies across the economy to have higher work place standards.

Anyways, if these individuals actually help grow our economy, the way I suspect they do, it makes more sense to me to just grant them citizenship. Then we not only free them from the one company lock, but we also make them a permanent part of the American economy. A smarter, stronger economy.

Which does finally bring us to the moral questions about brain drain. I'm not sure what's right here. On one hand, it's easy to see how bringing these workers to America prevents them from developing the economies of their own countries. But if they want to come to America and we want to hire them... well, it's a hard call.

Anyways, the issue is closer to home this year since I know two applicants who may not get their visas. Luckily, one of them has completed his PhD which opens up an additional 20,000 slots for workers with advanced degrees.

Fingers crossed.

posted on: 04/04/2007 | path: /life

Startup School in Sunny CA

Some background. My friend Adam was selected as one of this year's Y-Combinator Winter Founders. For the past few months he and his partner Josh have been building a startup company named "Tsumobi."

Thanks to Adam, I flew out this past weekend to attend Y-Combinator's Startup School. All in all, it was a totally unique experience.


(The auditorium was packed.)

The speakers were really good. Almost everyone had some useful insight. My favorites were Mitch Kapor (founder of Lotus, and no slouch since then either) and Greg McAdoo Partner (of Sequoia Capita). And as I understand, Paul Graham's presentation was something of a novelty because he used slides.

The audience was a very cool collection of geeks. Unfortunately, there were a few individuals that would mob each speaker as he or she tried to leave the stage. It wasn't clear to me if they were looking for investors or new best friends, but some of the speakers got a little wild eyed trying to escape.


(Thankfully RoboCop was there to escort the speakers off the premise.)

That said, I meet some really sharp other attendees, including several folks I'd previously only met electronically. I even ran into my friend Davy who was down from Washington for the weekend.


(Trendy Nightclub or Geek Social?)

I managed to pick up a sore throat on the plane and by Saturday night I was so exhausted that I feel asleep on the couch in the middle of a networking event. Not my finest moment. But it was definitely worth it.


(Heck of a view looking down from the hills toward the city.)

Mountain View itself was kind of awful, but the warm breezes of California were amazing. You know, I'm not sure if I'll end up with my own startup company at some point, but today it actually feels doable.

I'd say that's the real takeaway from Startup School.

posted on: 03/29/2007 | path: /tech

Things I Want

I found this old list of Things I Wanted from back when I first moved to Oregon.

  • Ninja Sword
  • Digital Camera
  • LCD Monitor
  • Accoustic Guitar
  • MIDI Keyboard
  • Red Leather Sneakers
  • Audio Recording Device
  • Yellow Waffle Shower Curtain
  • Window Curtains

Don't you love how Ninja Sword is at the top? I ended up getting a surprising number of them.

  • Ninja Sword
  • Digital Camera
  • LCD Monitor
  • Accoustic Guitar
  • MIDI Keyboard
  • Red Leather Sneakers
  • Audio Recording Device
  • Yellow Waffle Shower Curtain
  • Window Curtains

My list is much shorter these days.

  • Banjo
  • MIDI Foot Pedals
  • Shirts

Identity through consumption!

posted on: 03/09/2007 | path: /life

Home Improvement

The tiolet is fixed. Let's start with that. Despite a multi-day repair process, a dethawing of the pipes, and, finally, replacement parts the problem was never really that bad. The tiolet just kept running sometimes. And now it doesn't.

More interesting, is the fact that we've lost power in the middle of the night twice this week. The first time happened while I was reading Stephen King's 'Salem's Lot in bed just as the vampires cut the power in the book. I survived the night, only for us to lose power again in the middle of the next one. Anyways, the more frustrating thing about power outages is reseting my alarm clocks (probably time to put the battery backup in). Luckily with two of us, Sarah and I have managed to make it out of the house mostly on time.

Well, at least until this morning that is.

"Sarah, I'm stuck in my room."
"Stuck?"
"Yeah, the door knob won't turn."
"Are you sure it's not locked?"
"Yeah, I'm sure..."

This door's been tricky ever since I moved in, but usually a few wiggles get the thing open. Not anymore. Finally with both Sarah and I turning it from both sides, it let me out. Hallelujah!

Sarah was late to class.

posted on: 02/09/2007 | path: /life

Building Rubinius

Have I mentioned how cool I think Rubinius is? It's totally awesome. Here's how I got it building on my Mac:

# Make sure ~/bin is in your path before doing this
cd ~/bin
wget http://www.opensource.apple.com/darwinsource/Current/ruby-22.2.2/ruby/mdoc2man.rb
chmod a+x mdoc2man.rb

# You'll need DarwinPorts/MacPorts installed

sudo port install subversion

sudo port install readline
sudo port install ruby

sudo port install pkgconfig
sudo port install glib2

# Now use Ruby Gems

# Had to download package manually for some reason
sudo gem install rake
sudo gem install RubyInline
sudo gem install rspec
sudo gem install ruby2ruby (needed by RSpec)

# Check out Rubinius
svn co http://code.fallingsnow.net/svn/rubinius/trunk

cd trunk

cd externals/syd-parser
rake package
cd pkg
sudo gem install sydparse-1.2.2.gem
cd ../../..

rake build:all

I'm pretty sure that's what I did anyways. =)

posted on: 02/06/2007 | path: /tech