Shriphani Palakodety

In Pursuit Of Truth and Beauty

Shriphani Palakodety header image 1

Disjoint Set Data Structure

May 20th, 2010 · Computer Science, python

The last two weeks didn’t really offer a lot of challenges considering the semester is over and I didn’t grow a big enough pair to actually leave the practice rooms in TopCoder and go participate. So, I decided to revise some of the most interesting stuff I learned in my CS 381 class. And since I really liked the stuff we did with Disjoint Sets (not a lot of stuff, just kruskal’s algorithm but it still is pretty neat).We typically define 3 operations on disjoint sets:

  • MakeSet(x) : Create a set with the element ‘x’ in it.
  • FindSet(x) : Return the set that the element belongs to
  • Union(x, y) : Make a new set defined as :  where and   and destroy X and Y.

Implementation Using A Linked List:

Here each set is represented by placing its elements in the nodes of a linked list. In each node, we also store a pointer to the parent which contains the name of each set and some other information like the number of elements in the set, the name and so on.

Running Time For Each Operation:

MakeSet(x) : Constant Time

FindSet(x) : Return the parent that the parent pointer points to

Union(x, y)  :  Assume X is the set x resides in and Y is the set y resides in. Now, if we append the elements of X to Y, we would need to walk through X and set the parent pointers to Y. So, 1 union operation takes O(n) time.

Special Heuristics:

The Union(x, y) implementation gets a slight change here. When deciding which set to append to the other in the union operation, we append that set which has fewer elements to the other set. The advantage is that the walk through the list to change the parent takes lesser time.

Implementation Using A Tree:

We represent a set by a rooted tree where each node points to its parent (not parent -> children but the other way round). We define a special term here called rank. The rank of a set is an upper bound on the height of the tree. Why it is an upper bound will be evident soon.

Running Time Per Operation:

MakeSet(x) : Constant Time. Let x be a node whose parent is itself

FindSet(x) : O(log(n)) time. Basically need to go from x to the root.

Union(x, y): Constant time. We just make the root of either X or Y (the sets x and y belong to respectively) the parent of the other root.

Special Heuristics:

We use a heuristic here called path compression. When we run FindSet(x), we typically traverse the path from x to the root. With path compression, we basically make all nodes on this path the immediate children of the root. The advantage? Subsequent FindSet() operations on these nodes take constant time. This might modify the actual height (as you can see). BUT YOU DON’T CHANGE THE RANK HERE. Hence the rank is an “upper-bound” on the height. If we didn’t have the path-compression heuristic, the rank would have been the height.

So, the code follows. First the linked list implementation:

Here are the class definitions for the Nodes, the List and the Universe

valueNodeDict = {}

class Node():
        ‘Represents a node of the linked list’

        def __init__(self, value, parent, next=None):
                self.value = value
                self.next = next
                self.parent = parent
                valueNodeDict[value] = self

        def __str__(self):
                return str(self.value)

class List():
        ‘Represents the linked list itself’

        def __init__(self, name, value=None):
                ‘Creates a set and sets head and tail to the appropriate nodes’
                self.name = name
                self.count = 0
                if value is None:
                        self.head = None
                        self.tail = None

                else:
                        self.head = Node(value, self)
                        self.tail = self.head
                        self.count += 1

        def __str__(self):
                ‘Lists out all the elements’
                s = self.name + ": "
                node = self.head
                while node != None:
                        s += str(node) + ", "
                        node = node.next
                return s + "\n"

        def addElement(self, node):
                ‘Add another node’
                self.tail.next = node
                self.tail = self.tail.next
                self.count += 1

        def changeParent(self, newParent):
                ‘Changes the parent of every node in the set’
                node = self.head
                while node is not None:
                        node.parent = newParent
                        node = node.next

class Universe():
        ‘Operations you can perform in the universe’
        def __init__(self, name="U"):
                ‘Creates the universe where all your subsequent sets belong’
                self.name = name
                self.setCount = 0
                self.sets = []

        def __str__(self):
                s = self.name + ":\n"
                for set in self.__sets:
                        s += "\t" + str(set) + "\n"
                return s

        def addSet(self, name=None, value=None):
                ‘Adds a set to the universe’
                if name is None:
                        self.__sets.append(List("S"+str(self.setCount), value))
                        self.setCount += 1
                else:
                        self.__sets.add(List(name, value))

U = Universe()
 

As you can see, I have a valueNodeDict dictionary in the implementation. The idea is that I should be able to use the values themselves in the operations and not the nodes.

Next, the operations themselves:

def MakeSet(x, name=None):
        ‘Makes a new Linked List’
        U.addSet(name, x)

def FindSet(x):
        ‘Find The Set This Node Belongs To’
        return valueNodeDict[x].parent

def Union(x, y):
        ‘Destructively Perform The Union’
        if valueNodeDict[x].parent is not valueNodeDict[y].parent:
                x_set = valueNodeDict[x].parent
                y_set = valueNodeDict[y].parent

                if x_set.count < y_set.count:
                        #x gets appended to y
                        y_set.count += x_set.count
                        x_set.changeParent(y_set)
                        y_set.tail.next = x_set.head
                        y_set.tail = x_set.tail
                        U.sets.remove(x_set)
                else:
                        #y gets appended to x
                        x_set.count += y_set.count
                        y_set.changeParent(x_set)
                        x_set.tail.next = y_set.head
                        x_set.tail = y_set.tail
                        U.sets.remove(y_set)
 

Now, the tree implementation:

valueNodeDict = {}

class Node():
        ‘Represents a node in a tree’
        def __init__(self, value, parent, rank):
                self.value = value
                self.parent = parent
                self.rank = rank
                valueNodeDict[value] = self

        def __str__(self):
                return str(value)

class Universe():
        ‘The Universe where all sets sit’
        def __init__(self):
                self.sets = [] #list of all root nodes

        def addSet(self, root):
                self.sets.append(root)

U = Universe()
 

And the operations:

def internalFindSet(x):
        ‘Find The Root Of The Tree That Contains This Node. Uses path compression’
        if x.parent is not x:
                x.parent = internalFindSet(x.parent)
        return x.parent

def MakeSet(x):
        ‘Make a new node whose parent is itself’
        a = Node(x, None, 0)
        a.parent = a
        U.addSet(a)

def FindSet(x):
        ‘Returns the root of the tree which contains this value’
        x_node = valueNodeDict[x]
        return internalFindSet(x_node)

def Union(x, y):
        ‘Destructively Unite X and Y where x belongs to X and y to Y’
        x_set = FindSet(x)
        y_set = FindSet(y)

        if x_set.rank > y_set.rank:
                y_set.parent = x_set
        else:
                x_set.parent = y_set
                if x_set.rank == y_set.rank:
                        y_set.rank += 1
 

As an added exercise, I also threw in Kruskal’s algorithm for finding the Minimum Spanning Tree of a Graph. Here is my graph implementation which just consists of an edge-list and a vertex-list:

import heapq
from disjoint_set2 import *

class Vertex:
        def __init__(self, value):
                self.value = value

        def __str__(self):
                return self.value

class Edge:
        def __init__(self, vertex1, vertex2, weight):
                self.vertex1 = vertex1
                self.vertex2 = vertex2
                self.weight = weight

        def __str__(self):
                s = "Connects: " + str(self.vertex1) + " and " + str(self.vertex2) + "\tWeight: " + str(self.weight)
                return s

class Graph:
        def __init__(self, V, E):
                self.V = V
                self.E = E
 

I decided to create a small graph with nodes: ‘a’, ‘b’, ‘c’, ‘d’ and ‘e’. The code to do that:

characters = [‘a’, ‘b’, ‘c’, ‘d’, ‘e’]

vertices = []
edges = []

for char in characters:
        vertices.append(Vertex(char))
 

Next, I decided to connect every vertex to every other vertex using edges whose weights are in increasing order as follows:

Edge from ‘a’ to ‘a’ has weight 0

From ‘a’ to ‘b’ we get 1

From ‘a’ to ‘c’ we get 2

and so on, you get the idea. The plan was to get a verifiable result straight away.

for vertex1 in vertices:
        for vertex2 in vertices:
                edges.append(Edge(vertex1, vertex2, i))
                i += 1

G = Graph(vertices, edges)
 

Now, we prepare the required data structures for this algorithm. We need a priority queue. Python 2.6.5 ships with a heapq module. Using this module, we can maintain a heap in an array and the desired “bubble up” and “bubble down” operations are performed by the heapq module’s routines. As it is known to mankind, the root of any heap contains the element with the smallest key (assuming the heap is storing (key, value) pairs and is a min-heap). So, we finally have:

