<?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>NIX/WIN/WEB</title>
	<atom:link href="http://www.formboss.net/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.formboss.net/blog</link>
	<description>Modern Web Application Development</description>
	<lastBuildDate>Mon, 16 Apr 2012 08:05:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>PHP Extension Maker &#8211; PHP Extension Creation UI</title>
		<link>http://www.formboss.net/blog/2012/04/php-extension-maker-php-extension-creation-ui/</link>
		<comments>http://www.formboss.net/blog/2012/04/php-extension-maker-php-extension-creation-ui/#comments</comments>
		<pubDate>Mon, 16 Apr 2012 07:57:57 +0000</pubDate>
		<dc:creator>grdinic</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Qt]]></category>
		<category><![CDATA[Extension]]></category>
		<category><![CDATA[PHP Extension Maker]]></category>
		<category><![CDATA[PHP xtension]]></category>

		<guid isPermaLink="false">http://www.formboss.net/blog/?p=1648</guid>
		<description><![CDATA[Here&#8217;s a little something I&#8217;ve been working on called PHP Extension Maker: PHP Extension Maker is a desktop application made for the express purpose of building PHP extensions. As anyone who&#8217;s done so can attest to, while not the most complicated process extension creation would benefit hugely from a decent UI. I&#8217;m posting this today [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a little something I&#8217;ve been working on called <strong>PHP Extension Maker</strong>:</p>
<p><a href="http://www.formboss.net/blog/2012/04/php-extension-maker-php-extension-creation-ui/php-extension-maker/" rel="attachment wp-att-1649"><img class="alignnone size-medium wp-image-1649" title="php-extension-maker" src="http://www.formboss.net/blog/wp-content/uploads/2012/04/php-extension-maker-300x193.gif" alt="" width="300" height="193" /></a></p>
<p>PHP Extension Maker is a desktop application made for the express purpose of building PHP extensions.</p>
<p>As anyone who&#8217;s done so can attest to, while not the most complicated process extension creation would benefit hugely from a decent UI.</p>
<p>I&#8217;m posting this today to say what&#8217; done so far, what&#8217;s planned, and if you have any ideas or suggestions to let me know : )</p>
<h2>Core</h2>
<p>The basic functionality already done is selecting an extension folder and loading that extensions c, h w32, and m4 files into a visual editor. We create a list of all <strong>PHP_FUNCTION</strong> entries defined in that extension and provide one-click access to that item in the editor.</p>
<p>When done writing code we have a simple (read, zero config) <em>click to compile</em> feature that takes your current PHP dev environment and completely automates the build process. Output from this process is of course shown in a debug window. Right now Windows nmake is done, with full support for Linux planned in the same executable.</p>
<p>Moving forward then I have to implement:</p>
<ul>
<li>The creation of new extensions using a Wizard</li>
<li>Populate ini entries, ARG_INFO, and other PHP structures and provide one-click access to that item in the editor.</li>
<li>Create helper logic for easy PHP_FUNCTION creation.</li>
<li>More features for the code editor (line numbers, auto-complete, etc)</li>
<li>Live command line for testing out our compiled extension functions right within the editor.</li>
<li>etc : )</li>
</ul>
<p>It&#8217;s a load of work but I&#8217;m excited about the finished product. PHP is my language of choice and having a tool for extension creation can only make it better by opening it up to a wider audience.</p>
<p>As noted above if you have any suggestions or comments please let me know!</p>
<p>Finally, this will be a free, fully open source project when done : )</p>
]]></content:encoded>
			<wfw:commentRss>http://www.formboss.net/blog/2012/04/php-extension-maker-php-extension-creation-ui/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Assembly Optimizations</title>
		<link>http://www.formboss.net/blog/2012/04/php-assembly-optimizations/</link>
		<comments>http://www.formboss.net/blog/2012/04/php-assembly-optimizations/#comments</comments>
		<pubDate>Mon, 02 Apr 2012 08:53:20 +0000</pubDate>
		<dc:creator>grdinic</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP Assembly]]></category>

		<guid isPermaLink="false">http://www.formboss.net/blog/?p=1638</guid>
		<description><![CDATA[Consider the following user-space PHP code: As the comment states this code will trigger the Zend Engine to call a &#8220;fast&#8221; add operation (fast_add_function()) defined in Zend/zend_operators.h. The code includes the following bit of inline assembly, which if nothing else shows how to code defensively while using inline assembly (the overflow condition), as well as [...]]]></description>
			<content:encoded><![CDATA[<p>Consider the following user-space PHP code:</p>
<pre class="brush: php; title: ; notranslate">
$a = 1;
$b = 2;

// calls fast_add_function() from Zend/zend_operators.h
$c = $a + $b;
</pre>
<p>As the comment states this code will trigger the Zend Engine to call a &#8220;fast&#8221; add operation (fast_add_function()) defined in Zend/zend_operators.h. </p>
<p>The code includes the following bit of inline assembly, which if nothing else shows how to code defensively while using inline assembly (the overflow condition), as well as how to use jump operations to skip to the end of a function block:</p>
<pre class="brush: plain; title: ; notranslate">
#elif defined(__GNUC__) &amp;&amp; defined(__x86_64__)
		__asm__(
			&quot;movq	(%1), %%rax\n\t&quot;
			&quot;addq   (%2), %%rax\n\t&quot;
			&quot;jo     0f\n\t&quot;
			&quot;movq   %%rax, (%0)\n\t&quot;
			&quot;movb   $0x1,0x14(%0)\n\t&quot;
			&quot;jmp    1f\n&quot;
			&quot;0:\n\t&quot;
			&quot;fildq	(%1)\n\t&quot;
			&quot;fildq	(%2)\n\t&quot;
			&quot;faddp	%%st, %%st(1)\n\t&quot;
			&quot;movb   $0x2,0x14(%0)\n\t&quot;
			&quot;fstpl	(%0)\n&quot;
			&quot;1:&quot;
			:
			: &quot;r&quot;(result),
			  &quot;r&quot;(op1),
			  &quot;r&quot;(op2)
			: &quot;rax&quot;);
#else
</pre>
<p>The function block that contains this code takes three zvals* as parameters, structs whose first member is a pointer to the zvalue_value&#8217;s used as op1, opt2, and result.</p>
<p>We attempt an addq and if we overflow, issue a Jump Overflow (jo) to the 0 label which calls two floating point load quad (fildq) for our parameters followed by an faddp. </p>
<p>The movb call modifies the result zval structure&#8217;s <strong>type </strong>property to be 1, which (I assume) means a data type of long. </p>
<p>The point is sure PHP is a managed language, but its C roots means we can jump into assembly when possible for maximum performance. Their are several other &#8220;fast&#8221; methods defined in Zend/zend_operators.h, most for optimizing simple a and b type operations. A possible takeaway may be to try and code for these &#8220;free&#8221; optimizations by grouping add operations into blocks of two. </p>
<p>What&#8217;s more interesting to me though is an idea I&#8217;ve had for a while now, which is to create an extension that allows us to create assembly code by hand and use it <em>inline in our PHP code</em>. Seeing how we populate and work with zvals here seems pretty strait forward so long as the Zend Engine handles the memory bits, perhaps the extension would work much like GNU assembly in that we would link PHP vars as parameters to the assembly block. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.formboss.net/blog/2012/04/php-assembly-optimizations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My Non-Achievement Achievement</title>
		<link>http://www.formboss.net/blog/2012/03/my-non-achievement-achievement/</link>
		<comments>http://www.formboss.net/blog/2012/03/my-non-achievement-achievement/#comments</comments>
		<pubDate>Fri, 09 Mar 2012 03:09:23 +0000</pubDate>
		<dc:creator>grdinic</dc:creator>
				<category><![CDATA[Fitness]]></category>

		<guid isPermaLink="false">http://www.formboss.net/blog/?p=1619</guid>
		<description><![CDATA[So close now&#8230; Just a few more steps&#8230; Hooray! I did it. That&#8217;s 1,000,000 steps according to my iPod Nano. What an accomplishment! Over 165 hours of walking burning over 61000 calories in the process&#8230; Hmmm. So why don&#8217;t I feel anything? Where&#8217;s the elation and festivity? Ah yes I know, it&#8217;s because I started [...]]]></description>
			<content:encoded><![CDATA[<p>So close now&#8230;</p>
<p><a href="http://www.formboss.net/blog/2012/03/my-non-achievement-achievement/attachment/999998/" rel="attachment wp-att-1624"><img class="alignnone size-full wp-image-1624" title="999998" src="http://www.formboss.net/blog/wp-content/uploads/2012/03/999998.jpg" alt="" width="640" height="480" /></a></p>
<p>Just a few more steps&#8230;</p>
<p><a href="http://www.formboss.net/blog/2012/03/my-non-achievement-achievement/1000004-2/" rel="attachment wp-att-1626"><img class="alignnone size-full wp-image-1626" title="1000004" src="http://www.formboss.net/blog/wp-content/uploads/2012/03/10000041.jpg" alt="" width="640" height="480" /></a></p>
<p>Hooray! I did it. That&#8217;s 1,000,000 steps according to my iPod Nano.</p>
<p>What an accomplishment! Over 165 hours of walking burning over 61000 calories in the process&#8230;</p>
<p>Hmmm. So why don&#8217;t I feel anything? Where&#8217;s the elation and festivity?</p>
<p>Ah yes I know, it&#8217;s because I started tracking this at the <em>end</em> of October 2011. Yup, in only 5 months I&#8217;ve somehow managed to walk one million steps, outdoors, in winter, in Wisconsin. How is this even possible?</p>
<p>As a wee-pup I used to think one million was unfathomably large. An unobtainable amount of anything, be it money, toys, or whatever. And yet a few weeks ago while waiting in line for something or another I glanced down at my iPod to see 800,000 of something. I had not seen that stat before, and was dumbfounded when I saw what it was. 800,000 steps? Really? Doing the math I realized I&#8217;ll hit 1 million in less than 3 weeks.</p>
<p>If this had taken me a decade sure, that&#8217;s fine. But at 11,000 steps a day (a 2 hour walk) I&#8217;d hit that magical number in no time. The child in me resisted: 1 million is <em>not</em> supposed to happen that quickly, and yet here it was just a few weeks away &#8212; from walking no less. Not the fastest way to rack up a million of anything.</p>
<p>We live in a magical world where the intensely large and unfathomably small are commonplace &#8212; Our CPU&#8217;s tick over billions of times a second and we can image individual atoms. Yet one million steps in such a short time has always been with us. From 50,000 years ago to just now. Turns out one million isn&#8217;t that much, I simply made it so as a child.</p>
<p>What other false barriers and preconceptions do I have yet to break down?</p>
<p>Two million steps, here I come : )</p>
]]></content:encoded>
			<wfw:commentRss>http://www.formboss.net/blog/2012/03/my-non-achievement-achievement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Two Things I Want Windows 8 To Get Right</title>
		<link>http://www.formboss.net/blog/2012/03/two-things-i-want-windows-8-to-get-right/</link>
		<comments>http://www.formboss.net/blog/2012/03/two-things-i-want-windows-8-to-get-right/#comments</comments>
		<pubDate>Fri, 02 Mar 2012 08:22:17 +0000</pubDate>
		<dc:creator>grdinic</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.formboss.net/blog/?p=1605</guid>
		<description><![CDATA[For all the upheaval concerning the Metro UI in Windows 8 I find it to be a non-issue. I don&#8217;t use the start menu anymore anyway, and so long as I have my taskbar I&#8217;m happy. But there are two changes I simply must have for me to even consider abandoning Windows 7: 1) Smart [...]]]></description>
			<content:encoded><![CDATA[<p>For all the upheaval concerning the Metro UI in Windows 8 I find it to be a non-issue. I don&#8217;t use the start menu anymore anyway, and so long as I have my taskbar I&#8217;m happy.</p>
<p>But there are two changes I simply must have for me to even consider abandoning Windows 7:</p>
<p>1) <strong>Smart Window Focus</strong> &#8211; For years now in OSX you can drag objects (files, folders, etc) from one window and when you hit a second window, that window will pop to the foreground after a set time. This is a smart and beautiful way to maximize space and make file move operations much faster and more intuitive. No version of Windows has ever had this, and its MIA status in Windows 8 thus far is a real shame.</p>
<p>2) <strong>Control over task bar preview size</strong> &#8211; Mouse over an item in the task bar and a preview appears. It&#8217;s a good idea spoiled by the preview item being more of a postage stamp than a usable object. Sure you can change this size in the Registry, but why so much work? Moreover this should be a &#8220;smart&#8221; feature anyway, with the size of the thumbnails changing intelligently to make the best use of the space they have.</p>
<p><strong>Bonus Feature</strong>: Okay here&#8217;s one more, also from OSX &#8211; If you <strong>hold the Control key down</strong> and click on a folder in Windows nothing happens. <em>Double click</em> the folder and sometimes &#8212; but not always &#8212; that folder will open in a new window. I love that kind of stuff but it&#8217;s still inconsistent and buggy in Win 8.</p>
<p>What I&#8217;m saying is what a treat it would be if the changes made in Win 8 would not just stop at  Explorer ribbons and better file copy features, but real, usable shortcuts and time-savers for us working folk.</p>
<p>&nbsp;</p>
<p>What would you like to see in Windows 8?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.formboss.net/blog/2012/03/two-things-i-want-windows-8-to-get-right/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Now What Do We Have Here? ส็็็็็็็็็็็็็็็็็็็</title>
		<link>http://www.formboss.net/blog/2012/02/now-what-do-we-have-here/</link>
		<comments>http://www.formboss.net/blog/2012/02/now-what-do-we-have-here/#comments</comments>
		<pubDate>Wed, 22 Feb 2012 04:12:02 +0000</pubDate>
		<dc:creator>grdinic</dc:creator>
				<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.formboss.net/blog/?p=1580</guid>
		<description><![CDATA[Via Reddit I jumped to this video on YouTube, where we have this comment: That&#8217;s&#8230;odd I thought. In Firebug it gets stranger: And in Qt Creator in text mode, stranger still: So what is it? In Word or Notepad the vertical extension seems to be limited to one line regardless of text size: Which means [...]]]></description>
			<content:encoded><![CDATA[<p>Via Reddit I jumped to <a title="YouTube F18 Video" href="http://www.youtube.com/watch?v=-1ywUmBpVGY&amp;feature=youtu.be" target="_blank">this video</a> on YouTube, where we have this comment:</p>
<p><a href="http://www.formboss.net/blog/2012/02/now-what-do-we-have-here/comment/" rel="attachment wp-att-1581"><img title="comment" src="http://www.formboss.net/blog/wp-content/uploads/2012/02/comment.gif" alt="" width="667" height="196" /></a></p>
<p>That&#8217;s&#8230;odd I thought.</p>
<p>In Firebug it gets stranger:</p>
<p><a href="http://www.formboss.net/blog/2012/02/now-what-do-we-have-here/comment-firebug/" rel="attachment wp-att-1582"><img class="alignnone size-full wp-image-1582" title="comment-firebug" src="http://www.formboss.net/blog/wp-content/uploads/2012/02/comment-firebug.gif" alt="" width="519" height="108" /></a></p>
<p>And in Qt Creator in text mode, stranger still:</p>
<p><a href="http://www.formboss.net/blog/2012/02/now-what-do-we-have-here/comment-qt-creator/" rel="attachment wp-att-1584"><img class="alignnone size-full wp-image-1584" title="comment-qt-creator" src="http://www.formboss.net/blog/wp-content/uploads/2012/02/comment-qt-creator.gif" alt="" width="241" height="213" /></a></p>
<p>So what is it? In Word or Notepad the vertical extension seems to be limited to one line regardless of text size:</p>
<p><a href="http://www.formboss.net/blog/2012/02/now-what-do-we-have-here/comment-notepad-2/" rel="attachment wp-att-1585"><img class="alignnone size-full wp-image-1585" title="comment-notepad" src="http://www.formboss.net/blog/wp-content/uploads/2012/02/comment-notepad1.gif" alt="" width="581" height="79" /></a></p>
<p>Which means content in the middle of this stream would be obfuscated from normal view.</p>
<p>My first thought is Unicode, though the nature of how the characters stack atop each other makes it very difficult to select them.</p>
<p>Thus, the best way too see which characters we&#8217;re dealing with is in a binary or hex editor, in my case that means Qt Creator via:</p>
<p><a href="http://www.formboss.net/blog/2012/02/now-what-do-we-have-here/qt-open-with/" rel="attachment wp-att-1586"><img class="alignnone size-full wp-image-1586" title="qt-open-with" src="http://www.formboss.net/blog/wp-content/uploads/2012/02/qt-open-with.gif" alt="" width="289" height="120" /></a></p>
<p>Followed by selecting <strong>Core.BinaryEditor</strong>:</p>
<p><a href="http://www.formboss.net/blog/2012/02/now-what-do-we-have-here/qt-open-with-filter/" rel="attachment wp-att-1592"><img class="alignnone size-full wp-image-1592" title="qt-open-with-filter" src="http://www.formboss.net/blog/wp-content/uploads/2012/02/qt-open-with-filter.gif" alt="" width="399" height="260" /></a></p>
<p>When opened then we see this:</p>
<p><a href="http://www.formboss.net/blog/2012/02/now-what-do-we-have-here/qt-binary-content/" rel="attachment wp-att-1587"><img class="alignnone size-full wp-image-1587" title="qt-binary-content" src="http://www.formboss.net/blog/wp-content/uploads/2012/02/qt-binary-content.gif" alt="" width="656" height="163" /></a></p>
<p>So a good place to start would be to Google Unicode 0e47. The only problem is we don&#8217;t get a match. Lets try Unicode 2a0e. Nada.</p>
<p>Ah, but that&#8217;s right, Windows is Little Endian, which means we should actually be looking for <a title="MAITAIKHU" href="http://www.fileformat.info/info/unicode/char/e47/index.htm" target="_blank">470e</a> and <a title="SO SUA" href="http://www.fileformat.info/info/unicode/char/e2a/index.htm" target="_blank">0e2a</a>.</p>
<p>Now we&#8217;re getting somewhere. Using little endian Unicode encoding I can recreate the first two characters, but no more than that.</p>
<p>That is, in Notepad we add 0e2a for:</p>
<p><a href="http://www.formboss.net/blog/2012/02/now-what-do-we-have-here/test-1/" rel="attachment wp-att-1588"><img class="alignnone size-full wp-image-1588" title="test-1" src="http://www.formboss.net/blog/wp-content/uploads/2012/02/test-1.gif" alt="" width="244" height="124" /></a></p>
<p>and then 470e for:</p>
<p><a href="http://www.formboss.net/blog/2012/02/now-what-do-we-have-here/test-2/" rel="attachment wp-att-1589"><img class="alignnone size-full wp-image-1589" title="test-2" src="http://www.formboss.net/blog/wp-content/uploads/2012/02/test-2.gif" alt="" width="312" height="112" /></a></p>
<p>Which as we can see places the second character above the first. Though subsequent paste operations fail to add more 470e characters, as we can see in Binary Mode:</p>
<p><a href="http://www.formboss.net/blog/2012/02/now-what-do-we-have-here/test-3/" rel="attachment wp-att-1590"><img class="alignnone size-full wp-image-1590" title="test-3" src="http://www.formboss.net/blog/wp-content/uploads/2012/02/test-3.gif" alt="" width="377" height="180" /></a></p>
<p>However, in Firebug we can add as many 470e&#8217;s as we want using the code editor:</p>
<p><a href="http://www.formboss.net/blog/2012/02/now-what-do-we-have-here/test-4/" rel="attachment wp-att-1591"><img class="alignnone size-full wp-image-1591" title="test-4" src="http://www.formboss.net/blog/wp-content/uploads/2012/02/test-4.gif" alt="" width="417" height="363" /></a></p>
<p>Which means to apply this &#8216;hack&#8217; we simply need a copy/pasted character and Firebug.</p>
<p>The issue then seems to be that, from my testing anyway, any Thai character proceeded by an oe2a will get placed <em>above</em> the 0e2a. Conversely, 0e47 followed by 0e2a doesn&#8217;t place the 0e2a above the 470e. Of course their could be other vulnerable characters as well, and programs such as Word and Notepad restrict the display to one line only. InDesign doesn&#8217;t seem to recognize the Unicode characters at all.</p>
<p>The issue however, is that as the Web <em>does</em> respect this scheme I&#8217;d expect to see many annoying comments in the near future as others learn this new trick.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.formboss.net/blog/2012/02/now-what-do-we-have-here/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C++ extern, QSemaphore, And Circular Buffers</title>
		<link>http://www.formboss.net/blog/2012/02/c-extern-qsemaphore-and-circular-buffers/</link>
		<comments>http://www.formboss.net/blog/2012/02/c-extern-qsemaphore-and-circular-buffers/#comments</comments>
		<pubDate>Tue, 07 Feb 2012 04:29:00 +0000</pubDate>
		<dc:creator>grdinic</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Qt]]></category>
		<category><![CDATA[C+= extern]]></category>
		<category><![CDATA[Circular Buffer]]></category>
		<category><![CDATA[Coin Flip Simulation]]></category>
		<category><![CDATA[Producer Consumer]]></category>
		<category><![CDATA[QSemaphore]]></category>

		<guid isPermaLink="false">http://www.formboss.net/blog/?p=1560</guid>
		<description><![CDATA[In this post I share a few hints about QSemaphore, the C++ extern Keyword, and creating circular buffers for 2 threads in the producer/consumer model. The Overall Project So the overall project I&#8217;m working on is to create a coin flipping simulation to see how many flips it would take to reach n consecutive results [...]]]></description>
			<content:encoded><![CDATA[<p>In this post I share a few hints about QSemaphore, the C++ extern Keyword, and creating circular buffers for 2 threads in the producer/consumer model.</p>
<h2>The Overall Project</h2>
<p>So the overall project I&#8217;m working on is to create a coin flipping simulation to see how many flips it would take to reach <em>n</em> consecutive results of the same coin face. The <a title="Coin Flips" href="http://people.ccmr.cornell.edu/~ginsparg/INFO295/mh.pdf" target="_blank">math is a bit beyond me</a> in terms of prediction, so I&#8217;m focusing on the simulation aspect.</p>
<p>One of the tricks of this process is in C++, creating a random number is a bit of a hack. The good news is with the forthcoming Intel Ive Bridge processors we&#8217;ll get the <a title="Wikipedia" href="http://en.wikipedia.org/wiki/RdRand" target="_blank">RdRAND</a> instruction for generating <a title="Behind Intels rdRAND" href="http://spectrum.ieee.org/computing/hardware/behind-intels-new-randomnumber-generator" target="_blank">truly random</a> numbers.</p>
<p>For now though we&#8217;re stuck with seeding rand() with srand() via a time() call, something along the lines of:</p>
<pre class="brush: cpp; title: ; notranslate">
#include

time_t seconds;
time(&amp;seconds);
srand((unsigned int) seconds);
</pre>
<p>This works but again, it&#8217;s not <em>truly</em> random in the purest sense of the word.</p>
<p>No matter, to create my simulation I wrote a simple program that spawns a few threads and iterates over a large number of &#8216;flips&#8217; to see how long a streak we can create. <em>For the curious, over 1 billion flips we usually average about 22 consecutive heads or tails</em>.</p>
<p>The program spawns &#8216;self contained&#8217; threads in that the result of each flip stores its result in that threads buffer. Thus, with 4 threads we get 4 sets of 1 billion flips, not 4 billion consecutive flips. I thus set out to create a producer/consumer application using semaphores for using more than one core where are larger number of consecutive flips could be simulated. To be clear this is for educational purposes &#8212; being a web guy means you usually don&#8217;t get to create such logic, and so even though we could just let the existing program run for longer, it&#8217;s not so much about actual implementation but education.</p>
<h2>The C++ extern keyword</h2>
<p>One of the first issues encountered was how do we create a global variable my producer and consumer thread classes can both talk to?</p>
<p>In other words, because we&#8217;re using a shared data structures two separate classes need to communicate with (the semaphores and buffer), it makes sense to make them global. The alternative is to create a slightly more complex class structure but I&#8217;m not interested in doing so.</p>
<p>With that being the case the trick with this, as I found out, is that unlike using a single file say, main.cpp, and just declaring the globals at the top of the file, when using multiple class files the compiler quickly becomes confused regarding where and when variables are declared and used.</p>
<p>To see the basic problem consider the basic project layout:</p>
<p><a href="http://www.formboss.net/blog/2012/02/c-extern-qsemaphore-and-circular-buffers/project-layout/" rel="attachment wp-att-1561"><img class="alignnone size-full wp-image-1561" title="project-layout" src="http://www.formboss.net/blog/wp-content/uploads/2012/02/project-layout.gif" alt="" width="288" height="323" /></a></p>
<p>As this is a Qt application main.cpp is only used for setting up the UI, and can be ignored. mainwindow.cpp however, is where we react to a button press that starts our two threads:</p>
<p><a href="http://www.formboss.net/blog/2012/02/c-extern-qsemaphore-and-circular-buffers/main-window/" rel="attachment wp-att-1562"><img class="alignnone size-full wp-image-1562" title="main-window" src="http://www.formboss.net/blog/wp-content/uploads/2012/02/main-window.gif" alt="" width="415" height="337" /></a></p>
<p>This calls a slot in mainwindow.cpp as follows:</p>
<pre class="brush: cpp; title: ; notranslate">
void MainWindow::slot_startThreads()
{

    Producer *producer = new Producer;
    Consumer *consumer = new Consumer;

    producer-&gt;start();
    consumer-&gt;start();

    producer-&gt;wait();
    consumer-&gt;wait();

}
</pre>
<p>Thus, we create instances of producer and consumer, these two classes inherit QThread. Both classes need access to a char buffer called <em>buffer</em>, which means we somehow need to make this buffer visible to both classes.<br />
At first it would appear that we simply define buffer above main.cpp&#8217;s main() function. No go. Doing so makes buffer available to any function within main.cpp, but not any other file.</p>
<p>Next I tried to define buffer in mainwindow.cpp and mainwindow.h &#8212; again, no go.</p>
<p>To be honest I was somewhat baffled by this. If it works in a single file instance why not multiple? Well that&#8217;s when I learned about <strong>extern</strong>.</p>
<p>So lets say in different, brand new project we have <strong>mainwindow.cpp</strong> with the following code:</p>
<pre class="brush: cpp; title: ; notranslate">
#include &quot;mainwindow.h&quot;
#include &quot;ui_mainwindow.h&quot;

#include &quot;test.h&quot;

int age = 1;

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui-&gt;setupUi(this);

    test *t = new test;

}

MainWindow::~MainWindow()
{
    delete ui;
}
</pre>
<p>In a class called <strong>test</strong> we have a call to qDebug() &lt;&lt; age:</p>
<pre class="brush: cpp; title: ; notranslate">
#include &quot;test.h&quot;

test::test()
{
    qDebug() &lt;&lt; age;
}
</pre>
<p>When we compile this code as is we get an error:</p>
<pre class="brush: plain; title: ; notranslate">C:\QtSDK\Projects\extern\test.cpp:5: error: 'age' was not declared in this scope</pre>
<p>But if we make one simple change in <strong>test.cpp</strong> by declaring age to be extern:</p>
<pre class="brush: cpp; title: ; notranslate">
#include &quot;test.h&quot;

test::test()
{
    extern int age;
    qDebug() &lt;&lt; age;
}
</pre>
<p>Everything works, and in the running program we spit out 1 to the console.</p>
<p>I needn&#8217;t go too deep into this here, for that we have this <a title="Global Variables" href="http://www.learncpp.com/cpp-tutorial/42-global-variables/" target="_blank">great link</a>, but the main take-away is extern tells the compiler this value is defined elsewhere, and so long as it is, no problem.</p>
<p>One final point though: in our coin flipping simulation we have a few globals, and as you may have noticed from the project files screen shot, we have global.h and global.cpp.</p>
<p>See, in larger projects we don&#8217;t want to sprinkle too many externs around because as some will attest, globals are in fact a <em>bad</em> thing. I&#8217;m not quite sold on that concept (that globals are bad if used wisely), but I will say that if we need globals we should at least keep then unified in one location. Thus, in my code we have global.h and global.cpp:</p>
<pre class="brush: cpp; title: ; notranslate">
#ifndef GLOBALS_H
#define GLOBALS_H

#include &lt;QSemaphore&gt;

// consts don't need labels in the compiler
const int DataSize = 10;
const int BufferSize = 4;

// but variables do, which means they must be extern and defined in cpp file(s)
extern char buffer[BufferSize];
extern int consecutive; // used in the full flipper application

extern QSemaphore freeSpace;
extern QSemaphore usedSpace;

#endif // GLOBALS_H
1

1
#include &quot;global.h&quot;

char buffer[BufferSize];

QSemaphore freeSpace(BufferSize);
QSemaphore usedSpace(0);
</pre>
<p>However, as soon as we go the global.h include file route a series of potential pitfall awaits us.</p>
<p>As you may notice by the comments, some variables we declare will be const, and these guys are handled differently than non-const vars with respect to global use and the extern keyword.</p>
<p>Also, in my code I need to include the global.h file in several places, but this means we&#8217;re now susceptible to multiple inclusion issues. Of course a decent IDE will add the boilerplate:</p>
<pre class="brush: cpp; title: ; notranslate">
#ifndef GLOBALS_H
#define GLOBALS_H
[...]
#endif // GLOBALS_H
</pre>
<p>&#8230;but this won&#8217;t prevent a subtle compiler error from rearing its ugly head.</p>
<p>Basically, if we have a const variable we do not need the extern keyword so long as any instance of a global variable is preceded by including our global.h file. However, <strong>any non-const variable must be declared extern</strong>, and then <strong>assigned a value</strong> in a cpp file, as we&#8217;ve done above.</p>
<p>If we don&#8217;t do this all sorts of strange compiler errors will be generated, most having to do with the variable being declared multiple times.</p>
<p>A great place to learn more is <a title="extern Keyword" href="http://www.learncpp.com/cpp-tutorial/42-global-variables/" target="_blank">this link</a>.</p>
<h2>QSemaphore</h2>
<p>Moving along then, at this point I have my global data structures for storing my coin flip data. Now we need to implement the QSemaphore logic for our circular buffer.</p>
<p>The basic idea of a semaphore is to make a shared data item have parts that can be operated on by two or more different threads via locking. A great example of this is a circular buffer.</p>
<p>We start the buffer out by having a producer thread write data to it. The semaphore then marks, at a specific point, that some data has been processed, at which point a consumer thread reads and processes that data.</p>
<p>My thought process for this project is that the producer thread will flip the coin (generate a random number), the consumer will compare that flip to the previous and if the same, store it in a buffer which resets a consecutive flip count if a non-consecutive flip occurs.</p>
<p>This is by no means supposed to be the proper way to do this in terms of speed or efficiency, I just figure it&#8217;s a good way to learn about QSemaphors.</p>
<h3>The Implementation</h3>
<p>My application uses a single widget with a start button that when clicked, calls the slot_startThreads method defined as follows:</p>
<pre class="brush: cpp; title: ; notranslate">
void MainWindow::slot_startThreads()
{
    this-&gt;ui-&gt;pushButton_startThreads-&gt;setText(&quot;Working...&quot;);
    this-&gt;ui-&gt;pushButton_startThreads-&gt;setDisabled(true);

    QDateTime start, end;
    start = start.currentDateTime();

    Producer *producer = new Producer;
    Consumer *consumer = new Consumer;

    producer-&gt;start();
    consumer-&gt;start();

    producer-&gt;wait();
    consumer-&gt;wait();

    // output total
    qDebug() &lt;&lt; &quot;Consecutive: &quot; &lt;&lt; consecutive + 1;

    // reset consecutive
    consecutive = 1;

    // benchmark
    end = end.currentDateTime();

    int elapsed = end.toMSecsSinceEpoch() - start.toMSecsSinceEpoch();

    qDebug() &lt;&lt; &quot;Elapsed time: &quot; &lt;&lt; elapsed &lt;&lt; &quot; (seconds)&quot;;

    this-&gt;ui-&gt;pushButton_startThreads-&gt;setDisabled(false);
    this-&gt;ui-&gt;pushButton_startThreads-&gt;setText(&quot;Start Threads&quot;);

}
</pre>
<p>I&#8217;ve included benchmark code to compare this method against a non-buffered version, please see below for results on that bit.</p>
<p>The producer and consumer classes are defined as follows:</p>
<pre class="brush: cpp; title: ; notranslate">
#ifndef CONSUMER_H
#define CONSUMER_H

#include &lt;QThread&gt;
#include &lt;QSemaphore&gt;
#include &lt;QDebug&gt;

#include &quot;global.h&quot;

class Consumer : public QThread
{
public:
    Consumer(); // for producer the only thing that changes is the constructor name

    void run(); // both classes simply implement run()
};

#endif // CONSUMER_H
</pre>
<p>And implemented as follows:</p>
<pre class="brush: cpp; title: ; notranslate">
#include &quot;producer.h&quot;

Producer::Producer() {}

void Producer::run()
{
    int first_die, streak, max_streak;

    streak = 0; max_streak = 0;

    time_t seconds;

    time(&amp;seconds);

    srand((unsigned int) seconds);

    // flip logic
    const int LOW = 1;
    const int HIGH = 10;

    for(int i = 0; i &lt; DataSize / BufferSize; i++){

        freeSpace.acquire(BufferSize);

        for(int j = 0; j &lt; BufferSize; j++){

            first_die = rand() % (HIGH - LOW + 1) + LOW;

            if(first_die &gt; 5){
                buffer[j] = 'T';
            } else {
                buffer[j] = 'H';
            }

        }

        usedSpace.release(BufferSize);
    }
}
</pre>
<p>&nbsp;</p>
<pre class="brush: cpp; title: ; notranslate">
#include &quot;consumer.h&quot;

Consumer::Consumer() {}

void Consumer::run()
{

    char last = 'A';
    int streak = 0;

    for(int i = 0; i &lt; DataSize / BufferSize; i++){

        usedSpace.acquire(BufferSize);

        for(int j = 0; j &lt; BufferSize; j++){

            if(last == buffer[j]){
                streak++;
            } else {
                streak = 0;
            }

            if(streak &gt; consecutive){
                consecutive++;
            }

            last = buffer[j];

        }

        freeSpace.release(BufferSize);

    }
}
</pre>
<p>The key drivers are the global.h and global.cpp files, defined as shown above &#8212; this is where we define the number of flips and the buffer size.</p>
<p>The end result of this code is 1,000,000 flips is achieved in an average of 43 milliseconds. Also of interest is in our global.h file we can define the size of the buffer used by the semaphore (aka the resource size). Smaller values like 512 for one million flips returns the same average performance as 1 megabyte. However, when we up the flips to one-hundred million a buffer size of 512 bytes averages around 4 seconds, a two-megabyte buffer in 3.5. Going to a four megabyte buffer further reduces this to 3.1 milliseconds, at which point going higher has a negligible effect on performance.</p>
<p>The key here is the buffer size has a direct impact on the number of context switches our threads perform, which in other words means the larger of a resource the semaphore controls the less overhead we have.</p>
<p>For example, a 128 byte buffer increases our benchmark time to 7 seconds simply because of the number of times we need to switch threads.</p>
<p>Of course it also must be said that our code is unbalanced in that the consumer thread must wait for the longer random number generation operations of the producer thread. If we spent more time on this we would make an effort to make sure our producer and consumer operate at a matching frequency.</p>
<p>Finally, I would point out that a single threaded version of the same flipping logic is almost twice as fast. This should not be that much of a surprise, in that the type of processing we&#8217;re trying to achieve here is largely dependent on the overhead assumed with using a generalized semaphore.</p>
<h2>Files Used For This Project</h2>
<p><a href="http://www.formboss.net/blog/2012/02/c-extern-qsemaphore-and-circular-buffers/producer-consumer/" rel="attachment wp-att-1572">producer-consumer</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.formboss.net/blog/2012/02/c-extern-qsemaphore-and-circular-buffers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Thoughts On SOAP/PIPA And The Future Of The Net.</title>
		<link>http://www.formboss.net/blog/2012/01/thoughts-on-sopa/</link>
		<comments>http://www.formboss.net/blog/2012/01/thoughts-on-sopa/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 19:49:03 +0000</pubDate>
		<dc:creator>grdinic</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[PIPA]]></category>
		<category><![CDATA[Software Owner]]></category>
		<category><![CDATA[SOPA]]></category>

		<guid isPermaLink="false">http://www.formboss.net/blog/?p=1550</guid>
		<description><![CDATA[SOPA and PIPA are bills are designed to help guys like me (software company owners), and yet I find them pretty distasteful in many ways. As other have pointed out, a rather large burden is placed on site owners, especially those who run aggregate sites like Reddit and YouTube. My understanding is content/copyright owners can [...]]]></description>
			<content:encoded><![CDATA[<p>SOPA and PIPA are bills are designed to <em>help</em> guys like me (software company owners), and yet I find them pretty distasteful in many ways.</p>
<p>As other have pointed out, a rather large burden is placed on site owners, especially those who run aggregate sites like Reddit and YouTube. My understanding is content/copyright owners can request that sites be <strong>removed from the US Internet</strong> if they&#8217;re found to harbor, support, or link to unlicensed content.</p>
<p><span id="more-1550"></span></p>
<p>On the face of it that seems like it makes sense &#8212; if you&#8217;re &#8220;linking&#8221; to stolen goods via a sign in the front yard that says &#8220;car stereos in garage&#8221; it&#8217;s only natural that, even if it&#8217;s not your house, the operation gets shut down.</p>
<p>Right now the Internet is as free as it gets. Virtual goods and ideas exchange &#8220;hands&#8221; with impunity. Be it a movie or your <em>thoughts</em> on the movie, the Internet and our government doesn&#8217;t make a distinction. It&#8217;s all just bits floating in space.</p>
<p>As a society then we have a simple decision to make: <strong>do we embrace the current system or do we throw it away?</strong></p>
<p>If the answer is &#8220;embrace&#8221; content providers and producers will simply have to live with the Internet as it stands right now, pirates and all.</p>
<p>Me: I like to pay for things:</p>
<p><a href="http://www.formboss.net/blog/2012/01/thoughts-on-sopa/itunes-tv/" rel="attachment wp-att-1551"><img class="alignnone size-full wp-image-1551" title="itunes-tv" src="http://www.formboss.net/blog/wp-content/uploads/2012/01/itunes-tv.jpg" alt="" width="650" height="527" /></a></p>
<p>By my rough count I own 144 episodes at $2.99 each making for $432 in TV shows. I also own about 860 songs, which at .99 cents means I&#8217;ve spent close to a thousand dollars on music &#8212; in the past 4 years.</p>
<p>This isn&#8217;t counting the Blurays and DVD I&#8217;ve bought over the years, the movie tickets, and of course rentals.</p>
<p>In short I&#8217;ve still spent what <em>I</em> consider a pretty exorbitant amount of money on entertainment, an amount that in some countries would be the equivalent of a years salary or more.</p>
<p>I pay because feel anything else would be wrong. In fact, my beloved South Park episodes: I can watch those for free anytime I want at <a href="http://www.southparkstudios.com/">South Park Studios</a> and yet I don&#8217;t. Why? I like to own stuff I&#8217;ve paid for I guess.</p>
<p>And yet as sure as you have me and my way of buying, you have others who feel entitled to whatever they want, when they want, and always for free.</p>
<p>Thus, the other option is we do not embrace openness and instead move to lock the Internet down. In this world the Internet will become what I&#8217;ve been predicting all along: the cable TV model but on the Net. Instead of an open model we&#8217;ll buy &#8220;Internet Content Packages&#8221; (channels) that contain blocks of content (that still contain ads, just like cable TV does today!).</p>
<p>So we&#8217;ll get the tech package that contains access to Ars and Vox properties, the sport package that contains ESPN, and so on. I fear smaller sites like mine will be relegated to what in cable TV today is the public access channel. A slower, less reliable data-stream that at best means fewer visitors and less traffic. And make no mistake, we&#8217;ll do this willingly. An effort will be made to make the Internet as dangerous (legally speaking) as can be for aggregates (fan sites, the aft-mentioned YouTube etc), which means the &#8220;good&#8221; content will be the curated stuff we &#8220;conveniently&#8221; pay for in the content packages.</p>
<p>And so as I said above the bill is supposed to help software guys like me (content producers), but in the long term I believe its potential to hurt my business is a real threat.</p>
<p>Put another way I feel the greatest failing of SOPA is its inability to stop piracy in general while fundamentally changing how the Internet works for us working folk. Same as I have my content channel (iTunes) pirates have theirs, disabling websites because of links won&#8217;t stop this at all. Thus, SOPA passes and I, a law-abiding consumer, pays, while the pirates quite literally never do. They&#8217;re already comfortable using illicit channels, what&#8217;s to stop that in the future?</p>
<p>The future of the Internet is not in question &#8211; it&#8217;s what it will look like that is. I personally side with those that argue so long as content is easy to access and comes with reasonable rights <em>people will pay</em>.</p>
<p>I believe their are more than enough of us that fit into this mold, why should we be punished for those that do not?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.formboss.net/blog/2012/01/thoughts-on-sopa/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Where Bing Has To Improve</title>
		<link>http://www.formboss.net/blog/2011/12/where-bing-has-to-improve/</link>
		<comments>http://www.formboss.net/blog/2011/12/where-bing-has-to-improve/#comments</comments>
		<pubDate>Sat, 10 Dec 2011 20:06:05 +0000</pubDate>
		<dc:creator>grdinic</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[Bing Search]]></category>
		<category><![CDATA[Google Search]]></category>

		<guid isPermaLink="false">http://www.formboss.net/blog/?p=1525</guid>
		<description><![CDATA[I appreciate competition in the search engine space but Bing simply doesn&#8217;t compete at this point. I would like to it, but it simply doesn&#8217;t. So let&#8217;s talk why: When building something like FormBoss you often run into a situation where you need to do cross-browser compatibility coding. With Google Chrome now in the #2 [...]]]></description>
			<content:encoded><![CDATA[<p>I appreciate competition in the search engine space but <em>Bing</em> simply doesn&#8217;t compete at this point. I would like to it, but it simply doesn&#8217;t.</p>
<p><span id="more-1525"></span></p>
<p>So let&#8217;s talk why: When building something like FormBoss you often run into a situation where you need to do cross-browser compatibility coding. With Google Chrome now in the #2 spot and IE variants still holding around 50% of the market, this means at minimum 3 browser windows open at once.</p>
<p>This also means the developer tools for each browser being open and ready for some heavy lifting as code checks are run and bug squashed. Problem is, somehow the IE developer tools are not pinned to the main window like Chrome and Firefox, which means I&#8217;ve got an extra window clogging an already tight workspace.</p>
<p>I need to pin them to the IE window, but do not know how. As I&#8217;m already in IE I <em>Bing</em>:</p>
<pre>ping ie developer tools to main window</pre>
<p>I know, I know : ) My spelling&#8217;s terrible, but that&#8217;s the whole point.</p>
<p>I miss my error at first, and my search results comes back with this:</p>
<p><a href="http://www.formboss.net/blog/2011/12/where-bing-has-to-improve/bing-results-1/" rel="attachment wp-att-1526"><img class="alignnone size-full wp-image-1526" title="bing-results-1" src="http://www.formboss.net/blog/wp-content/uploads/2011/12/bing-results-1.png" alt="" width="655" height="694" /></a></p>
<p>Not to be a mean guy, but that&#8217;s utterly worthless as a search result. It&#8217;s not even close that what I need or want.</p>
<p>So I copy/paste my #erroneous# query into Google and get this:</p>
<p><a href="http://www.formboss.net/blog/2011/12/where-bing-has-to-improve/google-results-1/" rel="attachment wp-att-1527"><img class="alignnone size-full wp-image-1527" title="google-results-1" src="http://www.formboss.net/blog/wp-content/uploads/2011/12/google-results-1.png" alt="" width="605" height="708" /></a></p>
<p>Eureka. Three completely relevant links right up top.</p>
<p>And that&#8217;s the thing. I gave Google what to some <em>humans</em> would be an nonsensical question and yet Google still comes through.</p>
<p>Now to be fair when we change our query to:</p>
<pre>pin ie developer tools to main window</pre>
<p>Bing comes through in fine fashion, even providing a Microsoft link at top:</p>
<p><a href="http://www.formboss.net/blog/2011/12/where-bing-has-to-improve/bing-results-2/" rel="attachment wp-att-1528"><img class="alignnone size-full wp-image-1528" title="bing-results-2" src="http://www.formboss.net/blog/wp-content/uploads/2011/12/bing-results-2.png" alt="" width="636" height="849" /></a></p>
<p>So it&#8217;s not all bad, but I&#8217;ve come to expect that my search engine is smarter than me.</p>
<p>Google is, Bing is not.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.formboss.net/blog/2011/12/where-bing-has-to-improve/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery vs. Prototype – Part 2</title>
		<link>http://www.formboss.net/blog/2011/10/jquery-vs-prototype-%e2%80%93-part-2/</link>
		<comments>http://www.formboss.net/blog/2011/10/jquery-vs-prototype-%e2%80%93-part-2/#comments</comments>
		<pubDate>Sun, 23 Oct 2011 20:23:12 +0000</pubDate>
		<dc:creator>grdinic</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Prototype JS]]></category>

		<guid isPermaLink="false">http://www.formboss.net/blog/?p=1480</guid>
		<description><![CDATA[In the first post of this series we looked at the common misconception of jQuery being the &#8220;lightweight&#8221; JavaScript library. In this post we&#8217;ll leave the sidelines and jump right into some real-world scenarios. I want to see what makes jQuery tick by comparing it to my beloved Prototype. A quick note as we get [...]]]></description>
			<content:encoded><![CDATA[<p>In the first post of this series we looked at the common misconception of jQuery being the &#8220;lightweight&#8221; JavaScript library. In this post we&#8217;ll leave the sidelines and jump right into some real-world scenarios. I want to see what makes jQuery tick by comparing it to my beloved Prototype.</p>
<p><span id="more-1480"></span><br />
<em>A quick note as we get started: I&#8217;ve never coded in jQuery before, so my apologies ahead of time if I miss something obvious!</em></p>
<h2>A Button Clicking Example</h2>
<p>In this first example let&#8217;s see what a typical event handler for a button click looks like when following the design pattern of separating design from implementation: </p>
<p><strong>Prototype:</strong></p>
<pre class="brush: jscript; title: ; notranslate">
&lt;!DOCTYPE html&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;script src=&quot;prototype.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;title&gt;Prototype&lt;/title&gt;

&lt;script type=&quot;text/javascript&quot;&gt;

// bind each button
document.observe('dom:loaded', function(){

	syntax = 'quick';

	if(syntax == 'quick'){
		// quick syntax
		$$('.dynamic-element-wrapper &gt; INPUT').invoke('observe', 'click', buttonClicked);
	}

	if(syntax == 'verbose'){
		// verbose
		$$('.dynamic-element-wrapper &gt; INPUT').map(function(t){
			t.observe('click', buttonClicked);
		});
	}

});

function buttonClicked(e){
	$('console').update(e.element().id + ' Clicked');
};

&lt;/script&gt;

&lt;/head&gt;

&lt;body&gt;

&lt;div class=&quot;dynamic-element-wrapper&quot;&gt;
	&lt;input type=&quot;button&quot; id=&quot;button-1&quot; name=&quot;button-1&quot; value=&quot;Button 1 - Click Me&quot; /&gt;
    &lt;input type=&quot;button&quot; id=&quot;button-2&quot; name=&quot;button-2&quot; value=&quot;Button 2 - Click Me&quot; /&gt;
&lt;/div&gt;

&lt;div style=&quot;clear:both;&quot; id=&quot;console&quot;&gt;&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;
</pre>
<p><strong>jQuery</strong></p>
<pre class="brush: jscript; title: ; notranslate">
$(document).ready(function() {

	syntax = 'verbose';

	if(syntax == 'quick'){
		$('.dynamic-element-wrapper &gt; INPUT').click(buttonClicked);
	}

	if(syntax == 'verbose'){
		$('.dynamic-element-wrapper &gt; INPUT').bind('click', buttonClicked);
	}

});

function buttonClicked(e){
	$('#console').html(e.target.id + ' Clicked');
};
</pre>
<p><em>Please note that as the HTML doesn&#8217;t change the jQuery code sample is limited to just the SCRIPT block.</em></p>
<p><strong>So a couple items of note:</strong></p>
<p>As a long-time Prototype guy jQuery&#8217;s automatic array return when using $() sits in stark contrast to Prototype&#8217;s use of $$(). I have to admit I&#8217;m torn on this one, as in a way the jQuery way makes more sense. The selector and knowledge of the document, combined with the function our event listeners call should be all that&#8217;s needed from a selector. In practical terms then differentiating between $() and $$() is admittedly more work without a huge gain in readability. </p>
<p>That aside, in Prototype we also get a bit more syntax heavy having to resort to <strong>.invoke()</strong> or <strong>.map()</strong>, whereas jQuery&#8217;s <strong>.click()</strong> makes short work of the job &#8212; providing a quick and concise way to perform such a common task is a huge win.  </p>
<p>On the event processing side our <strong>buttonClicked()</strong> call is very similar. Once again jQuery&#8217;s love of shortcuts impresses me. <strong>.html()</strong> for getting <em>and </em>setting text is quite nice, and from what I can see, is duplicated via <strong>.val()</strong> of the form field side. </p>
<h2>The this Reference Binding Issue</h2>
<p>So here comes the main event. The example above in terms of design pattern is going to be just fine for most projects. Our design code is free from implementation code and when we click the element we get the info we need &#8212; everything just works. </p>
<p>But what happens when we follow a slightly more complex design pattern? Many times allowing UI implementation code to hover in the global script scope is perfectly acceptable. But their are times, either by virtue of space or code cleanliness, that wrapping our event code into objects is desirable or required. </p>
<p>An example of doing so in <strong>Prototype </strong>looks like this:</p>
<pre class="brush: jscript; title: ; notranslate">
var buttonFactory = {

	_limit: 10,
	_secure: true,

	bindObjects: function(){
		$$('.dynamic-element-wrapper &gt; INPUT').invoke('observe', 'click', this.buttonClicked);
	},

	buttonClicked: function(e){
		$('console').update(e.element().id + ' was clicked. ' + 'The limit value = ' + this._limit);
	}

};

// bind each button
document.observe('dom:loaded', function(){
	buttonFactory.bindObjects();

});
</pre>
<p>As you can see instead of binding our event listeners in the global scope we issue a simple call to <strong>buttonFactory.bindObjects()</strong>. If this was a much larger project it&#8217;s not hard to see why this would be a great way to work. Our <strong>document.observe</strong> code would simply be a series of calls to code that initialize other parts of the UI. The initialization code would then perform all sorts of long-winded tasks while leaving our <strong>document.observe</strong> call far from the down and dirty details. </p>
<p>But all&#8217;s not well. When coding this way &#8212; if not just to save space but to also create more complex event handling logic &#8212; we would expect that our <strong>buttonClicked()</strong> code would handle the reference to <strong>this._limit</strong> but it doesn&#8217;t. We&#8217;ll get this when we click a button:</p>
<pre class="brush: plain; title: ; notranslate">button-2 Was Clicked. The limit value = undefined</pre>
<p>That&#8217;s not at all what we want. You&#8217;d think <strong>this._limt</strong> should return with a value of 10 but it doesn&#8217;t. Why? </p>
<p>The problem is when we bound our event listener the <em>this </em>reference wasn&#8217;t part of the process. This means when we trigger a click event the <em>this </em>refers to the <strong>event object</strong>, not the buttons original parent object (buttonFactory). </p>
<p>Prototype has a solution for this via a call to <strong>bindAsEventListener()</strong>. <strong>bindAsEventListener()</strong> takes the object we wish to use as the <em>this </em>reference when invoked. To implement this fix in our example code we&#8217;d change our <strong>bindObjects()</strong> call to:</p>
<pre class="brush: jscript; title: ; notranslate">
//
//
$$('.dynamic-element-wrapper &gt; INPUT').invoke('observe', 'click', this.buttonClicked.bindAsEventListener(this));
//
//
</pre>
<p>Now when we run our code it returns the following when a button&#8217;s clicked:</p>
<pre class="brush: plain; title: ; notranslate">button-1 was clicked. The limit value = 10</pre>
<p>That&#8217;s more like it. Sure this is a synthetic example, but it&#8217;s absolutely essential to creating <em>portable </em>code. </p>
<p>Portable is the key word here, as yes, we could just do this to our <strong>buttonClicked() </strong>call:</p>
<pre class="brush: jscript; title: ; notranslate">
//
//
$('console').update(e.element().id + ' was clicked. ' + 'The limit value = ' + buttonFactory._limit);
//
//
</pre>
<p>But this would be in bad form in my opinion, as now we&#8217;re making all sorts of assumptions of how this object will be consumed. </p>
<p>So the point is Prototype gives us a sleek, consistent way of holding objects together in event-driven code. </p>
<p>How does jQuery solve this issue?</p>
<p><strong>jQuery</strong></p>
<pre class="brush: jscript; title: ; notranslate">
var buttonFactory = {

	_limit: 10,
	_secure: true,

	bindObjects: function(){
		$('.dynamic-element-wrapper &gt; INPUT').bind('click', this, this.buttonClicked);
	},

	buttonClicked: function(e){
		$('#console').html(e.target.id + ' Clicked' + 'The limit value = ' + e.data._limit);
	}

};

$(document).ready(function() {
	buttonFactory.bindObjects();
});
</pre>
<p>The <a href="http://api.jquery.com/bind/" target="_blank">method signature</a> of .bind() as we&#8217;re using it is:</p>
<pre class="brush: plain; title: ; notranslate">.bind( eventType [, eventData], handler(eventObject) )</pre>
<p>Thus, my solution is to simply pass our object reference as the <strong>eventData </strong>argument. We then pick up on the value via the <strong>event.data </strong>object in <strong>buttonClicked()</strong> and away we go. </p>
<p>Seems simple enough but again I do not have&#8230;well&#8230;<em>any </em>jQuery experience, so I would not be surprised is this is wrong in terms of implementation. What I <em>can </em>say though is it works just fine, and once again the syntax is pretty slick. For Prototype adding bindAsEventListener() is every bit as cumbersome as <strong>document.getElementById()</strong> if you catch my drift&#8230;</p>
<p>I say it works fine as for my part I did issue a test call of:</p>
<pre class="brush: jscript; title: ; notranslate">e.data._limit = 20;</pre>
<p> under the <strong>#console</strong> update call and sure enough, the <strong>buttonFactory </strong>object was updated accordingly. From this we can tell <em>this </em>is passed as a reference, which means for my money this is an acceptable, working solution. </p>
<p>For the sake of completeness it appears we can also use <a href="http://api.jquery.com/jQuery.proxy/" target="_blank">.proxy()</a>. </p>
<p>When used our code changes to:</p>
<pre class="brush: jscript; title: ; notranslate">
var buttonFactory = {

	_limit: 10,
	_secure: true,

	bindObjects: function(){
		var bProxy = $.proxy(this.buttonClicked, this);
		$('.dynamic-element-wrapper &gt; INPUT').bind('click', bProxy);

	},

	buttonClicked: function(e){
		$('#console').html(e.target.id + ' Clicked' + 'The limit value = ' + this._limit);
		e.data._limit = 20;
	}

};

$(document).ready(function() {
	buttonFactory.bindObjects();
});
</pre>
<p>I&#8217;m not entirely sold on this method as now we&#8217;re once again in the mode of hand-wrangling specific behavior from our objects. It&#8217;s nice to know it can be done, however.</p>
<h2>Conclusion</h2>
<p>The title of this post has a <em>vs.</em> in it so who wins this round? Somewhat unsurprisingly I think it&#8217;s a draw, though if I had to pick I&#8217;d say jQuery. jQuery&#8217;s ability to pass <em>this </em>as an event parameter and it still works is fine by me and easier to code, and considering we can just as easily wrap <em>this </em>into a larger structure is better still.</p>
<p>Of course I&#8217;m ready and willing to have any and all ignorance corrected, so if you&#8217;ve seen something that&#8217;s not right with my solution(s) please let me know! </p>
<p>The bottom line is jQuery has some real time savers in its bucket of tricks; the fact that $() returns arrays is worth the price of admission alone.</p>
<p>Color me continually intrigued.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.formboss.net/blog/2011/10/jquery-vs-prototype-%e2%80%93-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery vs. Prototype &#8211; Part 1</title>
		<link>http://www.formboss.net/blog/2011/10/jquery-vs-prototype-part-1/</link>
		<comments>http://www.formboss.net/blog/2011/10/jquery-vs-prototype-part-1/#comments</comments>
		<pubDate>Sat, 22 Oct 2011 18:50:27 +0000</pubDate>
		<dc:creator>grdinic</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Prototype JS]]></category>

		<guid isPermaLink="false">http://www.formboss.net/blog/?p=1449</guid>
		<description><![CDATA[One of the hottest JavaScript libraries on the planet is jQuery. It&#8217;s opened up a world of web developers to functionality and ease they would not otherwise know, and has done so without stepping on anyone toes. Their are hundreds of great extensions for it made by a first-rate community that&#8217;s almost always helpful and [...]]]></description>
			<content:encoded><![CDATA[<p>One of the <a title="http://appendto" href="http://appendto.com/jquery-overtakes-flash" target="_blank">hottest</a> JavaScript <a title="codeclimber" href="http://codeclimber.net.nz/archive/2009/06/22/ajax-survey-2009-jquery-and-ms-ajax-are-almost-tied.aspx" target="_blank">libraries</a> on the planet is jQuery. It&#8217;s opened up a world of web developers to functionality and ease they would not otherwise know, and has done so without <a title="noConflict()" href="http://api.jquery.com/jQuery.noConflict/" target="_blank">stepping on anyone toes</a>. Their are hundreds of great extensions for it made by a first-rate community that&#8217;s almost always helpful and supportive. When it comes to getting a job I&#8217;d say jQuery knowledge is <a title="Stack Overflow" href="http://stackoverflow.com/questions/932967/do-javascript-developers-need-to-know-jquery" target="_blank">almost becoming requirement</a>, if not right away then as part of your integration into that job.</p>
<p>Prototype JS is&#8230;well&#8230;it&#8217;s another JavaScript library. But it&#8217;s the library I know and <em>love</em>. It&#8217;s what drives FormBoss and while not as exciting or popular as jQuery, I swear its day <em>will </em>come (again). Their are many reasons for this belief, but the first is due to what I believe is a fundamental misconception about jQuery vs. other libraries &#8212; its payload size.</p>
<p>In this first of a multi-part series we&#8217;ll take a look at the physical delivery size of each library. In the next post well dive into practical programming. First though, a bit of background.</p>
<p><span id="more-1449"></span></p>
<h2>Background</h2>
<p>As a professional Web Developer I had a decision to make in mid-2008 as to what JavaScript library I would use for FormBoss. At that time I was looking for a library that fixed JavaScript&#8217;s core issues and had good AJAX support. (<em>Little did I know that while AJAX support was important, far more relevant would be DOM handling and event binding, but more on that latter</em>).</p>
<p>I checked a few libraries starting with Yahoo&#8217;s <a title="YUI" href="http://developer.yahoo.com/yui/" target="_blank"><em>YUI </em></a>and <a title="Dojo" href="http://dojotoolkit.org/" target="_blank"><em>Dojo</em></a>. Forget it. Far more complex than I needed, they seemed to make even simple tasks difficult (<em>disclaimer: I haven&#8217;t looked into these libraries for some time now, they may be better, or perhaps my initial impressions were wrong!</em>).</p>
<p>What I really wanted was a library like PHP. Provide a solid foundation that was <em>not </em>unto itself a framework. All I wanted was something that extends and smooths over vanilla JavaScript but also provides glue functions for doing more advanced stuff.</p>
<p>It wasn&#8217;t long before I narrowed my decision down to Prototype and jQuery (at <em> versions 1.6.0.3 and at 1.2.6., respectively)</em>. Both seemed strong &#8211; jQuery on the count of its small size and simplicity, Prototype because of its more robust feature-set and AJAX support (<em>again though DOM traversal and event binding played no part in this process, but would become crucial later on</em>).</p>
<p>In the end I went with Prototype for a simple reason &#8212; it seemed more &#8220;complete&#8221; in terms of a programming construct. jQuery, always bragging about how small it was seemed almost <em>too </em>small, too limiting. I wasn&#8217;t looking for flash but utility, and Prototype fit the mold. For the most part I haven&#8217;t regretted this decision one bit&#8211;in the intervening years Prototype has been wonderful to me and always delights. In places where it needed improvement like upgrading to the Selectors API it&#8217;s done so in a reasonable time-frame, and for just about everything else, such as animation and event binding, it&#8217;s never let me down.</p>
<p>But always in the back of my mind has been jQuery, a nagging sense that I&#8217;m missing something. Why has it gotten so popular and does this mean I should be using it too?</p>
<h2>Modern jQuery &#8211; The Popular Place To be</h2>
<p>The base answer to our question of <em>why so popular</em> can be found right at the top of the jQuery <a title="jQuery" href="http://jquery.com/" target="_blank">home page</a>:</p>
<p><a rel="attachment wp-att-1450" href="http://www.formboss.net/blog/2011/10/jquery-vs-prototype-part-1/get-jquery/"><img class="alignnone size-full wp-image-1450" title="get-jquery" src="http://www.formboss.net/blog/wp-content/uploads/2011/10/get-jquery.png" alt="" width="295" height="218" /></a></p>
<p>Compare that with <a title="Prototype JS" href="http://www.prototypejs.org/" target="_blank">Prototype</a>:</p>
<p><a rel="attachment wp-att-1451" href="http://www.formboss.net/blog/2011/10/jquery-vs-prototype-part-1/get-prototype/"><img class="alignnone size-full wp-image-1451" title="get-prototype" src="http://www.formboss.net/blog/wp-content/uploads/2011/10/get-prototype.png" alt="" width="260" height="68" /></a></p>
<p>Ugh. It&#8217;s no wonder jQuery has more hype &#8212; seriously &#8212; by download link alone jQuery simply looks cooler and more advanced.</p>
<p>But it&#8217;s not just that&#8230;well not entirely : )</p>
<p>When you look at the jQuery download options you see that magic value: <strong>31KB</strong>.</p>
<p>How brilliant can they be? Think about all of those large newspaper, e-commerce, and other highly trafficked sites. Bandwidth is money, and when it comes time to tell your boss you need to add more weight to a site it had better be as little as possible <em>and </em>worth it. More importantly, even as recently as 2009 <a title="FCC Broadband Adoption" href="http://online.wsj.com/public/resources/documents/FCCSurvey.pdf" target="_blank">broadband adoption</a> in America was still only 67%. Sure that number continuies to rise but now consider our rising mobile Internet use. Truly two steps forward and one step back.</p>
<p>The point is size still matters, and Prototype&#8217;s stubborn lack of a minified version and frankly boring site and download page mean of course jQuery&#8217;s flashy site will draw more users in, both from a aesthetic and practical standpoint.</p>
<h2>In Reality&#8230;</h2>
<p>But of course we&#8217;re developers so we go deeper than that, and in preparation for this post I was&#8211;admittedly&#8211;floored by a simple test:</p>
<p><a rel="attachment wp-att-1452" href="http://www.formboss.net/blog/2011/10/jquery-vs-prototype-part-1/relative-sizes/"><img class="alignnone size-full wp-image-1452" title="relative-sizes" src="http://www.formboss.net/blog/wp-content/uploads/2011/10/relative-sizes.png" alt="" width="277" height="314" /></a></p>
<p>Had you asked me just five minutes ago I would have said &#8220;<em>Of course</em> jQuery is smaller, everyone knows that!&#8221;.</p>
<p>As of 1.6.4 jQuery has actually grown larger than Prototype in terms of raw source , 6084 lines vs. 9048 (and almost twice as large in terms of raw source code size in KB). More importantly though is while the minified version of Prototype is still larger, the minified + gzipped versions are <em>identical</em>. More importantly still: the minified jQuery is not 32KB but ~90KB. This is important because the jQuery website makes you feel like you&#8217;ll be getting all of that functionality for 32kb, but <em>only </em>if your server is gzipping content. The simple fact is almost all shared hosting plans won&#8217;t be doing do, which means your 32KB is actually closer to 90KB. And no, it&#8217;s not just the smaller plans, it happens with the big boys as well:</p>
<p><a title="Nordstrom" href="http://shop.nordstrom.com/" target="_blank">http://shop.nordstrom.com/</a></p>
<p>Run a Firebug NET session on that site and you&#8217;ll see what we&#8217;re about to cover below. They use a minified but not gzipped version of jQuery (version 1.5.1), which means payload size is 51KB.</p>
<p>In that light it&#8217;s instructive to see what happens with no server size gzipping with the latest versions of each library:</p>
<p><strong>Prototype.js</strong></p>
<p><a rel="attachment wp-att-1453" href="http://www.formboss.net/blog/2011/10/jquery-vs-prototype-part-1/prototype-js-server-no-gzip/"><img class="alignnone size-full wp-image-1453" title="prototype-js-server-no-gzip" src="http://www.formboss.net/blog/wp-content/uploads/2011/10/prototype-js-server-no-gzip.png" alt="" width="796" height="140" /></a></p>
<p><strong>jQuery</strong></p>
<p><a rel="attachment wp-att-1454" href="http://www.formboss.net/blog/2011/10/jquery-vs-prototype-part-1/jquery-js-server-no-gzip/"><img class="alignnone size-full wp-image-1454" title="jquery-js-server-no-gzip" src="http://www.formboss.net/blog/wp-content/uploads/2011/10/jquery-js-server-no-gzip.png" alt="" width="796" height="140" /></a></p>
<p>Here we can can very little server time spent on the requests, but with jQuery&#8217;s minified version definitely being smaller. Again though, the 32KB shown on the jQuery website, while true as it clearly states &#8220;Gzipped&#8221;, is not what we get without the server actually gzipping, as we would expect.</p>
<p>However, as soon as we enabling server size gzipping [via Apache&#8217;s mod_deflate using:</p>
<pre class="brush: plain; title: ; notranslate">LoadModule deflate_module modules/mod_deflate.so</pre>
<p>we get:</p>
<p><strong>Prototype</strong></p>
<p><a rel="attachment wp-att-1455" href="http://www.formboss.net/blog/2011/10/jquery-vs-prototype-part-1/prototype-js-server-gzip/"><img class="alignnone size-full wp-image-1455" title="prototype-js-server-gzip" src="http://www.formboss.net/blog/wp-content/uploads/2011/10/prototype-js-server-gzip.png" alt="" width="796" height="140" /></a></p>
<p><strong>jQuery</strong></p>
<p><a rel="attachment wp-att-1456" href="http://www.formboss.net/blog/2011/10/jquery-vs-prototype-part-1/jquery-js-server-gzip/"><img class="alignnone size-full wp-image-1456" title="jquery-js-server-gzip" src="http://www.formboss.net/blog/wp-content/uploads/2011/10/jquery-js-server-gzip.png" alt="" width="796" height="140" /></a></p>
<p>The minified version of Prototype is made via <a title="JS Minifier" href="http://fmarcia.info/jsmin/test.html" target="_blank">this minifier</a>, and as we can see is essentially the same size as jQuery.</p>
<p>However, note that the non-minified version of Prototype is only ~5KB larger, and just as importantly, only take ~3 ms of extra server processing time (remember that gzipping in Apache is not free!). In other words we&#8217;re about even in that <strong>we do not need to create a minified version of Prototype</strong> and we&#8217;ll still deliver, in terms of processor load and payload size, the same thing.</p>
<h2>In Conclusion</h2>
<p>In this first post we&#8217;ve found that when properly delivered both libraries are essentially the same size. I would actually give Prototype the win however, as its smaller uncompressed size means we can simply plop the uncompressed version in to our delivery or &#8216;live&#8217; section, and then in testing, instead of nonsensical minified error messages get actual line numbers we can refer back to. True this shouldn&#8217;t happen often, (it should be our code with the error, not Prototype or jQuery), but still handy in the larger scheme.</p>
<p>In non-gzipped environments however it&#8217;s clear that jQuery gets the win. This will be important for shared hosting plans of anywhere else we do not have access to server-side gzipping.</p>
<p>It&#8217;s also noteworthy that in order for Prototype to gain some of the more advanced animation framework goodness that (I assume) jQuery already has in the base library, we&#8217;d need to add <a title="script.aculo.us" href="http://script.aculo.us/" target="_blank">Script.aculo.us</a>, which would of course make the total payload larger.</p>
<p>Those considerations aside, what&#8217;s fascinating to me is that the <em>perception </em>of jQuery being &#8220;the&#8221; light-weight library. In the past 3 years I firmly believe this has been the primary driving force behind its mass adoption and popularity. I don&#8217;t know about you but I&#8217;ve been specifically told by bosses to not include Prototype <em>because </em>of its size &#8212; but at the same time given the go-ahead for jQuery. I&#8217;ve also made similar decisions for FormBoss based on the same reasoning (<em>though not to instead use jQuery, just vanilla JavaScript</em>).</p>
<p>Now that this is no longer true for the right environments (and truth be told, this has always been the case in the right environments), I think the time&#8217;s right for Prototype to take back some of the users it rightly deserves.</p>
<p>The irony of course is back in 2008 jQuery 1.4.2 <em>was </em>in fact smaller: 3549 lines of code vs. Prototype 1.6.0.1&#8242;s 4321. But success comes with a price, and jQuery&#8217;s potential bloat can only be a good thing for users looking to &#8216;trim&#8217;. How wonderful : )</p>
<p>Please understand though: I have nothing against jQuery, I simply feel that Prototype deserves more recognition and is in many ways the superior library for some specific types of work.</p>
<p>This will only happen though, and I cannot be more serious, if the Prototype folks get off their collective butts and do the same thing as jQuery &#8211;  advertise, as prominently as you can, the fact that when minified <em>and </em>gzipped your library <strong>is the same size</strong>.</p>
<h2>Links</h2>
<p><a title="Prototype and jQuery" href="http://thinkrelevance.com/blog/2009/01/12/why-i-still-prefer-prototype-to-jquery.html">http://thinkrelevance.com/blog/2009/01/12/why-i-still-prefer-prototype-to-jquery.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.formboss.net/blog/2011/10/jquery-vs-prototype-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

