What's in my head?

The random ideas, questions, and thoughts that enter this feeble brain.

Saturday, March 26, 2005

Wedding plans, installment three

We have a DJ! Leo over at Good Vibrations is our winner. The man's got skills and knowledge. He even fulfilled the tri-lingual requirement! We're still not entirely sure what extra bells and whistles we want, but the rule is that we can't downsize to a smaller package, but we can upsize anytime. Since we're down for the basic package right now, I don't think that's a problem. When I visit Toronto in May, this will be one of my stops. Leo was highly recommended by those who actually experienced his work. Awesome.

At long last, I found the picture of our wedding cake. Noelia and I actually found the design we wanted back in February, but the person had the picture in her book and had no copies. It turns out it is a Martha Stewart cake. So I emailed and googled and emailed and a9ed, but came up short of finding the original picture. Then a break came when one day Noelia was looking at a website for a baker, and our design was featured on the site with an image about the size of a postage stamp. I emailed that to the Martha Stewart folks who replied with issue date, name, and an offer to buy the magazine. What is one to do? I went the analog route. I. Went. To. The. Library. Take that, modern society! I went to the freakishly overstyled Seattle Public Library. After a bit of a maze, I found the issue and the cake. :) We have decided to let that be a surprise, so I am not going to share any more information about that. I'm just proud we have our own picture of the cake, and I went to the library to get it.

Next up: flowers, decorations, bombonieri, limo, bridesmaid dresses, ...

Life is great :)

Continue reading Wedding plans, installment three ...

Anna Karenina

On Thursday night, in keeping with my goal of seeing more plays, I experienced a bit of theatre. This was my first experience watching a play in a small, intimate setting. The room was probably half as big as a standard gymnasium, with the proper theatre seating taking up about 3/4 of that. The stage was not the elevated structure I am used to. In fact, the floor was the stage, and the audience was slightly elevated above it.

The stage was modest at best; nothing more than two translucent screens and a couple of benches. The experience, however, was as diverse and intricate as the finest Asian tapestry.

This was a production of Anna Karenina. I have never read the book, so I didn't really know what to expect. From reading the show's program, and various websites afterwards, I see that the playwright decided to present the events in a way that linked the two main characters (Anna and Levin) metaphysically. Anna and Levin share dialogue throughout the production, but only once do they speak directly to each other. It is more as if they rely on each other to bear witness to the events of their lives; as if to acknowledge that it happened.

You can read the full text online, but I'd suggest hitting the library.

I am a terribly undereducated critic, so I'll just say that I absolutely loved the play and the actors were of such vibrant quality that my memories conspire against me to make me believe that the bare stage was in fact a lush green meadow, a dark, emotionless bedroom, a church altar, and the train tracks upon which two tragic deaths occurred.

My attention span has been slipping, but the characters before me held my interest for a solid three hours. Boy do I miss theatre.

One of my interests lies in acting. I thoroughly enjoyed it in my elementary and highschool years, but ultimately chose to stage my career on the technical landscape. I'll admit, Java code pales in comparison to the raw emotion delivered through the theatre, but it is a challenge and enjoyment of a different nature. Perhaps one day I will try my hand at acting again, but for now I am far too underdeveloped as a Software Developer to devote large amounts of time to an entirely unrelated field. I would hate to suck at two important things! Not that I suck as a Software Developer, I am actually quite good; but the sheer quality of my fellow developers at Amazon has shown me that there is much more I need to learn.

Anna Karenina is presented by Atlas Theatre, with support from The Shunpike arts collective. Written by Helen Edmundson, adapted from Tolstoy. Directed by Jose Amador and Chris Mayse. Plays until April 2nd, 2005.

Continue reading Anna Karenina ...

Wednesday, March 16, 2005

28 Characters . . .

So on Friday my manager came up to me and said "Hey Johnny, there is this trouble ticket in your queue that needs to be resolved as soon as possible, it's very important." Noting the weight of the statement, I agreed, "I'll start on it immediately".

Let's see what I can say without getting fired... hmmm OK, the problem was that our code was not populating fields as it should have. So what? Well, this means slows the reps down, which can get customers angry...which is perceived as bad Customer Service...is not good for the company... Let's just say the company deals with a large number of Customer Service reps and an incredibly large number of emails on a daily basis.

Ok, so there's the motivation.



I was going to blab about all the things I did to find the problem, but it ended up being a story of same old same old: Repro the problem, read the logs, attach a debugger to the front end, attach one to the back end, all good. How about the middleware technology? All good.

To make a loong story short, I found the problem today. I can reconstruct it into wont-get-me-fired code like this:


if( !alreadyDidSomething ){
doSomething();
alreadyDidSomething = true;
}


A coworker comes to my cube and tries to help out. I was running the debugger again, and when I come to the abovementioned lines he asks "hmm where is that variable initialized?" At this exact moment, I recalled a discussion I had with a friend at school after I had found a bug I caused in our OS. "I forgot to init this variable..." "JOHNNY!", she shrieked, "how many times have you hit this problem. INIT YOUR VARIABLES!" Since then I have this great habit of ensuring that all my variables are initialized before use. Sounds trivial, but when the number of variables grows, and the complexity of the system grows, it's easy to miss one.

