A sign that ticket prices are too high

Les Misérables is in town, and I would love to see it. I’ve seen it three times, but it’s one of those shows that I could see a million times and love it more each and every time.

Problem is: the tickets are minimum $200.00. The best seats still available are over $300.00. $300.00 for 3 hours of entertainment? Is it that really worth it?

In London, front row seats are about £40 ($70). A quick search turns up a flight for $419 from Dulles. So… for $300 I could see Les Misérables here, or for $490.00 I could fly all the way to London and see it.

Gift of the Magi

While I was shopping for a gift for my dad I must have mentioned to somebody something about how someday I wanted to build model ships. My dad caught wind of it, and on Christmas Eve I opened a nice set of knives and razors suitable for working with small wood parts. I was really confused. My mom got it, and laughed. I was still confused.

Later that night, my dad opened his model ship, and I handed him the knives which he had bought for me. Very funny. 🙂

On Fixing Computers

As the family’s computer guy, I often get asked to fix, maintain, look at, improve, or otherwise modify my family’s computers over vacations. This Christmas vacation is no exception. While I was at my brother’s house he asked me to look at his computer–remove spyware, make sure everything was running smoothly. I updated Spybot to 1.4, ran Ad Aware, and removed a bogus web search toolbar. And that’s about it. All-in-all, the computer was running smoothly as-is.

A few hours later, I got called to look at it because a new error message was being displayed–by Norton Internet Security. The anti-virus e-mail checker was disabled. I think this is what happened: It turns out that running Spybot had turned on the Windows Firewall, even though Norton had its own.

On the one hand, I probably could have read the descriptions of the problems Spybot had found and realized what it would do. On the other hand, why did Spybot find a problem when there really wasn’t one?

Computer software, including operating systems and the applications we run on them, has gotten far too complex for us to understand the implications of even simple operations.

Everytime we install an application on Windows, it makes changes to the file system, the registry, the start menu, and more. If it’s a system utility, it can modify much more.

And don’t tell me it’s any better on Linux. You have to deal with the potential of mismatched shared libraries every time an application is upgraded.

There a couple of technologies that I see as easing some of these problems:

  • .Net – xcopy deployment (for the most part), easy to use XML config files. Drop in and play for simple apps. Many Linux apps work well like this, why not Windows?
  • System change monitoring – like MS Anti-spyware, it notifies you whenever a system change occurs and lets you stop it before damage is done. What if we had a system that allows you to set what kind of changes you want to be notified about? What if it monitored a much broader set of features than today? This method presupposes a fairly good knowledge of computers. I like MS anti-spyware, but I wonder what people thing when it brings up a window asking whether to continue with a registry change, or run a script. Most people simply dismiss things like that, which is unfortunate.

Navigating a Changing Universe

Something my wife and I were talking about the other day inspired me to think about navigating the cosmos. I don’t remember our conversation, but I do remember wondering

How can we travel to a star a million light years away if the universe is constantly expanding? It wouldn’t be there once we arrived!

Which led to the general question of navigation in the universe. Even though we’re many, many decades from making these ultra-long exploratory voyages, surely someone must be thinking of these issues now so that when we do need a navigational system, it’s already available.

There is a galactic coordinate system.

(Of course, throughout all, I’m assuming that humans can be put in stasis, that we’re sending probes, robots, cyborgs, or otherwise assuming we can last the hundreds or thousands of years to get somewhere.)

But despite my best efforts at locating an answer, I find none. Has no one thought about it? We think about it with respect to the moon and Mars, but what about shifting galaxies?

Food for thought…

Gum

I’ve never liked gum. I did eat the stale pink stuff sticks that came in Topps baseball cards years ago, but since then…yuck.

Today I had a piece of my wife’s gum. Ick.

Chewing gum is like brushing your teeth for thirty minutes.

2-D Arrays versus Structs

I had a situation the other day where I needed an array of two values and the thought occurred to me: which is better? A 2-D array or a 1-D array of structs. I decided to come up with a quick test to see.

Here are my results:

2-D Arrays : 55.9376 cycles/row
Structs : 31.9937 cycles/row

That’s the number of cycles, on average, to add up the numbers in a row. Cycles makes more sense to me than microseconds when we’re talking about this level of code.

