Ruby Gem 1.0 is out

RubyGem 1.0 is out.


Which means that if you see

undefined method `require_gem' for main:Object (NoMethodError)

You’ll need to replace require_gem by just gem.

For example, unless you have the very latest version of ruby-debug (0.9.3), you’ll see the above error. In that case, though, updating your gem is simpler.

Upgrade to Windows XP?

This was just too good to pass up! Vista has been getting a pretty bad rap anywhere you look (well, at least anywhere I look, and from second hand experience helping people with their Vista machine), so here’s your chance to finally Upgrade to XP

Ok, you can stop laughing now.

And for a real upgrade

(via Reginald)

in News | 59 Words

Removing the quarantine attribute on your application

With Apple latest OS, Leopard (Which I recommend highly), comes an interesting new feature (well, at least it is cute for a while, but it can get to you after a while). For annoying, try Vista

When you try to run an application you downloaded and get this message every time you try to start an application

"..." is an application which was downloaded from the internet...

There is an easy solution.

Check first tha it has the “” Attribute.

xattr -l

which may give you something like: 0000;4726d129;Safari;5FF2A3CB-B74C-405A-BF92-AD14858A6F5A|

If it does, remove it using:

sudo xattr -d

in Mac | 91 Words

Dreamhost codes

I’ve had my ups and downs with Dreamhost and I’m now running nano RAILS on a kick ass VPS with gentoo.

But for a starter ruby site (nano RAILS was hosted there for over a year!), it is hard to beat their price, and they do run quite nicely with fcgi. If you want to run multiple apps, using mongrel, then sure it is not for you.

I’m also running lots of wordpress blogs (Home Recipes and Why not create a Side Business) and I’m happy with the no hassle way to get them setup and how smoothly they run.

Any way, to make a long story short, Dreamhost has finally decided to update the way you create codes for their Coupons.

So if you want to get started with a pretty good host, and need a new domain name, you can get that domain for free for the life of your account by using the code NANODOMAIN (plus you get the max $50 off, which is a nice chunk of change).

Or if you already have a domain, but want a unique IP, you can use NANOIP (and you also get $50 off).

Or you can take advantage of that last week to get $97 off with NANO97.


in News | 211 Words

Upgrading a MacBook Pro Hard Disk

Just last week I inherited a not so old 17” MacBook Pro. Sweet!

It just needed a little TLC, more memory and a bigger and faster disk (7200 rpm, yummy, but not so good for your pocket book).

Changing the memory is surprisingly easy on the later models. Just remove the battery, remove a few screws below the battery (small phillips screw driver) and you are done.

Changing the hard disk is a different story. A few google searches did not turn up the expected solution, but gave me enough ideas to be bold enough to get to it. In fact, it is really simple to open the case. (Before you do this, know that this will void your warranty if it is still current, so don’t say you have not been warned).

Unscrew all visible phillips screws (including the one below the cover from the memory, and then you are left with just a couple of torx screws. Then flip back the machine, open the screen and lift the keyboard/mouse pad. After that, gently unplug the single connection and the disk is within reach (just 2 more screws).

Unplug the disk, plug in the new one, and retrace your steps back.

If you can, though, avoid working above thick carpet, this will save you tons of embarrassing time looking for one of these tiny screws ;)

That was the easy part. Because I just did not have the system disks handy. I had a few other ones, though. A newer Macbook Pro set, and even the latest stainless steel iMac ones. But none of these would accept to install a new system on that brand new disk :(

Fear not, there is a simple solution, that will kill 2 birds with one stone (since I also needed to copy all the existing data from the old disk).

I bought (third trip to Fry’s that day) an external USB 2.5” laptop disk enclosure (this will set you back $15 or more), plugged in the old disk and followed these simple steps:

* plug the external disk
* boot the mac with any system CD (Mac OS X)
* go to the next step till the Utilities menu is available
* use Disk Utilities to format/partition the new disk
* go back and start “Terminal” to do the copy
* once the terminal app has started, figure out the Volume names from /Volumes

ls /Volumes

* then run:

asr --source /Volumes/[SOURCE] --target /Volumes/[DEST] --verbose

asr will even go so far as to show you a progress bar that shows you how far it got. And some time later, you’ll have an exact, bootable, copy of your old disk.

in Mac | 439 Words

My Ruby on Rails Gentoo Setup

I had been hearing about Gentoo for a long time, and finally discovered it in depth about 6 months ago. Gentoo is really a different beast as Linuxes go. You get to build everything from sources. No binaries. That’s right. That means that you get to build everything with compatible flags, get to remove a lot of the unnecessary bloat (Do I hear X windows for example?). It also means that the initial setup could take you several days if your machine is not so powerful. Suffice it to say, I really, really like the approach and that is now what I’m using to run this blog.

Of course, if I need a server setup in a hurry, I’ll still go for a Debian or Ubuntu. But if I want a very fined tune system, Gentoo is it.

Of course, there is an ebuild for rails (ebuild is gentoo-speak for describing a package your can grab and build), but it did bring a lot more that what I cared for, so here’s the step by step instructions for getting Rails+Mongrel+nginx going on Gentoo.

This assumes that you are starting from a Gentoo 2006.1 stage 3 without much else.

A word of warning

Even though I’ve used these notes to successfully setup 3 machines (both on x86 and amd64), your experience may still be different, or you may need slightly different options or settings as the packages are bound to evolve, or I’ve made some assumptions that do not apply in your case, or something was obvious to me that should not have been, or, perish the thought, I just plain forgot something. If that happens, remember, Google is your friend, or don’t be shy, ask a question here, someone might know the answer.

So with that out the way, let’s get started.


auto start ssh:

rc-update add sshd default

update portage tree

emerge --sync
emerge portage
emerge -av --update --deep world

At this point, you are going to have a lot of configuration files that out of date. Since we are doing a new setup, we just want to silence the warnings and making sure we use the latest version. So to find each file:

find /etc -iname '._cfg????_*'

But do not overwrite inittab if it is only putting back more terminal login than you need.

Now it is time to add a few very useful tools like sudo, stuff to help you figure out what’s installed, and to find things (namely sudo, gentoolkit and sys-apps/slocate)

emerge -av app-admin/sudo app-portage/gentoolkit sys-apps/slocate

Now it is time to create your user. And set its password.

useradd user
passwd user

Add user to /etc/sudoers with ALL

Add vim (or whatever else you fancy)

emerge -av vim

Change default EDITOR

vi /etc/rc.conf

There, comment out /bin/nano, and uncomment /bin/vim

Install subversion

emerge -av subversion

Even though not strictly necessary for Rails, a few network utilities always come in handy (traceroute, dig, nslookup):

emerge -av traceroute bind-tools

If you want to send/receive emails:

emerge -av mail-client/mailx
emerge --unmerge mail-mta/ssmtp
emerge -av syslog-ng mail-mta/exim
rc-update add exim default

There are lots of options to do SMTP, but I find exim4 the quickest and simplest to setup:

create /etc/exim/exim.conf from /etc/exim/exim.conf.dist

To lockdown mail to localhost (you just want your Rails app to send emails), add this exim.conf:

local_interfaces =

And to allow non users to send mails (comment out this line)

##require verify        = sender

And finally, start your mail server:

/etc/init.d/exim start

Rails Setup

My preferred database remains MySQL. I know, some people prefer PostgrSQL.

emerge -av dev-db/mysql
rc-update add mysql default

Then, to configure MySQL and create a first database, first you need to figure out which version you just installed. If you were not paying attention as the logs were flying by (I know I wasn’t), use

equery list mysql

And then

emerge --config =dev-db/mysql-5.0.26-r2

To get rubygems 0.9.x, you need to unmask it. For that, add a new line to /etc/portage/package.keywords with:

dev-ruby/rubygems ~amd64

Replace with ~x86 if you are not on an AMD chip, then run:

emerge -av dev-lang/ruby dev-ruby/mysql-ruby dev-ruby/rubygems  dev-ruby/ruby-termios

For any kind of image manipulation (resizing and such), install Image Magick. First, it it does not already exist create /etc/portage/package.use

dev-ruby/rmagick lcms gif imagemagick jbig jpeg jpeg2k pdf png svg tiff truetype unicode wmf xml xpm pcre
media-gfx/imagemagick lcms gif imagemagick jbig jpeg jpeg2k pdf png svg tiff truetype unicode wmf xml xpm pcre
emerge -av media-gfx/imagemagick dev-ruby/rmagick

The above line represents the options for that ebuild.

Time to get the latest nginx

  1. add a new line to /etc/portage/package.keywords with (Again, on Intel, use ~x86)

"www-servers/nginx ~amd64

Then run emerge again:

emerge -av www-servers/nginx

Ok, now time to install what we actually wanted to install, Ruby on Rails and a few useful gems:

gem install -y rails rake capistrano daemons gem_plugin mongrel mongrel_cluster rmagick BlueCloth RedCloth ruby-debug termios ruby-openid ruby-yadis

Start mysql, create a database for rails test app

/etc/init.d/mysql start
mysqladmin -u root -p create test1_development
mysqladmin -u root -p create test1_production

And finally, install a rails app (we’ll use beast as it is pretty simple to install)

svn checkout beast
cd beast/
rake rails:freeze:edge
#create config/database.yml from config/database.example.yml
rake db:schema:load RAILS_ENV=production
./script/server -e production

Test that everything’s fine fine by pointing your browser to port 3000.

Now, let’s configure mongrel (We are almost there, I promise).

cd [app]
sudo useradd -n mongrel
sudo chown -R mongrel:mongrel [app]
mongrel_rails cluster::configure -e production -p 8000 -N 3 -c [app] -a --user mongrel --group mongrel

Later, a few useful commands to use

#start cluster
mongrel_rails cluster::start

#restart cluster
mongrel_rails cluster::restart

#stop cluster
mongrel_rails cluster::stop

To setup nginx, edit /etc/nginx/nginx.conf to match your setup

To setup mongrel_cluster for autostart

mkdir /etc/mongrel_cluster
ln -s [app]/config/mongrel_cluster.yml /etc/mongrel_cluster/[app].yml

#copy from wherever the gem is installed (use locate to figure out the location)

ln -s /usr/lib64/ruby/gems/1.8/gems/mongrel_cluster-0.2.1/resources/mongrel_cluster /etc/init.d/mongrel_cluster
chmod +x /etc/init.d/mongrel_cluster

Add nginx and mongrel_cluster to startup

rc-update add nginx default
rc-update add mongrel_cluster default

For smooth reboot, you may need to delete the pid files
Apply this patch (from

create file “mongrel_cluster.patch” with:

--- bin/mongrel_rails-orig      2007-05-16 14:41:51.000000000 -0400
+++ bin/mongrel_rails   2007-05-16 14:42:50.000000000 -0400
@@ -83,9 +83,17 @@
       config = do
         if defaults[:daemon]
           if File.exist? defaults[:pid_file]
-            log "!!! PID file #{defaults[:pid_file]} already exists.  Mongrel could be running already.  Check your #{defaults[:log_file]} for errors."
-            log "!!! Exiting with error.  You must stop mongrel and clear the .pid before I'll attempt a start."
-            exit 1
+            # mongrels that crash can leave stale PID files behind, and these
+            # should not stop mongrel from being restarted by monitors…
+            pid =[:pid_file]).readline
+            unless `ps -ef | grep #{pid} | grep -v grep`.length > 0
+            # use "ps ax" for freebsd
+                log "!!! PID file #{defaults[:pid_file]} exists, but is stale, and will be deleted so that this mongrel can run."
+                File.delete(defaults[:pid_file])
+            else
+                log "!!! PID file #{defaults[:pid_file]} already exists and the process id referred to in it is running.  This mongrel is probably already running.  #{defaults[:log_file]} for errors.  EXITING."
+                exit 1
+            end



then apply the patch

patch -p0 /usr/lib64/ruby/gems/1.8/gems/mongrel-1.0.1/bin/mongrel_rails < mongrel_cluster.patch

And there you have it. A nice, humming Ruby on Rails+Mongrel+nginx on Gentoo.

An amazing lesson in Micro Biology

If you are just curious about how things work, or a big fan of Micro Biology, you should not miss this 10 minutes video.

David Bolinsky has created an amazing video where he shows in stunning motion the inner working of the cell. This may have been staged so that visibility of what’s going on is increased, but the video are just breath taking. I look forward to watch his entire creation

Or if you prefer, the higher resolution version

Thanks to TED for sharing!

in News | 84 Words

Finally migrated to Mephisto

Big sigh of relief…

… and yes, everything went fine. Well, mostly. If something looks amiss, please use the brand new feedback page (thanks Rick!) to let me know. I’ve tried to redirect most existing urls to their new ones as Mephisto and Typo slightly differ on how they generate the permalink portion, but may have missed a few (so if you get an error page when something used to work, please do let me know!).

After much hesitation, and having dreaded the minutiae of the conversion, I’ve finally made it!

In fact it was the switch to a brand new VPS with a 1Gb of memory that was the trigger. Since I was reinstalling everything from scratch (more on that shortly), I figured now was the time to bite the bullet. And it went much easier than I expected :). I’ll try to put down some notes on some the pitfalls to avoid within a few days.

