Search within this blog
Tuesday, June 29, 2010
First day Second Show
We needed a place to go. First of all we made lots of debates and discussion. And as time passed in discussion and view - counter-views, the schedule of most of the movie halls became unsuitable. Except one, Hind. We decided to go there. Although the movie was not of choice for most of us.
The six of us went outside the college and weighted for the bus. Now, I have a theory in this. Whenever you weight for a bus say S-12, all the bus except that would pass you. So, it is no wonder that we saw two back to back S-9s and some of the rarest buses we never get in the days of requirement. After waiting for (say,) 30 minutes, we did some calculation. Suman pointed out if we share the taxi fare among six of us, then it is almost comparable to the bus fare. We agreed and took a taxi. It is no wonder that as soon as we got inside, an S-12 passed by.
The movie was Jhoom Barabar Jhoom (first day second show). Whoever have watched the movie knows how it is. It is one of the most Codopyrine movies i have ever seen. No story, no screen play, no acting and of course, no ticket to hollywood. Believe me, it is really hard to undergo Bobby Deol in the latter half of the movie. The songs were in the same category except Bol Na Halke Halke.
But none of us could possibly think of for what I would remember the day later on. That was the first day I suspected the entry of someone else in my life.
From here the post takes an acute angle turn.
We sat side by side in the movie hall. Could I concentrate on the movie fully? When we came out (all six of us, if people wants disambiguation) it was raining. We stopped for a roll. Egg roll mixed with Calcutta rain is a kind of irresistible taste. Now one after another the copy-book cliches started happening around me. We both became deserted near the foot-over bridge near Sealdah. It started raining heavily and we found there was only one umbrella (that too a small, fragile, sealdah market special). This was the beginning of a long story.
Thursday, June 17, 2010
Creating Multiple Processes under Windows (repost)
The following code illustrates how multiple processes can be spawned run in parallel under Windows. Here Windows API is used for system calls (like fork in Linux). The compiler I used is Microsoft Visual C++ 6.0.
There are three C source files:
- Win32Process1.c for Win32Process1.exe
- Win32Process2.c for Win32Process2.exe
- Win32MulProc.c for Win32MulProc.exe
Win32Process1 & Win32Process2 are similar. They both print integers 0 onwards with a specific delay between two integers. The delay can be specified by command line. If no delay is specified in command line then they goes for default delay which is set to 500ms.
Win32MulProc creates and runs Win32Process1 & Win32Process2 as child processes. It uses CreateProcess API call. Win32MulProc also has a loop that prints integers as before with specific delay. The delays for all 3 processes can be set by command line like
> Win32MulProc 500 250 250
The three processes the main one, Win32Process1 and Win32Process2 runs simultaneously.
The main process waits until the children completes.
CODES:
| Win32Process1.c 1/27/2007 /** * Win32Process1.c * Code for Win32Process1.exe * * This is the code for the child process Win32Process1 which will be * created by parent process Win32MulProc * * Author: Joydip Datta * Date: 3:09 PM Saturday, January 27, 2007 */ #include stdio.h #include stdlib.h #include windows.h // a simple process thats counts 1 2 3 4 etc until Esc is hit // a specific delay is imposed between each count #define DEFAULT_DELAY 500 //ms int main(int argc, char * argv[]) { int delay, i, ch; printf("\nProcess Win32Process1 started...\n"); if(argc>=2) //delay specified delay = atoi(argv[1]); else //delay not specified delay = DEFAULT_DELAY; for(i=0;;i++) { if(kbhit()) if((ch=getch())==27) break; printf("Win32Process1: %d\n",i); Sleep(delay); } printf("\nProcess Win32Process1 ended...\n"); } Win32Process2.c 1/27/2007 /** * Win32Process2.c * Code for Win32Process2.exe * * This is the code for the child process Win32Process2 which will be * created by parent process Win32MulProc * * Author: Joydip Datta * Date: 3:09 PM Saturday, January 27, 2007 */ #include stdio.h #include stdlib.h #include windows.h // a simple process thats counts 1 2 3 4 etc until Esc is hit // a specific delay is imposed between each count #define DEFAULT_DELAY 500 //ms int main(int argc, char * argv[]) { int delay, i, ch; printf("\nProcess Win32Process2 started...\n"); if(argc>=2) //delay specified delay = atoi(argv[1]); else //delay not specified delay = DEFAULT_DELAY; for(i=0;;i++) { if(kbhit()) if((ch=getch())==27) break; printf("Win32Process2: %d\n",i); Sleep(delay); } printf("\nProcess Win32Process2 ended...\n"); } Win32MulProc.c 1/27/2007 /** * Win32MulProc.c * This is the parent process that calls and run two child processes * Win32Process1.exe and Win32Process2.exe * (and of course there is the main process) * (To check how Windows handles multi programming) * * Author: Joydip Datta * Date: 3:41 PM Saturday, January 27, 2007 */ #include stdio.h #include windows.h #define DEFAULT_DELAY 500 #define PROCESS1 "Win32Process1" #define PROCESS2 "Win32Process2" int main(int argc, char* argv[]) { STARTUPINFO si1,si2; PROCESS_INFORMATION pi1,pi2; int delayMain,delayP1,delayP2, i, ch; char cmd1[50],cmd2[50]; //commands for two child processes printf("\nProcess //delay calculation if(argc>=4) {//delay specified delayMain = atoi(argv[1]); delayP1 = atoi(argv[2]); delayP2 = atoi(argv[3]); } else //delay not specified delayMain = delayP1 = delayP2 = DEFAULT_DELAY; //setup commands sprintf(cmd1,"%s %d",PROCESS1,delayP1); sprintf(cmd2,"%s %d",PROCESS2,delayP2); printf("\nPreparing to open two child processes...\n"); //CREATE 1ST PROCESS //ALLOCATE MEMORY ZeroMemory(&si1,sizeof(si1)); si1.cb=sizeof(si1); ZeroMemory(&pi1,sizeof(pi1)); //create child process if(! CreateProcess(NULL, cmd1, NULL, NULL, FALSE, 0, NULL, NULL, &si1, &pi1)) { fprintf(stderr,"err: Win32Process1 creation failed"); return -1; } //CREATE 2ND PROCESS //ALLOCATE MEMORY ZeroMemory(&si2,sizeof(si2)); si2.cb=sizeof(si2); ZeroMemory(&pi2,sizeof(pi2)); //create child process if(! CreateProcess(NULL, cmd2, NULL, NULL, FALSE, 0, NULL, NULL, &si2, &pi2)) { fprintf(stderr,"err: Win32Process2 creation failed"); return -1; } //loop for main process for(i=0;;i++) { if(kbhit()) if((ch=getch())==27) break; printf("Main: %d\n",i); Sleep(delayMain); } printf("\nLoop of Process Main ended.\nBut Process Main will wait for her children...\n"); //parent will wait till child completes WaitForSingleObject(pi1.hProcess,INFINITE); printf("1st child complete\n"); WaitForSingleObject(pi2.hProcess,INFINITE); printf("2nd child complete\n"); //close handles CloseHandle(pi1.hProcess); CloseHandle(pi1.hThread); printf("\nProcess return 0; } |
References:
- Galvin
- MSDN
Joydip Datta
1/27/2007 4:41:36 PM
Creating Threads in Windows
File: Win32ThrdCreat.c
---------------------------------------
/*
MULTITHREADED C PROGRAM USING WIN32 API
CREATES A CHILD THREAD TO CARRY OUT 'thread_func' FUNC.
MAIN THREAD AND CHILD THREAD RUNS CONCUURENTLY
1/2 S DELAY IS IMPOSED IN EACH THREAD FOR DEMONSTRATION PURPOSE
Galvin p 31
Modified by: Joydip Datta
Date: 9:56 AM Thursday, December 14, 2006
*/
#include
#include
DWORD Sum=0; //shared data
//the thread runs in this separate function
DWORD WINAPI thread_function(LPVOID Param)
{
DWORD Upper = * (DWORD*) Param;
long i;
for(i= 0; i<= Upper; i++){
printf("Child Thread: %ld\n",i);
Sum+=i;
Sleep(500);//pause for 1/2 s
}
return 0;
}
int main(int argc, char * argv[])
{
DWORD ThreadId;
HANDLE ThreadHandle;
long Param,i;
//perform basic err chk
if(argc != 2){
fprintf(stderr, "An Integer parameter is requirred");
return -1;
}
Param = atoi(argv[1]);
if(Param <>
fprintf(stderr,"An Integer param >=0 is requirred");
return -1;
}
//create the thread
ThreadHandle = CreateThread(
NULL, //default security attribs
0, //default stack size
thread_function, //pointer to thread func
&Param, //parameter to Thread func
0, //default cration flags
&ThreadId//returns the thread Id
);
for(i=0;i
printf("Main Thread: %ld\n",i);
Sleep(500); //pause for 1/2 s
}
if (ThreadHandle != 0) {
//wait for the thread object to finish
WaitForSingleObject(ThreadHandle, INFINITE);
//close the thread handle
CloseHandle(ThreadHandle);
printf("Sum: %ld",Sum);
}
return 0;
}
Monday, June 14, 2010
Being mad in Mumbai rain.. Childhood returns
Tuesday, April 20, 2010
ভোর
নেশাতুর রাত আড়ামোড়া ভেঙে জেগে উঠল। প্রত্যেক জায়গার ভোরের নিজস্ব একটা গন্ধ থাকে, সেই গন্ধ নাকে এল। মনে পড়ে গেল, দেশগাঁয়ে যখন বেড়াতে যেতুম, তখন ঘুম ভাঙার পর কতকটা এমনই গন্ধ নাকে আসত। মশারি ফাঁক করে, পা-টা নামিয়ে হাওয়াই চটি খুঁজতাম আর ক্রমশঃ স্পষ্ট হয়ে জেগে ওঠা লোকজনদের কলতান।
আমাদের হস্টেল-এর ছাদে এসে দাঁড়ালে এমনিতেই মনটা ভালো হয়ে যায়। একদিকে সারি সারি ধোঁয়া ঘেরা পাহাড়; অন্যদিকে বিশাল একটা লেক। লেকের অন্যপাড়ে সদাজাগ্রত শহরের রাস্তায় গাড়ীগুলো বিন্দুর মত সরে সরে যায়। তার-ও পেছনে দেখা যায় বিমানের ওঠানামা। সামনের দিকে আছে লেক এর চড়া আর তার-ও পেছনে জনপদ। ঝাঁ-চকচকে শহরের সাথে তার পার্থক্য চোখে পড়ার মত। সেই পার্থক্য কেন জানি না, বারবার আমার পাড়াগাঁ-এর কথা মনে পড়িয়ে দেয়।
পাখির আনাগোনা শুরু হয় আস্তে আস্তে। হস্টেলের ঘুলঘুলি থেকে পায়রাগুলো বেরিয়ে পড়ে। কোকিল আর কাক ডাকতে শুরু করে এক-ই সাথে। মাটিতে শালিখ চরে বেড়ায়। টিভির তারে বসে ফিঙে লেজ দোলায়। দোয়েলরা গল্প করে। দূরে লেকের চরে বসে থাকা বকগুলিকে মনে হয় ছড়িয়ে থাকা সাদা পালক। লেকের উলটোদিকে আছে একটি পাঁচতারা হোটেল।তার সবকটা ঘরেই নীল পর্দা। সেগুলি একইরকম থাকে। কতকগুলি গরু চরতে আসে লেকের চরে। বকগুলি ঘিরে ধরে তাদের। কুকুরগুলো খামোখা মস্করা করে গরুগুলিকে তাড়িয়ে বেড়ায়।সামনে আমার প্রিয় জনপদে শুরু হয় মানুষের আনাগোনা।
ক্রমশঃ রোদ বাড়ে, আমি ফিরে এসে ঘুমোতে যাই।
Sunday, April 11, 2010
Retrograde and Anterograde Amnesia
In retrograde amnesia, the subject (that's me) is unable to recall events that occurred before the development of amnesia. The reason in my case was a mild head injury and shock. And I forgot the event of falling down altogether. According to Ribot's Law, there is a time-gradient in retrograde amnesia. Recent memories are more likely to be lost than the more remote memories. So, I lost the last 5-6 seconds before the head injure completely although I was able to remember the events before that gradually within a short time. For the first few hours it seemed that the time (2-3 hours) was a dream. But as people informed me the events that happened in that period, I gradually recollected some of the events (except for the 5 seconds period).
In anterograde amnesia, the subject loses the ability to create memory. There are two types of memory in human brain. One is short-term memory which is used for immediate processing and one is long-term memory which is used as a permanent storage for later retrieval. In anterograde amnesia, the process of writing from short term memory to long term memory is affected. I don't remember what happened during the 30 minute period after the injury. People said, I handed over my bi-cycle to Omair, came back to my room walking, asked my friend for Dettol, called my girlfriend once, took the bicycle keys back from Omair etc. But I don't remember these things at all. In most cases (including mine) subjects loss declarative memory (recollection of facts) and not procedural memory (how to do things).
References
- http://en.wikipedia.org/wiki/Retrograde_amnesia
- http://en.wikipedia.org/wiki/Ribot%27s_Law
- http://en.wikipedia.org/wiki/Anterograde_amnesia
Tuesday, April 06, 2010
Sealdah Episode
Do you still remember that guy standing in the entrance of Sealdah-north and weeping? Yeah, he was one of the boys who among the rare breed of men who cry. To make the matter worse he cried before his girlfriend. He was not weak (nobody admits himself weak). The thing was that his girlfriend was only person before whom who could cry, speak his heart out, and talk freely. He rarely shared anything with people. His girlfriend was the only person before whom he could be free.
He was tense. He was going to give one of the most important exams of his life in two days. It’s the exam for which he abandoned everything else. It’s the exam for which he sacrificed everything. He doomed in the other areas any way… or the IT scenario during recession was like that, everybody was dooming. Doing something in that exam was his only chance. Every other hope was already gone.
He didn’t know then that the exam would change his life so much and will take him thousands of kilometers away from where he used to be, from where he used to meet her, from the very Sealdah station where they said good bye to each other. It was most of the times the boy first said that they should leave. The boy was like this only. Always confused and prioritizing stuffs and never putting importance on what he actually wanted to do. The girl became sad and then became used to it.
That day the boy was not leaving. He was weeping and weeping. He was venting his heart out… he could not take the pressure any more. He needed to do something decisive in those three hours of exam. The girl was consoling and trying to make him understand like a mother talks with her child. Slowly the boy got back power. The exam was not that bad. He was prepared enough to face it. He prepared the best way he could and that was the best he could do. The girl could not give him a hug as they were standing in one of the busiest station in the world. But her eyes told everything. It talked about how deeply she loved the boy and how surely she believed in the love of the boy for her.
Thursday, February 18, 2010
I have Just Completed Alchemist
Sunday, February 14, 2010
Friday, January 29, 2010
Gloomy Evening Sets In
You should have done this, done that...
Sunday, January 24, 2010
John Denver -- Leaving On a Jet Plane
All my bags are packed I'm ready to go
I'm standin' here outside your door
I hate to wake you up to say goodbye
But the dawn is breakin' it's early morn
The taxi's waitin' he's blowin' his horn
Already I'm so lonesome I could die
So kiss me and smile for me
Tell me that you'll wait for me
Hold me like you'll never let me go
Cause I'm leavin' on a jet plane
Don't know when I'll be back again
Oh babe, I hate to go
There's so many times I've let you down
So many times I've played around
I tell you now, they don't mean a thing
Every place I go, I'll think of you
Every song I sing, I'll sing for you
When I come back, I'll bring your wedding ring
So kiss me and smile for me
Tell me that you'll wait for me
Hold me like you'll never let me go
Cause I'm leavin' on a jet plane
Don't know when I'll be back again
Oh babe, I hate to go
Guitar Solo
Now the time has come to leave you
One more time let me kiss you
Close your eyes I'll be on my way
Dream about the days to come
When I won't have to leave alone
About the times, I won't have to say
So kiss me and smile for me
Tell me that you'll wait for me
Hold me like you'll never let me go
Cause I'm leavin' on a jet plane
Don't know when I'll be back again
Oh baby, I hate to go
Cause I'm leavin' on a jet plane
Don't know when I'll be back again
Oh babe, I hate to go
Thursday, January 21, 2010
Monday, January 18, 2010
শ্রীজাতের লেখা
আমার যা গেছে গেছে, বাকিদের আরও ক্ষতি হোক।
হাত মেলাতে এসে তারা অভিশাপ খেলে যায় টাচ-এ
রোগ তো, ছোঁয়াচে।
আমার আর কী ক্ষতি হবে, ঘরে নাই হিরে-জহরত
কানে তুলো, চোখে ঠুলি, হাতে-পায়ে বেড়ি, নাকে খত
সবই তো কমপ্লিট হল। ক্ষতি বলতে লাভে হারব গেম
একটা প্রেম ছেড়ে দিয়ে জংশনে দাঁড়িয়ে আছি। লেট করছে পরবর্তী প্রেম।
দুঃসময় বন্ধু ছিল, তাই আমার ভাল না সময়
উপায় থাকে না কোনও। ভালবাসলে ভালবাসতে হয়।
Thursday, January 07, 2010
Yet Another Fiction - issue 2
Shreyasee and Rahul were two students of same college. Even they shared the same department. But they didn’t quite know each other as they had different friend circles and Rahul, being an introvert, didn’t often talk with people other than his close friends. But some complex circumstances brought them together as Rahul changed his friend-group and joined the group in which Shreya belonged. Quickly than expected they became very good friends.
On the very day when Shreya was crying in the corner of the college roof and Rahul was consoling her, Rahul also shared some of his deepest secrets that nobody knew about. The secret that Rahul always feared of getting leaked, the secret which tells why Rahul changed the friend-circle, the one and only secret of Rahul’s life, he shared with Shreya. This way by sharing secrets and crying their heart out, they became really good friends, possibly the best friends of each other. They chatted until evening that day. And when they came out from the college, street lamps at the roads were lit.
From now they could be seen in different places in different times sitting together and chatting with each other. As expected, rumours started spreading. Rahul never thought he could be the topic of discussion anywhere. He never imagined that anybody could actually talk about him in his absence. He had a habit of underestimating himself. So, he was quite enjoying the new situation.
“Do you know, people are talking about us?” – said Shreya as they just got out of the college in one afternoon.
“Are they?” said Rahul as if he didn’t know anything.
“Yes, they are.” Shreya continued, “Do you think we should break their misunderstanding?”
Is this an indication that at last love is coming to Rahul formally? Whatever Shreya said just now seemed like an acceptance guarantee to Rahul. Otherwise Shreya wouldn’t have asked Rahul, she would have told her to just break the misunderstanding. Now, this is a grab-it-or-lose-it situation for Rahul. Rahul must react now... else, he’d lose again. What Rahul needed to do now was just propose her. But being an introvert, this was never easy for him. Rahul got nervous and quickly took an auto and left.
Wednesday, December 23, 2009
Another Fiction
- 1 -
Sadness, when not shared, often becomes like a rock. Sadness, when shared, the rock slowly melts in the form of teardrops. And when such a teardrop fell on the bench making her cheek wet, it’s the beginning of our story.
“Should I wipe the teardrop off from the table?” Rahul said to himself. Will give any kind of message? Rahul was hesitating as he always does. He was hesitating over whether he should give any kind of message or not.
She continued talking. After a while, at last, Rahul wiped the teardrop from the bench. He actually wanted to wipe her cheek, but he thought at this stage, it would be too outrageous.
“Let’s go outside... in the roof. There is no use of talking these matters in the classroom” said Rahul. Crying in the classroom with all other friends looking at you can never be a good idea. And being alone with the girl you like while she shares saddest part of her life made Rahul little bit proud of himself. First time in life, somebody have thought Rahul important enough to tell him all these. People generally do not think Rahul significant enough to talk or share. This incident was really boosting Rahul’s ego.
There was a corner in the college rooftop beside the water tank. If one sits there, no one can spot him (except for some unlikely people roaming in the bushes in the ground far below.) The corner used to give necessary privacy to the lovebirds of the college. Rahul’s heartbeat was pumping as he sat in such a corner with the girl she likes and the girl sharing deepest secrets of her life. Rahul thought that maybe he is not that much insignificant he thinks himself to be. This boosted Rahul much and finally he gathered all the courage to wipe the teardrop off Shreyasee’s cheek.
Friday, December 11, 2009
Rahman - 5th issue
First Issue: Click Here (This issue combines all prior issues)
Second Issue: Click Here
Third Issue: Click Here
Fourth Issue: Click Here
Rahman and Ziah was walking together through a narrow walking path in a not-too-dense forest. Then Ziah asked Rahman, “Tell me your story? How come you get here?... Ok, wait a second. I’m too tired to walk anymore. Let’s sit under this banyan tree and tal
k”
Rahman told his full story to Ziah. How his father died at his age of six, what hardships his mother faced while bringing him up and how she too succumbed to the hardships of the world and died when he was fifteen. How Sadhan uncle ill-treated him in every possible occasion, and finally he started walking the path. How he met the dying old woman and how he got the coin and how he met the first stop people who told him that he was in a sacred journey.
“So you actually didn’t have any choice. In whatever position you are now, you weren’t any better off at Sadhan’s.”, said Ziah.
Now that’s it. Rahman knew that what Ziah was saying was correct. But getting a certificate on how bad you are from an other person doesn’t always feel good. Yet Rahman kept his mum. It is because of this soft-spoken nature of his character every other person gets successful in pushing him.
Ziah continued, “My case is totally different although. I never had any problem regarding money. My dad runs a big grocery store in the main market where I live. I used to get more money than I actually needed.”
“Then why did you left your home?” asked an astonished Rahman.
“Why wouldn’t I? should I stay at home just to have the crap study and give the crap exam? Life was so boring. So I left home. Failing in the exam worked as a catalyst although.”, Ziah said with curving her lips in a peculiar way.
“So you left home just because you failed in an exam?”
“Oh… not for that damn exam yaar… I told you, it only worked as a catalyst. I left home because there was no charm in my life. Life was so clumsy, so unexciting. Tell me one thing. What’s point in living that way? If you live that way, do things you do not like and do the same things day after day, year after year, you are not actually living. You are just waiting for death.”
“I think you should get back to your parents.”, said Rahman.
“No way. If I get back now they will surely lock me up in a room and make my life more miserable. Plus they will make me married as soon as possible. Dad had already started the talks with the son of the owner of the main market, who is a criminal by profession.”
Ziah paused for a second or two. Then continued, “Don’t worry! I will surely get back to my parents. There is no doubt in that. But first let me find out the charms of life. Let me continue my journey as a sacred walker. We are among the chosen few, remember?”
“Chosen few? You mean there are more that just me and you?”
“Of courses there are. But I am not very sure how many of them are still alive. The path is really dangerous.
“That is why I will again tell you to go back to your parents.”
Ziah got furious at this. She shouted, “I have already decided what to do. I have made it very clear that I am not gonna get back until I finish the sacred path. And by the way, you are no one to advise me. And if you keep nagging me any further I will forget about the alliance and go on my own.”
Rahman did not push her any more on this. Not because he cared for the alliance but because he knew how stubborn the girl is and he didn’t want to let her face the path alone. I must be there with her all the way, Rahman thought.
“what happened after you left home?” asked Rahman.
“that is in itself a history. I will tell you some other day. Everything was fine till my pocket money lasted. but as the money was nearing it’s end, I gradually becoming hard to cope up you know. But you see, you have to face hardship in achieving anything great”, Ziah said as if she had a lot of experience regarding life.
Ziah continued, “One day as I was sitting in a park, I noticed that a coin fell in the grass from the bowl of a blind beggar. I picked them up but as I was going to give that back to the beggar, he was gone. I searched the whole park but he was nowhere. There was something unusual about the coin as you must know. It was the fucking direction coin for God’s sake.
“How did you lost your coin?” asked Rahman. It is because of this Ziah and Rahman was together. Ziah lost her direction coin somehow in the path. On the other hand Rahman lacked information. This made them natural partners in the journey.
“It fell in the river. It was in my hand while I was crossing the river through the bamboo pool. It just fell from my hand and sank in the river.”
“You should not be that much careless” said Rahman.
“See, whatever gone is gone. There is no point in mourning over and over on the same point. Look, I can not carry on without the coin. You too can not carry on because you are a know-nothing-looser and you are by character so dumb. So it makes sense if we carry on together. And for that do not piss me off in such a way that I have to carry on alone.”
Somebody please teach this girl how to talk properly! Thought Rahman.
