Archive

Archive for the ‘Rails’ Category

Comparing arrays in Ruby

January 6th, 2010 Michael Comments off

There are a number of instances where you may find yourself with two arrays and you need to find the values that do not exist in both.  This is fairly simple:

For these two arrays:

a = ["rockets", "saucers", "underwater", "warp"]
b = ["saucers", "fuel", "moon", "warp"]

A simple way to do this is to put the two arrays together and then remove the items that exist in both:

(a | b) - (a & b)

Gives you:

["rockets", "underwater", "fuel", "moon"]

Categories: How-To, Programming, Rails, Ruby Tags:

Installing Rmagick on Ubuntu 9.04

August 17th, 2009 Michael Comments off
sudo aptitude install -y imagemagick
sudo aptitude install -y libmagick9-dev
sudo gem install rmagick
Categories: Linux, Open Source, Programming, Rails, servers Tags:

DoS Vulnerability in Ruby

June 10th, 2009 Michael Comments off

A Denial of Service vulnerability has been found and fixed in ruby. The vulnerability is due to the BigDecimal method mishandling certain large input values and can cause the interpreter to crash. This could be used by an attacker to crash any ruby program which creates BigDecimal objects based on user input, including almost every Rails application. This vulnerability has been assigned the CVE name CVE-2009-1904.

For upgrade instructions and information on affected ruby versions please see the ruby security team’s announcement.

All users are advised to upgrade their ruby installations immediately to avoid this problem. In the event that you are unable to upgrade your ruby installation, or are using an out-of-maintenance ruby version, there is a workaround available on github. You can either install it as a gem, or simply copy the file bigdecimal-segfault-fix.rb into config/initializers of your rails application.

via Riding Rails: DoS Vulnerability in Ruby.

Categories: Rails, Ruby, Security Tags:

RailsConf 09: David Heinemeier Hansson, “Rails 3 …and the real secret to high productivity”

May 7th, 2009 Michael Comments off

Categories: Rails, Ruby, video Tags:

Ruby on Rails 2.3

March 16th, 2009 Michael Comments off

From the Riding Rails blog:

Rails 2.3 is finally done and out the door. This is one of the most substantial upgrades to Rails in a very long time. A brief rundown of the top hitters:

Templates: Allows your new skeleton Rails application to be built your way with your default stack of gems, configs, and more.

Engines: Share reusable application pieces complete with routes that Just Work, models, view paths, and the works.

Rack: Rails now runs on Rack which gives you access to all the middleware goodness.

Metal: Write super fast pieces of optimized logic that routes around Action Controller.

Nested forms: Deal with complex forms so much easier.

And that’s just the tip of the iceberg. We’ve put together a complete guide for the Rails 2.3 release notes with much more information. Be sure to checkout the section on what was deprecated when you’re ready to upgrade your application.

You install 2.3 with (the final version is marked 2.3.2):

gem install rails

If you’re running on Passenger, be sure to upgrade to 2.1.2 as well. Rails 2.3 doesn’t run on older versions of Passenger!

We hope you’ll love it.

Categories: Programming, Rails Tags:

Unattended Passenger / Ruby Enterprise Installation on Ubuntu 8

December 23rd, 2008 Michael Comments off

Want to save some time when installing on Ubuntu?  We do too:

Check it out on the brightlight blog:

Unattended Passenger / Ruby Enterprise Installation on Ubuntu 8

Categories: How-To, Linux, Rails, Ruby Tags:

We’re switching to passenger

August 27th, 2008 mike Comments off

Mongrel has served us well for the past year or so, but the simplicity of deployment in passenger along with the ever reliable apache has lured us into extensive testing. We’re getting slightly better performance numbers from passenger over mongrel with about 2/3 of the memory footprint. Please let us know at support@imapenguin.com if you see any wonkyness with any of our services. As we migrate over night.

Ubuntu Ruby Vulnerabilities Officially Patched

June 27th, 2008 mike Comments off

ubuntu logo

Ubuntu pushed patches for the aforementioned Ruby vulnerabilities last night. apt-get to get them in a snap. Thanks for the quick response Ubuntu team!

Categories: Linux, Rails, Ruby, Security, servers Tags:

Nate’s How-To Update Ubuntu Servers to Close Ruby Vulnerabilities

June 26th, 2008 mike Comments

ubuntu logo

Nate Clark is right. The risk of the recently announced Ruby vulnerabilities may or may not be high, but let’s not take any chances.

He’s done a quick and good how to on upgrading Ubuntu servers. Check it out. Nate Rules.

Categories: How-To, Linux, Rails, Ruby, Security, servers Tags:

Capistrano Git Deploy Issue

May 29th, 2008 mike Comments off

There is a bug in the capistrano git bridge that’s not been patched in the stable version yet.

If you’re getting:

fatal: Could not parse object

A quick and dirty hack is to add a task that just removes your git cache for now on the deployed server with:

desc "Clear that git cache"
task :clear_git_cache do
  run "rm -Rf /#{deploy_base}/#{application}/shared/cached-copy"
end

before "deploy", "clear_git_cache"

It takes about 1 second longer to do the checkout but I don’t really notice.

Categories: Programming, Rails, Ruby, servers Tags: