Friday, April 17, 2009

Voting for South Africa

Me and my wife were one of the many "Londoners" that braved the cold rainy day to vote for South Africa. We were very impressed with the turn-out, and they were even fairly organized.
We can only hope that we will make a difference, the scale of problems in Africa are huge, and corruption is unfortunately a daily reality in our governments. The sad fact is that we probably would never have another Mandela and if and when we do, it may be too late. The ANC will probably always be in power mostly due to the post apartheid loyalty to the ANC rather than any real indication of how well or not they run the country.
So now we are entering a new and again, unknown era of the new South Africa. Will the ANC get their 2/3rds majority? We can also just speculate on how Mr Zuma will turn out, some say because of his history it will not go well for our country but to some he is a hero. We can only wait and hope he will continue to make South Africa the beackon of hope in Africa that it stumbled into being. For all his faults he is a good speaker, maybe too good. Which is apparent by his huge following, but is it all just talk. We hear the words of his speaches and then he toi toi in the streets singing about guns and killing. Maybe he is just a fan of angry music, maybe its is premature victory dance. Only time will tell.

Tuesday, April 14, 2009

Classic Irish Joke

Mick and Paddy were walking home from the pub.
Mick says to Paddy, ' I can't be bothered to walk all dat way.'
'I know,' says Paddy, 'but we've no money for a cab and we've missed the last Bus home.'

'We could steal a bus from the depot,' Mick suggests.
They arrive at the bus depot and Mick tells Paddy to go in and get a bus while He keeps a look-out.
After shuffling around for ages, Mick shouts, 'Paddy, what are you doing? Have you not found one yet?'
Paddy shouts back, 'I can't find a No. 91'
'Oh Jeysus Christ, ye thick sod, take a No. 14 and we'll walk from the Roundabout.

Thursday, April 9, 2009

Read if you feel like laughing for 5 minutes

Natal is a province in South Africa, which apparently has the highest quota of Indians outside of India...

Natal curry contest.

If you can read this whole story without laughing then there's no hope
for you. I was crying by the end.......

NOTE:
If you pay attention to the first two judges, the reaction of the third
judge is even better.

For those of you who have lived in Natal, you know how typical this is!

They actually have a Curry Cook-off about June/July.
It takes up a major portion of a parking lot at the Royal Show in PMB.

Judge #3 was an inexperienced food critic named Frank, who was visiting
from America.




Frank: "Recently, I was honoured to be selected as a judge at a Curry
Cook-off. The original person called in sick at the last moment and so
I happened to be standing there at the judge's table asking for
directions to the Beer Garden when the call came in. I was assured by
the other two judges (Natal Indians) that the curry wouldn't be all
that spicy and, besides, they told me I could have free beer during the
tasting, so I accepted".


Here are the scorecard notes from the event:


CURRY # 1 - SEELAN'S MANIAC MONSTER TOMATO CURRY...


Judge # 1 -- A little too heavy on the tomato. Amusing kick.

Judge # 2 -- Nice smooth tomato flavour. Very mild.

Judge # 3 (Frank) -- Holy shit, what the hell is this stuff? You could
remove dried paint from your driveway. Took me two beers to put the
flames out. I hope that's the worst one. These people are crazy.



CHILI # 2 - PHOENIX BBQ CHICKEN CURRY...

Judge # 1 -- Smoky, with a hint of chicken. Slight chili tang.

Judge # 2 -- Exciting BBQ flavor, needs more peppers to be taken seriously.

Judge # 3 -- Keep this out of the reach of children. I'm not sure what
I'm supposed to taste besides pain. I had to wave off two people who
wanted to give me the Heimlich manoeuvre! They had to rush in more beer
when they saw the look on my face.



CURRY # 3 - SHAMILA'S FAMOUS "BURN DOWN THE GARAGE" CURRY...


Judge # 1 -- Excellent firehouse curry. Great kick.

Judge # 2 -- A bit salty, good use of chili peppers.

Judge # 3 -- Call 911. I've located a uranium spill. My nose feels like
I have been snorting Drain Cleaner. Everyone knows the routine by now.
Get me more beer before I ignite. Barmaid pounded me on the back, now
my backbone is in the front part of my chest. I'm getting pissed from
all the beer.



CHILI # 4 - BABOOS BLACK MAGIC BEAN CURRY...

Judge # 1 -- Black bean curry with almost no spice. Disappointing.

Judge # 2 -- Hint of lime in the black beans. Good side dish for fish
or other mild foods, not much of a curry.

