Friends from Entrecard

I’ve been using Entrecard for a while now. While it’s true I get lower quality traffic in general (chain droppers), there is one benefit I found. With search engine traffic, I have no idea who’s visiting. With Entrecard, I do.

Usually, I check the drop box (as it’s called) about once every 2 days. I get like 50+ or so drops. I check out the sites (based on those drops), and if it’s interesting, I drop my card too. And if it’s really interesting, I keep track. This was what Entrecard was meant to do anyway, introducing yourself to another (not dropping cards and racking up credits).

It seems that my pruning and filtering have narrowed down the interactions to those I want to associate and be associated with. So here’s a few of the more prominent ones, in no particular order.

General Web and Tech

Creatives

Uh, humour?

I read Scott Adams’ blog, so these seem to fit in somehow.

“Wait, there’s not an iota of code in any of those sites!” you cry.

Well, I can’t seem to find any programming blog in Entrecard, despite the size of the “Technology” and “Computers and Internet” categories. It’s a big place. Maybe I haven’t looked hard enough.

I changed my WordPress theme!

This is wonderful! It seems to be the standard to show before and after pictures, so here’s the “before” look:

Blue TicTac theme

This is the new look:

Polymath theme by Josh Sharp

Josh Sharp is my theme designer. I got acquainted with him through Entrecard. And the theme looks gorgeous! Wait, let me go look at it again… *wee, clap hands like a little child*

The old theme was adapted from the TicTac theme from the Blogger platform. It was nice with a moderate techy feeling. It was also a bit restrictive on width. Since I broke out of my web safe colour prison, I decided I want to break out of 800 by 600 pixel width too.

My initial attempt at outsourcing the blog design gave me nightmares, which thankfully disappeared quickly due to experience from frequent interactions with people and immense tolerance at code with WTF-like qualities.

Then I tried doing one up on my own. The designing was fine. It’s figuring out which PHP files I needed to use that’s the problem. After some frustration and much mulling over, I decided that learning PHP and WordPress theme creation was a skill I could do without. And I tried outsourcing again. So here we are.

Optimise your code later

I was young and naive then. Having learned this fascinating subject known as C programming, I read anything I could about programming. As a game enthusiast, I pored over articles and tricks on getting the computer to perform neat and cool stuff.

Things like

i << 3

to multiply by 8 as I could save a few processor cycles.

Or the triple XOR swap trick

x = x ^ y;
y = x ^ y;
x = x ^ y;

so I could save the use of a temporary variable.

Or counting down so I could compare against zero in a for loop's condition part.

int i, sum = 0;
for (i = 10; i != 0; --i)
{
    sum += i;
}

Which was supposedly more efficient than counting upwards, and having to compare against a nonzero value.

int i, sum = 0;
for (i = 1; i <= 10; ++i)
{
    sum += i;
}

I can't remember when, but at some point in time, I decided that I've been restricting myself. Obsessed with faster clock cycles, smaller memory footprints and elaborate coding structures, I had taken away the freedom to create a working program the way it needs to be. I became an optimisation slave.

Chris Anderson mentioned in an article that in the mainframe era,

early developers devoted as much code as possible to running their core algorithms efficiently

It was difficult letting that optimisation obsession go, but I was

liberated from worrying about scarce computational resources like memory and CPU cycles, could become more and more ambitious, focusing on higher-order functions such as user interfaces and new markets such as entertainment

But what about demo sceners? Aren't they coding against unnecessary limits? In the past, programmers optimise out of necessity. Demo sceners optimise as a form of programming challenge. Although nowadays, there are contests (such as in Breakpoint) where full blown demos weigh in megabytes. With better computing architecture, richer textures, fuller sounds and more detailed 3D models are used.

Speaking of 3D models, I remember writing a custom geometric shape generator. There were functions for generating spheres, cubes and tetrahedrons, complete with texture mapping capabilities. I was obsessing over the number of polygons produced, trying to figure out the least number of vertices so that frame rate wasn't affected.

I gave the computer too little credit. Just because I couldn't conceive of generating hundreds of vertices and polygons, didn't mean the computer couldn't. All that time wasted optimising when I could have been working on my game...

"But don't you need to find out what the limits are?" you ask. "If you plan and optimise from the start, then you won't hit those nasty problems."

Let me introduce you to the math concept of local and global maxima. A maxima is a point of maximum value.
Local and global maxima

If you optimise from the start without regards to the whole, then you gain local maxima, high efficiency relative to the little amount of code you wrote.

But if you wait till closer to the end, where you have already solved the given problem, then you have a better idea of the code structure. This is where your optimisation efforts create the most benefits. You get global maxima effect.

Computer virus behaviour thesis

I was going through some web site logs, and found an interesting combination of search terms. This site was listed in search results for “computer virus”, “dissertation” and “thesis”. I racked my brain for the reason why. Then I remembered I wrote something about the computer virus behaviour thesis for my final year project in university.

I rummaged through my collection of important CDs, and found it. With a small slip of paper that reads “Vincent’s Honours project — DO NOT ERASE!!!”, it’s easy to guess what’s inside that CD. Alas, it didn’t contain a PDF of my dissertation. It did contain all the source LaTeX and PostScript files. I wasn’t really in the mood to install a converter, so I went for the easy way out: ps2pdf.com.

Download the computer virus behaviour thesis in PDF (372 KB). I’d appreciate some credit if you find anything useful.

