Archive for the ‘Ruby on Rails’ Category

iPhone development the easy way

Wednesday, July 8th, 2009

iphone I’ve been doing some iPhone and iPod Touch development and if like me you’re used to web development in languages like Ruby, Java, and Python, the learning curve to build a native iPhone app in Objective C is quite steep. Since my applications are online (in that you need to be connected for them to be useful) I was pysched to find a much easier way using two great open-source tools:

iUI consists of Javascript/CSS/images that allow you to build a mobile version of your app that looks and feels just like a native iPhone app

PhoneGap lets you create an iPhone application (that can be submitted to the app store) that displays a framed mobile version of your site

To build your iPhone app: (more…)

Standalone Migrations: Using Rails migrations in non Rails projects

Monday, December 22nd, 2008

Update 7/8/2009: With the latest batch of user submitted patches standalone migrations now works just like Rails migrations
Update 12/26/2008: I switched standalone migrations to use a Rakefile instead of a Ruby script.

Standalone MigrationsIn my work managing websites I end up working in Ruby, Java, and PHP. In everything but Rails managing the schema requires rolling your own solution. As a result I’ve started using Rails migrations in non-Rails projects to manage the schema. It’s not much code but I figured others might benefit from it so I created a little Github project called standalone migrations.

It’s based on Lincoln Stoll’s blog post titled Stand-alone ActiveRecord migrations and David Welton’s blog post titled Using Migrations Outside of Rails.

Assuming you have Ruby and Gem installed on your machine, here’s how to use it:

gem install -y activerecord rake mysql
wget http://github.com/thuss/standalone-migrations/zipball/master (or fetch it using git)
unzip it, and mv to something like my_non_rails_project/db
cd my_non_rails_project/db/ (or wherever you put it)
cp config/database_sample.yml config/database.yml
vi config/database.yml
./new_migration some_user_story
vi migrations/*_some_user_story.rb
rake db:migrate (this applies your newly created migration)

Bay Area Indie Rock Bandega Style

Tuesday, March 13th, 2007

My good friends in the east bay have just debuted their new Ruby on Rails based site Bandega :: never miss a show again! If you’re a San Francisco Bay Area resident that loves indie rock and wants to keep track of your favorite bands swing by Bandega and check them out!

Search Engine Friendly URLs with Ruby on Rails

Sunday, February 4th, 2007

Update 2/5/07: I’ve since discovered five plugins that address this very problem with slightly different approaches (the latter two store a permalink in the table, good for mutable titles):

Obie’s recent post on search engine friendly URL’s in Ruby on Rails 1.2 and greater couldn’t have been more timely. I was about to tackle search engine friendly URL’s on my little local san francisco bay area boating classifieds site and after reading his blog post, 15 minutes later it was done. Here’s the old URL structure:
(more…)

Ruby on Rails Dreamhost plugin

Friday, February 2nd, 2007

Update 2/11/07: Just to clarify, this plugin won’t keep your Rails site running on Dreamhost if the sum of all your running processes exceeds 200MB (which is when their process monitor kills your processes). Run ps aux and sum the VSZ column and then divide by 1024. If you’re pushing the limit and are only running one Rails site you may want to look at another provider. If you’re running multiple Rails sites, run each site under a different user (one account can create many users).

Per Thomas Aylott’s suggestion on my previous post Keeping Rails Running at Dreamhost Part 2 I’ve decided to release my Dreamhost signal handling code as a Rails plugin. I’m using it on a Rails 1.2.1 site and a Rails 1.1.6 site.
(more…)

Keeping Rails running at Dreamhost Part 2

Wednesday, January 24th, 2007

Update 2/2/07: Per Thomas’ comment I’ve released the code below as the dreamhost rails plugin.
Update 1/25/07: People have reported difficulties copy and pasting the dispatch.fcgi source code from this blog post so here is a dispatch.fcgi to download. Make sure you make it executable!

My first attempt to keep my Ruby on Rails sites running at Dreamhost involved modifying dispatch.fcgi to implement the frao_handler approach as described on the wiki. This left me with a 3% 500 error rate. Ughh!
(more…)

Switching from Edge Rails to 1.2 stable with Piston

Wednesday, January 24th, 2007

Update 1/25/07: Francois pointed out that now as of Piston 1.3.0 you can now do this all with the following command:

piston switch http://dev.rubyonrails.org/svn/rails/tags/rel_1-2-1 vendor/rails

For starters, if you’re still using svn:externals to manage your vendor/rails directory it’s time to switch to using Piston. svn:externals is so Q4!
(more…)

Keeping Ruby on Rails running at Dreamhost

Tuesday, January 9th, 2007

Update 1/12/07: This solution has reduced my 500 error rate down to less than 0.2% but it’s still not perfect. I continue to plug away at this…

Update 1/24/07: I’ve finally solved my Dreamhost 500 error problems with a different solution described in Keeping Rails running at Dreamhost part 2

This weekend I moved two of my newer Ruby on Rails based sites (http://windandtides.com and http://gearandboats.com) over to Dreamhost. You simply can’t beat their prices for hosting a small site (if you prepay for 2 years and use coupon code GABRITO to save $50 the total is $140.80) and I’ve found their customer service to be pretty responsive too.
(more…)

The Rails Way delivers the goods

Monday, December 18th, 2006

I had a piece of data import code in Wind and Tides that I just knew could be cleaner and more elegant. Last week I submitted it to Jamis and Michael who write the Rails Way blog and their refactoring of it exceeded my expectations and taught me a thing or two in the process. Their blog is definitely worth a read if you’re trying to take your rails coding to the next level!

Hello Newshutch, goodbye Bloglines

Monday, December 4th, 2006

I’ve been a Bloglines user for a long time. However, after hearing about Newshutch on the Web 2.0 show podcast Episode 26 I’ve made the switch and couldn’t be happier. It sports just the right amount of Ajax, good keyboard shortcuts, and it’s built with Ruby on Rails. In short it’s by far the best web based RSS reader out there, check it out!