Dec 9, 2013

Man of Steel

IT TOOK me a while to write about Zack Snyder’s Man of Steel (MoS) because I was trying to articulate what it meant to me. And I think I’ve got it: MoS is our generation’s Superman anthem.

Let me explain. The Donner movies* were an anthem of the previous generation: Clark Kent as the Everyman, Superman as the benevolent big Boy Scout. Snyder has reimagined Clark as an outsider trying to find himself, someone who’s a little lost in the world. And a lot of us can relate to that, especially in this post-recession age.

With MoS, Snyder and Zimmer have quite literally given us an anthem for this era: brash, bold, perhaps worlds-spanning. And with it, there’s the wild element of of danger and uncertainty because Clark still doesn’t have full control over his powers, his emotions, and his moral compass yet.

Speaking of moral compass, I honestly don’t have a problem with the way it ended with Zod. There’s precedent for it in the comics, and I felt it was a nod to that. My problem was with the way they used Metropolis as the Kryptonian battleground. And maybe I’m being overly sentimental here, but I would’ve thought that Clark would try his hardest to keep those things happening to densely-populated urban centres, especially Metropolis. But then again, maybe it just goes to show how we’re not in Kansas any more, in terms of who and what this Superman is. It’s a brave new world.

* I count Superman Returns as one of the Donner movies because it explicitly tried to follow that continuity and approach to Superman/CK.

Nov 2, 2013

Notes on The Master and Margarita

‘MANUSCRIPTS don’t burn’.–Woland, The Master and Margarita

Recently I re-read this classic, long my favourite book, and I re-discovered why that is. It always amazes me how Bulgakov changes his tone and phrasing, here switching to an everyday, very Russian dry humour and wit, and there to an almost science-fiction exposition. Some notes:

‘… Let me see it.’ Woland held out his hand, palm up.

‘Unfortunately, I cannot do that,’ replied the master, ‘because I burned it in the stove.’

‘Forgive me, but I don’t believe you,’ Woland replied, ‘that cannot be: manuscripts don’t burn.’

Ideas: the most incredible and indestructible creation of humankind. Once an idea is created, it can never be destroyed.

‘No, because you’ll be afraid of me. It won’t be very easy for you to look me in the face now that you’ve killed him.’

‘Quiet,’ replied Pilate. ‘Take some money.’

Levi shook his head negatively, and the procurator went on:

‘I know you consider yourself a disciple of Yeshua, but I can tell you that you learned nothing of what he taught you. For if you had, you would certainly take something from me. Bear in mind that before he died he said he did not blame anyone.’ Pilate raised a finger significantly, Pilate’s face was twitching. ‘And he himself would surely have taken something. You are cruel, and he was not cruel….’

How incredible it would be to not be cruel and petty in this world.

‘… You uttered your words as if you don’t acknowledge shadows, or evil either. Kindly consider the question: what would your good do if evil did not exist, and what would the earth look like if shadows disappeared from it? Shadows are cast by objects and people. … Do you want to skin the whole earth, tearing all the trees and living things off it, because of your fantasy of enjoying bare light? You’re a fool.’

Ah, how clean-cut good and evil are to the Devil … on a grand scale, you need evil to balance out the good. Of course, this is ignoring the minutiae … maybe the Devil’s not in the details, but rather in the grand scheme of things?

‘… If it is true that cowardice is the most grievous vice, then the dog at least is not guilty of it. Storms were the only thing the brave dog feared. Well, he who loves must share the lot of the one he loves.’

An echo of the master and Margarita?

Sep 13, 2013

Excel Gotcha–Fractional Numbers

TODAY I learned (the hard way) about a subtle bug in Microsoft Excel. It seems that to the VLOOKUP function looking for a matching value in a range, two equal fractional numbers are not always equal.

Fractional numbers, technically known as floating-point numbers because of the way computers store them internally, sometimes give Excel a headache. If you want to see this for yourself, try out the following exercise:


You will find yourself with the following error:


Even more nefariously, if you use the range lookup option:

=VLOOKUP(3.3, tblLookup, 2, TRUE)

Excel will give you an actively incorrect result:


So, be extremely wary of using fractional numbers as lookup keys in VLOOKUP functions. If you must, then use the techniques described in Microsoft’s Knowledge Base article on this issue.

Dec 10, 2012

Analysing Transit Spending with Presto

