Monday, October 29, 2007

Here is the solution to question no 1 of MGPT 2007....

MGPT 2007 question no 1 :

smaller code (75 lines):
This code I developed after the MGPT............
I subitted the second question in MGPT....
There is another post containing that code......

import ncst.pgdst.*;
class Router{
String rule[][]=new String[20][7];
int row;
static SimpleInput in=new SimpleInput();
void input()throws IOException{
row=in.readInt();
for(int i=0;i rule[i][0]=in.readWord();
for(int j=1;j<6;j++)
rule[i][j]=in.readWord();
if( ! rule[i][0].equals("FORWARD"))
rule[i][6]="XXXXXXXXXXXXXXXXXXXXXXX";
else
rule[i][6]=in.readWord()+" "+in.readWord();
}
sort();
}
void sort(){
int index=-1;
String rule1[][]=new String[20][7];
for(int i=0;i if(rule[i][0].equals("REJECT"))
rule1[++index]=rule[i];
for(int i=0;i if(rule[i][0].equals("ACCEPT"))
rule1[++index]=rule[i];
for(int i=0;i if(rule[i][0].equals("FORWARD"))
rule1[++index]=rule[i];
rule=rule1;
}
String respond(String ip){
int octet[]=new int[6];
int index=ip.indexOf(".");
octet[0]=Integer.parseInt(ip.substring(0,ip.indexOf(".")));
ip=ip.substring(index+1);
octet[1]=Integer.parseInt(ip.substring(0,ip.indexOf(".")));
ip=ip.substring(index+1);
octet[2]=Integer.parseInt(ip.substring(0,ip.indexOf(".")));
ip=ip.substring(index+1);
octet[3]=Integer.parseInt(ip.substring(0,ip.indexOf(" ")));
octet[4]=Integer.parseInt(ip.substring(ip.indexOf(" ")+1));
int pos=-1;
boolean acpt,reje,fwd;
for(int i=0;i boolean go[]=new boolean[5];
for(int j=0;j<5;j++)
if(rule[i][j+1].equals("*"))
go[j]=true;
else if(rule[i][j+1].indexOf("-") != -1){
int f=Integer.parseInt(rule[i][j+1].substring(0,rule[i][j+1].indexOf("-")));
int s=Integer.parseInt(rule[i][j+1].substring(rule[i][j+1].indexOf("-")+1));
if(octet[j]>=f && octet[j]<=s)
go[j]=true;
}else if(octet[j]==Integer.parseInt(rule[i][j+1]))
go[j]=true;
if(go[0]==true && go[1]==true && go[2]==true && go[3]==true && go[4]==true){
if(rule[i][0].equals("REJECT")) return "REJECT";
else if(rule[i][0].equals("ACCEPT")) return "ACCEPT";
else if(rule[i][0].equals("FORWARD")) return rule[i][6];
}
}
return "REJECT";
}
public static void main(String[]args)throws IOException{
Router router=new Router();
router.input();
int n=in.readInt();
for(int i=0;i String ip=in.readWord()+" "+in.readWord();
System.out.println(router.respond(ip));
}
}
}



If you are unable to see the program in a proper format, please click this link
http://chandra-shekhar.spaces.live.com/default.aspx

Sunday, October 28, 2007

This is another solution to MGPT 2007 question no 1.....

MGPT 2007 question no 1 ...
This is the first version that I made (232 lines)

import ncst.pgdst.*;
class IP{
int octet[],port;
IP(){
octet=new int[4];
}
void input(SimpleInput in)throws IOException{
String str=in.readWord();
int kk=-1;
do{
int k=str.indexOf(".");
if(k==-1){
octet[++kk]=Integer.parseInt(str);
break;
}
octet[++kk]=Integer.parseInt(str.substring(0,k));
str=str.substring(k+1);
}while(str.length() != 0);
port=Integer.parseInt(in.readWord());
}
public String print(){
String str="";
for(int i=0;i<4;i++){
str += octet[i] + ".";
}
str += " "+port;
return str;
}
}
class IPRange{
String octetRange[],portRange;
IPRange(){
octetRange=new String[4];
}
void input(SimpleInput in)throws IOException{
for(int i=0;i octetRange[i]=in.readWord();
}
portRange=in.readWord();
}
}
class Rule{
IPRange ipRange;
Rule(){
ipRange=new IPRange();
}
void input(SimpleInput in)throws IOException{
ipRange.input(in);
}
}
class RejectRule extends Rule{
}
class AcceptRule extends Rule{
}
class ForwardRule extends Rule{
IP forwardTo;
void input(SimpleInput in)throws IOException{
super.input(in);
forwardTo=new IP();
forwardTo.input(in);
}
}
class Router{
RejectRule[] rejectRule;
AcceptRule[] acceptRule;
ForwardRule[] forwardRule;
int rejectRuleCount,acceptRuleCount,forwardRuleCount;
Router(){
rejectRule=new RejectRule[10];
rejectRuleCount=-1;
acceptRule=new AcceptRule[10];
acceptRuleCount=-1;
forwardRule=new ForwardRule[10];
forwardRuleCount=-1;
}
void inputRules(SimpleInput in)throws IOException{
int n=Integer.parseInt(in.readWord());
for(int i=0;i String cmd=in.readWord();
if(cmd.equals("REJECT")){
rejectRule[++rejectRuleCount]=new RejectRule();
rejectRule[rejectRuleCount].input(in);
}else if(cmd.equals("ACCEPT")){
acceptRule[++acceptRuleCount]=new AcceptRule();
acceptRule[acceptRuleCount].input(in);
}else if(cmd.equals("FORWARD")){
forwardRule[++forwardRuleCount]=new ForwardRule();
forwardRule[forwardRuleCount].input(in);
}
}
}
void perform(SimpleInput in)throws IOException{
int n=Integer.parseInt(in.readWord());
for(int i=0;i String ipStr=in.readWord();
IP ip=new IP();
int k=-1,kk=-1;
do{
k=ipStr.indexOf(".");
if(k==-1){
ip.octet[++kk]=Integer.parseInt(ipStr);
break;
}
ip.octet[++kk]=Integer.parseInt(ipStr.substring(0,k));
ipStr=ipStr.substring(k+1);
}while(ipStr.length() != 0);
ip.port=Integer.parseInt(in.readWord());

System.out.println(respond(ip));
}
}
String respond(IP ip){
for(int i=0;i<=rejectRuleCount;i++){
boolean go[]={false,false,false,false,false,true};
for(int j=0;j<4;j++){
String octetRange=rejectRule[i].ipRange.octetRange[j];
if(octetRange.equals("*")){
go[j]=true;
}else if(octetRange.indexOf("-")==-1){
if(Integer.parseInt(octetRange)==ip.octet[j])
go[j]=true;
}else{
int first=Integer.parseInt(octetRange.substring(0,octetRange.indexOf("-")));
int second=Integer.parseInt(octetRange.substring(octetRange.indexOf("-")+1));
if(ip.octet[j]>=first && ip.octet[j]<=second)
go[j]=true;
}
}
String portRange=rejectRule[i].ipRange.portRange;
if(portRange.equals("*")){
go[4]=true;
}else if(portRange.indexOf("-")==-1){
if(Integer.parseInt(portRange)==ip.port)
go[4]=true;
}else{
int first=Integer.parseInt(portRange.substring(0,portRange.indexOf("-")));
int second=Integer.parseInt(portRange.substring(portRange.indexOf("-")+1));
if(ip.port>=first && ip.port<=second)
go[4]=true;
}
for(int j=0;j<5;j++){
if(go[j]==false)
go[5]=false;
}
if(go[5])
return "REJECT";
}



for(int i=0;i<=acceptRuleCount;i++){
boolean go[]={false,false,false,false,false,true};
for(int j=0;j<4;j++){
String octetRange=acceptRule[i].ipRange.octetRange[j];
if(octetRange.equals("*")){
go[j]=true;
}else if(octetRange.indexOf("-")==-1){
if(Integer.parseInt(octetRange)==ip.octet[j])
go[j]=true;
}else{
int first=Integer.parseInt(octetRange.substring(0,octetRange.indexOf("-")));
int second=Integer.parseInt(octetRange.substring(octetRange.indexOf("-")+1));
if(ip.octet[j]>=first && ip.octet[j]<=second)
go[j]=true;
}
}
String portRange=acceptRule[i].ipRange.portRange;
if(portRange.equals("*")){
go[4]=true;
}else if(portRange.indexOf("-")==-1){
if(Integer.parseInt(portRange)==ip.port)
go[4]=true;
}else{
int first=Integer.parseInt(portRange.substring(0,portRange.indexOf("-")));
int second=Integer.parseInt(portRange.substring(portRange.indexOf("-")+1));
if(ip.port>=first && ip.port<=second)
go[4]=true;
}
for(int j=0;j<5;j++){
if(go[j]==false)
go[5]=false;
}
if(go[5])
return "ACCEPT";
}


for(int i=0;i<=forwardRuleCount;i++){
boolean go[]={false,false,false,false,false,true};
for(int j=0;j<4;j++){
String octetRange=forwardRule[i].ipRange.octetRange[j];
if(octetRange.equals("*")){
go[j]=true;
}else if(octetRange.indexOf("-")==-1){
if(Integer.parseInt(octetRange)==ip.octet[j])
go[j]=true;
}else{
int first=Integer.parseInt(octetRange.substring(0,octetRange.indexOf("-")));
int second=Integer.parseInt(octetRange.substring(octetRange.indexOf("-")+1));
if(ip.octet[j]>=first && ip.octet[j]<=second)
go[j]=true;
}
}
String portRange=forwardRule[i].ipRange.portRange;
if(portRange.equals("*")){
go[4]=true;
}else if(portRange.indexOf("-")==-1){
if(Integer.parseInt(portRange)==ip.port)
go[4]=true;
}else{
int first=Integer.parseInt(portRange.substring(0,portRange.indexOf("-")));
int second=Integer.parseInt(portRange.substring(portRange.indexOf("-")+1));
if(ip.port>=first && ip.port<=second)
go[4]=true;
}
for(int j=0;j<5;j++){
if(go[j]==false)
go[5]=false;
}
if(go[5])
return forwardRule[i].forwardTo.print();
}

return "REJECT";
}
public static void main(String[]args)throws IOException{
SimpleInput in=new SimpleInput();
Router router=new Router();
router.inputRules(in);
router.perform(in);
}
}

If you are unable to see the program in a proper format, please click this link
http://chandra-shekhar.spaces.live.com/default.aspx

Wednesday, October 24, 2007

Solution to MGPT 2007 question no 2.....

This is the solution to MGPT 2007 question no 2.... (85 lines)
I could clear only this question in the MGPT....
The rest I did after the MGPT...


import ncst.pgdst.*;
class Vertex{
char data;
int edgeCount;
Vertex[]edge;
boolean visited;
Vertex(char n){
data=n;
edge=new Vertex[50];
edgeCount=-1;
visited=false;
}
}
class Graph{
Vertex[]vertex;
int vertexCount;
int hops=0;
int min=999999;
Graph(){
vertex=new Vertex[50];
vertexCount=-1;
}
void addVertex(char n){
vertex[++vertexCount]=new Vertex(n);
}
void addEdge(char v1,char v2){
int posv1=findIndex(v1);
int posv2=findIndex(v2);
if(posv1==-1 posv2==-1) return;
int p=++(vertex[posv1].edgeCount);
vertex[posv1].edge[p]=vertex[posv2];
}
int findIndex(char v){
for(int i=0;i<=vertexCount;i++)
if(vertex[i].data==v) return i;
return -1;
}
void dfs(char v1,char v2){
int p1=findIndex(v1);
Stack stack=new Stack();
stack.push(vertex[p1].data);
while(!stack.isEmpty()){
boolean found=false;
int n=findIndex(stack.peek());
for(int i=0;i<=vertex[n].edgeCount;i++){
if(vertex[n].edge[i].visited==true) continue;
stack.push(vertex[n].edge[i].data);
vertex[n].edge[i].visited=true;
++hops;
found=true;
if(vertex[n].edge[i].data==v2){
if(hops//{
//System.out.println("hops = "+hops);
min=hops;
//}
}
break;
}
if(!found){
unvisitChildren(stack.peek());
stack.pop();
--hops;
}
}
if(min==999999)
System.out.println("UNREACHABLE");
else
System.out.println(min);
}
public static void main(String[]args)throws IOException{
SimpleInput in=new SimpleInput();
Graph g=new Graph();
in.skipWhite();
int n=in.readInt();
for(int i=0;iin.skipWhite();
char v1=in.readChar();
in.skipWhite();
char v2=in.readChar();
if(g.findIndex(v1)==-1) g.addVertex(v1);
if(g.findIndex(v2)==-1) g.addVertex(v2);
g.addEdge(v1,v2);
}
in.skipWhite();
char v1=in.readChar();
in.skipWhite();
char v2=in.readChar();
g.dfs(v1,v2);
}
void unvisitChildren(char n){
int p=findIndex(n);
for(int i=0;i<=vertex[p].edgeCount;i++)
vertex[p].edge[i].visited=false;
}
}
class Stack{
char[]a=new char[100];
int top=-1;
void push(char n){ a[++top]=n; }
char peek() { return a[top]; }
void pop() { --top; }
boolean isEmpty(){ return top==-1; }
}


If you are unable to see the program in a proper format, please click this link
http://chandra-shekhar.spaces.live.com/default.aspx

Monday, October 22, 2007

The First MGPT was a blessing in disguise for me..........

Oh, it's true...... I had no idea of clearing the first MGPT at all....... I was no preparation... in fact... I had solved not a single question out of the previous year's MGPT papers.... neither did I have any idea of the kind of questions that might come.......

O' ...... ! Please don't take it other wise. I didn't do that deliberately.. The situations that came up one by one; left me with no options....... You might know.. at first there was a big - big issue out of nothing...... simply a silly complaint against me killed more than two complete days and nights from my routine....... And even after that I remained so affected that I virtually lost interest in doing any study at all......

Still, I coaxed myself and tried to devote myself to studies...... I was still not over with the implementation 'graph' .... I was still very much unconfident on this chapter..... hence, instead of solving the previous year's MGPT questions, I simply relied on enhancing my understanding of the implementation of graphs....... and dropped the hope of clearing the first MGPT at all.... Might be I could work next time for the second MGPT.....

I was frustrated and was having mild headache for several days. I tried to relax myself by watching a movie 'Johny Gaddar', and glimpses of several others. It was very surprising for myself to spend time like that because I had been preparing before every MGPA. I was worried on my inside as to how could I face others by not clearing the MGPT....... But nothing could have been done now.......

The next morning...... as usual I woke up by quarter past nine...... I went for a fresh-up and could manage to get to the test-hall by the right time.....

I was not hoping any good.... I got the paper.... it had two questions.... as was already known to all...... the first question was so long..... to read; it was three pages long.... it took me more than half an hour to read and understand the question itself.........

It was to design an algorithm for a router which has three activities in the listed order:
1) REJECT
2) ACCEPT
3) FORWARD

The question required me to accept IP-ranges for each of these and predict the router action for more inputted IP addresses. The ranges could be defined as each of the octets of each input IP having one of the following forms:
1) integer i.e; single fixed octet
2) start-end i.e; fixed octet range from start to end octets both inclusive
3) * i.e; any possible octet

