Posted almost 3 years back at PJ Hyett
Programmers are arguably some of the smartest people in the world. We solve complex problems all day, every day, and we’re always hungry for more. We strive to find simplicity in even the most complicated situations. If Eistein were alive today, he’d probably be hacking the Linux Kernel along side Alan Cox during his lunch break.
The issue arises when you take those minds, throw in the impersonality of the internet, and mix in a whole bunch of ego.

Case in point: Vlad the Deployer. It was written as a Capistrano replacement to handle application deployment simpler than the aforementioned project. Make no mistake, the library rocks; I’m using it in production already.
Capistrano certainly became the victim of its own success. It needed to be everything to everyone in the Rails community, because it was the only thing out there that handled deployment with any sort of ease.
Futhermore, its author, Jamis Buck, recently said that its dependencies were written at a different time and place than he’s in now and has been working on rewriting them to remove unnecessary complexity. It takes a big person to admit that his hugely successful application needs a lot of work.
It doesn’t take a big person to rip on an open-source app that has been one of the most useful libraries for Rails since the framework’s inception. Vlad’s authors, the Ruby Hit Squad, have made it some bizarre mission of theirs to insult Capistrano in an attempt to promote their replacement. I have no idea what they’re accomplishing with their tactics (see image above for an example) other than alienating someone that dedicates a portion of his time contributing to a framework that allows them to make their livelihood programming in Ruby.
I’m picking on Vlad, but I’ve seen this time and time again with open-source projects and find the attitude unbelievably off-putting as it reflects poorly on the open-source community as a whole. I’m certainly not immune to bad-mouthing projects that I’m not excited about, but I’d like to think that as the years progress that I’m learning to control the emotions that ran rampant when I was 16.
As the saying goes, “Speak softly and carry a big stick, you will go far.†Let others know about your alternative, but allow the code do most of the talking for itself.
Posted almost 3 years back at Synthesis

Just wanted to mention our Rails Rumble project, RubyBrigade.org. Jason Perry, James Seaman and I
worked through the weekend to build RubyBrigade.org – a geographically aware database of Ruby User groups.
Big thanks to James for the killer hand drawn illustrations and interface. Big thanks to Jason & Katie for letting us take over their house for the weekend.
Features:
- Google Maps Integration
- Sub-domains for each group
- Geocoding: either by the search box or by sub-domain!
- RSS and iCal feed parsing
- Display latest user groups
- Display upcoming events across all groups
- Display blog posts & upcoming events for individual groups
- ReCAPTCHA for spam prevention
- No authentication required
More Screenshots
View a Brigade

Edit a Brigade

Delete a Brigade

404 Message

If you like what you see, vote for us!
Posted almost 3 years back at Alloy Code - Home
After a turbo-charged 48 hour development period, our contest entry has launched! Keith did an outstanding job on our interface, far exceeding merely doing justice to my application code. Even more impressive, we managed to implement everything we intended, and simplified the app at the same time.
Here’s the short list of features:
- *No* Account Management Required!
- Easy to share private URLs
- Document Version & Status Tracking
- Version specific Comments
I would argue that our greatest success was removing the account management requirement. Most of the Rumble contest sites we’ve viewed so far put the majority of their content behind a login/password screen. A few of the more generous ones support OpenID, a technology I’ve recently come to embrace.
We take pride in being one of the few applications that offers all the benefit of a session-backed user account without any of the account creation/management overhead. Simply provide your name and email address when you upload a document and your account is created for you. If you’ve uploaded additional documents with the same email address, we’ll automatically group them together for you.

Posted almost 3 years back at Alloy Code - Home
After a turbo-charged 48 hour development period, our contest entry has launched! Keith did an outstanding job on our interface, far exceeding merely doing justice to my application code. Even more impressive, we managed to implement everything we intended, and simplified the app at the same time.
Here’s the short list of features:
- *No* Account Management Required!
- Easy to share private URLs
- Document Version & Status Tracking
- Version specific Comments
I would argue that our greatest success was removing the account management requirement. Most of the Rumble contest sites we’ve viewed so far put the majority of their content behind a login/password screen. A few of the more generous ones support OpenID, a technology I’ve recently come to embrace.
We take pride in being one of the few applications that offers all the benefit of a session-backed user account without any of the account creation/management overhead. Simply provide your name and email address when you upload a document and your account is created for you. If you’ve uploaded additional documents with the same email address, we’ll automatically group them together for you.