def kruskal(G):
        heap = []

        for edge in G.E:
                heapq.heappush(heap, (edge.weight, edge))

        T = []  #this contains all the edges in the tree

        # run makeset on all the vertices

        for vertex in G.V:
                MakeSet(vertex)

        while heap:
                min_edge = heapq.heappop(heap)[1]
                if FindSet(min_edge.vertex1) is not FindSet(min_edge.vertex2):
                        # perform a union and add this edge to the Tree
                        T.append(min_edge)
                        Union(min_edge.vertex1, min_edge.vertex2)
        return T
 

So, I return a list of edges in the MST. When I run this on the graph created above, I get:

(shriphani@Shriphani-Palakodetys-MacBook-Pro) (556/ttys000) (09:03P:05/19/10) -
(%:~/scripts) > python kruskal.py
Connects: a and b	Weight: 1
Connects: a and c	Weight: 2
Connects: a and d	Weight: 3
Connects: a and e	Weight: 4

Which when checked is the actual MST.

Analysis

Assume that we have n makeset operations out of m overall operations, with the special heuristic we use, anytime a list is chosen for appending to another list, we observe that this list has to have fewer elements than the other list.

So, this is the pattern we have:

  • If there is one element in the list and this list is chosen for appending to the other list, then the resulting size would be at least 2
  • If the current size is 2 and we append this list to another list, the resulting size will be at least 4
  • Once we append a list of size 4 to another list, the resulting list would have a size of 8.

So, we observe that in 3 append operations, we approached a size of 8. So, in lg(8) operations, we approached size 8. So, we would approach size ‘n’ (the kruskal() routine obtains the MST on a connected graph at this stage) in lg(n) operations.

Also, there need to be n-1 union operations since the Universe finally contains just 1 set with all vertices in it (assuming you have a connected graph). There need to be n-1 union operations for the universe to approach this state. So, a final running time is O(n * lg(n)) for this.

Now, if the graph is pretty sparse, as in 5 vertices and a single edge in the entire graph, the other operations would dominate. So, the actual running time is

O(m + n*lg(n))

With the tree based structure, our course didn’t cover the analysis but we were told that the running time was a cool O(m * alpha(n)) where alpha(n) <= 4 for  most circumstances.

The code can be obtained at:

In this post I used material from Cormen-Leiserson-Rivest-Stein’s amazing book (It is the best book I’ve ever read. Please go get a copy. You won’t regret it). And of course, stuff from Professor GNF’s CS 381 class. It is the best CS course I’ve taken thus far.

→ No CommentsTags:·········

Gandhi – How Modern India Can’t Understand This Man

May 8th, 2010 · Daily life

More often than not, those who have hit puberty recently (or are in such a mental state. This of course would include most of the Indian youth), try to convince me that Gandhi was flawed, his ideologies were backward (some have even gone on to call him a racist – I don’t know where you pull that one from but whatever.) and so on.

This pains me. Gandhi was an individual whose thought was far beyond what any education can bestow on a man. What our history books fail to tell us (I think this is a fault of the authors or maybe they are under oath to not analyze so the details are left to interpretation) is that when Gandhi arrived in the Indian political scene, India was represented by an elite super-educated group whose understanding of British atrocities was limited to the violence they saw on the streets. What they didn’t understand was that iron-fist imperialist rule doesn’t merely extend to military might but also to a law-and-order system designed to crush and keep the masses impoverished. Gandhi was the only person who understood this. Not one other leader ever bothered to listen to the economic policy that the British empire used to keep the indigo farmers deep in debt and poverty. What every other freedom fighter failed to understand was that the military of the British empire was maintained to enforce unjust law in the subcontinental colonies. If you didn’t comply, you would be forced into poverty, so comply you did. Well, complying forced you into poverty too. Retaliating using violence would be met with sternly. This was a hallmark feature of their style of governing. Well, Gandhi was the first man who managed to understand the problem here, think of a solution (active civil disobedience) and to confuse a law and order system that assumed that dissent would come in the form of a crude attack, adopted the policy of non-violence. So, essentially, whenever Gandhi went to prison, his own fame would ensure that people knew of his arrests on no charges defined by law. This was how advanced his thought was. Gandhi was smarter than most men.

