Weaving in the crowd

The crowds in shopping malls have always frustrated me. I’m not the type to meander around the corridors looking for bargains or sales. If I want to buy something, usually I already know what’s the item and where I can get it.

So I’ll arrive at the entrance of the shopping mall, and I know where the shop that has my desired item. It’s a straightforward point A to point B thing. But there are so many obstacles! I feel like I’m running an obstacle course, dodging one after another, stopping to let one pass, speeding up to avoid another. What are these obstacles?

My fellow human beings.

Mall plan route

Judging from where I am, the right side of the corridor seems packed. So I move straight, and encounter a slowly moving elder. That’s easy, and I swerve around quickly to encounter…

The family of five. You never really know what kids will do. I’ve had experiences where I would be walking and minding my own business, and then out of nowhere two screaming children would materialise on my left and sprint in front of me to my right. So I swerve a bit more to my left to encounter…

The giddy teenagers, who just emerged from one of those trendy fashion stores. Don’t go near them, because they could suddenly point their fingers somewhere, and go “Oh look, ZARA!” and run enthusiastically toward said store. You need a wide buffer area to improve your chances of dodging their stampede. That, and their unforeseeable and inexplicable fits of high-pitched laughter. So swerving, I encounter…

The young parents with their 6 month old baby in a stroller. This one’s easy, because they will usually move very slow. The stroller also restricts their range of angular movement, so if it’s pointed one way, that’s the direction the parents are moving towards. Easy to predict the point they’ll reach in say, 2 seconds, which is the amount of time I have before I reach them. By which time, I’ll encounter…

The bored boyfriend. This one can be easy or hard, depending on where said boyfriend decides to wait out his girlfriend’s retail rampage in the store. If he decides not to be a free model for the store, he will move out a little onto the corridor. At which traffic will then flow around him and make my path that much harder. This one’s a bit more considerate, choosing to stand close to the store instead. Simple to pass through, and I’ll encounter…

The sentinels. They are a bunch of friends, laughing and talking. Quite ok actually, if not for the fact that their preferred battle formation is a single file moving horizontally. This isn’t a CSI search and comb; you don’t need to spread out into a line. If you want to maximise face time, the line is the worst formation. A circle is much better, like around a camp fire for example (haven’t they heard of complete graphs?). The worst thing is they’ll block a lot of the corridor, leaving you with very little maneuverability. They’re like the sentinels of some hidden treasure, who found an intruder, and are inexorably moving forward to crush the invader… Moving sharply to my left, I avoid them and finally reached my destination. *whew*

The above story was fictional. Well, I didn’t meet the characters all in one trip anyway… but they’re real. This is my long-winded way of saying, sometimes even if you know the destination, there are many unforeseen variables. Such as a software project. Ok, that analogy is a little weird…

I want to point out that, in order for me to successfully navigate around all the colourful characters who so innocently obstruct my path of least resistance, I have to read them. I have to read their body movement, posture and facial expressions to decipher what their likely directions of movement are.

That takes some practice, because you need to know that the person slowing down in front of you might change direction, or even stop completely. Of course, you will need to detect that the person is in fact slowing down…

I used to get angry because of the people blocking me. Why are they moving so slow? In time, I’ve learnt to control my anger. I’ve even turned it into a game of sorts. Here’s how you can play too.

At a moderately populated shopping mall, decide on a destination, preferably one that’s on the same level as your starting point. Your goal is to reach that destination at a more or less constant speed. Say your walking speed is 2 metres per second. You can speed up a little, or slow down a little, but you may not break into a run or stop completely.

This should test your knowledge of human behaviour, how good your reflexes are, whether you can adjust your route on the fly based on real-time data and so on. It also trains you to be more aware of your surroundings, your body position and posture, the length of your stride and so on.

I have 2 killer moves to help you: the shoulder slant and the side step. In the shoulder slant, you swivel one of your shoulders forward and the other backward. This way, you’ll be able to squeeze through some “cracks” in the obstacle run. Because sometimes, there’s never a good time, so when an opening appears, take it. With practice, you’ll learn which shoulder to swivel forward too, depending on situations (swivelling the left shoulder forward means the left foot is more natural to use for the forward leg).

The side step is particularly useful for when the idiot in front of you who don’t know where to go, decides to stop completely. At this point, you must rapidly decide if you want to go to the left or right of this confused and lost person. And then do a side step. Basically you open up your legs sideways. So instead of moving your leg forward in a normal step, you move it to the side.

You need to decide quickly because your momentum will carry you forward, and you don’t want to knock down the fella, right? Because of your forward momentum, there’s almost non-existent side-ways momentum. Thus if you move to the left, you must exert pressure on your right leg to “bounce” to the left. It takes a little practice…

