Screensavers like glmatrix have long been used by *nixers to woo people by showing them customizable animations as desktop wallpapers. Users of desktop environments such as Xfce have to however use xwininfo to determine and use the window IDs of their desktops (as the “-root” option stops working when the root window is overlayed by respective desktop managers e.g., Xfdesktop). For those who want to automate the startup process of XScreenSaver wallpapers in such environments, here’s a quick command you can use:

Few *nix users are aware of existence of one /usr/share/dict/words on their machines. The original purpose of this file was to assist Unix programs in spell-checking. Now that every program that supports typo-prevention includes its own dictionaries, the words file no longer fares as something significant in the geek universe.

Nevertheless, the nifty gem can still serve as a fun place to find or coin new words based on lexicographical constraints. The omnipresent egrep command can be used to exploit the power of regular expressions against the English dictionary. Here’s how:(more…)

The standard way of including source code listings in Beamer is to use the semiverbatim environment. Needless to say, it does not provide all the syntax highlighting and line-numbering love of the listings package. Combine the two and you have something pretty as well as extremely helpful in delivering presentations which have code:

While developing PyS60 apps is one of the most fun things you could do with your Nokia phone, debugging them isn’t as zippy as one would hope for in a Py development environment. To make up for that, PyS60 gives the developers an option for directly connecting to the interpreter through Bluetooth. Doesn’t sound very appealing? How about this: You connect your laptop with the cellphone, jump in at some place in the code while your app is executing and then use lappy’s big keyboard for exploiting different code and values in the interpreter. Sounds better?

To accomplish this on a Linux distro, you will need the following packages installed on your system:

Pat yourself on the back. Now, you can use your Bluetooth console to import your modules, execute some stuff and then jump in the middle to test some extra lines or values. In fact, I found it to be a pretty darned good way of learning about PyS60’s API. Res secundae!

I had never really laid my hands on LaTeX until I required it in one of the helper applications for my graduation project. Unfortunately, the requirement wasn’t as simple as producing some documents as I had to embed mathematical expressions on the fly in my PyGTK apps. Googling around for the solution, I found GtkMathView which accomplished something similar to this albeit using MathML. However, my luck ran out on me again as the widget lacked Python bindings. The other solution was to generate transparent PNGs on the fly and include them as GtkImages. This worked rather well, as the final code allowed easy modifications to the generated expressions.

Recently, I needed to create some visualizations in a drawing area for one of my PyGTK apps. The PyGTK tutorial had an excellent writeup complete with a working example for immediate help. Unfortunately, my requirements were of a “grid” view on which other objects would be drawn. Naturally, I hoped for some variable on the GtkDrawingArea which I would set to true and have the grid lines drawn automatically. But since I couldn’t find any such magic setting in the API, I had to draw the lines manually.

Consequently, I could use either of the following approaches:

Loop horizontally and vertically while draw_line()ing.

Draw a 10×10 box as a tile and repeat it over the background.

The first approach would’ve worked faster but involved writing more code. The second was uglier — especially for larger images — but resulted in me having to add only a few lines to the example:

Note that the 10×10 tiles’ borders match prettily with the markers on top and left rulers. There will definitely be some more efficient method for achieving this but for the time being tiling serves my needs perfectly.

Pidgin is a multi-protocol instant-messaging client which I use for all my MSN/Google Talk/IRC communication. Apart from offering adept support for all of these protocols (and plenty others as well), Pidgin also provides decent logging support. However, I’m not at all interested in having my daily MSN conversations recorded. On the other hand, I prefer having my previous IRC chats with me for reference. Right now, Pidgin does not support any options in the Preferences which would allow me to selectively turn on logging based on the protocols I’m using. If I turn it on for chat windows, it also starts producing logs for every MSN chat I participate in.

Most of the people wouldn’t/don’t see any issue with this behavior. For those who do want to keep a history of their conversations only for particular protocols, here’s a quick workaround for doing it:

Check the appropriate options under the “Logging” tab in Preferences window.

Have a few chats the likes of which you’d prefer being logged.

Go to the directory containing Pidgin logs (default is ~/.purple/logs):

