Saturday, December 26, 2009

In the winter

So this is my first post after a lot of time. Time which changed me beyond anything. But that is talk for another time. For now, I am just enjoying my time in holidays. Yep, I am on holiday. So lets hope I get time to some time to get some pics in here and make this a proper blog.

Friday, July 31, 2009

Template Hell

Man, When I first saw pointers, referencing and de-referencing and all, I thought that I had seen the worst that C++ can throw at you. And now come and greet the new enemy that I found

TEMPLATES!!!

So you think you know what templates do ? Lets see, they are a type of metaprogramming right ? They allow you to use C++ compiler as an interpreter and write generic code with the use of which C++ compiler would generate specific code. So that is what templates does ? Nope. Sorry but I thought so too. But along comes this code snippet which supposedly implements a while loop. Go figure! And when you do please tell me too :D

template
class loop {
private: enum { go = (I-1) != 0 };
public: static inline void f() {
// Whatever needs to go here
loop::f(); }
};

class loop<0> {
public:
static inline void f()
{ }
};

loop::f();

Sunday, July 26, 2009

Jamming On

Well this time around I guess I might have some time to go after the code jam contest. Took some small steps in that way and here is the first result. Think I would use C++ for the contest. I would love to experiment with Python and use some C# or Java for this. I would love the java libraries in the more complex problems. But seems I can make do with C++ this while and this would be a good time as any to get those rusty C++ skills honed in. So here goes nothing. :D

This is my solution for the first practise problem. This is really cool, at least for me and I hope is good and correct C++. No C stdio, no c-strings and bettter still no mallocs. Take a look and see what comes.

/*
* main.cpp
*
* Created on: 27 Jul 2009
* Author: Osada
*/

#include
#include
#include
#include "math.h"

using namespace std;

