<?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>Hay Kranen &#187; tutorial / howto</title>
	<atom:link href="http://www.haykranen.nl/category/tutorial/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.haykranen.nl</link>
	<description></description>
	<lastBuildDate>Fri, 30 Dec 2011 23:41:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Using the :first-of-type pseudoselector instead of :first-child</title>
		<link>http://www.haykranen.nl/2011/10/08/using-the-first-of-type-pseudoselector-instead-of-first-child/</link>
		<comments>http://www.haykranen.nl/2011/10/08/using-the-first-of-type-pseudoselector-instead-of-first-child/#comments</comments>
		<pubDate>Sat, 08 Oct 2011 15:15:24 +0000</pubDate>
		<dc:creator>Hay</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[ict+web]]></category>
		<category><![CDATA[tutorial / howto]]></category>

		<guid isPermaLink="false">http://www.haykranen.nl/?p=1793</guid>
		<description><![CDATA[Consider this case: you have a blogpost with an image, a heading, and some text. You want a little margin on the top of every heading to divide the different sections. Your HTML might look like this: &#60;article&#62; &#60;img src="photo.jpg" alt="A nice photo" /&#62; &#60;h3&#62;My heading&#60;/h3&#62; &#60;p&#62;Text. Bla bla bla&#60;/p&#62; &#60;h3&#62;Another heading&#60;/h3&#62; &#60;p&#62;Even more bla [...]]]></description>
			<content:encoded><![CDATA[<p>Consider this case: you have a blogpost with an image, a heading, and some text. You want a little margin on the top of every heading to divide the different sections. Your HTML might look like this:</p>
<pre>&lt;article&gt;
    &lt;img src="photo.jpg" alt="A nice photo" /&gt;
    &lt;h3&gt;My heading&lt;/h3&gt;
    &lt;p&gt;Text. Bla bla bla&lt;/p&gt;

    &lt;h3&gt;Another heading&lt;/h3&gt;
    &lt;p&gt;Even more bla bla&lt;/p&gt;
&lt;/article&gt;
</pre>
<p>Your CSS might looke like this:</p>
<pre>img {
    float: right;
    margin: 0 0 10px 10px;
}

h3 {
    font-size: 24px;
    margin-top: 24px;
}

p {
    font-size: 16px;
    margin: 12px 0;
}
</pre>
<p>Now here&rsquo;s a problem. The very first <tt>&lt;h3&gt;</tt> will have an ugly margin at the top, so it doesn&rsquo;t line up with the image. How would you style it so that it won&rsquo;t have a margin at the top? My first guess was to use the <tt>:first-child</tt> selector:</p>
<pre>article h3:first-child {
    margin-top: 0;
}
</pre>
<p>However, that doesn&rsquo;t work. The <a href="http://www.w3.org/TR/CSS2/selector.html#first-child">spec</a> is not very clear about it: but here&rsquo;s the problem: <tt>:first-child</tt> only selects the <em>very first element</em> and doesn&rsquo;t care about the element you give it. That&rsquo;s great if all your elements are the same (such as <tt>&lt;li&gt;</tt> elements in a list) but it sucks when having a case like this.</p>
<p>Fortunately, there&rsquo;s a new CSS3 property that&rsquo;s perfect for this case. It&rsquo;s called <a href="http://www.quirksmode.org/css/type.html"><tt>:first-of-type</tt></a> and does exactly what you want.</p>
<pre>article h3:first-of-type {
    margin-top: 0;
}
</pre>
<p>Browser support is <a href="http://caniuse.com/#search=first-of-type">mostly pretty good</a>, although you&rsquo;re out of luck on Internet Explorer 8 and earlier.</p>
<img class="colorbox-1793"  src="http://www.haykranen.nl/?ak_action=api_record_view&id=1793&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.haykranen.nl/2011/10/08/using-the-first-of-type-pseudoselector-instead-of-first-child/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing &#8216;OS Process Error&#8217; in CouchDB Single Server for Mac OS X</title>
		<link>http://www.haykranen.nl/2011/08/10/fixing-os-process-error-in-couchdb-single-server-for-mac-os-x/</link>
		<comments>http://www.haykranen.nl/2011/08/10/fixing-os-process-error-in-couchdb-single-server-for-mac-os-x/#comments</comments>
		<pubDate>Wed, 10 Aug 2011 10:02:26 +0000</pubDate>
		<dc:creator>Hay</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[ict+web]]></category>
		<category><![CDATA[tutorial / howto]]></category>

		<guid isPermaLink="false">http://www.haykranen.nl/?p=1781</guid>
		<description><![CDATA[When i downloaded the Couchbase Single Server 1.1.2 for Mac OS X i tried replicating a database and tried to view a view. Unfortunately all i got was endless errors in my log: [error] [&#60;0.159.0&#62;] OS Process Error &#60;0.17372.0&#62; :: {os_process_error,{exit_status,1}} [error] [&#60;0.159.0&#62;] OS Process Error &#60;0.17375.0&#62; :: {os_process_error,{exit_status,1}} [error] [&#60;0.159.0&#62;] OS Process Error &#60;0.17378.0&#62; [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.haykranen.nl/wp-content/uploads/2011/08/couchbase.png"><img class="alignnone size-full wp-image-1782 colorbox-1781" title="couchbase" src="http://www.haykranen.nl/wp-content/uploads/2011/08/couchbase.png" alt="" width="166" height="164" /></a></p>
<p>When i downloaded the Couchbase Single Server 1.1.2 for Mac OS X i tried replicating a database and tried to view a view. Unfortunately all i got was endless errors in my log:</p>
<pre>[error] [&lt;0.159.0&gt;] OS Process Error &lt;0.17372.0&gt; :: {os_process_error,{exit_status,1}}
[error] [&lt;0.159.0&gt;] OS Process Error &lt;0.17375.0&gt; :: {os_process_error,{exit_status,1}}
[error] [&lt;0.159.0&gt;] OS Process Error &lt;0.17378.0&gt; :: {os_process_error,{exit_status,1}}</pre>
<p>When i looked in the configuration i noticed this value in my &#8216;query_servers&#8217;:</p>
<pre>bin/couchjs /Users/dustin/tmp/master/build/share/couchdb/server/main.js</pre>
<p>When you change this to:</p>
<pre>bin/couchjs share/couchdb/server/main.js</pre>
<p>Everything works again.</p>
<p>Vote on the <a href="http://www.couchbase.org/issues/browse/CB-33">ticket</a> to get it fixed for the next release :)</p>
<img class="colorbox-1781"  src="http://www.haykranen.nl/?ak_action=api_record_view&id=1781&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.haykranen.nl/2011/08/10/fixing-os-process-error-in-couchdb-single-server-for-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HOWTO run multiple versions of Firefox side-by-side on Mac OS X Lion</title>
		<link>http://www.haykranen.nl/2011/08/04/howto-run-multiple-versions-of-firefox-side-by-side-on-mac-os-x-lion/</link>
		<comments>http://www.haykranen.nl/2011/08/04/howto-run-multiple-versions-of-firefox-side-by-side-on-mac-os-x-lion/#comments</comments>
		<pubDate>Wed, 03 Aug 2011 23:14:18 +0000</pubDate>
		<dc:creator>Hay</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[ict+web]]></category>
		<category><![CDATA[tutorial / howto]]></category>

		<guid isPermaLink="false">http://www.haykranen.nl/?p=1735</guid>
		<description><![CDATA[Cross-browser testing is pretty essential when developing web sites. Most of the bugs you need to fix are probably in older versions of Internet Explorer. Both Chrome and Firefox have a very fast release cycle, where new versions are released every six weeks or so. However, there are still many people using the older 3.6 [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.haykranen.nl/wp-content/uploads/2011/08/fx36.png"><img class="alignnone size-medium wp-image-1736 colorbox-1735" title="fx36" src="http://www.haykranen.nl/wp-content/uploads/2011/08/fx36-300x300.png" alt="" width="300" height="300" /></a></p>
<p>Cross-browser testing is pretty essential when developing web sites. Most of the bugs you need to fix are probably in older versions of Internet Explorer. Both Chrome and Firefox have a very fast release cycle, where new versions are released every six weeks or so.</p>
<p>However, there are <a href="http://arstechnica.com/web/news/2011/08/july-browser-stats-windows-xp-loses-its-majority-share-of-web-users.ars">still many people</a> using the older 3.6 version of Firefox. Firefox 3.6 has a few bugs, and because of its big installed base you probably need to run some tests on it as well.</p>
<p>There&#8217;s a problem here: Firefox doesn&#8217;t like it when two different versions are run side-by-side. Fortunately there are a few tricks you can use to make this happen. This should also work on Snow Leopard, provided you have at least 10.6.2, because the <tt>--args</tt> parameter was introduced in that version.</p>
<ol>
<li>Download the Firefox 3.6 release from <a href="http://www.mozilla.com/en-US/firefox/all-older.html">Mozilla.com</a>.</li>
<li>Unzip and mount the DMG file.</li>
<li>Drag the file from the DMG to your Desktop instead of to the Applications folder.</li>
<li>Rename the .app to &#8216;Firefox36.app&#8217; and move it to your /Applications folder</li>
<li>Run this command from a Terminal (found in /Applications/Utilities):<br />
<code>/Applications/Firefox36.app/Contents/MacOS/firefox-bin -ProfileManager</code></li>
<li>Add a new account. Call it &#8216;test&#8217;.</li>
<li>Run Automator. From the &#8216;Choose a type for your document&#8217; menu, select &#8216;Application&#8217;.</li>
<li>Drag &#8216;Run Shell Script&#8217; to the action area.</li>
<li>In the content area (where &#8216;cat&#8217; is displayed) copy-paste this line:<br />
<code>open /Applications/Firefox36.app --args -P test</code></li>
<li>Save the document to /Applications as &#8216;Firefox 3.6&#8242;</li>
<li>Drag &#8216;Firefox 3.6&#8242; application from the Applications folder to your dock for fast access.</li>
<li>You&#8217;re done!</li>
</ol>
<p>For a nice icon to differentiate your current Firefox version with the old one get the full resolution PNG from above this article <a href="http://www.haykranen.nl/wp-content/uploads/2011/08/fx36.png">right here</a>. Open it in preview, select all (Cmd-A) and press copy (Cmd-C). Open up the Automator .app by right-clicking and selecting &#8216;Get info&#8217; or hitting Cmd-I. Select the icon in the topleft corner so that it is outlined and press Paste (Cmd-V).</p>
<img class="colorbox-1735"  src="http://www.haykranen.nl/?ak_action=api_record_view&id=1735&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.haykranen.nl/2011/08/04/howto-run-multiple-versions-of-firefox-side-by-side-on-mac-os-x-lion/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Basic HTTP authentication in Node.js using the request module</title>
		<link>http://www.haykranen.nl/2011/06/21/basic-http-authentication-in-node-js-using-the-request-module/</link>
		<comments>http://www.haykranen.nl/2011/06/21/basic-http-authentication-in-node-js-using-the-request-module/#comments</comments>
		<pubDate>Tue, 21 Jun 2011 22:17:54 +0000</pubDate>
		<dc:creator>Hay</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[ict+web]]></category>
		<category><![CDATA[tutorial / howto]]></category>

		<guid isPermaLink="false">http://www.haykranen.nl/?p=1723</guid>
		<description><![CDATA[Here&#8217;s an easy way to use basic authentication while using the request library for Node.js. Unfortunately request doesn&#8217;t come with an easy convenience parameter you can use, so you need to provide it by yourself. The common way is to add it as an extra HTTP header. Let&#8217;s say you need to login to example.com [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s an easy way to use <a href="http://en.wikipedia.org/wiki/Basic_access_authentication">basic authentication</a> while using the <a href="https://github.com/mikeal/request"><tt>request</tt> library</a> for <a href="http://nodejs.org">Node.js</a>.</p>
<p>Unfortunately <tt>request</tt> doesn&#8217;t come with an easy convenience parameter you can use, so you need to provide it by yourself. The common way is to add it as an extra HTTP header.</p>
<p>Let&#8217;s say you need to login to <tt>example.com</tt> using <tt>user</tt> and <tt>pass</tt> as your username/password.</p>
<pre>
var request = require('request'),
    username = "john",
    password = "1234",
    url = "http://www.example.com",
    auth = "Basic " + new Buffer(username + ":" + password).toString("base64");

request(
    {
        url : url,
        headers : {
            "Authorization" : auth
        }
    },
    function (error, response, body) {
        // Do more stuff with 'body' here
    }
);</pre>
<p>This is pretty verbose. Fortunately, you can use a trick using the URL itself, as specified in <a href="http://www.ietf.org/rfc/rfc1738.txt">RFC 1738</a>. Simply pass the user/pass before the host with an <tt>@</tt> sign.</p>
<pre>
var request = require('request'),
    username = "john",
    password = "1234",
    url = "http://" + username + ":" + password + "@www.example.com";

request(
    {
        url : url
    },
    function (error, response, body) {
        // Do more stuff with 'body' here
    }
);</pre>
<p>Nice one huh?</p>
<img class="colorbox-1723"  src="http://www.haykranen.nl/?ak_action=api_record_view&id=1723&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.haykranen.nl/2011/06/21/basic-http-authentication-in-node-js-using-the-request-module/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery 1.5 and JSONP requests</title>
		<link>http://www.haykranen.nl/2011/02/25/jquery-1-5-and-jsonp-requests/</link>
		<comments>http://www.haykranen.nl/2011/02/25/jquery-1-5-and-jsonp-requests/#comments</comments>
		<pubDate>Fri, 25 Feb 2011 19:54:31 +0000</pubDate>
		<dc:creator>Hay</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[ict+web]]></category>
		<category><![CDATA[tutorial / howto]]></category>

		<guid isPermaLink="false">http://www.haykranen.nl/?p=1659</guid>
		<description><![CDATA[jQuery 1.5 adds better support for JSONP requests. As you might know, JSONP is a way to avoid the same-origin policy and do cross-domain requests by adding a method call around the JSON data. Because browsers don&#8217;t return data from requests that fail, error handling is tricky compared to normal AJAX requests. There is a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.jquery.com/2011/01/31/jquery-15-released/">jQuery 1.5</a> adds better support for JSONP requests. As you might know, JSONP is a way to avoid the same-origin policy and do cross-domain requests by <a href="http://en.wikipedia.org/wiki/JSONP#JSONP">adding a method call</a> around the JSON data.</p>
<p>Because browsers don&#8217;t return data from requests that fail, error handling is tricky compared to normal AJAX requests. There is a workaround by using a timer, which is the way the popular <a href="http://code.google.com/p/jquery-jsonp/">jquery.jsonp</a> plugin solves it.</p>
<p>jQuery 1.5 adds this workaround, so you don&#8217;t need this plugin. All other features of the plugin, such as custom callback naming, are possible in jQuery now as well.</p>
<p>Here&#8217;s an example:</p>
<pre>var req = $.ajax({
    url : url,
    dataType : "jsonp",
    timeout : 10000
});

req.success(function() {
    console.log('Yes! Success!');
});

req.error(function() {
    console.log('Oh noes!');
});</pre>
<p>The <tt>timeout</tt> parameter is essential, because this indicates when a request should be considered &#8216;failed&#8217;. Because of this extra parameter you need to use <tt>$.ajax</tt> instead of <tt>$.getJSON</tt>.</p>
<p>The <tt>req</tt> variable contains the <a href="http://api.jquery.com/jQuery.ajax/#jqXHR">jqXHR</a> object, which can be used to attach multiple callbacks and error handlers.</p>
<img class="colorbox-1659"  src="http://www.haykranen.nl/?ak_action=api_record_view&id=1659&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.haykranen.nl/2011/02/25/jquery-1-5-and-jsonp-requests/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Koffie + Wifi: Centrale Bibliotheek Utrecht</title>
		<link>http://www.haykranen.nl/2010/12/30/koffie-wifi-centrale-bibliotheek-utrecht/</link>
		<comments>http://www.haykranen.nl/2010/12/30/koffie-wifi-centrale-bibliotheek-utrecht/#comments</comments>
		<pubDate>Thu, 30 Dec 2010 15:46:03 +0000</pubDate>
		<dc:creator>Hay</dc:creator>
				<category><![CDATA[koffie+wifi]]></category>
		<category><![CDATA[leven]]></category>
		<category><![CDATA[nederlands]]></category>
		<category><![CDATA[tutorial / howto]]></category>

		<guid isPermaLink="false">http://www.haykranen.nl/?p=1567</guid>
		<description><![CDATA[De zogenaamde digitale nomade is in opkomst: geen kantoor meer nodig, je werkt op je laptop vanuit een koffiebar. Of zoiets. Nu zou ik mezelf helemaal geen digitale nomade willen noemen, maar ik vind het wel fijn om af en toe wat mails weg te werken op een andere plek dan mijn eigen huis. De [...]]]></description>
			<content:encoded><![CDATA[<p><em>De zogenaamde <a href="http://www.nrcnext.nl/geld-en-werk/2009/06/10/hoe-word-je-een-digitale-nomade/">digitale nomade</a> is in opkomst: geen kantoor meer nodig, je werkt op je laptop vanuit een koffiebar. Of zoiets. Nu zou ik mezelf helemaal geen digitale nomade willen noemen, maar ik vind het wel fijn om af en toe wat mails weg te werken op een andere plek dan mijn eigen huis.</em></p>
<p><em>De eisen zijn simpel: koffie en wifi. Maar dat te vinden is nog niet zo makkelijk. Ik probeer af en toe een locatie uit en ik blog hier mijn bevindingen. </em></p>
<p>Deze keer: de <strong><a href="http://bibliotheekutrecht.nl/">centrale bibliotheek in Utrecht</a></strong>.</p>
<h3>Wifi</h3>
<p>Wisselend. Hotspot van KPN die gratis is voor alle bezoekers (dus ook niet-leden). Inloggen op &#8216;KPN&#8217;, willekeurige webpagina openen en &#8216;akkoord met de voorwaarden&#8217; en je kunt internetten. Meestal. De snelheid wisselt nogal: als je eenmaal verbinding hebt werkt het meestal ok (Spotify gaat prima), maar soms gaat het ook tergend traag. En niet overal bereik: bijvoorbeeld bij de leuke tafeltjes bij het raam. De tafeltjes bij de koffiecorner lijken goed bereik te hebben. Wel een voordeel: weinig geblokkeerde poorten: SSH, VPN, Secure IMAP en zelfs IRC doen het.</p>
<p>Voor de nerds: hier is het grafiekje van <a href="http://www.speedtest.net">speedtest.net</a>:</p>
<p><img class="alignnone size-full wp-image-1671 colorbox-1567" title="1194086349" src="http://www.haykranen.nl/wp-content/uploads/2010/12/1194086349.png" alt="" width="300" height="135" /></p>
<h3>Koffie</h3>
<p>Uitstekend, bij de koffiebar. Lekkere latte voor 2.10. Gratis water en prima broodjes en koekjes.</p>
<h3>Stroom</h3>
<p>Stopcontacten zijn sporadisch en niet altijd makkelijk te vinden. Goed zoeken of met een volle accu binnen komen.</p>
<h3>Toilet</h3>
<p>Begane grond. 50 cent.</p>
<h3>Omgeving</h3>
<p>Locatie is prachtig, in een mooi pand boven de Broese met uitzicht op de Stadhuisbrug. Voor een bibliotheek enigszins rumoerig, maar rustiger dan bijvoorbeeld bij <a title="Koffie + Wifi: Seats2meet Utrecht" href="http://www.haykranen.nl/2011/02/25/koffie-wifi-seats2meet-utrecht/">Seats2meet</a>. Redelijk wat werkplekken, maar het is soms even zoeken naar een plek met én goed wifi bereik én stroom. Kans op zwervers die naast je gaan zitten en in slaap vallen of draaiorgels die op straat &#8216;Shalalieshalala&#8217; van Sieneke en Vader Abraham spelen.</p>
<h3>Openingstijden</h3>
<p>Maandag en donderdag tot 21.00. Anders tot 18.00. Niet open op zondag. <a href="http://www.bibliotheek-utrecht.nl/nl/home/Vestigingen/centralebibliotheek">Alle openingstijden</a>.</p>
<h3>Oordeel</h3>
<p>Als de wifi het doet is de centrale bibliotheek een prima plek, zeker vanwege de koffie en goede locatie. Jammer het trage internet, de vroege sluitingstijden (en niet open zijn op zondag) en het gebrek aan stopcontacten.</p>
<p><strong>Cijfer: 7,5</strong></p>
<p><strong>Locatie:</strong> Oudegracht 167. <a href="http://maps.google.nl/maps?f=q&amp;source=s_q&amp;hl=nl&amp;geocode=&amp;q=oudegracht+167,+utrecht&amp;sll=52.091874,5.118835&amp;sspn=0.003408,0.008765&amp;ie=UTF8&amp;hq=&amp;hnear=Oudegracht+167,+Lange+Elisabethstraat+Mariaplaats,+Utrecht&amp;ll=52.091333,5.119071&amp;spn=0.006816,0.017531&amp;z=16">Kaartje</a>.</p>
<img class="colorbox-1567"  src="http://www.haykranen.nl/?ak_action=api_record_view&id=1567&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.haykranen.nl/2010/12/30/koffie-wifi-centrale-bibliotheek-utrecht/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>De ultieme chocolademelk</title>
		<link>http://www.haykranen.nl/2010/12/28/de-ultieme-chocolademelk/</link>
		<comments>http://www.haykranen.nl/2010/12/28/de-ultieme-chocolademelk/#comments</comments>
		<pubDate>Tue, 28 Dec 2010 19:31:43 +0000</pubDate>
		<dc:creator>Hay</dc:creator>
				<category><![CDATA[leuk]]></category>
		<category><![CDATA[nederlands]]></category>
		<category><![CDATA[tutorial / howto]]></category>
		<category><![CDATA[chocolademelk]]></category>
		<category><![CDATA[recept]]></category>
		<category><![CDATA[winter]]></category>

		<guid isPermaLink="false">http://www.haykranen.nl/?p=1561</guid>
		<description><![CDATA[Vanwege het winterweer het ultieme recept voor warme chocolademelk Vul zoveel kopjes als nodig met (halfvolle) melk. Gooi alle melk in een klein pannetje. Laat een beetje melk over in de kopjes. Verwarm de melk op een laag vuurtje. Niet laten koken! Roer in elk kopje 2 en een half theelepeltje cacao (b.v. Blooker of [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_1562" class="wp-caption alignnone" style="width: 310px"><a href="http://www.flickr.com/photos/jlz/4169031076/"><img class="size-medium wp-image-1562  colorbox-1561" title="Chocolate Milk" src="http://www.haykranen.nl/wp-content/uploads/2010/12/cmelk-300x199.jpg" alt="" width="300" height="199" /></a><p class="wp-caption-text">Foto: Jukka Zikking / CC-BY</p></div>
<p>Vanwege het winterweer het ultieme recept voor <strong>warme chocolademelk</strong></p>
<ol>
<li>Vul zoveel kopjes als nodig met (halfvolle) melk.</li>
<li>Gooi alle melk in een klein pannetje. Laat een beetje melk over in de kopjes.</li>
<li>Verwarm de melk op een laag vuurtje. Niet laten koken!</li>
<li>Roer in elk kopje 2 en een half theelepeltje cacao (b.v. Blooker of Droste) en 1 theelepel suiker.</li>
<li>Roer het restje melk, cacao en suiker goed door elkaar zodat het een gladde massa wordt.</li>
<li>Voeg de warme melk toe in elk kopje en roer nog even goed door.</li>
<li>Voor het extra feestelijke element kun je nog slagroom op de melk spuiten.</li>
</ol>
<p><strong> </strong></p>
<img class="colorbox-1561"  src="http://www.haykranen.nl/?ak_action=api_record_view&id=1561&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.haykranen.nl/2010/12/28/de-ultieme-chocolademelk/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Escaping dollar signs in PHP regular expressions</title>
		<link>http://www.haykranen.nl/2010/09/07/escaping-dollar-signs-in-php-regular-expressions/</link>
		<comments>http://www.haykranen.nl/2010/09/07/escaping-dollar-signs-in-php-regular-expressions/#comments</comments>
		<pubDate>Tue, 07 Sep 2010 08:53:34 +0000</pubDate>
		<dc:creator>Hay</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[ict+web]]></category>
		<category><![CDATA[tutorial / howto]]></category>

		<guid isPermaLink="false">http://www.haykranen.nl/?p=1443</guid>
		<description><![CDATA[I had some problems matching dollar signs in PHP regexp&#8217;s: $str = 'Bacon $ham eggs and $spam'; preg_match_all("&#124;\$&#124;", $str, $matches); print_r($matches); Gives Array ( [0] =&#62; Array ( [0] =&#62; ) ) It does work when double escaping the $ preg_match_all("&#124;\\$&#124;", $str, $matches); Gives Array ( [0] =&#62; Array ( [0] =&#62; $ [1] =&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>I had some problems matching dollar signs in PHP regexp&#8217;s:</p>
<pre>$str = 'Bacon $ham eggs and $spam';
preg_match_all("|\$|", $str, $matches);
print_r($matches);</pre>
<p>Gives</p>
<pre>Array
(
    [0] =&gt; Array
        (
            [0] =&gt;
        )
)</pre>
<p>It does work when double escaping the $</p>
<pre>preg_match_all("|\\$|", $str, $matches);</pre>
<p>Gives</p>
<pre>Array
(
    [0] =&gt; Array
        (
            [0] =&gt; $
            [1] =&gt; $
        )

)</pre>
<p>This problem occurs because PHP substitutes $variables in <a href="http://www.codewalkers.com/c/a/Programming-Basics/PHP-Strings-Primer/3/">strings enclosed in &#8220;double quotes&#8221;</a>. So, actually the problem can very easily be solved by just replacing double with single quotes:</p>
<pre>preg_match_all('|\$\' $str, $matches);</pre>
<img class="colorbox-1443"  src="http://www.haykranen.nl/?ak_action=api_record_view&id=1443&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.haykranen.nl/2010/09/07/escaping-dollar-signs-in-php-regular-expressions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript and sorting</title>
		<link>http://www.haykranen.nl/2010/08/12/javascript-and-sorting/</link>
		<comments>http://www.haykranen.nl/2010/08/12/javascript-and-sorting/#comments</comments>
		<pubDate>Thu, 12 Aug 2010 08:11:27 +0000</pubDate>
		<dc:creator>Hay</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[ict+web]]></category>
		<category><![CDATA[tutorial / howto]]></category>

		<guid isPermaLink="false">http://www.haykranen.nl/?p=1348</guid>
		<description><![CDATA[Sorting in Javascript using the Array.sort() function doesn&#8217;t work how i thought it did: var foo = [3, 4, 5, 2, 1]; foo.sort(function(a,b) { return a < b; }); console.log(foo); In Firefox this gives the result you expect ([1,2,3,4,5]), but in Chrome and Safari, it doesn't (and in IE too probably). When re-reading the spec [...]]]></description>
			<content:encoded><![CDATA[<p>Sorting in Javascript using the <tt>Array.sort()</tt> function doesn&#8217;t work how i thought it did:</p>
<pre>
var foo = [3, 4, 5, 2, 1];
foo.sort(function(a,b) {
    return a < b;
});
console.log(foo);
</pre>
<p>In Firefox this gives the result you expect (<tt>[1,2,3,4,5]</tt>), but in Chrome and Safari, it doesn't (and in IE too probably). When <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/sort">re-reading the spec at Mozilla's dev site</a> i discovered why:</p>
<blockquote style="font-size:10px;"><p>
If compareFunction(a, b) is less than 0, sort a to a lower index than b. (…) If compareFunction(a, b) is greater than 0, sort b to a lower index than a.</p></blockquote>
<p>So, the return value should not be <tt>true</tt> or <tt>false</tt> but -1 or 1. The example above should be written as:</p>
<pre>
foo.sort(function(a,b) {
    return a - b;
});
</pre>
<img class="colorbox-1348"  src="http://www.haykranen.nl/?ak_action=api_record_view&id=1348&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.haykranen.nl/2010/08/12/javascript-and-sorting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HOWTO completely disable the auto-translate feature in Google Chrome</title>
		<link>http://www.haykranen.nl/2010/07/17/howto-completely-disable-the-auto-translate-feature-in-google-chrome/</link>
		<comments>http://www.haykranen.nl/2010/07/17/howto-completely-disable-the-auto-translate-feature-in-google-chrome/#comments</comments>
		<pubDate>Sat, 17 Jul 2010 11:13:58 +0000</pubDate>
		<dc:creator>Hay</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[tutorial / howto]]></category>

		<guid isPermaLink="false">http://www.haykranen.nl/?p=1321</guid>
		<description><![CDATA[Preferences (either from the menu or from the wrench) &#8211;&#62; Under the hood &#8211;&#62; Scroll down to &#8216;Web content&#8217; and uncheck &#8216;Offer to translate pages that aren&#8217;t in a language i read&#8217;. I didn&#8217;t know this option existed. However, i still think Chrome should have an option in the dropdown menu in the translation bar [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.haykranen.nl/wp-content/uploads/2010/07/chrome.jpg"><img class="alignnone size-medium wp-image-1322 colorbox-1321" title="chrome" src="http://www.haykranen.nl/wp-content/uploads/2010/07/chrome-300x300.jpg" alt="" width="300" height="300" /></a></p>
<p>Preferences (either from the menu or from the wrench) &#8211;&gt; Under the hood &#8211;&gt; Scroll down to &#8216;Web content&#8217; and uncheck &#8216;Offer to translate pages that aren&#8217;t in a language i read&#8217;.</p>
<p>I didn&#8217;t know this option existed. However, i still think Chrome should have an option in the dropdown menu in the translation bar itself, <a href="http://code.google.com/p/chromium/issues/detail?id=48776">for which i&#8217;ve opened a ticket</a>.</p>
<img class="colorbox-1321"  src="http://www.haykranen.nl/?ak_action=api_record_view&id=1321&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.haykranen.nl/2010/07/17/howto-completely-disable-the-auto-translate-feature-in-google-chrome/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

