<?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>/dev/null &#187; JavaScript</title>
	<atom:link href="http://www.nulldevice.de/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nulldevice.de</link>
	<description>Static is evil.</description>
	<lastBuildDate>Fri, 18 Nov 2011 17:28:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Combining SOA and Cloud Computing</title>
		<link>http://www.nulldevice.de/2011/11/combining-soa-and-cloud-computing/</link>
		<comments>http://www.nulldevice.de/2011/11/combining-soa-and-cloud-computing/#comments</comments>
		<pubDate>Thu, 17 Nov 2011 13:40:59 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Cloud Computing]]></category>
		<category><![CDATA[IEEE]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[SOA]]></category>

		<guid isPermaLink="false">http://www.nulldevice.de/?p=1330</guid>
		<description><![CDATA[To my surprise, the combination of SOA (Service-oriented Architecture) and Cloud Computing (basically outsourcing the server management/using many virtual machines) was described as something new in IEEE Computer&#8217;s October issue (&#8220;Software Engineering Meets Services and Cloud Computing&#8221;, Stephen S . Yau and Ho G. An, pp. 47 &#8211; 53). Besides the fact, that this is [...]]]></description>
			<content:encoded><![CDATA[<p>To my surprise, the combination of SOA (Service-oriented Architecture) and Cloud Computing (basically outsourcing the server management/using many virtual machines) was described as something new in IEEE Computer&#8217;s October issue (&#8220;Software Engineering Meets Services and Cloud Computing&#8221;, Stephen S . Yau and Ho G. An, pp. 47 &#8211; 53).</p>
<p>Besides the fact, that this is nothing new, but an ongoing trend that started a couple of years ago, there are three observations I&#8217;l like to share:</p>
<ol>
<li>The authors seem to be at home in the Java world, because XML was mentioned as the only feasible data format for Web services. If you are used to work with PHP and/or JavaScript, you probably prefer JSON over XML, because it&#8217;s more lightweight and it is the natural choice for Rich Internet Applications that use a JavaScript frontend. The only real advantage of XML is the possibility to use XSL to transform data. Therefore it sometimes makes sense to use XML for server-to-server communication, but probably not when communicating with mobile or JavaScript clients, that don&#8217;t use XSL.</li>
<li>The list of characteristics of a good service interface does not list API versioning, which is very important for mission critical applications that are mainly based on Web services. Otherwise these applications will break very often.</li>
<li>Also, the API should be &#8220;stateless&#8221;, according to the authors. In reality, you want to use some sort of state for sessions (a shared token is common) and for transactions (to bundle a couple of API calls and only permanently store the data, when everything was successful).</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.nulldevice.de/2011/11/combining-soa-and-cloud-computing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Git: A hellish nightmare!</title>
		<link>http://www.nulldevice.de/2011/05/git-a-hellish-nightmare/</link>
		<comments>http://www.nulldevice.de/2011/05/git-a-hellish-nightmare/#comments</comments>
		<pubDate>Wed, 04 May 2011 15:52:10 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Flot]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHPUnit]]></category>

		<guid isPermaLink="false">http://www.nulldevice.de/?p=1304</guid>
		<description><![CDATA[Even though I am the master of procrastination, I managed to fix 3 issues in flot (JS charting plugin for jQuery) and PHPUnit this week. Of course they are hosted on github and everyone who knows me, knows that I hate git because it is sooo different from svn and my brain frequently explodes when [...]]]></description>
			<content:encoded><![CDATA[<p>Even though I am the master of procrastination, I managed to fix 3 issues in <a href="https://github.com/smashedpumpkin/flot/branches" target="_blank">flot</a> (JS charting plugin for jQuery) and <a href="https://github.com/smashedpumpkin/phpunit/commit/9087b0a4321af3b2a36e28b8dd0efcf54aed76e1" target="_blank">PHPUnit</a> this week. Of course they are hosted on github and everyone who knows me, knows that I hate git because it is sooo different from svn and my brain frequently explodes when I see all the branches and connections between them. Every time I try to explain that to more or less experienced git users, they try to convince me from the opposite. Anyhow, it shouldn&#8217;t be a mission impossible to checkout the source, fix the bugs and send pull request &#8211; one for each fix &#8211; to the maintainers, right?</p>
<p>After committing the second flot fix, I found out that you can only send ONE pull request per branch and I didn&#8217;t even know how to create new branches. Not to speak about how to move the commits to the right branches. Without the help of Alexandre Salomé from Sensio Labs I would have been totally lost! Here is what he did:<br />
<code><br />
git status<br />
git checkout origin/master -b fix-fonts<br />
git remote<br />
git remote -v<br />
git checkout upstream/master -b tmp<br />
git branch -D fix-fonts<br />
git checkout -b fix-fonts<br />
git branch -D tmp<br />
git log<br />
git cherry-pick 82583fc<br />
git cherry-pick 082e991<br />
git push origin fix-typos<br />
git push origin fix-fonts<br />
git checkout 40d886f9<br />
git checkout -b fix-issue-520<br />
git push origin fix-issue-520<br />
git checkout origin/master<br />
git checkout upstream/master<br />
git branch -D master<br />
git checkout -b master<br />
git push -f origin master<br />
</code><br />
Simple, isn&#8217;t it?</p>
<p>I <strong>really</strong> have to read (and understand) a book about git soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nulldevice.de/2011/05/git-a-hellish-nightmare/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Secrets of the JavaScript Ninja</title>
		<link>http://www.nulldevice.de/2011/03/secrets-of-the-javascript-ninja/</link>
		<comments>http://www.nulldevice.de/2011/03/secrets-of-the-javascript-ninja/#comments</comments>
		<pubDate>Mon, 28 Feb 2011 23:26:27 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.nulldevice.de/?p=1287</guid>
		<description><![CDATA[On http://www.manning.com/resig/resig_meapch1.pdf you find the first chapter of John Resigs new book &#8220;Secrets of the JavaScript Ninja&#8220;. From what I can see there, the book can be a useful reference, but it does not look like there are any actual secrets revealed. All the bread &#38; butter topics seem covered and John certainly understands JavaScript. I [...]]]></description>
			<content:encoded><![CDATA[<p>On <a href="http://www.manning.com/resig/resig_meapch1.pdf">http://www.manning.com/resig/resig_meapch1.pdf</a> you find the first chapter of John Resigs new book &#8220;<a href="http://www.amazon.de/Secrets-JavaScript-Ninja-John-Resig/dp/193398869X" target="_blank">Secrets of the JavaScript Ninja</a>&#8220;. From what I can see there, the book can be a useful reference, but it does not look like there are any actual secrets revealed. All the bread &amp; butter topics seem covered and John certainly understands JavaScript.</p>
<p>I think every experienced JavaScript developers agrees with his statement:</p>
<blockquote><p>Browser-based JavaScript development is much more complicated than it seems.</p></blockquote>
<p>Except that I don&#8217;t like the word &#8220;complicated&#8221;. When developers say something is complicated, it means they are too lazy to think about it and/or that they want somebody else to implement a feature. Instead I would say:</p>
<blockquote><p>Browser-based JavaScript development requires more attention to detail than usual server-side programming languages.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.nulldevice.de/2011/03/secrets-of-the-javascript-ninja/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Chaotic Pattern: Wiki is online</title>
		<link>http://www.nulldevice.de/2010/11/chaotic-pattern-wiki-is-online/</link>
		<comments>http://www.nulldevice.de/2010/11/chaotic-pattern-wiki-is-online/#comments</comments>
		<pubDate>Mon, 01 Nov 2010 21:06:45 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JavaScriptMVC]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.nulldevice.de/?p=1232</guid>
		<description><![CDATA[I recently managed to publish my latest project: chaoticpattern.net While reading the book Sync, I felt that this is the right name &#8211; an explanation can be found on the Web site. There is already some blog with the same name, but it does not seem to be very active. The last post is from May 2009. [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-medium wp-image-1235" title="Chaotic Pattern Screenshot" src="http://www.nulldevice.de/wp-content/uploads/2010/11/Screenshot-Chaotic-Pattern-Google-Chrome-500x470.png" alt="" width="300" height="282" /></p>
<p>I recently managed to publish my latest project:</p>
<p><a href="http://www.chaoticpattern.net/" target="_blank">chaoticpattern.net</a></p>
<p>While reading the book <a href="http://www.amazon.com/SYNC-Emerging-Science-Spontaneous-Order/dp/0786868449">Sync</a>, I felt that this is the right name &#8211; an explanation can be found on the Web site. There is already some blog with the same name, but it does not seem to be very active. The last post is from May 2009. Hope I don&#8217;t cause any confusion.</p>
<p>Chaotic Pattern will be used as an incubator/lab. The Wiki itself is the first in a series of experiments. It fits my personal needs as a publishing platform and is more convenient than any typical word processor out there. You can not only edit documents online, like in every other Wiki, but also produce wonderful PDFs and include content from Flickr, Youtube and Google Maps. If you like it, use it for free. There are no strings attached and I will not sell your documents or your Facebook profile <img src='http://www.nulldevice.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Also the Wiki is there to demonstrate what you can do with JavaScriptMVC 3.0 and a little bit of PHP. Theoretically, it should scale to billions of users. But as long as I don&#8217;t get any venture capital, we will never find out. Anyhow, I want people to use it as a prototype for their own apps. Until end of this year, everything should be properly documented and you can download some of the components.</p>
<p>The next step is to get the Ajax push server finally running, so that you can use the real time features. Ape is installed, but seems to cause connection problems under certain conditions. Either I can fix that with my limited resources or I have to switch to another server. It&#8217;s not like I don&#8217;t have anything else to do, so please be patient^^</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nulldevice.de/2010/11/chaotic-pattern-wiki-is-online/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The new Google JS search interface</title>
		<link>http://www.nulldevice.de/2010/09/the-new-google-js-search-interface/</link>
		<comments>http://www.nulldevice.de/2010/09/the-new-google-js-search-interface/#comments</comments>
		<pubDate>Thu, 09 Sep 2010 07:45:11 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.nulldevice.de/?p=1221</guid>
		<description><![CDATA[The engineers at Google are facing the same (concurrency) problems as every other Web developer. Such problems are hard to find with ordinary testing, that does not take small variations in timing into account. To produce this result, you just have to press the back button at the right time:]]></description>
			<content:encoded><![CDATA[<p>The engineers at Google are facing the same (concurrency) problems as every other Web developer. Such problems are hard to find with ordinary testing, that does not take small variations in timing into account. To produce this result, you just have to press the back button at the right time:</p>
<p><a href="http://www.nulldevice.de/wp-content/uploads/2010/09/google.png"><img class="alignnone size-medium wp-image-1222" title="JS powered Google search interface" src="http://www.nulldevice.de/wp-content/uploads/2010/09/google-500x478.png" alt="" width="500" height="478" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nulldevice.de/2010/09/the-new-google-js-search-interface/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to contribute to JavaScriptMVC 3.0</title>
		<link>http://www.nulldevice.de/2010/09/how-to-contribute-to-javascriptmvc-3-0/</link>
		<comments>http://www.nulldevice.de/2010/09/how-to-contribute-to-javascriptmvc-3-0/#comments</comments>
		<pubDate>Sat, 04 Sep 2010 12:25:33 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JavaScriptMVC]]></category>

		<guid isPermaLink="false">http://www.nulldevice.de/?p=1216</guid>
		<description><![CDATA[If you are reading this, I can safely assume you know what JavaScriptMVC (JMVC) is, what its features are, and what components it consists of, namely: FuncUnit (the test framework) DocumentJS (the documentation engine) jQuery (JavaScriptMVC uses a special fork with added bugfixes) JavaScriptMVC  (the core framework) Steal (the code manager / script loader; sometimes [...]]]></description>
			<content:encoded><![CDATA[<p>If you are reading this, I can safely assume you know what JavaScriptMVC (JMVC) is, what its features are, and what components it consists of, namely:</p>
<ul>
<li>FuncUnit (the test framework)</li>
<li>DocumentJS (the documentation engine)</li>
<li>jQuery (JavaScriptMVC uses a special fork with added bugfixes)</li>
<li>JavaScriptMVC  (the core framework)</li>
<li>Steal (the code manager / script loader; sometimes referred to as “StealJS”)</li>
<li>Phui  (component library for JavaScriptMVC, not part of the core)</li>
</ul>
<p>These partly independent components (together with Selenium) are bundled using git submodules (<a href="http://book.git-scm.com/5_submodules.html">http://book.git-scm.com/5_submodules.html</a>) in a repository called “framework” for your convenience:</p>
<p><a href="http://github.com/jupiterjs/framework">http://github.com/jupiterjs/framework</a></p>
<p>A detailed description of the components can be found on the Jupiter JS blog:</p>
<p><a href="http://jupiterjs.com/#news/javascriptmvc-features">http://jupiterjs.com/#news/javascriptmvc-features</a></p>
<h4>Release 2.0</h4>
<p>You should be aware that release 2.0 is still out there. Don’t get confused. It is hosted on Google Code at <a href="http://code.google.com/p/javascriptmvc/">http://code.google.com/p/javascriptmvc/</a> and uses Subversion instead of git. Don’t use the issue tracker there for bugs you find in 3.0.</p>
<p>The respective project Web sites are:</p>
<ul>
<li><a href="http://www.javascriptmvc.com/">http://www.javascriptmvc.com/</a> for 2.0</li>
<li><a href="http://v3.javascriptmvc.com/index.html%20for%203.0">http://v3.javascriptmvc.com/index.html</a> for 3.0</li>
</ul>
<h4>Ways to contribute</h4>
<p>There is a number of ways to contribute:</p>
<ol>
<li>You can fork the project repositories on github (<a href="http://github.com/jupiterjs/">http://github.com/jupiterjs/</a>) into your own repository and send a “pull request”, every time you want to submit changes (pull requests replace patches and preserve your authorship)</li>
<li>After contributing for a while, you can become a member of the JavaScriptMVC team and ask for direct write access to the project repositories</li>
<li>You can just checkout/download  the latest framework version and report bugs to the developers (<a href="http://github.com/jupiterjs/javascriptmvc/issues">http://github.com/jupiterjs/javascriptmvc/issues</a>) or answer questions on the mailing list (<a href="http://groups.google.com/group/javascriptmvc?hl=en">http://groups.google.com/group/javascriptmvc?hl=en</a>)</li>
</ol>
<h4>A few words about git</h4>
<p>In every case you should become more or less familiar with git (the distributed version control system) and github (the project hosting Web site).  The Git Community Book is a great reference: <a href="http://book.git-scm.com/index.html">http://book.git-scm.com/index.html</a>. If you are already familiar with Subversion, you might want to read the “Git &#8211; SVN Crash Course” (<a href="http://git.or.cz/course/svn.html">http://git.or.cz/course/svn.html</a>). The main idea of git is that everyone has its own repository (that’s why it’s called distributed). It allows everyone to contribute easily to Open Source projects and was initially designed and developed by Linus Torvalds for Linux kernel development.</p>
<p>In contrast to “normal” version control systems, a commit is happening on your local computer only. If you want to actually send your code to the server, you have to push it back to the remote repository. If this is not the main repository of the project but your own fork, you additionally have to send a “pull request” to the project owner (jupiterjs in that case). As a previous user of Subversion I found the whole process of checking out the source, committing my changes and pushing it back to the repository tremendously complicated, even though I understand the need for distributed version control. In part this is because git sometimes comes up with error messages that look pretty scary and that don’t help to understand the actual problem.</p>
<h4>Setup your github account</h4>
<p>After you created your free github account at <a href="http://github.com/">http://github.com/</a>, you need to go to the Account Settings page, click on “SSH Public Keys” in the left hand side navigation and then enter your public key. If you don’t have one yet, you open a text terminal on the local computer and enter:</p>
<blockquote><p>ssh-keygen -t rsa -C &#8220;youremail@address.com&#8221;</p></blockquote>
<p>There is a more detailed howto at <a href="http://help.github.com/msysgit-key-setup/">http://help.github.com/msysgit-key-setup/</a>.</p>
<p>If you run Windows, you are probably out of luck. Try to ask Google for assistance <img src='http://www.nulldevice.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Next step is to fork the repositories you want to work on. This process is pretty convenient – you simply click the fork button on the main repository page. The complete list is visible on:</p>
<p><a href="http://github.com/jupiterjs">http://github.com/jupiterjs</a></p>
<h4>Install Git and Java</h4>
<p>If not yet done, you should also install Git and Java on the local computer by using the package management software that comes with your Linux distribution. On Ubuntu you can use the “Synaptic Package Manager” for example. At least in the past, I had bad experiences with OpenJDK and Rhino (the engine that executes JMVC’s command line scripts), so I recommend installing the “original” Sun/Oracle Java version. The Selenium server also needs Java.</p>
<h4>Clone the repositories</h4>
<p>I recommend cloning (that means checkout) the “framework” repository as the first step. The build script in there allows creating the downloadable packages you see on <a href="http://github.com/jupiterjs/framework/downloads">http://github.com/jupiterjs/framework/downloads</a>. To do this, follow these 4 easy steps:</p>
<ol>
<li>Create an empty local directory that should contain all your github repositories and change into it</li>
<li>git clone git://github.com/jupiterjs/framework.git</li>
<li>git submodule init</li>
<li> git submodule update</li>
</ol>
<p>That’s it!</p>
<p>The procedure to clone your forked project repositories is similar. First you need the URL that you have to provide to Git.</p>
<p>Go to your Git home page ( <a href="http://github.com/%5busername%5d/">http://github.com/[username]/</a>) and then click on the forked respository, e.g. javascriptmvc. On the top you’ll see 3 different URLS:</p>
<ul>
<li>SSH with read and write access: This is what you want to use</li>
<li>HTTP: This is slower and offers read only access</li>
<li>Git Read-Only: Since we want to push (write) our changes to the server, this does not make sense</li>
</ul>
<p>Now simply clone it into your local github directory by typing:</p>
<p>git clone <a href="mailto:git@github.com:[username]/%5brepository%5d.git">git@github.com:[username]/[repository].git</a></p>
<h4>Push changes</h4>
<p>With Git, you can do as many commit as you want locally. Please note that the equivalent to “svn commit” is “git commit –a”. Please be nice and provide a commit message every time, for example:</p>
<blockquote><p>git commit -a &#8211;message &#8216;Changed github URLs from pinhook to jupiterjs&#8217;</p></blockquote>
<p>To see what would be commited or to see your changes since the last commit you can use “git status” and “git diff”.</p>
<p>After testing all your changes locally (this is probably worth another article, but I’m running out of time now), you are free to commit your changes to the remote repository:</p>
<blockquote><p>git push origin master</p></blockquote>
<p>You can also configure git to always push to the matching remote branch (there are other options as well, but I’m not that much into git to fully understand them, to be honest):</p>
<blockquote><p>git config push.default matching</p></blockquote>
<p>Next time you push something into that repository, it is enough to use “git push”.</p>
<p>As mentioned earlier, you have to do send a “pull request” (there is a nice button on github to do just that), if you want to send your changes from your fork to the original project repository.</p>
<h4>Pull changes for submodules</h4>
<p>In my naïve thinking, I assumed that Git will automatically update the submodule directories in the framework repository when you type “git submodule update”. This is not the case.</p>
<p>You have to manually pull the latest changes in each sub directory that contains a submodule like this:</p>
<blockquote><p>cd funcunit/</p>
<p>git checkout master (only required the first time)</p>
<p>git pull</p></blockquote>
<p>You will only get the changes in the submodules via “git pull” in the main framework directory if somebody with write access to framework does this “cd [submodule]; git pull” procedure locally and then pushes back to the repository on github:</p>
<p><a href="http://github.com/jupiterjs/framework/commit/1affd96d632b34621e9e0d06707ea83d1d4c3b9d">http://github.com/jupiterjs/framework/commit/1affd96d632b34621e9e0d06707ea83d1d4c3b9d</a></p>
<h4>Thanks</h4>
<p>Thanks for reading this. You see, I’m not a Git expert yet and I really hope I didn’t give any bad advice concerning its usage. As I improve my knowledge and find best practices how to do things most efficiently, I will update this page or post a follow-up. Especially testing is not covered in this article, which is a shame.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nulldevice.de/2010/09/how-to-contribute-to-javascriptmvc-3-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ape: Ajax Push Engine</title>
		<link>http://www.nulldevice.de/2010/09/ape-ajax-push-engine/</link>
		<comments>http://www.nulldevice.de/2010/09/ape-ajax-push-engine/#comments</comments>
		<pubDate>Fri, 03 Sep 2010 20:20:41 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.nulldevice.de/?p=1196</guid>
		<description><![CDATA[Let me say a few words about Ape, an Ajax push server I came across this week: http://www.ape-project.org/ Even though the authors say it&#8217;s a stable 1.0 release and &#8220;insanely great&#8221;, there are some issues you should be aware of. I write this in the hope that it helps others to evaluate the server and to give [...]]]></description>
			<content:encoded><![CDATA[<p>Let me say a few words about <strong>Ape</strong>, an Ajax push server I came across this week:</p>
<p><a href="http://www.ape-project.org/">http://www.ape-project.org/</a></p>
<p>Even though the authors say it&#8217;s a stable 1.0 release and &#8220;insanely great&#8221;, there are some issues you should be aware of. I write this in the hope that it helps others to evaluate the server and to give feedback to the developers. The general idea of combining fast C code with JavaScript is very good. It&#8217;s still a young Open Source project and has a lot of potential.</p>
<h4>Incomplete documentation</h4>
<p>It turned out to be a little bit challenging to develop code for Ape because of the quality of the documentation. There is an API documentation (which is not good for new users) and there is a Wiki with some links leading to missing pages. Most of the examples deal with how to implement a chat server. In fact Ape was previously named ACE (Ajax Chat Engine). It&#8217;s sometimes hard to understand how to use it for a general purpose application and what the limits are.</p>
<h4>Maximum length of channel names</h4>
<p>One of these limitations is the maximum length of 40 characters for channel names. In my library I use channel names like &#8216;foo.bar.baz&#8217; that can be easily published with OpenAjax on the JavaScript side. Some of these events never arrived nor did the subscribe function throw an exception.</p>
<h4>Nickname required to connect to server</h4>
<p>At first it seemed like the server requires a nickname to connect, which makes sense for chat applications only. Not every Web site out there should ask the user to enter his nickname, right? After investigating the issue (I didn&#8217;t find a hint in the documentation), I found out that an example server-side script in <em>/var/ape/examples</em> was causing this behavior. You can comment out this line in <em>main.ape.js</em> to &#8220;fix&#8221; it:</p>
<blockquote><p>include(&#8220;examples/nickname.js&#8221;);</p></blockquote>
<h4>Error when sending messages to empty channels</h4>
<p>If you happen to send a message to a channel that is currently not subscribed (Ape calls it &#8220;joined&#8221;, like in a chat software), you&#8217;ll get an error. This behavior is strange, if you are used to other message servers that just accept the message, even if nobody will ever get it. If you know this can happen, it&#8217;s not so much of an issue anymore.</p>
<h4>Complicated domain name setup</h4>
<p>Ape uses sub domains in the form of [Number].ape. to communicate with the JavaScript client. Each connect increases the number (which is stored in a cookie) by one. They call the numbers &#8220;frequencies&#8221;. According to the documentation, this concept should provide sessions within a session, if you open multiple tabs in the same browser. I&#8217;ve never seen something like that before. I disabled the feature by modifying their code and tracking the different tabs on the server side. My code will be published later, so you can copy this, if you like. Another problem with the changing domain names is that you have a hard time to set this up locally in /etc/hosts &#8211; there is no support for wildcards.</p>
<h4>Config directly inside the JavaScript library</h4>
<p>I found it really strange to configure the Ape server URL directly in <em>Build/uncompressed/apeClientJS.js</em>. If you ever update this file, your config will be overwritten. Why not provide the config as a parameter to the load() or constructor function? Again, I modified the code.</p>
<h4>Based on MooTools</h4>
<p>There are two versions of the client library, one for MooTools and one for other JavaScript frameworks, which includes MooTools. I did not find out yet, why you need MooTools to write an Ajax push library for general usage. I also did not investigate how many files are loaded additionally when the Ape library is included. My feeling tells me, that this whole thing can be improved and that the library should be compressed and put in one single file.</p>
<h4>No standard protocols</h4>
<p>Even though it probably is possible to connect Ape to a general usage message server (like <a href="http://activemq.apache.org/">ActiveMQ</a> or <a href="http://www.rabbitmq.com/">RabbitMQ</a>) with some additional work, it does not offer a standard STOMP or AMQP interface by default. The Web site states that the Ape protocol is faster than everything else. So far, I was not able to confirm or reject that claim <img src='http://www.nulldevice.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<h4>JavaScript on the server side</h4>
<p>It is convenient to be able to use JavaScript on the server side. Just let me note that this can lead to previously unexpected errors. JavaScript is a loosely typed language and if you happen to return a number instead of a string as nickname to the server, you will see this exception:</p>
<blockquote><p>/var/ape/examples/nickname.js:6:TypeError: params.name.toLowerCase is not a function</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.nulldevice.de/2010/09/ape-ajax-push-engine/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>It&#8217;s really hard to talk about JavaScript best practices and JMVC</title>
		<link>http://www.nulldevice.de/2010/07/its-really-hard-to-talk-about-javascript-best-practices-and-jmvc/</link>
		<comments>http://www.nulldevice.de/2010/07/its-really-hard-to-talk-about-javascript-best-practices-and-jmvc/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 09:36:32 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JavaScriptMVC]]></category>
		<category><![CDATA[OpenAjax]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.nulldevice.de/?p=1136</guid>
		<description><![CDATA[I was totally enthusiastic, when I first learned about JavaScriptMVC &#8211; because it brings all the best practices you are accustomed to into the JavaScript world. That means the MVC architecture, Object-oriented development with simulated inheritance, EJS templates, easy testing, OpenAjax support, powerful event delegation and so on. However, I often have a hard time to [...]]]></description>
			<content:encoded><![CDATA[<p>I was totally enthusiastic, when I first learned about JavaScriptMVC &#8211; because it brings all the best practices you are accustomed to into the JavaScript world. That means the MVC architecture, Object-oriented development with simulated inheritance, EJS templates, easy testing, OpenAjax support, powerful event delegation and so on.</p>
<p>However, I often have a hard time to convince other developers about those advantages. I guess <strong>testing </strong>is the easiest one, because no developer would dare to argue against testing, even though many developers don&#8217;t do it or don&#8217;t do it right. Questions and discussions about testing seem to be very rare. Developers just discuss it with their non-technical managers, if they want to get around that &#8220;effort&#8221;.</p>
<p>But it already starts with <strong>OpenAjax</strong>. I rarely find a developer that knows what it is and what it is good for and why you might need an event hub in JS at all. Zend, W3C, IBM and Google are some of the more well-known members of the OpenAjax Alliance. If you hear about it the first time now, take the time to have a look.</p>
<p>Just yesterday I was talking to an obviously experienced JS dev (who was working for a well known mobile phone company), that was browsing through the JavaScriptMVC documentation and stopped in the chapter about <strong>EJS templates</strong>: &#8220;Yeah, I saw something similar in our own project and removed it. It is confusing, if the JS code and the HTML are in separate files, because you don&#8217;t see the code together in one file. HTML should only be edited by developers who know the JS code very well&#8221;. Not sure what to say about that. Why not give up separation of concerns at all and put everything in one big file? Then you see the big picture on your hopefully big screen. Also you always need to check the full version control system diff after each change because the file name alone doesn&#8217;t tell you what was changed and you probably have more of those exciting conflicts to resolve. And: You REALLY need to be an expert to understand what is going on. The company can never fire you, because no one else would ever understand that kind of code. Sorry for being sarcastic, but that kind of attitude can seriously damage the health of innocent other people who need to clean up the mess in 20h work days afterwards, to meet the deadline of the project. Or the project is so small that it doesn&#8217;t matter. Or the company you work for can afford to pay a lot of developers who have the time to maintain a JS app without templates.</p>
<p>Convincing people about the usefulness of <strong>controllers </strong>is not easy too. Either you start showing an OpenAjax subscribe action &#8211; then the developer most likely won&#8217;t understand what that is good for (see above). Or you talk about <strong>event delegation</strong>, then the developer will point to jQuery&#8217;s live() method, which does event delegation too. In fact, JavaScriptMVC&#8217;s event delegation used to be one of the strong points and I admit that I am not totally up to date with the whole <a href="http://groups.google.com/group/jquery-dev/browse_thread/thread/e3bb36f8a9dae2b5/7e3bc980cd327a74">discussion</a> right now, because I was busy with a PHP project during the last 6 months. I know Justin Meyer is/was working on the controller code so that it makes more use of jQuery, he contributes code to jQuery and he is in contact with John Resig. Anyways, the whole point about controllers again is <a href="http://en.wikipedia.org/wiki/Separation_of_concerns">separation of concerns</a> and not so much the technical details behind the scenes. The JavaScript world is moving very fast and implementation details change a lot, but separation of concerns is not really something that you can look at as something you probably don&#8217;t need. The JS world sometimes feels like the PHP world about 10 years ago.</p>
<p>Ok, after getting rid of those thoughts, I will return to work now. The next 2 weeks will be quite relaxed with very little work. So maybe, I can read through the new JavaScriptMVC code and update my knowledge. It really feels uncomfortable not the be able to answer questions in detail. Also I start confusing PHP and JS syntax *lol*</p>
<p>See also: <a href="http://jupiterjs.com/news/talkin-javascriptmvc-is-hard">http://jupiterjs.com/news/talkin-javascriptmvc-is-hard</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nulldevice.de/2010/07/its-really-hard-to-talk-about-javascript-best-practices-and-jmvc/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Chrome Bug Tester</title>
		<link>http://www.nulldevice.de/2009/09/chrome-bug-tester/</link>
		<comments>http://www.nulldevice.de/2009/09/chrome-bug-tester/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 16:06:50 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Chrome]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.nulldevice.de/?p=1027</guid>
		<description><![CDATA[What these tests do, is basically constructing Arrays and one Object (in the last test), and then output the data using a &#8220;for(var i in array)&#8221; loop. All browsers do handle objects and arrays as expected and return the data in the original order, just Google Chrome fails. That means there is no way to [...]]]></description>
			<content:encoded><![CDATA[<p>What these tests do, is basically constructing Arrays and one Object (in the last test), and then output the data using a &#8220;for(var i in array)&#8221; loop. All browsers do handle objects and arrays as expected and return the data in the original order, just Google Chrome fails. That means there is no way to store data in a certain order in Chrome, if you don&#8217;t want to loop over it with &#8220;for(var i = 0; i < array.length; i++)", which can result in significant code and/or processing overhead for a number of reasons.</p>
<p>If all tests are green, they passed. Red results indicate failures:</p>
<p><iframe src="/js/chrome.html" width="250" height="380"</iframe></p>
<p>Especially this comment in JavaScriptCore (Apple Safari), indicates that all browsers should preserve the order of data, as this is a de-facto standard:</p>
<p>// lastIndexUsed is an ever-increasing index used to identify the order items<br />
// were inserted into the property map. It&#8217;s required that getEnumerablePropertyNames<br />
// return the properties in the order they were added for compatibility with other<br />
// browsers&#8217; JavaScript implementations.</p>
<p>The ultimate reason behind the behavior of Chrome seems to be that a NumberDictionary is used for certain array/object keys and a StringDictionary for others (handles.cc line 554):<br />
// Compute the element keys.<br />
element_keys = Factory::NewFixedArray(current->NumberOfEnumElements());<br />
current->GetEnumElementKeys(*element_keys);<br />
content = UnionOfKeys(content, element_keys);<br />
content = UnionOfKeys(content, GetEnumPropertyKeys(current));</p>
<p>Also the many type casts do look scary to me =)</p>
<p>Sure you could use non-numeric attributes only, but those are normally part of the inline cache. To cache offsets of arbitrary arrays does not make a lot of sense. The JavaScriptCode devs recognized just that and made it right.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nulldevice.de/2009/09/chrome-bug-tester/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Object property ordering in Google Chrome</title>
		<link>http://www.nulldevice.de/2009/09/object-property-ordering-in-google-chrome/</link>
		<comments>http://www.nulldevice.de/2009/09/object-property-ordering-in-google-chrome/#comments</comments>
		<pubDate>Sun, 06 Sep 2009 22:26:37 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Chrome]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Safari]]></category>

		<guid isPermaLink="false">http://www.nulldevice.de/?p=1021</guid>
		<description><![CDATA[Today, I prepared for the upcoming PHP/JS conferences and had a look at the mysterious bug #883 of Google Chrome and those related to it. Also I read though SquirrelFish source, which is used by Safari 4. The reason for the odd behavior of Chrome seems to be a if/else construct that is repeated throughout [...]]]></description>
			<content:encoded><![CDATA[<p>Today, I prepared for the upcoming PHP/JS conferences and had a look at the mysterious bug #883 of Google Chrome and those related to it. Also I read though SquirrelFish source, which is used by Safari 4.</p>
<p>The reason for the odd behavior of Chrome seems to be a if/else construct that is repeated throughout the source of runtime.cc:</p>
<p><code><br />
// Check if the name is trivially convertible to an index and get<br />
// the element if so.<br />
if (name-&gt;AsArrayIndex(&amp;index)) {<br />
  return GetElementOrCharAt(object, index);<br />
} else {<br />
  PropertyAttributes attr;<br />
  return object-&gt;GetProperty(*name, &amp;attr);<br />
}<br />
</code></p>
<p>Chrome makes a difference between properties and elements. And they do weird type casts. If you check JavaScriptCore, you see there is a better way:<br />
<code><br />
inline JSValue JSObject::get(ExecState* exec, const Identifier&amp; propertyName) const<br />
{<br />
  PropertySlot slot(this);<br />
  if (const_cast(this)-&gt;getPropertySlot(exec, propertyName, slot))<br />
    return slot.getValue(exec, propertyName);<br />
  return jsUndefined();<br />
}<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nulldevice.de/2009/09/object-property-ordering-in-google-chrome/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