I knew it could have taken much more time than available..... I decided to have a look on the second question.... it was less than a page long......
It required me to find length of the shortest possible path between given start and end vertices of a given graph......

I felt I could possibly deal with this question in the prescribed time limit i.e; 90 minutes..... I still wished that I could solve the first one also.... but I decided to try that if I could have some time left after being over with the second on........... By the time 90 minutes were over I found that could only develop code for the second question and review it several times...... I felt better for having at least done some work at all...... I was still not sure whether it would have worked in the PARIKSHAK environment.....
We were then asked to go to the lab..... I started typing my code and it took more than half an hour...... I compiled the program and submitted.... still fearing about the X's..... and lo..... the very first result came up as an X............ my heart sank back....but then there appeared a Y to my delight.... Now I was sure that my logic was correct.... and the program was working fine..... there must had been some very small error..... I inserted commands in the program to display the hop-count each time..... and this time a created the input file.... Now the program was printing the hops exactly as expected..... but the minimum path length was being printed as -1..... Then it striked in my mind that instead of printing the minimum path length I was actually printing the hop length. I corrected it, removed the assertions..... and submitted............

Then came the first Y......., I murmured.... what's the next... it was another Y...... then the third Y...... it was so heart-throbbing...... then the fourth Y...... now I was sure the fifth must be Y..... and yes...... it was a Y again..... Wow...............!It was so exciting a moment..... as if I had won the World Cup..... I can't explain that experience...... It was simply exhilarating....

