New-formula-starburst

How-To Update Ubuntu Servers to Close Ruby Vulnerabilities

1

It was announced the other day that some arbitrary code execution vulnerabilities were discovered in almost all production versions of Ruby out in the wild. I’m not sure how vulnerable your typical Ruby on Rails application servers would be, but I’m taking no chances. I run this blog, and all my other production sites on Ubuntu. Updating to the latest patched version of ruby was easy:

$ sudo apt-get install build-essential libssl-dev libreadline5-dev zlib1g-dev
$ wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p22.tar.gz
$ tar zxvf ruby-1.8.7-p22.tar.gz
$ cd ruby-1.8.7-p22
$ ./configure --prefix=/usr/local --with-openssl-dir=/usr --with-readline-dir=/usr --with-zlib-dir=/usr
$ make
$ sudo make install

And you’re done. The only sorta tricky part there is the ./configure command, which requires those options to tell the compiler to enable Readline and OpenSSL support which are most often needed in a Ruby on Rails environment. To check and make sure it’s working, type these commands and verify that the output looks like this:

$ which ruby
/usr/local/bin/ruby
$ ruby --version
ruby 1.8.7 (2008-06-20 patchlevel 22) [i686-linux]
$ ruby -ropenssl -rzlib -rreadline -e "puts :success"
success

Now, run your tests, restart mongrels, and you’re safe. Phew.

The Ultimate Iced Tea: Juicetea

0

I have always been a lover of iced tea … not that sugary, syrupy stuff that beverage companies sell in bottles or cans … the kind you brew yourself. Over the past couple of hot summers, I have perfected the ultimate iced tea recipe. I call it Juicetea.

  • 8 tea bags of Good Earth Green Tea with Lemongrass
  • Your favorite 100% (no sugar added) cranberry juice blend. Pure cranberry juice will give the tea a nice tangyness, or choose a blend of berry juices for different flavors. I like R.W. Knudsen brand cranberry raspberry blend lately, but I switch it up from time to time.
  • Water

Fill a teakettle with purified or filtered water, and bring to a full boil. Remove the kettle from the heat, and then submerge all 8 tea bags in the hot water. Close the lid, and let it steep for 30 minutes to an hour.

Then, fill a 2 quart pitcher about two-thirds full of ice cubes. Pour the still warm tea over the ice and most of the ice cubes will melt. Keep the pitcher in the fridge for at least 20 minutes before serving.

When serving, fill a glass halfway with ice, followed by the iced tea … but leave at least 2 inches at the top of the glass and top it off with juice.

For hot summer nights, try adding some premium vodka and use a little bit more juice for a refreshing Juicetea Cocktail.

Trouble with Ruby 1.8.7 and Rails

2
I went to download a fresh copy of Ruby the other day, and noticed that they quietly released 1.8.7 and are promoting it as the recommended install now. I haven’t heard much about its compatibility with Rails, but I was curious about the performance enhancements backported from 1.9. So, I downloaded it … and …. bam!
\ FAILSAFE /!\  Thu Jun 12 21:50:31 -0700 2008
  Status: 500 Internal Server Error
  wrong number of arguments (2 for 1)
    /usr/local/lib/ruby/1.8/cgi/session.rb:267:in `respond_to?'
    /usr/local/lib/ruby/1.8/cgi/session.rb:267:in `initialize_without_cgi_reader'
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/cgi_ext/session.rb:39:in `initialize'
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/cgi_process.rb:130:in `new'
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/cgi_process.rb:130:in `session'
........
A little Googling, and I discover that there is a subsequent patchlevel that addresses this problem. I downloaded 1.8.7-p17 and it seems to get past this one. To compile and install on my Mac:
tar zxvf ruby-1.8.7-p17.tar.gz
cd ruby-1.8.7-p17
./configure --enable-shared --enable-pthread CFLAGS=-D_XOPEN_SOURCE=1
make
sudo make install

So far that seems to work!

Globalize plugin for Rails 2.1

2

Tonight at the Pivotal office I showed a few people the updates and modifications I’ve made to the globalize plugin for Rails.

My main motivation was fixing Globalize to work with Rails 2.1. They changed the way rails views are selected and rendered, and the date_helper api, both which broke the plugin. I forked globalize on github and my fork now works with Rails 2.1.

UPDATED June 14: Thanks to tips from jodosha and David Ramalho, I’ve made a few updates to the branch that fix a few things.

Get the plugin for Rails 2.1.0
script/plugin install git://github.com/heythisisnate/globalize.git
Globalize offers a variety of ways to translate and internationalize your Rails application. I’m using it primarily on my biodiesel stations locator application to translate arbitrary strings:
>> "Biodiesel Stations".t
=> "Biodiesel Stations"

>> Locale.set 'zh-tw'
>> "Biodiesel Stations".t
=> "生質柴油"

In addition to string translations, Globalize does a lot more, including date & time localization, currency, and number formatting differences. It handles pluralization supremely. The original team did a great job, and I’m happy to contribute my changes for Rails 2.1.

I’ve hacked on a few additional features that I previewed tonight … they’re not quite ready for prime time yet. I’ll definitely publish them here when they are.

Blog Revived, and a New Leaf

1

After a very long break, I’ve decided to revive this blog. Today, June 10, is a turning point for me. This morning, I resigned from my senior Rails developer position at a startup in Palo Alto, and I’m wasting no time getting ready for the next career adventure.

Being employed and extremely busy didn’t work well with frequent blogging. Unfortunately, I have done a poor job of writing interesting stuff here. But, now that I’m a free agent, I’ll have more time and motivation to keep the blog going.

As you might guess, I’m now looking for a new Ruby on Rails gig. I live in San Francisco now, and will stay in this area. If you’re looking for a leader and developer with 2+ years experience, I’m your guy. I favor small teams that use Agile or XP principles.

Anyway, as I write this, I’m upgrading my server and updating my resume (simultaneously). Look forward to more frequent articles on more in-depth technical topics.

When it's yellow ...

2

You may or may not know that Atlanta is in a severe drought right now, and the Governor recently asked Atlantans to cut back their water consumption by 10%. Reminds me of a mantra of an old friend:

When it’s yellow … let it mellow
When it’s brown … flush it down

Yeah, that’s a little gross, but seriously we could do better to conserve water. Especially when taking a leak … it seems like such a waste to use all that water to flush away something that’s already liquid. I read this week that one county’s schools are going to those waterless urinals. A great step in the right direction. Let’s also get these in airports, malls, everywhere.

Also, I recently came back from Paris, where all the toilets have two flush buttons … one that deploys a smaller flush for #1. What a great, simple and effective idea. Why don’t we have these in our homes?

It looks like they’ve caught on in some airports:

Photo by jessamyn on Flickr

Older posts: 1 2 3 4