<?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; english</title>
	<atom:link href="http://www.haykranen.nl/category/english/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>logrotate, virtual hosts on Apache and 100% CPU</title>
		<link>http://www.haykranen.nl/2011/11/15/logrotate-virtual-hosts-on-apache-and-100-cpu/</link>
		<comments>http://www.haykranen.nl/2011/11/15/logrotate-virtual-hosts-on-apache-and-100-cpu/#comments</comments>
		<pubDate>Tue, 15 Nov 2011 16:33:20 +0000</pubDate>
		<dc:creator>Hay</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[ict+web]]></category>

		<guid isPermaLink="false">http://www.haykranen.nl/?p=1803</guid>
		<description><![CDATA[I got a typo in my logrotate config which pretty much killed my VPS. My Apache server runs a lot of virtual hosts, i didn&#8217;t want to type them all out for logrotate, so i created something like this to handle it: /var/www/*/logs/*.lo* { daily missingok rotate 7 compress delaycompress notifempty create 640 root adm [...]]]></description>
			<content:encoded><![CDATA[<p>I got a typo in my <tt>logrotate</tt> config which pretty much killed my VPS.</p>
<p>My Apache server runs a lot of virtual hosts, i didn&#8217;t want to type them all out for <tt>logrotate</tt>, so i created something like this to handle it:</p>
<pre>
/var/www/*/logs/*.lo* {
        daily
        missingok
        rotate 7
        compress
        delaycompress
        notifempty
        create 640 root adm
        sharedscripts
        postrotate
                if [ -f "`. /etc/apache2/envvars ; echo ${APACHE_PID_FILE:-/var/run/apache2.pid}`" ]; then
                        /etc/init.d/apache2 reload > /dev/null
                fi
        endscript
}
</pre>
<p>Note the ending <tt>*</tt> at the first line. I didn&#8217;t know what got into me, but this caused <tt>logrotate</tt> to rotate the rotated logfiles, hence 100% CPU and hence, a broken system.</p>
<p>I fixed it (by replacing the &#8216;*&#8217; with a &#8216;g&#8217;), but logrotate still didn&#8217;t work. CPU stayed at 100%, logs didn&#8217;t rotate. So i ran a <tt>strace -f logrotate</tt> and got lots of these:</p>
<pre>
stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=2917, ...}) = 0
stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=2917, ...}) = 0
stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=2917, ...}) = 0
</pre>
<p>A little bit of Googling turned up <a href="http://www.uno-code.com/?q=node/146">this</a> blogpost: apparently <tt>lograte</tt>&#8216;s own log got corrupted. A simple <tt>rm /var/lib/logrotate/status</tt> did the trick and everything worked perfectly again.</p>
<img class="colorbox-1803"  src="http://www.haykranen.nl/?ak_action=api_record_view&id=1803&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.haykranen.nl/2011/11/15/logrotate-virtual-hosts-on-apache-and-100-cpu/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<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>Git: merging specific files from another branch</title>
		<link>http://www.haykranen.nl/2011/07/18/git-merging-specific-files-from-another-branch/</link>
		<comments>http://www.haykranen.nl/2011/07/18/git-merging-specific-files-from-another-branch/#comments</comments>
		<pubDate>Mon, 18 Jul 2011 11:04:56 +0000</pubDate>
		<dc:creator>Hay</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[ict+web]]></category>

		<guid isPermaLink="false">http://www.haykranen.nl/?p=1730</guid>
		<description><![CDATA[Jason Rudolph has a great blog post on merging files from one branch to another in git. In most cases you probably want to cherry-pick commits, however for a quick and fast solution this is pretty cool: $ git branch * master twitter_integration $ git checkout twitter_integration app/avatar.rb $ git status # On branch master [...]]]></description>
			<content:encoded><![CDATA[<p>Jason Rudolph has a <a href="http://jasonrudolph.com/blog/2009/02/25/git-tip-how-to-merge-specific-files-from-another-branch/">great blog post</a> on merging files from one branch to another in git. In most cases you probably want to cherry-pick commits, however for a quick and fast solution this is pretty cool:</p>
<pre>
$ git branch
* master
  twitter_integration
$ git checkout twitter_integration app/avatar.rb
$ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD &lt;file&gt;..." to unstage)
#
#   new file:   app/models/avatar.rb
#
$ git commit -m "'Merge' avatar code from 'twitter_integration' branch"
[master]: created 4d3e37b: "'Merge' avatar code from 'twitter_integration' branch"
1 file changed, 72 insertions(+), 0 deletions(-)
</pre>
<p>Two things i noticed about this method:</p>
<ul>
<li>Wildcards and directories work too. So instead of getting a single file from another branch you can also do a <tt>git checkout branch *</tt> or <tt>git checkout branch path/to/directory</tt></li>
<li>All paths are relative, so if you&#8217;re not in the root of a repo, you need to give the relative path to your file(s).</li>
</ul>
<img class="colorbox-1730"  src="http://www.haykranen.nl/?ak_action=api_record_view&id=1730&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.haykranen.nl/2011/07/18/git-merging-specific-files-from-another-branch/feed/</wfw:commentRss>
		<slash:comments>0</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>Silverlight browsers bugs</title>
		<link>http://www.haykranen.nl/2011/06/07/silverlight-bugs/</link>
		<comments>http://www.haykranen.nl/2011/06/07/silverlight-bugs/#comments</comments>
		<pubDate>Tue, 07 Jun 2011 08:51:28 +0000</pubDate>
		<dc:creator>Hay</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[ict+web]]></category>

		<guid isPermaLink="false">http://www.haykranen.nl/?p=1707</guid>
		<description><![CDATA[Silverlight is one of those browser technologies that you just wish wasn&#8217;t there. Proprietary,buggy, not widely used, and difficult to implement. Unfortunately, sometimes you can&#8217;t live without it when you want to play, for example, Windows Media files in a browser. While working with Silverlight i encountered quite a few bugs in its implementation in [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.haykranen.nl/wp-content/uploads/2011/06/silverlight.jpg"><img class="alignnone size-medium wp-image-1708 colorbox-1707" title="silverlight" src="http://www.haykranen.nl/wp-content/uploads/2011/06/silverlight-300x200.jpg" alt="" width="300" height="200" /></a></p>
<p><a href="http://www.silverlight.net/">Silverlight</a> is one of those browser technologies that you just wish wasn&#8217;t there. Proprietary,buggy, not widely used, and difficult to implement. Unfortunately, sometimes you can&#8217;t live without it when you want to play, for example, Windows Media files in a browser.</p>
<p>While working with Silverlight i encountered quite a few bugs in its implementation in browsers, especially when working together with Javascript. Here are a few bugs i encountered and possible workarounds.</p>
<p>All these bugs are noticed when using Silverlight 4.</p>
<h3>overflow:hidden / overflow:auto bug</h3>
<p><strong>Browsers affected</strong>: Firefox 4 (Mac / Win)</p>
<p><strong>The bug</strong>: when you put the Silverlight <tt>&lt;object&gt;</tt> inside a div, every time you change the <tt>overflow</tt> property from <tt>hidden</tt> to <tt>auto</tt> (making scrollbars appear) the Silverlight object re-initializes. This is especially frustrating with videos, that start from the beginning.</p>
<p>The <a href="http://msdn.microsoft.com/en-us/library/cc189089(v=vs.95).aspx">official docs</a> actually have this wonderful explanation:</p>
<blockquote><p>Because of browser differences, the Silverlight plug-in does not support the cascading style sheets (CSS)overflow property on the object element or on a parent container element, such as a div element.</p></blockquote>
<p><strong>Workaround</strong>: This only seems to happen when the overflow property is changed by a <strong>user action</strong>, such as with a :hover pseudoclass. When you &#8216;force&#8217; the browser to hide the scrollbar the Silverlight object doesn&#8217;t restart. For example, when you set the height of the div to a very large height the scrollbar disappears but the object doesn&#8217;t restart.</p>
<p>Another workaround when you need a scrollbar is to use a custom Javascript solution. I recommend the excellent <a href="http://jscrollpane.kelvinluck.com/">jScrollPane jQuery plugin</a>.</p>
<h3><strong>Offscreen initialize bug</strong></h3>
<p><strong>Browsers affected: </strong>All browsers on Mac (tested: Chrome, Safari, Firefox)</p>
<p><strong>The bug</strong>: This Mac-only bug happens when you initialize the Silverlight object at a place that is not on-screen (for example to create an audio-only player that you don&#8217;t want to see) the object doesn&#8217;t initialize. When you scroll the object into screen (e.g. by using Firebug) the object starts.</p>
<p><strong>Workaround</strong>: difficult. With an audio player you could put it in a div with <tt>position: fixed</tt>, but putting multiple &#8216;audio pixels&#8217; on top of each other using <tt>z-index</tt> won&#8217;t work though.</p>
<p>&nbsp;</p>
<img class="colorbox-1707"  src="http://www.haykranen.nl/?ak_action=api_record_view&id=1707&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.haykranen.nl/2011/06/07/silverlight-bugs/feed/</wfw:commentRss>
		<slash:comments>2</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>Random Album Generator</title>
		<link>http://www.haykranen.nl/2011/01/05/random-album-generator/</link>
		<comments>http://www.haykranen.nl/2011/01/05/random-album-generator/#comments</comments>
		<pubDate>Wed, 05 Jan 2011 18:34:54 +0000</pubDate>
		<dc:creator>Hay</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[kunst+muziek+cultuur]]></category>
		<category><![CDATA[leuk]]></category>
		<category><![CDATA[nederlands]]></category>

		<guid isPermaLink="false">http://www.haykranen.nl/?p=1612</guid>
		<description><![CDATA[CREATE YOUR DEBUT ALBUM COVER 1 &#8211; Go to &#8220;wikipedia.&#8221; Hit &#8220;random&#8230; Read More&#8230; Read More&#8221; or click http://en.wikipedia.org/wiki/Special:Random The first random wikipedia article you get is the name of your band. (alternatively, if the first article you hit is short, hit Random Article two more times.) 2 &#8211; Go to &#8220;Random quotations&#8221; or click [...]]]></description>
			<content:encoded><![CDATA[
<a href='http://www.haykranen.nl/2011/01/05/random-album-generator/dejeuner/' title='dejeuner'><img width="150" height="150" src="http://www.haykranen.nl/wp-content/uploads/2011/01/dejeuner-150x150.jpg" class="attachment-thumbnail colorbox-1612" alt="dejeuner" title="dejeuner" /></a>
<a href='http://www.haykranen.nl/2011/01/05/random-album-generator/mistyhyman/' title='mistyhyman'><img width="150" height="150" src="http://www.haykranen.nl/wp-content/uploads/2011/01/mistyhyman-150x150.jpg" class="attachment-thumbnail colorbox-1612" alt="mistyhyman" title="mistyhyman" /></a>
<a href='http://www.haykranen.nl/2011/01/05/random-album-generator/pianoman/' title='pianoman'><img width="150" height="150" src="http://www.haykranen.nl/wp-content/uploads/2011/01/pianoman-150x150.jpg" class="attachment-thumbnail colorbox-1612" alt="pianoman" title="pianoman" /></a>

<p>CREATE YOUR DEBUT ALBUM COVER</p>
<p>1 &#8211; Go to &#8220;wikipedia.&#8221; Hit &#8220;random&#8230; Read More&#8230; Read More&#8221; or click <a href="http://en.wikipedia.org/wiki/Special:Random">http://en.wikipedia.org/wiki/Special:Random</a></p>
<p>The first random wikipedia article you get is the name of your band. (alternatively, if the first article you hit is short, hit Random Article two more times.)</p>
<p>2 &#8211; Go to &#8220;Random quotations&#8221;<br />
or click <a href="http://www.quotationspage.com/random.php3">http://www.quotationspage.com/random.php3</a></p>
<p>The last four or five words of the very last quote of the page is the title of your first album.</p>
<p>3 &#8211; Go to flickr and click on &#8220;explore the last seven days&#8221; or click <a href="http://www.flickr.com/explore/interesting/7days">http://www.flickr.com/explore/interesting/7days</a></p>
<p>Third picture, no matter what it is, will be your album cover.</p>
<p>4 &#8211; Go to You tube and type without looking-the first music in the search results is your bands hot new Indie release!!</p>
<p>**Alternatively you can ask people in the group to post music that sounds like a good match with your album cover.</p>
<p>5 &#8211; Use photoshop or similar to put it all together.</p>
<p>6 &#8211; Post it to FB with this text in the &#8220;caption&#8221; and TAG the friends you want to join in.</p>
<p>7 &#8211; Use this URL to invite people to this group so they can share their masterpieces:<a href=" http://tinyurl.com/dh4bqr"> http://tinyurl.com/dh4bqr</a></p>
<img class="colorbox-1612"  src="http://www.haykranen.nl/?ak_action=api_record_view&id=1612&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.haykranen.nl/2011/01/05/random-album-generator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Emulating HTML5 &lt;details&gt; and &lt;summary&gt; behaviour using jQuery</title>
		<link>http://www.haykranen.nl/2010/12/20/emulating-html5-and-behaviour-using-jquery/</link>
		<comments>http://www.haykranen.nl/2010/12/20/emulating-html5-and-behaviour-using-jquery/#comments</comments>
		<pubDate>Mon, 20 Dec 2010 16:46:23 +0000</pubDate>
		<dc:creator>Hay</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[ict+web]]></category>
		<category><![CDATA[frontend]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.haykranen.nl/?p=1546</guid>
		<description><![CDATA[A little known new feature of HTML5 are the &#60;details&#62; and &#60;summary&#62; tags.  Combined, you can use these two tags to create a disclosure widget. Something you&#8217;ve probably seen before. Here&#8217;s an example from the Mac Finder: Clicking the arrow next to &#8216;Devices&#8217; hides or shows the &#8216;children&#8217; under it. A very useful interface element. [...]]]></description>
			<content:encoded><![CDATA[<p>A little known new feature of HTML5 are the <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/interactive-elements.html#the-details-element">&lt;details&gt; and &lt;summary&gt; tags</a>.  Combined, you can use these two tags to create a <a href="http://en.wikipedia.org/wiki/Disclosure_widget">disclosure widget</a>. Something you&#8217;ve probably seen before. Here&#8217;s an example from the Mac Finder:</p>
<p><img class="alignnone size-full wp-image-1548 colorbox-1546" title="disclosure" src="http://www.haykranen.nl/wp-content/uploads/2010/12/disclosure.png" alt="" width="144" height="90" /></p>
<p>Clicking the arrow next to &#8216;Devices&#8217; hides or shows the &#8216;children&#8217; under it. A very useful interface element. Until now, there was no standard for doing that (i usually used &lt;fieldset&gt; and &lt;legend&gt; to code it).</p>
<p>Unfortunately, it&#8217;s not supported in any browser (yet). But thanks to the power of jQuery we can make a very simple plugin that emulates this behaviour. My version is really simple, but if you need something more sophisticated check out <a href="http://mathiasbynens.be/notes/html5-details-jquery">@mathias&#8217; solution</a>.</p>
<p><a href="http://projects.haykranen.nl/detailsshim/example.html">Here&#8217;s an example</a>.</p>
<p>Download the plugin from <a href="https://gist.github.com/748596">Github</a> or copy-paste from below:</p>
<p><script src="https://gist.github.com/748596.js?file=jquery.detailsshim.js"></script></p>
<img class="colorbox-1546"  src="http://www.haykranen.nl/?ak_action=api_record_view&id=1546&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.haykranen.nl/2010/12/20/emulating-html5-and-behaviour-using-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

