Tuesday, August 16, 2005

Forest Gump

Watched 'Forest Gump', to say that it is amazing would be an understatement...

Some quotes from the movie:

Forest Gump: Now the really good thing about meetin' the President of the United States is the food.

Forest Gump: Momma always said life was like a box of chocolates. You never know what you're gonna get.

Forest Gump: Mama always said, dying was a part of life

Bubba: My given name is Benjamin Buford Blue, but people call me Bubba. Just like one of them ol' redneck boys.
Forrest Gump: My name's Forrest Gump. People call me Forrest Gump.

Forrest Gump: My Mama always said you've got to put the past behind you before you can move on.

Forrest Gump: What's my destiny, Mama?

Mrs. Gump: You're gonna have to figure that out for yourself.

Jenny Curran: Do you ever dream, Forrest, about who you're gonna be?
Forrest Gump: Who I'm gonna be?

Jenny Curran: Yeah.
Forrest Gump: Aren't-aren't I going to be me?



Wednesday, August 10, 2005

Googling

[The term 'Googling' is in news again. This 'short-imaginative-horrible-write-up' (I dare not call it a story), was born out of my bored mind while traveling in the chaotic Bangalore traffic]

Babu Dotbubble was in his swank office enjoying as he watched the stock price of his competitor tumble to the abyss. He had commissioned the guys to go googling about the murkier past of his competitor. The data that the googling process had unraveled was more than his own expectations. And as expected when he released this 'data' to the press, the downfall of the stock started.

Now that he had vanquished his competitor, he had a very few wishes that were to be fulfilled.

As he leaned back on his cushy chair he saw two horrible looking men approach him, and he realized that he was not aware of his body...
and before he could lock his computer they mailed him away to the abode of Yamaraja.

He was now before Yamaraja, where his past deeds would be recounted, Though worried about the prospect of spending time in the boiling oil of Hell; He wondered about how the management at Hell maintained so many records of past deeds of so many dead people and how did they collect all this information...

...to his horror Chitragupta was at a computer terminal googling about him.

[Yamaraja and Chitragupta are Hindu mythological Gods of death, For more information there is Google]

Monday, August 08, 2005

Change

Hello All,

I have been blogging for quite some time now. Mostly I have blogged topics related to software, books and a little bit about life in general. Sometimes my posts generated a few comments, but in most of the cases the posts were in fact downright boring and nobody posted any comments :)

Recently I came across a study which stated that, even though most people have interesting experiences, they do not think about them or share them with others, they just discuss about the routine life. Which is very true.

So I have thought that from now on, I will write about my experiences which I have found interesting, or other's experiences if they are willing to share them here.

I will not blog in greater detail about technology or things that people can find on web. I will just provide the relevant URLs.

Do provide your feedback. I will start with an experience from my childhood in the next post which hopefuly should be intresting :)

I am looking for a new title for my blog as well, "Me, Myself and my blog" sounds very selfish :) even though I did not mean it. It was rather inspired from the movie title "Me, Myself and Irene".

Thursday, August 04, 2005

Asynchronous programming in C#

Long time since I posted something technical. So here I will discuss about support for asynchronous programming in C#. Do post your thoughts on how much effort this could have taken in C++? Any C++ libraries which can do this?

.Net provides new simple ways to perform asynchronous programming. Asynchronous delegates provide the ability to invoke any method asynchronously. (A delegate is equivalent to a function pointer).

Method parameters can be used for input or output. (C++: &var pass by reference). C# refines this by introducing new keywords: out and ref.
out states that the parameter's value set the by the method. For example, I can define a function as:

public void Method(float param, out float multResult, out float divResult)
{
//...
}


and invoke it:
float multResult, divResult;
Method(100,out multResult,out divResult);
Console.Writeline(multResult);
Console.Writeline(divResult);

We will first see how we can invoke a method asynchronously. We will also answer a doubt which might arise: 'If I invoke 'Method' asynchronously, what will be the values of out params?'

public class AyncTest
{
//Define the delegate
public delegate void AsyncDelegate(int inParam,out int outParam);
private AsyncDelegate m_asyncDelegate;

public void Test()
{
m_asyncDelegate = new AsyncDelegate(AsyncMethod);

System.AsyncCallback asyncCallback = new AsyncCallback(OnAsyncReturn);

int outParam;

IAsyncResult result = m_asyncDelegate.BeginInvoke(2,out outParam,asyncCallback,null);

Console.Writeline(outParam) //<--- whats the result?

result.AsyncWaitHandle.WaitOne();
}

public void OnAsyncReturn(System.IAsyncResult result)
{
int outParam;
m_asyncDelegate.EndInvoke(out outParam,result);
Console.WriteLine("Result: "+outParam);
}

public void AsyncMethod(int inParam,out int outParam)
{
outParam = inParam * 100;
}
}

So as seen asynchronous invocation is quite simpler than, what you would have to do, without this kind of support.

And now to the question: 'If I invoke 'Method' asynchronously, what will be the values of out params?'. As you might have guessed the out params are set to default values, int, float set to zero, objects set to null.

The (mis)adventure of the missing bowler?

'The missing three quarter' is one of the Sherlock Homes stories in which a star player of the football team goes missing just before a vital match. As the story progresses different possibilities emerge, either he might have been kidnapped, or suffering from some fatal disease, or killed. But ultimately Sherlock Homes solves it.

Other mystery which might have appealed to Sherlock homes is 'Missing fifth bowler in the Indian cricket team'. We have lost two matches because of this, no other reason, It is elementary my dear Greg Chappell, that the fifth bowler is a necessity...

But still he is not included in the team and warms benches on windy srilankan grounds. May be Sherlock could help.

PS: Dont miss reading the story