Contact MeContact Me

it's flickr time

Sunday, March 30, 2008

Just uploaded a ton of photos. This is a momentous occasion... it's been over a year since I uploaded anything to flickr! Go take a look.

Labels: ,

where am i from?

Thursday, March 20, 2008

I guess this is one of those "a little about me" posts. I was doing some nostalgia surfing this evening and felt compelled to blather a little about where I'm from. Most people who know me know that I was born in Okinawa, am half-Korean, and was raised as a Navy brat which meant we moved around a lot. In fact, that's sort of my "line" whenever people ask where I'm from. It's quick and easy, and it usually suits the conversation... enough information, but not too much (because people expect short answers to such questions). But since this is my site and my train of thought, I'd like to elaborate:

I was born in 1972 on the island of Okinawa, a prefecture of Japan and the largest in a chain of islands called the Ryukyu islands which lie south of Japan's four main islands. A lot of people think of Karate Kid 2 or Okinawan martial arts when I tell them I was born there, and that's fine. We left Okinawa when I was still an infant, which makes you wonder why I'm droning on about a place I don't remember. Well, we eventually returned in 1980.

Between 1980 and 1983 I attended grades 2 through 5 on Kadena Air Base. We lived on the economy (off base) at first, in a small house nestled against a forested area that my friends and I referred to as "the boonies". We'd often find ourselves building forts out of reeds and giant "elephant ear" leaves whose sap always made me itch (but how else were we going to build the roof?!). The best places to build forts, eerily enough, were near old stone tombs that looked like small houses. Naturally, there was this one tomb that was always open. The small, but heavy stone door was cracked maybe 6 or 7 inches—just enough to give you a good case of the heebies. We would always dare each other to get a good look inside—not go in, mind you—just peer inside to see whatever there was to see, but since the door and the opening were so small, very little light ever got in and so it was always pitch black... and very, very scary.

The route to my school bus stop was pretty cool. It involved following dirt paths along the edge of the forest and making my way through a sugarcane field, usually swiping a small chunk of cane to gnaw on (my teeth hurt thinking about it). The bus stop was located near a small stationery and candy store where I would squander any Yen in my pocket on Felix gum or other local goodies. If I had a fair amount of Yen (around 200), I'd buy this one box that contained several different kinds of candy, stickers, pencil, erasers and a toy. That was the mother lode... when I was 8.

When we eventually got into base housing, the walk to school was not nearly as adventurous, but there were a lot more American kids to play with that lived near us. The two real friends that I had made off base had also moved at the same time or thereabouts. One moved on base, but a bit too far for me to visit often, and the other moved back to the States, which was devastating... I even missed getting to say goodbye to him. Such is the life of a brat.

More later.

Labels: , ,

geek thread

Wednesday, March 05, 2008

Since some people have gotten tired of staring at my last post, and also since it's some whacky hour in the middle of the night when I should be sleeping, but ain't, I decided to share some work-related geekery.

This is probably stupid and you probably already know about this, but... You know that one bit of coding advice that's been going around about how you should initialize a local variable to the length of an array and use that in your "for" loop condition instead of accessing the length property on the array every iteration? Yeah. That one. Well, a couple colleagues and I were curious if this practice applied to all languages. Long story short, it seems that generally speaking, modern compilers (e.g., C#, VB, Java) should make such optimizations for you and to do so in those languages may be superfluous and only serve to make the code harder to read. However, such manual tweaking is still a good practice if you're developing Javascript for web pages (being that there is currently no smart JIT optimization going on under the hood of your typical browser today).

A compact, clean method of doing this involves initializing the length variable along with the iterator in the for loop construct:

for (var i = 0, len = myArray.length; i < len; i++) {}

Not only is this compact, but it also scopes the variable "len" to the loop itself, meaning it's eligible for garbage collection immediately after the loop is done iterating.

As for compiled languages (and even non-compiled languages), there are still options for speeding up array access in a "for" loop. One that I thought was interesting, but really makes app logic tough to follow, is initializing the iterator with the length of the array minus one, then counting backwards.

for (var i = myArr.length - 1; i >= 0; i--) {}

That really just buys you some extra cycles during the initialization of the loop, but not throughout subsequent iterations, and as I said, it's hard to immediately determine the purpose of that loop. One situation where you might get a noticeable increase in performance using that construct is when iterating through a large jagged multi-dimensional array. Like anyone ever does that.

Anyway, that's what you get for complaining about stale posts on my blog.

Labels: , ,