It turns out that the struct version is about 74% faster, which confused me slightly. Isn’t the memory layout for both options the same and should thus have the same assembly code?

It turns out…no. Before proceeding, download the test code here. It’s not pretty, but it works. Some of the mess is designed to keep the compiler from optimizing out my test cases. I tested with Visual Studio 2005 beta 2 with default release mode compiler options.

So lets look at two things I discovered:

Here are the addresses of the first two rows (of two elements each) of the two array styles:

sum1: 0x00354860 0x00354868 0x00354878 0x00354880
sum2: 0x026F0020 0x026F0028 0x026F0030 0x026F0038

Take a look at sum2 (the array of structs); each element starts exactly at 8-byte intervals–what we would expect because memory is often aligned on 8-byte boundaries on x86.

But look at sum1; the elements in the first row are 8 bytes apart, but the next row starts 16 bytes later! That means 8 additional bytes are wasted between each row. This means that fewer rows will fit in the CPU’s L1 cache, causing more cache misses, slowing down the program. (Why did this layout occur? I don’t know the answer to that yet)

Second of all, let’s look at the assembly code. This is just for adding the two elements of a row together.

;array addition
mov eax, DWORD PTR _arr$[esp+4] ; 1st operand addr
mov eax, DWORD PTR [eax+ebp*4] ; 2nd operand addr
fld QWORD PTR [eax+8] ; 1st operand
fadd QWORD PTR [eax] ;add 2nd operand
faddp ST(1), ST(0) ;add result to answer

;struct addition
fld QWORD PTR [eax+8];put first operand in register
fadd QWORD PTR [eax-16] ; add other operand
faddp ST(1), ST(0) ;add result to answer

So…the array version has to do two mov’s to fixup the correct addresses.

It seems now that the struct version is slightly more efficient here–both in space and in speed. However, this is really a microcosm of a problem. This kind of thing probably wouldn’t matter unless you were doing a lot of it. Personally, I’d go with the struct more often than not because it would be much easier to update the code to use a 3rd field, for example.

When Bad Random Functions Go Good?

Most software developers who have even a cursory knowledge of code security know that using the built-in rand() function for anything cryptographic is a bad idea.

Now take the issue of randomness in car CD players, for example. In the last year I replaced my car’s stolen stereo system with a new one. It’s a Kenwood and I’m generally happy with it, but it has got to have the WORST shuffle play I have ever seen…er… heard. Let me explain:

I created a WMA CD with about 80 favorite songs in the root directory. I have this CD in more often than not. Yesterday, as I was driving home it played the exact same set of songs as on the previous day driving home! They were in a different order, however. It was probably a subset of about 20 songs. What are the odds of that?

A second oddity I’ve noticed is that it more often than not plays two Elton John songs in a row (songs are ordered in alpanumerical order and most consist of something like “01 – My Song.wma”, where the number is the track number from the original album). I have maybe 5 on the CD.

But the really weird thing is that every time Trace Adkins’ beautiful tribute Arlington comes on I happen to be passing Arlington Cemetery right at that moment. This has happened each of the 4 times I’ve heard the song in my car. Each instance has been separated by at least a few weeks.

I would be interested in seeing the algorithm they use.

Movie Theaters

Much has been said in the media lately regarding the drop in movie theater attendance by the American public. Reasons given include: awful movies; expensive tickets and concessions; competition from DVDs, home theaters, and video games; cell phone users; advertisement and preview glut; rude patron behavior; etc. I bet the list could go on for many people.

Yesterday, we went to see March of the Penguins. It was highly recommended, and some said we had to see it in the theater for the full-scale effect.

The movie was great–but not overly so. Worth a theater ticket? (and the popcorn I have to get?) I’m not so sure. But each time (and they’ve been few) that I’ve gone to the theater here, I’ve understood more and more the reasons people are not going as often.

I think I’d rather watch things at home where I can control the environment–sure I don’t have a cavernous room with a 30-foot screen and 7-channel Dolby Digital, but…

…It still seems more enjoyable. Probably the next big thing to drag me to the theater will be the next Harry Potter movie. After that, the Lion, The Witch, and the Wardrobe. After that? Who knows…the list gets smaller every year.

I wonder if theaters will become the exception, as DVDs become the rule?