firestarter — autoswitch between wired and wireless networks 

February 26th, 2011

Ok, so we roam about a lot these days, switching between different networks and different network infrastructures all the time. If you are like me and you use Linux with the Firestarter firewall, you probably wish there was a way to get Firestarter to seamlessly reconfigure between wired networks (say on eth0 interface) and wireless networks (say on wlan0 interface). If that is the case, then do read on, as this post presents a simple approach to achieve just that.

latex — set page number 

April 6th, 2010

How to set the page number for the current page in LaTeX? i.e., how to reset page number counter in a LaTeX document? Simply set the latex page counter to a specific value. The syntax is as follows:

ocw — open courseware video lectures for machine learning 

February 5th, 2009

Open CourseWare (OCW) refers to publicly available learning resources. OCW started back in 2002 with an initiative brought forward by MIT. Since then many top universities and research institutions started offering high quality learning materials online freely to the public. On this page I'll keep a list of useful OCW resources that I have come across.

munpack — decode base64 mime multi-part email attachments 

January 3rd, 2009

The other day I went to scan a document using our Ricoh Aficio 3030 all-in-one photocopier, scanner and fax. The machine allows you to scan documents which then are emailed to you as attachments in PDF format. Sounds great in theory. Unfortunately, it has one limitation (possibly imposed on it by our network admins): the maximum attachment size is set to 2 MB, that is Aficio 3030 splits attachments greater than 2 MB into multi-part attachments and sends each in a separate email. Thus, after scanning a four page document I got two emails as shown in the screen-shot below.

opensuse 11 — beta screenshots 

April 19th, 2008

Less than two months remain untill the eagerly anticipated openSUSE 11 is finally released. The current official screen shots of the beta1 release can be found on the openSUSE website and openSUSE is looking slicker than ever! I am very eager to take the openSUSE beta1 for a test drive and to post my own screenshots. I have downloaded openSUSE 11 beta1 torrent and got some nice screen shots of the installer… however, no luck with actually running SuSE 11 under VirtualBox.

avi to cd — avi trim, avi to iso, iso to cd with cdrecord 

March 29th, 2008

Have you ever come across an AVI file which is just a few megabytes too large to fit on a CD or a DVD? Well I have… and in this post I'll go over a crude solution to this problem. That is, I'll assume that the very end of the AVI file is not that important and I'll simply trim it off. Of course, an alternate solution is to re-encode the file at a lower bit-rate. However, trimming seems just so much simpler.

mplayer — multiple sound cards: select audio device 

March 25th, 2008

Mplayer is the ultimate media player. Bold statement, huh? Well mplayer is loaded with features, options, switches and other functionalities. If default settings satisfy your needs then that is great. However, if you have to use some of the non-default functionalities then mplayer's shell syntax can take a little getting used. This post contains examples of how to select an audio architecture that mplayer uses (e.g. ALSA, OSS, etc.) as well as how to select a specific audio device if you have multiple sound cards.

ubuntu 8.04 hardy heron — beta screenshots 

March 22nd, 2008

We have recently upgraded our computers. I decided to go for a new main distro for the new hardware: Ubuntu 7.10 Gutsy Gibbon. I have been very happy with it and I am looking forward to the next Ubuntu release: 8.04 Hardy Heron. Here are a few screen-shots of its current beta release. Note that these were taken under VirtualBox emulation. :D

synergy — open source keyboard-mouse switch software 

February 28th, 2008

A KVM (keyboard video mouse) hardware device can be used to share the same keyboard, display, and mouse between many computers. In contrast, synergy is a software solution that enables sharing, between many computers, of the same mouse and keyboard but not the screen. Synergy can be thought of as software-based KVM switch, but without the display capability. This means that each of the computers that the mouse and keyboard are shared between needs its own monitor. The main advantage of this approach, over solutions such as VNC, is the raw speed. Mouse and keyboard device inputs are efficiently compressed and transmitted over the network without the overhead of bulky video. An advantage over hardware KVM is that synergy is an open source project and thus the software can be downloaded and used free of charge.

connection reset by peer — ssh sshfs error 

February 14th, 2008

Recently, after re-installation of Ubuntu Linux, sshfs mount, from a Fedora Core 6, has failed with the following error message, read: Connection reset by peer. In fact this error is not due to sshfs but its ssh subsystem. Unlike ssh, sshfs does not give a very descriptive error in this case. The above error happens due to a possible security threat, namely the man-in-the-middle attack. If we know that the security has not been compromised then it is very likely that the RSA host key has been changed. The fix for the above error is very simple. All one has to do is to remove the cached host key from the ~/.ssh/known_hosts file. This post lists steps needed to get rid of the read: Connection reset by peer sshfs error.

gimp — creating cool flame effects 

February 13th, 2008

