<?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>Nicolas Schudel &#187; Web Development</title>
	<atom:link href="http://nicolasschudel.name/category/web-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://nicolasschudel.name</link>
	<description>Balancing Design and Development in Online Media</description>
	<lastBuildDate>Sun, 09 May 2010 08:42:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Compressed, High-Performing Animations in Flash</title>
		<link>http://nicolasschudel.name/bitmap-animations/</link>
		<comments>http://nicolasschudel.name/bitmap-animations/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 01:50:22 +0000</pubDate>
		<dc:creator>Nicolas</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://nicolasschudel.name/?p=296</guid>
		<description><![CDATA[<p>Multimedia applications often have interactive elements based on video. The Flash Video data used for such scenes is compressed but processor intensive. I discuss a solution that decompresses the data on the client side, in order to enhance display performance.</p>]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>
Multimedia applications often have interactive elements based on video: For example, a pre-rendered 3D scene that moves according to a user’s interaction. The trick, in such a scene, is to play specific parts of the movie forward and backward to fake movement.
</p>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="480" height="360" id="sculpture"><param name="movie" value="/fileadmin/articles/2009/11/sculpture.swf" /><!--[if !IE]>--><object type="application/x-shockwave-flash" data="/fileadmin/articles/2009/11/sculpture.swf" width="480" height="360"><!--<![endif]--><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a><!--[if !IE]>--></object><!--<![endif]--></object>
<p class="wp-caption-text">
This sculpture has been rendered as a movie, with the camera panning 360˚around the object. <br />(Drag with the mouse to turn the object)
</p>

<h2>Embedding Animations</h2>
<p>
There are three basic ways to embed an animated scene into Flash:
</p>
<ul>
<li>In the Flash Video format (FLV);</li>
<li>As a sequence of images, e.g. PNG or JPEG;</li>
<li>As a sequence of vector graphics.</li>
</ul>
<p>
The latter is often forgotten. Tools such as <a href="http://www.cinemax4d.de/flashex/home_us.html">Cinema 4D’s FlashEx renderer</a> can export a scene as a vector animation. If the scene doesn’t contain many objects and has simple texturing, a vector animation would probably be the way to go. The file size stays relatively small, plus the graphics are scalable.
</p>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="480" height="150" id="blimp"><param name="movie" value="/fileadmin/articles/2009/11/blimp.swf" /><!--[if !IE]>--><object type="application/x-shockwave-flash" data="/fileadmin/articles/2009/11/blimp.swf" width="480" height="150"><!--<![endif]--><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a><!--[if !IE]>--></object><!--<![endif]--></object>
<p class="wp-caption-text">
A simple 3D object rendered as a vector sequence with FlashEx 2.<br />(Drag with the mouse to turn the object)
</p>
<p>
The other two methods, FLV and image sequences, are both pixel based, but have their own pros and cons. FLV has a decent quality/size ratio. <a href="http://help.adobe.com/en_US/Flash/10.0_UsingFlash/WSBDABD69F-D146-4e5c-9340-BF717A10426C.html">Flash CS4 does not allow F4V files to be embedded directly</a>, so the best codec is the older and less compressing On2 VP6. Interacting with FLV, e.g. jumping between frames quickly or playing it backward, is heavy on the processor. Presumably, the Flash Player has to jump to the nearest proceeding keyframe and process the changes to the current frame each time. On the other end of the spectrum is the image sequence. The compression is on a per-frame basis, so the overall file size will usually turn out much bigger. The display performance, however, is far better than FLV.
</p>
<h2>Eliminating the Cons</h2>
<p>
A combination of the reduced file size of FLV and the performance of an image sequence is possible, if the data gets decompressed on the client side. H.264 encoded video data could be sent through the wire and then be processed into an uncompressed image sequence before being displayed. I wrote a class named BitmapAnimation that parses each frame of a MovieClip (including any FLVs within) and adds it to an array of bitmap data. BitmapAnimation has the same methods as a MovieClip (gotoAndPlay, currentframe etc.), so the two can be interchanged. For instance, I was able to use a BitmapAnimation in place of a MovieClip to create a MovieMaterial in Papervision3d – polymorphism works. 
</p>
<p>
When <a href="/fileadmin/flv_vs_bitmapanimation.zip">compared with simultaneously running FLVs</a>, BitmapAnimations showed a <strong>500% performance increase</strong> on my system. The difference was even bigger with the clips running backward. There may be a performance benefit in converting complicated vector animations to a BitmapAnimation before they are displayed. I have, however, not recently come across a scenario where a pure vector animation alone caused the frame rate to stagnate. 
</p>
<p>
The MovieClip option cacheAsBitmap requires, to my understanding, the frame to be rendered in the Flash display list before it takes effect. This would be the only major difference to BitmapAnimation (where the image is rendered before being displayed). Enabling cacheAsBitmap on MovieClips containing FLV did not show a change in performance in my tests. Because a video is usually viewed once, it makes sense not to cache FLV by default.
</p>
<p>
There is one known drawback when using a BitmapAnimation: Depending on the size of the video and the client’s processor speed, the Flash Player could “freeze” for a few seconds while decompressing the video data. I created an additional class, where I lengthened the processing time by decompressing one frame per half-second. This would allow the video to be prepared in the background without noticeably slowing down the rest of the application. Delayed processing would work best during a loading sequence, where the video is loaded first, then converted to a BitmapAnimation, while the rest of the assets are being retrieved.
</p>
<h2>Usage</h2>
<p>Simply pass a MovieClip to the draw method.</p>
<pre class="brush: as3">
bitmapAnimation = new BitmapAnimation();
bitmapAnimation.draw(movieClip);
addChild(bitmapAnimation);
</pre>
<p>The imported bitmap data can be reused with multiple BitmapAnimations.</p>
<pre class="brush: as3">
var bitmapAnimation1:BitmapAnimation = new BitmapAnimation();
bitmapAnimation1.draw(movieClip);
var bitmapAnimation2:BitmapAnimation = new BitmapAnimation(bitmapAnimation1.bitmapSequence);
</pre>

<h2>Conclusions</h2>
<p>
Pre-rendering a complex MovieClip, such as embedded FLV, using the BitmapAnimation class, may likely show a performance increase. Also, this method may remove the need to embed an image sequence where display performance is an issue. Due to the computation time required for conversion, BitmapAnimations should not be used for long clips. Inputs and feature requests are welcome, just add a comment below.
</p>
<p><a href="/fileadmin/bitmapanimation_classes.zip">Download the classes BitmapAnimation and DelayedBitmapAnimation</a>.</p>
<p><a href="/fileadmin/blimp.zip">Download the blimp example</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://nicolasschudel.name/bitmap-animations/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>ActionScript Performance Testing</title>
		<link>http://nicolasschudel.name/actionscript-performance-testing/</link>
		<comments>http://nicolasschudel.name/actionscript-performance-testing/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 20:41:33 +0000</pubDate>
		<dc:creator>Nicolas</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://nicolasschudel.name/?p=277</guid>
		<description><![CDATA[Unlike Javascript, ActionScript usually runs on the same engine (the AVM). This makes specific performance tests worthwhile, in order to compare different code execution speeds. I start a Wiki, where I document such tests and display my results.]]></description>
			<content:encoded><![CDATA[<p>The way I see it, Flash is currently the standard tool for developing and distributing casual games on the net. While the Flash Player has been making leaps in performance these past years, it still has severe limitations in comparison with modern games on other platforms (e.g. game consoles).</p>
<div id="attachment_401" class="wp-caption alignright" style="width: 160px"><a href="http://nicolasschudel.name/fileadmin/articles//2009/11/destruction-derby.png" rel="shadowbox[post-277];player=img;"><img src="http://nicolasschudel.name/fileadmin/articles//2009/11/destruction-derby-150x150.png" alt="Screenshot from the 1995 racing game Destruction Derby" title="Destruction Derby" width="150" height="150" class="size-thumbnail wp-image-401" /></a><p class="wp-caption-text">Screenshot from the 1995 racing game Destruction Derby</p></div>
<p>It seems that the graphics performance is comparable to games that came out in 1995 on the PC, before graphics hardware became widespread. Imagine running a game like <a href="http://en.wikipedia.org/wiki/Dark_Forces">Dark Forces</a> or <a href="http://en.wikipedia.org/wiki/Destruction_Derby_(video_game)">Destruction Derby</a> inside the browser. In a nutshell, on today’s average computer, the Flash graphics performance is <a href="http://en.wikipedia.org/wiki/Quake">Quake 1</a> tops. Broad statements aside, it is important to know what code flies on the Flash Player when developing games and interactive applications.</p>
<p>I’d like to know what basic code will perform best in a given situation. Therefore, I have started to extract these parts of code from my projects and test them against alternative methods, attempting to quantify the execution speed on the <abbr title="ActionScript Virtual Machine">AVM</abbr>. Unlike Javascript, ActionScript usually runs on the same engine; This makes such specific tests worthwhile.</p>
<p>I have gathered performance tests from a couple of my projects and put them into the <a href="http://nicolasschudel.name/actionscript-performance-wiki/Main_Page"><strong>ActionScript Performance Wiki</strong></a>. It is open to anonymous editors, so anybody is free to add their own tests.</p>
]]></content:encoded>
			<wfw:commentRss>http://nicolasschudel.name/actionscript-performance-testing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Linking a Site’s Search Function to the Browser’s Search Bar</title>
		<link>http://nicolasschudel.name/linking-search/</link>
		<comments>http://nicolasschudel.name/linking-search/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 18:56:02 +0000</pubDate>
		<dc:creator>Nicolas</dc:creator>
				<category><![CDATA[Branding]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Search]]></category>
		<category><![CDATA[Usability]]></category>

		<guid isPermaLink="false">http://nicolasschudel.name/?p=180</guid>
		<description><![CDATA[<p>The search bar has become a common feature in modern web browsers. Equally common, are search forms embedded into web sites. I talk about a format named OpenSearch and show how it can be used to link site- and browser search functionality.</p>]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://www.mozilla.com/en-US/firefox/search.html">search bar</a> has become a common feature in modern browsers since it was <a href="http://en.wikipedia.org/wiki/Browser_wars#The_second_browser_war">introduced by Firefox in 2004</a>. Users have gotten so used to finding the search bar in the upper right hand corner of the window, that many sites<a href="http://www.uie.com/brainsparks/2006/03/22/does-search-need-to-be-in-the-upper-right/"> adapted their layout to place their own local search in the same area</a>.</p>

<p>A lesser known feature of browsers, such as Firefox 2 or Internet Explorer 7, is that users can add search functionality to the browser’s search bar directly from within a page. The data structure containing the search information has (so far) been agreed upon as <a href="http://www.opensearch.org/">OpenSearch</a>. Since the format is open, any browser software can implement this functionality.</p>

<div class="column half left">
<div id="attachment_192" class="wp-caption alignnone" style="width: 314px"><img src="http://nicolasschudel.name/fileadmin/articles/2009/11/firefox3_searchbar.jpg" alt="The Firefox search bar with a linked OpenSearch example on the bottom." title="Firefox 3 Search Bar" width="304" height="216" class="size-full wp-image-192" /><p class="wp-caption-text">The Firefox search bar with a linked OpenSearch example on the bottom.</p></div>
</div>
<div class="column half right">
<div id="attachment_193" class="wp-caption alignnone" style="width: 314px"><img src="http://nicolasschudel.name/fileadmin/articles/2009/11/ie8_searchbar.jpg" alt="The Internet Explorer search bar listing the OpenSearch example." title="Internet Explorer 8 Search Bar" width="304" height="216" class="size-full wp-image-193" /><p class="wp-caption-text">The Internet Explorer search bar listing an OpenSearch example.</p></div>
</div>
<h2>When to use OpenSearch</h2>
<p>OpenSearch makes sense on any site that provides search functionality. When active, Firefox and Internet Explorer include an option to add the site’s search in the search bar. </p>
<img src="http://nicolasschudel.name/fileadmin/articles/2009/11/add_search_bar_link.jpg" alt="A link indicating that the site’s search can be added to the browser search bar" title="Search Bar Link" width="244" height="208" class="alignleft size-full wp-image-189" />

<p>In my opinion, adding a notice or a link on the page to enable the search functionality is overkill for most sites. I personally wouldn’t use it for my own weblog. On the other hand, an online store with thousands of products could greatly benefit from this feature as a brand touchpoint; And informing the user about this functionality would be worthwhile. Once a user adds a site to their browsers search bar, it is a constant reminder of the site’s existence. Every time a user activates the search bar drop-down menu, that site will be there.<br /></p>

<h2>Implementation</h2>
<p>Versions of Firefox before 2.0 had a different way for adding search to the search bar. It was similar, but included a different XML structure. The data was saved in files ending with “.src”. I decided not to add this method anymore, since it is specific to a small user base (who still uses FF 1.0?).</p>

<p>Only two things need to be done to add OpenSearch:</p>

<ol>
	<li>Create an XML-File containing data about the search engine;</li>
	<li>Link to the XML-File in the head of the site’s HTML.</li>
</ol>

<p>The XML, for example, would be structured as follows; Simply adapt the URLs for your site. To get the correct search URL, perform a search on your site, copy the URL and replace your search term with “{searchTerms}”.</p>
<pre class="brush: xml">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&gt;
&lt;OpenSearchDescription xmlns=&quot;http://a9.com/-/spec/opensearch/1.1/&quot;&gt;
	&lt;ShortName&gt;OpenSearch Example Name&lt;/ShortName&gt;
	&lt;Description&gt;OpenSearch Example Description&lt;/Description&gt;
	&lt;InputEncoding&gt;UTF-8&lt;/InputEncoding&gt;
	&lt;Image height=&quot;16&quot; width=&quot;16&quot; type=&quot;image/x-icon&quot;&gt;http://yoursite/favicon.ico&lt;/Image&gt;
	&lt;Url type=&quot;text/html&quot; template=&quot;http://yoursite/?s={searchTerms}&quot; /&gt;
&lt;/OpenSearchDescription&gt;</pre>
<p>This file could then be saved as “search.xml” to the root folder of the site and linked to by placing the following code in the HTML header:</p>
<pre class="brush: xml">&lt;link rel=&quot;search&quot; type=&quot;application/opensearchdescription+xml&quot; title=&quot;OpenSearch Example Title&quot; href=&quot;/search.xml&quot;&gt;</pre>
<h2>Including an OpenSearch Link to the Page</h2>
Optionally, the search plugin can be installed via a link using Javascript. Both Firefox and Internet Explorer use this:
<pre class="brush: jscript">window.external.AddSearchProvider(&quot;search.xml&quot;);</pre>
<p>An unobtrusive way to add the link, is to first check if the browser supports the AddSearchProvider function before adding it. Further details can be found on <a href="https://developer.mozilla.org/En/Adding_search_engines_from_web_pages#Browser_search_engine_capability_detection">Mozilla’s developer site</a>.</p>
<pre class="brush: xml">&lt;p id=&quot;add-opensearch&quot;&gt;OpenSearch not supported&lt;/p&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
	if (window.external &amp;&amp; (&quot;AddSearchProvider&quot; in window.external)) {
		document.getElementById(&quot;add-opensearch&quot;).innerHTML = '&lt;a href=&quot;#&quot; onclick=&quot;window.external.AddSearchProvider(\'/search.xml\')&quot;&gt;Add this site’s search to your browsers search bar.&lt;/a&gt;';
	}
&lt;/script&gt;</pre>
<h2>Possible Future Browser Features</h2>
<p>I have a hunch that the usability of web-browsing in general, would be enhanced if the browser could detect OpenSearch and enable it temporarily in its search bar. The use case could be: </p>

<p><em>A user visits a site and the browser toggles the search bar to the site’s search. Instead of looking for a search form in the page, the user enters the query via the browser. Upon leaving the site the search bar switches to the new site’s search functionality, or defaults to the preferred search engine.</em></p>

<p>The search bar could be highlighted with another color to indicate that it’s linked to the current site.</p>

<p>For this feature to be useful, OpenSearch would have to become more commonly adopted. But I think sites would follow quickly once a browser vendor starts pushing the feature.</p>

<h2>Conclusion</h2>
<p>In my opinion, the creators of OpenSearch got it right. The specification is clear and it blends in perfectly with the existing technologies, HTML and Javascript. Plus, it is quick and easy to implement. I could recommend any web content management system with search functionality to enable this feature as standard.</p>

<p>I would also recommend adding a <a href="http://en.wikipedia.org/wiki/Favicon">favicon</a> to the OpenSearch XML, so the site stands out more in the browser’s search bar.</p>

<p><strong><a href="/fileadmin/opensearch_example.zip">Download the Code</a></strong></p>]]></content:encoded>
			<wfw:commentRss>http://nicolasschudel.name/linking-search/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Upcoming Flash Platform Goodness</title>
		<link>http://nicolasschudel.name/upcoming-flash-platform-goodness/</link>
		<comments>http://nicolasschudel.name/upcoming-flash-platform-goodness/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 14:02:45 +0000</pubDate>
		<dc:creator>Nicolas</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Conference]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://nicolasschudel.name/?p=1</guid>
		<description><![CDATA[Adobe presented new Flash related products at Adobe Max in Milan. Three favorites of mine are Flex 4, BlazeDS for .Net, and the RTMFP protocol. Based on the announcements, I make some predictions for the future of the Flash platform.]]></description>
			<content:encoded><![CDATA[<p>I just got back from the Adobe Max conference in Milan this week. Boy, what an event it was! I haven&#8217;t been to any large conferences recently, so I can&#8217;t make any direct comparisons. For me, it was great balance between learning and fun. I got some good insight into what to expect from future Adobe products, here are some snippets that are important to me as a Flash Developer:
</p>
<p>
In my opinion, it looks like Flash will gradually return back to it&#8217;s roots as an animation tool. Unlike today, where it has become a multimedia behemoth in which entire sites are created. Flex and a new product named <a href="http://labs.adobe.com/technologies/flashcatalyst/">Flash Catalyst</a> (formerly Thermo) will take over the rolls of creating user interaction. I got a preview copy of Catalyst and it looks pretty good. Page elements, and their states, can be assembled visually based on an imported Illustrator or Photoshop composition. It reminds me somewhat of Dreamweaver, but instead of HTML in creates MXML (the declarative language used in Flex).
</p>
<p>
I took a preview of <a href="http://opensource.adobe.com/wiki/display/flexsdk/Gumbo">Flex 4 (codename Gumbo)</a> for a spin, but it still can&#8217;t keep up with the sheer awesomeness of <a href="http://fdt.powerflasher.com/">FDT</a>. I think Adobe should just buy FDT, employ all the <a href="http://powerflasher.com/">Powerflasher</a> dudes, mash the two products together, and give it a snappy name like Adobe Insane.
</p>
<p>
In one of the general sessions held on Tuesday it was mentioned that <a href="http://opensource.adobe.com/wiki/display/blazeds/BlazeDS/">BlazeDS</a> should soon be compatible with the .Net framework. I was exited about BlazeDS when I first heard of the product a couple months back, but my excitement eroded away like a soaked sandcastle when I heard it required Java. Nothing against Java of course, but the company I work for uses .Net. BlazeDS may yet make it onto the company servers.
</p>
<p>
One of the Max sessions showed a sneak peak of peer-to-peer capabilities in the Flash Player on the basis of <acronym title="Real Time Media Flow Protocol">RTMFP</acronym>. A peer-to-peer mesh would open up some amazing data sharing possibilities. We could build a Skynet of SWFs! Historians in two hundred years would say things like: &#8220;At first it played simple animations and cheesy banners, but then it gained consciousness ant launched a nuclear attack&#8221;. We could also just use this technology for video streaming I guess.
</p>
<p>
I had a great time at Max, and I am looking forward to continuing my work as a Flash Developer with all the great new Tools coming up.</p>
]]></content:encoded>
			<wfw:commentRss>http://nicolasschudel.name/upcoming-flash-platform-goodness/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debugging in Flash Revisited</title>
		<link>http://nicolasschudel.name/debugging-in-flash-revisited/</link>
		<comments>http://nicolasschudel.name/debugging-in-flash-revisited/#comments</comments>
		<pubDate>Wed, 20 Aug 2008 15:15:13 +0000</pubDate>
		<dc:creator>Nicolas</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://nicolasschudel.name/?p=4</guid>
		<description><![CDATA[An update to my previous post about debugging in Flash. I introduce the Flash Tracer Firefox plugin, and describe why it’s better than the formerly used Javascript-Firebug combo.]]></description>
			<content:encoded><![CDATA[<p>I short while back I wrote about debugging in Flash and the many options available to receive messages via a web browser. My conclusion was send output to the Firebug plugin using Javascript. I have been using this method now for my projects long enough to notice it&#8217;s shortcomings. One is that the unused Debugger code stays inside the SWF (even when disabled), and the other is that it only works inside Firefox with Firebug.</p>
<p> I made another attempt to get the <a href="http://www.sephiroth.it/firefox/">Flash Tracer plugin from Sephiroth</a> to work and I was successful (turns out my User Settings folder at work is saved on the 486 down the hall). With a few tweeks to the mm.cfg file I even get warnings about Security issues: </p>
<p><code>
<pre>
ErrorReportingEnable=1
TraceOutputFileEnable=1
PolicyFileLog=1
PolicyFileLogAppend=1
</pre>
<p></code></p>
<p>Apart from the dreadfully slow performance, I think this is the simplest way to debug a Flash App from within the browser.</p>
]]></content:encoded>
			<wfw:commentRss>http://nicolasschudel.name/debugging-in-flash-revisited/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How Descriptive Variable Names Affect a SWF’s File Size</title>
		<link>http://nicolasschudel.name/how-long-variable-names-affect-swf-filesizes/</link>
		<comments>http://nicolasschudel.name/how-long-variable-names-affect-swf-filesizes/#comments</comments>
		<pubDate>Thu, 07 Aug 2008 09:30:34 +0000</pubDate>
		<dc:creator>Nicolas</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://nicolasschudel.name/?p=6</guid>
		<description><![CDATA[A create a brief test to compare the file size overhead of long variable names to short ones, and conclude that descriptive code is worth more than the reduced file size.]]></description>
			<content:encoded><![CDATA[<p>
Often I notice in other peoples Actionscript code, that all the variable names are really vague. The programmer&#8217;s typing effort is shortened at the cost of readability. Reducing the file size of the final application may be a reason, but the names get compiled into smaller bytecode at the end. I was wondering what the impact is on the file-size of a compiled SWF.
</p>
<p>
A quick test gave the answer: Practically nill. 30 really long variable names compared to 30 short ones resulted in a file size difference of a measly 5 bytes.
</p>
<h2>Conclusion</h2>
<p>
For file size optimization, limiting the length of variable names should be considered an extreme measure. Rather, leave the code readable and optimize the images instead.</p>
<h2>Update</h2>
<p>
Short variable names <a href="http://blog.hexagonstar.com/as3-short-variablefunction-names-vs-long-ones/">perform better</a> than long ones. But again, not enough to make it worthwhile throughout the entire application.</p>
]]></content:encoded>
			<wfw:commentRss>http://nicolasschudel.name/how-long-variable-names-affect-swf-filesizes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SWF WMODE Transparency Hell</title>
		<link>http://nicolasschudel.name/swf-wmode-transparency-hell/</link>
		<comments>http://nicolasschudel.name/swf-wmode-transparency-hell/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 15:01:11 +0000</pubDate>
		<dc:creator>Nicolas</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://nicolasschudel.name/?p=9</guid>
		<description><![CDATA[I have been having trouble with the WMODE="transparent" embed setting in combination with Firefox. What I wanted to do was show a SWF on top of some HTML with the background set to transparent. Turns out that it's just not possible in Firefox.]]></description>
			<content:encoded><![CDATA[<p>
One issue was that the user had to click into the SWF at least once for the dragging functionality to work properly. Otherwise an item would lag behind the mouse.
</p>
<p>
The biggest issue I had was that the keyboard input would somehow get &#8220;reset&#8221; to the English layout.  This means that anybody using a non-English keyboard would get strange results while typing. This <a href="http://www.5etdemi.com/blog/archives/2005/06/firefox-wmodetransparent-is-completely-screwy-and-breaks-textfields/">keyboard bug</a> has been known since at least 2005.
</p>
<p>
In the end I just loaded a dummy image into the background of the SWF instead of making it transparent. All the other browsers behaved fairly well with the WMODE setting.
</p>
<p>
If anybody else is having these issues, head over to <a href="https://bugzilla.mozilla.org/">bugzilla</a> and vote for getting <a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=wmode+transparent">the bugs</a> fixed.
</p>
<p>
In conclusion, consider WMODE=&#8221;transparent&#8221; a last resort for even the simplest Flash projects.</p>
]]></content:encoded>
			<wfw:commentRss>http://nicolasschudel.name/swf-wmode-transparency-hell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>1001 Ways to Debug in Flash</title>
		<link>http://nicolasschudel.name/1001-ways-to-debug-in-flash/</link>
		<comments>http://nicolasschudel.name/1001-ways-to-debug-in-flash/#comments</comments>
		<pubDate>Tue, 08 Jul 2008 16:10:26 +0000</pubDate>
		<dc:creator>Nicolas</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://nicolasschudel.name/?p=15</guid>
		<description><![CDATA[<p>I have been looking around at all the different ways to debug content when developing Flash applications. The Flex folks already have a decent way of doing this, since the debug version of the Flash player communicates everything back to the Flexbuilder IDE. In Flash it's not that easy. As soon as the SWF is being run from within a browser all those <em>Trace statements</em> don't get through anymore.</p>]]></description>
			<content:encoded><![CDATA[<p>
I have checked out something like over 1000 different ways (number inflated for more drama) to debug Flash content within the browser and picked out the following 4 decent tools:
<ul>
<li><a href="http://www.powerflasher.de/">Powerflasher SOS</a></li>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/3469">Flash Tracer Firefox Plugin</a></li>
<li><a href="http://osflash.org/xray">Xray</a></li>
<li><a href="http://code.google.com/p/flash-thunderbolt/">Thunderbolt</a></li>
</ul>
</p>
<p>
<strong>SOS</strong> looked sweet for a moment, because it used an XML Socket for the Logging statements. However I ran into some cross-domain issues on an external development server, so I put it aside. The <strong>Flash Tracer</strong> plugin for Firefox would have been sweeeet, but I gave up trying to get it work in Firefox 3. <strong>Xray</strong> is a debugging behemoth. I didn&#8217;t quit like having to include a connector component to my SWF. All these debuggers are pretty darn good, but they all involved some twisted procedures to get them up and running. I then stumbled across a super simple answer to my browser debugging issue. Why not just <a href="http://getfirebug.com/">do what the Javascript guys do</a>? <a href="http://labs.findsubstance.com/2008/02/26/firebugs-console-log-flash-debugging-made-easy/">Trace it out to Firebug</a> like this: 
</p>
<pre class="brush: jscript">
ExternalInterface.call(&quot;console.log&quot;,&quot;test&quot;);
</pre>
<p>
It&#8217;s so simple it can&#8217;t be wrong. There is just an issue that I have to decide if I want to use Flash&#8217;s built in <em>trace function</em> or the Firebug log while debugging. This however is taken care of buy <strong>Thunderbolt</strong>. It is a simple class that notices if Firebug is accessible and otherwise uses <em>trace</em>. Thunderbolt also has a &#8220;hide&#8221; option built in, for when the SWF goes live.
</p>
<h3>Conclusion</h3>
<p>
The Firebug / Thunderbolt combo is an elegant way to debug Flash content in both the Flash IDE and in Firefox. For a quick introduction to Thunderbolt, check out the Article <a href="http://www.websector.de/blog/2008/06/15/10-tips-and-tricks-using-thunderbolt-as3/">10 tips and tricks using ThunderBolt AS3</a>, by Thunderbolt&#8217;s author Jens Krause.
</p>]]></content:encoded>
			<wfw:commentRss>http://nicolasschudel.name/1001-ways-to-debug-in-flash/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Lessons Learned Implementing the hResume Microformat</title>
		<link>http://nicolasschudel.name/lessons-learned-implementing-the-hresume-microformat/</link>
		<comments>http://nicolasschudel.name/lessons-learned-implementing-the-hresume-microformat/#comments</comments>
		<pubDate>Tue, 08 Apr 2008 16:40:20 +0000</pubDate>
		<dc:creator>Nicolas</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Microformats]]></category>

		<guid isPermaLink="false">http://nicolasschudel.name/?p=20</guid>
		<description><![CDATA[<p>A digital resume or <abbr title="Curriculum Vitae">CV</abbr> has a few plusses over its paper predecessor. One of these extras is the ability to give the information more meaning to the reader - human or machine. The hResume microformat introduces some nice additions to the usual HTML markup, but some rocks lay in the path of the implementor.</p>]]></description>
			<content:encoded><![CDATA[<p>
I made two changes of my own while using hResume. I sweetened the (generated) markup and discarded the <code>object</code> tag.
</p>
<h3>Pimping the Markup</h3>
<p>
There are <a href="http://microformats.org/wiki/hresume#Implementations">many tools for creating hResume markup</a>, but the ones I tested ended up creating something similar to the following code:
</p>
<pre class="brush: xml">
&lt;div class=&quot;experience vevent vcard&quot;&gt;
	&lt;div class=&quot;htitle&quot;&gt;
		&lt;object data=&quot;#j&quot; class=&quot;include&quot;&gt;&lt;/object&gt;
		&lt;span class=&quot;title&quot;&gt;Coffee Bringer&lt;/span&gt;&lt;br/&gt;
		&lt;span class=&quot;org&quot;&gt;My Employer&lt;/span&gt;, &lt;span class=&quot;location&quot;&gt;My Location&lt;/span&gt;
	&lt;/div&gt;
	&lt;div class=&quot;date_duration&quot;&gt;
		&lt;abbr class=&quot;dtstart&quot; title=&quot;2008-01-01&quot;&gt;January 2008&lt;/abbr&gt; - &lt;abbr class=&quot;dtend&quot; title=&quot;2008-03-01&quot;&gt;March 2008&lt;/abbr&gt;
	&lt;/div&gt;
	&lt;div style=&quot;clear: both&quot;&gt;&amp;nbsp;&lt;/div&gt;
	&lt;div class=&quot;description&quot;&gt;Bringing coffee to fellow web designers while they work.&lt;/div&gt;
&lt;/div&gt;
</pre>
<p>
The markup kinda misses the point of being human readable (<a href="http://microformats.org/about/">a main objective of Microformats</a>). At first glance, the employer, job title, date, location, and description should be marked up as a definition list. In my opinion, however, describing the data using a table would have an additional advantage: The description could be put into the table footer using the <code>tfoot</code> tag. This way it references to the rest of the data the good-old HTML way.
</p>
<pre class="brush: xml">
&lt;table class=&quot;vcalendar experience vevent vcard&quot; summary=&quot;Experience Overview&quot;&gt;
	&lt;thead&gt;
		&lt;tr&gt;
			&lt;th scope=&quot;col&quot;&gt;Title&lt;/th&gt;
			&lt;th scope=&quot;col&quot;&gt;Duration&lt;/th&gt;
			&lt;th scope=&quot;col&quot;&gt;Employer&lt;/th&gt;
			&lt;th scope=&quot;col&quot;&gt;Location&lt;/th&gt;
		&lt;/tr&gt;
	&lt;/thead&gt;
	&lt;tfoot&gt;
		&lt;tr&gt;
			&lt;td colspan=&quot;4&quot; class=&quot;description&quot;&gt;Bringing coffee to fellow web designers while they work.&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/tfoot&gt;
	&lt;tbody&gt;
		&lt;tr class=&quot;htitle&quot;&gt;
			&lt;td class=&quot;title&quot;&gt;&lt;a class=&quot;include&quot; href=&quot;#j&quot; rel=&quot;#j&quot;&gt;Coffee Bringer 2&lt;/a&gt;&lt;/td&gt;
			&lt;td class=&quot;date_duration&quot;&gt;
				&lt;abbr class=&quot;dtstart&quot; title=&quot;2008-01-01&quot;&gt;January 2008&lt;/abbr&gt; -
				&lt;abbr class=&quot;dtend&quot; title=&quot;2008-03-01&quot;&gt;March 2008&lt;/abbr&gt;
			&lt;/td&gt;
			&lt;td class=&quot;org&quot;&gt;My Employer&lt;/td&gt;
			&lt;td class=&quot;location&quot;&gt;My Location&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
</pre>
<p>
This has the additional advantage that it displays nicely in the browser even when CSS is turned off. But wait, isn't the object tag missing?
</p>
<h3>Good-Bye Object Tag</h3>
<p>
The <code>object</code> tag inside the Microformat links each <em>vevent</em> element to the <em>vcard</em> later in the hResume. The Safari browser, and presumably any software using WebKit, renders the reference of the <code>object</code> so that it displays the whole page (and vcard) every time. It's the correct thing to do, I guess, but it makes the visualization of the resume overly-complicated.
</p>
<p>
The <a href="http://microformats.org/wiki/hresume">Wiki entry on hResume</a> describes a workaround to this by setting the dimensions to zero.
</p>
<pre class="brush: xml">
&lt;object data=&quot;#j&quot; class=&quot;include&quot; width=&quot;0&quot; height=&quot;0&quot;&gt;&lt;/object&gt;
</pre>
<p>
Safari rendered the data accordingly (by not showing it), but the page's display performance stayed unbearably bad (duh, it rendered the entire page anew inside each <em>vevent</em>). I, therefore, discarded the object tag all-together. I don't think it's a big loss, since the <em>vcard</em> is still there inside the hResume. A better option may be to add the reference along with the title using a link and the <em>rel</em> attribute instead, as seen in my code above.
</p>
<h3>Conclusion</h3>
<p>
There is still some changes to be made to the hResume Microformat before it can be considered "1.0". Turning the <em>vevent</em> markup into a table and rethinking/discarding the <code>object</code> tag may be two useful advances for the format.
</p>]]></content:encoded>
			<wfw:commentRss>http://nicolasschudel.name/lessons-learned-implementing-the-hresume-microformat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making Sign-Up Forms That Much Easier</title>
		<link>http://nicolasschudel.name/making-sign-up-forms-that-much-easier/</link>
		<comments>http://nicolasschudel.name/making-sign-up-forms-that-much-easier/#comments</comments>
		<pubDate>Mon, 18 Feb 2008 13:23:22 +0000</pubDate>
		<dc:creator>Nicolas</dc:creator>
				<category><![CDATA[E-commerce]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Forms]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Usability]]></category>

		<guid isPermaLink="false">http://nicolasschudel.name/?p=23</guid>
		<description><![CDATA[<p>Having to create an account is a barrier for new users to join a site and should, therefore, be kept as easy as possible. I propose a user interface improvement that pre-fills the user’s city based on the entered postal code. In addition, I describe the programming process using PHP, MySQL and AJAX.</p>]]></description>
			<content:encoded><![CDATA[<img src="http://nicolasschudel.name/fileadmin/articles//2008/02/signup-forms.png" alt="Signup Forms" title="Signup Forms" width="180" height="180" class="alignleft size-full wp-image-334" />
<p>
I watched a <a href="http://www.youtube.com/watch?v=J00ehBG0VNg">useful presentation about form design</a> by Ryan Singer a while back and he makes a point that user input should be kept to the bare minimum when signing up. An article by Luke Wroblewski titled <a href="http://www.alistapart.com/articles/signupforms">Sign Up Forms Must Die</a> seconds the notion.
</p>
<p>
However, sometimes it is required for the user to do the leg-work and fill in lots information. Like registering at an online store for instance. Gotta at least know where to send the purchased goods! For users that don't have auto-fill plugins such as the <a href="http://toolbar.google.com/)">Google Toolbar</a>, Javascript can help filling in the necessary information - not just validating the user input. It would, for instance, make web forms simpler for users if their city would be filled in automatically upon entering their postcode. I timed myself typing my city of residence as quickly as possible and it took me about 3 seconds. So, all in theory of course, the improvement would skim roughly that much time off filling in a form. It's not a lot, but the users level of tolerance towards HTML forms isn't much either.
</p>
<p>
I'm now going to talk about how I “auto-fill” the city information based on the entered postcode in a HTML form using PHP, MySql and Javascript.
</p>
<h2>Setting Up the Database</h2>
<p>
First I needed to get the postcode information from somewhere. For Switzerland I found <a href="https://match.postmail.ch/">the data</a> via the Swiss Post.
</p>
<p>
Then I needed to get it into the database somehow. To do this I imported the downloaded text file (it is tab delimited) into Excel and then exported it again as a <abbr title="comma-separated values file format">CSV</abbr> file. I only imported the columns I needed which are the ones containing the Town name and the postcode.
</p>
<p>
Next I put on my white programming gloves and wrote a quick PHP script that connects to the database and runs two <abbr title="Structured Query Language">SQL</abbr> statements to import the <abbr title="comma-separated values file format">CSV</abbr> file. Change the variables to fit your setup and be sure to have the <abbr title="comma-separated values file format">CSV</abbr> file in the same folder when you run the following example.
</p>
<pre class="brush: php">
$link = mysql_connect('localhost', 'root', 'root') or die('Could not connect: ' . mysql_error());

mysql_query(&amp;amp;quot;CREATE DATABASE IF NOT EXISTS test
DEFAULT CHARACTER SET latin1 
COLLATE latin1_swedish_ci;&amp;amp;quot;
);

mysql_select_db('test') or die('Cannot select database');

mysql_query( &amp;amp;quot;CREATE TABLE postcodes (
code SMALLINT(4) NOT NULL ,
city VARCHAR(27) NOT NULL ,
PRIMARY KEY (code)
) ENGINE = MYISAM CHARACTER SET latin1 COLLATE latin1_swedish_ci&amp;amp;quot;
);

mysql_query( &amp;amp;quot;LOAD DATA LOCAL INFILE 'postcodes.csv'
INTO TABLE postcodes
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\r\n'
(code, city);&amp;amp;quot;
);

if(mysql_error()) echo mysql_error();
else echo &amp;amp;quot;Done!&amp;amp;quot;;

mysql_close($link);
</pre>
<p>
Special characters where also an issue with importing and exporting so be sure to check the city names in the database. I used the windows text format for importing.
</p>
<h2>Creating a Web Service</h2>
<p>
We now need some server side code to provide us with the data from the database. I am using the insanely cool <abbr title="JavaScript Object Notation">JSON</abbr> gateway included with <a href="http://www.amfphp.org/">AMFPHP</a> to provide the client with data. So with AMFPHP set up I could just write a simple PosteCodeFinder class and plop it into the AMFPHP's services folder. Otherwise a simple way to get the correct name would be a PHP script like this:
</p>
<pre class="brush: php">
mysql_connect('localhost', 'root', 'root') or die('Could not connect: ' . mysql_error());
mysql_select_db('zencart_shop') or die('Cannot select database');

if (isset($_GET['code']) &amp;amp;amp;&amp;amp;amp; is_numeric($_GET['code'])) $code= $_GET['code'];
else die ('Only numbers please! The URL should look something like: postcodefinder.php?code=1000');

$query = &amp;amp;quot;SELECT city FROM postcodes WHERE code =&amp;amp;quot; . $code . &amp;amp;quot; LIMIT 0 , 1 &amp;amp;quot;;

header(&amp;amp;quot;Content-Type: text/javascript; charset=utf-8&amp;amp;quot;);
echo json_encode(utf8_encode(mysql_result(mysql_query($query), &amp;amp;quot;city&amp;amp;quot;)));
</pre>
<p>
The code connects to the database, checks the input to be numeric, retrieves the city name and spits it out as <abbr title="JavaScript Object Notation">JSON</abbr>.
</p>
<p>
I had to use utf8_encode() inside the json_encode() function because it would otherwise mess up my character encoding. "Genéve", for instance, would be truncated to "Gen". It was reported as <a href="http://bugs.php.net/bug.php?id=43941">PHP bug #43941</a>.
</p>
<h2>The Client-Side Code</h2>
<p>
On to the Javascript! I am using the Prototype library here to make programming AJAX bearable.
</p>
<pre class="brush: jscript">
FormController = {
	previousResponse: &quot;&quot;,
	
	postcodeHandler:function(el) {
		var code = parseInt(el.value);
		if (code &gt;= 1000 &amp;&amp; code &lt;= 9999 &amp;&amp; $F('country') == 204) 
	  	new Ajax.Request(
			&quot;json.php/PostCodeFinder.find/&quot; + code, 
			{
	  		method: &quot;get&quot;,
	  		onSuccess: FormController.updatePostCode.bindAsEventListener(this)
	  		}
		);
	},
	
	updatePostCode:function(transport) {
		var jsonObj = eval(&quot;(&quot; + transport.responseText + &quot;)&quot;);
		if (jsonObj != undefined &amp;&amp; ($F('city') == &quot;&quot; || $F('city') == previousResponse)) {
	   	$('city').value = jsonObj;
			this.previousResponse = jsonObj;
	   }
	}
}

Event.observe(
	window,
	'load',
	function() {
		new Form.Element.Observer('postcode', 1, FormController.postcodeHandler.bindAsEventListener(this));
	}
)
</pre>
<p>
<a href="/fileadmin/postcodefinder.zip">Download all the code here.</a>
</p>
<h2>Conclusions</h2>
<h3>Usability Gain</h3>
<p>
Considering the amount of time it took me to implement, I can only recommend the postcode optimization as a final improvement to a form.   Other factors, as mentioned in Singer's video for instance, should be considered first to get the most bang for the buck.
</p>
<h3>Character Encoding</h3>
<p>
Most of my time was not spent with programming the scripts but with playing with the character encoding. Having UTF-8 all the way through form the original text file, to the database, to the PHP script, to the client side Javascript and finally the HTML document itself was easier said than done. I found a <a href="http://www.kerstner.at/downloads/utf8_webapplications_v0.2.pdf">PDF on the UTF-8 development practices</a> by Matthias Kerstener, that helped out with some of the issues. Still, character encoding issues makes me not want to be a web developer any more.
</p>]]></content:encoded>
			<wfw:commentRss>http://nicolasschudel.name/making-sign-up-forms-that-much-easier/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
