Categories
Photography

Sun break

sandpoint1

sandpoint2

sandpoint3

Categories
Just Shelley Photography

From a Train Window

Spending two days on a train is an interesting experience, one that could be improved by spending the extra money for a sleeper. No matter how comfortable the coach chairs are, they are not conducive to sleep.

I had a chance to see Illinois’ fall colors on the trip from St. Louis to Chicago. It was a lovely day and the view was wonderful. It was during this portion of the trip that I found out train personnel are very strict regarding baggage. One mentioned weighing my pullman bag until he hefted and then said it would be fine. Note: if you travel by train, don’t fudge your baggage; not when fuel is so costly and the railroads are barely scraping by. If the bag was overweight, I don’t know if the attendant would have started chucking my clothes out the window.

I spent four hours in Chicago waiting my next train. A red cap at Union Station helped me get my bags to lockers, and then retrieved me and the baggage for the next trip. If you ever need a red cap at Union Station in Chicago, I recommend Phil.

Baggage checked, I had three hours to look around, and it was a perfect fall day: cool, sunny, colorful. I had a marvelous time walking up and down canal street. At one point I passed a bunch of trailers for a movie, but I couldn’t see anyone about.

Back at the train station, I decided to go into the large, open room called the Great Room, but it was blocked off. The Clint Eastwood WWII movie, Flags of our Fathers, was being filmed in Chicago, including scenes at the train station. The Great Room had been re-decorated until it resembled its 1940’s self. The security guards were very nice, answering my questions, and letting me take photos from the doorway. I didn’t see anyone in period clothing, so assumed they were probably on break. Too bad—I would have liked to have seen Eastwood.

High, and not so high, lights of the trip:

Good: Having a chance to spend a few hours with the friendly folk in Chicago–not to mention seeing that great downtown.

Good: Spending 1/2 hour waiting for a train with about 30 Amish people, as one group of Amish ran into another group of Amish and exchanged details of their lives. Some English was used.

Bad: Finding out that the Amish are suspicious of outsiders and not particularly friendly.

Good: Train was half empty so I had my two seats to myself.

Bad: When you’re a tad over 5’11”, you cannot fold yourself into two train seats. No, not even when you do that.

Good: The homemade beef pot pie in the dining room was excellent.

Bad: Being seated with three complete strangers in close quarters in the dining car. More, three strangers who look aghast at you when you order a beer for dinner.

Good: The old cars dumped down hills here and there. You wouldn’t think junk could be beautiful, but it is. Especially the rusted out Model T laying on the hillside in North Dakota.

Bad: Seeing so many small, deserted towns along the way, as corporations buy out small farmers and ranchers. One town was completely empty, but strikingly preserved except for the grass growing along the street and a couple of range cows grazing on it.

Bad: Not having enough time to get the camera ready when an exceptionally fascinating view comes along, such as the abandoned town, the Model T, and a wolf in Montana.

Good: Having a chance to see the abandoned town, the Model T, and the wolf, regardless of getting a picture or not.

Good: Being able to walk about, stretch, gaze out the window.

Bad: Trying to sleep sitting up.

Good: The sound, the motion, the feel of being on a train. It is unique.

Bad: One train attendant who was rather offensive with the pretty, young women.

Good: The train conductor who helped me off with my bags at Sandpoint. He answered all my train questions with enthusiasm and delight. It is rare to meet someone so completely and absolutely in love with their work.

Good: Having so much to see that you never get bored.

Best moment: The pass coming from Glacier, Montana to Sandpoint.

The pass is normally completely dark. I was half asleep and reading when I noticed a ghostly blue light around the track ahead of us. Through the fog, a phosphorescent glow silhouetted several train cars lying scattered about—up the hill, down a cliff—in a scene that looked straight out of The Shining.

I asked the conductor about the lights and he said the cars were from a derailed train carrying grain and hadn’t been recovered yet. The lights placed around the cars were to keep away the bears who were attracted to the wet and fermenting corn. The bears would eat the corn, and then pass out on the tracks.

Flags of our Fathers

chicagoandunion

barnbw

train2

Categories
Technology Web

Accessing the Newsgator API within PHP

One of the programming jobs I’ve had recently was to provide PHP functions to access the Newsgator SOAP API; hiding as much of the SOAP bits as possible. I used the nuSOAP PHP library as the basis for my work. Though SOAP functionality is built into PHP 5, my client, like most people, are still using PHP 4, and nuSOAP has a very clean implementation.

For those who might want to give the API a shot, I’ll walk through some sample code that should be easily modified as interested. I had hoped to write a more complete application, but have ran out of time.