I called upon Anubhav Sir.... and submitted my work.... Sir asked me to try the other question also.... I did..... but it took long..... and before I could start typing in my code, the time was already over.....

Well........, that was the MGPT experience.....

In all.... there were six successes this time....... three from the current batch.... and three form previous batches.....

Tuesday, October 16, 2007

End of the First term.....

The first term here in NCST is now reaching its end. We all the students of FPGDST course have had sweet and bitter experiences throught this term. Let's take a recount of some of them... as observed by me.....

In the beginning...., it was a very nice experience being at this place..... The content of study was not harassing at all..... it was all the very basics and very easy - going..... In fact, I felt it uncomfortable spending my time on easy topics like them.......

That was truely called 'our honeymoon period'.............. It was simply relax...... relax..... and relax....... But yet, there were others who found those topics difficult because they were new to them.... and they had rarely studied them.......

Till the 9th MGPA all was so... so... but then it seems there was a storm....... so many new topics...... heavy topics....... rapidly dumped on us...... Nobody, in fact, has been able to handle that pressure efficiently.......... The schedules now seemingly went more tight than ever... and all the three modules started dancing above our heads like ghosts.......

It was simply a nightmare....... By luck we could have a comfortable teacher in MFCS... but that too we didn't have many classes........

Now......, tomorrow there's going to be the first MGPT...... let's hope for the better.... but.... truely speaking...... I'm not having a good preparation for the MGPT and I'm not at all ready for it....

Yet..... let's see....

Why do I lack on the part of confidence.....?

There's going to be the 5th and the last MFCS test tomorrow morning... and I know most of the stuff I should to clear the test.... But still, I don't know why..... I've been fearing the test like anything... might be because this was the only subject that brushed me for 2 years during the time when I was doing BCA from IGNOU..... or might be because of something I do not really know about.....

