My Uncle mentioned that the audio on this aging PC wasn’t working ever since he got it “repaired”. It was running Windows XP and we were initially unable to find the right audio drivers online so I thought I’d give Ubuntu a go on it. Sure enough, the audio worked fine in Ubuntu. However, with the machine running Ubuntu, it was incredibly slow and unstable. It crashed every 5 mins with either a white screen of death or a screen that looked like a jail with vertical bars going across it. My uncle said ”

Yeah, this ooobuntooo thing is ok but it keeps freezing like a zoo and I have to switch the computer off and on again

” 🙂 .

I tried Linux Mint 12 instead of Ubuntu and got the same instablility. I was left with no choice other than to leave with Windows set as the default grub option. Oh Ubuntu, you have failed me – You are slower and less stable than Windows XP, on at least 1 machine. In fact Windows was a better experience in terms of speed and stability by a significant distance! Sad days. Ubuntu, please step-up. I love you, but only because you are better than the competition.

Another problem that left a sour taste in my month was that my Uncles old monitor didn’t like grub and switched off after the initial bios splash screen, kept switched off during grub and then switched back on when the OS actually started booting. Luckily I guessed than Ubuntu is usually at the top of the menu and Windows at the bottom so was able to choose the right OS even though nothing was on the screen. but having grub invisible is not a good user experience! And it make it tricky to change the default to Windows (I had to guess the GRUB_DEFAULT value in /etc/default/grub).

Dell XPS L702xI have a Dell XPS L702x Laptop and the wireless is dodgy in Ubuntu 11.04. By Dodgy I mean it drops out and doesn’t automatically connect very often especially when a Ethernet cable is unplugged. It seems the problem is that Ubuntu doesn’t get on well with wireless-N (perhaps the driver is buggy?). I fixed it by disabling wireless N (but leaving G working):

First check to see that b, g and n is enabled:

> iwconfig
wlan0 IEEE 802.11bgn ESSID:"WKIXNTOM"
we need:
wlan0 IEEE 802.11bg ESSID:"WKIXNTOM"

To disable Wireless N, create a file called /etc/modprobe.d/iwlagn.conf and put the disable incarnation in it:
> sudo vi /etc/modprobe.d/iwlagn.conf
options iwlagn 11n_disable50=1 11n_disable=1

Restart the computer to finish.

I agree this isn’t a ideal solution (to say the least!), but it’ll do for now.

Update after 2 months: Wireless has been reliable and steady since making the above change.

Update (15/Oct/11): This “hack” is a disaster for Ubuntu 11.10 Oneiric Ocelot, it causes Wireless to fail to load. Be sure to remove the /etc/modprobe.d/iwlagn.conf file when upgrading to Ubuntu 11.10. I found this issue the hard way: askubuntu question.

Wordpress Logo

Did you know that WordPress sends you emails when you get a new blog comment? I didn’t – because it has never worked for me. But once I knew it was supposed to email me I looked into it and found a fix.

Setup: My setup is running on a Ubuntu 9.04 box called Butterfree with sendmail installed.

The problem was that the Return-Path header in my outgoing mails wasn’t valid which caused some mail recipients to reject the mail, while other less picky ones, accepted the mail fine (e.g. gmail). The Return-Path header that sendmail was using looked something like this:

Return-Path: <>

I found this by changing the admin email from the one that didn’t work to a gmail one, then posting a test comment on one of my posts. Then I waited for the email to arrive in gmail and selected “show original” from the gmail interface. A quicker way is to check the entries in /var/log/mail.log.

In order to fix the issue, I configured the return path in emails sent from WordPress (i.e. PHP) to something different using the -f parameter for sendmail:

sudo emacs /etc/php5/apache2/php.ini

Find the sendmail_path and uncomment it and add the -f flag:

; -f will set the "return-path" headers.
sendmail_path = /usr/sbin/sendmail -i -t -f

Doing this solved this issue so I now get email about new comments.

My fix feels a bit of a hack. I would be interested in how to solve this problem the right way, so let me know if you can give me some advice. For example, perhaps I should have done something with my DNS settings for my domain?

