Chalcography, Die Hard and Gamberetto

The arts

For the past few weeks, I had passed by this bus stop where a post on the signboard had this alluring picture. It was Mona Lisa. It was also done in pencil, or so I thought (I was on the bus, and couldn’t see clearly).

So one day, I peered really closely, and discovered there’s an exhibition going on in the Singapore Art Museum on chalcography. Interesting…

Too bad that’s the only picture I could take. Galleries are off limits. Here’s what I found out during my tour of the chalcography displays:

  • Chalcography is engraving on copper to make templates to print paper (or some such)
  • Some of the prints are very detailed (individual tree branches, hair)
  • There are a lot of nude or semi-nude models in the prints (must be the Renaissance)
  • I find myself scrutinising at prints a lot (the backdrop, not the nude)

The exhibition is held at the Singapore Art Museum from 4 May till 22 July 2007.

Entertainment

I also caught the latest installment of the Die Hard series, starring Bruce Willis. Aside from the subtle nation protection messages, the bad guys used a lot of work from hackers, with the movie’s emphasis on the surviving whiz kid’s algorithm. Mathematical encryption program. Oh, that just warms my heart…

New experience

When I visited my favourite local pasta restaurant, they were offering a new selection. Thinking that it’s about time for me to try something new, I decided I could go for a gastronomical one. I chose the “Creamy Herb Gamberetto”. Normally, I prefer a tomato-based pasta, but since I’m going for new… It’s good. Oh, so gamberetto means shrimp or prawn. I think mine were tiger prawns.

I think I’m getting a headache from all the new experiences…

Live Earth 2007 – Post-mortem

It was a bright and cheery Saturday. I had an unexpectedly wonderful afternoon in the art museum (which is another story), and had already decided to check out what Live Earth program aired on the local TV network.

I watched a few minutes of the program, and decided that I don’t really know any of the musicians and that I’d be better off doing something else. Like reading.

Alright, fine, I surfed the Internet. I checked out the Live Earth web site again. And I finally noticed it.

The organisers are obviously not fans of the Law of Attraction. What you focus on, expands. Concerts for a climate in crisis, will keep the climate in crisis. I suggest “Concerts for a greener planet”.

I also found this interesting little nugget:
I have a sensitive nose and lungs. Anytime I see or hear “incense” or “smoke”, I try to stay far far away.

I thought burning stuff will contribute to the rising global temperature. Why do I need to light up an incense stick?

There has got to be a better way to check for window drafts. Forgive me for asking, while we’re here, can someone tell me why we need to check for window drafts? I live in Singapore, and if anything, I’d love a draft, because it’s unbearably hot here.

Save our Earth

Tomorrow, on the 7 July 2007, is when Live Earth, a huge music event is held. The event is held separately over 7 continents, and many musicians will be performing. The objective is to raise awareness about our planet’s climate crisis, and to get people to take action.

I am moderately pro-green, reusing plastic bags when possible, taking public transport, and rarely buy and drink from cans or plastic bottles. I switch off lights when they’re not in use and turn off my computer when I’m done at work or at home. (If you’re one of my colleagues reading this, please, turn off your computer when done. Saving the couple of minutes for Windows to start up is a ridiculous reason.) But I’m not an extremist.

Saving our Earth. Can we do it? If all of us make a concerted effort.

I’ve read some negative comments about Live Earth contradicting the very message it’s conveying. The argument is that top musicians and artists will need certain comforts, such as private jets, and these comforts will cost the Earth. And concerts consume an insane amount of energy, what with all the lights and sound equipment. And concerts bring huge numbers of people together in one spot. I’m quite sure there will be food, there will be trash, there will be human waste to be disposed of, and not necessarily in that order.

These are all valid arguments. I also want to point out something else. Remember the concerted effort part? To bring people together, with the same purpose, with the same ideal, is hard. As hypocritical as the arguments make of the Live Earth concerts, these concerts will do one thing: align a large number of people on the same wavelength. They just start out with music as the connecting frequency. Everyone sings along and dances with the rhythm. Which brings us to a secondary effect of concerts, that people are energised during the performance. People are enthusiastic, excited and eager, all very positive and supportive qualities for mass ideal alignment.

