13 April 2014

Pushing to GitHub without the authentication problem

Update: The new method is here

After creating a repository in GitHub, accessing it and pushing to it from Fedora with Smartgit and an authentication token, I found it very perplexing that i wasn't able to do the same thing from Windows. Here, whenever I tried pushing to the repository, Smartgit gave me an authentication error. If anyone else is going through the same problem, this is the way to solve it:

Download and install Git for windows: http://git-scm.com/downloads

Open the Git Gui and select "Show SSH key"




Click on "Generate a key" and copy that key to the clipboard. This is the key with which Github will know that a connection from your PC is genuine. You'll be asked to enter a passphrase. Remember this passphrase, because everytime you want to push to the repository, you'll be asked for this passphrase.

Open your GitHub account and navigate to the account settings > SSH keys > Add SSH key
to add the key that you copied to the clipboard.


I initially tried using PuTTY's plink.exe (there's a GIT_SSH system environment variable which had first pointed to just 'plink' and I changed it to the full path to C\Program Files\PuTTY\plink.exe, (but the right way to do it is to point it to the ssh.exe of the Git installation, after which the Git GUI's will work fine)



but kept getting a  "The server's host key is not cached in the registry" error) to do the ssh authentication. Then decided to unset the GIT_SSH variable. Just open up the Git Bash prompt in Windows, and type "unset GIT_SSH" (without the quotes).

That's it! Now you'll be able to clone and push to GitHub.

To clone:
First, copy the SSH link
 
 
Now use that link in Git Bash like so (attribution):

git clone git@github.com:yourgithubusername/yourrepositoryname.git

The remote repository will now be cloned onto your local PC.
Create a few new files in the local repository and add them to the 
local repository by typing:

git add .
 
This will add the new files to your local Git repository (note the 
space and the dot after 'add'). Commit by:
 
git commit -m "some message"
 
and push to the remote server using:
 
git push
 
It's as simple as that! Somehow, I liked the process of doing it via the 
commandline more than via a GUI.





 
At this point, you'll be able to push from SmartGit or from Git GUI too.

 
 
 
At any point of time if you wish to see the files which contain your 
ssh authentication, go to the Git Bash prompt and type:

cd ~/.ssh
ls 

and you'll see the rsa files that hold your ssh keys. If you want to 
generate new keys, you can always delete these files and create new ones 
as I showed in the beginning of this blog post.
 
 

The right hardware for the right purpose

When it comes to hardware, the price variation between similar products of different brands surprises me. I needed a new spike-buster (surge protector) for my computer and went searching for it at around 9:30pm. Most of the shops were closed, but one shop had one of Cona for Rs.185. Bargaining brought it down to Rs.165, but on carefully examining it, I noticed one socket was jutting out a little. One thing I always look for in a product, is the care that they take to make it. This one was lacking, even though it seemed to be made of good material. Although the shopkeeper was trying hard to make a sales pitch, I excused myself and reached another shop farther away, which had more known brands (of better quality), but the prices were Rs.650 (Frontech) and Rs.1000 (Belkin). Although bargaining brought the price of the Frontech spike-buster to Rs.500, it seemed odd that it was almost double the price of Cona. The only extra feature it had was individual switches for every socket. I decided not to buy.

The next day, I started hunting a bit early, reached a shop where another Cona spike-buster was available for Rs.250. Here, the metal in one socket was a bit twisted and the hologram had a piece 'bitten' off it. Didn't buy. Further on, at a small shop, I found a smaller, neat, carefully crafted spike buster for just Rs.145. The brand was "Allen" (a local brand), which I hadn't even heard of, but the material quality was good enough and the shopkeeper obliged in allowing me to stick a few plugs into the sockets to test if it was held in position well. Turned out to be exactly what I needed, at a fraction of the price of the other spike-busters.


If I were purchasing a computer processor, I'd definitely be conscious about the brand. I'd buy only from a reputed brand. But when I already have a UPS which protects from power surges, a spike buster with a fuse and four sockets were more than enough for an un-complex hardware requirement perspective. In this case, not going for a known brand, but looking for a good quality product at a reasonable price was a wise decision.

