viz

 

A Million Random Digits

Here is a list of some of my favourite Amazon reviews.

All three reviews for this book that exist at the time of writing are simply brilliant. But what can you expect if the book title is A Million Random Digits with 100, 000 Normal Deviates. Here is what rhys lewis writes:

Wow, I loved this book, a real page turner. It started off kinda slow but the characters have real depth and you soon grow to care and really believe in them. I dont want to give too much away but I especially enjoyed the plot twist at the end, very clever. If you only have time to read one book this year, make sure its this one.

Unfortunately not many people are interested in serious literature like this nowadays, hence low rating. This is definitely not the case with the next book, The Story About Ping by Marjorie Flack, with more than a hundred reviews. However, only one author gives a really deep insight into the true concept behind this book:

Using deft allegory, the authors have provided an insightful and intuitive explanation of one of Unix’s most venerable networking utilities. Even more stunning is that they were clearly working with a very early beta of the program, as their book first appeared in 1933, years (decades!) before the operating system and network infrastructure were finalized.
read more

Surely this book is a “must have” for all network administrators.

And finally, one more interesting item with many useful reviews. If you decide to buy it don’t go with the cheapest delivery option though as Patrick J. McGovern warns:

I purchased this product 4.47 Billion Years ago and when I opened it today, it was half empty.

Uranium Ore

Correction: it turned out that it is the .co.uk Amazon site has only 3 reviews for the first book, amazon.com has much more. It gives me hope that the people are still reading (not only amazon reviews). Enjoy!

 

In this post I will describe how to add arbitrary keyboard shortcuts in the Nautilus file manager using its extension API. I really like Nautilus, it has a clean interface and lots of features under the hood. One of the things I was missing coming from the world of orthodox file managers was an embedded terminal which can be shown/hidden with a simple keyboard shorcut. Recently there appeared an extension called Nautilus Terminal that provides exactly this. It is quite good and I highly recommend to give it a try. However I was not entirely satisfied with it because of inability to use some usual shortcuts such as Ctrl+L, although you can use Ctrl+Shift+L instead. Also if you change a directory in Nautilus the embedded terminal is closed and a new one is opened in a new location. So you can’t really have anything running in a terminal and at the same time browse the directories.

After some googling I’ve found another nice extension called nautilus-open-terminal which allows to open a terminal through a context menu. It is not bad but I would prefer a keyboard shortcut instead of the context menu. After some experiments I’ve found a hackish way to implement this by (ab)using LocationWidgetProvider. If you know a better way please tell me about it in the comments section below.

So here is a Python script that does the trick:

# Nautilus extension that adds a keyboard shortcut Ctrl-O that opens
# a terminal in the current directory. Copy it to the extensions
# install path, e.g. ~/.nautilus/python-extensions/

import gconf, gtk, nautilus, os, pipes, urllib

TERMINAL_KEY = '/desktop/gnome/applications/terminal/exec'

class ShortcutProvider(nautilus.LocationWidgetProvider):
    def __init__(self):
        self.client = gconf.client_get_default()
        self.accel_group = gtk.AccelGroup()
        self.accel_group.connect_group(
           ord('o'), gtk.gdk.CONTROL_MASK, gtk.ACCEL_VISIBLE,
           self.run_terminal)
        self.window = None

    def run_terminal(self, accel_group, acceleratable,
                     keyval, modifier):
        filename = urllib.unquote(self.uri[7:])
        terminal = self.client.get_string(TERMINAL_KEY)
        os.chdir(filename)
        os.system(pipes.quote(terminal) + ' &')
        return True

    def get_widget(self, uri, window):
        self.uri = uri
        if self.window:
            self.window.remove_accel_group(self.accel_group)
        window.add_accel_group(self.accel_group)
        self.window = window
        return None

To enable this extension copy it to the extensions install path, e.g. ~/.nautilus/python-extensions/ and restart nautilus with the nautilus -q command. This script redefines the Ctrl+O shortcut to open a terminal. It can be easily adjusted to use a different key combination or to define several shortcuts with different actions. For example this script defines Ctrl+O to open a terminal and Ctrl-G to open gitg in the current directory of Nautilus. It also adds Compare… to the context menu when two files are selected.

Edit: don’t forget to install the python-nautilus package: sudo apt-get install python-nautilus

Update: I’ve ported the script to Nautilus 3. The new version can be downloaded from here. Note that the script requires at least version 1.0-0ubuntu2 of the python-nautilus package which is not yet in the mainline of Ubuntu Oneiric, but can be obtained here.

 

Google never stops to amaze me. Today I found out about the recent Google Labs project Body Browser that allows to explore the human body right in your browser using the latest Web technologies.

This project relies on WebGL so you need a modern web browser (read: any popular web browser other than IE). You can check if your browser supports WebGL here. Although the Body Browser details page says that you need a beta version of Google Chrome, it is not really so. You can use the current stable release. It seems that the versions of Chrome are released so often that even Google guys can’t keep up.

So I used Google Chrome version 8.0.552 which is the current stable release. WebGL is disabled by default in this version but it can be easily enabled from the browser by visiting the about:flags page and clicking the Enable link under WebGL:

Enable WebGL

Then you will need to restart the browser and yay (that’s what that WebGL check page gives you now =). You are ready to visit the Body Browser and enjoy the beauty of the human body:

Body Browser

© 2012 zverovich.net Suffusion theme by Sayontan Sinha