Archive for July, 2007

Order Of The Phoenix

If you follow the Harry Potter series you know that Harry is a reluctant hero. He’s famous for being the only person to have ever survived the Killing Curse. But he does not wear his fame proudly; he’s tormented by a celebrity that he never asked for, and mourns the loss of parents he never knew.

Harry’s fame has always been one of his biggest challenges. Because he survived Lord Voldemort’s attempt to kill him, he’s supposed to be a great wizard. Yet Harry has often succeeded more because of the talents of others than anything he has done himself. He defeated Lord Voldemort’s attempt to regain a body in The Sorcerer’s Stone largely because of the sacrifice of his mother, which gave him the “ultimate protection”. He survived a young Voldemort in the form of Tom Riddle in The Chamber of Secrets because of the deus ex machina in the form of Fawkes the Phoenix and the Sorting Hat. It wasn’t until The Prisoner of Askaban that Harry finally displayed the sort of powers that had been expected of him, when he saved his godfather from certain death at the hands of the dementors by producing a Patronus Charm, a spell of considerable difficulty for a wizard his age.

It seems fitting then that in The Order of the Phoenix Harry takes the next step toward wizard greatness and begins to earn some of the reputation that has dogged him these many years.

Harry Potter and the Order of the Phoenix is the darkest Harry Potter film thus far. It also possesses some of the best individual moments in any Potter movie (even if it doesn’t satisfy as a whole film as much as the others), mostly because we finally get to see Harry make the transformation from reluctant hero to leader of wizards.

Hogwarts is under siege this year. The Ministry of Magic is doing everything it can to turn a blind eye toward the return of Lord Voldemort. The Minister, Cornelius Fudge, has planted one of his own among the staff: Dolorus Umbridge, brilliantly played by Imelda Staunton, the new Defense Against The Dark Arts instructor. Her mission is to wrestle control of the school away from professor Dumbledore. This she accomplishes through a series of increasingly ridiculous rules and regulations.

Umbridge is a great villain; her allegiance is to the Ministry of Magic, which puts here directly at odds with Harry. Her punishment for Harry (his crime: he doesn’t like being called a “liar”) is so vile it can only be classified as torture. She also refuses to teach the students any real magic, instead attempting to handicap them by relying solely on the text of very basic books for their learning. This infuriates Harry and his classmates, to the point where Harry reluctantly allows himself to be persuaded by his friends to teach a secret Defense Against The Dark Arts class. The students dub themselves Dumledore’s Army.

It is during these sessions that we get to see Harry grow into the sort of teacher and leader we’ve expected. He instructs his fellow students like an old pro, as if he’s been doing this as long as any of his previous Defense Against the Dark Arts instructors, and we see for the first time that Harry is indeed a great wizard. He may have ridden luck, nerve and the help and talents of his friends this far, but when it comes to combat Harry is an exceptional wizard. He begins to accept the mantle of responsibility that has been placed on his shoulders, and it is a wonderful transformation to watch on screen. I saw the movie with full house of Potter fans and it was particularly rewarding to watch them cheer a scene in which the inept Neville Longbottom finally succeeds in disarming a fellow student.

The book that the movie is based on comes in at 870 pages, the longest of the Potter books. The film, however, clocks in at 138 minutes, the shortest film in the series. While the director David Yates and screenwriter Michael Goldenberg wisely trim the film of many of the side stories and sub plots from the book, it could have used another twenty or thirty minutes of development for the main story. Having read the book prior to seeing the movie, I noticed several scenes in the film that were exceptionally brief almost to the point of being unclear. Some viewers are going to feel like they’re missing out on a larger story (and they are).

That said, the core of the book is still there, and the actors do as much as they can with the limited time they are given. Gary Oldman is incredibly effective as Harry’s godfather, Sirius Black. Harry has a great deal of affection for the only person he can truly call ‘family’, and Oldman does great work here conveying their connection. Entire conversations pass between then with a look and a wink. Evanna Lynch is also pitch perfect as Luna Lovegood, so much so that one wonders if they ripped her character straight off the pages of the book. And Jason Isaacs gets more screen time as Lucius Malfoy, the unabashed ally of Lord Voldemort, now openly working for his master without fear from the Ministry of Magic or anyone else.