In the same way, I see so many people (sometimes I do too) purchasing shoes, sandals, burgers, movies, pizza's and fried chicken from brands that are clearly charging them anything from three to five times what they actually needed to make a profit (likely due to splurging on advertising). Sometimes, it's worth the money because of the 'experience' and 'ambiance', but it would be a wise decision for a person to consider from time to time, whether it really is worth the money, when what really brings us happiness, is not the amount of money we spend, but the people we spend our time with. Searching for what makes you happy, is important.

Update 2018: I no longer recommend Allen. I recently purchased one, and the quality was poor. The contact points were also not properly soldered. It malfunctioned.

12 April 2014

Skill page

Experience never gets old


I'm known to be observant, impartial, articulate, good with root cause analysis and ideation. I care about following best practices and creating an environment where people can improve. I'm more productive in evenings than mornings, and I still build hobby projects to solve little problems.

Masters Degree in Machine Learning at MSRUAS

Was the first ranker in my class and I got admission to this course by clearing the difficult computer science GATE exam in the first attempt, despite being a mechanical engineer. 
 
Evolutionary algorithms (DE, PSO, etc.), neural networks, statistics, pattern recognition, image processing, data mining, natural language processing, time series analysis, exploratory data analysis, probabilistic graphical models, fuzzy logic, management methodology and soft skills.


At C-DAC

C-DAC brought the internet to India and built India's first supercomputer. We were taught by some very capable researchers. My Post Graduation Diploma in Software also involved passing the dreaded MGPT's.

Object Oriented Programming, Datastructures, Computer Organization and Operating Systems, Computer Networks, Database Management Systems, Object Oriented Analysis and Design. Software Engineering. Web Technologies.

 -----------------------------------------------------------------------------------

Languages & Frameworks

Good knowledge

Have worked extensively on these. Even if I've forgotten some of it due to a time-gap, I could catch up.

Python, Apache Storm, C++, STL, Boost, Target-tracking / State-estimation algorithms (Kalman filters, IMM, VSIMM), Processing (it's a language), MATLAB, D3.js, CSS, HTML, BASIC, ActionScript.


Working knowledge

Have worked on these just enough for it to be useful in completing a project and/or having worked on it as part of my self-development and learning

Java, PyQt, R, MySQL, Jongo, RabbitMQ, Spring Boot, JavaScript, C, VC++, PHP, ffMPEG, Git, NGINX, MediaPipe.

     

Learning-level knowledge

Have dabbled with these at work and/or as self-development, and don't have much knowledge on it.

Generative AI, Golang, MongoDB, Flask, Express.js, Django, Docker, Kubernetes, Spring framework, Shell Scripting, Jenkins/Hudson (continuous integration), Open GL, Leaflet.js, DirectX, TBB, MKL, JQuery, JSP, OpenMP, GDAL, Firebreath, SDL, Open Scene Graph, OGRE, Make/CMake, Ant, Gradle, Greasemonkey

Misc.

Windows, Linux, Mac, Interaction Design (UX and UI), Decision Analysis & Review, Agile software development, Clearcase, Enterprise Architect (EA), GIS, Rational Purify Plus, Struts2, Servlets, Visio, Valgrind, GDB, ActiveX controls, Cosmic FP Estimation, CMMI, Requirements Elicitation, Unit testing, Six hats thinking brainstorming, JQWidgets, Design patterns, Quantify, VTune, GIMP, PyMunk, Markdown, XML, JSON.

 -----------------------------------------------------------------------------------
 

My Research Papers

You'll find them on Google Scholar.


 -----------------------------------------------------------------------------------
 

Extra-curricular

Was well known for winning at competitions.



06 April 2014

Machine Graded Programming Tests

While doing my post-graduation in C-DAC this was the 6 month full time PGDST (Post Graduate Diploma in Software Technology) course at E-city we found that we'd pass the course only if we passed the minimum number of Machine Graded Programming Tests (MGPT's). These tests were similar to Google Code Jam, where you'd have to submit your program to a software program which will supply various inputs to your program and you pass the test only if each and every one of those inputs give the desired output.

