### The Tao of Mac

Caught these in my RSS stream while trying to shake off work stress:

Since a lot of people were asking about the site header photos, I did some minor tweaks to banner rotation: you now get a Xmas banner first (there's a different one for morning, noon, afternoon and evening), then a semi-random selection of photos valid for 24 hours.

It turns out that rotating all of the nearly 200 headers bumps up my traffic something awful, so by limiting the number of photos in rotation every day I hope to take advantage of client-side caching and reach a kind of compromise.

Here's the (rather simplified) bit of PHP code that does the semi-random selection, in case you happen to need something similar:

$aFiles = array(); // contains all the photos// pick today's 16 headers by unpacking the md5 string as an integer array$aHeaders = unpack("S16", md5(strftime("%Y%m%d")));$nCount = count($aFiles);foreach($aHeaders as$dummy => $nOffset) { // use modulus to keep inside the$aFiles array  $aRotation[] =$aFiles[$nOffset %$nCount];}