25

Mar

…And Now Shashin 2.0.3

Topic: WordPress and Web Programming
Tags: ,

In version 2.0.2 I updated Shashin to accommodate changes in the Picasa RSS feed. The feed changes had caused images to stop displaying after you synced your albums in Shashin. I fixed that, but what I didn’t notice was that they also changed how videos are represented in the feed, so version 2.0.2 still doesn’t display videos after you sync your albums. Someone kindly pointed out the problem, so I’ve fixed it - Shashin 2.0.3 is now available at wordpress.org.

21

Mar

Shashin 2.0.2 - Critical Upgrade

Topic: WordPress and Web Programming
Tags: ,

Murphy’s Law is being strictly enforced today: within 24 hours of my 2.0 release, Google coincidentally changed the Picasa RSS feed. The URL for the photos isn’t where it used to be in the feeder, with the result that, if you sync your albums in Shashin, your photos won’t show up anymore. I’ve found the new tag for the photo URLs in the Picasa feed and updated Shashin accordingly. So download Shashin 2.0.2 now. Note that your photo data is still safe in Shashin even if your photos stopped appearing after the Picasa RSS feed change. Syncing the albums with 2.0.2 should straighten everything out.

This is the one real problem with building an application that relies on Google’s RSS feeds - I have no control over when they might change the feeds, or what kind of changes they make.

There are also some other minor fixes. Here’s a list of the changes in 2.0.2:

  • Adjusted for new location of the content_url in the Picasa feed
  • If you select the option to display your photos at Picasa in a new browser window, it actually works now ;-) (the formatting of the anchor tag was incorrect).
  • Shashin now performs a preg_escape when detecting the URL for the page containing your salbumphotos tag. This fixes a warning that was being displayed for some URLs in PHP 5.
  • Shashin now correctly detects your WordPress installation directory if you’ve installed it in a subdirectory (except for paths in shashin/display/highslide.css which are hardcoded - you’ll need to edit those by hand).

19

Mar

Shashin 2.0 - Highslide and Album Displays

Topic: WordPress and Web Programming
Tags: ,

Shashin 2.0 is now available. I jumped the version number to 2.0 because this release includes a couple major new features. One is that Shashin is now bundled with Highslide. It was a fun challenge getting WordPress to play nicely with Highslide for displaying any combination of photos in a post, and then any combination of posts on a page. The other major new feature is linking album thumbnails to a local display of the album’s photos, so you can show them on your site instead of having to go to Picasa.

There are minor new features too: a new tag that lets you display sets of album thumbnails alongside their titles and descriptions, an option to prefix album titles to photo captions, and if you choose not to use Highslide, you can open the links to Picasa in a new window if you want.

All the details, including instructions for using the new features, are on my Shashin page.

If you have any questions or run into any problems, please use the comments on this post.

18

Mar

Kai Rocks Out

Topic: Kai and Eidan
Tags:

Kai rocks out
Kai rocks out

Kai refused to let me make a video of him dancing. I tried my best paparazzi camera-hiding technique, but as you can see, it got me only about 10 seconds of video.

15

Mar

Eidan Rocks Out

Topic: Kai and Eidan
Tags:

Eidan rocks out
Eidan rocks out

Who knew he’d develop a taste for heavy metal at such a young age. Click the image to watch.

12

Mar

To Serve All My Days

Topic: TV, Movies, and Music
Tags:

Star Trek: Phase II - To Serve All My DaysStar Trek: Phase II - To Serve All My Days
Star Trek: Phase II - To Serve All My Days

I’m a few years late to the party, but last night, while searching for something totally unrelated, I accidentally discovered (and then watched) To Serve All My Days. It’s an episode in the fan produced series Star Trek - Phase II. It continues the original series, with fans playing the roles of the original cast. I have to say it was actually not bad. The fact that longtime Star Trek writer D.C. Fontana penned the script and that Walter Koenig reprised his role as a Chekov probably didn’t hurt. In this episode Chekov undergoes rapid aging, which is a convenient solution to Koening being 40 years older now than when he first played Chekov (but he’s not as old as he looks in the picture here! That’s all makeup). I was particularly impressed with how they ended the episode - it was a touching and unexpected conclusion.

