<?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>David Lynch &#187; ajax</title>
	<atom:link href="http://davidlynch.org/blog/tag/ajax/feed/" rel="self" type="application/rss+xml" />
	<link>http://davidlynch.org/blog</link>
	<description>has a blog</description>
	<lastBuildDate>Fri, 18 Jun 2010 07:37:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Practicing JavaScript with Dilbert</title>
		<link>http://davidlynch.org/blog/2008/01/practicing-javascript-with-dilbert/</link>
		<comments>http://davidlynch.org/blog/2008/01/practicing-javascript-with-dilbert/#comments</comments>
		<pubDate>Mon, 28 Jan 2008 16:53:16 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[dilbert]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://davidlynch.org/blog/2008/01/practicing-javascript-with-dilbert/</guid>
		<description><![CDATA[I discovered that there was a flash widget displaying Dilbert archives in color, back to the start of 2007. Naturally I thought to myself &#8220;aha, there must be an XML data feed somewhere in that!&#8221; Some light flash-decompilation later, I discovered that I was right. I then seized on this as a learning opportunity, and [...]]]></description>
			<content:encoded><![CDATA[<p>I 
<a  href="http://dilbertblog.typepad.com/the_dilbert_blog/2008/01/dilbert-widget.html">discovered</a> that there was a 
<a  href="http://widget.dilbert.com/">flash widget</a> displaying Dilbert archives in color, back to the start of 2007.</p>
<p>Naturally I thought to myself &#8220;aha, there must be an XML data feed somewhere in that!&#8221;  Some light flash-decompilation later, I discovered that I was right.</p>
<p>I then seized on this as a learning opportunity, and wrote a much better viewer, in boring old JavaScript.  Why is it better?  Because it doesn&#8217;t require Flash, and is not limited to one panel at a time, that&#8217;s why.</p>
<p>
<a  href="http://davidlynch.org/toys/dilbert/">My Dilbert viewer, can you view it?</a></p>
<p>Caveats:<br />
1. It&#8217;s perfect in Firefox3 and Safari.  Sundays aren&#8217;t <em>quite</em> right in IE7; the first and last buttons are missing in Opera.  All else is untested.<br />
2. For some reason, the widget seems to get different feeds for the last week or two, which means this viewer is a week behind.  I suspect user-agent sniffing, but have not yet been motivated to work out what a flash-player&#8217;s user-agent is.</p>
<p>Things learned:<br />
1. Cross-domain xmlhttprequest requiring a proxy is a pain, and has no obvious benefit.<br />
2. 
<a  href="http://www.jquery.com">jQuery</a> is still awesome.<br />
3. Forgetting to take out debug statements that rely on FireBug when uploading is dumb of me.<br />
4. Decompiling these things is complex &#8212; the embed code provided loads a .swf, which loads a .swf, which finally loads the actual widget that displays the comics.</p>
<p><ins>Update: I worked out the cause of the weird out-of-sync-ness I observed between the data files I received and the content seen in the official widget.  The lesson is not to trust the data feed when it tries to tell you which domain to look at; it includes a &lt;Domain&gt; tag, which seems like a perfect complement to the domain-less URLs given in the strip descriptions.  However, that domain contains files that are several weeks out of date.  So I just hardcoded the &#8220;real&#8221; URL.</ins></p>
<p><ins>They finally released this stuff to the main Dilbert site, so I just went through and fixed up the viewer to use the appropriate new feed format.  Darn changes.</ins></p>
]]></content:encoded>
			<wfw:commentRss>http://davidlynch.org/blog/2008/01/practicing-javascript-with-dilbert/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
