Percentage calculation with negative numbers

Suppose you have 2 numbers. You want to sum them up, and calculate the percentage of each number upon that sum. Say, 4 and 6. So 4 contributes 40% and 6 contributes 60% to their sum 10.

What happens when you have negative numbers?

I did some simple research, and the relevant articles have someone trying to calculate percentage changes from one number to another. Like financial growth reports.

My question is more of, how much each component number contributes to the sum, as a percentage. The problem comes when one of the numbers is negative. Consider the trivial case, 1 and -1. The sum is 0. You already get a division by zero error when calculating the percentage (1/0) * 100.

The solution, which is the same as that in my research, is to take the difference between the two numbers and use that as the basis. So difference of 1 and -1 is 2. So 1 contributes (1/2)*100 = 50%.

What about -1? Use the absolute function. ( abs(-1) / 2 ) * 100 = 50%.

The difference method works fine if you have only two numbers. What if you work with several? My friend actually posed this question to me. Suppose you have 6 numbers, and you want to calculate the percentage contribution for each number towards their sum.

My suggestion? Absolute everything. The percentage contribution of n1 is
abs(n1) / ( abs(n1) + abs(n2) + abs(n3) + abs(n4) + abs(n5) + abs(n6) ) * 100

Then my friend posed a killer question. What if all the numbers are zero? What’s the percentage for each number then (even though each number is zero)?

It’s for a reporting application, and my friend was wondering how to calculate the percentages. Now the sum of a bunch of zeroes is also zero. You hit the division by zero error. Even the absolute-everything method fails, since each number is zero, so there’s nothing to “absolute”.

Since there’s no defined way of calculating when all the numbers are zero, I gave the 2 obvious solutions. The first is that, since each number is zero, and the sum is zero, therefore each zero contributed 100% to the zero sum. The second is, since each number is zero, therefore each contributed 0%.

My friend chose the second solution. The most compelling reason for that choice was that it’s easier to explain the logic behind that choice to the user. It’s an edge case. When there’s no right answer, choose the answer which is easier to explain.

UPDATE: Steve has given 2 more alternative solutions.

UPDATE: I wrote an article to explain some of the confusion by some readers. How can a poorly performing product contribute the highest percentage in a company’s bottom line? Read the explanation here.

If you enjoyed this article and found it useful, please share it with your friends. You should also subscribe to get the latest articles (it’s free).

Random quote – I feel productive

Some time ago, my colleague gave birth to a beautiful baby girl. As such, she cannot lunch with us for a while, because she needs the lunch hour to fulfil her motherly duties. She might not be able to bring her baby to the office to nurse, but she can definitely uhm, produce milk for uhm, takeaway.

So one fine day, I had a particularly effective morning, cranking out code while listening to my favourite songs. When my other colleagues and I were getting ready for lunch, the mother called out to me and said she would be joining us. When I asked about her uhm, motherly duties, she said she did it a bit earlier, and so she could join us.

We were happily talking, and strolling along to take the lift down. We caught up with the happenings of each other.

“Oh how are things with your baby?”
“She’s so cute. I’m so tired. Hey, how’s your trip?”

We went into the lift and down it went. Somewhere during the descent, there was a slight pause in our conversation flow. And the mother blurted out:

I feel productive

I couldn’t stop laughing…

Here come weaker viruses

A particular hosting company, McColo, was taken down some time ago. While there are reports of decreased amount of spam, as experienced by Terry Zink, I remain wary.

For around the same period of time, I experienced an increase in spam at this blog.

Granted, Zink was referring to mail spam. I just have a theory. Based on my research in epidemiology, when a major virus gets wiped out, the weaker viruses start to fill in the gap. Nature abhors a vacuum.

For all we know, the major virus was keeping the weaker viruses at bay. Once we hit some kind of equilibrium, we sort of coexist with the major virus, despite our distaste for it. We establish methods for dealing with that virus. We maintain some sort of control.

Once that major virus was taken out (say, the hosting company hosting its operations), a void was left. And if we weren’t prepared for the weaker viruses (because we’re so focused on that one virus), we’ll be in trouble.

The above was a bit of a generalisation. I’m not deliberately being pessimistic. I’m just saying something will happen. Hopefully, that something is us warriors of light taking advantage of the situation.

Pure programming knowledge is not enough

I’m short-sighted. The degree of blurriness isn’t terrible, so I can still make do without glasses. When I first started working, I thought working with computers the whole day warrants the wearing of glasses, so I got myself a pair. Turns out to be more trouble than it’s worth…

Eyeglasses
[image by Gene Chutka]

Anyway, I found out about it when I was in university, when I couldn’t see the notes on the projector screen or on the board properly. I’d have to sit in the first 3 rows if the words were to be clear. But the first 3 rows were occupied by uhm, zealous students, so I took seats slightly further away.

Since I couldn’t see much of the notes, I squinted. To forestall some of the obvious questions, no, vanity had nothing to do with not wearing glasses. Glasses were expensive, and so were contact lenses. And they’re really troublesome to wear on a regular basis. So yeah, no glasses.

