Thursday, July 03, 2008

Ridiculously pleased

I'm a nerd.

I know it. You don't need to tell me so. In fact, I kinda get a lot of enjoyment out of it.

Anyway.

I was sitting at my job, and I heard another one of the students mention that he was about to go home to play Riven. I immediately perked up, as Riven is the sequel to Myst, and as dedicated readers know, I love the Myst series.

Naturally, I asked him how far along he was. He told me he was stuck at a particular part, and was actually planning on looking it up online. He felt he had the correct solution, and it just wasn't working. I'm not a big fan of using online help sites for puzzle games like Riven, since you tend to see more than you were looking for, so I offered to give him a hint or two. We talked, and he was able to figure out what he was doing wrong. Hooray. I asked if he'd played Exile (Myst III), which he hadn't, so I told him to look forward to it. A few minutes of conversation later, he was gone.

I then elated for the next 5 minutes that I'd talked to someone about Myst.

[elates]

...

Yes, I know it.

I'm a nerd.


Did anyone notice the slightly chiasmic structure of this post? I did!

Magic Numbers

In programming circles, there's an evil phenomenon known as "magic numbers". This describes the practice of using a number in the program's code whose meaning might not be clear to others. For example, if I wrote:

x = t/(60 * 1440);

you might not be sure what the code did. On the other hand, if I wrote:
SECONDS_PER_MINUTE = 60;
MINUTES_PER_DAY = 1440;
x = t/(SECONDS_PER_MINUTE * MINUTES_PER_DAY);

it's easy(er) to see that I'm calculating days from seconds. 60 and 1440 were magic numbers that hid the meaning of the code. An additional benefit of programming with named constants (like those found in the second example) is that if for some reason I need to change one of the constants, I only need to change it in one place. So, for example, if by divine decree all minutes are now 61 seconds long (maybe the earth is slowing?) I only need to change it in one place and all my calculations are updated. Nice.

The other day, though, I found a whole new meaning to the phrase "Magic Number" in a computer sense. I use Adium as my instant messaging client. It's an OS X-only program which allows me to talk to users on AIM, MSN, Yahoo, ICQ, Jabber, Bonjour, Google Talk, (etc. etc. etc.) all in the same program. Adium has an emoticon replacement feature, fairly common to such clients that turns :) into an actual smiley. Of course, it doesn't just cover your generic smiley face; it has hundreds of smileys available through various arcane and unexpected character sequences. Occasionally I'll run across one unintentionally, but looking back, I can usually see how the text might be construed as a face of some sort.

I was chatting with Dragon Lady the other day, and she was telling me about some problems she was having at work. She was running a query on a database and getting inconsistent results. She then told me this:

How many records???

I clicked on the smiley to see the underlying text. This is what I found:


Oh. 1414. I see.

If that's not a "magic number", I don't know what is.

P.S. Okay, okay. It's a lame analogy. I know. But it's still what I thought of when I saw it. And if any of you Adium users are curious and want to verify it, just make sure you're using the "Default" emoticon set. I understand that this will be fixed in the 1.3 release, so you have only a short time to enjoy your magic-number-ness. In the meantime, if anyone knows how to get "sarcastic" from 1414, please let me know.