Also, if you decide to go right, and your left foot is in front of you, then the natural movement is to move your right foot to the right in a wide split so as to avoid the now stationary person in front of you. Similarly for the decision to go left.

What if you decide to go right, and your right foot is in front? Uh, try to avoid this situation… Don’t try any fancy dance moves or you might entangle your legs and fall down. Just stop (and you’ll lose the game, but it’s better than public embarrassment). With some practice, you’ll learn to move in the direction based on the length of your stride and where your feet are.

And that’s some 1000+ words to tell you to be observant of human behaviour, to be conscious of your surroundings and to be aware of your body position and posture.

Viruses on Windows, Macs and Unix

The most powerful force in the universe is compound interest.
- Albert Einstein

Einstein may not have said that, but compounding is really powerful. I’ll get to the point in a bit, so just read on…

There’s this story I read about a rich man employing a young lady to count his fortune. She took 6 days to complete the task, and the result was that the man was 42 million dollars rich. The man then asked her how she wanted to be paid.

[For the purposes of the story, 100 pennies equal a dollar.]

The young woman asked to be paid 2 pennies for her 1st day. Then pay her the amount paid the previous day, multiplied by itself, for the next day. So her 2nd day costs 2 * 2 = 4 pennies. Her 3rd day costs 4 * 4 = 16 pennies. And so on till her 6th day.

The rich man thought, “Such a foolish girl!”, and promptly agreed.

So for her 4th day, she had 16 * 16 = 256 pennies. Her 5th day costs 256 * 256 = 65536 pennies. And her 6th day? 65536 * 65536 = 4294967296 pennies.

Wait a minute! 4294967296 pennies is just over 42 million dollars! And so the young woman took all of the rich man’s money. The end.

The point is, small things can add up (or in the clever woman’s case, multiply up). What’s that got to do with computer viruses? What is the primary ability a computer virus needs? To spread to as many computers as possible.

[For the purposes of the following discussion, "computer virus" encompasses all the bad things coded by a human being that could happen on a computer. That should cover viruses, worms, hacks and so on...]

This is why I find people’s reactions to the “susceptibility” of Windows machines towards computer viruses, … confusing. They might say that Macs don’t have this problem, or Unix machines have that security clamped down. There will be rabid fans supporting their favourite operating system.

The thing is, I’m sure there are computer viruses on Macs and Unix. Why is there a lack of mass destruction and mayhem on those platforms? My answer might be deflating for those supporters.

There simply aren’t that many people using those platforms.

As far as I know, Windows is used by most people on a computer. The path of least resistance for a virus writer is to target Windows. And he won! For a while at least… then another outbreak, then fixed and so on.

Each “win” sort of amplifies the “susceptibility” of Windows. Virus writers get a little bolder, a little more creative. People get scared, news stories (in the early days) sort of “glorifies” the damage done, and the difference in platforms got a little wider (even if it’s just people’s perceptions).

Bit by bit, Windows come under fire for things such as the blue screen of death, the ease with which an attacker disrupts, and poor security models. I believe it’s just a scaling factor. Web browsers are now targeted, and that means the operating system doesn’t matter as much anymore.

This is why I find it amusing whenever I encounter what’s known as an Apple fanboy. The praises showered on Apple products for their beauty and elegance. Granted, that’s true. It’s when they also show their disdain for Windows that’s amusing. Why such a strong emotion?

I admit right now. I don’t really have overwhelming love for Windows. Hey I’ve got an iPhone! I just find it useful for me. I like using .NET because it allows me to do what I want quickly and easily (I have a friend who “eewws” at the mention of .NET …).

And I’ve only been seriously wounded by computer viruses a couple of times in my entire life of using computers (probably protected by my positive aura). So I’m offering another reason, and drawing a broad generalisation in the process… Mac and Unix users are generally fairly competent with computers. They are designers, so using image editors is second nature to them. They are system administrators, and let’s face it, if you can do command line stuff, you’re competent.

It’s the not-so-competent users that get hit by computer viruses. Broadly speaking of course, and I don’t know if it’s true, so this is just my conjecture. Where are most of those users? On Windows machines.

So based on small reasons, a twist of fate here and there, and compounding all that, and Windows seem to be riddled with security loopholes, wide open for any attack. But I don’t see it that way.

Bloggers Calendar 2009

About a month ago, I was invited to participate in a project that’s never been done in Singapore before: A calendar for 2009 featuring bloggers in Singapore. It turned out well, and so yeah, the rest of this is going to sound narcissistic…