I’ve played a game, Final Fantasy VII, where the fate of the planet was at stake, the Lifestream of the planet was slowly depleted by inconsiderate acts. Then there’s the scene in Matrix, where Agent Smith was interrogating Morpheus, and Smith says that humans are considered a disease, a virus, because we destroy and consume anything in our path. We latch onto our planet like a parasite and sap the life out of it.

The question is not about whether Live Earth concerts are hypocritical. It’s not about giving up all the niceties that modern technology has brought us, and go live in a cave and eat only produce from our own gardens.

The question is, are you doing anything about it?

So much for web safe colours

Whenever I’m faced with a web design decision, it almost always involve the issue of colour. I will test and tune the colour theme and combination of graphics, page elements and text colours. Then I’ll have to switch to a low resolution setting with a colour depth from the early 20th century. Why do I care about this unthinkable and ugly setting?

Because some of my users still live in prehistoric times.

They are totally fine with Windows applications running on drab grey backgrounds, icons that seem to be straight out of a 3 year old’s art experiment and hideous colour combinations such as bright green, blinding yellow and depressing slate blue. And they are absolutely comfortable with web applications looking like those grotesque behemoths of applications they use every day.

I’ve studied proponents of web safe colours, and I say “Enough!”. We have to embrace our gift of sight. The human eye is capable to distinguishing many colours. Computer hardware and web browsers have evolved to the point where there are colours displayed which the human eye cannot separate with accuracy. We. Have. 32. Bit. Colour. Experience all the colours.

Now, the .Net Framework provides the KnownColor enumeration, so I’ve used that as a base. I wrote a C# program to generate a reference HTML page with the colours and their names and hexadecimal values in it. Every time I’m stuck, I’ll pull up this reference page and look for the closest colour I desire. Then I’ll dump that hexadecimal value into my image processing application for finer adjustments.

So much for web safe colours.

Order in chaos

My desk is a mess.

My computer takes the centre position. That’s about the only place with some semblance of serenity. Surrounding this electronic piece of equipment, chaos reigns. Files are stacked and shoved to one corner. My bag and other personal belongings are packed to the other corner. I’ve got a C# reference book practically acting as my permanent armrest for my left hand. I don’t even have space to put my other three reference books, and I have to put those on another desk. And the pieces of paper scattered all over, covering every centimetre square of space on my desk.

And I can’t work without this mess. I need this chaos around me to function. That pile of paper there? That’s my programming reference pile. This pile here? My immediate-tasks pile. The one beside it? Oh, the project-just-over-but-keep-in-my-face-for-emergency pile, which slowly joins its comrades in the so-long-ago-I-forgot pile. Then there’s the scribbles, where I scribble down stuff like thoughts, notes, user interface prototype drawings and shorthand of user queries.

The apparent haphazardness of my desk actually has an order to it. Like handing a value smaller than 1 to the “minus x square” function, the chaotic disarray goes one way and then another. And as you continue, you find everything slowly settles into order.

The function eventually goes to zero. And my desk arrangement finally makes sense.

I’ve peeked at my colleagues’ desks. Their files and papers are all neatly stacked into rectangular blocks, with nary a sheet out of place. I can also see large parts of their desks’ surface. My mind is capable of pulling seemingly disparate ideas together. The natural way for my work desk to manifest is by being a mess.

I can’t tell you how many times I’ve wondered if a high level manager walks by my desk and judges me to be anything less than competent, based on the condition of my desk. I, am afflicted with NADD. This is who I am. I will be listening to music, while I’m feverishly jamming the keyboard, wishing the code will appear as fast on screen as it is in my mind, and tapping my feet in tune to the rhythms. Then I’ll be writing some comments because that piece of code will probably confound anyone else who reads it, and midway through the commenting, I’d think of some funny expression and I’ll check my English on Merriam-Webster. And oh yeah, I need to check that SQL expression to do string manipulation, and then Google it. Then the phone will ring, and I’ll drop my earphones, and I’ll wait a while to clear my throat and then pick it up, to attend to the needs of some user. I’ll then clasp the phone between my right ear and shoulder (because research shows the right ear is connected to the left side of the brain, which is better at deciphering voices than music), while opening up a document to confirm some details. And after I finish answering the user’s query, I’ll think to myself, “what the heck was I doing before this?“. Ok, what was I talking about? Oh right, so I find it unbelievable that anyone can have a neat desk, and so I decided to ignore the high level manager and just do what I do to produce results.