ABOUT a year ago roughly I started using a new transit fare payment card called Presto. Presto is a top-up card–you pay as you spend–and it promised to unify fare payments for public transit systems throughout the Greater Toronto Area. By and large, it has lived up to its promise. But it does have its fair share of discontents.

One of the things that I was impressed by when I first got set up and registered on their website was they have a table of raw data on your transit usage–what service was used, where you travelled from, date and time, amount paid, etc. It was limited to only the past three months’ worth of data, though. No problem, I thought. I’ll just log in every three months, copy the accrued data into an Excel file, and save it that way. And for the most part it worked.

With this raw data, I imagined that I’d be able to do analysis on things like my travel patterns, bus timings (e.g. if some are regularly late), and of course how much I’m spending per week/month compared to how much I’d be spending with more conventional tickets or weekly/monthly passes.

I made a mistake, though. When copying and saving the data in a nicely formatted Excel file, I didn’t notice that Excel wasn’t properly understanding the date format (dd/mm/yyyy) used in the data and was converting it into bogus dates, for whatever reason. And so I deleted some (to me) extraneous columns in the data, like another column which contained the month in which the transaction took place. So I ended up not being able to do month-to-month-type analyses on a large subset of the original data.

Having learned my lesson, I’ve taken care to not delete any more columns in the fresh data I’m copying down now–just formatting things like transaction times and months when I’m absolutely sure Excel is understanding them properly.

With the new, better, data I managed to do a spending analysis like I originally wanted. And though I’d been a bit sceptical of the savings with Presto for me personally, I became a believer after seeing the figures below.

Before I get into the analysis though, a quick explanation of exactly how payment with Presto works: when you first buy the card at a transit kiosk, you pay some amount out of pocket for them to load the card with initially. When you board a bus/train, you tap the Presto card on a special reader and it deducts the amount of the fare from the card. Then you periodically top up the card to prevent going down to zero balance. You can set it up to automatically charge your credit card a certain amount when the Presto balance reaches a certain lower threshold that you set. This is really convenient and I’ve set up mine to auto-load $40 when the balances goes down to $20.

One more thing to keep in mind before the analysis: all of these months were more or less full working months for me, in which I worked at least 20 days and therefore took at least 40 transit rides throughout the month.

The Analysis Result


The above screenshot shows an Excel PivotTable with one line entry per month. So to go through the figures for September: the ‘E-Purse Fare Payment’ column says I spent $89.96 in transit fare in September; ‘E-Purse Load Value’ says my credit card was charged $80 total throughout September and that balance was added to my Presto card; and the ‘Grand Total’ of -$9.96, being negative, means I actually spent about $10 more than I loaded onto the card that month (since I had some balance left over from August). And so on for the following months.

How does this compare to what I would have spent with the more conventional weekly or monthly passes? Mississauga Transit, or MiWay weekly passes are $29, so for a month’s worth of them I’d have spent roughly $116, give or take a few days. For a monthly pass I’d have spent $120. Now these are basically the most affordable options if you need to ride 40 times throughout the month. You can’t get cheaper than that if you’re working full-time.

Given the above, September was really a very good month–lot of savings. My credit card was charged only $80. October was not so great, but not exactly horrible. Note that my credit card was still only charged $120–the extra $2.80 was from someone who borrowed the card and loaded some money into it by accident. This is no more than a monthly pass, and now let me explain why the spend was greater in October:


The above screenshot shows the same PivotTable as before, just broken down by transit system.

The person who borrowed my card spent about $11 on GO Transit, leaving $117 for my regular travel to/from work, and other places. Still competitive with the weekly and monthly passes.

November was competitive at a spend of $114.37–less than the MiWay weekly/monthly passes despite some extra travel on other transit systems. Again, my credit card was charged exactly $120. The remaining $5.63 was carried over as balance into December–something that is simply not possible with monthly/weekly passes.

December is so far so good. Presto has automatically reloaded early in the month, so for now the credit card has been charged a bit more than I’ve spent on transit this month. But that will have evened out by the time December ends.

All in all, a lot of value for money and a bunch of other benefits (check out the Presto website for details).


The steps from raw Presto usage data to finished PivotTable are fairly simple–if you’re an Excel user, you should be able to mostly figure it out. But the really quick summary: log in to the Presto website, go to the transactions page, show all transactions from the past three months, drag-select (with the mouse) the entire transactions table (including column headings) and paste into Excel. Excel should understand the tabular format and get it more or less right. Get rid of all formatting, then convert the range to an Excel table (select any cell in the data, press Ctrl-T). Format the ‘Loyalty Month’ column (should be column H) with the custom ‘number’ format yyyy-mm. This uniquely identifies the month and year. Finally, create a PivotTable from this raw data with the following specifications:


