Tuesday, July 14, 2020

Growing up

Original post: 3 Aug 2007 from South Africa, during my stay in hospital (will get to that)

Okay, I’m starting a little before the beginning cause I don’t really remember much before “the accident”. I put that in parenthesis because it has been such a defining point in my life that it sometimes feels like it should be announced with a large Chinese GONG.
My first Dad, was a quantity surveyor (Junior Partner at Farolong- mind the spelling.). Not sure if I would have still become a programmer had he been alive today. I can't unfortunately tell you much about him cause I don’t really remember. I do remember being happy to see him when he came home and never saw someone run that fast after my little brother who disappeared down the beach because he decided that my parents should have gone down there. I can still remember running at full pace and suddenly feeling like I was standing still as my dad came flying by and scoop up my brother. Aside from small memories like this one I don’t think I remember the man, I wish I could remember his voice. I have trouble to come up with a memory of me sitting on his lap. But I can’t. Instead I just remember him as the man who brought me into this world. Gave me a great start to life and someone I loved.



Growing up we spent a lot of time at my father's parents farm. I can't honestly remember a great deal about it, but some of these photos ring vague bells.
My dad was working in a small town (He was junior partner at Foralang), Klerksdorp (We lived in Moreen Street 3). People, including us, living there will tell you its not a town it’s a small city. He got offered a job in Johannesburg. Back then it was still the old South Africa. I must admit to being totally and completely oblivious to the existence of apartheid growing up. I never thought of myself as being racist. The concept wasn’t even discussed with me or even mentioned to me. I was good friends with our gardener. His name was Johannes.
Okay not going into that discussion now because it’s a story all on its own.
So my dad got the new job and we were busy finalizing arrangements to move to Johannesburg. We even went there to look at the rent house (In Swallow Street in Horizon) we were going to stay in while my dad was going to build another house.
However we never made it home that night. Instead I woke up a week later in the hospital. My dad had died, my brother was in a coma and I had a 30cm scar down my tummy and another 20cm one on my arm. Fortunately my youngest brother only cracked his hip bone, my mom only bit open her lip and our cleaning lady Beauty, broke her nose (she was always with the family).
The time directly after the accident I think was hard for all of us. My mom especially, having to deal with three boys on her own whilst still providing us with the illusion that everything was alright. She still took us to the beach on holiday.
My brother who had stayed in a coma for a good part of 2 months had come out of it with some damage. So we stayed with my Dad's parents while he went through a lot of physio and operations to give him some hope of a normal life. He turned out good in the end, got through school. He got the house and the car and all that.
I was having problems at school. I wasn’t a popular boy before the accident but after it I became the guy who’s dad died and who the whole class went to visit in the hospital, and after a while the reason why I was different got lost on people and I was just labelled different. Unfortunately the fact that I had a huge imagination didn’t really help. As I had trouble making friends I started making up my own worlds in my head. Which would have been okay if I didn’t insist on telling everybody about them.

About 2 years after the accident my mom got married again to my dad and I couldn't have asked for a better father. I did get moved from being the oldest in the family to being the middle which kinda sucked but I wouldn't have it any other way. With my new dad I also got two older sisters.
My parents eventually wanted to give me some help so I was sent on a course. Young winners, yes, it is as corny as it sounds and even though I hated it, (Especially cause it was on while I wanted to watch ninja turtles), in hid sight, I guess it helped me, a bit. Maybe it was that, that made me make one of the dumbest decisions of my life:
I decided to go to a Technical High School. I’m a sucker for a sales pitch, ask my girlfriend she can vouch on that one. When the people from the Technical high school came and made their pitch at our school I was sold.
The promise of a new beginning, where very few people knew me was great. But your reputation follows you and I have to say that having a reputation grow from the seed of a few rumors can be much worse than the actual reputation. I was back to the “misunderstood” outsider. Until I got some backbone and eventually at the beginning of Grade 11 decided to go back to the high school where all the other kids from my primary school went to, and suddenly I was accepted. Maybe it was the putting up with bullies 24/7 in the other School. Maybe it was just that I finally got it. But I was for lack of a better word, normal.
The technical school wasn't all bad. I met some really good friends there that I still keep in touch with whenever I get a chance.
From then on my life just got better, I met the friends that till today are like my brothers. I had a fantastic University life of partying my hart out.
I was a late starter on the whole girls issue. But I did eventually catch on to that one to and it was in one of my late nights clubbing that I happen to meet my girlfriend, Heather. I walked past her earlier in the night and something about her caught my attention. Saw her later on while she was dancing on the stage and eventually caught up with her sitting on the stage. I got her name and her phone number and my pick up line was literally.”Give me your phone number and I’ll buy you a drink on your birthday.” And she gave me her number. Who says corny pickup lines don’t work?
We had a great 6 weeks before she left for London. I saw her off at the airport and I was pulled not just by her, but by her freedom. Going off to another country, no debt no attachments nothing, she just packed up and went.
At that point in my life I was working for a company doing database analysis work for large companies. I was driving a nice car for a guy my age, and I was out of my parents house. Albeit that I moved in with my brother. The point that I’m trying to make is I was well on my way to settling down. Most of my friends had long term girlfriends, the one that didn’t was still studying and didn’t have the cash enough to keep going clubbing night after night. And so my life was kinda at a turning point.
But I delayed.

