Lazing

I’m resting up. It happens. Expect the next post in {insert first odd prime number here} days.

Clues to this most unimaginable practice may be found here.

Market of artists and designers

Also known as MAAD. It’s held at the Red Dot Design Museum (in Singapore) every first weekend (Saturday and Sunday) of the month. My friends brought me to this place, and it’s amazing!

Hand-painted shoes, intricately sewn clothes and detailed design in jewellery. What caught my eye was the stall on origami. The artist’s specialty is in flowers. They’re beautiful! Stand a few metres away, and they look like real flowers. I’m not sure if I could just take pictures of them though. The artist’s name is Kelvin Atmadibrata (origami artist).

Kelvin Atmadibrata name card

That’s the name card. Yeah, my phone camera sucks…

Further into the museum, was this awesome sight. About 20 or so artists sat resolutely in front of a model. Every one of them was either sketching, or inking, or water colouring. You can get a portrait of yourself after modelling for 10 minutes. If you like any of the paintings or drawings, you may purchase it at 8 Singapore dollars. You are of course welcome to buy all of them, each at that price.

Here’s one I particularly like. I don’t know the model’s name, and from the signature, I think the artist was Felis.

Unnamed by Felis?

Choose your own adventure

I loved those “Choose your own adventure” books. Each choice I made created a different outcome, and somewhere down the road, I might end up with the same point which resulted from a different choice. There were only a few final endings, finite due to the limitation of a book, but there were still lots of different story plots to go through.

Because it’s finite and limited, if you play through enough times, you’ll discover the “best” route to the “ideal” outcome. You can construct a solution choice tree and tell your friend, and your friend will be able to navigate through the book in one reading and get the best ending. It’s tried, it’s proven, and it’s also incredibly boring. Where’s the fun in that?

I’m telling you this with regards to learning, specifically when learning from other people. When studying code samples from reference books (or sites), test them to check if they fit your purposes. Understand what the code is to accomplish. When reading other people’s works and writings (that includes me), question their intentions, question their understanding, hey, even question their questions.

Think for yourself. I’m not saying you can’t agree with nor trust the information. I’m saying to think about it before blindly following along. Choose your own adventure books have finite paths. Learning doesn’t.

This actually reminded me of something from those wealth seminars I attended. The general idea from the presenters was:

  • Found a way to become fabulously wealthy
  • Am rich (show proof: screenshots of PayPal accounts, cheques)
  • Will show you how, step by step (for a fee of course)

Granted, the methods do work for some people. It’s not that that puts me off. It’s the step-by-step part. Because normal people find it difficult to navigate the road to wealth, they are presented with a step-by-step, hold-your-hand, do-as-I-say process to follow. I find it fascinating and utterly insulting at the same time. So there’s little room for experimentation, huh?

I have another story to share with you. Welcome to another lesson from the great kungfu master Chen Min!

The holes in stones

Some time after Chen Min’s training in the bamboo grove, a travelling master and his disciple arrived. Long story short, the disciple, Xu Fang, became a good friend and sparring partner to Chen Min. The thing was, Chen Min lost all the battles with Xu Fang thus far, despite his proficiency with the staff.

During one of the battles, Chen Min lost because Xu Fang extended his staff, from holding the end in his hands to holding it with his index finger and thumb. Both thrust their staves at each other. The extension meant Xu Fang hit Chen Min, even though the staves were of the same length.

So he decided to see what Xu Fang every day, to see if Xu Fang did any special training. He watched Xu Fang closely during breakfast, to see if there’s anything he did with chopsticks. He peered surreptitiously at Xu Fang during daily training to see if he did anything differently. Nothing.

Chen Min then decided to train his index finger and thumb. At night, he would write, using only his index finger and thumb to hold a brush steady. When chopping vegetables during chores, he’d hold the chopping knife by only the index finger and thumb. He trained his arm strength by holding a piece of firewood with his arm outstretched horizontally. Yet he still got no closer to winning Xu Fang.

One day, Chen Min saw Xu Fang carrying his staff into the woods, apparently for training. Chen Min decided to shadow him. Xu Fang went past a small brook, and caught sight of something in the water. He went into the water and got into a stance, holding the staff at one end and pointing the other end down at the water.

Then he started jabbing into the water with amazing speed. After some time, Xu Fang stopped. He looked down at the water, breathed a sigh and wiped his brow. Then he left.

