<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://united-coders.com"  xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>united-coders.com - javascript</title>
 <link>http://united-coders.com/taxonomy/term/14/0</link>
 <description></description>
 <language>en</language>
<item>
 <title>On the phone with Mom - Throttle and Delay DOM-Events in Javascript</title>
 <link>http://united-coders.com/matthias-reuter/on-the-phone-with-mom-throttle-and-delay-in-javascript</link>
 <description>&lt;p&gt;Imagine you&#039;re on the phone with your mom and she keeps on talking. And talking. And talking. And you keep on listening and listening. And listening. Every now and then your mom will throw in a &quot;you still there?&quot; to which you will murmur &quot;uh huh&quot;.&lt;/p&gt;
&lt;p&gt;And while your mom keeps talking, you feel the increasing urge to answer to something she said, but being well raised, you don&#039;t want to interrupt her, but wait until she is finished.&lt;/p&gt;
&lt;p&gt;Now imagine being a Javascript (Come on, It&#039;s not that hard, is it?).&lt;span class=&quot;read-more&quot;&gt;&lt;a href=&quot;/matthias-reuter/on-the-phone-with-mom-throttle-and-delay-in-javascript&quot;&gt;&lt;strong&gt;Read more&lt;/strong&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

&lt;!--
&lt;rdf:RDF xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:trackback=&quot;http://madskills.com/public/xml/rss/module/trackback/&quot;&gt;
&lt;rdf:Description rdf:about=&quot;http://united-coders.com/matthias-reuter/on-the-phone-with-mom-throttle-and-delay-in-javascript&quot; dc:identifier=&quot;http://united-coders.com/matthias-reuter/on-the-phone-with-mom-throttle-and-delay-in-javascript&quot; dc:title=&quot;On the phone with Mom - Throttle and Delay DOM-Events in Javascript&quot; trackback:ping=&quot;http://united-coders.com/trackback/113&quot; /&gt;
&lt;/rdf:RDF&gt;
--&gt;
&lt;div class=&#039;sexybookmarks-default-6420&#039;&gt;&lt;/div&gt;</description>
 <comments>http://united-coders.com/matthias-reuter/on-the-phone-with-mom-throttle-and-delay-in-javascript#comments</comments>
 <category domain="http://united-coders.com/category/tags/delay">delay</category>
 <category domain="http://united-coders.com/category/tags/javascript">javascript</category>
 <category domain="http://united-coders.com/category/tags/settimeout">setTimeout</category>
 <category domain="http://united-coders.com/category/tags/throttle">throttle</category>
 <category domain="http://united-coders.com/category/tags/your-mom">your mom</category>
 <pubDate>Thu, 17 Nov 2011 07:10:43 +0000</pubDate>
 <dc:creator>Matthias Reuter</dc:creator>
 <guid isPermaLink="false">113 at http://united-coders.com</guid>
</item>
<item>
 <title>Snow is falling - code puzzle</title>
 <link>http://united-coders.com/christian-harms/snow-is-falling-code-puzzle</link>
 <description>&lt;p&gt;Code puzzles are fun and you can solve it with some lines of code. The code puzzle on &lt;a href=&quot;http://www.snowisfalling.com&quot;&gt;snowisfalling.com&lt;/a&gt; is a page showing snow is falling up instead down.  After reading the code, sleeping two nights without time to solve it, the simple solution is easy:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;geshifilter&quot;&gt;&lt;div class=&quot;javascript geshifilter-javascript&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; init &lt;span style=&quot;color: #339933;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;law&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; String.&lt;span style=&quot;color: #660066;&quot;&gt;prototype&lt;/span&gt;.&lt;span style=&quot;color: #660066;&quot;&gt;reverse&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #660066;&quot;&gt;split&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&quot;color: #660066;&quot;&gt;reverse&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&quot;color: #660066;&quot;&gt;join&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #660066;&quot;&gt;law&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;var&lt;/span&gt; k &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;in&lt;/span&gt; law&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #660066;&quot;&gt;law&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;k.&lt;span style=&quot;color: #660066;&quot;&gt;reverse&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; law&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;k&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;&lt;span class=&quot;read-more&quot;&gt;&lt;a href=&quot;/christian-harms/snow-is-falling-code-puzzle&quot;&gt;&lt;strong&gt;Read more&lt;/strong&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

&lt;!--
&lt;rdf:RDF xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:trackback=&quot;http://madskills.com/public/xml/rss/module/trackback/&quot;&gt;
&lt;rdf:Description rdf:about=&quot;http://united-coders.com/christian-harms/snow-is-falling-code-puzzle&quot; dc:identifier=&quot;http://united-coders.com/christian-harms/snow-is-falling-code-puzzle&quot; dc:title=&quot;Snow is falling - code puzzle&quot; trackback:ping=&quot;http://united-coders.com/trackback/109&quot; /&gt;
&lt;/rdf:RDF&gt;
--&gt;
&lt;div class=&#039;sexybookmarks-default-2475&#039;&gt;&lt;/div&gt;</description>
 <comments>http://united-coders.com/christian-harms/snow-is-falling-code-puzzle#comments</comments>
 <category domain="http://united-coders.com/category/tags/code-puzzle">code puzzle</category>
 <category domain="http://united-coders.com/category/tags/javascript">javascript</category>
 <pubDate>Tue, 15 Nov 2011 08:15:04 +0000</pubDate>
 <dc:creator>Christian Harms</dc:creator>
 <guid isPermaLink="false">109 at http://united-coders.com</guid>
</item>
<item>
 <title>basic rules for code readability and the if statement</title>
 <link>http://united-coders.com/christian-harms/basic-rules-for-code-readability-and-the-if-statement</link>
 <description>&lt;!--paging_filter--&gt;&lt;p&gt;Some reader knows my preference for programming languages like python or javascript. One reason is the readability (yes, this is possible with many languages except &lt;a href=&quot;http://brainfuck.tk/&quot; title=&quot;brainfuck interpreter&quot;&gt;brainfuck&lt;/a&gt; or &lt;a href=&quot;http://compsoc.dur.ac.uk/whitespace/&quot; title=&quot;programming language whitespace&quot;&gt;whitespace&lt;/a&gt;). Once we write some lines of code, but other developer has to read the lines of code several times while code reviews, debugging or refactoring.&lt;/p&gt;
&lt;p&gt;Code should be &lt;b&gt;readable&lt;/b&gt; like your normal language. I will start with a funny condition.&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;geshifilter&quot;&gt;&lt;div class=&quot;javascript geshifilter-javascript&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;!&lt;/span&gt;notOk &lt;span style=&quot;color: #339933;&quot;&gt;!=&lt;/span&gt; &lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;false&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; userObj.&lt;span style=&quot;color: #660066;&quot;&gt;ask&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;This is only confusing and you will never formulate this expression in a natural language. With several steps this term can be simply resolved:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;( !notOk != false )&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;( !notOk == true )&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;( !notOk)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;now you should rethink the variable name: &lt;code&gt;isOk = !notOk&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And the result is more readable:&lt;span class=&quot;read-more&quot;&gt;&lt;a href=&quot;/christian-harms/basic-rules-for-code-readability-and-the-if-statement&quot;&gt;&lt;strong&gt;Read more&lt;/strong&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

&lt;!--
&lt;rdf:RDF xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:trackback=&quot;http://madskills.com/public/xml/rss/module/trackback/&quot;&gt;
&lt;rdf:Description rdf:about=&quot;http://united-coders.com/christian-harms/basic-rules-for-code-readability-and-the-if-statement&quot; dc:identifier=&quot;http://united-coders.com/christian-harms/basic-rules-for-code-readability-and-the-if-statement&quot; dc:title=&quot;basic rules for code readability and the if statement&quot; trackback:ping=&quot;http://united-coders.com/trackback/106&quot; /&gt;
&lt;/rdf:RDF&gt;
--&gt;
&lt;div class=&#039;sexybookmarks-default-8209&#039;&gt;&lt;/div&gt;</description>
 <comments>http://united-coders.com/christian-harms/basic-rules-for-code-readability-and-the-if-statement#comments</comments>
 <category domain="http://united-coders.com/category/tags/javascript">javascript</category>
 <category domain="http://united-coders.com/category/tags/python">python</category>
 <category domain="http://united-coders.com/category/tags/readability">readability</category>
 <pubDate>Mon, 01 Aug 2011 16:55:23 +0000</pubDate>
 <dc:creator>Christian Harms</dc:creator>
 <guid isPermaLink="false">106 at http://united-coders.com</guid>
</item>
<item>
 <title>create optimized wordlist data structures for mobile webapps</title>
 <link>http://united-coders.com/christian-harms/create-optimized-wordlist-data-structures-for-mobile-webapps</link>
 <description>&lt;p&gt;John Resig (creator and lead developer of jQuery) has published two interesting articles about data structure for a lookup to a huge wordlist (&lt;a href=&quot;http://ejohn.org/blog/dictionary-lookups-in-javascript/&quot;&gt;dictionary lookups&lt;/a&gt; and &lt;a href=&quot;http://ejohn.org/blog/javascript-trie-performance-analysis/&quot;&gt;trie performance&lt;/a&gt;). Read in his articles about all the variants and preconditions.&lt;/p&gt;
&lt;p&gt;I implemented six variants for the data structure (started with simple String search, Array to Trie) and benchmarked them to find the &lt;a href=&quot;http://united-coders.com/christian-harms/create-optimized-wordlist-data-structures-for-mobile-webapps#conclusion&quot;&gt;best solution&lt;/a&gt;. But let’s start with the rules:&lt;span class=&quot;read-more&quot;&gt;&lt;a href=&quot;/christian-harms/create-optimized-wordlist-data-structures-for-mobile-webapps&quot;&gt;&lt;strong&gt;Read more&lt;/strong&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

&lt;!--
&lt;rdf:RDF xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:trackback=&quot;http://madskills.com/public/xml/rss/module/trackback/&quot;&gt;
&lt;rdf:Description rdf:about=&quot;http://united-coders.com/christian-harms/create-optimized-wordlist-data-structures-for-mobile-webapps&quot; dc:identifier=&quot;http://united-coders.com/christian-harms/create-optimized-wordlist-data-structures-for-mobile-webapps&quot; dc:title=&quot;create optimized wordlist data structures for mobile webapps&quot; trackback:ping=&quot;http://united-coders.com/trackback/99&quot; /&gt;
&lt;/rdf:RDF&gt;
--&gt;
&lt;div class=&#039;sexybookmarks-default-8660&#039;&gt;&lt;/div&gt;</description>
 <comments>http://united-coders.com/christian-harms/create-optimized-wordlist-data-structures-for-mobile-webapps#comments</comments>
 <category domain="http://united-coders.com/category/tags/data-structure">data structure</category>
 <category domain="http://united-coders.com/category/tags/hashmap">hashmap</category>
 <category domain="http://united-coders.com/category/tags/javascript">javascript</category>
 <category domain="http://united-coders.com/category/tags/john-resig">john resig</category>
 <category domain="http://united-coders.com/category/tags/tree">tree</category>
 <pubDate>Fri, 18 Mar 2011 21:22:09 +0000</pubDate>
 <dc:creator>Christian Harms</dc:creator>
 <guid isPermaLink="false">99 at http://united-coders.com</guid>
</item>
<item>
 <title>Javascript algorithm performance : And the winner is ...</title>
 <link>http://united-coders.com/christian-harms/javascript-algorithm-performance-and-the-winner-is</link>
 <description>&lt;p&gt;Our little &lt;a href=&quot;http://united-coders.com/christian-harms/forfeit-game-coding-contest-since-50-years&quot;&gt;programming contest&lt;/a&gt; was fun and we can learn something about best practices in javascript algorithm performance. I have prepared some micro benchmarks for common code sniplets to find the best variant. After the section with the micro benchmarks you can find the &lt;a href=&quot;http://united-coders.com/christian-harms/javascript-algorithm-performance-and-the-winner-is#winner&quot;&gt;best-performed solution&lt;/a&gt; by running the JSLitmus test and browse  through the javascript code. And yes - our co-author Matthias had the best solution with &lt;b&gt;factor 20-35 faster&lt;/b&gt; than the clean code variant. No solution is close with the performance to Matthias&#039; solution!&lt;/p&gt;
&lt;p&gt;Knowing some javascript performance hints are importend. The different javascript interpreter with Just-In-Time-Optimizer can offer some surprise in the following basic code examples.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Adding Numbers to an Array&lt;/li&gt;
&lt;li&gt;Using code in loop-header or Body&lt;/li&gt;
&lt;li&gt;Round down a Number&lt;/li&gt;
&lt;li&gt;Using linear Array or Object (=hashmap) for caching Numbers&lt;/li&gt;
&lt;li&gt;Find a substring in a String&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;br clear=&quot;all&quot; /&gt;&lt;span class=&quot;read-more&quot;&gt;&lt;a href=&quot;/christian-harms/javascript-algorithm-performance-and-the-winner-is&quot;&gt;&lt;strong&gt;Read more&lt;/strong&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

&lt;!--
&lt;rdf:RDF xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:trackback=&quot;http://madskills.com/public/xml/rss/module/trackback/&quot;&gt;
&lt;rdf:Description rdf:about=&quot;http://united-coders.com/christian-harms/javascript-algorithm-performance-and-the-winner-is&quot; dc:identifier=&quot;http://united-coders.com/christian-harms/javascript-algorithm-performance-and-the-winner-is&quot; dc:title=&quot;Javascript algorithm performance : And the winner is ...&quot; trackback:ping=&quot;http://united-coders.com/trackback/90&quot; /&gt;
&lt;/rdf:RDF&gt;
--&gt;
&lt;div class=&#039;sexybookmarks-default-4221&#039;&gt;&lt;/div&gt;</description>
 <comments>http://united-coders.com/christian-harms/javascript-algorithm-performance-and-the-winner-is#comments</comments>
 <category domain="http://united-coders.com/category/tags/algorithm-performance">algorithm performance</category>
 <category domain="http://united-coders.com/category/tags/benchmark">benchmark</category>
 <category domain="http://united-coders.com/category/tags/game-of-forfeits">game of forfeits</category>
 <category domain="http://united-coders.com/category/tags/javascript">javascript</category>
 <enclosure url="http://united-coders.com/sites/default/files/beautify_min.js.txt" length="16919" type="text/plain" />
 <pubDate>Thu, 02 Dec 2010 06:32:26 +0000</pubDate>
 <dc:creator>Christian Harms</dc:creator>
 <guid isPermaLink="false">90 at http://united-coders.com</guid>
</item>
<item>
 <title>forfeit game - ALGOL 60 solution from 1964</title>
 <link>http://united-coders.com/christian-harms/forfeit-game-algol-60-solution-from-1964</link>
 <description>&lt;!--paging_filter--&gt;&lt;p&gt; I found two ALGOL sniplets for the &lt;a href=&quot;http://united-coders.com/christian-harms/forfeit-game-coding-contest-since-50-years&quot; title=&quot;game of forfeits programming contest&quot;&gt;forfeit game contest&lt;/a&gt;. My ALGOL 60 programming book (happy birthday for the &lt;a href=&quot;http://dbenn.wordpress.com/2010/08/03/50th-anniversary-of-algol-60/&quot; title=&quot;50th Anniversary of Algol 60&quot;&gt;ALGOL&lt;/a&gt; programming language) offer for every problem the question, a problem analysis, a code structure chart, the code solution and the executing time for the ZUSE 23 computer (see a very similar &lt;a href=&quot;http://en.wikipedia.org/wiki/Z22&quot;&gt;Z22 on wikipedia&lt;/a&gt;). I converted the fast solution for the game of forfeit from ALGOL to javascript without optimizations and benchmarked it.&lt;/p&gt;
&lt;h2&gt;Opera 10.63 vs. Chrome 7/8 vs. Firefox 3.6.12/4b7&lt;/h2&gt;
&lt;p&gt;I will start with the results from the converted ALGOL solution. The new javascript engine Jägermonkey with the &lt;a href=&quot;http://www.mozilla.com/en-US/firefox/all-beta.html&quot;&gt;firefox 4b7&lt;/a&gt; is a real competitor for other fast javascript engines! And the ALGOL version is (mostly) better than the &lt;a href=&quot;http://united-coders.com/christian-harms/forfeit-game-coding-contest-since-50-years&quot; title=&quot;clean code version of game of forfeits&quot;&gt;clean code&lt;/a&gt; version. The absolute numbers are generated on my own mini-pc and used for comparing with the clean code solution. &lt;/p&gt;
&lt;p&gt;The 1:1 conversion of the ALGOL code runs on my Intel Atom N270 &lt;b&gt;3.5 million times faster&lt;/b&gt; than on the original ZUSE Z23.&lt;span class=&quot;read-more&quot;&gt;&lt;a href=&quot;/christian-harms/forfeit-game-algol-60-solution-from-1964&quot;&gt;&lt;strong&gt;Read more&lt;/strong&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

&lt;!--
&lt;rdf:RDF xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:trackback=&quot;http://madskills.com/public/xml/rss/module/trackback/&quot;&gt;
&lt;rdf:Description rdf:about=&quot;http://united-coders.com/christian-harms/forfeit-game-algol-60-solution-from-1964&quot; dc:identifier=&quot;http://united-coders.com/christian-harms/forfeit-game-algol-60-solution-from-1964&quot; dc:title=&quot;forfeit game - ALGOL 60 solution from 1964&quot; trackback:ping=&quot;http://united-coders.com/trackback/82&quot; /&gt;
&lt;/rdf:RDF&gt;
--&gt;
&lt;div class=&#039;sexybookmarks-default-3686&#039;&gt;&lt;/div&gt;</description>
 <comments>http://united-coders.com/christian-harms/forfeit-game-algol-60-solution-from-1964#comments</comments>
 <category domain="http://united-coders.com/category/tags/algol">algol</category>
 <category domain="http://united-coders.com/category/tags/algol60">algol60</category>
 <category domain="http://united-coders.com/category/tags/benchmark">benchmark</category>
 <category domain="http://united-coders.com/category/tags/code-puzzle">code puzzle</category>
 <category domain="http://united-coders.com/category/tags/javascript">javascript</category>
 <enclosure url="http://united-coders.com/sites/default/files/forfeit_fast.a60.txt" length="1037" type="text/plain" />
 <pubDate>Mon, 15 Nov 2010 13:51:00 +0000</pubDate>
 <dc:creator>Christian Harms</dc:creator>
 <guid isPermaLink="false">82 at http://united-coders.com</guid>
</item>
<item>
 <title>Forfeit game - coding contest since 50 years</title>
 <link>http://united-coders.com/christian-harms/forfeit-game-coding-contest-since-50-years</link>
 <description>&lt;!--paging_filter--&gt;&lt;p&gt;The game of forfeits is a simple game and one of the classic programming examples since 50 years. I found it in a ALGOL 60 exercise book from 1963: Count the numbers up to 100, but skip all numbers if one of the condition matches:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;number is divisible by seven&lt;/li&gt;
&lt;li&gt;number contains a seven&lt;/li&gt;
&lt;li&gt;sum of digits is divisible by seven&lt;/li&gt;
&lt;li&gt;sum of digits contains a seven&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Develop a function which calculates all numbers based on the given conditions. The only one parameter for the function is the range and the function should return the Array of all valid numbers. Hint: You must not cheat while returning a sliced constant result array. The result of the function with max=100 is: [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 18, 19, 20, 22, 23, 24, 26, 29, 30, 31, 32, 33, 36, 38, 39, 40, 41, 44, 45, 46, 48, 50, 51, 53, 54, 55, 58, 60, 62, 64, 65, 66, 69, 80, 81, 82, 83, 85, 88, 90, 92, 93, 94, 96, 99, 100]. &lt;span class=&quot;read-more&quot;&gt;&lt;a href=&quot;/christian-harms/forfeit-game-coding-contest-since-50-years&quot;&gt;&lt;strong&gt;Read more&lt;/strong&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;clean code variant&lt;/h2&gt;

&lt;!--
&lt;rdf:RDF xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:trackback=&quot;http://madskills.com/public/xml/rss/module/trackback/&quot;&gt;
&lt;rdf:Description rdf:about=&quot;http://united-coders.com/christian-harms/forfeit-game-coding-contest-since-50-years&quot; dc:identifier=&quot;http://united-coders.com/christian-harms/forfeit-game-coding-contest-since-50-years&quot; dc:title=&quot;Forfeit game - coding contest since 50 years&quot; trackback:ping=&quot;http://united-coders.com/trackback/80&quot; /&gt;
&lt;/rdf:RDF&gt;
--&gt;
&lt;div class=&#039;sexybookmarks-default-8177&#039;&gt;&lt;/div&gt;</description>
 <comments>http://united-coders.com/christian-harms/forfeit-game-coding-contest-since-50-years#comments</comments>
 <category domain="http://united-coders.com/category/tags/algol">algol</category>
 <category domain="http://united-coders.com/category/tags/code-puzzles">code puzzles</category>
 <category domain="http://united-coders.com/category/tags/javascript">javascript</category>
 <enclosure url="http://united-coders.com/sites/default/files/forfeits.js.txt" length="3037" type="text/plain" />
 <pubDate>Mon, 08 Nov 2010 16:11:16 +0000</pubDate>
 <dc:creator>Christian Harms</dc:creator>
 <guid isPermaLink="false">80 at http://united-coders.com</guid>
</item>
<item>
 <title>Javascript Functional programming with Underscore or ECMAScript5</title>
 <link>http://united-coders.com/christian-harms/javascript-functional-programming-with-underscore-or-ecmascript5</link>
 <description>&lt;p&gt;Intro: A little excursion to code more functional with javascript. It contain examples with the classic for-loop-code, the more functional variant with &lt;a href=&quot;http://documentcloud.github.com/underscore/&quot; title=&quot;JavaScript helper Underscore&quot;&gt;Underscore.js&lt;/a&gt; and the HTML5 functional enhancements. It does not explain the basic idea of functional programming - it shows the differences in code examples.&lt;/p&gt;
&lt;h2&gt;motivation&lt;/h2&gt;
&lt;p&gt;Last week I got access on the address book from Matthias&#039; well known entry &lt;a href=&quot;http://united-coders.com/matthias-reuter/better-javascript-three-women-and-one-address-book&quot;&gt;Jennifer&lt;/a&gt;. But I had no time to scan all the other girls addresses. With many lines of source code filled with for-loop-code - no way. I have to find a smarter coding way to scan the address book.&lt;span class=&quot;read-more&quot;&gt;&lt;a href=&quot;/christian-harms/javascript-functional-programming-with-underscore-or-ecmascript5&quot;&gt;&lt;strong&gt;Read more&lt;/strong&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

&lt;!--
&lt;rdf:RDF xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:trackback=&quot;http://madskills.com/public/xml/rss/module/trackback/&quot;&gt;
&lt;rdf:Description rdf:about=&quot;http://united-coders.com/christian-harms/javascript-functional-programming-with-underscore-or-ecmascript5&quot; dc:identifier=&quot;http://united-coders.com/christian-harms/javascript-functional-programming-with-underscore-or-ecmascript5&quot; dc:title=&quot;Javascript Functional programming with Underscore or ECMAScript5&quot; trackback:ping=&quot;http://united-coders.com/trackback/74&quot; /&gt;
&lt;/rdf:RDF&gt;
--&gt;
&lt;div class=&#039;sexybookmarks-default-3067&#039;&gt;&lt;/div&gt;</description>
 <comments>http://united-coders.com/christian-harms/javascript-functional-programming-with-underscore-or-ecmascript5#comments</comments>
 <category domain="http://united-coders.com/category/tags/benchmark">benchmark</category>
 <category domain="http://united-coders.com/category/tags/ecmascript5">ecmascript5</category>
 <category domain="http://united-coders.com/category/tags/filter">filter</category>
 <category domain="http://united-coders.com/category/tags/functional">functional</category>
 <category domain="http://united-coders.com/category/tags/javascript">javascript</category>
 <category domain="http://united-coders.com/category/tags/map">map</category>
 <enclosure url="http://united-coders.com/sites/default/files/functional.js.txt" length="3236" type="text/plain" />
 <pubDate>Mon, 04 Oct 2010 19:56:21 +0000</pubDate>
 <dc:creator>Christian Harms</dc:creator>
 <guid isPermaLink="false">74 at http://united-coders.com</guid>
</item>
<item>
 <title>JavaScript Object property getter benchmarks - part 2</title>
 <link>http://united-coders.com/christian-harms/javascript-object-property-getter-benchmarks-part-2</link>
 <description>&lt;p&gt;The &lt;a href=&quot;http://united-coders.com/christian-harms/javascript-object-access-micro-benchmarks&quot;&gt;object access benchmarks&lt;/a&gt; last weeks was not surprising but a factor 5 between access &quot;obj.a&quot; and &quot;obj.getA()&quot; is interesting. In this second part I check the access time for properties on objects, created with ECMAScript 3 getter/setter and with the ECMAScript 5 Object.defineProperty variant (works on IE8+, FF3.7+, newest Webkit and Chrome 5) - see more on &lt;a href=&quot;http://kangax.github.com/es5-compat-table/&quot; title=&quot;ECMAScript 5 compatibility table&quot;&gt;ECMAScript 5 compatibility table&lt;/a&gt;. &lt;a href=&quot;http://united-coders.com/christian-harms/javascript-object-access-micro-benchmarks#comment-200&quot; title=&quot;Oliver from nerget.com&quot;&gt;Oliver&lt;/a&gt; asked to add getter tests - and the results produce differences with factor 15-100.&lt;span class=&quot;read-more&quot;&gt;&lt;a href=&quot;/christian-harms/javascript-object-property-getter-benchmarks-part-2&quot;&gt;&lt;strong&gt;Read more&lt;/strong&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

&lt;!--
&lt;rdf:RDF xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:trackback=&quot;http://madskills.com/public/xml/rss/module/trackback/&quot;&gt;
&lt;rdf:Description rdf:about=&quot;http://united-coders.com/christian-harms/javascript-object-property-getter-benchmarks-part-2&quot; dc:identifier=&quot;http://united-coders.com/christian-harms/javascript-object-property-getter-benchmarks-part-2&quot; dc:title=&quot;JavaScript Object property getter benchmarks - part 2&quot; trackback:ping=&quot;http://united-coders.com/trackback/61&quot; /&gt;
&lt;/rdf:RDF&gt;
--&gt;
&lt;div class=&#039;sexybookmarks-default-7384&#039;&gt;&lt;/div&gt;</description>
 <comments>http://united-coders.com/christian-harms/javascript-object-property-getter-benchmarks-part-2#comments</comments>
 <category domain="http://united-coders.com/category/tags/benchmark">benchmark</category>
 <category domain="http://united-coders.com/category/tags/get">get</category>
 <category domain="http://united-coders.com/category/tags/javascript">javascript</category>
 <category domain="http://united-coders.com/category/tags/property">property</category>
 <category domain="http://united-coders.com/category/tags/set">set</category>
 <enclosure url="http://united-coders.com/sites/default/files/objectbench.js_2.txt" length="5045" type="text/plain" />
 <pubDate>Wed, 05 May 2010 22:12:41 +0000</pubDate>
 <dc:creator>Christian Harms</dc:creator>
 <guid isPermaLink="false">61 at http://united-coders.com</guid>
</item>
<item>
 <title>JavaScript Object Access Micro benchmarks</title>
 <link>http://united-coders.com/christian-harms/javascript-object-access-micro-benchmarks</link>
 <description>&lt;p&gt;After getting the tip to use &lt;a href=&quot;http://www.broofa.com/Tools/JSLitmus/&quot; alt=&quot;JSLitmus Benchmark Suite&quot;&gt;JSLitmus for JavaScript&lt;/a&gt; microbenchmarks I grabbed my old &quot;How to access JavaScript Object&quot; code and build some tests with JSLitmus. The following question was sometimes very religious and only benchmarks can solve the problem:&lt;/p&gt;
&lt;p&gt;The question is simple: what is faster?&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;geshifilter&quot;&gt;&lt;div class=&quot;javascript geshifilter-javascript&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;obj &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;a&lt;span style=&quot;color: #339933;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #CC0000;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&lt;span style=&quot;color: #006600; font-style: italic;&quot;&gt;//variant 1&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;result &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; obj.&lt;span style=&quot;color: #660066;&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&lt;span style=&quot;color: #006600; font-style: italic;&quot;&gt;//variant 2&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;result &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; obj&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&#039;a&#039;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&lt;span style=&quot;color: #006600; font-style: italic;&quot;&gt;//variant 3 - build an object with getter function:&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: bold; font-style: italic;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;result &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; obj.&lt;span style=&quot;color: #660066;&quot;&gt;getA&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;&lt;span class=&quot;read-more&quot;&gt;&lt;a href=&quot;/christian-harms/javascript-object-access-micro-benchmarks&quot;&gt;&lt;strong&gt;Read more&lt;/strong&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

&lt;!--
&lt;rdf:RDF xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:trackback=&quot;http://madskills.com/public/xml/rss/module/trackback/&quot;&gt;
&lt;rdf:Description rdf:about=&quot;http://united-coders.com/christian-harms/javascript-object-access-micro-benchmarks&quot; dc:identifier=&quot;http://united-coders.com/christian-harms/javascript-object-access-micro-benchmarks&quot; dc:title=&quot;JavaScript Object Access Micro benchmarks&quot; trackback:ping=&quot;http://united-coders.com/trackback/60&quot; /&gt;
&lt;/rdf:RDF&gt;
--&gt;
&lt;div class=&#039;sexybookmarks-default-2652&#039;&gt;&lt;/div&gt;</description>
 <comments>http://united-coders.com/christian-harms/javascript-object-access-micro-benchmarks#comments</comments>
 <category domain="http://united-coders.com/category/tags/access">access</category>
 <category domain="http://united-coders.com/category/tags/javascript">javascript</category>
 <category domain="http://united-coders.com/category/tags/jslitmus">jslitmus</category>
 <category domain="http://united-coders.com/category/tags/object">object</category>
 <enclosure url="http://united-coders.com/sites/default/files/objectbench.js_3.txt" length="5049" type="text/plain" />
 <pubDate>Tue, 27 Apr 2010 21:33:21 +0000</pubDate>
 <dc:creator>Christian Harms</dc:creator>
 <guid isPermaLink="false">60 at http://united-coders.com</guid>
</item>
</channel>
</rss>