My first car

You never forget your first car! In the process of transferring the previous post I came across this photo :)  Can you spot me the head sticking out, lol.
I have loads of memories associated with this old skiedonk.
It had a big exhaust that meant it could be heard from kilometers away. One of my friends said that their TV distorted when I pulled up :)
We had a blast with it, and even did a trip down to Margate from Johannesburg with it for the Y2K new-years celebration. We almost had to turn back but after some fiddling in the engine at the first service station it managed to make it all the way there and back. Was about 7 hours there and 7 back.
The steering weel had about a 10 degree "give" after someone (guy in the blue in the photo :)) drove it over a side-walk, but that didn't stop me from driving it for another year before I bought by second car with some money I inherited from Oupa Daan (my namesake :))

My 21st

I had the option of a party or a trip to a warm water (at the time it was called Warm baths or Warm Bad) resort for my 21st with a couple of friends. Guess which one I picked :)
It was a great weekend. As I recall one entire boot of one car was dedicated to alcohol. But we also had some amazing Ribs (wonder if they still make them in Witpoortjie)
I have a fond slighly hazy memory of making up shooters and getting a moth full of curdled Kalua with Sours... I think we called it the snot-ball shot :)

Wednesday, February 12, 2014

JsonRequest.com simple data server

I'm please to announce my new website jsonrequest.com

JsonRequest.com provides a cheap and easy way to serve data to your mobile app or website, or just a way to test how your application reacts to different JSON responses from a server.

Its free to use, and currently I don't have limits set on its usage.

Please let me know if you have any ideas for me to make it better and more useful to you!

Friday, September 20, 2013

Should I comment my code

Yes.... but.

I've been doing some reading regarding the pro's en con's (actually it is more like the for and against commenting) and I figured I'd make a quick summary of what I've come across.

Firstly I think that both camps (for and against comments) have the same goal in mind; readable code. The against camp's main concern seems to be:

  1. You don't need comments because your code should be structured in such a way to make it clear what it is doing.
  2. Lack of discipline causes redundant comments when code is updated
The "for people" says:
  1. Not commenting code is arrogant since you believe that what is apparent to you is apparent to everyone, or that the way you implemented the code is makes it obvious and readable.
  2. It is hard to know the intent of the code, especially when business logic comes into play
I actually think both camps have valid points, I had a bit of a thought experiment about it which I will show my thinking.

Enter code example 1 (A basic event scenario):

 public void OnStudentCreated(Student student) {  
   CheckSchoolCapacity();  
   if (student.HasSpecialNeeds) {  
       ConfirmSchoolHasSpecialNeedFacilities(student);  
   }  
   if (!AllocateStudentToClass(c)) {  
     NotifySchoolBody();  
   }  
   else {  
     SendEnrolledEmailToParent(c);  
     SendEmailToTeacher(c);  
   }  
 }  

Now as you can see, this is an event that fires when a student is created for a school application. There are various things to check and people to notify when this happens.

Also note I have coded it without any comments. So I then tried to think about what part of this could I not sufficiently make clear in the source code.

  • CheckSchoolCapacity() method, I can't say anything more about. I could possibly ask capacity of what? But unless you don't know what a Student and a school is, it should be pretty apparent.
  • Next is the SpecialNeeds section. Here I was of 2 minds about a comment. It is easy enough to go look at the implementation of the ConfirmSchoolHasSpecialNeedFacilities method but I currently don't know what will happen if the school doesn't have facilities. Does it throw an exception if the school doesn't, does it simply notify someone. You can either change the method name to something more specific, like EmailSpecialNeedRequirementsToStudentBody(student) or WarnIfSpecialNeedFacilitiesAreNotMet, or there may be some legal requirements that it will be looking at, OR it could be all of the above.
  • Similiar to the above point I didn't know what NotifySchoolBody meant, is it an email, a update to an internal system, both, etc. Again you can go look at the implementation but you can't see it at a glance.
  • I think the last to method calls are pretty self explanatory.
