<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>925 HTML</title>
	
	<link>http://925html.com</link>
	<description>For those of us who work with the web daily.</description>
	<lastBuildDate>Sun, 14 Mar 2010 18:02:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/925html" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="925html" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Auto-Building YUI 3 Custom Modules</title>
		<link>http://925html.com/techniques/auto-building-yui-3-custom-modules/</link>
		<comments>http://925html.com/techniques/auto-building-yui-3-custom-modules/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 06:21:13 +0000</pubDate>
		<dc:creator>Eric Ferraiuolo</dc:creator>
				<category><![CDATA[Techniques]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[compression]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JSLint]]></category>
		<category><![CDATA[minify]]></category>
		<category><![CDATA[YUI 3]]></category>

		<guid isPermaLink="false">http://925html.com/?p=469</guid>
		<description><![CDATA[The details of my development strategy to automatically build YUI 3 Custom Modules that I outlined in my talk at YUICONF 2009.
YUI 3’s modularity and instance sandboxing invites developers to create their own custom modules, breaking apart their specific application logic.
Having developed over 30 Custom YUI 3 Modules in the last year I quickly realized [...]]]></description>
			<content:encoded><![CDATA[<p>The details of my development strategy to automatically build YUI 3 Custom Modules that I outlined in <a href="http://developer.yahoo.com/yui/theater/video.php?v=ericf-yuiconf2009-webapps">my talk at YUICONF 2009</a>.</p>
<p>YUI 3’s modularity and instance sandboxing invites developers to create their own <em>custom</em> modules, breaking apart their specific application logic.</p>
<div id="attachment_481" class="wp-caption aligncenter" style="width: 460px"><a href="http://925html.com/wordpress/wp-content/uploads/2010/01/yui3_module_categories.png"><img class="size-medium wp-image-481" title="YUI 3 Module Categories" src="http://925html.com/wordpress/wp-content/uploads/2010/01/yui3_module_categories-450x164.png" alt="Diagram depicting the categories of YUI 3 modules on a scale from general to specific" width="450" height="164" /></a><p class="wp-caption-text">YUI 3 Modules Categories from General to Specific</p></div>
<p>Having developed over 30 Custom YUI 3 Modules in the last year I quickly realized I needed a sane way to go from writing code to running it in the browser. So, I set out to connect the <a href="http://yuilibrary.com/projects/builder">YUI Builder</a> with my IDE.</p>
<p>For the last three or more years I’ve been using <a href="http://www.aptana.org/">Aptana Studio IDE</a> for HTML, CSS, and JavaScript code development. Aptanta, which is built on <a href="http://www.eclipse.org/">Eclipse</a>, can be used standalone or as a plugin to Eclipse. The concepts here are not specific to Eclipse; the details of my technique on implementing the concepts are however.</p>
<h3>Goals and Reasons</h3>
<ul>
<li><strong>Synchronize UI building with the rest of the project code.</strong><br />
Compiling of JavaScript (when needed) should occur along with any server-side code compilation. IDEs such as Eclipse, ‘Build Automatically’ a project&#8217;s Java code; I want my YUI 3 Custom Modules to ‘Build Automatically’ as well.</li>
<li><strong>Faster turn-around.</strong><br />
I don’t want to switch from my IDE to another program to run builds on my UI code. The IDE should recognize when <em>it</em> needs to re-build my UI code. I want a process where I: hack… hack… save… refresh-browser…</li>
<li><strong>Easier for non-UI developers.</strong><br />
Teams of developers are usually working on a shared code-base; a mixture of server-side and client-side code wrapped up into one project. If the UI code is built automatically, like the server-side code, the non-UI developers <span style="text-decoration: line-through;">won’t bitch</span> don’t have to do anything UI-related.</li>
<li><strong>Cmd + S = JSLint, Compress, &amp; Deploy.</strong><br />
Anytime the source file(s) to a YUI 3 Custom Module change, the YUI Builder tool runs, giving me: JSLint-ing, YUI Compressor-ing, and YUI 3 Module wrapping.</li>
</ul>
<p><span id="more-469"></span></p>
<h3>Auto-Building in Eclipse IDE</h3>
<p>Eclipse is an open, extensible, integrated development environment. Eclipse’s <strong>External Tools</strong> feature a great place to integrate the YUI Builder into the IDE:</p>
<blockquote><p>“External tools allow you to configure and run programs, batch files, <strong>Ant buildfiles</strong>, and others using the Workbench. You can save these external tool configurations and run them at a later time.</p>
<p>Output from external tools is displayed in the console view.</p>
<p>You can add external tools as <strong>part of the build process for a project</strong>. These external tools will run in the specified order every time a project is built.” — <cite><a href="http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.platform.doc.user/concepts/concepts-exttools.htm">Eclipse.org</a></cite></p></blockquote>
<p>Eclipse External Tools Builders can <em>run</em> Ant tasks, the YUI Builder and YUI 3 Custom Module build files <em>are</em> Ant tasks, <em>perfect!</em></p>
<p>The goals listed above are reachable. I’m, not going to lie, this was <em>hard</em> to get working the first time; I feel it’s best to go through the process in steps.</p>
<h4>0. Git YUI Builder</h4>
<p>You need a copy of the YUI Builder project. If you already have Git clones of other YUI projects, make the Builder project a sibling to them.</p>
<pre><code class="bash">$ git clone git://github.com/yui/builder.git</code></pre>
<p><a href="http://github.com/yui/builder/tree/master/componentbuild/#readme">Detailed YUI Builder installation instructions</a>.</p>
<h4>1. Set <code>builddir</code> as a Global Ant Property in Eclipse</h4>
<p>YUI 3 Module build files need to be configured with a <code>builddir</code> property; Eclipse can be configured with the path to YUI Builder on your system. By creating this property you will not have to hard-code the path to the YUI Builder project; making it easier to share code amongst a team. Everyone in your team will need to set the <code>builddir</code> Ant property in their Eclipse configuration; a trade-off between configuration and development environment convention.</p>
<p><strong>Eclipse &gt; Preferences &gt; Ant &gt; Runtime &gt; Properties</strong><br />
Name: <strong>builddir</strong><br />
Value: <strong>/path/to/yui/builder/componentbuild</strong><br />
The value will needs to be set for each system specifically.</p>
<div id="attachment_480" class="wp-caption aligncenter" style="width: 460px"><a href="http://925html.com/wordpress/wp-content/uploads/2010/01/ant_global_prop.png"><img class="size-medium wp-image-480" title="Ant Global Properties" src="http://925html.com/wordpress/wp-content/uploads/2010/01/ant_global_prop-450x299.png" alt="Screenshot of Eclipse’s Ant Global Properties configuration" width="450" height="299" /></a><p class="wp-caption-text">Eclipse’s Ant Global Properties</p></div>
<h4>2. Create YUI 3 Module Directory Structure</h4>
<p>For each YUI 3 Custom Module you create, you’ll want to create a directory structure that mimics the default structure for YUI 3 Core Modules (Note: The directory structure can be different, you’ll just have to “tell” the YUI Builder via extra configuration in the <code>build.properties</code> file):</p>
<p>Assume we’re creating a module named <strong>test</strong></p>
<pre><code class="php">/../
	test/
		js/
			test.js
		build.xml
		build.properties</code></pre>
<h4>3. Create build.xml and build.properties Files</h4>
<p>The build.xml file is ran by Ant, it defines some meta-data about the module build and imports the module-specific build.properties file.</p>
<p>Again, assuming a module named <strong>test</strong></p>
<h5>build.xml</h5>
<pre><code class="html">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!-- Test Component Build File --&gt;
&lt;project name="Test" default="local"&gt;
    &lt;description&gt;Test Build File&lt;/description&gt;
    &lt;property file="build.properties" /&gt;
    &lt;import file="${builddir}/3.x/bootstrap.xml" description="Default Build Properties and Targets" /&gt;
&lt;/project&gt;</code></pre>
<h5>build.properties</h5>
<p>I left in the comments to provide explanations of the main settings.</p>
<pre><code class="php"># Test Build Properties

# The name of the component. E.g. event, attribute, widget
component=test

# The list of files which should be concatenated to create the component.
# NOTE: For a css component (e.g. cssfonts, cssgrids etc.) use component.cssfiles instead.
# component.jsfiles=test.js, testHelperClass.js, testSubComponentClass.js
component.jsfiles=test.js

# The list of modules this component requires. Used to set up the Y.add module call for YUI 3.
component.requires=widget

# The list of modules this component supersedes. Used to set up the Y.add module call for YUI 3.
component.supersedes=

# The list of modules that are optional for this module. Used to set up the Y.add module call for YUI 3.
component.optional=</code></pre>
<h4>4. Connect Eclipse With YUI Builder and Module’s Build File</h4>
<p>Creating and configuring a new Project Builder will allow Eclipse to drive the YUI Builder tool for your YUI 3 Custom Module.</p>
<h5>Open Project Properties</h5>
<p><strong>Project &gt; Properties</strong></p>
<div id="attachment_496" class="wp-caption aligncenter" style="width: 460px"><a href="http://925html.com/wordpress/wp-content/uploads/2010/01/select_project_properties.png"><img class="size-full wp-image-496" title="Select: Project &gt; Properties" src="http://925html.com/wordpress/wp-content/uploads/2010/01/select_project_properties.png" alt="Screenshot showing the Project menu of Eclipse with Properties selected" width="450" height="300" /></a><p class="wp-caption-text">Selecting Project &gt; Properties in Eclipse</p></div>
<h5>Create New Project [Ant] Builder</h5>
<p><strong>Builders &gt; New…</strong><br />
Choose <strong>Ant Builder</strong></p>
<div id="attachment_498" class="wp-caption aligncenter" style="width: 460px"><a href="http://925html.com/wordpress/wp-content/uploads/2010/01/new_project_builder.png"><img class="size-medium wp-image-498" title="New Project Builder" src="http://925html.com/wordpress/wp-content/uploads/2010/01/new_project_builder-450x319.png" alt="Screenshot showing Eclipse’s New Project Builder window" width="450" height="319" /></a><p class="wp-caption-text">Creating a new Project Ant Builder in Eclipse</p></div>
<h5>Set Build Name and Select Buildfile Created in Step 3</h5>
<p>Give the Builder a <em>unique</em> name and select the Buildfile associated with your Custom Module (which you setup previously) by choosing: <strong>Browse Workspace…</strong>.</p>
<div id="attachment_499" class="wp-caption aligncenter" style="width: 460px"><a href="http://925html.com/wordpress/wp-content/uploads/2010/01/select_build_file.png"><img class="size-medium wp-image-499" title="Select Build File" src="http://925html.com/wordpress/wp-content/uploads/2010/01/select_build_file-450x397.png" alt="Screenshot of ‘Main’ tab of Eclipse’s Builder Configuration window" width="450" height="397" /></a><p class="wp-caption-text">Setting Builder name and selecting Buildfile in Eclipse</p></div>
<p><strong>Note:</strong> One finicky thing I found with Eclipse is it’s in-ability to remember Builder settings when moving between tabs; <strong>Always click <em>Apply</em> before switching tabs in the Builder Configuration.</strong></p>
<h5>Set Ant Targets</h5>
<p>By default, the Builder’s: <strong>‘After a “Clean”’</strong>, and <strong>‘Manual Build’</strong> Eclipse “Moments” will be set to the default <em>Ant</em> target as specified in the Ant buildfile. Choose the default target for <strong>‘Auto Build’</strong> as well.</p>
<div id="attachment_501" class="wp-caption aligncenter" style="width: 460px"><a href="http://925html.com/wordpress/wp-content/uploads/2010/01/set_ant_targets.png"><img class="size-medium wp-image-501 " title="Set Ant Targets" src="http://925html.com/wordpress/wp-content/uploads/2010/01/set_ant_targets-450x397.png" alt="Screenshot of ‘Targets’ tab in Eclipse’s Builder Configuration window" width="450" height="397" /></a><p class="wp-caption-text">Setting the default Ant Target on Eclipse Builder for ‘Auto Build’</p></div>
<h5>Set Build Options</h5>
<p>Important here is to tell the builder which files to monitor for changes, and only re-build the YUI 3 Custom Module when one (or more) of those files has changed. Otherwise the build process will run in an infinite loop.</p>
<p><strong>Check:</strong> Specify working set of relevant resources<br />
<strong>Click:</strong> Specify Resources…</p>
<div id="attachment_502" class="wp-caption aligncenter" style="width: 460px"><a href="http://925html.com/wordpress/wp-content/uploads/2010/01/set_build_options.png"><img class="size-medium wp-image-502" title="Set Build Options" src="http://925html.com/wordpress/wp-content/uploads/2010/01/set_build_options-450x397.png" alt="Screenshot of ‘Build Options’ tab in Eclipse’s Build Configuration window" width="450" height="397" /></a><p class="wp-caption-text">Setting up relevant working resources for Eclipse Builder</p></div>
<h5>Specify [Relevant] Resources</h5>
<p><strong>Notice:</strong> I do <em>not</em> have the <strong>build_tmp</strong> directory selected, just the source files that make up the YUI 3 Custom Module. You’ll want Eclipse to monitor just the module’s source files, and rebuild the module when <em>only</em> those file change.</p>
<div id="attachment_503" class="wp-caption aligncenter" style="width: 460px"><a href="http://925html.com/wordpress/wp-content/uploads/2010/01/specify_resources.png"><img class="size-medium wp-image-503" title="Specify Resources" src="http://925html.com/wordpress/wp-content/uploads/2010/01/specify_resources-450x445.png" alt="Screenshot of ‘Specify Resources’ dialog for Eclipse Builder Configuration" width="450" height="445" /></a><p class="wp-caption-text">Selecting the relevant resources for Eclipse to monitor</p></div>
<h5>Build Project Automatically</h5>
<p>Set your Eclipse project to ‘Build Automatically’ by selecting:<br />
<strong>Project &gt; Build Automatically</strong></p>
<div id="attachment_504" class="wp-caption aligncenter" style="width: 460px"><a href="http://925html.com/wordpress/wp-content/uploads/2010/01/build_automatically.png"><img class="size-full wp-image-504" title="Select: Build Automatically" src="http://925html.com/wordpress/wp-content/uploads/2010/01/build_automatically.png" alt="Screenshot showing the Project menu in Eclipse with Build Automatically selected" width="450" height="300" /></a><p class="wp-caption-text">Selecting ‘Build Automatically’ in Eclipse’s Project menu</p></div>
<h4>Further Configuration</h4>
<p>The YUI Builder tool is highly-configurable, there are many configuration properties that can be set and Ant targets to run; both specified in the <a href="http://github.com/yui/builder/tree/master/componentbuild/docs/"><strong>docs</strong> folder</a> of the YUI Builder project. Most likely you’ll have to configure extra properties in your <code>build.properties</code> files to move your deployable YUI 3 Custom Modules to an appropriate place in your project’s layout.</p>
<p><strong>I highly recommend you review the YUI Builder configuration properties and Ant targets documentation.</strong></p>
<img src="http://feeds.feedburner.com/~r/925html/~4/T3FJLRe_A94" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://925html.com/techniques/auto-building-yui-3-custom-modules/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Simple Tab View with YUI 3</title>
		<link>http://925html.com/code/simple-tab-view-with-yui-3/</link>
		<comments>http://925html.com/code/simple-tab-view-with-yui-3/#comments</comments>
		<pubDate>Sun, 03 Jan 2010 23:14:40 +0000</pubDate>
		<dc:creator>Eric Ferraiuolo</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[interface]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[YUI]]></category>
		<category><![CDATA[YUI 3]]></category>

		<guid isPermaLink="false">http://925html.com/?p=456</guid>
		<description><![CDATA[Tab Views (i.e. tabbed-content) are ubiquitous on the web.
These interface elements are super simple to implement these days, so it seemed useful to show how a simple Tab View could be created using YUI 3.
The HTML Markup
The markup is a navigation list linking to content sections in the content area; simple and semantic. Some CSS [...]]]></description>
			<content:encoded><![CDATA[<p>Tab Views (i.e. tabbed-content) are ubiquitous on the web.</p>
<div id="attachment_460" class="wp-caption aligncenter" style="width: 460px"><img class="size-full wp-image-460" title="Tabbed Content Examples" src="http://925html.com/wordpress/wp-content/uploads/2010/01/tabbed-content-examples.png" alt="Examples of tabbed content areas from popular websites" width="450" height="250" /><p class="wp-caption-text">Tabbed content is everywhere on the web</p></div>
<p>These interface elements are super simple to implement these days, so it seemed useful to show how a <em>simple</em> Tab View could be created using YUI 3.</p>
<h3>The HTML Markup</h3>
<p>The markup is a navigation list linking to content sections in the content area; simple and semantic. Some CSS classes are added to help with the layout, styling and JavaScript hooks.</p>
<pre><code class="html">&lt;div class="tabview"&gt;

	&lt;ul class="tabview-tabs"&gt;
		&lt;li class="tabview-active"&gt;&lt;a href="#content1"&gt;Tab 1&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="#content2"&gt;Tab 2&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="#content3"&gt;Tab 3&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;

	&lt;div class="tabview-content"&gt;
		&lt;div id="content1"&gt;&lt;p&gt;Content for Tab 1&lt;/p&gt;&lt;/div&gt;
		&lt;div id="content2" class="tabview-hidden"&gt;&lt;p&gt;Content for Tab 2&lt;/p&gt;&lt;/div&gt;
		&lt;div id="content3" class="tabview-hidden"&gt;&lt;p&gt;Content for Tab 3. bla bla bla…&lt;/p&gt;&lt;/div&gt;
	&lt;/div&gt;

&lt;/div&gt;</code></pre>
<h3>The JavaScript Using YUI 3</h3>
<p>Using the <a href="http://developer.yahoo.com/yui/3/node/"><code>Y.Node</code> Class</a> made adding the behavior a breeze.</p>
<p>When a tab is clicked:</p>
<ol>
<li>I add the <code>tabview-active</code> CSS class to it and remove the class for all other tabs.</li>
<li>I then find the corresponding content section and remove the <code>tabview-hidden</code> CSS class from it and make sure all the other content sections <em>are</em> hidden.</li>
</ol>
<pre><code class="javascript">YUI().use('node', function(Y){

	Y.all('.tabview').each(function(){
		this.delegate('click', toggleTabs, '.tabview-tabs a');
	});

	function toggleTabs (e) {

		var tabview = e.container,
			tabs = tabview.all('.tabview-tabs li'),
			contents = tabview.all('.tabview-content &gt; *'),
			tab = e.currentTarget.get('parentNode');

		contents.addClass('tabview-hidden')
			.item(tabs.removeClass('tabview-active').indexOf(tab.addClass('tabview-active')))
				.removeClass('tabview-hidden');

		e.preventDefault();
	}

});</code></pre>
<h3><a href="http://925html.com/files/simple-tab-view/example1.html">Working Example</a></h3>
<div id="attachment_458" class="wp-caption aligncenter" style="width: 460px"><a href="http://925html.com/files/simple-tab-view/example1.html"><img class="size-full wp-image-458 " title="Simple Tabs Example" src="http://925html.com/wordpress/wp-content/uploads/2010/01/simple-tabs-example.png" alt="Screenshot of the Simple Tabs Example" width="450" height="120" /></a><p class="wp-caption-text">The example using this code</p></div>
<p><a href="http://925html.com/files/simple-tab-view/example1.html"><strong>View working example</strong></a></p>
<img src="http://feeds.feedburner.com/~r/925html/~4/W7LKcMERZd0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://925html.com/code/simple-tab-view-with-yui-3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>RGBA — IE Fallback</title>
		<link>http://925html.com/code/rgba-ie-fallback/</link>
		<comments>http://925html.com/code/rgba-ie-fallback/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 21:00:12 +0000</pubDate>
		<dc:creator>Eric Ferraiuolo</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[browsers]]></category>
		<category><![CDATA[Chrome]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[Safari]]></category>

		<guid isPermaLink="false">http://925html.com/?p=368</guid>
		<description><![CDATA[I&#8217;ve been using RGBA color values, border-radius, and box-shadow CSS3 features all over in my current projects. Since Internet Explorer (6, 7, &#38; 8) does not support any CSS3 features I wanted to find some suitable fallbacks. RGBA color values are the most important (of the three CSS3 features I&#8217;m using) to find an IE-alternative; [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using <a href="http://www.w3.org/TR/css3-color/#rgba-color">RGBA color values</a>, border-radius, and box-shadow CSS3 features all over in my current projects. Since Internet Explorer (6, 7, &amp; 8) does not support <em>any</em> CSS3 features I wanted to find some suitable fallbacks. RGBA color values are the most important (of the three CSS3 features I&#8217;m using) to find an IE-alternative; without one, IE will inherit the last non-RGBA color value (which maybe no color value, i.e. transparent).</p>
<p>A great article, <a href="http://24ways.org/2009/working-with-rgba-colour">Working With RGBA Colour</a>, recently appeared on the collaborative web development blog: <a href="http://24ways.org/">24 Ways</a>. The ‘Supporting All Browsers’ section of the article fell short of describing a robust way to “support” IE without punishing the other browsers.</p>
<blockquote><p><strong>Falling back to a PNG</strong></p>
<p>In cases where you’re using transparency on a <code>background-color</code> (although not on borders or text) it’s possible to fall back to using a PNG with alpha channel to get the same effect. This is less flexible than using CSS as you’ll need to create a new PNG for each level of transparency required, but it can be a useful solution.</p>
<p>Using the same principal as before, we can specify the background in a style that all browsers will understand, and then overwrite it in a way that browsers without RGBA support will ignore.</p>
<pre><code class="css">h1 {
	background: transparent url(black50.png);
	background: rgba(0, 0, 0, 0.5) none;
}</code></pre>
<p><cite><a href="http://allinthehead.com/">Drew McLellan</a>, 24 Ways: <a href="http://24ways.org/2009/working-with-rgba-colour">Working With RGBA Colour</a></cite></p></blockquote>
<p>I had a feeling, as did <a href="http://24ways.org/2009/working-with-rgba-colour#c003161">Martin Klepsch</a>, that this code would result in downloading <code>black50.png</code> in browsers which wouldn&#8217;t even use/need it (i.e. non-IE browsers). Running tests and investigating alternate fallback techniques for RGBA color values in IE shined some light on this issue.<span id="more-368"></span></p>
<h3>The Tests</h3>
<p>I started with the fallback technique of using a PNG, as described in the 24 Ways post, as my baseline. I wanted to test the theory I had (and Martin Klepsch commented on): Browsers will download the PNG even if they do not use it.</p>
<p>I mocked up a quick-and-dirty example to test. I used a textured background for the page with a short paragraph of text centered on a semi-transparent green background (25% opacity); upon hovering over the paragraph, the background becomes more opaque (50% opacity).</p>
<div id="attachment_390" class="wp-caption aligncenter" style="width: 460px"><img class="size-full wp-image-390" title="RGBA Test" src="http://925html.com/wordpress/wp-content/uploads/2009/12/rgba-test.png" alt="A screenshot of the RGBA Test code" width="450" height="152" /><p class="wp-caption-text">Screenshot of desired rendering</p></div>
<div id="attachment_394" class="wp-caption aligncenter" style="width: 460px"><img class="size-full wp-image-394" title="RGBA Test - Hover" src="http://925html.com/wordpress/wp-content/uploads/2009/12/rgba-test-hover.png" alt="A screenshot of the RGBA Test code on hover" width="450" height="152" /><p class="wp-caption-text">Screenshot of desired rendering on hover</p></div>
<h4 id="test1"><a href="http://925html.com/files/rgba-ie-fallbacks/test1.html">Test 1: Baseline</a></h4>
<p>I started with the following CSS, using the PNG technique:</p>
<pre><code class="css">body {
	background: url(pattern.png);
	font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
p {
	color: rgb(225, 225, 225);
	background: transparent url(green-25.png);
	background: rgba(156, 217, 107, 0.25) none;
	width: 400px;
	margin: 48px auto;
	padding: 32px 40px;
}
p:hover {
	background: transparent url(green-50.png);
	background: rgba(156, 217, 107, 0.50) none;
}</code></pre>
<p><a href="http://925html.com/files/rgba-ie-fallbacks/test1.html"><strong>View Test 1</strong></a></p>
<p>Safari 4 and Chrome 4 (Mac/PC) <strong>did download</strong> the <em>unused</em> PNG; while Firefox 3.x <strong>did not download</strong> the PNG. This method does work for IE 7 and IE 8; but it&#8217;s important to note: I noticed a <a title="Flash of Unstyled Content" href="http://www.456bereastreet.com/archive/200609/flash_of_unstyled_content_fouc_explained/">FOUC</a> while IE downloaded the PNG for the <code>:hover</code> state.</p>
<h4 id="test2"><a href="http://925html.com/files/rgba-ie-fallbacks/test2.html">Test 2: Using <code>!important</code></a></h4>
<p>I wanted to test if setting <code>!important</code> on a rule would force the browser to ignore other rules with the same CSS property.</p>
<pre><code class="css">p {
	/* … */
	background: transparent url(green-25.png);
	background: rgba(156, 217, 107, 0.25) none !important;
	/* … */
}
p:hover {
	background: transparent url(green-50.png);
	background: rgba(156, 217, 107, 0.50) none !important;
}</code></pre>
<p><a href="http://925html.com/files/rgba-ie-fallbacks/test2.html"><strong>View Test 2</strong></a></p>
<p>No change from the baseline test. Bummer.</p>
<h4 id="test3"><a href="http://925html.com/files/rgba-ie-fallbacks/test3.html">Test 3: <code>!important</code> with Reverse Order</a></h4>
<p>For completeness I wanted to test if order made a difference when using <code>!important</code></p>
<pre><code class="css">p {
	/* … */
	background: rgba(156, 217, 107, 0.25) none !important;
	background: transparent url(green-25.png);
	/* … */
}
p:hover {
	background: rgba(156, 217, 107, 0.50) none !important;
	background: transparent url(green-50.png);
}</code></pre>
<p><a href="http://925html.com/files/rgba-ie-fallbacks/test3.html"><strong>View Test 3</strong></a></p>
<p>No change from the baseline test. Webkit browsers are so eager to download these unused images.</p>
<h4 id="test4"><a href="http://925html.com/files/rgba-ie-fallbacks/test4.html">Test 4: IE Conditional Comments</a></h4>
<p>I use <a href="http://msdn.microsoft.com/en-us/library/ms537512(VS.85).aspx">IE Conditional Comments</a> on most projects, sending IE a set of “fixes” without resorting to using hacks in my CSS. I was confident this approach would work flawlessly.</p>
<pre><code class="html">&lt;style type="text/css"&gt;

	body {
		background: url(pattern.png);
		font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
	}
	p {
		color: rgb(225, 225, 225);
		background: rgba(156, 217, 107, 0.25) none;
		width: 400px;
		margin: 48px auto;
		padding: 32px 40px;
	}
	p:hover {
		background: rgba(156, 217, 107, 0.50) none;
	}

&lt;/style&gt;

&lt;!--[if lte IE 8]&gt;
	&lt;style type="text/css"&gt;

		p {
			background: transparent url(green-25.png);
		}
		p:hover {
			background: transparent url(green-50.png);
		}

	&lt;/style&gt;
&lt;![endif]--&gt;</code></pre>
<p><a href="http://925html.com/files/rgba-ie-fallbacks/test4.html"><strong>View Test 4</strong></a></p>
<p>It works! This technique is a great RGBA fallback for IE 7 and IE 8; Safari 4, Chrome 4, and Firefox 3.x <strong>did not download</strong> the unused PNGs. This outcome was expected since only IE is going to receive the style rules which set the background PNGs.</p>
<h4 id="test5"><a href="http://925html.com/files/rgba-ie-fallbacks/test5.html">Test 5: Conditional Comments with CSS Filter</a></h4>
<p>Searching for the Holy Grail in this one…</p>
<p>A <em>major</em> advantage of using RGBA color values is not needing to create and serve an alpha-transparent PNG. The RGBA IE fallback techniques looked at so far relied on a PNG. I wanted to test an approach which would <em>not</em> require a PNG. After doing some searching, I came across a post, <a href="http://css-tricks.com/rgba-browser-support/">RGBa Browser Support</a>, using <a href="http://msdn.microsoft.com/en-us/library/ms532997(VS.85).aspx">Microsoft&#8217;s IE-only Gradient Filter</a>.</p>
<p>The tricky part in using Microsoft Gradient Filter is getting the Color Property set right.</p>
<blockquote><p><strong>Color is expressed in #AARRGGBB format</strong>, where AA is the alpha hexadecimal value, RR is the red hexadecimal value, GG is the green hexadecimal value, and BB is the blue hexadecimal value. The alpha value controls the opacity of the object. An alpha value of 00 is transparent, while a value of FF is opaque.</p>
<p><cite><a href="http://msdn.microsoft.com/en-us/library/ms532861(VS.85).aspx">Color Property</a>, Microsoft Developer Network</cite></p></blockquote>
<h5>Determining The Alpha Hexadecimal Value</h5>
<p>We need the figure out the <em>AA</em> part of #AARRGGBB. For CSS3 RGBA color values, <em>A</em> is a decimal/percentage of opacity; where 0.0 is completely transparent and 1.0 is completely opaque. Another way to look at it is like masking: where 0.0 is black or absence, and 1.0 is white or presence.</p>
<p>There are 256 values (0 — 255) for each color (red, green, and blue) in RGB values. We can multiply the alpha-opacity value by 256, round the result, and convert to hexadecimal to get our value.</p>
<p>e.g. For this example I have two alpha-opacity values: 0.25, and 0.50 on hover.<br />
256 × 0.25 = 64<br />
256 × 0.50 = 128<br />
We can <a href="http://www.statman.info/conversions/hexadecimal.html">convert to hexadecimal</a> values: 40, and 80 for hover.</p>
<pre><code class="html">&lt;!--[if lte IE 8]&gt;
	&lt;style type="text/css"&gt;

		p {
			background: transparent;
			filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#408ED557,endColorstr=#408ED557);
		}
		p:hover {
			background: transparent;
			filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#808ED557,endColorstr=#808ED557);
		}

	&lt;/style&gt;
&lt;![endif]--&gt;</code></pre>
<p><a href="http://925html.com/files/rgba-ie-fallbacks/test5.html"><strong>View Test 5</strong></a></p>
<p>This technique “worked” insofar that it used <strong>no PNGs</strong> and rendered in all the browsers tested. The nature of my test case using a <code>:hover</code> style revealed an IE rendering anomaly (surprise, surprise); in both IE 7 and 8 the <code>:hover</code> CSS <code>filter</code> was only applied when <em>hovering the actual text of the paragraph</em> instead of the region of space the paragraph takes up. In all the previous test cases this was never an issue; the problem is directly related to Microsoft&#8217;s IE-only Gradient Filter.</p>
<p>Microsoft&#8217;s CSS <code>filter</code> properties are generally seen as something to <a href="http://developer.yahoo.com/performance/rules.html#no_filters">avoid using</a>. I&#8217;m extremely curious about the performance trade-offs of an extra HTTP request vs. using the Microsoft Gradient <code>filter</code> property.</p>
<h3 id="results">Results &amp; Recommendations</h3>
<p>My goal was to find a robust fallback for Internet Explorer&#8217;s lack of support for RGBA color values; a technique that wouldn&#8217;t punish the browsers which <em>do support</em> RGBA, and second, wouldn&#8217;t punish the developer.</p>
<table class="results">
<thead>
<tr>
<th></th>
<th title="Baseline"><a href="#test1">Test 1</a></th>
<th title="!important"><a href="#test2">Test 2</a></th>
<th title="Order with !important"><a href="#test3">Test 3</a></th>
<th title="IE Conditional Comments"><a href="#test4">Test 4</a></th>
<th title="IE Conditional Comments with CSS Filter"><a href="#test5">Test 5</a></th>
</tr>
</thead>
<tbody>
<tr>
<th>Safari 4</th>
<td class="fail">PNGs</td>
<td class="fail">PNGs</td>
<td class="fail">PNGs</td>
<td class="pass">no PNGs</td>
<td class="pass">no PNGs</td>
</tr>
<tr>
<th>Chrome 4</th>
<td class="fail">PNGs</td>
<td class="fail">PNGs</td>
<td class="fail">PNGs</td>
<td class="pass">no PNGs</td>
<td class="pass">no PNGs</td>
</tr>
<tr>
<th>Firefox 3.x</th>
<td class="pass">no PNGs</td>
<td class="pass">no PNGs</td>
<td class="pass">no PNGs</td>
<td class="pass">no PNGs</td>
<td class="pass">no PNGs</td>
</tr>
<tr>
<th>IE 8</th>
<td class="pass">PNGs</td>
<td class="pass">PNGs</td>
<td class="pass">PNGs</td>
<td class="pass">PNGs</td>
<td class="warn">no PNGs</td>
</tr>
<tr>
<th>IE 7</th>
<td class="pass">PNGs</td>
<td class="pass">PNGs</td>
<td class="pass">PNGs</td>
<td class="pass">PNGs</td>
<td class="warn">no PNGs</td>
</tr>
</tbody>
</table>
<p><a href="#test4">Test 4: IE Conditional Comments</a> proved to be the most robust; an excellent RGBA fallback solution for IE 7 and IE 8 that won&#8217;t download PNGs in Safari, Chrome, or Firefox.</p>
<p><a href="#test5">Test 5: Conditional Comments with CSS Filter</a> is a very compelling solution; it <em>does not</em> require PNGs in <em>any</em> browser, making it appealing to designers and developers. <strong>I caution the use of this technique:</strong> beware of rendering anomalies and/or unknown performance implications. This technique needs further testing an experimentation; that said, I still plan to give it a whirl in my current projects.</p>
<img src="http://feeds.feedburner.com/~r/925html/~4/qGoU-H1U0Kc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://925html.com/code/rgba-ie-fallback/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Web Application Development with YUI3</title>
		<link>http://925html.com/presentation/web-application-development-with-yui3/</link>
		<comments>http://925html.com/presentation/web-application-development-with-yui3/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 22:04:10 +0000</pubDate>
		<dc:creator>Eric Ferraiuolo</dc:creator>
				<category><![CDATA[Presentation]]></category>
		<category><![CDATA[slides]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[web app]]></category>
		<category><![CDATA[Yahoo!]]></category>
		<category><![CDATA[YUI]]></category>
		<category><![CDATA[yuiconf]]></category>

		<guid isPermaLink="false">http://925html.com/?p=351</guid>
		<description><![CDATA[The slides and video from my talk at YUICONF2009.
This talk discusses techniques for deploying YUI 3 custom modules within a larger server application environment, using a working application as a reference. You&#8217;ll learn how to streamline your development and deployment process, ways to organize your code for maximum efficiency, how to integrate with the Eclipse [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="#webapp-dev-slides">slides</a> and <a href="#webapp-dev-video">video</a> from my talk at <a href="http://yuilibrary.com/yuiconf2009/">YUICONF2009</a>.</p>
<p>This talk discusses techniques for deploying YUI 3 custom modules within a larger server application environment, using a working application as a reference. You&#8217;ll learn how to streamline your development and deployment process, ways to organize your code for maximum efficiency, how to integrate with the Eclipse IDE, and some tips and tricks around build strategies and server-side tooling.</p>
<h4 id="webapp-dev-slides">Slides:</h4>
<div style="width:425px;text-align:left" id="__ss_2379064"><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=webappdevelopmentwithyui3-nobg-091029163040-phpapp01&#038;stripped_title=web-app-development-with-yui-3-2379064" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=webappdevelopmentwithyui3-nobg-091029163040-phpapp01&#038;stripped_title=web-app-development-with-yui-3-2379064" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object></div>
<h4 id="webapp-dev-video">Video:</h4>
<p><object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=7442654&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=7442654&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object>
<p><a href="http://vimeo.com/7442654">Web App Development with YUI 3</a> from <a href="http://vimeo.com/ericf">Eric Ferraiuolo</a> on <a href="http://vimeo.com">Vimeo</a>.<br />
…The video is also on the <a href="http://developer.yahoo.com/yui/theater/video.php?v=ericf-yuiconf2009-webapps">YUI Theater</a>.</p>
<img src="http://feeds.feedburner.com/~r/925html/~4/9Io5wzDzPjQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://925html.com/presentation/web-application-development-with-yui3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Facebook Style Overlay in YUI 3 &amp; CSS 3</title>
		<link>http://925html.com/code/facebook-style-overlay-in-yui-3-css-3/</link>
		<comments>http://925html.com/code/facebook-style-overlay-in-yui-3-css-3/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 03:48:44 +0000</pubDate>
		<dc:creator>Eric Ferraiuolo</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[interface]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[YUI]]></category>

		<guid isPermaLink="false">http://925html.com/?p=337</guid>
		<description><![CDATA[While wandering-around the Internet looking for examples of overlays in web application interfaces I thought of a challenge: create a working Facebook–styled overlay. I&#8217;m in the process of creating an application-wide design for overlays and needed some inspiration. Facebook uses overlays extensively and they have a distinct style [that others imitate, maybe even me :-) [...]]]></description>
			<content:encoded><![CDATA[<p>While wandering-around the Internet looking for examples of <em>overlays</em> in web application interfaces I thought of a challenge: <em>create a working Facebook–styled overlay</em>. I&#8217;m in the process of creating an application-wide design for overlays and needed some inspiration. Facebook uses overlays extensively and they have a distinct style [that others imitate, maybe even me :-) ]; I set-out to re-create <em>this style</em>.</p>
<p>Not wanting to mess around — I whipped up <a href="http://925html.com/files/fb_overlay/">a working example of Facebook-styled overlays</a> using <strong>only</strong> YUI 3 and CSS 3; things are nice and easy to do when you use the latest technologies.</p>
<p>The code is short enough I&#8217;ll just lay it all down here:</p>
<p><strong>The JavaScript — YUI 3 is doing all the heavy lifting</strong></p>
<pre><code class="javascript">YUI().use('overlay', 'dd-constrain', function(Y){

	var fbOverlay = new Y.Overlay({

		contentBox : '#fbOverlay',
		width : '540px',
		height : '300px',
		visible : false

	}).render();

	// make overlay draggable
	new Y.DD.Drag({

		node : fbOverlay.get('boundingBox'),
		handles : ['.yui-widget-hd']

	}).plug(Y.Plugin.DDConstrained, { constrain2view : true });

	// show overlay
	Y.get('#show-fbOverlay').on('click', function(e){
		if ( ! fbOverlay.get('visible') ) {
			fbOverlay.align(this, [Y.WidgetPositionExt.TL, Y.WidgetPositionExt.TR]);
			fbOverlay.show();
		}
	});

	// hide overlay
	Y.get('#hide-fbOverlay').on('click', function(e){
		fbOverlay.hide();
	});

});</code></pre>
<p>Oh, and if you didn&#8217;t notice these Facebook–styled overlays are drag-able; Facebook doesn&#8217;t do that…</p>
<p><strong>The CSS [3] — This is all me… and Facebook&#8217;s colors</strong></p>
<pre><code class="javascript">#fbOverlay { display: none; }

.yui-widget #fbOverlay {
	display: block;
	background: rgba(0, 0, 0, 0.5);
	border-radius: 6px;
	-moz-border-radius: 6px;
	-webkit-border-radius: 6px;
	padding: 10px;
}
#fbOverlay .yui-widget-hd {
	border: #3B5998 1px solid;
	background: #6D84B4;
	color: #fff;
	padding: 0 10px;
	cursor: move;
}
#fbOverlay .yui-widget-bd {
	background: #fff;
	border: #555 1px solid;
	border-top: none;
	border-bottom : none;
	padding: 0 10px;
}
#fbOverlay .yui-widget-ft {
	border: #555 1px solid;
	border-top: none;
	background: #f2f2f2;
}
#fbOverlay .yui-widget-ft > div {
	border-top: #ccc 1px solid;
	padding: 5px 10px;
	text-align: right;
}</code></pre>
<p>If you <strong>View Source</strong> you&#8217;ll see the contents of the overlay are in the (X)HTML; I&#8217;m making sure the hide these overlay–contents until the <a href="http://developer.yahoo.com/yui/3/overlay/">YUI Overlay Class</a> instance grabs them up.</p>
<p>Not much to it; the only CSS 3 stuff is in the second rule, <code>background: rgba(0, 0, 0, 0.5);</code> giving the background some transparency and <code>border-radius: 6px;</code> to round-them-corners. Funny thing, these two style declarations save so much time and effort; look the source for Facebook&#8217;s overlay and you&#8217;ll see a nasty-mess of tables.</p>
<p>If you missed the link to the working version of the code above: <a href="http://925html.com/files/fb_overlay/"><strong>here it is again</strong></a>.</p>
<img src="http://feeds.feedburner.com/~r/925html/~4/zIfGC-0bQlY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://925html.com/code/facebook-style-overlay-in-yui-3-css-3/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Adaptive CSS-Layouts: Compromising Ideals</title>
		<link>http://925html.com/techniques/adaptive-css-layouts-compromising-ideals/</link>
		<comments>http://925html.com/techniques/adaptive-css-layouts-compromising-ideals/#comments</comments>
		<pubDate>Mon, 15 Jun 2009 04:29:56 +0000</pubDate>
		<dc:creator>Eric Ferraiuolo</dc:creator>
				<category><![CDATA[Techniques]]></category>
		<category><![CDATA[browsers]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[devices]]></category>
		<category><![CDATA[layout]]></category>
		<category><![CDATA[reaction]]></category>

		<guid isPermaLink="false">http://925html.com/?p=331</guid>
		<description><![CDATA[Smashing Magazine recently published an article posing a question [as it's heading]:

Adaptive CSS-Layouts: New Era In Fluid Layouts?: &#8220;Fluid web designs have many benefits, but only if implemented correctly. With proper technique, a design can be seen correctly on large screens, small screens and even tiny PDA screens. With bad coding structure, however, a fluid [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.smashingmagazine.com/">Smashing Magazine</a> recently published an article posing a question [as it's heading]:</p>
<blockquote><p>
<a href="http://www.smashingmagazine.com/2009/06/09/smart-fixes-for-fluid-layouts/">Adaptive CSS-Layouts: New Era In Fluid Layouts?</a>: &#8220;Fluid web designs have many benefits, but only if implemented correctly. With proper technique, a design can be seen correctly on large screens, small screens and even tiny PDA screens. With bad coding structure, however, a fluid layout can be disastrous. Because of this, we need to find ways to work around most, if not all, of the cons of fluid design.&#8221;</p>
<p>(Via <a href="http://www.smashingmagazine.com">Smashing Magazine</a>.)</p>
</blockquote>
<p>Intrigued, I read through the lengthly article; which, seemed to answer the posed question positively; or at least suggested the <em>possibility</em> of a <em>yes</em> answer.</p>
<p>The article is a prescription of <em>six</em> &#8220;effective techniques to create 100%-functional adaptive CSS-layouts&#8221; (quoted from article). These techniques are not independent from one another; they must be used together, <em>and implemented correctly</em> to achieve their prescribed solution to the Adaptive/Fluid layout problem.</p>
<blockquote><p>
All of these techniques can be implemented in one design to create a <strong>very user-friendly fluid layout</strong>. A smart use of the fluid grid can create an adaptable layout whose proportions remain faithful to the Rule of Thirds, balance and other design principles…
</p></blockquote>
<p>I&#8217;m left dissatisfied with Smashing Magazine&#8217;s solution. Spending time to understand and apply six different, seemingly independent, layout techniques to an interface feels too compromising. The one-size-fits-all approach to User Interface design leaves you <em>compromising</em> on crucial interface components and aspects of usability. The interface for a web site/application on a computer isn&#8217;t going to best serve a user on their iPhone; users with a <em>computer</em> screen resolution of 800&#215;600 are rare; users with wide-screen monitors don&#8217;t browse at full screen.</p>
<p>Contorting the development of <em>one</em> interface to serve vastly different devices is not ideal. To achieve a better, more usable interface you must design for the device. I&#8217;m not buying the idea that we, as web developers and designers, can get away with forcing our compromised interfaces on user&#8217;s screens big and small.</p>
<p>I posed a somewhat opposing question about layout— regarding it&#8217;s flexibility, in October 2008: <a href="http://925html.com/techniques/layout-flexibility/">Layout Flexibility – Still A Requirement?</a></p>
<p>Questioning my own pervious layout techniques and use of Elastic Layouts (em&#8217;s to specifying box-model dimensions). Concluding that the adoption of full-page zoom in modern browsers leaves the elastic-layout technique obsolete.</p>
<img src="http://feeds.feedburner.com/~r/925html/~4/qQ94gi6afEE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://925html.com/techniques/adaptive-css-layouts-compromising-ideals/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing HTML From JavaScript</title>
		<link>http://925html.com/code/writing-html-from-javascript/</link>
		<comments>http://925html.com/code/writing-html-from-javascript/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 17:08:04 +0000</pubDate>
		<dc:creator>Eric Ferraiuolo</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://925html.com/?p=326</guid>
		<description><![CDATA[JavaScript developers know the DOM API sucks: very verbose, and hairy across browsers. Some JavaScript library developers have chosen an innerHTML&#8212; approach for dynamically writing markup (DHTML). I&#8217;d argue this is just as crazy as trying to use the native DOM API.
Some [including me] are fed up with either alternative and decide to create a [...]]]></description>
			<content:encoded><![CDATA[<p>JavaScript developers know the DOM API sucks: very <em>verbose</em>, and <em>hairy</em> across browsers. Some JavaScript library developers have chosen an <code>innerHTML</code>&mdash; approach for dynamically writing markup (DHTML). I&#8217;d argue this is just as crazy as trying to use the native DOM API.</p>
<p>Some [including me] are fed up with either alternative and decide to create a new API for writing markup in JavaScript:</p>
<blockquote><p>
<a href="http://jeethurao.com/blog/?p=156">Jeethu</a>: &#8220;One of the sweetest parts of Mochikit IMO has been Mochikit.DOM. This is something which I’ve always missed with YUI. innerHTML is fast, but icky and it feels a little inelegant. So, I ended up writing something like Mochikit.DOM for YUI while writing Tagz. Thought it might be useful to others as well. So, here’s the mercurial repo with the code.&#8221;</p>
<p>(Via <a href="http://jeethurao.com/blog/?p=156">A Mochikit style Dombuilder for YUI | Jeethu&#8217;s Blog</a>.)</p>
</blockquote>
<p>Jeethu has something here; but I&#8217;m not psyched about the API design. The simple example on his blog post lacks clarity; the nested tree structure feels overly complicated. When creating a <em>document</em> in (X)HTML, nesting makes sense, you&#8217;re authoring the document as a whole <em>thing</em>. When programatically <em>outputting</em> (X)HTML, there isn&#8217;t a clear vision of the document as a whole. I prefer to keep with the semantics of programming when generating markup by <em>writing meaningful statements</em>.</p>
<p>At <a href="http://oddnut.com">Oddnut Software</a>, my small company (just two of us), we&#8217;re thinking about this issue with a broader vision: <strong>a unified API for writing XHTML on the server (Java) and on the client (JavaScript)</strong>. We plan to open-source our project once it&#8217;s ready; we&#8217;re working out some of the final features.</p>
<img src="http://feeds.feedburner.com/~r/925html/~4/zmgwnWpQljA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://925html.com/code/writing-html-from-javascript/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Webpage Thumbnails — Screenshots via Page Glimpse in JavaScript</title>
		<link>http://925html.com/code/webpage-thumbnails/</link>
		<comments>http://925html.com/code/webpage-thumbnails/#comments</comments>
		<pubDate>Tue, 14 Apr 2009 16:58:53 +0000</pubDate>
		<dc:creator>Eric Ferraiuolo</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[services]]></category>
		<category><![CDATA[thumbnails]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://925html.com/?p=306</guid>
		<description><![CDATA[For quite some time I&#8217;ve had a desire to fetch screenshots of webpages in thumbnail form. My last round of development in the area involved a somewhat overly complex solution using Amazon&#8217;s AWS Alexa Site Thumbnail service. I chose to integrate with the AWS Alexa Thumbnail service over other services because it just returned an [...]]]></description>
			<content:encoded><![CDATA[<p>For quite some time I&#8217;ve had a desire to fetch screenshots of webpages in thumbnail form. My last round of development in the area involved a <a href="http://code.google.com/p/ajax-alexa-thumbnails/">somewhat overly complex solution</a> using <a href="http://aws.amazon.com/ast/">Amazon&#8217;s AWS Alexa Site Thumbnail service</a>. I chose to integrate with the AWS Alexa Thumbnail service over <a href="http://www.snap.com/">other services</a> because it just returned an image, no extra crap (<strong><a href="http://www.snap.com/">Snap&#8217;s</a> thumbnails are grotesque</strong>) and no ads. Although the service wasn&#8217;t free, it only <a href="http://aws.amazon.com/ast/#pricing">cost a few pennies to use</a>. </p>
<p>The other requirement I have is to retrieve the thumbnails in JavaScript. This lead to the creation my <a href="http://code.google.com/p/ajax-alexa-thumbnails/">Ajax Alexa Thumbnails project</a>. The AWS Alexa Thumbnail service required a client to interact via a XML web service (similar to the other AWS services), this means signing the request with your AWS credentials; something I wasn&#8217;t going to do in JavaScript. The project became too complex for the task; it involved making an Ajax request to a local PHP file which dealt with sending the request to and receiving the response from Amazon. <em>Crazy I know</em>, which is why <strong>I&#8217;m deprecating the <a href="http://code.google.com/p/ajax-alexa-thumbnails/">Ajax Alexa Thumbnails project</a> along with the deprecation of the AWS Alexa Thumbnail service in favor of <em>my new solution [below]</em> using <a href="http://www.pageglimpse.com">Page Glimpse</a></strong>.<span id="more-306"></span><br />
<h3><a href="http://www.pageglimpse.com/">Page Glimpse</a></h3>
<p>On March 18, 2009 I received the email from Amazon AWS telling me the Alexa Site Thumbnail service is being deprecated:</p>
<blockquote><p>
Dear Alexa Developer,</p>
<p>We are announcing the deprecation of the Alexa Site Thumbnail service as of March 13, 2009. After this date, the service will be closed to new subscriptions. The Alexa Site Thumbnail service will continue to be operational for existing subscribers for 90 days, until June 12, 2009.</p>
<p>Use of the service has been relatively low, and we have decided to focus our resources on more broadly used services in order to provide the greatest benefit to Alexa customers.</p>
<p>Thank you for your use of the service. We regret any inconvenience to you.</p>
<p>Thank you,</p>
<p>The Alexa Web Services Team
</p></blockquote>
<p>Luckily that same day <a href="http://www.techcrunch.com/2009/03/18/amazon-shutters-unpopular-alexa-site-thumbnail-service/">TechCrunch ran an article</a> about this announcement and <a href="http://www.techcrunch.com/2009/03/18/amazon-shutters-unpopular-alexa-site-thumbnail-service/#comments">users posted alternate services in the comments</a>, which <a href="http://www.techcrunch.com/2009/03/18/amazon-shutters-unpopular-alexa-site-thumbnail-service/#comment-2658917">included Page Glimpse</a>. Based on Marcio Castilho comment, I figured it was worth a look:</p>
<blockquote><p>
You should check <a href="http://www.pageglimpse.com">http://www.pageglimpse.com</a>. It is also run on scalable Amazon AWS infrastructure, and it is much more faster than Alexa and other services.
</p></blockquote>
<p><strong>Page Glimpse is a <em>free</em> service providing programmatic access to thumbnails of any web <em>page</em></strong> (AWS Alexa Site Thumbnail service just provided thumbnails of hostnames, not interior pages). They have a <a href="http://www.pageglimpse.com/features/api">well-documented RESTful HTTP API</a>; to retrieve a thumbnail for a webpage you construct a URL to their API with query-string parameters. If Page Glimpse hasn&#8217;t captured the webpage you are requesting, it will do so, automatically, within a few seconds. They also have API methods to check if a thumbnail already exists, and request the service to capture a thumbnail. Just like Marcio stated, Page Glimpse is very fast; I&#8217;ve been pretty amazed at the speed durning my testing.</p>
<p><strong>To start using Page Glimpse, <a href="http://www.pageglimpse.com/signup"><em>Sign-up for a free account</em></a></strong> to get your developer key.</p>
<p>After signing-up and trying a few requests with my shinny new developer key I was pretty curious how they are offering this service for free. I gathered from their <a href="http://www.pageglimpse.com/info/terms">Terms of Use</a> that <strong>if you are a heavy user (> 300 GB/month) you might have to pay a monthly fee</strong> (this seems completely reasonable):</p>
<blockquote><p>
If your bandwidth usage exceeds 300 GB/month, or significantly exceeds the average bandwidth usage (as determined solely by RADSense) of other PageGlimpse customers, we reserve the right to terminate your use of the service, but we will make the best effort possible to accomodate the increased bandwidth, although a monthly fee might apply in this case.
</p></blockquote>
<h3>Page Glimpse Thumbnails in JavaScript</h3>
<p>With the Page Glimpse API being HTTP based and free, I am <em>okay</em> with including my developer key in client-side JavaScript code; it&#8217;s just not worth the complexity to hide it.</p>
<p>One could easily use Page Glimpse in JavaScript by constructing a new <code>img</code> DOM Node and set it&#8217;s <code>href</code> property to the Page Glimpse API URL with all the parameters. I want something more convenient. Even with Page Glimpse being a speedy service, I also want to make sure the image has fully downloaded before showing it on the page.</p>
<h4><a href="http://925html.com/files/thumbnailsjs/">Thumbnailsjs</a> &mdash; JavaScript Interface To Page Glimpse&#8217;s API</h4>
<p>I&#8217;ve created a small (1.2KB minified, <strong>0.7KB gzipped</strong>) utility Class to provide a convenient interface to Page Glimpse in JavaScript and to ensure the images have been fully-downloaded by the client before displaying the it on the page (thanks to <a href="http://lucassmith.name/">Luke Smith&#8217;s</a> <a href="http://lucassmith.name/2008/11/is-my-image-loaded.html">Is my image loaded? post</a>).</p>
<p><strong>The fully-documented <a href="http://925html.com/files/thumbnailsjs/thumbnails.js">source code</a> along with a <a href="http://925html.com/files/thumbnailsjs/run.html">simple example</a> is available in the <em>files</em> section: <a href="http://925html.com/files/thumbnailsjs/">http://925html.com/files/thumbnailsjs/</a>.</strong></p>
<h5>Example of Client Code</h5>
<pre><code class="javascript">var container = document.getElementById('container'),
	thumbs = Thumbnails({ devkey:'xxx' });

thumbs.get('http://google.com', append);
thumbs.get([
	'http://eric.ferraiuolo.name/',
	'http://925html.com',
	'http://oddnut.com'
], append);

function append ( url, img ) {
	var link = document.createElement('a');
	link.href = url;
	link.appendChild(img);
	container.appendChild(link);
}</code></pre>
<h5>Details of Thumbnailsjs API</h5>
<p>The Class&#8217; <strong><code>constructor</code></strong> takes a <strong><code>config Object</code></strong> which can have the following <strong>properties</strong>:</p>
<ul>
<li><strong><code>devkey</code></strong> <code>{String}</code>: Your PageGlimpse API deveoper key. All requests to PageGlimpse service require a devkey <strong>(required)</strong>.</li>
<li><strong><code>size</code></strong> <code>{String}</code>: The size of thumbnail. Available sizes are: small, medium, large.</li>
<li><strong><code>root</code></strong> <code>{Boolean}</code>: Indicates if the thumbnails for the domain root should be displayed. The root thumbnail image will only be used if an interior page&#8217;s thumbnail hasn&#8217;t been resolved.</li>
<li><strong><code>nothumb</code></strong> <code>{String}</code>: If the thumbnail for the website is not yet taken, the URL for this property will be used. If this parameter is not set a PageGlimpse default image will be returned.</li>
</ul>
<p>The Class only has <strong>one public method, <code>get</code></strong>, which takes <strong>two arguments</strong> (both required):</p>
<ol>
<li><strong><code>url</code></strong> <code>{String | Array}</code>: Location of webpage(s)</li>
<li><strong><code>callback</code></strong> <code>{Function}</code>: Function to pass the webpage URL and image Node once fully downloaded</li>
</ol>
<h3>Page Glimpse + Thumbnailsjs</h3>
<p>I&#8217;m planning to update <a href="http://eric.ferraiuolo.name/">my personal webpage</a> to use this setup for displaying tooltips for external links with a thumbnail of the webpage; retiring the current setup of using AWS Alexa Site Thumbnail + Ajax-Alexa-Thumbnails.</p>
<p>I have to say to the folks over at <a href="http://www.radsense.com/">RADSense Software</a> who put together Page Glimpse; Thanks for developing such a cool and useful service!</p>
<p>Hope you find Page Glimpse + Thumbnailjs useful; let me know if you questions, thoughts, or requests.</p>
<img src="http://feeds.feedburner.com/~r/925html/~4/CPQydpMX20A" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://925html.com/code/webpage-thumbnails/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Smart Polling</title>
		<link>http://925html.com/code/smart-polling/</link>
		<comments>http://925html.com/code/smart-polling/#comments</comments>
		<pubDate>Mon, 30 Mar 2009 16:31:44 +0000</pubDate>
		<dc:creator>Eric Ferraiuolo</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[YUI]]></category>

		<guid isPermaLink="false">http://925html.com/?p=288</guid>
		<description><![CDATA[I&#8217;m working on the rich UI of a small web application which has a problem I need to solve: the data from the server which the UI is presenting could change at any time. The first iteration of the UI has a refresh button. Clicking this button sends an Ajax request to a resource on [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working on the rich UI of a small web application which has a problem I need to solve: <strong>the data from the server which the UI is presenting could change at any time</strong>. The first iteration of the UI has a <em>refresh button</em>. Clicking this button sends an Ajax request to a resource on the server which responds with a JSON data structure, and the UI is updated with any changes in the new data. My business partner doesn&#8217;t like the refresh button; he questions why it&#8217;s there and states how annoying it is to press the button all the time. His suggestion is the rich UI should <em>smartly</em> poll the server for changes to the data, and update the UI automatically.</p>
<p>Intrigued by his idea, we continued our discussion leading to a definition for what it means to <em>smartly</em> poll a server&#8217;s resource:</p>
<ul>
<li>Use <strong>conditional GET requests</strong></li>
<li><strong>Retain</strong> the most recent <strong>Etag</strong> and <strong>Last-Modified date</strong> of the polled resource</li>
<li><strong>Disable</strong> polling when the <strong>browser window is inactive</strong></li>
</ul>
<p>Implementing a <em>smart</em> polling process in our application&#8217;s rich UI gives us some desired benefits:</p>
<ul>
<li>Removal of the refresh button</li>
<li>Automatic updating of the UI when the resource on the server has changed</li>
<li>Less repainting of the page since the DOM is touched only when the data has changed</li>
<li>Changes to the UI only happen when the window is active (the user sees them) as polling is paused while the user is doing something else</li>
</ul>
<p>Creating a reusable component to achieve a smart polling process feels like the correct approach as I foresee a need to use this functionality in future projects as well.<span id="more-288"></span><br />
<h3><a href="http://925html.com/files/smart_polling/">Poller &#8211; YUI3 Component</a></h3>
<h4>Update: The <a href="http://yuilibrary.com/gallery/show/io-poller">IO Poller Module</a> lives on the <a href="http://yuilibrary.com/gallery/">YUILibrary Gallery</a></h4>
<p>I&#8217;ve moved the code to the <a href="http://yuilibrary.com/gallery/">YUI 3 Gallery</a> on YUILibrary site; <a href="http://yuilibrary.com/gallery/show/io-poller">IO Poller on the YUILibrary Gallery</a>.</p>
<p><strong>The rest of this post is out-dated (comments are still good though)…</strong></p>
<p>The remainder of this post pertains to Poller, a YUI3 compatible component hosted in the files sections of this site: <strong><a href="http://925html.com/files/smart_polling/">http://925html.com/files/smart_polling/</a></strong> (<a href="http://925html.com/code/public-bazaar-vcs-repository/">a Bazaar branch</a>)</p>
<p>I&#8217;ve been developing several components and widgets using the new <a href="http://developer.yahoo.com/yui/3/">YUI3 component infrastructure</a>; this is the first fully built and documented (including docs for the relevant YUI modules) one I&#8217;m releasing.</p>
<ul>
<li><a href="http://925html.com/files/smart_polling/api/"><strong>Poller API</strong></a></li>
<li><a href="http://925html.com/files/smart_polling/build/poller/"><strong>Poller Build</strong></a></li>
<li><a href="http://925html.com/files/smart_polling/src/poller/"><strong>Poller Src</strong></a></li>
</ul>
<p>The Poller class is <strong>3.3kb minified</strong> and <strong>1.1kb gzipped</strong>, it requires <a href="http://developer.yahoo.com/yui/3/io/">io-base</a> and <a href="http://developer.yahoo.com/yui/3/base/">base</a> YUI3 modules.</p>
<p>The Poller class&#8217; usage is through the <a href="http://925html.com/files/smart_polling/api/Poller.html#methods">public API methods</a>: <code>pause</code>, <code>sendRequest</code>, <code>start</code> and <code>stop</code>; along with <a href="http://925html.com/files/smart_polling/api/Poller.html#events">events</a>: <code>modified</code>, <code>request</code>, <code>response</code>, <code>start</code> and <code>stop</code>.</p>
<p>Internally the Poller class is using conditional XHR GET requests. When polling is first kicked off (i.e. <code>start()</code> is called) the <strong>Etag and Last-Modified header values are cached</strong>. As subsequent polling requests are sent to the server the cached <strong>Etag</strong> is set for the <strong>If-None-Match</strong> HTTP request header, if no Etag was cached (i.e. the server doesn&#8217;t send Etags) then the cached <strong>Last-Modified</strong> date is set as the <strong>If-Modified-Since</strong> header. If a server doesn&#8217;t support conditional GET requests at all, sending neither an Etag nor a Last-Modified date, the Poller class will fire the <code>modified</code> event with every response.</p>
<h4>Example instance of Poller</h4>
<pre><code class="javascript">var myData = new Y.Poller({ url:'path/to/resource/', interval:5000 });
myData.on( 'modified', updateUI );
myData.start();</code></pre>
<p>The above code will continue sending Ajax requests to the resource at <code>path/to/resource/</code> until <code>myData.stop()</code> is called. If the Poller receives a 200 HTTP status (and not a 304 not modified status) the <code>modified</code> event will be fired passing the <code>txId</code>, <code>response</code> and <code>args</code> to the <code>updateUI</code> subscriber function. Subscribing to the <code>poller:modified</code> event is like subscribing to Y.io&#8217;s <code><a href="http://developer.yahoo.com/yui/3/io/#events">io:success</a></code> event.</p>
<h4>Disable polling on inactive windows</h4>
<p>With the above functionality covering most of our requirements, we still need a way to pause polling when the browser window isn&#8217;t active. We came up with the idea to attach listeners to the <code>window</code> <code>focus</code> and <code>blur</code> events which call into protected methods to start/stop the polling process. <strong>Note: this functionality won&#8217;t interfere with the client code&#8217;s intent.</strong> i.e. if the client explicitly calls <code>stop()</code>, losing (blur) then gaining focus of the browser window won&#8217;t automatically start the polling process again. It respects the state of the Poller&#8217;s <a href="http://925html.com/files/smart_polling/api/Poller.html#config_polling"><code>polling</code> read-only attribute</a>; calling <code>start()</code> will set the <code>polling</code> attribute to <code>true</code> and calling <code>stop()</code> will set the attribute to <code>false</code>.</p>
<p>To enable the functionality to pause and resume polling on the window&#8217;s focus and blur events: either <code>set</code> the <a href="http://925html.com/files/smart_polling/api/Poller.html#config_pauseInactive"><code>pauseInactive</code> attribute</a>, or declare <code>pauseInactive: true</code> on the <a href="http://925html.com/files/smart_polling/api/Poller.html#configattributes"><code>config</code> object</a> during construction.</p>
<p>Using the <code>myData</code> Poller instance from above:</p>
<pre><code class="javascript">myData.set( 'pauseInactive', true );</code></pre>
<p>Setting the <code>paseInactive</code> attribute on construction:</p>
<pre><code class="javascript">var myOtherData = new Y.Poller({
	url : 'path/to/resource/',
	interval : 5000,
	pauseInactive : true
});</code></pre>
<h4>Putting it all together</h4>
<p>I have a <a href="http://925html.com/files/smart_polling/run.html">small demo</a> for this project which continually checks a resource on the server to see if it has changed and updates the page if it has. The resource is a super simple JSON object with two properties: <code>label</code> and <code>time</code>, where <code>time</code> is a timestamp indicating the time on the server when the file was last modified.</p>
<pre><code class="javascript">{ "label":"the server's time was", "time":1238530883810 }</code></pre>
<p>There is a button on the page which will update the data file stamping the new time on the server as the value of the <code>time</code> property. You can press this button to update the data file and after the next polling request is sent the UI will be updated to reflect the change in the file. I&#8217;ve included a <a href="http://developer.yahoo.com/yui/3/console/">YUI Console</a> on the page which I send log messages to so you can see what&#8217;s going on.</p>
<p>The following is the code pertaining to the Poller instance used in the demo:</p>
<pre><code class="javascript">var poller = new Y.Poller({
	url : 'data.json',
	headers : {"foo":"bar"},
	interval : 7000,
	pauseInactive : true
});
poller.on( 'request', logRequestData );
poller.on( 'response', logResponseData );
poller.on( 'modified', updateUI );
poller.start();</code></pre>
<p><a href="http://925html.com/files/smart_polling/run.html"><strong>Run The Demo</strong></a></p>
<p><strong>Note:</strong> I&#8217;ve have some issues running the demo on IE8 and IE7, it has something to do with the YUI Console; enabling the Developer Tools in IE8 made the demo work correctly.</p>
<img src="http://feeds.feedburner.com/~r/925html/~4/tqf2bwXVNcw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://925html.com/code/smart-polling/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>The Sun Amongst The Clouds</title>
		<link>http://925html.com/deployment/the-sun-amongst-the-clouds/</link>
		<comments>http://925html.com/deployment/the-sun-amongst-the-clouds/#comments</comments>
		<pubDate>Sat, 21 Mar 2009 22:12:20 +0000</pubDate>
		<dc:creator>Eric Ferraiuolo</dc:creator>
				<category><![CDATA[Deployment]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[infrastructure]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[Sun]]></category>

		<guid isPermaLink="false">http://925html.com/?p=276</guid>
		<description><![CDATA[Sun Microsystems now has a cloud-based computing business. Not only are they going to start offering cloud-based services similar to that of Amazon AWS and Rackpsace Mosso; they&#8217;ve also released a Cloud API specified with RESTful HTTP and JSON. Maybe more interesting than the technology choices, is that Sun is releasing it as an open-source [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sun.com/">Sun Microsystems</a> now has a <a href="http://www.sun.com/solutions/cloudcomputing/index.jsp">cloud-based computing business</a>. Not only are they going to start offering cloud-based services similar to that of <a href="http://aws.amazon.com/">Amazon AWS</a> and <a href="http://www.rackspace.com/solutions/cloud_hosting/index.php">Rackpsace Mosso</a>; they&#8217;ve also released a <a href="http://kenai.com/projects/suncloudapis">Cloud API specified with RESTful HTTP and JSON</a>. Maybe more interesting than the technology choices, is that Sun is releasing it as an open-source project licensed with <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution</a>.</p>
<p><a href="http://en.wikipedia.org/wiki/Tim_Bray">Tim Bray</a>, the Director of Web Technologies at Sun Microsystems, <a href="http://www.tbray.org/ongoing/When/200x/2009/03/16/Sun-Cloud">blogged about his involvement developing the API</a>:</p>
<blockquote><p><a href="http://www.tbray.org/ongoing/When/200x/2009/03/16/Sun-Cloud">The Sun Cloud</a>: &#8220;This is a unified view of the storage and compute and networking services. It’s built around the notion of a ‘Virtual Data Center’ (VDC), which contains networks and clusters of servers and public IP addresses and storage services. The idea is to give you the administrative and operational handles to build something really big and ambitious. The VDC notion is really slick and I think something like it is going to be required in any serious cloud API going forward.</p>
<p>At the bottom level, the interface is based on HTTP and tries hard to be RESTful. All the resources—servers, networks, virtual data centers—are represented in JSON. <em>[Don’t you mean XML? -Ed.] [Nope, JSON is just right for this one. -Tim]</em>&#8221;</p>
<p>(Via <a href="http://www.tbray.org/ongoing/">ongoing</a>.)</p>
</blockquote>
<p>After reading Tim&#8217;s post, I went directly to <a href="http://kenai.com/projects/suncloudapis">the Cloud API project site</a> on Kenai and read <a href="http://kenai.com/projects/suncloudapis/pages/Home">all the docs</a> for the API specification. Reading the specs raised some questions, most of which <a href="http://kenai.com/projects/suncloudapis/forums/forum/topics/524-API-Discussion">others were already discussing</a> in <a href="http://kenai.com/projects/suncloudapis/forums/">the forums</a>. I&#8217;m really digging the RESTful HTTP with JSON APIs. It just feels more natural then the Amazon AWS APIs.</p>
<p>Sun is retaining the separation between the APIs and the implementations and encouraging other cloud providers to also implement their APIs. Potentially allowing a client to have interoperability between CSP (Cloud Service Providers). I feel similarly about CSPs adopting Sun&#8217;s Cloud APIs as <a href="http://925html.com/code/yui3-is-sizzling-hot/">I do with JavaScript libraries adopting the Sizzle JavaScript Selector Library</a>; <strong>i.e. Amazon AWS should provide an implementation of Sun&#8217;s Cloud APIs</strong>, or someone should write an adapter.</p>
<p>While the Cloud APIs are still in-flux, they are defiantly on the right path here. Sun is listening to the community while taking the feedback seriously; great to see from a big company with their open source project. Sun is stepping up the game by providing not just cloud-based resources, but an API built on current technologies (RESTful HTTP and JSON) and allowing any cloud-based service provider to use it.</p>
<img src="http://feeds.feedburner.com/~r/925html/~4/h1BuZMqDQ9w" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://925html.com/deployment/the-sun-amongst-the-clouds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss><!-- Dynamic page generated in 1.024 seconds. --><!-- Cached page generated by WP-Super-Cache on 2010-03-17 03:29:30 --><!-- Compression = gzip -->
