Archive for the ‘Ruby on Rails’ Category

Edge Rails: Now With a Built-in XML Sit-ups Ab Machine!

Friday, June 30th, 2006

There’s a lot of innovation still happening in Ruby on Rails.


Rails' New XML Sit-ups Ab Machine

Edge Rails: Now with a Built-in XML Sit-ups Ab Machine!

See this post for some of the things in store for the next major release of Ruby on Rails.

This commenter made a funny XML Sit-ups reference in relation to one of the new features of edge rails:

does the Hash.create_from_xml method mean that Rails does XML sit-ups now?

j/k :) Seriously, this is great.

When it comes time to implement an API in your Ruby on Rails app, well. it already *was* pretty darn easy to do so.

Rails Core & all of the RoR committers just keep making it simpler and simpler to do all this stuff that used to be considered fancy, but is now almost the de facto standard for webapps these days.

Implementing a Billing System in Ruby on Rails vs. ASP

Tuesday, June 13th, 2006

Note: this was written a while back but was sitting in my drafts section. Worth a read if you are coming from a Microsoft background at all.

About two years ago, I implemented a billing system in ASP and SQL Server. It took about a month and a half to get fully flushed out.

Even so, we still experienced intermittent problems with it that drove our salespeople batty. (we could never replicate the problem in-house, since we didn’t have a test lab)

The requirements were, however, different, since we needed to charge cards in real-time in the ASP scenario.

With Sprout, though we might at some point need to do that for certain things (i.e. re-enabling locked, past-due accounts), we generally have the luxury of billing people as needed. (on the backend, at a time of our choosing)

Billing Systems on Rails

The system we just knocked out at Sprout took only about a week. Though, Charles had been working on the requirements for quite some time.

Requirements really do help us programmers. That way I don’t have to idle on IM, asking my manager every 5 minutes about some minutiae of how the system should be implemented.

Yeah - you can always plow ahead and just do things your way… but once you’ve been burned too many times from just doing that, you tend to seek out a little more guidance in the future.

Our system at SproutIt is also a lot more robust than my previous ASP endeavor. Our Sprout system includes a really robust notification system that includes:

- three days worth of charge failed notices
- three days worth of no card present notices
- Activation reminders (signed up for a paid plan, but haven’t entered a card yet, etc)

Hopefully we won’t have to send too many of these various types of notices… but it helps to be prepared.

Rails Productivity Numbers Legit?

Much has been bantied about re: productivity and rails (10x productivity boost, oh my!). Let me just say that I think a 10x number is pure hogwash.

However, even if it were only a 50% increase … that would be incredible. Can you imagine going to a decent manager and explaining that you can get 50% more done if you just use X technology? They would be crazy to ignore that possibility.

In all reality though, I think the number hovers somewhere between 1.5 and 3. That is, you can sometimes get things done in Rails that it would take you three weeks in PHP, or ASP.Net, for example.

Now, Rails productivity vs. Java/J2EE? You’re probably 4-6X as productive in Rails compared to such a bloated monstrosity as J2EE.

(Re)Introducing Search in Mailroom; Ferret in Ruby on Rails

Friday, June 2nd, 2006

Well, we finally completed the new Ferret Search Engine indexing system for Mailroom.

Ferret

We’re now using Ferret to index anywhere between 150,000 and 200,000 Mailroom messages, growing by thousands more daily.

There were a few hiccups along the way. Very few, caused by Ferret itself. Some, by yours truly. Since I’ve only been coding in Ruby/Rails for a few months, luckily I still have that as an excuse. A few more months of doing this full-time and I’ll have nothing to fall back on when I get stuck on a silly problem!

Benefits of Pair/Team Programming

But more and more, I’m realizing how handy pair/team programming can be. Often-times, showstoppers tend to be solved by a simple solution — having another set of eyes looking at the problem.

I.e. the other day there was a majorly annoying JavaScript bug in some new (not deployed yet) Mailroom development code, which brought our new dev efforts to a halt briefly. (if it doesn’t work in IE6, you better bet we won’t be releasing it anytime soon!)

Safari

Charles & Co. use Safari as their default browser, which fortunately has an optional plugin called Safari Enhancer.

So while IE6 was reporting that the problem was simply a “undefined Ojbect” or something similarly useless, Safari Enhancer with its JavaScript console pointed me to the exact line of the problem.

Turns out, it was an extraneous comma in a function list, which Firefox was not complaining about, but ended up borking IE6 and Safari in nearly the same way.

Dump and Slurp YAML Data in Rails

Thursday, June 1st, 2006

Topfunky wrote an awesome plugin that allows you to dump and slurp (or, import) YAML data between databases.

This is handy if you have things like a production server & staging server and need to transfer a few records (or whole tables in this case) across the wire.

Another OS X Updated Killed my Symbolic Ruby 1.8.4 Link

Wednesday, May 24th, 2006

Just had to go through these steps again.

Anyone know of a permanent solution? OS X update doesn’t seem to like my symoblic Ruby 1.8.4 link.

Making Peace with JavaScript and Prototype

Tuesday, May 16th, 2006

I just rocked out some sweet ass JavaScript/Prototype/RJS code for Mailroom. I won’t spoil the surprise by announcing what it does, because we can probably make a nice todo out of it on the Big Act.

It took some time for me to make friends with JavaScript. It always seemed like a hackish, backwards kind of language.