To compensate for my “loss” of sight, my other abilities stepped up to take on the responsibility. After 2 and a half years of serving the nation (National Service in Singapore), I was suddenly very productive. I paid better attention to the lecturer. I listened carefully.

Since I can’t see very well, I got context from surrounding words. My language skills helped a lot, filling in grammar, spelling and sentence structure. In both proper and “broken” English no less. I was studying math, and my math background helped in making sense of the symbols and the esoteric language used, filling in gaps where my language skills were useless.

With perseverance, lots of context filling (from language and math), I got most of the lesson. I actually took very little notes, since I couldn’t copy them fast enough anyway. I opted instead to understand what the lecturer was teaching and try to quickly absorb them.

I’m not so much concerned with seeing the words correctly, but interpreting them correctly.

The squinting… Now the squinting seemed to blur the words even more. But I saw the words more “clearly”. It’s like holding a picture close to your face. It’s blur, and you can’t make out anything. Take it further away and you can see the picture. It’s something like that. I needed to “blurrify” the words so they became meant for far viewing in my case. Sort of like Nazca Lines.

After I graduated and started working, I got myself a pair of glasses. Then I stopped wearing them. I haven’t needed to read words at a fair distance. And the computer screen seems to read fine. I take regular breaks to rest my eyes. Besides, wearing glasses gives me a headache and dries my eyes easily. Sometimes, I still wear them, and only for reading books and playing video games (otherwise I can’t see the dialogue on the TV screen).

The lesson?

When I read code, be it other people’s code or mine, I use a lot of context filling. Half the time, I’m using my knowledge of business logic, human psychology and languages (English or otherwise) to understand the code. The other half is programming knowledge.

It’s when I do this that I figure out patterns, of decisions made (where devoid of comments). That I understand where I needed to make changes for new business logic. That I can do simple refactoring (the refactoring is simple. It’s the understanding that’s hard. Different programmers do the same thing differently).

I found that when reading code, whether because of debugging or adding changes, pure programming knowledge isn’t enough. For example, if I knew the original programmer wrote that piece of code far in the past, I could make a guess as to why he wrote it that way. Say he’s trying to optimise a piece of code, but the optimisation is no longer relevant in modern times.

It bears repeating. Pure programming knowledge isn’t enough.

Math, culture and programming languages

Can a programmer’s background determine whether he’ll be a great programmer? By background, I mean his upbringing, the values learnt, his primary (and perhaps secondary) spoken/written language and so on.

I don’t know. However, I have arguments for and against the proposition. Let’s start with…

Learning to count

You think counting is easy? Apparently not. Recently I read a book, Outliers by Malcolm Gladwell. According to Gladwell, American children the age of four can, on average, count up to fifteen. Chinese children at that age can, on average, count up to forty.

His reasoning is that, the system of naming numbers is different in English and in Chinese.

For example, think about counting from twenty to thirty (I’m deliberately using the English form instead of the Arabic numerals to highlight the difference). You have twenty, twenty one, twenty two and so on till twenty nine and thirty. How about thirty to forty? Thirty, thirty one, thirty two and so on till thirty nine and forty.

Consider counting from ten to twenty. Ten, eleven, twelve, thirteen and so on till eighteen, nineteen and twenty. The pattern is different and irregular.

Before I show you the Chinese method of counting, let me show you the first 10 numbers, shown by the Arabic numeral, the English name and the (closest) Chinese pronunciation I can give:

1 one (yi, like in “yeast”)
2 two (er, like in “brighter”)
3 three (san, “sahn”)
4 four (si, do a short hissing sound with the s)
5 five (wu, “woo” and keep it short)
6 six (liu, “li” and “ou” as in “shoulder”, and string li-ou together quickly)
7 seven (qi, “cheese” without the s, and shorter in length)
8 eight (ba, as in “barter”)
9 nine (jiu, “gi” as in “gin” and “ou” as in “shoulder”. Like that of six.)
10 ten (shi, like that of four, with the h)

There are actually 4 tonal inflections for a Chinese character pronunciation, and we’ll ignore that for this discussion.

So to count in Chinese from ten to twenty, we have shi, shi yi, shi er, shi san, shi si, shi wu, shi liu, shi qi, shi ba, shi jiu, er shi. They are literally “ten”, “ten one”, “ten two”, “ten three” and so on till “ten nine” and “two ten”. There’s an implicit “one” in front of the “ten”, so it’s “one ten one” for eleven. For twenty three, it’s “er shi san”, or literally “two tens and three”.

Gladwell says this gives structure to the counting system, so children are able to grasp larger numbers quicker. The faster you can count to larger numbers, the more operations you can do on them. Additions, subtractions, summations and so on.

Ok, I’m not saying the Chinese number naming system is better than the English system. It’s just different. Gladwell says this difference also makes memorising short number sequences easier. For example, I can remember my Identification Card Number (equivalent to the Social Security Number in America) easier in Chinese than in English.

It explains why when someone asks for my phone number in English, I have a problem. Because I’m mentally translating my memory of the phone number from Chinese to English. Did you know it’s kinda hard to say out 8 digits in English while translating them from a Chinese memory? I can even mentally picture the numbers. It’s the speaking out that’s taking up mental processing time.

