Photo-1 Photo-2 Photo-3 Photo-4 Photo-5 Photo-6

@brentmc79

@brentmc79

Full-time web developer. Part-time smart ass.

I'm Brent Collier.

After a year and a half as an engineer on Twitter's Trust & Safety team, I'm looking for my next gig. Contact me if you know of something interesting.

#

Having trouble updating rails?

Posted on 06/18/2008

I was setting up the AAB dev environment on my macbook pro when I realized that I was only running Rails 2.0.2 but AAB wanted 2.1.0.  Ehh...  no big deal I thought.  I opened up Terminal and typed...

$ sudo gem update rails

All the usual output scrolled by, indicating that everything went as expected.  Once it was done I tried to check the rails version and that's when I realized that there was a problem

$ rails -v
/Library/Ruby/Site/1.8/rubygems.rb:377:in `report_activate_error':
RubyGem version error: activesupport(2.0.2 not = 2.1.0) (Gem::LoadError)
from /Library/Ruby/Site/1.8/rubygems.rb:309:in `activate'
from /Library/Ruby/Site/1.8/rubygems.rb:335:in `activate'
from /Library/Ruby/Site/1.8/rubygems.rb:334:in `each'
from /Library/Ruby/Site/1.8/rubygems.rb:334:in `activate'
from /Library/Ruby/Site/1.8/rubygems.rb:76:in
`active_gem_with_options'
from /Library/Ruby/Site/1.8/rubygems.rb:50:in `gem'
from /Library/Ruby/bin/rails:15

So then I ran 'gem list' and saw what was up.

...
actionmailer (2.0.2, 1.3.6, 1.3.3, 1.2.5)
actionpack (2.0.2, 1.13.6, 1.13.3)
actionwebservice (1.2.6, 1.2.3, 1.1.6)
activemerchant (1.1.0)
activerecord (2.0.2, 1.15.6, 1.15.3)
activeresource (2.0.2)
activesupport (2.0.2, 1.4.4, 1.4.2)
...

When I did the rails update, none of the rails dependencies were updated.  I tried the update again, thinking that maybe something had just choked in the process, but it was no luck.  A quick Google search yielded the solution of using update with the --source option and http://gems.rubyonrails.org as the URL.

$ sudo gem update --source http://gems.rubyonrails.org
Updating installed gems
Updating metadata for 13 gems from http://gems.rubyonrails.org/
.............
complete
Updating actionmailer
Updating metadata for 13 gems from http://gems.rubyonrails.org/
.............
complete
Successfully installed activesupport-2.1.0
Successfully installed actionpack-2.1.0
Successfully installed actionmailer-2.1.0
Updating activerecord
Successfully installed activesupport-2.1.0
Successfully installed actionpack-2.1.0
Successfully installed actionmailer-2.1.0
Successfully installed activerecord-2.1.0
Updating activeresource
Successfully installed activesupport-2.1.0
Successfully installed actionpack-2.1.0
Successfully installed actionmailer-2.1.0
Successfully installed activerecord-2.1.0
Successfully installed activeresource-2.1.0
Gems updated: activesupport, actionpack, actionmailer, activesupport, actionpack, actionmailer, activerecord, activesupport, actionpack, actionmailer, activerecord, activeresource

That did it! Now rails and all its dependencies are at 2.1.0.

#

my first hiccup

Posted on 06/04/2008

So I mentioned earlier that I was using Capistrano 2.0.  Well, in actuality, I was using version 2.3.0.  Why's this important?  Well, I'll tell ya....

On my initial deploy:

cap deploy:cold

...everything went fine.  Capistrano did a clone of my Github repo, ran all of my migrations, and started up the mongrels without a hitch.  It was on my subsequent deploy that I had a problem.

macbook:blog brent$ cap deploy
  * executing `deploy'
  * executing `deploy:update'
 ** transaction: start
  * executing `deploy:update_code'
    updating the cached checkout on all servers
ssh_exchange_identification: Connection closed by remote host
fatal: The remote end hung up unexpectedly
*** [deploy:update_code] rolling back
  * executing "rm -rf /home/brent/public_html/acts-as-blogr.com/releases/20080604051355; true"
    servers: ["acts-as-blogr.com"]
    [acts-as-blogr.com] executing command
    command finished
