Teaching and public speaking

I was standing in front of the class, with a heavy lump in my throat and my heart pumping blood so hard I could feel the blood throbbing in my brain.

My primary school teacher told everyone in the class that all of us had to do a short presentation. The topic could be on anything. An incident, or hobby description, whatever. The point was to get us to speak in front of the class.

So I talked about David Eddings (my favourite author. Still is). I talked about his book about the powerful jewel named Blue Rose. And I talked about one of his characters (Kalten) mistaking something.

“And so they defenestrated him.”
“They did what?!? That’s a terrible thing to do to a man.” said Kalten.
“They threw him out of the window.”

Just in case you’re wondering, Kalten thought that man was castrated. Which would be a terrible thing to do to a man.

No response from the class, even the boys. Apparently 11 (10? 12? Can’t remember…) year olds are too young to understand the loss of genitalia…

And so I’m wondering, aren’t teachers also public speakers? Granted the audience typically isn’t big, but teachers still go up in front of everyone and start talking (well, teaching, but let’s not split hairs over semantics).

It’s a wonder how university professors get students to learn anything. When I last left university, professors were graded on their ability to teach. Possibly as a criteria to continuing their tenure. We take education seriously here in Singapore.

In closing, I’ll be teaching a course (up in 3 more days!). It’s called OpenXML Spreadsheet Boot Camp, a programming course on Open XML spreadsheets. Half the course is about dissecting the behaviour of Microsoft Excel, so you might find that interesting even if you don’t use the Open XML SDK or Open XML spreadsheets in general.

Sometimes, medium is everything

I sucked at arts and crafts. So when my primary school arts teacher told the class to come up with our own art projects to submit, I wasn’t too happy.

Luckily, I had a children’s encyclopedia (yes, it was still a thing back then…) and I flipped through the arts and crafts book… And found something interesting.

It was a woven seat. Basically you take strips of newspaper (the printed kind. Yes, it was still a thing back then…) and weave them together. I believe there were 2 sets of the weaves, and then you weave them together at the edges. Each strip was maybe 4 layers of newspaper, so the whole thing turned out to be quite bulky. And soft due to the material used.

My arts teacher was positively ecstatic, probably because my newspaper woven seat was one of the few original projects in the class. However, the “dirtiness” of the woven seat bothered her. You know newspapers are (were?) printed with ink, and newspaper ink can, you know, smudge your fingers.

So she asked me to make another one, but use construction paper instead.

That was hard. Construction paper is rougher and less pliable than newspaper, so it’s harder to weave. In the end, the one made with construction paper didn’t have the seat-feel to it.

A simple solution to the newspaper woven seat being “dirty” would be to wrap it in clear plastic. This way, the texture is retained, the softness retained, the “artistic” look retained, yet it remains “clean”.

Construction paper is just not very suitable for this particular art project. Sometimes, medium is everything.


My Open XML spreadsheet class is starting next Monday, 2 July. I’ve written a programming guide on the topic, but this is the first time I’m writing a study course curriculum on it. I’m excited!

Smooth Bezier splines

Apparently, having mathematically defined curves that pass through a set of desired points is a thing. And (cubic) Bezier splines are popular for this. Professor Dagan (mentioned previously) sent me a link.

Smooth B├ęzier Spline Through Prescribed Points

The article outlines a method that given a set of points you want your Bezier curve to pass through, calculate the required control points of the Bezier curve. This is similar to what I wrote here.

The difference is that my method requires the inverse of the coefficient matrix to exist, which it does. The method in that article requires the first and second derivatives of the Bezier curve to be continuous.

Stereotypes and Programming

Generally, stereotypes are bad. They’re useful only as a tool to fill in gaps, but most people use it the wrong way, which is they rely *only* on their version of the stereotype.

Also, all software frameworks are stereotypes. Also, the sun was being dramatic.

Cubic polynomials and cubic Beziers

So it turns out that for cubic Bezier curves, t values of 0, 1/3, 2/3 and 1 have special meanings. A general cubic polynomial is of the form