Learning how to use gimp can be either a painful experience or a very enjoyable one. This largely depends on whether you are reading through tutorials or learning by watching someone else use gimp. This is where YouTube videos make a huge difference. Recently, I stumbled upon a YouTube gimp tutorial on how to make a cool abstract wallpaper. The YouTube video is shown below.

matlab djpegxx bug — problem calling ghostscript: system error 

January 27th, 2008

Recently, I wrote Matlab code that does some processing, plots the results and saves the plots as compressed JPEGs. When I run it on a cluster as part of a batch job I got the following error: "Problem calling GhostScript. System returned error". Apparently Matlab releases prior to R2007a suffer from a bug to do with printing compressed JPEGs. Here is how to reproduce the above error. First, run Matlab as follows:

linux blog forums — brand new discussion forums are now open! 

January 19th, 2008

Linux Blog now has discussion forums, url: Whether you are after a quick feedback on a Linux related issue or a general discussion about Linux, the Linux Blog Forums are there to provide this facility for you! The forums are based on the highly popular phpBB software. We are looking forward to seeing the forums community grow. Join us today! :D

rmnl — remove new line characters with tr, awk, perl, sed or c/c++ 

January 15th, 2008

How to remove new lines from files or pipe streams under Linux? This post contains simple examples that show how to use common Linux shell tools such as tr, awk/gawk, perl, sed and many others to delete new line characters. C and C++ source codes are also provided. They can be compiled into a binary tool that removes new lines. To get started, here is an example text file: days.txt. Lets have a look at its content by running the following command from shell.

firefox — can't connect securely … security protocol not enabled 

January 5th, 2008

In an effort to keep the web communication secure the web browser support for older, inferior, security protocols gets phased out over time. This encourages web server administrators to employ up to date security protocols. Unfortunately, this is not always successful and some web servers still employ older and weaker protocols. If you have no alternative but to use a less secure service this post explains how to enable older security protocols in the firefox web browser.

the power of reddit: spreddit — detailed web server statistics 

December 29th, 2007

Recently, I posted a Linux Blog article on a number of social bookmark sites including,, and The article generated limited interest on most of these sites with the exception of The volume of reddit readers visiting in the initial twelve hours was extraordinary. What follows are detailed web server statistics for the sub-domain under redditor invasion. For the most part, the stats are based on the free AWStats software. However, some Google Analytics visitor info and Feedburner RSS feed subscription stats are also included.

latex — professional résumé layout made simple 

December 20th, 2007

Résumé, Curriculum Vitae or simply CV is an important brief about your professional life. It is likely to be one of the first contacts with a prospective employer. Curriculum Vitae means course of life in Latin. So what exactly should a Résumé contain and how detailed should it be? There is no silver bullet answer. A fair amount of variability exists in Résumé expectations across different employers and different countries. For instance, career advisors in Australia tend to recommend three to four page resumes and that is what I have used for a while. Recently however, I have switched to a European style single-page resume. This article is not so much about the actual Résumé content, as it is about professional layout and formating. This is where the LATEX Project comes into the picture. LATEX is a programming language used for technical publications. Simply put, it uses the TEX engine (a set of complex rules) to figure out how to make your publications look great! Given a good document class file all you need to provide is the actual content.

no volume control gstreamer ... found — no sound on ubuntu 

December 19th, 2007


I was introduced to Linux via RedHat distributions, such Fedora and CentOS. With Fedora you tend to learn a lot because so many things are broken! I also used Novell's openSuSE for a while. I found it to be much more polished than Fedora. SuSE includes Yast configuration utility: a central GUI application where you simply click and things just work, i.e. no need for editing of configuration files. SuSE is however quite chunky, i.e. it is quite hungry for system resources. Very recently, I have installed Ubuntu. I have heard many Ubuntu users praising it, while users of other distros were ridiculing it for the lack of development tools. Well, since installing it… I have been impressed and I started praising it too :). Ubuntu is targeted for the end users as a desktop environment. It is very polished, things just work. It is quick and compact. Installing extra Debian packages is not a problem. Synaptic package manager handles it flawlessly. That said however, there have been a few errors cropping in here and there, especially to do with user management and user permissions. One such error, No volume control GStreamer plugins and/or devices found, prevents users from accessing the audio device. Note however, that the above error is caused by a Gnome bug and is most likely distribution independent. In this article, I will present a number of approaches to getting around this bug.

java jvm bug — broken java application gui in compiz and beryl 

December 17th, 2007

Compositing window managers, such as Compiz and Beryl, are eye candy we have grown accustomed to. However, there is bug in certain editions of Sun's Java Virtual Machine (JVM) that makes Java applications not render some parts of their Graphical User Interfaces (GUIs). All AWT and Swing Java programs suffer from this bug, including the popular Netbeans and Matlab platforms. A screenshot of Matlab running under Compiz and suffering from the JVM bug (i.e. with partially rendered GUI) is shown below.