I usually have half a dozen applications open on my computer desktop at any one time. I thought this to be bad. Then I saw one of my colleagues have so many windows open (yeah we’re in the Windows camp. Hey we telnet to do some *nix work too), that the taskbar had to double up in width (I’m starting to do that too these days…) because there are too many taskbar icons.

I also know of some of my users who have ten Excel spreadsheets open. Or two of the same application open because they think it’ll work faster. Or they’ll give the impression of being multitasking. STOP IT! Multitasking is a fallacy! David Allen uses the term “rapid refocusing”. Some people can bring chaos into order. Some people can’t. If you need to have that many windows opened to gather information, and you’re a user, your IT department is slacking off. Go pester them.

If you are someone who thrives on being in the eye of a tornado, who finds peace in chaos and who can bring peace from chaos, I salute you. Welcome to the real world.

Just say hi

As of this writing, I have worked in a corporate environment for just over four years. My colleagues are great and I (usually) like my work. There’s something missing though. A pervading miasma of human frigidity saps the friendliness out of the air. Teams don’t really talk to other teams, let alone between departments.

The sad truth is we form cliques and this will ruin creativity. Innovation will then only come from ideas within the clique, and let’s face it, one can only come up with so many ideas in isolation. With my main job role as a programmer, this “island clustering” means I’ve got few people to bounce ideas off of.

How do we bridge the gaping maw present in corporate human interaction?

Just say hi.

I read about this advice from New Rules @ Work by Barbara Pachter. She wrote a short chapter about it, covering topics such as the greetings used (“hi” or “hello”) and at what distance between you and the other person you meet should you say or do anything (5 feet minimum and you must say something).

The experiment.

So I tried it. Several weeks ago, on one blustery morning, as I was walking along the side of a row of cubicles, someone was also walking towards me. I quietly cleared my throat, looked her in the eye, and said “Good morning”. She just breezed right by me without giving me a look. Oh this is gonna be hard…

For the next few days, I tried really hard. I said “Hi” or “Good morning” to anyone I met. Along the cubicle aisle. On the way to the pantry. Not one single person responded. Then something magical happened. Some of these people started noticing me, that I’ve been greeting them. They turned and looked at me when I greeted them, but still they said nothing.

Then one fine morning, as I was walking back from the pantry after getting some water, I greeted another person. I was pretty much discouraged by now, and my heart wasn’t really in it. There came a feeble “hi” from that lady. I nearly jumped for joy. I got another person to respond! It was unbelievable. I walked back to my seat, smiling all the way. I could have clicked my heels in the air, but I thought that’d look ridiculous.

It’s still hard now. Sometimes. Sometimes they are looking away from me. Sometimes they have a scowl on their face, and I was afraid they’d bite my head off if I waved and said “hi” to them. And sometimes, I just plain forget. And sometimes, some of them says “hi” or “Good morning” to me first. That’s just awesome.

Do not discriminate. 

Let me give a piece of advice. Greet everybody. I don’t care if the person is your boss or your boss’s boss. I don’t care if that person is the cleaning lady. Greet everyone. Especially the cleaning lady. You do not want to slowly find that your trash bin is almost always never cleaned out, or your desk not wiped.

Now go say hi to your boss.

Transformers: More Than Meets The Eye

I remember when I was young, I used to watch the Transformers cartoons. I mean, it was like so cool that those machines could transform into humanoid robots and back into machines again (usually transportation vehicles). There were the Autobots with the red insignia and the Decepticons with their purple insignia. Then there were these double agents who could transform into both an Autobot and a Decepticon. Cool.

So I’m kinda excited when they are bringing Transformers onto the silver screen. I saw a trailer of the movie, and something nagged at me. I couldn’t quite put my finger on it, and I just saw how awesome the movie looks, with all the special effects and even the recognisable “transformation” sound when the machines change form.

It looks like they brought the Transformers universe up to speed with our current world. The “World Wide Web” became the tool of learning human languages (in particular, English), and even Ebay made it to the script (Autobots and Decepticons were both looking for Sam Witwicky, a.k.a ladysman217). I just checked, ladysman217 is a valid user name on Ebay. That is some marketing.

