broken pipe error with aptana

5 03 2010

I work on a Mac with Aptana. Sometimes Aptana crashes and then, after restarting it, it shows this error when I try to access my application:Broken pipe error for webrick

Errno::EPIPE in Site#home

Showing layouts/_banner_headers.html.erb where line #11 raised:

Broken pipe

The line doesn’t matter. The problem is that Webrick continues to run even after restarting Aptana. So, when you go to http://localhost:3038/ it is actually accessing a ‘zombie‘ Webrick. Not the one you last launched.

Here is the solution:

1. Fire up a Terminal

2. [etagwerker@gesell trunk]$ ps aux | grep ruby

etagwerker 22930   0.2  2.0   165156  84312   ??  S     2:53PM   0:48.88 /usr/local/bin/ruby -e p(Process.pid.to_s) -e load(ARGV.shift) -I … etc…

The first number is the PID

3. Kill the zombie process

[etagwerker@gesell trunk]$ kill -9 22930

4. Restart your Aptana.
That’s it. You should be able to continue using Aptana.


the topsy ruby gem (rtopsy version 2.0)

28 01 2010

The other day I was browsing through open source projects on GitHub and I found the topsy gem. (A gem is a ruby library that can be used for a certain purpose)

Initially, I was upset. It was a new gem for something that I had built more than one month ago. I thought that the programmer behind it (Wynn Netherland) should have collaborated with my existing gem: rtopsy.

After reviewing his code, I realized that he had developed a better version of my gem. So I decided that it was an opportunity to learn more about Ruby, gems and APIs.

I reached out to Wynn (via Twitter) and we decided to collaborate on the topsy gem. I added some ‘business objects’ to the gem. He added some logic for the rate limit status info. I added more documentation and examples. We worked through tests together.

The end result: A more stable version of the Topsy API Ruby gem. In the process, I learned a lot about testing code with fakeweb.



how to setup rsync with cron

14 12 2009

I just built an environment which a few servers that requires rsync to keep a directory synchronized among servers.

Here are the steps.

1. On every server install rsync:

sudo yum install rsync

2. Generate an ssh key pair to be used only for rsync among servers

With Mac, it’s as simple as:

ssh-keygen -t rsa

Make sure no password is associated with the SSH keypair

3. Add the keypair for my rsync runner user

Place id_rsa in /home/runner/.ssh/id_rsa with the right ownership (runner:runner) and permissions (0400)

4. Configure cron tab for the runner user

crontab -e

# rsync

* * * * * rsync -azq –delete -e ssh  /sites/aycron.com/shared/public/ webcloud2:/sites/aycron.com/shared/public/

Basically that command connects over SSH to the other server every minute and ‘rsyncs’ with the target directory.

# rsync
* * * * * rsync -azq –delete -e ssh  /sites/hungry-girl.com/shared/public/ hgwebcloud2:/sites/hungry-girl.com/shared/public/

That’s it!