<?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>TheHippo &#187; Programming</title>
	<atom:link href="http://blog.thehippo.de/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.thehippo.de</link>
	<description>if (i=1) throw null;</description>
	<lastBuildDate>Wed, 02 Mar 2011 18:06:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Flex: Using embedded image in HTML-Text</title>
		<link>http://blog.thehippo.de/2011/03/programming/flex-using-embedded-image-in-html-text/</link>
		<comments>http://blog.thehippo.de/2011/03/programming/flex-using-embedded-image-in-html-text/#comments</comments>
		<pubDate>Wed, 02 Mar 2011 18:05:09 +0000</pubDate>
		<dc:creator>Hippo</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[HTML Text]]></category>
		<category><![CDATA[Image]]></category>
		<category><![CDATA[mxml]]></category>
		<category><![CDATA[spark]]></category>

		<guid isPermaLink="false">http://blog.thehippo.de/?p=352</guid>
		<description><![CDATA[I am currently working on a Flash project. Because it has a lot of GUI stuff and it is always a lot of code to make some nice GUI components in pure ActionScript 3 I decided to give Flex a change. Surprisingly I really like it. It's nice and a little bit sick (for ...]]></description>
			<content:encoded><![CDATA[<p>I am currently working on a Flash project. Because it has a lot of GUI stuff and it is always a lot of code to make some nice GUI components in pure ActionScript 3 I decided to give Flex a change. Surprisingly I really like it. It&#8217;s nice and a little bit sick (for a framework a lot of magic happens during compilation). Like for ActionScript 3 Adobe again did a really good job on writing a nice documentation.</p>
<p>But not everything works flawless. Here is a thing struggled with:</p>
<p>Embedding an image is quite easy (the image will be compiled into the final swf file):</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&lt;mx:Image source=&quot;@Embed(source=&#8217;image.jpg&#8217;)&quot;/&gt;</div>
</li>
</ol>
</div>
<p>Using HTML to format text shouldn&#8217;t be a problem for anyone.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&lt;mx:Text width=&quot;100%&quot;&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &lt;mx:htmlText&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &lt;![CDATA[&lt;p&gt;&lt;img src='url'/&gt;some text&lt;/p&gt;]]&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &lt;/mx:htmlText&gt;
</div>
</li>
<li class="li2">
<div class="de2">&lt;/mx:Text&gt;</div>
</li>
</ol>
</div>
<p>This will show the image from the given URL and &#8220;some text&#8221;. The Image is going to be loaded when displayed, it is not embedded into the swf file.</p>
<p><strong>How to use a embedded image in a HTML text element?<span id="more-352"></span></strong></p>
<p>It took a while, so here is the solution. It is not clean as it should, but it works.</p>
<p>First you need a helper class, which embeds the image:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">package embeds <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">import</span> mx.<span class="me1">core</span>.<span class="me1">BitmapAsset</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">import</span> flash.<span class="me1">display</span>.<span class="me1">Sprite</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">class</span> ImageAsset <span class="kw3">extends</span> Sprite <span class="br0">&#123;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>Embed<span class="br0">&#40;</span>source=<span class="st0">&quot;image.jpg&quot;</span><span class="br0">&#41;</span><span class="br0">&#93;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>Bindable<span class="br0">&#93;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">var</span> source : <span class="kw2">Class</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">function</span> ImageAsset<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">super</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> image:BitmapAsset = <span class="kw2">new</span> source<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addChild<span class="br0">&#40;</span>image<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li2">
<div class="de2"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>Then you could do this, as I said it looks a little bit like a hack, but it works just fine.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&lt;fx:Script&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &lt;![CDATA[
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; import embeds.ImageAsset;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; // this is needed, otherwise the image is not
</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; // available within the html text
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; private var hack:ImageAsset;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; ]]&gt;
</div>
</li>
<li class="li1">
<div class="de1">&lt;/fx:Script&gt;
</div>
</li>
<li class="li1">
<div class="de1">&lt;mx:Text&gt;
</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &lt;mx:htmlText&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;![CDATA[&lt;p&gt;&lt;img src='embeds.ImageAsset'/&gt;some text&lt;/p&gt;]]&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &lt;/mx:htmlText&gt;
</div>
</li>
<li class="li1">
<div class="de1">&lt;/mx:Text&gt;</div>
</li>
</ol>
</div>
<p class="wp-flattr-button"></p> <p><a href="http://blog.thehippo.de/?flattrss_redirect&amp;id=352&amp;md5=066e58cb1fc8a92eb53d4b1488361bec" title="Flattr" target="_blank"><img src="http://blog.thehippo.de/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.thehippo.de/2011/03/programming/flex-using-embedded-image-in-html-text/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to combine DELETE and JOIN in one MySQL query</title>
		<link>http://blog.thehippo.de/2011/01/server/delete-and-join-mysql-query/</link>
		<comments>http://blog.thehippo.de/2011/01/server/delete-and-join-mysql-query/#comments</comments>
		<pubDate>Tue, 18 Jan 2011 18:33:30 +0000</pubDate>
		<dc:creator>Hippo</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[delete]]></category>
		<category><![CDATA[join]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://blog.thehippo.de/?p=334</guid>
		<description><![CDATA[Today I discovered that a while back on a PHP/HTML/MySQL project I made some serious mistakes on my database design. To explain it in short:

I have one a table, lets call it "table1", and another table, lets call it "table2". Table1 references a row from table2, but I didn't used foreign keys in these ...]]></description>
			<content:encoded><![CDATA[<p>Today I discovered that a while back on a PHP/HTML/MySQL project I made some serious mistakes on my database design. To explain it in short:</p>
<p>I have one a table, lets call it &#8220;table1&#8243;, and another table, lets call it &#8220;table2&#8243;. Table1 references a row from table2, but I didn&#8217;t used foreign keys in these days. (I don&#8217;t if I didn&#8217;t know that they are exist or if InnoDB wasn&#8217;t available.) The Website has an admin tool which edits all the tables through some HTML forms. My mistake was that it is possible to delete a row from table2 which leaves all the rows in table1 referencing this row in table2 somehow broken. Today someone discovered this mistake I needed to clean this up. My idea was to create a simple query which cleans table1 and the alter the PHP which deleting rows from table2 to also clean up table1.</p>
<p>I started which the following query:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">DELETE</span> <span class="kw1">FROM</span> table1 <span class="kw1">WHERE</span> id <span class="kw5">IN</span> <span class="br0">&#40;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">SELECT</span> t1.id</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">FROM</span> table1 AS t1</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">LEFT</span> <span class="kw1">JOIN</span> table2 AS t2 ON t1.key = t2.key</div>
</li>
<li class="li2">
<div class="de2">&nbsp; <span class="kw1">WHERE</span> t2.key <span class="kw5">IS</span> <span class="kw3">NULL</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#41;</span></div>
</li>
</ol>
</div>
<p>Which leads to the following error:</p>
<pre>#1093 - You can't specify target table 'table1' for update in FROM clause</pre>
<p>I was some kind of shocked because I had no idea whats wrong with this query. After searching the web for a while I found out that it is some kind of bug in MySQL but there is a weird looking workaround:<span id="more-334"></span></p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">DELETE</span> <span class="kw1">FROM</span> table1 <span class="kw1">WHERE</span> id <span class="kw5">IN</span> <span class="br0">&#40;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">SELECT</span> id</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">FROM</span> <span class="br0">&#40;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">SELECT</span> t1.id</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; <span class="kw1">FROM</span> table1 AS t1</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">LEFT</span> <span class="kw1">JOIN</span> table2 AS t2 ON t1.key = t2.key</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">WHERE</span> t2.key <span class="kw5">IS</span> <span class="kw3">NULL</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#41;</span> AS temp</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#41;</span></div>
</li>
</ol>
</div>
<p>This works very nicely, but costs a lot of performance, because you need to add another subquery and you create a temporary table. So the better solution is to sanitise all your data before you remove some referenced rows <img src='http://blog.thehippo.de/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p class="wp-flattr-button"></p> <p><a href="http://blog.thehippo.de/?flattrss_redirect&amp;id=334&amp;md5=3bf6080bce612a67a9b7acb2481b073a" title="Flattr" target="_blank"><img src="http://blog.thehippo.de/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.thehippo.de/2011/01/server/delete-and-join-mysql-query/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScript curiosity: mixing function and global scope</title>
		<link>http://blog.thehippo.de/2010/05/programming/javascript-curiosity-mixing-function-and-global-scope/</link>
		<comments>http://blog.thehippo.de/2010/05/programming/javascript-curiosity-mixing-function-and-global-scope/#comments</comments>
		<pubDate>Mon, 31 May 2010 15:05:46 +0000</pubDate>
		<dc:creator>Hippo</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[curiosity]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[global]]></category>
		<category><![CDATA[scope]]></category>
		<category><![CDATA[var]]></category>
		<category><![CDATA[variable]]></category>

		<guid isPermaLink="false">http://blog.thehippo.de/?p=237</guid>
		<description><![CDATA[I am developing with JavaScript for a while and I am used to a lot of it quirks. But even after years of using this language you still find new curiosities. Today a struggled a while with this one.
Considering this piece of JavaScript code:
var i = 10;
function foo() {
	i++; // i is now 11
	console.log("foo1: ...]]></description>
			<content:encoded><![CDATA[<p>I am developing with <a title="JavaScript" href="http://en.wikipedia.org/wiki/JavaScript" target="_blank">JavaScript</a> for a while and I am used to a lot of it quirks. But even after years of using this language you still find new curiosities. Today a struggled a while with this one.<br />
Considering this piece of JavaScript code:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">var</span> i = <span class="nu0">10</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">function</span> foo<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; i++; <span class="co1">// i is now 11</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; console.<span class="me1">log</span><span class="br0">&#40;</span><span class="st0">&quot;foo1: &quot;</span>+i<span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; i = <span class="nu0">0</span>; <span class="co1">// i is now 0</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; console.<span class="me1">log</span><span class="br0">&#40;</span><span class="st0">&quot;foo2: &quot;</span>+i<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span>;</div>
</li>
<li class="li1">
<div class="de1">console.<span class="me1">log</span><span class="br0">&#40;</span><span class="st0">&quot;global1: &quot;</span>+i<span class="br0">&#41;</span>; <span class="co1">// should be 10</span></div>
</li>
<li class="li1">
<div class="de1">foo<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">console.<span class="me1">log</span><span class="br0">&#40;</span><span class="st0">&quot;global2: &quot;</span>+i<span class="br0">&#41;</span>; <span class="co1">// and now 0</span></div>
</li>
</ol>
</div>
<p>Ok. That&#8217;s fine. Now we change the code a little bit to this one:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">var</span> i = <span class="nu0">10</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">function</span> foo<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; i++; <span class="co1">// is now 11</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; console.<span class="me1">log</span><span class="br0">&#40;</span><span class="st0">&quot;foo1: &quot;</span>+i<span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> i = <span class="nu0">0</span>; <span class="co1">//create a new variable with value 0</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; console.<span class="me1">log</span><span class="br0">&#40;</span><span class="st0">&quot;foo2: &quot;</span>+i<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span>;</div>
</li>
<li class="li1">
<div class="de1">console.<span class="me1">log</span><span class="br0">&#40;</span><span class="st0">&quot;global1: &quot;</span>+i<span class="br0">&#41;</span>; <span class="co1">// expect: 10</span></div>
</li>
<li class="li1">
<div class="de1">foo<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">console.<span class="me1">log</span><span class="br0">&#40;</span><span class="st0">&quot;global2: &quot;</span>+i<span class="br0">&#41;</span>; <span class="co1">// expect: 11</span></div>
</li>
</ol>
</div>
<p>What do you expect? I was quite surprised:<span id="more-237"></span></p>
<blockquote><p>global1: 10<br />
foo1: NaN<br />
foo2: 0<br />
global2: 10</p></blockquote>
<p>Why do we get a <strong>Not a Number</strong>? Why is JavaScript not using the global var as in the first example? Why is the global variable <strong>i</strong> not increased, the operation took place before the declaration of the local variable <strong>i</strong>? JavaScript has some &#8220;strange&#8221; rules about variable declaration. Every variable declared within a function is initialised at the beginning of the function, so our function actually would look like this:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">var</span> i = <span class="nu0">10</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">function</span> foo<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> i; <span class="co1">//undefined</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; i++; <span class="co1">// undefined + 1 = NaN</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; console.<span class="me1">log</span><span class="br0">&#40;</span><span class="st0">&quot;foo1: &quot;</span>+i<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; i = <span class="nu0">0</span>; <span class="co1">//and now 0</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; console.<span class="me1">log</span><span class="br0">&#40;</span><span class="st0">&quot;foo2: &quot;</span>+i<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span>;</div>
</li>
<li class="li1">
<div class="de1">console.<span class="me1">log</span><span class="br0">&#40;</span><span class="st0">&quot;global1: &quot;</span>+i<span class="br0">&#41;</span>; <span class="co1">//10</span></div>
</li>
<li class="li2">
<div class="de2">foo<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">console.<span class="me1">log</span><span class="br0">&#40;</span><span class="st0">&quot;global2: &quot;</span>+i<span class="br0">&#41;</span>;<span class="co1">//still 10, because global i has not changed</span></div>
</li>
</ol>
</div>
<p>Looking into the rules of <a title="JSLint" href="http://www.jslint.com/" target="_blank">JSLint</a> which helps to verify JavaScript code to improve the quality of your JavaScript you get a few rules how to safely declare variables:</p>
<ul>
<li>JavaScript allows var definitions to occur anywhere within a function. JSLint is more strict.</li>
<li>JSLint expects that a var will be declared only once, and that it will be declared before it is used.</li>
<li>JSLint expects that a function will be declared before it is used.</li>
<li>JSLint expects that parameters will not also be declared as vars.</li>
<li>JSLint does not expect the arguments array to be declared as a var.</li>
<li>JSLint does not expect that a var will be defined in a block. This is because JavaScript blocks do not have block scope. This can have unexpected consequences. Define all variables at the top of the function.</li>
</ul>
<p>So Remember:<strong> Variables are not initialised when they are declared!</strong></p>
<p>Links:</p>
<ul>
<li>all <a title="JSLint rules" href="http://www.jslint.com/lint.html" target="_blank">JSLint rules</a> for quality JavaScript code.</li>
<li><a title="WTFJS.com" href="http://wtfjs.com/" target="_blank">WTFJS.com</a>, a page collection all kinds of JavaScript curiosities.</li>
</ul>
<p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://blog.thehippo.de/2010/05/programming/javascript-curiosity-mixing-function-and-global-scope/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.288 seconds -->

