The (sometimes) incoherent and inconsistent Ramblings of a math geek, chess addict, and father of two young and adorable kids.
Wednesday, January 31, 2007
Trivia Answers
Tammy got #1 (Jenny) and #5 (Sinead O'Connor) correct for 4 points
Peter J got #2 (Andrew Ridgely & George Michael), #3 (Captain Lou Albano) and #4 (Spandau Ballet) correct for 4 points
Mike M corrected me in that Sinead O'Connor just ripped the Pope's picture, she didn't burn it, so I'll give him a point too.
Pink Floyd's The Wall:
Tammy got #1 (Hey You), #3 (Money) and part of #4 (Alan Parker) for 4 points
Matt got Alan Parker as well - but after Tammy.
The other answers are:
#2: When The Tigers Broke Free and What Shall We Do Now
#4: Alan Parker also directed Fame and The Commitments
#5: Gerald Scarfe
Lyrics:
Peter J gets 3 points for correctly identifying #2 When Doves Cry by Prince from Purple Rain.
#1 is Summer of '68 by Pink Floyd from Atom Heart Mother
#3 is Warm Wet Circles by Marillion from Clutching At Straws
Final Results:
Tammy: 8
Peter J: 7
Mike M: 1
Sunday, January 28, 2007
Trivia for Blogpoints
80's Pop:
- Who are you trying to reach if you call 867-5309? (3 points)
- Who were the two members of Wham? (2 points)
- What WWF manager appeared in Cyndi Lauper's video Girls Just Wanna Have Fun?
- What band recorded True?
- Who burned a picture of Pope John Paul II when appearing as the musical guest on Saturday Night Live?
Pink Floyd's The Wall:
- What song appears on the album, but not in the theatrical release of the film? (2 points)
- What songs appear in the film, but not on the album? (2 points)
- What song's lyrics is 'Pink' writing when the school teacher reads his 'poetry' to the class?
- Who directed the film, and what two other music related films has he directed? (3 points)
- What artist provided the animation and a lot of the set pieces for the tour?
Lyrics: For these questions I give some lyrics, you name the artist, song and album for one point each.
- Would you like to say something before you leave
Perhaps you'd care to state exactly how you feel
We said good-bye before we said hello
I hardly even like you, I shouldn't care at all
We met just six hours ago, the music was too loud - Dig if you will the picture
Of you and I engaged in a kiss
The sweat of your body covers me
Can you my darling...can you picture this? - I saw teenage girls like gaudy moths
A classrooms shabby butterflies
Flirt in the glow of stranded telephone boxes;
Planning white lace weddings from smeared hearts and token proclamations,
Rolled from stolen lipsticks across the razored webs of glass
Sharing cigarettes with experience
With her giggling jealous confidantes,
She faithfully traces his name
With quick bitten fingernails
Through the tears of condensation
That’ll cry through the night
As the glancing headlights of the last bus
Kiss adolescence goodbye
Saturday, January 27, 2007
Random stuff from another blogger
EDIT: The four star movie link is now working - sorry for the bad post yesterday.
Link 1) Four Star Movies this is a list of all the movies that get 4 stars in the Halliwell movie guide (the guide that pioneered the 4 star system). Some people say it is too skewed towards B&W films.
Link 2) From Hell and Other Comics his take on the appeal of Alan Moore as opposed to comics in general
Thursday, January 25, 2007
Tarzan of the Apes
I'm quite enjoying it - as my friends would say about a good movie - it's a real page turner ;).
However, something is bugging me about it (hence this post). I can suspend my disbelief about a grief stricken ape-like mother rescuing a human baby and raising it as her own child. Similarly, I can buy into the fact that Tarzan, after discovering children's books and an English dictionary, is able to teach himself to read and write English despite never encountering written language before. The author is fairly careful to point out that spoken English is completely foreign to Tarzan because he has no idea about pronounciation of any of the letters. However, in a couple of situations, Tarzan writes a note that includes his name! How could he possibly come up with the spelling for 'Tarzan' when he has no idea about the sounds of any of the letters?
Probability and Statistics
Here's a type of probability question I enjoy...and there's 3 blog points up for grabs:
A bag contains 6 red balls and 8 green balls. 5 balls are withdrawn and placed in a red box, the rest are dumped in a green box. What is the probability that the number of green balls in the red box plus the number of red balls in the green box is not a prime number? (For this example assume 1 is defined as prime).
Wednesday, January 24, 2007
Guitar Solos
Here's a link to the post. I wasted a good hour looking at some of my favourites.
Highlights for me included:
- David Gilmour got #4 for Comfortably Numb
- Jimi Hendrix at #5 All Along the Watchtower (he had 3 of the top 20!)
- Brian May for Bohemian Rhapsody at #20
New Features with Rogers
Anyway, I quickly found 4 features, two of which I've been lamenting the absence of for some time:
- When selecting a in-progress recording from the 'list', now you are presented with a choice of whether to start watching at the current point, start watching from the beginning, or to stop recording (with a keep or discard option). The 'start from beginning' feature has been absent prior to this update and a real sore point with me.
- When watching a recorded show you can now see the title and original air date in the info bar. Furthermore, pressing info actually displays the original program description. Nice
- The flip bar will now display TV and MPAA ratings along with the title
- When a recording ends, the status bar indicates you can press 'Live' for live TV (not really sure what the benefit is here)
Monday, January 22, 2007
One Easy, One Hard
1) An intelligent, but eccentric census taker (eccentric means he never questions unnecessarily) came to a house where the three residents were not at home. The housekeeper answered the door. Here is their conversation about the three occupants:
CT: What is the product of their ages?
HK: 1296
CT: What is the sum of their ages?
HK: The same as the house number.
CT: I still can't figure out their ages. Are any of them older than you? (He must know the house keeper's age)
HK: No.
How old are the three occupants?
2) If it takes James 2 hours to mow a lawn and it takes Maya 5 hours to mow the same lawn. How long would it take to mow the lawn if James started feeling sorry for Maya after she had been working for 90 minutes and he started helping? (You can assume they each have their own lawnmower)
Sunday, January 21, 2007
David Gemmel's Rigante Series
Sword In The Storm: 3/4
Midnight Falcon: 4/4
Raven Heart: 2/4
Stormrider: 2/4
New Steelers Coach

