Feb 3, 2015

Show the Structure of Your GUI in Your Code

I LIKE creating my GUIs programmatically. I suppose I'm a traditionalist (some would say a masochist). But I feel that it gives me more control over the design and keeps together things that should live together.

The downside to this is, lots of objects all declared in the same scope, with no structure to give you a hint as to how they all fit together:

    class View {
      Form frm = new Form();
      FlowLayoutPanel pnl = new FlowLayoutPanel();
      TabControl tbc = new TabControl();
      TabPage tbp1 = new TabPage();
      Label lbl = new Label();
      TextBox txt = new TextBox();
      TabPage tbp2 = new TabPage();
      Button btn = new Button();
      ...
    }
If you think about it though, the controls will all have fixed parent-child relationships with each other. They will effectively form a tree structure during runtime, that will give rise to the final graphical display. In fact, that's what all the XAMLs and JavaFXs and QMLs of the world model. Why not actually show these relationships in the code itself with a little bit of indentation trickery?

    class View {
      Form frm              = new Form();
        FlowLayoutPanel pnl = new FlowLayoutPanel();
          TabControl tbc    = new TabControl();
            TabPage tbp1    = new TabPage();
              Label lbl     = new Label();
              TextBox txt   = new TextBox();
            TabPage tbp2    = new TabPage();
          Button btn        = new Button();
      ...
    }

A-ha! So the Button won't be inside the TabPage; it'll be a sibling of the TabControl itself!

Of course, this is all manual, and won't work with whitespace-sensitive languages, and can get out of date when you change your layout, and all those things. But--when it does work, it's surprising how well it works at organising my thoughts about the layout into a nice 'graphical' overview.

Jan 8, 2015

Expressive Functional Programming with Continuations in Python

In Python, statements and expressions are separate and unequal citizens. For example, statements can contain expressions but expressions can't contain statements. This prevents things like full-powered anonymous functions which can do everything that named functions can, or expression calculations which contain statements like 'import' etc.

I wanted to fix this, to give Python an expressiveness which I thought it was missing. I first thought that we could introduce a new syntax token which could 'wrap' up any number of statements and return the value of the final expression in the block. This turned out to not be feasible, for a couple of reasons, as discussed in the mailing list.

Then I had the idea that we can turn all statements into expressions. In Python, function calls are expressions. So statements can be wrapped up inside functions to turn them into expressions. Since there aren't that many statements in Python, it's feasible to just do this for all of them. Each of these functions can take a continuation to represent 'the rest of the computation'. If all statements become expressions, and so everything is an expression, this lets us define full anonymous functions because now everything inside the anonymous function can be a single expression!

Implementation

To manage the continuations, we first define a data structure: a pair of (continuation, expression) which is passed around among the functions we'll define later, named whatever_. expression in the pair is meant to represent the input to the continuation, if it takes one.

A 'dead' continuation doesn't take an input value.

    def __dead(k): return (k, None)

A 'live' continuation takes an input value.

    def __live(k, x): return (k, x)

Continuations are run using trampolining to prevent stack overflow, allowing us to overcome the restriction of Python not optimising tail calls. The trampoline takes care of running each continuation with input or not depending on whether it's live or dead.

    def run_k_(prog):
      (k, x) = prog

      while k is not None:
        if x is None: (k, x) = k()
        else: (k, x) = k(x)

In short, a trampoline function like the above converts recursion into iteration. If you want to learn more about trampolines, here's a beautifully simple description of the idea and some examples in Python.

Some 'Syntax' Definitions

Below I define some 'syntax' in the form of functions which use continuation-passing style (CPS). So as discussed above, these functions are wrappers for the real syntax, and turn statements into expressions. Note that some of them are fairly simple versions of the real functionality.

A print function which just prints something and then doesn't return a value, it just sets up the rest of the computation to go ahead when it returns. This pattern can be used for all the Python statements.

    def print_(x, k):
      print x
      return __dead(k)

A primitive version of a 'let' binding. This 'returns' a value, i.e. the expr, bound to the parameter name in the continuation lambda. This pattern can be used for all expression-oriented syntax.

    def let_(expr, k): return __live(k, expr)

An assertion 'statement'.

    def assert_(expr, k):
      assert expr
      return __dead(k)

An if_ 'expression' can 'return' one of two values--so in other words it can pass on either of its input expressions to its continuation.

    def if_(test_expr, then_expr, else_expr, k):
      if test_expr: return __live(k, then_expr())
      else: return __live(k, else_expr())

A cond_ is basically a switch statement, but in the form of an expression that again 'returns' a value. Can be used as a replacement for Python's if ... elif ... else ... syntax.

    def cond_(test_pairs, default_expr, k):
      for (test_expr, then_expr) in test_pairs:
        if test_expr: return __live(k, then_expr())
      else: return __live(k, default_expr())