So it turns out that alreadyDidSomething was never initialized to false. There was the bug. The variable came to life with whatever was in memory at the time. This problem lead me to a lot of dead ends while debugging, because at times the code actually worked! The solution? When the object containing the variable is instantiated, I set alreadyDidSomething to false, like so: :alreadyDidSomething(false). (This is in the context of the constructor's signature, in C++.

I tested, and things seem to be working now. The errors in the logs are gone, and the results are always what I expect.

Now the name of the variable and other information has been altered to protect my job, but all in all, 3 and a half working days have been spent on 28 characters. Humbing. What would you have paid a programmer for fixing this?


This could lead to a whole discussion on compiler warnings and code reviews, but I'm tired.

Continue reading 28 Characters . . . ...

Sunday, March 13, 2005

I am Murdock

I took the Which A-Team member are you??? quiz, and surprisingly ( or maybe not surprisingly to others, as crazy people like me might not know that they're crazy) I am Murdock.




They call him "Howling Mad" and with good reason. Once a top notch pilot, the pressures of war left Murdock mad. He is known for his smirk, variety of personas and overall mental instability. When he isn't spending time institutionalized, Murdock is using his flying skills for the A-Team, driving B.A. nuts and talking to his imaginary dog.


Which A-Team member are you???



Hmm I am a bit crazy, but I thought my leadership would put me somewhere else. Oh well. Although I love it when a plan comes together, I guess I am not meant to lead the A-Team. Maybe I'll start the J-Team!



Continue reading I am Murdock ...

Saturday, March 12, 2005

mmmmmovie trivia!

FilmWise has some great movie puzzles on their site. My favorite such quiz is when they remove the characters faces from a shot in the movie, and you have to identify the movie. Someone added a nice server-side script to one such test.

It's fun, and a little addicting!



Continue reading mmmmmovie trivia! ...

Tuesday, March 08, 2005

Thanks to Haskell, I understand QUICKSORT!!

Oh quicksort, let me count the number of times I have learned thee.
1: Grade 11 Comp Sci
2: First year university
3: Second year university

Every time I restudied quicksort, I thought I had it. Then, no less than 30 minutes after the exam, GONE. I swear I have the memory of a bag of sand.

I have some very smart friends, and some of them work with me. One person in particular is into programming languages. This week, he mentioned Haskell. *sigh*, I thought, here comes another conversation where the other guys will talk and nod about something of which I know NOTHING. It's very humbling. So today I hit the StumbleUpon button on FireFox, and up comes Haskell. So I figure, it's a sign - time to read.


The first example, which of course highlights Haskell's strengths and exposes one of C's weaknesses, is quicksort. The idea behind quicksort is: pick an element from the array (the pivot), partition the remaining elements into those greater than and less than this pivot, and recursively sort the partitions. I don't know why that was so hard for me to remember, but there it is. Two solutions can be found at About Haskell, and I will paracode the Haskell solution here:


qsort [] = []
qsort (head:restOfList) =
qsort elementsLT_head ++ [head] ++ qsort elementsGE_head
where
elementsLT_head = [ y | y <- restOfList, y < head ]
elementsGE_head = [ y | y <- restOfList, y >= head ]


Six lines. Six. Wow. You can go see About Haskell if you really want to see the C solution, so I'm not going to list it here. Suffice to say that it's a lot longer and harder to understand. I may be biased because I love math (lines 6 and 7 are purposely designed to mimic mathematical set notation), but I think this is a beautiful way to express quicksort.

Explanation:
Line 1: The result of qsort on an empty list is an empty list. Yay.
Line 2: The result of qsort on a list of 1 or more elements, where the first element is called head and the rest of the list is called restOfList happens in the following way.
Line 3: qsort elementsLT_head, then insert head, then insert the qsort elementsGE_head.
Line 4: Where the following definitions apply:
Line 5: elementsLT_head is a list of all the elements y such that y is taken from restOfList, and y is less than head.
Line 6: elementsGE_head is a list of all the elements y such that y is taken from restOfList, and y is greater than or equal to head.

There are all sorts of pros and cons and what not, but the fact of the matter is that I re-understood quicksort as soon as I read this code, whereas the C code was far more cryptic. There are many places where you want to use C, or Perl, or Java, or InsertLanguageHere. This is not an argument for language superiority. To me, the biggest advantage of knowing multiple languages is knowing the right tool for the right job. Not to mention that you begin to see better ways of doing things in all the languages you use. Next time I'm asked to explain quicksort, this solution will come to mind, then I can write whatever code I need.



P.S. What are we sorting in the Haskell code? Any object or primitive that can be compared using <>=. Yay polymorphism!

Continue reading Thanks to Haskell, I understand QUICKSORT!! ...

Saturday, March 05, 2005

Wedding plans, installment two.

We booked a banquet hall! I will have the honour of having my wedding at Mississauga Convention Centre This place is a dream come true for Noelia, so I'm really really happy. We spoke with Manuel.. he's a great guy with which to deal. Unfortunately, I could not get seat covers as part of the plan, which means even more expense. I'm hoping that the guests are generous enough with the boosta so that I won't still be paying for this wedding on my silver anniversary. I should have asked Jeff Bezos to sponsor me when I had the chance.

I would rather not disclose the menu at this point, but I can give hints:
prosciutto, veal, chicken, pasta, seafood, porchetta, ice cream, Martinis and lots of sweets.
My guests would best be advised to refrain from eating at least two days before the event.

One thing that shocked me is the bar. They will make any drink, including martinis, etc, etc. They will have all types of coffee such as Irish, Italian, South American, espresso, cappuccino, etc, etc. Even specialty teas such as Green Tea! I'm definitely going to advertise this to my guests. I know that some people would not have even bothered to ask for Green Tea.

The excitement continues.. I'm still about 400 days from being married. It'll be quick.

Continue reading Wedding plans, installment two. ...

I finally get it!

Remember that episode of Family Guy where Stewie sings RocketMan? I never figured out exactly why that was funny. Well, today I found out. It was poking fun of a 1978 performance of the song by William Shatner.

I hate when he sings.


Continue reading I finally get it! ...