January 16, 2010

"du" with single level directory traversal

I always used du to know the size used up by the files in a particular directory, mostly recursively. But there were sometimes when I wanted to know the directory and file sizes upto only one level. May be "man du" would have helped, but as most *nix users are, I was lazy to do that. While reading a forum thread about the same question here, I came across the solution :

"du --max-depth=1"

and of course adding the "-h" switch would print the sizes in human readable form.

January 12, 2010

emulating keyboard and mice input from s/w : The uinput system

The linux kernel exposes the uinput API for emulating keyboard and mice input events from any program. The default uinput API is a low-level API, requiring most operations to be done using FCNTL functions, a detailed explanation of its use can be found here.
The basic requirement for using the uinput system is that the uinput module be loaded(can be checked using lsmod). From recent discussions on the ILUGC mailing lists, I have also come across libsuinput, which is a wrapper around the low-level library and provides easier emulation.

Thread automata, dependency structures for NLP and the project

The abstract :

Several constraints have been proposed that restrict the structures for syntactic parsing such as projectivity, non-projectivity, planarity, well-nestedness, gap and edge degrees. These classes can generally be characterized by the dependency structure characteristics themselves rather by grammar formalism that generate these structures. Thread automata are a powerful but simple automata which are an extension of embedded push-down automata. This automata exhibits a wide range of parsing strategies for the so called mildly context sensitive (MCS) formalism. These formalism are considered to be a little more powerful than context free but less powerful than context sensitive in respect of parsing and semi-linear issues. In this project, we aim to connect the properties of dependency structures with the functionality of thread automata. If such a connection is established, it will increase the expressiveness and reduce the complexity of syntactic parsing of natural languages with free form word order.

Most natural languages seem to be parsed by creating dependencies in the tokens as they are parsed. Hence some constraints have been proposed for these dependency structures. The project deals with contemplating and validating the applicability of these constraints, if any, to thread automata.

January 07, 2010

Cron based script to change twitter profile image

I have been trying to write a simple python script using python-twitter which is triggered by cron and is run, say every 4 hours to change the twitter profile image. I could do something like have 6 profile images per day, each somehow representing the time of the day (or something similar).
Now I have been at the python-twitter API documentation for some time, looks like I can set the profile image url to something I want using the User class and the function SetProfileImageUrl(self,image_url), but the problem is that , the function manipulates the local values of the object (of type User) and the changes are not reflected on the twitter site. The same happens when I manipulate the status of the User object.
Is there some way to update the changes to the User object to the twitter site, or am I taking the wrong approach, or does python-twitter have support for changing the profile image at all ?