Thursday, March 27, 2008

Trip to Kanneliya

Last two days me and my friends at the university went on a trip to Kanneliya (a biological park nere Galle). Probably it will be the last trip that we are going during our stay at the university. We all had a very nice time with each other. Thank you Asiri and Saminda for providing us meals. And Moththe(Sameera) for the Tea. Ah, Dont forget leva and Sura , the fun they gave @ nite hi hi :) .

I think the most important event is providing the gifts of appreciation to Asiri, Saliya and Saminda who had helped us a lot for the exams (By doing "kuppi") through whole four years. The commitment they put can not be measured by the awards we gave. Thank you very much Asiri, Saliya and saminda for all those things you had done for us. Also thank you Amila for arranging such an event.


Tuesday, March 4, 2008

End of a sweetest episod of life

Now its the last few months at the university. Its really hard to believe that it has now come down to the wire. A four years of sweet memories with my friends. We had Lots of joyful moments, thank you dear friend for all those memories. The best part of it is, now I'm certain that there are bunch of friends who will never let me down, who will be with me for joy and sorrow. Thats the kind of relationship each other had in the university life. Any way thats the life is all about. There is a huge future ahead and I think experience gained here will be very important to deal with it. So dear friends may success will be with you in every part of your life. Hope this is GOOD NITE & not GOOD BYE.

Monday, February 25, 2008

Accesing a veriable defined in another file in C++

This might be a very simple thing to most of the programmers. But I thought of writing this in my blog as I spent half a day finding a way to access a variable in .cpp from another .cpp(without importing the .h or defining as public inside a class.)

suppose the variable we want to access is defined as follows in the original file,

bool flag;

if you want to access this from another .cpp simply you have to do is define it with extern key word in that file,

i.e extern bool flag;

both declarations refer to the same variable "flag".

Friday, February 22, 2008

C++ threading in windows

Any one had trouble in implementing threading in C++(well, I had, as C++ directly not providing threading) . We have to use the treading support in the windows API. But it is bit difficult to directly code to the windows API using "windows.h". while I 'm searching I found the article "C++ And Threads, by Randy Charles Morin" which has implemented the threading in C++ very effectively. If you are interested I recommend you to go through it. here is the link

http://www.kbcafe.com/articles/HowTo.Thread.pdf

Thursday, February 21, 2008

Bug in OpenCV

I wanted to capture an image from the web cam and convert that to gray scale in my application. I use openCV to do that. But when I directly convert the captured image to gray scale it returned a horizontally flip gray image of the original. but if I load an image using cvLoadImage() and then convert it to gray scale there was no problem. No flipping is involved. I think this was a bug in openCV. Correct me if I am wrong.

here is the code that cause the flipping,

CvCapture* capture = cvCaptureFromCAM( CV_CAP_ANY );
IplImage* frame = cvQueryFrame( capture );

IplImage* gray = cvCreateImage( cvGetSize(frame), 8, 1 );
cvCvtColor( frame, gray, CV_BGR2GRAY );

Sunday, February 3, 2008

Einstein's Challenge

Would you like some brainstorming challenge. Here it is. It is often called "Einstein's Puzzle" or "Einstein's Riddle" because it is said to have been invented by Albert Einstein as a boy. Some claim that Einstein said "only 2 percent of the world's population can solve it". But I believe it should be more than 2% if they given sufficient time. so here it is, ENJOY !!!!!!!!!!!!!!!

There are 5 houses in 5 different colors. In each house lives a person with a different nationality. The 5 owners drink a certain type of beverage, smoke a certain brand of cigar, and keep a certain pet. No owners have the same pet, smoke the same brand of cigar, or drink the same beverage.
  • The British lives in the red house.
  • The Swedish keeps dogs as pets.
  • The Danish drinks tea.
  • The green house is on the left of the white house.
  • The green homeowner drinks coffee.
  • The person who smokes Pall Mall rears birds.
  • The owner of the yellow house smokes Dunhill.
  • The man living in the center house drinks milk.
  • The Norwegian lives in the first house.
  • The man who smokes Blend lives next to the one who keeps cats.
  • The man who keeps the horse lives next to the man who smokes Dunhill.
  • The owner who smokes Bluemaster drinks beer.
  • The German smokes prince.
  • The Norwegian lives next to the blue house.
  • The man who smokes Blend has a neighbor who drinks water.
the question is , Who owns the fish?


try it your self, it's fun. Here is the answer..........................

But don't look at it till you finished.




House 1

House 2

House 3

House 4

House 5

Nationality

Norwegian

Dane

Brit

German

Swede

Color

Yellow

Blue

Red

Green

White

Pet

Cats

Horses

Birds

Fish

Dog

Beverage

Water

Tea

Milk

Coffee

Beer

Cigarettes

Dunhill

Blend

Pall Mall.

Prince

Blue Mstr




Thursday, January 31, 2008

Inter department tournament

Today we have participated to our inter department cricket tournament. As we are now in our final year this is the last tournament we are competing in the university. Though our team couldn't make it to the finals, it's a great pleasure to took part in such an event as all the batch mates from different departments had the opportunity have a good time with their friends from other departments. Department of Civil Engineering won the trophy and Department of Mechanical engineering was the runners up.