<?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>Olle Jonsson&#039;s blog &#187; copenhagenrb</title>
	<atom:link href="http://ollehost.dk/blog/tag/copenhagenrb/feed/" rel="self" type="application/rss+xml" />
	<link>http://ollehost.dk/blog</link>
	<description></description>
	<lastBuildDate>Tue, 22 May 2012 20:28:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Crosscheck wheel spin</title>
		<link>http://ollehost.dk/blog/2007/10/05/crosscheck-wheel-spin/</link>
		<comments>http://ollehost.dk/blog/2007/10/05/crosscheck-wheel-spin/#comments</comments>
		<pubDate>Fri, 05 Oct 2007 21:00:23 +0000</pubDate>
		<dc:creator>olleolleolle</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[copenhagenrb]]></category>
		<category><![CDATA[crosscheck]]></category>

		<guid isPermaLink="false">http://ollehost.dk/blog/?p=362</guid>
		<description><![CDATA[At the last meeting with Copenhagen.rb, I said I&#8217;d test out Crosscheck &#8211; a JavaScript testing framework, suited for continuous integration or command-line testing. I had just tried getting it to run, following the slightly outdated Add Event tutorial. At &#8230; <a href="http://ollehost.dk/blog/2007/10/05/crosscheck-wheel-spin/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>At the last meeting with Copenhagen.rb, I said I&#8217;d test out <a href="http://www.thefrontside.net/crosscheck">Crosscheck</a> &#8211; a JavaScript testing framework, suited for continuous integration or command-line testing.</p>
<p>I had just tried getting it to run, following the slightly outdated <a href="https://dev.thefrontside.net/crosscheck/wiki/AddEventTutorial">Add Event tutorial</a>. At last I got it to work, but I had to actually read the text, not just paste the examples. Better grab the example source code than read the slightly-outdated docs.</p>
<p>Tonight I have tested it in a little more real setting: I had a hunch of how I would be able to do a filtering function that worked like in Quicksilver or Textmate. A case-insensitive, very inclusive search that just narrows down based on the sequence of the characters, not on their immediate order. (Did that make sense?)</p>
<p>Expressed as a positive test case: &#8220;jy8&#8243; should match &#8220;Jyri is happy to be 8 years of age&#8221;.</p>
<p>Anyway, I thought I could construct a regex on the fly, somehow. I itched to try. And I wanted to try it using tests along the way.</p>
<p>So, I entered the first, simplest case I could think of: equality. A list of one element should return only a single-element array. That was simple to do, so I could take on the next (that I could think of). And the rest was just implementation, until I hit something I had to test in Firebug.</p>
<p>The cool thing was that my experimentation was over as soon as I&#8217;d answered the question I had. Focus, the programmer&#8217;s holy grail. The promise of focus, at least. We&#8217;ll see about how that holds up in practice.</p>
<p>Here is the quite redundant, stupid list of test cases that I accumulated while trying things on:</p>
<pre><code>
crosscheck.onSetup(function(){
    crosscheck.load("scripts/quicksilverSearch.js");
});
crosscheck.addTest({
    testShouldFindSameMatchingString : function () {
        var outPut = quicksilverMatch('johnny', ['johnny']);
        var exp = ['johnny'];
        assertEquals( exp[0], outPut[0],
            'The same word could not be found in the simple array. Shame.' );
    },
    testShouldNotFindANonMatchingString : function () {
        var outPut = quicksilverMatch('jx', ['johnny']);
        assertTrue( outPut.length == 0, 'The word jx was found in johnny?! Shame.' );
    },
    testShouldMatchAllOnFirstLetter : function() {
        var outPut = quicksilverMatch('jo', ['johnny', 'jools', 'june']);
        assertTrue( outPut.length == 2,
            'Unable to match with indexOf on the first two letters. Shame.' );
    },
    testShouldMatchAcrossWords : function() {
        var outPut = quicksilverMatch('jy', ['jyri', 'johnny', 'june']);
        assertTrue( outPut.length == 2,
            'Unable to match across words. Shame.' );
    },
    testShouldMatchAcrossWordsCaseInsensitively : function() {
        var outPut = quicksilverMatch('jy8', ['Jyri 8 years', 'Johnny turns 8', 'june']);
        assertTrue( outPut.length == 2,
            'Unable to match case-ins. across words. Shame.' );
    }
});
</code></pre>
<p>So, the first thing that gets done before execution of each test case: load my script. That is specified in <code>crosscheck.onSetup</code>.</p>
<p>The least interesting part of this is my resulting code. After pulling it through JSLint and mulling over it a couple more times, it just shrunk. Which is the end goal of testing, I guess: to have me own as little code as possible. (We&#8217;ll come back to that.)</p>
<pre><code>
/**
 * "Quicksilver" filter search: returns an array of the haystack elements that
 * match case-insensitively the given term.
 * 2007-10-05, Olle
 */
function quicksilverMatch(term, haystack) {
    var matches = [];
    var straw; // The individual piece of hay
    // "t.*e.*r.*m" regular expression for loose matching
    var re = new RegExp(term.split("").join('.*'), "i");
    for (var idx = 0, len = haystack.length; idx < len; ++idx) {
        straw = haystack[idx];
        // Direct match inside word? Or: a case-ins. loose match
        if (straw.indexOf(term) > -1 || re.test(straw)) {
            matches.push(straw);
        }
    }
    return matches;
}
</code></pre>
<p>The take-home piece I got from this sitting was how to run Crosscheck. I created a wrapper shell script that I christened &#8220;crosschecka&#8221;, where I set my target browsers (&#8220;hosts&#8221;) and paths:</p>
<pre><code>
#!/bin/bash
#
# Run the crosscheck jar on given test path, or default
#
# We run on Firefox 1.5 and IE6: moz-1.8:ie-6
#
# Author: olle, 2007-09-26

CROSSCHECK_JAR=/Users/olle/lib/crosscheck-0.2.1/crosscheck.jar
# Colon-separated. Possible values are moz-1.7:moz-1.8:ie-6
HOSTS_TO_CHECK=moz-1.8:ie-6    

# Our test path is tests/eosweb/js, relative to the web app root
if [[ $1 == '' ]]; then
{
    java -jar $CROSSCHECK_JAR -hosts=$HOSTS_TO_CHECK tests/eosweb/js
    exit 0;
}
else
{
    java -jar $CROSSCHECK_JAR -hosts=$HOSTS_TO_CHECK $1
    exit 0;
}
fi
</code></pre>
<p>(I never got the file test in the else clause right, so I let Crosscheck complain for me.) The Rails-type win here is having a pre-set default, so I never have to think about it.</p>
<p>Thought: Maybe this whole testing thing is a way to get me to reduce the scope of my methods? To be testable, they have to be decomposed to parts that are cheap to test. </p>
<p>I said I&#8217;d come back to owning less code: now that I know these things about the behaviour of my code, do you think I should revisit and sharpen up my test-cases? For one thing, some of them might not even hit right. The first one, it seems very weak and situationally dependent. </p>
<p>Would you go back and change such stuff? Or delete such cases?</p>
]]></content:encoded>
			<wfw:commentRss>http://ollehost.dk/blog/2007/10/05/crosscheck-wheel-spin/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Copenhagen.rb: September meetup, minor review and or notes</title>
		<link>http://ollehost.dk/blog/2007/09/26/copenhagenrb-september-meetup-minor-review-and-or-notes/</link>
		<comments>http://ollehost.dk/blog/2007/09/26/copenhagenrb-september-meetup-minor-review-and-or-notes/#comments</comments>
		<pubDate>Wed, 26 Sep 2007 07:53:49 +0000</pubDate>
		<dc:creator>olleolleolle</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[activewarehouse]]></category>
		<category><![CDATA[copenhagenrb]]></category>
		<category><![CDATA[rubyonrails]]></category>

		<guid isPermaLink="false">http://ollehost.dk/blog/?p=361</guid>
		<description><![CDATA[Last night, a Ruby club meet, which was interesting, but the feeling I got was &#8220;you hadda have been at RailsConf&#8221;. And I wasn&#8217;t, so bummer. Informal atmosphere allows one to play with one&#8217;s laptop while others are reminiscing: ActiveWarehouse &#8230; <a href="http://ollehost.dk/blog/2007/09/26/copenhagenrb-september-meetup-minor-review-and-or-notes/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Last night, a Ruby club meet, which was interesting, but the feeling I got was &#8220;you hadda have been at RailsConf&#8221;. And I wasn&#8217;t, so bummer.</p>
<p>Informal atmosphere allows one to play with one&#8217;s laptop while others are reminiscing:</p>
<p><a href="http://activewarehouse.rubyforge.org/" title="Data warehousing with Rails">ActiveWarehouse</a> a data warehousing application. Could be very interesting. Funny: me and Isak had said &#8220;Let&#8217;s analyze our SVN logs, that a nice chunky dataset.&#8221; He showed his first steps, grabbing the XML output Subversion can report about its logs. They were rich enough to map to&#8230; a data warehouse.</p>
<p>And, as it ironically turns out, the seminal example for ActiveWarehouse is <a href="http://anthonyeden.com/2006/12/20/activewarehouse-example-with-rails-svn-logs" title="Introductory tutorial">activewarehouse-example-with-rails-svn-logs</a>. Going to play with this, when I get some time.</p>
<p>When I was not listening, I was struggling to get offline browser tests running with <a href="http://www.thefrontside.net/crosscheck" title="Crosscheck is an open source testing framework">Crosscheck</a>, which packages up IE6 and Firefox (1.5 and the older 1.0):</p>
<p>It&#8217;s just a JAR, so you run it on a folder with tests:</p>
<pre><code>java -jar ~/Desktop/crosscheck-0.2.1.tar/crosscheck.jar \\
-hosts=moz-1.8:ie-6 \\
tests/eosweb/js/
</code></pre>
<p>I want to hook this into our <a href="http://bitten.cmlenz.net/" title="Continuous Integration server plugin for Trac">Bitten</a> installation.</p>
<p>Super-secret note, only for you: I also made a note about the Oresund Web Hacking club, which only exists on Facebook (as a local group), so befriend me there, or search for the above name. Something more public will get created.</p>
]]></content:encoded>
			<wfw:commentRss>http://ollehost.dk/blog/2007/09/26/copenhagenrb-september-meetup-minor-review-and-or-notes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Patch day for Rails, in Copenhagen</title>
		<link>http://ollehost.dk/blog/2007/04/30/patch-day-for-rails-in-copenhagen/</link>
		<comments>http://ollehost.dk/blog/2007/04/30/patch-day-for-rails-in-copenhagen/#comments</comments>
		<pubDate>Mon, 30 Apr 2007 08:11:34 +0000</pubDate>
		<dc:creator>olleolleolle</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[copenhagenrb]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://ollehost.dk/blog/?p=342</guid>
		<description><![CDATA[The inimitable Jakob tells all about the upcoming Rails patch night, so I won&#8217;t say more than &#8220;it is a great way of getting into Rails&#8221; (Rails, the Open Source project; and Rails, the codebase). (I won&#8217;t be there, I &#8230; <a href="http://ollehost.dk/blog/2007/04/30/patch-day-for-rails-in-copenhagen/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The inimitable <a href="http://mentalized.net">Jakob</a> tells all about the upcoming <a href="http://mentalized.net/journal/2007/04/27/rails_patch_night/">Rails patch night</a>, so I won&#8217;t say more than &#8220;it is a great way of getting into Rails&#8221; (Rails, the Open Source project; and Rails, the codebase).</p>
<p>(I won&#8217;t be there, I have a family thing to travel to, but please fill my seat, you.)</p>
<p>Hm, I shoulda added this to <a href="http://upcoming.org/">Upcoming.org</a>, too.</p>
<p>[tags]copenhagenrb,rails[/tags]</p>
]]></content:encoded>
			<wfw:commentRss>http://ollehost.dk/blog/2007/04/30/patch-day-for-rails-in-copenhagen/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Copenhagen.rb meetup: Puppet and fringe activity</title>
		<link>http://ollehost.dk/blog/2007/04/20/copenhagenrb-meetup-puppet-and-fringe-activity/</link>
		<comments>http://ollehost.dk/blog/2007/04/20/copenhagenrb-meetup-puppet-and-fringe-activity/#comments</comments>
		<pubDate>Fri, 20 Apr 2007 07:22:19 +0000</pubDate>
		<dc:creator>olleolleolle</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[copenhagenrb]]></category>
		<category><![CDATA[fringe]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://ollehost.dk/blog/?p=339</guid>
		<description><![CDATA[Juri presented the amazing Puppet framework for controlling servers. He controls about 20 servers with it. Think of Puppet&#8217;s files as &#8220;setup Rakefiles for servers&#8221; which is version-controlled, monitored, and written in a very terse DSL. Seems slick. Juri might &#8230; <a href="http://ollehost.dk/blog/2007/04/20/copenhagenrb-meetup-puppet-and-fringe-activity/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Juri presented the amazing Puppet framework for controlling servers. He controls about 20 servers with it. </p>
<p>Think of Puppet&#8217;s files as &#8220;setup Rakefiles for servers&#8221; which is version-controlled, monitored, and written in a very terse DSL. Seems slick. Juri might publish his nice slides, who knows.</p>
<p>While he was presenting, me and <a href="http://larsgeisler.dk/">Lars SG</a> were typing to each other, like kids in the back of the classroom. Quicksilver&#8217;s <em>Large Type</em> action was used a lot. It started when I noted he was working on the Counter example in <a href="http://www.seaside.st/Download/">Seaside</a>, using a new Squeak. A fellow tourist in fringe-language-land!</p>
<p>We took quick detours into Io and CLisp (I had read about <code>mapcar</code>, and wanted to show what it was), and Lars turned out to be able to stomach even the most arcane crap. Perfect: a new special interest group in our Copenhagen Ruby Brigade. <a href="http://jamesbritt.com/2007/4/10/good-to-be-wrong">James Britt</a> reports that this is a common Ruby programmer&#8217;s thing, and that it manifests itself in their meetups. See his link to <a href="http://www.lisperati.com/fringedc.html">fringedc</a> for a picture of how to understand the &#8220;fringe&#8221; label.</p>
<p>[tags]ruby,copenhagenrb,fringe[/tags]</p>
]]></content:encoded>
			<wfw:commentRss>http://ollehost.dk/blog/2007/04/20/copenhagenrb-meetup-puppet-and-fringe-activity/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Copenhagen.rb meeting notes</title>
		<link>http://ollehost.dk/blog/2006/09/20/copenhagenrb-meeting-notes/</link>
		<comments>http://ollehost.dk/blog/2006/09/20/copenhagenrb-meeting-notes/#comments</comments>
		<pubDate>Tue, 19 Sep 2006 20:33:47 +0000</pubDate>
		<dc:creator>Olle Jonsson</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[copenhagenrb]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubyonrails]]></category>

		<guid isPermaLink="false">http://olle.ter.dk/blog/?p=303</guid>
		<description><![CDATA[Update: photos by Pelle. Syndication with AtomPub, APP and GData&#8230; and Rails Olle Jonsson &#8220;explores&#8221; some things you would want to do with Atom&#8230; and how Rails enables you to do it. Update: My somewhat confused slides now available (PDF). &#8230; <a href="http://ollehost.dk/blog/2006/09/20/copenhagenrb-meeting-notes/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>Update</strong>: <a href="http://flickr.com/photos/pelle/sets/72157594291461447/">photos</a> by Pelle.</p>
<h2 id="syndication_with_atompub_app_and_gdata8230_and_rails">Syndication with AtomPub, APP and GData&#8230; and Rails</h2>
<p>Olle Jonsson &#8220;explores&#8221; some things you would want to do with Atom&#8230; and how Rails enables you to do it.</p>
<p>Update: <a href="http://talks.olle.ter.dk/http_verbs_and_rails.pdf">My somewhat confused slides</a> now available (PDF).</p>
<h2 id="dhh_on_activeresource">DHH on ActiveResource</h2>
<p>&#8230;and then I got lucky, and David was able to give us &#8220;how to do all this painlessly in Rails.&#8221;</p>
<p>David HH presented the new ActiveResource stuff. Edge, plugins. &#8220;Undecided&#8221;, still, about if it&#8217;ll be in the standard distribution.</p>
<p>Suffix the URL with <code>.xml</code> (or any format your app <code>responds_to</code>!)</p>
<pre><code>GET /posts/1.xml
POST /posts/1.xml {POST payload}
</code></pre>
<p>Clarifiction: The last line there, the POST payload, is not a Ruby block, it is what you send as the body of the HTTP request.</p>
<p>We saw the MIME-type format list that Rails&#8217; ActiveResource can output. I missed the JSON format, mentioned it, and David showed how it would be simple to add JSON support to ActiveResource.</p>
<p>Let us cook that up! And David showed:</p>
<ul>
<li>Register a new JSON mime-type</li>
<li><code>respond_to</code> {} the <code>:json</code>, and spit that out</li>
<li>make <code>.to_json()</code></li>
</ul>
<p>There must be a plugin for this. And there is, we were informed.</p>
<h2 id="don8217t_trust_yourself_with_your_users8217_data">Don&#8217;t Trust Yourself with Your Users&#8217; Data</h2>
<p><a href="http://www.neubia.com/">Pelle B.</a> tells it like it is, and <strong>provides</strong> a plugin called EzCrypto. Short, simple presentation, very good. And also, notes on a couple of new developments from the productive programmer: secret URLs as a plugin.</p>
<h2 id="jruby_at_a_glance">JRuby at a glance</h2>
<p>Teaser-like presentation (&#8216;Part I&#8217;) by Morten Ch. from Aarhus.</p>
<p>[tags]ruby,rubyonrails,copenhagenrb,event[/tags]</p>
]]></content:encoded>
			<wfw:commentRss>http://ollehost.dk/blog/2006/09/20/copenhagenrb-meeting-notes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Olle interviewed at PuneRuby</title>
		<link>http://ollehost.dk/blog/2006/09/07/olle-interviewed-at-puneruby/</link>
		<comments>http://ollehost.dk/blog/2006/09/07/olle-interviewed-at-puneruby/#comments</comments>
		<pubDate>Thu, 07 Sep 2006 05:25:36 +0000</pubDate>
		<dc:creator>olleolleolle</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[copenhagenrb]]></category>
		<category><![CDATA[puneruby]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://olle.ter.dk/blog/?p=292</guid>
		<description><![CDATA[I was being interviewed at PuneRuby &#8211; next to my heroes. Strange, wonderful times.]]></description>
			<content:encoded><![CDATA[<p>I was being <a href="http://www.puneruby.com/blog/?p=88">interviewed at PuneRuby</a> &#8211; next to my heroes.</p>
<p>Strange, wonderful times.</p>
]]></content:encoded>
			<wfw:commentRss>http://ollehost.dk/blog/2006/09/07/olle-interviewed-at-puneruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

