Prayer Scheduling

A prayer scheduling algorithm for “your god”.

# Prayers:  all the prayers unanswered till time t.
AddPrayers(newPrayer,PrayingPerson,PrayingToPerson)
If (PrayingToPerson == ME) {
If (PrayingPerson.IsBeliever){
for (prayer in Prayers):
if (prayer==newPrayer AND 
prayer.priority != MAXPRIORITY) 
{prayer.priority=prayer.priority+
CheckStrengthOfPrayer(newPrayer);}
else{
newPrayer.priority=CheckStrengthOfPrayer(newPrayer);
}
if(prayer==!newprayer)
{if (CheckStrengthOfPrayer(newPrayer) > prayer)
 Prayers.remove(prayer); }
Prayers.add(newPrayer);
}
}
else{
Prayers.add(!newPrayer);
}

CheckStrengthOfPrayer(newPrayer)
priority=0;
If (newPrayer.SoundLevel == INSANELY_HIGH) 
priority=priority+10;
If (newPrayer.AssistedBy == RELIGIOUS_LEADER) 
priority=priority+10;
If(newPrayer.AccompaniedBy == HOMICIDE) 
priority=priority+10;
If(newPrayer.AccompaniedBy == OTHER_CRIMES) 
priority=priority+5;
##################
##more code goes in here
##################
return priority;

AnswerPrayers(Prayers,World)
While(!Prayers.IsEmpty) {
If(World.HasGays()){Send a disaster;}
else{
for (prayer in Prayers){Fulfill Wish;}
}
}
Posted in Alacrity, Monkey Business, Uncategorized | Leave a comment

Mithai khane ka asar

(After coming back from a movie.)
Anuran: Abe Anik, aaj mein aur Nihar Royapettah gaye the. Ek dukan mein mithai khaye. Tab ek ajeeb-o-gareeb ghatna huyi.
Anik: Kya hua bata?
Anuran: Abe do tho mithai khaye. Kitna price hoga guess kar? 60 rupaye liye usne….. aur dukan bhi Bihari dhaba se chhota tha.
Anik: (With a diplomatic gaze) hmm…. yahan pe aisa hi hota hai.
Anuran: Pata hai uske baad kya hua? Hum donon ko achanak se dikhna bandh ho gaya. Phir raat ko room laute tab jaake thikse dikha.
Anik: shit!!! Kya milaya tha usmein???
Anuran: Abey nahin…. usne hum donon ko ullu bana diya na. :D :D :D

Posted in Monkey Business, TJs and PJs | Leave a comment

A beginners tutorial on Social Network Analysis – (Part 2)

In this part, we will talk about visualizing our network.

  • Tools used for this tutorial: networkX, matplotlib

In Part 1 of this tutorial, we talked of a graph having 5 nodes (a,b,c,d,e) and the edges [(a,b), (b,c), (c,d)]. Let’s add one more edge (b,d)

Matplotlib is a set of plotting tools for python. You can download and install it from a package manager of your choice, or install it from source. This can take care of advanced 2D plotting for python. We will use this to plot our network.

#!/usr/bin/python
import networkx as nx
import matplotlib.pyplot as plt

graph=nx.Graph()
edgeList=[('a','b'), ('b','c'),('c','d'),
('b','d')]
graph.add_edges_from(edgeList)

pos=nx.spring_layout(graph) #specify the layout
nx.draw(graph,pos,node_color='#A0CBE2',
        edge_color='#B0C23E',width=2,
        edge_cmap=plt.cm.Blues,with_labels=True)
plt.show()   #display the graph
plt.savefig("idiot_network:P.png")
#save it on the disk
the rendered graph

All the parameters in nx.draw() are self explanatory.
NetworkX has the following layouts:

  • Graphviz and pydot layout
  • circular layout (places nodes in a circle)
  • random layout (positions nodes based on an uniform distribution in a unit square.
  • shell layout (places nodes in concentric circles)
  • spring layout (places nodes using Fruchterman-Reingold force-directed algorithm )
  • spectral layout (positions nodes using eigen vectors of the graph laplacian)

You can tinker with different layouts and select the one that best suits your needs.

To show you the types of visualizations rendered, I am posting some renders below :

Portion of a large graph in random layout
co-authorship graph of faculties in CSE dept. IIT Madras

In the next parts, we will work on some real network, like twitter followers network or IMDB co-star network or DBLP co-authorship network and check models for link prediction, homophily, information cascades and epidemics, community detection etc. Thanks for following this tut.  :)

Posted in Academics, Courses, Technology | 1 Comment

A beginners tutorial on Social Network Analysis – (Part 1)

Social Network Analysis refers to the methods used for analyzing social networks or interconnections among individuals. The individuals are taken as “nodes” and are connected to each other based on their interconnections, which may be of various types (friendship, co-authorship, kinship, sexual relations, financial exchange, common interest etc.) SNA uses various techniques from Graph Theory, Game Theory and several other to study, explain and predict the network.

