Search within this blog

Sunday, March 20, 2011

রাঙিয়ে দিয়ে যাও

রাঙিয়ে দিয়ে যাও যাও যাও গো এবার যাবার আগে--
তোমার আপন রাগে, তোমার গোপন রাগে,
তোমার তরুণ হাসির অরুণ রাগে
অশ্রুজলের করুণ রাগে॥
রঙ যেন মোর মর্মে লাগে, আমার সকল কর্মে লাগে,
সন্ধ্যাদীপের আগায় লাগে, গভীর রাতের জাগায় লাগে॥
যাবার আগে যাও গো আমায় জাগিয়ে দিয়ে,
রক্তে তোমার চরণ-দোলা লাগিয়ে দিয়ে।
আঁধার নিশার বক্ষে যেমন তারা জাগে,
পাষাণগুহার কক্ষে নিঝর-ধারা জাগে,
মেঘের বুকে যেমন মেঘের মন্দ্র জাগে,
বিশ্ব-নাচের কেন্দ্রে যেমন ছন্দ জাগে,
তেমনি আমায় দোল দিয়ে যাও যাবার পথে আগিয়ে দিয়ে,
কাঁদন-বাঁধন ভাগিয়ে দিয়ে॥
বিচিত্র > ১৬

Friday, March 18, 2011

রাঙিয়ে দিয়ে যাও - ১

আজ আমাদের ন্যাড়াপোড়া
কাল আমাদের দোল
পুন্নিমাতে চাঁদ উঠেছে
বল্লোও হরিবোল

Sunday, March 13, 2011

One More Time, One More Chance

Yesterday night I saw a Japanese movie called "Five Centimeters per Second". It is a chain of short stories about two people in love but separated by distance. Really nice and touching piece of animation. I strongly recommend that you see it.

At the end, it had a song named "One More Time, One More Chance". This is a single from Japanese singer Masayoshi Yamazaki. I could not help reposting the lyrics in my blog post.


What else need I lose, before my heart will be forgiven?
What pain need I feel, before I can see you again?
One more time--I don't want the season to change
One more time--That time we spent joking together

I'm always searching, watching for a glimpse of you
On the opposite platform, in alleyway windows
Not that I could hope to find you there
If I could have any wish I would be with you now
There's nothing left that I won't do
I'd give everything just to hold you again

Anyone would do if I just wanted
To hold back my loneliness
But on a night like this
When the stars themselves seem like they might fall
I can't fool myself
One more time--I don't want the season to change
One more time--That time we spent joking together

I'm always searching, watching for your face
At intersections, in my dreams
Not that I could hope to find you there
Granted a miracle, I'd want to show you
A new morning, the person that I'm becoming
I'd finally tell you that I love you

I'm lost in memories of summer,
A pulse that fades to nothing

I'm always searching, watching for a glimpse of you
In the city at dawn, in Sakuragi-cho
Not that you would ever come here
There's nothing left that I won't do
I'd give everything I have just to hold you again

I'm always searching, watching for some part of you
In shops when I travel, in newspaper stories
Not that I could hope to find you there
Granted a miracle, I'd want to show you
A new morning, the person that I'm becoming
I'd finally tell you that I love you

I'm always searching, watching for your smile
At train crossings, waiting for the express to pass
Not that I could hope to find you there
If I could live over and over again, I would always go back to you
The most important thing of all
=================

Here is the version directly from the movie 5 centimeters per second.



Lyrics copied from: http://goo.gl/AWT8D

Thursday, March 10, 2011

Help With Care - a 60 Seconds UNCUT Movie (and the making of it)

For the annual post graduate cultural competition, PGCult2011, we prepared a 60 seconds uncut movie. Ok first let us see the movie, then we will talk about it.


The video had to be a single shot of no more than 60 seconds. No editing was allowed in between. Not even adding a sound track.

The shooting spot was beside the main road out side IIT Campus. We had a real shooting experience while filming the shot. It was just like what is portrayed in television or films when they show shooting. People were gathering all around us. We had to create a barricade so that they don't come inside the frame. People were really very helpful to us. We were really taken aback by the enthusiasm they showed. We have to say them a big thank you. Thank you all.

