Articles

Off Topic, FiveRuns is Hiring

Live near Austin, TX? Want to work at a small, Rails-focused company? Not completely put off by the idea of having to work with me on a day-to-day basis? Really, think about that last one…

We’re gearing up to hire several Rails developers with varying levels of experience from the local area. If you’re sincerely passionate about Rails, Ruby, the community that’s grown up around it, and fit the bill, drop me a line (bruce at fiveruns).

HTML::Tag class in scrapi

While working with scrapi, I found there is no external documentation for HTML::Tag class. This article is to ensure no one says this again.

PuneRuby August Meet

Around 20+ rubyists got together on a rainy evening of Saturday to take part in PuneRuby's August Meet
.
The evening started with quick round of introductions. There were college students, fairly new rubyists and some expert Railers.

Prototype demo of COEP college website using Hobo

Domain Forwarding or URL Redirection

also known as URL Forwarding or Domain Redirection. Its a technique of making webpage available through many URLs.

Checkout
wikipedia article on URL redirection
for uses of redirection.

QScraper : hpricot interface to scrapi

QScraper is a wrapper over scrapi to provide Hpricot like interface.

Motivation: Hpricot interface is simple and easy to use while scrapi is more powerful because of bundle scraping and anonymous classes. I was using hpricot for quick testing and checking but scrapi for project implementation. To avoid working with two html scrapers, I wrote this wrapper over scrapi.

Testing the Right Stuff

I’m going to take a slightly different tack here, and review some of the unit tests in rails itself. They show up two common anti patterns, spurious assertions and coupling your tests to the implementation.

Upgrading to Capistrano2

From capify,
"Capistrano 2.0 is the first significant update to Capistrano in a year. It represents a major refactoring of the tool's internals, as well as a complete reworking of the deployment recipes."

All you need to do for upgrading your existing Rails app using cap1.x is to,

a. Capify your Rails app,
capify .

An epiphany about Functional Programming and Lazy Evaluation

(Update: be sure to read the comments, as the language used in my article was not entirely exact, in functional programming legalese ;-) Many readers helped to clarify things a bit.)

I had a mini-epiphany recently. Altough I haven’t had the chance yet to program with a functional programming language, it’s a subject I’ve had my eye on for a while. My ear perks up when I hear about Erlang, Haskell, F# or Scala, 4 functional programming languages.

Paginator 1.1.0

I just released an update of the paginator gem; the full range of Enumerable methods are now available on Paginator and Page instances. This was a long overdue feature – like many releases, this one was for largely selfish reasons … not having inject available was really getting on my nerves.

Forward and Delegate, A Simple Pattern

Here’s a simple example showing how to:

  1. Forward all missing method invocations on to some object

  2. Dynamically add delegation of that method to that object for future invocation.

    def methodmissing(meth, args, &block) #:nodoc: returning @object.send(meth,args, &block) do self.class.classeval %{delegate :#{meth}, :to => :@object} end end

Note this example uses two bits from ActiveSupport:

22 Technology Posts of Summer | Rails Fire

22 Technology Posts of Summer

Send to friend

We’ve been pretty busy on the blog this summer reviewing some of the interesting technologies that the Ruby and Rails worlds are working with. We tried to mix in some introductory materials and some more advanced ones. In case you missed them, we thought we’d do a quick review, particularly since we’ve had quite an increase in blog readership over the Summer.

Rails and Deployment

Yehuda Katz talked about the challenges of refactoring Rails, (in two posts) and then about his five favorite things about Rails 3. His vote: a new bundler, a new ActionController architecture, the new Responder object, ActiveModel (which brings ORM pluggability) and much better performance. Carl Lerche also chipped in with some tips for how to boost Rails performance. Top tips: eager loading, leveraging the database and keeping the request cycle simple.

One of the most popular posts of the summer was Sudara Williams take on app server bloat, and bad ActiveRecord behavior that can get you in trouble. One interesting point was that looking for Rails or Ruby memory leaks as the source of big memory consumption jumps is usually the very last thing you should worry about. There were some great comments and extra tips in the comments, so be sure to read them all.

Taylor Weibley blogged about managing background jobs in Rails. The big takeaway, benchmark your workload and track completion and failure rates like a hawk. And Greg Nokes talked about sharding for Rails – to be avoided as long as you can because it complicates life greatly, but is eventually inevitable.

All Things Ruby

Charlie Nutter kicked off our JRuby series with a brief introduction, and then wrote about how to script Java libraries using JRuby, and built a MIDI keyboard app to show it in action. Tom Enebo then went over how to bring your favorite Ruby features to Java APIs when you’re accessing those libraries from JRuby, and covered decoration, delegation, blocks. Brian Ford kicked off the summer with a tour of RubySpec and later went through the mechanics of a Ruby compile from text to bytecode. Stay tuned for the next post on how a Ruby compiler goes from bytecode to machine code.

Key Value Stores & Search

Kirk Haines kicked off his series on key-value stores for Ruby with an introduction to this class of non-relational stores, and why you might look at them as an alternative to the tried and true relational database.

First up was an overview of Tokyo Cabinet, a family of key-value stores created by mixi — the Facebook of Japan. Tokyo Cabinet is more than just simple key-value stores though, it also offers b-tree storage and fixed length array storage. In Kirk’s evaluation, it looks super-fast as well as nice and mature.

Next up was Cassandra, an eventually consistent, fully distributed, highly scalable data store created by the Facebook crew. Cassandra’s model is a little bit of twist on a simple key value store, but it can really be the right solution if you think you’re going to need Amazon or Facebook like datastore scaling at a compelling cost. Finally, Kirk did an introduction to Redis, great if you need speed, persistence and you can tolerate some data loss. Stay tuned for more entries in Kirk’s list. Next up: MongoDB!

Another interesting post was Avrohom Katz’s post explaining five ways to improve your use of Sphinx text-search.

Development Tools and Testing

Dave Astels wrote an excellent series on Cucumber, from introductory to intermediate users and on to expert tips. And Joe Arnold talked about the pair-programming approach at Engine Yard.

And stay tuned for more great technology posts for the fall!

Images: