When cap deploy keeps asking for passwords even though you’ve set up your authorized_keys files, do two things:

First, check perms for the whole directory tree leading up to $HOME/.ssh:

server$ chmod go-w ~/
server$ chmod 700 ~/.ssh
server$ chmod 600 ~/.ssh/authorized_keys

Second, add the deploy user’s public key to the authorized_keys file. Test by ssh’ing to localhost. No password = good to go!

Written on September 22nd, 2009 & filed under SciTech

* Open the Error Console: Tools menu/Error Console
* In the Code text box paste this (it’s a single line):

Components.classes["@mozilla.org/browser/nav-history-service;1"].getService(Components.interfaces.nsPIPlacesDatabase).DBConnection.executeSimpleSQL(“VACUUM”);

* Press Evaluate. All the UI will freeze for a few seconds while databases are VACUUMed

Written on September 16th, 2009 & filed under SciTech

The defaults in Rails with ActiveRecord is beautiful when you are just getting started and are created everything for the first time. But once you get into it and your database schema becomes a little more solidified, the things that would have been easy to do by relying on the conventions of Rails require a little bit more work.

In my case, I had a form where there was a database column named “num_guests”, representing the number of guests. When the field fails to pass validation, the error messages is something like

Num guests is not a number

Not quite the text that we want. It would be better if it said

Number of guests is not a number

After doing a little bit of digging, I found the human_attribute_name method. You can override this method in your model class to provide alternative names for fields. To change our error message, I did the following

class Reservation < ActiveRecord::Base
...
validates_presence_of :num_guests
...
HUMAN_ATTRIBUTES = {
:num_guests => “Number of guests”
}

def self.human_attribute_name(attr)
HUMAN_ATTRIBUTES[attr.to_sym] || super
end
end

(taken from http://www.theodorenguyen-cao.com/2009/04/06/custom-field-names-in-rails-error-messages/)

Written on April 22nd, 2009 & filed under SciTech

Firefox3 stores a lot of info in sqlite3 databases. Optimizing those databases can speed up load time and reduce the file sizes of these files as well.

On linux or os x, go to your profile directory (Library/Application Support/Firefox/Profiles/ or .firefox/profiles/ ) and execute the following:

for i in *.sqlite; do echo “VACUUM;” | sqlite3 $i ; done

This reduced my places.sqlite file to 10% of its previous size.

Written on April 13th, 2009 & filed under SciTech Tags:

./configure –with-ns –with-ns-antialias-text=t

Written on March 23rd, 2009 & filed under SciTech

“I think that it’s extraordinarily important that we in computer science keep fun in computing. When it started out, it was an awful lot of fun. Of course, the paying customers got shafted every now and then, and after a while we began to take their complaints seriously. We began to feel as if we really were responsible for the successful, error-free perfect use of these machines. I don’t think we are. I think we’re responsible for stretching them, setting them off in new directions, and keeping fun in the house. I hope the field of computer science never loses its sense of fun. Above all, I hope we don’t become missionaries. Don’t feel as if you’re Bible salesmen. The world has too many of those already. What you know about computing other people will learn. Don’t feel as if the key to successful computing is only in your hands. What’s in your hands, I think and hope, is intelligence: the ability to see the machine as more than when you were first led up to it, that you can make it more.”

Alan J. Perlis (April 1, 1922-February 7, 1990)

Written on December 2nd, 2008 & filed under SciTech