<?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>Todd Huss &#187; AJAX</title>
	<atom:link href="http://gabrito.com/post/category/technical/ajax/feed" rel="self" type="application/rss+xml" />
	<link>http://gabrito.com</link>
	<description>Anecdotes on Technology Leadership, Ruby, Java, Scala, Cloud Computing, Open-Source, SEO, and Design</description>
	<lastBuildDate>Thu, 08 Dec 2011 00:21:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Simple CMS using Google Spreadsheet API</title>
		<link>http://gabrito.com/post/simple-cms-using-google-spreadsheet-api</link>
		<comments>http://gabrito.com/post/simple-cms-using-google-spreadsheet-api#comments</comments>
		<pubDate>Tue, 12 Jun 2007 17:05:05 +0000</pubDate>
		<dc:creator>Todd Huss</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Software Engineering]]></category>

		<guid isPermaLink="false">http://gabrito.com/post/simple-cms-using-google-spreadsheet-api</guid>
		<description><![CDATA[Update 6/14/2007: Dion Almaer has published a nice Javascript helper which makes working with spreadsheets much nicer, I&#8217;ve moved my stuff to it and it&#8217;s a big improvement over using the Google JSON api directly. Publishing dynamic content on your &#8230; <a href="http://gabrito.com/post/simple-cms-using-google-spreadsheet-api">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>Update 6/14/2007:</strong> <a href="http://www.almaer.com/blog/archives/001516.html">Dion Almaer has published a nice Javascript helper</a> which makes working with spreadsheets much nicer, I&#8217;ve moved my stuff to it and it&#8217;s a big improvement over using the Google JSON api directly.</p>
<p>Publishing dynamic content on your website in a format that you can style with CSS has gotten a whole lot easier with Google&#8217;s simple JSON based Javascript API&#8217;s. The two I&#8217;ve found myself playing with lately are the <a href="http://code.google.com/apis/ajaxfeeds/">Google Ajax Feed API</a> for publishing RSS and Atom feeds and the <a href="http://code.google.com/apis/spreadsheets/overview.html">Google Spreadsheet API<br />
</a> for publishing little snippets of text that should be easily editable.</p>
<p>Say you want a simple headline on your homepage that you can change daily. Here&#8217;s how you&#8217;d do it with the Google Spreadsheet API:</p>
<p><strong>1.</strong> Create a spreadsheet making the first row the column headers (important because you&#8217;ll refer to the cell by the column header):</p>
<p><img src='http://gabrito.com/wp-content/uploads/2007/06/easycmsspreadsheet.png' alt='easycmsspreadsheet.png' /><br />
<span id="more-178"></span><br />
<strong>2.</strong> Go to the publish tab and publish the spreadsheet: <a href="http://spreadsheets.google.com/pub?key=pouqRkV5D_eZT_VdOKu7CQA">http://spreadsheets.google.com/pub?key=pouqRkV5D_eZT_VdOKu7CQA</a>. Note in this example the key is <strong>pouqRkV5D_eZT_VdOKu7CQA</strong></p>
<p><!--adsense--></p>
<p><strong>3.</strong> Use a simple container div and some javascript to display the field:</p>
<pre>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&amp;lt;div id=&quot;headline&quot;&amp;gt;&amp;lt;/div&amp;gt;<br />
&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;<br />
function displayContent(json) { document.getElementById('headline').innerHTML = json.feed.entry[0].gsx$html.$t; }<br />
&amp;lt;/script&amp;gt;<br />
&amp;lt;script type=&quot;text/javascript&quot; <br />
src=&quot;http://spreadsheets.google.com/feeds/list/&lt;b&gt;pouqRkV5D_eZT_VdOKu7CQA&lt;/b&gt;/od6/public/values?alt=json-in-script&amp;amp;callback=displayContent&quot;&amp;gt;<br />
&amp;lt;/script&amp;gt;</div></div>
</pre>
<p><strong>Note:</strong> the spreadsheet key in the URL that needs to be replaced. Also, entry[0] refers to row 2 in the spreadsheet (because row 1 contains the column headers and is not considered an entry):</p>
<p><strong>4.</strong> The text appears dynamically on the page:</p>
<p>Palm releases Linux based <a href="http://www.palm.com/us/products/mobilecompanion/foleo/">Foleo</a></p>
<p><strong>5.</strong> When it&#8217;s time to update, make your changes to the spreadsheet, go the publish tab, and republish it and the changes will appear on your site!</p>
<p>The only real downside I can think of with this simple approach is that it&#8217;s not SEO friendly so if you want all search engine crawlers to follow those links you publish, you&#8217;re better off with a non-javascript solution. The <a href="http://groups.google.com/group/Google-Spreadsheets-Data-API">Spreadsheets API google group</a> is a good resource and <a href="http://imagine-it.org/google/spreadsheets/gadgets_all.html">Pamela Fox has some examples to look at</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://gabrito.com/post/simple-cms-using-google-spreadsheet-api/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Hello Newshutch, goodbye Bloglines</title>
		<link>http://gabrito.com/post/hello-newshutch-goodbye-bloglines</link>
		<comments>http://gabrito.com/post/hello-newshutch-goodbye-bloglines#comments</comments>
		<pubDate>Tue, 05 Dec 2006 02:54:34 +0000</pubDate>
		<dc:creator>Todd Huss</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://gabrito.com/post/hello-newshutch-goodbye-bloglines</guid>
		<description><![CDATA[I&#8217;ve been a Bloglines user for a long time. However, after hearing about Newshutch on the Web 2.0 show podcast Episode 26 I&#8217;ve made the switch and couldn&#8217;t be happier. It sports just the right amount of Ajax, good keyboard &#8230; <a href="http://gabrito.com/post/hello-newshutch-goodbye-bloglines">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been a <a href="http://www.bloglines.com/">Bloglines</a> user for a long time. However, after hearing about <a href="http://www.newshutch.com/">Newshutch</a> on the <a href="http://www.web20show.com/">Web 2.0 show podcast</a> <a href="http://www.web20show.com/articles/2006/08/09/web-2-0-show-episode-26-newshutch">Episode 26</a> I&#8217;ve made the switch and couldn&#8217;t be happier. It sports just the right amount of Ajax, good keyboard shortcuts, and it&#8217;s built with Ruby on Rails. In short it&#8217;s by far the best web based RSS reader out there, <a href="http://www.newshutch.com">check it out</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://gabrito.com/post/hello-newshutch-goodbye-bloglines/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ajax enabling crusty legacy webapps with Prototype</title>
		<link>http://gabrito.com/post/ajax-enabling-crusty-legacy-webapps-with-prototype</link>
		<comments>http://gabrito.com/post/ajax-enabling-crusty-legacy-webapps-with-prototype#comments</comments>
		<pubDate>Sun, 26 Nov 2006 19:35:18 +0000</pubDate>
		<dc:creator>Todd Huss</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://gabrito.com/post/ajax-enabling-crusty-legacy-webapps-with-prototype</guid>
		<description><![CDATA[With all of the hype around Ajax it&#8217;s easy to think you might need an MVC framework with baked in Ajax support like Rails ActionPack or JBoss Seam to make Ajax easy. However, libraries like Prototype (which is what Rails &#8230; <a href="http://gabrito.com/post/ajax-enabling-crusty-legacy-webapps-with-prototype">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>With all of the hype around Ajax it&#8217;s easy to think you might need an MVC framework with baked in Ajax support like <a href="http://www.rubyonrails.org/">Rails ActionPack</a> or <a href="http://www.jboss.com/products/seam">JBoss Seam</a> to make Ajax easy. However, libraries like <a href="http://prototype.conio.net/">Prototype</a> (which is what Rails uses) make it so easy that it&#8217;s a snap to Ajax enable even the crustiest legacy web application!</p>
<p>Let&#8217;s take a look at what it takes to put a simple unordered list on a page with a refresh button to refresh the list without doing and page reload and then we&#8217;ll spruce it up a bit:<br />
<span id="more-162"></span><br />
1. First we&#8217;ll need a URL that should return the content of the list and say we&#8217;re working in a crusty old CGI environment so we&#8217;ll call it <strong>/cgi-bin/friends_online.cgi</strong> and say it returns the list of your friends that are online:</p>
<pre>&lt;ul&gt;
&lt;li&gt;Mr Bigglesworth&lt;/li&gt;
&lt;li&gt;Austin Powers&lt;/li&gt;
&lt;/ul&gt;</pre>
<p>2. Now on the page where we want to include the list of our friends that are online we&#8217;ll need to include <a href="http://prototype.conio.net/dist/prototype-1.4.0.js">prototype.js</a> in the head section of the page:</p>
<pre>&lt;script src="/js/prototype.js" type="text/javascript"&gt;&lt;/script&gt;</pre>
<p><!--adsense--></p>
<p>3. Let&#8217;s look at how simple this can be:</p>
<pre>&lt;div id="friends_online"&gt;
... friends online ...
&lt;/div&gt;
&lt;a href="javascript:var x=new Ajax.Updater('friends_online','/cgi-bin/friends_online.cgi')"&gt;Refresh&lt;/a&gt;</pre>
<p>When you hit the refresh button the contents of the friends_online div will be replaced with the output from friends_online.cgi, it&#8217;s that easy! Now let&#8217;s spruce it up a bit.</p>
<p>4. Since we&#8217;re not concerned with server load in this example we&#8217;ll populate the dynamic list using Ajax the first time the page loads as well. While we&#8217;re at it let&#8217;s also hide the <strong>Refresh</strong> button and <strong>friends_online</strong> div while the refresh is happening and <a href="http://www.sanbaldo.com/wordpress/1/ajax_gif/">display an animated loading gif</a>. Here&#8217;s what that would look like:</p>
<pre>&lt;div id="friends_online"&gt;&lt;/div&gt;
&lt;img id="loading" src="loading.gif" alt="Loading"/&gt;
&lt;a id="refresh" href="javascript:friendsOnline()"&gt;Refresh&lt;/a&gt;

&lt;script type="text/javascript"&gt;
function friendsOnline() {
	$('friends_online').style.display = 'none';
	$('refresh').style.display = 'none';
	$('loading').style.display = 'inline';
	new Ajax.Updater('friends_online', '/cgi-bin/friends_online.cgi', {
		parameters: 'key=value&amp;key2=value2',
		method: 'get',
		onComplete: function () {
			$('friends_online').style.display = 'block';
			$('refresh').style.display = 'inline';
			$('loading').style.display = 'none';
		}
	});
}
Event.observe(window, 'load', friendsOnline, false); // This calls friendsOnline on page load
&lt;/script&gt;</pre>
<p>I put in the parameters just to illustrate how to pass parameters with the URL. If I were to take this one step further I&#8217;d put the Javascript into a separate .js file and use <a href="http://wiki.script.aculo.us/scriptaculous/show/CombinationEffectsDemo">Script.aculo.us Effects.js BlindUp and BlindDown</a> to animate hiding and un-hiding the <strong>friends_online</strong> div. Hopefully you can see how much power Prototype gives you and how easy it can be to Ajax enable a legacy web application!</p>
]]></content:encoded>
			<wfw:commentRss>http://gabrito.com/post/ajax-enabling-crusty-legacy-webapps-with-prototype/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>5 things Ruby on Rails has that Java doesn&#8217;t</title>
		<link>http://gabrito.com/post/the-appeal-of-ruby-over-java</link>
		<comments>http://gabrito.com/post/the-appeal-of-ruby-over-java#comments</comments>
		<pubDate>Mon, 13 Mar 2006 16:47:09 +0000</pubDate>
		<dc:creator>Todd Huss</dc:creator>
				<category><![CDATA[Agile Development]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://gabrito.com/post/the-appeal-of-ruby-over-java</guid>
		<description><![CDATA[After listening to this weeks Ruby on Rails podcast where Geoffrey Grosenbach interviewed Bruce Tate, it got me to thinking about why Ruby on Rails appeals to me. For me as a Java person, the real appeal of Ruby lies &#8230; <a href="http://gabrito.com/post/the-appeal-of-ruby-over-java">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>
After listening to this weeks <a href="http://podcast.rubyonrails.com/">Ruby on Rails podcast</a> where <a href="http://nubyonrails.com/">Geoffrey Grosenbach</a> interviewed <a href="http://weblogs.java.net/blog/batate/">Bruce Tate</a>, it got me to thinking about why Ruby on Rails appeals to me. For me as a Java person, the real appeal of Ruby lies in Rails and here&#8217;s why:<span id="more-112"></span>
</p>
<ol>
<li><b>Rails is a one stop shop</b> with a web MVC framework that has AJAX support, an OR Mapping framework, logging framework, default directory structure, unit testing, functional testing, etc&#8230; Bottom line is that it&#8217;s much easier for someone to get productive quickly in RoR learning good practices such as TDD than in any equivalent Java setup. Heck, at work we still don&#8217;t have a good functional web testing framework for the programmers to use because after some tinkering I still couldn&#8217;t get it to start Tomcat, deploy, and run the HttpUnit tests reliably. The first time I tried Rails, the logging, mvc framework, OR Mapping, web services integration, functional tests, unit tests, etc&#8230; just worked, wow!</li>
<li><b>Rails let&#8217;s you learn things when you&#8217;re ready to</b> whereas in Java, just to get my projects off the ground, I have to understand the build system, Hibernate configuration files, web.xml, log4j configuration, my MVC configuration, etc&#8230; I still don&#8217;t know the first thing about Rake (the build system) even though I&#8217;ve built a couple small web projects in RoR and you know what, that&#8217;s a real testament to how well it does it&#8217;s job. I&#8217;m focusing on solving my business problem now, not on learning a build system! Similarly there are massive black holes in my knowledge around ActiveController, ActiveRecord, Rails&#8217; AJAX support, etc&#8230; but it hasn&#8217;t stopped me from using those features and being productive! I hope to learn the ins and outs of these components eventually but that&#8217;s in direct contrast to Java where you have to front-load tons of knowledge to be productive!</li>
<li><b>Rails recognizes that in the real world there are differences between your dev, test, and production environment</b> whereas I&#8217;ve always had to roll my own solution in Java whether it&#8217;s through JNDI or the creative use of property files. The key here is that in Rails you have all of those settings in your project under source control making it easy to lookup how a setting differs between test and production, with JNDI that information is stored on the server but it&#8217;s irrelevant because everyone does it differently anyhow.</li>
<li><b>The Rails community recognized the need for a production deployment solution and came out with Capistrana (ex SwitchTower)</b> whereas in Java with Tomcat we had to write our own from scratch that goes to our 10 application servers, takes each one out of production, deploys the WAR, performs a test, and then brings it back into production before moving onto the next server.</li>
<li><b>Jumping in on an existing Rails project should be easy because there are strong conventions</b> whereas in Java every project does almost everything a little differently. You have to learn the Ant targets, the project source layout, how dependencies are managed, how they deploy into Tomcat, and so on. Maven certainly helps address this issue in the Java space but it&#8217;s adoption rate is low compared to Ant.</li>
</ol>
<p>
That said, there are still things I really like about Java. For starters I&#8217;m an Emacs to IDE convert and nothing compares to the refactoring and code analysis capabilities of JetBrains Idea. Since Ruby is dynamically typed, no IDE will ever support the degree of refactoring we enjoy in Java. Also, once you have your Java environment setup and everything integrated and working, developing new web pages is fast. For example when I develop in Idea I can change a class or a web page and hit refresh in my browser just like I do in Ruby. Since we use JSPX and TAGX files, IDEA tells me if my XHTML is not well-formed XML&#8230; I could go on and on.
</p>
<p>
Suffice it to say that I still like Java but I&#8217;m loving that there&#8217;s some fierce competition on the block and I hope someday to have the opportunity to develop a large software project in Rails. If you still have your doubts about Ruby on Rails, read <a href="http://www.pragmaticprogrammer.com/titles/rails/index.html">Agile Web Development with Rails</a>, it&#8217;s a great book that will knock your socks off!
</p>
<p>
Related reading: <a href="http://squizlog.keithpitty.org/archives/000425.html">Keith Pitty looks at Java versus Ruby on Rails<br />
</a></p>
]]></content:encoded>
			<wfw:commentRss>http://gabrito.com/post/the-appeal-of-ruby-over-java/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