If there’s a flaw with the film it is in the source material. The Order of the Phoenix is widely believed to be the weakest of the Potter books. This is probably due to the unsatisfying way that Umbridge’s comeuppance is handled, and the overall lack of awe that the ‘prophecy’ inspires. But those are minor issues. The real meat of The Order of the Phoenix is in Harry’s emergence as a mentor and role model for his fellow students. Harry accepts his fate now, and that gives him a resolve that seems befitting of his reputation. The rest of the film is handled incredibly well, taking into accounted the abbreviated nature of the film. The hostile takeover of Hogwarts by Umbridge is perfectly infuriating and the final confrontation at the Ministry of Magic between Dumbledore’s Army, the Death Eaters, The Order of the Phoenix and Lord Voldemort is one of the most rewarding special effects scenes in any of the Potter films.

More than anything, this film perfectly sets up the next two. The world Harry Potter lives in is growing darker and more dangerous and The Order of the Phoenix does just about everything right to prepare us for the final encounters.

1408

Fifty-six people have died in room 1408, explains Gerald Olin (Samuel L. Jackson), the manager of the Dolphin hotel, to Mike Enslin (John Cusack). Olin, in his efforts to dissuade Enslin from staying in the room for an evening, provides him with a thick photo album containing pictures of the more gruesome deaths, the ones that weren’t the result of ‘natural causes’. Enslin doesn’t buy the story, however, because in a bit of irony the writer responsible for such paranormal best sellers as Ten Nights in Ten Haunted Hotel Rooms is a skeptic. He doesn’t believe in ghosts, poltergeists, or haunted hotels, and thinks that they are simply the product of hotel managers trying to bump bookings when interstate roads reroute business away from them.

Undaunted by Olin’s ominous warnings, Mike Enslin journeys into room 1408. From the very beginning, Enslin is faced with bizarre occurrences and frightening images. Skeptic that he is, Enslin at first attempts to explain what is happening to him by reasoning out logical solutions, periodically pausing to dictate his thoughts into a small tape recorder. But as the events grow more frightening and hazardous to Enslin’s health, he abandon’s the idea that what he is witnessing is staged and decides that it’s time to get out. The room, predictably, works to prevent that from happening.

The film is directed by Mikael HÃ¥fström and plays more or less like a typical haunted house genre movie. There’s a couple of problems with the film, however, that keep it from being as good as it could be.

The first problem is that John Cusack feels like the wrong actor for this role. The character of Mike Enslin is a broken man at the start of this movie; a guy who is a cynic and skeptic, who has lost his faith in God due to personal tragedies in his life. He doesn’t even believe his own writing, and comes across as a fraud. Enslin doesn’t feel like a guy we should be rooting for.

Cusack, on the other hand, is an actor who is instantly likable in anything he does. Because of that, it’s really difficult to buy him as a broken-down cynic. The movie is basically Enslin vs. The Room, and because Cusack is so likable we’re rooting for him from the get-go. But the story would have been more effective if Enslin would have been someone we didn’t initially like. If we could witness Enslin transform over the course of the film from a broken-down cynic into a man who gets his faith back via the difficult encounter with the room, it would have been a powerful makeover to witness and would have given the film some much needed weight. As it is, the film comes across as thin and Cusack’s character actually seems to lose dimensionality as the story progresses. It’s not often that a main character such as Mike Enslin is actually more interesting at the beginning of the movie than at the end.

The other problem with the film is that the writers and director opt for the cheap horror movie parlor trick toward the end. I don’t want to give too much away, despite the disappointment here, but what the filmmakers pull is a variation on the age old “is it real, or is it a dream?” trick, which creates an unnecessary layer of ambiguity that only serves to cheapen the previous 90 minutes of storytelling and reduce the impact of the film’s final scene. The movie would have been better with such theatrical gadgets left on the cutting room floor.

The film isn’t a complete waste of time, but it’s not anywhere close to being as good as it could have been had the creators simply taken a more straightforward approach to storytelling and left the parlor tricks for the lesser horror fare like Halloween and Friday the 13th. What happens in the room is, at times, genuinely chilling. A better movie would have stayed on point and pitted Enslin’s cynicism against the room’s terror until there was a clear winner.

People have been asking me for this code for a while, so it’s about time I put it up. There are two chunks of code: (a) A sample application to show how I use the service and (b) the UIService project by itself, in case you just want to reference the code in your project and get started.


Source code for the sample application: here


Source code for only UIService: here