So now I had introduced another question, does a every method have to fully document its intent. In certain OO instances where a method may be an abstraction or partial, I will have no choice but to go look at the code inside these methods, and high level comments will give me little more clue to the method's function than the name already does. So, the answer to my question is probably no.

At this point I am starting to lean towards no comments, because I've not been able to find a situation where it would be useful. Lets face it, even if you use the method summaries for documentation, will anybody ever really look at it... I actually think they will, I mean I do all the time of MSDN. I want to know what a class does or a method in that class does, more to the point I would like to know how it does it. 

Enter code example 2 (The API method):


 public void AssignStudentToSchool(Student student, School school) {  
    // I don't know what this code is because it is in a black box dll  
 }  

I am using the StudentAPI.dll which gives me some basic functionality to writing a school system. Now, I know this example is slightly moot in open source software APIs but even if I can see the code, maybe I'm not a super senior developer and I don't understand what it does, even if it only adds a record in the database, looking at the code I may see some statements doing something I have no idea what their function is... ok so I need a cup of coffee and about 2 hours to figure it out. So even-though Bjarne Stroustrup probably don't need comments here, some of us mere mortals might.

BUT WHAT ABOUT TESTING, SURELY THE TEST WOULD GIVE YOU A CLUE!!!

This question is valid for an open source API but a black box API would still require at least a method signature comment section. Also it may be difficult to determine which test relate to a piece of code, unless it is really well structured and loads of discipline practiced to make sure all the code is covered.

My humble opinion in conclusion

  • Add comments when it is important for a method's meaning and function needs to be clear at a glance. This may be internal policy or for important method that do something high risk and important.
  • If you have a black box or complex method that you intend to expose via an API, though you can say that giving comments to any complex method signature is important.
  • I will add another one that wasn't apparent from this example, but put a comment if you do something weird so the next poor developer will know what you were thinking!
  • Obviously also use comments for TODO comments in your code.
  • If your class or method name uses a term that is very domain specific, for example a plane part that no-one else even knows exists. Please tell the poor next guy coming from the banking sector what it is.

Tuesday, October 23, 2012

Code reuse myth

I've been wondering about this for a while and found an article with an interesting take on it.

Basically write testable code. Don't code for possible future reuse. Only make something reusable when you write a new piece of functionality and notice it is similiar to something you did before then make it reusable.

I like this because I see people spending a lot of time architecting reusable solutions when you can tell it will never be reused. However, when reuse makes sense, you can still make use of it.

http://agile.dzone.com/news/reuse-myth-can-you-afford

Monday, September 3, 2012

Busy skies

Last night In dreamed that there was a huge meteor shower. We were driving on a highway and saw one after another plane and helicoper fly past us. The jets would occasionally let a missile go which would be followed my a great explosion, presumably blowing up a large meteor. I looked up and saw lots of planes in the air.

Tuesday, May 15, 2012

Developer VS Project Manager


A man is flying in a hot air balloon and realizes he is lost. He reduces height and spots a man down below. He lowers the balloon further and shouts:
"Excuse me, can you help me? I promised my friend. I would meet him half an hour ago, but I don't know where I am."
The man below says, "Yes, you are in a hot air balloon, hovering approximately 30 feet above this field. You are between 40 and 42 degrees North latitude, and between 58 and 60 degrees West longitude."
"You must be a programmer," says the balloonist. 
"I am," replies the man. "How did you know?" 
"Well," says the balloonist, "everything you have told me is technically correct, but I have no idea what to make of your information, and the fact is I am still lost." 
The man below says, "You must be a project manager" 
"I am," replies the balloonist, "but how did you know?"
"Well," says the man, "you don't know where you are or where you are going. You have made a promise which you have no idea how to keep, and you expect me to solve your problem. The fact is you are in the exact same position you were in before we met, but now it is somehow my fault."

Sunday, July 4, 2010

How to hide duplicate Column Entries GridView VS2008 using c#

The Code below will hide values of textbox and label controls with the same ID in a gridview, you should be able to modify the code easily enough to support other controls. This does however mean that you have to use TemplateFields not basic BoundFields. For example if you have a Template field and inside it you have a textbox called txtName and a Phone number field called txtPhone, you specify HideDuplicatesInColumns to "txtName,txtPhone" for example:

<cus:GridView2 runat="server" ID="grdTrainMeNonSuperSet" AutoGenerateColumns="false"
HideDuplicatesInColumns="lblExerciseShort,lblMuscleGroup" GridLines="Horizontal"
OnRowCommand="grdTrainMeNonSuperSet_RowCommand">