We can import a module and pass it along to a continuation, which will then use it and pass it along implicitly to its children continuations through the magic of closures. This is almost like a 'let' binding but it binds the name to the imported module instead of to an expression.

    def import_(mod_name, k):
      m = __import__(mod_name)
      return __live(k, m)

The try_ function is different from the others because it actually runs the 'try' continuation and (if needed) the 'except' continuation. This is because it can't just set up two different continuations to be run. It has to run one first to actually find out if there's an exception or not. It returns the 'finally' continuation because the 'finally' block should always be run whether or not an exception occurred, so it's a natural fit for being a continuation.

    def try_(expr_k, except_k, finally_k):
      try: run_k_(__dead(expr_k))
      except: run_k_(__dead(except_k))
      finally: return __dead(finally_k)

The for_ function also needs to run its act continuation on all the items in its seq (sequence), because there may be a lot of items and just queuing them up for running might build up a huge data structure. It's more efficient to flatten the structure at this point and then just set up the ending continuation after all that.

    def for_(seq, act, k):
      for x in seq: run_k_(__live(act, x))
      return __dead(k)

Usage

The end result is that we build and run a large expression that looks kind of like normal code on the left, but ends with a bunch of lambdas on the right of each line. Because Python doesn't have macros or autoclosures, we can't hide the fact that we're passing around lots of functions.

Note that we stop the 'program' at any point by passing in None as the next continuation. You can see this in the functions stored inside the dict below. Also note how we're storing code that looks pretty imperative inside the functions. If you squint a little bit you can kind of ignore the extra clutter and think of each line as a separate 'imperative' statement. Indentation becomes arguably more important here than in normal Python for readability.

Finally, remember that run_k_ ('run continuation') runs the whole thing. As long as we compose our program using only functions specially designed to work with the trampolining mechanism, like the ones above, it should all run fine.

    if __name__ == "__main__":
      run_k_(
        let_(
          { "foo":
              λ:
                print_("I pity the foo!", λ:
                for_(range(5), λ x:
                  print_(x, None), None)),
            "bar":
              λ:
                import_("math", λ m:
                let_(5, λ r:
    
                print_("The area of the circle is:", λ:
                print_(m.pi * r * r, None)))),
            "baz":
              λ:
                print_("None of your bazness!", None) },
          λ dispatch_dict:

        # Call to the function inside the dispatch dict is also handled by
        # the trampolining mechanism.
        dispatch_dict["bar"]()))

For the sake of readability, I've replaced all occurrences of the keyword 'lambda' above with the Greek symbol 'λ'. Of course in real Python code we'll use the keyword (search and replace should do it).

Obviously, you won't want to program like this in normal Python. It would drive people up the wall with crazy. But for specialised use cases like storing a lot of functions inside other data structures, callback-based event handling when you want to do something more complex than just call a function, or building DSLs in Python (hey, worse things have happened), this expressive method could come in very handy.

Update: this article describes a simpler, more primitive version of what I currently have. You can follow the latest developments at the GitHub repository.

Dec 21, 2014

Exodus: Gods and Kings

THIS movie should really be called Exodus: Moses’ Struggle with God.

Early on in the movie, Moses (at the time an Egyptian general), travels to the city of Pithom to investigate complaints about the Hebrew slaves from the Viceroy assigned to the city. They have a conversation in which the Viceroy mocks the Israelites, saying the very name itself means ‘one who fights with God’. Moses corrects him and says it means ‘one who wrestles with God’. Personally I would use the word ‘struggles’ instead of ‘wrestles’, but the point is that that exchange foreshadows Moses’ relationship with God.

As much as the movie is about the suffering and deliverance of the Hebrew people in Egypt, and about how Moses finally finds some measure of happiness in exile with his wife and son, it is more about Moses’ relationship with God–a very personal relationship, almost an equal partnership at times.

Moses is very clearly an unbeliever–he has grown up surrounded by the Egyptian religion with its pantheon of gods (not to mention Pharaohs), and has remained unconverted by any of them. He finally decides to follow God (their relationship, as I mentioned, doesn’t even look like any kind of deity worship we have today) because that’s the only way he sees to save his people.

Moses sets out to save his people from Pharaoh, but his attempts don’t have much impact, while Rameses’ retaliation seems expressly designed to dispirit and demoralise, frighten and terrorise, the Hebrew slaves. Like any clever slaveowner, Rameses avoids doing much real damage to his property, while still punishing them enough to (in his eyes) frighten them into submission.

That it doesn’t work is evident whenever we see the faces of the Hebrews as they observe the injustice. That they persevere in the face of it all seems like the real miracle to me, not the plagues and the cataclysms. Early on in the movie, Moses tells the Viceroy that you can tell a lot about a man by looking into his eyes. When you look at the faces of the Hebrews, it seems as if God is behind their eyes looking out at you.