Chen Min sprang forth from his hiding place and went into the water, wondering what Xu Fang was hitting. Then he saw them. Stones resting on the bed of the stream. With holes in them. Round holes made by the end of a staff. The stones weren’t shattered, they were bored. Chen Min was astounded by the strength and accuracy required to thrust through water and drill a hole in a stone.

So Chen Min practised boring holes in stones. The water made it difficult to aim due to its flow, and difficult to strike because of its presence. But Chen Min persevered. Stones shattered, but it wasn’t enough. It wasn’t enough to just break them. He had to be strong enough, fast enough and accurate enough to bore holes in stones. He was ecstatic when he finally made it, holding the bored stone in his hands. Chen Min went back, feeling like he’s catching up to Xu Fang.

The next day, Chen Min followed Xu Fang again. This time, Xu Fang went to the woods again, and stopped in a clearing. He stood before a large boulder and stared at it. And waited. Chen Min held his breath.

Then Xu Fang went into his signature stance, right hand holding a staff end, the other end aimed at the boulder. The staff was held horizontally at shoulder level, his left hand in front, as though aiming at a particular spot.

Then he struck. A loud knock echoed in the clearing as wood hit rock. Xu Fang lowered his staff. A split appeared diagonally across the boulder. Then the top half of the boulder slid off with a dull thud on the grass.

It was at this moment that Chen Min realised he couldn’t catch up with Xu Fang.

He went back dejected, and told his own master what happened. The master smiled. And told Chen Min that if he was always copying Xu Fang, if he was always following in Xu Fang’s footsteps, then he’d never be able to surpass Xu Fang.

It’s a brave new world

You, my friend, are going to face some tough challenges. You’ve read what others had written, heard what others had done and used what others had created. You’ve learnt a lot. Yet it still seems insufficient.

It’s a brave new world out there. Things seem to move quite rapidly. Maybe it’s not enough to play catch up, to keep following other people’s footsteps. Maybe it’s time to do it your own way. Because all those skills, all that knowledge, isn’t as good as what’s in your head, the way you think.

Learn and adapt what you can, and come up with something uniquely yours. The world doesn’t get better if you keep choosing other people’s routes. For crying out loud, forge your own path and choose your own adventure.

The x = sine x pitfall

Approximations and simplifications. They offer us an easy way to understand the world around us. If someone asked you what time it was, would you say it’s 8:23? You’d probably say it’s 8:25 or 8:30. Unless you’re Phileas Fogg.

PI? 3.14159. Free fall acceleration? 10 metres per second squared (corrected to 9.81 near pre-college level). Estimated time of arrival of your friends? Your appointed time, give or take half an hour (usually give).

This is fine, because the error is insignificant for the particular level of use. It’s when you have no idea what the true accurate is that’s the problem. For example, you and your friend have decided on a time to meet on a particular day. You can generally estimate when both of you will actually meet up.

Suppose you and your friend have decided to meet up on a particular day, but did not decide what time to do so. What’s the actual time that you will actually meet each other? You will only know when you’ve waited at the appointed place for an entire day, until your friend shows up. Let’s assume you’re a really good friend, and you’re really excited to meet your friend… and that your friend is going to come…

The point I want to highlight is about project deadline estimations. Before I talk about that, let me show you a graph.

Only for small x

In math, there are situations where you can use x in place of sin(x).* Obviously x is not equal to sin(x). But, for small values of x, they are approximately equal.

x ≈ sin(x) for small values of x

Here’s a graph of sin(x) and x. The sine curve is coloured blue, and the line y = x is coloured red.

Sine wave

Here’s the code I used to generate it:

const int cnWidth = 400;
const int cnHeight = 400;
const int cnXOffset = 20;
const int cnYOffset = 20;
const int cnAxisLength = 360;
const double cnHalfYAxis = 180.0;
Bitmap bm = new Bitmap(cnWidth, cnHeight);
Graphics g = Graphics.FromImage(bm);
Pen p = new Pen(Color.Black);
g.FillRectangle(Brushes.White, 0, 0, cnWidth, cnHeight);
// the vertical axis
g.DrawLine(p, cnXOffset, cnYOffset, cnXOffset, cnYOffset + cnAxisLength);
// the horizontal axis
g.DrawLine(p, cnXOffset, cnYOffset + cnAxisLength / 2, cnXOffset + cnAxisLength, cnYOffset + cnAxisLength / 2);

Brush brWords = Brushes.LightSlateGray;
Font ft = new Font(FontFamily.GenericMonospace, 8.0f);
g.DrawString("1", ft, brWords, 5, 15);
g.DrawString("0", ft, brWords, 5, 190);
g.DrawString("-1", ft, brWords, 5, 370);
g.DrawString("PI", ft, brWords, 190, 205);
g.DrawString("2PI", ft, brWords, 370, 205);