And see the contrast.... I've been performing so well in the class of Theory of Computation (TOC).............. I think I'm Jiji ma'm's favourite..... (Jiji Ma'm is our TOC faculty). I think I must improve myself on the part of confidence......

I had, in fact, an exhaustive talk with Jiji Ma'm .... and she was so surprised over me talking like that...... She said that I was one among a few students in the class that she expected could clear the test..... apart from the fact that she has been asked to set a tough paper for the test by Balaji Sir..... I was greatly comforted by her saying these words...... She is no less than an ANGEL to me...........

Truely..........., she makes upto her name - 'JIJI ANGEL'. If ever I were asked as to who is the best teacher in the world................ I would surely name her............... because nobody can be like her...... she is simply much more than what one could expect at all....

Could you imagine...... talking with her for 10 minutes or so...... how changed I felt myself...... all the fear in me is gone .......

I wish she be there with me always ........ good souls are so rare..... I can hardly afford to lose her presence................

Saturday, October 13, 2007

A terrible experience.........

One day, I had been to a nearby mall named 'Total' for shopping. I required to buy a pair of slippers or sandals for casual use; among several other items to buy. Unluckily, I could not find satisfactory ons and then I decided to look for them in another nearby mall named 'Vishal Megamart'. Since, it is not very far away, I decided to walk through the distance. I was casually moving on when I noticed something very painful........... There was a little girl whipping herself on and on and begging for coins from the passersby....... It was such a pity..... I really felt like doing everything I could do for the poor guy... and the very next sight instigated more of it inside me.............. I noticed her parents sitting some distance away and directing her to catch the profitable passersby..... And they were, not at least, in their rugs....... they were averagely dressed and had average health......and I could not doubt them being her parents.............because of the affection which was evidently visible between them and the poor child....... Then how could a couple let their child beat up herself and beg like that............. Well........, what comes to scene is 'boundness' or say 'helplessness'............ One could say that jthe parent could earn themselves and feed their family.... it's easy to say.........but what if you don't get a job......the meanest job even.....after much hard search............ After all, you need to get the mouths fed.............. I could clearly see that the parents were not selfish, but they had no other choice....they were a prey to 'UNEMPLOYMENT'...............one of the most burning problems all over the world....... There's nothing more unbearable than the fire of hunger.... So please, if you are someone who can eleviate this problem to even a trace percentage, then go do it.... Please kindle lights of hope in as many minds as you can......... Come..........., let's together kill the daemon of 'UNEMPLOYMENT'...............!!!!

Monday, October 8, 2007

The report until now........

It's sunday night and now I've developed the programs (on paper) for Graph including functions for adding a vertex, adding an edge, performing a breadth-first-traversal (bfs) and performing a depth-first-traversal (dfs). Initially, the program could make up for unwieghted directed graphs only, but now I've introduced another array to synchronously contain the weights of the edges..... and it should work fine as far as I can see till now........ I think a little addition will equip my code to deal with the undirected graphs also..... or might the already there code might be sufficient....... I still need to check and might be to modify it....... One thing really interesting happened........ Ravi and Subhash fortunately happened to visit my room and have a very exhaustive discussion over the working and correctness and also on what all could be added possibly to the code to enhance it....... I explained the internals and the working algorithm of my code to them and it was really enjoying....... I think this is the best method we all could apply to carry our code-development activity at a rapid pace........ because you know nobody in this place in willing to help in any way..... and each student is expected to develop such complex logics by himself and that even when the classes are not at all good enough to help us understand the concepts and get ourselves comfortable coding those concepts........ I have yet not been able to get a good cover on the B-Tree..... I've only coded the search function for the B-Tree; and the insert function and the delete function are still remaining....... and they are really tough stuff to code because insert function involves breaking nodes.................. while delete function requires joining nodes......... and these breakings and joinings are really tough as far as I see to it till now...... You need to see whether there is room for the new node to be inserted....., if yes do the insertion in the proper node without involving any breakings...... if not...... insert the node and find the median element in the node....... shift it one level up...... and break the node into two at the point of the median element........ and follow the same procedure way up to the root............................................... and do you why so much pain in implementing the B-Trees.......... because they grow not at the bottom like the Binary Search Tree (BST)..........................., but at the top.................. You can never create a leaf node in a B-Tree to insert a new value..... you simply insert the value in the appropriate place and if the node has more values than could be allowed......... travel the median value up the node and repeat the process untill you are over upto the root of the B-Tree....... For now, I've planned to code the rest of the algorithms on Graphs.............. and I am to start with them......Bye....

Saturday, October 6, 2007

A big challange ahead........

Now, after the MGPA's are over, the big challenge ahead is the first MGPT (Machine Graded Programming Test). It's surely tougher than the MGPA's and as far as I know it's really going to be a big oracle for all of us...............
There are four MGPT's over the year...... and this is the first among them......
Each MGPT consists of two questions - one from OOPJ and the other from DSAL...... one can solve either or both of the questions......... In all, there are eight questions out of four MGPT's, of which one needs to clear at least two..... Till the last batch it was necessary to clear just two questions..... both could be from the OOPJ or both could be from DSAL..... but I've heard that this time it might be like at least one from OOPJ and one from DSAL must be cleared...
The topics that are expected in the MGPT are general OOPJ problem solving; and DSAL structures like AVL trees, B-Trees, Graph and algorithms related to Graphs......

I am done with topics upto the BST, but after that I'm still on the way to implement the rest of the topics like B-Trees, Graph and the rest of the algorithms...... I did generate the code for the AVL tree last night; and the search function for the B-Tree today morning....

I hope I should be over with the B-Tree by tonight; and I should complete Graphs by tomorrow night.....
However, I'm finding it very difficult to generate the code for these because seldom of the books, be it those I brought from home or be it those in the library of NCST, describe the topics in an appreciable way or provide a proper coding approach to the problem......
I even asked Sachin Sir to name any such book.... He suggested one book from the library but.... yet he said that no book can appreciably get one that much satisfaction..... The only thing one could do is to try understanding the code by oneself and try developing the code by himself.... So let me try coding and see what all happens....

One thing sure......, the course is now really gearing up in a rapid manner....., but the only hard thing about it is that you need to help yourself........ nobody is going to help you a single bit at all...... It's all about do it yourselves.......

A tryst with 'Failure'........................

Today it was the tenth and the last MGPA (Machine Graded Programming Assignments ) here at CDAC, Bangalore......... and it sadly came out to be a failure for me. I was already fearing of the dreaded event this time because graph among other topics was probable to come for the test........ And this time..... like the last one..... one of the assignments of the OPAD handbook was to come for the test.... I could find three of them based on graphs...... ..... one concerning the 'Deadlock Detection', next the one for finding the shortest path according to water level, and the last one regarding the Consistency of prerequisite couses........ But I was not expecting graphs.... simply because everytime there used to be such a great hype and what all used to come....... a silly problem which took not more than 10 or 15 minutes of coding..... and no more than 10 or 15 minutes to type and submit the problems at all...... all this gave me the illussion that it was really very annoying to work so hard till late night..... and most of the time keeping awake the whole night even before the days of the MGPA's..... to find a solution to some probable problems ........ and to my utter disappointment no such problem of that kind did ever come for the MGPA..

Instead, I revised all other DSAL assignments which I had already done before but was finding them blurred in my memory....... and also developed several others that I found possible to tackle on the night just before the current MGPA..... Then after working for the whole night....... I felt I should work for the 50th and the 51st problems also...... and I did....... but by then I was so tired of coding..... and that too.... on paper..... that I could afford only to write the crucial parts of the logic that I could develop for both of the problems in the meanwhile...... .... And by the time I appeared for the MGPA, I was poised to see the same 50th assignment before me......

I wasted no time.... and started coding down whatever logic I had developed the previous night...... It was a long piece of code because it included the most details required............ and it, I could assume, should have run run successfully..... and should have passed the PARIKSHAK.... but you never know it perfectly until you actually implement it and submit it to the PARIKSHAK......

In the machine session, my fear exactly came to surface and I was caught in my program clogged in the PARIKSHAK.... with two out of 5 X's and 3 Y's .....

Friday, September 28, 2007

Today it was the 9th MGPA.....

It was the 9th MGPA today...... and it was already intimated that one of the Student Assessment Assignments(SAA) was to come for the test...... At one extreme, it was a matter to be happy about..... because these problems were already worked upon and I was familiar with them...... but at the other extreme, some of the problems like the 14th, 15th and the 16th assignment problems... I still have difficulty in solving them.... But then.... nobody has yet solved the 15th and the 16th one..... They are really tough stuff... and must be out of place if given in MGPAs......!!!!!!!
I've heard that some people have got over the 14th one.... but still that stuff is yet too good for MGPA.. In the rest of the assignment problems I found the 8th one (permutation problem) really wierdy.... because I got the recursive code from the DSAL book and yet it didn't work fine at all....!!!!!!!! The 12th problem (Maze problem) is somewhat tricky, yet managable.
Yesterday I kept praying and guessed that the last three problems should not come in the MGPA9.. I revised code of all the OOPJ programs I had done so far.... and then I mugged up Sushant's logic for the 8th problem (Permutation problem) and Ravi's logic for the 12th problem (maze problem)..... and went to sleep not quite late at night....... because 'Gyanesh Sir' did warn me in the previous MGPA not to look sleepy in the class..........
It was the today morning..... and as usual, I woke up around 9'O clock.... I got ready for the test. It was so nice to see that it was problem number 7 (Removing zero rows and zero columns from a given matrix...) it was so easy that it took just 12 to 13 minutes to solve it...... the rest of the time I had to again sit idle in the lecture hall and wait until it was 11'O clock....
After that all of us came down to the lab at ground floor..... I typed my program... but not in a hurry..... I didn't want to repeat the mistake I made earlier.... then I compiled it for it might contain typing errors.... but all was well... then I hit a submit on it.... and it simple came out with all the Y's......
Now I have 9 MGPAs on my record..... and I feel I have a good impression on Raman Sir... All this necessarily work good for my future....

What rubbish are we getting for our meals ????????

It's really a mess out here in CDAC as far as the meals are concerned..... Could you imagine getting meals of such a bad quality in the mess that I have had been vomiting regularly for the last two weeks and.... not only me..... most of the others are experiencing the same...... The meals... whether in the afternoon or at night..... are never upto the mark..... they are simply rubbish.... Especially today night......., I couldn't at afford to go for the meal after having the very first sight of the ingredients ....... there was something bloody-red....., (nobody ever could guess what all are they given to eat.... it's simply put..... close your eyes and have it inside..... without applying any thought or reasoning....... because it's the mess of CDAC......) and something grassy..... and CHAPATIs like PAPPADs ....... and PAPPADs like CHAPATIs............ and watery DAHI (curd)................
Oh.......! It's simply toooooooooooooooooooo.............................. good to nibble and get inside.......
I'm taking medicines all the way to keep up my digestive system....... but alas.........! it's not working..... but how could it actually work.......????? After all the food must be something like that for the humans.... not the hoofed creatures........

I certainly need to go ahead and make a complaint against all this..... oh.....! but today it's friday.....!!!!!!!!!
Need to wait another two days..... because it is the weekend and nobody would be there to make a heed to what I and the others have got to say.......
Ok....... let's see.................

Friday, September 21, 2007

Mam's superb presentation......

Today was a very busy friday..... as we had classes right from the morning.... MFCS class in the first session..... then the DSAL class ....... and then somebody came up saying there was to be a TCOM session too..... I was so tired and so unwiling that I just did not want the TCOM session to happen that day at all...... Then some students opted to go and ask the admin staff if the TCOM session could be postponed to some other day.... probably the very next day if possible..... and lo......... Uma ma'm came up and declared that it was meant for the staff only.... however any student if interested could very well attend the presentation and that Sawani Ma'm was to the one who was to give the presentation... and the topic of her presentation was "Rhetoric Structure Theory"..... that is the relation among various sentences of a whole paragraph, in fact, a whole lot of text.....
Now, this was something irresistible at all..... firstly because Sawani Ma'm was to give away the presentation... and secondly it was related to the "Artificial Intelligence". The session was concerned with "Natural Language Processing" through computers....
A lot of this I could infer from the presentation at all..... that there can be sentences or even parts of sentence.... and they may be related to each other in different forms depending upon the intent of the author.... what all the author wants to convey....
A single piece of text could be broken down and a binary tree could be constructed as according to importance and precedence of its parts...
Then I came to know about what is called..... nucleus and the satellite. nucleus is the central idea or the theme that the author want to emphasise upon...... while satelite is that part of the sentence or a different sentence at all... which may be present to support that central idea....
And what could be the cause behind all such things that Ma'm said was to help computers be able to translate not only sentences from one language to the other, but also to translate the ideas of the author into the target language.....
It was really.... an informative session..... and I think it's quite a loss for those who didn't attend the session..... They could have learnt so much out of it that it can never be accomodated in this blog.....

Thursday, September 20, 2007

A little hurry... got it all down......

Yes, it was all in a hurry..... and what a bad luck.... I could better not do what i did....
Last week, I was short ofone blog... and what more happened was that the gnyan server went out for the whole days right on saturday and sunday.... the days on which I used to devote time for writing blogs......
However, on Sunday night, it became available for sometime..... and it was the time I and every other student in CDAC could do his or her blog-writing..... But I was so sort of words, in fact, I was not able to think ofany topic I could blog upon.....
Finally, I decided to try google search on some random words.... because the time was running out..... and I had to have completed my blog....
I tried some words arbitrarily.... to see if I could find some good stuff on it. Finally, I found some really good and informative stuff by searching for the word 'confidence'.
I was really fascinated by whatever was written about it. Ithought this could serve the purpose well.... and what I did was that I copied the content and pasted it in my blog.
But, now I can see that copying is no way going to yield anything other than harm as far as TCOM assignments are concerned..... even if there are reasons for it.

Yet, I can see the ground beneath this harshness and which is very much justified... if I stand on the other side of the table.....

I should really appreciate the way Sawani Ma'm handles things and the way she answers questions put to her is so nicely placed that it really wins her listeners..

At times, I feel that that if I were in her place, might be that I couldn't tolerate some of the incidents that take place and the way they take place.......

Really, tolerence grows with experience...... and this is very very evident from Sawani Ma'm....

Friday, September 14, 2007

The 6th MGPA... could be a blow storm for me...

Really......, this time I was really stuck up during the 6th MGPA... I knew the code was superb... it could never fail... but the wretched "Parikshak".... it can't even tolerate even a subtle difference... that i knew ... but where was it finding that little a difference..... ?
It was all before me.... I did insert print methods in the code.... the code did show what all was getting out of the logic of the program.... but it was just a slip of my eyes that I couldn't notice that the program was actually producing 'two' line-breaks instead of just 'one'.....

And,... do you know how I got into all of a sudden in this kind of a situation.... It was all because I wanted to kick 'Bajaj' behind by submitting my code earlier than him... so that he could no longer boast of this and that..... a very sheer of me .... and i typed by mistake, an extra '\n' which took all the show down to ashes......
I wondered though the code up and down...... trying to find out what went wrong actually.... but alas... i couldn't find the minute fault in my code....
Then I felt that it was the time to change the approach... I implied a 'static' string as the instance member of the class and stripped out the extra space at the end of it using the substring method of the 'String' class and then directed it to the display using the 'System.out.println' method....... O'................ what a mistake I was fooling around.... I felt it this moment that all of my previous code was exactly correct.... except for the extra '\n'. But still, I didn't have the patience to rework and submit it... After all... the present code was still consistent; and I simply wanted to all the 'Y's at the earliest....
Hence, i did submit the code right away and felt greatly relaxxed after getting one 'Y' and all the other 'Y's following in the line....
In the meanwhile, I could see Anubhav Sir and Sachin Sir disappointed at the fact that I was behaving so careless... I think I got that warmth from them that I didn't remain stuck for long.....
I wrote the very previous blog on the topic 'competition', but this time it was a great lesson for me that competition can be at times, hazardous...... and it's you who must decide whether a competition is healthy for you or not.....
I would always carry Sachin Sir's warning after the MGPA was over... that I shouldn't be so careless again....
Yes... I would take my own time, and get my code ready patiently.... after all there's so much of time... and what could I achieve by submitting before or after...? Getting all 'Y's is all that is required.... So, I expect all my readers to learn the same lesson that I did after reading this blog of mine....
Bye for now...

Monday, September 10, 2007

What is LOVE ?

Love is a constellation of emotions and experiences related to a sense of strong affection or profound oneness.
The meaning of love varies relative to context. Romantic love is seen as an ineffable feeling of intense attraction shared in passionate or intimate attraction and intimate interpersonal and sexual relationships.
Though often linked to personal relations, love is often given a broader signification, a love of humanity, of nature, with life itself, or a oneness with the Universe, a universal love or karma. Love can also be construed as Platonic love,
religious love,
familial love, and, more casually, great affection for anything considered strongly pleasurable, desirable, or preferred, to include activities and foods.
This diverse range of meanings in the singular word love is often contrasted with the plurality of Greek words for love, reflecting the concept's depth, versatility, and complexity.

What is competition...

Competition is the rivalry of two or more parties for something. Competition occurs naturally between living organisms which coexist in an environment with limited resources. For example, animals compete over water supplies, food, and mates. In addition, humans compete for recognition, wealth and entertainment.
Competition can be remote, as in a free throw contest, or antagonistic, as in a standard basketball game. These contests are similar, but in the first one players are isolated from each other, while in the second one they are able to interfere with the performance of their competitors.
Competition gives incentives for self improvement. If two watchmakers are competing for business, they will lower their prices and improve their products to increase their sales. If birds compete for a limited water supply during a drought, the more suited birds will survive to reproduce and improve the population.
Rivals will often refer to their competitors as "the competition", and the term competition can also be used as to refer to a contest or tournament.

Friday, September 7, 2007

History of Blogs...

Before blogging became popular, digital communities took many forms, including Usenet, commercial online services such as GEnie, BiX and the early CompuServe, e-mail lists[2] and bulletin board systems (BBS). In the 1990s, Internet forum software, such as WebEx, created running conversations with "threads". Threads are topical connections between messages on a metaphorical "corkboard". Some have likened blogging to the Mass-Observation project of the mid-20th century.


1994–2001
Main article: Online diary


Brad Fitzpatrick, an early blogger.


The modern blog evolved from the online diary, where people would keep a running account of their personal lives. Most such writers called themselves diarists, journalists, or journalers. A few called themselves "escribitionists". The Open Pages webring included members of the online-journal community.

2001–2004
Several broadly popular American blogs emerged in 2001: Andrew Sullivan's AndrewSullivan.com, Ron Gunzburger's Politics1.com, Taegan Goddard's Political Wire, Glenn Reynolds' Instapundit, Charles Johnson's Little Green Footballs, and Jerome Armstrong's MyDD — all blogging primarily on politics (two earlier popular American political blogs were Bob Somerby's Daily Howler launched in 1998 and Mickey Kaus' Kausfiles launched in 1999).
By 2001, blogging was enough of a phenomenon that how-to manuals began to appear, primarily focusing on technique.

2004–present
In 2004, the role of blogs became increasingly mainstream, as political consultants, news services and candidates began using them as tools for outreach and opinion forming. Even politicians not actively campaigning, such as the UK's Labour Party's MP Tom Watson, began to blog to bond with constituents.

What's haunting me these days....

In the very beginning of the FPGDST course in CDAC, I was wondering what all is happenning....

all was going that smoothly for me.. but this TCOM sessions have created a real hell for me. Instead of devoting my time to more studies, I'm simply stuck up trying to dare to speak before the audience and all in vain....

I don't know what I'm fearing of...

Still, let me try and get to the place where i should be....

Yes... I certainly need to try a lot..

Thursday, September 6, 2007

What's happenning ?

I'm really worried about what all is happenning to me these days..... I'm scared...i'm vanishing... and i'm getting all those rubbish odds in myself...
Speaking to people has not been a hurdle for me... and i've even taught people on technical subjects.. then i don't know what's what's grilling me so much that i'm not even daring to stand before them and speak a few lines...
I think it's some difference in environment that drawing me away from what i should achieve.. Here it's a large hall and all the time I'm fearing someone could grill me up....
Still, I must try and get to where I'm required. I think I must restart teaching which I threw off like ashes.... it was that beautiful...
I must really start teaching again.. That would be beneficial not only to me but to the others who are stuck up in the concept of data structures and Java Programming...
and that even in the very same kind of hall where I'm expected to perform...

Saturday, September 1, 2007

My life at school

Every person has a unique experience and a story to tell about his school life and first day in school, and for that matter, passage through their student life. My story goes something like this. The first day I went to school was `D' day for me.
School life started when I joined the school in June 1983 when I was only 2 1/2 years old. For me, the school meant play, play, and more play. Instead of sitting in the classroom and learning something, I used to roam around the garden doing a gardener's job. Two years passed and I was in U.K.G. when we shifted to a new school that was an old building with a big playground. In class I was scared of one of my subject teachers because she used to beat us very often. I was so scared and didn't want to go to school anymore. Eventually my mother went to the Principal and sorted things out. After that it was like a smooth sailing ship.
All these years of my school life, I have made many friends and they have helped me a lot in my academics. Many a time I used to fight with my friends. But, then I think that everything is fair in friendship. In my school life I am gifted with excellent class teachers and subject teachers. They always help me to cope with my notes whenever I was absent or fell ill. When I was in class six, I was very good in my academics as well as in extra curricular activities. Then I put my feet on the 7th step of learning.
Growing and learning had been a great fun. Every year we were taken to different places on our school picnics. I was never able to go on to these excursion tours but I enjoyed every word of the stories told by my friends. When I was in class eight I won a couple of prizes in drawing and in interschool competitions. We were also given many projects as class assignments that helped all of us to know more about the subject. I was very fond of cricket (now in football). My friends and I played cricket in the school campus after the school got over. At the same time we all used to get lots of scolding from our principal.
Every Saturday we used to have our P.T. drill and frankly speaking, nobody in my class, even me, had ever liked this. As I reached class nine I realised that I should concentrate on my studies as the next year I was going to write my Board exams. The most memorable day in my life was the day when we bid farewell to our seniors on Feb. 16, 2002. Well, now I am in class ten and all set to write my Boards in March 2003. Whenever I recollect all these incidents of school life. I feel very happy and I think in everybody's school life there are many ups and downs that mould one's life. School is a place where all of us learn to care and share. "School" is just not a place, but it is a large dome made up of discipline, knowledge, love and affection. I think in everybody's success, school plays a key role. I can describe my school in "Three S's, they are: Small, Sweet and Simple. My school was the best, is the best and will be the best.

Sardar Jokes

Sardar Ji Jokes Page 11- Sardar ji is buying a TV"Do you have color TVs?""Sure.""Give me a green one, please."
2- Sardar Ji calls Air India."How long does it take to fly to Amritsar?""Just a sec," says the rep.Thank you." says the Sardar ji and hangs up.
3- Sardar ji is filling up a job applicationHe promptly fills in the lines on NAME, AGE, ADDRESS, etc.Then came the column SALARY EXPECTEDAfter much thought he writes: Yes
4- Sardarji goes into a store and sees a shiny object.He asks the clerk, "What is that shiny object?"The clerk replies, "That is a Thermos flask."The Sardar asks, "What does it do?"The clerk responds, "Keeps hot things hot and cold things cold."The Sardar says, "I'll take it!"The next day, he walks into work with his new Thermos.His Sardar boss sees him and asks, "What is that shiny object with you?"He said, "It's a Thermos flask."The boss asks, "What does it do?"He replies, "Keeps hot things hot and cold things cold."The boss said, "Wow, what do you have in it?"The Sardar replies, "Two cups of coffee and a coke."
5- Sardarji fixed an answering machine at home.Two days later he disconnected it because he was getting complaintslike "Saala phone utha ke bolta hai ghar pe nahin hai."
6- What does Sardarji do after taking photocopies?He compares it with the original for spelling mistakes.
7- What does Sardarji do when he has one white sheet and wants an extrasheet?He makes a photocopy of the white sheet.
8- There was a meeting of all the Surd freedom fighters.They were planning for a free Punjab. Santa Singh raised a point,"Oh...we'll take Punjab from India but how would we develop it?"That was a tough one indeed. Banta Singh had a brainwave..."No problem! We'll attack Amrika, it would take over us and thenwe would become a State of USA and develop automatically."All the surds became happy with this very simple solution but an old surdwas not. Someone asked him why he wasn't happy.The old surd replied, "THAT'S ALL VERY WELL...WHAT WOULD HAPPEN IF BY CHANCEWE TOOK OVER AMRIKA???"
9- Sardarji went to the appliance store sale and found a bargain."I would like to buy this small TV," he told the salesman."Sorry, we don't sell to Sardars," he replied.He hurried home removed his turban and changed his hair style, and returnedto tell the salesman"I would like to buy this TV.""Sorry, we don't sell to Sardars," Salesman replied."Damn, he recognised me," he thought.He went for a complete disguise this time, haircut, new hair colour,new outfit, big sunglasses, waited a few days, saw the salesman again."I would like to buy this TV.""Sorry, we don't sell to Sardars," he replied.Frustrated, he exclaimed, "How do you know I'm a Sardar?""Because that's a microwave," he replied.
10- Why did 18 Sardars go to a movie?Because below 18 was not allowed.
11- How do you measure Sardarji's intelligence?Stick a tire pressure gauge in his ear
12- Sardarji proposes to a woman. She says yes if you bring me a pair of crocodile boots. He sets off to Africa and disappears. Finally a search is being made, they find him hunting crocodiles and watch him killing a huge one. He walks over the reptile, checks its legs and angrily exclaims "71st and *again* barefoot!"
13- What do you do when a Sardar throws a hand grenade at you? Pull the pin and throw it back.
14- What do you do when a Sardar throws a pin at you? Run like crazy....he's got a hand grenade in his mouth.
15- How do you make a Sardar laugh on Saturday? Tell him a joke on Wednesday.
16- What is the Sardar doing when he holds his hands tightly over his ears? Trying to hold on to a thought.
17- Why do Sardars work seven days a week? So you don't have to re-train them on Monday.
18- Why can't Sardars make ice cubes? They always forget the recipe.
19- How did the Sardar try to kill the bird? He threw it off a cliff.
20- What do you call 10 Sardars standing ear to ear? A wind tunnel.

Sunday, August 26, 2007

See what I got all on ROBOTICS...



A robot is a mechanical or virtual, artificial agent. It is usually an electromechanical system, which, by its appearance or movements, conveys a sense that it has intent or agency of its own. The word robot can refer to both physical and virtual software agents, but the latter are usually referred to as bots to differentiate.
While there is still discussion about which machines qualify as robots, a typical robot will have several, though not necessarily all of the following properties:
Is not 'natural' i.e. has been artificially created.
Can sense its environment.
Can manipulate things in its environment.
Has some degree of intelligence, or ability to make choices based on the environment, or automatic control / preprogrammed sequence.
Is programmable.
Can move with one or more axes of rotation or translation.
Can make dexterous coordinated movements.
Appears to have intent or agency (reification, anthropomorphisation or Pathetic fallacy).


Defining characteristics
The last property (above), the appearance of agency, is important when people are considering whether to call a machine a robot. In general, the more a machine has the appearance of agency, the more it is considered a robot.

KITT is mentally anthropomorphic
Mental agencyFor robotic engineers, the physical appearance of a machine is less important than the way its actions are controlled. The more the control system seems to have agency of its own, the more likely the machine is to be called a robot. An important feature of agency is the ability to make choices. So the more a machine could feasibly choose to do something different, the more agency it has. For example:
a clockwork car is never considered a robot
a remotely operated vehicle is sometimes considered a robot (or telerobot).
a car with an onboard computer, like Bigtrak, which could drive in a programmable sequence might be called a robot.
a self-controlled car, like the 1990s driverless cars of Ernst Dickmanns, or the entries to the DARPA Grand Challenge, which could sense its environment, and make driving decisions based on this information would quite likely be called robot.
a sentient car, like the fictional KITT, which can take decisions, navigate freely and converse fluently with a human, is usually considered a robot.

My search for Artificial Intelligence over the net...


Artificial intelligence (AI) is a branch of computer science and engineering that deals with intelligent behavior, learning, and adaptation in machines. Research in AI is concerned with producing machines to automate tasks requiring intelligent behavior. Examples include control, planning and scheduling, the ability to answer diagnostic and consumer questions, handwriting, speech, and facial recognition. As such, it has become an engineering discipline, focused on providing solutions to real life problems, software applications, traditional strategy games like computer chess and other video games. For topics relating specifically to full human-like intelligence, see strong AI.
Schools of thoughtAI divides roughly into two schools of thought: Conventional AI and Computational Intelligence (CI), also sometimes referred to as Synthetic Intelligence to highlight the differences. Conventional AI mostly involves methods now classified as machine learning, characterized by formalism and statistical analysis. This is also known as symbolic AI, logical AI, neat AI and Good Old Fashioned Artificial Intelligence (GOFAI). (Also see semantics.) Methods include:
Expert systems: apply reasoning capabilities to reach a conclusion. An expert system can process large amounts of known information and provide conclusions based on them.
Case based reasoning
Bayesian networks
Behavior based AI: a modular method of building AI systems by hand. Computational Intelligence involves iterative development or learning (e.g. parameter tuning e.g. in connectionist systems). Learning is based on empirical data and is associated with non-symbolic AI, scruffy AI and soft computing. Methods mainly include:
Neural networks: systems with very strong pattern recognition capabilities.
Fuzzy systems: techniques for reasoning under uncertainty, have been widely used in modern industrial and consumer product control systems.
Evolutionary computation: applies biologically inspired concepts such as populations, mutation and survival of the fittest to generate increasingly better solutions to the problem. These methods most notably divide into evolutionary algorithms (e.g. genetic algorithms) and swarm intelligence (e.g. ant algorithms). With hybrid intelligent systems attempts are made to combine these two groups. Expert inference rules can be generated through neural network or production rules from statistical learning such as in ACT-R. It is thought that the human brain uses multiple techniques to both formulate and cross-check results. Thus, systems integration is seen as promising and perhaps necessary for true AI.

Sunday, August 19, 2007

Today I put a request over the newsgroup comp.lang.c++

Today I searched for a newsgroup on C++ and luckily found one - comp.lang.c++ at www.groups.google.com. There I put an open request for anyone who could come up and help me start programming a small UNIX OS kernel....

By the way, it was so exciting to get to know all this .... blogging - the first day....
n newsgroups... the day after....

Let me see if one comes up.....

I'm really for something of this kind to emerge....

bye.

Friday, August 17, 2007

The first time I came to know about what's a blog...

This is really the first time I've ever come to know what a blog is.... wandering at the way people lack the capability to express the meaning of a very frequently used buzzword...... Everyone knows just to speak it.... do it for himself, but how shame on them... nobody tries to let it go properly into another guy's mind....


Yet....., it's interesting to get to know about this very new thing....


bye for now.