January 25, 2011

Visualizing directories and files as a graph

The Information Retrieval class I have been taking this spring has been inspiring me to try quite a few things, the first of them was to try and analyse text to extract the semantic information in the words. Well that has not reached anywhere near perfection but the present code for a naive method of drawing a graph containing the words can be found here. While trying to draw the graph for the words, I did however read through the NetworkX library documentation extensively. I really like this library, creating simple graphs is very easy and at the same time there are so many features if you want to do a lot more with the graph. While I was searching for some interesting problem which I could visualize as a graph (just to flex my python skills and to get more fluent with NetworkX), the idea of trying to see a directory as a graph with files and sub-directories as nodes colored by the file type struck, especially I wanted to try this out on the directory where I store all my work related files, and here is the result :



well , the above code is simple directory traversal in python with the code for drawing the graph added. (the script works only on *nix systems and ignores hidden files and directories by default, this is so that I could ignore the nasty version control related metadata directories like .git or .svn which are quite common in my folders).
The graph without the file names produced by the script looks like this :


The other files and graphs can be found here.

January 03, 2011

Websites that load fast, why it is subjective !

I am a pretty active (if not aggressive) user of facebook, and the one thing that I observe every time I pop up a new tab with facebook on google chrome is that it is almost instantaneous. This set me thinking about how the time a website takes to load affects the user's experience. My speculation is that it is completely subjective. It majorly depends on two important factors (or rather categories of factors) :
  1. What the user is using : the website + browser
  2. What is the user's mood 
Most benchmarks deal with the first set of factors, the ones which deal with the software, but this is not a perfect measurement of the affects on the users interaction with the website. I performed a simple task to measure the difference and took into consideration the second set of factors such as the user's mood etc which affect how the user perceives the speed : 

Open a new tab in a browser you prefer, wait till the page completely loads, now open another tab of the same website and try to close the earlier opened tab, see if you can close the old tab before the new tab opens. Repeat this for various browsers and various websites while you are in different moods. 

This simple test also brings into play a certain factor that we often forget, most benchmarks deal with the time taken for a site to load from scratch (a fresh tab) which is often not the case, most of the time an individual spends on the internet, he/she is not going to open a new website every time, most websites are closed and opened again and again. Again, the whole point of the post is not to provide solid results on which websites are faster or which browser is the best, rather, to focus on some subjective issues we forget in user interactivity !

Power notifications on a laptop (quick and simple)

First you would need to install packages appropriate for your distribution providing "acpitool", then you could use watch to get updated information on the battery at fixed intervals, for example to update the information every one second you could run the following on a terminal :

watch -n 1 "acpitool | grep charging"