Gladwell also made a point about Cantonese (a Chinese dialect) pronunciation of numbers. So I tried saying out numbers in Cantonese (yes, I’m multilingual), and wow, it is easier to say and memorise! The Cantonese pronunciation of numbers are short in length, which makes it easier to spit them out *smile*

And the relation to programming? Programming is made up largely of counting and solutions formed from abstract ideas. When I first learned C, I was surprised that many fellow students had difficulty counting the number of iterations in say,

for (i=0; i<10; ++i)
{
	if (i>7) break;
	// do something
}

Counting and iterating leads to lists of data, or sets of data. In SQL, you can manipulate sets of data as if it’s one unit, abstracting away the fact that the data is actually iterated one by one. For example, you can select information from another data set, or a subquery as it’s known.

Of course, there are still some people who have difficulty visualising SQL data sets as one unit, hence their need to iterate over that one record by one record at a time, even when there’s no need. What does that tell you about these people?

Hard work is valued

Gladwell also made a point about culture. That successful people seem to grow up with a culture of valuing hard work. The ability to think on a problem long enough to come up with a solution.

He said something worth thinking about. There’s a educational researcher by the name of Erling Boe at the University of Pennsylvania. Boe says that one can know if a child will do well in math without asking that child a single math question.

The example in the book was a fictional Math Olympics. Before the test, there was a questionnaire to be filled in. There were tons of questions inside, none related to math. Boe asserts that a child who finishes that questionnaire will also do correspondingly just as well in the math test.

It’s a question of perseverance, the willingness to put one’s mind to work, even if one doesn’t feel like it.

Hard work is something valued in the countries of “wet-rice agriculture and meaningful work”, as Gladwell puts it. Based on the research of Boe, the top countries are Singapore (yay!), South Korea, Taiwan, Hong Kong and Japan. Though I’m not so sure of my fellow countryman’s motivations… The parents and children could be driven more by the race for top scores rather than the culture passed on by our forefathers.

Well, I haven’t read much on Boe’s research, but the hardworking nature of my countrymen is fairly accurate. Students are willing to study for long periods of time (most of them anyway…). Adults are willing to work just a little longer, a little harder at work. For example, I recently knew that my friend worked overtime till 4 am at the office. Personally, I think that’s crazy, but to each his (in this case, her) own.

The native language

There was a question in StackOverflow about coding in other spoken languages, which was highlighted in Jeff and Joel’s recent podcast.

The reserved words in a programming language are fixed. Usually they are in English, though there are programming languages in say Chinese. I didn’t know there was a Chinese version of BASIC!

Once, I took up an SQL reference book, written in Chinese. I want to mention that I cannot read a programming reference book written in Chinese. That is to say, I can certainly read the Chinese characters, but I can’t understand the heck what it means.

I need a reference book written in English for SQL, because the native (human) language for SQL is English! Unless there’s a variant I don’t know about…

I’ve seen some code written in Spanish before, I think. Can’t remember. Anyway, the native language for the programming language (C, I think) was English, so the code reads fine. The variable names look different, but I didn’t have too much difficulty.

My guess is that my math background prepared me for abstract notions and symbols, and still be able to work with them. So I treated variables named in a foreign language as just another symbol. And continued to read the code based on that.

And this brings me full circle to…

So does background really matter?

I am unfamiliar with how an American (or English, or French) grows up. I don’t really know the values valued, or the culture surrounding the upbringing of a child.

I do know mine. I’m brought up learning two languages (English and Chinese), two Chinese dialects (Hokkien and Cantonese). I taught myself to read Japanese characters. I’m brought up around people who wake up before dawn to work, and work long hours, regularly and consistently and over long periods of time.

Personal values, personality, genes and luck. I agree they play a part in the makings of a great programmer. In particular, I believe that one’s background influences personal values and personality, so in that sense, background does matter.

And specifically, I think my math background makes grasping programming concepts easier for me.

Of course, everything you’ve just read could be hogwash, because I’m still telling (interesting, I hope) anecdotes to illustrate points as Joel points out vehemently. I haven’t read a lot about computer science and its history in America (or pretty much anywhere in the world). I research just enough so that what I write is as true as I understand it (sometimes I don’t research at all!).

I admit that I’m still naive and easily impressed. I still pretty much trust what I read as true. It’s only when I start internalising the information that I really think about them.

So what do you think?

You are debugging with the wrong database

I feel an urge to tell a story first. So here goes…

Once upon a time, in a far away land, a young prince lived in a shining castle. Although he had everything his heart desired, he was spoilt, selfish and unkind.

But then, one winter’s night, an old beggar woman came to the castle and offered him a single rose, in return for shelter from the bitter cold. Repulsed by her haggard appearance, the prince sneered at the gift, and turned the old woman away. But she warned him, not to be deceived by appearances, for beauty is found within…

Oops, wrong story. Let me try again.

Once upon a time…

In the Far East, there was an adventurer by the name of Wen Sen* (wuhn suhn). He wandered many lands, climbed many hills and even walked on glaciers. But he’s a scholar at heart, and so he set out in search of knowledge.

Mayan ruins explorer
[image by Steve Geer]

