<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>decodeURI</title>
	<atom:link href="http://lucianopanaro.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://lucianopanaro.wordpress.com</link>
	<description>blog of Luciano Germán Panaro</description>
	<lastBuildDate>Mon, 28 Mar 2011 11:13:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='lucianopanaro.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>decodeURI</title>
		<link>http://lucianopanaro.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://lucianopanaro.wordpress.com/osd.xml" title="decodeURI" />
	<atom:link rel='hub' href='http://lucianopanaro.wordpress.com/?pushpress=hub'/>
		<item>
		<title>FX Queues plugin and jQuery 1.4</title>
		<link>http://lucianopanaro.wordpress.com/2010/01/15/fx-queues-plugin-and-jquery-1-4/</link>
		<comments>http://lucianopanaro.wordpress.com/2010/01/15/fx-queues-plugin-and-jquery-1-4/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 15:30:52 +0000</pubDate>
		<dc:creator>lucianopanaro</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[fxqueues]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jquery1.4]]></category>

		<guid isPermaLink="false">http://www.decodeuri.com/?p=113</guid>
		<description><![CDATA[So jQuery1.4 has been finally released and, though I haven&#8217;t been able to test the FX Queues plugin yet with it, I already got some feedback mentioning it&#8217;s not working. During the next couple of days I will be releasing a new version compatible with jQuery 1.4 &#8211; It will be a good way to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lucianopanaro.wordpress.com&amp;blog=2195581&amp;post=113&amp;subd=lucianopanaro&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>So <a href="http://jquery14.com/" target="_blank">jQuery1.4</a> has been finally released and, though I haven&#8217;t been able to test the <a href="http://plugins.jquery.com/project/fxqueues" target="_blank">FX Queues plugin</a> yet with it, I already got some feedback mentioning it&#8217;s not working.</p>
<p>During the next couple of days I will be releasing a new version compatible with jQuery 1.4 &#8211; It will be a good way to get back to some Javascript hacking after many months with just Ruby in my head <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Stay tuned!</p>
<h2>Update:</h2>
<p>So it just took me an hour to do the update to 1.4 &#8212; seems like <strong>jQuery.queue()</strong> is behaving a little different.</p>
<p>Since the plugins site for 1.4 is still to be released, for now you can grab the code from GitHub: <a href="http://github.com/lucianopanaro/jQuery-FxQueues/tree/jQuery1.4" target="_blank">http://github.com/lucianopanaro/jQuery-FxQueues/tree/jQuery1.4</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lucianopanaro.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lucianopanaro.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lucianopanaro.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lucianopanaro.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lucianopanaro.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lucianopanaro.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lucianopanaro.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lucianopanaro.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lucianopanaro.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lucianopanaro.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lucianopanaro.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lucianopanaro.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lucianopanaro.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lucianopanaro.wordpress.com/113/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lucianopanaro.wordpress.com&amp;blog=2195581&amp;post=113&amp;subd=lucianopanaro&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lucianopanaro.wordpress.com/2010/01/15/fx-queues-plugin-and-jquery-1-4/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/55d4558687335fd7de57eb9a2786fb90?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lucianopanaro</media:title>
		</media:content>
	</item>
		<item>
		<title>Quick tip: Running Clearance features</title>
		<link>http://lucianopanaro.wordpress.com/2009/03/10/quick-tip-running-clearance-features/</link>
		<comments>http://lucianopanaro.wordpress.com/2009/03/10/quick-tip-running-clearance-features/#comments</comments>
		<pubDate>Tue, 10 Mar 2009 16:38:55 +0000</pubDate>
		<dc:creator>lucianopanaro</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[clearance]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://www.decodeuri.com/?p=93</guid>
		<description><![CDATA[If you are working with Clearance and want to have its features (script/generate clearance_features), be sure to have a layout that prints flash messages (notice, error, success and failure), as these are used in some scenarios. Nothing crazy, but hopefully I&#8217;m saving you a headache .<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lucianopanaro.wordpress.com&amp;blog=2195581&amp;post=93&amp;subd=lucianopanaro&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you are working with <a title="Clearance GitHub" href="http://github.com/thoughtbot/clearance" target="_blank">Clearance</a> and want to have its features (<em>script/generate clearance_features</em>), <strong>be sure to have a layout that prints flash messages</strong> (<em>notice</em>, <em>error</em>, <em>success</em> and <em>failure</em>), as these are used in some scenarios.</p>
<p>Nothing crazy, but hopefully I&#8217;m saving you a headache <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lucianopanaro.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lucianopanaro.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lucianopanaro.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lucianopanaro.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lucianopanaro.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lucianopanaro.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lucianopanaro.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lucianopanaro.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lucianopanaro.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lucianopanaro.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lucianopanaro.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lucianopanaro.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lucianopanaro.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lucianopanaro.wordpress.com/93/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lucianopanaro.wordpress.com&amp;blog=2195581&amp;post=93&amp;subd=lucianopanaro&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lucianopanaro.wordpress.com/2009/03/10/quick-tip-running-clearance-features/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/55d4558687335fd7de57eb9a2786fb90?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lucianopanaro</media:title>
		</media:content>
	</item>
		<item>
		<title>FxQueues update: now compatible with jQuery 1.3.1</title>
		<link>http://lucianopanaro.wordpress.com/2009/02/15/fxqueues-update-now-compatible-with-jquery-1-3-1/</link>
		<comments>http://lucianopanaro.wordpress.com/2009/02/15/fxqueues-update-now-compatible-with-jquery-1-3-1/#comments</comments>
		<pubDate>Sun, 15 Feb 2009 19:49:58 +0000</pubDate>
		<dc:creator>lucianopanaro</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[fxqueues]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://www.decodeuri.com/?p=87</guid>
		<description><![CDATA[For all FxQueues plugin users, I just pushed a new version (2.0.3) that is only compatible with jQuery 1.3.x, since many tests and the main example under 2.0.2 weren&#8217;t working with jQuery&#8217;s latest version. So if you are using jQuery 1.3.1, you should be using FxQueues 2.0.3, otherwise you can stick to 2.0.2, as only [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lucianopanaro.wordpress.com&amp;blog=2195581&amp;post=87&amp;subd=lucianopanaro&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>For all <a href="http://www.decodeuri.com/jquery-fxqueues-plugin-20/" target="_blank">FxQueues plugin</a> users, I just pushed a new version (<a href="http://plugins.jquery.com/node/6389" target="_blank">2.0.3</a>) that is only compatible with <strong>jQuery 1.3.x</strong>, since many tests and the main example under 2.0.2 weren&#8217;t working with jQuery&#8217;s latest version.</p>
<p>So if you are using jQuery 1.3.1, you should be using <a href="http://plugins.jquery.com/node/6389" target="_blank">FxQueues 2.0.3</a>, otherwise you can stick to <a href="http://plugins.jquery.com/node/1972" target="_blank">2.0.2</a>, as only internal changes have been done and there are no new features.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lucianopanaro.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lucianopanaro.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lucianopanaro.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lucianopanaro.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lucianopanaro.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lucianopanaro.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lucianopanaro.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lucianopanaro.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lucianopanaro.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lucianopanaro.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lucianopanaro.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lucianopanaro.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lucianopanaro.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lucianopanaro.wordpress.com/87/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lucianopanaro.wordpress.com&amp;blog=2195581&amp;post=87&amp;subd=lucianopanaro&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lucianopanaro.wordpress.com/2009/02/15/fxqueues-update-now-compatible-with-jquery-1-3-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/55d4558687335fd7de57eb9a2786fb90?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lucianopanaro</media:title>
		</media:content>
	</item>
		<item>
		<title>jQuery Object Cache Update</title>
		<link>http://lucianopanaro.wordpress.com/2009/01/11/jquery-object-cache-update/</link>
		<comments>http://lucianopanaro.wordpress.com/2009/01/11/jquery-object-cache-update/#comments</comments>
		<pubDate>Sun, 11 Jan 2009 17:14:56 +0000</pubDate>
		<dc:creator>lucianopanaro</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://www.decodeuri.com/?p=76</guid>
		<description><![CDATA[After discussing with Andrew Luetgers some improvements that could be done to the Object Cache plugin, I updated the plugin to a new version. The new improvement is that now you can store a selection automatically: This will let you avoid doing $(&#8220;#menu&#8221;).cache(&#8220;menu&#8221;), which is a bit redundant. Now by doing $$(&#8220;#menu&#8221;) you will be [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lucianopanaro.wordpress.com&amp;blog=2195581&amp;post=76&amp;subd=lucianopanaro&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>After discussing with <a title="Andrew Luetgers" href="http://thetechnicsblog.blogspot.com/" target="_blank">Andrew Luetgers</a> some improvements that could be done to the <a title="jQuery Object Cache" href="http://www.decodeuri.com/2008/11/20/new-jquery-plugin-object-cache/" target="_blank">Object Cache</a> plugin, I updated the plugin to a new version.</p>
<p>The new improvement is that now you can store a selection automatically:</p>
<p><pre class="brush: jscript;">
// Will store in cache $(&quot;#sidebarNav&quot;) with #sidebarNav key
$$(&quot;#sidebarNav&quot;);
</pre></p>
<p>This will let you avoid doing <em>$(&#8220;#menu&#8221;).cache(&#8220;menu&#8221;)</em>, which is a bit redundant. Now by doing <em>$$(&#8220;#menu&#8221;)</em> you will be able to store it in the cache and retrieve it automatically. There is also a <strong>reload</strong> option that you can pass to that call in order to, well, reload the the cached object with that selection:</p>
<p><pre class="brush: jscript;">
// Will reload #sidebarNav with $(&quot;#sidebarNav&quot;)
$$(&quot;#sidebarNav&quot;, true);
</pre></p>
<p>You can grab the <a title="jQuery Object Cache Plugin" href="http://plugins.jquery.com/node/5633" target="_blank">new version of the Object Cache plugin here</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lucianopanaro.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lucianopanaro.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lucianopanaro.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lucianopanaro.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lucianopanaro.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lucianopanaro.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lucianopanaro.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lucianopanaro.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lucianopanaro.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lucianopanaro.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lucianopanaro.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lucianopanaro.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lucianopanaro.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lucianopanaro.wordpress.com/76/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lucianopanaro.wordpress.com&amp;blog=2195581&amp;post=76&amp;subd=lucianopanaro&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lucianopanaro.wordpress.com/2009/01/11/jquery-object-cache-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/55d4558687335fd7de57eb9a2786fb90?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lucianopanaro</media:title>
		</media:content>
	</item>
		<item>
		<title>Update: Creating a news carousel with jQuery, now with time based switching</title>
		<link>http://lucianopanaro.wordpress.com/2009/01/11/update-creating-a-news-carousel-with-jquery-now-with-time-based-switching/</link>
		<comments>http://lucianopanaro.wordpress.com/2009/01/11/update-creating-a-news-carousel-with-jquery-now-with-time-based-switching/#comments</comments>
		<pubDate>Sun, 11 Jan 2009 16:48:23 +0000</pubDate>
		<dc:creator>lucianopanaro</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[carousel]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.decodeuri.com/?p=72</guid>
		<description><![CDATA[This is just a simple and quick update on the Creating a news carousel with jQuery post. After reading this comment, and going through the code, I decided to implement the time-based switching functionality and also clean up the code a little bit (check it out here). The additions made (along with some code cleaning) [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lucianopanaro.wordpress.com&amp;blog=2195581&amp;post=72&amp;subd=lucianopanaro&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is just a simple and quick update on the <a title="Creating a news carousel with jQuery" href="http://www.decodeuri.com/2008/10/05/creating-a-news-carousel-with-jquery" target="_blank">Creating a news carousel with jQuery</a> post.</p>
<p>After reading <a href="http://www.decodeuri.com/2008/10/05/creating-a-news-carousel-with-jquery/comment-page-1/#comment-71" target="_blank">this comment</a>, and going through the code, I decided to implement the time-based switching functionality and also clean up the code a little bit (<a href="http://www.decodeuri.com/samples/carousel_with_time_based_switching.html" target="_blank">check it out here</a>).</p>
<p>The additions made (along with some code cleaning) were:</p>
<ul>
<li>Append a simple div that will shrink while the picture is shown and reinitialized when the picture is switched.</li>
<li>Add a <strong>setInterval</strong> call that will do the picture switching (and the new div&#8217;s animation).</li>
</ul>
<p><span style="text-decoration:underline;"><strong>Update 01/12:</strong></span> I added some fixes to the code</p>
<ul>
<li>Use the image&#8217;s load event to calculate each individual width. When all images are loaded, then the carousel is initiated.</li>
<li>The <strong>animate_timer</strong> function now stops all animations on the timer div before reinitializing the animation</li>
</ul>
<p><span style="text-decoration:underline;"><strong>Update 01/27:</strong></span> Even more fixes <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<ul>
<li>Work with cases were images are already in cache and load event is fired before we attach to it.</li>
<li>Fixed the way the news animation was calculated.</li>
<li>Added 2 more news to help test it better.</li>
</ul>
<p>So here&#8217;s the new javascript that will do this:</p>
<p><pre class="brush: jscript;">
$(function() {
    var carousel   = $('#news_carousel');
    var news       = carousel.find('ul.news');
    var controls   = null; // Will hold the ul with the controls
    var timer      = null; // Will hold the timer div
    var wait       = 5000; // Milliseconds to wait for auto-switching
    var widths     = [];   // Will hold the widths of each image
    var items_size = news.find('li').length;
    var initialized = false;

    if (!items_size) { return; }

    // Controls html to append
    var controls_str = '&lt;ul class=&quot;controls&quot;&gt;';
    for ( var i = 1; i &amp;lt;= items_size; i++) {
       controls_str += &#39;&lt;li&gt;&lt;a href=&quot;#&quot;&gt;' + i + '&lt;/a&gt;&lt;/li&gt;';
    }
    controls_str += '&lt;/ul&gt;';

    // Cache the controls list
    controls = carousel.append(controls_str).find('ul.controls');

    // Make the first button in controls active
    controls.find('li:first a').addClass('active');

    // Hook to the controls' click events
    controls.find('li a').click(function(event) {
      move_news( $(this) );
      return false;
    });

    // Append the timer and cache it
    timer = carousel.append('&lt;div class=&quot;timer&quot;&gt;&lt;/div&gt;').find('div.timer');

    // Store each item's width and calculate the total width
    news.find('li img')
        .each(function(i, e) {
            widths[i] = $(e).width();
            if ( all_images_loaded() ) { init_carousel(); }
        })
        .load(function(e) {
            var i = news.find('li img').index(this);
            widths[i] = $(this).width();
            if ( all_images_loaded() ) { init_carousel(); }
        });


    function all_images_loaded() {
      return (items_size == widths.length) &amp;amp;&amp;amp; (jQuery.inArray(0, widths)  1 ) {
        return false;
      }

      var current_active = controls.find('li a.active');

      if (new_active == 'next') {
        var next = current_active.parent().next().find('a');

        if ( !next.length ) { next = controls.find('li:first a'); }

        new_active = next;
      }

      var current_index = parseInt(current_active.text(), 10) - 1;
      var new_index     = parseInt(new_active.text(), 10) - 1;
      var move_to       = new_index - current_index;


      if (!move_to) { return false; }

      var direction = (move_to &amp;gt; 0)? '-=': '+=';

      var move   = 0;
      var bottom = Math.min(current_index, new_index);
      var top    = Math.max(current_index, new_index);

      while (bottom &amp;lt; top) {
        move += widths[bottom];
        bottom++;
      }

      news.animate({marginLeft: direction + move }, 500);
      new_active.addClass(&#39;active&#39;);
      current_active.removeClass(&#39;active&#39;);
    }

    function animate_timer() {
      timer.stop().css({width: &#39;100px&#39;}).animate({width: &#39;1px&#39;}, wait);
    }

    // Initializer, called when all images are loaded
    function init_carousel() {
      if (initialized) { return false; }

      // Set the news ul total width
      var width = 0;
      for( var i = 0; i &amp;lt; widths.length; i++) { width += widths[i]; }
      news.width(width);

      // Make the news change every X seconds
      setInterval(function() { move_news(&#39;next&#39;); animate_timer(); }, wait);
      animate_timer();

      initialized = true;
    }
});
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lucianopanaro.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lucianopanaro.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lucianopanaro.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lucianopanaro.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lucianopanaro.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lucianopanaro.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lucianopanaro.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lucianopanaro.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lucianopanaro.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lucianopanaro.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lucianopanaro.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lucianopanaro.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lucianopanaro.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lucianopanaro.wordpress.com/72/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lucianopanaro.wordpress.com&amp;blog=2195581&amp;post=72&amp;subd=lucianopanaro&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lucianopanaro.wordpress.com/2009/01/11/update-creating-a-news-carousel-with-jquery-now-with-time-based-switching/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/55d4558687335fd7de57eb9a2786fb90?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lucianopanaro</media:title>
		</media:content>
	</item>
		<item>
		<title>New jQuery plugin: Object Cache</title>
		<link>http://lucianopanaro.wordpress.com/2008/11/20/new-jquery-plugin-object-cache/</link>
		<comments>http://lucianopanaro.wordpress.com/2008/11/20/new-jquery-plugin-object-cache/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 18:54:56 +0000</pubDate>
		<dc:creator>lucianopanaro</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://www.decodeuri.com/?p=67</guid>
		<description><![CDATA[Inspired by Benjamin Sterling&#8216;s &#8220;Better jQuery Code&#8221; article I decided to develop a simple plugin to make his first point (Caching) easier&#8230; nothing fancy, just a few methods, but you will hopefully find it useful. Its objective is to let you store a jQuery object with a simple key in a global cache, so that [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lucianopanaro.wordpress.com&amp;blog=2195581&amp;post=67&amp;subd=lucianopanaro&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Inspired by <a href="http://benjaminsterling.com" target="_blank">Benjamin Sterling</a>&#8216;s <a href="http://benjaminsterling.com/better-jquery-code-1/" target="_blank">&#8220;Better jQuery Code&#8221;</a> article I decided to develop a simple plugin to make his first point (<em>Caching</em>) easier&#8230; nothing fancy, just a few methods, but you will hopefully find it useful.</p>
<p>Its objective is to let you store a jQuery object with a simple key in a global cache,<br />
so that you can access the same object easily, without having to write the same selection, filtering or traversing code (i.e: $(&#8220;#main &gt; p&#8221;) or $(&#8220;#main&#8221;).children(&#8220;.selected&#8221;).eq(0)).</p>
<h2>Here is how it works:</h2>
<p><pre class="brush: jscript;">
// Store in cache - Returns current object
$(&quot;#mainNav&quot;).cache(&quot;main_navigation&quot;);

// Retrieve from cache - Returns cached object
$$(&quot;main_navigation&quot;); // or jQueryCache(&quot;main_navigation&quot;);

// Remove from cache
$$.remove(&quot;main_navigation&quot;);

// Clear Cache
$$.clear();

// Load jQueryCache with noConflict to avoid overriding window.$$
$$.noConflict();
</pre></p>
<p>There is a lot of room for improvement, which will be done depending on the feedback I get,  so feel free to contact me with any ideas or corrections you might come up with.</p>
<p><a href="http://plugins.jquery.com/project/object-cache" target="_blank">You can get the Jquery Object Cache plugin here</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lucianopanaro.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lucianopanaro.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lucianopanaro.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lucianopanaro.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lucianopanaro.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lucianopanaro.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lucianopanaro.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lucianopanaro.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lucianopanaro.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lucianopanaro.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lucianopanaro.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lucianopanaro.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lucianopanaro.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lucianopanaro.wordpress.com/67/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lucianopanaro.wordpress.com&amp;blog=2195581&amp;post=67&amp;subd=lucianopanaro&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lucianopanaro.wordpress.com/2008/11/20/new-jquery-plugin-object-cache/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/55d4558687335fd7de57eb9a2786fb90?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lucianopanaro</media:title>
		</media:content>
	</item>
		<item>
		<title>Creating a Rack Middleware for Minifying Your Javascript files</title>
		<link>http://lucianopanaro.wordpress.com/2008/10/15/creating-a-rack-middleware-for-minifying-your-javascript-files/</link>
		<comments>http://lucianopanaro.wordpress.com/2008/10/15/creating-a-rack-middleware-for-minifying-your-javascript-files/#comments</comments>
		<pubDate>Wed, 15 Oct 2008 22:40:46 +0000</pubDate>
		<dc:creator>lucianopanaro</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[jsmin]]></category>
		<category><![CDATA[middleware]]></category>
		<category><![CDATA[rack]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.decodeuri.com/?p=59</guid>
		<description><![CDATA[If you are in the Ruby world you have probably heard of Rack. If you haven&#8217;t, and you are a Pythonista, then you only need to know that Rack is a sort of &#8220;WSGI for Ruby&#8221;. And in case you don&#8217;t know what Rack or WSGI are, then here&#8217;s a brief description: &#8220;Rack provides a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lucianopanaro.wordpress.com&amp;blog=2195581&amp;post=59&amp;subd=lucianopanaro&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you are in the Ruby world you have probably heard of <a href="http://rack.rubyforge.org/" target="_blank">Rack</a>. If you haven&#8217;t, and you are a Pythonista, then you only need to know that Rack is a sort of &#8220;<a href="http://wsgi.org/wsgi/" target="_blank">WSGI</a> for Ruby&#8221;. And in case you don&#8217;t know what Rack or WSGI are, then here&#8217;s a brief description:</p>
<blockquote><p>&#8220;Rack provides a minimal, modular and adaptable interface for developing web applications in Ruby. By wrapping HTTP requests and responses in the simplest way possible, it unifies and distills the API for web servers, web frameworks, and software in between (the so-called middleware) into a single method call.&#8221;</p></blockquote>
<p>So you can think of Rack as a &#8220;<a href="http://macournoyer.wordpress.com/2007/12/14/rack-the-framework-framework/" target="_blank">frameworks framework</a>&#8220;. <a href="http://brainspl.at/articles/2008/02/16/so-merb-core-is-built-on-rack-you-say-why-should-i-care" target="_blank">Merb</a> and other <a href="http://ramaze.net" target="_blank">ruby</a> <a href="http://railswaves.com/" target="_blank">frameworks</a> already support Rack, which means that they can share the middleware described above.</p>
<h2>Creating a Rack Middleware</h2>
<p>So let&#8217;s say you want your application (built on Rails, Merb, Ramaze or even Rack) to intercept any request for javascript files so that you can first minify them. Below is the sample code for achieving this with a Rack Middleware:</p>
<p><em>(You can checkout this code, its spec and example from <a href="http://github.com/lucianopanaro/rack-javascript-minifier" target="_blank">http://github.com/lucianopanaro/rack-javascript-minifier</a>. The javascript minifier is a port from <a href="http://www.crockford.com/javascript/jsmin.html" target="_blank">Douglas Crockford&#8217;s library</a> <a href="http://github.com/rgrove/jsmin/" target="_blank">done by Ryan Grove</a>.)</em></p>
<p><pre class="brush: ruby;">
  class JavascriptMinifier
    F = ::File

    def initialize(app, path)
      @app = app
      @root = F.expand_path(path)
      raise &quot;Provided path #{@root} does not exist&quot; unless F.directory?(@root)
    end

    def call(env)
      path = F.join(@root, Utils.unescape(env[&quot;PATH_INFO&quot;]))

      unless path.match(/.*\/(\w+\.js)$/) and F.file?(path)
        return @app.call(env)
      end

      if env[&quot;PATH_INFO&quot;].include?(&quot;..&quot;) or !F.readable?(path)
        body = &quot;Forbidden\n&quot;
        size = body.respond_to?(:bytesize) ? body.bytesize : body.size
        return [403, {&quot;Content-Type&quot; =&amp;gt; &quot;text/plain&quot;,&quot;Content-Length&quot; =&amp;gt; size.to_s}, [body]]
      end

      last_modified = F.mtime(path)
      min_path = F.join(@root, &quot;m_#{last_modified.to_i}_#{F.basename(path)}&quot;)

      unless F.file?(min_path)
        F.open(path, &quot;r&quot;) { |file|
          F.open(min_path, &quot;w&quot;) { |f| f.puts JSMin.minify(file) }
        }
      end

      [200, {
             &quot;Last-Modified&quot;  =&amp;gt; F.mtime(min_path).httpdate,
             &quot;Content-Type&quot;   =&amp;gt; &quot;text/javascript&quot;,
             &quot;Content-Length&quot; =&amp;gt; F.size(min_path).to_s
            }, F.new(min_path, &quot;r&quot;)]
    end
  end
</pre></p>
<p>Rack Middleware&#8217;s interface is dead simple. As <a href="http://macournoyer.wordpress.com/2008/02/09/the-flexible-thin-anorexic-gymnast-that-democratized-deployment/">Marc-André Cournoyer points out</a>: <em>&#8220;It must have a call method and receive a Rack app as the first argument of new&#8221;</em>.</p>
<p>So here, when we initialize the JavascriptMinifier, we pass the root path where the javascript files are placed. Every time it gets called, the middleware first checks if the request is for a javascript file. If it&#8217;s not, it passes it to the application. If the request is for a javascript in a parent directory, then we return a forbidden (403) page. Finally, if the request passes these filters, the middleware creates a minified version of the javascript file and returns it.</p>
<h2>Running your application with middleware</h2>
<p>This is also really simple using <a href="http://rack.rubyforge.org/doc/classes/Rack/Builder.html" target="_blank">Rack::Builder</a>:</p>
<blockquote><p>&#8220;Rack::Builder implements a small DSL to iteratively construct Rack applications. <a href="http://rack.rubyforge.org/doc/classes/Rack/Builder.html#M000112" target="_blank">use</a> adds a middleware to the stack, <a href="http://rack.rubyforge.org/doc/classes/Rack/Builder.html#M000113">run</a> dispatches to an application.&#8221; </p></blockquote>
<p>So here is an example of a rackup file that you can use to startup your application with some middleware:</p>
<p><pre class="brush: jscript;">
   use Rack::CommonLogger
   use Rack::ShowExceptions
   use JavascriptMinifier, &quot;./&quot;
   run Rack::Lobster.new
</pre></p>
<h2>Testing and Spec&#8217;ing helpers</h2>
<p>Rack provides two helpers that will be of great use for testing your application: <a href="http://rack.rubyforge.org/doc/classes/Rack/MockRequest.html" target="_blank">Rack::MockRequest</a> and <a href="http://rack.rubyforge.org/doc/classes/Rack/MockResponse.html" target="_blank">Rack::MockResponse</a>, so you have no excuses to test your Rack Middleware and do some TDD/BDD!</p>
<h2>Where to go from here</h2>
<p>To learn how to develop your own Rack Middleware, your best resource will be Rack sources. You will learn a lot of Rack (and Ruby in general) by reading the code and specs they provide: <a href="http://rack.rubyforge.org/doc/classes/Rack/URLMap.html" target="_blank">URLMap</a>, <a href="http://rack.rubyforge.org/doc/classes/Rack/CommonLogger.html">CommonLogger</a>, <a href="http://rack.rubyforge.org/doc/classes/Rack/File.html">File</a>. There also is a <a href="http://groups.google.com/group/rack-devel">group</a> where you can ask your questions too.</p>
<p>So enjoy your trip with Rack Middleware and feel free to comment your thoughts and questions!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lucianopanaro.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lucianopanaro.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lucianopanaro.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lucianopanaro.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lucianopanaro.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lucianopanaro.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lucianopanaro.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lucianopanaro.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lucianopanaro.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lucianopanaro.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lucianopanaro.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lucianopanaro.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lucianopanaro.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lucianopanaro.wordpress.com/59/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lucianopanaro.wordpress.com&amp;blog=2195581&amp;post=59&amp;subd=lucianopanaro&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lucianopanaro.wordpress.com/2008/10/15/creating-a-rack-middleware-for-minifying-your-javascript-files/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/55d4558687335fd7de57eb9a2786fb90?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lucianopanaro</media:title>
		</media:content>
	</item>
		<item>
		<title>Creating a news carousel with jQuery</title>
		<link>http://lucianopanaro.wordpress.com/2008/10/05/creating-a-news-carousel-with-jquery/</link>
		<comments>http://lucianopanaro.wordpress.com/2008/10/05/creating-a-news-carousel-with-jquery/#comments</comments>
		<pubDate>Sun, 05 Oct 2008 19:54:30 +0000</pubDate>
		<dc:creator>lucianopanaro</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[carousel]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.decodeuri.com/?p=18</guid>
		<description><![CDATA[Last week I had to do a news carousel for a project I&#8217;m developing. It had been a while since I had the chance to do something interesting with jQuery, so I wanted to share the experience of how easily you can build similar widgets for your site. So first let&#8217;s take a look at [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lucianopanaro.wordpress.com&amp;blog=2195581&amp;post=18&amp;subd=lucianopanaro&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Last week I had to do a news carousel for a project I&#8217;m developing. It had been a while since I had the chance to do something interesting with jQuery, so I wanted to share the experience of how easily you can build similar widgets for your site.</p>
<p>So first let&#8217;s take a look at <a href="http://www.decodeuri.com/samples/carousel.html" target="_blank">what we want to build</a>.</p>
<p>Now, I know that there are a few plugins out there for jQuery that probably can do this, but the point of this post is to show how simple it is to create something like this with a few lines of jQuery and CSS.</p>
<p>Let&#8217;s begin by defining how we will organize the content. Being a list of news, we can either use an ordered or an unordered list.</p>
<p><pre class="brush: xml;">
&lt;div id=&quot;news_carousel&quot;&gt;
  &lt;ul class=&quot;news&quot;&gt;
    &lt;li&gt;
      &lt;img src=&quot;&quot; alt=&quot;&quot; /&gt;
      &lt;strong&gt;&lt;a href=&quot;#&quot;&gt;Title&lt;/a&gt;&lt;/strong&gt;
      &lt;span&gt;Description&lt;/span&gt;
    &lt;/li&gt;
  &lt;/ul&gt;
&lt;/div&gt;
</pre></p>
<p>Now that we have our content, we have to style it. The keys here are to:</p>
<ul>
<li>Align the list elements one next to the other.</li>
<li>Make <em>#news_carousel</em> just show one list element at a time</li>
<li>Use relative and absolute positioning to show the titles and descriptions over each image</li>
</ul>
<p>Here&#8217;s the CSS used in the sample with some comments:</p>
<p><pre class="brush: css;">
 #news_carousel {
     width: 444px;
     height: 333px;
     margin: 0;
     padding: 0;
     overflow: hidden;  /* this will make only show 1 li */
     position: relative;
  }
  #news_carousel ul.news {
    list-style-type: none;
    margin: 0;
    padding: 0;
    position: relative;
  }
  #news_carousel ul li {
    margin: 0;
    padding: 0;
    position: relative; /* so that we can do absolute positioning of the paragraph inside of it */
    float: left; /* align one next to the other */
  }
  #news_carousel ul.news li p {
    position: absolute;
    bottom: 10px;
    left: 0;
    margin: 5px;
  }
  #news_carousel ul.news li p strong {
    display: block;
    padding: 5px;
    margin: 0;
    font-size: 20px;
    background: #444;
  }
  #news_carousel ul.news li p span {
    padding: 2px 5px;
    color: #000;
    background: #fff;
  }
  #news_carousel ul.controls {
    position: absolute;
    top: 0px; right: 20px;
    list-style-type: none;
  }
  #news_carousel ul.controls li a {
    float: left;
    font-size: 15px;
    margin: 5px;
    padding: 2px 7px;
    background: #000;
    text-decoration: none;
    outline: none;
  }
  #news_carousel ul.controls li a.active {
    border: 2px solid #ccc;
  }
</pre></p>
<p>The Javascript code is pretty self-explanatory:</p>
<p><pre class="brush: jscript;">
var news_carousel = function() {
    var items_size = $('#news_carousel ul li').length;

    if (items_size == 0) return;

    // Calculate the total width and set that value to the ul.news width
    // Store each item width
    var width = 0;
    var widths = [];
    $('#news_carousel ul.news li img').each(function(i, e) {
      widths[i] = $(e).width();
      width += widths[i];
    });

    $(&quot;#news_carousel ul.news&quot;).width(width);

    // Append the controls
    controls = '&lt;ul class=&quot;controls&quot;&gt;&lt;li&gt;&lt;a class=&quot;active&quot; href=&quot;#&quot;&gt;1&lt;/a&gt;';
    for ( var i = 2; i &amp;lt;= items_size; i++) {
       controls += &#039;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;#&quot;&gt;' + i + '&lt;/a&gt;&lt;/li&gt;';
    }
    controls += '&lt;/ul&gt;';
    $('#news_carousel').append(controls);

    $('#news_carousel ul.controls li a').click(function(event) {
      // if the ul is already moving, then do nothing
      if ($(&quot;#news_carousel ul.news:animated&quot;).length &amp;gt; 0) return false;

      var clicked_item = $(event.target);
      var current_active = $(&quot;#news_carousel ul.controls li a.active&quot;);
      var current_index = parseInt(current_active.text());
      var new_index = parseInt(clicked_item.text());
      var move = new_index - current_index; // get how many items it should be moved

      if (move != 0) {
        direction = (move &amp;gt; 0)? &quot;-=&quot;: &quot;+=&quot;;
        $('#news_carousel ul.news').animate({marginLeft: direction + widths[new_index-1] }, 300);
        clicked_item.addClass(&quot;active&quot;);
        current_active.removeClass(&quot;active&quot;);
      }

      return false;
    });
  }();
</pre></p>
<p>And that&#8217;s it! Around 100 lines of code and you have your own home-made news carousel. Hope you found it useful! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>(Pictures taken from: <a href="http://www.flickr.com/photos/christing/268490607/">http://www.flickr.com/photos/christing/268490607/</a> and <a href="http://www.flickr.com/photos/11717181@N02/1170861540/">http://www.flickr.com/photos/11717181@N02/1170861540/</a>.)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lucianopanaro.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lucianopanaro.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lucianopanaro.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lucianopanaro.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lucianopanaro.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lucianopanaro.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lucianopanaro.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lucianopanaro.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lucianopanaro.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lucianopanaro.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lucianopanaro.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lucianopanaro.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lucianopanaro.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lucianopanaro.wordpress.com/18/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lucianopanaro.wordpress.com&amp;blog=2195581&amp;post=18&amp;subd=lucianopanaro&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lucianopanaro.wordpress.com/2008/10/05/creating-a-news-carousel-with-jquery/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/55d4558687335fd7de57eb9a2786fb90?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lucianopanaro</media:title>
		</media:content>
	</item>
		<item>
		<title>RSpec Link Fest!</title>
		<link>http://lucianopanaro.wordpress.com/2008/10/02/rspec-link-fest/</link>
		<comments>http://lucianopanaro.wordpress.com/2008/10/02/rspec-link-fest/#comments</comments>
		<pubDate>Thu, 02 Oct 2008 14:24:39 +0000</pubDate>
		<dc:creator>lucianopanaro</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bdd]]></category>
		<category><![CDATA[rspec]]></category>

		<guid isPermaLink="false">http://www.decodeuri.com/?p=13</guid>
		<description><![CDATA[Now that I am developing a few new ruby and ror projects I wanted to begin with BDD and RSpec. There are lots of content all around the web so here&#8217;s a quick list of a few links that you might find useful if you are in your baby steps with RSpec (as I am [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lucianopanaro.wordpress.com&amp;blog=2195581&amp;post=13&amp;subd=lucianopanaro&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Now that I am developing a few new ruby and ror projects I wanted to begin with BDD and RSpec. There are lots of content all around the web so here&#8217;s a quick list of a few links that you might find useful if you are in your baby steps with RSpec (as I am <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p><a href="http://blog.davidchelimsky.net/2008/9/22/cucumber">RSpec Story Runner is being replaced</a> by <a href="http://github.com/aslakhellesoy/cucumber">Cucumber</a> for RSpec 1.1.5, but as mentioned <a href="http://groups.google.com/group/rspec/browse_thread/thread/1905de910b3695eb/7683b7ff750e3c44">here</a>, if you are about to start you should go with Cucumber. <a href="http://github.com/aslakhellesoy/cucumber/wikis/ruby-on-rails">Here are the instructions for installing RoR support</a>.</p>
<ul>
<li><a href="http://rspec.info">RSpec&#8217;s site</a> (there are a few <a href="http://rspec.info/documentation/rails/">examples</a> for Rails controllers, models, views and helpers)</li>
<li><a href="http://github.com/dchelimsky/rspec/tree">RSpec on Github</a></li>
<li><a href="http://github.com/aslakhellesoy/cucumber/wikis">Cucumber</a></li>
<li><a href="http://github.com/brynary/webrat">Webrat</a></li>
<li><a href="http://blog.davidchelimsky.net/">David Chelimsky&#8217;s (RSpec&#8217;s creator) blog</a></li>
<li> <a href="http://andrzejonsoftware.blogspot.com">Andrzej Krzywda&#8217;s blog</a>
<ul>
<li><a href="http://andrzejonsoftware.blogspot.com/2008/04/bdd-examples-with-user-stories-and.html">BDD examples with user stories and Webrat</a></li>
<li><a href="http://andrzejonsoftware.blogspot.com/2008/05/story-driven-development.html">Story Driven Development</a></li>
<li><a href="http://andrzejonsoftware.blogspot.com/2008/04/tdd-with-rails-slides-from-my-talk-at.html">TDD with Rails</a></li>
</ul>
</li>
<li><a href="http://blog.kabisa.nl/2008/01/02/RSpec-and-restful-authentication/">RSpec and Restful Authentication</a></li>
<li><a href="http://www.tomtenthij.co.uk/2008/1/25/rspec-plain-text-story-runner-on-a-fresh-rails-app">RSpec plain text story runner on a fresh rails app </a></li>
<li><a href="http://st-on-it.blogspot.com/2008/03/story-writing-is-fun.html">Story writing is fun</a></li>
<li><a href="http://www.joesniff.co.uk/ruby/telling-a-good-story-rspec-stories-from-the-trenches.html">Some RSpec useful links</a></li>
<li><a href="http://www.robbyonrails.com/articles/2008/08/19/rspec-it-should-behave-like">RSpec, it should behave like</a></li>
<li><a href="http://blog.emson.co.uk/2008/06/understanding-rspec-stories-a-tutorial/">Understanding RSpec stories, a tutorial</a></li>
<li><a href="http://www.netbeans.tv/screencasts/Nick-Sieger-Uses-RSpec-with-the-NetBeans-Ruby-Support-305/">NetBeans: Screencast on RSpec support</a></li>
</ul>
<p>Hope you find it useful!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lucianopanaro.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lucianopanaro.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lucianopanaro.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lucianopanaro.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lucianopanaro.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lucianopanaro.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lucianopanaro.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lucianopanaro.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lucianopanaro.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lucianopanaro.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lucianopanaro.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lucianopanaro.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lucianopanaro.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lucianopanaro.wordpress.com/13/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lucianopanaro.wordpress.com&amp;blog=2195581&amp;post=13&amp;subd=lucianopanaro&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lucianopanaro.wordpress.com/2008/10/02/rspec-link-fest/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/55d4558687335fd7de57eb9a2786fb90?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lucianopanaro</media:title>
		</media:content>
	</item>
		<item>
		<title>New skin, new (old) plugin</title>
		<link>http://lucianopanaro.wordpress.com/2008/03/13/new-skin-new-old-plugin/</link>
		<comments>http://lucianopanaro.wordpress.com/2008/03/13/new-skin-new-old-plugin/#comments</comments>
		<pubDate>Thu, 13 Mar 2008 19:49:41 +0000</pubDate>
		<dc:creator>lucianopanaro</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[decodeuri]]></category>
		<category><![CDATA[fxqueues]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://lucianopanaro.webfactional.com/?p=10</guid>
		<description><![CDATA[When I launched this blog a few months ago I promised myself I would post at least weekly. Well, it is pretty obvious that I haven’t. Even more, I was just able to do a few posts commenting on some news I found interesting. So the inmediate question that comes up is simply “why?” . [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lucianopanaro.wordpress.com&amp;blog=2195581&amp;post=10&amp;subd=lucianopanaro&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div class="storycontent">
<p>When I launched this blog a few months ago I promised myself I would post at least weekly. Well, it is pretty obvious that I haven’t. Even more, I was just able to do a few posts commenting on some news I found interesting.</p>
<p>So the inmediate question that comes up is simply “why?” . Well, there are many reasons why:</p>
<ul>
<li>Study comes first.</li>
<li>Work comes second (well, it comes first sometimes).</li>
<li>I couldn’t find time to write (a sort of corollary of the first two) anything I liked.</li>
<li>I hated the template I had.</li>
</ul>
<p>From these bullets, there is one that can be (sort of) easily fixed. Creating a new appealing template that would make me want to post every week can’t be <strong>that </strong>hard, right? Well, it is, especially if you are a designer-wannabe. It took me a long time to come up with a template that I liked, but I am pretty glad with the result.</p>
<p>In the meantime, I came across a plugin from John Resig with similar functionality. Since it’s core implementation was far better than mine, I updated the <a href="http://www.decodeuri.com/jquery-fxqueues-plugin-20/" target="_blank">jQuery FxQueues Plugin to a 2.0 version</a>, by merging John’s and my code (I also created a new example page and some unit tests).</p>
<p>So now that I have a template that I like there is one thing less preventing me from writing new posts. I have a few ideas for some posts and hopefully you will be able to read them soon.</p>
<p>Hope you like this new template as I do!</p>
</div>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/lucianopanaro.wordpress.com/10/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/lucianopanaro.wordpress.com/10/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lucianopanaro.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lucianopanaro.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lucianopanaro.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lucianopanaro.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lucianopanaro.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lucianopanaro.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lucianopanaro.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lucianopanaro.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lucianopanaro.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lucianopanaro.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lucianopanaro.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lucianopanaro.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lucianopanaro.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lucianopanaro.wordpress.com/10/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lucianopanaro.wordpress.com&amp;blog=2195581&amp;post=10&amp;subd=lucianopanaro&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lucianopanaro.wordpress.com/2008/03/13/new-skin-new-old-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/55d4558687335fd7de57eb9a2786fb90?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lucianopanaro</media:title>
		</media:content>
	</item>
	</channel>
</rss>
