Weblog of an Aspiring Computer Scientist
Random header image... Refresh for more!

Posts from — October 2007

Back again

After a lull of 10 days (no internet), I am finally back, 512 KBps and unlimited download is what I picked. Now loads of things to do. I am working on making my very first firefox extension and I’ve found this: http://developer.mozilla.org/en/docs/My_Chrome_Oven:_Generating_XUL_with_Python

So we now have no troubles whatsoever making our extensions. Apart from this I am going to put up a few podcasts for twincling’s school division. I will be posting more on my adventures with firefox soon. Let me give all my readers (I am sure there are very few of them) an idea of what all I’ve been up to in recent times.

I got my SAT 2 scores, 2270. Seems decent and hopefully tests won’t be there to worry me. Debian has undergone some more of my torture and I have discovered a few good books that have interested me.

My first book was ‘Remarkable Curves’ which dealt with properties peculiar to conic sections, like the pascal’s theorem etc. I couldn’t really figure out any coding ideas from that book. I am now trying to get around the theoretical barrier (the random variables part) that is hindering my progress with the book on the Monte Carlo theorem.

I am also going to dump all I have written on my nipl hosted site, hopefully it will be of some use to someone. I am eager to kick off with firefox hacking, so I am in a hurry to leave. I will write again later.

October 30, 2007   1 Comment

Unlucky times.

I broke my new HP headphones (Sniff). I don’t have a spare pair of headphones (Sniff). Well forget it already. I checked my gmail inbox recently and I saw a mail from Mr. Mahesh U. Patil of TWINCLING Society. Mr. Mahesh was trying to make a web interface for his location plotting application. When I last saw him at TWINCLING, he wanted to create a system that would enable him to plot the position of a device without getting the background to change. After this piece of info let us move to the mail. It was about Python magic. He showed me the master’s thesis of someone by the name Albert Huang (MIT as usual).

October 23, 2007   No Comments

Debian: What an OS

Well the topic says it all. I have switched to debian gnu/linux and my engineering skills were tested. I faced troubles at almost every stage after installation. Let me describe the process.

I got myself a debian cd, put it in the cd - drive, restarted my laptop and after hitting the enter key about 10 times, debian was installed. I was greeted by a not-so-good-looking screen (clearlooks theme + gnome icon theme). I fired up iceweasel (debian’s patched version of firefox (they are not allowed to call it firefox)). Within 5 minutes, my fan begins spinning. I realise that I am just running a web browser and reading a BOFH story. I check the output of cat /proc/acpi/thermal_zone/THRM/temperature. The output is 72 Degrees C. I am stunned. I close all applications and leave my laptop alone. Five minutes later, my laptop’s fan is still spinning. I realize that something is surely wrong. I devise a plan. My first stop is to check how the fan’s trip points. Trip points are basically the temperatures at which the behaviour or the system or the fan changes. I checked the output of “cat /proc/acpi/thermal_zone/THRM/trip_points”. The output was:

critical (S5):           100 C
passive:                 92 C: tc1=2 tc2=3 tsp=100 devices=0xc124657c
active[0]:               73 C: devices=0xc12525a4
active[1]:               66 C: devices=0xc1252694

So there you go. My fan would begin spinning when the cpu temperature hits 66 C. I decide to change the values a bit. I decide that it would be better if I set the values at boot-time and I add the following line to /etc/init.d/bootmisc.sh:

echo 90:0:62:52:50 > /proc/acpi/thermal_zone/THRM/trip_points

Upon booting, I check the trip points and I get:

critical (S5):           90 C
passive:                 62 C: tc1=2 tc2=3 tsp=100 devices=0xc124657c
active[0]:               52 C: devices=0xc12525a4
active[1]:               50 C: devices=0xc1252694

It works! But just a few seconds later, the fan begins to spin. I check the temp again and: 63 C. “!@$@!#”. What the bloody hell. The temperature kept shooting up and stayed put at 70 C. I shut my laptop down and open it up and armed with a cotton swab, I aim to clean up the buge amount of dust on the fan. Bad luck, there isn’t any significant amount of dust there to cause a huge problem. I then realise that this route won’t lead to a solution as well. I finally reboot my laptop with the aim of planning my next move. I run:

cat /proc/cpuinfo

The output ensues and line 7 catches my eye:

cpu MHz:                                            1600

Bingo ! My genius brain figures out that cpu scaling is disabled. My cpu was running at 1600 MHz irrespective of the apps running. I know quite a bit about scaling as I had once asked people on IRC for help on overclocking my cpu. I was pointed to a tutorial about scaling then. I installed cpufrequtils and did:

modprobe acpi-cpufreq
/etc/init.d/cpufrequtils restart

Thats all.
There is one issue however. While booting, debian complains that the OnDemand CPU failed. I was a bit irritated by this. But it was easy to figure out the solution. Plainly add modprobe acpi-cpufreq to /etc/init.d/cpufrequtils.
Thats all!

October 19, 2007   2 Comments

Chirec School

My first stop. Chirec seems to be one school that has taken open source software to its students. From my classmates at FIITJEE, I got to know that Chirec has RedHat running (I was left thinking if the institution was a bit too rooted in the past.). I called up Chirec this morning and I was told to send them an email detailing the organisation I was representing etc. I have sent them 5 already but I haven’t got any sort of response from them. Not even a “no”. This makes me feel stupid. I will keep calling them etc. but it doesn’t seem to really work out. A pretty depressing start to TWINCLING Schools.