Previously I discussed a method for solving the Active View Problem. The Cliff Notes version of the solution goes like this: Give every view a unique identifier, and then when you show that view, use some service to record the fact that is just got shown and is now the “active view”. Subsequent logic in your application can test to see if a particular view is the active view before executing certain code paths.

This is all very convenient for figuring out the active view, but a lot of people were in the dark about how this solution could help them manage the ToolStrip. That’s where the UIService/ToolStripService comes in.

The UIService I’ve implemented contains a sub-service called the ToolStripService. It’s job is to manage ToolStripGroups. ToolStripGroups are simply a way to configure a group of ToolStripButtons under one name. So you can write code like this to create a group and associated the commandHandlers with that group name:


_uiService.ToolStripService.Groups.Add("EmployeeGroup");
_uiService.ToolStripService.Groups["EmployeeGroup"].Commands.Add("SaveEmployee");
_uiService.ToolStripService.Groups["EmployeeGroup"].Commands.Add("UndoEmployeeChanges");

Once you have created all of the groups you wish, you can load them by simply calling the ToolStripService:


_uiService.ToolStripService.LoadGroup("EmployeeGroup");

The ToolStripService takes care of clearing the ToolStrip and loading the appropriate buttons based on the group you’ve previously created.

As far as creating the actual buttons goes, you can also make use of the ToolStripService to perform this function for you. I’ve included a ToolStripItemFactory which the ToolStripService makes use of to create ToolStripItems. If you want to adjust the way your buttons get created (borders, or any other visual aspect) just adjust the factory.

Creating a new ToolStripButton looks like this:



ToolStripItem item = _uiService.ToolStripService.Items.Add(CommandNames.SaveEmployee, "Save", Resources.SaveButton, "Save");
Commands[CommandNames.SaveEmployee].AddInvoker(item, "Click");

Note the second line: you still have to add the invoker to the WorkItem’s Commands collection.

There’s one other key thing you cannot forget to do: you must let the ToolStripService know about the UIExtensionSite otherwise you will get an exception when the service tries to clear the ToolStrip UIExtensionSite. Typically I do this in the ShellApplication class, in the AfterShellCreated override (after I’ve already added the UIService in the ShellApplication’s AddServices override):


protected override void AfterShellCreated()
{
   base.AfterShellCreated();

   RootWorkItem.UIExtensionSites.RegisterSite(UIExtensionSiteNames.MainMenu, Shell.MainMenuStrip);
   RootWorkItem.UIExtensionSites.RegisterSite(UIExtensionSiteNames.MainStatus, Shell.MainStatusStrip);
   RootWorkItem.UIExtensionSites.RegisterSite(UIExtensionSiteNames.MainToolbar, Shell.MainToolbarStrip);

   IUIService uiService = RootWorkItem.Services.Get();
   uiService.ToolStripService.ToolStrip = RootWorkItem.UIExtensionSites[UIExtensionSiteNames.MainToolbar];
}

As always, I hope this snippet of code helps folks out. Let me know if something doesn’t work, or if you find a better way to do something. I’m always excited to see what people are doing with CAB.

For the past couple of days I’ve been posting on a CodePlex thread with a potential CAB adopter. In a follow up post today the person wrote this, in regards to a slow build:

IT forces some evil audit program to run every lunch time that thrashes the disks for > 1hr, as well. That doesn’t help at all.

My immediate response was something akin to irritation/anger/frustration. Not at the person who wrote the post, but directed at whoever their IT people are. My response was such:

Talk to your IT Department and see if you can get them to run that at night. I would body-slam our IT guy if he screwed with our development machines during work hours. And I’m not joking. I don’t let anything screw with our rigs during coding hours. We’re paid too much money to have things slow us down. (And that argument should work for you too; anytime you can’t get something you need to make you productive, remind the correct people that inefficiencies are just wasted money. You should see results after that).

In my opinion this is serious business. I don’t know about most developers, but according to yearly surveys and other such metrics, we programmer types don’t do too bad on the pay scale. We make pretty decent money; enough that our time shouldn’t be wasted by inefficiencies. Poor tools and infrastructure are a sure way to piss away expensive programmer dollars. Anything that slows us down should be remedied. Immediately.

