I am going to start my two year MBA course in about a couple of days. The name of the college is Institute of Management Technology - Nagpur(http://www.imtnagpur.ac.in). Incidentally there is another IMT in Ghaziabad where my colleague Shubo studied, and now my senior Akshay Moorthy, a.k.a, Redeye is going to study. So, the senior becomes the classmate now. He of course was working at Reliance Info,or Comm.,I don't know which. And then there is this incredible guy named Arun aka Voodoo( and about whom I intend to write about in the coming posts), who was my super senior in DA-IICT, he is already into his first year of MBA at Oklahoma in the US. And he is getting married too. So, all the reasons for me and them to rejoice.
I have been getting recurring dreams about me wanting to become the next John Galt, to this world, but I am afraid, like my friend Sai Deep pointed out, it aint that simple, nor is it easy.
Drifting away in endless thought, walking away from reality, I find myself going absolutely crazy. On the one side, the push towards doing that which is right, and then the whims of the modern day entertainment pulling me towards it, is just tearing me down with much greater force than that of a black hole as it draws matter from its own event horizon towards the centre.
Anyway I have no idea, what I am talking about, will update again upon getting a feel of the college and all...
Adios!
Wednesday, June 17, 2009
Friday, May 1, 2009
Optimization to password.c
So, after a long time, atleast one of my friends came up with a couple of optimizations and an error for me to correct. The first error is that in the code at the end of the do-while statement, the comparison of counter to a number is not at all clear, so, here is what it should look like
while(counter<500); ----> this is to limit the number of characters in the string.
One of them is rather trivial. The initialization of the variable counter is not necessary as it is a global variable and will automatically be initialized to '0' at runtime.
A couple of good optimizations suggested by Barjatiya were as follows:
1. Instead of "goto end:", he says, I could have used a break. But I insisted that I like goto, and so he left me alone.
2. The other was instead of printing all the characters using a printf, I could rather converts the character array to a string and then print the whole thing. One problem was encountered that way, which again, thanks to baddu, I was able to correct it.
Note: Because of the html tags "<" and ">" , printing the code is a headache, and hence comparisons, and #include ...... will not work, If you copy paste the code. (Still trying to figure out someway.)
Second program, will be coming very soon. Keep checking.
Adios!
while(counter<500); ----> this is to limit the number of characters in the string.
One of them is rather trivial. The initialization of the variable counter is not necessary as it is a global variable and will automatically be initialized to '0' at runtime.
A couple of good optimizations suggested by Barjatiya were as follows:
1. Instead of "goto end:", he says, I could have used a break. But I insisted that I like goto, and so he left me alone.
2. The other was instead of printing all the characters using a printf, I could rather converts the character array to a string and then print the whole thing. One problem was encountered that way, which again, thanks to baddu, I was able to correct it.
Note: Because of the html tags "<" and ">" , printing the code is a headache, and hence comparisons, and #include ...... will not work, If you copy paste the code. (Still trying to figure out someway.)
Second program, will be coming very soon. Keep checking.
Adios!
Sunday, April 26, 2009
The Egoist.
So, was wondering how a password field could be written in a compact way. The following source code in C, is just one of the many ways to do it.
Read through, and suggest optimizations if you can think of any.
The code:
Read through, and suggest optimizations if you can think of any.
The code:
//START.
#include "stdio.h"
#include "ctype.h"
#include "conio.h"
int counter;
char str[500];
void removelast(int);
int main(void){
char c;
int i;
do{
c = getch();
i = (int)c;
if(i == 13)
goto end;
else if(i == 8 && counter > 0){
removelast(counter);
putchar(0x08);
putchar(0x20);
putchar(0x08);
}
if(isprint(c)){
printf("*");
str[++counter] = c;
}
} while(counter <>
The above source code is allowed to be copied, transmitted,stored, and used in any way the reader sees fit. I just want people to appreciate what and how a small and beautifully written code can do wonders.
end:
printf("\nThe entered string is ");
for(i=1;i<=counter;i++)
printf("%c",str[i]);
return 0;
}
void removelast(int a){
str[a] = NULL;
counter--;
}
//END.
Saturday, April 25, 2009
A is A.
Well, this is officially my first post now. After seemingly long unnecessary time spent in chosing what template to use and what font and all that, here I am finally scribbling my first thoughts after creating one. Any way, just want to say to all the readers out there, that from now on, I will be posting my daily doings here, just for me to remember them, and to share them with my friends. The daily postings may include some noobish C/Java code that I so passionately write to pass my time. For the time being atleast, this is what I enjoy doing!
Ok, now... next post tomorrow. Adios!
-That was John Galt speaking.
Subscribe to:
Posts (Atom)