Thursday, December 16, 2010

fixing linux's shell worst pitfal: rm

When I started working with shell few yeas ago, I remember the first thing people warned me about: the rm command has no backup. So there is no copy saved in the Recycle bin or in Trash. Many books and tutorial will share this warning, and also the wisdom that no matter how careful you are. It is bound to happen that you will delete an important file wasting the work of hours or days.

Today I thought of a solution of this for my UBUNTU 9.10. We might mention that alias doesn't work since it doesn't take arguments. Also we should make the effort to find where "Trash" is, a matter that wasn't so simple [1] [2] So the next solution is to write a function and save it in .bashrc:

function rmv () { scp $* ~/.local/share/Trash/files/; }

so now:
$rmv test.f

will put it in the trash instead of deleting it forever. If you are an extensive user of rm you should be careful not to fill up the Trash directory so maybe writing a command that will clean it say every 24 hours or few days. Maybe I will do that one day...

Tuesday, December 14, 2010

fixing your webcam for skype

After updating to UBUNTU 9.10. Skype started running without any interferences. So the next step is to tackle the issue of webcams.Here is a good resource:

https://wiki.ubuntu.com/SkypeWebCams

 so now using lsusb:
Bus 003 Device 003: ID 045e:00f7 Microsoft Corp. LifeCam VX-1000

i get the details of my webcam and the link associated with it:
http://ubuntuforums.org/archive/index.php/t-914952.html
it turned out that the needed fix is to have the following command:
 env LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so skype

so i fixed it for the alias:
alias skype='env LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so skype'

and i fixed it on the launching pas:
System->Preference->Mainmenu.
I removed skype and put instead the required command.

my skype has a webcam access and life is good.

Thursday, December 2, 2010

Updating ROOT on your machine.

I was running ROOT 5.18 on my laptop and it has the interesting issue of saving the plots 90 degrees rotated. I never bothered myself with this until someone brought the issue on CMS's hypernews. The solutions she got were:

1- You can change the size of the canvas to be rectangle
TCanvas *c = new TCanvas("c","",800,850); Quite easy but we need to remember that the TDR style for CMS papers is 600 by 600.

2- It turned out that this issue is solved in the new releases (after 5.22).


So the challenge was to try to update my old ROOT release. These days they have clear instructions about installing ROOT. The problem is that this is not a full package and installing without care will create a mess! so doing the instructions you can use that release in the current shell. but not if you opened a new one.

I wanted something more "default". So here is the trick:

in 'root' edit file names: .bashrc
and at the bottom i added:
. $HOME/Desktop/Research/ROOT522/root/bin/thisroot.sh

which is the place where the new installation is.