Thursday 4 December 2008

How do I setup a Huawei E220 USB wireless modem in Ubuntu linux?

I have one of those USB wireless modems, a Huawei E220, which I can use to access the internet from many Australian cities using the three network. The modem works fine in Windows but I had many problems to make it work in Ubuntu. I finally found some useful information on the web, and the process is not as hard as I thought could be. Here's a summary of how to do it. But first of all, an explanation of how the modem works.

After plugging in the USB modem, two USB devices are created in /dev/TTYusb0 and /dev/ttyUSB1. The first one, /dev/ttyUSB0, is the actual modem. The computer sees the modem as a dial-up modem. So to use it, the computer needs to use the modem and "call" a special phone number via the modem. This can be done with the program wvdial.

To configure wvdial, edit the file /etc/wvdial.conf so that it looks like this (you need to edit with sudo and have administrator permissions):

[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = Analog Modem
ISDN = 0
Modem = /dev/ttyUSB0
Phone = *99#
Username =
Password =
Baud = 460800
New PPPD = yes

That's it! You can type whatever you want as a username and password. Now plug the modem, wait for a few minutes until the device /dev/ttyUSB0 exists, and run the following command:

wvdial Defaults

For some reason that I don't understand, the first time I try this the connection always drops, so I need to unplug the modem, plug it again, wait a few minutes and then type wvdial Defaults again. Then it works.

Wednesday 27 August 2008

How do I set a dual screen output for Linux Ubuntu/Kubuntu?

Linux does have many good things, but sometimes you really need to try hard to get the best of it, or even to do what is taken for granted, say, in Windows. One example is for allowing a laptop to use an external monitor. I have a Dell laptop, model XPS M1210 with nVidia graphics card. The laptop has two partitions, one with Windows Vista, and the other with Linux Ubuntu or Kubuntu, both are basically the same thing with different clothes. I use this laptop to give lectures at Macquarie University and therefore the external monitor is essential. But I haven't yet managed to use the external monitor under Ubuntu easily.

Under Windows Vista, you just need to type Fn+F8. This combination of keys alternates the use of the laptop screen, the external screen, or both. However, in Ubuntu you first need to do a lot of under-the-hood tinkering until you get something that works somewhat.

First, I had to install the nVidia driver. Some time ago I unsuccessfully tried to do it, until I found Envy, an installer written by Alberto Milone that does all the job very easily. Thanks so much Alberto! This was last year, when I was using a former version of Ubuntu (was it Feisty Fawn...?). Recently I tried to use it again to re-install the driver but it didn't work any more... pity. There are other options, or so the Synaptic Package Manager tells me. I tried some of them but I don't remember which ones worked and which ones didn't work.

Anyway, once you get the driver installed you need to edit one of those mysterious files, in particular the file /etc/X11/xorg.conf. Before you even think of editing this file it's best if you make a back up of it, otherwise you might not be able to use your graphic display any more. Since you need the superuser privileges you need to type the following:
sudo cp xorg.conf xorg.conf.bkup
Then, edit the file using your favourite editor. Mine is emacs. Since you need to use superuser privileges to edit this file, you edit it by typing:
gksudo emacs xorg.conf
Then you need to specify that the screen uses Twin View, and some characteristics such as screen resolution. This is what I added to the entry Section "Screen":
#    Option         "RenderAccel" "True"
Option "TwinView"
# Option "TwinViewOrientation" "Clone"
Option "MetaModes" "1280x800,1280x800; 1280x1024,1280x1024; 1024x768,1024x768"
Option "SecondMonitorHorizSync" "50"
Option "SecondMonitorVertRefresh" "60"
# Option "UseDisplayDevice" "DFP, CRT"
# Option "ConnectedMonitor" "CRT"
Noted that some of the text is commented out? This is because I haven't yet managed to work the way I want, but I'm coming to this in a minute. Just to finish, you need to save the file, plug the external monitor, and then restart the window manager by typing Alt-Ctrl-Backspace. You could also restart the system completely but of course that takes longer.

In theory this should make it work, or at least the tutorials listed below say. But I haven't yet managed to have both the laptop screen and the external monitor active. More often than not, the laptop screen appears completely blank and I can only use the external monitor. I tried to add other options following some suggestions from the Internet, but none of them helped, and in some occasions (such as the options "useDisplayDevice" and "ConnectedMonitor" made things worse.

So well, I can use the external monitor after several hours of trying, but it's not yet the way I wanted it to work... I'll keep trying.

Some tutorials that I used:

Monday 4 August 2008

Setting the default display manager in Ubuntu/Kubuntu

One of the good things of Ubuntu, and Linux in general, is that there is a wide range of windows managers. You aren't stuck to the look and feel given by a company, but you can choose among several options. Two of the most popular windows managers in the Linux world are GNOME and KDE. The default manager in Ubuntu is GNOME, but if you use Kubuntu, the default is KDE.

Kubuntu and Ubuntu are very much the same thing but the looks are different, using different user interface philosophies. Ubuntu/GNOME is robust and ideal for those who want to use the computer for productivity, whereas Kubuntu/KDE is flexible and customisable and ideal for those who like looking "under the hood", but it's less reliable (sometimes you really need to look under the hood to fix some specific problems).

I generally find the look and feel of GNOME more elegant, and that of KDE more nerdy, but that's just my opinion.

I sometimes like GNOME, other times prefer KDE, and I end up switching from one to the other whenever one of them announces a new improvement, which is quite often.

But surprisingly I found very little information about how to switch from one to the other... finally, after looking here and there, I found out. It's simple, as these things are once you know them. Here's what you need to do:
  • If you are under Ubuntu (GNOME) and want to switch to Kubuntu, simply install kubuntu-desktop by using Synaptics or your favourite package manager
  • If you are under Kubuntu (KDE) and want to switch to Ubuntu... well, simply install ubuntu-desktop by using adept_manager or your favourite package manager
KDM and GNOME have their own display managers, and oddly enough KDM does work fine under GNOME's display manager, and vice-versa. So there's no real need to change display managers unless you want to. To do this, after installing kubuntu_desktop or ubuntu_desktop simply edit the file /etc/X11/default-display-manager so that it has the following contents:
  • /usr/sbin/gdm to set GDM, that is, the Gnome display manager
  • /usr/bin/kdm to set KDM, the KDE display manager
  • /usr/lib/kde4/bin/kdm to set KDM for KDE4, the new version of KDE which is still under experimentation. To use KDE4 you will need to install the package kubuntu-kde4-desktop (you guessed right)
I like the look and feel of GNOME but I want the flexibility of many of the programs associated with KDE (such as digikam for managing photos, or amarok for playing music). The good thing is that these programs also run under GNOME so it is actually possible to get the best of both worlds.

Tuesday 29 July 2008

I can't delete a KDE4 widget


Last week I installed Furius Weather, a cool widget for KDE4 that displays the weather in your preferred location. This widget, though, is not perfectly integrated in the KDE4 plasma, and for example you can't add it to the task bar at the bottom, or at least I didn't manage to do it.

I tried to add it by following the usual procedure: select "Add widgets" on right-click at the desktop, and then drag the entry for Furius weather to the bar. When I did that, a dialogue appeared that prompted for a theme. I selected my default theme which I had downloaded from Furius Weather. To my horror I saw that the default theme uses large icons which did not fit on the task bar.

I tried to delete the widget using the usual way: select "Add widgets" and click on the star next to Furius Weather, but nothing happened. Actually, I don't know how I ended up having three instances in my task bar! See the image. Now I had almost no space for anything else in the bar.

Today, finally I found the solution. You need to edit the file ~/.kde4/share/config/plasma-appletsrc. In the file I found 18 references to FuriusWeather! I guess that was how many times I added the widget and tried to delete it. I removed all references, restarted the window manager (ALT CTRL <-; don't just log out or restart the computer or KDE will overwrite your modifications), and the desktop came back clean.

Wonderful!

How can I add a personalised wallpaper to KDE4?


I have been trying KDE4 for a few months. This is the new version of KDE, a Linux desktop that has a beautiful interface. But currently it's not as easy to customise as the old trusty KDE 3. For example, do you know how to use one of your own photos as a wallpaper? There are no right-click actions on dolphin, the file manager, and I didn't find any settings anywhere that would tell where to put your images for wallpapers.

If you right click on the desktop and select "Configure Desktop..." you are offered with a selection of wallpapers, and you can even download new ones. But what if you want to use your own photos?

Finally I found out. You can copy your photo to the hidden folder ~/.kde4/share/wallpapers. If you're using dolphin you will need to select "Show Hidden Files" in the "View" menu. Then, next time you right-click on the desktop and select "Configure Desktop..." you can select your new wallpaper.

Easy! But I didn't find any documentation on the webpages about this... how are we supposed to know?

... update ... I found an easier way to add your own wallpaper. In "Configure Desktop" there's a tiny icon next to the drop down selection of the picture. If you click on that icon a file selector will appear to find your own file... see the picture of this blog. I didn't see that one!

Tuesday 24 June 2008

Thunderbird: IMAP Mailbox isn't selectable

There was a problem with Thunderbird that was bugging me for a long while. If I did a search across all my folders, I would always get a pop-up window with the message "not a selectable mailbox" or something like that.

Finally today I decided to investigate how to solve this and I found this blog entry. I tried it, and it worked! This is what I did:
  • I located the .mailboxlist file that lists all the folders of the offending IMAP account. In my case the file was in my home directory. Easy!
  • In .mailboxlist I deleted the entries to the offending folders. Apparently they should haven't been listed there. These folders are meant to be carriers of other folders and therefore they have no messages. Why the file .mailboxlist lists them, I don't know and I would love to hear if someone knows.
  • In my Thunderbird profile folder I went to the directory ImapMail/my.offending.imap.account. In my case the Thunderbird folder is .thunderbird. This folder has a directory with a strange name and the suffix .default; this is the default profile. In this default profile I found ImapMail.
  • Inside that my.offending.imap.account directory there is a list of files with suffix .msf. I simply deleted the files that corresponded with the offending folders.
  • I restarted Thunderbird... and voilĂ , now the offending folders are greyed out and in italics. And there were no more errors of this type.
What a relief.

Thunderbird and Gmail

I'm always trying to find the best way to manage my email. For a very long time I've been using Thunderbird as the main mail reader for various reasons:
  • It is available in Windows and Linux
  • There is a portable version that runs on a USB stick
  • There is a large list of extensions (though far less than firefox)
A problem with Thunderbird, though, is its clumsy use of tags. Up to version 2.0 the only way to manage one's mail was to file them into folders and subfolders. Versions pre-2.0 had the ability to tag mail according to a predefined set of 5 tags, each one able to highlight the email with a different colour. Here are the default colours:
  1. important
  2. work
  3. personal
  4. todo
  5. later


Most interesting of all, each tag had a shortcut number (1 to 5), so it was very easy to categorise the email as you read it.

Version 2.0 allows the possibility of adding your own tags, and to add several tags to each mail message. That's great, I thought, but there is one serious shortcoming: the tag labels are not stored in the imap server. Or so it seems, since if I define a new tag in my work computer and use it to tag an email, I won't be able to see the tag in my home computer.

So, really, Thunderbird 2.0 tags are cumbersome if you use several computers, since you would need to define exactly the same set of tags in every copy of your Thunderbird.

This is one of the main reasons that has led me to gmail. This is Google's popular email service, and it does allow the use of tags. Google's tags are very flexible:
  • Email messages can have multiple tags
  • Tags can be arranged in hierarchies
  • It is relatively easy to filter all messages by tags
Best of all, there is a Firefox extension called GTDInbox that makes the interface with gmail so much more productive, enabling one to apply GTD (Getting Things Done) techniques to the email. But the Gmail interface, even after the extension of GTDInbox, is clumsy and slow. Really, what one needs is to use Gmail server via a local client like Thunderbird.

Is there a way to get the best of both? I think so. Gmail messages can be accessed via imap, and therefore it is possible to use Thunderbird to read Gmail messages without having to download them to the local computer. But currently I'm not aware of any extension that would make it possible to assign Gmail tags from Thunderbird in an easy manner. The way to filter by tags with the imap interface to gmail is via folders. For example, if an email is tagged "office", then Thunderbird will have a folder called "office" with this and all other messages that have that label. So it is very easy to filter by tag.

If one wants to assign a tag to a message, say "todo", one just needs to copy the message to the "todo" folder. If one wants to remove a tag, just delete the message from the folder that has the tag name. All of this and more is explained in this fine blog posting.

Still, wouldn't it be better to assign and delete tags with the click of a button or using a drop-down list? and how does one know what are the tags associated to a particular email?

It would be an excellent idea to build a Thunderbird extension that makes the best of Gmail's tags. Is anybody up to the challenge?

Friday 6 June 2008

Who am I?

OK, I've just created this blog. Blogs are like beasts that are difficult to train and they tend to have their own life, so it's difficult to predict what will end up here. But my intention is to use this blog to comment about the thoughts that I sometimes have while doing my work, or while using computers.

So, to give people an idea of what sort of things will appear in this blog, I'll just write a few lines about me.

I work as a senior lecturer at Macquarie University. My teaching duties typically include introduction to programming for first-year students, and units about language technology. For example, this is what I was teaching this semester (first semester of 2008):
  • COMP125: Fundamentals of Computer Science
  • COMP348: Document Processing and the Semantic Web
  • COMP448: Advanced Topics in Natural Language Processing
I'm an active member of the Centre for Language Technology, of the Australasian Language Technology Association (ALTA), and of HCSNet, a network of researchers in the area of human communication science.

So, I spend most of my time in front of a computer, either preparing lectures, or doing research on various aspects of language technology... but you can read all about me in my webpage.

Enough for an introduction.