Over the past few months, I've gotten back into contact with more than a dozen old friends and coworkers through Facebook. After blogging for nine years, I prefer hanging out here on Workbench over social networking sites, but I'm beginning to feel like an anachronism. It's easier for people to keep up with their BFFs on sites like Facebook than to visit a bunch of personal blogs, even with the help of RSS and a feed reader. I recently began linking my posts on Facebook using Simplaris Blogcast, a Facebook application that posts the title and link of blog posts to your Facebook profile. You can manually post items from your blog, pull them automatically from an RSS feed or ping Simplaris with each new post.
For reasons unknown, Simplaris Blogcast stopped pulling items automatically from my feed a month ago. To get automatic posts working again, I've updated my weblog ping library for PHP so that it can ping Blogcast each time I post on Workbench.
Blogcast uses the same ping protocol as Weblogs.Com. Before you can use the Weblog-Pinger library in a PHP script, you must add Blogcast to your Facebook account and retrieve your ping info, which includes a ping URL that includes a special ID unique to your account. In the example URL http://blogcast.simplaris.com/ping/0dd8dfad5c842b600091ba/, the ID is 0dd8dfad5c842b600091ba. You'll need this ID when sending a ping, as in this example code:
require_once('weblog_pinger.php');
$pinger = new Weblog_Pinger();
$pinger->ping_simplaris_blogcast($post_title, $post_link, "0dd8dfad5c842b600091ba");
Once Blogcast has successfully received a ping, the application setting Update Mode will have the Ping Automatic selection chosen.
The code's available under the open source GPL license. If it worked, this post will show up on my Facebook profile.
On late-night television in Utica, N.Y., leather store salesman Charlie Celi went off the script in November to share his opinion on the state's politicians. Celi, who handles marketing for Forever Leather at the Sangertown Square shopping center in New Hartford, N.Y., flew into a Howard Beale-style rant against former Gov. Eliot Spitzer and departing Sen. Hillary Clinton.
"If Spitzer wasn't out there poppin' chicks like bon bons, maybe we'd be a little better," Celi says in an ad that has made its way to YouTube. "The people in upstate New York always gettin' the short end of the freakin' stick," he continued, directing his next comments directly to the politicians: "You all suck. ... Hillary Clinton, thanks for nothin'."
In an earlier ad, Celi shares his opinion on dog urine and cigarette butts in the streets of Herkimer, N.Y.
"There's a nice smell of dog urine all down Main Street," he observes. "I'd like to see something done and I'm not alone. ... I'm not turning my back on Herkimer. I love Herkimer."
In another spot he addresses price-gouging gas companies, specifically calling out Nice N Easy convenience stores.
"These gas people. They've been hosin' us, hosin' us, for a year when we were down," Celi says. "The scumbag Nice N Easy people -- I say scumbag, that's a harsh word -- ratballs is a better one! ... Did you have a good time, because someday you're going to pay for what you did. Pisses me off."
Celi has been holding court on local television since 1989, his son Patrick told me in a phone interview Tuesday. Forever Leather's a family-owned business, and the company began buying blocks of late-night time for half-hour infomercials in the '90s. "We never plan them out," Patrick Celi said. "We used to do them once a month." The rant against politicians inspired a call from the mayor of Rome, N.Y., and some suggestions from the public that Charlie Celi run for office. He's a political independent who isn't interested in doing that, his son said.
"It has been said to me that I'm quick with the tongue," Charlie Celi acknowledges in one ad. "There's people out there pretty mad at me right now for things I said. I didn't mean it. I just get mad."
For 30 minutes Saturday morning, Google displayed the warning "this site may harm your computer" with all search results, including its own home page. Normally, the warning only appears on sites that Google suspects to be infected with malicious programs such as viruses. A data error flagged every site on the web as potentially harmful, as thousands of people noted on Twitter.
The situation became so desperate that people began using Yahoo Search.
Even though the problem lasted just a half-hour, that was enough time for the conservative blog American Thinker to uncover a vast left-wing conspiracy. In a story headlined "Google Blocks Conservative Web Sites," Rick Moran writes:
The blocks appear to be temporary -- more a nuisance than a threat. But this morning, websites for the Republican National Committee, Real Clear Politics, and Pajamas Media were all blocked with the caption:
Warning -- visiting this web site may harm your computer! ...
The potential for this gigantic corporation to game the free flow of information to suit its own ideological ends is frightening. Everyone -- liberals and conservatives -- should be concerned when ideological attacks like this take place.
Since the problem affected billions of pages in Google's search database, it appears that the writers at American Thinker don't get out much beyond right-wing sites. Color me shocked.
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:
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.
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.
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.
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.