Monthly Archives: January 2009

Make HTML Postable in WordPress

In my previous post, I wrote some HTML inside the post that was supposed to be displayed as text, not actually parsed by the browser as HTML. For whatever reason, the <code> tags in WP don’t seem to do their job. Maybe I don’t understand what their job is??

Anyway, I did a little search and was happy to find this little gem that converts all the special browser characters into their text-displayable characters. Very handy!

Postable

Auto-refresh HTML at Given Time

I have a page that grabs data from a database and graphs it using flot. (BTW, If you need dynamic graphs or charts on your website and haven’t checked out flot, do it!) The database is populated by a weather station that aggregates data and records a new entry every 30 minutes. So, every hour at 0 and 30 minutes, new data is recorded and the graphs can be updated.

At first, I did a simple refresh of the page every minute to grab the new data. This works, but is annoying when you have scrolled down and are zooming in on a data set. Every minute, the page reloads and you start over.

I realized I know the exact time new data is available, so why not schedule the page reload on that? It’s not perfectly straightforward, but not really difficult after thinking about it for a few minutes. I’m still using the javascript::timeRefresh, but all I need is a way to set its argument dynamically. I’d explain what the code is doing, but I think you can tell. If not, use Google to look up the PHP functions. The only tricks are the logic on the minutes and setting the seconds parameter in mktime() to zero. PHP’s mktime() is a little magical because it handles the rollover of minutes and days for me. Thanks PHP!

<body onload="JavaScript:timedRefresh(
<?php
$year = date("Y");
$month = date("m");
$date = date("d");
$hour = date("H");
$minute = date("i");
if ($minute < 30)
    $minute = 30;
else
    $minute = 60;
echo 1000 * (mktime($hour,$minute,0,$month,$date, $year) - time());
?>);">

Comparing News Photo Galleries

I think the Chicago Tribune and the Boston Globe are the two news sources with photo galleries I see linked most often from digg.com.  It’s strange how different the two sites are.  Personally, I avoid chicagotribune.com photo galleries unless I’m very interested in the content.  On the other hand, I’ll click on boston.com because they are usually very pleasing.  Here’s why:

  1. URL
  2. Layout
    • Boston.com’s page is obviously about the photos. A small amount of text at the top to provide viewer context doesn’t distract from the goal of the site. The layout also wins because I don’t have to click to get through the gallery, simply scroll down.
    • Chicagotribune.com’s page is obviously about the ads. Sure, the photo is in the middle, but it’s barely bigger than the largest ad on the page and total ad area dominates the real content. What are you trying to showcase here?
  3. Photo Size

    Boston.com wins again. I am here to see photos, don’t make me squint!

  4. Photo Quality

    This is where the Boston Globe really shines. I don’t know how they obtain all the quality photos they publish, but they are constantly impressive. Chicago Tribune, on the other hand, looks like they picked the best photos from a high school point-and-shoot photo project.

Why the Republican Party Isn’t Ready for the Big Show

On the radio this morning, NPR had a Morning Edition story on the debate between contenders for the GOP Chairman position.  The story was full of quotes highlighting the sad state of the Republican Party.  But the most appalling was a quote exclaiming, “the Republican Party will be ready for battle in 2010!” against the Democratic Party.

They really don’t get it.  America is in trouble and they’re still trying to divide us.  The reason Obama won is because he is a shining star guiding and uniting all Americans.  The last thing we need is a group of politicians coming back attempting to divide the nation.

Wake up GOP!  You need more than new leaders, you need a new agenda!