[user@host ~]$ cd ~/.purple/logs/

[user@host ~]$ cd ~/.purple/logs/

See whether the protocols you want to be logged have a directory named for them:

[user@host logs]$ ls

[user@host logs]$ ls

irc msn

Remove the protocols you do not want to have logs for (in my case, MSN):

[user@host logs]$ rm-rf msn

[user@host logs]$ rm -rf msn

Change directory permissions to stop new protocols from getting logged:

[user@host logs]$ chmod500 .

[user@host logs]$ chmod 500 .

And you’re done. Now, whenever you start a conversation in a protocol which does not have a respective directory in ~/.purple/logs, you’ll see a “Logging failed” error message in the conversation window. For other (allowed) protocols, logging will work as expected. To turn off selective logging, reset directory permissions with:

[user@host ~]$ chmod600 ~/.purple/logs/

[user@host ~]$ chmod 600 ~/.purple/logs/

It is also possible to apply the same workaround on contacts. For example … :

[user@host ~]$ cd ~/.purple/logs/msn/[user@host msn]$ ls

[user@host ~]$ cd ~/.purple/logs/msn/
[user@host msn]$ ls

bestbuddy@live.com ignorantmoron@live.com

[user@host msn]$ rm-rf ignorantmoron@live.com

[user@host msn]$ rm -rf ignorantmoron@live.com

[user@host msn]$ chmod500 .

[user@host msn]$ chmod 500 .

… will disable logging for all MSN contacts including ignorantmoron@live.com, but will record everything communicated with bestbuddy@live.com. Like the previous example, you just have to reset directory permissions to re-enable nondiscriminatory logging:

Every once a while, I need to take the backup of my Nokia N72 using PC Suite. Since the task had to be performed on Windows, I expected my virtualized machine to be able to do so. Unfortunately, Virtual Machine Manager does not provide any option in its interface which would allow me to use my USB devices in virtualized machines. Going through the documentation though, here’s the method through which I was able to solve my issue.

First of all, you should have the vendor and product ID’s of the USB device you want to use. Sounds alien? Use the command:

The bold numbers in the line containing “Nokia Mobile Phones” are the vendor and product IDs respectively. Once you’ve noted them down for your required device (in my case: 0x421 and 0x4c4), list the virtual machines’ configuration files:

[user@host ~]$ sudols/etc/libvirt/qemu

[user@host ~]$ sudo ls /etc/libvirt/qemu

networks windoze.xml

My virtual machine was named “windoze”, so windoze.xml is the file that I need to edit:

[user@host ~]$ sudo gedit /etc/libvirt/qemu/windoze.xml

[user@host ~]$ sudo gedit /etc/libvirt/qemu/windoze.xml

In the editor, add the highlightedhostdev lines under the devices section (replacing the vendor and product IDs with the ones noted down from lsusb output):

More often than not, Linux users will end up in a situation where they’d need to access their Windows neighbors on LAN. This can easily be accomplished using IP addresses, but using NetBIOS names is just too convenient to be overlooked.

The Xandros distro on Asus’ Eee PC does not resolve NetBIOS names by default. To make it perform that, you can do the following:

I’m well aware of the fact that this thing has been posted on various blogs countless times already; but if you haven’t noticed, YouTube has changed its page structure so that only a text-search of player2.swf?video_id= in the source code won’t yield the prolonged video_id. Instead, you now have to search for /watch_fullscreen?video_id= to locate the holy grail.

For those who’re new to this method, here’s what you have to do:

Open the YouTube video link for which you want to download the FLV.

Right-click anywhere on the page and click on ‘View (Page) Source’.

Press CTRL+F and search for the string: /watch_fullscreen?video_id=

Copy everything after the question mark until the end of quotes, as shown in the image below:

(Click to enlarge)

Type this in your address bar: http://www.youtube.com/get_video?[video_id you've just copied]

Hit Enter/Return, you’ll be offered a downloaded named get_video which is actually your desired FLV file. Save it somewhere locally and change its extension to .flv.

Here’s a list of players that you can use to play your downloaded FLV: