Archive for February, 2007

Balanced Widescreen Design

Wednesday, February 28th, 2007

I decided the previous New Widescreen Layout was too lopsided and balanced it with one sidebar on either side. One disappointment was that I couldn’t get a set of widgets in each sidebar and still had to wrangle some PHP and CSS. I was also able to shrink the email subscription form using a bit of Javascript magic (work is good for something), and corrected out the tag cloud CSS to use relative font sizes and the base page font.

Update: It turns out that multiple widget panels work just fine when you edit the right copy of the functions.php file!

Unified Search Part 2

Monday, February 26th, 2007

The one problem with my Unified Search for blog entries and photos was it always hit the blog search engine and page before redirecting to photo searches. I found the magic solution in PHP’s header command, which allowed me to direct searches though a pre-search page that redirects transparently. Here’s the code:

$PARAM = array_merge($_GET, $_POST); 
$s = $PARAM['s']; # search terms
$search_type = $PARAM['type'];  # search type

if ($search_type == “photos”) {
  header(”Location: http://www.botos.com/
cgi-bin/tag_search.cgi?terms=$s”);
} else {
  header(”Location: http://matthewbotos.com/?s=$s”);
}

Tag Cloud Plugin and Widgets

Sunday, February 25th, 2007

I found a nice Tag Cloud Plugin for WordPress, which also introduced me to the wonderful world of WordPress widgets. The widgets offer an easy way to customize WordPress with a web-based drag-and-drop interface instead of having to muck with the template code. Dropping in the tag cloud widget gives you the expected tag cloud of your categories, which is more compact and informative than the usual long list of them.

Tileable Images

Sunday, February 25th, 2007

As part of the New Widescreen Layout, I set out to make the image at the top of the page tile. Though the ends of the image are both blue sky, the coloring and clouds were different enough to mark the transition very sharply. Though I remembered the basic approach from working through Grokking the Gimp years ago, it took a few attempts to shake off the rust.

The overall method is to make one image fade into its neighbors on either side. The detailed steps are:

  1. Duplicate the image onto two additional layers so you have Left, Right, and Center copies.
  2. Move the Left and Right copies off in their respective directions so only 100 pixels are showing.
  3. Create an layer mask for each to set transparency.
  4. Fade the layer mask for Left and Right with a gradient over the inner 50 pixels of their 100 pixel width.
  5. Fade each end of the Center layer mask 50 pixels from the outer edge, using multiply mode for the second.
  6. Crop the image by 25 pixels from each end so that the images will join in the middle of the transition.

The key is that one gradient flows into the solid portion of the neighbor, thereby feathering the images into each other. My initial mistake was to have the gradients flow into each other, which left some transparency through which the white background bled through. The join in the final result is only noticeable if you really look for it. (Open one the photo albums to maximum width.)

A few final words: the width of the gradients can be adjusted to taste, and it’s useful to snap to a grid by which the image width is divisible to get symmetric results at both end.

Unified Search

Saturday, February 24th, 2007

The search form in the upper right now lets you search both blog posts and photos from the front page. This is something I’ve been meaning to do for a long time, but dreaded the thought of having to convert the Perl CGI photo search. Instead, the blog search page now catches the search type and redirects to the photo search if appropriate. Here’s the new code in header.php:

<?php>
$PARAM = array_merge($_GET, $_POST); 
$search_type = $PARAM['type'];  # search type
if ($search_type == “photos”) { 
?>
<meta http-equiv=”refresh” content=”0;
  URL=http://www.botos.com/cgi-bin/tag_search.cgi?terms=
  <?php echo $s; ?>”>
<?php } ?>

The page is still rendered and displayed before the redirect kicks in, so search.php also got some logic to short circuit rendering the results of the search. WordPress still performs the search, but this it’s reasonably quick and skipping it would require digging into WordPress beyond the template files. Improvements to this little scheme are welcome, or you can use it as-is to extend WordPress with your own search engine.

New Widescreen Layout

Saturday, February 24th, 2007

In keeping with the trend towards wider and widescreen displays, I’ve changed the layout to have two sidebars. This keeps the main blog text at a moderate and more readable width, while bringing more of the ancillary sidebar content above the fold. The “actionable” feeds and email subscription are also near the top now (the user interface folks at work must be rubbing off on me). Let me know if this looks too crowded or cluttered.

Another Brick in the Wall

Saturday, February 24th, 2007

One brick at a time, I continue to add to my Rube Goldberg assortment of Perl scripts that drive the non-Wordpress portions of this site. The resulting photo workflow is fairly efficient; one script builds and links pages for a newly exported set of photos from Picasa. One last step to automate was the blog entry for each new album; the script spit it out to be cut and paste into WordPress’s Write Post page.

To cut out this step, I HTML-encoded the post text using the Perl one-liner

$content =~ s/([^A-Za-z0-9])/sprintf(”%%%02X”, ord($1))/seg;

and called FireFox with the post URL. The necessary parameters are post_title and content. I wasn’t able to select the category checkboxes, but set the default to Photography instead.

This nicely prefills the form for preview or additions; have fun making your own scripts start writing blog entries for you!

Saturday in Philly

Saturday, February 24th, 2007

Saturday in Philly After an enjoyable lunch date at the Reading Terminal Market, I did a little shopping before heading over towards City Hall. It was quiet and cold on a Saturday afternoon, but wonderfully clear for photos with strong sunlight and shadows.

View the Saturday in Philly photos

Snowboarding and Plato

Friday, February 23rd, 2007

The Wall Street Journal had a fun article on a snowboard school in Crested Butte, Colorado where students mix snowboarding and Plato. Not only does school get canceled for powder days, but at any time a quarter of the students are nursing injuries from trying to attain the philosophically impossible perfect 720.

eHarmony Again

Wednesday, February 21st, 2007

Returning to dating recently, I decided to give eHarmony another shot. A few years ago, I found it to be a good source of serious matches, and am surprised at the volume of good matches this time around. In case you haven’t seen the commercials with Dr. Neil Warren and the Shiny Happy Couples, eHarmony matches you based on a long personality survey and guides you through a multi-step introduction before opening it up to email.

There’s still the usual amount of unanswered communication and unexplained fizzles, but the people who do communicate have been conscientious about it and do seem to be looking for serious relationships. By and large, they’ve also been quite civil for Internet daters; I’ve exchanged a number of pleasant “closed match” messages with these women.

As for the quantity, Merle posited that I’ve hit a magic age where I can appeal to both the younger women looking for an older guy and the women my own age with ticking clocks. I’m inclined to agree, and in any case, it’s good news for me!