Took out decaying plant matter early this afternoon, in between rainstorms. Lots of it. Totally waterlogged. Totally disgusting. Worst of all: I wound up smelling like sauerkraut.

Been kinda tired lately. Today I went to work without my belt—eep!

Fun fact: I never wore a belt when I was younger, and when I started wearing one I would constantly forget to zip my pants. It’s like my brain thought “you need to do two things with your pants,” and “button them” and “apply belt” met that criteria.

I-hope-this-is-a fact: I no longer have that problem.

Mathematical Doodling: I think… this feeling… could it be? Love?


One day a couple years ago, my aunt—a high school teacher—asked her students if they had any Thanksgiving traditions. One girl piped up with the greatest tradition I have ever heard:

Every Thanksgiving, after dinner, my dad would take the turkey carcass and chase us kids around the table with it.

Holy shit!

Snow! Sticking, in November!

The mess I am in

I’ve spent far too much time near the theoretical line that divides the people who are in control of their lives from the people who aren’t in control. My usual position in that spectrum is hovering somewhere just barely in the “not in control” camp, and the terrible thing there is that being in control isn’t that far away; it isn’t impossible. You can see it just over the next rise.

And in that way your hopes are raised before being dashed on the rocks of reality.

Repeatedly trying, and failing, to get things under control eventually takes a toll on you. I (at least imagine I) feel it physically; my back seems to be growing more and more tight as the months pass, and I’ve had trouble sleeping lately. Even more damaging, though, is an insidious, unexpected (at least by me), consequence: I’ve pretty much forgotten how to have fun.

I can relax and enjoy myself when I have friends over, and Wednesday night dance practices are pretty much a sacred time separate from my regular life. Outside of those situations, though, I feel a constant need to be productive and get stuff done. This is (tragically?) exacerbated by my inability to actually get everything I want done—and suddenly I’m in the middle of a feedback loop that’s been going crazy on my ass for years now.

End result? I buy video games, but never actually find the time to sit down and enjoy playing them. I’ve seen damn few movies released in the last decade. My nose is constantly in my iPod or iPad, trying to catch up on all the RSS feeds I haven’t read. Despite being online constantly, I don’t actually respond to emails in any timely fashion; despite getting my blog set up on WordPress (crossed off that to-do item!), I don’t really post in it. My free time is consumed with trying to accomplish things, and what things I do “for fun” are stripped of a lot of their joy.

This is Sparta madness—and the crazy thing is that I’ve somehow done it all to myself.

I can be trained: using Outlook at work has taught me to hit F7 (check spelling) before sending any email. I now do that at home, on my Mac. F7 does nothing in Mail, which automatically checks my spelling as I type.

Pisses me off every time I do it, too.

Jane Austen’s Fight Club: for some reason I thought of Eric while watching this.

Random images in WordPress

Putting random images in the sidebar of a standard Movable Type blog is relatively easy, because Movable Type generates static pages that the web server then dishes out. Tell your web server to run the pages through PHP before sending them out, and include a little bit of code to stick in random image URLs—the PHP will survive intact through Movable Type, and your server will take care of the images before sending the page to the browser.

This is even easier in WordPress, because—by default—pages are dynamically generated (using PHP) when the browser asks for them. Add your image rotation code in, and WordPress will take care of the rest.

The problem occurs when you want to add page caching to WordPress. Generating a page each time a browser asks for it is rather wasteful; I can’t count the number of times that Daring Fireball has crashed a server by linking to a WordPress blog it was hosting. The solution to that is saving those generated pages, and then using that saved copy when some other browser asks for that page.

Which is all well and good, until you realize that the cache has also cached a specific (albeit random!) set of images for your sidebar. Everybody will see the same images when visiting a specific page (say, this front page), and they will continue to see those images until the cache expires and the page is re-cached.

W3 Total Cache, the caching plugin that I’m using, has a workaround: it can cache parts of a page, so long as you use the “Disk (basic)” page cache method. You surround the parts you don’t want to cache with <!--mfunc--> and <!--/mfunc-->, and it’ll cache the rest. Notably, you omit the usual <?php and ?> tags when using this “mfunc” notation. My code looks something like this:

$image_path = 'rotating_pics/';
$temp = array_merge(glob($image_path . '*.jpg'), glob($image_path . '*.png'), glob($image_path . '*.gif'));
$pic_list = $temp?$temp:array();

$top_pic = $pic_list[0];
$mid_pic = $pic_list[1];
$end_pic = $pic_list[2];

echo '<div id="background_pic_1" class="side_pics" style="background-image:url(' . $top_pic .')"> </div>';
echo '<div id="background_pic_2" class="side_pics" style="background-image:url(' . $mid_pic .')"> </div>';
echo '<div id="background_pic_3" class="side_pics" style="background-image:url(' . $end_pic .')"> </div>';

I’ve gotten lazy, and am now using the PHP function glob() to figure out what pictures are available for use—rather than hardcoding the file names into a script. The server I’m on doesn’t support it, but the GLOB_BRACE flag could combine the three calls to glob() into a single one. (I’m also using shuffle() over array_rand(), as the latter apparently isn’t exactly random when it comes to ordering the selected elements.)

And that’s pretty much the fruit of half a day’s poking around on my week off. It may be a little bitter for me (really… my week off), but may be useful for someone else.

You Are Not So Smart: this “celebration of self delusion” is in the running for my favorite blog, ever. Well-written, interesting, and informative… everything my blog is not.

powered by wordpress