<?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>Martijn van der Lee</title>
	<atom:link href="http://martijn.vanderlee.com/martijn/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://martijn.vanderlee.com</link>
	<description></description>
	<lastBuildDate>Wed, 15 Aug 2012 18:40:14 +0000</lastBuildDate>
	<language>nl</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
		<item>
		<title>Thoughts on G-WAN</title>
		<link>http://martijn.vanderlee.com/?p=396</link>
		<comments>http://martijn.vanderlee.com/?p=396#comments</comments>
		<pubDate>Thu, 09 Aug 2012 18:34:44 +0000</pubDate>
		<dc:creator>Martijn</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[apache2]]></category>
		<category><![CDATA[benchmark]]></category>
		<category><![CDATA[gwan]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[static]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[varnish]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[webserver]]></category>

		<guid isPermaLink="false">http://www.vanderlee.com/martijn/?p=396</guid>
		<description><![CDATA[While looking for a quick webserver to serve static content I came across a relatively unknown solution: G-WAN (a.k.a. GWAN, a.k.a. Global-WAN). The extensive statistics and graphs on this blog show significant improvements over more well-known solutions such as Nginx and Varnish. In hindsight, I should have trusted my gut instinct on these benchmarks, but [...]]]></description>
			<content:encoded><![CDATA[<p>While looking for a quick webserver to serve static content I came across a relatively unknown solution: <a title="G-WAN" href="http://gwan.ch/">G-WAN</a> (a.k.a. GWAN, a.k.a. Global-WAN).<br />
The extensive statistics and graphs on <a title="Moot!" href="http://nbonvin.wordpress.com/2011/03/14/apache-vs-nginx-vs-varnish-vs-gwan/">this blog</a> show significant improvements over more well-known solutions such as Nginx and Varnish. In hindsight, I should have trusted my gut instinct on these benchmarks, but my trusting nature took me for a short ride&#8230;</p>
<p><span id="more-396"></span></p>
<h1>Getting busy</h1>
<p>Without hestitation, I launched my &#8220;sandbox&#8221; Amazon EC2 instance with Ubuntu 12.04 x64 and jumped straight into SSH to install G-WAN. Installation was a breeze. Configuring G-WAN is a bit different than usual though, but 15 minutes of reading documentation later, I had it up and running on non-standard port 8888 (G-WAN uses port 80 by default).  Getting it running as a daemon took a bit longer, but in the end it was all running smoothly.</p>
<p>Then came the benchmarking. My initial tests involved simply reloading a small (~57KiB) image a bunch of time while watching `top` running in the shell. It didn&#8217;t take long for the problems to show up. Initially G-WAN didn&#8217;t give a peep. Using a single process with less than 1% of memory (Apache2 typically uses 1.5%-2% for each process and Nginx used ~0.5% per process); much better. CPU% remained at 0%. For a simple image request, Apache tends to show a short 1% peak whereas Nginx keeps a cool 0% as well.</p>
<h1>Standardized testing methodologies</h1>
<p>Trouble starts however, when I pressed the Shift+F5 (no client-side cache, please) a few more times. Memory remained low, but CPU%&#8230; wow. &#8220;Wow&#8221; meaning &#8220;jumping to 100% for a few seconds&#8221;. Quite impressive, though not of the right kind. For comparison, Apache2 just kept giving those small 1% peaks and Nginx, trusty old Nginx, still didn&#8217;t register <em>any</em> CPU%.</p>
<p>It wasn&#8217;t just CPU% though, the latency as measures by the Chrome browser&#8217;s excellent developer tools showed wildly varying numbers for G-WAN responses. Again, initially G-WAN performed an admirable ~45ms for that picture, but when hitting the F5 key some 50 times, I occasionally got responses of over 2 seconds. That&#8217;s two whole frickin&#8217; seconds for a 57KiB image file! Shame! Apache2 handles the same image at right about 160ms each and every time. Nginx, as a reversal of G-WAN&#8217;s behaviour, starts out at ~150ms but quickly drops to ~90ms. Again, neither of these show any weird behaviour as far as CPU% is concerned.</p>
<h1>20-20 hindsight</h1>
<p>As I said before the fold, in hindsight I should have known. The benchmarks on that blog (which are the same shown in the documentation and frequently mentioned on their forum) are somewhat&#8230; &#8220;unworldly&#8221;. By now you&#8217;re probably thinking that a smallish image isn&#8217;t a very reliable real-world benchmark. Compared to the 100-byte text file with only &#8216;x&#8217; characters that is the &#8220;official&#8221; benchmark, it is practically science! Shame! I noticed this before I started testing myself, so I guess that shame is on me.</p>
<p>For what it&#8217;s worth, I&#8217;ve also tried the &#8220;100 &#8216;x&#8217;&#8221; file, using the same hightly acclaimed &#8220;Hit Shift+F5 like a spastic&#8221; method. CPU% for G-WAN remained at a comfortable zero this time, but again, latency slowly increased. In this test, at it&#8217;s best G-WAN performed equal to Nginx at ~45ms and at it&#8217;s worst equal to Apache2 at ~75ms. Apache2 peaked at 1% CPU, Nginx again remained at zero. Also notable is that both Apache2 and Nginx performed consistantly and reliably.</p>
<h1>It smells funny</h1>
<p>I&#8217;m keeping an open mind. The only thing I changed in G-WAN&#8217;s configuration was the port number, and this may be responsible for it&#8217;s lacklustre performance. Also, the G-WAN site clearly states it was tested on Debian and CentOS. Ubuntu derives from Debian, but they are not identical. Another thing to note is that G-WAN is also capable of dynamic websites. Then again, so do Nginx and Apache2. All this does not bode well for G-WAN. Perhaps somebody should do some quality benchmarking. As for me, the G-WAN benchmarks take effort to point out how bad <a title="Varnish" href="https://www.varnish-cache.org/">Varnish</a> performs, so that&#8217;s what I&#8217;ll be testing next.</p>
<p><strong>Update; please read the comments and addendums for more.</strong></p>
<h1>Addendum; Varnish</h1>
<p>Okay, installing <a title="Varnish is better" href="https://www.varnish-software.com">Varnish</a> was pretty easy. Although they claim to support LTS versions of Ubuntu, their site lists only the Lucid (Ubuntu 10.04) repository. Thankfully it was just a matter of search and replace. Simply add &#8220;<span style="font-family: 'courier new', courier;">deb http://repo.varnish-cache.org/ubuntu/ precise varnish-3.0</span>&#8221; to <span style="font-family: 'courier new', courier;">/etc/apt/sources.list</span> and just <span style="font-family: 'courier new', courier;">sudo apt-get update</span>, <span style="font-family: 'courier new', courier;">sudo apt-get install varnish</span>. Some minor configuration later and it&#8217;s running on port 888 with Apache2 as a backend (Varnish is different in that it can&#8217;t serve files on it&#8217;s own; it needs a backend). The 57KiB files has consistent latency in Chrome of about ~60ms (faster than any) with small 0.3% CPU peaks and 0.5% of memory combined over two processes (oddly enough, as I expected it to take the full 256MiB I configured). The small &#8216;x&#8217;-file runs past at ~35ms with same CPU%/memory%.</p>
<p>Running with Nginx as backend (itself with Apache2 as backend) makes no difference whatsoever. That means there is no point in having Nginx sitting between Varnish and Apache2. Alternatively, drop Apache2 and use only Nginx, ideal for pure static content. It should also be noted that Varnish does not handle PHP files by default, some minor configuration lets it cache only specific file extensions (or vice versa). This lets you use Varnish for a dynamic site as well. With Varnish configured like this, it&#8217;d make a great load-balancer/reverse-proxy when used on a separate server (due to memory requirements).</p>
<h1>Addendum; Partial G-wan redemption.</h1>
<p>As commenter Bert so aggressivly pointed out, I made a mistake regarding the &#8220;100-x&#8221; file. I again compare G-wan and V+N (ruining a perfectly good evening) with both the &#8220;official&#8221; ab.c test file and a number of other files. You can read my full findings in the comments below.</p>
<p>The summary conclussion is that, for some files, G-wan does indeed perform quite well. Not quite as well as Varnish+Nginx (although it does have the benefit of a lower memory profile than Varnish), but a lot closer than in previous tests. For some other files, G-wan still uses an extraordinarily large amount of CPU to the point where it dramatically impacts it&#8217;s own performance as well as the entire server. The bad news is that I can see no pattern in which files are delivered fast and which aren&#8217;t.</p>
<p>Sadly this still makes G-wan a bad choice for a production server, though it does show promise for the future.<br />
If it can perform (nearly) on par with Varnish+Nginx, it may have a bright future ahead of it.</p>
]]></content:encoded>
			<wfw:commentRss>http://martijn.vanderlee.com/?feed=rss2&#038;p=396</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Subdomain alias on Plesk 9/Ubuntu</title>
		<link>http://martijn.vanderlee.com/?p=335</link>
		<comments>http://martijn.vanderlee.com/?p=335#comments</comments>
		<pubDate>Wed, 11 Jan 2012 09:58:43 +0000</pubDate>
		<dc:creator>Martijn</dc:creator>
				<category><![CDATA[Plesk]]></category>
		<category><![CDATA[alias]]></category>
		<category><![CDATA[conf]]></category>
		<category><![CDATA[forward]]></category>
		<category><![CDATA[httpdmng]]></category>
		<category><![CDATA[plesk]]></category>
		<category><![CDATA[plesk9]]></category>
		<category><![CDATA[redirect]]></category>
		<category><![CDATA[subdomain]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[vhost]]></category>
		<category><![CDATA[vhost.conf]]></category>
		<category><![CDATA[websrvmng]]></category>

		<guid isPermaLink="false">http://www.vanderlee.com/martijn/?p=335</guid>
		<description><![CDATA[Plesk on Ubuntu is just a little bit different than Plesk on most other Linux platforms. There is plenty of information on how to do subdomain aliasses on Plesk, but to get it working on Ubuntu you need a bit more effort. So&#8230; here&#8217;s how to do it; Make a subdomain like normal using Plesk [...]]]></description>
			<content:encoded><![CDATA[<p><a class="thickbox" title="altair8800" href="http://www.vanderlee.com/martijn/?attachment_id=386" rel="same-post-335"><img class="alignright size-medium wp-image-386" title="altair8800" src="http://www.vanderlee.com/martijn/wp-content/uploads/2012/01/altair8800-300x177.jpg" alt="" width="300" height="177" /></a>Plesk on Ubuntu is just a little bit different than Plesk on most other Linux platforms. There is plenty of information on how to do subdomain aliasses on Plesk, but to get it working on Ubuntu you need a bit more effort. So&#8230; here&#8217;s how to do it;<span id="more-335"></span></p>
<ol>
<li>Make a subdomain like normal using Plesk (I use version 9.2.3, but should be the same atleast for all Plesk 9&#8242;s).</li>
<li>Log in to SSH or FTP as root user (you can&#8217;t do this through the panel; shame on you, Parallels!).</li>
<li>Make a &#8220;<span style="color: #800080;"><strong>vhost.conf</strong></span>&#8221; in the /conf directory in your subdomain. For subdomain &#8220;<span style="color: #ff6600;"><strong>test</strong></span>.<span style="color: #008080;"><strong>example.com</strong></span>&#8221; (assuming the domain is example.com) this would be &#8220;/var/www/vhosts/<span style="color: #008080;"><strong>example.com</strong></span>/subdomains/<span style="color: #ff6600;"><strong>test</strong></span>/conf&#8221; and the file would be &#8220;/var/www/vhosts/<span style="color: #008080;"><strong>example.com</strong></span>/subdomains/<span style="color: #ff6600;"><strong>test</strong></span>/conf/<span style="color: #800080;"><strong>vhost.conf</strong></span>&#8220;. The vhost.conf file is an empty, plain text file.</li>
<li>Edit vhost.conf and insert a line for each alias. For example, alias &#8220;<span style="color: #0000ff;"><strong>alias</strong></span>.<span style="color: #008080;"><strong>example.com</strong></span>&#8221; would require the following line in vhost.conf:<br />
<span style="font-family: 'courier new', courier;">ServerAlias <span style="text-decoration: underline;"><span style="color: #0000ff; text-decoration: underline;">alias</span></span>.<span style="text-decoration: underline;"><span style="color: #008080; text-decoration: underline;">example.com</span></span></span></p>
<ol>
<li>If you use SSL, you must make (copy) an identical file named &#8220;<strong>vhost_ssl.conf</strong>&#8221; in the same directory.</li>
</ol>
</li>
<li>Log in to SSH.</li>
<li>Enter the following command in the terminal (obviously replacing the marked parts):<br />
<strong><span style="font-family: 'courier new', courier;">/usr/local/psa/admin/sbin/websrvmng -u &#8211;vhost-name=<span style="text-decoration: underline;"><span style="color: #008080; text-decoration: underline;">example.com</span></span></span></strong></p>
<ol>
<li>If you want to reconfigure all (sub)domains at once, you can use:<br />
<span style="font-family: 'courier new', courier;"><strong>/usr/local/psa/admin/sbin/websrvmng -a</strong></span></li>
</ol>
</li>
<li>Restart the server through the Plesk panel.</li>
</ol>
<div>That should be it. The change will survive server reboots and such.</div>
]]></content:encoded>
			<wfw:commentRss>http://martijn.vanderlee.com/?feed=rss2&#038;p=335</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Afterdark says &#8220;Afternoon&#8221;</title>
		<link>http://martijn.vanderlee.com/?p=327</link>
		<comments>http://martijn.vanderlee.com/?p=327#comments</comments>
		<pubDate>Wed, 21 Dec 2011 21:51:44 +0000</pubDate>
		<dc:creator>Martijn</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[jqueryui]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[themeroller]]></category>

		<guid isPermaLink="false">http://www.vanderlee.com/martijn/?p=327</guid>
		<description><![CDATA[Afterdark just got a cousin; Afternoon (pictures here) The Afterdark theme has mutated to become a flexible theme framework, where multiple similarly styled themes could be generated from a single &#8220;source code&#8221;. The first product of this is the new &#8220;Afternoon&#8221; theme, a bright and shiney theme with blue tones, for a professional but lighthearted [...]]]></description>
			<content:encoded><![CDATA[<p>Afterdark just got a cousin; Afternoon (pictures here)</p>
<p>The Afterdark theme has mutated to become a flexible theme framework, where multiple similarly styled themes could be generated from a single &#8220;source code&#8221;. The first product of this is the new &#8220;Afternoon&#8221; theme, a bright and shiney theme with blue tones, for a professional but lighthearted feel intended for front-end use.</p>
<p><span id="more-327"></span></p>
<p>As with Afterdark, it&#8217;s a total conversion set of jQueryUI theme settings, form components HTML components and a number of common extra&#8217;s (still working on this). It&#8217;s not complete yet, but the core is growing stronger and more stable all the time.</p>
<p>Next step will be to extract more stuff out of the core source and into the &#8220;theme&#8221; configuration. Eventually the theme should be easily user-configurable from a web interface and be able to render any number of combinations of the style sets &#8220;jqueryui&#8221;, &#8220;html&#8221;, &#8220;form&#8221; and &#8220;extra&#8221;.</p>
<p>If anybody want to dare a &#8220;themeroller&#8221; type site even while this project is still under active developement, please contact me. If you&#8217;re an expert with CSS3 styling, in particular with Mozilla or Opera, your help might even be invaluable.</p>
<p>The location is still unchanged:</p>
<p>Demo: <a href="http://vanderlee.github.com/Afterdark/">http://vanderlee.github.com/Afterdark/<br />
</a>Project: <a href="https://github.com/vanderlee/Afterdark">https://github.com/vanderlee/Afterdark</a></p>
]]></content:encoded>
			<wfw:commentRss>http://martijn.vanderlee.com/?feed=rss2&#038;p=327</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Less Afterdark</title>
		<link>http://martijn.vanderlee.com/?p=322</link>
		<comments>http://martijn.vanderlee.com/?p=322#comments</comments>
		<pubDate>Wed, 07 Dec 2011 22:16:31 +0000</pubDate>
		<dc:creator>Martijn</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://www.vanderlee.com/martijn/?p=322</guid>
		<description><![CDATA[Just updated the Afterdark jQueryUI &#8220;total conversion&#8221; theme. Afterdark delivers a complete style for jQueryUI driven sites, changing not only the look of jQueryUI components, but all layout including body and form elements. It is designed for admin backends but can be used for any purpose. This update adds a little bit of Mozilla (Firefox) [...]]]></description>
			<content:encoded><![CDATA[<p>Just updated the Afterdark jQueryUI &#8220;total conversion&#8221; theme.</p>
<p>Afterdark delivers a complete style for jQueryUI driven sites, changing not only the look of jQueryUI components, but all layout including body and form elements. It is designed for admin backends but can be used for any purpose.</p>
<p><span id="more-322"></span></p>
<p><img title="Meer..." src="http://www.vanderlee.com/martijn/wp-includes/js/tinymce/plugins/wordpress/img/trans.gif" alt="" />This update adds a little bit of Mozilla (Firefox) support and some fixes/additions for Webkit (Chrome/Safari). More importantly, it is now compiled from a .less file using <a href="http://leafo.net/lessphp/">LessPHP</a>, making it much easier to support multiple browsers and keep style more consistent. LessPHP might also make it possible to influence colors/style in the theme, kinda like themeroller, but different.</p>
<p>It should be noted that support for styling of form elements differs wildly among different browsers, so Afterdark will probably look different on each browser. Ideally Afterdark will have some level of native support for  IE9 (and graceful degradation for IE8), Chrome, Firefox, Safari and Opera. Realistically it should atleast look &#8220;normal&#8221; on all browsers.</p>
<p>Demo: <a href="http://vanderlee.github.com/Afterdark/">http://vanderlee.github.com/Afterdark/<br />
</a>Project: <a href="https://github.com/vanderlee/Afterdark">https://github.com/vanderlee/Afterdark</a></p>
]]></content:encoded>
			<wfw:commentRss>http://martijn.vanderlee.com/?feed=rss2&#038;p=322</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jQuery.colorpicker</title>
		<link>http://martijn.vanderlee.com/?p=320</link>
		<comments>http://martijn.vanderlee.com/?p=320#comments</comments>
		<pubDate>Tue, 29 Nov 2011 20:34:31 +0000</pubDate>
		<dc:creator>Martijn</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[colorpicker]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jqueryui]]></category>

		<guid isPermaLink="false">http://www.vanderlee.com/martijn/?p=320</guid>
		<description><![CDATA[Take a look at my new colorpicker component for jQuery: jQuery.colorpicker It looks like a proper jQueryUI themed component and feels like a proper PhotoShop colorpicker, so you get the best of both worlds. My hope is that this plug-in will eventually become part of jQueryUI itself, in order to guarentee the best support and [...]]]></description>
			<content:encoded><![CDATA[<p>Take a look at my new colorpicker component for jQuery: <a title="jQuery.colorpicker" href="http://www.vanderlee.com/martijn/?page_id=314">jQuery.colorpicker</a></p>
<p>It looks like a proper jQueryUI themed component and feels like a proper PhotoShop colorpicker, so you get the best of both worlds.<span id="more-320"></span></p>
<p>My hope is that this plug-in will eventually become part of jQueryUI itself, in order to guarentee the best support and stability, but for now it&#8217;s still in active development.</p>
<p>This colorpicker already includes all the core features and should be stable enough for production (I&#8217;m using it for a production application myself), so give it a try!</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://martijn.vanderlee.com/?feed=rss2&#038;p=320</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Afterdark jQueryUI theme</title>
		<link>http://martijn.vanderlee.com/?p=307</link>
		<comments>http://martijn.vanderlee.com/?p=307#comments</comments>
		<pubDate>Sat, 12 Nov 2011 19:04:47 +0000</pubDate>
		<dc:creator>Martijn</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://www.vanderlee.com/martijn/?p=307</guid>
		<description><![CDATA[A medium to dark gray jQueryUI theme with limegreen/olivegreen accents. Demo: http://vanderlee.github.com/Afterdark/ Project: https://github.com/vanderlee/Afterdark &#160; For one the projects I work on, I needed a theme for the admin backend. Since the admin backend is pretty much for me to do with as I please, I wanted to give it a unique UI. Just because. The site will [...]]]></description>
			<content:encoded><![CDATA[<p>A medium to dark gray jQueryUI theme with limegreen/olivegreen accents.</p>
<p>Demo: <a href="http://vanderlee.github.com/Afterdark/">http://vanderlee.github.com/Afterdark/<br />
</a>Project: <a href="https://github.com/vanderlee/Afterdark">https://github.com/vanderlee/Afterdark</a></p>
<p>&nbsp;</p>
<p><span id="more-307"></span>For one the projects I work on, I needed a theme for the admin backend. Since the admin backend is pretty much for me to do with as I please, I wanted to give it a unique UI. Just because. The site will be <a href="http://jquery.com">jQuery</a>/<a href="http://jqueryui.com">jQueryUI</a>-based, so the obvious choice would be a jQueryUI <a href="http://jqueryui.com/themeroller/">themeroller</a>-based theme. But those themeroller themse are just so boring; they all look the same, no matter how you change the colors.</p>
<p>Instead I decided to follow the route of the excellent <a href="http://taitems.tumblr.com/post/482577430/introducing-aristo-a-jquery-ui-theme">Aristo</a> (which we&#8217;ll hopefully use for the customer-facing UI) and <a href="http://www.michaelvanderheeren.be/archives/382">Absolution</a> themes; take a custom themeroller theme and manually overhaul it to look like I want it to. The demo page I borrowed from Aristo, I hope Mr. Brown doesn&#8217;t mind <img src='http://martijn.vanderlee.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .</p>
<p>Since the theme was made in my spare-time I&#8217;m able to release it to the public with a Creative Commons license! I hope people will find this theme useful and release their own further modifications of it to the open source community; the jQueryUI community desperately needs more freely available non-themeroller themes.<br />
Also; if you find any problems/fixes/improvements/etc. (in particular regarding browser-compatibility), please post issues on github or email me directly.</p>
]]></content:encoded>
			<wfw:commentRss>http://martijn.vanderlee.com/?feed=rss2&#038;p=307</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cycle counting SSE</title>
		<link>http://martijn.vanderlee.com/?p=282</link>
		<comments>http://martijn.vanderlee.com/?p=282#comments</comments>
		<pubDate>Tue, 27 Sep 2011 17:56:37 +0000</pubDate>
		<dc:creator>Martijn</dc:creator>
				<category><![CDATA[SynthMaker]]></category>
		<category><![CDATA[asm]]></category>
		<category><![CDATA[cycle]]></category>
		<category><![CDATA[mmx]]></category>
		<category><![CDATA[sse]]></category>
		<category><![CDATA[sse2]]></category>
		<category><![CDATA[synthmaker]]></category>
		<category><![CDATA[x86]]></category>

		<guid isPermaLink="false">http://www.vanderlee.com/martijn/?p=282</guid>
		<description><![CDATA[While doing some work in SynthMaker, I was optimizing a bunch of DAP paths. This basically means trying to get a small subset of seemingly random chosen SSE and SSE2 instruction to calculate what I want. As the developers of SynthMaker didn&#8217;t bother to implement most of the SSE/SSE2 instruction set (god knows why; reverse engineering [...]]]></description>
			<content:encoded><![CDATA[<p>While doing some work in SynthMaker, I was optimizing a bunch of DAP paths. This basically means trying to get a small subset of seemingly random chosen SSE and SSE2 instruction to calculate what I want. As the developers of SynthMaker didn&#8217;t bother to implement most of the SSE/SSE2 instruction set (god knows why; reverse engineering the code reveals it&#8217;s parser could easily handle most of SSE dealing with packed singles, coincidentally exactly what is used in SynthMaker), most of the common hacks simply won&#8217;t work. Heck, we don&#8217;t even have XORPS!<span id="more-282"></span></p>
<p>So it all boils down to common subexpression elimination (easy, since SynthMaker creates so many) and good ol&#8217; cycle counting. I haven&#8217;t counted cycles since the 6510! Since most ASM programmers have the full set of SSE* operands at their disposal, which typically implements a specialized op for most of what you do, it&#8217;s hard to find a decent cycle chart; most people don&#8217;t need to bother.</p>
<p>Luckily, there are still some resources around. And since I hate to forget, here&#8217;s the best one I found: <a title="SSE cycles" href="http://www.intel80386.com/simd/mmx2-doc.html" target="_blank">http://www.intel80386.com/simd/mmx2-doc.html</a><br />
Yup! It&#8217;s supposedly for the 386, which didn&#8217;t even have MMX, but there you go! It&#8217;s not complete but good enough.</p>
<p>If somebody finds a better chart, let me know!</p>
]]></content:encoded>
			<wfw:commentRss>http://martijn.vanderlee.com/?feed=rss2&#038;p=282</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Interactive shadows; jQuery.shadowtext</title>
		<link>http://martijn.vanderlee.com/?p=278</link>
		<comments>http://martijn.vanderlee.com/?p=278#comments</comments>
		<pubDate>Thu, 08 Sep 2011 17:38:53 +0000</pubDate>
		<dc:creator>Martijn</dc:creator>
				<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.vanderlee.com/martijn/?p=278</guid>
		<description><![CDATA[The jQuery.shadowtext plugin lets you add interactive, animated CSS3 text-shadow to parts of your webpage. The interaction is that it reacts to the mouse cursor position and casts a shadow at the opposite side of text . Or on the same side, or the other way around, or not a shadow at all. It&#8217;s easier [...]]]></description>
			<content:encoded><![CDATA[<p>The jQuery.shadowtext plugin lets you add interactive, animated CSS3 text-shadow to parts of your webpage. The interaction is that it reacts to the mouse cursor position and casts a shadow at the opposite side of text . Or on the same side, or the other way around, or not a shadow at all.</p>
<p>It&#8217;s easier to just demonstrate: <a href="http://blog.vanderlee.com/demo/shadowtext?keepThis=true&TB_iframe=true&height=640&width=960" title="http://blog.vanderlee.com/demo/shadowtext" class="thickbox">http://blog.vanderlee.com/demo/shadowtext</a>  <img src='http://martijn.vanderlee.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p><span id="more-278"></span></p>
<p>One important note is that it does NOT work on IE (anything upto and including IE9, last time I checked), because IE still doesn&#8217;t support CSS3 text-shadow. But it should work on every other normal browser. IE does have filters and some other tricks that kinda look like text-shadow, but catering to their ugliness simply wasn&#8217;t worth the effort for me.</p>
<p>Anyway&#8230; demo/instructions/download can be found here: <a title="jQuery.shadowtext" href="http://www.vanderlee.com/martijn/?page_id=251">jQuery.shadowtext</a>.</p>
<p>p.s. ShadowText can use our <a title="jQuery.px" href="http://www.vanderlee.com/martijn/?page_id=152">jQuery.px</a> plugin if installed. It&#8217;s not required, but having it installed allows you to use more unit types for various distances.</p>
]]></content:encoded>
			<wfw:commentRss>http://martijn.vanderlee.com/?feed=rss2&#038;p=278</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>For&#8230;In and the Array prototype</title>
		<link>http://martijn.vanderlee.com/?p=263</link>
		<comments>http://martijn.vanderlee.com/?p=263#comments</comments>
		<pubDate>Tue, 06 Sep 2011 14:02:42 +0000</pubDate>
		<dc:creator>Martijn</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[each]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[for]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[in]]></category>
		<category><![CDATA[iterate]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[loop]]></category>
		<category><![CDATA[mozilla]]></category>

		<guid isPermaLink="false">http://www.vanderlee.com/martijn/?p=263</guid>
		<description><![CDATA[I just ran into an&#8230; &#8220;interresting&#8221; problem with Javascript. Extending an Array prototype and a naïve For&#8230;In iteration over an array spells trouble in FireFox. I&#8217;ve only seen this issue in FireFox and I suspect it&#8217;s a bug. No doubt it&#8217;ll soon enough be fixed but in the meantime this post may help you fix [...]]]></description>
			<content:encoded><![CDATA[<p>I just ran into an&#8230; &#8220;interresting&#8221; problem with Javascript.<br />
Extending an Array prototype and a naïve For&#8230;In iteration over an array spells trouble in FireFox.<br />
I&#8217;ve only seen this issue in FireFox and I suspect it&#8217;s a bug. No doubt it&#8217;ll soon enough be fixed but in the meantime this post may help you fix it.</p>
<p><span id="more-263"></span></p>
<h1>The situation</h1>
<ol>
<li>Add a function to Array.prototype. In my case this was handily provided by a third party plug-in in the form of an Array.prototype.contains() function.</li>
<li>Use jQuery to load some JSON array. (Haven&#8217;t tested it, but I think any array will do, not just ones created using jQuery, JSON, AJAX or any other specific method).</li>
<li>Iterate over the array using the For&#8230;In loop.</li>
</ol>
<p>Seems innocent enough, but FireFox will also iterate over the contains() function, causing all sorts of weird problems.</p>
<h1>An example</h1>
<p>(Actual buggy code!)</p>
<pre class="brush: jscript; title: ; notranslate">$.post('fields.php'
	,	{	'action': 'get_fields'
		,	'listid': listid
		}
	,	function(json) {
			for (fieldid in json.fields) {
				$('#fields').append(getFieldHTML(fieldid, json.fields[fieldid]));
			}
		}
);</pre>
<h1>So&#8230; how to fix it?</h1>
<p>Since I was using jQuery, the obvious fix was to just use <a href="http://api.jquery.com/jQuery.each/" target="_blank">$.each</a>, which is a usually more convenient anyway. Here&#8217;s the same bit of code as before, but using $.each:</p>
<pre class="brush: jscript; title: ; notranslate">$.post('fields.php'
	,	{	'action': 'get_fields'
		,	'listid': listid
		}
	,	function(json) {
			$.each(json.fields, function(fieldid, name) {
				$('#fields').append(getFieldHTML(fieldid, name));
			});
		}
);</pre>
<p>For a pure Javascript solution (but why bother if we&#8217;re already using jQuery?), the following should work as well:</p>
<pre class="brush: jscript; title: ; notranslate">$.post('fields.php'
	,	{	'action': 'get_fields'
		,	'listid': listid
		}
	,	function(json) {
			for (var fieldid = 0; fieldid &lt; json.fields.length; ++fieldid) {
				$('#fields').append(getFieldHTML(fieldid, json.fields[fieldid]));
			}
		}
);</pre>
<p>The benefit of this last solution is that only the line with the for(&#8230;) statement changes, but I think a similar problem to the one we were trying to fix might occur when iterating over an Object. I&#8217;d rather stick with jQuery and let the collective hivemind of developers prevent my bugs <img src='http://martijn.vanderlee.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://martijn.vanderlee.com/?feed=rss2&#038;p=263</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>non-standard &#8216;vd&#8217; unit in jQuery.px</title>
		<link>http://martijn.vanderlee.com/?p=256</link>
		<comments>http://martijn.vanderlee.com/?p=256#comments</comments>
		<pubDate>Wed, 31 Aug 2011 18:46:51 +0000</pubDate>
		<dc:creator>Martijn</dc:creator>
				<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.vanderlee.com/martijn/?p=256</guid>
		<description><![CDATA[I just did a minor &#8220;v1.0.1&#8243; update to jQuery.px; it now includes the non-standard &#8216;vd&#8217; unit size, which is the hypothenuse of the vw and vd units; 1/100th of the diagonal of the viewport. Seemed like a useful addition to have, even though it&#8217;s not in the CSS3 specs and I doubt it&#8217;ll ever be [...]]]></description>
			<content:encoded><![CDATA[<p>I just did a minor &#8220;v1.0.1&#8243; update to jQuery.px; it now includes the non-standard &#8216;vd&#8217; unit size, which is the hypothenuse of the vw and vd units; 1/100th of the diagonal of the viewport. Seemed like a useful addition to have, even though it&#8217;s not in the CSS3 specs and I doubt it&#8217;ll ever be implemented (then again, they did vm, which is much more useless, IMHO). Get jQuery.px here: <a title="jQuery.px" href="http://www.vanderlee.com/martijn/?page_id=152">jQuery.px</a></p>
]]></content:encoded>
			<wfw:commentRss>http://martijn.vanderlee.com/?feed=rss2&#038;p=256</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