Wen Sen wanted to find out more about a particular village with strange inhabitants. After travelling many days on foot, he finally reached the village’s gates. Despite his raging thirst, his thirst for knowledge was greater. So he accosted the first villager with

Do you think it’s a coincidence that the first 3 prime numbers are also part of the Fibonacci sequence**?

Getting a blank stare, he leapt to the next villager with

What are your thoughts on the first 3 odd prime numbers forming 2 pairs of twin primes***?

Despite his fervour, Wen Sen didn’t get anything out of the villlagers. He even tried indecent questions such as “Are you divisible by 17?”. Dejected, he slumped at a corner of a building, thoroughly miserable.

An elderly woman approached him and asked,
“Are you alright, young man?”
“I’m fine. I just haven’t found what I am looking for,” Wen Sen sighed.
“Well, what are you looking for?” she asked.
“Your village is supposed to hold the key to unlocking the secrets of prime numbers,” Wen Sen breathed. “But everyone seems confused. What am I doing wrong?“.

“Oh,” the elderly woman’s eyebrows lifted. “You must be referring to our neighbouring Village 2357. This is Village 4680.”

The real story…

Well, I can’t remember the details. All I remembered was, I was testing my code, and the results on the web page didn’t match the results in the database.

I triple checked my code. I retrieved the results from the database to verify the data. Everything was in order. But why wasn’t the web page showing the correct set of data?

I forgot what triggered it, but I suddenly realised that I was connecting to the wrong database. I was working with databases in development, testing and production environments then. And I forgot to change a configuration setting.

From then on, I was careful about making sure that I’m in the correct database before I do anything else.

* Wen Sen are the closest Chinese characters to my name Vincent. It means “knowledge forest” or “culture forest”, depending on context. And depending on the Chinese characters used, of course. And no, my actual Chinese name isn’t Wen Sen.

** The first 3 primes are 2, 3 and 5. The Fibonacci sequence is 1, 1, 2, 3, 5, 8 and so on.

*** 3 and 5 form one pair of twin primes. 5 and 7 form another.

New Zealand Nov 2004 trip – Back to Singapore

This is part of some travelling notes I wrote exactly 4 years ago for a trip to New Zealand in November 2004. Please enjoy the story.

Day 9, 14 November 2004, Sunday

My mind left dream land at 6:00am, but my body only caught up at 6:15am. Ate the last Snickers and muesli bars for breakfast. Waited for the 6:30am morning call. Ring, ring. Time to move. Washed up, packed up and dragged my luggage across the road to get to the reception counter. Checking out was a brief affair, and the receptionist helped me mail a survey letter (from my tour package company TourMasters) I did last night.

It was then 7:30am. I walked around the reception room, glancing at the hotel’s trophies, paintings and fireplace. They were also selling batteries, shavers, medicine and stuff. The only reason I even remember these things was that I felt restless waiting there. And hungry, didn’t forget that… Oh, there were two floor lamps, metal (bronze?) molded in the shape of angels (I guess), mirror images of each other. Oh good, my limo arrived (same car company for when I first arrived in Christchurch). Driver’s name is Ashley.

Reached airport at 8:05am. Ashley even showed me how and where to check in before he left. Finished checking in at 8:20am. Could have been earlier, but there was a young couple who seemed to have overweight baggage, and was creating extra paper work.

Didn’t want to repeat the same mistake 9 days ago in Changi Airport, so I hurried immediately to the gate. I got a window seat! Not too good though, because the right airplane wing was just outside my window and the sun was especially strong. Not much cloud cover to speak of, so my eyes were assailed by a constant stream of reflected sunlight. I had to pull the window cover down to shield my eyes.

Lift off at 9:16am, touch down at 10:21am. That was quick. Connecting flight’s at 1:00pm, so I had plenty of time. I decided to walk the 8 minute route from the domestic terminal to the international terminal. My luggage was automatically transferred to the plane, so I didn’t have to lug that big case around. I took my time, since my calf was still aching. Checked in early, paid the airport tax (NZ25.00), and explored the Auckland airport a bit, since the last time I was here, I was kinda occupied with reaching my connecting flight.

Nothing much to see really, so I went to the gate to wait. Besides, the smell from the cafes and McDonald’s was driving me crazy. Hope they serve food on the flight soon. I’m famished!

It’s now 11:20am, one hour more till boarding time. I got a window seat again! My seat partner was Sheila from Christchurch. She’s English by birth, but decided to reside in New Zealand. Going to her brother’s birthday. Wishes her children will provide her some grandchildren.

At 2:10pm, they served lunch. Finally. There was some chicken thingy, vegetables, bread and dessert cake. I hope Sheila didn’t get the impression that I’m a starving lunatic, what with the way I was bulldozing through the food. Though it’s not too far from the truth. I really was trying very hard to eat with decorum. Inflight movies: “I, Robot”, “The Terminal” and “The Manchurian Candidate”. They served stuff on and off. Like lemon tinctured ice water. Take. Ice cream. Take. Peanuts and crackers. Take. Orange juice. TAKE! Oh yeah, I’m not too picky…

