Ruby Inside

Syndicate content
Updated: 48 sec ago

daemon_controller: Automatic Daemon Process Management

Wed, 08/27/2008 - 10:24

After tackling the difficult task of improving Rails deployment, Phusion - the creators of Passenger (mod_rails) recently announced the availability of daemon_controller - a library (rather than a stand-alone tool) for managing daemons. It lets you write applications that manage daemons in a robust manner (e.g. mongrel_cluster or UltraSphinx could be adapted to use this library).

The primary motivation for using daemon_controller is to make it easier to have other applications (such as Rails apps) start daemons without encountering race conditions or parallel attempts. With a little work, daemon_controller makes it possible for your app to safely launch all the daemons that its functionality relies upon (UltraSphinx, BackgrounDRb, etc.).

The library is simple to use - though it does require that you know how to start the daemon, how to contact the daemon, and you must know where it will put its PID and log files. Source code is available at http://github.com/FooBarWidget/daemon_controller/tree/master

Ruby Hoedown 2008 Videos Available

Tue, 08/26/2008 - 21:22

Videos from the recent Ruby Hoedown conference are now available at the Confreaks site.

The talks this year are split between traditional talks and "Lightning Talks" - 5 minute presentations that quickly highlight a single package or aspect of Ruby.  The talks cover a wide range of topics including Archaeopteryx - a Ruby MIDI/Music generator, easy phone calling with ruby, cloud computing, the usual excellent testing and design patterns talks, and a slew of other quirky and useful presentations.

If you don't want to sit through the talks at normal speed, you can download the presentations in .mp4 format and increase the playback speed in your video viewer of choice.  I've found that the videos are perfectly watchable at 2x speed in Quicktime (Command-K > Playback speed.)

Mack 0.7.0: A Significant Update to A Powerful Ruby Web App Framework for Distributed Apps

Tue, 08/26/2008 - 14:38

We first covered Mack in April, when I billed it as a "fast, best of the rest, Web app framework." Mack, a Ruby-based Web application framework, developed by a team led by Mark Bates, has continued to grow over the past several months and today announced a significant release, Mack 0.7.0.