We had to face some real movie making constraints on the spot. Like, we can not film a BEST bus without prior permission. We can not show the child getting the cigarette from a cigarette shop because selling cigarette to a minor is illegal. We had to do minor changes in the plot on the spot. That is why a tire shop sells cigarette in our movie.

Let us give the credits here. Our hero, Nilesh was a local boy and performed really well. DamC and Victor gave him full support. The main idea was from DamC which was further enhanced by Victor and others. Abhirup did a great job behind camera; just like a professional. Me, Debarghya, Gourab, Parmod did some plot refinements and crowd management. Here is a 14 seconds making-of video that shows us in action.

It was really an experience we can not forget. At the end when we were taking snaps with the people gathered there, we got touched by life. Without those pictures, this blog will be incomplete.


This is us with all the kids in the locality. But the cameraman Abhirup is missing...




Abhirup joins us in this snap.


Happy moments.


Me with the actors and our hero.

Monday, February 28, 2011

Crossing the pipes

If you come up to the terrace of our hostel and look towards north, the first thing you will notice is a series of five parallel pipes. Those pipes lie just beside the wired fence of our hostel. Huge in size, those sky blue colored pipes carry water from Vihar lake and supply that to a huge portion of Mumbai population. Just behind those pipes there is this lively locality called Chancawalli.

Yes, it is the same place that reminded me of my hometown long ago. It is the same place where band parties practice each evening. It is the same place we visited for the Urus Festival. Although this place is just behind our hostel, to reach there the formal way is all the way around Powai lake. Why can't we just go there directly?

May be we can. Five of us started investigating. Finally we entered the beautifully kept and protected lawn of our hostel through a secret side passage. In a shabby and dark corner of this lavish green lawn there was the rabbit hole. We crept in.

And one by one, we were out. It was 6:30 in the evening. Fishermen in the Powai lake were packing up with fresh fishes in their collection. There was a narrow walking path running side by side insti fence. We went ahead. In five minutes we reached the pipes.

The pipes were huge; as tall as me. How to climb? We started walking forward. Then someone found the ladder to reach a manhole. We climbed up and started walking on the pipes towards Bhandup. I had seen localities jump from one pipe to another at ease. But for us it was unimaginable. Pipes were round and if by chance you slip, something or other in your body will break.

Night was falling in. Some part of our mind was telling us to go go back. We had heard people talking about this place. They say this is not a very safe place to be at night. All types of crimes are abundant. Although we saw no evidence, if someone kills you and throws between two pipes, nobody will find your body before next morning. Besides, we could not find any way to cross the pipes. And towards front as well as towards back, the pipes were endless. We came down at the next manhole.

But there was a portion of our brain, that kept telling us to move on and we did not stop. And after 10 minutes or so, we found a platform and a ladder. We went up and found that the platform joins the three of the pipes. But the fourth one had to be crossed some other way. Between the fourth and the fifth pipe, there is pipeline road. And I had seen an underpass to cross the fifth one. Hence, our final hurdle was this fourth pipe. We reached the third pipe using the platform and then again started going forward until we found a ladder in the fourth one. We dropped down and one by one climbed the ladder. Finally we were in the pipeline road. It was 8:00 pm in the night. And it was still not a safe place to be. We had decided not to go back in the same route. Hence the only way forward was through the pipeline road towards Renaissance Hotel.


The pipeline road ends near the entrance of NITIE. And there is a check post of Mumbai Corporation there. Should we really be here. We must have better excuses. Thankfully they did not ask anything from us. Finally we reached the spot of the Urus Festival, by foot.

And our journey continued. This time we took the road (public road this time) beside NITIE hostels and then Vihar Lake Road. When we looked down, we could see the locality beside Aarey Powai Road. Then we reached the bus depot. Just after the Bus Depot, there is the entrance of Vihar Lake.

Did we reach Vihar Lake? Wow! We could not believe this. But sadly enough, the entry to the park was restricted by the Mumbai Corporation. After all Vihar Lake supplies drinking water to a large portion of Mumbai. The guard stopped us. But we kept requesting. I don't know what worked finally, but after a lot of persuasion he allowed us to go inside on condition that we will not go beyond his eyesight.

Then we came face to face with the vast beauty. Vihar Lake at night. Deep jungles of Sanjay Gandhi National Park were in the opposite side. Evening breeze was curving patterns in the dark water. We stood still in the mesmerizing vastness for a long time. On the other side of where we were standing, there was a cliff and below there was jungle. Deep jungle.

We took a bus from the depot to come back.


Disclaimer: Although the places mentioned in this post is real, the event not necessarily. Trying to correlate this post with reality is simply a waste of time.

Sunday, February 20, 2011

Mirch - Movie review


While writing the review of this latest movie by Vinay Shukla, one word that comes in my mind first is: “weird”. This movie is really weird. It's a collection of four short stories that are loosely connected by a wannabe director who narrates his script to a probable producer and how they can identify themselves within the story. All the four stories share a common theme. It's about how women can fool men if they want and how they can cheat with the man knowing nothing. Well its woman who cheats in this movie and at times their tricks catches the Z-level. All the stories are simple yet catchy. Although at times the men look like more fool than they really are.

There are plenty of talented actors scattered in this movie. Rajpal Jadav, Prem Chopra, Shreyas Talpade, Boman Irani, Konkona Sensharma all are great. Especially Konkona and Boman – you look stupendous on screen. Really. And of course Sahana! Sahana Goswami is really a talented actress. Although I liked her performance in Rock On more, she really needs a mention here. Arunodoy Sing tries to act, but when compared to others, he performs rather badly. But the most charming performance was definitely by Illa Arun. Wow.... I love her accent.



Pitobash Tripathy can be seen in many key roles in this movie. I have to say, this man is going to create his own genre of acting in Hindi Cinema. He is in all the four short stories here and also in the outside connecting story. In the first one he is the friend of Rajpal Yadav, second story makes him the prime servant of the king, in the third one he actually plays himself: Pitobash and in the fourth one he is the room service person. For those who does not know, Pitobash Da is an engineer and we studied in the same college. He is three years senior to me. Wow... it does make me proud.

The editing of this movie did not look impressive to me. The sequences between the films (the outside/ connecting story) is often too long and boring. In fact, the connecting story only annoys ourself except one scene near the end of the film. I think it would be far better if the film would be presented as just a sequence of four stories. The outside story only bored me.

The music is far from being impressive. The lyrics written by Javed Akhtar Ji failed to put a dent on me probably because of the music. It's the same Kamasutra type music. Just bored me.

I would rate the movie in the bucket of Above Average or a BB. This translates to a 8 out of 10. It is definitely not in the league of Life in a Metro, Veja Fry, Rang De Basanti, Taare Zameen Par etc which the movie itself mentions. But it's not too bad either. At least this one is... what's the word... Hatke.

Monday, February 14, 2011

Eatables, Drinkables etc.

This post is more like a teaser. A log. Or an index. Don't be confused.. I wrote this post because I was bored and had to kill some time. Do expect some weird grammar here...

After the Urus mela at Chansawalli, we went to Mahabaleswar. Cameras were unable to catch the beauty hence I am skipping the pics this time. But the trip was awesome (especially the chorus in the whole night bus travel energized with some doses of WM). The initialization of the next day was blocked for a while because the other group were taking bath. Can u imagine! They can not even skip it once. Contrast this with us. We skip bathing out of no reason. For example, I skipped bath today. The corn butter, the ice-gola were among the other things that are hard to forget. And did I forget to mention the STRAWBERRIES???

Then came Saraswati puja. To summerize, mesmerizing environment, a good cultural program, great Bengali food for two days and one visit to Sunny (BP this time, two stipends in one month has some externally observable signals).

Today is, well, so called St. Valentines day (who cares... real people can make each day one). Yesterday we had a full chicken dinner at Nirmal Lifestyle mall. Literally, a chicken dinner.

Thursday, January 27, 2011

Urus Mela at Chancawalli

Urus (Urs) fesitval is presently going on at the Chand Shah Wali Baba Dargah at Chancawalli, Mumbai. Yes, it is the same Mela that can be seen just behind our hostel. The sounds of bollywood songs, dholaks and motorcycle stunts echo in the corridors each night. Two days ago we decided to visit there.

Although the Mela is within 500m Euclidean distance from our hostel, that direction is blocked by a pretty high barbed wire fence. Hence, we had to take the only route through the Main Gate and then surrounding the Powai lake. It took us 45 mins in Mumbai Jam and 50 rupees auto fare to reach the site.

And then we saw it. An extravaganza of life. Extraordinarily vivid and living gathering of thousands of people. Yes, the mela was big enough. With balloons to Motorcycle Stunts to roller-coasters and foods. The rates were cheap and fun was affordable. It took me back 10 years when small things in life gave me tremendous happiness. We shot at little balloons, rode a roller-coaster, tested our gambling fate with ring throwing (and we won Rs. 100 cash!). The mela looked a lot like the mela's I used to see in my childhood days.

Except of course, the food. Most of the food items I didn't even saw previously. We tested halwa-paratha where the parathas are 2 feet in diameter. We had greasy-spicy chicken roll dipped in pudina chutney.

Near the end of the Mela there was Chand Shah Wali Baba Dargah. In the adjoining ground Qawali performance was going on. This is the first time I saw any live Qawali performance.

People say pictures are worth thousands of words. Hence I will talk no more. Instead, let me present some of the moments of the gathering. Pictures are taken by my friends (Abhirup, Victor and me)

People and life -->



We rode this one -->



Roller-coasters -->



Little Balloons for shooting practice -->



One of the numerous food stalls -->



Colors and more colors -->



Chicken roll dipped in pudina chutney -->



The roll and moghlai shop -->



Halwa-parathas.. note the size of the parathas -->



And the decoration and colors of the halwa -->



The Qawali singers at the Dargah ground



These are we -->

Sunday, January 16, 2011

DSpace at West Bengal State Central Library -- Digital Library for Bengali Books

I recently came across:
http://dspace.wbpublibnet.gov.in/

This website contains catalog of numerous books in the public libraries in West Bengal. Many books that are obsolete now, or hard to get hands on, are there. But the most interesting part is: this website stores the SCANNED E-Book versions of the books that are freely downloadable. The website is also easily navigable.

I browsed the History section. This section contains more than 450 books on History specially History of Bengal. The other sections are also pretty rich.

Thursday, January 13, 2011

আমি মারের সাগর পাড়ী দেব

This song is the most motivating song that I heard recently, thanks to the serial Ganer Opare. I cannot suppress the urge of making another post on this song.

This songs talk about how the limited I will try and to reach the perfect I through the sea of hardship. The limited I have no fear now. The perfect I is separated from the limited I by a sea of hardship. The limited is determined to cross the sea with his limited resources because at the other side of the sea there is peace, there is solace. That is, when the limited I will cross the sea of hardship and reach the other end, he will be united with the perfect I. He will be perfect and will have peace. In the journey, the limited I is sure God will help him. All he needs to do is keep the journey on; fearlessly. When the day will end, the limited I knows, he will reach the shore. The days of hardship will be the offerings at the kind feet of the Godhead.

Bengali:
---------

আমি মারের সাগর পাড়ি দেব বিষম ঝড়ের বায়ে
আমার ভয়ভাঙা এই নায়ে ॥
মাভৈঃ বাণীর ভরসা নিয়ে ছেঁড়া পালে বুক ফুলিয়ে
তোমার ওই পারেতেই যাবে তরী ছায়াবটের ছায়ে ॥
পথ আমারে সেই দেখাবে যে আমারে চায়--
আমি অভয় মনে ছাড়ব তরী, এই শুধু মোর দায়।
দিন ফুরালে, জানি জানি, পৌঁছে ঘাটে দেব আনি
আমার দুঃখদিনের রক্তকমল তোমার করুণ পায়ে ॥

- রবীন্দ্রনাথ ঠাকুর

পূজা, ১৯৯

Ganer Opare version from youtube:



Movie Review: V for Vendetta


When the end credit was rolling, I was wondering who might be behind this amazing motion picture. And then the names came. This kind of awesome screenplay can only be expected from Wachowsky Bros.

Behind every good movie there must be a great storyline. I have to say the story is powerful here. The movie is set in a future UK. America has fallen and UK is under the dictatorship of Sutler (John Hurt). A masked man suddenly appears and blasts off Old Bailey and threatens to demolish the parliament in exactly one year’s time. The government calls the masked man terrorist and tries to nab him but their attempts fail. In the process the masked man abducts a BTN television worker. I would not like to reveal anymore. Be sure, once started you would not be able to stop the movie.