October 16, 2007   No Comments

TWINCLING Schools Division

So I am the ambassador of TWINCLING Society Schools Division(page: http://www.twincling.org/node/149 ). My job is to promote the use of open source software across Hyderabad and I am concentrating on promoting Edubuntu. By the way it might be worth mentioning that Edubuntu will be offered alongside Microsoft’s product on the Intel Classmate. This contract was signed on September the 18th. This was a great achievement for Open Source Software.

I will focus on the following points when I present Edubuntu:

  1. Edubuntu is FREE. As in Free speech and Free beer. I will not focus on the philosophy but on the advantages. No admin I know gives a damn about philosophy. They want the work done cheap and fast.
  2. Edubuntu  comes with a plethora of educational software. KDE-EDU is an excellent package that comes with software like KStars and Kalzium
  3. The power of LTSP can be experienced with great ease. The Linux Terminal Server Project allows thin clients (a pentium 2 with a good 64 MB of RAM can act as one) to boot off a Linux installation on the LTSP server.
  4. Edubuntu is open source. No, not every kid might end up to be a geek but those who want to be geeks will get their Linux dose on a regular basis.

I believe that this initiative of TWINCLING Society will go a long way in promoting the use of free and open source software in Hyderabad.

October 16, 2007   No Comments

Poparse

Poparse is a lame attempt to do what gettext does. The reasons why I made gettext are:

1. Getting to know about the gdbm database routine

2. Trying to compete with popular open source software (I won’t do this again).

3. Trying to improve my skills (the most important requirement)

Gdbm is a database routine that allows you to use dictionary methods. I found it after I was pondering about using sqlite3 for this very script (project). I am not too sure if I will continue working on this. Anyway, have a loo:

#import the needed modules
import shlex
import gdbm

dictionary = gdbm.open('dictionary','c')

def voraciousEater(filename):
        """This function saves the msgstrs corresponding to the msgids in a gdbm database
        routine named `dictionary`."""
        po_file = open(filename, 'r')
        po_file_text = po_file.readlines() #We obtain a list of the lines in the po file.
        for line in po_file_text:
                if line.find("msgid") != -1:
                        number = po_file_text.index(line)
                        message_id = shlex.split(line)[1]
                        value_of_msg_id = shlex.split(po_file_text[number + 1])[1]
                        dictionary[message_id] = value_of_msg_id

def efficientFiller(filename):
        """This function creates a new po file and fills it using entries saved previously              ."""
        pot_file = open(filename,'r')
        pot_file_text = pot_file.readlines()
        for line in pot_file_text:
                if line.find("msgid") != -1:
                        message_id = shlex.split(line)[1]
                        if dictionary.has_key(message_id):
                                number = pot_file_text.index(line)
                                corresponding_crap = dictionary[message_id]
                                final_string = 'msgstr' + " " + '"' + corresponding_crap + '"' + '\n'
                                pot_file_text[number+1] = final_string
                                yield pot_file_text #a very huge output of lists is generated
                pot_file.close()

def writer(filename):
        output_file = filename[:-1] #create the pot file
        outfile = open(output_file,'w')
        efficient_filler =  efficientFiller(filename)
        try:
                new_list = list(efficient_filler)[-1] #picking the last list that the yield statement generates.
        except IndexError:
                pass
        for line in new_list:
                outfile.writelines(line)
                outfile.close

filename = raw_input("Give me the pot file or the po file and I will do the rest: ")
if filename.endswith(".pot"):
        writer(filename)

elif filename.endswith(".po"):
        voraciousEater(filename)
else:
        print "File type not recognised. Ensure that the file ends in .po or .pot"

October 14, 2007   No Comments

SAT 2: Recovering from the “Shriphani Conjecture”

The Shriphani Conjecture states that:

“If something is judged by you to be impossible, then it is sure to happen to you.”

Well here goes. Two days ago I chanced to look at my Toefl iBT profile on ets’ website and clicked on the “View Scores” button and wonders of wonders, 117 on 120. So I am safe I said and moved on to read Einstein’s special theory of relativity.

Today I sat for SAT 2. A comedy scene took place at the center.

Scene 1:

(Enter Shriphani Palakodety and Mother)

Shriphani Palakodety: Hmm… from what I gather by looking at the contents of the bag, I seem to have forgotten to get my calculator.

Mother: WHAT !!

SP: Yeah, I am without the electronic device that seems to be so needed to write this exam.

M: We paid more than a 100 dollars for that calculator!

SP: It will be useful at some later date.

M: It won’t be serving the purpose we got it for !! You made us go through a lot of trouble to get hold of this calculator

SP: Relax ! I can write the exam.

M: You wasted money ! That calc. was for your SAT

(I still think that calc. is for playing minesweeper and figuring out why the look-to-us-if-you-want-to-learn-about-open-source-and-linux company doesn’t have a linux version of their calculator-pc syncing software. I still managed to copy the binaries using pyserial to play games on my calc)

SP: Sorry.

M: hmph

So I went in and wrote my name, encircled the dots and came out. I did leave quite a few. I will probably cross 2250 easily. I should have taken the calc. DAMN !

October 6, 2007   1 Comment