God in the movie is a wrathful God. A God of vengeance. There are no two ways about it. He cannot coerce men nor preempt their minds, having given them free will. But He can and does preempt the natural order and the natures of the beasts and insects, and causes them to rain down upon Egypt in plague after plague. The punishment is intense, the suffering severe. Moses grows frustrated with it. ‘Who are we punishing?’ he asks. When God acts upon the face of the Earth, his action is like a giant hammer that smashes down upon all, without discrimination.

The final plague is what finally threatens to break Moses’ resolve: ‘No! I cannot be a part of this!’ In a final act of wrath, God reveals that He has heard Rameses’ threat to kill every Hebrew infant, and He will take the life of every first-born child of Egypt, unless they are in a house whose door is marked with the sacrificial blood of a lamb. Of this escape only the Hebrews are warned. Finally, God plans a way to discriminate between His people and their oppressors.

Knowing that there will be a massacre of innocent children is a hard thing to take. Yet the God of the Old Testament has many times been wrathful. He has taken perhaps millions of lives as punishment for evil. The Passover is the first time that He has actually planned out such a massacre with a human general and has chosen who will live and who will die in such a targeted way (well, perhaps since Noah, but then the Ark was also a much cruder means of selecting survivors than what they did for the Passover).

The way that God reveals Himself to Moses is interesting. Before I watched the movie, I heard somewhere that God took the form of a British public schoolboy. This intrigued me because it meant that Ridley Scott subscribed to the idea that God, being eternal, experienced all moments of time (past, present, and future) simultaneously and could thus introduce anachronisms by appearing in one time period as something from a completely different time period.

But ... I probably took that too literally. It didn’t actually happen. Instead I saw something just as interesting, but in another way. God asks Moses who he is, and Moses replies ‘A shepherd’. God says, ‘I thought you were a general? I need someone who can fight.’ As if He is a wartime leader recruiting a general to lead an army on a front. Which of course He is, and which of course is what He needs Moses to do. The portrayal is very, very interesting when you think about how Yahweh, the Hebrew God, started out in the oldest stories as a legendary warrior hero and leader of his people. In some stories, He had once been in the same position that He now wanted to recruit Moses to.

Many times throughout the film, Moses struggles with God, perhaps even chastises Him as being too cruel and vengeful. After four hundred years of watching His people suffer, apparently God has some pent-up wrath. Ultimately though they agree on one thing: the people of Israel need protection and guidance to find their way home.

Jul 7, 2014

Easily Authenticate when Pushing to a Git Remote

SOMETIMES when you’re working with git repositories, the remote doesn’t support pushing and pulling over SSH. It only supports HTTPS. Or you don’t have an SSH key properly set up, or you do but it’s not working for some reason. Whatever the cause, the upshot is that whenever you push, you’re forced to type in your username and password. This sucks, understandably. But do you use a password manager, like KeePass, on Windows by any chance? Because if you do, you can authenticate absolutely painlessly. Here’s how.

Set up a KeePass entry for the git server you’re pushing to. Let’s use GitHub as an example. Create a GitHub entry with your username and password, then make sure the entry has these two properties:

Auto-Type: {USERNAME}{ENTER}{PASSWORD}{ENTER}

Auto-Type-Window: Git Bash

If you’re using git on Windows, most likely you’re using Git Bash. Of course, if you’re using Posh Git, then just change the window name to whatever is appropriate.

Now, when you do a ‘git push’ and the git remote asks you to authenticate, simply press your global autotype combo (by default it’s Ctrl-Alt-K) and KeePass will log you in immediately. No SSH necessary.

That’s convenience.

May 13, 2014

Stack Overflow and its Discontents

LIKE many others, I’ve come to rely on Stack Overflow (SO) as an amazing repository of technical knowledge. How did it become so comprehensive? My guess is it was the ‘many eyes make bugs shallow’ principle. I.e., many contributors building something together, a lot like Wikipedia. SO is nearly always great when you’re searching for an answer, but not that great when you’re trying to contribute and build a profile for yourself among the other members. I’ll explain why but first let me clarify something as I see it: SO may look like a simple Q&A site, but it’s really a permanent knowledge base with the knowledge organised in the form of questions and answers. That’s important: the Q&A format is just that, a knowledge delivery mechanism. So with that in mind, we can examine how that affects peoples’ actions on the site.

Lots of people have discussed why SO punishes or rewards contributors the way it does, but one widely-held belief is that there is a subset of users (usually the moderators and other high-reputation users) that is intent on seeing SO’s core mission carried out: that the site becomes a repository of useful and generally applicable questions and answers. To keep it that way, this subset performs triage on the questions that are asked: they apply judgment calls on whether or not the questions are good ones. When you’re a beginner, there are no bad questions. But when you’re building a long-lasting repository, there are bad questions.

Generally speaking, bad questions on SO could be any of:

  • Duplicate of an already-answered question
  • Not phrased as a question
  • Not clear what the asker wants to find out
  • Asker shows no signs of having done any research or made any attempt to solve the problem
  • Question is about a specific corner case which can be easily solved if asker understood a more general principle
  • Code examples are incomplete and can’t be compiled, error messages are not quoted verbatim but only vaguely described
  • And the other end of the spectrum: many screenfuls of code or log output pasted verbatim, in entirety, without any attempt to zoom in on the source of the issue.