The acting overall was amateurish, but not cringe inducing - no worse than some other sci-fi series that have been on TV (I’m thinking of shows like Andromeda and the 1st year of Babylon 5). I enjoyed James Calwey who played Kirk - he often seemed barely able to contain his glee, hamming up Kirk just like Shatner did. There were only two cast members I found distracting: Ben Tolpin Jeff Quinn as Spock, not because of his acting, but because of the horrific makeup/headgear he was wearing, and Charles Root as Scotty, also not because of his acting, but because he looks almost exactly like Dan Akroyd (I kept expecting him to break out into a Blues Brothers routine at any moment).

The sets for the ship were particularly impressive - they were indistinguishable from the original 1960s sets. In terms of special effects, a big thing the show has going for it is the natural point of comparison is the original series, so the bar is set low. Like the original series, they have folks leaping onto their faces and things falling from the ceiling to provide the impression of a space battle. Unlike the original series, they use cheesy CGI instead of cheesy models for the space scenes. One advantage this gives the new series, however, is the ability to do some sophisticated maneuvering of ships during the battle scenes, so that was fun to watch.

I’m writing this because I know there are at least a few Trek fans lurking around my site. This is the article I stumbled across about the show, which has some interesting background information (like why they aren’t in trouble with Paramount for making the series, and that J.J. Abrams dropped in one time to give them some tips). You can download episodes from the Star Trek: Phase II site.

8

Mar

Kai’s Birthday Party - 2 Hours of Total Terror

Topic: Kai and Eidan
Tags:

Kai and his friends, waiting for cake at his birthday partyKai and his friends, waiting for cake at his birthday party
Kai and his friends, waiting for cake at his birthday party

We had a party at the house today for Kai’s 7th birthday. Maria and I barely survived the non-stop barrage of fart and burp jokes from 9 boys, not to mention the almost constant screams of glee as they battered each other with long balloons for 2 hours. Watch the video below to get a sense of it. Maria did a great job doing all the party planning - with a ring-pop scavenger hunt, bashing a piƱata with a toy lightsaber, small Lego Bionicle toys for everybody, pizza, and ice cream cake - she knows the way to the hearts of 7 year old boys. They all had a blast - especially Kai - and no one was hurt, so I’d call it a success.

Preparing for the party really came down to the wire. Back in November we covered the living room in tarps, so I could paint it, and so I could do some remodeling around the fire place. Then I broke my hand, and then I re-injured my back, so the room ended up covered in tarps for months. Now my hand is fully healed, and my back is better enough that I can do things like stand and paint for about an hour per day, so last week I got back to work on it. I had budgeted enough time to finish in time for the party, but then Eidan came down with the flu and was home from preschool for two days, which threw a major wrench in the works. I still finished in time, but I was painting under a lamp on Friday evening to have the room ready in time for the party today. You can catch a glimpse of the fireplace in the video - that work is not done yet.

Kai enjoying a ring pop at his 7th birthday partyKai enjoying a ring pop at his 7th birthday party
Kai enjoying a ring pop at his 7th birthday party
Video - Total insanity at Kai's 7th birthday partyVideo - Total insanity at Kai’s 7th birthday party
Video - Total insanity at Kai’s 7th birthday party

5

Mar

The Aftermath of Yesterday’s Primaries

Topic: Politics
Tags: ,

Slate has a fun Delegate Calculator, where you can experiment with different vote totals for the remaining primary states and see how they affect Obama’s and Clinton’s pledged delegate totals. If you play with the red slider across the top, you can see that Clinton would need to win all of the states listed by an average of 58% to Obama’s 42%, in order to exceed his pledged delegate count (averaging all the states like this is an oversimplification of the situation, but it gets the point across). To get within 100 delegates of him (a number I’m arbitrarily picking, where she might credibly argue the difference is too small to be a deciding factor), she’d need to average 53%. (Note the calculator still lists yesterday’s states, where her average percentage wasn’t anywhere close to 58%, and wasn’t even 53%, so the percentages she’ll need going forward are likely even higher than what I just outlined.)

