<?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>The Stem &#187; AJAX</title>
	<atom:link href="http://blog.thestem.ca/archives/category/ajax/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.thestem.ca</link>
	<description>Brett Forsyth's professional work showcase, photos, and ramblings.</description>
	<lastBuildDate>Sat, 04 Apr 2009 20:26:45 +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>Outclicks Pepper hack</title>
		<link>http://blog.thestem.ca/archives/37</link>
		<comments>http://blog.thestem.ca/archives/37#comments</comments>
		<pubDate>Fri, 07 Apr 2006 04:40:08 +0000</pubDate>
		<dc:creator>Brettf</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Web Services]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://blog.thestem.ca/archives/37</guid>
		<description><![CDATA[I have started using Shaun Inman&#8217;s fabulous Mint stats package for about a month and half. It&#8217;s a great app. One of the really cool things about Mint is Pepper, Mint&#8217;s plugin API. There is an emerging Pepper plugin community out there. One Pepper that intrigued me was Outclicks by Andrew Sutherland. It works fantastic [...]]]></description>
			<content:encoded><![CDATA[<p>I have started using <a href="http://www.shauninman.com/plete/">Shaun Inman&#8217;s</a> fabulous <a href="http://www.haveamint.com">Mint</a> stats package for about a month and half. It&#8217;s a great app. One of the really cool things about Mint is Pepper, Mint&#8217;s plugin API. There is an emerging <a href="http://massiveblue.net/pepperminttea/">Pepper plugin community</a> out there. One Pepper that intrigued me was <a href="http://code.jalenack.com/archives/outclicks-pepper/">Outclicks</a> by <a href="http://blog.jalenack.com/">Andrew Sutherland</a>. It works fantastic for any site that is on the main domain of the Mint install.</p>
<p> A problem with it is it does not work on sites reporting to Mint from a subdomain, like mine. The reason for this is Outclicks uses the XMLHTTPRequest object. In Internet Explorer and Firefox&lt;1.5 the XMLHTTPRequest object can not call a page across subdomains. Well never one to let a problem hold me down I created a work around. My work around uses a PHP proxy file placed in the subdomain. The proxy file uses CURL to call the data.php file of the Outclicks Pepper which avoids the XMLHTTPRequest object problem. The other modification is in the Outclicks script.php file to point at the proxy file. Now I suppose I could have just put CURL in the script.php file but I wanted to preserve as much of the Outclicks file as possible. This is not an endorsed solution by Andrew and will likely break or be broken by any future Outclicks release. <a href="http://www.thestem.ca/outclickshack.zip">Download a .zip containing the files.</a></p>
<p><strong>Instructions</strong></p>
<ol>
<li>Download the outclickshack.zip file and uncompress</li>
<li>Open the proxy.php file and modify line ten to point at your Mint install</li>
<li>Upload the proxy.php file to the subdomain you want to start tracking</li>
<li>Upload the script.php file to the /mint/pepper/andrewsutherland/outclicks/ folder replacing the file already there</li>
<li>Your finished!</li>
</ol>
<p>If you have any problems please feel free to contact me through comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thestem.ca/archives/37/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Flickr Google Module Update</title>
		<link>http://blog.thestem.ca/archives/33</link>
		<comments>http://blog.thestem.ca/archives/33#comments</comments>
		<pubDate>Sat, 25 Feb 2006 08:21:00 +0000</pubDate>
		<dc:creator>Brettf</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Web Services]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://blog.thestem.ca/archives/33</guid>
		<description><![CDATA[It has been a while since I messed with my Flickr Google module. This is mostly because I went down a wrong path exploring the NSXL API as a way to inline the module. I have sine found a script that is better suited to my needs (pulling specific data from the XML for later [...]]]></description>
			<content:encoded><![CDATA[<p>It has been a while since I messed with my <a href="http://www.googlemodules.com/module/122/">Flickr Google module</a>. This is mostly because I went down a wrong path exploring the NSXL API as a way to inline the module. I have sine found a <a href="http://xmljs.sourceforge.net/">script</a> that is better suited to my needs (pulling specific data from the XML for later use). Now I have the same Google module mostly up and running as an inline module. This was all so it could take advantage of the Google _IG_FetchContent method, which is blazingly fast. This is going to allow for some great features and enhancements in the near future. Stay tuned.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thestem.ca/archives/33/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Module Example : NXSL API</title>
		<link>http://blog.thestem.ca/archives/25</link>
		<comments>http://blog.thestem.ca/archives/25#comments</comments>
		<pubDate>Fri, 03 Feb 2006 07:58:02 +0000</pubDate>
		<dc:creator>Brettf</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Web Services]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://blog.thestem.ca/?p=25</guid>
		<description><![CDATA[This example will discuss how to use the NXSL API within a google module. The following code imports the NXSL API, uses _IG_FetchContent() to make a REST request of a Flickr service and processes the returned XML document. &#60;script src="http://www.google.com/js/nxsl.1.js" type="text/javascript"&#62;&#60;/script&#62; &#60;script type="text/javascript"&#62; &#160;&#160;_IG_FetchContent('http://www.flickr.com/services/rest/ ?api_key=YourKey&#038;method=flickr.people.findByUsername &#038;username=brettf', function (responseText){ &#160;&#160;&#160;&#160;var nxsl = xmlParse(responseText) &#160;&#160;&#160;&#160;var user_id = [...]]]></description>
			<content:encoded><![CDATA[<p>This example will discuss how to use the <a href="http://www.google.com/apis/homepage/reference.html#NXSL_Ref">NXSL API</a> within a google module.<br />
The following code imports the NXSL API, uses _IG_FetchContent() to make a REST request of a Flickr service and processes the returned XML document.<br />
<code><br />
&lt;script src="http://www.google.com/js/nxsl.1.js" type="text/javascript"&gt;&lt;/script&gt;<br />
&lt;script type="text/javascript"&gt;<br />
&#160;&#160;_IG_FetchContent('http://www.flickr.com/services/rest/<br />
?api_key=YourKey&#038;method=flickr.people.findByUsername<br />
&#038;username=brettf', function (responseText){<br />
&#160;&#160;&#160;&#160;var nxsl = xmlParse(responseText)<br />
&#160;&#160;&#160;&#160;var user_id = xmlParse('&lt;div select="//user" content="@id"&gt;&lt;/div&gt;');<br />
&#160;&#160;&#160;&#160;nxslProcess(nxsl, user_id);<br />
&#160;&#160;&#160;&#160;alert(xmlText(user_id));<br />
&#160;&#160;&#160;};<br />
&#160;&#160;);<br />
&lt;/script&gt;<br />
</code><br />
And the returned Flickr document<br />
<code><br />
&lt;rsp stat="ok"&gt;<br />
	&lt;user id="23687999@N00" nsid="23687999@N00"&gt;<br />
&#160;&#160;&lt;username&gt;Brettf&lt;/username&gt;<br />
&lt;/user&gt;<br />
&lt;/rsp&gt;<br />
</code><br />
<strong>Step 1</strong><br />
Import the NXSL API<br />
<code>&lt;script src="http://www.google.com/js/nxsl.1.js" type="text/javascript"&gt;&lt;/script&gt;</code><br />
<br />
<strong>Step 2</strong><br />
Use <a href="http://www.google.com/apis/homepage/guide.html#Proxy">_IG_FetchContent()</a> to make a REST request to Flickr and setup the function that will process the returned XML document.<br />
<code>&lt;script type="text/javascript"&gt;<br />
&#160;&#160;&#160;&#160;_IG_FetchContent('http://www.flickr.com/services/rest/<br />
?api_key=YourKey&#038;method=flickr.people.findByUsername<br />
&#038;username=brettf', function (responseText){ ...processing code here see step 3...};<br />
);<br />
&lt;/script&gt;</code><br />
<br />
<strong>Step 3</strong><br />
Process the responseText argument with the <a href="http://www.google.com/apis/homepage/reference.html#NXSL_Ref">NXSL API</a>. There are several steps involved in processing the document. They are explained with comments in the code.<br />
<code><br />
function (responseText){<br />
&#160;&#160;&#160;&#160;//Convert the responseText into an DOM data structure<br />
&#160;&#160;&#160;&#160;var nxsl = xmlParse(responseText);<br />
&#160;&#160;&#160;&#160;<br />
&#160;&#160;&#160;&#160;//Create a NXSL template. This is where I had the most difficulty.<br />
&#160;&#160;&#160;&#160;//The template is a XPath expression broken into pieces.<br />
&#160;&#160;&#160;&#160;//This template will be processed into the id attribute of any user tag in the document.<br />
&#160;&#160;&#160;&#160;var user_id = xmlParse('&lt;div select="//user" content="@id"&gt;&lt;/div&gt;');<br />
&#160;&#160;&#160;&#160;<br />
&#160;&#160;&#160;&#160;//Process the template using the data structure created earlier <br />
&#160;&#160;&#160;&#160;nxslProcess(nxsl, user_id);<br />
&#160;&#160;&#160;&#160;<br />
&#160;&#160;&#160;&#160;//Convert the processed template into XML text and display<br />
&#160;&#160;&#160;&#160;alert(xmlText(user_id));<br />
};<br />
</code><br />
You can find the whole module at <a href="http://www.thestem.ca/flickrSearch/nxslExample.xml">http://www.thestem.ca/flickrSearch/nxslExample.xml</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thestem.ca/archives/25/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Google Module Experiences</title>
		<link>http://blog.thestem.ca/archives/24</link>
		<comments>http://blog.thestem.ca/archives/24#comments</comments>
		<pubDate>Thu, 02 Feb 2006 23:36:37 +0000</pubDate>
		<dc:creator>Brettf</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Web Services]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://blog.thestem.ca/?p=24</guid>
		<description><![CDATA[I have been messing with Google modules recently. The first module I wrote, Flickr Search, was an external content module using AJAX and PHP to do Flickr searches based on username or tags. That module is getting a complete overhaul. The new one will be inlined and use the built in Google functions to retrieve [...]]]></description>
			<content:encoded><![CDATA[<p>I have been messing with <a href="http://www.google.com/apis/homepage/">Google modules</a> recently. The first module I wrote, <a href="http://www.googlemodules.com/module/122/">Flickr Search</a>, was an external content module using AJAX and PHP to do <a href="http://www.flickr.com">Flickr</a> searches based on username or tags. That module is getting a complete overhaul. The new one will be <a href="http://www.google.com/apis/homepage/guide.html#Inlining">inlined</a> and use the built in Google functions to retrieve Flickr data. I will be posting a small tutorial on how to use the Google Homepage API as their examples are slim and I want to save people some of the frustrations I had. Stay tuned.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thestem.ca/archives/24/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google homepage module</title>
		<link>http://blog.thestem.ca/archives/22</link>
		<comments>http://blog.thestem.ca/archives/22#comments</comments>
		<pubDate>Thu, 22 Dec 2005 17:46:29 +0000</pubDate>
		<dc:creator>Brettf</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Web Services]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://blog.thestem.ca/?p=22</guid>
		<description><![CDATA[I cleaned up the Flickr Search page so that it will fit nicely into a google homepage module. The module xml file is at http://www.thestem.ca/flickrSearch/flickrSearch.xml. Go to Google Homepage for info on setting up custom modules. If I get around to it I would like to inline the module and build a del.icio.us module that [...]]]></description>
			<content:encoded><![CDATA[<p>I cleaned up the Flickr Search page so that it will fit nicely into a google homepage module. The module xml file is at http://www.thestem.ca/flickrSearch/flickrSearch.xml. Go to <a href="http://www.google.com/ig">Google Homepage</a> for info on setting up custom modules. If I get around to it I would like to inline the module and build a del.icio.us module that talk to each other.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thestem.ca/archives/22/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AJAX widgets</title>
		<link>http://blog.thestem.ca/archives/20</link>
		<comments>http://blog.thestem.ca/archives/20#comments</comments>
		<pubDate>Tue, 20 Dec 2005 20:21:20 +0000</pubDate>
		<dc:creator>Brettf</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Web Services]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://blog.thestem.ca/?p=20</guid>
		<description><![CDATA[A small example of using the Flickr API with AJAX to create an image search viewer.]]></description>
			<content:encoded><![CDATA[<p>I know that AJAX is all the rage and there are a million examples out there but I thought I would share my experiment. The goal was to explore web services and AJAX at the same time. This was all to be used as teaching material for one of my classes. </p>
<p>
I decided to try out the Flickr services because they have interested me for a while. After reading a bunch about the Flickr API and the ways of connecting to it with php, I created a simple REST query page, using CURL, that can retrieve Flickr photos based on your user name or a general search term. In the class I covered the REST query page with the student. His task was to extend the example by adding the ability to query by username or general term in the same interface and to create a paging 9&#215;9 grid of images. The student in the class had prior experience with AJAX so we used <a href="http://twilightuniverse.com/2005/05/sack-of-ajax/">SACK</a> to do all of the dirty work for us. </p>
<p>
I fixed some bugs in his submission to get everything mostly working across the big 3 (IE,Firefox,Safari). I say mostly because the dynamically set id&#8217;s of the images and number links don&#8217;t get CSS rules applied in IE but ah well I will fix that later. And because it&#8217;s buzz word Tuesday I made the whole thing validate. But really it is nothing more then a Flickr search, which is handled much better on their site, but it was fun. Check it out: <a href="http://thestem.ca/dd02rey/vfs/flickrSearch/gallery.html">AJAX Flickr Search</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thestem.ca/archives/20/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