Before you do this you need to add this class to you appcode folder, and in the your asp.net page add a reference to it.

Example of the Reference
<%@ Register Namespace="ST.Web.Controls" TagPrefix="cus" % >



The Class

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.Configuration;
using System.Web.UI;

namespace ST.Web.Controls
{
///
/// Summary description for GridView2
///
public class GridView2 : GridView
{
public GridView2()
: base()
{

}

protected override void OnDataBound(EventArgs e)
{
base.OnDataBound(e);
}

string hideDuplicatesInColumns = string.Empty;HideDuplicatesInColumns
string[] columnsToHideDups;

public string
{
set
{
hideDuplicatesInColumns = value;
columnsToHideDups = hideDuplicatesInColumns.Split(Convert.ToChar(","));
}
get
{
return hideDuplicatesInColumns;
}
}

private int ConvertToInt(string value)
{
return Convert.ToInt32(value);
}

Dictionary watchList = new Dictionary();
protected override void OnRowDataBound(GridViewRowEventArgs e)
{
if (columnsToHideDups != null)
{
//Hide all the duplicate values in based on the selected settings
foreach (string c in columnsToHideDups)
{
Control cntrl = e.Row.FindControl(c);

string val = string.Empty;
string id = string.Empty;
string key = string.Empty;
if (cntrl is TextBox)
{
val = ((TextBox)cntrl).Text;
id = ((TextBox)cntrl).ID;
key = string.Format("{0}", id);
if (watchList.ContainsKey(key) && watchList[key] == val)
{
((TextBox)cntrl).Text = String.Empty;
continue;
}
else
{
watchList.Add(key, val);
watchList[key] = val;
}
}
if (cntrl is Label)
{
val = ((Label)cntrl).Text;
id = ((Label)cntrl).ID;
key = string.Format("{0}", id);
if (watchList.ContainsKey(key) && watchList[key] == val)
{
((Label)cntrl).Text = String.Empty;
continue;
}
else
{
watchList[key] = val;
}
}

}
}
base.OnRowDataBound(e);
}

protected override void OnRowCreated(GridViewRowEventArgs e)
{
base.OnRowCreated(e);
}
}
}

Wednesday, June 2, 2010

The Garbage Law

This is how I try to live my life. Was surprised it had a name, but thought I'd share it here.

Tuesday, May 11, 2010

Vitamine D for Hodgkins Lymphoma

Its all over the internet but I think its important enough to keep repeating. Vitamin D hinders lymphoma and a whole bunch of other cancers. So much so that this study found that people diagnosed in summer times seems to have a 20% better survival rate!!! So stock up on Vitamin D supplements, and if possible get in the SUN as much as possible!! (without, obviously, burning yourself and getting skin cancer, kinda defeats the purpose)

Thursday, March 18, 2010

Microsoft SQL - Return random number in Query in Microsoft SQL

After a lot of searching around for a random number generation function for Microsoft SQL views, and trying all kinds of different methods, and only finding very resource expensive methods for getting a random number for each line in a query result set, I stumbled on this very obvious solution in a forum. I unfortunately cannot remember the forum otherwise I would post the link but I figured it couldn't hurt posting this here.

We all know NEWID() function will return us a GUID, which is nicely random. So using this we can generate ourselves a nice random number.

Step 1. Convert the Guid to Binary using

Step 2. Great so we have random binary, which we can change into anything we basically want, so lets convert it to an in CAST(CAST(NEWID() AS VARBINARY) AS int)

Step 3. Ok we have a random number but it may be negative and we probably just need something positive, so lets do ABS(CAST(CAST(NEWID() AS VARBINARY) AS int))

Step 4. Last step is to limit our Random number, The mod operator will help us here so lets say we want a random number up to 1000 we go ABS(CAST(CAST(NEWID() AS VARBINARY) AS int)) % 1000

So if you have a Northwind database and run

Select ABS(CAST(CAST(NEWID() AS VARBINARY) AS int)) % 10000 as RANDOMNUMBER,* from dbo.Customers

You will get a random number for each row in the Customer table in the database

You can also use this in a View and it works perfectly.

Hope this makes someone else's search a bit less frustrating than mine was.

Thursday, February 11, 2010

Cars are better than trains

There are certain definite advantages to public transport, aside from the obvious environmental benefits, you don't have to worry about car maintenance, traffic (at least not the kind the makes you calves hurt from having to maintain constant clutch control) and the fact that you can read your paper while travelling to work instead of concentrating on the road.

