Obama's White House Adopts Atom Format

I became the first subscriber on Bloglines to the feed for the new White House web site, which launched at 12:00 p.m. as Barack Obama became the 44th president of the United States. As a syndication dork, I was interested to discover that the feed employs Atom as its format:

<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>White House.gov Blog Feed</title>
  <link href="http://www.whitehouse.gov" />
  <updated>2009-01-20T12:05:25Z</updated>
  <author><name>EOP</name></author>
  <id>urn:uuid:ca4baafc-b6bc-45e5-9144-79c5289d9518</id>
  <entry>
    <title>A National Day of Renewal and Reconciliation</title>
    <link href="http://www.whitehouse.gov/blog/a_national_day_of_renewal_and_reconciliation/" />
    <id>urn:uuid:ca4baafc-b6bc-45e5-9144-79c5289d9518</id>
    <updated>2009-01-20T17:01:00Z</updated>
    <summary>President Barack Obama's first proclamation.</summary>
  </entry>
</feed>

The Atom feed passes the Feed Validator, but there are four issues that trigger warning messages:

  • Your feed appears to be encoded as "utf-8", but your server is reporting "US-ASCII" [help]
  • Missing atom:link with rel="self" [help]
  • Two entries with the same id: urn:uuid:ca4baafc-b6bc-45e5-9144-79c5289d9518 (4 occurrences) [help]
  • Two entries with the same value for atom:updated: 2009-01-20T17:01:00Z [help]

When he has the time, President Obama can address these issues pretty quickly.

First, the XML element should reflect the actual encoding transmitted by the White House server:

<?xml version="1.0" encoding="US-ASCII"?>

Alternatively, the feed should be published using the UTF-8 encoding.

Next, the feed's link element must include an rel="self" attribute indicating that it's the feed's own URL:

<link rel="self" href="http://www.whitehouse.gov/feed/blog/" />

Finally, steps should be taken so that each feed entry has a unique ID. I recommend using the tag URI format, which for the White House could produce id elements like this:

<id>tag:whitehouse.gov,2009:1</id>

The final number in the id element should be a unique number, such as the index number of a blog entry.

The new White House site promises more feeds to come, but describes them as RSS feeds:

RSS is an acronym for Really Simple Syndication or Rich Site Summary. It is an XML-based method for distributing the latest news and information from a website that can be easily read by a variety of news readers or aggregators.

Either this is an error -- Atom feeds are not in RSS format, of course -- or Obama's effort towards national reconciliation includes the combatants in the RSS/Atom war.

eHarmony Couple Joshua and Tanyalee Oppose Gay Marriage

Joshua and Tanyalee Pearson are newlyweds in Redding, Calif., who met through the online dating service eHarmony and married 10 months later. The telegenic boutique owner and "geeky chemist" have become the greatest TV commercial supercouple since Jared Fogle and a six-inch turkey sandwich.

Jared scares me, but after seeing their commercial hundreds of times I've become attached to Joshua and Tanyalee. They got married pretty quickly, but who am I to argue with 29 factors of compatibility? The eHarmony dating site is powered by romantic science.

Five questions are used to assess Dyadic Cohesion, including how often the couple laughs together, works together on a project, or has a stimulating exchange of ideas. Univariate Chi-square and ANOVA analyses indicated a significant benefit (p < .001) for having been introduced by eHarmony for all five of the measures used to assess Dyadic Cohesion, as well as for all 32 items comprising the entire DAS.

We didn't have Dyadic Cohesion back in my day. I met the missus at a kegger. She looked at me through the haze of beer goggles and it was love at impaired sight.

Given eHarmony's trouble in New Jersey over excluding gays from its service, it's interesting to see that Tanyalee has gone on the record in favor of California's Proposition 8:

Marriage is a biblical union under God that happens to be recognized by our government. It is not subject to amendments. I believe that it would be right of our government to offer some sort of union benefit to those who wish to join their lives in a same-sex union. However, this does not mean that the government has any right to step into the church and redefine "marriage". The separation between church and state is not to keep the beliefs of the church out of our governing systems. Instead is to keep the governing systems out of the church. ...

This is not about rights as a citizen of the United States of America. This is about whether we as a country have the audacity to ammend the Bible. "Marriage" is not the term to be used in homosexual unions. This is not ever been defined in the Bible as such. Thus it is not the place or right of my government to change that. In order to keep separate as so many have suggested the church and the state, we must fundamentally re-examine the suggestions being purposed.