Well, if that radio-turned-mobile-phone Decepticon is any indication of how fast our electronic databases can be hacked, we are doomed I tell ya. Robots type darn fast, and somehow, they always have these mechanical devices that can interface with anything we have. And they download and upload stuff as fast as the hard drive can spin. It’s a lucky thing we have a human equivalent, Micah Sanders from Heroes.

Oh right, now I found it, my can’t-quite-put-my-finger-on-it mystery. My first impression of Bumblebee, the camaro, was that after he transformed into his humanoid form, there was just …  more of him. There seemed to be more metal on him, and he seems quite large. His car form seems small in comparison. So where did the extra metal come from?

Reverse engineering Bezier curves

My initial contact with Bezier curves came when I was studying 3 dimensional computer graphics. The professor introduced the standard cubic Bezier curve equation, which looks something like this

B(t) = (1-t)3p0 + 3(1-t)2tp1 + 3(1-t)t2p2 + t3p3
where p0, p1, p2, p3 are the control points.

WARNING: you might find this an intensive discussion on math, 3D theory and programming.

So the interesting thing about Bezier curves is that they are easy to work with, theoretically and programmatically. There’s only one problem; the curve does not pass through its control points. The curve actually lies in the convex hull of the control points.Convex hull of bezier curve
This means the control points may not lie on the curve, which makes calculating tangents and normals (for use in 3D trigonometry) tedious.

What I want to do is to define four points and have a Bezier curve passing through all four points. Basically, given the four original points q0, q1, q2 and q3, I will find four points p0, p1, p2 and p3 such that the Bezier curve calculated using points p(i), will pass through the points q(i).

So going back to the equation above, when t is zero, the equation effectively collapses into just p0. When t is one, the equation gives p3. When t is between zero and one, the resulting point lies on the curve itself, so iterating t from zero to one will give the Bezier curve. Since we know the curve will pass through p0 and p3, we need to find p1 and p2.

Suppose we want the curve to pass through p0 when t=0, f when t=u, g when t=v and p3 when t=1, where f and g are the points to be passed through. Next, we make sure that 0 < u,v < 1 and u not equal to v. These conditions will ensure a solution can be found. Next, we substitute the desired points into the equation:

f = (1-u)3p0 + 3(1-u)2up1 + 3(1-u)u2p2 + u3p3
g = (1-v)3p0 + 3(1-v)2vp1 + 3(1-v)v2p2 + v3p3

The two equations are then simplified into

3(1-u)2up1 + 3(1-u)u2p2 = c
3(1-v)2vp1 + 3(1-v)v2p2 = d

where
c = f – (1-u)3p0 – u3p3
d = g – (1-v)3p0 – v3p3

UPDATE: I’m assuming that u = 1/3 and v = 2/3, but they can be any value as long as 0 < u,v < 1 and u not equal to v (and logically u < v). It is likely that f is somewhere 1/3 of the way between p0 and p3, and that g is somewhere 2/3 of the way between p0 and p3. BUT it’s not a given, so you still need to determine that. 1/3 and 2/3 just happens to be the “logical, and common-sensical” default.

This set of equations has a unique solution when 0 < u,v < 1 and u not equal to v, and assuming c and d aren’t both zero vectors. The equations have a unique solution because the determinant is not zero. Let’s transform the set of equations into matrix form before explaining what a determinant is.

The determinant for the above 2 by 2 matrix on the left-most side is
3(1-u)2u * 3(1-v)v2 – 3(1-u)u2 * 3(1-v)2v

Factorising this, we get
9uv(1-u)(1-v)[(1-u)v – u(1-v)]
= 9uv(1-u)(1-v)[v -uv -u +uv]
= 9uv(1-u)(1-v)[v – u]

Since 9 obviously is not equal to 0, and 0 < u,v < 1 (so u,v not equal to 0 and (1-u),(1-v) not equal to 0) and u not equal to v (so v-u is not equal to 0), therefore, the determinant is not equal to 0. By a theorem in linear algebra, this means the set of (linear) equations has a unique solution. For a 2 by 2 matrix, the determinant can be obtained by taking the product of the top-left element and bottom-right element, then subtract the product of the top-right element and bottom-left element. Like drawing a cross.

