<?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>radikalFX</title>
	<atom:link href="http://radikalfx.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://radikalfx.com</link>
	<description>In full FX</description>
	<lastBuildDate>Thu, 28 Jan 2010 14:38:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Making the best of the iPad</title>
		<link>http://radikalfx.com/2010/01/28/making-the-best-of-the-ipad/</link>
		<comments>http://radikalfx.com/2010/01/28/making-the-best-of-the-ipad/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 14:38:00 +0000</pubDate>
		<dc:creator>cra5h</dc:creator>
				<category><![CDATA[radikalFX]]></category>
		<category><![CDATA[iPad]]></category>

		<guid isPermaLink="false">http://radikalfx.com/?p=135</guid>
		<description><![CDATA[Yes I know, everybody has been writing about this thing and probably everybody in the world has the same doubts about Apples latest addition to their product line of ultra sleek products. But instead of trying to list everything I hate about it and all the negative feelings, I would like to write some of [...]]]></description>
			<content:encoded><![CDATA[<p>Yes I know, everybody has been writing about this thing and probably everybody in the world has the same doubts about Apples latest addition to their product line of ultra sleek products. But instead of trying to list everything I hate about it and all the negative feelings, I would like to write some of my initial ideas for new software.</p>
<p><img style="width: 200px; float: right; margin: 10px;" src="http://radikalfx.com/wp-content/uploads/2010/01/jazzmutant_lemur1.jpg" alt="Jazzmutant Lemur" /><strong>1. Musical instrument</strong><br />
The last couple of years I have seen more and more futuristic DJ tools, effect processors and digital instruments. The iPhone is just to small to run the tools on, but imagine having a touch surface a bit bigger, that could be, in Apple promotion talk, pure magic. At the moment we have dedicated hardware systems like Lemur from Jazzmutant which is an amazing system. But software like that on the Lemur could be created for the iPad and that would mean you don&#8217;t need to put down the bucks for the dedicated hardware anymore.</p>
<p><img style="width: 200px; float: right; margin: 10px; clear:right;" src="http://radikalfx.com/wp-content/uploads/2010/01/10_GUI.png" alt="10/GUI" /><strong>2. Touch screen interface for you computer</strong><br />
Imagine being able to control your computer through your iPad, while you iPad is able to give you visual feedback on what is going on. Or looking at the <a href="http://10gui.com/">10/GUI</a> OS concept. I doubt whether Apple will allow something like this, but wouldn&#8217;t it be incredible?</p>
<p>But also if there is no visual response from the actual system. The iPad could serve the same market as the Wacom Bamboo Touch. I know, a lot more expensive, but the possibilities are endless.</p>
<p><img style="width: 200px; float: right; margin: 10px; clear:right;" src="http://radikalfx.com/wp-content/uploads/2010/01/family-guy-monopoly-l.jpg" alt="Monopoly" /><strong>3. Board games</strong><br />
Don&#8217;t think about multiplayer by connecting over wifi to some other system. But multiplayer on one device and sharing it across the table with your friends or family. Starting with games like checkers and chess, but also think about a game like <a href="http://en.wikipedia.org/wiki/Ludo_(board_game)">Ludo</a> or Monopoly.</p>
<p>I know that you could just as easily get the original board game from somewhere underneath some dust and the playing experience might even be better. But still think that have the added interactivity could be a big plus over the traditional games.</p>
]]></content:encoded>
			<wfw:commentRss>http://radikalfx.com/2010/01/28/making-the-best-of-the-ipad/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Animated website background with HTML5</title>
		<link>http://radikalfx.com/2009/10/17/html5-animated-background/</link>
		<comments>http://radikalfx.com/2009/10/17/html5-animated-background/#comments</comments>
		<pubDate>Sat, 17 Oct 2009 13:05:04 +0000</pubDate>
		<dc:creator>cra5h</dc:creator>
				<category><![CDATA[Canvas]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://radikalfx.com/?p=83</guid>
		<description><![CDATA[After fooling around with some of the basic HTML5 Canvas features for my previous post, I decided to also work out some other ideas I had. Today I started implementing a simple animated background for a website.]]></description>
			<content:encoded><![CDATA[<p>After fooling around with some of the basic HTML5 Canvas features for my previous post, I decided to also work out some other ideas I had. Today I started implementing a simple animated background for a website.</p>
<div class="center">
<a href="/files/anibg/"><img src="http://radikalfx.com/wp-content/uploads/2009/10/anibg_screen.png" alt="Animated webpage background with HTML5"/></a><br />
<a href="/files/anibg/">Click here for the <strong>demo</strong></a>
</div>
<p><br/></p>
<p><strong>Using a Canvas Object as a background</strong><br />
Before actually getting to the animating of the background, I first had to setup Canvas as a background object. In order to do this. I have added the Canvas element in an absolute positioned div that is aligned to the top of the page. The reason for using a div around the Canvas is because the browsers don&#8217;t seem to want to put the Canvas in page at 100% without creating scrollbars.</p>
<p>After placing the background a div can be placed on top. When this div is created with a max-height of 100% and overflow set to auto. This layer will automatically give a scrollbar when necessary.</p>
<p>So that leaves us with the following HTML and CSS code:<br/><br/></p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;body&gt;
	 &lt;div id=&quot;backgroundHolder&quot;&gt;
	 	 &lt;canvas id=&quot;backgroundCanvas&quot; width=&quot;800&quot; height=&quot;600&quot;&gt;&lt;/canvas&gt;
	 &lt;/div&gt;
	 &lt;div id=&quot;realbody&quot;&gt;
	 	 &lt;!-- Content --&gt;
	 &lt;/div&gt;
&lt;/body&gt;</pre></div></div>

<p>CSS:<br/><br/></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#backgroundHolder</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#999</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#realbody</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">max-height</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
canvas <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p><strong>Let the browser resize the Canvas</strong><br />
When I created the first setup for this demo. I started by setting the height and width of the Canvas to the height and width of the page. This soon turned out to be quite heavy on the CPU usage at higher resolutions. So I made the Canvas a static size and let the browser resize the area to 100%. This works and performs way better. And because the animated content is abstract it does not really matter that we loose the aspect ratio.</p>
<p>Once you have setup the Canvas behind the page. You can draw whatever you want in this Canvas and it will render behind the normal content in the browser.</p>
<p><strong>How to animate the background</strong><br />
Now that we have done the setup for the page, we can start to animate. I created some really simple code which doesn&#8217;t do very proper checking on the boundaries. It basicly switches 3 variables around to make the background animated: move the bars from right to left, change the rotation of the Canvas context from (&#960; / 32) to -(&#960; / 32), and fade the color between an array of colors.</p>
<p><strong>Drawing the bars</strong><br />
The bars are just drawn rectangles which are drawn a little bit above the canvas till a little bit below the Canvas, this is because of the rotation. In order to draw the bars I use the following code:<br/><br/></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> leftOffset<span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> canvas.<span style="color: #660066;">width</span> <span style="color: #339933;">+</span> <span style="color: #CC0000;">600</span><span style="color: #339933;">;</span> i <span style="color: #339933;">+=</span> <span style="color: #009900;">&#40;</span>BAR_WIDTH <span style="color: #339933;">*</span> <span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	context.<span style="color: #660066;">fillRect</span><span style="color: #009900;">&#40;</span>i <span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span>canvas.<span style="color: #660066;">width</span> <span style="color: #009966; font-style: italic;">/ 2), 0 - (canvas.height /</span> <span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #CC0000;">200</span><span style="color: #339933;">,</span> BAR_WIDTH<span style="color: #339933;">,</span> canvas.<span style="color: #660066;">height</span> <span style="color: #339933;">+</span> <span style="color: #CC0000;">400</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
leftOffset <span style="color: #339933;">-=</span> BAR_SPEED<span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>leftOffset <span style="color: #339933;">+</span> BAR_WIDTH <span style="color: #339933;">*</span> <span style="color: #CC0000;">2</span> <span style="color: #339933;">+</span> <span style="color: #CC0000;">300</span> <span style="color: #339933;">&lt;</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	leftOffset <span style="color: #339933;">+=</span> BAR_WIDTH <span style="color: #339933;">*</span> <span style="color: #CC0000;">2</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The BAR_SPEED is to move the initial leftOffset to the left all the time. Up till it reaches a certain value. Then the leftOffset is scaled up a little so that we don&#8217;t create more and more bars over time. The starting point of the context.fillRect might seem a bit weird. This is because the Canvas is translated to the center. So the starting point for drawing a bar is minus the width of the Canvas area.</p>
<p><strong>Rotating the bars</strong><br />
Rotating the bars is even simpler then the drawing of them. We can just use the context.rotate function to set the rotation of the content that we are drawing. Keep in mind that you might want to save the context state before rotating so you can restore it after the rotation. The JavaScript code for rotating is the following:<br/><br/></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">context.<span style="color: #660066;">save</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
context.<span style="color: #660066;">rotate</span><span style="color: #009900;">&#40;</span>angle <span style="color: #339933;">+=</span> angleAdjust<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// Draw your content here</span>
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>angle <span style="color: #339933;">&gt;</span> MAX_ANGLE <span style="color: #339933;">||</span> angle <span style="color: #339933;">&lt;</span> <span style="color: #CC0000;">0</span> <span style="color: #339933;">-</span> MAX_ANGLE<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	angleAdjust <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span> <span style="color: #339933;">-</span> angleAdjust<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>In the example above MAX_ANGLE is set to &#960; / 32. The variable angleAdjust is used to make sure that we either increase the angle or decrease the angle.</p>
<p><strong>Switching the colors</strong><br />
The effect to finish the whole thing of, is the switching of colors. For this demo I am using 6 colors that I just guessed some RGB values for. Blending the colors is done with this Color object in JavaScript:<br/><br/></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> Color<span style="color: #009900;">&#40;</span>r<span style="color: #339933;">,</span>g<span style="color: #339933;">,</span>b<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">r</span> <span style="color: #339933;">=</span> r<span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">g</span> <span style="color: #339933;">=</span> g<span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">b</span> <span style="color: #339933;">=</span> b<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">step</span> <span style="color: #339933;">=</span> COLOR_STEP<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">fadeTo</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>color<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">r</span> <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">r</span> <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>color.<span style="color: #660066;">r</span> <span style="color: #339933;">-</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">r</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">step</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">g</span> <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">g</span> <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>color.<span style="color: #660066;">g</span> <span style="color: #339933;">-</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">g</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">step</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">b</span> <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">b</span> <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>color.<span style="color: #660066;">b</span> <span style="color: #339933;">-</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">b</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">step</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">step</span> <span style="color: #339933;">+=</span> COLOR_STEP<span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">r</span> <span style="color: #339933;">==</span> color.<span style="color: #660066;">r</span> <span style="color: #339933;">&amp;&amp;</span>
				<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">g</span> <span style="color: #339933;">==</span> color.<span style="color: #660066;">g</span> <span style="color: #339933;">&amp;&amp;</span>
				<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">b</span> <span style="color: #339933;">==</span> color.<span style="color: #660066;">b</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">step</span> <span style="color: #339933;">=</span> COLOR_STEP<span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">getRGB</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">return</span> Math.<span style="color: #660066;">round</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">r</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;,&quot;</span> <span style="color: #339933;">+</span>
				Math.<span style="color: #660066;">round</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">g</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;,&quot;</span> <span style="color: #339933;">+</span>
				Math.<span style="color: #660066;">round</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">b</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Every time the fadeTo method is called, the color that is used will blend more to the color provided as an argument to the fadeTo method. If color provided as a parameter is the same as the color. Then this method will return true so the rest of the code can start providing another color to blend to.</p>
<p>The code to start running through the array of colors then becomes something like this:<br/><br/></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>activeColor.<span style="color: #660066;">fadeTo</span><span style="color: #009900;">&#40;</span>colors<span style="color: #009900;">&#91;</span>nextColorIndex<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	activeColor <span style="color: #339933;">=</span> colors<span style="color: #009900;">&#91;</span>nextColorIndex<span style="color: #339933;">++</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>nextColorIndex <span style="color: #339933;">&gt;=</span> colors.<span style="color: #660066;">length</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		nextColorIndex <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
context.<span style="color: #660066;">fillStyle</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'rgb('</span> <span style="color: #339933;">+</span> activeColor.<span style="color: #660066;">getRGB</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">')'</span><span style="color: #339933;">;</span></pre></div></div>

<p>After setting this demo up today, I have to conclude that doing animations like this is really not that difficult. I think within the next few months we will see more and more awesome website implementations with Canvas. </p>
]]></content:encoded>
			<wfw:commentRss>http://radikalfx.com/2009/10/17/html5-animated-background/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Dynamic image collage with HTML5 and Canvas</title>
		<link>http://radikalfx.com/2009/10/16/canvas-collage/</link>
		<comments>http://radikalfx.com/2009/10/16/canvas-collage/#comments</comments>
		<pubDate>Fri, 16 Oct 2009 21:43:05 +0000</pubDate>
		<dc:creator>cra5h</dc:creator>
				<category><![CDATA[Canvas]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://radikalfx.com/?p=62</guid>
		<description><![CDATA[In the last couple of months the hype around web technology has really started to heat up. The HTML5 standard is getting a lot of attention from all major browser manufacturers and all my favorite browsers are starting to support all the nice new features coming in HTML5.
One of my favorite new features is Canvas, [...]]]></description>
			<content:encoded><![CDATA[<p>In the last couple of months the hype around web technology has really started to heat up. The <a href="http://www.whatwg.org/specs/web-apps/current-work/">HTML5 standard</a> is getting a lot of attention from all major browser manufacturers and all my favorite browsers are starting to support all the nice new features coming in HTML5.</p>
<p>One of my favorite new features is Canvas, prime reason being my hope to finally make Flash obsolete, sorry Adobe. Because I wanted to check out the capabilities of Canvas, I decided to start coding some simple projects with Canvas.</p>
<div class="center">
<a href="/files/collage/demo.html"><img src="http://radikalfx.com/wp-content/uploads/2009/10/screen.png" alt="HTML5 Canvas Collage"/></a>
</div>
<p><br/></p>
<p>My first demo is a simple Canvas element which can be used to make a collage of images. <a href="/files/collage/demo.html">The <strong>demo</strong> can be found here.</a>, <em>you will need a Canvas compatible browser</em>.</p>
<p><strong>What does it do</strong><br />
The <a href="/files/collage/demo.html">demo</a> lets you search for images from <a href="http://www.flickr.com">Flickr</a>. When you have searched for some images, you can click any of the images there to add them to the Canvas part of the page. When the image is added to the Canvas then it&#8217;s automatically created as a new layer. Each layer can be manipulated in the following ways: move, scale, rotate, move layer up and down, remove layer, change opacity, change blending mode and enable or disable shadow.</p>
<p>The layout is a bit similar to image edit software, which I think is quite simple to understand. The code might still contain some bugs and do some unexpected things. <em>Rotating images and then scaling makes the whole thing kinda whobly!</em></p>
<p><strong>How does it work</strong><br />
The JavaScript code for this demo is split up into two parts. The first is a library that loads in all the proper calls for the Canvas element and that gives the page the ability to modify the layers in the collage. The second part of the JavaScript code, is the code to handle all the page interaction and to bind the HTML controls for the layers. I won&#8217;t go into the code for the user controls. But the canvas control might be interesting:<br />
<br/></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">jCollage <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Collage<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#collage&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Create new collage Object with id of the Canvas tag</span>
&nbsp;
jCollage.<span style="color: #660066;">setBackgroundColor</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#fff&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Set background color of collage</span>
jCollage.<span style="color: #660066;">setBackgroundImage</span><span style="color: #009900;">&#40;</span>img<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Set background image for the collage</span>
&nbsp;
jCollage.<span style="color: #660066;">redraw</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Force redraw the collage</span>
&nbsp;
jCollage.<span style="color: #660066;">addLayer</span><span style="color: #009900;">&#40;</span>img<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Add a new layer to the collage</span>
jCollage.<span style="color: #660066;">getLayer</span><span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Get layer by id</span>
jCollage.<span style="color: #660066;">getLayers</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Get Array if all layers</span>
jCollage.<span style="color: #660066;">removeLayer</span><span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Remove layer based on id</span>
&nbsp;
jCollage.<span style="color: #660066;">moveLayerUp</span><span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Move layer up in the array</span>
jCollage.<span style="color: #660066;">moveLayerDown</span><span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Move layer down in the array</span>
&nbsp;
layer.<span style="color: #660066;">isVisible</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Is layer visible</span>
layer.<span style="color: #660066;">toggleVisible</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Toggle visibility</span>
layer.<span style="color: #660066;">hasShadow</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Does layer have shadow</span>
layer.<span style="color: #660066;">toggleShadow</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Toggle shadow</span>
layer.<span style="color: #660066;">setShadow</span><span style="color: #009900;">&#40;</span>boolean<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Set shadow</span>
layer.<span style="color: #660066;">getOpacity</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Get opacity of layer</span>
layer.<span style="color: #660066;">setOpacity</span><span style="color: #009900;">&#40;</span>float<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Set opacity of layer</span>
layer.<span style="color: #660066;">getCompositeOperation</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Set the composite operation</span>
layer.<span style="color: #660066;">setCompositeOperation</span><span style="color: #009900;">&#40;</span>string<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Get the composite operation</span></pre></div></div>

<p>You can find the JavaScript code for this <a href="/files/collage/jcollage.js">here</a>. I might one day work this out as a jQuery plugin, but don&#8217;t know if that will be worth the extra effort.</p>
<p><strong>Conclusion</strong><br />
Getting up to speed on the Canvas element is quite easy and the information for the HTML5 standard is already enough to get you going. Because a lot of people have already been working with this feature, it&#8217;s also very simple to find more detailed information about problems and how to solve them.</p>
<p>The most difficult thing to get going was handling the collision interaction with the Objects, because I couldn&#8217;t use the normal mouse events based on the DOM. I had to figure out the math behind the collisions myself, this code is not very pretty. But after getting this demo running, I have to say that it was not very difficult to code and Canvas is definitely going into a direction were it could replace Flash functionality. I just hope that Internet Explorer starts supporting it some time soon as well!</p>
]]></content:encoded>
			<wfw:commentRss>http://radikalfx.com/2009/10/16/canvas-collage/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>No more cookies, client side database on the iPhone</title>
		<link>http://radikalfx.com/2009/03/15/no-more-cookies-client-side-database-on-the-iphone/</link>
		<comments>http://radikalfx.com/2009/03/15/no-more-cookies-client-side-database-on-the-iphone/#comments</comments>
		<pubDate>Sun, 15 Mar 2009 11:29:24 +0000</pubDate>
		<dc:creator>cra5h</dc:creator>
				<category><![CDATA[Client side database]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[SQLite]]></category>

		<guid isPermaLink="false">http://radikalfx.com/?p=38</guid>
		<description><![CDATA[At the moment I am working on a small iPhone web application. The main goal of creating this application is to check out the capabilities of my favorite phone. While working on this demo application, I wanted to store favorite information for every user. Since I don&#8217;t want to set up server side databases for [...]]]></description>
			<content:encoded><![CDATA[<p>At the moment I am working on a small iPhone web application. The main goal of creating this application is to check out the capabilities of my favorite phone. While working on this demo application, I wanted to store favorite information for every user. Since I don&#8217;t want to set up server side databases for just a small test web application. My first thought was the always hated cookie. But before doing that I wanted to look into the possibilities of the HTML5 database support. I knew that this was implemented in the latest Safari release. But didn&#8217;t know if it was in Safari on the iPhone. But you know what, it is!</p>
<p>I won&#8217;t go into all the details, but I setup a very simple demo page here: <a href="http://radikalfx.com/files/db.html">http://radikalfx.com/files/db.html</a>. Visit that link with your iPhone or with Safari 4 to see how it works. The page lets you creating and dropping a table in your client side browser database. And you can insert, select and delete data in this table.</p>
<p><strong>So how does it work</strong><br />
The first thing to do, is create a connection to the database. This can be done with some code like this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> setupDatabase<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>window.<span style="color: #660066;">openDatabase</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #003366; font-weight: bold;">var</span> shortName <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;testdb&quot;</span><span style="color: #339933;">;</span>
      <span style="color: #003366; font-weight: bold;">var</span> version <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;1.0&quot;</span><span style="color: #339933;">;</span>
      <span style="color: #003366; font-weight: bold;">var</span> displayName <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;Test Database&quot;</span><span style="color: #339933;">;</span>
      <span style="color: #003366; font-weight: bold;">var</span> maxSize <span style="color: #339933;">=</span> <span style="color: #CC0000;">65536</span><span style="color: #339933;">;</span>
      mydb <span style="color: #339933;">=</span> openDatabase<span style="color: #009900;">&#40;</span>shortName<span style="color: #339933;">,</span> version<span style="color: #339933;">,</span> displayName<span style="color: #339933;">,</span> maxSize<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      dbReady <span style="color: #339933;">=</span> mydb <span style="color: #339933;">!=</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
      writeStatus<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;No JavaScript database support!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">catch</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    dbReady <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    writeStatus<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Exception while setting up database: &quot;</span> <span style="color: #339933;">+</span> e.<span style="color: #660066;">message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The most important call in this code is the <code>mydb = openDatabase(shortName, version, displayName, maxSize);</code> which opens the database connection for you. </p>
<p>After this is done you can start transactions on this database in the following way:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">mydb.<span style="color: #660066;">transaction</span><span style="color: #009900;">&#40;</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>transaction<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  transaction.<span style="color: #660066;">executeSql</span><span style="color: #009900;">&#40;</span>query<span style="color: #339933;">,</span> data<span style="color: #339933;">,</span> dataHandler<span style="color: #339933;">,</span> errorHandler<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The transaction requires a query, the data added to the query. And a data handler object which is called when the transaction succeeded and a error handler for handling errors in the transaction. </p>
<p>For inserting data I created the following very basic data handler in <a href="http://radikalfx.com/files/db.html">my sample code</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> insertDataHandler<span style="color: #009900;">&#40;</span>transaction<span style="color: #339933;">,</span> results<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  writeStatus<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Insert row with id: &quot;</span> <span style="color: #339933;">+</span> results.<span style="color: #660066;">insertId</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Since this functionality is build with <a href="http://www.sqlite.org">SQLite</a>, you can use the <a href="http://www.sqlite.org/lang.html">documentation of SQLite</a> to figure out what you can do with your queries and how they should be build up.</p>
<p>Since the application I am developing is just for the iPhone, I can safely use this functionality. Of course for normal web development it&#8217;s kinda tricky since most browsers don&#8217;t support it yet.</p>
<p>For more information on this technology you can also visit the <a href="http://developer.apple.com/safari/library/documentation/iPhone/Conceptual/SafariJSDatabaseGuide/UsingtheJavascriptDatabase/chapter_5_section_1.html#//apple_ref/doc/uid/TP40007256-CH3-SW1">Safari Programming Guide</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://radikalfx.com/2009/03/15/no-more-cookies-client-side-database-on-the-iphone/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Canonical Links: Google, Yahoo &amp; Microsoft working together</title>
		<link>http://radikalfx.com/2009/02/16/canonical-links-google-yahoo-microsoft-working-together/</link>
		<comments>http://radikalfx.com/2009/02/16/canonical-links-google-yahoo-microsoft-working-together/#comments</comments>
		<pubDate>Mon, 16 Feb 2009 10:51:31 +0000</pubDate>
		<dc:creator>cra5h</dc:creator>
				<category><![CDATA[SEO]]></category>

		<guid isPermaLink="false">http://radikalfx.com/?p=31</guid>
		<description><![CDATA[It doesn&#8217;t happen very often, but every once in a while all the major search engines decide on something together. A week ago something like this happened and they decided on supporting canonical links in pages.
Is this useful for you? That really depends on what you are doing on the web. But for example at [...]]]></description>
			<content:encoded><![CDATA[<p>It doesn&#8217;t happen very often, but every once in a while all the major search engines decide on something together. A week ago something like this happened and they decided on supporting canonical links in pages.</p>
<p>Is this useful for you? That really depends on what you are doing on the web. But for example at my work this really helps a lot. At ilocal.nl we have different ways of linking to company detail pages. For example:<br />
<a href="http://www.ilocal.nl/WebDisplayServlet?iqk1=466448876390121&#038;iqf1=id&#038;tid=DetailsDisplay">http://www.ilocal.nl/WebDisplayServlet?iqk1=466448876390121&#038;iqf1=id&#038;tid=DetailsDisplay</a><br />
<a href="http://www.ilocal.nl/nl/restaurants/bistro-zilverzoen/290448876390948">http://www.ilocal.nl/nl/restaurants/bistro-zilverzoen/290448876390948</a></p>
<p>Above links contain exactly the same information. The only difference is that the first one is the old URL that we used to use. And then we switched to the second URL for SEO improvement. But /WebDisplayServlet links still get a lot of traffic from pages linking to them. </p>
<p>Now what you can do with canonical links is when the first URL is requested, add the following HTML in the head of the page:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;link rel=&quot;canonical&quot; href=&quot;http://www.ilocal.nl/nl/restaurants/bistro-zilverzoen/290448876390948&quot;/&gt;</pre></div></div>

<p>This way all our friendly search crawlers can instantly recognize that it shouldn&#8217;t put this URL in it&#8217;s index, but use the canonical link. If the search engine then starts crawling the link provided here or if it&#8217;s using the data from this page, isn&#8217;t 100% clear to me. But if the page is accessed by the second URL then you should <strong>not</strong> put this canonical link in. So the crawler doesn&#8217;t try to look up a page that it&#8217;s already looking at.</p>
<p>One problem with this canonical link is that the content of the page should be the same or close to the same as the page that the crawler found the link on. But for ilocal what I would like to do is when a users searches for something. Then let the canonical link point to a static result page. For example if a user links to a search for &#8220;hotel zwembad&#8221; in &#8220;utrecht&#8221; (<a href="http://www.ilocal.nl/WebSearchServlet?iqk1=hotel+zwembad&#038;iqk3=utrecht&#038;point=&#038;sort=distance%3Aasc&#038;x=0&#038;y=0&#038;tid=NewSearch&#038;ips=10&#038;iv1=1&#038;loc=1&#038;irs=&#038;isf=priority&#038;iqk2=not+member&#038;iqf2=groupListing&#038;iv11=">link</a>). Let the canonical link, link to the rewritten results page for hotels in utrecht (<a href="http://www.ilocal.nl/rubriek/hotels/utrecht">link</a>). But in the <a href="http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html">blog post on google</a> about the canonical links it says the following:</p>
<blockquote><p><strong>Is it okay if the canonical is not an exact duplicate of the content?</strong><br />
We allow slight differences, e.g., in the sort order of a table of products. We also recognize that we may crawl the canonical and the duplicate pages at different points in time, so we may occasionally see different versions of your content. All of that is okay with us.</p></blockquote>
<p>So right now I will not provide a canonical link on the results pages of ilocal.nl, but it would be nice to also have a way to specify some sort of parent URL which you want crawlers to use instead of all the URL which is cluttered with refinements by users and other nasty parameters. It&#8217;s a good thing that in the next release of ilocal.nl we will remove a lot of defaulted parameters and this might help a bit as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://radikalfx.com/2009/02/16/canonical-links-google-yahoo-microsoft-working-together/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Yahoo Pipes, impressive!</title>
		<link>http://radikalfx.com/2009/02/15/yahoo-pipes-impressive/</link>
		<comments>http://radikalfx.com/2009/02/15/yahoo-pipes-impressive/#comments</comments>
		<pubDate>Sun, 15 Feb 2009 10:03:39 +0000</pubDate>
		<dc:creator>cra5h</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://radikalfx.com/?p=24</guid>
		<description><![CDATA[Every once in a while you are surfing the web and come across something that you really think, whoa. For me this is most of the time something cool in graphical design or user interaction. But a week ago I came across Yahoo Pipes and just at that moment I also had a good reason [...]]]></description>
			<content:encoded><![CDATA[<p>Every once in a while you are surfing the web and come across something that you really think, whoa. For me this is most of the time something cool in graphical design or user interaction. But a week ago I came across <a href="http://pipes.yahoo.com/pipes/">Yahoo Pipes</a> and just at that moment I also had a good reason to use it.</p>
<p>Now the best way to start is to describe what <a href="http://pipes.yahoo.com/pipes/">Yahoo Pipes</a> is. The description from the Yahoo Pipes website is:</p>
<blockquote><p>Pipes is a free online service that lets you remix popular feed types and create data mashups using a visual editor. You can use Pipes to run your own web projects, or publish and share your own web services without ever having to write a line of code.</p></blockquote>
<p>So a visual way to mashup different sources of data. So what you for example could do is combine Flickr, Facebook and Last.fm data into one nice tailored data feed and then you won&#8217;t have to combine all the sources of data in you web application. But you&#8217;ll be able to just do one JSON call and get all you data in the format that you want.</p>
<p><strong>My use case</strong><br />
The reason I found this interesting is because I ran into a problem with the last.fm API. The problem is in the <a href="http://www.last.fm/api/show?service=119">artist.getSimilar</a> method. This method can be used to get a number of artist similar to the artist name provided. This works quite well when you look at the normal XML return value. But when you switch to the JSON output it doesn&#8217;t work correctly anymore. The reason for this, is that this method in XML returns a similarartists tag. This tag has a collection of child elements with the name artist. But the similarartists also has a attribute with the name artist. Probably in the last.fm implementation the switch between XML to JSON format is automatic. And in JSON all the child elements will be discarded. So basically rendering the JSON output of the <a href="http://www.last.fm/api/show?service=119">artist.getSimilar</a> method useless.</p>
<p><strong>In Pipes</strong><br />
So I was interested to see whether Yahoo Pipes would be able to fix this problem by parsing the XML and then outputting the proper values. So I created an account, logged in and started dragging and dropping elements around. I created the following flow:</p>
<p><img src="http://radikalfx.com/wp-content/uploads/2009/02/pipesgetsimilarartists.jpg" alt="Pipes getSimilarArtists" title="Pipes getSimilarArtists" width="664" height="622" class="aligncenter size-full wp-image-26" /></p>
<p>I used the following components to parse the last.fm XML and create a API call that would be usable in JSON.</p>
<p><strong>URL Builder</strong><br />
The first call is a URL builder. This builder has a base URL which is that URL of the last.fm API. In the URL Builder you can add as many query parameters as you want. In order to make the parameters configurable you can hook in Text Input fields. For this functionality I added text input for the artist name and for the API key. This way other users can also use my generated pipe if they like to.</p>
<p><strong>Fetch Data</strong><br />
The URL Builder is connected to the input of a Fetch Data block. What this block does is read in the information from the URL build by the URL Builder and parses it for you. In the &#8220;Path to item list&#8221; you can already select what exact data it should get from the XML feed. In my case I want all similarartist.artist.</p>
<p>But that still leaves me with the problem that the first Object is just the artist name. In outputting the data that&#8217;s really not nice and I want to get rid of that first one.</p>
<p><strong>Split, Count, Simple Math &#038; Tail</strong><br />
In order to get rid of the first item from this list I start of by splitting the output of the Fetch Data block. On the left output of the split I count the number of results. The total amount of items is then put into a Simple Math block. The simple math block then just subtracts 1 from the total count. The other part of the Split block is fed into the Tail block. What the Tail block does is that it outputs only the last items from the provided data. So in the Tail the (total amount &#8211; 1) is provided. Why they labeled this field &#8220;Emit after position&#8221; I don&#8217;t know. But I don&#8217;t think this is a very proper description.</p>
<p><strong>Sub-element</strong><br />
The last step before outputting the data, is that I only output the item.name. This is because this is the only important element for me at this time and I don&#8217;t want to clutter the pipe output with a lot of data that I don&#8217;t have any use for.</p>
<p>After saving the Pipe you are then able to connect to the pipe. You can even provide that exact path to use. My pipe can by accessed over here:<br />
<a href="http://pipes.yahoo.com/fruitmaster/getsimilarartists?artist=Justice&#038;_render=JSON">http://pipes.yahoo.com/fruitmaster/getsimilarartists?artist=Justice&#038;_render=JSON</a></p>
<p>Now I do have to say that not all is well in the land of Pipes. A few times the Yahoo online editor didn&#8217;t completely get what I was doing and wasn&#8217;t working as it should. This was easily resolved by reloading the page. But still it was kind of annoying. Also the documentation is sometimes kinda vague and the preview data in the editor also sometimes fails. But all in all, it&#8217;s a nice piece of software that Yahoo set up!</p>
]]></content:encoded>
			<wfw:commentRss>http://radikalfx.com/2009/02/15/yahoo-pipes-impressive/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Spring 2.5 with annotations and REST requests</title>
		<link>http://radikalfx.com/2009/01/31/spring-25-with-annotations-and-rest-requests/</link>
		<comments>http://radikalfx.com/2009/01/31/spring-25-with-annotations-and-rest-requests/#comments</comments>
		<pubDate>Sat, 31 Jan 2009 17:09:09 +0000</pubDate>
		<dc:creator>cra5h</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[Tomcat]]></category>

		<guid isPermaLink="false">http://radikalfx.com/?p=14</guid>
		<description><![CDATA[Spring 2.5 Web MVC is a really great framework, especially when using annotations you don&#8217;t have to spend to much time on getting everything up and running and separating MVC logic is really simple. One problem I recently came across, was something which was a bit annoying. When using Spring 2.5 with annotations, it&#8217;s not [...]]]></description>
			<content:encoded><![CDATA[<p>Spring 2.5 Web MVC is a really great framework, especially when using annotations you don&#8217;t have to spend to much time on getting everything up and running and separating MVC logic is really simple. One problem I recently came across, was something which was a bit annoying. When using Spring 2.5 with annotations, it&#8217;s not possible to define a URL pattern with a wild card in it. So creating REST full URL patterns can be a problem then. This is something that they will have build into Spring 3.0. But since that is not ready for production I wrote a small hack to at least be able to easily define URL patterns with wild cards.</p>
<p><strong>Creating a custom handler mapping Object</strong><br />
The first thing to do is, is to create a custom handler mapping Object. This Object can extend the Spring DefaultAnnotationHandlerMapping. This handler mapping won&#8217;t overwrite the DefaultAnnotationHandlerMapping. But we will just use this one to test for our REST url patterns. If no match is found. Then the method getHandlerInternal will return null. When null is returned, this means that Spring will go on and try to do this request in any of the other handler mappings configured. How this is configured in Spring comes up a little bit later in this post.</p>
<p>The code for the new RestHandlerMapping is as follows:<br />
<br/></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.radikalfx.demo.handler</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.servlet.http.HttpServletRequest</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.springframework.beans.factory.annotation.Required</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.springframework.web.servlet.HandlerExecutionChain</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> RestHandlerMapping <span style="color: #000000; font-weight: bold;">extends</span> DefaultAnnotationHandlerMapping <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> requestNames<span style="color: #339933;">;</span>
&nbsp;
	@Override
	<span style="color: #000000; font-weight: bold;">public</span> HandlerExecutionChain getHandlerInternal<span style="color: #009900;">&#40;</span>HttpServletRequest request<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Exception</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #003399;">String</span> uri <span style="color: #339933;">=</span> request.<span style="color: #006633;">getRequestURI</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> requestName <span style="color: #339933;">:</span> requestNames<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>uri.<span style="color: #006633;">startsWith</span><span style="color: #009900;">&#40;</span>requestName<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">new</span> HandlerExecutionChain<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">getHandlerMap</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>requestName<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	@Required
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setRequestNames<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> requestNames<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">requestNames</span> <span style="color: #339933;">=</span> requestNames<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>This RestHandlerMapping Object has the option to set one or more request names. This was we can just have this one Handler to set up multiple different URL patterns for different Controllers.</p>
<p><strong>The Controller</strong></p>
<p>Next is the controller. There is not much special that needs to happen to the controller. The only thing that we need to do, is make sure that we place a request mapping similar to that provided to the handler. And that this request mapping is placed on the class and not on the method.<br />
<br/></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.radikalfx.demo.controller</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.servlet.http.HttpServletRequest</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.springframework.stereotype.Controller</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.springframework.web.bind.annotation.RequestMapping</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.springframework.web.servlet.ModelAndView</span><span style="color: #339933;">;</span>
&nbsp;
@Controller
@RequestMapping<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/action/&quot;</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ActionController <span style="color: #009900;">&#123;</span>
&nbsp;
	@RequestMapping
	<span style="color: #000000; font-weight: bold;">public</span> ModelAndView getAction<span style="color: #009900;">&#40;</span>HttpServletRequest request<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">new</span> ModelAndView<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;action&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><strong>Spring configuration</strong><br />
Next thing we need to do, is that we need to change the Spring configuration a little bit. Normally when using annotated Web MVC you would probably use the DefaultAnnotationHandlerMapping, with this hack, we are still doing that. But creating an own handler mapping to be used before this one. In you configuration, this would become:<br />
<br/></p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;com.radikalfx.demo.handler.RestHandlerMapping&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;requestNames&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;list<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/action/<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/list<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/property<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p><em>Don&#8217;t forget to also include in the Controller in the Spring configuration!</em></p>
<p><strong>Changing web.xml</strong><br />
The final thing that you need to do, to get this working, is change the web.xml so that the DispatcherServlet gets the requests for the URL pattern that we want to use:<br />
<br/></p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/action/*<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>And that&#8217;s it. Of course you probably want to have some service that can handle the HttpServletRequest in the controller and extract the proper information from the request URI. But basically this is all you need to use wild cards in URL patterns with Spring 2.5 and annotations. </p>
]]></content:encoded>
			<wfw:commentRss>http://radikalfx.com/2009/01/31/spring-25-with-annotations-and-rest-requests/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Check if image exist</title>
		<link>http://radikalfx.com/2008/05/14/check-if-image-exist/</link>
		<comments>http://radikalfx.com/2008/05/14/check-if-image-exist/#comments</comments>
		<pubDate>Wed, 14 May 2008 07:26:55 +0000</pubDate>
		<dc:creator>cra5h</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://radikalfx.com/?p=12</guid>
		<description><![CDATA[I ran into some problems that I don&#8217;t want to show these horrible looking red cross images in Internet Explorer when an image doesn&#8217;t exists. And it turns out it&#8217;s really easy to solve this problem. You can just use the onerror attribute of the img tag. Having jquery, you could really easily just put [...]]]></description>
			<content:encoded><![CDATA[<p>I ran into some problems that I don&#8217;t want to show these horrible looking red cross images in Internet Explorer when an image doesn&#8217;t exists. And it turns out it&#8217;s really easy to solve this problem. You can just use the onerror attribute of the img tag. Having jquery, you could really easily just put a $(this).hide(); in the onerror attribute and the image is automatically hidden when it can&#8217;t be loaded.</p>
]]></content:encoded>
			<wfw:commentRss>http://radikalfx.com/2008/05/14/check-if-image-exist/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Communication between Flash and Javascript</title>
		<link>http://radikalfx.com/2008/04/03/communication-between-flash-and-javascript/</link>
		<comments>http://radikalfx.com/2008/04/03/communication-between-flash-and-javascript/#comments</comments>
		<pubDate>Thu, 03 Apr 2008 17:02:21 +0000</pubDate>
		<dc:creator>cra5h</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://radikalfx.com/2008/04/03/communication-between-flash-and-javascript/</guid>
		<description><![CDATA[Today I spend some time looking at the best way to communicating between a Flash Object and the Javascript in the page containing the Flash Object. After seeing a lot of out of date solutions I came by this article from Adobe:
Using the External API for Flashâ€“JavaScript Communication
It makes it really easy to do the [...]]]></description>
			<content:encoded><![CDATA[<p>Today I spend some time looking at the best way to communicating between a Flash Object and the Javascript in the page containing the Flash Object. After seeing a lot of out of date solutions I came by this article from Adobe:</p>
<blockquote><p><a href="http://www.adobe.com/devnet/flash/articles/external_interface_05.html">Using the External API for Flashâ€“JavaScript Communication</a></p></blockquote>
<p>It makes it really easy to do the communication between the two technologies by using the following code in Flash</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">external</span>.<span style="color: #66cc66;">*</span>;
<span style="color: #808080; font-style: italic;">// The name of a JavaScript function to call </span>
<span style="color: #000000; font-weight: bold;">var</span> callJasFunction:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;callJavascript&quot;</span>;
<span style="color: #808080; font-style: italic;">//parameter </span>
<span style="color: #000000; font-weight: bold;">var</span> msg:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;Hello. ^^&quot;</span>;
<span style="color: #808080; font-style: italic;">// The return value after calling JavaScript </span>
<span style="color: #000000; font-weight: bold;">var</span> returnValue:<span style="color: #0066CC;">String</span> = ExternalInterface.<span style="color: #0066CC;">call</span><span style="color: #66cc66;">&#40;</span>callJasFunction, msg<span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
return_txt.<span style="color: #0066CC;">text</span> = returnValue;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://radikalfx.com/2008/04/03/communication-between-flash-and-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Footer placement?</title>
		<link>http://radikalfx.com/2008/03/23/footer-placement/</link>
		<comments>http://radikalfx.com/2008/03/23/footer-placement/#comments</comments>
		<pubDate>Sun, 23 Mar 2008 10:49:34 +0000</pubDate>
		<dc:creator>cra5h</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://radikalfx.com/2008/03/23/footer-placement/</guid>
		<description><![CDATA[This post will give a little description about how you could place a footer at the bottom of a HTML page, but because I don&#8217;t like the way I am currently doing it, please let me know if you have any better solutions.
The requirements for the footer placement are the following:

Footer should be at the [...]]]></description>
			<content:encoded><![CDATA[<p>This post will give a little description about how you could place a footer at the bottom of a HTML page, but because I don&#8217;t like the way I am currently doing it, please let me know if you have any better solutions.</p>
<p>The requirements for the footer placement are the following:</p>
<ul>
<li>Footer should be at the bottom of the page when the page is higher then the browser viewport.</li>
<li>Footer should be at the bottom of the browser viewport if the page is smaller then the browser viewport. No scrollbar should be shown.</li>
<li>Footer has a 100% width</li>
<li>Browser resizing and AJAX actions in the webpage that change the page height should update the footer position.</li>
</ul>
<p>At the moment I am using a JavaScript solution that uses the <a href="http://jquery.com/" title="jQuery">jQuery</a> 1.2.3 library. You can check it out on this page: <a href="http://www.ilocal.nl" target="_blank">ilocal.nl</a>.</p>
<p>It uses the following JavaScript and CSS code:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>window<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  setFooterPosition<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
$<span style="color: #009900;">&#40;</span>window<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">resize</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  setFooterPosition<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">function</span> setFooterPosition<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#footer&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span>window<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #CC0000;">65</span> <span style="color: #339933;">&lt;</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;body&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#footer&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;top&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;body&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;px&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#footer&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;top&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span>window<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #CC0000;">65</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;px&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#header&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #CC0000;">996</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#topbanner&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;width&quot;</span><span style="color: #339933;">,</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#header&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;px&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#topbanner&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;width&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;996px&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>  $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#footer&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;width&quot;</span><span style="color: #339933;">,</span> $<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;px&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#footer&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;left&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;0px&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#footer&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#footer</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">53px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">z-index</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Please note that earlier versions of jQuery don&#8217;t work with this code, so it&#8217;s important to use 1.2.3. You might also notice that there is some difference between the offset height that I am using in the JavaScript, and the height of the footer, this is because I want a small margin between the content on the page and the footer.</p>
]]></content:encoded>
			<wfw:commentRss>http://radikalfx.com/2008/03/23/footer-placement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