Did some problems from Amazing Logic Puzzles to kill time. Managed to solve 5 math puzzles before the 10:00pm dinner. Food! Yeah! Lasagne, long beans, bread, fruit, cake, orange juice and Chinese tea. Oh this is lovely.

The flight took about 11 hours. We landed on Singapore soil at 7:12pm Singapore time according to the plane, and 12:10am New Zealand time according to my watch. Switching back to Singapore time now. I’m back!

Epilogue

I thoroughly enjoyed this trip. Sure there were unfortunate instances that could have been avoided, like maybe walking less (Dunedin walkathon), or bringing more money (the two day end-of-trip financial disaster). But these are what made my trip more memorable, and ultimately more enjoyable. I wasn’t in any real danger, so I went for having adventures instead.

I’m glad this trip was so free-style in nature. Imagine being led around by a tour guide. Why would I want to do that, when I can explore the cities and have my own experience? New Zealand gave me awe-inspiring landscapes, unforgettable experiences and unique memories.

A lot of people asked why I’m travelling alone, especially for my first trip. First off, no one’s free to come along, or willing to pay for this trip I like. Second, I wanted freedom at the time. I wanted this to be entirely different for me. About the only thing I heeded was to get a tour package. The tour company arranged everything about transport and lodging. Food and fun is up to me.

Finally, I want to thank all the people I’ve met on the trip. Notable persons are:

  • Richard, the Air New Zealand pilot.
  • Jung Tea Hee, the Korean backpacker.
  • Mie, the Japanese lady.
  • Rob, my paragliding pilot.
  • The nice Mexican couple. … Especially and particularly this nice Mexican couple. I really should have gotten their names…
  • Jaya, my glacier walk guide.

My only regret was that I didn’t take pictures of the people I met. I started on the trip just wanting to have a new view of my world. The (mis)adventures I had and the people I came into contact with, made my experience fuller. Thank you for reading.

New Zealand Nov 2004 trip – Starving broke

This is part of some travelling notes I wrote exactly 4 years ago for a trip to New Zealand in November 2004. Please enjoy the story.

Day 8, 13 November 2004, Saturday

Woke up at 6:00am, but decided to just lie underneath the covers because it’s really cold. Got out of bed at 6:30am because I was hungry. Ate the Snickers bar and two muesli bars. Packed everything and just waited till 8:00am.

Took my luggage out of the room and the motel manager (happened to pass by) told me to stay put. He’ll drive around to pick me and another couple’s luggage. Apparently, the couple went to the coach pick up point first and left their luggage here. Anyway, the motel guy is really nice. Forgot to get his name, but I’ll remember his establishment. Rainforest Motel, folks, Rainforest Motel of Fox Glacier.

The pick up point is actually just outside the Alpine Guides station. I met a middle-aged/elderly couple from Sydney, Australia. They’re going to take the TranzAlpine as well. This was also the couple whose luggage was brought over with me.

Coach came, and driver took everyone’s vouchers except mine. I gave it to him and he was trying to look for my name. I moved closer to help him, and he backed away. Whether he wanted a better light, or he didn’t want me to look at his list, I’ll never know.

When we’re about to leave (8:31am), the general store lady rushed out (the store’s opposite the Alpine Guides station), with what I think is a NZ20.00 note in her hand. Some conversation between her and the driver, and I only caught something about the driver keeping the change. Started moving again at 8:32am. Coach driver’s name’s Maurice, I think. Didn’t quite catch it. Or Moris.

Franz-Josef town
The town of Franz-Josef seems larger than that of Fox Glacier. But I think Fox sounds way cooler than Franz-Josef…

Some commentary from driver about the colour of glacial rivers. Chalky, because of the rock dust or rock flour ground by the glaciers. Picked up more passengers from Franz-Josef town. Met the Mexican couple again. Left Franz-Josef town proper at 9:42am. Passed Whataroa town. Picked up another passenger at 10:04am. Entered Mount Hercules Scenic Reserve (10:16am).

Pukekura
Pukekura stop. Possum delights. Yum…

Bushmans Centre
Pukekura stop. The coach driver was making a joke of running if one was suddenly under a huge shadow. It could the killer sandfly… haha… 🙂

Moose and turkey
Pukekura stop. This a moose? Coach driver was talking about there being three turkeys. That was two Christmases ago, he said. And we now have only one turkey here…

Frisbee at Pukekura
Pukekura stop. Frisbee! Blue disk in picture centre. People lounging, writing in notepads, licking on ice cream and so on and so forth.

Stopped at Pukekura (10:48am to 11:14am). Entered Fergusson’s Bush Scenic Reserve (11:22am). Passed through gold mining town of Ross (11:32am).

Hokitika
Rain in Hokitika.

Hokitika clock
Jade, or greenstone as they call it.

We stopped at Hokitika from 11:55am to 12:30pm. Didn’t want to walk around town. It was raining then, so didn’t want to get wet. Lunch was a miserable muesli bar. Rain stopped at 12:15pm. The coach windows were clear again at 12:30pm. Either the rain here is different or the coach windows are really good at keeping water off.

Greymouth Station

TranzAlpine
Greymouth train station and the TranzAlpine.