Any of these questions will annoy the mods because they’ll invariably get answered (because people are incentivised to answer no matter how bad the question), and then those bad questions and their answers will raise the noise level and make it difficult for people trying to find answers to the genuinely good questions. (Good search features, and even Google, can only take you so far.)

So with this in mind, we can start to understand the mods’ behaviour of seemingly penalising usually newer users of the site, those who haven’t absorbed the culture yet and are treating SO as a source of answers to one-off questions. It’s not–the questions are meant to become part of a knowledge base on the subject and potentially live forever. Under these conditions, it’s very difficult to justify questions with the above bad qualities, especially if we can guide the new users towards improving their question quality (and lots of people are trying to do this).

So, remember, the mods’ goal is to build a generally-useful knowledge base. With this as a given, the questions (subjects of knowledge) that are of a low quality will tend to get weeded out: either by being downvoted, or closed. The people who’re doing the downvoting and closing don’t have the end goal of punishing the askers; their goal is to weed out the bad questions. That the askers lose rep points is a side effect of the voting and rep system. Which is fair: if my peers judge me as not contributing good material, then I should have less cred. But the primary goal on everyone’s mind is having good material on the site, not punishing me.

Having said all that, I want to address the fact that votes on each question and answer are essentially on an infinite scale going in both directions. So, a given question or answer can potentially be upvoted or downvoted many times over, and every one of those votes affects the poster’s rep. But the effects on rep are all coming from a single posting. That’s skewed, because users on the site are more likely to see higher-voted questions and answers than they are to see lower-voted ones. That’s simply how the search facilities work by default: understandably and helpfully, users get to see highly-regarded content before they see the dregs of the site. But this means that highly-upvoted content will always get more exposure, and therefore continuously be exposed to more upvotes, while downvoted content will get less exposure and less downvotes. This skewness is disproportionately rewarding the experts and inflating their rep.

Let’s ignore the downvoted content for a second and think about the upvoted content: it is continuously getting upvoted, just for being there. Meanwhile, the person who posted that content could very well have not made a single contribution after that (taking this to the logical extreme). That’s an unfair advantage, and thus a bad indicator of that person’s cred in the community.

It’s clear at this point that the SO rep system is not going to be recalibrated yet again (barring some really drastic decision) to fix this bias, so let’s imagine for a second what a rep system would look like that actually did fix it. My idea is that such a rep system would reward (or punish) a user for a single contribution by a single point only, to be determined as the net number of up (or down) votes. So, if a post had +1 and -1, the reward to the contributor is nothing. If the post has +100 and -12, the reward to the contributor is +1. And if the post has +3 and -5, the reward is -1. If there’s a tie, the next person who comes along has the power to break that tie and thus ‘reward’ or ‘punish’ the contributor. Usually, of course, the situation won’t be a tie–usually there’s pretty good consensus about whether a contribution is good or not (to verify this, simply log in to Stack Overflow and click on the score of any question or answer on the question’s page–it’ll show you the upvotes and downvotes separately).

The sum of the net effect on reputation from each of a contributor’s posts shouldn’t become the final measure of their profile rep, though. That doesn’t give the community an easy way to tell apart a person with +100/-99 rep (a polarising figure) from someone with +1/0 (a beginner, an almost-unknown). Instead, users should be able to judge contributions as +1 (helpful), -1 (not helpful), or 0 (undecided). And each net reputation change from a contribution should form a part of a triune measure of rep: percentage helpful, percentage not helpful, and percentage undecided.

The three parts of the measure are equally important here. The vote on the merit of a contribution is nothing but a survey; and any statistician will tell you that in a survey question you must offer the respondent the choice of giving a ‘Don’t know’ answer. In this case that’s the ‘undecided’ option. If we don’t offer this option, we are missing critical information about the response to the contribution–we can’t tell apart people who simply didn’t vote, or those who tried to express their uncertainty in the question/answer by not voting.

This way, everyone immediately sees how often a particular user contributes valuable content, as opposed to unhelpful or dubious content. And the primary measure of rep is therefore not something that can grow in an unbounded way: the most anyone can ever achieve is 100% helpfulness. That too, I think, should be quite rare. The best contributors will naturally tend to have higher helpfulness percentages, but it won’t so much a rat race but rather a level marker within the community, tempered by their levels of ‘unhelpfulness’ or people’s indecision about their contributions.

So much for user profile rep. I do think that the scores on questions and answers should behave in the traditional SO way: all votes should be counted as individual votes, instead of (as with user profile rep) being summed into a net positive/negative/undecided vote. The reason for the difference is that the votes are the measure of each contribution’s merit; and if (for example) you have two similar contributions, their vote scores should be a good way to judge between them. Again, vote score should be presented in the form of a three-fold percentage measure of helpfulness, unhelpfulness, and undecidedness (with vote counts available on, say, mouseover). This keeps conformity with user profile rep and puts an upper bound on the score shown on each question or answer. The reason why this is a good thing is that most of the time, to a site user, unbounded scores are simply extra information they won’t really process. The site itself can easily search and present content in order of most highly-voted; but the reader just needs to judge merit on a fixed scale. Anything extra is just cognitive burden on the reader.

So to recap, if we’re to implement an unbiased user profile rep, we need to count the net helpfulness of each contribution once only. But for content scoring, we can count each vote individually. And to present everything in a uniform way and with low cognitive burden, we should show all scores as a three-fold measure of percentage helpfulness, unhelpfulness, and undecidedness.

Once we have this system in place, we can start doing interesting things, like automatically closing questions which sink below a threshold of, say, 10% helpfulness (they’ll start out with 100% helpfulness because the original asker’s vote is automatically counted as helpful–otherwise they wouldn’t have asked). And we can do away with reputation loss from downvoting, since a downvote will usually have no effect on the recipient’s profile rep, and only one unit of negative effect on the contribution being downvoted.

Achieving an unbiased measure of rep is tricky. But I think we can do better than SO’s current system by rebalancing the ‘rewards’ and ‘punishments’, and bounding the primary measures between 0 and 100% helpfulness so that we don’t end up with another Jon Skeet on our hands (I kid–Jon Skeet is great :-)

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:
image
Edit: the formula above should be '=VLOOKUP(3.3, tblLookup, 2, FALSE)'.

You will find yourself with the following error:
image
Even more nefariously, if you use the range lookup option:
=VLOOKUP(3.3, tblLookup, 2, TRUE)
Excel will give you an actively incorrect result:
image
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

image

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:

image

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).

Process

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:

image

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)

Location: https://twitter.com/intent/tweet?source=webclient&text=%s

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.

Feb 13, 2012

Short Note on Blogging


SOME time ago I complained that there wasn’t any good, free blogging software on the Mac. Well, since then I’ve pruned my list of demands somewhat, and learned to settle for some typographical niceties like curly quotes (‘’, “”) and en-dashes (–).

And it turns out that the Mac’s built-in TextEdit editor does these nicely, with a little help from the system-wide Substitutions feature (in TextEdit’s main menu, click Edit > Substitutions > Show Substitutions, and check all the automatic substitutions offered there).

So now it’s just a matter of typing out my thoughts in TextEdit, which laods almost instantly; and dealing with the psychological baggage of navigating to the correct post page in Blogger comes later.

Feb 12, 2012

Thoughts on Lion


I UPGRADED to Mac OS X Lion, the latest and greatest version of Mac OS X, tonight. While the update was cheap ($30) and easy (click and run), it was also slow. Roughly speaking it must have taken at least a couple of hours to finish up. At the end of that, though, I found all my files and settings transferred seamlessly into the new OS.

The first question on my mind was whether Lion would slow down my system, given that I have a basic 2009 MacBook. The answer is no; it performs just as well as Snow Leopard in my perception.

On first boot there’s a change right from the start: the login screen is now a single page, not a window, of users and basic system info like battery status, time and Wi-Fi status. And on login the desktop is kind of sent hurtling forward towards you–it seems like Apple has grown fond of the kind of page-transition animations that started out on iOS.

Some of the biggest new features you see right after logging in are Mission Control and Launchpad. Mission Control (shortcut key Ctrl-UpArrow) is basically a new version of Exposé; and Launchpad is like the iOS app launcher–all your applications arranged in grids of icons, ready to be launched with a click. I like the former; but I don’t really intend to use the latter much because my most frequently-used apps are on the Dashboard, or I just launch them with Spotlight.

There are numerous new features scattered throughout the system; for a complete list see Apple’s page. I want to touch on a few of the UI changes.

The first is the look of basic UI elements like buttons, drop-down lists, checkboxes, etc. These are all now rounded rectangles instead of bubble-shaped. That’s definitely a break from the OS X Aqua design that was introduced ten years ago.

The second is the new overlay scroll bars that disappear when you’re not actually scrolling, thus giving you back some screen real estate. This is definitely influenced by iOS–designers had to figure out new space-saving tricks on mobile form factors and these tricks are now showing up on more traditional desktops. However, the new scroll bars aren’t actually enabled by default. In the System Preferences, General page, the ’Show scroll bars:’ option is originally set to ‘Automatically based on input device’, which basically means, ‘depends’. To enable the overlay scroll bars, choose the ‘When scrolling’ option here.

Also, another surprising (and slightly annoying) change is when scrolling with a wheel mouse, the traditional wheel down movement actually scrolls stuff up and the wheel up movement scrolls stuff down. To fix this, uncheck the ‘Move content in the direction of finger movement when scrolling or navigating’ option in the ‘Mouse’ page.