Next, we multiply the inverse of the 2 by 2 matrix on the left of both sides of the equation and we get

Note that the inverse will cancel the matrix on the left side. The inverse (of a 2 by 2 matrix) is obtained by swapping the top-left and bottom-right elements, then switch the signs of the top-right and bottom-left elements, and then divide each element by the determinant. The determinant is non-zero, so division by zero is not a problem. A non-zero determinant also means an inverse actually exists (by another theorem in linear algebra), so all of this works out fine. Now all you have to do is calculate that right side and that’s it. Make sure you calculate for x, y and z, meaning you have to do the calculation three times.

The determinant of an n by n matrix is generally difficult to find, as is the inverse of one. Refer to a linear algebra text book for the theories (they usually use a method called Gaussian elimination. The programmatic approach uses a slightly modified version to reduce computational errors). There’s a “quick and dirty” method for getting the determinant for a 3 by 3 matrix, but anything higher requires the aforementioned theories.

You can download my C program code of reverse engineering a Bezier curve to learn more.

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

Zip up or shut up

Today, I’m reminded of an article I read in the Men’s Health magazine. I can’t remember the entire thing, but there was something that stuck to my mind. Now, if there are ladies reading this, you might want to stop right here and go read something else, because what follows will be a shocking revelation of an undisclosed men’s toilet habit which might jar your sensibilities. Perhaps you ladies might even find this secret natural (hey, men actually do this!), but since I’ve never been in a ladies washroom before…

You still here?

Ok, here it is, and I want you to read everything carefully and slowly.

There is nothing, absolutely NOTHING, that is so important, that you have to talk about it with your pants down.

There had been quite a few instances where I’ll be, uh, minding my own business while in the washroom, and two guys would waltz in to do their business. And they would be talking to each other. They could be talking about a recent project, or the decision of so-and-so, or about the details of a business deal (a real one thankfully, not the one happening in the washroom. Sheesh.).

I don’t know about you, but I find it kind of awkward conversing while holding my pants up. Especially if you are also making sure the other person isn’t looking at you. Seriously, you could have struck lottery (and positively thrilled to tell me), the building could be on fire, or Armageddon is nigh. I don’t care what it is, it can wait a couple of minutes.

Embarrassingly,  as I’m writing this, I recall a presentation for my Japanese language class. I wrote a scene with my fellow student, where both of us were in the toilet and discussing details of a karaoke session we were going for afterwards. Ah, the follies of youth…

Which brings me to a related point. Do not use your mobile phone in the toilet either! Barbara Pachter, author of “New Rules @ Work” says,

No one wants to be on the other end of a flushing toilet.

I doubt anyone has an interest in the fascinating sounds produced in water closets too.

Hot Fuzz – Hilariously Funny

After a long and tiring week, I was deciding what to do to amuse myself on this Sunday afternoon. I went to my usual local movie site, and found the movie “Hot Fuzz”. Then I remember seeing the preview a while back, and thought it was funny. So my plan for the afternoon was set.

Quick digression: fuzz informally means the police.

The movie is about this high flyer of a policeman, I’m sorry, police officer, Nicholas Angel, who was transferred to the quiet village of Sandford because he had a 400% arrest rate compared with his peers, and he’s embarrassing the entire department.

So there he was, itching to squash some crime, and he arrested some underage teenagers for drinking in a pub, the night before he was even officially to report for work. I can identify with him a little, when sometimes I feel my talents could be put to better use… oh well.

Amidst dealing with his recalcitrant colleagues, villagers with uncanny knowledge of goings-on and a partner who longs for big action, Angel manages to sit through a 3 hour long horribly blasphemous rendition of Romeo and Juliet, takes on the unexciting task of finding a swan, and taking care of his Japanese peace lily.

There are traffic accidents (I’m sorry, traffic collisions), flaming houses and exciting chases on foot. There’s arterial spray, decapitation and exploding bombs. If you can stand a little blood (CSI sort of conditioned me), and a little “colour” in the dialogue (officers dump change into a box whenever someone swears), and open-minded on your beliefs, then “by the power of Castle Grayskull”, you absolutely have to watch this movie.