I don’t know the dynamics of the upcoming states in any detail, and I don’t think they’ve been broadly polled yet. But just doing a quick mental comparison of them to demographically similar states, my gut feeling is that the only states where Clinton has a good chance of winning are Pennsylvania, Indiana, West Virginia, and Kentucky, with Obama likely to win the other 8 contests. I don’t see her getting within even 100 delegates of him. Even with her boost from yesterday, she is actually likely to fall further behind, even if she wins a few more big states (with the proportional allocation of delegates, such wins will only net her a handful of delegates; Obama’s strengths in the more numerous smaller states has a powerful cumulative effect).

That means her path to the nomination is not through the popular vote, but through the superdelegates. The only way she can persuade the superdelegates to overturn the overall popular vote is to get traction with attacks that thoroughly undermine belief in Obama’s capabilities. She needs to decimate the superdelegates’ confidence in his ability to lead the party effectively in the general campaign. This means she will have to really bloody Obama without getting equally bloodied in return. We got a taste of these kinds of attacks in Ohio and Texas, and it’s safe to say it will only get nastier.

This strategy is of course predicated on Obama not swatting back the attacks effectively. Obama’s advisor David Axelrod said today, “If Sen. Clinton wants to take the debate to various places, we’ll join that debate. We’ll do it on our terms and in our own way, but if she wants to make issues like ethics and disclosure and law firms and real estate deals and all that stuff issues, as I’ve said before, I don’t know why they’d want to go there, but I guess that’s where they’ll take the race.”

Regardless of who emerges the winner, the big concern for Democrats is that this will get really, really ugly, and do serious damage to both candidates as the general election quickly approaches. An exciting intra-party contest is good for the party to a point, as it keeps a media focus on the contest, and sharpens the candidates skills before the real battle with the other party begins (for example, Obama has become a much better debater, and the Clinton campaign has learned when - and when not - to put Bill on the campaign trail). But when the issue debates are largely exhausted and the contest begins to turn largely on personal attacks, that is when we are beyond that point. The last thing the Democrats need is lingering, bitter factionalism in the party, and a candidate that is badly tarnished even before the hardcore mudslinging of the general election begins.

4

Mar

Generating HTML Tables with a Variable Number of Columns and Rows

Topic: WordPress and Web Programming
Tags: ,

Often when you’re generating an HTML table on the fly, you need to be able to display an arbitrary number of columns and rows. This typically comes up when displaying data from a database, where you can get any number of records (rows) back. Fortunately handling a variable number of rows is easy in HTML, since all you have to do is keep adding table row tags until you run out of records. The harder, and less common, case is handling a variable number of columns. An example of where this situation comes up is my Shashin plugin, as Shashin users can decide how many columns they want in the display of their photos. Another example is a form where you need multiple rows and columns for neatly laying out a variable number of checkboxes.

I’ve seen a number of strange and tortured solutions to this problem over the years, so I thought I’d share my solution, which is really simple (I’m sure many others have figured this out as well, but I haven’t seen it posted anywhere). What’s often missing in other solutions I’ve seen is properly closing the final table row when the number of cells in it is less than the preceding rows. Here’s some generic PHP code for it:

// desired number of columns - this can be any number
$cols = 3;

$output = "<table>\n";

$cell_count = 1;

for ($i = 0; $i < count($your_array); $i++) {
    if ($cell_count == 1) {
        $output .= "<tr>\n";
    }

    $output .= "<td>your cell content</td>\n";
    $cell_count++;

    // end the row if we've generated the expected number of columns
    // or if we're at the end of the array
    if ($cell_count > $cols || $i == (count($your_array) - 1)) {
        $output .= "</tr>\n";
        $cell_count = 1;
    }
}

$output .= "</table>\n";

And just for fun here’s the same thing in Smarty:

<table>
<{assign var="cell_count" value=1}>
<{foreach key=key item=item from=$your_array name=yourloop}>
    <{if $cell_count == 1}>
        <tr>
    <{/if}>
    <td>your cell content</td>
    <{math assign="cell_count" equation="$cell_count + 1"}>

    <{if $cell_count > 3 || $smarty.foreach.yourloop.last}>
        </tr>
        <{assign var="cell_count" value=1}>
    <{/if}>
<{/foreach}>
</table>