Getting the tools:

NetworkX is a Python-based package for the creation, manipulation, and study of the structure, dynamics, and functions of complex networks. If you are on a linux distribution like Ubuntu chances are it will be in your package manager. Otherwise, you can download and install the binary or even compile it from source from here.

Head-first to NetworkX:

import networkx as nx #importing networkx for use

Next we need to create a graph,

graph=nx.Graph()

Let’s say we have 4 nodes named ‘a’,'b’,'c’ and ‘d’ and edges between (a,b) , (b,c) and (a,d).

to add a node we can just use:

graph.add_node('a')

We can also add all nodes from an iterable to the graph.

nodeList=['a','b','c','d']
graph.add_nodes_from(nodeList)

Nodes can also have attributes: attribute can be from a dictionary

nodeListAtrb=[('a',{'name':'alpha','color':'red'}),
('b',{'name':'beta','color':'blue'})]
graph.add_nodes_from(nodeListAtrb)
print graph.node['a']['color']
#to access an attribute of a node

You can have any number of attributes according to your choice.
Next we will add some edges. Adding an edge is exactly similar to adding a node.

edgeList=[('a','b',{'color':'blue'}),
('b','c',{'weight':8}),('c','d',{'connected':8})]
graph.add_edge('a', 'b')
graph.add_edges_from(edgeList)
print graph.edge['a']['b']['color']
#To access an edge's attribute

Next we will analyze this graph.

nx.degree(graph)
#To find the degree of graph
nx.connected_components(graph)
#Find all connected components
nx.connected_component_subgraphs(graph)
#get connected components as subgraphs
graph.degree('a') #Get degree of a node
nx.degree(graph) #Get degree of all nodes
nx.closeness_centrality(graph)
#get closeness centrality for all nodes in a dict
nx.betweenness_centrality(graph)
#get betweenness centrality
nx.clustering(graph) #Find clustering coefficients
nx.shortest_path(graph,'a','d')
#find shortest path between 2 nodes
nx.shortest_path_length(G,'a', 'd')
#find length of shortest path between 2 nodes
nx.neighbors(graph,'a') #find neighbors of a node

NetworkX provides many other methods to access different properties of the network and analyze them.

(In the next parts, we will discuss on how to get a visual representation of the network, collecting data for our network, and work with a real life network) In case of any issues or suggestions please add a comment to this post.

Posted in Academics, Courses, Technology | 1 Comment

Barefoot – The other side of life BY HARSH MANDER

Can anyone really live on Rs. 26 a day, the income of the officially poor in rural India? Two youngsters try it out.
Late last year, two young men decided to live a month of their lives on the income of an average poor Indian. One of them, Tushar, the son of a police officer in Haryana, studied at the University of Pennsylvania and worked for three years as an investment banker in the US and Singapore. The other, Matt, migrated as a teenager to the States with his parents, and studied in MIT. Both decided at different points to return to India, joined the UID Project in Bengaluru, came to share a flat, and became close friends.
The idea suddenly struck them one day. Both had returned to India in the vague hope that they could be of use to their country. But they knew the people of this land so little. Tushar suggested one evening — “Let us try to understand an ‘average Indian’, by living on an ‘average income’.” His friend Matt was immediately captured by the idea. They began a journey which would change them forever.
To begin with, what was the average income of an Indian? They calculated that India’s Mean National Income was Rs. 4,500 a month, or Rs. 150 a day. Globally people spend about a third of their incomes on rent. Excluding rent, they decided to spend Rs. 100 each a day. They realised that this did not make them poor, only average. Seventy-five per cent Indians live on less than this average.
The young men moved into the tiny apartment of their domestic help, much to her bemusement. What changed for them was that they spent a large part of their day planning and organising their food. Eating out was out of the question; even dhabas were too expensive. Milk and yoghurt were expensive and therefore used sparingly, meat was out of bounds, as were processed food like bread. No ghee or butter, only a little refined oil. Both are passionate cooks with healthy appetites. They found soy nuggets a wonder food — affordable and high on proteins, and worked on many recipes. Parle G biscuits again were cheap: 25 paise for 27 calories! They innovated a dessert of fried banana on biscuits. It was their treat each day. Continue reading
Posted in Brainstorm | Leave a comment

New bill to stop unfortunate incidents of watching Porn in the assembly

In an interesting turn of events, Minister of Parliamentary Affairs Mr. P.K Dansal has condemned media for showing reports on ministers watching porn inside Karnataka state assembly. “The ministers go through a lot of trouble and often have to get involved in the dirty work of screening such videos so as to better understand the culture in other countries. Media has no right to malign the image of the house by showing such clips to the public.”, he said when contacted by our correspondents. 