But between Prototype, Rails’ RJS Templates and a little good-ol fashioned JavaScript, you can accomplish miracles. (But, I probably shouldn’t speak too soon… We need to put some polish on the hacks I just wrote.)

LightWeight Modeling in Java

Thursday, April 27th, 2006

A friend who’s attending the php|tek conference said there was a bit of Ruby bashing going on. Of course, he reports as well, Java is feeling a much bigger brunt of the heat.

I’ve decided to officially stop saying negative things about my fellow Java/J2EE brethren.

Seeing articles like this, make me realize that saying bad things about Java/J2EE, is like kicking a defenseless puppy while he’s down.

It just isn’t right, and chances are, the usage of Java in many enterprise shops was carved in stone some 3-5 odd years ago after a middle-manager read about its cross-platform benefits in a Delta Airlines in-flight magazine. (oops, there I go again!! my bad…)

I’m just sorry, guys. Sorry.


You may say that I’m a dreamer
But I’m not the only one
I hope someday you’ll join us
And the world will be as one

- John Lennon, Imagine

JavaScript / Selenium Testing in Ruby on Rails

Thursday, April 13th, 2006

My buddy Gabriel links to JTF — JavaScript unit Testing Farm.

How does it work? From the site:

You write your javascript and insert some code to indicate a failure (or a pass) using the same functions as in JsUnit and other unit testing frameworks. Then, every time a visitor views your test case, it performs the unit test on their browser… providing information if the test fails.

Sounds like a novel idea.

Over at Sprout we now have a suite of Selenium JavaScript-based acceptance tests.

It was a little tricky, but our Selenium tests for Mailroom now pass in the following browsers:
- IE6 on XP
- Firefox on XP
- Firefox on OS X
- Safari on OS X

The first thing Charles asked me was… if we already have Unit & Functional tests already, why do we need Selenium ones too?

Granted, Selenium tests are not necessary for a small startup. But at previous employers, full-time Testers have been employed whose sole job was to:
- sit around for 4-5 days a week (waiting for a new release)
- if the developers happened to have a new release ready by Friday, the Testers would jump into action and earn their $37k a year in one afternoon per week.

Many lessons can be learned from this anecdote, but one is: hire someone who can automate away his or her own job in a few weeks and move onto things that cannot be automated.

Writing Selenium Tests in Rails

Often I feel the urge to simply create a new Selenium test for a new feature that we implement. There’s nothing like a full UI-based end-to-end test to see if something is functioning properly. (this could just be a psychological phenomena)

But, we also add Unit & Functional tests, and then sometimes maybe Selenium tests. That’s some pretty good code coverage. :)

Selenium on Rails Links

Selenium on Rails Plugin (Recommended)

Automate Acceptance Tests with Selenium

There is an alternative Selenium on Rails plugin floating around that comes up a lot higher in Google searches.

It’s sad because the devs on this other plugin did a tremendous job at marketing (and developing) their plugin, but I am not as impressed with it as the one mentioned above. Here’s a link, which includes a nice screencast:
Selenium on Rails Plugin

Screencasts are the *ultimate* linkbait! I needs to make me some of dem!

OS X Update Killed My Rails!

Tuesday, April 4th, 2006

I thought this was a problem only associated with Microsoft updates! Apparently not!

If you compiled Ruby from source, following instructions from this Hivelogic tutorial, the latest OS X Tiger update may have killed your symbolic link to Ruby 1.8.4.

(This assumes you had installed Ruby 1.8.4 to /usr/local and had symbolically linked to this binary from /usr/bin/ruby)

Simple enough solution though:

cd /usr/bin
sudo mv ruby ruby.back
sudo ln -s /usr/local/bin/ruby /usr/bin/ruby

Now try a “ruby -v” and you should see 1.8.4 as the version.

(In defense of OS X — at least I’m not rebooting into 8bit, 16color 800×600 resolution on my 20″ flatscreen, as has happened w/ MS updates before.)

Rails 1.1 and RJS Templates for Easily Ajaxifying your Webapp

Friday, March 31st, 2006

Rails 1.1 has arrived!

RJS is a templating language that allows you to write JavaScript in a native Ruby style.

Some Good RJS Links

Cody Fauser's Intro to Rails' RJS
More on RJS and some of its advanced features
Rails JavaScript Generator Methods

Now, here's an absolute Must-Have RJS Debugging Snippet to drop into your rhtml page when you're playing around with this stuff:

RUBY:
  1. <div id="debug">
  2. </div>
  3. <script type="text/javascript">
  4.     Ajax.Responders.register({
  5.     // log the beginning of the requests
  6.     onCreate: function(request, transport) {
  7.     new Insertion.Bottom('debug', '<p><strong>[' + new Date().toString() + '] accessing ' + request.url + '</strong></p>')
  8.     },
  9.    
  10.     // log the completion of the requests
  11.     onComplete: function(request, transport) {
  12.     new Insertion.Bottom('debug',
  13.     '<p><strong>http status: ' + transport.status + '</strong></p>' +
  14.     '<pre>' + transport.responseText.escapeHTML() + '</pre>')
  15.     }
  16.     });
  17. </script>

(via techno-weenie)


You are currently browsing the Shanti's Dispatches weblog archives for the 'Ruby on Rails' category.

Shanti A. Braford blogs here.

If you really want to know, just read this.



  

Powered by FeedBlitz