Judge # 3 -- I felt something scraping across my tongue, but was unable
to taste it. Is it possible to burn out taste buds? Shareen, the beer
maid, was standing behind me with fresh refills. That 200kg woman is
starting to look HOT...just like this nuclear waste I'm eating! Is
chili an aphrodisiac?



CHILI # 5 LALL'S LEGAL LIP REMOVER...


Judge # 1 -- Meaty, strong curry. Cayenne peppers freshly ground,
adding considerable kick. Very impressive.

Judge # 2 -- Average beef curry, could use more tomato. Must admit the
chili peppers make a strong statement.

Judge # 3 -- My ears are ringing, sweat is pouring off my forehead and
I can no longer focus my eyes. I farted and four people behind me
needed paramedics. The contestant seemed offended when I told her that
her chili had given me brain damage. Shareen saved my tongue from
bleeding by pouring beer directly on it from the pitcher. I wonder if I'm burning my lips off.
It really pisses me off that the other judges asked me to stop screaming.
Screw them



CHILI # 6 - VERISHNEE'S VEGETARIAN VARIETY...

Judge # 1 -- Thin yet bold vegetarian variety curry. Good balance of
spices and peppers.

Judge # 2 -- The best yet. Aggressive use of peppers, onions, and garlic.
Superb.

Judge # 3 -- My intestines are now a straight pipe filled with gaseous,
sulfuric flames. I am definitely going to shit myself if I fart and
I'm worried it will eat through the chair. No one seems inclined to
stand behind me except that Shareen. Can't feel my lips anymore. I need
to wipe my ass with a snow cone ice cream.



CHILI # 7 - SELINA'S "MOTHER-IN-LAW'S-TONGUE" CURRY...


Judge # 1 -- A mediocre curry with too much reliance on canned peppers.

Judge # 2 -- Ho hum, tastes as if the chef literally threw in a can of
chili peppers at the last moment. (I should take note at this stage
that I am worried about Judge # 3. He appears to be in a bit of
distress as he is cursing uncontrollably).

Judge # 3 -- You could put a grenade in my mouth, pull the pin, and I
wouldn't feel a thing. Ive lost sight in one eye, and the world sounds
like it is made of rushing water. My shirt is covered with curry which
slid unnoticed out of my mouth. My pants are full of lava to match my
shirt. At least, during the autopsy, theyll know what killed me. I've
decided to stop breathing - it's too painful. Screw it; I'm not getting any oxygen anyway.
If I need air I'll just suck it in through the 4-inch hole in my stomach.



CHILI # 8 - NAIDOOS TOENAIL CURLING CURRY...


Judge # 1 -- The perfect ending. This is a nice blend curry. Not too
bold but spicy enough to declare its existence.

Judge # 2 -- This final entry is a good, balanced curry. Neither mild
nor hot. Sorry to see that most of it was lost when Judge #3 farted,
passed out, fell over and pulled the curry pot down on top of himself.
Not sure if he's going to make it. Poor man, wonder how he'd have
reacted to really hot curry?

Judge # 3 - No Report


Wednesday, February 11, 2009

Extacts from Pet Diary

Excerpts from a Dog's Diary

8:00 am - Dog food! My favourite thing!
9:30 am - A car ride! My favourite thing!
9:40 am - A walk in the park! My favourite thing!
10:30 am - Got rubbed and petted! My favourite thing!
12:00 pm - Lunch! My favourite thing!
1:00 pm - Played in the yard! My favourite thing!
3:00 pm - Wagged my tail! My favourite thing!
5:00 pm - Milk bones! My favourite thing!
7:00 pm - Got to play ball! My favourite thing!
8:00 pm - Wow! Watched TV with the people! My favourite thing!
11:00 pm - Sleeping on the bed! My favourite thing!

Excerpts from a Cat's Diary

Day 983 of my captivity.
My captors continue to taunt me with bizarre little dangling objects.

They dine lavishly on fresh meat, while the other inmates and I are fed
hash or some sort of dry nuggets. Although I make my contempt for the
rations perfectly clear, I nevertheless must eat something in order to
keep up my strength.

The only thing that keeps me going is my dream of escape. In an attempt
to disgust them, I once again vomit on the carpet.

Today I decapitated a mouse and dropped its headless body at their feet.
I had hoped this would strike fear into their hearts, since it clearly
demonstrates what I am capable of. However, they merely made
condescending comments about what a "good little hunter" I am.

There was some sort of assembly of their accomplices tonight. I was
placed in solitary confinement for the duration of the event.
However, I could hear the noises and smell the food. I overheard that
my confinement was due to the power of "allergies." I must learn what
this means and how to use it to my advantage.

