Save Power with Linux

Intel has created a new website helping Linux users to reduce the power consumption of a computer (especially useful for laptops): www.lesswatts.org. Flash Electricity On this page many tips and tools helping to save electricity (and therefore get longer battery life) are provided. During the next days (weeks?) I will do some tests and improvements on my laptop and tell you about the results.

Today I would like to start with the installation of PowerTOP, a tool helping to find out how badly the computer is configured and which software is consuming most of the power. It can be downloaded from www.lesswatts.org. Unfortunately it has not yet been integrated into the Ubuntu package system and there are currently no .deb files available. Thus you have to download and compile it yourself to install it – but that’s easy:

  1. Download it.
  2. Unpack it by typing tar -xzf powertop-1.8.tar.gz in a terminal.
  3. Enter the folder: cd powertop-1.8
  4. On Debian/Ubuntu install sudo apt-get install libncursesw5-dev
  5. Type make. The program compiles, this is done in a few seconds. If you get the following error
    /usr/bin/ld: cannot find -lncursesw
    collect2: ld returned 1 exit status
    make: *** [powertop] Error 1

    you have forgotten to install libncursesw5-dev in the previous step. Do it and retype make.
  6. Type sudo make install (it is important that this be done as root/sudo!).
  7. Start PowerTop sudo powertop

After being started, the program will tell you how often the CPU is woken up per second and give suggestions how you can improve the situation. In my case there are currently between 400 and 600 wakeups per second – in the best case three (3) are enough. Thus, my computer is wasting a lot of energy.
To achieve good results, a kernel of version 2.6.21 or later has to be installed. This also activates all functionalities of PowerTop.

In the next post we will install the new kernel on Ubuntu Feisty.

Resize Images on Linux

To publish pictures in my gallery I have to resize them. Doing this picture per picture is annoying, I want to batch resize the images – the best solution would be a command line tool that accepts wildcards (*) so that many files (e.g. all in a specified folder) can be modified at once. With ImageMagick this is a very easy task under Linux: the command mogrify -resize "1200>" */*.JPG resizes all files with the ending .JPG in all subfolders to a width of 1200 pixels. The resize operation is only done if the original is larger than 1200 pixels (option >).

Autorotate Images on Linux

Cameras store information about the orientation of an image in the so-called exif. Many programs automatically rotate images when displaying them. However they do not store the image after the rotation which is necessary if you want to publish your pictures in a gallery. Under linux the tool jhead does this job for you.
The command jhead -autorot *.jpg will rotate all files ending with .jpg in the current folder if necessary (i.e. if the exif-data indicate that you should rotate the image).

How to Scan at UniFR

Students and collaborators at the University of Fribourg have access to a very fast and high quality scanner: the printer and photo coyp machine in the A100 hall at Pérolles II. Simply push the button „Scan“, then choose the „scan to file“ option (in the middle) and follow the instructions (choose pdf or tiff, set resolution, color etc). The scans are then stored in a folder that can be accessed using samba.

To access the scans, a samba client is necessary. Under Linux kbear or the command line interface smbclient can be used. For the command line interface, type the following command (replace by your username):

smbclient //admpr07/FILE_SHARE -U -W UNIFR

After, the same commands as in the terminal ftp client can be used, i.e. get to download a file, mget to download multiple files (e.g. mget *.pdf), cd to navigate and del to remove a file (which is recommended at the end, as everybody has access to the folder).

If smbclient is not installed, you will first have to install it. Under ubuntu this can be done by typing sudo apt-get install smbclient.

If you want to access the files using your own machine or from at home, you will have to connect using VPN.

Comfortable Wireless Networking with Linux

Logo NetworkManagerUntil a few minutes ago I was not really happy with the current configuration for (wireless) networking on my notebook. When I wanted to change to another (wireless) network (e.g. when I was not at home), I had to go to the network settings and change the network there. If I went to a new place, I had to use iwlist scanning to find out which networks were available and then manually enter the essid to the form. Connecting to the network was then rather slow, sometimes it did not work (always switched back to another network that was not available at the current place) and I had to reboot. Thanks to Clem who told me about the NetworkManager this is now over. Originally it is a gnome-tool but it works perfectly on my Ubuntu with XFCE.

I installed NetworkManager by the command sudo apt-get install network-manager, commented out (with #) all lines except those with lo in /etc/network/interfaces and rebooted. The first time I had to start the NetworkManager using nm-applet, since then a small applet has been in my xfce-panel. Similar to windows I can click on it to display available networks. By clicking on an entry, I can connect to the corresponding network (and enter the network key).

Switching from Gaim to Pidgin

PidginIt has now been for a while that Gaim has changed its name to Pidgin (no, it is not pigeon…) due to a lawsuit with AOL and published the version 2 of this instant messenger. Now they have released 2.0.1, so I decided to install this new version.
My Ubuntu did not automatically install the new version. Unfortunately I could not find a .deb-package for Pidgin, so I had to compile Pidgin myself. Before doing that I made a backup of my folder ~/.gaim containing my preferences.

First, I had to download the source and then unpack the .tar.bz2-file using the command tar -xjf pidgin-2.0.1.tar.bz2. After a cd pidgin-2.0.1, I executed the first of the classic three commands to compile a program: ./configure. Unfortunately I got the message You must have libxml2 >= 2.6.0 development headers installed to build. so that I had to install sudo apt-get install libxml2-dev before again executing ./configure. This time everything went well and I was told configure complete, now type ‹make›. Obviously I followed this advise and typed make which busied my aging computer for a couple of minutes. To finalize the installation I had to type make install. After that, everything was ok.
I can now start Pidgin by typing pidgin in the terminal or by using the entry in the menu (Network -> Pidgin Instant Messenger).

Pidgin does not seem to have changed a lot compared to the beta version of Gaim 2 that I had installed before (however it has changed a lot compared to the older versions). The design and icons are different and more modern, but the functionalities are about the same. Unfortunately it does not support video or voice chats, but personally I prefer writing over talking, so this missing feature does not really disturb me. What I really appreciate is that Pidgin supports no less than 15 different protocols. As an example, I use it for my ICQ, MSN and GoogleTalk accounts.

Continue reading «Switching from Gaim to Pidgin»

How to easily sort out bad pictures

If you take many pictures from events or sport matches you certainly know the problem of separating the good pictures from the trash. Most image manipulation programs like are too heavy to use them for sorting the pictures. However, there exists a very light-weighted tool for Linux (and Solaris and FreeBSD): qiv, Quick Image Viewer. Although the download has only about 100KB (provided that gtk+/gdk and Imlib are installed), it offers an incredible number of functions.

Under Ubuntu the installation of qiv is very easy sudo apt-get install qiv. After the installation, qiv can be started using the command qiv where path can be a file or a folder whose content should be displayed. In addition to this pure paths, operators like the * are also possible, for exampleqiv *.jpg opens all .jpg-files in the current folder.

When qiv is the current window and displays an image, many commands (use man qiv for an exhaustive list) can be used. Actually I use only a few of them. The most frequently used commands are:

  • space bar: display next picture
  • backspace: display previous picture
  • Page Up: go five pictures forward
  • Page Down: go five pictures backward
  • d: delete the currently displayed image
  • u: undelete the previously deleted image
  • q: close qiv

When you delete an image it is actually not deleted but moved to a folder .qiv-trash (in the folder of the pictures), so it can be recovered later. At the end of the sorting, it is quite wise to delete this folder using rm -rf .qiv-trash to save some space.

Using qiv I have managed to considerably speed up the tedious task of sorting the images before editing and publishing the good ones.

Zattoo for Linux

ZattooFinally Zattoo is available for Linux! Today I’ve got a newsletter from Zattoo telling me that Zattoo can now be downloaded for Linux. With Zattoo 43 TV-channels are available for free. You simply have to register (which means: indicate the email-address and choose a password), download and install the software (for Windows, Mac and Linux), start it, login and choose the channel. It is very easy to use and the quality is surprisingly high. There are more channels than we get with Cablecom and it is free. The software is available in English, Deutsch, Dansk et Français (la versione italiana e la versiun romontscha mauncan aunc…).

I immediately downloaded the .deb-package of Zattoo (rpm’s are also available) for Linux and installed it on my Ubuntu Edgy Eft. The installation was very easy, however it did not work on the first try: When executing the command sudo dpkg -i zattoo-2.2.8.5561-i386.deb the installation failed with the message Package libgtkglext1 is not installed. I therefore installed this missing package with sudo apt-get install libgtkglext1, then re-executed the command sudo dpkg -i zattoo-2.2.8.5561-i386.deb and after a few seconds everything was fine.
Using the terminal I could start Zattoo with the command zattoo_player & (it could also be started using the menu Multimedia and then Zattoo player, but personally I prefer the terminal), log in and choose the channel and enjoy the new TV. It works!

New Thunderbird in Action

ThunderbirdThunderbird 2.0, the new major release of the free opensource email-client has now been out for a couple of weeks. Yesterday I finally decided to upgrade to this new version. Already after a few hours I can say that the new release definitely has some advantages over the old one and that Thunderbird has now become even better.

Let’s first talk about installation of the new version of Thunderbird. Actually the installation under Linux was extremely easy: I simply replaced the Thunderbird-folder (i.e. the folder in my home directory where I have installed Thunderbird – the mail data is stored in another folder, namely ~/.thunderbird) with the untared files of the new version of Thunderbird. I then started Thunderbird which automatically updated all installed extensions (now called add-ons) and the installation was done!

In my opinion, Thunderbird 2.0 has some strong advantages over its predecessors, and obviously even more advantages over the rivals. Some advantages are:

  • New, better interface.
  • The search tool which was already great before has become even better. It is now really fast to find a message by searching after a keyword. Additionally, Thunderbird now dynamically updates the search results, i.e. the result list is permanently updated while typing the key word.
  • The notification has been considerably improved: In older versions of Thunderbird there was a small window popping up in the bottom right corner saying that there was a new message. However, this notification did not work under Linux, so I just heard the sound and then had to switch to Thunderbird to see whether the newly arrived message was worth reading. Now this notification also works under Linux and displays useful information: sender, subject and the beginning of the message. Thus I can decide about the appropriate treatment of the new message without having to switch to Thunderbird.
  • The Spam filter is not really an improvement over older versions of Thunderbird as it was already integrated. However, this adaptive filter is an important reason for me why I use Thunderbird. Every day it filters out between 100 and 200 Spam messages. False negatives (i.e. it does not filter a Spam message) are rare, false positives (i.e. a message is filtered although it should not) hardly ever happen.
  • Dictionaries can be installed as add-ons. When editing messages, these are automatically corrected. The language can be chosen in a small dropdown-menu, without having to go to a preferences menu. Especially for people like me who often write emails in different languages, this feature is extremely useful.

Mail View Toolbar Button For me, the new release of Thunderbird has only a single, small disadvantage over its predecessor: the mail view toolbar button has disappeared and has to to be activated manually (go View->Toolbars->Customise and drag it to your preferred place). However it can not be placed where it used to be in older versions. I have now placed it in the top menu bar, just on the right of the Help-menu entry. I will first have to get used to that.
The main problem here is that this button does not really work as I expect it: when changing the selection this does not have an immediate effect on the list of messages displayed. When I change it from «Unread» to «All», there are still only the messages displayed that are unread. The only effect it seems to have is that the search also finds messages that are read. I will try to find out how I can change this strange behaviour…

These are only some of the good points of Thunderbird, the release notes give you more reasons to immediately uninstall Outlook to replace it with Thunderbird.

How to easily print code

For the first-year project in computer science at the University of Fribourg (where I am working as an underassistant) I had to correct exercises handed in by the students. 5 groups handed in their solutions, for each group I had to print out 7 files containing programming code (written in the Lisp-dialect Scheme). Opening all them in DrScheme takes a lot of time – too much as I decided.
I therefore searched the web for an easy solution and found it in the unix (terminal) tool enscript. For me it is the perfect solution for printing code. It includes syntax highlighting for numberless programming languages, including Scheme. For example the command

enscript -2 --highlight=scheme -r -d diufpr06 switch.scm

prints the file switch.scm on the printer diufpr06 (option -d), printing two sides per page (option -2) in landscape-format (option -r). The –highlight-option allows to indicate the programming language for which the syntax should be highlighted. The list of available languages can be displayed by typing enscript --help-highlight, it might be usefull to add | less to the command, otherwise the list is not really readable.
With the option -G (not used here) quite fancy headers are printed. All options can be displayed using man enscript. The installation of enscript is very easy under Ubuntu: just type sudo apt-get install enscript and within a few seconds everything is done. Under MacOS enscript is even installed by default.