Stopped at Greymouth at 1:10pm. Checked in luggage, and didn’t want to miss the train, so kept close to the station. While waiting for the train, saw a “Just Married” tag hung on the backpack of the husband of the Mexican couple. Awww… that’s so sweet. Got on TranzAlpine Express at 1:40pm. My ticket gives a window seat on the left! Seat B3A. Carriage B, row 3, seat A.

Well, the train ride might have been really good, but I didn’t really enjoy it. In fact, I was downright miserable. Cold, hunger and exhaustion overwhelmed me, and I dozed half the time on the train. Plus the windows were a bit dirty, and they really reflect the interior, so pictures weren’t great.

Arthurs Pass
Arthur’s Pass.


Just showing the real cool reflective properties of the train window.

We stopped at Arthur’s Pass station and picked up (and left off) some passengers. Took pictures of the mountains and went back in. Really cold. And really hungry. I’m left with one muesli and two Snickers bars, so I want to conserve them a bit.

And the train driver wasn’t helping! He kept mentioning about the bar counter in carriage D, where things like warm pies, sumptuous sandwiches, delicious ice cream (for some reason, tourists really love them despite the cold weather), fragrant teas, and hot chocolate could be bought. And there were specialty sandwiches. NZ2.00 for two. They might be good value, but I couldn’t even afford that now. Oh this is disasterrific…

Passed through Springfield (stopped for some servicing) and Darfield. We must have passed through some other towns, but I was asleep. 5:20pm, and I’m now really looking forward to being in Christchurch, where I could find some food. I had not eaten real food for about 2 days now, surviving on just cookies and nutrition bars and chocolate bars.

45 minutes later, we pulled into Christchurch train station. I waited patiently for my luggage to come unto the conveyor belt. Grabbed it, and went looking for my hotel transport driver. “V. Tan. Cotswold Hotel.” I think the driver’s a Mauri, name’s Tores. Really big man. Took me to Cotswold Hotel, where the receptionist Rewa gave him a voucher (NZ12.00) for the taxi fare (my transport’s supposed to be paid for by the hotel. Or I’ve already paid it, and it’s included in my itinerary vouchers.).

Room 872
Oh yeah, room 872.

Cotswold Hotel
Cotswold Hotel.

I checked in. Room number 872. I’ve never stayed at a hotel room a road away from the main hotel before. Cool. Entered my room (opulent) and emptied my pockets. NZ31.65 and an American quarter. Well if the departure tax is NZ25.00, I would only have NZ6.65 for dinner. I went back to the reception counter to check. Yup, NZ25.00.

Burger King
My life saver!!

Head down, I went looking for a fast food joint. Burger King! I went in, scanned the menu on top and rested my eyes on “Double Cheeseburger. Normal NZ5.95. Large NZ6.45”. Yes, within budget! I might as well get the large one.

“No combo?”, the waiter asked.
“No, just the burger.”, I replied.

Now, under normal circumstances, one could have deduced that NZ6.45 wouldn’t buy just a burger. But I’m not thinking straight at the moment. So when they plopped a pack of fries and a cup with the burger, I asked if this was part of what I paid for. They look stunned. Since they didn’t ask me for more money, I diverted the question. “Is that where I get my drink?”, I pointed to the self-service tap on my right after glancing around. They nodded.

I sauntered towards the drink device, scanned through the available choices, and stuck my cup under “raspberry fizzy”. I sat down, and at 7:15pm, chewed on my first bite of normal food. Bliss. Never mind it being fast food. Finished my meal at 7:28pm. Fast, considering the normal speed I eat. I’m just happy I got more than the burger.

National Radiation Laboratory
I remember it’s the National Radiation Laboratory. Not “Research”. “Radiation”. I wonder why it’s in the middle of the city…
[EDIT] It is National Radiation Laboratory.

Christchurch clock
Missed this clock on the first day.

Christchurch penitentiary
I could be mistaken, but this building is a penitentiary. Says so on the gate.

Christchurch casino
Christchurch casino.

Peterborough
The Peterborough. I have no idea what this building houses. A club maybe?

It’s my last leisure day in New Zealand, so despite the aching advice given by my right calf (injury from glacier walk), I braved the city once more. Finally, at 8:00pm, my desperate thighs added their protests as well, so I made my way back to the hotel. Checked my finances again. 1 NZ20.00, 1 NZ2.00 coin, 2 NZ1.00 coins, 2 NZ0.50 coins, 1 NZ0.01 coin, 2 NZ0.05 coins and an American quarter, disregarding the fact that I still have Singapore money on me.

On hindsight, I could have changed money at the reception or with people around me, but I only remembered the bank. And they were closed now (Saturday afternoon). After paying the NZ25.00 tax, I’ll just have NZ0.20 left. And the American quarter. Not exactly a penny to my name, but close.

Anticipating another Amazing Race flight connection. Domestic flight from Christchurch to Auckland flies at 8:55am, and I think it takes two and a half hours. So will reach Auckland at about 11:30am. Connecting flight’s at 1:00pm. More than enough time, some would say, but I’m not too hopeful at this point. Will check out early the next day, and hope my transport to the airport arrives sooner. Oh yeah, ate one more Snickers bar. Still hungry.

Coding better to reduce number of toxic villages