void process(fstream *input_file, fstream *output_file, int line_no)
{
string num_str;
string source_lang;
string target_lang;
string convert_num_str;
char input_char = '\0';

(*input_file) >> num_str >> source_lang >> target_lang;

cout << "The number string is " <<>
cout <<>
cout <<>

/* Data processing variables set */
long target_lang_dim = target_lang.size();
long source_lang_dim = source_lang.size();
long source_lang_value = 0;
long pos_value = 0;
long convert_residue = 0;

std::reverse(num_str.begin(), num_str.end());
for(int i =0; i <>
{
pos_value = source_lang.find(num_str.at(i), 0);
source_lang_value += pos_value * powl(source_lang_dim, i);
}

convert_residue = source_lang_value;
ldiv_t div_result;
while(convert_residue != 0)
{
div_result = div(convert_residue, target_lang_dim);
convert_residue = div_result.quot;
convert_num_str.push_back(target_lang.at(div_result.rem));
}
std::reverse(convert_num_str.begin(), convert_num_str.end());
(*output_file) << "Case #" <<>
}

int main (int argc, char **argv)
{
/* File input variables */
fstream input_file("A-large-practice.in", fstream::in);
fstream output_file("output.txt", fstream::out);
int no_of_lines = 0;
input_file >> no_of_lines;
for(int i = 0; i
{
process(&input_file, &output_file, (i + 1));
}
input_file.close();
output_file.close();
}


Wednesday, June 24, 2009

Last post at office

Here I am writing my last post from the zone24x7. I wish I could write lots and lots on this post. But I cant. I just cant. It is all blank. And gloom. And Lonely. Maybe I will write something later. May be I miss you all. Love you all.

Monday, February 16, 2009

What can you achieve ?

What can you achieve ? This is a question that you get asked each day. And there is a evasive almost invisible question bubbling in the other person's mind just below the surface. What are you willing to sacrifice for it ? These are not questions with hard and fast answers. No textbook can ever make you understand how to answer these questions. No university can ever teach you this save for Gorki's "My University". No one defines rules for playing this game. So just how do you answer these questions ? Just how do we play this game ? I dont really know. But I am going to find out. By god, I am going to. And I am going to let you know when I do.

Monday, December 29, 2008

The Sixth Sense - Grrrrr......

Yes, that was exactly my response after watching th movie. I mean the ending was so cruel I just sat down and wondered what the heck for about half an hour. :D

On a more serious note, the film was a very good one. First of all the script was fabulous. It just let the person who is watching the movie make the intutive and obvious links and assumptions and them break them all in one single go so easily. The plot is kept at a running pace too. If you are not a die hard fan of "Rambo" style action or "Die hard" type theatrics, then you wont be disappointed. The script keeps the edge by keeping the observer always just a bit out of focus. everthing seems so elusive and cannot be taken for granted. Also the acting by Bruce wills and the Haley Joel Osment is very engaging and feels true. There are no forced antics or out of place frights. Things just flow naturally and they just flow with the act too.

But the double whammy at the end takes the prize for the top award of them all. The closure is not a fairy tale ending though the end leaves all the characters strangely satisfied in their own ways but not at dead ends. It again confirms that every thing just keeps in motion and does not stop at any place. No story in real life ever ends like, "Then they all lived happily". The lives of real people will keep on changing and morphing. The beauty of life is that we all eventually find a purpose in all this, a meaning in the mess that we call life. That is what i see at the end of it all. I have long since stopped reading any so called "Top critic" comments at rotten tomatoes. But just for the sake of it I looked at some before writing this review and most of them were good. But i noticed that one writer has said that the character development was "arragont". If he meant that there was no way that real people could have developed things that fast or the writer has developed the characters according to his desires, he was very wrong. The characters are intelligent and not really self desctructive , sucidical and manical people those "top critics" want to see in the films.
So what is the final wordict ? well if you feel like sitting at the edge of the seat for a good two hours and another halff an hour in bewilderment at the movie. Sure go for it. Even otherwise it would rank as a top pick on my list of thriller/drama films.

Friday, December 26, 2008

Dreams and Stories

For a while a thought has been coursing through my mind, Just what keeps me going ? I mean I have been through so much, have seen, done and felt so much. Why do i keep in going ? It is not like I have anyone making me go forward as it i m on a bullock cart or something. So why do I go forward ? For a while I thought may be it was the desire for winning that keeps me going. May be it is that never ending desire for excellence that make me tick. But after a while I realized even though i do possess that desire it does not drive me. It too is a manifestation of some other mysterious internal reason. May be it was the love for my family, my parents. But even though I love them and like to make them safe and happy, they too are not the main reason I keep at it. After all what i have done already is enough to make them proud. Then I thought may be it was my fiance that I wanted to make happy,proud and safe. But today I realized it was none of these things. I mean all these times I had so much wanted to be wanted, wanted to be loved and understood and respected by other just like any normal human being. But today i discovered what i need more than anything it is to succeed. If anyone of you ever read weefree men, it says, the hills are the bones and the bones are the hills. It is all one. The history rallied behind you, the blinding heritage, the longings of generations is what drives you. The bones of them all, the tears of them all, the blood of them all stand beside you. You are never alone if you just remember who you are and why you are here. Remember it is not just you, it is them all, hopes of generations have been aflame inside you waiting to roar to this world in celebration when you make entry in to this world as an envious and exemplary person. And thus finally I knew what I searched for was inside me. I was talking to her on a book she sent me for my birthday. It was so long since I properly read a book I was so delighted just to hold it in my arms. It gave me such pleasure to dig in to it and get lost in the world of the "Lost Boy". And I wanted her to share in the memories. But I guess she was a bit too preoccupied with her things. Anyway I was a bit shaken up. But as i was going to go to sleep I suddenly realized I just didn't care. I just wanted to read the book, consume it, revel in the thoughts of the "Lost Boy" and bathe in the warmth of a dreamworld only story can provide. That was when I knew why I did all this. This entity called me was not a random creation. My roots go back so far in to the past. And as i stand here today so many dreams stand beside me. The dreams dreamt by the storyteller. They are my dreams and I live for them. I live for the stories and the dreams that I create, my heritage. I don't need any other thing to live for. For this is my life. The life of a story teller,  dreamer,  
The Rainmaker.