Posted by chad
on February 09, 2010
Tango Rails esta juntando para tomar unas cervezas y charlar sobre Ruby on Rails, Sinatra y mas… Es un after muy informal y bueno para conocer gente jugando con las mismas tecnologías.
Tango Rails is meeting for some drinks and to chat about Ruby on Rails, Sinatra or other interesting things happening with web frameworks and Ruby these days. It’s a very informal after office and a great place to meet people in person working on interesting projects.
Link to the Facebook Invite
Posted by chad
on June 17, 2009
Here’s how I did it:
mysqldump -uroot -p rubyrescue | sed
's#rubyrescue.com#rubyrescue.com/blog#g' > temp.sql
mysql -uroot -p rubyrescue < temp.sql
The only other item was dealing with permalinks. The error handler for lighttpd was set to look for index.php in the root. I had to change that to look for it in /blog.
Posted by chad
on May 07, 2009
this article nicely summarizes how great heroku is. i deployed a small personal project with it and LOVE how easy it was. incredible.
One concern i have is that without a static IP address, if you have a highly SEO-sensitive application it’s probably not the best choice, because a static IP is just one of many factors in your pagerank, but an important one.
Posted by chad
on March 24, 2009
In attempting to upgrade a Bort app with Rails 2.3.2, i’ve found two errors so far:
1. This OpenIdAuthentication error:
rake aborted!
uninitialized constant Rails::Plugin::OpenIdAuthentication
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:105:in `const_missing'
/home/chadd/foo/vendor/plugins/open_id_authentication/init.rb:16:in `evaluate_init_rb'
The solution is to comment out line 16 in vendor/plugins/open_id_authentication/init.rb when running rake db:migrate.
Updated: Better solution in the comments, thanks!
chadd@ubuntu:~/foo$ rake db:migrate --trace
(in /home/chadd/foo)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
== BortMigration: migrating ==================================================
-- create_table(:sessions)
-> 0.0017s
-- add_index(:sessions, :session_id)
-> 0.0004s
-- add_index(:sessions, :updated_at)
-> 0.0003s
-- create_table(:open_id_authentication_associations, {:force=>true})
-> 0.0021s
-- create_table(:open_id_authentication_nonces, {:force=>true})
-> 0.0016s
-- create_table(:users)
-> 0.0027s
-- add_index(:users, :login, {:unique=>true})
-> 0.0006s
-- create_table(:passwords)
-> 0.0017s
-- create_table(:roles)
-> 0.0007s
-- create_table(:roles_users, {:id=>false})
-> 0.0007s
== BortMigration: migrated (0.5497s) =========================================
** Invoke db:schema:dump (first_time)
** Invoke environment
** Execute db:schema:dump
chadd@ubuntu:~/foo$
2. application.rb was renamed to application_controller.rb in Rails 2.3 and if you don’t rename it you get this error:
Loading development environment (Rails 2.3.2)
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:443:in `load_missing_constant':NameError: uninitialized constant ApplicationController
Posted by chad
on March 22, 2009
The twitter gem doesn’t do a good job of allowing unauthenticated queries, so I have to make a specific request to the twitter API to do this.
If you pass in Scrap.friendsandfollowers(‘rubyrescue’) you’ll get about 6000 ids. Anything better than a depth of ‘1′ and you’ll need an un-rate-limited account w/Twitter as it will take more than 100 requests and they limit requests to 100/hour.
require 'twitter'
require 'net/http'
require 'json'
class Scrap
def self.friendsandfollowers(users,depth=0,type = :all)
users = [users] unless users.is_a?(Array)
puts "at level #{depth}"
newusers = []
[:friends,:followers].each do |t|
if [:all,t].include?(type)
users.each() do |u|
puts "looking for #{t.to_s.pluralize} of #{u}"
newusers += JSON.parse(Net::HTTP.get(URI.parse("http://twitter.com/#{t}/ids/#{u}.json")))
end
end
end
newusers.uniq!
if depth == 0
return newusers
else
newusers.each() do |u|
users += self.friendsandfollowers(u,depth-1,type)
end
return users.uniq
end
end
end
Posted by chad
on March 10, 2009
http://locosxrails.com

I’m going… Anyone from Brazil other than Akita On Rails?
Posted by chad
on December 20, 2008
A skeleton (but functional) ruby gem that allows manipulation of a WordPress database from rails, using activerecord. WordPress on Rails
Posted by chad
on December 05, 2008
Poolparty.rb is a very promising ec2 management tool. But it’s down right now. (see below) Based on the documentation, poolparty is self-hosting, which is not an advertisement for relying on ec2 as the primary tool to host a site. As reserve capacity it makes sense, but when it’s the only server, it seems expensive and not necessarily reliable. We use ec2 instances for a number of tasks, mostly for data processing, but the unreliability of using a cloud in this way is related to the immaturity of the toolset to manage the cloud. While the instances are an incredible time savings over provisioning and maintaining the physical hardware, I’m finding that I underestimate the time needed to build and manage the tools to manage the cloud. As tools like poolparty improve, i’m sure this will go down, but it’s significant at this point.
Note: downforeveryoneorjustme.com says it’s not even a site on the internet. This is probably related to the way DNS is managed for the site, which is exactly my point. Odds are the instances are running just fine.
Posted by chad
on December 01, 2008
You never know when you’ll get photographed with 10 beer cans in front of you.
Posted by chad
on October 20, 2008
Dave Thomas has a great list of one-liners that are handy for command line jobs in ruby. Today I needed to setup a cron job to find all backup files that match a specific regular expression and delete them when they are 15 days old. Here’s the way I did it (yes some versions of find can do pretty much the same thing but the version that is on the RedHat server i’m using doesn’t seem to do what I want).
find | sort | ruby -pe 'next unless $_ =~ /MYFILTER/; f=$_.gsub(/n/,"");next unless File.mtime(f) < Time.now - 24*60*60*10;File.delete(f) '