There are a couple of big changes in apps I use frequently. Mail has been redesigned to show all messages in the same conversation on a single page, like Gmail. For this I’m grateful. However, the ordering of the messages in the conversation view is most recent first–for me, that’s upside-down. This can be fixed in Mail Preferences, the Viewing page, in the ‘View conversations:’ section, by unchecking the ‘Show most recent message at the top’ option.

Another change is that the Address Book app has been redesigned to look like an actual open book with a list of contacts on the left and a detailed view of the contact on the right. I liked the old, normal Cocoa UI; to me the new design looks a bit cartoonish, and amateurish. The functionality is still the same, though. One thing I’ve always found puzzling that would be nice to get off my chest: all the operations on a card (a contact) are in the ‘Card’ menu, except for ‘Delete Card’, which is in the ‘Edit’ menu. Baffling.

Another couple of interesting (to me :-) tidbits: Lion has FaceTime calling built-in, and Google Chrome now takes advantage of Lion’s new support for full-screen mode instead of baking in its own.

So bottom line: Lion continues the evolution of Mac OS into something more iOS-like, but mostly familiar and comfortable for OS X users. Plus, it’s much easier to say ‘Lion’ than ‘Snow Leopard’, so that’s a win right there. :-)

Nov 10, 2011

Kobo Vox

THE KOBO Vox (from Latin, vox populi, ‘voice of the people’) is Kobo’s latest and greatest ebook reader. It’s basically a touch-screen Android tablet, but Kobo has made some smart trade-offs to keep it at the $200 price point. Here are my impressions.

First Boot

The first time it starts, the device asks to connect to a wireless network and then downloads and installs a software update. It then guides you through restarting and completing setup. You have to pick your time and date and then log in to, or create, a Kobo account. There don’t seem to be any options for not signing in to a Kobo account–to use the Vox, you must be signed in.

Hardware

There’s much to like about this compact device. It’s roughly three-quarters the size of an iPad, and has a crisp full-colour screen. Text is crisp and images really pop out. It’s a little heavy to hold; could get uncomfortable over extended periods reading while sitting or lying down.

The processor is not the most powerful you can fit into this form factor; but going for a slightly cheaper CPU is one of the trade-offs I mentioned, and ultimately I think worth it. I’ll explain more later.

There’s a single speaker built-in with sound quality similar to that of a smartphone. No microphone or camera–so there’s no scope for voice or video chatting. And in terms of connectivity, there’s Wi-Fi, an SD card slot and a USB port, but no Bluetooth.

Software

The Vox comes with Google’s Android OS 2.3 with a few relatively minor adjustments: the default home screen has a large Kobo desktop widget showing the covers of the five most recently-read books; the global pop-down notification list has been replaced with Kobo’s Reading Life stats (more on Reading Life later); and apparently you can’t access the Android Market because the device doesn’t (yet) pass Android hardware certification. There is an alternative app store called GetJar bundled.

Since the Vox isn’t locked in to the Android Market, you can actually install any apps (*.apk files) you can find floating around on the internet. So the keyword here is caution–there’s plenty of malware out there for Android. I installed a couple of essential apps from a relatively trusted source. The first is Overdrive, an ebook and audiobook app for DRM-protected books. Overdrive lets you connect to public libraries’ electronic catalogues and download books from them. I’ve successfully downloaded a couple of ebooks from my local library.

The browser doesn’t come with Flash installed. It’s possible to install it from Good eReader's list but I haven’t so far because from what I’ve heard, Flash is a mobile device killer. Even my laptop has a hard time with it.

There’s a YouTube app that works pretty much as expected; a music and video player that I haven’t tried yet; and a few other apps that I haven’t actually bothered to explore–a Facebook news feed widget for the desktop, and other similar apps that plug in to Facebook. If I could uninstall these, I would; but there doesn’t seem to be any way to uninstall apps yet.

Kobo Vox customised home screen

Reading eBooks

One of the Vox’s biggest selling points is that it has a new ‘social reading’ feature called Reading Life. Reading Life lets you keep track of how many books you’ve read and how long you spent reading them; gives you ‘awards’ for finishing books; and lets you share these awards and statistics with friends. Newly introduced with the Vox is a comment feature called ‘Pulse’ that lets you publicly ‘like’ and share comments on specific pages of books you’re reading.

Reading Life is pervasive and easily accessible from several places in the Vox interface–the pull-down notification area at the top; the dock at the bottom; and from the Kobo reading and library app itself. This gives a feeling of coherence to the device and makes it feel more like an ebook reader than just a generic Android tablet.

However, you’ll only find yourself using Reading Life if you read ebooks on Kobo’s own ebook reader app. This would include reading books that you bought or downloaded for free from the Kobo store; and any books that you manually copied over from another device. If, like me, your main source of books is your public library’s electronic catalogue, you’ll probably end up using the Overdrive ebook reader app; and Overdrive is not integrated with Reading Life or Pulse.

Kobo Vox Overdrive ebook app

Trade-offs

