Tuesday, July 13, 2010

Sinahawa

Sinahawa
Mila kara

Paumata

Wikunaa

Wiriththana

Kuhakiynta

Hinawenawa

Man

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.