A Book on Algorithms.

My Guru and an individual in whose service, I am ready to spend the rest of my life, Mr./ Uncle / Dr. ( I don’t know what he wants to be called ) Prashanth Mohan recommended that I get this cool book entitled, “Programming Pearls” by “Jon Bentley”. I happen to like the warnings the author puts into his book such as, “Boring Material Ahead. Skip to section 4.4 if drowsiness strikes.”. I love the fact the the pseudocode is laid out in such an excellent fashion ( compared so some “pseudocode” I have seen… ). I jumped straight away to the section on “Searching” and realized that I was doing injustice to the writing capabilities of Jon Bentley ( which deserve a lot of respect ).

The only requirements of the book are knowing how to program in a high level language and thats it ! I would recommend that people pick this marvel of a book and add it to their collection ( although looking at the popularity this book seems to enjoy in programmer circles, you might already have it in your collection ).

Oh by the way, I am working on something extremely useless but its a top-secret mission of mine and I will write about it later.

Got involved in some fight with a bunch of “elites” from India’s “elite” engr. college ( no need to ask ). I happened to mention that I liked CS a lot and the discussion veered to something more unrelated to the field such as the methods institutions chose to fill their computer science classes. I mentioned that those who had programmed should be given first priority because the guys would have had *some* idea about process. I realized that I had made the biggest mistake of my life then and there. What followed is:

elite_guy: CS is not about coding. If you want to code in college, why not take those IT courses that are abundant in this nation.

Me: I know what CS is, I might not have a paper which certifies that I am a Computer Scientist, but I have a fairly good idea of what CS is.

elite_guy: CS is about math.

Ah, the classic statement. Like I never knew.

Me: I know it is about math but its basically imperative knowledge of math as opposed to declarative knowledge.

elite_guy: It is declarative knowledge

elite guy links me to SICP.

There are only two conclusions I could come to with that statement:

  • The guy skimmed through the book, encountered the words declarative and imperative and felt happy enough to throw them in without knowing what Prof. Abelson intended to say.
  • The guy was not interested in getting what he said, right. His aim was to somehow contradict me, even at the cost of speaking the right thing.

By the way elite_guy is just some stupid nick I could come up with. I didn’t want to stain his reputation by directly mentioning his name.

Got to go and work. Goodbye !

jammed dirname.py on top of mount.py

Trouble’s struck !!. Ubuntu’s libATA has stopped functioning and my partitions are now seen as IDE subsystems once again. Hence we have a conflict between udev rules and device names leading to automount getting <censored>. I seriously can’t be bothered by this. Considering that I try to behave as much as a sysadmin as possible, I tried to whip up a script that would mount the device specified as I have no idea what filesystems my 3 identical (in appearance) external drives have on them. I think one has reiserfs, another has ext3 and the third has fat32 on it. I tried to find out the command that would let me know about the fs I have on my external drive without actually mounting it. fdisk didn’t help and I was stuck with waiting for the new kernel 2.6.20-16-generic to be fixed. Later that day I did:

man -k locate

The first line in there was:

blkid (8)            - command-line utility to locate/print block device attributes

Was this command the solution to my troubles? It indeed was. I then whipped up a script in no time. Here it is:

 #!/usr/bin/python

#mountcreatingdir.py

#Author:Shriphani Palakodety

import commands

index = 1

while True:

 dir = "/mnt/usbdisk" + str(index)

 string = commands.getoutput('mkdir %s' % dir)

 if string == "":

  continue

 else:

  index = index + 1

 device = raw_input('Enter the name of the device you want to mount: ')

 a = commands.getoutput('blkid %s' % device)

 import string

 number = string.find(a, " T")

 print number

 requirement = a[number+6:]

 s = commands.getoutput('mount -t %s %s %s' % (requirement, device, dir))

 print s

That’s about it.

Feisty fawn, first observation

I got my feisty cds this morning. I installed feisty immediately and considering that one of the ubuntu devs on #ubuntu told me that feisty’s way of handling storage devices had changed, I immediately did:

shriphani@psp-laptop:~$ cat /etc/fstab
# /etc/fstab: static file system information.
#
#
proc            /proc           proc    defaults        0       0
# /dev/sda3
UUID=1a97343a-e3ed-48e2-9db4-ea67228fb1aa /               ext3    defaults,errors=remount-ro 0       1
# /dev/sda2
UUID=68033b3d-f469-4a8b-8ade-c3a9984f5281 /boot           ext2    defaults        0       2
# /dev/sda1
UUID=01107bb3-77bb-41c3-b271-6019bfa8ebb3 /home           ext3    defaults        0       2
# /dev/sda4
UUID=da271254-066a-46f4-b1a0-75ba2c4b494f none            swap    sw              0       0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto     0       0

What’s this !!. a UUID describing a device ? I was a bit confused. I also saw that my IDE drive (I have an acer travelmate 4500 laptop) was being recognised as SCSI. I immediately went to #ubuntu on freenode to figure out what was wrong. I was then given the link to this.
Wow! Surely a lot of thought going into that. So we will be dealing with just one subsystem from now on in Ubuntu land.