My fellow Indians, corruption in the public sector is not Gandhi’s fault. He led by example and you failed to follow. He wanted to ensure that modern India was secular, and yet we allowed our imagination to run wild and partitioned ourselves. Gandhi did not just fight for independence, he fought to ensure that India would be led by individuals who wouldn’t exploit the minorities or engage in harebrained foreign policy. He refused to accept help from those who were responsible for most of Asia’s and Europe’s suffering. This man had the power of analyzing the effect of every action he took. We have only benefitted from Gandhi’s life, we have lost almost nothing. He truly deserves the title – “Father Of The Nation”.

→ 1 CommentTags:·····

Weirdest Analyses Ever

April 30th, 2010 · Computer Science

This semester I had the fortune of taking Dr. Greg Frederickson’s CS 381 (Algorithms) class. And boy did I see weird stuff in there. Below, I have a list of analyses I say are downright the most non-obvious (and in a way beautiful to look at).

  • Edmonds-Karp Algorithm (Max Flow in a network): This algorithm is the Ford Fulkerson’s algorithm that uses a BFS to compute the next augmenting path as opposed to a DFS and subsequently achieves a running time of O(|V||E|^2). The idea here is that an edge (u, v) can appear in an augmenting path as a critical edge when the distance of u from the source ‘s’ (I will use dist(u) to denote distance from the source henceforth)is less than dist(v). Now, once augmented, this path can appear in another augmenting path only when this condition is met. This only happens when we retract flow off this edge. That is, edge (v, u) appears in an augmenting path on our residual network. The result is,

    dist(v) = dist(u) + 1

    So, let us say, (u,v) gets another shot at making it in an augmenting path, the distances are:

    new_dist(u) = new_dist(v) + 1;

    But from the conclusion obtained from a previous step,

    new_dist(u) = dist(u) + 2;

    So, for (u,v) to show up as a critical edge, in an augmenting path time and again, the distance of u from the source needs   to be incremented by 2. We can only go as far a |V| – 2 from the source. Simple arithmetic shows us that an edge can show up as a critical edge at most (|V|  / 2 ) times in its lifetime. There are 2*|E| edges in the residual network. So we have |V||E| iterations overall. We do at most |E| work with each augmenting path. So, the overall complexity is O(|V||E|^2). Beautiful stuff indeed.

  • Any problem reduction which is used to prove lower bounds. EMST has a lower bound of Omega(nlog(n)) because we can reduce sorting to EMST. Brilliant!

Overall, I have to say, CS 381 under GNF or Atallah at Purdue is a must. Our department is responding too aggressively to individuals with a very poor work ethic by allowing CS majors to graduate without a solid, super-hard algorithms course. Please make the most of the solid Theory group we have in our department. This is wrong, simply wrong and it is an insult to the field and to society when you let someone call themselves a “Computer Scientist” and they need to look up wikipedia to analyze the performance of a breadth first tree traversal. Overall, I am not sure I am happy with the way the new curriculum is shaping up.

→ No CommentsTags:····

Making A Difference

April 17th, 2010 · Uncategorized

I found this video on facebook. It is about a banker in the state of Tamilnadu in India who changed the lives of a lot of people in his state. It is one of the best documentaries I have ever seen.

Banking On Change (12 min version) from Pilgrim Films on Vimeo.

→ No CommentsTags:

Breast Cancer Gene Patent

March 29th, 2010 · Uncategorized

The patent on the breast cancer gene is ruled invalid. A big day for research. I only hope this ensures that any such patents in the future don’t stand in the path of research. http://www.aclu.org/free-speech-womens-rights/patents-breast-cancer-genes-ruled-invalid-aclupubpat-case

→ No CommentsTags:

Listener Gets a VAD

January 21st, 2010 · DSP, python

So, the beginning of the 4th semester in the midst of losers and overachievers and this sem promises to set my a$$ on fire. As usual, I plan to continue working under Dr. Kihara this sem so that should be interesting. Anyway, I decided to improve upon what listener offered and decided to add a VAD algorithm to it. I initially chose the algorithm by moattar and homayounpur and decided that I ended up with too much to do (it might certainly be a good candidate for later, when I have more time for example). Hence, I decided to snoop around for something simpler and found this paper which seemed small and had a sort of ever changing threshold for successive frames. The paper was authored by S.Milanovic, Z. Lukac and A. Domazetovic. I still don’t think I got it exactly right though. The paper mentioned that they used counters to mark frames as silence based on what the previous frame was and I had to come with a counter upper bound for myself and finally chose to go with 10 as a good counter for such stuff. i.e. even if a particular frame doesn’t make it beyond its threshold, it still will be marked as active if the previous frame was active. This is done to accommodate situations where we end up reducing our volume at the end of a word / sentence.

