Saturday, May 10, 2008

Evolution: Import addressbook from old home directory

When i switch from Ubuntu to Fedora, i just backuped my home directory and didn't create a backup from my mails/addressbook with the function provided in Evolution. I thought copy the mails and addressbook from your old to your new home directory will do the job. For the mail the idea is right, but not for the addressbook. because in the background a database server is running.

Open Evolution, create the same numbers of addressbooks you had in your old one, create for every addressbook one contact (without this step no directory will be created in $home/.evolution/addressbook/local for an addressbook).

Close Evolution and stop the database server with

evolution --force-shutdown

Now copy the addressbooks and start Evolution.
The next time i will use the backup function from Evolution, sure !

UFO AI on Fedora 8

UFO AI (http://ufoai.sourceforge.net) is a nice game, you have to save to world from aliens.

I wanted to play it, so i had to install it first. First I used yum, but the version available was one number behind. So i downloaded the Linux installer from the site, 400MB. The installation was easy as the download. You also need the packages SDL and SDL_ttf. Your graphic card should support direct rendering, you can get information about your card with glxinfo. The command glxgears draws running gears on your screen.


To start the game, call $ufoai/ufoai.
Do not call $ufoai/ufo directly because the script ufoai sets necessary environment variables. If you do, you will see a window with a red border and nothing more.

After starting i got this nice error:
./ufo: error while loading shared libraries: libcurl-gnutls.so.4: cannot open shared object file: No such file or directory

I started yum, looked for libcurl-gnutls, couldn't find anything. Searched the web. Found out that the binary is compiled on Ubuntu, the knowledge didn't solve my problem.

To get ride of this problem, i tried to create a link from libcurl.so.4 to libcurl-gnutls.so.4 and it worked.

cd /usr/lib
ln -s libcurl.so.4 libcurl-gnutls.so.4


Run again $ufoai/ufoai, the game started but without a sound and hanged up on exit. The problem was that SDL loaded the wrong sound driver. Comment out the line SDL_AUDIODRIVER="alsa" in $ufoai/ufoai solved the problem.

Now the game even works better than on Windows.
When i run the game in full screen mode, the multimedia keys on the keyboard, like Launch Calculator or volume lower/raise, doesn't work.

Wednesday, May 7, 2008

Huawei E220 UMTS Modem

One of the reasons why i changed to Fedora was my UMTS Modem. Ubuntu does not detect it as a modem and calling the program with udev doesn't work. So every time i plugged-in the modem, i had to run the program.

That page helps a lot for the first time with a E220 modem (and others, in German): http://linux.frankenberger.at/Huawei_E220.html

With Fedora 8 you just need to create a new network interface with the Network Manager, enter the phone number, user, password and the init connection string for your connection. Then you are ready to start your connection with ifup/ifdown.


Disable PIN code
If you are to lazy, like me, to disable the pin code, use udev to send the pin code every time the modem is pluged in:
Create a file with the name /etc/udev/rules.d/50-UMTS.rules and put the content in it:

BUS=="usb", KERNEL=="ttyUSB0", SYSFS{idProduct}=="1003", SYSFS{idVendor}=="12d1", SYMLINK+="umts", RUN+="/usr/bin/wvdial -n --config /etc/wvdial-pin.conf"

Maybe you have to replace the values of SYSFS{idProduct} and SYSFS{idVendor} to match your modem, use lsusb to get the values.

As you can see, you need also the file /etc/wvdial-pin.conf which contains the pin:

[Dialer Defaults]
Modem = /dev/ttyUSB0
Baud = 460800
SetVolume = 0
Dial Command = ATDT
FlowControl = NOFLOW
Init1 = ATZ
Init2 = AT+CPIN=XXXX


Replace XXXX with your PIN code.
Warning: The file wvdial-pin.conf should only be readable for root and no other users. (chown root:root /etc/wvdial-pin.conf;chmod u=rw,go-rwx /etc/wvdial-pin.conf)

When your remove the -n option for the wvdial command in the file 50-UMTS.rules, you will see in a log file (usually messages), what wvdial is doing and your PIN code, so be careful.


Nice script for the desktop
I have written a script for ifup/ifdown that shows the status/errors via a nice windows. First it wats til /dev/ttyUSB0 is available.

Command: network.sh up|down networkinterface
A newer version of the script can be found at my Linux Stuff page.
#!/bin/sh


if [[ $1 = "up" ]] ; then
CMD="/sbin/ifup"

#wait for modem

DEV=/dev/ttyUSB0

if [ ! -e $DEV ] ; then
(echo 1; while [ ! -e $DEV ] ; do sleep 3; done; sleep 7; echo 100) | zenity --progress --text="Auf Modem warten ..." --auto-close --auto-kill --pulsate
fi
fi

if [[ $1 = "down" ]] ; then
CMD="/sbin/ifdown"
fi


if [[ ! $CMD || ! $2 ]] ; then
zenity --error --text="Was willst du machen ?"
exit 1
fi

zenity --progress --auto-kill --text="Bitte warten ..." --percentage=30 --pulsate <<<30 progress_pid="$!" msg="`$CMD">&1`
EXIT_CODE=$?

kill $PROGRESS_PID

if [ $EXIT_CODE != 0 ] ; then
echo $MSG
zenity --error --text="$MSG"
exit $EXIT_CODE
else
if [[ $1 = "up" ]] ; then
zenity --notification --text="Verbindung hergestellt" --window-icon=info &
PROGRESS_PID=$!
sleep 30
kill $PROGRESS_PID
fi
fi

exit 0

Nautilus - where are my backup files ?

Some nice editors create a backup file with the extension *.*~
But it would also be nice, if you could see them in the file browser. But this isn't the case.
I tried the option "View/Show hidden files", but that showed me only the files starting with a dot.
The only solution to show your backup files is to open the settings dialog and check the option "Show hidden files and backup files". But that isn't a solution you can live with because you do not want to see your hidden files every time you open a browser.

I search the web for a solution and i found a setting which seems to solve my problem.
gconftool-2 -s -t bool /desktop/gnome/file_views/show_backup_files true

But it doesn't work. Later i have found out that this is an unsolved bug from 2005!! (http://bugzilla.gnome.org/show_bug.cgi?id=313307).

Monday, May 5, 2008

Where the hell is the Launch Calculator entry in gnome-keybinding-properties ?

Short answer: There is no entry like in Ubuntu. I searched the web, but nobody knows why. The workaround is to create a custom shortcut.

HOWTO:
  • gconftool-2 --set --type string /desktop/gnome/keybindings/calc/binding "XF86Calculator"
  • gconftool-2 --set --type string /desktop/gnome/keybindings/calc/action "gcalctool"
replace calc with something that describes your shortcut.
replace XF86Calculator with your key, use the command xev to get the name of the key
action is the executed command when the key is pressed.
Restart your Gnome session. I think logout and login will do.

Switch from Ubuntu to Fedora

"Never change a running system"

Ubuntu worked (for me). Why i wanted to change ?
  • my UMTS modem was not really supported by the kernel.
  • i missed many basic apps (yes, i can download it via the internet, but do i know all the names of the packages ?)
  • i got my ordered Fedora DVD
I created a backup from my home directory and installed Fedora.
Now the real pain begins. Stuff that have worked in Ubuntu won't work in Fedora.
  • "Launch Calculator" key on the keyboard
  • Evolution won't import my old addressbook.
  • Apps crash
The only thing that works without a problem is my UMTS moden.