Suffice it to say that I’m quite happy with the result and this blog is now running with nginx (yeah!!!) and a cluster of mongrels on a fined tune gentoo vps (I’ve kept detailed notes that I will share soon).

I’ve also ported the Brighthouse theme by Richard White to Mephisto and will add it to the Mephisto Theme Gallery as soon as I get to clean it up and remove the nano RAILS specific stuff. In fact, I’m curious as to whether you would rather have the theme with AdSense and TextLinkAds: (aff) included, or maybe the ability to turn them on/off?

Also new is the Archives page, and hopefully the new error page will help people find what they were looking for.

in News | 293 Words

Take back the web

Today was not a good day for the internet. First I read Seth’s post, then Kathy’s sad and upsetting story directly. Then countless others

This is just plain and simple not acceptable behavior. Period.

Brad nails it when he says:

Kathy’s story sealed it for me – reputation and trust are at a tipping point and are an issue that is going to have to be dealt with in 2007.

I agree.

And before someone mentions it, no, censorship is not the solution here.

Seth once said:

Have you ever noticed that people you know are far less likely to cut you off in traffic, curse at you, or steal your parking space than treal strangers seem to be? There’s a reason: Anonymity is the enemy of civility.

(From Small is the new Big)

Maybe it’s time we bring civility back, don’t you think?

Kathy, hang in there! We are here to help.

in News | 157 Words

Brace for impact!

Tomorrow might prove to be interesting! So fasten your seatbelts…

Paul Hirsch, a moderator on got wind that hacker Billy Hoffman with SPI Dynamics is going to do a talk tomorrow at Schmoo titled: “Javascript Malware for a Gray Goo Tomorrow”.

He created Jikto, a web scanner written in javaScript:

This homogenous platform, coupled with JavaScript’s new features has enabled attackers to perform advanced attacks using XSS that were thought to be impossible even 2 years ago. Self-propagating XSS+Ajax worms, advanced keystroke and mouse loggers, port scanning, fingerprinting, and assaulting intranet applications, as well as stealing search engine queries or browser histories are now all components in an attackers toolbox.

If this does not concern you just a bit, I’m not sure what could…

The good news? Well, he’s not going to release Jikto, at least not yet…

But this will definitely bring XSS in the forefront.

in News | 152 Words