Today I was almost successful in an attempt to assassinate one of my
tormentors by weaving around his feet as he was walking. I must try
this again tomorrow -- but at the top of the stairs.

I am convinced that the other prisoners here are flunkies and snitches.
The dog receives special privileges. He is regularly released - and
seems to be more than willing to return. He is obviously retarded.

The bird has got to be an informant. I observe him communicating with
the guards regularly. I am certain that he reports my every move. My
captors have arranged protective custody for him in an elevated cell, so
he is safe. For now....

Friday, January 23, 2009

Simple Object-oriented programming (OOP) concepts explanation

I don't include code samples because this should be used to understand the concepts rather than teach you to program. Please feel free to use it but please give me the credit if you use!

We start with 2 concepts
  • A Class
  • An Object also known as An Instance
So in object orientated programming, the structure has been built around the idea of the real world. So lets take it back to the real world for a second.
If I want to build a house what do I need? Okay before you say bricks, windows lets just make it a little less detailed and just say you need rooms.
OK so how do we make a room, erm... Well that's our first problem, we need a plan. So we draw up a blueprint of what our room is going to look like. For now we don't much care about what kind of room it is, we just need a room. So our blueprint defines 4 walls and a roof and a floor.
Great now we know how to build the room, how do we build it? Well get a builder so lets not worry to much about that part, let assume we can give someone the plans and they'll give us a room. Its good to note at this point that you can give the same plan to that builder or another builder over and over again and each time they'll give us back a similiar room.
So if our house is a collection of rooms we can make a whole house using the same plan a couple of times over to create a couple of rooms, put them together and whoala, we have a house. Albeit a very boring bare house.

So bringing the example above back to object orientation. We can say the blueprint is the class and the room is the object or instance of the room's blueprint.
The collection of rooms are just that, they can be grouped in either a collection (a instance of a collection blueprint or class) or an array which is just basically putting them side by side in your computers memory.

Now lets EXTEND on that!

OK so lets make out house a bit more interesting, shall we? We need a bathroom, with a toilet and a bath and a basin. Other than that it should be a room. So rather than start from scratch lets just staple some additional instructions to our builder onto the room blueprint.
So what do we want?
  1. We want a room
  2. We want a bathroom in the room
  3. We want a sink in the room
  4. We want a basin in the room
So what we are basically doing is EXTENDING our idea of a room. Which is the next concept in object orientation. You have something that's almost what you need, you tweak it, and whoala you have the new thing. Then we just give it to the builder with the extra notes and he makes us a bathroom room or kitchen, depending on the extended blueprint.

Lovely! So why not just copy and paste the class and give it another name, like make a bathroom blueprint from scratch. Well 4 reasons:
  1. Cause you actually doing just that anyway, because you are going to make a new class, its just going to be extending the other class. Basically just steal all its functionality.
  2. Because then its not a room anymore and we cannot refer to it as a room anymore. The nice thing about extending from a basic concept is that in code you can actually refer to the more complex items as their basic counterparts. For example I can still have a collection of rooms to my house, but now some of those rooms will just happen to be bath rooms. If we made a whole new bathroom blueprint it would be a different concept all together and we'd need to have 2 collections, one for all our normal rooms and one for our bathrooms, and that is just horribly inefficient.
  3. Because sometimes, you don't have access to the code of the class you want to extend. There are heaps of libraries of classes scattered over the Internet which might all do almost what you want but not quite. But you won't always have access to their code. So you'd have to resort to EXTENDING them to get what you want.
  4. And most importantly! Why do you want to take the risk of making a mistake recoding something that already works! Debugging takes up more time than coding in many scenarios so why go there?
In its simplest form most of the above benefits can be obtained by using an INTERFACE. Basically all an INTERFACE is, is a tick list of things to include. So if our room had an interface it would say something like, make sure its got walls a ceiling and a floor. It won't define any detail about the walls or the floor or the ceiling but it will just make sure its there. If our room had been using an interface we would have said it IMPLEMENTED the INTERFACE. Hey I'm a poet!
When the builder then took the room to his boss, the boss would get out his checklist and tick off
Walls. check!
Ceiling. check!
Floor???? Where is the floor?
And the builder would have to come back to you and say listen about your room, you forgot to add the floor and according to you tick list, or interface, it should have one. Could you please revise the blueprint and give it back to me?