Finally to decide whether there was speech on an overall level, I look for at least 3 instances of 18 consecutive frames being marked as active (just random picks, 18 frames allows 8 active frames and 10 additional for the counter we have and 3 looked like a good candidate at the end when I spoke my own name out).

And as a final measure, I also ensure that the overall intensity beats 48 dB so that someone trying to have a conversation with me is only recognized.

Finally, I made the switch from GeekTool to Growl as this thing kept taking a solid amount of real estate and since I have one 23” monitor and a 15” monitor, this thing is positioned outside the real estate of my laptop’s display. Growl seems like a better candidate overall and since I could get growl bindings to build on my machine finally, I think I should let growl handle this.

So, the only places where my VAD implementation (or my mod of whatever was in that paper) doesn’t seem to work is in surroundings with a piano (in our dorm’s lobby for example), v inconvenient but whatever, probably some time in the future, I will begin understanding DSP and spectral analysis well enough to come up with a simple VAD algorithm (as opposed to implementing something straight from a paper without any understanding of what is going on). Anyway, here is the updated script, it seems to do well recognizing speech in sort of silent settings:

#!/usr/bin/env python
#Author: Shriphani Palakodety
#Tool to aid those with noise cancellation headphones

import pyaudio
import wave
import sys
import struct
import numpy
import time

Growl_exists = True

try:
        import Growl
except ImportError:
        print "No Growl"
        Growl_exists = False
        pass

skype_on_call = False
notifier = 0
if Growl_exists:
        notifier = Growl.GrowlNotifier(‘Listener’,  [‘Attention’, ‘test’])
        #notifier.applicationName = ‘Listener’
        notifier.register()

def record():
    ‘Records Input From Microphone Using PyAudio’
    duration = 3 #record for 1 second. Pretty long duration don’t you think
    outfile = "analysis.wav"
   
    p = pyaudio.PyAudio()
   
    inStream = p.open(format=pyaudio.paInt16, channels=1, rate=44100,input=True, frames_per_buffer=1024)

    out = []
    upper_lim = 44100 / 1024 * duration #upper limit of the range we record to. 44100 / 1024 sized chunk * 5 seconds
   
    for i in xrange(0, upper_lim):
        data = inStream.read(1024)
        out.append(data)
   
    #now the writing section where we write to file
    data = .join(out)
    outFile = wave.open(outfile, "wb")
    outFile.setnchannels(1)
    outFile.setsampwidth(p.get_sample_size(pyaudio.paInt16))
    outFile.setframerate(44100)
    outFile.writeframes(data)
    outFile.close()
    analyze()

def analyze():
    if skype_on_call:
        print "\n"
        print "Skype Call In Progress"
        print "Listener On Hold"
        return
    inFile = wave.open("analysis.wav", "rb") #open a wav file in read mode
    thresh = 1000  #establish a minimum threshold
    max_samp = 0               
   
    decision = [0]

    #for i in xrange(441):

    inactive_counter = 0
       
    vals = inFile.readframes(inFile.getnframes()) #read in 30 samples
    len(vals)
    results = struct.unpack("%dh"%(inFile.getnframes()), vals)  #unpack to get the samples
    results = [abs(x) for x in results]
   
    #now we need to pull 30 samples at a time (30 samples = 1 frame).

    for i in xrange(4404):
        frame = results[30*i: 30*(i+1)]
        print frame
        new_thresh = (thresh * (1(2.0 ** -7)))  +  ((2 ** -8) * max_samp)
         
        #check how many samples go above this new threshold
        count = 0

        for j in frame:
            if j > new_thresh:
                count += 1
        if count / 30.0 >= 0.9 :   #need it to beat 90%
            #frame is a candidate for speech
            decision.append(1)
         
        else:
            #this is where we use a counter based implementation for labelling inactiveness
            if inactive_counter < 10 and decision[-1] == 1: #we ignore silence for 10 runs
                decision.append(1)
                inactive_counter += 1
            else:
                inactive_counter = 0
                decision.append(0)
         
        #update the threshold and the max sample values
        thresh = new_thresh
        max_samp = max(frame)

    #final check for characterization as speech, we use another counter
    active_counter = 0 #since the inactive counter will cause silence to be recognized as speech, we only consider speech as
    print decision
    final_num = 0
    for val in decision:
        if active_counter >= 18:
            print "Speech!"
            final_num += 1
            active_counter = 0
        if val == 1:
            active_counter += 1
        else:
            active_counter = 0

    results = [x ** 2 for x in results]
    intensity = 20 * numpy.log10(numpy.sqrt(sum(results)/inFile.getnframes()))
   
    if final_num >= 3 and intensity > 48:
        if Growl_exists:
            notifier.notify(‘Attention’,‘Listener’, ‘Speech Detected Nearby’)
        else:
            print "Speech Detected Nearby!\nSomeone might be calling you"
    inFile.close()