It is to be noted that three ministers were caught by media while watching porn inside Karnataka state assembly and tendered their resignation after the incident. A new bill is to be brought up in the house to convict the media for showing such defamatory reports to innocent public. “These news reports are being watched by millions of people including small children. It is an act of utter irresponsibleness to broadcast such reports. We must take steps to prevent news like this from reaching to general public. This proposed bill will certainly be a huge relief to the Nation. “, said Mr. Bakil Sibbal to our correspondents.

In another incident a cartoon TV channel representing the country (atleast in name) is seen ridiculing other news channels. In a report they said, “We are unable to understand why news channels are airing such meaningless reports whereas there are news about ‘alien invasion’, ‘reincarnation of the Pandavas’, ‘witch of Delhi’ and many more yet to reach to the public.” We asked them about ‘Witch of Delhi’ and got to know that a witch has given the city an ultimatum of one month to do some puja otherwise she will be eating half of North Delhi. Continue reading

Posted in Alacrity, Monkey Business | Leave a comment

SAPA – SCALE Conference 2012

SAPA – SCALE Conference 2012
7-8 September 2012, Portland, OR, USA
http://www.sapaworkshops.org/2012

Papers are solicited for the SAPA-SCALE conference, an ISCA-supported
event to be held as a satellite to Interspeech 2012 in Portland, USA,
September 2012. Following the successful Workshops on Statistical and
Perceptual Audition (SAPA 2004, 06, 08, 10), the event this year is
organized jointly with the Speech Communication with Adaptive Learning
(SCALE) consortium. The principal objective of the conference is to
bring together researchers addressing perceptually motivated speech
and audio processing tasks with the tools of statistical signal
processing and machine learning. The themes of the conference are: Continue reading

Posted in Academics, Conferences | Leave a comment

Methods of Proof

Top 10 Proof Techniques

  1. Proof by throwing in the kitchen sink: The author writes down every theorem or result known to mankind and then adds a few more just for good measure. When questioned later, the author correctly observes that the proof contains all the key facts needed to actually prove the result. Very popular strategy on exams. Known to result in extra credit with sufficient whining.
  2. Proof by example: The author gives only the case n = 2 and suggests that it contains most of the ideas of the general proof.
  3. Proof by vigorous hand waving: A faculty favorite. Works well in any classroom or seminar setting.
  4. Proof by cumbersome notation: Best done with access to at least four alphabets and special symbols. Helps to speak several foreign languages.
  5. Proof by exhaustion: An issue or two of a journal devoted to your proof is useful. Works well in combination with proof by throwing in the kitchen sink and proof by cumbersome notation. Continue reading
Posted in Alacrity, Monkey Business | Leave a comment

Mojito

After quite a long time thought of going for a mojito. It started with the thrill of blending , and after the plan got final with Sunny it turned out to be just another excuse to gulp down some white rum and blend a cocktail to beat down the scorching summer. :P

Ingredients used:

  1.  Sparkling water.
  2. Mint leaves
  3. Lemon
  4. Sugar syrup
  5. Ice cubes (crushed)
  6. Bacardi white rum

Preparation:

Added crushed ice upto 30% in the glass. 5ml. sugar syrup to trickle down, followed by 10ml of mint leaf extracts, 10ml. lemon juice, 20ml. sparkling water and 20ml rum. The whole thing was topped with few mint leaves and 5ml of mint extract.

Posted in Food, Life | Leave a comment

A walk in the clouds

Coorg is a well known hill station in Karnataka known for the mesmerizing mountain ranges all over with luscious greenery and the tranquil waters of the Cauvery River flowing through the hilly area, not to mention some attractions like dubare, Kaberi Nisarg dham, a buddhist temple and a white water rafting site surrounding the spot.

We started off from Mysore in a group of 8 (me, guru, T. sushant, Piyush, Mohan, Pratyush, Sudhir and Prateek) and our first stop was the Buddhist temple at Bailakuppe. The place was pretty well managed in terms of cleanliness and the monks were seen all over doing their chores. Well the poor souls were having hard time as each group of tourists dragged them for a pic and we were no exception. :)

The next stop was Dubare forest. A short expedition in the jungle, tree house and after that had the most thrilling time of the trip– the rafting in Cauveri. 4 of us joined on a raft and after a short tutorial got on with our paddles, and then came the rapids. When the guy guiding us asked to jump into the water, I was shocked with disbelief and then at the next moment we were floating in Cauveri. That was simply awesome….

Went on to find a place for home stay on top of a hillock after reaching Madikeri, and after a mini-train ride the plan was to cook. Spent the evening cooking and getting high (and this time the excuse was chilly climate :P )

The next morning went for a water fall, few places of historical importance and the next stop was Talakaveri . The real fun was from the top of the mountains in Western Ghats, 4000ft above the sea level and kissing the clouds. After having a “Khatti” over there finally got down and got back on our way to Mysore.

 

In one word it was just exhilarating, a package filled with fun, thrills, adventure and in all a perfect weekend with friends.

Posted in Life, Travelling | Leave a comment