I actually wanted to write something on better programmers somehow improving the world. Then I read a Plurk by Shen Heng with the video above. (video link)

Discarded electronic equipment are transported to some countries to process. In particular, heavy metals such as lead are extracted from the equipment. In the video, there are small villages in China dedicated to processing the electronic equipment. The concern is on the toxicity of the processing and how heavy metal poisoning is affecting the children of those villages.

That’s just terrible. Can writing better code somehow improve the longevity of our electronic devices (computers, mobile phones and so on), so there are less to be recycled or disposed of? Can being a better programmer butterfly-affect the reduction of electronic waste?

I believe so. I believe somehow, the intangible software we write can affect the tangible hardware it resides in. I believe the software we develop should still be effective and efficient regardless of hardware improvements.

Or maybe it doesn’t matter. People will upgrade and throw away “old” equipment anyway.

What do you believe in?

New Zealand Nov 2004 trip – Fox Glacier walk

This is part of some travelling notes I wrote exactly 4 years ago for a trip to New Zealand in November 2004. Please enjoy the story.

Day 7, 12 November 2004, Friday

7:20am. Rise and shine. Didn’t have to get out of bed this early, but I was restless. And it was cold, so maybe walking a bit will warm me up. Ate another muesli bar and 4 biscuits. Food left as of now: 5 Snickers bars, 6 muesli bars and 4 biscuits. The muesli bars and biscuits were quite nice actually. Of course hunger is the best condiment, so anything goes.

Cat
While I was waiting till near the commencement of the glacier walk, this cat appeared outside my room and was just staring at me. I think it’s the motel owner’s cat because it loiters around the vicinity.

Milled around the motel room for a while, not knowing what to do, until 8:55am. The Alpine Guides lady said to wear 3 or 4 pieces of warm clothing, so I wore, in order, one T-shirt, one shirt, one long-sleeved shirt, and a wind-breaker. That ought to keep me warm. Wouldn’t want to lose unnecessary heat, what with the scarcity of food and all…

Slapped on plenty of sunscreen lotion on forearms and face. And chapstick on lips. Then went to the Alpine Guides station early, just to confirm my 10:30am walk (you never know…). It’s confirmed, then I remembered I prepared lunch (3 Snickers bars), but no water. *sigh* Mineral water (NZ2.10) at the general store. Tried using the American quarter as the 10 cents, but the cashier lady refused to accept it. I distinctly remembered it came from her. Never mind, took a twenty cent coin to get change.

Went back to motel room to rest. Went through my stuff again, and remembered I still have to pay the airport tax when departing New Zealand! Oh this is bad… At 10:10am, I went to the motel reception to ask what’s the departure tax. I got an NZ20.00 or NZ25.00 as an answer. Well, the former’s fine since it’ll leave me with about NZ10.00 for dinner in Christchurch. The latter will be devastating to my finances.

Dog
Dog. Not a dog person myself, but I took the shot because of the rarity of domestic pets in New Zealand. Disregarding sheep of course…

Waited at Alpine Guides for the glacier walk guide. 10:25am, a female guide came in, and told all of us going on the 10:30am walk to follow her. We went to the boots station, to get those mountain trekking boots. When asked about my shoe size, I sheepishly replied a 10. “UK 10?”. I just nodded (I don’t know…). Took a pair of their gray socks that seemed to match and tried on the socks and boots. Boots fitted nicely. Then the guide said to take one of their raincoats as well, in case it rains. And their backpacks if we don’t have any. Well, I’m pretty sure my wind-breaker can act as a rain-breaker, but my mind’s not working too well now. So I took a raincoat. I was then wearing 5 pieces of clothing…

The guide then handed us crampons. They’re metal spikes that we’re to attach to the boots. I took a pair, and climbed aboard their bus, which would take us to the glacier terminal (10 minutes). Terminal, as in end of the glacier.

There were 24 of us and 2 guides. On arrival, we split into two, and I ended up with the female guide from earlier on. She made us go round introducing ourselves, and to state one thing we want to do before we die. I didn’t get their names (but the guide did. Fantastic memory. Her name’s Jaya. Rhymes with fire, she says.), but there were people from Holland, Germany, America (Los Angeles). The Dutch (found out after we started walking) was actually living in Singapore, working as an engineer. He was involved in the Tuas land reclamation project. There was one who wanted to dance, one wanted to paraglide (did that :)), one wanted to go to Alaska, and one who wanted to hold a concert for his friends (plays the guitar). I didn’t know what to say, so I just mentioned doing the Milford Track or Kepler Track. Hah! Don’t think I’ll ever be able to do those. Now that I think about, what I really wanted was to come back to New Zealand again.

Jaya then told me to put the crampons in my bag first. Oh no! It’s kinda dirty, and my bag wasn’t suited to hold something spiky (I’ve got travel documents and stuff inside…). In the end, I sandwiched the crampons between my gloves and hoped for the best.

Fox Glacier
Glimpse of the ice river I’ll be walking on.

Champagne Creek, blurred
Champagne Creek. Bad shot, because of my precarious narrow perch then, and that I was blocking other people. The water’s flowing from the right to the left, and splashing upwards off of … something… probably a rock.