Happy analysis Smile

Dec 8, 2012

Tweet from the Browser Address Bar

This will work on Firefox and should also work on Chrome with a little adjustment. You can start posting a tweet straight from the browser address bar instead of having to navigate to the Twitter website and click on the new tweet button.

In Firefox, create a new bookmark with the following properties:

Name: Tweet (or similar)


Keyword: tw (or whatever you like)

Description: Tweet something

Now, with this bookmark saved, go to the address bar and type: tw Just testing. Then press Enter. A new tweet composition page should show up with the words Just testing. Finish off the tweet as wanted and click Tweet.

Is the tweet composition page unavoidable? Maybe not, but I don’t see an easy way to tweet directly from the address bar. And maybe that’s for the best–giving you a chance to finalise things before you publish for the world to see.

May 21, 2012

Marvel’s The Avengers

Warning: Minor spoilers. I do references specific scenes from the movie, but nothing major.

HARK, True Believers, and let me tell you a story. It’s a simple story, one of raw power and potential, where Good comes together against Evil and drives it back for another day. It’s the original story of the Avengers, straight from their first appearance in comics.

There came a day (unlike any other), when Loki, the Norse god of mischief, unleashed a series of machinations, starting with a clash between the Hulk and Thor. Other heroes got involved by chance or by fate, figured out what was going on, and finally stopped him. On that day they came together as a team, and the Avengers were born.

Since those original comics came out, there’ve been many iterations of the story. Significantly, there was Mark Millar and Bryan Hitch’s The Ultimates, the Ultimate Marvel version of The Avengers. It even provided the source material for the enemy alien armada in the movie, the Chitauri. In a way, The Ultimates was the kick in the pants that started the whole Marvel Avengers movie franchise rolling. So given all that history, where does this movie stand?

First of all, its credentials are impeccable. The story has Joss Whedon’s imprint all over it—the snarky humour, the really fun moments, the horror and the Big Bad (and the hints of the Bigger Bad). Oh, and let’s not forget the destruction of, and escape from, the SHIELD base in the beginning—a nod to the destruction of the Hellmouth in the series finale of Whedon’s Buffy the Vampire Slayer. That was awesome Smile

The screenplay is by Zak Penn, who’s done really good work recently—to me, most notably in his new (and returning) show Alphas, which is like a modern, grounded-in-reality version of X-MEN.

The ensemble cast plays really well off of each other, in a way a lot of ensembles haven’t been able to; their egos and personalities, their senses of humour and honour, shine through; and under Whedon’s guiding hand, through all their neuroses and bickering, they keep a laser-like focus on driving the story forward.

The story: there were many moments that were laugh-out-loud funny—e.g. when Captain America shows a bunch of hardened NYC cops why they should take orders from him. There were moments when I cheered—e.g. when Iron Man shows up in Stuttgart to take down Loki. Robert Downey Jr’s Tony Stark provides the attitude and AC/DC’s Shoot to Thrill provides the soundtrack. Awesome! Smile

On a side note, when they first announced the original Iron Man movie, I was rooting for Leonardo DiCaprio to play Tony Stark. The character was literally based off Howard Hughes (notice how Tony Stark father’s name is Howard) and DiCaprio had proven he could pull off Howard Hughes. But three movies later, I’m solidly in the RDJr camp. He’s proven himself, and not just because of the moments when he’s funny and eccentric, but especially in the moments when he’s dead serious.

As for the characters: I won’t do a headcount (I’ll let Tony Stark do that), but it’s being said that Mark Ruffalo’s Bruce Banner/Hulk provided the heart of the movie. Absolutely true. The wry humour and sarcasm, the world-weary cynic mixed with the eager scientist playing with new gadgets, Ruffalo’s Banner shows us all these sides of the character. As the Hulk, he shows us something almost elemental: rage personified, quick and unexpected as lightning, a force of nature, but ultimately a personality, a man struggling to do what’s right through the thick red haze of anger.