int i, j;
for (i = 0; i < 360; ++i)
{
    j = cnHeight / 2 - (int)(cnHalfYAxis * Math.Sin((i * Math.PI) / 180.0));
    bm.SetPixel(cnXOffset + i, j, Color.SlateBlue);
    j = cnHeight / 2 - (int)(cnHalfYAxis * (i * Math.PI) / 180.0);
    if (j > cnYOffset)
    {
        bm.SetPixel(cnXOffset + i, j, Color.Crimson);
    }
}
bm.Save("sinewave.bmp");

The normal Y axis increases vertically upwards. In bitmap or raster graphics, the usual coordinate system has Y increasing downwards. Exercise: Determine which parts of the code correct this difference so that the bitmap still shows the Y axis increasing vertically.

As you can see from the graph, the line y = x is identical to the line y = sin(x) for small values of x, when discretisation of the values are considered. It doesn’t mean x = sin(x). It just means for a small part of sin(x), x is almost the same as sin(x).

Giving the man hours

I was involved in a few projects where there were some unfamiliar situations, problems and techniques after I did requirement analysis. I had an idea how to solve them, but I had no idea how long it might take. I had to come up with prototype code to see if my solution could work. Then I had to come up with the full code to solve the problem.

When asked to give an estimate of the required man hours, I couldn’t say. It could take 3 hours. It could take 3 days. I wouldn’t know till I tried writing the code.

This happens when new requirements are involved. So new, that you have little background knowledge to work with, little past experience to guide you.

Sure, you can break up the project into small parts, and give estimates on the small parts. Then you add up the estimates for the small parts, and you get the final required man hours.

I’m asking you to be careful. Don’t mistake a straight line for a sine curve. Don’t fall into the x = sine x pitfall.

* I can’t remember what situations they are, nor even if there’s any use at all. I’m using it as an illustration.

Doing some thinking

There’s no deep thought or idea in this article. Or maybe there is for you. I don’t know. This June 2008 is special to me. How special? You’ll have to wait a couple of weeks before I tell… *smile*

I’m also in a sort of transitional period. So I’ve been thinking and reflecting. And I’m going to tell you a little story…

[referral links present]
I actually hate to have to say that. You’re a big boy (or girl). You’re an intelligent person. You’re a programmer for crying out loud! Can’t you hover over a link and decide if that link is an affiliate or referral link without clicking on it? Are you that pressed for time?

The seminars

It started with 2 back-to-back seminars (2-day-4-day). The first was a wealth seminar. It’s an event where some wealthy people go up on stage and teach, inspire and generally make the audience feel good about themselves. The presenters told their own stories of how they overcame their own fears, doubts and poverty (to a certain extent). In the end, there’s a sales pitch. If the audience liked what they’ve heard, and they wanted to continue learning from the presenter, they signed up for a package, or bought a product, or joined a membership.

I’m usually relatively inert to such tactics. As an experiment, I gave in, and bought a product, a set of CDs containing recordings of a workshop conducted by the presenter. It cost me slightly less than 500 Singapore dollars. I actually thought it contained a video recording, not audio. Well, I listened to the first 2 CDs, and then decided I had better things to do.

It wasn’t a complete loss, since I learnt how sales pitches worked, what a wealthy person’s mindset was, and how innocent and naive I was about the Internet marketing world. Besides, the seminar was uplifting. And an investment in a business education.

The second seminar was the World Internet Summit. This one seemed a bit more up my alley. It’s still like the first one, but with an emphasis on online businesses. There were some flaky tactics presented that I didn’t quite approve of. But I was there to learn, so I kept my mind open.

That was where I learnt about Adsense, pay per click and pay per lead. That was where I got to know about affiliate marketing, copy writing and selling digital products (eBooks). That was where I found article directories, Technorati and blogging. It was a lot to take in.

I was in the mood to create my own business. Somehow. I remembered something from the Summit.

The Internet is the cheapest place to fail.

Agreed, up to a point. If I made a phenomenally stupid mistake, it could also be an expensive place to fail. AdWords could eat up thousands of dollars if careless.

So I started my own business. You’re reading it. I started blogging. I’ll be honest with you. When I started writing, it was mostly to make some money online. The original idea was a combination of affiliate sales, advertisements (Adsense primarily) and possibly a product of my own (eBooks were the hottest and easiest to create. Supposingly…). Now, I write to make a difference in the world. I still desire making a living online somehow, but it’s now shunted down my list of priorities.