Programming is not a cakewalk discipline. It might seem like it from the outside looking in (I know my wife thinks I must play video games all day), but it’s not. It’s mentally tough, challenging and, at times, stressful. Flow/Rhythm is a key element to what we do. The only way to get into that rhythm is to not be derailed by bad tools, processes or other things that make us inefficient. When you get into a groove, either solo or in a pair programming environment, the productivity can feel like it’s off the charts. You all know what I’m talking about; it feels like you could code every feature in the next hour and ship the app before you go home. Derailment due to poor hardware or tools or processes is literally throwing money into the wastebasket. Programmers are not cheap. If they are, you’re doing something wrong.

Fight for productivity.

Final thought: My boss occasionally reads my blog. It should be known that I work in a shop where I and my fellow developers get everything we need :)

Transformers

Steven Spielberg. Michael Bay. These two names mean completely different things in the world of movie making. One is a master craftsman, well versed in the many nuances of film making and storytelling. The other is known for blowing stuff up. It’s unfortunate that Transformers was made by the latter.

A look at Michael Bay’s directorial resume reveals a bunch of really bad actions movies: The Rock, Pearl Harbor, Armageddon and Bad Boys I & II. It’s sort of amazing then that he was given the reigns to helm this summer’s potential blockbuster, Transformers, while Spielberg was given the overseer role of producer. Other minds might have reversed the roles here, hoping to put this blockbuster in the lap of Spielberg’s more capable hands. Had they done so, they almost certainly would have been rewarded with a better movie.

Transformers can best be described as spectacle. The movie is one big action festival with special effects galore, designed to pulverize your senses into submission. You’re supposed to walk out of the theater after watching this movie so in awe of the robots that your brain doesn’t notice the sheer lack of story, acting, writing or directing. Bay sets out with Transformers to make your jaw drop. And yes, there are some fairly spectacular special effects scenes. Unfortunately, the story is so thin, the dialog is so cheesy and the directing is so pedestrian that the Transformers are the only thing worth watching here. Nothing else in this movie matters.

It’s probably a good thing then that Industrial Light & Magic has done a masterful job on the robots. They look great, and their transformations from machine to robot and back again is one of the most interesting visual effects you’ll see in any film this year. What’s disappointing is that Michael Bay apparently didn’t understand how to film his gargantuan actors on the screen.

Bay could have used some help from his executive producer, Spielberg, on this movie where the spectacle of the robots is concerned. Spielberg has always been able to quench an audience’s thirst when it comes to special effects. From Close Encounters of the Third Kind to War of the Worlds, Spielberg has always been a master at giving the audience what they came to see and showing his special effects centerpieces with the sort of framing and long looks that they deserve. In short, Spielberg knows how to show off the good stuff.

The same cannot be said of Transformers. The entire movie is shot so poorly that the Transformers are often relegated to the very corners of the screen where they can barely be seen. When they do come into the direct view of the camera they’re often obscured by visual effects, sunlight or incredibly shaky camera work. The rest of the time the Transformers are engaged in such high velocity battle sequences that they’re barely more than a blur. One wonders if Bay doubted ILM; he shoots this movie as if he believes the effects shop was not up to the task of rendering the Transformers. His camera work suggests that he doesn’t want the audience to actually see the huge things in all their glory.

That said, the Transformers are the best thing about the film, and even in the abrupt windows of opportunity that the audience is given to glimpse them they’re still one hundred times better than anything else in the movie.

There’s absolutely no story to here; there’s no interesting characters, and the dialog is reduced to the most basic speech of the action movie genre: the one liner. The characters, including the Autobots and Decepticons, are so thin that it’s almost impossible to feel anything for them. There’s almost nothing to root for here except carnage.

And, of course, the film suffers from Bay’s tired directorial style. We’ve seen these shots before, we’ve seen this camera work before, and we’ve heard this soundtrack for about the 100th time, and it’s just old now. It’s tiresome and boring. The slow motion shots are exactly where you expect them to be; the camera angles are exactly what you expect, the movie is cut and paced just like you expect. There’s absolutely no surprises here. Even though the movie is completely new material, it feels like a remake of something we’ve seen before.

Audiences will flock to this movie because they’ll hear about the special effects and the robots and they’ll want to go see it on the big screen. And that’s the place to see it, because I can’t imagine being able to see the robots any clearer once this transfers to DVD. But there’s not much story here, and there’s not a lot to care about.

It’s disappointing, because in the hands of a better director Transformers could have been outstanding. It gives me the chills to think about what this film could have been had Spielberg directed it himself, or an up-and-coming star like Christopher Nolan. As it is, it’s a decent popcorn flick, but it’s not going to end up on anyone’s Top 100 list anytime soon.