Mauricio Fernandez’s ever-mindblowing Eigenclass presents a great article about how to easily implement a plugin system for any Ruby application. Ruby’s reflection and OO features make it a cinch. Read More
Paul Cantrell has created a cool guide, with demonstrations, of the powers, quirks, and surprises of closures, blocks, and procs in Ruby. He writes:
A closure is a block of code which meets three criteria:
* It can be passed around as a value and
* executed on demand by anyone who has that value, at which time
* it can refer to variables from the context in which it was created (i.e. it is closed with respect to variable access).
Closures are a mainstay of functional languages, but are present in many other languages as well (e.g. Java’s anonymous inner classes). Read More
The contracts have finally all been signed and I’m (Peter Cooper) already several chapters into writing a new Ruby book, Beginning Ruby, for APress. The information will probably go live on their site sometime in the next few weeks, but you’ve heard it here first.
The book is anticipating the continuing rise of Ruby, to the point where hundreds of thousands of developers begin learning it separate from Rails, or where it becomes a popular language for totally new programmers. I don’t think we’re quite there yet, but it’s going to happen. At that point, Beginning Ruby will provide a ‘from the beginning’ guide to Ruby, object orientation, development practices, the Ruby community, and so on. Read More
Promoting companies is not going to become a regular thing on Ruby Inside, but Guruza struck me as quite interesting. It’s a Google Answers style site but in a Web 2.0 vein. Interestingly, though, there are quite a few people asking and answering Ruby questions on there (whereas I’ve found other questions sites to be thin on programming stuff). Check out the latest Ruby questions. People asking questions specify an amount in dollars of how much they’d pay for an answer, and if you satisfactorily answer the question, the money is yours.
If the smell of money makes your head spin, then there’s always Rails Weenie, a pretty amazing, free, Rails questions and answers system managed by Rails god Rick Olson. Read More
Sending mail from Rails applications using sendmail or a normal SMTP daemon is easy, but GMail has posed some problems. Luckily, someone has worked it out and presents code on how to get ActionMailer sending through a GMail account. Read More
I initially thought there was only one PayPal library for Ruby, but apparently not. Here’s all those I’ve found:
Paypal by Tobias Luetke – Primarily developed to help integrate PayPal with Rails applications. It works with PayPal’s IPNs (Instant Payment Notifications). Source code demonstrations included.
VPayPal – A new library (released February 2006) that supports both Express Checkout API and the direct checkout API.
RoR::PayPal – A library developed by ELC Technologies and made available under the LGPL. It doesn’t seem to support the Express Checkout API but presents another option and has a detailed README.
Testing PayPal Web Services with Ruby soap4r – This isn’t a library but Pranav Bihari looks at the internals of talking between Ruby and PayPal. Read More
The official API documentation for Rails is focused on the last official release, but what about all of us using Edge Rails? The Caboose has a set of documentation for edge Rails, with even ‘hidden’ ‘nodoc’-ed methods included. This is perfect if you’re digging around for bugs or looking for old, deprecated methods. It’s updated three times a day from the latest Edge Rails code. Read More
I don’t know much about Oracle, but many people have asked about Ruby’s support for Oracle. One of my clients is also attempting a project with Rails and Oracle. Here are some useful resources I’ve found:
Starting with Ruby and Oracle : A pretty comprehensive and up to date tutorial about using Oracle with Ruby. The tutorial is written from a Windows perspective.
Ruby/OCI8 (Oracle Call Interface) : A library that provides an interface between Ruby and Oracle 8.
Ruby Oracle 7 library : An alternative for Oracle 7 users.
Ruby and Oracle : A basic tutorial to setting up Ruby and Ruby’s Oracle bindings on a Hewlett Packard UNIX based machine. Read More
Cobra vs Mongoose is a Ruby library by Paul Battley that makes it easy to convert between XML and Ruby hashes (in both directions). It’s a good alternative to YAML or JSON. It’s available as a gem with gem install -r cobravsmongoose. Here’s some demonstration code:
require ‘rubygems’
require_gem ‘cobravsmongoose’
require ‘cobravsmongoose’
xml = %q{
<people>
<person>Fred</person>
<person>Chris</person>
<person age="10">Bert</person>
</people>
}
puts CobraVsMongoose.xml_to_hash(xml).inspect
# => {"people"=>{"person"=>[{"$"=>"Fred"}, {"$"=>"Chris"}, {"@age"=>"10", "$"=>"Bert"}]}}
You can combine this with the JSON library to convert from XML to hash to JSON, meaning you can convert between all three formats. Read More
Chris Williams looks at David Heinemeier Hansson’s keynote speech at last weekend’s RailsConf in Chicago and examines what David has to say about Rails 1.2 (scroll down half a page when you get there).
Other than toys like clever find conditions in Rails without SQL and specifying response types in the URL, you’ll be able to look forward to some extreme REST goodies where Rails can route certain HTTP verbs directly to controller actions (e.g. a DELETE HTTP request would route to ‘destroy’, POST would route to ‘create’, etc) and the ability to pull data from other applications natively with ActiveResource (I’ve hacked my own dirty version of this into apps I’ve developed, and this will be a life saver). Read More
Streamlined is a framework that sits about Ruby on Rails and makes developing Rails applications even quicker than possible with scaffolding alone. It includes a ton of useful stuff like pre-built layouts, a REST layer around all the models, support for Atom, and its own DSL. As developer Justin Gehtland explains:
Streamlined is an open source framework for quickly creating data-centric applications with Ruby on Rails. We’ve been using Rails and Ruby to build applications for our customers for going on two years now. Over time, we’ve realized that, like in just about every development platform before, we spent a lot of our time building and rebuilding the same stuff. Read More
Slingshot is just one of many hosting companies getting on the Rails bandwagon. Unlike many, though, Slingshot was launched specifically with Rails in mind, as the tagline says: “When we couldn’t find a reliable Rails host, we created our own.” If you use the service and have any comments or a review, do post in comments here. Read More
I know.. PHP. Don’t stone me just yet! Eric Rollins presents some interesting work relating to generating PHP code with Ruby.
It’s very much opposite to the whole way Rails works. You supply the system with XML files describing your schema and database setup, and the Ruby scripts pump out PHP files to produce a ‘scaffolded’ type application that can work with the data. The results are very similar to basic Rails scaffolding, but in PHP. The source code for the code generator is available for free download. Read More
The language we all know as Ruby began life in 1993 and was first released to the public in 1995. But before Yukihiro Matsumoto began work on Ruby, there was already another language called Ruby in existence. There’s even an interpreter and compiler for it. How about an example?
Yikes! Read More
Railsbench, by Stefan Kaes, is a collection of scripts that makes benchmarking a Rails application quick and easy. Rather than benchmark over HTTP, Railsbench tests the ‘raw’ speed of your application directly, and won’t include latencies involved with the network or between your HTTP daemon and Rails. If you love statistics, you’ll love Railsbench. Here’s some demonstration output:
perf data file: /d/perfdata/09-15.all.native_routing.txt
requests=1000, options=-p3 -bm=all -mysql_session -fast_routes
loading environment 0.40159
page request total stddev% r/s ms/r
/empty/index 1.20234 0.4098 831.7 1.20
/welcome/index 1.33902 0.1074 746.8 1.34
/rezept/index 1.43960 0.7505 694.6 1.44
/rezept/myknzlpzl 1.42853 0.2709 700.0 1.43
/rezept/show/713 3.85798 0.0605 259.2 3.86
/rezept/cat/Hauptspeise 4.43199 0.0389 225.6 4.43
/rezept/cat/Hauptspeise?page=5 4.55130 0.2091 219.7 4.55
/rezept/letter/G 4.49349 0.0627 222.5 4.49
It’s open source, as usual, so if you want to contribute and make it kick even more butt, please do! Read More