In fact, I’m feeling generous. Here, download the whole shebang (525 KB). The zip file contains all the program source code, MATLAB code files, LaTeX source files, PostScript files, some image files and even the PowerPoint slides I used for my presentation.

It’s been what, 6 years? So don’t expect me to remember a lot of stuff… A short breakdown then.

The “program” folder contains the source code for the simulation program running on Unix. Note the accompanying MATLAB files. This was where I used the output of the C program to generate data files usable by the MATLAB code to generate graphs. Note the narcissistic name of vince.c *smile*.

The “winprog” folder contains the source code for the simulation program running on a Windows computer. I used this version for the presentation. It’s more interesting when the audience could see the infection in “real” time. The code was written in Dev-C++ IDE. The code was based off a game template I was working on, hence the use of DirectX and the game-related comments and code structure.

You’ll find a few files with the .pfn extension. If I remember correctly, that’s my custom font file format, and it stands for “Phantasy Font”. I was running a web site phantasyrealm.com then. Don’t bother looking, the site’s not there anymore; I took it down. If you look through the code, and find any references to phantasyrealm, you’ll know what it is.

Question: Can you figure out the structure of the .pfn files?
Hint: It has something to do with bits, where 0 is black and 1 is white. It also has something to do with a 256 by 256 pixel grid. Or was it 128 by 128? *smile*

The discussion on spatial graphs is interesting. Imagine an entire grid of nodes, each node connected to the node above it, below it, to the left and right of it. If the grid wraps vertically and horizontally, the topology effectively becomes a torus (aka donut).

To visualise this, imagine you have a sheet of paper. Roll it so it becomes a cylinder with open ends. Then imagine bending the ends towards each other to form a loop. Tada! Torus formed.

I presented 4 points in the thesis

  • Topology
  • Advanced alarm system (foreknowledge of the virus epidemic)
  • Natural response system (higher vigilance after infection, decreased immunity over time)
  • Periodic activity system (computers and users are not “on” all the time)

I also remember my thesis advisor asking if any one point could be taken out and still produce the desired results. I said no. It’s only now that I realise he was referring to irreducible complexity.

So, I hope I’ve given you some useful information, some points to ponder and a fun computer virus simulation program to play with. Have fun!

Going through the looking glass

The thought of going through the looking glass
Is frightening enough, a terrifying mission
‘Cos in order for one to step through and pass
One must free one’s mind from its prison

Misunderstandings happen. Users don’t know what you’re talking about. You don’t know they’re talking about. Educating users to the innards of the application is one way. In this article, we’ll look at self-introspection, of understanding your users by changing the way you understand a situation or a problem.

Wear other people’s shoes

Difficult choice by YinYang @ iStockphoto

Metaphorically speaking of course. I’m in charge of maintaining legacy code and existing applications. The general feeling I got was either the original programmer was design dysfunctional, or he was design dysfunctional. The colour scheme was awful. There were buttons and icon buttons that were mystery meat. And placement of user interface elements only had one rule: if it’s there somewhere on the screen, it’ll do.

When you write code, think of your users. Put yourself in their shoes. Even go so far as to wear their shoes. Have you even tried using the interface yourself?

Even if you write non-interactive programs, think of the next programmer who’s going to maintain your code. Is it easy to understand critical portions and modify portions susceptible to change? Appropriate commenting can only go so far. Ultimately it’s what the compiler understands and spits out, not what you understand and write out.

Different perspective

I was having lunch at a diner. It was one of my favourite eating establishments. The staff knew me by face, and even knew what I’d order. I seem to always order the same items, so I try to vary a bit. When I try a new dish, they’d act shocked as if some fundamental law had been violated.

Anyway, I’ve always sat on the tables along the main sections of the diner. There’s this small table at the corner near the entrance. It’s cramped, with enough space only for two, sitting face to face.

I’ve always been fascinated by that table space. So I decided to sit there, taking the seat right at the corner, so I face towards the entrance. With the main diner space on my right, and I’m facing directly towards the entrance and the ordering counter, everything changed.

There I was, snug in a corner, watching people queue, watching people enter and leave. The music in the diner was somewhat muted. The sounds of people talking were compartmentalised somewhere to my right.

The difference in perspective was enormous.

Lost in translation

Recently I received an email from a user saying that he cannot export a report to Excel. The export function was provided by Crystal Reports, and it turns out that there was an issue when Windows Server 2003 was upgraded to Service Pack 2. The error message was “Error detected by export DLL”. (The solution patch can be found at the end of this forum post.) After upgrading, the Excel export function failed.

We’ve always provided the option to export to Adobe Portable Document Format (PDF), Microsoft Word and Excel. Now from the email, it suggested that only PDF and Word were available. So we’re perplexed.

I had to wear his shoes. I had to change my perspective. I had to understand that user queries were sometimes not what they seemed. That sometimes, users lie because they state something they understood in their terms, but mean something else in our terms. Even if both of us speak English.

I did the simplest thing possible. I went to the pertinent web page, and exported the report in all three different formats. It was then that I found that the export to Excel function generated an error. That’s what the user meant by “cannot export to Excel”. If he said there’s an error when exporting to Excel, it would have a different meaning, a more specific meaning.

There could be many reasons why he could not export the report. There were also many reasons why there’s an error in exporting. The confusion in this case was in discerning between “availability of export options” versus “error in one of the export options”.

Going through the looking glass involves looking at yourself with a critical eye. Sometimes it means changing your point of view. Sometimes it involves admitting you’re wrong. Because in the looking glass, your reflection stares right back at you. Are you brave enough to go through the looking glass?