This movie also has a clear message. In the fight of terrorism, how much are we ready to give up? We have already given up much of our privacy and freedom. We do not complain when we are checked again and again under metal detectors. We do not complain when random security guards check our body before entering any damn shopping mall. We do not complain when we are always being watched under n number of surveillance cameras. We do not complain when we are not allowed to even read certain types of literatures. Even in order to criticize Extreme Red don’t you need to first read it? What would we do, if in the name of national security the government wants to install cameras in the bedrooms also? What if the government wants total compliance in return of complete security? What is better? Anarchy or dictatorship and tyranny?

The end scroll of credits too has the impression of Wachowsky Bros. The music track is a nicely mixed composition of Dholaks, Pardesi-Pardesi and Churake dil mera; truly Wachowsky signature.





Image copied from MediaWiki foundation and is as per the Non-free media use rationale of Wikipedia.

Wednesday, January 12, 2011

হে ভৈরব শক্তি দাও

This RNT song is one of the most motivational songs for me. In this song, the poet prays God to remove everything small in him. Every small, unworthy stuffs must be removed to make space for the grand.

A few months ago I heard the instrumental version of this song. Then I searched a lot in the web but could not get it. Then suddenly I got it one day from my DVD collection. The song starts with "সর্ব খর্বতারে দহে তব ক্রোধদাহ"

Lyrics:
--------
সর্ব খর্বতারে দহে তব ক্রোধদাহ-
হে ভৈরব, শক্তি দাও, ভক্ত-পানে চাহো ।।
দূর কর মহারুদ্র যাহা মুগ্ধ, যাহা ক্ষুদ্র-
মৃত্যুরে করিবে তুচ্ছ প্রাণের উত্সাহ ।।
দুঃখের মন্থনবেগে উঠিবে অমৃত,
শঙ্কা হতে রক্ষা পাবে যারা মৃত্যুভীত ।
তব দীপ্ত রৌদ্র তেজে নির্ঝরিয়া গলিবে যে
প্রস্তর শৃঙ্খলোমুক্ত ত্যাগের প্রবাহ ।।

Tuesday, August 31, 2010

I got a strange spam today


Today, just a few minutest ago, I got this mail in my CSE inbox.



Obviously this is a spam. But something else made me curious. This mail says I need to contact someone called Frank. What is more interesting is, just the previous day, I was Googling a lot about FRank, a learning based ranking algorithm. Is this mere coincidence or there is something else?

Friday, August 27, 2010

Full day break

Today I got an unexpected off day. Early in the morning my phone rang. I woke up, talked sweet for some time and then went to sleep again. Like all the other people in nearby rooms, I have caught cold too. So, going to sleep did not seemed to be an bad idea. I turned the alarm clock off... I was close to the alarm time anyway so I became over confident.

Overconfidence never pays. When I woke up again it was 10:55. I had a lecture from 11:00. At that point of time, I had two options:
  1. Abandon all natural things you do when you wake up and RUSH to the school
  2. Be natural! and abandon the lecture
Obviously I choose the second option. With toothbrush in my mouth I awakened up my computer. There was one email from another Prof. that audit people need not attend the afternoon quiz.

Voila!!! I had a full day break.

Tuesday, August 24, 2010

Setting up PHP within Apache Tomcat

PHP by default comes with Apache web server. But when we tried using PHP at our server we faced problem. The reason was we already use Apache Tomcat and Tomcat already uses port 80.

We needed to install PHP within Tomcat. We needed one additional software: PHP Java Bridge for that.

We were lucky to see one nice tutorial on the web. It almost spoon-feeds.

Tuesday, June 29, 2010

First day Second Show

From here let me take you one month back. After a tedious end semester examination we all were tired. In engineering end semesters are always tedious, as you hardly study throughout the semester and the whole load concentrates. So on the day of the last exam we decided to hang out.

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:

  1. Win32Process1.c for Win32Process1.exe
  2. Win32Process2.c for Win32Process2.exe
  3. 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 Main started...\n");

//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 Main ended...\n");

return 0;

}

References:

- Galvin

- MSDN

Joydip Datta
1/27/2007 4:41:36 PM

Creating Threads in Windows

