Sunday, November 29, 2009

A thread I started a while ago suggests a solution to getting hibernation and suspend working properly with nvidia cards on Inspiron 5160 in Ubuntu. At least as of Karmic Koala (9.10), the solution one-line easier:

In the device section of /etc/X11/xorg.conf add the line:
Option "NvAGP" "1"

To /etc/modprobe.d/blacklist.conf add the following:
blacklist intel_agp

then reboot

slow browsing in firefox in Ubuntu 9.10 Karmic Koala

type in about:config into the browser bar

change the value of the key "network.dns.disableIPv6" from 'false' to 'true'

drastically increased browsing speed for me.

Saturday, November 14, 2009

a little Perl spice for ruby

An insightful blog post got me envying some of the brevity of Perl, so I implemented a couple useful idioms from Test::More in Ruby (which is pretty trivial since it allows opening up a class).

We'd like to have a really terse vocabulary when describing the most common test cases:

## equality
num = 8
num.should.equal 8 # bacon
num.must_equal 8 # minitest::spec
num.should == 8 # rspec
num.is 8 # clearly superior, similar to Test::More "is a, b"

## true/false
(num == 8).should.be.true # bacon
(num == 8).ok # superior, like Test::more "ok (something)"


So, for Bacon at least, this is all that needs to be done (put in your spec_helper.rb file)

class Object
def is(arg)
should.equal(arg)
end
def ok
should.equal true
end
end


The argument against this would go, "well, it's better to be more verbose and understood". The counter-argument something like, "this still makes sense and is way easier to write, so I can write more spec's which == better code".