Adding MS fonts to Ubuntu

February 26, 2007

Ubuntu does not install Microsoft fonts like Arial or Trebuchet by default, as I guess they are not free.

However you can get them from the multiverse packages. To install them, enable the multiverse packages in System/Administration/Sofware Sources and go to a terminal and type

sudo apt-get install msttcorefonts

I was very annoyed by the fact that VLC did not keep the playlist when restarted and I was always forced to load the playlist myself. In my case the playlist is in a url (it is supplied by my broadband and TV provider) but it could also be a file.

It turns out that the solution  is very simple:

  1. Open VLC
  2. Go to Settings/Preferences.
  3. Select Playlist
  4. Enter your default playlist in the Default stream field.

Basically you can build your playlist, save it (open the playlist with CTRL+P and then Manage/Save playlist) and then put the full path to the saved playlist in the Default stream field as explained in the steps above.

Have you ever had the need to access an internal CVS repository from the office and from home or any other place outside your organization’s intranet? This is something I have been doing for quite a while now as I work from home from time to time.

We don’t use any kind of VPN as we don’t have the necessary hardware to set it up properly but I have access to an internal machine from home through ssh that then allows me to connect to the CVS machine.

The tip is to create a SSH tunnel to connect to the CVS machine (I use ssh to access CVS). That way, your CVS repository is always accessed through a port opened in your localhost and so it looks the same to applications regardless of how you connect to the CVS repository.

Imagine the following scenario:

My laptop hostname is laptop.domain, the CVS server is cvs.domain and the machine I use to connect to the intranet from home is gateway.domain.

When I am at home I create the following tunnel (replace username with your login name in gateway.domain):
ssh -L2222:cvs.domain:22 username@gateway.domain

When I am in the office I create the following tunnel:
ssh -L2222:cvs.domain:22 laptop.domain

Note that you MUST NOT replace laptop.domain with localhost in the second ssh tunnel. If you do that, the SSH key associated to localhost will be your laptop’s one and this will prevent you from making a ssh connection to cvs.domain through the tunnel because the SSH host key that will be reported will be the cvs.domain’s one that will conflict with the the SSH key already registered (you laptop’s one) and therefore the client will refuse to open the connection.

To make things easier I have created two aliases that I add to my .bashrc or .alias or .bash_aliases depending on your GNU/Linux distribution:

alias cvs_home=’ssh -L2222:cvs.domain:22 username@gateway.domain’
alias cvs_office=’ssh -L2222:cvs.domain:22 laptop.domain’

When you configure the repository in your CVS client specify:

  • host: localhost
  • port: 2222
  • connection protocol: ext:ssh or ssh

When you install a Rails application you need to initialize the DB tables where the data will be stored.

First, you need to create the database and give the correct privileges to a user to access the application. With mysql you will do the following:

  1. mysql -u root
  2. mysql> create database my_database;
  3. mysql> grant all privileges on my_database.* to my_user@localhost identified by ‘my_password’;
  4. mysql> flush privileges;

Then set this parameters in the rails application

  1. Edit the database.yml file in your application config folder
  2. You can configure three different environments there: development, test and production. Change the values for your environment:
    1. adapter: mysql
    2. database: my_database
    3. username: my_user
    4. password: my_password
    5. host: localhost
    6. socket should be set to the value specified  in the mysql configuration file. In Ubuntu this file is in /etc/mysql/my.cnf. In the [mysqld] section look for value of the socket variable, which in my system is /var/run/mysqld/mysqld.sock

Once your are done with the set up, creating the appropriate tables is damn easy with Rails migrations:

  1. cd into your Rails application folder
  2. Run ‘rake db:schema:load’
  3. You may also want to run ‘rake db:migrate’ in case you don’t have the latest version of the schema.rb file which sometimes  happens because developers forget to commit the changes.

You are done!

Note: In order to allow Rails to connect to the mysql database I had to enable the old password scheme in the mysql configuration file (/etc/mysql/my.cnf):

 old_passwords   = 1

Ubuntu rocks!

February 22, 2007

Recently I installed Ubuntu on every machine in the office, servers and desktops and I must say that it just rocks.

It is very easy to install and configure. I have been using debian at home for quite a long time and adding new packages with apt-get is the simplest thing I have ever seen.

Actually I had an issue installing it on my laptop. The installation process just keep on hanging. But as always with GNU/Linux there are many alternatives available on the web so I decided to go for a network installation. It worked smoothly. Maybe you need some GNU/Linux administration backgound to do it, but it was my first network installation and it just worked.

One thing that sets Ubuntu appart from other GNU/Linux distributions is the huge documentation available. You can find detailed easy-to-follow steps to do about anything. For instance, do you want to add support for rich media cotent? Just follow the instructions here.

To sum up, if you plan on installing GNU/Linux (or even if you don’t 😉 ), give Ubuntu a go.