The Newsgator API requires an account in order to test the code, but you can sign up for one at no charge. When you get an account, you’re given an online Newsgator Location in which to add subscriptions. You’re also given the ability to create new locations, as well as folders, and to subscribe to and read, syndication feeds. The API itself is split into five main categories for the five SOAP endpoints: Locations, Folders, Subscriptions, Feeds, and Posts.

Each SOAP engpoint page lists the web service methods for the specific item, including a description of the parameters and values returned. An important element when looking at the page is to find a link to the endpoint at the bottom. Clicking on it opens a window asking for the account username and password. Once you enter these, the endpoint page opens, containing links for each of the methods.

Clicking on a method link opens up another page, usually containing a form, and an example SOAP request and response. These latter are essential in order to determine the values used with nuSOAP. You can also test the web service by typing values into the form and invoking the method. If, that is, the parameters are simple values rather than programmatic structures, such as arrays.

Once you’ve looked through the API methods to see what parameters are needed, and explored the actual SOAP request and response, it’s just a matter of plugging in values within the nuSOAP functions. To demonstrate, I’m going to walk through a program that creates a SOAP client, queries the service for all subscriptions for a given location, and then accesses and prints out links to the individual items for the subscriptions.

In the program, I first create a SOAP client using the appropriate endpoint, checking for any error afterwards. (Complete source code is provided later, so no worries about any gaps in the code):

