14 September, 2008

Moral Dilemmas Results

In part II of the continuing series on morality, I took the "Moral Dilemmas" quiz at yourmorals.org. The results:

 AverageMe
Impersonal Dilemmas3.06.0
Personal Dilemmas3.21.0

Moral Foundation Results

I just took the highly informative "Moral Foundation" quiz at yourmorals.org. The results:

 LiberalsConservativesMe
Harm3.62.94.0
Fairness3.73.04.0
Loyalty2.23.22.7
Authority2.13.32.2
Purity1.32.91.0

05 July, 2008

Comcast, Airport Express, and DHCP

I just got a new Comcast high-speed cable account today. It was a bit of a hassle to get the setup utility to run properly on OSX, but it did eventually. Then I had a working connection from laptop to cable modem to the world.

I wanted to use my Airport Express as a wireless router; this went less smoothly. I fiddled with this setting and that, but could not get the Airport Express to get a DHCP lease. This discussion, however, solved my problem immediately: the trick is that the cable modem remembers the MAC address of the computer you set up the account with. To fix the problem, just power-cycle the modem while the Airport Express is plugged in to the LAN port.

25 June, 2008

Ruby Needs a StringBuffer

john has written a little post about using a String as a File (really as an IO) in Ruby. He does a great job explaining how StringIOs work for reading characters. They're particularly good for unit tests on IO operations.

What john doesn't mention, however, is that StringIO is only an 'I.' It has no 'O.' You can't do this, for example:

s = StringIO.new
s << 'foo'
s << 'bar'
s.to_s
# => should be "foo\nbar"
# => really is ''

Ruby really needs a StringBuffer just like the one Java has. StringBuffers serve two important purposes. First, they let you test the output half of what Ruby's StringIO does. Second, they are useful for building up long strings from small parts -- something that Joel reminds us over and over again is otherwise very very slow.

So I wrote a StringBuffer, but it's not very good, and it's not very fast. What we need is one written in C in the core Ruby library. Now that will help Rails scale.