<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Software and Opinions &#187; feedburner</title>
	<atom:link href="http://ianloic.com/tag/feedburner/feed/" rel="self" type="application/rss+xml" />
	<link>http://ianloic.com</link>
	<description>from Ian McKellar</description>
	<lastBuildDate>Thu, 19 Nov 2009 22:05:43 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Out with the old, in with the goo(gle)</title>
		<link>http://ianloic.com/2007/05/21/out_with_the_old_in_with_the_google/</link>
		<comments>http://ianloic.com/2007/05/21/out_with_the_old_in_with_the_google/#comments</comments>
		<pubDate>Wed, 30 Nov -0001 00:00:00 +0000</pubDate>
		<dc:creator>Ian McKellar</dc:creator>
				<category><![CDATA[Default]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[feedburner]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[rss]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[[flickr-photo:id=28961855,size=m] Some time ago I reworked my <a href="http://ian.mckellar.org/">home page</a> to feature content from various other sites I post to (blogs, flickr, delicious) by using some JSON tricks to pull in their feeds. I <a href=""http://ianloic.com/making_dynamic_static_pages>blogged</a> about how to do this with Feedburner's JSON API, so that my actual page was just static HTML and all the work was done client-side.

Last week I decided to revisit this using Google's new <a href="http://code.google.com/apis/ajaxfeeds/">AJAX feeds API</a>. <a href="http://www.feedburner.com">Feedburner</a>'s API never seemed to be well supported (it came out of a <a href="http://blogs.feedburner.com/feedburner/archives/2007/01/hackathon_episode_iv_a_new_hac.php">hackathon</a>) and it forced me to serialize my requests. In the process I neatened up a bunch of the code.
]]></description>
			<content:encoded><![CDATA[<p>Some time ago I reworked my <a href="http://ian.mckellar.org/">home page</a> to feature content from various other sites I post to (blogs, flickr, delicious) by using some JSON tricks to pull in their feeds. I blogged about how to do this with Feedburner&#8217;s JSON API, so that my actual page was just static HTML and all the work was done client-side.</p>
<p>Last week I decided to revisit this using Google&#8217;s new <a href="http://code.google.com/apis/ajaxfeeds/">AJAX feeds API</a>. <a href="http://www.feedburner.com">Feedburner</a>&#8217;s API never seemed to be well supported (it came out of a <a href="http://blogs.feedburner.com/feedburner/archives/2007/01/hackathon_episode_iv_a_new_hac.php">hackathon</a>) and it forced me to serialize my requests. In the process I neatened up a bunch of the code.</p>
<p>Google&#8217;s API is pretty straight-forward. It uses a loader model that is similar to <a href="http://dojotoolkit.org">Dojo</a>&#8217;s dojo.require, so you load the main Google library:</p>
<pre class="prettyprint">
&lt;script src="http://www.google.com/jsapi?key=YOURAPIKEY"
  type="text/javascript"&gt;&lt;/script&gt;</pre>
<p>and then ask it to load their feed library:</p>
<pre class="prettyprint">
google.load('feeds', '1');</pre>
<p>They have a handy way of setting a callback to be called when the libraries are loaded:</p>
<pre class="prettyprint">
google.setOnLoadCallback(function () { /* just add code */ });</pre>
<p>By putting all three of these together we have a straight-forward way to execute code at the right time.</p>
<p>I refactored the code that inserts the feed data into the page a lot. I fleshed out the concept of input filters from simply filtering the title to filtering the whole item objects. This allows for a more flexible transformation from the information that is presented in the RSS feeds to information that I want to present to visitors to my page. In practice I only used it to remove my name from Twitter updates. Instead of hard-coding the DOM node creation like I did in the previous version of the code I moved to a theme model. The theme function takes a feed entry and returns a DOM node to append to the target DOM node.</p>
<p>The flexibility of Google&#8217;s API let me abandon my separate code path for displaying my <a href="http://www.flickr.com/">Flickr</a> images. Previously I used Flickr&#8217;s own JSON feed API but since Google&#8217;s feed API supports returning RSS extensions I used the Flickr&#8217;s MediaRSS compliant feeds to show thumbnails and links. They even provide a handy cross-browser implementation of getElementsByTagNameNS (google.feeds.getElementsByTagNameNS) for us to use.</p>
<p>I&#8217;m tempted to write a client-side implementation of <a href="http://adactio.com/">Jeremy Keith</a>&#8217;s <a href="http://adactio.com/journal/1202/">lifestream</a> thing using this API.</p>
<p>Take a look at the code running on my <a href="http://ian.mckellar.org">home page</a> or check out the <a href="http://ian.mckellar.org/feeds.js">script</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://ianloic.com/2007/05/21/out_with_the_old_in_with_the_google/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Making dynamic static pages</title>
		<link>http://ianloic.com/2007/03/05/making_dynamic_static_pages/</link>
		<comments>http://ianloic.com/2007/03/05/making_dynamic_static_pages/#comments</comments>
		<pubDate>Wed, 30 Nov -0001 00:00:00 +0000</pubDate>
		<dc:creator>Ian McKellar</dc:creator>
				<category><![CDATA[Default]]></category>
		<category><![CDATA[feedburner]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[rss]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[UPDATE: I changed how this works and blogged about it.
I wanted my home page to reflect what was going on in my life, or at least what content I was generating. There&#8217;s the concept of a lifestream floating around at the moment, but I was happy just to have a few sources (a couple of [...]]]></description>
			<content:encoded><![CDATA[<p><strong>UPDATE: I changed how this works and <a href="http://ianloic.com/out_with_the_old_in_with_the_google">blogged about it</a></strong>.<br />
I wanted my <a href="http://ian.mckellar.org/">home page</a> to reflect what was going on in my life, or at least what content I was generating. There&#8217;s the concept of a lifestream floating around at the moment, but I was happy just to have a few sources (a couple of blogs, my bookmarks, my twitters and my flickr stream) shown, split out my source. The catch was I wanted to do it without implementing a web service to back it.</p>
<p>If you want to pull content from a bunch of different servers without writing any server-side code your only options are Flash and JSON. They&#8217;re both ways of getting around the web security model that&#8217;s protected us for so long. Flash is kind of complicated, requires proprietary, expensive tools to work with while JSON comes for free.  The idea behind JSON is that we can use the browser&#8217;s <code language="html"><script src="..."></script></code> tag to load a script from another serve that contains data encoded as JavaScript data structures rather than code.</p>
<p>A few key services like <a href="http://www.flickr.com/">Flickr</a> and <a href="http://del.icio.us/">del.icio.us</a> offer JSON versions of their feeds, but most do not. In steps <a href="http://www.feedburner.com/">FeedBurner</a> who in January <a href="http://blogs.feedburner.com/feedburner/archives/2007/01/hackathon_episode_iv_a_new_hac.php">added a JSON version</a> of the feeds they serve, and since you can ask FeedBurner to host any feed you please we can use them as our high-availability, standardizing, caching feed proxy. I\&#8217;d <a href="http://ianloic.com/drupal_feedburner">already</a> set up FeedBurner for this blog, so I just added feeds for my <a href="http://loic.livejournal.com/">LiveJournal</a> and <a href="http://www.twitter.com/ian_mckellar">twitter</a> accounts and looked up how to get access to the JSON feeds for my <a href="http://www.flickr.com/photos/ianloic/">Flickr</a> and <a href="http://del.icio.us/ianloic">del.icio.us</a> accounts.</p>
<p>When you call a JSON script you can often pass in the name of a callback function to be called when the data is returned. I wrote a simple one to process a JSON response from FeedBurner and turn some of the most recent items into HTML list items:</p>
<pre class="prettyprint">
var max_items = 3;
var target = null;
var filter = null;
function fb(o) {
  if (!target) return;
  for (var i=0; i&lt;o.feed.items.length &amp;&amp; i&lt;max_items; i++) {
    var item = o.feed.items[i];
    var li = document.createElement('li');
    var a = document.createElement('a');
    if (!item.title) item.title = item.date;
    if (filter) item.title = filter(item.title)
    a.appendChild(document.createTextNode(item.title));
    a.setAttribute('href', item.link);
    li.appendChild(a);
    target.appendChild(li);
  }
}</pre>
<p>The function depends on a couple of external variables that are set before the JSON feed is called. They are <code>target</code>, the DOM object to append the list items to and <code>filter</code> an optional function to post-process titles. I had to add <code>filter</code> since my twitter feed comes back a little weird.</p>
<p>Getting the most recent posts from this blog into a bullet list is now pretty straight-forward:</p>
<pre class="prettyprint">
&lt;ul id="ianloic-list" /&gt;
&lt;script type="text/javascript"&gt;
target = document.getElementById('ianloic-list');
&lt;/script&gt;
&lt;script type="text/javascript"
src="http://api.feedburner.com/format/1.0/JSONP?uri=ianloic&amp;callback=fb"&gt;
&lt;/script&gt;</pre>
<p>Getting my LiveJournal in was identical and twitter just required me to write a filter function to chop up the title a little and do some unescaping. For some reason the twitter feed is both HTML entity encoded and JavaScript string escaped when I get it back from FeedBurner.</p>
<p>Flickr and del.icio.us each require some custom code since I want to handle each of them specially. For del.icio.us I link to the tag pages of each tag on each bookmark and for Flickr I embed a thumbnail for each image. Take a look at the source code of <a href="http://ian.mckellar.org/">ian.mckellar.org</a> to see how that&#8217;s done or drop me if you&#8217;d like more explanation.</p>
]]></content:encoded>
			<wfw:commentRss>http://ianloic.com/2007/03/05/making_dynamic_static_pages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Burning your Drupal feed in two easy steps</title>
		<link>http://ianloic.com/2007/03/04/burning_your_drupal_feed_in_two_easy_steps/</link>
		<comments>http://ianloic.com/2007/03/04/burning_your_drupal_feed_in_two_easy_steps/#comments</comments>
		<pubDate>Wed, 30 Nov -0001 00:00:00 +0000</pubDate>
		<dc:creator>Ian McKellar</dc:creator>
				<category><![CDATA[Default]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[feedburner]]></category>
		<category><![CDATA[rss]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[[flickr-photo:id=136409681,size=m] <a href="http://www.feedburner.com/">FeedBurner</a> provides all kinds of neat stats, but it didn't seem straight-forward to "burn" my blog feed since I'm using <a href="http://www.drupal.org/">Drupal</a> 5. After a little fiddling I think I've got a pretty good idea how to make it work in probably the simplest way possible. In fact, it doesn't require and Drupal configuration at all.

<ol>
<li>First I set up a <a href="http://www.feedburner.com/">FeedBurner</a> account and burned my feed. The feed Drupal produces for me is: <code>http://ianloic.com/rss.xml</code>. Now when I access http://feeds.feedburner.com/ianloic I get the contents of that feed. It's pretty simple, but so far nobody is going to see that feed.</li>
<li>Then I simply told Apache to redirect all requests for that feed, except the ones from the FeedBurner bot to my FeedBurner feed. With the slight of hand magic of <a href="http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html">mod_rewrite</a> this is pretty straight forward. In the root of every Drupal install there's an <code>.htaccess</code> file containing a bunch of stuff. I just added a few lines to the <code>mod_rewrite.c</code> block of that file:<pre>
  # Rewrite rss.xml to http://feeds.feedburner.com/ianloic
  # unless FeedBurner is requesting the feed
  RewriteCond %{HTTP_HOST} ^ianloic\.com$ [NC]
  RewriteCond %{HTTP_USER_AGENT} !FeedBurner.*
  RewriteRule ^rss.xml$ http://feeds.feedburner.com/ianloic [L,R=301]</pre>
This will cause Apache to send a 301 redirect to <code>http://feeds.feedburner.com/ianloic</code> any time anyone requests <code>http://ianloic.com/rss.xml</code>, unless their HTTP User Agent begins with <code>FeedBurner</code>.</li>

Now I've got access to all the FeedBurner statistics and fun features. Since I didn't actually touch the Drupal configuration I'm pretty sure a similar approach can be taken to applying FeedBurner to any feed.</ol>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.feedburner.com/">FeedBurner</a> provides all kinds of neat stats, but it didn&#8217;t seem straight-forward to &#8220;burn&#8221; my blog feed since I&#8217;m using <a href="http://www.drupal.org/">Drupal</a> 5. After a little fiddling I think I&#8217;ve got a pretty good idea how to make it work in probably the simplest way possible. In fact, it doesn&#8217;t require and Drupal configuration at all.</p>
<ol>
<li>First I set up a <a href="http://www.feedburner.com/">FeedBurner</a> account and burned my feed. The feed Drupal produces for me is: <code>http://ianloic.com/rss.xml</code>. Now when I access http://feeds.feedburner.com/ianloic I get the contents of that feed. It&#8217;s pretty simple, but so far nobody is going to see that feed.</li>
<li>Then I simply told Apache to redirect all requests for that feed, except the ones from the FeedBurner bot to my FeedBurner feed. With the slight of hand magic of <a href="http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html">mod_rewrite</a> this is pretty straight forward. In the root of every Drupal install there&#8217;s an <code>.htaccess</code> file containing a bunch of stuff. I just added a few lines to the <code>mod_rewrite.c</code> block of that file:
<pre class="prettyprint">
  # Rewrite rss.xml to http://feeds.feedburner.com/ianloic
  # unless FeedBurner is requesting the feed
  RewriteCond %{HTTP_HOST} ^ianloic\.com$ [NC]
  RewriteCond %{HTTP_USER_AGENT} !FeedBurner.*
  RewriteRule ^rss.xml$ http://feeds.feedburner.com/ianloic [L,R=301]</pre>
<p>This will cause Apache to send a 301 redirect to <code>http://feeds.feedburner.com/ianloic</code> any time anyone requests <code>http://ianloic.com/rss.xml</code>, unless their HTTP User Agent begins with <code>FeedBurner</code>.</p>
<p>Now I&#8217;ve got access to all the FeedBurner statistics and fun features. Since I didn&#8217;t actually touch the Drupal configuration I&#8217;m pretty sure a similar approach can be taken to applying FeedBurner to any feed.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://ianloic.com/2007/03/04/burning_your_drupal_feed_in_two_easy_steps/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