Leaving aside Tanyalee's completely back-asswards interpretation of the separation of church and state, I don't understand the impulse of some straight people to play "tick-tock the game is locked" with marriage. Why should I care if a committed gay couple wants the benefits and burdens the state assigns to married people? eHarmony is now under legal agreement with the state of New Jersey to begin applying love cohesive to gays on a same-sex service called Compatible Partners. When they start churning out gay couples whose univariate Chi-square and ANOVA analyses indicate lifelong compatibility, shouldn't they get married and celebrate their happiness in heavily rotated television commercials? Gay people can't possibly screw up marriage any worse than heterosexuals. If the institution can survive quickie Vegas weddings, 35,000-couple Unification Church mass ceremonies and the union of Julia Roberts and Lyle Lovett, it can survive a couple with the same plumbing who'd like to file a joint tax return and share parental rights over their children.

Tanyalee takes a pretty hardline view on the issue, and given the fact that Joshua has an advanced degree in chemistry, I was concerned they might have only 28 favors of compatibility -- 60 percent of people with postgraduate degrees voted against Proposition 8, according to exit polls. But the only hero named on Joshua's MySpace profile is "Jesus Christ my Lord and Savior and ultimate HERO, role model, and friend," and he attends a church that prescreens applicants to its School of Supernatural Worship for the purpose of weeding out gays, cultists and practitioners of witchcraft:

Have you ever been involved in homosexuality or lesbianism?

If yes, how long since last involvement?

So Joshua and Tanyalee are in harmony on this issue, and thank God for that.

Update: After writing this, I heard from Tanyalee.

The Tale of the Naked Neighbor

Occasionally, my kids surprise me with something that I didn't know about them. I've worked out of my house for their entire lives, aside from 90 days as a university webmaster I'll never get back. Spending so much time under my watchful eye, my children ought to find it impossible to acquire even a scintilla of independent life experience. But sometimes kids develop lives of their own, as I was reminded recently when telling my mother about the first time I saw a nude woman.

This is my first letter to Penthouse Forum. I never thought anything like this would ever happen to me -- er, actually, it wasn't like that at all.

Shortly before I entered school in the '70s, my family moved from Wichita Falls, Texas, to an apartment off Central Expressway in Dallas. The apartment had a fenced-in back porch barely big enough to hold a barbecue grill, as did the adjacent apartments. I became fast friends with a girl my age next door, and we visited each other by climbing our back fences and dropping in.

These visits were, of course, unannounced. One morning I scaled the fence to the neighbor's apartment per the normal routine, opened the sliding-glass door and stepped into their bedroom. As I did, the girl's mother walked into the same room, naked and dripping wet after a shower.

The sight of this pale red-haired woman wearing nothing but condensation would not have been a jarring experience, I don't think, except for what she did next. My friend's mother let forth a blood-curdling scream of terror as if I were the Zodiac Killer. I met that scream with one of my own, vaulted the fence like Bruce Jenner, and returned home to sit hunched over in front of the television, talking myself back to my happy place with the help of Mr. Rogers' Neighborhood.

Afterward, the woman and I pretended the event never happened. I didn't tell the parents and she didn't either. After 35 years I decided to break my silence -- I'm in my 40s, she'd be in her 60s and I couldn't pick her face out of a lineup. My mother had no idea this took place.

When I got a little older and began attending Sunday school at my Catholic church, I didn't have to be told that the sight of the unclothed body fills you with panic, nausea and shame.

Creating PHP Web Sites with Smarty

I recently relaunched SportsFilter using the site's original web design on top of new programming, replacing a ColdFusion site with one written in PHP. The project turned out to be the most difficult web application I've ever worked on. For months, I kept writing PHP code only to throw it all out and start over as it became a ginormous pile of spaghetti.

Back in July, SportsFilter began crashing frequently and neither I nor the hosting service were able to find the cause. I've never been an expert in ColdFusion, Microsoft IIS or Microsoft SQL Server, the platform we chose in 2002 when SportsFilter's founders paid Matt Haughey to develop a sports community weblog inspired by MetaFilter. Haughey puts a phenomenal amount of effort into the user interface of his sites, and web designer Kirk Franklin made a lot of improvements over the years to SportsFilter. Users liked the way the site worked and didn't want to lose that interface. After I cobbled together a site using the same code as the Drudge Retort, SportsFilter's longtime users kept grasping for a delicate way to tell me that my design sucked big rocks.