if __name__ == "__main__":
    f = open("skype_Status", "r")
    for new_line in f:
        if new_line == "PROGRESS":
            skype_on_call = True

    if skype_on_call:
        analyze()
    else:
        record()
 

Anyway, it would be really convenient if I could find something about VAD algorithms and improve listener to work better for my dorm room settings. It is doing a pretty good job already but there is always scope for improvement.

As always, my solutions need to be convoluted and over here, I make use of applescript to check if there’s a skype call going on or not, so yeah, you can find all that here.

Screenshots etc available on Listener’s new home: http://shriphani.com/blog/listener/.

→ No CommentsTags:

2009 – Recap

January 2nd, 2010 · Uncategorized

Well, this year, I did a lot of cool stuff. You can’t believe the stuff I did this year. First, I managed to blow up a stat course and get a B – right in the second semester in one of the easiest courses (supposedly). Well, the next sem went well. And that is all I did. Well, in code land here is the stuff I did:

1. Wrote a search engine – Seriously, purdue CS students, take Dr. GRR’s Course and you won’t regret it.

2. Wrote a Map Editor and a Turn by Turn direction finder – Although the GUI stuff was 100% done by my teammate  ( I suck at SWING), I worked with the dijkstra algorithm. (Again, Dr. GRR’s course).

3. Worked in real mode. Did you know the real mode is absofuckinglutely cool. From a debugger, you can modify the fkin screen. Every CS major should code in real mode – it is important that you do. Else you have missed out, believe me, you have missed out.

Now, some whacko notes:

From the DSP guide I managed to see a signal in a different way.

Lemma: Assume a signal composed of n samples is a linear space. (It is. A signal with every sample set to 0 falls in this space and we can add / scale without adding any more samples. So an n – point signal is a linear space  - Q.E.D)

Since we have a linear space, what is the basis of the space. These are the basis functions (the sinusoids). There’s n + 2 sinusoids but two of these have all values set to 0. Hence these sinusoids are linearly dependent on other sinusoids we already have – leaving us with n linearly independent sinusoids. These span the n dimensional space containing the signal and the frequency domain provides us with the coordinates of the signal in the space represented by the basis functions. Useless piece of knowledge is now recorded on this site and will rot here till eternity.

It is 2010…….

→ 2 CommentsTags:

The One PITA

November 29th, 2009 · Daily life, PITA, python

Well, it is thanksgiving break and I was so far having a decent semester, straight As in all exams (a perfect score in economics – not that I should be proud of it or anythin) and then terror strikes. Or well whatever the college version of a cataclysm is. I managed to f’kin ruin (misunderstand) the spec on a project and I am in danger of throwing away a coveted 4.0 GPA which would have been a great reward for the long hours of study I have put in + a retooling of my schedule so I have the multitasking capability of a mule and those $$ my parents spend so their son can enjoy a pain free life in a first world country and try to make them proud. Well, as it happens, I managed to (or at least I think – the scores are not yet out) misunderstand a spec AAAAARRRGGHH! In a datastructures course, I mastered AVL & Red-Black trees, spent hours trying to tweak my implementations, did well on the exam and managed to blow it when it came to reading a text file and filling an array. I just wonder how I even pull this stuff off. With Grad School apps coming in 2 years, what will I have to show – a carelessness in even reading specs seriously that puts doubts on the efficacy of my research methodology, I just hope I don’t cause major problems for myself.

