Monthly Archives: June 2008

Making glchess work

I am using Fedora 7. To begin with, glchess used to work fine for me. Then suddenly it stopped working. It was giving a strange error. After googling a bit, I realised that it stopped working because I upgraded my Python from 2.0 to 2.5. Lucky for me though, I had python2 in my /usr/bin. So, this is the fix: I opened /usr/bin/glchess, and changed the header to

! /usr/bin/python2

And voila, it started working again!

The moral of the story is, glchess does not work with Python 2.5. It needs Python 2.

Magic of ps

The command

$ps -eF

lists all process along-with the full command which started the process. When I ran this, I could not see the entire command due the width restriction of my terminal. This is the solution to set unlimited width:

$ps -eF -w -w

Now, suppose I want to know a specific process by its name:

$ps -F -C java -w -w

The -C option accepts a list of process name like:

$ps -F -C “java xmms” -w -w

For a list of files opened by a process, use

$/usr/sbin/lsof -p 3456 | grep XXXX

[Courtesy Prakash]

Producer/Consumer

I have tried to come-up with a thread safe and a non thread safe version of a typical producer/consumer scenario.

Run this with

boolean THREAD_SAFE_EXECUTION = true;

and

boolean THREAD_SAFE_EXECUTION = false;

And see the difference yourself :).