Soma's Blog

April 11, 2010

Flash and Gmail B0rked in Firefox 3.6.4pre

Filed under: Linux,Ubuntu — somanov @ 21:51

I updated Firefox on my netbook to Firefox 3.6.4pre today. As a result gmail stopped working and every site that uses even a tiny bit of flash completely froze my browser. Some googling revelaed that apparently the new “plugin process isolation feature” is the cause of this problem. Right now it can be fixed by going to about:config and setting = False

There. now back to watching a cat jump into a box and fall over…


March 17, 2010

Making Java work in Firefox 3.6 (Namoroka)

Filed under: Java,Ubuntu — somanov @ 15:34

About two weeks ago I carelessly installed Firefox 3.6 on my Kubuntu 9.10 System (forgot to turn off the mozilla repository before doing a full-upgrade). When I finally realized what had just happened, Firefox 3.6 was already up and running and I figured I might as well give it a try. All in all it works quite well and I have not had a lot of trouble with it.

Today I realized that java applets dont work (If I needed further prove for the fact that java has become completely irrelevant for websites this is probably it). Luckily the solution is relatively simple:

cd /usr/lib/firefox-3.6.2pre/plugins
sudo ln -s  /usr/lib/jvm/java-6-sun- 

Then restart Firefox and check that java is listed in about:plugins .

Now I am again able to use the ONE java applet that I am forced to use on a regular basis. Hooray!

February 14, 2010

“Two Finger Scrolling” for Ubuntu 9.10 on Dell Latitude E6400

Filed under: Ubuntu — somanov @ 22:31

Was bored today, lying on the couch with my notebook and wondering why Apple users get neat features like two finger scrolling and the linux crowd does not.

Well a few minutes of googling later I had learned that this is indeed supported by Linux but not enabled by default in Ubuntu. I had also found some very helpful sites that explain how to set it up for Ubuntu Karmic.

This blogpost talks about setting up multi-touch scrolling for the Asus Eee 1005HA netbook and the process in general. And this forum thread talks specifically about the ALPS touchpad which is built into my Dell Latitude E6400.

The main problem here appears to be that the ALPS touchpad does not support two finger recognition. However it is somehow “pressure sensitive”. Using the pressure value you can have the driver guess how many fingers you are probably using at the moment. The values output by the touchpad may vary between models, so it is best to start by debugging the touchpad output with synclient:

Reading out the touchpad values
For this Option "SHMConfig" "true" must be set in the xorg.conf .. but my xorg.conf does no longer contain a device section for the touchpad as most of the hardware is handled by HAL now. So I ended up creating a policy .fdi file for HAL which looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<deviceinfo version="0.2">
<match key="info.product" string="AlpsPS/2 ALPS DualPoint TouchPad">
   <merge key="input.x11_options.VertTwoFingerScroll" type="string">1</merge>
   <merge key="input.x11_options.HorizTwoFingerScroll" type="string">1</merge>
   <merge key="input.x11_options.EmulateTwoFingerMinZ" type="string">70</merge>
<match key="input.x11_driver" string="synaptics">
    <merge key="input.x11_options.SHMConfig" type="string">True</merge>

After restarting HAL and the xserver (or rebooting) one can start synclient with

synclient -m 10 output

Synclient will give you a lot of information about your touchpad.. Take a close look at the “f” and “z” columns. The “f” column should report the number of fingers used on the touchpad, but unforatunately it always outputs “1” on my computer. The “z” column represents the pressure value. Try operating the touchpad with one or two fingers and see how the value changes. You want to find a threshold that cleanly seperates operating with one finger from operating with two fingers. For me this threshold was about 70.

Enable 2 Finger Scrolling
Now all we have to do, is tell the driver to emulate “two finger mode” if the pressure value is over 70. This should be easy right? In a perfect world it would be. If you look closely at the above xml again, you will see that I put the corresponding lines right at the beginning of the file (and also the lines to enable two finger scrolling). My xorg.log shows that the statements are parsed correctly when the xserver starts, but for some reason they didnt have any effect in Ubuntu 9.10.

Fortunately the blogpost i mentioned before also shows a bash script to work around this problem. I had to modify some of the values in the original script. In particular the statments in the script tell the driver to emulate two finger operation when finger-pressure AND the finger-width (“w” column in the synclient output) exceed thresholds. Unfortunately my touchpad always reports a finger-width of 0, so I had to slightly adapt the script:

# Use xinput --list-props "SynPS/2 Synaptics TouchPad" to extract data

# Set multi-touch emulation parameters
xinput set-int-prop "AlpsPS/2 ALPS DualPoint TouchPad" "Synaptics Two-Finger Pressure" 32 70
xinput set-int-prop "AlpsPS/2 ALPS DualPoint TouchPad" "Synaptics Two-Finger Width" 32 0
xinput set-int-prop "AlpsPS/2 ALPS DualPoint TouchPad" "Two-Finger Scrolling" 8 1
xinput set-int-prop "AlpsPS/2 ALPS DualPoint TouchPad" "Synaptics Two-Finger Scrolling" 8 1 1

# Disable edge scrolling
xinput set-int-prop "AlpsPS/2 ALPS DualPoint TouchPad" "Synaptics Edge Scrolling" 8 0 0 0 

# This will make cursor not to jump if you have two fingers on the touchpad and you list one
# (which you usually do after two-finger scrolling)
xinput set-int-prop "AlpsPS/2 ALPS DualPoint TouchPad" "Synaptics Jumpy Cursor Threshold" 32 110

Note that this script only works if the SHMConfig option I mentioned above is active. The script also disables the “edge scrolling” on the touchpad to give you a little more space.

The end result
It works, but it does not work well. I played around with various threshold values for a bit, but I could not find a combination which gave me a responsive and consistent feeling. Finally I ended up disabling the feature again. I think the main culprit here is my touchpad, which does not report enough data to distinguish one-finger from two-finger operation with the required consistency. The feature is there though, and for other touchpads it might work quite well. It may not be perfect on my notebook but nevertheless it would be nice to see this in one of the upcoming Ubuntu versions.

February 11, 2010

Fixing Eclipse for Ubuntu 9.10

Filed under: Java,Ubuntu — somanov @ 16:38

I recently discovered that Eclipse is broken beyond hope in Ubuntu 9.10. Many Buttons dont work and some other things also seem flaky at best. Apparently this has something to do with the GTK+ version used in Ubuntu 9.10. The bug is fixed in Eclipse 3.6 but previous Eclipse versions are pretty much unusable.

Fortunately I found this excellent blog post which explains the problem in detail and also gives a very simple fix for older Eclipse versions :

The solution is to create a bash script which sets an environment variable before starting eclipse:


now everything works just fine and I can go back to coding java. Many thanks to the Blogosphere 🙂

January 25, 2010

Dear Game Developers…

Filed under: Games — somanov @ 22:41

Warning here comes a rant… actually one I had coming for a long time. About a year ago I ditched PC Gaming and moved to consoles exclusively. Mostly due to laziness combined with the insane rate at which PC Gaming Hardware becomes obsolete. I own an XBox360 now, and I mostly use it to play shooters. During the holiday season I had the opportunity to finish a few newer titles, among them Dead Space, Halo ODST, Call of Duty Modern Warfare 2 and Army of TWO – 40th day .. All in All it was fun, but I ran into certain… annoyances… which seem to be a lot more prevalent on consoles than on the PC:

My console has a 60 GB harddrive. Why on earth am I not allowed to save my progress whenever I want? Almost every game I have played uses a checkpoint system and more often than not the checkpoints are spread too far apart. If I die at a bad moment I am forced to replay portions of the game which I already beat. For recreational gamers like me this is highly frustrating not to mention its a huge time-waster. I dont get whats so hard about allowing free saves? Its not nearly as complicated as having a graphics engine render a bazillion polygons at once..

Mind you I am not asking to make the game too easy. In fact I usually enjoy challenging battles.. but give me the opportunity to make a game as easy or as hard as I desire… After all I am the customer here, and I want to be entertained, not punished.. Apart from the game’s overall difficulty setting this is something that can be very easily achived by a save-anytime option. People who want their game experience to be hardcore are welcome to ignore the save-feature and people like me have an easy way to control the level of frustration they are willing to suffer.

Granted there are some games where the checkpoint system works well and the checkpoints are distributed fairly (for example the Halo series does this very well). In principle it should not be such a hard concept to grasp for game developers: try not to frustrate the player. Dont take achievements (like winnig a battle) away from me by denying me the opportunity to save my progress. If there absolutely HAS to be a checkpoint system, put a checkpoint at the end of each battle… and another one shortly before the beginning of the next… this brings me directly to my second point

Cutscenes are great! But they dont get better if I am forced to watch them serveral times.
In “Army of Two – 40th day” for example there is this great cutscene where you are charged by a heavily armored guy with a chaingun. It really gets your adrenaline going when you watch it the first time… Unfortunately the following fight is pretty hard and if you die you have to restart and watch the whole 40 seconds cutscene again. There is no way to skip the scene and jump right into the action. I had to retry this particular section about 10 times before I finally killed the guy, and watching the same video again and again got incredibly annoying. So.. PLEASE put a checkpoint after every cutscene or at the very least give me an opportunity to SKIP IT.

Game Length
I think this one might be closely related to the saving issues. I often hear people complaining about a game being too short. Maybe thats the reason why game developers create a “challenging” checkpoint system? So the game lasts longer and people dont complain so much?

Honestly I dont find a 10 hour singleplayer campaign too short. Its perfect for a lazy weekend. And personally I get a LOT more enjoyment from a 10 hour game that keeps me entertained than from a 30 hour game that feels repetitive or frustrates the heck out of me by forcing me to replay the same section over and over again until I finally get lucky enough to kill the stray sniper who puts bullets into my head from half a lightyear away.

I could probably come up with a few more annoyances if I wanted to, but what it really comes down is this: I play games to enjoy myself. I am past the phase in my life when I cared about beating overly challenging or outright unfair games just to prove to myself that I can do it. I rarely find the time to play games and when I do I want to experience a few hours of fun and entertainment, not repetition and frustration. I really wish console game developers would spend more time thinking about how to make games more enjoyable for non-hardcore gamers.

December 27, 2009

Data Recovery with TestDisk

Filed under: Linux,Ubuntu — somanov @ 12:28

After several days of frantic picture-taking my mom yesterday managed to delete all the pictures from her digicam (instead of copying them to the computer’s hard drive). Desperation ensued. Luckily 2 minutes of googling for “file undelete on linux” turned up the name of the TestDisk utility. On Ubuntu it can easily be installed via apt.

This little gem offers a variety of functions including file undelete and can work with a great number of file-systems:

TestDisk can

  • Fix partition table, recover deleted partition
  • Recover FAT32 boot sector from its backup
  • Rebuild FAT12/FAT16/FAT32 boot sector
  • Fix FAT tables
  • Rebuild NTFS boot sector
  • Recover NTFS boot sector from its backup
  • Fix MFT using MFT mirror
  • Locate ext2/ext3 Backup SuperBlock
  • Undelete files from FAT, NTFS and ext2 filesystem
  • Copy files from deleted FAT, NTFS and ext2/ext3 partitions.

TestDisk worked flawlessly, was easy to use and made restoring all the deleted pictures (even ones deleted over half a year ago) a breeze. A big thanks to the developers and happy holidays 🙂

PS: I just browsed around the TestDisk site and found a second tool called PhotoRec . This is a specialized tool for recovering video and photo files. In contrast to TestDisk this utility ignores the file system and goes after the underlying data, so it will still work even if your media’s file system has been severely damaged or reformatted. Luckily I did not need it to recover my photos but if using TestDisk fails, this tool might be worth a try.

December 11, 2009

Ubuntu 8.04 on KVM weirdness

Filed under: KVM,Linux,Ubuntu — somanov @ 17:23

I have been using KVM on my Ubuntu Karmic installation for some time now. I have a Windows guest which I start from time to time to perform some tedious tasks which require Microsoft products. So far KVM has worked flawlessly for me and I have come to prefer it to other solutions like VMWare.

Today I needed a 64bit Ubuntu 8.04 system to test something. Installing an Ubuntu 8.04_amd64 server guest in KVM was a matter of 10 minutes. The installation went smoothly and everything looked well but after rebooting the new system the guest would hang at the Kernel message “Loading Hardware Drivers”. I tried booting serveral times. I tried booting into recovery mode. The KVM process and virt-manager locked up every time and I needed to kill -9 them. I did a few quick searches on google but could not come up with anything.

Frustrated I started to remove virtual hardware from the guest system. After removing the Serial Interface and the Sound Card the guest would suddenly boot without any sign of trouble.

I am still not sure which of the two pieces of hardware caused the problem. Perhaps I will try to reproduce the error later and file a bug when I find the time . For now I am just happy this works..

December 4, 2009

Unslung Adventures

Filed under: Linux,Tech — somanov @ 23:16

I recently bought a Linksys NSLU2 Network Storage Link from Amazon :

The Linksys NSLU2

Basically this little guy connects two normal USB drives to your network exposing them as samba shares…or at least thats the purpose the manufacturer intended for it. But with the right firmware it can do a lot more..

After playing around with the stock firmware for a while I decided to try one of the replacement firmwares from . There are several projects which offer custom (Linux-based) firmwares for users with different Linux expertise. There is a Firmware Matrix which shows what the different versions can do.

I mainly wanted to expose my USB drives to my home network (and maybe have a neat toy to play around), so I decided to go with the Unslung 6.10-beta firmware, which is basically an improved and open version of the stock firmware. It offers a nice web interface, has a lot of custom built packages and is targetted at users with little Linux knowledge.

All in all flashing the new firmware and configuring the device went pretty well. I followed the steps in the excellent Readme. However I ran into a few gotchas while configuring the device, some of which I did not find too clearly documented in the wiki. I thought it might help to post my findings. So here they are (in no particular order):

Stay away from NTFS
Actually this one is clearly stated in the FAQ but I thought it might be a good idea to emphasize it. Unslung -like the stock firmware- is based on a 2.4 Linux Kernel. It uses a very old and buggy NTFS driver, which did not play very well with my 1TB NTFS drive. Directories with a lot of files in them were empty or would not be displayed at all. Also it appears the driver may cause the whole system to hang under high IO load. Other firmwares like OpenSlug are based on a more recent 2.6 Kernel, and _might_ not have these problems (I guess the ntfs-3g module should be available there, but I did not check). Anyaway I decided to stay with Unslung and to reformat my drive to ext3. Which brings me to my next point:

Be careful with EXT3
In principle Unslung supports the ext3 filesystem, but it is very picky about its parameters. In particular it is unable to handle ext3 filesystems with an Inode size of 256 (this setting is standard when creating the filesystem from a modern Linux distribution). I had to use the following command to create an ext3 filesystem that would work in Unslung:

mkfs.ext2 -j -I 128 -m 1 /dev/sdb1

If you have an existing ext3 disk and want to know if the Inode size is compatible use:

sudo tune2fs -l /dev/sdb1 | grep Inode

An other related point:

The WebGUI’s “format” option does not create a simple ext3 filesystem
(although it might appear to be the case). If you format a drive in the web-gui you get a natively formatted disk. It has an ext3 partition for your data but contains additional partitions which are used by Unslung to store config files etc. This distinction is very important as you might be running into a lot of trouble with two natively formatted devices (see Rule 1 + the exceptions to Rule 1 ). In order to make the most of your device you need one natively formatted device (which contains the “unslung” root filesystem), but it is safer if you do not have two. But its no problem to have your other disk formatted as ext3, as long as you did not format it in the web-gui. Do it on a normal linux-box and use the command I mentioned above.

Your ext3 drive will not auto-mount
I dont know if thats a general rule, or just my stupidity, but I could not get the ext3 drive to auto-mount. The device would be recognized but I could not get Unslung to automatically mount it and create a samba share for it. The details of manually achieving this are worth mentioning because they were quite surprsing for me:

  • Dont use /etc/fstab ! It is overwritten at boot (dont know why). Also it does not understand the “auto” option which would be needed to automatically mount the device anyway. Instead I added the required mount command to /etc/rc.d/rc.local For a somewhat cleaner solution have a look at diversion scripts
  • Manually add the samba share to /etc/samba/user_smb.conf . My entry looks like this:
    valid users=@"administrators",@"everyone"
    comment=For everyone
    read only=no
    write list=@"administrators",@"everyone"

Transmission is a Bittorrent client which can be installed with the “ipkg install” command. It provides a nice web interface for managing your torrents and works pretty well. When I first started the transmission-daemon and tried to connect to the web interface, I got an error message telling me that access from my IP was not allowed and that I should add it to some config file to fix this….but alas I could not find the file -it had not been created. The fix for this was to run

transmission-daemon -a <my_ip>   # adds  my_ip to the list of allowed addresses

this allowed me to access the web interface, and also created the config file that was missing before.

Ok thats all I can think of for now. Maybe I’ll post an update to this if I find any more things worth mentioning 🙂

December 2, 2009

Window Shortcuts for Linux

Filed under: Linux,Python,Ubuntu — somanov @ 22:14

One thing that has bugged me for a long time ( no matter on what operating system) is the overhead for task-switching.

On my typical desktop there are a lot of open applications (these include Eclipse/KDevelop, some simple Text Editor like Kate or PSPad, Firefox, SSH sessions in consoles, QGis, a chat client etc.) and I typically do a lot of switching between them.

Naturally there are various ways for task-switching built into the Desktop.  These include the taskbar, the ALT-TAB shortcut or the (admitteldy great-looking) Expose Feature (“Present Windows”) many of the newer Linux Desktops are offering. But I find all of these methods counter-intuitive because they require me to visually search for the window and recognize it by its name or appearance.  The situation gets even worse when you have several instances of the same program -probably spread over multiple Desktops- and you need to find the correct one (as it is often the case with file-managers for example).

Long story short: I find the process of visual task-switching unecessarily complicated and overall disruptive for my concentration.

At this point I have to confess that I am a sucker for keyboard shortcuts. Sure they require a little extra effort to memorize, but once that is done they are real time-savers.

A task switching behavior that much better fits my way of thinking would look like this: Assign a Keyboard shortcuts to the most used applications. (eg.: WIN+f–>firefox) If this shortcut is pressed…

  • ..and no instance of firefox is currently running then start a new one
  • .. and a firefox instance is running then switch to it (no matter on which desktop it might currently be hiding)
  • .. and several instances of firefox are running then cylcle through them (pressing the shortcut repeatedly)

I am aware of the different Window Shortcut features that are built in various Linux desktops, but as far as I could find out none of them fit all the above requirements. After a lot of googling I stumbled upon this gem which nearly perfectly does what I want, except for the “cycling through windows” feature. To customize it to my exact needs I decided to do a rewrite of the script in Python. The result works beautifully for my needs on recent Ubuntu versions.

The script makes use of the wmctrl utility which can easily be installed with

sudo aptitude install wmctrl

Here is the “focus” script:

#!/usr/bin/env python
import os
import sys
import commands

program_name = sys.argv[1] # the program to be focused

# get all windows which contain "program_name" from wmcontrol
candidates = sorted([x.strip() for x in commands.getoutput(""" wmctrl -l -x | awk -v win="%s" 'tolower($0) ~ win {print $1;}' """ % (program_name, )).split("\n") if x !=''])

if candidates : # at least one candidate found , we need to check if the active window is among the candidates (for cycling)

        # Get the id of the active window

        # Note: wmctrl currently does not support getting information about the active window.  In order to realize this
        #       we use xprop here. Unfortunately xprop gives us the window id of the active window in a different format:
        #       Window ids from wmctrl always begin with 0x followed by 8 digits (leading zeroes for padding). xprop
        #       does not do the padding and might give a window id starting with 0x followed by only 6 digits. The
        #       lines below get the id of the current window and make the id returned by xprop comaptible with
        #       the window ids returned by wmctrl.
        active_window_string = commands.getoutput("""xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)" """)
        active_window_string =  active_window_string[active_window_string.find("#")+4:].strip()
        active_window = "0x" + "0" * (8-len(active_window_string)) + active_window_string

        next_window = None # the window to display. (one of the windows in candidates)
        if active_window not in candidates: # if the active window is not among the candidate windows
                next_window = candidates[0] # ..just show the first candidate window
        else:# we are already showing one of the candidate windows
                next_window = candidates[ (candidates.index(active_window)+1) % len(candidates)] # show the *next* candidate in the list (cycling)

        if next_window:
                os.system(""" wmctrl -i -a "%s" """ % (next_window,) ) # tell wmcontrol to display the next_window
else : # no windows open which fit the pattern of program_name
    os.system("%s &" % (program_name,)) # open new window

You can put it in your PATH and then use xbindkeys (or some other keyboard shortcut utility of your choice) to create mappings like

WIN+f –> focus firefox

I have defined shortcuts for my 5 most used applications, and have been using them for about half a year now. I feel this has really helped me to streamline my interaction with the UI.

November 29, 2009

Hello World

Filed under: Uncategorized — somanov @ 21:44

Ok, I finally did it.. I got my very own blog and am now officially a Web2.0 whore. I hope to post interesting tech stuff here. Stay Tuned.

« Previous Page

Create a free website or blog at