Well, in case this doesn’t make sense, I managed to misunderstand a technique to populate an array with data (the data structs would work with this but oh no, in my interest to take the maximum from this course, I devoted long hours to getting the data structs right). There is a very good chance that the part I screwed up would end up being insignificant but that is not the point. The point is that once again my grade is going to shuttle between the first two letters of the english alphabet.

Anyway, in all this self hatred that I have been building up for myself, I have managed to learn some cool stuff in Dr. Kihara’s lab. The work there is pleasant, I can feel good boasting about it and when I talk to my friends’ parents, I can make them believe I am going to find a solution to poverty in 4 years and find a cure for cancer in my spare time (you can see I am not popular).

However, a weird question I was dealing with was that most of the stuff I have written for my work is in Python and it would be cool if I could call it from Java since there are a bunch of people in the lab who use it. I am not looking for something complicated, just want to call a bunch of methods from a Python module. JPype and Jython seem to the things I should be looking for but with my awesome constraints (Python 2.6 should be supported, It should make coffee etc), I will need to use my Uber-GOOGLE-SKILLZ.

Anyway, this blog has managed to get to pagerank 0 (I will interpret that as the pagerank o loner being relevant ) and I am now a suggestion on Google (yay! my plan for world domination is in full swing!)

And I love this Charlie dude who bites his bro’s finger, as for kanye, well even the prez thinks he’s a jackass:

→ No CommentsTags:

Tinkering With A New Project

September 18th, 2009 · python

During the vacation this summer, I began working on creating an app that would help me respond to calls of attention when my auditory sensory capabilities were compromised courtesy the noise cancellation capabilities of my Bose headsets. Well, I managed to make a few mods to that script, used a touch of applescript (thank god OS X apps are scriptable) and introduced a bunch of new behaviors:

-> When a Skype call is in progress, the app stops listening.

Ok, not a bunch, just one. Also, this is not exactly an app you should be using since it relies too much on quirks in my own computing environment. Anyway, for more details you can head over to http://shriphani.com/Shriphani_Website/Listener.html.

So, a few screenshots:

Apart from that, I also wrote a protein function matching script as part of my research this semester. I will be putting it up soon. Wow, I have been more productive in these three weeks than all of last year.

→ 4 CommentsTags:

Experiments With Interior Design

September 7th, 2009 · Daily life

Well, yesterday I mentioned the battle of tarkington, an elaborate arrangement of action figures to illustrate a story. Well here is the second part:

Snake Eyes, struggles to aim at our heroes due to the high velocity winds. He decides to end it the cool way, by cutting the cord used by Data Center and Beach Head. He begins his ascent, his destination: the smoke detector, his mission: to cut the damn cord.

IMG_0166

IMG_0168

IMG_0171

IMG_0172

Meanwhile, Beach Head looks down and sees the citadel of Qwerty City, Macbook Pro Center. A drop would mean certain death.

In the face of death, Beach Head puked – everything he ate over the last meal – totaling a whopping 1.5 Kg. (Belly Clench = Puking).

To his horror Beach Head realized that he had dropped his ammo + supplies bag !!

Suddenly Data Frame noticed a movement in the smoke alarm region. He saw Snake Eyes and the knife.

He alerted Beach Head about it. Beach Head rubbed his brow thinking that that may have well been his last vomit.

The decrease in the mass of the (Beach Head + Ammo Bag) system was just enough for the strong computer programmer, Data Frame to perform his famous maneuver. Using all his strength, he swung his arm lifting Beach Head and the gun and as the barrel came in line with his view of Snake Eyes, he fired. His life hinged on the accuracy of his aim:

mid – mid – somersault, Beach Head heard a bang and saw the bullet whizz past his face.

Snake Eyes stunned by this feat didn’t realize what was happening when the bullet hit him in the face. The impact was so severe, he lost balance and hit the wall:

Gravity showed up demanding a demonstration of free fall. On his way down, Snake Eyes realized that he would ram into Baroness as well.

Baroness oblivious to the activity, noticed a dark object hurtling towards her:

Baroness couldn’t hang on to the rope and began her fall with Snake Eyes:

On his way down Snake Eyes was visited by a strange thought “Radioactive Ammo”

Data Frame couldn’t believe his superhuman strength:

Dataframe and Beach Head, defending QwertCity always.

→ 1 CommentTags: