Sleep and the length of days

Is it just a coincidence that humans require roughly the same amount of sleep as there are hours during the night?

In other words, is the amount of sleep that is “healthy” for us the result of long centuries of nurturing and tradition or is it biological?

In other words, if the day were 30 hours long, would we sleep more or work more?

This might keep me up at night…

Programmer’s Paradise

Joel of Joel on Software recently posted a good article on managing programmers in software companies. I liked this paragraph:

A programmer is most productive with a quiet private office, a great computer, unlimited beverages, an ambient temperature between 68 and 72 degrees (F), no glare on the screen, a chair that’s so comfortable you don’t feel it, an administrator that brings them their mail and orders manuals and books, a system administrator who makes the Internet as available as oxygen, a tester to find the bugs they just can’t see, a graphic designer to make their screens beautiful, a team of marketing people to make the masses want their products, a team of sales people to make sure the masses can get these products, some patient tech support saints who help customers get the product working and help the programmers understand what problems are generating the tech support calls, and about a dozen other support and administrative functions which, in a typical company, add up to about 80% of the payroll. It is not a coincidence that the Roman army had a ratio of four servants for every soldier. This was not decadence. Modern armies probably run 7:1.

 I have found that I am far more productive at home than in a cube. At home I have a private office, free drinks, a good computer (not great), two large screens, a perfect temperature, a good chair, and can listen to music out loud.

Programming is an exercise of the mind. The less you have to worry about your body the better your mind functions.

The web in a box

I was reading an interview of Gary Flake who works with MSN search. The following quote stood out to me:

 However, there is an even richer class of algorithms that can only be efficiently built on a 64 bit system because you essentially have to have a significant part of the web stored close to a single CPU. So, 64 bit systems pave the way for entirely new forms of relevance that look at how pages relate to one another.

That is just cool.

Microsoft announced recently that in a few months they would reveal a new search engine that is better than Google. This looks like part of it.

Macros are evil

I’m innocently developing a device context class for my LFC framework and I want a method called SelectPen. All of a sudden I’m getting very weird linker errors about how SelectPen is not defined.

It turns out that SelectPen is a macro defined in windowsx.h as an alias for SelectObject.

#define SelectPen(hdc, hpen) ((HPEN)SelectObject((hdc), (HGDIOBJ)(HPEN)(hpen))) Very annoying.Very annoying.Very annoying.

Editing Tracks in Windows Media Player

I recently embarked on a complete overhaul of my digital music library–including re-ripping all of my hundreds of CDs into WMA at 192 Kbps. It took a few weeks to get through  that, and now I’m going through each album “normalizing” it–fixing up names, album artists, composers, etc. It’s quite an effort and very tedious at times.

I just discovered yesterday that the keyboard is your friend in Windows Media Player. Using the mouse, you have to higlight a track, and then click again to enter the field (but be careful not to double-click, or it will start playing that track instead).

With the keyboard, you highlight a track, hit F2 to edit the first field (track number in my case). Don’t hit enter when you’re done editing a field, but use the tab/shift-tab keys to move between fields and the up/down arrow keys to move between tracks. This is saving a ton of time.

So why didn’t I realize this before? Part of me wants to say it’s my fault: I’m very computer-saavy and use the keyboard whenever I can and I ought to have tried something. However, another part of me is thinking that the interface does not indicate that the keyboard is a viable option here.

Simple Customization of a Collection Class

I needed a simple array of strings today, and I needed to be able to return it via a property. I could use a simple array, but that has some significant drawbacks. I could use an ArrayList, but the indexer returns an object, which would force the application to always cast it. I decided to derive a class from ArrayList and change the indexer. Something like this would work:

public class EmailList : System.Collections.ArrayList
{
public void Add(string email) { base.Add(email); }
public new string this[int index] {
    get { return (string)base[index]; }
    set { base[index] = value; }
  }
}

Notice the “new” keyword for the indexer. This tells the compiler to override the indexer provided by the base class. Now, whatever classes use this class can get a string back from the array list without having to cast it every time. There are other things you can do to customize this collection, but it’s a good start.

What’s the word for…

NPR ran a fun story the other day about coming up with words to express feelings or situations that we don’t have a word for.

My question is: what’s the word for the fear of writing “Love, ” (Like you would maybe automatically do to your spouse) at the end of an e-mail to your boss?

I’m not the only one who’s worried about this–a few weeks ago a coworker expressed the same fear.

Still No Silver Bullet…

Much is being made lately about vulnerabilities in Mac OS X, and various people are either haughtily dengrating the Mac while others are pooh-poohing the results with bad logic.

All of the ridiculous claims of “My OS is [better | more secure | safer] than your OS” is getting old. All these problems really do is serve to show us that, once again, that there really is no silver bullet in software design.

Dear Blockbuster,

Our relationship has been a long one, but at long last the time has come to go our separate ways. I can’t say our relationship has been a happy one. I remember the long nights of walking up and down your aisles, looking in vain for a decent movie, only to return home empty-handed to watch something I already have.

But I’ve found someone new–someone who will give me the movies I want to see, the movies I can’t find in any of your stores–good movies. New movies, old movies, classics, thrillers, TV shows–anything I’ve ever wanted to see, but couldn’t fit in a store.

I’ve moved to NetFlix and I won’t look back. With nearly 80 movies in the queue and counting I’m looking forward to a good year or more of movies I haven’t seen.