When saving images in general, and JPEG in particular, a colorspace is used. The two most commonly used colorspaces are RGB and CMYK.
RGB is used for screens (e.g. television, monitors, phones). Screens work by combining different light colors (red, green or blue) into one color we can actually see.
CMYK is used in print [...]
Handle CMYK colorspace uploads with Paperclip
June 17th, 2010Dynamic Queue Assignment for Resque Jobs
March 16th, 2010Resque is a Redis-backed library for creating background jobs, placing those jobs on multiple queues, and processing them later. Sounds great!
Let’s dive in directly:
class Archive
@queue = :file_serve
def self.perform(repo_id, branch = ‘master’)
repo = Repository.find(repo_id)
repo.create_archive(branch)
end
end
Resque.enqueue(Archive, @repo.id)
This example was taken from the Resque README. [...]
Setup a self-signed SSL site with Apache2
March 8th, 2010Some things need to be secure. Login and registration pages are often among them. This guide will show you how to quickly set-up a SSL site with a self-signed certificate and automatic HTTP-to-HTTPS redirect. This is ideal for setting up staging environments.
I’ll assume you have a standard Debian system with the apache2 package installed and [...]
Running cucumber features with sunspot_rails
February 3rd, 2010We wanted to integrate the sunspot_rails gem into our cucumber features. I found a ticket where mat adviced to call Sunspot::Rails::Server.start / stop in one of the available cucumber hooks.
Code found in features/support/env.rb is run when Cucumber begins and exits so this seemed the right place to start Solr:
Sunspot::Rails::Server.new.start
at_exit do
Sunspot::Rails::Server.new.stop
end
Also, make sure you’ve [...]
Using transactions with Ruby DataMapper
January 21st, 2010With DataMapper, it can be quite a challenge to perform tasks that seem so simple at first. DataMapper is an object-relational mapper (ORM) written in Ruby, with a lot of great features and innovative approaches to common ORM-tasks. But it lacks documentation for some of the less-used features and even the more popular search engines [...]
Presentation: Heroku & Jeweler + Gemcutter
December 11th, 2009A small presentation by Ariejan on two topics:
Heroku – What is Heroku and how does it compare to Amazon EC2 and Kabisa’s Hosting
Jeweler + Gemcutter – How to use Jeweler to manage your gem and push it to gemcutter
Xen: How to fix “SIOCSIFADDR: No such device”
December 11th, 2009Yesterday I had to clone a VPS to run some CPU and memory intensive tests. With our current setup (Xen + LVM), cloning an image on the fly is easy.
After configuring a new IP address for the clone, I booted up the system. Nice, but I ran into a problem:
Configuring network interfaces…SIOCSIFADDR: No such [...]
How to setup Ruby on Rails, Apache and Passenger on Debian Linux
December 8th, 2009For this article I’m going to install a single (virtual) server to run a standard Ruby on Rails application. I will be using Apache2 and passenger for the webserver stack and MySQL as a database server.
Let’s start by installing Ruby and all tools:
# apt-get install build-essential
# apt-get install ruby irb ri rdoc libopenssl-ruby ruby1.8-dev
# [...]
Ruby and SSL Certificate Validation
December 4th, 2009If your ruby app is doing SSL, you have probably seen one of the following errors:
doc = Hpricot(open(“https://www.cert.org/blogs/vuls/rss.xml”)) # => /usr/lib/ruby/1.8/net/http.rb:590:in `connect’: certificate verify failed (OpenSSL::SSL::SSLError)
or
warning: peer certificate won’t be verified in this SSL session
The solution is to make sure ruby has access to the right set of root certificates.