We can cheat a little with the above scenario. Lets say our initial INTERFACE for a room stated that the room should always have a window. Sometimes however this isn't important to us, but its important enough in most cases that you want it in your check list or interface. So what we then do is we
first:
  • Implement our interface and build a blueprint of a "standard" room, but instead of specifying all the details we just specify some defaults. So for the windows section we just say, "no windows", for the walls we say "no walls" for the floor we say "no floors" etc.
second
  • We EXTEND our standard room, and make it into everything we want. But because the standard room blueprint already says "no windows". If we neglect to fill in anything about the windows on our new rooms blueprint. The builder won't be bothered because he can see the default is "no windows" so he'll assume that is what he needs to do.
Nice thing about this is we can refer to all our rooms by the name of the interface, lets say its called iRooms. So now we can build our house out of a collection of iRooms. Which can be anything as long as it ticks all the boxes. Cool huh?
Its good to mention here that Implementing an Interface, or Extending a Class does not limit you to their functionality. You can add whatever you want on top of whatever is there.

OK minor problem emerging here!

Lets say I take a room out of my house collection...., what kind of a room is it?

I don't know!

OK well I'm just going to the loo in it..... NOOOOOOOOOOO! Crash. (wanted to use another word but it would be nasty)

So what happened?

Because we only know its a room, we don't know if its got any special characteristics. We don't know if its just a room or if its a bathroom or a kitchen or... you get the idea.
So if we don't know what it is how do we use its, unfortunatly for us the computer is even dumber than we are. So it won't know either. Luckily there is a solution. A couple actually.
  1. All classes has a getType method. Even if you don't put it there. That is because without you knowing it any class you create in either java or c# and even now a days in vb EXTENDS the "base class". If you haven't caught that, that does mean you can refer to any object as the base object. This class has nothing much in it except one or two little useful methods. One of which is getType(). Yippeee we're saved. Well kinda. The problem is that even though the objects base knows exactly what it is, if we have it defined as a room and not a bathroom we will only be able to tell you things about the bathroom that it can tell you about the room. If the wall colors were different it could tell us that or if the floor was tiled we'd be okay. But it won't be able to tell us anything about the bath, so we need to change what we have it defined as a room to a bathroom. In object orientation this is known as CASTING, and you only need to CAST if you are going from a simpler to a more complicated class. Like from a room to a bathroom. So first we cast our room to a bathroom and then we ask things about the bath, but at least we could call the GetType method to figure out what to cast it to. I know, computers are dumb! The sooner you learn this the better.
  2. Instead of using the GetType() method, you could always add a room name to your checklist in your interface. That way you know you would always have to define it and you'll always know where it is.
  3. Strangely enough, mostly it either won't matter or you'll know exactly what kind of room or object you are dealing with. The most common CAST you will ever do is from a base object to your object of choice (see point one on for note on the base object).
Now lets talk a bit about SCOPE...

I gave a builder the same set of room blueprints 20 times. He made 20 rooms. I don't like the color of my room I'm going to use as my kitchen so I paint it blue (never said I had fashion sense). Does that imply all my walls in my house are now blue because I changed one? Of course not! The rooms have been built, they now have very little to do with class or blueprint that made them except that you can probably get a good idea of what its supposed to do from the class. Once the room has been built its an individual. It can have its own fashion sense it can be used for different things. What happens to the one does not happen to the other. Same is true for classes and objects.

And that brings us to REFERENCES. OK now after a couple of years we have plenty of houses with plenty of rooms. We now need to refer to Daniel room. His room already exist, its been long built, probably customized. So we don't need to give it to a builder, we don't need the class. We already have it. So we just can just REFER to it.
So Daniel just won a room makeover. but there are many different people involved. So they each need Daniel's room to do their thing. We don't need to give them each a copy of Daniel's room we just need to let them know where it is. Anyways a copy won't work in the object orientated world because changing the colour of the walls in one copy won't change it in all the other copies of Daniel's room like magic.
So we jot down Daniel's address and room number on piece of paper and give it to all involved. We can write as many pieces of paper as we want REFERRING to Daniels room, it'll still be the same room. Even if one of the specialists write the address for someone else and they go find it and work on it it will still be the same room so at the end of the day I'll have my home entertainment system, my PS3 and my slightly scary new bedding all in the same room.
98% of objects gets passed via references, so be careful of passing an object to something, changing it and expect it to come back the same way. If you pass someone a reference to your object and they change it they will be changing your object! Its actually quite a mission to copy an object so always assume you are passing a reference not a copy.

OK enough for now, I've already given away that I watch way to many home decor programs! What can you do, BBC loves the things.

Hope this helps someone. I'll try extend on it at some point in the near future.