Instead it is Mike Tomlin, the one year defensive coordinator of the Minnesota Vikings.
With Whisenhunt leaving, it probably means Mark Whipple - the Steelers QB coach will also depart to the Cardinals. Those are the two guys who have worked the most with Roelisberger thus far. Here's hoping Tomlin is a good coach, and he can find some coaches that Roelisberger can get along with and grow under.
Friday, January 19, 2007
Conference Finals Weekend
The Colts-Pats game this weekend will be very interesting and could go either way. Based on the regular season, it should be a no-brainer for the Colts to win. Furthermore, their defense has really improved in the playoffs shedding their reputation of being unable to stop the run. Unfortunately for the Colts, Peyton Manning has continued his playoff woes. In the last two games he's looked jittery in the pocket. Against KC he threw some uncharacteristic picks and against Baltimore he couldn't get over their 15 yard line.
On the other side, New England just seemed to manage to hang around against San Diego. They didn't make any killer mistakes and took advantage of the bone headed plays on the other side of the ball. One big positive is that they have Brady and Belichek who are now 12-1 in the playoffs. The downsides are the same as they've been all year: no playmakers or big names on either side of the ball, rookie safeties (because of injuries), rookie placekicker (Vinatieri is now on the Colts), relatively slow linebackers.
On paper this shouldn't even be close and the Colts should walk away with it. But because of the Brady-Belichek vs Manning-Dungy factor it throws all the regular season statistics in doubt.
I'm still going to pick the Colts to beat the Pats however.
Thursday, January 18, 2007
The Pros and Cons of Travelling
Good
- face to face contact with partners results in better understanding of each others problems and concerns
- putting a face to a name you've heard before, or spoken with, or emailed back and forth adds a dimension to the relationship
- all food and drink will be reimbursed (especially good when travelling with my boss who picks up the expensive meals)
- finding a pretty good jazz club in Philly that had two great bands on consecutive nights (a tuesday and wednesday, no less)
- no screaming kids in the middle of the night in a hotel
- meeting the bouncer in the aforementioned club and realizing what a great guy he was - Philly truly is the city of brotherly love (also - see below)
- Leaving the family is stressful on both me and my wife
- A hotel that is under construction is not much fun - the power to the alarm clock went out both nights
- The TSA and the stupid 'enhanced searches' I always seem to receive
- Canadian Immigration screw-ups....it's still not resolved so I got hassled getting back in to my own country
- Mesaba Airlines operates the NWA airlink between London and Detroit - they have the worst planes I've ever been on. The seats are really uncomfortable
- Rushing to get a conneting flight when the first flight is late
- Sitting on the runway while your plane is de-iced
- Walking to the hotel and seeing a large homeless man masturbating while lying on the sidewalk - I said it was the city of Brotherly Love.
Wednesday, January 17, 2007
Retroactive Blog Points
2 points per correct answer. I'm going to give myself 1 blog point for each question that stumps the (somewhat less than massive) readership for at least one week.
Kimota94 receives 8 blog points for correctly solving One Of My Turns, Speak To Me, Word Problem, and the first half of the Big Number Problem.
Vish gets 2 blog points for his answer to the second part of the Big Number Problem. I'll also give him 1 point for his answer to One Of My Turns because it came after Kimota's answer was already published and acknowledged as correct.
And cjg gets 1 blog point for getting the answer to Brain Damage - but through a brute force mechanism rather then the theoretical/calculable method I was looking for.
I get 3 blog points for the unsolved (or incorrectly 'solved') questions Biding My Time, Math Is Fun, and Making Change.
This vaults Kimota94 well into the lead for blog points.
NFL Playoffs - the weekend that was.
Bal-Ind: Battle of field goals. The Ravens has a strange game plan. They hardly blitzed at all which is very different from their regular season defensive strategy. They may have been trying to emulate Pittsburg from last year who were a blitzing team in the regular season, then surprised Indy by playing a straight defense in the playoffs and coming out of the RCA Dome with an upset victory on the way to the Superbowl. However, Baltimore should have recognized that Indy wasn't confused or surprised by the regular defense this year and they should have adjusted their strategy to try something different. On offense, nothing seemed to work for Baltimore. This could be the result of coaching ego in that head coach Brian Billick fired his offensive coordinator mid-season and took over play calling duties. Maybe he should fire himself after that 6 point outing against a supposedly sup-par defense.
NO-Phi: An entertaining game that was much closer than I expected. I loved the NO running game and still like their chances to win it all. At the close of the game, NO was running the ball well and running the clock down when they executed a 'flip' (sort of a handoff but tossing the ball to a moving RB - in this case Reggie Bush). Unfortunately Bush bobbled it and it resulted in Philly recovering the fumble around mid field with 2 minutes remaining and 2 timeouts down by 3 points. NO managed to force a 4th and 10 and Philly converted with a 18 yard passing play (long passes seemed to work really well all day for Philly) - but there was an offensive penalty on the play resulting in 4th and 15. Then Philly sent out the punting unit?!??!?!?!?! I couldn't believe it. It was like they were giving up? What were they thinking. They have two timeouts left and less than two minutes to go they just went for it and made a long pass. A couple of years ago they completed a 25 yard play on 4th and 24 against the Packers. Why'd they give up?
Chi-Sea: Much closer than expected. I only watched the OT. What a clutch play by the Chicago kicker to win with a long field goal outside. Rex Grossman will kill the Bears next week against New Orleans.
SD-NE: Again Marty Shottenheimer crapped his pants in the playoffs and Brady/Belicheck proved completely unflappable. A couple of the low-lights from a San Diego point of view:
- Stupid head butt penalty on NE fourth down resulted in a new set of downs and eventually three points for New England.
- After New England tied the game with less than five minutes left with a two point conversion, SD apparently forgot they could run the ball. Their RB is the League MVP, to this point they had been gaining about 5 yards per rushing attempt. However, they decided to put the game in the hands of first year starter Philip Rivers which resulted in a couple of incompletions (which stopped the clock allowing New England to engineer a drive resulting in a field goal)
- SD challenged a play resulting in a fumble that was obviously a fumble. This wasted a second half timeout. What would have happened if they still had this timeout when they reached the NE 36 with 24 seconds left? Not a 54 yard field goal, I'm guessing.
Because of the SD loss, I'll have to revisit my predictions for the conference finals.
Sunday, January 14, 2007
Totally Eighties
Here is a sample card, and borrowing from Kimota94 - there are "blog points"tm up for grabs:
HL: What firm set a record for profits on Wall Street in 1986 thanks to Michael Milken's shady dealings?
TV: What show featuring the exploits of everyday folks was hosted by luminaries like Byron Allen, Mark Russell, and Fred Willard?
MOV: What stand-up comic played an old rich dude after Rodney Dangerfield backed out of Caddyshack II?
MUS: What critically panned song from The Woman in Red was Stevie Wonder's best-selling single ever?
S&L: What was the first home video game to let players take a bead on wildlife with Nintendo's patented "light gun" controller?
WC: What European lake was systematically swept by sonar cruisers in 1987's Operation Deepscan?
Friday, January 12, 2007
Good Interviewers Make A Big Difference
Last week Matt hosted "The Current" in the morning and did an excellent job spelling for Anna Marie Tremonti.
Moving Day
I hate packing up my stuff....probably because I have too much of it. It took a couple of hours and I ended up with 5 boxes, plus a bookshelf, plus my computer, plus two TVs. I should really get rid of some of the stuff I don't use frequently. I may have to if the new area I'm moving in to is as small as I think it may be.
Thursday, January 11, 2007
Lemmatisation
I was in a video conference talking about searching Video On Demand content from a set top box. The company providing the server side indexing system mentioned the concept of "Lemmatisation and Stemming" in passing without any explanation. So...I did a little research and found that this term is used in the linguistics area of artificial intelligence.
Lemmatisation takes a sentence (or any sequence of words) and parses it identifying the part of speech (noun, adverb, etc.) of each word and then reduces the word to its base (cannonical) meaning. For example go, goes, going, and went would all be replaced by "go". Because the analyzer requires a knowledge of the grammar being used different languages require different parsers.
Stemming just removes any common pre/post fixes to get to the root meaning of the word. This is a much simpler form of lemmatisation because it doesn't need to analyze any context nor does it care about language grammar.
In the Video On Demand example, the searchable text and the search string will be lemmatised to reduce the potential dictionary of search terms and make fuzzy connections between what is explicitly being requested and what is being returned.
Pretty powerful stuff.
Wednesday, January 10, 2007
Big Number Problems
Here are two 'easy' ones (Easy in that it only requires public school level arithmetic to solve).
1) What is the sum of all the digits used in writing out all the numbers from 1 to 1,000,000,000?
2) What is the product of 666...666 * 333...333 (where each number has 666 digits, the first being all sixes, the second being all threes).
Bathroom Shenanigans
Then I realized why she had done it. Last weekend when we had guests over she went to the bathroom and used the last piece of toilet paper (because the roll was very close to empty). When she came back downstairs she announced that fact to us and our guests which elicited a big laugh. So Maya had associated using the last of the toilet paper with doing something funny.
I guess it just shows you, that you have to be careful in how you react to the strange things kids sometimes say.
Tuesday, January 9, 2007
NFL Playoff Preview
Here's some more analysis that outlines why I think this will happen.
New England at San Diego:
A few stats here would lead you to think that the Patriots have a decent chance at winning in San Diego:
- Tom Brady is 11-1 as a starter in the playoffs
- Philip Rivers (the SD QB) has never played in a playoff game
- Marty Schottenheimer (the SD head coach) is 5-12 in the postseason and has not coached a playoff victory in 13 years.
The Patriots seemed to handle the Jets reasonably well last week, but their lack of a big play maker at wide receiver showed and they relied on their defense. It will be tough for them to come away from San Diego as the winner.
Pick: The San Diego Chargers
Indianapolis at Baltimore:
Last weekend, Payton Manning didn't exactly look brilliant playing against Kansas City. He threw a bunch of interceptions and couldn't seem to get things done in the red zone so they ended up settling for a bunch of field goals. In the regular season that never seemed to happen. However, their defense played really well shutting down the Kansas City running attack. KC didn't even get a first down until the last few minutes of the third quarter! Indy extended their home record to a perfect 9-0 this season with that win. However, now they are travelling to Baltimore, and Indy is 2-7 in outdoor playoff games.
I've said that Baltimore has been overrated for most of the season. I don't think that Steve 'Air' McNair is a quarterback that can be relied on to manage a game for a full 60 minutes. He has moments when he looks great - and then he throws a completely uncatchable ball that is quite often intercepted.
This meeting will be a matchup of the great Indy offense against the great Baltimore defense. I think one of the reasons for the resurgence of Ray Lewis and the Baltimore defense has been the play of their rookie defensive lineman Ngata. He's been able to absorb a couple of OL blockers making room for the fast Baltimore linebackers to make plays in the backfield. This is the key to any 3-4 defensive scheme and it has worked well so far. However, as most rookies do, Ngata is probably reaching the 'rookie wall' where he isn't used to the extended NFL season. I don't think he'll be able to maintain that level of play this weekend.
Pick: Indianapolis Colts.
Seattle at Chicago:
Seattle looked pretty bad last week and is lucky to still be in the playoffs. They can thank the mistakes of the Dallas Cowboys for that. Seattle has injuries at defensive back hand has a guy they signed off the street in the last week of the season (Hunter, I think) playing as their third defensive back. Dallas didn't really try to take advantage of this by going to 4 or 5 wide receiver sets very often which can be blamed directly on Bill Parcells.
Chicago had a great season, the only down side being that their quarterback, Rex Grossman, had a few stinker games (QB ratings of 0 and 1.3!!!) where he turned the all over a number of times and didn't look like he knew which team he was throwing the ball to. Arizona should have beat them on Monday Night Football (one of the few games of theirs I actually watched). However, their defense and special teams have been outstanding all year long.
If Rex Grossman doesn't turn the ball over more than 2 or 3 times, and their defense plays at leas their 'B+ game', then Chicago shouldn't have much trouble beating the Seahawks.
Pick: Chicago Bears
Philadelphia at New Orleans:
Philly looked like they just did enough to beat the Giants last weekend. They weren't able to take control and 'win early' and let the Giants hang around too long. However, they were able to win the field position battle in the third quarter and eventually came away with the win.
However, this week they won't have their loud fans booing the Saints. Instead they'll be listening to the cheers of fans who haven't had much go their way in the last couple of years with the exception of this Saints team. Drew Brees and Reggie Bush have lifted the spirits of the entire city. Coming off shoulder surgery in the off season, Drew Brees has been, arguably, the best quarterback in the entire league. Sean Payton, the Saints' rookie coach, was voted coach of the year.
I've picked New Orleans to win it all this year despite them never winning a playoff game past the wild-card round in their history.
Pick: New Orleans Saints
The pick I'm most confident about is the Chicago pick - Seattle doesn't stand a chance. The pick I'm least comfortable about is the San Diego pick - New England and Tom Brady are always dangerous in the playoffs.
Monday, January 8, 2007
Word Problem
Sunday, January 7, 2007
End of an Era