hostname: unknown host — hostname not resolving error 

December 15th, 2007

Recently, I encountered the following error message on one of our openSUSE boxes (version 10.2 — if you are not sure which distro version you are running, then see this short post: finding out Linux release version).

a2ps — printing files from linux shell 

December 12th, 2007

Linux shell is a powerful tool, since it is easy and convenient to perform many tasks directly from it. An example of this is sending files to the printer. While there are many ways of achieving this, f.e. to send content as is you could use the lpr or kprinter commands. In this post however, I will concentrate on the use of a small but very useful GNU utility called a2ps. The a2ps program is used to pre-format files for printing on a PostScript printer. This means you can parse different types of files into PostScript (PS) format supported by your printer. This is not all however, a2ps recognises many ASCII based formats (such as TEX files, Matlab/Octive files, C/C++ source code, etc.) and can perform highlighting and styling to make your source code printouts easier to read. a2ps supports many options, you can browse the a2ps man page to get familiar with them.

find — how to replicate a complex directory and file structure 

November 29th, 2007

Consider an example where you have a directory, called timit with many sub-directories that contain lots of files. Now, lets say you want to create a mirror copy of this complex directory structure in the /tmp directory, as well as a selective copy of its files based on certain pattern. Lets say we only want to copy files that have the following string somewhere in their filename, snr15. There are many possible solutions to this problem, you could write a perl or bash script, you could possibly use the rsync utility, but the simplest way I could find (on the Fedora Forum) is to use the Linux find command. Let me show you how it is done. It is a two step process. First step is to create a mirror copy of the directory structure as follows.

tar — how to create and extract tar.gz and tar.bz2 archives 

November 27th, 2007


The commonly employed archive types on Linux and Unix systems are tar, tar.gz and tar.bz2 archives. Note that tar.gz and tar.bz2 archives are simply gzip-ped and bzip(2)-ped tar archives, respectively. Working with these files is made very simple through the use of GNU tar utility, which is included as part of the base packages in modern distros. In this article, I'll show you how to create and extract compressed archives using tar.

./ — dealing with a leading minus in filenames under linux shell 

November 26th, 2007

Dealing with files whose filenames contain special shell characters can be tricky. Unless you know how to handle their filenames properly, you may not be able to perform even simple operations on such files. In this post I'll show you how to deal with files starting with the minus (-) character, as well as with files that contain spaces. Let us consider a simple example. I'll start with a pdf file outline.pdf and rename it so that the resulting filenames start with special shell characters.

