Feeds:
Posts
Comments

On understanding code









A friend shared the following article on Lifehacker about Otixo, a “Convenient File Manager for Dropbox, Google Drive, SkyDrive, and All Your Other Cloud Services,” and it made me realize something.

http://lifehacker.com/5905784/otixo-is-a-convenient-file-manager-for-dropbox-google-drive-skydrive-and-all-your-other-cloud-services

It seems most products/services these days, and the accompanying articles describing them, follow a similar model:

“Create something that doesn’t exist to solve some problem, or make some task easier.”

In this specific case, they figured if a person has >1 cloud storage, managing them separately is hard so it’d make sense to create a unified interface that allows you to do that. And that’s great!

However, I’ve found that recently (only within the last year or two, I think some time after I got my iPhone) I’ve started to look for another way to solve problems: by simplifying. I figure out what’s essential to me, and try to throw everything else out.

So if I need to have cloud storage, there are 2 paths:

  • Get Dropbox, Google Drive, SkyDrive, etc.
  • Then get Otixo to help manage/unify them and make your life easier

or

  • Choose the best single service, use only it

The advantage of path 1 is you get more space, but it involves more things. However, if u can get by with path 2, it involves less things, which I appreciate (more so than having that extra space, cuz right now 24 GB of free Dropbox is way beyond what I need).

My point is this: it seems my line of thinking (simplifying) is rather under-represented in terms of human efforts. How many people are working on products/services/writing articles about how to simplify, throw things out? Seems like very few.

If you want to improve your life and solve problems by simplifying, you gotta do it on your own. If you wanna solve problems by adding things, just go to lifehacker.com and such.

Pursuit of Perfection

Apple is known as a company that strives for perfection in everything they do. They place a lot of attention on getting the smallest of details right. The little things that you rarely notice, not until you see someone else doing it wrong.

This attention to detail shows up everywhere. Take the power indicator on a MacBook for instance. It is meticulously programmed to light up in a solid white colour only when the following two conditions are met:

  1. The MacBook is turned on
  2. Its LCD screen is not lit up
This ensures you can tell whether the computer is turned on at all times, yet the indicator light is never on when it would be redundant. After all, if the LCD is on, you will already know that the computer is on.

iOS is a fine example of high-quality Apple software. It’s not always perfect, but the level of polish is above and beyond what you typically find in this very young but fast growing mobile industry. However, one of the side-effects of highly polished software is that when there are flaws in it, they become quite glaring in contrast to everything else that is done well.

There is one such flaw that I’ve found. Being able to tell the time on your phone is quite important, that’s why it always takes its place front and center in the middle of the status bar.

When an iPhone is locked, time and date are displayed in a large font. To avoid displaying the time twice, needlessly, time within the status bar is replaced by a small lock icon.

The problem occurs when you get a call while your device is locked.

At this point, you lose the ability to find out the time until you respond to your phone call.

It’s not a big deal, but I’ve found myself quite jarred by this a few times recently, when I wanted to find out the time before picking up the call.

Update: This has been fixed in iOS 6.0.

I got my trusty CRT monitor capable of high refresh rates from the basement, to try my recent motion blur demo on it. It looked great on my 60 Hz LCD, so I had high expectations for 120 Hz.

I was shocked with the outcome. As expected, going from 60 to 120 Hz made a huge, noticeable difference in my demo with motion blur off. But turning it on, there was no significant difference. For the first time, I couldn’t believe my eyes.

As a competitive gamer and someone very passionate about display technologies, I am very familiar with the concept of refresh rate. The more, the better, I always thought. 60 Hz is okay, but 120 is much better! I could always easily tell the difference. Until now.

After thinking about it, it made sense. This is probably the root of all “but the human eye can only see at most X frames per second” arguments on the internet. It matters what the frames are, or more precisely, how distinct they are. I can easily tell the difference in frame rate when they are very distinct, but I wasn’t when motion blur made them less so.

You can experience the motion blur demo for yourself if you have a WebGL-capable browser.

The examples are abundant. Take movies. At 24 frames per second, the motion looks acceptably smooth. But take any video game running at 24 frames and it’s unplayable. The difference is in motion blur. Each frame in film captures the light for roughly 1/24th of a second. In a video game, each frame is typically rendered as if with instant exposure time. For these type of frames, yes, the higher the frame rate, the smoother the motion appears.

I am planning to confirm my findings on a 120 Hz LCD monitor soon, but I am certain that the results will be similar.

“By avoiding a future arrow from hitting your present self, you ensure your past self will dodge the present arrow.”

