<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>jakobloekkemadsen.com</title>
	
	<link>http://www.jakobloekkemadsen.com</link>
	<description>Usability. Design. Code.</description>
	<lastBuildDate>Thu, 26 Apr 2012 19:33:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Jakobloekkemadsen" /><feedburner:info uri="jakobloekkemadsen" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Growing software</title>
		<link>http://feedproxy.google.com/~r/Jakobloekkemadsen/~3/mMZvRhBOYRY/</link>
		<comments>http://www.jakobloekkemadsen.com/2012/04/growing-software/#comments</comments>
		<pubDate>Thu, 26 Apr 2012 14:00:15 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[craftsmanship]]></category>
		<category><![CDATA[design metaphors]]></category>
		<category><![CDATA[professionalism]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://www.jakobloekkemadsen.com/?p=276</guid>
		<description><![CDATA[<p>Next time you refer to software development as “building” something, there’s a good chance that you’re doing damage to your project.</p>
<p>The construction metaphor is widespread in software and IT, and there are several reasons why:</p>
<ul>
<li>It sounds like</li></ul><p>&#8230; <a href="http://www.jakobloekkemadsen.com/2012/04/growing-software/" class="read_more">Read the rest</a></p>]]></description>
			<content:encoded><![CDATA[<p>Next time you refer to software development as “building” something, there’s a good chance that you’re doing damage to your project.</p>
<p>The construction metaphor is widespread in software and IT, and there are several reasons why:</p>
<ul>
<li>It sounds like you are creating a thing which can be assessed on its’ own in absolute terms &#8211; detached from the social reality of its’ inhabitants or users.</li>
<li>It sounds like you are doing something, which will eventually be finished.</li>
<li>It makes software engineers and architects seem more like “real” engineers and architects.</li>
</ul>
<p>All of this sounds very serious and reassuring to clients.</p>
<p>But the worst threat to problem solving is misunderstanding the nature of the problem.<br />
And software is nothing like buildings!</p>
<ul>
<li>Software is social. Content and data is created by people. Business rules are described and used by people and reflect (and change with) the organization in which they are embedded.</li>
<li>Software is never finished. There’s always a next version, a “phase two”, a redesign, etc. somewhere on the horizon. And if you’re lucky enough to work on agile projects, this flow of re-alignments is even more accellerated.</li>
<li>Job titles in the software industry sometimes seem like they’re meant solely to describe our work in terms our grandmothers can understand. In reality, the titles don’t say much about the nature of the jobs.</li>
</ul>
<h3 id="software_gardener">Software gardener</h3>
<p>Today I stumbled on <a href="http://www.globalnerdy.com/2007/07/18/laws-of-software-development/">this great collection of some of the many, many software development laws</a>.<br />
The author of the post notes that: “<strong>some of the laws come from the world of biology — they also appear in some lists of software laws, and I think they still apply.</strong>”<br />
This observation brilliantly emphasizes why the gardening metaphor (suggested by <a href="http://pragprog.com/the-pragmatic-programmer">Andrew Hunt and David Thomas </a>) suits the art of software development much better than the construction metaphor.</p>
<p>Gardening is about thinking ahead, planning, then waiting patiently and reacting to the ways of nature, nursing, killing bugs and weeds &#8211; and season after season learning from your experience.</p>
<p>Good software is created in the same way: Pre-planning using as many skills as possible, then trying out concepts and ideas in real life, nursing and improving what works and getting rid of what doesn’t &#8211; then going back and doing it again and again.<br />
Good programmers &#8211; like good gardeners &#8211; know when to immerse themselves in little things and when to take a step back and assess the grand perspective. They understand the intimate connection between the singular detail and the ecosystem.</p>
<p>We already talk about &#8220;growing businesses&#8221;, so the concept of growing software shouldn’t be hard to explain to clients or investors.</p>
<p>Btw.: As with any interesting topic, Jeff Atwood has written a quality piece about this over at <a href="http://www.codinghorror.com/blog/2008/11/tending-your-software-garden.html">codinghorror.com</a>.</p>
 <p><a href="http://www.jakobloekkemadsen.com/?flattrss_redirect&amp;id=276&amp;md5=5b926b8292d2541d2e7e381c53d9b342" title="Flattr" target="_blank"><img src="http://www.jakobloekkemadsen.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p><img src="http://feeds.feedburner.com/~r/Jakobloekkemadsen/~4/mMZvRhBOYRY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.jakobloekkemadsen.com/2012/04/growing-software/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=jakobloekke&amp;popout=1&amp;url=http%3A%2F%2Fwww.jakobloekkemadsen.com%2F2012%2F04%2Fgrowing-software%2F&amp;language=en_GB&amp;category=text&amp;title=Growing+software&amp;description=Next+time+you+refer+to+software+development+as+%E2%80%9Cbuilding%E2%80%9D+something%2C+there%E2%80%99s+a+good+chance+that+you%E2%80%99re+doing+damage+to+your+project.+The+construction+metaphor+is+widespread+in+software+and+IT%2C...&amp;tags=craftsmanship%2Cdesign+metaphors%2Cprofessionalism%2Csoftware%2Cblog" type="text/html" />
	<feedburner:origLink>http://www.jakobloekkemadsen.com/2012/04/growing-software/</feedburner:origLink></item>
		<item>
		<title>Benchmarking the jQuery DOM ready binding</title>
		<link>http://feedproxy.google.com/~r/Jakobloekkemadsen/~3/YOTdWw8tKkU/</link>
		<comments>http://www.jakobloekkemadsen.com/2012/02/benchmarking-the-jquery-dom-ready-binding/#comments</comments>
		<pubDate>Fri, 24 Feb 2012 11:27:02 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://www.jakobloekkemadsen.com/?p=265</guid>
		<description><![CDATA[<p>After a discussion with a colleague about the pros and cons of using a lot of <strong>$(document).ready(function(){ &#8230; })</strong> statements across a project, I decided to measure the raw performance of the event binding itself.</p>
<p>Both of us agreed that&#8230; <a href="http://www.jakobloekkemadsen.com/2012/02/benchmarking-the-jquery-dom-ready-binding/" class="read_more">Read the rest</a></p>]]></description>
			<content:encoded><![CDATA[<p>After a discussion with a colleague about the pros and cons of using a lot of <strong>$(document).ready(function(){ &#8230; })</strong> statements across a project, I decided to measure the raw performance of the event binding itself.</p>
<p>Both of us agreed that extensive use of this statement represents a sort of <em>code-smell</em> &#8211; that it&#8217;s probably a sign that your Javascript needs better structure &#8211; and that this, in turn, will  probably lead to bad performance in one way or another.</p>
<p>But that set aside, how about the statement itself?<br />
Does it incur a performance hit?</p>
<p>Here&#8217;s the code I used for testing:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> no_of_bindings <span style="color: #339933;">=</span> <span style="color: #CC0000;">100</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> bind<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> no_of_bindings <span style="color: #339933;">-</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&gt;=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">--</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        $<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
console.<span style="color: #660066;">time</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;bindings&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
bind<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
console.<span style="color: #660066;">timeEnd</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;bindings&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>For IE, I used <a href="http://getfirebug.com/firebuglite" target="_blank">Firebug Lite</a>, which supports the <code>console.time</code> method.<br />
All times are measured in milliseconds.</p>
<p>And here are the results:</p>
<table border="1" cellpadding="0" cellspacing="0" width="100%">
<tr>
<th class='s0'>
            Number of bindings:
        </th>
<th class='s1'>
            1
        </th>
<th class='s1'>
            10
        </th>
<th class='s1'>
            100
        </th>
<th class='s1'>
            1000
        </th>
<th class='s1'>
            10000
        </th>
<th class='s1'>
            100000
        </th>
<th class='s1'>
            1000000
        </th>
</tr>
<tr>
<td class='s2'>
            Firefox
        </td>
<td class='s3'>
            1
        </td>
<td class='s3'>
            1
        </td>
<td class='s3'>
            5
        </td>
<td class='s3'>
            12
        </td>
<td class='s3'>
            109
        </td>
<td class='s3'>
            1052
        </td>
<td class='s3'>
            4952
        </td>
</tr>
<tr>
<td class='s2'>
            Chrome
        </td>
<td class='s3'>
            0
        </td>
<td class='s3'>
            0
        </td>
<td class='s3'>
            0
        </td>
<td class='s3'>
            2
        </td>
<td class='s3'>
            17
        </td>
<td class='s3'>
            160
        </td>
<td class='s3'>
            1936
        </td>
</tr>
<tr>
<td class='s2'>
            IE9
        </td>
<td class='s3'>
            0
        </td>
<td class='s3'>
            2
        </td>
<td class='s3'>
            5
        </td>
<td class='s3'>
            16
        </td>
<td class='s3'>
            140
        </td>
<td class='s3'>
            1831
        </td>
<td class='s3'>
            16866
        </td>
</tr>
<tr>
<td class='s2'>
            Safari
        </td>
<td class='s3'>
            0
        </td>
<td class='s3'>
            0
        </td>
<td class='s3'>
            1
        </td>
<td class='s3'>
            6
        </td>
<td class='s3'>
            63
        </td>
<td class='s3'>
            872
        </td>
<td class='s3'>
            8739
        </td>
</tr>
</table>
<p>As it turns out, you need to do an absurd amount of bindings before the performance overhead is worth caring about &#8211; even for IE.<br />
It might be different for older browsers, of course, but I didn&#8217;t feel like bothering with measuring those, since the pattern is probably equal + you have loads of other things dragging you down.</p>
<p>So in conclusion: DOM ready bindings are <em>almost</em> free to do, but you should of course still be conscious about why you are using them.</p>
 <p><a href="http://www.jakobloekkemadsen.com/?flattrss_redirect&amp;id=265&amp;md5=379fc815009c14302ddac7bc1e40293c" title="Flattr" target="_blank"><img src="http://www.jakobloekkemadsen.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p><img src="http://feeds.feedburner.com/~r/Jakobloekkemadsen/~4/YOTdWw8tKkU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.jakobloekkemadsen.com/2012/02/benchmarking-the-jquery-dom-ready-binding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=jakobloekke&amp;popout=1&amp;url=http%3A%2F%2Fwww.jakobloekkemadsen.com%2F2012%2F02%2Fbenchmarking-the-jquery-dom-ready-binding%2F&amp;language=en_GB&amp;category=text&amp;title=Benchmarking+the+jQuery+DOM+ready+binding&amp;description=After+a+discussion+with+a+colleague+about+the+pros+and+cons+of+using+a+lot+of+%24%28document%29.ready%28function%28%29%7B+%26%238230%3B+%7D%29+statements+across+a+project%2C+I+decided+to+measure+the+raw+performance...&amp;tags=javascript%2Cperformance%2Cblog" type="text/html" />
	<feedburner:origLink>http://www.jakobloekkemadsen.com/2012/02/benchmarking-the-jquery-dom-ready-binding/</feedburner:origLink></item>
		<item>
		<title>How to use Knockout.js with XSLT</title>
		<link>http://feedproxy.google.com/~r/Jakobloekkemadsen/~3/AvJ0syES_tU/</link>
		<comments>http://www.jakobloekkemadsen.com/2011/11/how-to-use-knockout-js-with-xslt/#comments</comments>
		<pubDate>Tue, 22 Nov 2011 15:37:37 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[knockout.js]]></category>
		<category><![CDATA[xslt]]></category>

		<guid isPermaLink="false">http://www.jakobloekkemadsen.com/?p=246</guid>
		<description><![CDATA[<p>As you may know, <a href="http://knockoutjs.com/">Knockout.js</a> uses inline Javascript for it&#8217;s elegant, declarative bindings:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&#60;</span>li data<span style="color: #339933;">-</span>bind<span style="color: #339933;">=</span><span style="color: #3366CC;">&#34;css: {'active': visible()}&#34;</span><span style="color: #339933;">&#62;&#60;/</span>li<span style="color: #339933;">&#62;</span></pre></div></div>

<p>But if you use XSLT to render your HTML, it may fail because the curly-braces may not be supported&#8230; <a href="http://www.jakobloekkemadsen.com/2011/11/how-to-use-knockout-js-with-xslt/" class="read_more">Read the rest</a></p>]]></description>
			<content:encoded><![CDATA[<p>As you may know, <a href="http://knockoutjs.com/">Knockout.js</a> uses inline Javascript for it&#8217;s elegant, declarative bindings:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>li data<span style="color: #339933;">-</span>bind<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;css: {'active': visible()}&quot;</span><span style="color: #339933;">&gt;&lt;/</span>li<span style="color: #339933;">&gt;</span></pre></div></div>

<p>But if you use XSLT to render your HTML, it may fail because the curly-braces may not be supported in attributes.</p>
<p>To make this work, you need to do two things:</p>
<ol>
<li>
Convert the attribute:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">data<span style="color: #339933;">-</span>bind<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;...&quot;</span></pre></div></div>

<p> into an</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>xsl<span style="color: #339933;">:</span>attribute <span style="color: #000066;">name</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;data-bind&quot;</span><span style="color: #339933;">&gt;</span></pre></div></div>

<p>Like this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>li<span style="color: #339933;">&gt;</span>
 <span style="color: #339933;">&lt;</span>xsl<span style="color: #339933;">:</span>attribute <span style="color: #000066;">name</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;data-bind&quot;</span><span style="color: #339933;">&gt;</span>
  css<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span><span style="color: #3366CC;">'active'</span><span style="color: #339933;">:</span> visible<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span>
 <span style="color: #339933;">&lt;/</span>xsl<span style="color: #339933;">:</span>attribute<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>li<span style="color: #339933;">&gt;</span></pre></div></div>

</li>
<li>Do a search and replace exchanging the curly braces with XML-safe entities:

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">	<span style="color: #3366CC;">&quot;{&quot;</span> to <span style="color: #3366CC;">&quot;&amp;#123;&quot;</span>
	<span style="color: #3366CC;">&quot;}&quot;</span> to <span style="color: #3366CC;">&quot;&amp;#125&quot;</span></pre></div></div>

<p>	So the final XSLT should look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>li<span style="color: #339933;">&gt;</span>
 <span style="color: #339933;">&lt;</span>xsl<span style="color: #339933;">:</span>attribute <span style="color: #000066;">name</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;data-bind&quot;</span><span style="color: #339933;">&gt;</span>
  css<span style="color: #339933;">:</span> <span style="color: #339933;">&amp;</span>#<span style="color: #CC0000;">125</span><span style="color: #3366CC;">'active'</span><span style="color: #339933;">:</span> visible<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&amp;</span>#<span style="color: #CC0000;">125</span>
 <span style="color: #339933;">&lt;/</span>xsl<span style="color: #339933;">:</span>attribute<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>li<span style="color: #339933;">&gt;</span></pre></div></div>

<p>&nbsp;</li>
</ol>
<p>Ugly, I know! But now it will work.</p>
 <p><a href="http://www.jakobloekkemadsen.com/?flattrss_redirect&amp;id=246&amp;md5=74ecaada9236982fabf4c4b98325ee38" title="Flattr" target="_blank"><img src="http://www.jakobloekkemadsen.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p><img src="http://feeds.feedburner.com/~r/Jakobloekkemadsen/~4/AvJ0syES_tU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.jakobloekkemadsen.com/2011/11/how-to-use-knockout-js-with-xslt/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=jakobloekke&amp;popout=1&amp;url=http%3A%2F%2Fwww.jakobloekkemadsen.com%2F2011%2F11%2Fhow-to-use-knockout-js-with-xslt%2F&amp;language=en_GB&amp;category=text&amp;title=How+to+use+Knockout.js+with+XSLT&amp;description=As+you+may+know%2C+Knockout.js+uses+inline+Javascript+for+it%26%238217%3Bs+elegant%2C+declarative+bindings%3A+%26lt%3Bli+data-bind%3D%26quot%3Bcss%3A+%7B%27active%27%3A+visible%28%29%7D%26quot%3B%26gt%3B%26lt%3B%2Fli%26gt%3B+But+if+you+use+XSLT+to+render+your+HTML%2C+it+may+fail+because...&amp;tags=javascript%2Cknockout.js%2Cxslt%2Cblog" type="text/html" />
	<feedburner:origLink>http://www.jakobloekkemadsen.com/2011/11/how-to-use-knockout-js-with-xslt/</feedburner:origLink></item>
		<item>
		<title>DropCheck: A magic checklist using Dropbox and Knockout.js</title>
		<link>http://feedproxy.google.com/~r/Jakobloekkemadsen/~3/C562LWrlvP8/</link>
		<comments>http://www.jakobloekkemadsen.com/2011/09/dropcheck-a-magic-checklist-using-dropbox-and-knockout-js/#comments</comments>
		<pubDate>Tue, 20 Sep 2011 21:27:37 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[Mobile]]></category>
		<category><![CDATA[dropbox]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[knockout.js]]></category>
		<category><![CDATA[webapp]]></category>

		<guid isPermaLink="false">http://www.jakobloekkemadsen.com/?p=201</guid>
		<description><![CDATA[<p>Ever created a todo list in a .txt file, then popped it into Dropbox for iPhone viewing?</p>
<p>I do it all the time! That&#8217;s why I created <strong><a title="Download DropCheck" onclick="pageTracker._trackEvent('link', 'click', 'DropCheck download');" href="https://github.com/jakobloekke/Dropcheck/zipball/master">DropCheck</a></strong>.</p>
<p>&#160;</p>
<p><a title="Download DropCheck" onclick="pageTracker._trackEvent('link', 'click', 'DropCheck download');" href="https://github.com/jakobloekke/Dropcheck/zipball/master"><img class="alignnone size-full wp-image-231" title="dropcheck" src="http://www.jakobloekkemadsen.com/wp-content/uploads/2011/09/dropcheck1.png" alt="DropCheck" width="500" height="376" /></a></p>
<p><strong>DropCheck is a web app that turns lines in a .txt</strong>&#8230; <a href="http://www.jakobloekkemadsen.com/2011/09/dropcheck-a-magic-checklist-using-dropbox-and-knockout-js/" class="read_more">Read the rest</a></p>]]></description>
			<content:encoded><![CDATA[<p>Ever created a todo list in a .txt file, then popped it into Dropbox for iPhone viewing?</p>
<p>I do it all the time! That&#8217;s why I created <strong><a title="Download DropCheck" onclick="pageTracker._trackEvent('link', 'click', 'DropCheck download');" href="https://github.com/jakobloekke/Dropcheck/zipball/master">DropCheck</a></strong>.</p>
<p>&nbsp;</p>
<p><a title="Download DropCheck" onclick="pageTracker._trackEvent('link', 'click', 'DropCheck download');" href="https://github.com/jakobloekke/Dropcheck/zipball/master"><img class="alignnone size-full wp-image-231" title="dropcheck" src="http://www.jakobloekkemadsen.com/wp-content/uploads/2011/09/dropcheck1.png" alt="DropCheck" width="500" height="376" /></a></p>
<p><strong>DropCheck is a web app that turns lines in a .txt file into checkable lines in a nice web app interface.</strong></p>
<p>It&#8217;s tailored specifically for grocery shopping, as this is a common use case for me.<br />
You have the ability to tick off each item as it goes in your shopping cart (&#8220;Yes&#8221;).<br />
Or you can mark it as sold out (&#8220;No&#8221;).</p>
<p>At the bottom you can move the checked items to the bottom of the list, so you have them out of sight.<br />
The web app also remembers the state of the list even though you close it.<br />
To re-connect to the Dropbox .txt-file you just click the &#8220;Reset to Dropbox file&#8221; link.</p>
<h3>Installation:</h3>
<p>To install, unzip the <strong><a title="Download DropCheck" onclick="pageTracker._trackEvent('link', 'click', 'DropCheck download');" href="https://github.com/jakobloekke/Dropcheck/zipball/master">DropCheck folder</a></strong> into your Dropbox public folder, then get the public link of the file called <code>dropcheck.htm</code>:<br />
<img class="alignnone size-full wp-image-211" title="Skærmbillede 2011-09-20 kl. 22.52.02" src="http://www.jakobloekkemadsen.com/wp-content/uploads/2011/09/Skærmbillede-2011-09-20-kl.-22.52.02.png" alt="" width="563" height="185" /></p>
<p>&nbsp;</p>
<p>Visit the public URL in Safari on your iPhone and save it to your homescreen:</p>
<p><img class="alignnone size-medium wp-image-213" title="installDropCheck" src="http://www.jakobloekkemadsen.com/wp-content/uploads/2011/09/installDropCheck1-200x300.png" alt="" width="200" height="300" />    <img class="alignnone size-full wp-image-215" title="icon" src="http://www.jakobloekkemadsen.com/wp-content/uploads/2011/09/icon.png" alt="" width="89" height="97" /></p>
<p>&nbsp;</p>
<p><strong>Now, when you visit the DropCheck app, you&#8217;ll see the contents of the <code>dropcheck-list.txt</code> file turned into a checkable list.</strong></p>
<p>Enjoy!</p>
<p>&nbsp;</p>
<p><strong>UPDATE for Windows users:</strong></p>
<p><a title="Kasper Hyllested" href="http://www.hyllested.net/">Kasper Hyllested</a> pointed out to me, that there was an issue with international characters when saving the .txt-file from Notepad on Windows.</p>
<p>To fix this, you must force notepad to save using UTF-8 encoding of characters (instead of ANSI):</p>
<p><img class="alignnone size-full wp-image-238" title="Skærmbillede-2011-09-22-kl.-09.37.21" src="http://www.jakobloekkemadsen.com/slir/w580/wp-content/uploads/2011/09/Skærmbillede-2011-09-22-kl.-09.37.21.png" alt="" /></p>
 <p><a href="http://www.jakobloekkemadsen.com/?flattrss_redirect&amp;id=201&amp;md5=6f9f5da6ae47bf0a6330216714daedbe" title="Flattr" target="_blank"><img src="http://www.jakobloekkemadsen.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p><img src="http://feeds.feedburner.com/~r/Jakobloekkemadsen/~4/C562LWrlvP8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.jakobloekkemadsen.com/2011/09/dropcheck-a-magic-checklist-using-dropbox-and-knockout-js/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=jakobloekke&amp;popout=1&amp;url=http%3A%2F%2Fwww.jakobloekkemadsen.com%2F2011%2F09%2Fdropcheck-a-magic-checklist-using-dropbox-and-knockout-js%2F&amp;language=en_GB&amp;category=text&amp;title=DropCheck%3A+A+magic+checklist+using+Dropbox+and+Knockout.js&amp;description=Ever+created+a+todo+list+in+a+.txt+file%2C+then+popped+it+into+Dropbox+for+iPhone+viewing%3F+I+do+it+all+the+time%21%C2%A0That%26%238217%3Bs+why+I+created+DropCheck.+%26nbsp%3B+DropCheck+is...&amp;tags=dropbox%2Chtml5%2Ciphone%2Cjavascript%2Cknockout.js%2Cwebapp%2Cblog" type="text/html" />
	<feedburner:origLink>http://www.jakobloekkemadsen.com/2011/09/dropcheck-a-magic-checklist-using-dropbox-and-knockout-js/</feedburner:origLink></item>
		<item>
		<title>How to empty a Javascript array</title>
		<link>http://feedproxy.google.com/~r/Jakobloekkemadsen/~3/VbSMuxw5YU0/</link>
		<comments>http://www.jakobloekkemadsen.com/2011/02/how-to-empty-a-javascript-array/#comments</comments>
		<pubDate>Sun, 20 Feb 2011 15:11:59 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.jakobloekkemadsen.com/?p=197</guid>
		<description><![CDATA[<p>It&#8217;s easy:</p>

<div class="wp_syntax"><div class="code"><pre class="js" style="font-family:monospace;">MyArray.length = 0;</pre></div></div>

<p>(Just a reminder to myself, since I&#8217;ve forgotten about this a few times &#8230;)</p>
]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s easy:</p>

<div class="wp_syntax"><div class="code"><pre class="js" style="font-family:monospace;">MyArray.length = 0;</pre></div></div>

<p>(Just a reminder to myself, since I&#8217;ve forgotten about this a few times &#8230;)</p>
 <p><a href="http://www.jakobloekkemadsen.com/?flattrss_redirect&amp;id=197&amp;md5=eb4b9fd1e9f3f725248dc5ced55ccd26" title="Flattr" target="_blank"><img src="http://www.jakobloekkemadsen.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p><img src="http://feeds.feedburner.com/~r/Jakobloekkemadsen/~4/VbSMuxw5YU0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.jakobloekkemadsen.com/2011/02/how-to-empty-a-javascript-array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=jakobloekke&amp;popout=1&amp;url=http%3A%2F%2Fwww.jakobloekkemadsen.com%2F2011%2F02%2Fhow-to-empty-a-javascript-array%2F&amp;language=en_GB&amp;category=text&amp;title=How+to+empty+a+Javascript+array&amp;description=It%26%238217%3Bs+easy%3A+MyArray.length+%3D+0%3B+%28Just+a+reminder+to+myself%2C+since+I%26%238217%3Bve+forgotten+about+this+a+few+times+%26%238230%3B%29&amp;tags=blog" type="text/html" />
	<feedburner:origLink>http://www.jakobloekkemadsen.com/2011/02/how-to-empty-a-javascript-array/</feedburner:origLink></item>
		<item>
		<title>How to make CSS3PIE work</title>
		<link>http://feedproxy.google.com/~r/Jakobloekkemadsen/~3/Zb1Z16Fh8hk/</link>
		<comments>http://www.jakobloekkemadsen.com/2010/10/how-to-make-css3pie-work/#comments</comments>
		<pubDate>Fri, 08 Oct 2010 19:16:45 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[Frontend development]]></category>
		<category><![CDATA[htc]]></category>
		<category><![CDATA[IE6]]></category>
		<category><![CDATA[IE7]]></category>
		<category><![CDATA[IE8]]></category>
		<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[UI]]></category>

		<guid isPermaLink="false">http://www.jakobloekkemadsen.com/?p=172</guid>
		<description><![CDATA[<p><a href="http://css3pie.com" target="_blank"><img class="alignnone" title="CSS3pie" src="http://css3pie.com/wp/wp-content/themes/pie-wp-theme/img/logo.png" alt="CSS3pie" width="194" height="127" /></a></p>
<p>Countless hours have been lost creating rounded corners, dropshadows and gradient backgrounds for the web.<br />
With Internet Explorer still lacking support for CSS3, until recently it seemed like we would have to keep doing tiny graphic sprites (or&#8230; <a href="http://www.jakobloekkemadsen.com/2010/10/how-to-make-css3pie-work/" class="read_more">Read the rest</a></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://css3pie.com" target="_blank"><img class="alignnone" title="CSS3pie" src="http://css3pie.com/wp/wp-content/themes/pie-wp-theme/img/logo.png" alt="CSS3pie" width="194" height="127" /></a></p>
<p>Countless hours have been lost creating rounded corners, dropshadows and gradient backgrounds for the web.<br />
With Internet Explorer still lacking support for CSS3, until recently it seemed like we would have to keep doing tiny graphic sprites (or implementing dirty javascripts) in order to accomodate the demand for such UI niceness.</p>
<p>Enter: <a href="http://css3pie.com/" target="_blank">http://css3pie.com/</a><br />
PIE is a .htc CSS behaviour script that enables support for dropshadows, rounded corners and background gradient CSS3 properties in Internet Explorer &#8211; all the way back to IE6!</p>
<p>Of course, I couldn&#8217;t wait to try it out.<br />
And it didn&#8217;t work.<br />
Bummer &#8230;</p>
<p>Fortunately, I found out why:<br />
It only works on positioned elements.</p>
<p><strong>You must specify &#8220;position: relative;&#8221; or &#8220;position: absolute;&#8221; on the element that calls the .htc behaviour, and then it works!</strong></p>
<p>Amazing script!<br />
CSS3 future is here now.<br />
Thank you so much, Jason Johnston of <a href="http://327creative.com/" target="_blank">327 Creative LLC</a>, for sharing this little goodie with the world!</p>
 <p><a href="http://www.jakobloekkemadsen.com/?flattrss_redirect&amp;id=172&amp;md5=5285f6c0ac74e5dc326e065ee81c973e" title="Flattr" target="_blank"><img src="http://www.jakobloekkemadsen.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p><img src="http://feeds.feedburner.com/~r/Jakobloekkemadsen/~4/Zb1Z16Fh8hk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.jakobloekkemadsen.com/2010/10/how-to-make-css3pie-work/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=jakobloekke&amp;popout=1&amp;url=http%3A%2F%2Fwww.jakobloekkemadsen.com%2F2010%2F10%2Fhow-to-make-css3pie-work%2F&amp;language=en_GB&amp;category=text&amp;title=How+to+make+CSS3PIE+work&amp;description=Countless+hours+have+been+lost+creating+rounded+corners%2C+dropshadows+and+gradient+backgrounds+for+the+web.+With+Internet+Explorer+still+lacking+support+for+CSS3%2C+until+recently+it+seemed+like+we+would...&amp;tags=css%2Ccss3%2CFrontend+development%2Chtc%2CIE6%2CIE7%2CIE8%2CInternet+Explorer%2CUI%2Cblog" type="text/html" />
	<feedburner:origLink>http://www.jakobloekkemadsen.com/2010/10/how-to-make-css3pie-work/</feedburner:origLink></item>
		<item>
		<title>Pick your browser …</title>
		<link>http://feedproxy.google.com/~r/Jakobloekkemadsen/~3/UpqRg3GeofA/</link>
		<comments>http://www.jakobloekkemadsen.com/2010/03/pick-your-browser/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 18:59:51 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[Politics]]></category>
		<category><![CDATA[Browser]]></category>
		<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://www.jakobloekkemadsen.com/?p=166</guid>
		<description><![CDATA[<p>Alright!</p>
<p>The good people at Microsoft have introduced the <a href="http://microsoftontheissues.com/cs/blogs/mscorp/archive/2010/02/19/the-browser-choice-screen-for-europe-what-to-expect-when-to-expect-it.aspx" target="_blank">Browser Choice</a> splash screen on new Windows installations.<br />
I thought I&#8217;d try it out by re-installing the Windows XP that runs in VMWare on my Macbook.</p>
<p>After running&#8230; <a href="http://www.jakobloekkemadsen.com/2010/03/pick-your-browser/" class="read_more">Read the rest</a></p>]]></description>
			<content:encoded><![CDATA[<p>Alright!</p>
<p>The good people at Microsoft have introduced the <a href="http://microsoftontheissues.com/cs/blogs/mscorp/archive/2010/02/19/the-browser-choice-screen-for-europe-what-to-expect-when-to-expect-it.aspx" target="_blank">Browser Choice</a> splash screen on new Windows installations.<br />
I thought I&#8217;d try it out by re-installing the Windows XP that runs in VMWare on my Macbook.</p>
<p>After running the install and the massive pile of updates following it, I rebootet and was greeted by the Browser Choice introduction.<br />
I then clicked OK to confirm that I was connected to the Internet and ready to make my choice &#8230;</p>
<p>This is what happened:</p>
<div id="attachment_167" class="wp-caption alignnone" style="width: 310px"><a href="http://www.jakobloekkemadsen.com/wp-content/uploads/2010/03/Billede-1.png"><img class="size-medium wp-image-167" title="Browser Choice" src="http://www.jakobloekkemadsen.com/wp-content/uploads/2010/03/Billede-1-300x187.png" alt="Time to pick a browser. Which one should I choose ... hmmmm ..." width="300" height="187" /></a><p class="wp-caption-text">Time to pick a browser. Which one should I choose ... hmmmm ...</p></div>
<p>What a funny coincidence!<br />
It appears that the freshly updated IE has opened it&#8217;s configuration wizard right on top of the Browser Choice window &#8230;</p>
<p>(-:</p>
 <p><a href="http://www.jakobloekkemadsen.com/?flattrss_redirect&amp;id=166&amp;md5=e95bb8d2cd3dd209ddf41ba4cbeaac9b" title="Flattr" target="_blank"><img src="http://www.jakobloekkemadsen.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p><img src="http://feeds.feedburner.com/~r/Jakobloekkemadsen/~4/UpqRg3GeofA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.jakobloekkemadsen.com/2010/03/pick-your-browser/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=jakobloekke&amp;popout=1&amp;url=http%3A%2F%2Fwww.jakobloekkemadsen.com%2F2010%2F03%2Fpick-your-browser%2F&amp;language=en_GB&amp;category=text&amp;title=Pick+your+browser+%26%238230%3B&amp;description=Alright%21+The+good+people+at+Microsoft+have+introduced+the+Browser+Choice+splash+screen+on+new+Windows+installations.+I+thought+I%26%238217%3Bd+try+it+out+by+re-installing+the+Windows+XP+that+runs...&amp;tags=Browser%2CInternet+Explorer%2CMicrosoft%2CPolitics%2Cblog" type="text/html" />
	<feedburner:origLink>http://www.jakobloekkemadsen.com/2010/03/pick-your-browser/</feedburner:origLink></item>
		<item>
		<title>Winter shots from Norway</title>
		<link>http://feedproxy.google.com/~r/Jakobloekkemadsen/~3/79FaqG53AOc/</link>
		<comments>http://www.jakobloekkemadsen.com/2010/03/winter-shoots/#comments</comments>
		<pubDate>Sun, 14 Mar 2010 11:21:39 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[Photos]]></category>
		<category><![CDATA[Nature]]></category>
		<category><![CDATA[photo]]></category>
		<category><![CDATA[snow]]></category>

		<guid isPermaLink="false">http://www.jakobloekkemadsen.com/?p=160</guid>
		<description><![CDATA[<p>Some photos from last week&#8217;s trip to Norway:<br />
<img class="flickr" src="http://farm5.static.flickr.com/4017/4431890136_5702563bcd.jpg" alt="DSC_3722" /></p>
<p><img class="flickr" src="http://farm5.static.flickr.com/4016/4431886852_6d70f7429c.jpg" alt="DSC_3652" /></p>
<p><img class="flickr" src="http://farm3.static.flickr.com/2717/4431121763_757a01ce3b.jpg" alt="DSC_3743" /></p>
<p><img class="flickr" src="http://farm3.static.flickr.com/2762/4431883574_ae40507e0a.jpg" alt="DSC_3567" /></p>
<p><img class="flickr" src="http://farm3.static.flickr.com/2786/4431886132_f70840c16e.jpg" alt="DSC_3648" /></p>
<p><img class="flickr" src="http://farm5.static.flickr.com/4039/4431887552_ab8a021f05.jpg" alt="DSC_3653" /></p>
]]></description>
			<content:encoded><![CDATA[<p>Some photos from last week&#8217;s trip to Norway:<br />
<img class="flickr" src="http://farm5.static.flickr.com/4017/4431890136_5702563bcd.jpg" alt="DSC_3722" /></p>
<p><img class="flickr" src="http://farm5.static.flickr.com/4016/4431886852_6d70f7429c.jpg" alt="DSC_3652" /></p>
<p><img class="flickr" src="http://farm3.static.flickr.com/2717/4431121763_757a01ce3b.jpg" alt="DSC_3743" /></p>
<p><img class="flickr" src="http://farm3.static.flickr.com/2762/4431883574_ae40507e0a.jpg" alt="DSC_3567" /></p>
<p><img class="flickr" src="http://farm3.static.flickr.com/2786/4431886132_f70840c16e.jpg" alt="DSC_3648" /></p>
<p><img class="flickr" src="http://farm5.static.flickr.com/4039/4431887552_ab8a021f05.jpg" alt="DSC_3653" /></p>
 <p><a href="http://www.jakobloekkemadsen.com/?flattrss_redirect&amp;id=160&amp;md5=d02ef1c847e2274d827e60ecaad3178e" title="Flattr" target="_blank"><img src="http://www.jakobloekkemadsen.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p><img src="http://feeds.feedburner.com/~r/Jakobloekkemadsen/~4/79FaqG53AOc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.jakobloekkemadsen.com/2010/03/winter-shoots/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=jakobloekke&amp;popout=1&amp;url=http%3A%2F%2Fwww.jakobloekkemadsen.com%2F2010%2F03%2Fwinter-shoots%2F&amp;language=en_GB&amp;category=text&amp;title=Winter+shots+from+Norway&amp;description=Some+photos+from+last+week%26%238217%3Bs+trip+to+Norway%3A&amp;tags=Nature%2Cphoto%2Csnow%2Cblog" type="text/html" />
	<feedburner:origLink>http://www.jakobloekkemadsen.com/2010/03/winter-shoots/</feedburner:origLink></item>
		<item>
		<title>Useful PHP libraries, part 2 – Scaffold CSS</title>
		<link>http://feedproxy.google.com/~r/Jakobloekkemadsen/~3/hUxRzXF1WyQ/</link>
		<comments>http://www.jakobloekkemadsen.com/2010/02/useful-php-libraries-part-2-scaffold-css/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 16:52:24 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[clean code]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[productivity]]></category>

		<guid isPermaLink="false">http://www.jakobloekkemadsen.com/?p=150</guid>
		<description><![CDATA[<p><a href="http://wiki.github.com/anthonyshort/csscaffold/" target="_blank">Scaffold CSS</a> was developed by <a href="http://anthonyshort.com.au/" target="_blank">Anthony Short</a> and it is &#8211; basically &#8211; every CSS-coder’s dream come true:</p>
<p>Variables, nested selectors, abstractions from vendor-specific properties etc. etc. etc. Good stuff!</p>
<p>Installation and usage couldn’t be simpler! (Really. I&#8230; <a href="http://www.jakobloekkemadsen.com/2010/02/useful-php-libraries-part-2-scaffold-css/" class="read_more">Read the rest</a></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://wiki.github.com/anthonyshort/csscaffold/" target="_blank">Scaffold CSS</a> was developed by <a href="http://anthonyshort.com.au/" target="_blank">Anthony Short</a> and it is &#8211; basically &#8211; every CSS-coder’s dream come true:</p>
<p>Variables, nested selectors, abstractions from vendor-specific properties etc. etc. etc. Good stuff!</p>
<p>Installation and usage couldn’t be simpler! (Really. I don’t see how it could!)<br />
You place the library folder in whatever folder holds you CSS-files. Then you copy-paste the .htaccess-file that redirects every request for your CSS-files to the library. Scaffold then reads through your CSS and interprets whatever tricks you’ve written and serves up nicely formatted (or minifed, if you prefer) W3C-compliant CSS.</p>
<p>”What’s this good for?”, you say?</p>
<p>Well. Consider this piece of regular CSS:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">form<span style="color: #cc00cc;">#searchbox</span> <span style="color: #cc00cc;">#arrival_date</span><span style="color: #00AA00;">,</span>
form<span style="color: #cc00cc;">#searchbox</span> <span style="color: #cc00cc;">#departure_date</span><span style="color: #00AA00;">,</span>
form<span style="color: #cc00cc;">#searchbox</span> <span style="color: #cc00cc;">#persons</span><span style="color: #00AA00;">,</span>
form<span style="color: #cc00cc;">#searchbox</span> <span style="color: #cc00cc;">#location</span>
<span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">18px</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">margin-bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
form<span style="color: #cc00cc;">#searchbox</span> <span style="color: #cc00cc;">#arrival_date</span> label<span style="color: #00AA00;">,</span>
form<span style="color: #cc00cc;">#searchbox</span> <span style="color: #cc00cc;">#departure_date</span> label<span style="color: #00AA00;">,</span>
form<span style="color: #cc00cc;">#searchbox</span> <span style="color: #cc00cc;">#persons</span> label<span style="color: #00AA00;">,</span>
form<span style="color: #cc00cc;">#searchbox</span> <span style="color: #cc00cc;">#location</span> label
<span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> inline-<span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
form<span style="color: #cc00cc;">#searchbox</span> <span style="color: #cc00cc;">#arrival_date</span> input<span style="color: #00AA00;">,</span>
form<span style="color: #cc00cc;">#searchbox</span> <span style="color: #cc00cc;">#departure_date</span> input<span style="color: #00AA00;">,</span>
form<span style="color: #cc00cc;">#searchbox</span> <span style="color: #cc00cc;">#persons</span> input<span style="color: #00AA00;">,</span>
form<span style="color: #cc00cc;">#searchbox</span> <span style="color: #cc00cc;">#location</span> input
<span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">18px</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">180px</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">40px</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">padding-left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
-moz-box-sizing<span style="color: #00AA00;">:</span> border-box<span style="color: #00AA00;">;</span>
-webkit-box-sizing<span style="color: #00AA00;">:</span> border-box<span style="color: #00AA00;">;</span>
-ms-box-sizing<span style="color: #00AA00;">:</span> border-box<span style="color: #00AA00;">;</span>
box-sizing<span style="color: #00AA00;">:</span> border-box<span style="color: #00AA00;">;</span>
behavior<span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">&quot;boxsizing.htc&quot;</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
form<span style="color: #cc00cc;">#searchbox</span> <span style="color: #cc00cc;">#arrival_date</span> .popupcalendar_icon<span style="color: #00AA00;">,</span>
form<span style="color: #cc00cc;">#searchbox</span>  <span style="color: #cc00cc;">#departure_date</span> .popupcalendar_icon<span style="color: #00AA00;">,</span>
form<span style="color: #cc00cc;">#searchbox</span>  <span style="color: #cc00cc;">#persons</span> .popupcalendar_icon<span style="color: #00AA00;">,</span>
form<span style="color: #cc00cc;">#searchbox</span>  <span style="color: #cc00cc;">#location</span> <span style="color: #6666ff;">.popupcalendar_icon</span>
<span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">./graphics/images/sprites.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">295px</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">314px</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">text-indent</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-9999px</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-271px</span> <span style="color: #933;">-20px</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">39px</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">31px</span><span style="color: #00AA00;">;</span>
zoom<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">1</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">inline</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> -moz-inline-box<span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> inline-<span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">vertical-align</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">3px</span> <span style="color: #933;">0px</span> <span style="color: #933;">0px</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Even though it’s nicely ordered and very readable, this code is still quite hard to understand at first look. You can&#8217;t just read what&#8217;s going on. What&#8217;s related to what? You need to look back and forth a few times to see this.<br />
This makes it bad code!<br />
<a href="http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882" target="_blank" title="Clean Code - book on amazon">Good code is always easy to read and understand.</a></p>
<p>Now look at the same code in Scaffold syntax:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #a1a100;">@constants {</span>
   labelTextColor<span style="color: #00AA00;">:</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">;</span>
   gutter<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
form<span style="color: #cc00cc;">#searchbox</span> <span style="color: #00AA00;">&#123;</span>
&nbsp;
   <span style="color: #cc00cc;">#arrival_date</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#departure_date</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#persons</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#location</span>  <span style="color: #00AA00;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">18px</span><span style="color: #00AA00;">;</span>
      <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> !labelTextColor<span style="color: #00AA00;">;</span>
      <span style="color: #000000; font-weight: bold;">margin-bottom</span><span style="color: #00AA00;">:</span> #<span style="color: #00AA00;">&#91;</span><span style="color: #cc66cc;">2</span> <span style="color: #00AA00;">*</span> !gutter<span style="color: #00AA00;">&#93;</span><span style="color: #993333;">px</span><span style="color: #00AA00;">;</span>
&nbsp;
      label <span style="color: #00AA00;">&#123;</span>
         <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> #<span style="color: #00AA00;">&#91;</span><span style="color: #cc66cc;">10</span> <span style="color: #00AA00;">*</span> !gutter<span style="color: #00AA00;">&#93;</span><span style="color: #993333;">px</span><span style="color: #00AA00;">;</span>
         <span style="color: #00AA00;">+</span>inline-<span style="color: #993333;">block</span><span style="color: #00AA00;">&#40;</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
      <span style="color: #00AA00;">&#125;</span>
&nbsp;
      input <span style="color: #00AA00;">&#123;</span>
         <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">18px</span><span style="color: #00AA00;">;</span>
         <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">180px</span><span style="color: #00AA00;">;</span>
         <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> #<span style="color: #00AA00;">&#91;</span><span style="color: #cc66cc;">4</span> <span style="color: #00AA00;">*</span> !gutter<span style="color: #00AA00;">&#93;</span><span style="color: #993333;">px</span><span style="color: #00AA00;">;</span>
         <span style="color: #000000; font-weight: bold;">padding-left</span><span style="color: #00AA00;">:</span> #<span style="color: #00AA00;">&#91;</span><span style="color: #cc66cc;">1</span> <span style="color: #00AA00;">*</span> !gutter<span style="color: #00AA00;">&#93;</span><span style="color: #993333;">px</span><span style="color: #00AA00;">;</span>
         <span style="color: #00AA00;">+</span>border-box<span style="color: #00AA00;">&#40;</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
      <span style="color: #00AA00;">&#125;</span>
&nbsp;
      <span style="color: #6666ff;">.popupcalendar_icon</span> <span style="color: #00AA00;">&#123;</span>
         image-replace<span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'./graphics/images/sprites.png'</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
         <span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-271px</span> <span style="color: #933;">-20px</span><span style="color: #00AA00;">;</span>
         <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">39px</span><span style="color: #00AA00;">;</span>
         <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">31px</span><span style="color: #00AA00;">;</span>
         <span style="color: #00AA00;">+</span>inline-<span style="color: #993333;">block</span><span style="color: #00AA00;">&#40;</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
         <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">3px</span> <span style="color: #933;">0px</span> <span style="color: #933;">0px</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
      <span style="color: #00AA00;">&#125;</span>
   <span style="color: #00AA00;">&#125;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>The nesting immedietaly makes the code easy to read!<br />
The selectors come in a logical order. The code is scannable, and in my opinion this is quite a revolution as far as CSS goes!</p>
<p>And it gets even better!</p>
<p>As you may have noticed, my second code example is full of non-CSS properties.<br />
These are Scaffold-specific functions, constants and ”mixins”.</p>
<p>For example: A standard gutter width of 10px is defined as a constant, then used throughout the style declarations by reference.<br />
No more search-and-replace for simple color changes!<br />
This feature alone will save me countless hours.</p>
<p>Then there’s stuff like ”+inline-block();” or ”+border-box();”. These are ”mixins” that basically call a set of CSS properties that take care of crossbrowser compatibility. Scaffold serves up vendor-specific properties and even a selection of IE-behaviors, filters and expressions to get the desired effect working all around. Now we have a one line trick that’ll fix box model-quirks or get inline-blocks behave like expected. (Or rotation, shadows and other CSS3-goodies for that matter). This means more time for coffee, which is nice!</p>
<p>Finally we have functions like ”image-replace: url(&#8216;./graphics/images/sprites.png&#8217;);”<br />
This line takes care of everything regarding CSS image replacement. It even automatically sets the correct height and width fitting the specified image file.</p>
<p>The library has tons of useful features and some pretty advanced ones too. Everything is cached, so it&#8217;s just as fast as regular CSS. </p>
<p>So if you’re lucky enough to have your CSS-files served from an Apache server with PHP enabled, then by all means, do not miss out on Scaffold CSS!</p>
 <p><a href="http://www.jakobloekkemadsen.com/?flattrss_redirect&amp;id=150&amp;md5=8b5262a748ea252cf8ea8564a87943ab" title="Flattr" target="_blank"><img src="http://www.jakobloekkemadsen.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p><img src="http://feeds.feedburner.com/~r/Jakobloekkemadsen/~4/hUxRzXF1WyQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.jakobloekkemadsen.com/2010/02/useful-php-libraries-part-2-scaffold-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=jakobloekke&amp;popout=1&amp;url=http%3A%2F%2Fwww.jakobloekkemadsen.com%2F2010%2F02%2Fuseful-php-libraries-part-2-scaffold-css%2F&amp;language=en_GB&amp;category=text&amp;title=Useful+PHP+libraries%2C+part+2+%26%238211%3B+Scaffold+CSS&amp;description=Scaffold+CSS+was+developed+by+Anthony+Short+and+it+is+%26%238211%3B+basically+%26%238211%3B+every+CSS-coder%E2%80%99s+dream+come+true%3A+Variables%2C+nested+selectors%2C+abstractions+from+vendor-specific+properties+etc.+etc.+etc.+Good+stuff%21...&amp;tags=clean+code%2Ccss%2Cphp%2Cproductivity%2Cblog" type="text/html" />
	<feedburner:origLink>http://www.jakobloekkemadsen.com/2010/02/useful-php-libraries-part-2-scaffold-css/</feedburner:origLink></item>
		<item>
		<title>Useful PHP libraries, part 1 – SLIR</title>
		<link>http://feedproxy.google.com/~r/Jakobloekkemadsen/~3/W6D-EmN-hcw/</link>
		<comments>http://www.jakobloekkemadsen.com/2010/02/useful-php-libraries-part-1-slir/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 19:20:05 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.jakobloekkemadsen.com/?p=115</guid>
		<description><![CDATA[<p><em>In this series of blog posts I introduce my favourite PHP libraries.</em></p>
<p>Today&#8217;s library is:<br />
<strong><a href="http://code.google.com/p/smart-lencioni-image-resizer/">SLIR</a></strong></p>
<p>SLIR – or ”Smart Lencioni Image Resizer” – was developed by <a href="http://shiftingpixel.com/">Joe Lencioni</a>.<br />
It does on-the-fly scaling and cropping of images.</p>
<p>The&#8230; <a href="http://www.jakobloekkemadsen.com/2010/02/useful-php-libraries-part-1-slir/" class="read_more">Read the rest</a></p>]]></description>
			<content:encoded><![CDATA[<p><em>In this series of blog posts I introduce my favourite PHP libraries.</em></p>
<p>Today&#8217;s library is:<br />
<strong><a href="http://code.google.com/p/smart-lencioni-image-resizer/">SLIR</a></strong></p>
<p>SLIR – or ”Smart Lencioni Image Resizer” – was developed by <a href="http://shiftingpixel.com/">Joe Lencioni</a>.<br />
It does on-the-fly scaling and cropping of images.</p>
<p>The benefit is that you can change your image sizes dynamically on request-time.<br />
If your page layout changes, you can just request images with new sizes that fit.</p>
<p>Under the hood it&#8217;s a clever PHP script that returns the content of an image file. Requests are handled by a .htaccess-file that disguises the underlying PHP and presents it to the public as an actual image file.</p>
<p>This means you activate the resizer just by requesting a url with some resize parameters plus the path to the original image file.</p>
<p>Example:</p>
<p>Original image:</p>

<div class="wp_syntax"><div class="code"><pre class="htm" style="font-family:monospace;">&lt;img src=&quot;http://www.jakobloekkemadsen.com/wp-content/uploads/2010/02/DSC_1225_maj-30-2009.jpg&quot; alt=&quot;&quot; /&gt;</pre></div></div>

<p><img src="http://www.jakobloekkemadsen.com/wp-content/uploads/2010/02/DSC_1225_maj-30-2009.jpg" alt="" /></p>
<p>Scaled to fit 100px width:</p>

<div class="wp_syntax"><div class="code"><pre class="htm" style="font-family:monospace;">&lt;img src=&quot;http://www.jakobloekkemadsen.com/slir/w100/wp-content/uploads/2010/02/DSC_1225_maj-30-2009.jpg&quot; alt=&quot;&quot; /&gt;</pre></div></div>

<p><img src="http://www.jakobloekkemadsen.com/slir/w100/wp-content/uploads/2010/02/DSC_1225_maj-30-2009.jpg" alt="" /></p>
<p>Scaled to fit 25px width and cropped to square:</p>

<div class="wp_syntax"><div class="code"><pre class="htm" style="font-family:monospace;">&lt;img src=&quot;http://www.jakobloekkemadsen.com/slir/w25-c1:1/wp-content/uploads/2010/02/DSC_1225_maj-30-2009.jpg&quot; alt=&quot;&quot; /&gt;</pre></div></div>

<p><img src="http://www.jakobloekkemadsen.com/slir/w25-c1:1/wp-content/uploads/2010/02/DSC_1225_maj-30-2009.jpg" alt="" /></p>
<p>”What about performance?”, I hear you ask. &#8220;Won&#8217;t the server choke on having to process all image requests?&#8221;</p>
<p>No, it won&#8217;t. (-:<br />
SLIR caches the image the first time it’s requested, so all subsequent requests are served just as fast as any other image file on the server. The redirect is handled by an alias to the cachefile. Only if no matching cache file exists, or if it’s too old, or if the original has changed, then SLIR is invoked and a new image is generated and cached.</p>
<p>”Ok. But what about security, then?”</p>
<p>In theory this script enables a hacker to flood your server with files just by changing the url and requesting all imaginable combinations of width and height. This issue has been discussed in the comments on <a href="http://shiftingpixel.com/2008/03/03/smart-image-resizer/">http://shiftingpixel.com/2008/03/03/smart-image-resizer/</a> and the current version of the script can be made to restrict access to any other combinations than the ones you specify.</p>
<p>Personally I haven’t found an easier, more futureproof and flexible solution for handling image scaling.<br />
And it&#8217;s free!</p>
<p>Simply put: I love this script!</p>
<p><strong>Stay tuned for part two of &#8220;Useful PHP libraries&#8221;. Coming soon &#8230;</strong></p>
 <p><a href="http://www.jakobloekkemadsen.com/?flattrss_redirect&amp;id=115&amp;md5=22fc482b916b1349568bb3054097a086" title="Flattr" target="_blank"><img src="http://www.jakobloekkemadsen.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p><img src="http://feeds.feedburner.com/~r/Jakobloekkemadsen/~4/W6D-EmN-hcw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.jakobloekkemadsen.com/2010/02/useful-php-libraries-part-1-slir/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=jakobloekke&amp;popout=1&amp;url=http%3A%2F%2Fwww.jakobloekkemadsen.com%2F2010%2F02%2Fuseful-php-libraries-part-1-slir%2F&amp;language=en_GB&amp;category=text&amp;title=Useful+PHP+libraries%2C+part+1+%26%238211%3B+SLIR&amp;description=In+this+series+of+blog+posts+I+introduce+my+favourite+PHP+libraries.+Today%26%238217%3Bs+library+is%3A+SLIR+SLIR+%E2%80%93+or+%E2%80%9DSmart+Lencioni+Image+Resizer%E2%80%9D+%E2%80%93+was+developed+by+Joe+Lencioni.+It...&amp;tags=class%2Cdesign%2Cimages%2Cphp%2Cblog" type="text/html" />
	<feedburner:origLink>http://www.jakobloekkemadsen.com/2010/02/useful-php-libraries-part-1-slir/</feedburner:origLink></item>
	</channel>
</rss>