Still here? Ok, I’m not going into the details of how this came about. The summary is that a few people organised it and the lot of us went to a studio to get our photos taken. I’m born in June, and I’m featured on that month together with another June baby. Here’s me:

Bloggers calendar June 2009

The pretty lady has an equally pretty handle: clicktokill. You do not want to mess with her…

I bought 6 hard copies of the calendar, each month printed on glossy photographic material (I don’t know the technical term for it…) with a cover page. For the life of me, I can’t remember why I ordered 6… Thus I’ve got a couple extra, so if you’re interested (really?), I can send one to you (email me with your address) even if you’re not in Singapore (I’m feeling generous).

Or you can head on over to the web version which was done by Darran (he did a great job on that). Then you can download a zip file with the images yourself. Have a look at the other bloggers while you’re there!

And special thanks to Willy from LiveStudios, who’s the photographer capturing us on film. If you’re in Singapore and looking for photographers, you know who to ask for.

How useful is wisdom of the crowd?

I checked out the entries on Wikipedia and found there’s a book named The Wisdom of Crowds by James Surowiecki and another entry on just wisdom of the crowd (note the “s”). The idea is that groups of individuals are able to provide better solutions, answers or opinions than a single individual.

People raising hands
[image by Michael Jay]

Now Surowiecki stated 4 criteria needed for it to work:

  • Diversity of opinion
  • Independence
  • Decentralisation
  • Aggregation

The first two points are somewhat countered by herd behaviour, where people are (easily) influenced by other people. Based on my observations of people around me, and my personal experience, I found that it’s challenging to come up with your own original idea, thought or opinion. Then it’s also challenging to defend that originality against questioning by other people, or self doubt.

The other two points seem related. The more you decentralise, the more you need to aggregate better. It’s like specialists and generalists (using the terms loosely here). The more you specialise in something, the more work you need to tap on other fields of knowledge.

Aannyway, I was thinking about independent thought, the phrase I heard that’s “wisdom of the crowd” and crowdsourcing (though after reading its meaning, it’s not what I wanted). I was thinking if you’re working on something really hard, would the crowd give you better answers? Or would you (or an individual knowledgeable in that field) be a better choice?

Previously, I talked about using heuristics to match image textures. I was using a few tests to determine if a given texture image matched any of the textures in a sample set. This is like using wisdom of the crowd. No one individual test could match with a reasonably high enough accuracy rate. Let’s compare my matching algorithm with the criteria above.

I’ve got a few different tests, so “diversity of opinion” is covered. I’ve got “independence” because each test doesn’t rely on another. I’ve got “decentralisation” because each test is an “expert” on the particular test algorithm used. And I’ve got “aggregation” when I used some kind of average of the tests’ results.

What happens if the problem is so hard, so unheard of, that you don’t know whose opinion to seek?

Diversity dilutes the final (if any) solution if unrelated opinions are brought on. And for an uncommon problem, independent thinkers might get swayed by the first seemingly correct answer (thus following the herd), simply because the problem is so hard. And there’s not much expert knowledge if the problem is so rare (there goes “decentralisation”).

And whose answer are you going to trust, or how are you going to consolidate answers (aggregation)? When answers are uncertain, bias comes into play. A person’s reputation, your feelings towards a person, the way a person presented his solution.

Remember how I used weights on the results of my texture matching algorithm? Not all opinions are created equal…

Of course, all this could be another barber’s paradox, because there’s no such problem! *smile*

Ok, the whole point of this article is I want you to increase your reliance on your opinions, intuition, thoughts and feelings. I’m sure you have a healthy dose of humility and self-awareness such that when you’re truly stumped, you will find someone knowledgeable and ask. It’s when you form a habit of asking others before coming up with your own conclusions first that I’m worried about.

Remember to change the year too

There were occasions when I was to increment or decrement some date value by one month. For example, “200806″ to “200807″.

No, I don’t have any disaster-insider-programmer stories to share. Although there was this fellow who forgot to change the year which resulted in a financial fiasco…

Anyway, this is more like a reminder to myself. Take care when January and December are involved. Change the year when going from say “200812″ to “200901″, and also “200801″ to “200712″.

If you’re bouncing from one date to another by multiple months, you could try storing the year and the month into one variable holding total months. So “200806″ becomes 2008 * 12 + 6 = 24102 months. Moving 15 months ahead, we have 24117 months, which is 2009 * 12 + 9. So it’s “200909″ finally.

Of course, if your standard code libraries have an inbuilt function, just use that. For .NET, it’s

DateTime.Now.AddMonths(15).ToString("yyyyMM");

Here’s something to think about: Using the algorithm above, what year and month is 24120 months?

Have a fantastic year ahead!