It's a test that makes students very nervous, because let's say you're writing a program to accept a string and print whether it's a palindrome or not, some programmers won't consider the possibility that the program might receive an empty string as an input. The software which supplies such boundary conditions to your program, was called the "Parikshak" program, in C-DAC. We'd be given our questions and had 45 minutes to write our program on paper. Then, we could go to the lab where we had 45 minutes to type our program, correct it and keep feeding it into Parikshak. We used to wait in trepidation each time we submitted the program to Parikshak, and Parikshak would evaluate the program by supplying inputs to it and we'd see if the outputs were correct, by (if I remember correctly), "X" symbols for every correct output and "-" for every wrong output. If we got even a single "-", we got zero marks for the question, and had to correct our program and re-submit.

The challenge eased:
I decided to put this nervousness to rest by requesting the course coordinator to allow us to create our own questions for Parikshak, so that our classmates could attempt solving it and thereby be prepared for the real MGPT's. Nobody had ever attempted to do this in C-DAC, and our generous course coordinator was happy to allow us (two other programmer enthusiast classmates of mine, joined in) to volunteer. We called ourselves the "Mock MGPT team" (play rock music now for some effect). A few months later a third classmate joined the team. We became the B.RA.I.N.S team.
B - Binish
RA - RAghvendra
I - Ipe 
N - Navin
S - Shiv