// create SOAP client
$client = new soapclient(”http://services.newsgator.com/ngws/svc/Subscription.asmx”);
$err = $client->getError();
if ($err) {
err($client,$err);
die();
}

I’m not using a proxy or WSDL, so no other parameters other than the endpoint are set.

Next, I define the method’s parameters, in this case a location string and a synchronization token. This latter value is used to synchronize the data between method calls, and in the results you’ll see this returned as part of the response. Using this provided synch value in the next method call ensures that the data, such as the count of unread items for each subscription, is fresh.

// set parameters
$params = array(
‘location’ => $location,
’syncToken’ => $synctoken
);

During the initial web service request, the synch token is blank.

Once the method parameters are set, I added code to authenticate the user:

// authenticate against the service
$client->setCredentials($user, $pass,’basic’);

Note that this uses example uses BASIC authentication; Newsgator also supports DIGEST authentication.

The Newsgator API token is passed in a SOAP header, which I build manually next. Note that the token must be authenticated with the service, so you’ll need to specify the appropriate service namespace:

// create SOAP header for Newsgator API
$hdr = “<ng:NGAPIToken xmlns:ng=’http://services.newsgator.com/svc/Subscription.asmx’>
<ng:Token>$token</ng:Token></ng:NGAPIToken>”;

Finally, we can now invoke the service:

// invoke SOAP service
$result = $client->call(’GetSubscriptionList’, $params,’http://services.newsgator.com/svc/Subscription.asmx’,
‘http://services.newsgator.com/svc/Subscription.asmx/GetSubscriptionList’,
$hdr,false, ‘rpc’,’literal’);

// check for error
if ($client->fault) {
echo ‘<h2>Fault</h2><pre>’; print_r($result); echo ‘</pre>’;
} else {
$err = $client->getError();
if ($err) {
echo ‘<h2>Error</h2><pre>’ . $err . ‘</pre>’;
}
}

In this function call, the SOAP method is the first parameter, followed by the parameters, the SOAP endpoint (namespace), the SOAP action, the manually created header, the serialization style (’rpc’), and the serialization for the parameters (’literal).

The nuSOAP function processes any XML returned as multi-dimensioned arrays. With this service call, the subscriptions are returned as OPML, values of which you can access by walking through the array:

// decipher the array, based on OPML
$opml = $result[”opml”];
$body = $opml[”body”];
$outline = $body[”outline”];
$syntoken = $opml[”!ng:token”];
foreach ($outline as $key => $sub) {
$feed = $sub[”!ng:id”];
$title = $sub[”!title”];
$url = $sub[”!htmlUrl”];
echo “<a href=’$url’>$title</a><br />”;
}

After each subscription is accessed, the feed identifier ($feed) is then used to invoke another service to get the news for the feed. The complete application demonstrates this.

Categories
Weblogging

Truth hurts

Recovered from the Wayback Machine.

There are a lot of people upset at a Forbes Magazine cover story on weblogs (free and easy registration required). Of course, it seeks to generate heat by the lead-in, which is inflammatory to say the least:

Web logs are the prized platform of an online lynch mob spouting liberty but spewing lies, libel and invective. Their potent allies in this pursuit include Google and Yahoo.

Oddly enough, this statement could be something found in weblogs, where broad strokes of the brush are used to define any number of subjects. However, as we all know, weblogs are many things, and sometimes they’re full of lies pretending to be truth; other times they’re truth pretending to be lies.

According to the article:

But if blogging is journalism, then some of its practitioners seem to have learned the trade from Jayson Blair. Many repeat things without bothering to check on whether they are true, a penchant political operatives have been quick to exploit. “Campaigns understand that there are some stories that regular reporters won’t print. So they’ll give those stories to the blogs,” says Christian Grantham, a Democratic consultant in Washington who also blogs. He cites the phony John Kerry/secret girlfriend story spread by bloggers in the 2004 primaries. The story was bogus, but no blogger got fired for printing the lie. “It’s not like journalism, where your reputation is ruined if you get something wrong. In the blogosphere people just move on. It’s scurrilous,” Grantham says.

And though they have First Amendment protection and posture as patriotic muckrakers in the solemn pursuit of truth, the blog mob isn’t democratic at all. They are inclined to crush dissent with the “delete” key. When consultant Nick Wreden criticized credit card banking giant MBNA on his blog, a reader responded in support of MBNA. Wreden zapped the comment. “I just thought: ‘This has to be a plant,’” he says.

Where is the lie in this? I have seen, time and again, webloggers repeat even the most unbelievable stories as truth; and they do so without batting an eye. As for our ‘openness’ — I don’t think we have to go back over five plus years of discussing how disagreement is ignored, and links are used as rewards for the faithful to provide proof of this allegation. The very fact that I can agree with certain points in the Forbes article will almost guarantee that none of the outraged pundits will acknowledge that this post, and my contrarian viewpoint, exist.

Regardless, many webloggers do have unwritten agendas when they write on particular issues, people, and organizations. Many webloggers do stretch the truth and accuse without facts. Many webloggers do have an interest in causing harm, and don’t accept accountability for their actions.

Let’s be honest: webloggers can be evil–just like everyone else. Am I concerned about being lumped in with the “Do no Good” webloggers? Not a bit–my writing is here to read, and will either stand, or fall, on it’s own. If I don’t go around telling people I’m a weblogger, it’s not because of the article; I didn’t go around telling people I was a weblogger before it was published.

(I’m personally thinking of printing up “Member of the Burningbird Weblogging Mob” t-shirts. Anyone want to be a Burningbird Weblogging Mob Member? We’ll have a secret handshake, magic decoder ring, and rituals where we howl at the moon, while sticking pins into iVoodoos, the new Apple product– complete with easily scratchable surface, by design.)

As for the overall condemning nature of the article–it got attention, didn’t it?

What I don’t understand is why the pundits think this article is harmful. Forbes has issued a wakeup call that will make companies pay attention to weblogs in a way that all of the “markets are conversation” cheerleading hasn’t been able to accomplish. We wanted them to pay attention to us; now they are.

All in all, I found the article to be an entertaining read.

Categories
RDF Technology

The Wordform/WordPress metaform

Time to start releasing some code.

The Metaform RDF extension and plugins are finally really for beta use.

The Metaform Extension creates a new page in your WordPress weblog that provides a home for all metadata extensions. You’ll also need to add a few lines to your wp-configure.php file and a couple of your templates. The install.txt file has installation instructions.

Included in the installation is a stripped down version of RAP: RDF API for PHP. This should work in PHP 4.3 and up, and will require no other external libraries.

The first plugin is the Links Plugin, which will parse out hypertext links in a post and store them as RDF data. This then can be used to add a link list to your syndication feed or your post, or however else you want to use the data. Again, follow the instructures in install.txt to use it.

I plan to finish packaging a few others for release tonight. My hope is, though, that the Metaform infrastructure will encourage a whole host of RDF-based plugins; using those I’ve created as templates and expanding in ways I haven’t imagined. Regardless, the extension and the plugins do demonstrate that RDF isn’t just for large, esoteric applications requiring a host of PhDs to create.

A few weeks ago the discussion about RDF focused on how complex it is, how hard it is to use; how difficult it is to use in hacking, or for creating simple applications. What Metaform demonstrates is that RDF can be hackable, simple, and immediately useful. It may not be as sexy as Web 2.0, but it is real.

The SeeAlso Plugin allows you to add one or more external references to a post, and have a list of these printed out in the page and/or syndicated feed. Follow the install.txt for how to install.

The Photo plugin accesses the Flickr API to gather metadata about a Flickr embedded photo in the post. The data is then output via a link, added by plugin.

A future version will have access to Google maps, and processing of XMP data.