There was plenty of meat in all the characters; there were moments that showed that Joss Whedon gets them all. Take Captain America, Steve Rogers. A man who must feel like he’s suddenly time-travelled 70 years into the future, he’s looking for anything that’ll give him a connection to the past and the present. He doesn’t get most of the pop-culture references spouted off rapid-fire by the rest of the Avengers and SHIELD agents, but when he does, he has one of those ‘A-ha!’ moments that tell him this is still his own world.

Take Tony Stark. What’s the first thing this cynical technologist does when he comes aboard the SHIELD Helicarrier, Nick Fury’s flying fortress and repository of some of the best-kept secrets outside the Vatican? His actions are so quintessentially Tony Stark, they’re almost predictable.

Take the Black Widow. Much of her past is a mystery. In the comics, she’s a lot like a Russian version of Wolverine, given what was done to her by her government. She’s someone who’s trying to make amends; she’s a master spy—clever enough to outwit the god of mischief at his own game. All of these things are hinted at, and shown in her scenes. Every scene she’s given is used to the maximum.

And of course, take Loki. Disgruntled, and carrying a grievance the size of a kingdom, Loki comes to Earth with a plan to take away the world his brother loves and protects. He wants to ‘free’ people from the ‘tyranny’ of freedom—brilliant and twisted; something only Loki’s warped mind could conceive. The size of his ego, and his giant psychotic need for recognition, are such that one after the other, the Avengers and SHIELD big guns profile him and start figuring out his plays. Agent Coulson delivers what I think is the best line in the movie (and that’s saying something) when he explains to Loki why he won’t win.

If there was one character whose essence didn’t come out in the movie, I’d have to say it was Maria Hill. I know a lot of fans were excited to see this relatively new character (in the comics) make the transition to the big screen for the first time, but Maria Hill is literally supposed to have learned spycraft and attitude at the Nick Fury school of badass; she wasn’t really given an opportunity to show that here, maybe given the fact that Agent Coulson seemed to be performing the second-in-command duties in this movie. Oh well, maybe in the next one.

Speaking of Nick Fury’s second-in-command, one character who was rather conspicuously missing from this iteration of SHIELD was Dum-Dum Dugan; especially given that he’d been in the Captain America movie of last year. I guess they would have had a hard time explaining Dugan’s (and then Fury’s) seeming eternal youth (or at least their eternal non-retirement), something they still haven’t explained in the main Marvel comics storyline, as far as I’m aware.

I’ll skip the main plotline and results (the Avengers save the day, what’d you expect), and jump to the delicious little end-of-credits teaser. Let me take a moment here to cackle madly with glee while I tell you, True Believers, that if they carry through with what they’ve shown there (and history says they will), then the Avengers will be going intergalactic, interdimensional, inter-timeline and possibly exploring the boundaries between life and death! *cackle*

Verdict: Loved it. And Long Live Joss Whedon!

May 6, 2012

Bookmarking in Adobe Reader

I RECENTLY moved to Windows and started using Adobe Reader. The latest version is Adobe Reader X (that is, 10) and I started to keenly feel the need for a bookmarking feature like the one that's built in to Mac OS’s PDF reader, Preview. (Which is quite superbly done.)

A quick run through Reader's menus revealed nothing about bookmarking. Adobe's still calling the built-in navigation links in PDF documents ‘bookmarks’. So that’s a dead trail. A web search turned up a bunch of hacks, some of which work but not very well, and others which just don’t.

Fortunately, Adobe Reader X has a (no hacking required) feature that’s almost equivalent to bookmarking, albeit in a slightly unexpected place: the Comment panel on the right-hand side. If you click the Comment toolbar button on the right, the Comment panel pops up, divided into two sections: Annotations, and Comments List.

So to add a ‘bookmark’: click the Sticky Note button in the Annotations section of the panel, then click anywhere on the page where you want to position the sticky note. You can then minimise the sticky note by clicking the minimise button on its upper-right corner.

As soon as you place a sticky note on the page, it shows up on the Comments List section of the panel. This is awesome because this comments list can basically be used like a bookmarks list, with a click on each comment taking you to the exact page it’s on. And when you’re done with it as a bookmark, you can right-click on it and select Delete.

There is one drawback: every time you close the PDF file, you’ll have to save it, in place, again. The sticky notes, or for our purposes bookmarks, are saved inside the PDF files, and Adobe Reader doesn’t let you just Ctrl+S save a PDF file, it forces you to pick the file in a Save As dialog box each time. Still ... that’s a relatively small trade-off for a pretty convenient bookmarking feature.