So we set out on this new journey with the blessings of both our teachers and our classmates. For me, it was a creative journey too. These are some of the questions I created (just came across them today in an old email and thought I'd post it online):

Question 1:

PROBLEM STATEMENT:
A software error in a data entry software caused the string "MGPT" to get added to some institution names in a list of instutitions in Bangalore. When word got out, the principals of those institutions thought it a pretty good idea to introduce MGPT in their colleges. The students however, are worried, and have pleaded with you to remove MGPT from the list before the principals return from their tea break and take a final decision on the matter.

Your job is to write a program which will locate the "MGPT" string in the institution names and remove the string from the institution name.
If an institution name is CDAC (upper case, lower case or both), you are to leave the MGPT string in that institution name intact.
If the "MGPT" string occurs in any institution name, it will not occur more than once.
All institution names will begin with an alphabet.
Institution names may contain only alphabets, spaces and/or full stops.
The list of institution names not containing the MGPT strings have to be sorted alphabetically before being output.
The default priority for alphabetical sorting is: 1.Spaces, 2.Full stops, 3.Upper case letters 4.Lower case letters. (This is the same priority followed by the Java string handling functions)
The "MGPT" string may either consist of upper case or lower case letters.

INPUT:
The first input will be a number N, indicating the number of institution names that will follow.
N number of institution names will be provided, each on a new line.

OUTPUT:
The list of institution names, sorted alphabetically. Each on a new line.


SAMPLE INPUT:

7
Ammgptbc Institute of Technology
Z P College of EngineeringmGpt and Technology
Ghost ColMGptlege of Engineering
MGPTJanaloka Education Institute
JSM College of EngineeringmgpT
cmgPtDac
M. R. College of Engineering

SAMPLE OUTPUT:

Ambc Institute of Technology
Ghost College of Engineering
JSM College of Engineering
Janaloka Education Institute
M. R. College of Engineering
Z P College of Engineering and Technology
cmgPtDac


PROGRAM:
import ncst.pgdst.*;

class m
{

 public static void main(String[] args)throws IOException
 {
  SimpleInput s=new SimpleInput();
  int n=Integer.parseInt(s.readLine());
  String[] word=new String[n];//stores the original strings
  String[] big=new String[n];//strings converted to upper case
  String[] removed=new String[n];//strings with 'mgpt' removed
  for(int i=0;i  {
   word[i]=s.readLine();
   big[i]=word[i].toUpperCase();//convert it to upper case for ease of use
   removed[i]="";
  }//for

  for(int i=0;i  {
   int start=0,end=0;
   String w="";
   start=big[i].indexOf("MGPT");
   if (start>=0)//found the mgpt string
   {
    end=start+4;
    w=word[i].substring(0,start)+word[i].substring(end,word[i].length());
    String temp=w.toUpperCase();
    if (temp.compareTo("CDAC")==0) {w=word[i];}
   }//if
   else w=word[i];
   removed[i]=w;
  }//for

  //sort alphabetically
  for(int i=0;i  {
   for(int j=0;j   {
    if (removed[j].compareTo(removed[j+1])>0)
    {
     String temp=removed[j+1];
     removed[j+1]=removed[j];removed[j]=temp;
    }
   }//for
  }//for

  for(int i=0;i  {
   System.out.println(removed[i]);
  }
 }//main
}//class


-----------------------

Question 2 for Mock MGPT (classmates found this one very amusing)

When Tarzan came swinging to the CDAC campus, he heard of forests and trees being discussed in the classes. The CDAC'ians offered Tarzan three binary search trees to start swinging on, but Tarzan was afraid that if he tried to swing on a leaf node, he'd fall down.
A bunch of monkeys decided to help him with this. The monkeys would climb up onto the trees, according to their ages, in the same way that numbers are inserted into a binary search tree.
Any node which is not null is a node containing a monkey.

Tarzan doesn't like crash-landing on monkeys and he can't swing on the leaf of a tree, so he will swing only on VALID branches of the trees.
He differentiates between VALID branches and leaves (ie:leaf's) this way (this is a little different from conventional terminology)
A VALID branch is a node which is null and has a sibling node which contains a monkey.
A node is a leaf node if it is null and its sibling node is also null.

We will specify a swinging height for Tarzan (one swinging height will apply for all trees) so that he doesn't crash into the CDAC building. The swinging height is always greater than zero. Even if there is a single VALID branch at the specified height on a tree, Tarzan can swing on that tree.
Tarzan will be jumping from the CDAC building, onto the first tree, then to the second tree and then to the third tree, in that order. He doesn't jump after he reaches the third tree. Each time he jumps, he yells "OOOEEOOOYEEEOOOHH". If a tree doesn't have any VALID branches at the specified height, Tarzan falls down and yells "OOH AAH OUCH". Once he falls down, he doesn't attempt to jump onto any more trees.

You have to write a program to create three binary search trees and insert monkeys (age of the monkeys) into the trees. You should output the words that Tarzan yells when he attempts to jump onto the first tree, the second tree and the third tree. Assume the root node to be at a height of zero.


INPUT SPECIFICATION:
Three lines of numbers, each on a new line. The first number N of each line specifies that N numbers (these are the ages of the monkeys) are present after it on the same line. The first line of monkey ages are for insertion into the first binary tree, the second line for the second tree and so on.
One number on a new line, specifying the swinging height.

OUTPUT SPECIFICATION:
"OOOEEOOOYEEEOOOHH" (without quotes) if Tarzan can jump onto a tree with VALID nodes.
"OOH AAH OUCH" (without quotes) if he cannot land on a tree because it doesn't have VALID nodes at the specified height.

SAMPLE INPUT/OUTPUT:

Input1:
3 4 2 3
6 10 9 60 5 11 61
6 8 6 21 4 7 30
1

Output1:

OOOEEOOOYEEEOOOHH
OOH AAH OUCH

Input2:
3 4 2 3
6 10 9 60 5 11 61
6 8 6 21 4 7 30
2

Output2:
OOOEEOOOYEEEOOOHH
OOOEEOOOYEEEOOOHH
OOOEEOOOYEEEOOOHH

Input3:
4 4 2 3 5
6 10 9 60 5 11 61
6 8 6 21 4 7 30
1

Output3:
OOH AAH OUCH


PROGRAM:

import ncst.pgdst.*;

class t
{
 public static void main(String[] args)throws IOException
 {
  SimpleInput s=new SimpleInput();

  Node r1=new Node();
  int t=Integer.parseInt(s.readWord());
  for(int i=0;i
  Node r2=new Node();
  t=Integer.parseInt(s.readWord());
  for(int i=0;i
  Node r3=new Node();
  t=Integer.parseInt(s.readWord());
  for(int i=0;i
  int sHeight=Integer.parseInt(s.readWord());
  boolean fell=false;
      //check if first tree has VALID nodes
  if (r1.search(sHeight))
     System.out.println("OOOEEOOOYEEEOOOHH");
  else {System.out.println("OOH AAH OUCH");fell=true;}

  if (!fell)
     {//check if second tree has VALID nodes
      if (r2.search(sHeight))
         System.out.println("OOOEEOOOYEEEOOOHH");
      else {System.out.println("OOH AAH OUCH");fell=true;}
     }
  if (!fell)
     {//check if third tree has VALID nodes
      if (r3.search(sHeight))
         System.out.println("OOOEEOOOYEEEOOOHH");
      else {System.out.println("OOH AAH OUCH");fell=true;}
     }
 }//main
}//class

class Node
{
 Node left,right;
 int value;
 int height;

 Node() {left=null;right=null;value=0;height=0;}
 Node(int v, int h) {left=null;right=null;value=v;height=h;}

 public boolean search(int searchHeight)
 {
  boolean b=false,bv=false;
  if (height==searchHeight-1)
  {
   if ((right!=null && left==null) || (right==null && left!=null)) bv=true;
  }
  else
  {
   if (right!=null) {b=right.search(searchHeight);if (b) bv=true;}
   if (left!=null) {b=left.search(searchHeight);if (b) bv=true;}
  }
  return bv;
 }//search

 public void insert(int v)
 {
  if (value==0) value=v;
  else
  {
   if (v>value)
      {
       if (right==null) {Node n=new Node(v,height+1);right=n;} else right.insert(v);
      }
   else
      {
       if (left==null) {Node n=new Node(v,height+1);left=n;} else left.insert(v);
      }
  }//else
 }//insert

}//Node


--------------------

Question 3:

Students complained that bugs, which accidentally entered the Brinjal curry in the canteen food which they ate, were turning up as bugs in their software programs, which highly inconvenienced them while writing bug-free code during MGPT's.
Following these complaints, the canteen decided to install a device, capable of detecting and driving out bugs from the food with a K.N machine that emits special, patented Keeda-Naashak rays.

The food on a plate consists of many layers of food. Each layer is uniform in constitution, and is represented here with 5 characters. The character representation meaning is given below:
'P' is for a layer of Paapad. 'C' is for a layer of curry. 'R' is for a layer of rice.
'K' is a bug that can be present in any layer of food.
When a bug is present in a layer of food, the layer of food is represented with 4 food characters and one bug character.

The K.N machine emits rays laterally into a plate of food for 2 seconds. This irritates the bug, which immediately crawls up the layers of food and flies away when it reaches the surface.
The bug takes one second to crawl through a layer of food. The exception to this rule is that the bug takes 2 seconds to crawl through the curry layer.
If in the beginning the bug is in a layer of curry or once the bug passes through a layer of curry while crawling up, the bug always takes 2 seconds to crawl through ANY layer of food. Curry layers are not additive. ie: if a bug passes through two layers of curry, it won't take 2+(2+2) seconds to cross the layer. The time taken to cross the two layers of curry will be 2+2=4 seconds.

At the end of the 2 seconds for which the machine scans the food, if the bug is still in the food, the machine displays "KEEDA ALERT" (without quotes) on its screen. If there is no bug or if the bug has managed to reach the surface within the two seconds, the machine displays "CLEAN" (without quotes) on its screen.
You have to write a program to find out if at the end of the 2 seconds of scanning, would the food be bug-free or not. Your output will be the same as what is displayed on the screen of the K.N machine.

Assumptions:
1. The bug always crawls upward perpendicularly.
2. Assume that the number of layers of food will always be: number of layers >= 3 and number of layers <= 5
3. All inputs will be in upper-case characters
4. Assume that there can be only one or no bugs in a plate of food

INPUT:

One integer M, representing the number of plates to be scanned
M number of plate inputs will follow.
A plate input consists of:
One integer N on a new line, representing the number of layers of food in a plate.

N layers of food will follow, each on a new line.

OUTPUT:
"KEEDA ALERT" (without quotes) is displayed for a plate if it has a bug at the end of the two second scan.
"CLEAN" (without quotes) is displayed for a plate if it has no bug in it at the end of the two second scan.


SAMPLE INPUT:
5
4
PPPPP
PPPPP
CCCKC
RRRRR
3
PPPPP
CCCCC
KRRRR
3
PPPPP
RRRRR
KRRRR
5
PPPPP
PPPPP
RRRRR
RRRRK
CCCCC
3
CCCCC
PPPPP
RRRRR

SAMPLE OUTPUT:
KEEDA ALERT
KEEDA ALERT
CLEAN
KEEDA ALERT
CLEAN


CODE:
import ncst.pgdst.*;
class keeda
{
 public static void main(String[] args)throws IOException
 {
  SimpleInput s=new SimpleInput();
  int plates=Integer.parseInt(s.readWord());
  for(int j=0;j<plates;j++)
  {
   int n=Integer.parseInt(s.readWord()),foundInLayer=999;
   boolean alert=false,curry=false;
   for(int i=0;i<n;i++)
   {
    String layer=s.readWord();
    if (layer.indexOf("K")!=-1 && i>1) {foundInLayer=i;alert=true;}
    if (i<3 && layer.indexOf("C")!=-1) curry=true;
    if (foundInLayer==2) alert=curry;
   }//for i
   if (alert) System.out.println("KEEDA ALERT"); else System.out.println("CLEAN");
  }//for j
 }//main
}//class


And these were some of the questions my classmates created:
 
Problem 1:
 
Print the Fibonacci series which is prime number.
Fibonacci-series: A sequence of numbers in which each number equals the sum of the two preceding numbers.
For example: 2 3 5 8 13 21 34 55
Prime Numbers: A number which is divided only by 1 or itself.
(Note: 2 is a prime number).
For example: 3,5,13 etc.
You have to generate Fibonacci series and choose prime number among them and print it.

Input specification:
The first line of input will be two integers, a and b, separated by a space, specifying the first numbers in Fibonacci series.
The second line is also an integer, specifying the number of elements to be generated to check prime numbers.

Output specification:
The output contains only one line, containing each elements in Fibonacci series which should be prime number having single space between them.

Sample Input/Output:

Input:
2 3
5
Output:
2 3 5 13
 
 
 
Problem 2: LUCKY-5-PRIME

The objective of the program is to count the number of lucky-5-prime numbers occurring within a given range of integers. Lucky-5-prime numbers are those prime numbers the sum of whose digits add up to integer value 5. If the sum of digits of a number generates a two digit number add it's digits again to generate a single integer value.
For eg, 345=3+4+5=12
12=1+2=3

INPUT SPECIFICATION:
Input line contains two integers M and N which is the range of numbers
OUTPUT SPECIFICATION:
If number is found print LUCKY followed by the number of lucky 5 prime numbers after a space, terminated by a newline
If number is not found in the given range print NO LUCK terminated by a newline

Sample Input/Output:

Input
1 50
Output
LUCKY 3
 
 
Problem 3: Maximal Subsequence Problem:
Consider a series of numbers:
Eg: -2, 11, -4, 13,-5,-2
What is its maximal subsequence, i.e., a contiguous part of this series whose sum is maximum of all such subsequence?
Total sum is: 11
Subsequence <11,-4,13>= 20.(Maximum).
You have to write a program to find the maximal subsequence and print it with starting and last address. Assume position start with 1 and if there is more than one duplicate maximum then should be preferred first set of numbers.

Input specification:
The input will be single line containing an integer N, followed by N integers.
Output specification:
Only 3 values separated by single space
1st is maximum value.
2nd is position of first value.
3rd is position of second value.

Sample Input/Output:

Input:
8 -2 -3 45 25 -90 50 20 -1 -2
Output:
70 3 4

Input:
8 23 34 -90 34 5 6 7 98
Output:
150 4 8


Problem 4:
Create a stack consisting of the following elements : {32,29,24,20,12}. Observe that the stack created is arranged in
descending order from bottom to "top"(Top is the
upper bound of the stack from where insertions and deletions take place.) Given an ITEM to be pushed, insert into the
stack without disturbing the order of elements,
i.e stack should be in descending order even after insertion of ITEM and also without disturbing the property of stack.
Input Specification:
One line of input consisting of an integer value ITEM, which is to be pushed into existing stack.
Output specification:
Print the steps involved in pushing the new item into the stack i.e to push an item print PUSH <item> and for popping out
an item print POP <item>.
The popped item is reinserted into the stack according to it's value. Terminate each step with a newline.

For eg.
Input
22
Output
POP 12
POP 20
PUSH 22
PUSH 20
PUSH 12

Input
24
Output
POP 12
POP 20
PUSH 24
PUSH 20
PUSH 12


Problem 5
Consider a fees payment counter. Students waiting for service form a queue. At the start, the queue is empty and time is zero. The service per student is 5 minute. The input to the program consists of an integer N followed by a sequence of integer and float values indicating the arrival time (in
minutes) and amount paid respectively by the student. The times are given as offset from the start of simulation. So that an input 50 means 50 minutes
from the start of the simulation.If value of N is equal to the value of the arrival time of the student you have to consider that the student had paid his
amount.

The sequence of input numbers is terminated by number-1.
A program must simulate the queue and print the following.
1. The number of students processed until N minutes from the start of the
simulation.
2. The total amount of fees submitted from the students at time=N minutes.

In the output, each value must be separated by a space. Terminate your output with a newline character. For doing the computation, you can assume that
if the counter is expected to be vacant at time T, the first student in the queue will be scheduled for service before counting is done for time T.

Assumptions:-

1.The given arrival times will be already in sorted order.
2.The no of students will always be less than 200.
3.The input will terminated by -1.

Input:-
17 3 200.0 7 110.0 8 6.3 8 20.9 10 300.0 -1

output:-
3 316.3

Few interested classmates regularly attempted the mock MGPT's. Some of them were the only ones to crack the real MGPT's too. The sessions were helpful in taking a bit of the tension away from our minds. If I may humbly mention, I was the first one in my class to crack the real MGPT's and eventually was the only one to pass my PGDST course in the first attempt, because I was the only one in a class of 38 (comprising of CS engineers and MCA grads), to clear the necessary number of MGPT's.

The FPGDST (one year course) students had it easy. Their MGPT's were extremely simple. We PGDST (half year course) students had it very tough. Clearing it was not only a challenge, it was satisfying to have given my best shot at something and winning!

05 April 2014

Conference: Open source for startups

My first self-motivated decision to be a part of the larger software community by attending a software conference today at IIM-B:

It was an interesting conference with a panel discussion : Doing Business With Open Source


Panel members
• Prof. Rahul De – Hewlett-Packard Chair Professor @ IIMB (Moderator)
• Ms. Mishi Choudhary, Legal Director @ New York based Software Freedom Law Center
• Mr. Charudath Doddanakatte, Co-Founder & CTO of MyCloudPortal
• Mr. Abinash Saikia,   Co-Founder, EnCloudEn
• Mr. Abhas Abhinav, Founder & CEO of DeepRoot Linux
• Mr. Rohan Joshi, Founder, WokenSoft

 An intro by prof.De and Ms.Mischi touched upon how the non-proprietary FOSS final product has no price signalling capability in the market (price being an indicator of quality) and how it affects the adoption rates of FOSS. About how to face competition in the market while using FOSS, especially since seeing it as a reusable repository of code isn't reliable because of the general lack of documentation and the high rate of disruption that the IT industry is bringing (books, and the old music industry disappearing at a high rate being one example).

The talk randomly encompassed points like
  • Warranties of performance of FOSS
  • What if the code that you're borrowing goes under
  • When to upstream code to contribute back to the community
  • Which license is best for reuse

Contributing to Open Source
Both Prof. De and the other panelists spoke of how the community benefits and improves, when we give back to it. Many people download free softwares, but rarely contribute back to it. The practice of contributing back has to be encouraged.

Is GPL bad?
Some panelists referred to the GPL with adjectives like 'plague', 'viral' and a 'cancer'. Indicating how whatever the GPL touches, becomes GPL too. Indeed, people seem to take a dislike to being forced to expose their code as open source :-) During the question-answer session that followed, I tried giving it a different perspective, that the GPL was more like the Midas touch, where whatever it touches becomes gold. Free software really could be considered the equivalent of gold. It's the hard-work of a lot of people, intellectual contribution and time that's being put into it.

Malicious code in free software
Ms. Mishi (she gives free legal service to Debian, OpenSSL etc.) tried encouraging people to make their softwares GPL, as you're giving back to the community, saying that you'd be able to use even the competitors code. Mr.Abhas adding to that, saying then, the competition will no longer be about the code, but about the services provided. I asked the panel about the issue of trust in such a scenario, where malicious code could also be part of open source software and there's no real way to verify it even if you have the code with you. Mr. Abhas rightly said it would depend on the reputation of the source of software, and on asking the lawyer among the panelists, Ms.Mishi replied, saying that what a lawyer would ask you in such a situation is, "you got something for free and you got screwed?", well there's nothing you can legally do in such a situation; but apparently banks like Goldman Sachs also use open source software.

Did you know that software which does not having any licensing is implicitly protected by the copyright law? One example being Qmail.

Helping hands
So how do people who write free software make money? Something I was surprised to learn, was that the people at the Apache software foundation made their money via day jobs and by teaching people about the free softwares they created. Apparently, groups like the Open Invention Network and the Software Freedom Law Center etc. provide a helping hand to entrepreneurs for legal issues that arise while using FOSS. They help with knowing which legal notices to ignore and which to escalate, especially because for a startup, it's necessary for them to focus on the product in order to grow and survive in the market, rather than spend time fighting legal battles. We were also introduced to a term called "defensive suspension". The free software people are just as savvy about intellectual property rights as companies creating proprietary software. They have lawyers (paid) to help them. The GPL violation foundation and the Software Freedom Conservancy also come to the help of entrepreneurs.

Patenting software
Long back when a senior person I know was encouraging people to apply for patents. I had done some of my own research to end up find out that India doesn't allow software patents. The same was mentioned in the conference. One person in the audience deferred by saying that patents are allowed for embedded software, to which Ms.Mishi replied that only an embedded device can be patented; the software itself won't be. *sigh* wish India would encourage patenting too. At least the Kerala government had taken a good step forward in wanting to be a nodal agency for FOSS.

Misc
The conference was also a nice way of networking with some interesting people who introduced me to sysplay, the computer club, linux trainings, sogo and deeprootlinux. There was also a cryptography wiz enthusiastically taking pics of everyone, for 'documentary evidence' as he called it. Weird.

I'd encourage more people to participate in such conferences and discussions (more than 200 people had been part of this conference). It's a very good way to expand your knowledge and meet enthusiastic people in the field.


Say thank you or donate

25 March 2014

Being comfortable while seated at your workstation

I've seen many people carrying the strict discipline they learnt in school to office too. In an environment where they have to be seated for hours at an end, they try their best to not complain and adjust. Many end up seriously damaging their health. A friend's sister ended up requiring spinal surgery because she tried her best to sit straight and stiff while working; ignoring her back pain all the while.

Some chairs are designed for people with long thighs. People with short thighs won't be able to adjust to it (and vice versa). Good news is, chairs can be adjusted. But I rarely see people doing it. I did.


Got the armrests removed and the back of the chair tightened and phew! It was such a relief to be able to sit comfortably!

More on adjustments: http://www.ccohs.ca/oshanswers/ergonomics/office/chair_adjusting.html