cat /etc/*-release — finding out linux release version 

November 23rd, 2007

If you have a lot of different Linux distributions installed on many different machines it is easy to forget what distribution version runs on which PC. Well worry not! It is easy enough to findout. On Novell's Open SuSE Linux, the distribution release information is contained in the /etc/SuSE-release file. Simply cat it to see its content in your terminal.

john (john the ripper) — a password cracker for linux and windows 

November 20th, 2007


John the Ripper (a.k.a. JtR, or simply john) is a popular fast password cracker for both Linux and Windows. It is quite useful for identifying weak passwords. By weak, I mean ones that do not take a long time to crack. In this article I will show you how to install and use John the Ripper utility to crack weak passwords.

compiz and metacity — how to replace the current window manager 

November 18th, 2007

In this post I will show how to switch between compiz and metacity window managers using shell commands as well as a GUI tool. compiz is a window manager that uses 3D graphics acceleration via OpenGL. compiz is quite popular because it has matured somewhat and it produces eye-candy desktops. However, they are situations where running a window manager other than compiz is more desirable. One reason for this is the lack of OpenGL capabilities on older computers. Another reason is that some of the compiz's visual effects can interfere with full-screen applications, such as games. For this reason, gamers often tend to switch off compiz prior to starting games. The reason why I replace compiz with another window manager, namely with metacity (the default GNOME window manager) is that screenshots taken under compiz using gnome-screenshot lack window decorations! I have experienced this under both Fedora and Ubuntu. Since screenshots without window decorations don't look quite as good as with the decorations, I use the a GUI tool called desktop-effects to enable and disable compiz when needed. Here are example screenshots of desktop-effects tool without window decorations and with window decorations, respectively.

alsamixer and alsactl — adjust and save alsa mixer settings 

November 17th, 2007

In this entry I will show you how to change ALSA mixer settings using alsamixer and how to save them using alsactl so that the changes remain in place after reboot. First things first, while there are many graphical audio mixer tools, such as kmix, ALSA does come with a neat command based tool for adjusting mixers settings. ALSA mixer is called simply that, alsamixer. It is easy to operate. Simply use the left/right arrow keys to move between devices, and up/down keys (or numeric keys) to adjust their volumes. A screenshot of alsamixer is shown below.

lprm — cancel print jobs 

November 16th, 2007

lprm is a useful tool for removal of active or queued print jobs. Lets start by having a look at line printer queue status using lpq utility. Simply type lpq at the shell to produce a list of active and queued jobs for your default printer.

... xcb_xlib_unlock: assertion ... failed — matlab jvm error 

November 15th, 2007

Few days back I have installed Red Hat Fedora 8. I have put Matlab on there as well. When I tried to start Matlab using this command:

cups — fixing cups printer problem: client-error-not-found 

November 12th, 2007

Recently, my CUPS server crashed when I tried to print a pdf document. Strangely, the default printer, CUPS/printer, was replaced by CUPS/abort-job! Accessing GNOME printer configuration under Fedora Linux produced the following CUPS server error message.

lsof |grep snd — how to free a linux sound device 

November 2nd, 2007

A program attempting to open a sound device for exclusive access may fail, if that audio device is already in use by another program. Also, depending on the capabilities of the audio device, such as whether it is full-duplex or not, errors may occur if capture is requested during playback. The actual error messages produced are program and operating system dependent. However, some typical error messages are listed below.

gnome-screenshot — screen capture under linux 

October 19th, 2007

Screen capture in Linux is made simple by using Gnome tool called gnome-screenshot. An example screenshot produced using gnome-screenshot is shown below.

latex.bashrc function for latex2e source compilation 

October 12th, 2007

Here is my .bashrc function for compilation of LATEX2e sources into dvi, ps and pdf output file formats. The function includes bibtex and index processing.

growisofs — burning iso files to dvd using growisofs 

September 26th, 2007

It is very simple to burn ISO files to DVDs using growisofs under Linux. For example, to burn file.iso to /dev/dvd DVDR(W) device the following command can be used from bash.

cups — fixing cups printer problem: lpd failed 

September 25th, 2007


Recently, our HP2420dn printer stopped working. Well, it was not really the printer… printing jobs went but nothing came out of the printer. The cups server has put the printer into a stopped state with the StateMessage /usr/lib/cups/backend/lpd failed. What caused this? Well, I am not really sure, however the cups server error logs (http://localhost:631/admin/log/error_log, or alternatively /var/log/cups/error_log) tell at least part of the story, as shown below.

kompare — comparing files using kde kompare 

September 23rd, 2007

KDE kompare is a GUI front end for file comparison tools such as diff, cmp, or comm. While programs like diff are Linux essentials, their output is console based and in many instances is used by other tools. On the other hand, KDE kompare front end is well suited for the end user. It has an extremely neat interface with side by side comparison of two files, where differences are highlighted using different colors for deletions, changes and insertions. An example screenshot of KDE kompare is shown below. Two LATEX2e files are compared, paper_old.tex and paper_new.tex. Both files are located in /tmp directory. In this example the following shell command was used to launch KDE kompare:

aspell — spelling with foreign dictionaries 

September 22nd, 2007


Regardless of whether you are a spelling genius or a spelling disaster, like myself, it is useful to have a spellchecker handy. There are number of tools available for this purpose. For single words, Google is quite useful. There are many other websites with spellchecking and lexical capabilities, such as the free dictionary, Cambridge dictionary,, and wordnet, to name just a few. One could also use chunky tools such as the Open Office Writer. Instead, I use a light-weight shell program called aspell. aspell may be used to check spelling interactively from the shell as shown below.

screen.screenrc configuration file 

September 18th, 2007

Linux has many useful tools and utilities. Remote shell manager called screen is certainly one of them. screen allows for remote persistent shell sessions that are immune to connection hangups. The manager has an extensive and powerful set of features. Once mastered, it becomes an essential tool.

mencoder — dvd rip one-liner 

August 16th, 2007

I use mencoder to rip DVDs into .avi files under Linux. The following one-liner assumes that the DVD is mounted and available under dvd://, the first track is to be encoded into MPEG4 video with 1200Kbps bit rate, the video is (or gets) scaled to 640 width, the lame lib is used to encode sound into mp3 at 128Kbps bit rate. Here is the (long) one-liner, enjoy:

rar and unrar — rar compression and decompression tools 

August 13th, 2007

Here are some useful examples of rar and unrar usage under Linux shell. To create a rar archive archive.rar containing directory called dir use the following command.

mmv — move multiple files by wildcard patterns 

July 15th, 2007


If you ever have to rename or move multiple files under Linux, then the mmv©2007 shell command will make your life easy. The mmv utility will also come in handy for copying multiple files, appending content of one file to other files, as well as for creation of links.

tar bz2 a directory — a .bashrc function 

July 10th, 2007

To make compression of directories into .tar.bz2 archives quick and simple, put the following function in your .bashrc file:

VPS Hosting Referral Code DZZCC3

Add me to Technorati Favorites Vote for me on Blog Catalog