Mack is a unique Ruby Web app framework due to its heavy focus on reusability across multiple applications. Mack supports distributed objects - yes, between multiple applications, distributed views and layouts, and even distributed routing (all of your Mack apps can be aware of each other's routing). Mack has a Google group for discussion purposes, and Mark has put together a great screencast demonstrating how to create a simple application with the framework.

I caught up with developer Mark Bates to ask a few questions about the framework:

Why would you recommend someone try Mack over the alternatives (Merb, Rails, Ramaze, Sinatra, etc.)?

Mark Bates: I would recommend that people try a lot of different frameworks before they decide which one to go with - that's what I did. I tried over a dozen frameworks back in January 2008 when we decided to move away from Rails. None of them were right for the problems we had to solve. If you're looking for a framework that is simple, fast, easy to use, and yet powerful, than Mack might be right for you.

Mack has a large focus on giving developers the tools to build SOA, distributed, and portal-like applications. Mack is easily extensible and easy to configure to suite your projects. The core of Mack is small and lightweight. The mack-more series of gems allows people to pull in the extras that absolutely need.

What are the new features in Mack 0.7.0?

The two biggest features in 0.7.0 would have to be Distributed Objects and Distributed Views/Layouts, which round out the three big distributed features, along with distributed routes. These features are what really set Mack aside from all the other frameworks out there right now. Using the power of Rinda we're able to have a bunch of Mack applications talking seamlessly together with almost zero configuration.

In addition to the new distributed features, we've added a ton of helpers, including a whole suite of form helpers, Transactional support for tests using Active Record, DataMapper was already supported. Great improvements to the mack-data_factory content generating system, including a ton of new content types. A whole slew of bug fixes, and general overall improvements. A bunch of new generators and enhancements to existing ones.

What have you learned / discovered in the process of developing Mack?

One of the biggest things that I've learned since I've started developing Mack is that I truly believe in the KISS philosophy, Keep It Simple Stupid, and that it is the only way to code. One of big frustrations I've had with other frameworks, and one in particular, has been that if you crack open the source code to try and track down a bug it's nearly impossible. There are just thousands of lines of code, and eight levels of redirection before you find the things you're looking for. When I talk to people who want to commit that's the first thing I tell them, keep it simple. I want people to be able to open the source and be able to very quickly follow it through. Keeping things simple also has other side effects, apart from readability. It helps keep things fast, and helps keeps the bugs to a minimum.

Is deploying Mack applications as easy as Rails or Merb apps?

Since Mack is a Rack application at heart, it deploys with Phusion Passenger with just a simple config.ru file that Passenger requires. If you're using Thin, there's a Mack adapter built in, so it's very easy to deploy with a Thin cluster. Mackwiki.com (a new Mack-based wiki) is hosted using a cluster of 3 Thin servers behind Nginx. Again, KISS, is evident here. I want Mack apps to be easy to deploy. I've fought through some tough deployments with other frameworks, and I don't want other people to have to go through that.

What’s Hot on GitHub - August 2008

Mon, 08/25/2008 - 15:40

Github is a great resource for finding new projects within the Ruby community. It has become an extremely popular place for Ruby and Rails developers to congregate lately, so I wanted to list some of the new projects, and some of the updated ones, that I have found interesting and that are too small for their own blog post. Let us know if you like this as we might turn it into a regular series on Ruby Inside!

This month's picks:

  • Uppercut - A simple DSL for creating Jabber agents within Ruby. Seems quite young but full of potential.
  • AintABlog - Open-source tumblog application. Imagine your own tumblr account, but really customizable.
  • factory_girl_on_rails - If you use factory_girl (like I do) then this will provide you with automatic inclusion of test/factories/* and also new generators for creating factories.
  • object_daddy - A nice alternative to factory_girl. It helps you kill rails fixtures, keep your code DRY and reduce the complexity of your tests.
  • Chris Wanstrath's Ruby Hoedown Keynote - An unusual entry for Github, but as Chris runs GitHub, this makes sense. It's a transcript of Chris's great keynote presentation at the recent Ruby Hoedown conference.
  • Backchat - a one-file Merb application that allows you to quickly add commenting (think disqus) functionality on to any site.
  • HomeMarks - a Rails application that provides "start page" type functionality. A great example of Rails code using unobtrusive JavaScript. Very slick.
  • Inline File Editing - Not a project, but a new Github feature. You can now edit files in your repositories within the browser and Github deals with the housekeeping. Perfect for the most minor tweaks.
  • Adhearsion - A popular VoIP framework (a bit like a "Rails for telephony") that has just migrated over to using GitHub.

NeverBlock: Fast, Non-Blocking IO In Ruby Without Changing Program Flow

Mon, 08/25/2008 - 11:30

NeverBlock is a Ruby (1.9) library developed by eSpace - an Egyptian Web 2.0 development team - that could make your life a whole lot easier if you have to deal with blocking IO operations that hold up all your Ruby threads.

NeverBlock makes it easy to get the benefits of non-blocking IO (IO operations that aren't held up by mutexes) in your Ruby apps without having to take the usual route of redesigning your app to be event-based. You get all the benefits of event-based code (lower CPU overhead, lower memory use, less hangups) but with the benefit of a normal program flow model.

The catch? It's Ruby 1.9 only - relying heavily on fibers - and the documentation isn't particularly strong yet so it'll take a bit of work to figure out. It could be worth it, though, as in benchmarks on the NeverBlock-based Postgres library, throughput is shown as significantly increased where a percentage of queries are complex and slow (and would usually block up the client).

If you're still interested, NeverBlock is available on Github - there's also an official home page and documentation available.

This post is sponsored by AlphaSights Ltd - AlphaSights are recruiting. If you're looking for a Ruby on Rails opportunity, can work in Cambridge, UK and enjoy the buzz of a brand new well-funded startup then look no further. AlphaSights are recruiting from entry level to senior positions and offer very competitive salaries and a great working environment.

WhatLanguage: Ruby Library To Detect The Language Of A Text

Fri, 08/22/2008 - 18:04

WhatLanguage is a library by Peter Cooper (disclaimer: yes, that's me) that makes it quick and easy to determine what language a supplied text is written in. It's pretty accurate on anything from a short sentence up to several paragraphs in all of the languages supplied with the library (Dutch, English, Farsi, Russian, French, German, Portuguese, Spanish, Pinyin) and adding languages of your own choosing isn't difficult.

The library works by checking for the presence of words with bloom filters built from dictionaries based upon each source language. We've covered bloom filters on Ruby Inside before, but essentially they're probabilistic data structures based upon hashing a large set of content. They're ideal in situations where you want to check set memberships but the threat of false positives is acceptable in return for significant memory savings (and a 250KB bloom filter is a lot nicer to deal with than a 14MB+ dictionary).

WhatLanguage is available from GitHub (and can be installed as a gem from there with gem install peterc-whatlanguage) or from RubyForge with a simpler gem install whatlanguage. Once installed, usage is simple:

require 'whatlanguage' "Je suis un homme".language # => :french # OR... wl = WhatLanguage.new(:all) wl.language("Je suis un homme") # => :french wl.process_text("this is a test of whatlanguage's great language detection features") # => {:german=>1, :dutch=>3, :portuguese=>3, :english=>7, :russian=>1, :farsi=>1, :spanish=>3, :french=>2}

I wrote the library initially a year ago but have only just made it available for public use, so if there are unforeseen bugs to fix or things that really need to be added, fork it on GitHub and get playing.

This post is sponsored by AlphaSights Ltd - AlphaSights are recruiting. If you're looking for a Ruby on Rails opportunity, can work in Cambridge, UK and enjoy the buzz of a brand new well-funded startup then look no further. AlphaSights are recruiting from entry level to senior positions and offer very competitive salaries and a great working environment.

Ruby Inside Gets Redesigned; Gets Twittering; and Three New Writers Come On Board

Thu, 08/21/2008 - 21:08

New Design

Till yesterday, Ruby Inside had been sporting the same tired design it had since launch in May 2006, but no more! Ruby Inside now has a more up to date design that focuses more on getting access to great Ruby (and some Rails) content from both Ruby Inside itself and other sites (like Ruby Flow).

If you only read Ruby Inside through the full text feed, please visit the site directly just to give it a look - pretty please? :)

Follow RubyInside on Twitter

The new design you see today is only step one of a longer-term process to make RubyInside.com more useful for all Ruby and Rails developers. Another step has been creating a RubyInside Twitter account. Now, if you prefer, you can follow Ruby Inside directly from your Twitter account or cellphone. Alternatively you can subscribe by e-mail. You'll receive one e-mail a day max and it'll feature the new posts from the current day. See the new front page for more details.

Three New Writers

As part of staying on the pulse of the latest Ruby and Rails happenings, three new writers have come on board to help both Ruby Inside and Rails Inside going forward. They are Zach Inglis of Hashrocket, Shalev NessAiver, and Eldon Alameda (known as the author of Practical Rails Projects). You'll see and hear a lot more about them soon, but please welcome them to the team. Thanks to all 18 people who applied for these positions - I was genuinely surprised by the response and touched by a lot of the nice comments.

Suggestions?

If you have any comments or suggestions regarding the new design, things you'd like to see on Ruby Inside or Rails Inside, or the like, please leave them here, or visit our new Contact page to get in touch with us. Here's to another solid two years with Ruby Inside (and if you're interested in Rails - don't forget to subscribe to Rails Inside too, as most Rails content will be over there in future!)

Apple and Ruby: The Ongoing Relationship

Thu, 08/21/2008 - 01:50

While it was pretty momentous last year when Mac OS X (Leopard) was released with full support for Ruby and Rails included with the OS, it seems that the Ruby train is still rolling with Apple.

A recent InfoQ article highlights some ways that Apple is using Ruby that you might have missed - including:

  • The iPhone Configuration Web Utility - A tool written in Ruby on Rails for allowing enterprise customers to manage iPhones.
  • The SproutCore JavaScript framework - Which is designed for making desktop-like applications on the web and is used in Apple's new MobileMe applications. SproutCore is installed as a gem, uses generators written in Ruby to create resources and it utilizes Merb to generate HTML artifacts. (Update: SproutCore isn't a Ruby project / Ruby-based system per se, but it does offer some good tie-ins to the Ruby ecosystem.)
  • The MacRuby project - Apple's own port of Ruby to the Objective-C runtimes - which should make it much easier to integrate with Cocoa for Desktop development.

I haven't played with the MobileMe web applications much, but I recall thinking that they looked fairly impressive. Have any other Ruby developers tried SproutCore yet? How's it working out for you?

Post supported by Brightbox: Brightbox is a specialist European Rails hosting company. Each Brightbox server includes an optimised Ruby on Rails stack, SAN storage and access to a managed MySQL database cluster. They also manage dedicated clusters for large scale Rails deployments. Click here to learn more..

BOSSMan: Build Your Own Search Engine With Yahoo And Ruby

Wed, 08/20/2008 - 02:41

Recently, Yahoo! launched BOSS - the "Build Your Own Search Service." In all but name, it appears very similar to their older Yahoo! Search API, as it allows you to query Yahoo's search index programatically. Under the surface though, Yahoo has removed the 5,000 query per day limit, you're unrestricted in how you present the data returned, you can re-order the data, and no attribution is required.

For Rubyists ready to play with BOSS, Jay Pignata has developed BOSSMan, a library for interacting with the Yahoo! BOSS Web service. Either get it with Git or install with RubyGems like so:

gem sources -a http://gems.github.com gem install jpignata-bossman

Once you've got the library, make sure you've got an application ID from Yahoo (this is unavoidable, alas) and then you can start to play:

require 'rubygems' require 'bossman' include BOSSMan BOSSMan.application_id = "Your Application ID here" news = BOSSMan::Search.news("Barack Obama", 0, 3) news.results.each do |result| puts "#{result.title} [from #{result.source}]" end

BOSSMan supports Web, news, and image searches out of the box. You can dump to JSON, XML, or YAML and access all of the relevant attributes through methods. Superb!

This post supported by Notifixious - Notifixious - a new notification service startup based in San
Francisco - needs a Rails expert to become its CTO! Knowledge of messaging technologies (XMPP) and REST API development is a must. You can learn more here.

Shoes - Ruby’s Cross Platform GUI App Toolkit - Grows Up

Fri, 08/15/2008 - 13:36

It was about a year ago now that Rubyist extraordinaire Why The Lucky Stiff first showed his "Shoes" Ruby cross-platform GUI application toolkit off to the world. Since then, he's not let up with the development.

Previously, we've featured the release of The Shoebox - a Shoes application repository - and Nobody Knows Shoes - a short book about Shoes, done a roundup of Shoes tutorials, and looked at how to write a drawing program with Shoes on OS X.

Now, Shoes has a new official homepage - located at http://shoooes.net/ (yes, that's three os). Complete with a picture of an Amstrad CPC and gloriously pixellated logo, there's now a reasonably non-technical place to go to download Shoes, get into the wiki, and get access to the book. There's also a really good illustrative tutorial that walks you through some basic Shoes examples.

Quit dallying - go check it out. It's quite possibly Why's best work yet.

Ruby 1.9: What To Expect

Tue, 08/12/2008 - 23:12

Ruby 1.9: What To Expect is an online slideshow by Sam Ruby that covers a lot of the differences between the Ruby 1.8 that we all know and love and the currently experimental Ruby 1.9. Sam's examples are to the point, easily digestible, and span 47 slides. He gave the original presentation at OSCON in Portland a couple of weeks ago.

Sam's presentation is quite similar to "Migrating to Ruby 1.9" by Bruce Williams which we posted about in April. It never hurts, however, to frequently revise the changes since Ruby 1.9 will be production-ready in just four short months..!

(Note: A couple of readers - see comments - have reported slightly odd goings-on when visiting the slideshow page, so if you have 1001 tabs open that you don't want to lose, take care!)

Post supported by Brightbox: Brightbox is a specialist European Rails hosting company. Each Brightbox server includes an optimised Ruby on Rails stack, SAN storage and access to a managed MySQL database cluster. They also manage dedicated clusters for large scale Rails deployments. Click here to learn more...

New Vulnerabilities Discovered in Ruby (August 2008)

Fri, 08/08/2008 - 12:38


Photo by JL2003 - CC 2.0 Attribution License

In June, a serious security advisory was put out about the official (MRI) Ruby interpreter for all versions prior to 1.8.5, 1.8.6 prior to patch 231, 1.8.7 prior to patch 22, and 1.9.0 prior to 1.9.0-2. Now (August 8, 2008) a new set of vulnerabilities have been discovered and announced. They affect all 1.8.5 releases, 1.8.6 patch 285 and prior, 1.8.7 patch 70 and prior, and Ruby 1.9 r18423 and prior. This almost certainly means an upgrade is required for most users as all but very recent versions are affected.

The vulnerabilities discovered this time around aren't, on the surface, quite as serious as those last time around. Several vulnerabilities in safe level have been discovered (essentially there are some clever ways of getting around a few safe level restrictions), WEBrick's default file handler has a bug that results in certain operations taking exponential time, resolv.rb is open to the recently popularized DNS spoofing tactics, and dl doesn't check whether variables used in calling functions are tainted or not. These issues are all covered on the official Ruby news page about the vulnerabilities, along with some advice on how to upgrade.

Upgrading to the latest stable version is always a good idea (assuming you check if your apps will still work - Rails had/has problems with certain 1.8.6/1.8.7 versions) but if you're sure you (and your libraries!) are not using any of the features mentioned above, this set of vulnerabilities doesn't present any reason to panic, unless you're heavily reliant on safe mode or allow tainted variables to even reach something as powerful as dl.

A Crazy Number of Ruby and Rails Jobs for August 2008

Wed, 08/06/2008 - 04:46

There are some really amazing sounding jobs this month! The focus is definitely on Rails - and working environments include the skunkworks at an adult entertainment provider, a gaming startup, a mansion in Los Angeles, and one of the biggest companies in America. All the jobs are in the US, alas, but on both coasts and in-between!

From the Ruby Inside job board (costs $99 for a 60 day listing - and you get featured on Ruby Inside like this) comes a whole batch of interesting opportunities:

Web Developer for a Mobile Start Up (Seattle, WA) - Kiha are looking for a general Web developer with Ruby, Ajax, and MySQL experience (and preferably some Java). Kiha Software, a well-funded startup (Paul Allen is an investor), is introducing a novel user experience platform for mobile devices. As a Web Developer, you will be responsible for developing the web interface for Kiha’s services.

Rails Developer for an adult entertainment company (San Diego, CA) - Naughty America needs a great Rails developer for their "skunk works" R&D department. You'll be working on new, exciting projects - many to be revolutionary within the adult industry. You'll need a solid grasp of Ruby, Rails, and UI design. If 37signals sounds like a great place to work, you're the type they're looking for. Benefits include full medical/dental/vision, matching 401k, FSA, flexible hours, choice of platform, and a fast-paced work environment. Man, I think I'd be trying to apply for this job if I were in the US!

Rails Developer for a Web Gaming Start Up (San Francisco, CA or Portland, OR) - Kongregate, a web games startup (you know you've been stuck on that site as long as I have..), is looking for a Rails developer to join as their 18th employee. The ideal candidate would love shipping solid code, have demonstrable Rails experience, be smart and good at getting things done.

Front-End Rails Developer (Brooklyn, NY) - outside.in, an established startup in the hyperlocal space, is looking for a senior Rails developer. outside.in creates "on the fly" local newspapers for any address in the US and lets users track and explore news in their neighborhood. Their ideal candidate will be a strong Rails developer, able to take designs from Photoshop to HTML and CSS, and, ideally, have good JavaScript skills. They are also looking for a back-end developer with postgres, Mongrel and nginx experience.

Ruby on Rails Programmer (Austin, TX) - OtherInbox, a startup in the e-mail space, is looking for a Rails developer with experience of deploying on Amazon EC2, and with knowledge of Amazon's S3 and SQS services. A degree is required, but all OtherInbox Rails developers get to attend the Lone Star Ruby Conference and RailsConf on the company's dime. This is an opportunity to work with two very exciting entrepreneurs - Joshua Baer and Steven Smith.

Senior Rails Developer (San Francisco, CA) - Netbooks is a company revolutionizing how small businesses are managed through advanced software. A senior Web developer is required for their experience, agile team to help build Netbooks' SaaS business management applications. This is a team lead level position.

Web Application Developer (Sherman Oaks, Los Angeles, CA) - CitrusByte LLC is a Web app development shop headquartered in Los Angeles. They're looking for a forward thinking developer who wants to work with similar. They want to add several developers to their team. Supposedly they don't have an office, but a "McMansion with a BBQ out of back" with a fridge full of energy drinks. They've also built four of the largest Rails sites in the world. This is a lifestyle, not just a job.

Senior Ruby on Rails Developer (New York, NY) - weplay's ad was written by a member of their development team, not by HR, so it's worth reading directly. In any case, the position is in Manhattan's Chelsea Market building, you get an excellent compensation package including stock options. You need to be a solid Rails developer who's into collaboration, pair programming, and jQuery. If the thought of having Derek Jeter, Peyton Manning, LeBron James, and Jennie Finch walking through the office gets your heart racing, get in touch with these guys at techjobs [AT] weplay.com.

Two special mentions (Ruby Inside has received no compensation for these two mentions):

Time Warner Needs Rails Developers in NYC: Time Warner are looking for two Ruby on Rails developers to work from their New York office. The candidate will need to work well in an Agile/XP environment (with TDD, continuous integration, and pair programming as standard) and must have experience with using JavaScript libraries such as JQuery, and be proficient in implementing RESTful Rails 2.x apps. You can read a little more here or e-mail Chris.klamkin [AT] princetoninformation.com directly for more information.

San Francisco startup needs a Ruby/Rails guru CTO: Notifixious is looking for a Rails expert to become its CTO! Notifixious is a notification service built partially with Ruby On Rails, so knowledge of messaging technologies (XMPP) and REST API development is a must. You can learn more about this opportunity here. The successful applicant will need to be entrepreneurial and enjoy a startup atmosphere. Compensation is made up of stock options, a good salary and benefits.

If you or your company have openings for Ruby and/or Rails developers, consider checking out the Ruby Inside job board. Your job not only gets featured in the sidebar of every Ruby Inside page, but also summarized in posts like this. Alternatively, contact Ruby Inside directly in case there are other ways in which we can work together.

Still looking for a job? There are even more over at RubyNow's jobs section and on the 37signals Job Board!

Prawn: The Pure Ruby PDF Generation Library

Mon, 08/04/2008 - 15:43

Prawn is a new pure Ruby PDF generation library developed primarily by Gregory Brown.

Back in March, Gregory tried to raise $13000 so he could spend six months working on Ruby-related open source projects. He eventually raised $5525 from the community (plus $5000 from Ruby Central and $500 from Mountain West RubyConf) and has spent the last few months working on Prawn.

Prawn can be installed from a pull from GitHub or, for those of us who are less adventurous, with a gem install prawn. Once installed, you can give it a quick test run:

require 'prawn' Prawn::Document.generate("test.pdf") do font "#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf" text "this is a test " * 100 end

Prawn comes with 11 typefaces, including Helvetica, Courier, DejaVuSans, Times, and everyone's favorite - Comic Sans. It already supports image embedding, table drawing, and content positioning, but a lot more is yet to come. Prawn is now ripe for more community involvement and support, so if you want to help (Gregory's looking for a logo!) the prawn-ruby Google Group is a great place to start.

Update: Gregory has created the "Prawn Gallery" on GitHub as a place for people to show off their Prawn-created PDFs.

This post is sponsored by KickStart Events — RubyOnRails Training at the EMCC (East Midlands Conference Centre), UK. High-quality hands-on workshops and courses for web application developers. Taught by experienced mentors using live coding sessions, slides and participatory discussion.

“The Rubyist” Ruby Magazine Launches

Sun, 08/03/2008 - 17:00

The Rubyist - not to be confused with the Japanese Rubyist Magazine - a new paper-and-PDF based magazine for Ruby developers has released its first issue. This is a significant milestone, since it was just over a year I lamented about how the blogosphere killed the enthusiasm for Ruby magazines. In response to that post, Jeremy McAnally announced his intention to produce a Ruby magazine, and now, with the advent of simple Print On Demand magazines from MagCloud, it has become a reality.

The first issue is available in print for the United States only and costs $8 plus postage. A PDF version is available for $3 from Lulu for those who prefer PDFs or are located outside of the US. Contents include interviews with Rein Henrichs and Hampton Catlin, articles from Jamie van Dyke, Ben Scofield and Yehuda Katz, some unbelievably good ads, and more. There's nothing particularly deep in the first issue, but for a first issue this is a remarkable effort and one I'd certainly recommend purchasing, even if only in PDF form.

HTTParty: Quick Web Service Consumption From Any Ruby Class

Sat, 08/02/2008 - 16:40

HTTParty is a new Ruby library by John Nunemaker (of railstips.org fame) that makes it a snap to build classes that can use Web-based APIs and related services. At its simplest, you include the HTTParty module within a class, which gives your class a "get" method that can retrieve data over HTTP. Further directives, however, instruct HTTParty to parse results (XML, JSON, and so on), define base URIs for the requests, and define HTTP authentication information.

HTTParty's simplicity is demonstrated in the most "complex" example John gives in his introduction post - a Representative class that can retrieve information about US Representatives from whoismyrepresentative.com:

require 'rubygems' require 'httparty' class Representative include HTTParty base_uri 'whoismyrepresentative.com' default_params :output => 'json' format :json def self.find_by_zip(zip) get('/whoismyrep.php', :query => {:zip => zip}) end def self.get_all_by_name(last_name) get('/getall_reps_byname.php', :query => {:lastname => last_name}) end end puts Representative.get_all_by_name('Donnelly').inspect # {"results"=>[{"district"=>"2", "last"=>"Donnelly", "first"=>"Joe", "state"=>"IN", "party"=>"D"}]}

That code will work for you after a simple gem install httparty. So, join the HTTParty now; it looks pretty fun.

This post is sponsored by KickStart Events — RubyOnRails Training at the EMCC (East Midlands Conference Centre), UK. High-quality hands-on workshops and courses for web application developers. Taught by experienced mentors using live coding sessions, slides and participatory discussion.

Describe Your Perfect Conference: Win Ruby Hoedown Tickets!

Fri, 08/01/2008 - 16:33

Yee-haw! The Ruby Hoedown, the "Ruby conference for the South" enters its second year, taking place in Huntsville, Alabama on August 8th and 9th, 2008 (yes, in a week's time!). Speakers include David Black, Chris Wanstrath, Giles Bowkett, Robert Dempsey, Gregg Pollack and Jason Seifer, and late registration is $199. If you fancy a last-minute trip to what should be a great sophomore Ruby event, register now!. Huntsville isn't a crazy distance from Birmingham, Atlanta, or Nashville, so it shouldn't be too hard to attend if you're already in that corner of the country.

Describe Your Vision of the Perfect Ruby Conference..

Hoedown organizer Jeremy McAnally has also decided to give away 3 free tickets to the hoedown, so what better than a contest? To enter, describe your vision of the "perfect" Ruby / Rails or general technology conference. What would be there.. bars, circus tricks, hardcore programming sessions, casinos.. it's up to you. Be as crazy and unrealistic as you want! If you want a chance at the tickets, make sure to leave your e-mail in the relevant field and three people will be chosen at random. If you want to describe your ideal conference but DON'T want the Hoedown tickets, please mention that in your comment someplace.

(As an aside, consider filling out Hampton Catlin's Ruby survey if you haven't already. The results could prove very interesting - they'll be reported here on Ruby Inside once they're released.)

DocBox: Wiki-Like Ruby / Rails Documentation For Everyone

Wed, 07/30/2008 - 20:44

DocBox is the latest attempt to improve the Ruby/Rails documentation scene. Created as a Google Summer of Code project by Ian Ownbey (mentored by Jeremy McAnally) DocBox "sits on top of RDoc and allows users to update documentation through a wiki-like interface." Changes to the 'wiki' are then folded back into your code and committed to a git documentation branch.

While still young, this project shows a lot of promise, as it allows anyone to write detailed, versioned, documentation without having to download or view any source code.

Naturally, DocBox is open source and is available at GitHub. Jeremy and Ian both encourage people to jump in.

Ruby on Bells: The Ruby-Powered Musical Glass Playing Machine

Tue, 07/29/2008 - 16:11

Ruby on Bells is a demo of the Madrona fork of RAD (Ruby Arduino Development) itself a Ruby bridge to Arduino, an open source electronics prototyping platform. Powered by a simple Ruby script, a set of glasses are hit by small mallets on servos, resulting in a Philip Glass-esque cacophony. It's a compelling demo, and if physical computing intrigues you, the tools available to Ruby and Arduino developers are now mature enough to bring interesting results within easy reach.

A longer "behind the scenes" video explaining how it was put together and how the code looks is also available. The code used is a very simple Ruby-based DSL. Couple this with Giles Bowkett's MIDI generator and you could have a lot of fun.

Ruby 1.9 Drops Support For 9 Platforms (Ruby 1.9.0-3’s Release Bombshell)

Mon, 07/28/2008 - 16:37


Photo credit: Blakespot. License: CC 2.0 Attribution

Yuki Sonoda has announced the release of Ruby 1.9.0-3, a snapshot release of the still-experimental Ruby 1.9 (wait until Christmas for the production ready 1.9.1). Minor releases aren't typically covered here on Ruby Inside, but the dropping of support for nine platforms in Ruby 1.9 might be of significant interest to some:

Ruby 1.9 no longer supports the following platforms because they have no active maintainer.

  • BeOS
  • WinCE
  • OS/2
  • Interix
  • bcc32
  • Classic MacOS
  • djgpp
  • VMS
  • human68k

I will remove platform-specific codes for them from Ruby, unless someone become a maintainer by 25 Sep.

It seems unlikely anyone will be too bothered about losing Ruby on Mac OS 9, DOS, BeOS or WinCE, but if you are bothered, get on to ruby-talk right away. Even if you don't think you could maintain it yourself, renewed interest in your platform might encourage others to get involved.

Further to the above, Ruby 1.9.0-4 is due on August 25, 1.9.0-5 on September 25, 1.9.1 RC1 on October 25 (this will be quite a significant test - put it in your calendar), 1.9.1 RC2 on November 25, and 1.9.1 proper on December 20, 2008.

This post supported by Rails Kits: Get billing and subscription code "to go" with the SaaS Rails Kit. Quickly add credit card and PayPal payments to your Rails app. Now supports Authorize.net and other payment processors. Get 10% off by using the discount code "rubyinside" at checkout before August 1st.