/Library/Ruby/Gems/1.8/gems/capistrano-2.3.0/lib/capistrano/recipes/deploy/scm/git.rb:217:in `query_revision': Unable to resolve revision for master (RuntimeError)
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.3.0/lib/capistrano/recipes/deploy/scm/base.rb:35:in `send'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.3.0/lib/capistrano/recipes/deploy/scm/base.rb:35:in `method_missing'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.3.0/lib/capistrano/recipes/deploy/scm/base.rb:63:in `local'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.3.0/lib/capistrano/recipes/deploy/scm/base.rb:35:in `method_missing'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.3.0/lib/capistrano/recipes/deploy.rb:37:in `load'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.3.0/lib/capistrano/configuration/variables.rb:87:in `call'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.3.0/lib/capistrano/configuration/variables.rb:87:in `fetch'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.3.0/lib/capistrano/configuration/variables.rb:110:in `protect'
     ... 35 levels...
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.3.0/lib/capistrano/cli/execute.rb:14:in `execute'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.3.0/bin/cap:4
    from /usr/bin/cap:19:in `load'
    from /usr/bin/cap:19

I tried again and got the same results.  After a quick google or two, I found this Lighthouse ticket for Capistrano. Evidently there's an issue with cap version 2.3.0 in which it calls 'fetch --tags' to update your code, which returns only tag commits instead of all commits.  This is a problem.

Fortunately, the solution is a simple as either downgrading to version 2.2.0, or upgrading to the latest build.  I opted for the safe route and installed 2.2.0.  Now everything is right as rain. 

#

Git really 'gits' around...

Posted on 04/06/2008

I said 'gits' instead of 'gets'.  Get it?  Or should I say 'Git it'?  Ok, enough bad jokes...

If you're reading this, I'm sure you're aware of Git.  (Or you're a relative of mine, and you're still wondering what 'acts-as-blogr' means...)  If you're not, then climb out from under your rock, point your browser to the Git homepage, and start reading

Git is the latest trend in version control.  All the cool(aid) kids are drinking it, I mean using it.  Lately, it seems as though on every blog I read, and at every meet I attend, someone's preaching about Git.  See my little psuedo-rant here.  Since I'm not usually an early adopter, I usually wait a little while before picking up some new (or recently popular) technology.  Well, it looks like that time has come.

I started a new project last week and didn't like that my Subversion repo was on the same box as the app.  If something were to happen to that machine, I'd lose everything.  I looked around at several SVN hosting sites, but nothing really tickled my fancy.  I had a Github account which I hadn't taken advantage of yet, so I figured why not make the switch over to Git.

Funny thing was, just the day before I was bustin Brendan's balls for preaching about Git, telling him he was 'drinkin the kool-aid'.  To be honest though, I don't think anyone that does Rails development for a living can say anything about drinking the kool-aid.  Hell, we're swimming in it...

So, I've been using Git for a couple of days now and the transition hasn't been too painful.  I had a few small issues, like where I couldn't push to the master repo due to some config issue, and when I had forgotten to setup my public key on Github.  Aside from that, the only real trouble is getting used to the different terminology.

I definitely like the speed and ease in which you can create branches with Git.  I attempt a lot of different things with my blog, most of which never get deployed, and its nice to be able to easily create a branch and experiment without worrying about hosing the code in Trunk.

Anyway, enough about me...

Picture_2

So, I noticed that Heroku has added Git integration.  Check out the demo here.  I've played with Heroku for a while, and I must say that I really like it.  I do very little development via their interface, but its really nice to have a way to quickly deploy an app and have it publicly available with virtually no hassle involved.  Currently, Heroku acts as a staging server for a couple of personal projects that I'm working on.  If you haven't tried it out yet, you should definitely do so.

Picture_3

There's also Lighthouse, a ticket-tracking and project management app written in Rails. While it doesn't currently support Git integration, from what I hear, they're planning to with the 2.0 release.  I haven't used Lighthouse much yet, but I know of some projects that recently made the move from Unfuddle over to Lighthouse in anticipation of the Git integration.

It looks like Git is taking over, and for good reason.  So, if you're like me and you have some aversion to jumping on the bandwagon, then get over yourself and go give it a try.  You just might enjoy the ride...

#

Firefox 3 Beta 4

Posted on 03/13/2008

If you're using a beta release of Firefox 3, the 4th beta version was just recently released.  I've been using the beta 3 version for a couple of weeks now and I've been fairly happy with it, aside from a few little bugs here and there.  I just noticed that the beta 4 version had been released, so I downloaded and installed it a couple of days ago.  There were two immediately noticeable differences...

First, beta 4 is blazing fast compared to beta 3.  I use iGoogle as my homepage and it loads sooo much quicker with beta 4.

Second, they added this jumbo back button, which you can see here...

 Picture_3

This is no bueno in my book.  It causes the entire address bar to expand, wasting valueable space.  Fortunately, I looked in the customize toolbar menu, and there's a checkbox for using small icons...

 Picture_4_big

Once checked, the jumbo back button reverts to a more acceptable size, like so...

 Picture_5

So, if you haven't already, go here and download the latest beta release...