PHP's a handy language for simple web programming, but when you get into more complex projects or work in a team, it can be difficult to create something that's easy to maintain. The ability to embed PHP code in web pages also makes it hard to hand off pages to web designers who are not programmers.

I thought about switching to Ruby on Rails and bought some books towards that end, but I didn't want to watch SportsFilter regulars drift away while I spent a couple months learning a new programming language and web framework.

During the Festivus holidays, after the family gathered around a pole and aired our grievances, I found a way to recode SportsFilter while retaining the existing design. The Smarty template engine makes it much easier to create a PHP web site that enables programmers and web designers to work together without messing up each other's work.

Smarty works by letting web designers create templates for web pages that contain three things: HTML markup, functions that control how information is displayed, and simple foreach and if-else commands written in Smarty's template language instead of PHP. Here's the template that display SportsFilter's RSS feed:

<?xml version="1.0" encoding="ISO-8859-1"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
  <channel>
    <title>SportsFilter</title>
    <link>http://www.sportsfilter.com/</link>
    <description>Sports community weblog with {$member_count} members.</description>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <atom:link rel="self" href="http://feeds.sportsfilter.com/sportsfilter" type="application/rss+xml" />
{foreach from=$entries item=entry}
    <item>
      <title>{$entry.title|escape:'html'}</title>
      <link>{$entry.permalink}</link>
      <description>{$entry.description|escape:'html'}</description>
      <pubDate>{$entry.timestamp|date_format:"%a, %d %b %Y %H:%M:%S %z"}</pubDate>
      <dc:creator>{$entry.author}</dc:creator>
      <comments>{$entry.permalink}#discuss</comments>
      <guid isPermaLink="false">tag:sportsfilter.com,2002:weblog.{$entry.dex}</guid>
      <category>{$entry.category}</category>
    </item>
{/foreach}
  </channel>
</rss>

The Smarty code in this template is placed within "{" and "}" brackets. The foreach loop pulls rows of weblog entries from the $entries array, storing each one in an $entry array. Elements of the array are displayed when you reference them in the template -- for example, $entry.author displays the username of the entry's author.

