Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

Author Archives: Peter Cooper

By Peter Cooper / December 7, 2006

Doodlekit-1 Doodlekit2-1

Doodlekit is a cute looking Rails-powered Web application developed by Doodlebit. It’s a complete Web design and hosting system in one, aimed at small businesses and families. Features include a WYSIWYG editor, a photo album (with all resizing and tagging), blog system (with WYSIWYG editor, again), discussion forums, and contact form. The system is entirely hosted by Doodlekit, but you can create entire, powerful Web sites through their control panel, and even host them on your own domain name. Plans range from $9 to $45 per month.

I decided to give developer Ben Kittrell a quick interview to get a bit of background on Doodlekit, its development, and his opinions on Rails:

Ruby Inside: Hi Ben. Read More

By Peter Cooper / December 6, 2006

Evan Weaver has leaped to the rescue with a hotfix (installable as a gem) for the cgi.rb DoS vulnerabilities. This hotfix is ideal for those who don’t want to install Ruby or patch again. Evan’s site has been having some DNS issues (related to the EveryDNS outages) so I hope he doesn’t mind me repeating part of his post here:

I’ve constructed a hotfix for the cgi.rb vulnerability of yesterday. First, make sure you have the Hoe gem installed. Then:

sudo gem install cgi_multipart_eof_fix –source blog.evanweaver.com

Run the included test to verify the flaw is corrected. To apply the fix, you must require the gem in every affected application, as follows:

require ‘rubygems’
require ‘cgi_multipart_eof_fix’

If you only use mongrel_rails for application hosting, you may install mongrel like so:

sudo gem install mongrel –source=http://mongrel.rubyforge.org/releases

Then mongrel will require the fix for you, provided you have installed version 2.0.0 of this gem. Read More

By Peter Cooper / December 6, 2006

Glss1

Sean O’Neil wrote to me with exciting news:

G3DRuby is a Ruby extension for the G3D library, which lets you do quick 3D prototyping using advanced OpenGL API features like vertex arrays, framebuffer objects, and OpenGL Shading Language (GLSL) shaders. Version 0.1 does not support all G3D classes, but a few of G3D’s C++ demos have been ported to Ruby and tested in both Windows and Linux (Ubuntu 6.10). The source code for G3D and G3DRuby are available under the BSD license.

Along with the 3D graphics features, G3D also provides some binary file handling (textures, MD2 files, BSP trees), collection detection, physics, and a few other things that would be useful for making some fairly decent cross-platform 3D demos/games like 비트코인 카지노 entirely in Ruby. Read More

By Peter Cooper / December 5, 2006

Walter Korman has released the first version of a Yahoo! Video library for Ruby. All it takes is a gem install yahoo-video and some simple code like this:

require ‘rubygems’
require ‘yahoo-video’

# your application id for use with the yahoo search services. you can
# get one at http://api.search.yahoo.com/webservices/register_application.
APP_ID = YOUR_APP_ID_HERE

query = ARGV[0]
print “Running a video search for ‘#{query}’…\\n”

client = YahooVideo::Client.new APP_ID
request = YahooVideo::SearchRequest.new :query => query
response = client.search request

As Walter points out, this gives Ruby the distinct honor of supporting the trifecta of video search services: Yahoo! Video, Google Video, and YouTube. Read More

By Peter Cooper / December 5, 2006

Cgivuln

The official Ruby language homepage is reporting that another DoS vulnerability has been found in Ruby’s CGI library (cgi.rb). The solution is to upgrade to the newly released Ruby 1.8.5-p2 (warning: direct link to .tar.gz file). Specifically:

A specific HTTP request for any web application using cgi.rb causes CPU consumption on the machine on which the web application is running. Many such requests result in a denial of service.

(source: ozmm) Read More

By Peter Cooper / December 5, 2006

I just came across this excellent article that provides links supporting many of the benefits of Ruby on Rails. If you need to justify your use of Ruby on Rails to employers, co-workers, or even yourself, check it out. Links about performance, scalability, philosophy and evangelism are all included. Read More

By Peter Cooper / December 5, 2006

Jamis-Find

Jamis Buck has put together a cool series of articles about ActiveRecord’s find method as used in Rails. He goes into a lot of detail about how find and its related methods work in terms of the internals of ActiveRecord. Jamis’ explanations are not only useful for Rails developers, but for anyone interested in patterns and how to structure code in Ruby. The Rails team don’t always do everything the ‘best’ way, but it’s usually tight, well developed code you can learn a lot from.

In the first installment, Jamis just presents a basic introduction to his series.

In the second installment, he leaps right in to the details of find and its child methods, find_from_ids, find_every and find_initial. Read More

By Peter Cooper / December 3, 2006