So in general, how is the Vox as an Android tablet?

A little under-powered. It runs most of the standard apps–browser, email, ebook readers–just fine. But when I tried to run a more graphics-intensive app, like the included free Scrabble, it more or less got stuck. I had to hard-reboot the device to get it up and running again.

At the end of the day, the Vox is a compact Android OS-powered device that lets me read ebooks and just enough more that it’s a compelling buy.

Sep 2, 2011

St Urbain's Horseman

I’VE read a couple of other Mordecai Richler books by now, but this one was probably the most passionate, the most powerful. A man caught between two generations, between the Holocaust and the hippies, Jake Hersh is driven by a code of conscience and social justice that he feels is the only way to live up to the memory of his cousin and childhood hero, Joey. Joey who stood up to the anti-Semitism of Montreal in the ’40s, only to be run out of town. Who then went on a world-wide walkabout, rousting and rabble-raising and, seemingly, hunting down Nazi war criminals.
Meanwhile, Jake makes a life of comfort and luxury for himself, starts a family and settles for a peaceful home life. All the while tormented by his social conscience, a growing unease and a sense that the world is too unfair to let him live out such a good life without repercussions.
The chapters bled into each other, the pages flew by in a blur, and before I knew it it was over. Still, there were passages which stood out brilliantly, that you devoured because they were just so damn good.
Reading this passage reminded me intensely of the deshi diaspora in Western countries–so ironic:
Sitting with the Hershes, day and night, a bottle of Remy Martin parked between his feet, such was Jake’s astonishment, commingled with pleasure, in their responses, that he could not properly mourn for his father. He felt cradled, not deprived. He also felt like Rip Van Winkle returned to an innocent and ordered world he had mistakenly believed long extinct. Where God watched over all, doing His sums. Where everything fit. Even the holocaust which, after all, had yielded the state of Israel. Where to say, ‘Gentlemen, the Queen,’ was to offer the obligatory toast to Elizabeth II at an affair, not to begin a discussion on Andy Warhol. Where smack was not habit-forming, but what a disrespectful child deserved; pot was what you simmered the chicken soup in; and camp was where you sent the boys for the summer. It was astounding, Jake was incredulous, that after so many years and fevers, after Dachau, after Hiroshima, revolution, rockets in Space, DNA, bestiality in the streets, assassinations in and out of season, there were still brides with shining faces who were married in white gowns, posing for the Star social pages with their prizes, pear-shaped boys in evening clothes. There were aunts who sold raffles and uncles who swore by the Reader’s Digest. French Canadians, like overflying airplanes distorting the TV picture, were only tolerated. DO NOT ADJUST YOUR SET, THE TROUBLE IS TEMPORARY. Aunts still phoned each other every morning to say what kind of cake they were baking. Who had passed this exam, who had survived that operation. A scandal was when a first cousin was invited to the bar mitzvah kiddush, but not the dinner. Eloquence was the rabbi’s sermon. They were ignorant of the arts, they were overdressed, and their taste was appallingly bad. But within their self-contained world, there was order. It worked.
As nobody bothered to honor them, they very sensibly celebrated each other at fund-raising synagogue dinners, taking turns at being Man-of-the-Year, awarding each other ornate plates to hang over the bar in the rumpus room. Furthermore, God was interested in the fate of the Hershes, with time and consideration for each one. To pray was to be heard. There was not even death, only an interlude below ground. For one day, as Rabbi Polsky assured them, the Messiah would blow his horn, they would rise as one and return to Zion … .
And this captured the exact feeling of when you suspect that you have it too good, that you’re one of the top percentiles out of the billions on this planet:
… From the beginning, he had expected the outer, brutalized world to intrude on their little one, inflated by love but ultimately self-serving and cocooned by money. The times were depraved. Tenderness in one house, he had come to fear, was no more possible, without corruption, than socialism in a single country. And so, from the earliest, halcyon days with Nancy, he had expected the coming of the vandals. Above all, the injustice-collectors. The concentration camp survivors. The emaciated millions of India. The starvelings of Africa.
I probably didn’t get most of the jokes. There were scenes and passages that brought a smile to my face, but nothing like the laugh-out-loud humour others seemed to find. Not like Barney’s Version, but of course that’s a story for another blog post.

Feb 3, 2011

Seen on Miway (Mississauga Transit) bus

The way the sphere appeared
Up in the sky,
I stood in the shower.
I felt no fear.
I knew
It loved me.
The master returns
To dote on it's [sic] pet.

Sep 10, 2010

Life's Too Short for Instant Search

GOOGLE has recently rolled out their very own instant search, branded Google Instant, for most signed-in users. The cool thing about it is that it can potentially save a lot of time for people all over the world. All this time adds up--every time a behemoth like Google shaves a few seconds off the time it takes people to use it, it's probably saving many years and millions of dollars of aggregated time and money the world over, thanks to the sheer number of people using it all the time.

