Tuesday, June 24, 2008

Ended runners-up!! A good start.

Not bad! not bad at all, is what i will say for the result of the Infy tournament just ended.
My team ended up being the runners up!
As for me, I played some amazing tennis(my standards :)) against a really great oponent, guy was a senior national player. So i knew i dont stand a chance, so just went ahead and enjoyed playing, no fear, just hit my shots and was able to streach him in the first set till the last stages loosing 5-7.

But more than the game, the things i enjoyed most was meeting soo many good players, now friends...learnt a lot from them.....

Hope to continue ...the good start.

Sunday, June 22, 2008

Played bad today :(

Gosh! Today i played in a tennis tournament after a very long gap, actually dont even remeber when did I last played, i think it was in my school days..

Its a totally different ball-game when you play in a tournament, but i am glad atleast i have started again .

When match started i felt the net was high :) :) funny ...then i was not moving well legs had gone heavy this happened for first few games :) happens i know..but my backhand ditched me totally, played too defensive....... but fought till end....
Never mind its over.

But the good news is that, we(my team) won, it is davis cup style team tournament...fellow players played an amazing doubles and a remarkable reverse singles....so we are in semi-finals...most probably i will be playing tommorow as well...:)

Lets c if my nervousness goes away......................................................................

Thursday, June 12, 2008

PInvoke DhcpGetServerBindingInfo / DhcpSetServerBindingInfo C# ulong gotcha

Phew!! there is a thing always to remember while pinvoking. ulong is 64bit in c# while 32 bit in win32 world. Learned it hard way .. :)..
The error that you will get if you try to pinvoke if "null reference" .
Here is the signature and code snippet to be used.

[DllImport("dhcpsapi.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint DhcpGetServerBindingInfo(
[MarshalAs(UnmanagedType.LPWStr)]
string ServerIpAddress,
uint Flags,
out IntPtr BindElementsInfo);

[DllImport("dhcpsapi.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint DhcpSetServerBindingInfo(
[MarshalAs(UnmanagedType.LPWStr)]
string ServerIpAddress,
uint Flags,
IntPtr BindElementsInfo);


How to call:
IntPtr intptrBindElemArray = new IntPtr();
UInt32 ret;
ret = DhcpGetServerBindingInfo(localIP,
0,
out intptrBindElemArray);
if (ret != 0)
{
int code = 0;
code = (int)ret;
Win32Exception winex = new Win32Exception(code);
handleDHCPError(winex.NativeErrorCode + " : " + winex.Message);
}

Simple right.
Just that searched the hell lot but nobody in the world did it before ... :).

Sunday, April 27, 2008

Create process in another session.

So how do you create a process in another, different session than which you are logged on. (i am working on Windows Terminal Server 2008 although this can be done in earlier OSs as well)
In order to be able to do this you need to have "LOCAL_SYSTEM" credentials.
The api that will do this is CreateProcessAsUser(), and the most important parameter it will take is the hToken, which will the token of the user logged onto the other session, in which we are creating a process.
CreateProcessAsUser() creates process in the session of the token provided.

The api which will get you the token of that user is, WTSQueryUserToken(), which takes input a sessionid and outputs its token. It is this api which needs "LOCAL_SYSTEM" priveledge.
So i wrote a windows service, which runs as "LOCAL_SYSTEM" and here is very small skeleton code which does the work.

BOOL fSuccess;
HANDLE hToken;
fSuccess = WTSQueryUserToken(
SessionID,
&hToken);
if(!fSuccess){
return -1;
}
fSuccess = CreateProcessAsUser(
hToken,
AppName,
AppName,
NULL,
NULL,
FALSE,
0,
NULL,
NULL,
&StartInfo,
&ProcInfo);

if(!fSuccess){
return -1;
}

Monday, August 13, 2007

My Tennis Serve

For a few dayz I was battling with my serve. I normally had first serve %age of around 50, but lately had gone down drastically. I decided to go back to basics. So where would a techie go to learn tennis serve, no not tennis academy...it was youtube & some other videos that helped me recognize my problem.
I was doing everything right except toss. In my quest to put in more top spin esp in my second serve i was tossing the ball over or back of my head due to which i was goofing up badly. So here I put all the basic steps.
( I am not a tennis pro but a lover of the sport, so please add comments & videos for improvements)

1. Position yourself: Right foot at around 45 degrees to the base line, comfortably puts me in a nice position .
2. Focus: Focus focus focus, i do it by bouncing the ball few times...forget about last point, last serve, people watching, cute girl somewhere nearby :) ...forget everything just you and the tennis ball.
3. Pickup a spot: Everytime before serving I look and pick up a spot where i intend the ball should go.
4. TOSS: This is so very important. You need to toss the ball at a convinient position for you to hit. As for me it just above the base line little away from my body. This below video also very clearly shows the starting position of hand before toss and a good toss by Nadal.(dartfish)


5. Reach for the ball: As the ball is going up, start bending the knees and when its at it highest reach for it and hit it as hard as you can.

Below is the video that talks about all the steps in much more detail.

VideoJug: How To Serve: The Basics

Sunday, April 1, 2007

The Gospel (The Cool News)

Bad News:
Do this, Dont do that. else you die and goto hell.
This is, Karma(Work) based "religion".
No man could live according to God's standard, all sinned somewhere, sometime, and thus were condemned.

Good News:
God is compassionate.
God himself (Jesus) died for our sins, took all the brunt and condemnation of sins onto himself.
After cleansing all sins, He rose back from dead to live for evermore.

Now I need to just confess, repent(turn away), & BELIEVE in Him, that He died for my sins, and I am in accordance to God's standard.
This is, Faith based "Way".


John 3:16 -For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have eternal life.

http://www.gospeloutreach.net/gospel.html