The display of variables can be modified by functions that use the "|" pipe operator. The escape function, used in {$entry.title|escape:'html'}, formats characters to properly encode them for use in an XML format such as RSS. (It's actually formatting them as HTML, but that works for this purpose.)

Because Smarty was developed with web applications in mind, there are a lot of built-in functions that make the task easier. SportsFilter displays dates in a lot of different forms. In my old code, I stored each form of a date in a different variable. Here, I just store a date once as a Unix timestamp value and call Smarty's date_format function to determine how it is displayed.

Smarty makes all session variables, cookies, and the request variables from form submissions available to templates. In SportsFilter, usernames are in $smarty.session.username and submitted comments are in $smarty.request.comment. There also are a few standard variables such as $smarty.now, the current time.

To use Smarty templates, you write a PHP script that stores the variables used by the template and then display the template. Here's the script that displays the RSS feed:

// load libraries
require_once('sportsfilter.php');
$spofi = new SportsFilter();

// load data
$entries = $spofi->get_recent_entries("", 15, "sports,");
$member_count = floor($spofi->get_member_count() / 1000) * 1000;

// make data available to templates
$smarty->assign('spofi', $spofi);
$smarty->assign('entries', $entries);
$smarty->assign('page_title', "SportsFilter");
$smarty->assign('member_count', $member_count);

// display output
header("Content-Type: text/xml; charset=ISO-8859-1");
$smarty->display('rss-source.tpl');

Smarty compiles web page templates into PHP code, so if something doesn't work like you expected, you can look under the hood. There's a lot more I could say about Smarty, but I'm starting to confuse myself.

There are two major chores involved in creating a web application in PHP: displaying content on web pages and reading or writing that content from a database. Smarty makes one of them considerably easier and more fun to program. I'm fighting the urge to rewrite every site I've ever created in PHP to use it. That would probably be overkill.

User-Generated Content Event Offers Super Speaker

There's a User-Generated Content Expo being held in San Jose, Calif., next month. Keynote speakers include Craigslist founder Craig Newmark and CafePress founder Fred Durham.

While browsing the list of speakers to see if they invited any actual content-generating users, I found one of the greatest speaker bios I've ever read. Meet Dawn Clark, founder of DawnClark.Net:

A pioneer in the field of Cyberenergetics, Dawn Clark is a sensitive who stands at the nexus of science and spirituality. Fields influenced by Cyberenergetics include game theory, psychology, biological systems, organizational structure, philosophy, systems theory, and architecture. Dawn's deep insights in energy dynamics at the sub-atomic level are relevant for developing strategic direction and alignment, understanding how products engage, engross and affect subtle fields, all the while factoring in the values of the individuals or audiences critical to making a solution path workable.

Dawn ClarkWhere most people see empty space, Dawn perceives wave form, frequency, and interaction. She sees depth in dimensions and from an early age began experiencing retro and pre-cognitions. A near death experience heightened her sensory abilities. Recognizing her natural gifts, a former elite American counter intelligence agent, whom she assisted in writing books, trained her in the art of spycraft and developed her skills in remote viewing, subtle energy perception and engagement. Rather than apply her skills in the government arena, Dawn chose instead to walk the path of creating solutions, services and learning programs to help people and organizations realize their potential.

Internationally published, Dawn has guided clients working with Fox Entertainment, ABC, PBS, Wall Street Journal Online, 2010 Olympics, and many others, including creative artists, entrepreneurs and researchers. By bringing to light that which is for most unseen, Dawn consults on business development, identifies deep drives of engagement, offers insight as a future historian and tools for empowerment that go beyond what traditional counsel has to offer. A faculty member at the Omega Institute, Dawn is also a member of the Association of Humanistic Psychology, the International Society for the Study of Subtle Energies and Energy Medicine, and the Foundation for Mind Being Research.

I have a theory that every person on earth has one superpower, but it's often such a trivial ability that it goes completely unnoticed. My superpower is the ability to enter any mall department store and know exactly which direction to go when seeking the mall entrance. My power, though occasionally of moderate utility, does not lend itself to a catchy superhero name.

If I could see energy at the sub-atomic level, I'd use that power for a hell of a lot more than helping big media companies reach their potential.

The Sarah Connor's Great-Grandparents Chronicles

David Friedman asks a good question:

Why does Skynet keep sending Terminators after Sarah Connor? Or even John Connor, for that matter? Why not go back a hundred years, or two hundred years, and kill her great grandparents? ...

Future John Connor would surely send a human into the past to stop the Terminator from killing his great great grandparents. So how does this person fight against a robot killer in an age when technology is so primitive, using his knowledge from the future? And how does the Terminator blend in? What materials does he use to repair himself when he's been damaged? Over time, as he gets more and more damaged, does he go from glistening machine to steampunk hodgepodge of parts?

I think there’s a lot of potential for period Terminator stories. Maybe there's an 18th Century Ireland Terminator trying to kill Johnny O'Connor before he comes to America. Or a Dark Ages Terminator who’s trying to kill Sarah the bar wench.

Peace Declared Between Myself and Sweden

As it turns out, Sweden did not intentionally declare war on my web server earlier this month. Programmer Daniel Stenberg explains how the international incident happened:

A few years ago I wrote up silly little perl script (let's call it script.pl) that would fetch a page from a site that returns a "random URL off the internet." I needed a range of URLs for a test program of mine and just making up a thousand or so URLs is tricky. Thus I wrote this script that I would run and allow to get a range of URLs on each invoke and then run it again later and append to the log file. It wasn't a fancy script, but it solved my task.

The script was part of a project I got funded to work on, that was improving libcurl back in 2005/2006 so I thought adding and committing the script to CVS felt only natural and served a good purpose. To allow others to repeat what I did.

His script ended up on a publicly accessible web site that was misconfigured to execute the Perl script instead of displaying the code. So each time a web crawler requested the script, it ran again, making 2.6 million requests on URouLette in two days before it was shut down.

Sternberg's the lead developer of CURL and libcurl, open source software for downloading web documents that I've used for years in my own programming. I think it's cool to have helped the project in a serendipitous, though admittedly server destroying, way.

To make it easier for programmers to scarf up URouLette links without international strife, I've added an RSS feed that contains 1,000 random links, generated once every 10 minutes. There are some character encoding issues with the feed, which I need to address the next time I revise the code that builds URouLette's database.

This does not change how I feel about Bjorn Borg.