Sounds nice, so I was pretty benign about the new technology, which shows you results while you type your search--until I saw that it insisted on showing me only 10 results at a time. No matter how many times I went to the preferences (Search settings on top right corner) and changed it back to 100 results, it always went back to 10.

So I turned it off (option available also in Search settings). In my opinion the instant search is not worth the trade-off of clicking through many pages of results, if I'm looking for something that's hard to find. I mean sure, Google is good, but it happens to me all the time that I have to do quite a bit of searching and sifting through the results before I find what I'm looking for.

Who knows, maybe in the future they'll improve it to the point that they'll be able to show a thousand instant results even before I've typed my search query. But until that happens, Instant Search stays off for me.

 

Mar 29, 2010

Blogging Sensitive Stuff, and Some Whining

I THINK I've blogged before about not wanting to post private,
personal stuff. But I've been lumping some other things as private
as well--things I've been doing recently that are pretty
interesting (to me at least), but I don't want to post here
because that might lead to some awkward questions. But if I were
to post them in a few months' time, it'd be fine.

So I've decided to start blogging those things, as much as I can,
and keeping them saved privately as drafts. If all goes well, I'll
be able to publish them when the time comes with just a couple of
clicks.

Now that I think about it, I'm actually looking forward to typing
out some of these things and keeping them somewhere; I'll be able
to go back and look at them any time and remind myself of what
I've spent my time on. It's too easy to let the days pass by in a
blur in the normal 9-to-5 work, home, work, course of things.

On another note, though, I'm really missing the convenience of
blogging through Windows Live Writer. Still can't believe there's
no equivalent on the Mac that matches it for features and price.
As it stands, I'm using my favourite
text editor
to type out the posts, log in to Blogger, and then
submit them.

So, an appeal to the internet: can someone please just write a
Windows Live Writer clone for the Mac? Thank you! :-)

Nov 21, 2009

Logicomix--Mathematics & Madness

I BOUGHT Logicomix last Sunday and, reading feverishly on my lunch breaks, and in transit between home and work, finished it yesterday. Admittedly, I tried at first to draw out the pleasure, but finally gave up and glutted myself.

One thing: Logicomix is, as the name suggests, a comic book. Or rather, a graphic novel. But from here on I refer to it as a book because frankly, it's just trying to tell a story in the most interesting way possible.

Starting at the beginning though, I have to say I'd never have learned about it if not for this fine New York Times review. The book is on their best-seller list, and deservedly.

How do I describe the story? It's a story-within-a-story-within-a-story. The authors put themselves in the book, discussing the process by which they're trying to present the life and ideas of Bertrand Russell. That makes the book self-referential, which is ironic in the context of the story it's telling.

The main story is the life of the mathematician-philosopher Bertrand Russell and his titanic struggle to uncover the most fundamental meaning of logic (and therefore math, science and philosophy).

Russell lived in a time of great upheaval in the mathematical, logic and philosophy communities. He collaborated, and sparred, intellectually with such greats as Alfred North Whitehead, Ludwig Wittgenstein, Gottlob Frege, Georg Cantor, Kurt Gödel and David Hilbert (to name just a few). Their passion and drive is explored, and the authors actively try to explain, what made them so great, so insanely driven? (Russell and Whitehead worked on a book trying to explain all of mathematics for ten years before finally giving up and releasing it, unfinished.)

The authors seem to think there was a connection between their logical worldviews and some innate streak of madness. And they don't shy away from exploring this graphically, taking full advantage of the comic medium to show, for example, Russell waking from a nightmare of chaos, face contorted in fear and near-insanity.

Indeed, the authors are definitely not afraid of taking liberties with details of the story to add to the dramatic tension. They've done extensive research on the lives and ideas of everyone in the book--turn to the bibliography in the back if you don't believe me--and they feel, and I agree with them, that these changes add to the tightness and structure of the story. Sometimes you do get a feeling that a conversation seems too contrived, but honestly, the feeling is just washed away by the incredible ideas you encounter.

So is this a math book, stuffed full of math? Well yes and no. It's stuffed full of math and logic ideas, but there's not a single equation in the whole story. The ideas are explained by their creators and their best lovers, the protagonists of the story. You grasp them from the bird's-eye view and you get them, without needing to do a single sum.

So near the beginning of this post, I said it's ironic that the book is self-referential. Let me explain: the problem of logical statements that are self-referential is one that has puzzled great minds, including Russell's, for centuries. For example, how to interpret the following statement?

This statement is false.


If the above statement is false, then it must be true. And if it's true, it must be false!

Near the end, the authors hint that the end of their story is really just the beginning of the much greater story of the renaissance of mathematics with computer science. I'm eagerly looking forward to a follow-up book (or books?). Wishing every success to the authors.

Logicomix: An Epic Search for Truth by Apostolos Doxiadis, Christos Papadimitriou, Alecos Papadatos and Annie Di Donna.


Offtopic: Trying out the MarsEdit blog editor on the Mac to see if it's worth paying for.