On Friday, Bill Cowher announced he was leaving his position as coach of the Pittsburgh Steelers. Having been the longest-tenured coach in the league for the past 8 years, and having won a SuperBowl, and been to 5 AFC championship games. I'd say he's earned the right to leave the position with his head held high.
I hope the Steelers promote someone from within the organization to replace him rather than hiring a new coach. My first choice would be offensive coordinator Ken Wisenhunt. The Steelers aren't exactly experienced at hiring head coaches (they've had two since 1969 - Chuck Noll and Bill Cowher), but the ones they've chosen have been incredibly successful. Let's hope they go 3-3.
NFL playoffs so far
Indy dominated a pathetic Kansas City team. KC should have done much better, but apparently their offense was unaware they were in the playoffs and failed to show up. Indy's defense performed well, but I think it was more an ineptitude from Kansas City (especially their offensive line) that made the game so one sided.
I only watched the last half of the Dallas-Seattle game (I've mentioned before that I care a lot less about the NFC, right). Two thoughts dominated my mind for most of the time I watched the game:
- These are two of the best teams in the NFC? Thank goodness I didn't spend much time watching Fox telecasts this season.
- Tony Romo is a Pro-Bowl quarterback? Huh? How is that possible?
Saturday, January 6, 2007
Memory
In these cases I'd experience something, and then find myself reflecting on it a few minutes later as if it had happened much longer ago. It's as if I had purposely transfered the experience from my short term memory to long term and then recalled it from that long term memory. That's the only way I can explain the feeling of something that I just experienced seeming like it happened weeks or months prior.
The first time I had this experience was when I lived in England. I was in the equivalent of grade two and my family was going to move to Canada over the summer break. My class was visiting the next class - where most of them would be when school restarted. We played 'I Spy' in the class, then we walked back to our classroom. During that walk we went through a courtyard where there were a number of student desks lining the wall. As I passed by one of the desks, I placed my fingers in the hole in the desk surface left for the 'inkwell' (did I mention this was an old school in England). When we got back to our class, I had a 'recollection' of putting my fingers in the inkwell. At that point, I knew that I'd always remember what we had just done.
I've had this happen a handful of times in my life. I can't yet control this ability to force an experience into my long term memory. But I probably try to do it at least once a month. It's frustrating to know I have this ability, but not know how to use it.
Friday, January 5, 2007
Making Change - The Answer
This is a much harder problem than it initially seems. Credit goes to Kimota94 for attempting it - he had the right idea but used multiplication between the steps instead of addition which resulted in a much larger answer. Nobody else seemed brave enough to venture an answer.
I used a recursive approach to come up with the answer.
Let An be the number of ways to make n cents with pennies.
Let Bn be the number of ways to make n cents with pennies and nickels.
Let Cn be the number of ways to make n cents with pennies, nickels, and dimes.
Let Dn be the number of ways to make n cents with pennies, nickels, dimes, and quarters.
The question is asking us to find D100
The number of ways to make Dn when n >= 25 if at least 1 quarter is used is Dn-25, while the number of ways to make Dn when no quarter is used is Cn.
Therefore: Dn = Cn + Dn-25, n >= 25
Similarly:
Cn = Bn + Cn-10, n>=10
Bn = An + Bn-5, n>=5
It is obvious that An is always 1.
It is slightly less obvious, but fairly clear to see that Bn is 1+x where x is n/5 truncated to the integer portion of the quotient. We can show this obvious solution by proving it true for the first few values of n and then relying on the recursive definition above.
If n <>n = 1 (only pennies are possible). For n = 5, there are two choices: 1 nickel or 5 pennies. If 5 < n <>
Therefore B5 = 2, B10 = 3, B15 = 4, ..., B100=21.
We want D100, let's use some substitution here:
D100 = C100+D75
D100 = C100+C75+D50
D100 = C100+C75+C50+D25
D100 = C100+C75+C50+C25+1
Similarly:
C100 = B100+B90+B80+B70+B60+B50+B40+B30+B20+B10+1
C75 = B75+B65+B55+B45+B35+B25+B15+B5 (note no +1, since C5 = B5)
C50 = B50+B40+B30+B20+B10+1
C25 = B25+B15+B5
Substituting with the values of Bn in the formula above we see:
C100 = 21+19+17+15+13+11+9+7+5+3+1 = 121
C75 = 16+14+12+10+8+6+4+2 = 72
C50 = 11+9+7+5+3+1 = 36
C25 = 6+4+2 = 12
Finally:
D100 = C100+C75+C50+C25+1 = 121+72+36+12+1 = 242
So there are 242 ways to uniquely make change for $1 using pennies, nickels, dimes, and quarters.
New channels in the Rogers Lineup
Thursday, January 4, 2007
The Registrar Idiom
To construct/create objects without hard-coding the class name in the code.
Motivation
I heard that this sort of technique was used by the developers of the AS/400 OS to introduce new printer drivers at runtime. One of the complaints of an old version was the length of time required to install new drivers, so when IBM re-wrote the OS in C++ one of the goals was to have a dynamic run time registration system for new hardware drivers. The developers used this idiom to accomplish that requirement.
C++ vs Java
This is much simpler to do in Java with the static code block facility that is executed when the .class file is loaded by the VM. The solution below details how to accomplish this Idiom in C++, doing the same in Java is omitted for brevity.
Solution
- Add a clone() method to all classes (The 'Virtual Copy Constructor?' Idiom)
- Create a Map instance to use as a registry for all the subclasses of Thing
- This must use 'construct on first use' semantics
- This should be a static member of the base class, so the Registrar is referenced as Thing::registrar()
- 'Ugly' code can populate the registry with hard-coded or well known subclasses of 'Thing' as follows
Thing::registrar()["ThingA"] = new ThingA();
Thing::registrar()["ThingB"] = new ThingB();
... (one per derived class) - The original goal is achieved as now the following works:
String className = ...;
Thing *t = Thing.getThing(className);
where
Thing* Thing::getThing(String className)
{
return Thing::registrar()[className]->clone();
} - OPTIONAL:
- Use the constructor of a static object in the derived class to populate the registry
- If the registry doesn't contain className, then getThing can try to dynamically load a library that could contain the new derived class and then retry querying the registry.
Example
Shape.h
class Shape
{
public:
...
virtual Shape* clone() const = 0;
Shape* getShape(String& name);
...
protected:
...
static Map& registrar();
...
class Registrarer {
public:
Registrarer(String className, Shape* prototype);
};
...
private:
...
};
Shape.cpp
Map& Shape::registrar()
{
static Map* registry = new Map ;
return *registry;
}
Shape* Shape::getShape(String& name)
{
if (!registrar().containsKey(className))
{
String DLLName = className + ".DLL";
// try to load DLL containing the requested shape...
...
if (!registrar().containsKey(className))
throw Exception("Can't find: " + className);
}
return registrar()[className]->clone();
}
...
Shape::Registrarer(String className, Shape* prototype)
{
Shape::registrar()[className] = prototype;
}
...
Circle.cpp (note no .h is necessary)
class Circle : public Shape
{
public:
...
virtual Shape* clone() const;
...
private:
...
static Shape::Registrarer reg_;
...
};
// Automatically add myself to the Shape registry
Shape::Registarer Circle::reg_("Circle", new Circle());
...
Arghhhh..
So, last night I didn't sleep very much between doing some work, and Elliot not sleeping very much. I ended up getting about 75 minutes starting around 1AM, and then another 30 minutes around 3. Kelly relieved me at 5:30 when I took another 3 hours before going to work. This led me to have a fairly short fuse today which aggravated the situation.
I get in to work and find that an individual at another company is making false claims about me and my work in order to cover his own behind. I'm not sure how in detail I should go here...in fact I may have crossed the line already...\
Suffice it to say, I was pretty frustrated. I got a chance to confront my accuser via tele-conference with our respective bosses present and it went OK. Although there were a number of issues I heard were raised in the morning that were never addressed in the afternoon call. I trust my boss will follow up on them though so that sort of thing doesn't go un-mentioned for too long.
Hopefully everything will be better going forward.
Wednesday, January 3, 2007
Boom Goes the Dynamite
I'm not sure what the solution is...but I'm sure Google has a plan - you have to have a plan before spending 1.65 BILLION dollars, right?
Anyway, in the Wired article, they mentioned one of the viral clips hosted on YouTube called 'Boom Goes The Dynamite'...I watched it (and embedded it below). I didn't find it that funny...but if you like laughing at uncomfortable situations and the mistakes of others here is possibly, the worst sportscast ever....
2007 Canada Payroll Tax Limits
The EI maximum contribution is $702.00 down from $729.30 (unless you're in Quebec where the EI maximum contribution is $569.40 down from $596.70).
Tuesday, January 2, 2007
Hey Buddy..You Got Change For A Dollar?
Using just pennies, nickels, dimes, and quarters, how many distinct ways are there to get $1 (order does not matter).
NFL Playoffs
The NFL playoffs offer two weekends of exciting matchups (wild card weekend, and the conference finals) and two weekends of let down matchups that will probably be blowouts (division weekend and the SuperBowl). It's always fun, but almost never accurate, to try and predict what will happen so here's my shot:
Wild Card Weekend
Kansas City Chiefs at Indianapolis Colts:
On paper this looks like it could be an offensive shootout, with the KC Chiefs impressive rushing against the poor Indianapolis rush defense on one side and Peyton manning on the other.
Both coaches have less than impressive playoff records, with Herm Edwards being especially poor in Time Management (see NYJ v PIT two years ago).
I'm going with Indy in this one since:
- The Colts are playing at home where they are 8-0
- KC lost to Pittsburgh like 87-3 or something equally lopsided earlier this season, and the Steelers couldn't even make the postseason
- KC must be just happy making the playoffs after needing about 6 things to happen last weekend to make it (including nail-biting OT loses by both the bengals and broncos)
- KC is only 3-5 on the road
- Larry Johnson (KC RB) has rushed a ton this year (pretty much their entire offense) and must be at the point of breaking
- Indy desperately wants to shake its rep as playoff choke artists (they started by choking in the regular season)
New York Jets at New England Patriots:
As members of the same division, these two have played twice already - each winning the 'away' game. This game will be played at New England's Gillette Stadium. Don't expect a repeat performance of the 17-14 loss the Pats had in that game though. The Jets' coach, Eric Mangini, is a rookie and the youngest in the NFL and was also a former assistant of the Patriots' Bill Belichek.
The only concern for the Patriots is the same one they've faced all year - no real playmakers at wide receiver. They'll rely on the same three aspects they've used all year to win:
- Well coached players - probably the best in the league
- Smart play calling on both sides of the ball
- Tom Brady - [channelling generic sports announcer]"This guy just knows how to win games in the National Football League"[end channelling]
Dallas Cowboys at Seattle Seahawks:
I really don't follow the NFC nearly as closely as the AFC (because the Steelers are in the AFC, and the AFC seems to just be a better conference at this point, as evident from the last SuperBowl with the #6 AFC seed beating the #1 NFC seed). However, I'll still try to predict these games.
Dallas is starting a rookie QB (Tony Romo) who won his first few starts but has looked terrible in the last couple, has the ongoing soap opera of a WR in Terrell Owens, and the super arrogant/over-rated coach Bill Parcells.
Meanwhile, the other sideline will have the SuperBowl losers from last year with only one appreciable difference from last years team - the departed Pro Bowl OL Steve Hutchinson. Last year, the Seahawks seemed almost unbeatable at home, but this year they were a mediocre 5-3 (good enough for the playoffs in the NFC).
I have to think that Seattle just has to not make any big mistakes and Dallas would have to play almost as perfectly as they can in order for the Cowboys to progress any further in the postseason. I don't see that happening, so...
Pick: Seahawks
New York Giants at Philadelphia Eagles:
I've picked each home team so far, and even though the odds are against all home teams winning, in the wild-card weeked, I still can't pick the Giants to beat the Eagles.
The Giants have Manning the Younger at QB, Tiki Barber and RB, Jeremy Shockey at TE and former Steeler Plaxico Burress at WR. So on paper they look like they have a really good offense that would be able to beat a team that lost its starting QB to injury in the season, its best WR to Dallas in the offseason, and hasn't had a decent running game since Randall Cunningham was their QB. Unfortunately they removed the play calling duties from their offensive coordinator after week 16 ( replace by Kevin Gilbride last week) and they have a head coach in Tom Coughlin who likes to take credit for the victories and blame others (notably Eli Manning, their place kicker, and offensive coordinator) for their loses - not exactly what you look for in a leader. Tiki Barber has been promoting his retirement and post-football career since the midpoint of the season.
The Eagles have lots of playoff experience in the past few years, a big advantage of playing at home, and Jeff Garcia (their replacement QB) knows how to win from his time in the CFL and with the 49ers.
Pick: The Eagles
Assuming everything happens as I predicted above I see Indy beating Baltimore in Baltimore in the division weekend, with the remaining home teams (San Diego, Chicago, and New Orleans) winning.
Then in the Conference Weekend San Diego beating Indy and New Orleans beating Chicago.
Finally, the SuperBowl will be won by New Orleans.
Monday, January 1, 2007
How I Can Tell I'm Old
Guess I'm just out of touch with pop-culture.
Casino Royale
The plot was typical of most bond movies - a few action sequences loosely interconnected to a general world threat that was overcome by a single British Secret Agent, some double crosses.
When the title sequence started I got really excited (pretty childish, I know). The movie started with the activities that led to James Bond getting 'promoted' to double-0 status. This led me to think that with a new Bond actor, they are trying to restart the franchise, similar to the success of 'Batman Begins'.
I thought Daniel Craig played Bond exactly as he should be played. Cocky, self-aware, rough, but not overly suave/sophisticated (my biggest complaints about Dalton and Brosnan). Similar to On Her Majesty's Secret Service they showed how a true relationship with a woman affected Bond's personality going forward and provided an explanation for how he can treat peope's lives (men and women) with such indifference.
In a departure from previous Bond movies, where Bond played a card game at a casino it was Texas Hold-Em instead of Chemin De Fer (or Baccarat). This probably makes sense with the current poker craze and the general understanding of the rules of that game as opposed to the former. This is especially true considering how integral to the script the gambling scenes were.
Other than Daniel Craig himself, the only actors I recognized were Dame Judi Dench (as M again), and Jeffrey Wright (from Ali and Syriana), who played Felix Leiter. This is something I appreciate about the classic Bond movies - they use actors that are not Hollywood 'names'. It is something they got away from in the later Bond movies that led to them being more like typical Hollywood action fare (think Vin Diesel) rather than the separate (better) class of movies. The actress that played Vesper (the Bond Girl) was pretty good, although Kelly complained that she always had "the same stupid expression". She actually reminded me of Tammy a little bit - especially her eyes.
Woulda, Coulda, Shoulda
Had they beaten any one of the AFC teams they lost to in the regular season (including the pathetic Oakland Raiders) they would have been in the playoffs.
Oh well, there's always next year...that and the fact that they are still the reigning (I can no longer say defending) SuperBowl champions.
Math is Fun - The Answer
Solution:
First notice that 225 = 9 * 25 so the correct solution will be a multiple of both 9 and 25.
Starting with the factor 25...any multiple of 25 will end with one of 25, 50, 75, or 00. Obviously 00 is the only potential ending that meets the criteria of only having the digit 0 or 1.
Next, we know from this post that the sum of all the digits of any multiple of 9 is also divisible by 9. Since we are restricted to just using ones and zeros, the smallest number divisible by 9 will be 9 consecutive ones.
Combining those previous two observations we get the solution that the smallest positive integer that is evenly divisible by 225 is: 11,111,111,100.