Skip to main content

Posts

Showing posts from November, 2009

Python resources

Python for Non-Programmers
http://wiki.python.org/moin/BeginnersGuide/NonProgrammers

This page lists the best collection of resources on programming I have seen recently. It is mostly geared towards Python programmers.

Also, http://www.prasannatech.net/2008/06/top-three-python-programming-books.html lists some books.

All in all I found the following books are generally recommended for beginners (all of them are available online for free).

1. Dive Into Python
2. The Python Tutorial
3. A Byte of Python

There must be other good books too. I would update the list as I come across them.

Convert djvu files into pdf

The latest djvu viewer which is djview 4.4 allows the djvu file to be directly exported to pdf format. Just select File -> Export as ... -> Format: ( Destination ) PDF Document.

But I fopund out that this didn't quite work in my system. After 99% of conversion was finished I kept getting the error message "Cannot render image.This operation failed ..." .

So I went for the alternative. I printed the document using CUPS-PDF driver. Selec print and then PDF from the list of printers available. If PDF printer is not installed then you have to install it. Follow the guideline here http://www.ubuntugeek.com/how-to-create-pdf-documents-in-ubuntu.html or better still if you are using Debian then just open your PMS (package management system ;) Synaptic for Ubuntu ) and install "cups-pdf" .

Rotate image canvas in gimp

It is frustrating to rotate in GIMP or that is what I thought because the rotation may cause the layer to extend beyond the bounds of the image. ( http://docs.gimp.org/2.6/ko/gimp-layer-rotate-90.html )

But the trick is to rotate the entire canvas not the layer only.

Image -> Transform -> use the rotate options in there to rotate the whole image.

Cool ha.

How to convert avi to vcd in ubuntu

I had a collection of videos that I wanted to write as a video CD so that I could play them in the vcd player in my home. The problem was that they are in avi format and directly writing them to a CD is not playable by a cd player. So I have to make a video CD out of the avi files. I read that Avidemux exports directly to VCD (mpg) format, but what I found out after wasting two whole hours is that the container that Avidemux produces while exporting to VCD format cannot contain audio. That means I was getting mpg files with no audio and Avidemux website suggested adding it manually later. But as it turns as everything in Linux it is a one-step process when done from the command line.

I got the following from the Ubuntu forums. (http://ubuntuforums.org/showthread.php?t=105781)

AVI to VCD

NTSC

ffmpeg -i -target ntsc-vcd

PAL

ffmpeg -i -target pal-vcd

Burn CD

K3b File > New Project > New Video CD project

For example in my case :

ffmpeg -i mymovie.avi -target pal-vcd forvcd.mpg

If there …

Too long in a field makes a cow the agriculture expert . ...

Too long in a field makes a cow the agriculture expert . ...

My thoughts ... as the blog name suggests. This quote speaks of a valuable lesson. If a person stays in the same line of work(field) for too long (and provided he is moderately intelligent) ... people start to think that he is an expert of the stuff he works on.

Story of catching my first Russell viper

I apologize for the profanities used in the following text. It could have been excluded but for the morality* of characters involved.
(* if electricity comes from electrons then morality comes from morons)

8 Nov 2009 10:30 PM : I was trying to doze in my office when a phone comes ... "There's a snake near the main reception ..." So begrudgingly I leave to check it out. On reaching the spot I heard some real angry hissing sounds. The reason .. of the room boys got so scared of seeing the (big*) snake that he yelled so loud it got the snake nervous. It must be thinking ... "what to do with these pansy little creatures ... can't go anywhere without them yelling at me ... " Actually this is their interpretation because snakes are deaf . What I realized is that the guy, on seeing our bimbo, jumped so fast and high, that he got the snake into believing that he is another of his kind, but much bigger and scarier. This is what happened. Our boy jumped and viper( equ…

Thunderbird back & forward buttons are greyed out

When I open an email in Thunderbird the back & forward buttons are greyed out. So, I cannot move from one mail to another. So, I searched and came up with a discussion about it here http://sillydog.org/forum/sdt_13568.php.

The back & forward buttons are meant for the main window only and do not work in the email window. So, in the main window if I view one mail then another random mail, the back & forward buttonsgo along that order just like the browser history button, from the mail I viewed last to the one the viewed before that (back) or from the mail I viewed next (forward) .

I do not want this behavior. And I am sure most Thunderbird users do not want it either. I would prefer if Thunderbird just goes from one mail to immediate next mail. For e.g. if I delete one mail I want it to go to the next mail automatically.

Random slideshow of wallpapers

In Linux I had a lot of wallpapers and I wanted a random slideshow of all of them properly scaled to fullscreen.
I tried Picasa and F-spot but both were inadequate because they started from the first picture and went on linearly. So, I used FEH instead.

$ sudo apt-get install feh

Now, to get a slideshow of random random walllpapers stored in a folder the following command is very useful -

$ feh -zsdrZFD 15 wallpapers/

Explanation :
-z, --randomize When viewing multiple files in a slideshow,
-Z, --auto-zoom Zoom picture to screen size in fullscreen mode,
-d, --draw-filename Draw the filename at the top-left of the image.
-s, --stretch Normally, if an image is smaller than the specified
thumbnail size, it will not be enlarged. If this
option is set, the image will be scaled up to fit
the thumbnail size. (Aspect rat…

How to save online video

Again there's more than than one way to skin a pu... er... cat. So I give two methods.

Method I : Works in any OS but needs Firefox.
Just add the extension Download Helper https://addons.mozilla.org/en-US/firefox/addon/3006

Method II : Works in Linux.
Open the video in the video streaming website. (Youtube for example)
Let the video load entirely in the browser (Firefox for example).
With the browser still open go to the terminal.
$ ps aux | grep firefox # or grep your browsers' nameoutput looks like

12464 Sl 1:42 /usr/lib/firefox-3.0.14/firefox

12464 is the PID for Firefox. Now, let's find out where's Firefox storing the temporary video file. To see that find all open file handles by Firefox.

$ ls -lU /proc/12464/fd

-l option is necessary to see where the handles are pointing to. Output looks like

lrwx------ 1 xxxx academic 64 2009-11-03 15:48 90 -> /tmp/FlashY7mpKM
lrwx------ 1 xxxx academic 64 2009-11-03 15:48 91 -> /var/tmp/etilqs_yZv1nx28NVRfKhh (deleted)