Entries from February 2008 ↓

testing and Rails

Ratatouille

As a “professional” webdesigner I know how much testing sucks and how it, at the same time, is one of the most important things to do (besides coding the stuff). That’s why I appreciate Rails’ very complete testsuite so much. And now with Rspec user stories (a nice tutorial here and here) and webrat it’s getting even better!

Installing jruby

I used this resource:

http://rorblog.techcfl.com/2008/02/19/create-and-deploy-a-jruby-app-to-the-glassfish-gem-in-10-minutes-or-less-on-mac-os-x/

How to install jruby on Ubuntu:

sudo -i
mdir -p ~/src/jruby/trunk
cd ~/src/jruby/trunk
svn svn.codehaus.org/jruby/trunk/jruby/ .
ant
~/src/jruby/trunk/bin/jruby --version

The current version doesn’t work to well with rails’ script/console. It is very, very, very slow. So I keep using Yarv until this is fixed. It seems really promising though. Can’t wait for Rubinius to become stable!

Ubuntu changed default editor

 Ubuntu changed the defaut editor to ViM? At least: my Hardy Heron installation suddenly changed editor. This is the command you can use to determine which editor you want to use by default:

sudo update-alternatives –config editor

Where am I going to host my project?

In my previous blog item I asked the question: where am I going to host my (git) project? John Nunemaker mentioned github for hosting git projects. Maybe I’m gonna look at that when I’m done with my house.

The beauty of Ubuntu

A.k.a. “installing something that would take ages in another OS”

For a client of ours I’m doing a project. But I had to wait at my new house today for my new tiles. And at my new address I don’t have internet yet. So I made a local copy of the project and had to install apache, mysql and phpmyadmin.

sudo aptitude install libapache2-mod-php5 phpmyadmin mysql-server apache2 php5-gd

And it worked! Linux not user-friendly? Pfffttt!

How to play wmv files with Ubuntu Hardy Heron

I thought about doing:

sudo apt-get install non-free-codecs gstreamer0.10-pitfdll w32codecs

Nothing!

Maybe:

sudo aptitude install totem-xine

Nope…

Maybe… then:

sudo aptitude install mplayer

Yesss… that worked! Too bad mplayer gnome integration looks like shit…

[edit]

Of course, this works beter: aptitude install ubuntu-restricted-extras
Try it!
[/edit]

Running ut on a new x server (performance is everything)

This was a ha(n/r)dy guide:

http://ubuntuforums.org/showthread.php?t=51486

So because I am always losing with UT and keep blaming it on the poor performance of my laptop I was forced to optimise UT. After fiddling with new engines, I discovered that doesn’t make any difference at all.

I logged out of gnome and stopped gdm. With xinit I started a new X(org) server, ran UT and voila: much better performance. But this are waaaay to many steps so I created some scripts to do this for me.

I have two scripts:

ut
This runs wine and invoked the UT binary

newscreen
This runs a new xserver without gnome or anything.

I placed both scripts in ~/bin

UT:

#!/bin/bash
wine=`which wine`

$wine ~/.wine/drive_c/UnrealTournament/System/UnrealTournament.exe $*

newscreen:

#!/bin/bash

MINARGS=1
E_NOARGS=70
E_NOTEXE=71
EXECUTABLE=`which $1`

NR_OF_SCREENS=`pgrep -x Xorg |wc -l`
NEW_SCREEN=$(($NR_OF_SCREENS - 0))

if [ $# -lt $MINARGS ]; then
echo "You have to use at least 1 argument in the form of an executable"
exit $E_NOARGS
fi

if [ ! -x "$EXECUTABLE" ]; then
echo "The argument should be (the path to) an executable"
exit $E_NOTEXE
fi

xinit $* -- :$NEW_SCREEN  > /dev/null

I am especially proud of the newscreen command. I think it’s really nice. Especially because it counts the current number of running xservers. So if it’s only one (usually) it creates :1. If there are more it raises the number.

The commands are used like:

newscreen ut #start ut on a new :1 server
newscreen xclock #start xclock on :2

Nice eh?

Blacklisting firefox 3.0 in Hardy (and installing 2.0)

I used the following resources to accomplish this:

  • http://www.debian.org/doc/manuals/apt-howto/ch-apt-get.en.html
  • http://ubuntuforums.org/showthread.php?t=208426

First add an additional deb source for feisty packages. I did it like this:

touch /etc/apt/sources.list.d/feisty.list
echo "deb http://archive.ubuntu.com/ubuntu/ feisty main restricted universe multiverse" >>  /etc/apt/sources.list.d/feisty.list

Then you have to tell apt that feisty has preference for the firefox packages:

nano -w /etc/apt/preferences

And add this to the file:

Package: firefox
Pin: version 2.0*
Pin-Priority: 1001

Package: firefox-gnome-support
Pin: version 2.0*
Pin-Priority: 1001

And the last thing to do:

aptitude install firefox

Make sure all of this is executed as sudo!

[edit]
They fixed this “problem”. You can now install firefox-2 instead of using this overlay stuff.

sudo aptitude install firefox-2 firefox-2-gnome-support

Rhythmbox

I fired up rhythmbox today to play my music. I pointed rhythmbox to my ~/Music directory and it index 10% of my songs. Huh? WTF!?

Apparently not all required codecs are installed eh? I didn’t want to search through documentation and what not, to find out what it was exactyle missing. So I did a:

sudo apt-get install gstreamer0.10-plugins-bad-multiverse gstreamer0.10-plugins-ugly-multiverse

and all was peace again…

How to install acroread on ubuntu Hardy Herron

echo "deb http://packages.medibuntu.org/ hardy free non-free" | sudo tee -a /etc/apt/sources.list
wget -q http://packages.medibuntu.org/medibuntu-key.gpg -O- | sudo apt-key add - && sudo apt-get update
sudo aptitude install acroread

Worked like a charm!