Suppose you are designing a networking system for a multiplayer game. One of the biggest factors in the quality of networking design is how smooth the game feels for its players. People are not happy when they see snapping, jittering or other unexpected non-smooth behaviours. Such things occur because of the latency over the internet, and games have to try to predict things that are unpredictable by nature (e.g. player movement). Each time the prediction is wrong, the user sees an unpleasant correction.

One way to reduce such negative effects is to try to mask the corrections, by using smoothing.

I propose another approach. We can try to rely less on information that is uncertain, and rely on what is known. The latency is still there, but we can work around it.

Imagine an internet game server with multiple players, where everyone has less than 100 ms round-trip latency (and under 50 ms single-way latency). Those are good internet conditions, but not too unrealistic for today.

That means each player can know exactly all other players have been 100 ms ago, without having to use prediction. Let’s render them there. The local player still sees himself at present time, but he sees all other players 100 ms in the past, 100% smoothly (ignoring dropped packets).

We want to let players aim at enemies, and not where they think enemies are due to their current latency (ala Quake). So the server performs hit collisions with regard to what the player shooting saw. Bullets travel in present time, but they collide with players’ positions 100 ms in the past.

All the above has been done before (see Half-Life 1). But here’s the kicker of this post.

What if you try to dodge a bullet by doing something within 100 ms of it hitting you. With the above system, you physically can’t. No action, however drastic, within 100 ms of the bullet hitting you can save you, since the bullet will still hit where you were 100 ms ago (before you took said action).

It’s not that big a deal for bullets, since they travel quite fast so there’s little you can do in 100 ms to change anything. We can accept that as is. But can we do better?

What if, instead of a bullet, we have a slower moving projectile like an arrow. The player might want to jump out of the harm’s way just before it hits them, just to spite their opponent. With the above system, they will see themselves clearing the arrow, yet it still hits their 100 ms in the past alter-ego and the player quits in frustration.

Yes, we can do better. We take advantage of the principle that player movement is not easily predictable, but arrow projectiles are (all you need are the initial conditions). That’s why we render other players 100 ms in the past, but we can try to render other player’s projectiles 100 ms in the future.

Now, when you see an arrow just about to hit your face, and you duck at the last millisecond, you’re actually ducking 100 ms before the real arrow will have hit you. By avoiding a future arrow from hitting your present self, you ensure your past self will dodge the present arrow. :D

Additional Notes:

  • It’s hard to render the arrow when it is first fired, as we have to wait to receive the information about its initial conditions. But a long firing wind-up animation helps mask this.
  • You’re less likely to dodge arrows that are shot from point-blank range, or bullets that are fast. That’s why it’s okay if you don’t see the bullet before it hits you.
  • If you think the above is a problem, consider the real-life fact that if you hear the shot that was aimed at you, nothing you do from that point on (even if you have instantaneous reaction time) will help you, as that means the bullet has already hit you. Bullets travel faster than sound, just like they do faster than UDP internet packets.

A Subway Ride

You are riding the subway. It’s a regular train car. It feels familiar. There aren’t many people. Some are reading newspapers. A woman takes a sip from her coffee cup. An older woman in a wheelchair waits patiently for her stop. The train moves silently, as if through a thick layer of fog.

It makes a stop and a male gets on.

The train continues its monotone passage through a moonless night. It’s smooth sailing under the stars, except they’re not visible from within the tunnel.

A man in the seat ahead talks out loud, either to himself or into a headset. More likely the former.

People continue to mind their own business, each one almost completely oblivious to the presence of others.

An empty coffee cup rocks back and forth under the seat in front, caressed gently by the soft ride.

Another stop. The next station is Eglinton. They become more frequent, each one seemingly marking a period at the end of a sentence in the lifetime story of the train.

Three girls chatter happily at the end of the train car. Some laughter is heard from the other end. As I near my destination, my heart rate goes up ever so slightly. The smell of excitement fills the car.

The night is young. Whatever adventures await ahead are still unwritten.

Versionless Software

Suppose you have an ideal piece of software at version X with one bug in it. When the developer fixes the bug in version Y, you want to have that bug fixed too.

Without automatic updates, this means you have to manually update to Y. This has some cognitive effort associated with it. When multiplied by hundreds of different pieces of software, it is quite significant.

Wouldn’t it be better to have it automatically update without the end user having to worry about or even know anything about versions? Yes and no.

Yes – if you don’t mind using the newer version and the update process
No – if the new version does something other than bug fixes (i.e. added/removed features)
No – if the autoupdate process is intrusive and slows down your computer

I think the reasons for the ‘no’ answer can be, in theory, avoided, leaving yes and therefore making it possible to reduce cognitive load. To make our lives simpler by not having to regularly update software or deal with a major update from a very old version.

Follow

Get every new post delivered to your Inbox.