Scott Fleckenstein has developed a plugin for Ruby on Rails called Exceptional that ‘brings exception handling into the world of Rails filters’. The code speaks for itself on this one:

class SampleController < ApplicationController
handles AccessDeniedError,
:with => :access_denied,
:only =[:supah_sekret_akshun]

def supah_sekret_akshun

raise AccessDeniedError

end

private
def access_denied
render :text =’no, u kant’
end
end

There’s a bit more to it than that, so check out the official plugin site for examples and how to download the plugin. Read More

By Peter Cooper / December 3, 2006

A couple of days ago, Tim Lucas wrote a cool article called “instance_eval brings sexy back” where he demonstrated how to use instance_eval to improve the usability of the match method. The downside, however, was that Tim’s technique required manually defining accessor methods each time match was used.

Myles Byrne rapidly responded with a cuter solution:

class MatchData
def matchnames(*names)
names.each_with_index do |name, index|
self.instance_eval “def #{name}; self[#{index+1}] end”
end
self
end
end

time_components = /(\\d+):(\\d+):(\\d+)/.match(“17:00:34″).matchnames(:hours, :mins, :secs)
time_components.hours

I quickly realized, however, that I never use match in this way. I prefer to use String#match instead (Regexp#match doesn’t click to me, it seems back to front). Read More

By Peter Cooper / December 1, 2006

Radventday1

The Ruby Advent Calendar 2006 is all engines go! There’s an RSS feed available if you want to keep track of it, and a few days are still available if you want to write a day yourself. Read More

By Peter Cooper / November 30, 2006

There’s more about Amazon S3 and Marcel Molina’s hot new library coming as the first day of the Ruby Advent Calendar (this Friday!), so I don’t want to say too much about it yet. For anyone already enjoying this library, however, I put together a scrappy program that lets me copy files up to S3 from the command line easily:

#!/usr/bin/env ruby

require ‘rubygems’
require ‘aws/s3′

local_file = ARGV[0]
bucket = ARGV[1]
mime_type = ARGV[2] || "application/octet-stream"

AWS::S3::Base.establish_connection!(
:access_key_id => ‘REPLACE_ME’,
:secret_access_key => ‘REPLACE_ME’
)

base_name = File.basename(local_file)

puts "Uploading #{local_file} as ‘#{base_name}’ to ‘#{bucket}’"

AWS::S3::S3Object.store(
base_name,
File.open(local_file),
bucket,
:content_type => mime_type
)

puts "Uploaded!"

Just name it s3cp (or similar), chmod it, and then you can do stuff like:

s3cp ~/somefile.whatever bucket Read More

By Peter Cooper / November 28, 2006

I keep getting e-mails about job sites, Ruby jobs, and so forth, so I decided it’s time for a bumper “here are all the Ruby and Rails job sites” post! Enjoy..

2009 update: I’ve had to remove a few as they no longer exist any more – so there are not 6 here ;-)

First off: The Ruby Inside Job Board. There are lots of great jobs there – entirely up to date (as of August 2008) – vacancies from companies like TechCrunch, Scribd, and others. However, all the jobs on our job board are based in the United States only. Read More

By Peter Cooper / November 28, 2006

Jedit

Jim Morris declares that jEdit could be “Textmate for the rest of us“. jEdit will be familiar to many developers as a language agnostic IDE created with Java (though significantly less bulky than Eclipse!), but even I was surprised to hear this:

Yes JEdit actually has intellisense-like completion for Ruby. A previous blog entry of mine explained how I tried Komodo to get this, but it was not very good, however the JEdit version found in the latest RubyPlugin, works pretty well, I think it uses parsing from the JRuby project, so no surprise it works.

Morris continues to explain how he has developed macros for jEdit to replicate numerous TextMate features, such as expanding # to #{} when typing within a string and points to other macros to get a TextMate-like experience for free. Read More

By Peter Cooper / November 23, 2006

Railslogo

It’s only the first release candidate, but the Rails 1.2 gravytrain is now pulling into the station. The biggest new features include the full suite of REST goodies, a freshly-written Routing system, and significantly improved Unicode support.

An aside: I am wondering whether news such as this, which was already posted to the popular official Rails blog, should even be posted to Ruby Inside. I assume all Ruby Inside readers, if interested in Rails, would already be reading some of the important Rails blogs out there.. or are there people who only read Ruby Inside for their Ruby / Rails news? Read More

By Peter Cooper / November 22, 2006

Eughnice

It seems a few people share the opinion that RJS can prove to be a little abstraction too far sometimes, and would rather just code in JavaScript with the occasional bit of RJS embedded in. Now they have their wish. Dan Webb has created “RJS Minus R”, a Rails plugin that takes the R out of RJS. Even David Heinemeier Hansson gives it a careful thumbs up.

(Found via Dr. Nic Williams) Read More