Like process you can also create threads in windows at ease. The thing is similar to pthread_create in Linux. This code is mostly taken from Galvin. You use the CreateThread API call and pass the thread function to it. The following code illustrates this. The code is taken from Silberschatz, Galvin, Gagne: Operating System Concepts, 7th Edition: Figure 4.7. But the code was not working for some reason, so, i made a few changes and post it here. The changes are in bold. I also added a few comments to describe the code more elaborately.

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

I was inside lab. My lab doesn't have a window. So, I had no idea about what was going on outside. I came out and saw the earth getting soaked under Mumbai rain. I wrapped my pen, copy, earphone and mobile in a polythene bag, took my bi-cycle and went outside. Rolling through the slippery downhill road, I felt the raindrops all over my face, washing away the salts. Within a few moments I was all drenched. The rain is so heavy in Mumbai, that you can not even see objects that are meters away. While coming down I saw images of my childhood floating around me. The days when I intentionally kept the umbrella at bag. The days when I preferred cycling through those portions of the road where there were water standing. The childish joy while pushing myself through the waterlogged roads. Sometimes ice-stones fell during nor' westers. I remembered how I ran in the rooftop of my house to pick them up. I used to put some of them in my mouth when my mom was not watching.

Tuesday, April 20, 2010

ভোর

এখানে আসার পর থেকে ভোর হতে খুব কম-ই দেখেছি। ঘুমোতে যাওয়ার সময় ক্রমঃশঃ গভীর থেকে গভীরতর রাতের দিকে সরতে থাকে আর সেই সঙ্গে পিছোতে থাকে ঘুম ভাঙার সময়। এইভাবে পিছোতে পিছোতে যখন ঘুমোতে যাওয়ার সময় ৬:৩০ পার করল, আমি এখানে ভোর হওয়া দেখলাম।

নেশাতুর রাত আড়ামোড়া ভেঙে জেগে উঠল। প্রত্যেক জায়গার ভোরের নিজস্ব একটা গন্ধ থাকে, সেই গন্ধ নাকে এল। মনে পড়ে গেল, দেশগাঁয়ে যখন বেড়াতে যেতুম, তখন ঘুম ভাঙার পর কতকটা এমনই গন্ধ নাকে আসত। মশারি ফাঁক করে, পা-টা নামিয়ে হাওয়াই চটি খুঁজতাম আর ক্রমশঃ স্পষ্ট হয়ে জেগে ওঠা লোকজনদের কলতান।

আমাদের হস্টেল-এর ছাদে এসে দাঁড়ালে এমনিতেই মনটা ভালো হয়ে যায়। একদিকে সারি সারি ধোঁয়া ঘেরা পাহাড়; অন্যদিকে বিশাল একটা লেক। লেকের অন্যপাড়ে সদাজাগ্রত শহরের রাস্তায় গাড়ীগুলো বিন্দুর মত সরে সরে যায়। তার-ও পেছনে দেখা যায় বিমানের ওঠানামা। সামনের দিকে আছে লেক এর চড়া আর তার-ও পেছনে জনপদ। ঝাঁ-চকচকে শহরের সাথে তার পার্থক্য চোখে পড়ার মত। সেই পার্থক্য কেন জানি না, বারবার আমার পাড়াগাঁ-এর কথা মনে পড়িয়ে দেয়।

পাখির আনাগোনা শুরু হয় আস্তে আস্তে। হস্টেলের ঘুলঘুলি থেকে পায়রাগুলো বেরিয়ে পড়ে। কোকিল আর কাক ডাকতে শুরু করে এক-ই সাথে। মাটিতে শালিখ চরে বেড়ায়। টিভির তারে বসে ফিঙে লেজ দোলায়। দোয়েলরা গল্প করে। দূরে লেকের চরে বসে থাকা বকগুলিকে মনে হয় ছড়িয়ে থাকা সাদা পালক। লেকের উলটোদিকে আছে একটি পাঁচতারা হোটেল।তার সবকটা ঘরেই নীল পর্দা। সেগুলি একইরকম থাকে। কতকগুলি গরু চরতে আসে লেকের চরে। বকগুলি ঘিরে ধরে তাদের। কুকুরগুলো খামোখা মস্করা করে গরুগুলিকে তাড়িয়ে বেড়ায়।সামনে আমার প্রিয় জনপদে শুরু হয় মানুষের আনাগোনা।

ক্রমশঃ রোদ বাড়ে, আমি ফিরে এসে ঘুমোতে যাই।