Fox Glacier neve
The patch of pure white ice near the centre is called the névé (nay-vay), the birthplace of the glacier.

Fox Glacier
This was near the closest point to the top where our guide could take us safely. Oh man, I look dorky…

We started the walk, with the first one and a quarter hour in the rainforest part climbing up into the glacier. The track was perilous at one point, with sheer cliffs dropping to the land below, and I was to hold onto the metal chains on the rock face. There was this Champagne Creek, which Jaya said flows drinkable water. I didn’t drink any, though I took a picture of it.

The temperature rose, and I took off the raincoat. Why did I take the raincoat, and why did I wear so many clothes? Reached near the glacier, and out of the rainforest. Jaya showed us how to wear the crampons. Wore them and continued.

Can’t remember when, but we passed by two barrels containing sticks with a metal rod at one end. They’re alpenstocks, and it’s used in the old days to help travellers on their way. The method to walk with crampons is to step hard onto rounded mounds of ice. The crampons are fitted under the centre of the boots, so it doesn’t make sense to walk on one’s toes or heels.

We passed by moulins (yes, same spelling as Moulin Rouge), which are water holes created by swirling melted ice. Some of them were pretty deep. Jaya told us not to rush to moulins, or ice caves or something to take pictures. She’ll let us know when it’s safe. I think that was partially directed at me… hehe…

The walk was fun, sometimes on flat areas, sometimes on thin high ledges, sometimes having to descend into narrow crevices. Jaya had to wreck some parts of the glacier with her ice pick to make steps for us on some occasions. One time, we even had to backtrack a little because there wasn’t any way forward (glaciers change every day, so one route that day may disappear the next.). Several times, she told us to stay put while she went surveying for possible routes.

Fox Glacier
Breathtaking view from the top of the glacier. I also have to walk back down… That, looks like a long walk…

Fox Glacier
Jaya, exploring and carving out new paths for us.

Fox Glacier

Fox Glacier
“Wow grandma, what big teeth you have!”

Vincent at Fox Glacier terminal
Back down at the glacier terminal.

Fox Glacier rocky path
And the treacherous, gravel-ridden descent I did.

Somewhere on the walk, Jaya pointed out a drinkable pool of melted ice. It tasted fresh and clean. We also stopped for lunch somewhere. I ate 2 of the 3 Snickers bars I brought, and drank some of the mineral water I bought in the morning.

Spent the rest of the early afternoon zig-zagging on the glacier. My shoulders started to ache with carrying the raincoat and my sling bag. I got two cuts on my right hand from the ice. I got a cut from a rock on my right lower leg. And my right boot kept cutting into my right lower calf. I was glad when we reached the glacier terminal again. Alpenstocks were returned somewhere on the return trip, and crampons removed. I just jammed the crampons in the raincoat and draped the entire thing over my bag.

Jaya told us to walk back to the bus at our own pace. It was a long walk! My right calf sort of feels like it’s rubbed raw, and I was afraid of it bleeding. But I pressed on. The raincoat and crampons slipped off somewhere. I just grabbed them and held on to them. Immediately my shoulders thanked me.

Lots of tourists passing me by (just the glacier terminal tour I think), and some of them looked curiously at me. I suppose it’s the crampons (they look kinda wicked). I hope I look like an accomplished hiker to them, because I’m dead tired by now. I reached the bus and turned around, and there, was Jaya! With her pack and tools, she’s got to be hauling a load heavier than mine, yet she caught up easily. She said it’s the result of doing it every day. I just wowed.


Proof of my ice tramping experience.

On the bus and back to town then. We returned everything we got from them (relieved to be wearing my shoes again. Much more comfortable than the boots). And we even got a certificate stating we survived the walk, signed by our guides! I was beaming at the certificate as I walked back to the motel.

It was now 5:30pm. I had dinner, made up of 2 muesli bars and the rest of the biscuits. Prepared for tomorrow’s check out. Planned the coach ride (will sit on right window seat because of possible nice scenery). Nothing for the TranzAlpine train ride. Probably sit on the left, and see if I can get pictures of Arthur’s Pass.

Horse outside Rainforest Motel
Clothed horse. To keep the four-legger warm? Or they really like their equine mammals…

I also smell. Oh no, I was smelly after the Dunedin walkathon. I was smelly after the Queenstown gondola track. Now, I stunk. The boots smell, the raincoat smell. Especially the raincoat. I got this rusty, musty mildewy air hovering around me. Showered, then laid out tomorrow’s breakfast (1 Snickers and 2 muesli bars). Turned in at 10:05pm.

Miscellaneous information given by Jaya: The Fox Glacier legend. Lady in mountains fell in love with fisherman at bottom of mountain. Brought him up to the mountains. When she went to the other side of the mountains (to look at sunset? Can’t remember.), he fell into the waters below and died (oh… 🙁 Jaya remarked about what a sentimental fella I am.). The lady was devastated. The gods were moved by their love, and transformed her tears into glaciers. The tears from her right eye became the Franz-Josef Glacier and those from her left eye became the Fox Glacier. The Fox Glacier was originally named Victoria Glacier after their queen, but later renamed to honour Sir William Fox.