Friday, December 21, 2007

Bluetooth & Ubuntu 7.10

Quick-and-dirty HOWTO for people looking to get a bluetooth compatible phone to talk to Ubuntu 7.10 (Gutsy) -- any phone should work, i've used a Nokia N80 successfully.

First, make sure you've got the Bluetooth Icon in the taskbar, if you don't -- there's a possibility your bluetooth adapter doesn't work with (or wasn't detected by) Ubuntu.

Second. go to a terminal and type:

sudo apt-get -f install gnome-vfs-obexftp

Which should pull in a bunch of dependancies for libopenobex1 and company.

Thirdly, if you'd like to use GNOME's "Send To" function to push files to your Phone (like to can to Evolution currently) you can type:

sudo apt-get -f install gnome-bluetooth

note: currently, the gnome-bluetooth package doesn't authomatically start the transfer daemon, you'll need to go through System -> Preferences -> Sessions and add a new program to the startup list, my settings for this were as follows

Name: Bluetooth File Transfer
Command: gnome-obex-server
Comment (optional): Transfer files via Bluetooth from "Send To"

Now, rather than seeing something similar to:

The Browse action reports:
"obex://[nn:uu:mm:bb:ee:rr]" is not a valid location.

You should be able to transfer files between your phone and your Gutsy machine :)

Saturday, December 15, 2007

Better TTF fonts for LCD devices

A small follow-up to my last post -- because after you've installed your fonts, you'd probably like them to look good.

note: In some countries, the use of hinting is covered by patents -- which is why some distributions don't ship this functionality by default (prefering instead to use an auto-hinter included within the Freetype 2.x code specifically designed to completely ignore the TrueType bytecode instructions) -- still, you should use caution when modifying a production system -- caveat emptor.

First, you need to make sure you are actually using the native renderer, rather than the auto-hinter for your fonts -- in Ubuntu you can do this by opening a Terminal and typing:

sudo dpkg-reconfigure fontconfig-config

On the first screen, you need to select 'native' rather than 'autohinter' -- you can safely leave the other screens as their default values.

Second, you'll need to change your theme to use the better hinting -- you can do this on Ubuntu in the Font preferences from: System > Preferences > Appearance and select Fonts tab.

On the first screen, select the 'Details' button in the bottom right-hand-corner -- which will take you to a more detailed menu where you can customise your font and rendering preferences -- the key options to set here are:

Smoothing to Subpixel (LCDs),
Hinting to Slight
Subpixel Order to RGB. (Should be the default already)

At this point, instead of having something like:



You'll have:



Which, I think you'll agree -- looks much better (and is much easier to read, too)

Thursday, December 13, 2007

Installing TTF fonts in Linux

Recently, I was asked how to get downloaded fonts onto an Ubuntu workstation in order to make prettier documents in OpenOffice -- there's two methods to doing this, which I thought i'd document for anyone having difficulties doing it themselves.

This article works on a Fedora 8, an Ubuntu 7.10 and an Ubuntu 6.06 machine -- but mainly relies on an XFree86 4.2 (or later) install with the fontconfig package installed (most current distributions have this installed already).

Method One: Single-user Fonts

Individual Users can install fonts by opening a terminal (Accessories -> Terminal) and making a .fonts directory in their home directory, like:

mkdir -p .fonts

Then, find a TTF font you like (Google thinks here is a good place to start looking) -- download it, extract it (fonts are usually distributed in .zip archives, so you'll need to extract the .ttf font file from it first) and copy it to the .fonts directory you just made.

Then you can either logout and login again, or restart the application you want the fonts to appear in and they should appear for use.

Method Two: System-wide Fonts

Administrators can install fonts by opening a terminal (Accessories -> Terminal), becoming the root user using either:

su - (Fedora)

or:

sudo -s (Ubuntu)

Then making a specific directory in the font location on their machine for TTF fonts (usually /usr/share/fonts/truetype), like:

mkdir -p /usr/share/fonts/truetype/winfonts

Download and extract the fonts to the new winfonts directory you made above, then update the font cache information for the machine by typing:

fc-cache -f -v

note: Some older Linux distributions (Fedora Core 3 and KUbuntu 5.04 both need this) may need to run:

mkfontscale && mkfontdir as the root user before running the fc-cache command above, so that your machine correctly creates a fonts.dir file that can be found by fc-cache.

If you're interested in Free and Open Sourced fonts, you should look at Ed Trager's site on the subject.

Sunday, December 9, 2007

SSHFS (the alternative to fish://) on Ubuntu 7.10

Working on a file located elsewhere in the world, or in the workplace can sometimes become very tedious -- especially when using the SSH option in the GNOME file manager Nautilus, which relies on gnome-vfs module, which has some notable performance issues that still have to be addressed.

On the console, we have the fish:// transport in programs such as Midnight Commander and the excellent FTP/SCP program lftp, but fish:// still tends to be much slower than SSH itself.

Luckily, there's now FUSE & an equally useful drop-in module, SSHFS which allows a user to mount a remote SSH/SCP session as a virtual filesystem, having any modified data copied over the secure tunnel with little to no extra overhead than a straight SSH session instelf.

FUSE is a kernel module for mounting different filesystems by an unprivileged user, which was adopted into the mainline linux kernel a while back. SSHFS is an add-on created by the author of FUSE enabling users to mount remote folders/filesystems using SSH.

The idea is very simple - a remote SSH folder is mounted as a local folder in the filesystem. After that, almost all operations on this folder work exactly as if this was a normal local folder. The difference is that the files are silently transferred though SSH in the background.

Installing FUSE with sshfs in Ubuntu can be done via the Synaptic Package Manager (System->Administration->Synaptic Package Manager or by typing (as root):

apt-get install sshfs

Next, you need to give permission to use FUSE to the relevant users by adding the FUSE group to their account -- again, you can either use the Users and Groups GUI (System->Administration->Synaptic Package Manager) or via the command line using:

usermod -G -a fuse [username]

In Ubuntu Gutsy, the fuse module is already loaded at boot-time via the /etc/modules file -- If you are using Ubuntu Dapper, or another distribution -- you may need to load the module manually, you can do this via the command line by typing:

modprobe fuse

Now we can try to mount a remote folder using the sshfs transport. First, make a directory to use as the mount point for your remote folder (in this example, it's ssh_mount, but you could call it anything you liked):

mkdir ~/ssh_mount

Which would create the /home/username/ssh_mount folder.

Then, run the SSHFS command as you would a standard SCP command:

sshfs remote_username@remote_server:~/files ~/ssh_mount

The command above will cause the folder /home/remote_username/files on the remote server to be mounted as /home/username/ssh_mount on the local machine.

For now on, any file action (copying, editing, removing) to this folder will result in transparent copying over the network via SCP directly, which provides a massive performance improvement over the fish:// transport or the GNOME-VFS implementation.

Once you've finished working with the remote filesystem, unmount the remote folder by running:

fusermount -u ~/ssh_mount