Look at the difference between these two 50px headers that use the Georgia font:

Windows/Ubuntu font comparison - Georgia

The top one is from IE8 on Windows Vista, whereas the bottom one is from Firefox 3.0.15 on Ubuntu 9.04. On Windows, the text is clearly less pleasant on the eye? It is has jagged edges, has a pixel or two cut off the end of the ‘s’ and is 17 pixels less wide.

This is the styling code:

#logo h1 {
font-family:Georgia, Arial, sans-serif;

Read on…

In a previous tutorial we went through some tedious steps to generate 3 images that could be used to create a page shadow. The great thing about the GIMP is that anything you can do with a mouse and keyboard, you can also do via script.

We will generate the following images automatically:

Demo of what we will generate

Why script it?

  • It allows us to tweak settings and quickly re-generate the image to see the results. For example, we can ask ourselves, “I wonder what it’d look like if the shadow was a bit bluer?”
  • We can automatically generate multiple images (including, for example, a image suitable for a CSS sprite).
  • We can can adapt and re-use the scripts for different websites. For example, one website might use square angular edges, but another might use rounded corners – so you can adapt to use rounded corners in the background image by changing 1 line of the generation script.
  • Mice are evil – why involve a mouse when all we need is a keyboard?

Read on…

If you want to use the “Purisa Light” font on your Linux hosted website, you can follow the following steps:

  1. Copy the font file from your desktop machine to your webserver. On Ubuntu the “Purisa Light” font file is located at /usr/share/fonts/truetype/thai/Purisa.ttf. e.g:
    scp /usr/share/fonts/truetype/thai/Purisa.ttf <username>@<webhost>:/<pathToWebsite>/fonts/Purisa.ttf
  2. Add the font face to your stylesheet:
    @font-face {
        font-family: 'Purisa';
        src: url('fonts/Purisa.eot'); /* For IE */
        src: local('Purisa'),
             url('fonts/Purisa.ttf') format('truetype');
  3. Now you should be able to use it in your site pages. e.g.
    <div style="font-family:Purisa,arial">
    This should be in the "Purisa Light" font...
  4. BUT, we’re not done yet because unfortunately, IE does not support TrueType (ttf) fonts – only Embedded Open Type (eot) fonts.
  5. Download ttf2eot from – it is a open-source font format converter.
  6. Extract it to your home directory. Then build it:
    cd ~/ttf2eot-0.0.2-2
    sudo apt-get install build-essential
  7. Convert the font:
    ./ttf2eot < /usr/share/fonts/truetype/thai/Purisa.ttf > Purisa.eot
  8. Copy it to your website, e.g
    scp /usr/share/fonts/truetype/thai/Purisa.eot <username>@<webhost>:/<pathToWebsite>/fonts/Purisa.eot
  9. Now it should work on IE. If you don’t have time to convert this font, you can grab mine – use “view source” to find the URL from the stylesheet.

@font-face is a HTML5 feature supported by Safari 3.1+, Firefox 3.5+, Opera 10+ and IE 4+. At the time of writing Google Chrome currently doesn’t support @font-face (but the beta version does so it won’t be long).

This post was inspired from an excellent article called @font-face in Depth.

Ubuntu Logo 200x52

If you have a font file with a “ttf” extension you can easily install it in Ubuntu (v9.04) and use it in applications such as the Gimp. Essentially, all you have to do is drop it in the correct folder:

  1. cd /usr/local/share/fonts
  2. If the truetype/custom directory doesn’t exist already: sudo mkdir truetype sudo mkdir truetype/custom
  3. sudo cp where_you_downloaded_the_new_font/fontname.ttf /usr/local/share/fonts/truetype/custom
  4. sudo chown root.root /usr/local/share/fonts/truetype/custom/fontname.ttf
  5. fc-cache – Otherwise, the font will disappear at the next reboot.

The following text was created in the Gimp: It uses 3 free fonts, the “B” is Heavy Data, the “it” is Sans Bold and the “volution” is Ballpark:

ttf font demo