<?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>noCreativity.com &#187; JavaScript</title>
	<atom:link href="http://nocreativity.com/blog/tag/javascript/feed" rel="self" type="application/rss+xml" />
	<link>http://nocreativity.com</link>
	<description>The life and discoveries of a new media artist</description>
	<lastBuildDate>Sat, 07 Jan 2012 17:03:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>The world&#8217;s most pointless argument</title>
		<link>http://nocreativity.com/blog/the-worlds-most-pointless-argument</link>
		<comments>http://nocreativity.com/blog/the-worlds-most-pointless-argument#comments</comments>
		<pubDate>Tue, 01 Nov 2011 06:19:49 +0000</pubDate>
		<dc:creator>Ronny</dc:creator>
				<category><![CDATA[Everything else]]></category>
		<category><![CDATA[fibonacci]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[NodeJS]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://nocreativity.com/?p=1920</guid>
		<description><![CDATA[I get very annoyed when people make a valid point using unappropriate examples. This one is about NodeJS. It haunted me for weeks now and I had to get it out of my system. The fibonacci example was wrong and here's why.]]></description>
			<content:encoded><![CDATA[<p>If you read this, you undoubtably have seen <a href="http://teddziuba.com/2011/10/node-js-is-cancer.html" target="_blank" target="_blank">this post</a> stating that NodeJS is cancer. Quite honestly: I couldn&#8217;t care less about the argument at hand: I use NodeJS for personal projects and it&#8217;s big fun. I got it up and running easily and I have been creating stuff with it ever since. I&#8217;m mostly building realtime multi-user applications that rely on socket communication. That should tell you just about enough about the fact that I have little expertise with NodeJS.</p>
<p>However, that post by Ted Dziuba had me wondering. Is he right? Probably. He seems like a very smart man and considers many things I didn&#8217;t even think off. However, that fibonacci example had me confused. Why did that call take so long. Many days have passed since the original post and I never spent more than a few seconds wondering.</p>
<p>Until tonight. I was wondering what the general consensus was about NodeJS and came across a number of posts referring to Ted&#8217;s writing. <a href="http://joshuakehn.com/2011/10/3/Diagnosis-No-Cancer.html" target="_blank" target="_blank">This one in particular</a> had me taken in. Here, Joshua Kehn takes the analog of the given fibonacci example and translates it to a few other programming languages. The result? Every other language shows this massive waiting behavior. After reading this I had to find out: WHAT IS GOING ON!?</p>
<p>How can figuring out the 40th number of the fibonacci sequence take several seconds!? So I wrote a quick test in Javascript (read: I copy-pasted Ted&#8217;s code) and ran it in the browser.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> fibo1<span style="color: #009900;">&#40;</span>n<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>n <span style="color: #339933;">&lt;</span> <span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>	
	<span style="color: #009900;">&#125;</span>	
	<span style="color: #000066; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">return</span> fibo1<span style="color: #009900;">&#40;</span>n<span style="color: #339933;">-</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> fibo1<span style="color: #009900;">&#40;</span>n<span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #003366; font-weight: bold;">var</span> result <span style="color: #339933;">=</span> fibo1<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">40</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Result : '</span> <span style="color: #339933;">+</span> result<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><em>3.08 seconds. Holy shit&#8230; </em>At this point I was hooked. How!? Why!? This looks like reasonable code&#8230; Let the computer calculate what needs to be calculated and return the result as soon as possible, right&#8230; Can&#8217;t be more than about 50-60 function calls&#8230; I took the liberty to count the number of function calls&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> fcalls<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">function</span> fibo1<span style="color: #009900;">&#40;</span>n<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	fcalls<span style="color: #339933;">++;</span>
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>n <span style="color: #339933;">&lt;</span> <span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>	
	<span style="color: #009900;">&#125;</span>	
	<span style="color: #000066; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">return</span> fibo1<span style="color: #009900;">&#40;</span>n<span style="color: #339933;">-</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> fibo1<span style="color: #009900;">&#40;</span>n<span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #003366; font-weight: bold;">var</span> result <span style="color: #339933;">=</span> fibo1<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">40</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Result : '</span> <span style="color: #339933;">+</span> result <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&amp;lt;br/&amp;gt;Function calls: '</span> <span style="color: #339933;">+</span> fcalls<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>331 160 281 function calls!? That&#8217;s 331 million function calls. Are you freakin&#8217; kidding me!? For the 40th number in the fibonacci sequence. WHAT THE HELL!?</p>
<p>At this point I was doubting my own skills in writing a valid step counter in Javascript before actually believing that this many function calls were actually being executed. However that would explain the 3 second delay&#8230; Wait, what!? <em>3 seconds?</em> To execute a <em>mindblowing</em> 331 million function calls? (It is worth noting that Sheldon Cooper was wrong: <em>Once your mind is blown, it <span style="text-decoration: underline;">can</span> be re-blown.</em>)</p>
<p>But&#8230; Joshua correctly stated a mistake by Ted, which is that Ted&#8217;s fibonacci algorithm is incorrect. Let&#8217;s fix that&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> fcalls<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">function</span> fibo1<span style="color: #009900;">&#40;</span>n<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	fcalls<span style="color: #339933;">++;</span>
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>n <span style="color: #339933;">&lt;</span> <span style="color: #339933;">=</span> <span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>	
	<span style="color: #009900;">&#125;</span>	
	<span style="color: #000066; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">return</span> fibo1<span style="color: #009900;">&#40;</span>n<span style="color: #339933;">-</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> fibo1<span style="color: #009900;">&#40;</span>n<span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #003366; font-weight: bold;">var</span> result <span style="color: #339933;">=</span> fibo1<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">40</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Result : '</span> <span style="color: #339933;">+</span> result <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&amp;lt;br/&amp;gt;Function calls: '</span> <span style="color: #339933;">+</span> fcalls<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Hey! Look at that! <em>Only</em> 204 668 309 function calls! That&#8217;s a solid 130 million calls less. The execution time dropped by a second too! Only 2.1 second execution&#8230; Still: That&#8217;s a long time and that is still an INSANE amount of calls.</p>
<p>At this point I decided I was done with this crap. This implementation sucks royal rastaballs. Whoever thought the above was clever programming needs to stay off the drugs and reconsider his carreer choices.<br />
I remember writing fibonacci generators in high school, almost 10 years ago, and they didn&#8217;t take long. In fact: They were instantanious. Tell you what: I&#8217;ll just try it the old fashioned way&#8230; The human way.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> fibo2<span style="color: #009900;">&#40;</span>n<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> current <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> previous1 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> previous2 <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>i <span style="color: #339933;">&lt;</span> n<span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>	
		<span style="color: #006600; font-style: italic;">//previous 1 + previous2 = current</span>
		previous1 <span style="color: #339933;">=</span> previous2<span style="color: #339933;">;</span>				
		previous2 <span style="color: #339933;">=</span> current<span style="color: #339933;">;</span>
		current	 <span style="color: #339933;">=</span> previous1 <span style="color: #339933;">+</span> previous2<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">return</span> current<span style="color: #339933;">;</span>	
<span style="color: #009900;">&#125;</span>
<span style="color: #003366; font-weight: bold;">var</span> result <span style="color: #339933;">=</span> fibo2<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">40</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Result : '</span> <span style="color: #339933;">+</span> result<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Hey, look at that! <span style="text-decoration: line-through;">Almost</span> no execution time! The result was there like *snap* that. In fact Javascript tells me it took between 0.000 and 0.001 seconds&#8230;  And the fibonacci result is the same&#8230; What does that tell us?</p>
<p>Well, of course: The fibonacci example was a demonstration that NodeJS will in fact block. But how is that different from any other language. In fact, the only thing proven here is that NodeJS (actually the V8 Javascript engine) computes fairly quickly compared to PHP for example.</p>
<p>What I&#8217;d like to add here is that OF COURSE by writing BULLSHIT code, you can make any runtime block, stumble, freeze and turn to complete utter bollocks. What the fuck is the matter with you? If this is your argument, then frankly you should&#8217;ve kept it to yourself because the rest of the world already knows this.</p>
<p>This doesn&#8217;t only apply for NodeJS, it applies to ANY PROGRAMMING LANGUAGE: Writing crappy code will return crappy performance. This is nothing new: It&#8217;s common sense. Programming is a mental challenge and it will always stay that way. If you try to prove something by pointing out that bad programming results in bad performance, then perhaps you should reconsider the usage of the word &#8216;<em>braindead</em>&#8216; in some more appropriate context.</p>
<p>I&#8217;m sorry but the fibonacci example in Ted&#8217;s post is a &#8216;bad example&#8217; to prove a valid point. Yes, NodeJS will in fact block. However the example seemed more like an example of how bad code can provoke bad performance. That&#8217;s not an argument. That&#8217;s a fact.<br />
By writing <del>good</del> better code, I fixed the example and it runs fine now. And yet that doesn&#8217;t invalidate Ted&#8217;s point about blocking. (See why this is a pointless argument?)</p>
<p>I just wanted to have this out in the open. Made me nuts when I figured this out. And I still maintain I have no opinion about NodeJS and how bad it might be.</p>
<p>You can see a testpage with the different calculations <a href="http://labs.nocreativity.com/fibo" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nocreativity.com/blog/the-worlds-most-pointless-argument/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash vs HTML? What is wrong with you people??</title>
		<link>http://nocreativity.com/blog/flash-vs-html-what-is-wrong-with-you-people</link>
		<comments>http://nocreativity.com/blog/flash-vs-html-what-is-wrong-with-you-people#comments</comments>
		<pubDate>Thu, 04 Jun 2009 10:00:07 +0000</pubDate>
		<dc:creator>Ronny</dc:creator>
				<category><![CDATA[Everything else]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Browser]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[debate]]></category>
		<category><![CDATA[Flash Player]]></category>
		<category><![CDATA[Flash vs HTML]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JS]]></category>
		<category><![CDATA[Open-source]]></category>
		<category><![CDATA[SWF]]></category>
		<category><![CDATA[W3C]]></category>
		<category><![CDATA[Web standards]]></category>

		<guid isPermaLink="false">http://nocreativity.com/blog/?p=500</guid>
		<description><![CDATA[And I&#8217;m dead serious. Let me start by saying that I am a passionate Actionscript Creative (if someday I might grow up, you can call me a Flash developer but not just yet) and I absolute love the web as it exists today. I love HTML and CSS. I even like Javascript (a bit) (it&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>And I&#8217;m dead serious.</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-509" title="One can't live without the other" src="http://nocreativity.com/blog-engine/wp-content/uploads/2009/05/flashvshtml.jpg" alt="One can't live without the other" width="525" height="233" /></p>
<p>Let me start by saying that I am a passionate Actionscript Creative (if someday I might grow up, you can call me a <em>Flash developer</em> but not just yet) and I absolute love the web as it exists today. I love HTML and CSS. I even like Javascript (a bit) (it&#8217;s not my favorite, but we get along pretty good). So don&#8217;t go off thinking I&#8217;m taking sides.</p>
<h4><strong>What are we talking about today?</strong></h4>
<p>Earlier this week, <a href="http://www.webkitchen.be/" target="_blank" target="_blank">Serge Jespers</a> wrote about <a href="http://www.webkitchen.be/2009/05/27/adobe-versus-the-open-web/" target="_blank" target="_blank"><em>Adobe vs the open web</em></a>, which kinda looked like a <em>Flash vs HTML5</em> article from a distance (because let&#8217;s face it: The <a href="http://adobe.com" target="_blank" target="_blank">Adobe</a> platform on the web is mainly <a href="http://nocreativity.com/blog-engine/wp-content/uploads/2009/05/picture-1366.jpg" target="_blank">the Flash platform</a>). I had a lot of conversations about that in the past and the one thing I have come to conclude is that you can&#8217;t actually compare those to each other.<br />
Not even remotely.</p>
<h4><strong>So to what should we compare it then?</strong></h4>
<p>People keep referring to the features that the Flash Player offers and which the developer <em>might</em> want to use. And then their statement goes on with &#8216;<em>You can&#8217;t do that with HTML!</em>&#8216;<br />
Of course you can&#8217;t! There are thousands of things you can do with Flash, which you just can&#8217;t pull of with HTML, CSS or Javascript. But if you really want to compare Flash and HTML, you gotta do it right:</p>
<p style="padding-left: 30px;"><em><strong>Flash Player</strong> vs FireFox ( or IE or Safari or Opera or <strong>any</strong> other <strong>browser</strong>)<br />
<strong>Timeline and Actionscript</strong> vs <strong>HTML and Javascript</strong> (and <strong>CSS</strong> if you really want)</em></p>
<p>(Please, stop throwing those vegetables at me&#8230; Thank you.)<span id="more-500"></span></p>
<h3>Comparing the Comparables</h3>
<p>So now you&#8217;re looking at me, thinking I am completely nuts&#8230; So let me clarify&#8230;</p>
<h4><strong>The Web Browser</strong></h4>
<p><strong> </strong>A piece of software that allows you to browse the web and renders HTML and CSS into a beautiful layout (depending on the website that is) for your viewing pleasure.</p>
<h4><strong>The Flash Player</strong></h4>
<p>A browser plugin that allows you to view .SWF files and render them as described in the bytecode (or wherever) into a vector based movie.</p>
<p>This is a very brief description, and despite that I think you could already conclude their first difference (and what they got in common).<br />
<strong>Both the Flash Player and the browser are built to display content, and render that content using a specific set of rules. </strong>They are both the same on a different level.<strong><br />
</strong></p>
<h4><strong>W3C and &#8216;Web standards&#8217;</strong></h4>
<p>I really like how &#8216;<a href="http://en.wikipedia.org/wiki/Web_standards" target="_blank" target="_blank">Web standards</a>&#8216; is such an often used term (which sounds so professional and simple at the same time), and yet I am unable to describe exactly what it means (even after reading the Wikipedia explanation, I understand but don&#8217;t quite know it&#8230;). But I bet you, you already know where I&#8217;m heading&#8230; Exactly. There are <em><a href="http://www.w3.org/" target="_blank" target="_blank">rules</a> </em>being written, just to make sure everybody is writing valid code, and every browser displays it the same. Silly to say: <strong>Not everyone</strong> is writing valid code and nearly <strong>no browser displays exactly the same</strong>. I&#8217;m not bashing the W3C people here (although this might really look like it). In fact, I admire them for their effort. But in spite of that: The problem is there. Everybody is building browsers; websites look different on each and every one of them &#8211; even if the HTML/CSS you wrote is 100% valid.</p>
<h4><strong>Adobe and the Flash Player<br />
</strong></h4>
<p>Adobe is (mainly) the only instance developing, evolving, releasing and publishing the Flash Player (mobile devices and such left out). A lot of people think that this is a bad thing. <em>Only one company in charge of whatever is going to happen with our beloved browser plugin?</em> Hell yea!!<br />
I can see how open-sourcing the Flash Player might help evolving the capabilities (features AND efficiency) but the payoff would be &#8216;Crossplayer compatibility issues&#8217;.<br />
Imagine how you would publish your SWF, upload it to the server, and then test it in different Flash Players. (This is actually where my previous point of &#8216;Browser vs Player&#8217; should start making sense)</p>
<p>So there&#8217;s our second conclusion. Browsers can be built and released by about anybody whereas the Flash Player is developed and maintained only by Adobe. Both do have ground rules to which you better stick when creating content but seen as only 1 company is creating the Flash Player and a lot of people are creating browsers, the browser implementation of those rules differs and results (may) vary. (Flash content which is not perfectly &#8216;valid&#8217; will just result in a &#8216;movie not loaded&#8217; message&#8230;)</p>
<h3>Soooo&#8230;</h3>
<p>Comparing &#8216;Flash&#8217; to &#8216;HTML&#8217; is wrong. The Flash Player is more like a browser, but on a different level (it runs as a plugin inside the browser). Comparing them is just plain senseless.</p>
<h3>Okay&#8230; Still&#8230; SWF kicks HTML&#8217;s ass!</h3>
<p>That&#8217;s a plausible one&#8230; but I don&#8217;t know any self-respecting webdeveloper that would agree (same goes for the opposite). If you&#8217;re on the same page as I am you&#8217;ll agree that it&#8217;s a situation depended statement.</p>
<p>If you want to build a game, Flash is the right choice.<br />
If you want to create an experience to promote your latest product, Flash <em>might</em> be the right choice.<br />
If you want to build a message board, Flash is undoubtedly the wrong choice.</p>
<h4><strong>Back to basics</strong></h4>
<p>In it&#8217;s early years Flash was meant to be used as &#8216;animated vector graphic&#8217;. For the sake of simplicity let&#8217;s just say: &#8216;the enhanced version of an image&#8217;. Of course today the capabilities and the use-cases of Flash have long exceeded this basic idea.</p>
<p>But doesn&#8217;t it feel strange to deliver information using a technology that was meant to be used as an &#8216;entertaining addition&#8217;?<br />
Google doesn&#8217;t present its search results using an image or a Flash movie, right?<br />
I can hear you go &#8220;<em>Yea duh! That&#8217;s because Flash isn&#8217;t intended to be used for that kind of application</em>&#8220;. Exactly&#8230;</p>
<h4><strong>&#8216;The problem is choice&#8217;</strong></h4>
<p style="text-align: center;"><strong><img class="size-full wp-image-506 aligncenter" title="Taking the red pill" src="http://nocreativity.com/blog-engine/wp-content/uploads/2009/05/red-pill-or-blue-pill.jpg" alt="Taking the red pill" width="500" height="205" /><br />
</strong></p>
<p>It&#8217;s not about what you like most&#8230; It&#8217;s not about what is &#8216;the best&#8217;. It&#8217;s about what is &#8216;better in this case&#8217;. Right now, if somebody asks you to put a video on their HTML site, you&#8217;ll use a Flash Videoplayer (because right now Flash is the best choice to deliver video on the web: Everybody (<a href="http://www.adobe.com/products/player_census/flashplayer/" target="_blank" target="_blank">about 99%, Adobe</a>?) has a Flash Player installed, no (additional) codecs are needed, and not everyone is able to view HTML5 in their browser yet). That&#8217;s a no-brainer. You could go for Windows Media/Quicktime plugins but Flash would be the <em>better choice in this case</em>.</p>
<p>But if people are being asked to build a datadriven application, they&#8217;ll have a different idea about what to use. Some keep it simple and stick to basic HTML tables. Some others go nuts using jQuery and other Javascript libraries to enhance the dataviewing experience and useability of those tables. Others push it even further and choose a Flex based solution. All 3 of them will get the job done, that&#8217;s for sure, but what is the <em>better choice in this case</em> ? (Personally I&#8217;d go with the jQuery enhanced version)</p>
<p>The use of Flash or HTML each come with their own pro&#8217;s and con&#8217;s. And this is where people start arguing&#8230;</p>
<h3>Pro&#8217;s and Con&#8217;s</h3>
<blockquote><p>Google can&#8217;t index Flash sites</p></blockquote>
<div class="wp-caption alignright" style="width: 250px"><a href="http://www.flickr.com/photos/ari/1151236941/" target="_blank"><img src="http://farm2.static.flickr.com/1086/1151236941_e9730fdda5_m.jpg" alt="Bad implementation of Alternate Content" width="240" height="123" /></a><p class="wp-caption-text">Bad implementation of &#39;Alternate Content&#39;</p></div>
<p>That&#8217;s true, although they&#8217;re working on it, it&#8217;s for from being ready (Google apparently has a special Flash Player that indexes Flash Movies. The only thing I can say about that: I don&#8217;t know about any of my previous Flash sites being indexed by Google yet&#8230;) . You could make use of the alternate content feature when embedding your Flash movie in the website. That way Google can actually index the content of the website, and bring the user to your website (where he/she can then view the Flash based version). But you have to implement the alternate content. And: No. &#8216;<em>You need Adobe Flash Player to view this site</em>&#8216; is no alternate content (read: Bad Alternate Content). And talking about alternate content: I haven&#8217;t seen many Flash sites being built to be able to &#8216;<a href="http://en.wikipedia.org/wiki/Fault-tolerant_system" target="_blank" target="_blank">gracefully degrade</a>&#8216;. What if you users just don&#8217;t have the requested Flash version (company computer networks often disallow installation of new software). How do you enable them to use your website/webapplication? Right: <a href="http://en.wikipedia.org/wiki/Progressive_enhancement" target="_blank" target="_blank">Progressive enhancement</a>. But building a Flash website, and not providing decent alternate content (read: alternate HTML/JS version of the Flash application) is not it!</p>
<blockquote><p>People with accessibility issues can&#8217;t rely on screenreaders and such on a Flash based website.</p></blockquote>
<p>As far as I know, today it is possible to help screenreaders understand what Flash is doing, and what the user can do. However: You have to implement this in your website.</p>
<blockquote><p>You can now manage the browser history in a Flash site</p></blockquote>
<p>Sure, and by all means: SWFAddress is great! But you have to manage it and that&#8217;s where it boils down to: It&#8217;s standard browser behaviour! You shouldn&#8217;t have to manage that.</p>
<p>Let&#8217;s face it: Flash <em>breaks</em> the regular web. So choosing Flash <em>because it&#8217;s prettier</em> isn&#8217;t the right choice. Choosing Flash should <strong>ALWAYS</strong> be a result of weighing the pro&#8217;s and con&#8217;s; not a result of you (or your client) liking Flash sites <em>better</em> than standard HTML sites&#8230;</p>
<h3>Grand conclusion</h3>
<p>(I&#8217;ll start this one with a disclaimer. Unlike Serge Jespers, I&#8217;m not paid by Adobe so this is really my opinion and not the one of my employee <img src='http://nocreativity.com/blog-engine/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' />  )</p>
<p>For now (and even for the HTML5-era): Flash will always offer a bigger and probably faster featureset than HTML (video, audio, audio analyzing, drawing, shape morphing, complex animations, special effects, levels of interaction perharps, etc&#8230;) but as long as you don&#8217;t really have to rely on Flash&#8217;s special features, stick to plain old HTML and CSS.</p>
<p>Flash and HTML are no opponents. They should be seen as couple that complement each other. Both should be used for what they&#8217;re best at. There is no winner, there&#8217;s no best. There&#8217;s only &#8216;<em>better in this case</em>&#8216;.</p>
]]></content:encoded>
			<wfw:commentRss>http://nocreativity.com/blog/flash-vs-html-what-is-wrong-with-you-people/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>AJAXed websites done right</title>
		<link>http://nocreativity.com/blog/ajaxed-websites-done-right</link>
		<comments>http://nocreativity.com/blog/ajaxed-websites-done-right#comments</comments>
		<pubDate>Sat, 18 Oct 2008 00:13:38 +0000</pubDate>
		<dc:creator>Ronny</dc:creator>
				<category><![CDATA[Everything else]]></category>
		<category><![CDATA[Open-source]]></category>
		<category><![CDATA[byDust]]></category>
		<category><![CDATA[com.bydust.ajax]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Nick Van der Vreken]]></category>

		<guid isPermaLink="false">http://nocreativity.com/blog/?p=170</guid>
		<description><![CDATA[Mijn beste maat, Nick, heeft zonet een van zijn coolste Javascript projecten online gepost. Het gaat om zijn Javascript class die het toelaat om een standaard (werkende) HTML site on-the-fly om te bouwen naar een full-option AJAX site. Het idee was ooit ontstaan bij gesprekken over Flash-sites, AJAX-sites, Google-vriendelijke sites, en de snelst mogelijke en [...]]]></description>
			<content:encoded><![CDATA[<p>Mijn beste maat, <a href="http://bydust.com" target="_blank" target="_blank">Nick</a>, heeft zonet een van zijn coolste Javascript projecten online gepost. Het gaat om zijn Javascript class die het toelaat om een standaard (werkende) HTML site on-the-fly om te bouwen naar een full-option AJAX site.</p>
<p><a href="http://www.bydust.com/examples/com.bydust.ajax/" target="_blank"><img class="aligncenter size-full wp-image-171" title="afbeelding-559" src="http://nocreativity.com/blog-engine/wp-content/uploads/2008/10/afbeelding-559.jpg" alt="" width="499" height="105" /></a></p>
<p>Het idee was ooit ontstaan bij gesprekken over Flash-sites, AJAX-sites, Google-vriendelijke sites, en de snelst mogelijke en goedkoopste oplossing om deze RIA-oplossingen zo dicht mogelijk bij elkaar te brengen. Nick had de smaak te pakken en is er enkele maanden geleden in zijn vrije tijd aan begonnen. Gelukkig is hij koppig genoeg, zodat hij een paar weken geleden met een brede smile op zijn gezicht liet zijn hoe het ermee stond&#8230; Ik keek ernaar&#8230; Ik was onder de indruk&#8230;<span id="more-170"></span></p>
<p>Onlangs ging hij live met zijn nieuwe portfolio waarop je de Javascript class al in volle actie kan zien.</p>
<p>Enkele features:</p>
<ul>
<li>1 site bouwen: geen extra XML, geen bijkomende PHP functionaliteit, niets. Elke HTML site kan een AJAX site worden in enkele simpele stappen.</li>
<li>Het is simpel.</li>
<li>De site wordt niet destructief bewerkt door het AJAX script òf de implementatie ervan. Als je browser de AJAX functionaliteit niet aan kan, surf je gewoon door de standaard HTML site, zonder te bemerken dat er in feite &#8216;meer onder de motorkap&#8217; zit.</li>
<li>Het script kan omgaan met &#8216;incorrecte&#8217; HTML. Dit wordt niet aangeraden, maar de class is robuust genoeg om dit soort fouten te hanteren.</li>
<li>Je site blijft Google vriendelijk: ondanks het feit dat je bezoekers allerhande cool shit zien gebeuren, blijft Google een standaard HTML site zien, die goed kan geïndexeerd worden.</li>
<li>Deeplinking: gezien Google je site kan indexeren, kan je content van je site dus ook volwaardig naar voor komen in de zoekresultaten. Deze zoekresultaten zullen je naar de juiste pagina op de website brengen, vanwaar het AJAX script jou weer met eye-candy kan bedienen.</li>
<li>Crossbrowser: Internet Explorer, Firefox, Safari, Opera. Zelfs op de iPhone kan de website inclusieve AJAX features ten volle naar voor komen.</li>
<li>Error-handling en browser selection: Als er fouten gebeuren probeert de class dit zelf op te lossen. Hetzij door correctie, hetzij disablen van de class zelf, en de gebruiker zonder AJAX features verder laten surfen. Als de browser geen AJAX ondersteund schakelt de class zichzelf uit.</li>
<li>Animaties: Niets is leuker dan bewegende onderdelen om de gebruiker te laten weten dat de site verstaan heeft wat er gevraagd werd. De class preload de afbeeldingen en maakt vloeiende transities van één pagina naar de andere.</li>
</ul>
<p>En dit zijn er slechts een paar. Er zijn nog heel wat features. Meer hierover op <a href="http://www.bydust.com/ajaxed-website-automatically-convert-to-ajax-website-combydustajax/" target="_blank" target="_blank">Nick&#8217;s blog</a>.</p>
<p><strong>Voorbeeld</strong>: <a href="http://bydust.com" target="_blank" target="_blank">byDust.com</a><strong><br />
Documentatie</strong>: <a href="http://www.bydust.com/examples/com.bydust.ajax/" target="_blank" target="_blank">byDust.com</a></p>
<p>Ik ben erg onder de indruk, en zal deze class binnenkort zelf inbouwen in mijn eigen site.<br />
Lees er meer over op <a href="http://www.bydust.com/ajaxed-website-automatically-convert-to-ajax-website-combydustajax/" target="_blank" target="_blank">Nick&#8217;s blog</a> (Engels).</p>
]]></content:encoded>
			<wfw:commentRss>http://nocreativity.com/blog/ajaxed-websites-done-right/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Tutorial: Transparante Flash en HTML</title>
		<link>http://nocreativity.com/blog/tutorial-transparante-flash-html</link>
		<comments>http://nocreativity.com/blog/tutorial-transparante-flash-html#comments</comments>
		<pubDate>Wed, 26 Sep 2007 15:22:11 +0000</pubDate>
		<dc:creator>Ronny</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Eolas]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[SWFObject]]></category>
		<category><![CDATA[Transparant]]></category>

		<guid isPermaLink="false">http://nocreativity.com/blog/tutorial-transparante-flash-html</guid>
		<description><![CDATA[Naar aanleiding van heel wat hits op mijn site, en enkele emails om uit te leggen hoe ik het transparante pixel-teken effect op mijn portfolio-site heb gemaakt, heb ik besloten om even een korte tutorial te schrijven hiervoor. Om de tut te volgen heb je alleen een text-editor nodig (Notepad is al genoeg. Ik gebruik [...]]]></description>
			<content:encoded><![CDATA[<p>Naar aanleiding van heel wat hits op mijn site, en enkele emails om uit te leggen hoe ik het transparante pixel-teken effect op mijn <a href="http://www.nocreativity.com"title="Persoonlijk Portfolio van Ronny Welter"  target="_blank">portfolio-site</a> heb gemaakt, heb ik besloten om even een korte tutorial te schrijven hiervoor.</p>
<p>Om de tut te volgen heb je alleen een text-editor nodig (Notepad is al genoeg. Ik gebruik Dreamweaver <img src='http://nocreativity.com/blog-engine/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> ). Een Flashmovie kun je tijdens de tutorial zelf downloaden.</p>
<p>Basis kennis van HTML en &#8216;weten wat de Canvas in Flash is&#8217; is vereist. <img src='http://nocreativity.com/blog-engine/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><span id="more-40"></span></p>
<p><strong>Tutorial:</strong></p>
<p>We willen een Flashobject in een HTML pagina laten weergeven, en de onderliggende HTML gebruiken, om het achtergrond kleur te bepalen van het geheel.</p>
<blockquote><p>Maak een nieuw html document aan en sla het op als &#8216;index.htm&#8217; .</p></blockquote>
<p>We willen nu kunnen bepalen waar we onze Flash willen laten weergeven. Hiervoor maken we een DIV object aan in HTML waar we later onze Flashmovie inladen.</p>
<blockquote><p>Voeg dit toe aan de BODY in je HTML:</p></blockquote>
<p>[html4strict]&lt;div id=&#8221;flashDIV&#8221; style=&#8221;width:500px; height:400px; margin-left:-250px; margin-top:-200px;position:absolute;top:50%;left:50%; background-color:#FF0066;&#8221;&gt;<br />
Download de Adobe Flash Player om de FlashMovie te zien!<br />
&lt;/div&gt;[/html4strict]</p>
<p>In bovenstaande regel zie je meteen ook wat CSS staan. Dat is mijn manier van werken als ik iets wil centreren in het browservenster. Meteen ook een achtergrondkleur ingesteld oor deze DIV. <em>#FF0066 for a better world</em> <img src='http://nocreativity.com/blog-engine/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
Om verder te gaan willen we nu (op een verantwoorde wijze) Flash in deze DIV gaan laden.<br />
Mensen die Microsoft Internet Explorer 6 of Windows Internet Explorer 7 gebruiken zijn ongetwijfeld al op websites gestoten waar men eerst op een Flashobject moest klikken om het te activeren. Dit is een kwestie waar men veel naar verwijst als &#8216;<a href="http://en.wikipedia.org/wiki/EOLAS"title="Meer info rond de Microsoft - Eolas kwestie"  target="_blank">Het Eolas Patent</a>&#8216;. Het gebeuren rond Microsoft en Eolas had als gevolg dat alle &#8216;<a href="http://en.wikipedia.org/wiki/ActiveX"title="Meer info over ActiveX"  target="_blank">ActiveX objecten</a>&#8216;  in de Microsoft browsers eerst moesten geactiveerd worden. Dit valt op te lossen door <a href="http://blog.deconcept.com/swfobject/"title="SWFobject (door Deconcept)"  target="_blank">SWFObject</a> of andere JavaScript oplossingen te gebruiken. Het fijne hieraan is dat we meteen ook verantwoorde markup in onze broncode hebben.</p>
<blockquote><p>Download <a href="http://blog.deconcept.com/swfobject/#download"title="Download SWFObject hier"  target="_blank">SWFObject.js</a> en zet het in dezelfde map als je index.htm bestand.</p></blockquote>
<p>Als de HTML pagina geladen wordt moet de browser weten dat we het SWFObject.js bestand willen gaan gebruiken. Dit doen we door de volgende tag <strong>in de HEAD-tag </strong>van ons HTML document te steken.</p>
<blockquote><p>De volgende regel moet in de HEAD van je HTML document.</p></blockquote>
<p>[html4strict]&lt;script type=&#8221;text/javascript&#8221; src=&#8221;swfobject.js&#8221;&gt;&lt;/script&gt;[/html4strict]</p>
<p>Nu hebben we nog een Flashobject nodig dat we in onze DIV willen laden.</p>
<blockquote><p>Download <a href="http://nocreativity.com/tutorials/transparante-flash/DodgeMovie.zip"title="Unzip dit bestand ter hoogte van je index.htm bestand" >deze Flashmovie</a> en unzip deze ter hoogte van je index.htm. Je .SWF bestand staat dan in dezelfde map als je index.htm bestand.<br />
<strong>Nota:</strong> Deze Flashmovie is <strong>niet</strong> door mij ontworpen of gemaakt. Ik eis <strong>geen </strong>rechten op.</p></blockquote>
<p>Nu brengen we onze Flash en de DIV samen, door gebruik van SWFObject.</p>
<blockquote><p>De volgende code komt <strong>onder de DIV </strong>in onze HTML.</p></blockquote>
<p>[html4strict]&lt;script type=&#8221;text/javascript&#8221;&gt;<br />
var so = new SWFObject(&#8220;dodgesquad.swf&#8221;, &#8220;flashmovie&#8221;, &#8220;500&#8243;, &#8220;400&#8243;, &#8220;8&#8243;, &#8220;#000000&#8243;,&#8221;true&#8221;);<br />
so.write(&#8220;flashDIV&#8221;);<br />
&lt;/script&gt;[/html4strict]</p>
<p>Als we dit resultaat nu in een browser bekijken zien we een FlashMovie, met 3 actieve mannetjes, maar de achtergrond is nog altijd zwart (het achtergrondkleur ingesteld in Flash). Hiervoor gaan we een extra parameter meegeven aan het SWFObject.</p>
<blockquote><p>Maak van:</p></blockquote>
<p>[html4strict]&lt;script type=&#8221;text/javascript&#8221;&gt;<br />
var so = new SWFObject(&#8220;dodgesquad.swf&#8221;, &#8220;flashmovie&#8221;, &#8220;500&#8243;, &#8220;400&#8243;, &#8220;8&#8243;, &#8220;#000000&#8243;,&#8221;true&#8221;);<br />
so.write(&#8220;flashDIV&#8221;);<br />
&lt;/script&gt;[/html4strict]</p>
<blockquote><p>het volgende:</p></blockquote>
<p>[html4strict]&lt;script type=&#8221;text/javascript&#8221;&gt;<br />
var so = new SWFObject(&#8220;dodgesquad.swf&#8221;, &#8220;flashmovie&#8221;, &#8220;500&#8243;, &#8220;400&#8243;, &#8220;8&#8243;, &#8220;#000000&#8243;,&#8221;true&#8221;);<br />
so.addParam(&#8220;wmode&#8221;,&#8221;transparent&#8221;);<br />
so.write(&#8220;flashDIV&#8221;);<br />
&lt;/script&gt;[/html4strict]</p>
<p>Als we nu naar het resultaat kijken zien we weer de 3 actieve mannetjes, maar deze keer is de achtergrond pink! Het achtergrond kleur is nu #FF0066, wat we ingesteld hebben in onze DIV.style <img src='http://nocreativity.com/blog-engine/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<blockquote><p>Dit is de volledige source code die je nu zou moeten hebben.</p></blockquote>
<p>[html4strict]&lt;!DOCTYPE html PUBLIC &#8220;-//W3C//DTD XHTML 1.0 Transitional//EN&#8221; &#8220;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;&gt;<br />
&lt;html xmlns=&#8221;http://www.w3.org/1999/xhtml&#8221;&gt;<br />
&lt;head&gt;<br />
&lt;meta http-equiv=&#8221;Content-Type&#8221; content=&#8221;text/html; charset=utf-8&#8243; /&gt;<br />
&lt;title&gt;Tutorial: Transparante Flash&lt;/title&gt;<br />
&lt;script type=&#8221;text/javascript&#8221; src=&#8221;swfobject.js&#8221;&gt;&lt;/script&gt;<br />
&lt;/head&gt;</p>
<p>&lt;body&gt;<br />
&lt;div id=&#8221;flashDIV&#8221; style=&#8221;width:500px; height:400px; margin-left:-250px; margin-top:-200px;position:absolute;top:50%;left:50%; background-color:#FF0066;&#8221;&gt;<br />
Download de Adobe Flash Player om de FlashMovie te zien!<br />
&lt;/div&gt;<br />
&lt;script type=&#8221;text/javascript&#8221;&gt;<br />
var so = new SWFObject(&#8220;dodgesquad.swf&#8221;, &#8220;flashmovie&#8221;, &#8220;500&#8243;, &#8220;400&#8243;, &#8220;8&#8243;, &#8220;#000000&#8243;,&#8221;true&#8221;);<br />
so.addParam(&#8220;wmode&#8221;,&#8221;transparent&#8221;);<br />
so.write(&#8220;flashDIV&#8221;);<br />
&lt;/script&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;[/html4strict]</p>
<p>Het resultaat kun je <a href="http://nocreativity.com/tutorials/transparante-flash/TransFlashResultaat.zip"title="Download het resultaat om zelf verder te bouwen op de bron." >hier downloaden</a> of  <a href="http://www.nocreativity.com/tutorials/transparante-flash/"title="Bekijk het resultaat hier."  target="_blank">hier bekijken</a>.</p>
<p>Ik hoop hiermee een aantal mensen mee verder te kunnen helpen. Veel succes en vooral veel plezier!</p>
]]></content:encoded>
			<wfw:commentRss>http://nocreativity.com/blog/tutorial-transparante-flash-html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