Studying again

My chosen blog topic wasn’t the make money online ones (thankfully on hindsight). I was still floundering around. I disliked writing essays when schooling and had to accept that I had to write stuff regularly *urgh*. I was just browsing around doing research, when I happened on this Australian blogger Yaro Starak. He was starting a blog mentoring program, Blog Mastermind, teaching people how to blog and earn enough for a comfortable lifestyle.

One of the good points I learnt from the seminars was, I needed to invest in my education. After the $500 product purchase, Yaro’s program looked cheap in comparison. So I joined. Not before reading his long sales page though. If I was going to learn anything, I might as well have a look at how sales pages were written.

His program is great! I learnt loads from that program. I’m a beginning blogger and businessman, remember? A couple of weeks in, I finally decided on my focus: programming. It’s not the most profitable niche, but it’s the topic I’m really good at and passionate about.

From the seminars, WordPress was strongly recommended as a blogging platform. Yaro recommended it too. Luckily, I was already using it. If you’re not on WordPress, or considering a move, take a look at Injader. It’s written by Ben Barden, and it’s got lots of easy to use features. It’s also free! You can’t beat this price…

So from Yaro’s program, I learnt about marketing myself and my blog. Which was hard, considering I’m generally an introvert. Many things require me to sell myself anyway (asking for raise, promoting proposals), so this was practice. Blog carnivals? No programming related ones. Start one? Too much effort, too little time. Blog networks? None of significant repute willing to take me in, a small time blog (although now I’m in Alltop). But I plodded on. I learnt more about creating online businesses, which was fun.

Join and participate in discussion forums? Hmm… and I found Dream In Code. Very awesome, great programmers, fun people. Check it out. I was itching to help with programming questions anyway. My handle is orcasquall.

RSS out of hand

I read more blogs, and started subscribing to blogs. Blogs related to programming, such as The Daily WTF, Coding Horror, Joel On Software and The Old New Thing (Raymond Chen). Funny thing about Raymond’s blog. He writes about Windows development, I don’t do any Windows development yet I continue to read. I think it’s his style of writing, and his sometimes resigned tone of voice as in “why do people do such egregious coding?”. I can so totally relate…

I also thought maybe I’d try out technological blogs too, since it’s sort of related to my field. So I subscribed to TechCrunch. Big mistake. I caved after my unread RSS feed items climbed above 50 within a day (including my existing ones). I thought Lifehacker, a self improvement site might be ok. Another gargantuan mistake. I unsubscribed after scrolling through the items without reading for the umpteenth time.

Then came BlogRush. That seemed interesting and effortless. It eventually didn’t quite live up to it’s promised results, but it was fine. Another lesson learnt.

Then came Entrecard. I get to play with being an advertiser and take on advertisers? Cool, even if it’s with play credits. I might as well learn to deal with advertisers, hopefully practising for the real deal.

For some reason, I couldn’t find any programming blogs with, shall we say, a lower priority on the make money online part. In the Blog Mastermind lessons, I was instructed to approach bloggers on a similar level to mine. Basically a blogger with a huge following would generally ignore a fly blogger like me. Where was I to find programmers with a blog of similar size to mine? That was a challenge.

Still, with Entrecard, I found lots of interesting sites and people, some of whom were even passionate about their non-make-money-online topic. Shocking I know. Slowly, I found interesting people, much more and much faster than I would in real life. I don’t know, I start on Gaussian elimination or the finer points of string manipulation and people start nodding their heads. In stupor.

Anyway, there’s

Ever since I started blogging, I am even more supportive of some sites. Please go download Paint.NET, and put away Photoshop or even Paint *urgh*. Please also go visit demoscene resources pouet, scene.org and Nectarine (demoscene music).

Ultimately, blogging made me a better programmer, because I’m forced to challenge some of my internal understanding. I had to think about the concept before I could write about it. Helping with programming questions in forums forced me to explain concepts and terms in easier to understand language. Plus blogging related activities are fun sometimes.

I’ve also decided in this most special of months to join … Twitter. I know, I can’t believe it either. How would I ever squeeze my thoughts into 140 characters? *smile* Follow me on http://twitter.com/orcasquall. Social media and software is going to be important. If I’m to understand it, I’d better be part of it too.

So if you’re a programmer, or you know someone who’s a programmer, please ask that person to start writing. The best ideas in the world are useless if they’re kept locked up in that genius mind.