y = a0 + a1 * x + a2 * x^2 + a3 * x^3

where ai’s are real constants.

If the variable x is limited to the interval x0 <= x <= x0 + χ (that's the Greek letter Chi), where χ > 0, then it’s equivalent to a special case of cubic Bezier curves. Namely, when the t values are 0, 1/3, 2/3 and 1.

In fact, there’s a mathematical proof of it. Thanks to Professor Samuel Dagan of Tel-Aviv University for writing in and letting me know of his work. Here’s more of his work.

Teaching classes

I’ve been asked what possible career could I have with a maths degree. The asker usually already have an answer. Be a teacher.

When I graduated from university, it was about a year after Sep 9/11. Finding a job was hard. My friends, driven to desperation, decided to see if teaching was a viable career. I almost wanted to try too, but then I deliberately decided not to be a teacher (at least in Singapore), so I just followed my friends to the application centre.

I spent maybe an hour looking at the architecture of the centre while my friends filled in the application forms. So in Singapore, before you’re approved as a teacher, you had to go study at National Institute of Education (NIE) first. This is on top of whatever degree you’ve already earned. NIE teaches you how to be an effective teacher (we take education seriously here in Singapore).

After NIE, then you get assigned to schools. I don’t know the details, but I believe you don’t get a choice about the assignment.

Out of my university friends, only one actually became a teacher. There was once I mentioned that I forgot the double angle formulas of sine and cosine. She lectured me on that, together with another friend who was a part-time maths tutor.

I have since learned my lesson. (By not saying anything that’s maths-related. What, you think I’d go memorise the double angle formula just in case? Sheesh…)

So it’s a weird turn of events that I contemplated teaching a class of my own. It’s when I realised that classes on professional subjects are different than academic subjects. I’ve gone to a few Visual Studio courses (because they were the only courses I was approved to attend, and upper management pressured me to “Go take some courses dammit Vincent!”. Well, my manager didn’t actually say that, but the tone was there…), and the main difference was that you actually have to get something done.

So now, I’m teaching a programming course. Apparently, there are many tutorials out there teaching you how to do something in an Open XML spreadsheet (and for Word documents), but no one really teaches you how to know what settings to use.

The goal of the course: Given an Open XML spreadsheet (say, as a user requirement), reproduce that spreadsheet (with data changes of course). It’s called “OpenXML Spreadsheet Boot Camp”, and you can find out more here.


It was cold in the computer lab. I finished typing with a flourishing [Enter] and…

A bunch of compilation errors longer than the menu list of McDonald’s poured onto the screen.

What?!? I checked my program again, and found it. A missing semicolon. I typed
cc lab01.c -o lab01
again with a slightly less flourishing [Enter] and…

A blinking cursor on the Unix command prompt. Yes! I was certain it was error-free. Oh right, I had to run the program to check that it’s actually correct… No program is certain till you test it. And even then…

Oh boot camp…

Which reminds me of the time when I was in military boot camp. Everyone was tired. The corporals and sergeants and officers might be bossing you around, but at the end of the week, even they wanted to leave camp on time.

However, leaving the camp on time on Saturday depended on the ranking officer.

There was a saying that when the ranking officer said everybody could leave at 1:30pm on Saturday, it didn’t mean everybody could actually leave at 1:30pm on Saturday. The sergeants advised all of us recruits to keep our hopes down. Then when it actually happened, we could take it as a pleasant surprise.

Maybe it was “Everybody eats lunch at the cookhouse. Inspection of bunk at 1pm. The whole company can leave at 1:30pm if they pass.”.

You know what? Everyone ate with gusto. Everyone rushed back (with impeccably cleaned utensils of course) to the bunk. Buckets of water to wash the floor and walls. Even corridors weren’t spared. Lockers were wiped. Uniforms were tidied. Beds were made and arranged in strict 90 degrees to the walls and in line with the beds on the opposite wall.

Even then, we weren’t certain we could leave at 1:30pm. Which reminds me of a story I read…

Telling weather

There’s a book series called Elenium written by the late David Eddings. In it, there’s a race of people called Elenes. This race was described as being impeccably logical, almost to a fault.

There was a scene where this Elene logic was being made fun of. A character said that it would take an Elene forever to tell you what the weather was like, even if all you needed to do was look out the window. Another character said,

“Ahhh, but when an Elene tells you it’s raining, you’re absolutely certain that it’s raining.”

It didn’t happen, till it happened.

Because I read David Eddings *cough*, I didn’t feel too bad waiting for the go-ahead to leave camp. If it happened at 1:30pm, we were happy. Even if we could only leave at 2:30pm, we counted our blessings.

Back at the lab…

I typed “lab01” at the command prompt to run my program. The bane of my Unix C programming existence happened.

Segmentation fault.

The worst kind of error because it’s one of the hardest to trace and find the bug. And I was doing matrix computations. With malloc here and pointer there.

Nothing is absolutely certain. The best you can do is have a good chance. The only things that are certain are in the past. And you know what they say about history?

History is written by victors.

Go make something happen.

SpreadsheetLight now freely downloadable

Wow, I just mentioned I relaunched SpreadsheetLight, and now it’s free?

Truth be told, it was a hard decision. I spent a lot of time and effort on SpreadsheetLight. There’s an ECMA documentation PDF that’s over 5000 pages long involved. There’s cross-referencing with the Open XML SDK documentation. There’s experimentation with the actual Excel software to make sure the values are correct. I wrote copious amounts of XML documentation (every single public function and property) so that IntelliSense helps the programmer while he’s using the library.

Did you know Excel’s interface takes in values that are different when assigned to certain corresponding properties? SpreadsheetLight functions take in those Excel “approved” values rather than the Open XML recognised ones. Using SpreadsheetLight is as close to using Excel as you can get.

The crucial point came down to this: I want programmers to benefit from the software. It’s of no use to me or any programmer lying forgotten and hidden behind a pay wall.

And so I freed it.

It’s now free, both in gratis and libre. It uses the MIT License. Download it. Do whatever you want. Come back and tell me how easy your life became.

I only ask that you tell anyone who might benefit from the use of a spreadsheet library. Even if you don’t need to create spreadsheets, you can still download it and see how easy it is to create one.

SpreadsheetLight can be found here. Thank you.

What excites you?

Here’s an interesting story (“sickly” would be more appropriate, but that’s not “interesting”). It was a balmy Friday night. The weather had been finicky of late (she’s been listening to Katy Perry’s “Hot N Cold”), alternating between dry heat and cold rain. Even my kitchen floor tiles couldn’t handle it (they blew up like 2 tectonic plates colliding into each other. It’s not pretty…).

Oh yeah, balmy night. So I was sitting at my computer desk working on my new project. But I’ve been pushing myself just a tad too much. And what with the weather and all, my body decided to give me a little warning: a running nose or blocked nose, depending on its mood (my body probably listened to “Hot N Cold” too…).

Being the persistent little bugger I am, I decided to at least come up with a design for my project (It’s a training course, so it’s a design cover for the ebooklets). Man that took forever. Designer I am not… At that point, I was feeling a bit feverish. I was either sniffling or trying to breathe or sneezing (my record was 5 sneezes consecutively without pause).

I finished the design and was ready to call it a night, but I was like “No, I want to do more!”. My brain apparently doesn’t talk to my body. So I opened up an ebook on copywriting by Naomi Dunford from IttyBiz (It’s named Copywriting For People Who Categorically Do Not Want To Be Copywriters When They Grow Up. I think that pretty much sums it up. It’s good by the way).

At that point, my body decided on a running nose and blocked nose at the same time for me. The running nose wasn’t much of a problem, since if you breathe through that nostril, the mucus dries up quickly. My left nostril was blocked though. So I turned to the expedient method of tilting my head to the right while reading the copywriting ebook (yeah, I’m hardcore). Eventually the left nostril would clear (through gravity or whatnot. I’m no doctor…). That allowed me to read while breathing through the right nostril, and allow the left nostril to slowly clear, but it gave me one heck of a neckache because I had to tilt it slightly backwards too so that nasal innards don’t drip down on my nice keyboard.

Finally, I decided to really call it a night and went to bed. It was what you’d expect. I got a fever, a cold and a cough. My back was sore and I tremble uncontrollably.

Saturday came but I didn’t notice it. I was too busy sleeping (my cat still wins me in the sleeping department though).

So in between bouts of lucidity and delirium, there were only 2 things I thought about: trying to breathe and my project. One side effect is that I learnt to focus on my breathing (forced meditation?). So what’s my project? It’s a training course for programmers to decipher an Excel file enough to come up with code to generate that Excel file.

There are numerous resources online teaching you how to do this or that with either straightforward XML-styled version or with the Open XML SDK version. However, they don’t tell you why or when you should do it. It’s like teaching programmers how to do for loops or lambda expressions without explaining why they would ever need to write a for loop or use lambda expressions.

So while I’m lying in bed, trying desperately to breathe properly (through one nostril or ideally two), I’m so excited about my project that even when sick I’m still thinking about it. Of course, I couldn’t do much (I could only think of explaining the various colouring options that Excel has). This is where the Chinese proverb comes in “The mind is willing, but the body can’t” (or some such).

It’s Sunday. It hurts to get up. It hurts to even think about getting up. Food tastes weird. Even plain water tastes weird. What gets me through the day is something that excites me.

Whatever it is that gets you jumping out of bed, hang on to it. *sniff* (I advise against getting sick if you can possibly help it).

Translating user requirements to code can be hard

Back when I was working as a professional programmer (my job title was “Systems Analyst”), I would attend meetings with my supervisor to gather user requirements. Sometimes, I’m not required at the meeting, but typically, my supervisor needed to know if something was technically feasible. That’s where I came in.

At those meetings, which could be 3 to 4 hours long, I would gather notes. (Once I had to attend a whole-day event. I had to look at it as “I learnt more about my users’ business” rather than “I wasted an entire day”. I’ll tell you about it some other time…) Sometimes, these notes weren’t written because my users specifically told me about it. It’s just that I took note of potential technical limitations and problems that my users didn’t see.

For example, they might draw a sketch of the user interface on the whiteboard and I’d copy it if necessary. Then I took notes on the possible internal code structure if necessary.

The hardest kinds of user requirement gathering are the super-really-obvious ones. Even to you.

The hardest user requirement I’ve ever been given was an Excel spreadsheet. That’s it. The user basically said, “I want you to give me a report that looks like this Excel file.” Implicit requirement was that the file data reflect current database data.

I had to hunt for the source of the data (which database?). Other than that, I had to figure out how to create the Excel spreadsheet layout based on the given sample file.

You can’t really ask what settings the particular spreadsheet cell has, because the user would say “It’s there! In the file! What do you mean how did I set it?” All the styling/layout requirements was already in the Excel file.

I’m starting a course!

All this is really a long way to tell you that I’m starting a course teaching about Open XML spreadsheets, using the Open XML SDK as part of the tool kit.

“But there are lots of resources online about Open XML! And they’re free!”

I know. They tell you how to do a specific task, such as setting a cell value or “This is how to read an Open XML file” and so on. But they don’t tell you why you should do it.

I’ve got a couple of customers (who bought my Open XML spreadsheet reference) asking me, “How do you set this style?”. Then they show me a screenshot or the actual Excel file, and it’s like this complicated (or elegantly professional, depending on your perspective) mess of a jumble of cells with background colours and borders and OMG is that a merged cell?! (One programmer sent me the actual file he’s to simulate, and I felt really sorry for him…)

So in addition to teaching you about the Open XML parts and code and stuff, I’ll also teach you how to translate a given Open XML spreadsheet into code that generates that spreadsheet.

Tentative price is USD 30 for the whole course. The course is about 8 to 10 lessons, with each lesson given weekly. I’ve a rough outline of the course curriculum, but I’m open to suggestions at this point (contact me or leave a comment). It should be up in the next couple of weeks.