My mind, the unfortunate cynic, complains that my bodies environment suffers from the various city folk, coughing in my face, that traffic isn't that bad (you need the exercise) and you can get the news from the radio and get the added benefit of music instead of endless advertising in the paper (And even if there is advertising on the radio, its sometimes more entertaining, would miss the cartoons though...). So the trump card is car maintenance, which boils down to money.

Now personally I'm starting to think that the money for a car is really the well justified. First and foremost its a health issue. There is endless propaganda that talks about it being good for the environment to use public transport, but every winter I have to fight off flu after flu because some prior victim of the public transport health hazard, sneezes or coughs on me.

There are also the benefits of having a car for weekend trips (which cost some money anyway might as well pay a big oil corporate than a big public transport corporate). You don't need to rush to catch trains for you relaxing trips because the car leaves when you want to leave, and the comport of being in your own personal space (and not being sneezed on) is a brilliant perk.

One of the best perks I believe is the personal space perk of driving a car. When you leave work and get in your car, its your space. Its almost like being half-way home already. Your 4 square meters of space, in which you can do (and unfortunately some people take this too far) whatever you want to. No attention seeking teenagers with attitude playing their hip-hop as loud as possible, because they don't get enough attention at home and so needs it from the public hordes (join a football club or something!!!). No-one coughing on your head. No-one eating like giraffe with a twig stuck between their teeth. Just you, your music, your time.

Yup, cars are better than trains any day of the week.

Sunday, January 31, 2010

Big night out

It really does amuse me to find what I see as big night out now a days. Many people will smirk at a 29 year old thinking about the good old days. However my first big night out was around 12 year ago so I figure I am starting to gain just a little right to.

When I was 18 a big night out was synonymous with alcohol. If there was brandy there was a party, something that didn't change much by the time I got to 23 when my taste shifted to rum (I since went back to brandy). Rum is an essential drink for a guy trying to pick up girls, since I found the brandy made me mellow, whiskey made you forget. Rum made you brave! Nothing like a bit of Dutch courage when approaching a girl surrounded by her friends each one looking at you as if you are just another bottom feeder trying to score. I would like to think I was just honestly looking for someone and just lacking the courage initially. A theory that eventually bore fruit for me as I met my lovely wife in such a night.

By the time I reached 25 a big night out usually involved a braai (BBQ), still involving drink but now it was quality we were after. One or Two premium branded drinks were all we needed, sometimes a bit more but the goal of the night was to chill with the very friends you met while having way to much to drink when you were just 3 or 4 years younger.

Last night at the age of 29 out big night out started with dinner, followed by going to a pub and having a drink there (we had a rebellious moment and bought a shot of sours each) We actually even went to a second pub where we could dance a bit. However most of the time was spent shaking our heads as the younger less domesticated crowd was checking each other out, trying to look intimidating and the occasional girl in the short skirt trying to shove infront of you to try and display there dominance over basically everybody else (Couldn't help notice that the fabric of some of their dresses looked just like my grand mothers old curtains... recycling I guess?). Sign... nothing has changed in 12 years... except the girls didn't wear old curtains.

I guess a big night out is one you can smile about afterwards, have laugh about. The difference is that as with everything, the experience of previous big nights outs, will teach you how to get through one without making a complete idiot of yourself.


Thursday, January 28, 2010

Train delay theory

On Monday we very proudly managed to walk out of our house very proud of the fact that we left a full 5 minutes before our train was due. We only need a minute to walk there so we would have plenty of time to get to the station, get our metro and align ourselves with where the train door would be in order do get a seat when the door opens.
We were thus surprised to see the train arriving just as we stepped out of the parking area of our block of flats. But no worries! We're used to doing this, we bolted my wife with high heels and me with laptop bag swinging around wildly. The old lady living at the cute cottage probably shaking her head in her morning observations as the van Heerden's came rushing past again. Can just imagine her shaking her head thinking the youth of today has no sense of time.
Alas however, we didn't make the train. As we rounded to corner onto the platform the doors closed in that dramatic way only train door can, with a dramatic fooop that makes it seem like they are about to embark on an interstellar journey.
Seeing as we had some time to kill now, we realized that it was actually the previous train running late that we missed but that our train was also delayed by 25 minutes. Since it is January in London and frigid, our minds immediately went to coffee. We weren't the only ones either, the little coffee shop on the platform suddenly had more customers than he has in a good week. One of our fellow coffee drinkers mentioned that it was a person running over the rails. I think that possibly next Monday we will again be in the coffee shop only this time our helper behind the coffee counter will red in the face and puffing at us "£2.50 for your latte please!".

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.