Posted almost 3 years back at Railscasts
In this episode you will learn how to add custom routes, make some parameters optional, and add requirements for other parameters.
Posted almost 3 years back at Alloy Code - Home

Well, I’m long overdue for a Rumble update, the past 24 hours have been a whirlwind of activity over at team Redkey. Our application now supports team collaboration, ActionMailer backed email, and some really cool routing stuff that enables us to use the concept of users without the overhead of making those users log in.
Also, don’t forget to check out our Flickr photos. We were fortunate enough to have a guest photographer stop by the morning to take our official team photo, capturing us at our most-rested state in the past day and a half.
Posted almost 3 years back at Mike Mondragon
mms2r version 1.1.8 has been released!
- <http: mms2r.rubyforge.org=""/>
DESCRIPTION:
MMS2R is a library that decodes the parts of an MMS message to disk while
stripping out advertising injected by the cellphone carriers. MMS messages are
multipart email and the carriers often inject branding into these messages. Use
MMS2R if you want to get at the real user generated content from a MMS without
having to deal with the cruft from the carriers.
If MMS2R is not aware of a particular carrier no extra processing is done
to the MMS other than decoding and consolidating its media.
Contact the author to add additional carriers to be processed by the
library. Suggestions and patches appreciated and welcomed!
Corpus of carriers currently processed by MMS2R:
- AT&T => mms.att.net
- AT&T/Cingular => mmode.com
- Cingular => mms.mycingular.com
- Cingular => cingularme.com
- Dobson/Cellular One => mms.dobson.net
- Helio => mms.myhelio.com
- Nextel => messaging.nextel.com
- Orange (Poland) => mmsemail.orange.pl
- Orange (France) => orange.fr
- Sprint => pm.sprint.com
- Sprint => messaging.sprintpcs.com
- T-Mobile => tmomail.net
- Verizon => vzwpix.com
- Verizon => vtext.com
Changes:
1.1.8 / 2007-09-08 (James Grishnack – Head of Behemoth Productions, producer
of Blood Ocean)
- Added support for Orange of France, Orange orange.fr (Julian Biard)
- purge in the process block removed, purge must be called explicitly
after processing to clean up extracted temporary media files.
Posted almost 3 years back at Mike Mondragon
mms2r version 1.1.8 has been released!
- <http://mms2r.rubyforge.org/>
DESCRIPTION:
MMS2R is a library that decodes the parts of an MMS message to disk while
stripping out advertising injected by the cellphone carriers. MMS messages are
multipart email and the carriers often inject branding into these messages. Use
MMS2R if you want to get at the real user generated content from a MMS without
having to deal with the cruft from the carriers.
If MMS2R is not aware of a particular carrier no extra processing is done
to the MMS other than decoding and consolidating its media.
Contact the author to add additional carriers to be processed by the
library. Suggestions and patches appreciated and welcomed!
Corpus of carriers currently processed by MMS2R:
- AT&T => mms.att.net
- AT&T/Cingular => mmode.com
- Cingular => mms.mycingular.com
- Cingular => cingularme.com
- Dobson/Cellular One => mms.dobson.net
- Helio => mms.myhelio.com
- Nextel => messaging.nextel.com
- Orange (Poland) => mmsemail.orange.pl
- Orange (France) => orange.fr
- Sprint => pm.sprint.com
- Sprint => messaging.sprintpcs.com
- T-Mobile => tmomail.net
- Verizon => vzwpix.com
- Verizon => vtext.com
Changes:
1.1.8 / 2007-09-08 (James Grishnack – Head of Behemoth Productions, producer
of Blood Ocean)
- Added support for Orange of France, Orange orange.fr (Julian Biard)
- purge in the process block removed, purge must be called explicitly
after processing to clean up extracted temporary media files.
Posted almost 3 years back at Sporkmonger
So, after 3 months, I’m back from my excursion to Africa. Don’t worry, I’m not coming back empty-handed.
I thought my fellow rubyists might benefit from the URI implementation I’ve been using in various projects, so I’ve extracted it out into its own library. In the process, I improved a few things here and there, added support for URI Templates, and fleshed out the specifications a bit more.
I introduce to you the Addressable library.
It has about a 2:1 spec to code ratio, 100.0% code coverage, and it has gone through plenty of code heckling. It ought to be pretty reliable.
Hope you like it. Let me know how it works.
Update:
I’ve added URI Template variable extraction and I updated the documentation. The extract_mapping method should be useful for template-based routing systems for frameworks.
Posted almost 3 years back at Saaien Tist
Modeling genetics or genomics data presents its own challenges. One of the issues is that the actual definition of things change over time. A database system can only be based on the scientific knowledge at the time of conception. The prime example of course is the definition of a gene over the years. Before 1997, it was believed that the vast majority of these encoded proteins. As a result, 'genes' tables in databases typically had columns to store information on the start and stop codon. However, it became clear that many genes actually do not encode proteins, forcing the remodeling of biological databases. But that's not the topic of this post.
What is the topic here, is how relationships can be stored in a database. Suppose I want to store mapping data: markers mapped to linkage groups, clones mapped to physical maps, ... Markers are stored in a markers table, clones are stored in a clones table, linkage groups in a linkage_groups table; you get the point.
The database that I'm working with at the moment (and only have read-access to), stores the mappings in a mappings table which includes the following columns:
- map_type
- map_name
- mapped_object_type
- mapped_object_name
So records could look like:
map_type map_id map_name mapped_object_type mapped_object_id mapped_object_name
--------------+-------+-------------+-------------------+-----------------+------------------
chromosome 1 chromosome_1 marker 1 marker_A
chromosome 1 chromosome_1 marker 2 marker_B
physical_map 2 ctg1 clone 1 clone_A
physical_map 3 ctg2 clone 2 clone_B
To make things worse, markers can also be mapped to clones. This means that any clone can act as a marker, but also as a map at the same time.
map_type map_id map_name mapped_object_type mapped_object_id mapped_object_name
--------------+-------+-------------+-------------------+-----------------+------------------
clone 1 clone_A marker 1 marker_A
How can I model this in ActiveRecord? There's the concept of
polymorphisms in ruby, which could solve this relationship nightmare if there would be only one thing in the mappings table that's polymorphic. But as it happens, there's
two... Evan Weaver wrote this rails plugin
has_many_polymorphs, which should do the trick (see
here for a tutorial and background if it's unclear what I'm talking about). Unfortunately, as it is focussed on rails and not on ActiveRecord in general, it doesn't handle
namespaces.
So here's what I've come up with:
module MyNameSpace
class Mapping < ActiveRecord::Base
# Relationships to feature-like things
belongs_to :marker, :foreign_key => 'mapped_object_id', :conditions => ["mapped_object_type = 'marker'"]
belongs_to :clone, :foreign_key => 'mapped_object_id', :conditions => ["mapped_object_type = 'clone'"]
# Relationships to map-like things
belongs_to :chromosome, :foreign_key => 'map_id', :conditions => ["map_type = 'chromosome'"]
belongs_to :physical_map, :foreign_key => 'map_id', :conditions => ["map_type = 'physical_map'"]
belongs_to :clone, :foreign_key => 'map_id', :conditions => ["map_type = 'clone'"]
end
class Marker < ActiveRecord::Base
has_many :mappings_as_feature, :class_name => 'Mapping', :foreign_key => 'mapped_object_id', :conditions => "mapped_object_type = 'marker'"
has_many :chromosomes, :through => :mappings_as_feature
has_many :clones, :through => :mappings_as_feature
end
class Chromosome < ActiveRecord::Base
has_many :mappings_as_map, :class_name => 'Mapping', :foreign_key => 'map_id', :conditions => "map_type = 'chromosome'"
has_many :markers, :through => :mappings_as_map
end
class PhysicalMap < ActiveRecord::Base
has_many :mappings_as_map, :class_name => 'Mapping', :foreign_key => 'map_id', :conditions => "map_type = 'physical_map'"
has_many :clones, :through => :mappings_as_map
end
class Clone < ActiveRecord::Base
# Relationships where the clone is the feature
has_many :mappings_as_feature, :class_name => 'Mapping', :foreign_key => 'mapped_object_id', :conditions => "mapped_object_type = 'clone'"
has_many :physical_maps, :through => :mappings_as_feature
# Relationships where the clone is the map
has_many :mappings_as_map, :class_name => 'Mapping', :foreign_key => 'map_id', :conditions => "map_type = 'clone'"
has_many :markers, :through => :mappings_as_map
end
end
The key here is to make the distinguish between mappings_as_feature and mappings_as_map. A marker object can only have mappings where it acts as a feature, while a clone can both have mappings where it acts as a feature and where it acts as a map.
Using this code, it's now possible to do:
clone = Clone.find_by_name('clone_A')
puts clone.mappings_as_map.to_yaml
puts clone.mappings_as_feature.to_yaml
puts clone.markers.to_yaml
puts clone.physical_maps.to_yaml
Voila (until further notice...).
UPDATE: Pratik blogged about has_many_polymorphs and lists the generated associations
here.
Posted about 3 years back at Spejman On Rails
After a long time without publishing anything, I have finished an example of what you can do with festivaltts for Ruby: A Ruby on Rails application that talks!
You can test it at: http://thetalkingrailsapp.sergioespeja.com/
I hope it gives you ideas for your RoR applications!
Posted about 3 years back at Railscasts
Do you ever need to generate HTML code in a helper method? Placing it directly in Ruby strings is not very pretty. Learn a great way to generate HTML through Markaby in this episode.
Posted about 3 years back at The Rails Way - all
Today I’m reviewing Joe Van Dyk’s monkeycharger application, which is a web-service for storing and charging credit cards. I loved looking at this app, because its only interface is a RESTful web service: there is no HTML involved. (If you’ve never written an app that only exposes a web-service UI, you ought to. It’s a blast.)
In general, Joe has done a fantastic job with keeping the controllers slim and moving logic to models. The only significant gripe I had with the application is that it is not ActiveResource compatible.
For those of you that are late to the party, ActiveResource is the newest addition to the Rails family. It lets you declare and consume web-services using an ActiveRecord-like interface…BUT. It is opinionated software, just like the rest of Rails, and makes certain assumptions about the web-services being consumed.
- The service must understand Rails-style REST URLs. (e.g. “POST /credit_cards.xml” to create a credit card, etc.)
- The service must respond with a single XML-serialized object (Rails-style).
- The service must make appropriate use of HTTP status codes (404 if the requested record cannot be found, 422 if any validations fail, etc.).
It’s really not much to ask, and working with ActiveResource (or “ares” as we affectively call it) is a real joy.
However, monkeycharger tends to do things like the following:
1
2
3
4
5
6
7
8
9
10
|
class AuthorizationsController < ApplicationController
def create
@credit_card = Authorizer.prepare_credit_card_for_authorization(params)
transaction_id = Authorizer::authorize!(:amount => params[:amount], :credit_card => @credit_card)
response.headers['X-AuthorizationSuccess'] = true
render :text => transaction_id
rescue AuthorizationError => e
render :text => e.message
end
end |
Three things: the request is not representing an “authorization” object, the response is not XML, and errors are not employing HTTP status codes to indicate failure.
Fortunately, this is all really, really easy to fix. First, you need (for this specific example) an Authorization model (to encapsulate both the the XML serialization and the actual authorization).
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
class Authorization
attr_reader :attributes
def initialize(attributes)
@attributes = attributes
end
def credit_card
@credit_card ||= Authorizer.prepare_credit_card_for_authorization(attributes)
end
def authorize!
@transaction_id = Authorizer.authorize!(:amount => attributes[:amount],
:credit_card => credit_card)
end
def to_xml
{ :transaction_id => @transaction_id }.to_xml(:root => "authorization")
end
end |
Then, we rework the AuthorizationsController to use the model:
1
2
3
4
5
6
7
8
|
class AuthorizationsController < ApplicationController
def create
authorization = Authorization.new(params[:authorization])
authorization.authorize!
render :xml => authorization.to_xml, :status => :created
rescue AuthorizationError => e
render :xml => "<errors><error>#{e.message}</error></errors>", :status => :unprocessable_entity
end |
(Note the use of the “created” status, which is HTTP status code 201. Other verbs just use “ok”, status code 200, to indicate success. Also, with an error, we return an “unprocessable_entity” status, which is HTTP status code 422. ActiveResource will treat that as a failed validation.)
With that change, you could now use ActiveResource to authorize a credit card transaction:
1
2
3
4
5
6
7
8
9
10
11
12
|
class Authorization < ActiveResource::Base
self.site = "http://my.monkeycharger.site"
end
auth = Authorization.new(:amount => 15, :credit_card_id => 1234,
:remote_key => remote_key_for_card)
if auth.save
puts "success: #{auth.transaction_id}"
else
puts "error: #{auth.errors.full_messages.to_sentence}"
end |
It should be mentioned, too, that making an app ActiveResource-compatible does nothing to harm compatibility with non-ActiveResource clients. Everything is XML, both ways, with HTTP status codes being used to report whether a request succeeded or not. Win-win!
Obviously, real, working code trumps theoretical whiteboard sketches every time, and Joe is to be congratulated on what’s done. Even though ActiveResource-compatibility can buy you a lot, you should always evaluate whether you really need it and implement accordingly.
Posted about 3 years back at Luke Redpath - Home
I don’t usually post this kind of thing on my blog but when somebody experiences a level of customer service that seems to be so lacking these days, one feels the need to shout about it.
I’ve been hosting this blog on RimuHosting for about a year now – a basic 160MB VPS setup running nginx and one mongrel to power this blog and lighty on my second IP for PHP apps (like Mint Stats and RoundCube Webmail. The VPS also acts as a home to my mail and Subversion repositories.
In all the time I’ve been with RimuHosting I’ve experienced good uptime with problems being sorted out quickly and efficiently. I’ve not had much need to trouble their support team but having just purchased a shiny copy of Warehouse I needed some more RAM to handle a second mongrel instance. I submitted a support ticket asking for a quote, indicating that if it should cost less than an extra $10 a month that they should proceed.
In the time it took me to purchase and download a copy of Warehouse, scp it to my server and untar the thing, my VPS was restarting with its extra memory. All in all, about 5 minutes from the time I submitted my ticket. On a holiday weekend. On a Sunday. That is true customer service.
So, if you are in the market for a personal geek-friendly VPS at a decent price with great support then consider this an obligatory plug for RimuHosting. Tell ’em Luke sent ya!
Update: Warehouse is now up and running.
Posted about 3 years back at Shane's Brain Extension

I’m pleased to announce the launch of MyFitBuddy.com, a workout tracking tool with social networking features. It allows you to log your workouts at the gym, sports training, your run in the park, or any other type of physical activity, and see the improvement over time. You can add your workout buddies as friends, and keep in touch with their workouts as well.
I mainly built this site for myself, as I wanted a super simple way to keep a record of my workouts and see graphs of my improvement. I thought it would be a great idea for a social site, as many studies have shown that people exercise more when they have a workout buddy or do it as part of a group. In MyFitBuddy.com, you will be motivated to exercise by seeing the activity of your friends and others on the site.
Some of the other interesting features on the site include user generated exercise information from Wikipedia, and videos of exercise form from YouTube. Soon I’ll be adding weight and calorie tracking, as well as the ability to SMS text in your workouts from your mobile phone. The site is currently completely free to use.
Give it a spin and help me knock off some bugs. I’d love to hear feedback and any suggestions.
Update: KillerStarups, a sort of digg for startups, is the first to review MyFitBuddy.com. If you are in a generous mood, please vote for it.