<?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>pedant.dk &#187; Coding</title>
	<atom:link href="http://www.pedant.dk/category/coding/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pedant.dk</link>
	<description>Honesty in small things is not a small thing</description>
	<lastBuildDate>Thu, 05 Aug 2010 16:11:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>pdf thingy</title>
		<link>http://www.pedant.dk/2010/02/02/pdf-thingy/</link>
		<comments>http://www.pedant.dk/2010/02/02/pdf-thingy/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 20:27:48 +0000</pubDate>
		<dc:creator>Jacob</dc:creator>
				<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://www.pedant.dk/?p=784</guid>
		<description><![CDATA[Update 2010-05-08:
Google has decided to discontinue Google wave, so  I  will stop updating pdf-thingy.
I&#8217;ve spent a couple of hours tinkering with pdf export from wave. I put the result here :
pdf-thingy@appspot.com . You can invite the bot to your wave, when you do it will present a link to a pdf version of the root [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update 2010-05-08:</strong></p>
<p><strong>Google has decided to discontinue Google wave, so  I  will stop updating pdf-thingy.</strong></p>
<p>I&#8217;ve spent a couple of hours tinkering with pdf export from wave. I put the result here :<br />
pdf-thingy@appspot.com . You can invite the bot to your wave, when you do it will present a link to a pdf version of the root blip. No fancy colors yet <img src='http://www.pedant.dk/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Somebody pointed me to <a href="http://googlewavebots.info/wiki/index.php?title=PDF_Wave_Exporter">PDF Wave Exporter</a>, but I could not find the source code for it to tinker with. (I admit that I did not look that hard).</p>
<p>I implemented pdf thingy to learn more about python,wave and google appengine.</p>
<p>I based pdf-thingy on exporty by Pamela Fox , available from <a href="http://code.google.com/p/google-wave-resources/">google code</a> .  <a href="http://konryd.blogspot.com/2008/04/outputting-pdfs-with-google-app-engine.html">This tutorial</a> helped me learn about reportlab on google app engine.</p>
<p>You can find the code here: <a href="http://github.com/jacobandresen/pdf-thingy">http://github.com/jacobandresen/pdf-thingy</a></p>
<p>There are some obvious points of improvement:<br />
- handle text overflow<br />
- supporting annotations<br />
- fancy color templating</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pedant.dk/2010/02/02/pdf-thingy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>icanhas javascript OOP?</title>
		<link>http://www.pedant.dk/2009/12/12/icanhas-javascript-oop/</link>
		<comments>http://www.pedant.dk/2009/12/12/icanhas-javascript-oop/#comments</comments>
		<pubDate>Sat, 12 Dec 2009 05:48:17 +0000</pubDate>
		<dc:creator>Jacob</dc:creator>
				<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.pedant.dk/?p=724</guid>
		<description><![CDATA[In javascript we can express objects using the prototype notation: 

  var Cat = function () {
     this.furry = true;
  }
 Cat.prototype.greet = function () {
   return &#34;meeow&#34;;
 }

using class mimicking from prototype-js it would be :

 var Cat = new Class({
  initialize: function (){
  [...]]]></description>
			<content:encoded><![CDATA[<p>In javascript we can express objects using the prototype notation: </p>
<pre class="brush: jscript;">
  var Cat = function () {
     this.furry = true;
  }
 Cat.prototype.greet = function () {
   return &quot;meeow&quot;;
 }
</pre>
<p>using class mimicking from <a href="http://prototypejs.org/">prototype-js</a> it would be :</p>
<pre class="brush: jscript;">
 var Cat = new Class({
  initialize: function (){
    this.furry = true;
    },
  ask: function (item) {
   return &quot;icanhas &quot;+item+&quot; ?&quot;;
 });
</pre>
<p>This example should be pretty clear. But when we get into real-life application scenarios we need to interact with users and databases.</p>
<p>Let&#8217;s say we had a panel and a button for interacting with <a href="http://icanhascheezburger.com/2008/08/12/funny-pictures-i-fightz-dem/">lolcats</a>:</p>
<pre class="brush: jscript;">
var CatInformationPanel = Class.create({
   initialize: function (container) {
     $(container.id+'_furry').checked = true;
     $('petButton').observe('click',  this.ask.bindAsEventListener(this));
  },
  ask:  function (item) {
    $(container.id+'_text').value =&quot;icanhas &quot;+item+&quot; ?&quot;;
  }
});
</pre>
<p>Note that we need to bind &#8220;this&#8221; to the the function scope for &#8220;ask&#8221;. this is one of the intricacies of object oriented javascript. Here are <a href="http://alternateidea.com/blog/articles/2007/7/18/javascript-scope-and-binding">some badass ninja examples</a> to explain why.</p>
<p>Now, after interacting with user , you probably want to save the result to a database. let&#8217;s assume that you have a resource /lol/cat/questions you can issue a HTTP post to (you can create this using <a href="http://rubyonrails.org/">rubyonrails</a> or  something similar).</p>
<pre class="brush: jscript;">
var CatInformationPanel = Class.create({
   initialize: function (container,name) {
     this.name = name;
     $(container.id+'_furry').checked = true;
     $('petButton').observe('click',  this.ask.bindAsEventListener(this));
  },
  ask:  function (item) {
    var question = &quot;icanhas &quot;+item+&quot; ?&quot;
    $(container.id+'_text').value =question;
   var request = new Ajax.Request ({
      &quot;/lol/cat/question&quot;, {
        method:'post',
        params:{ name:name, question:question },
        onSuccess: function (json) {
           alert(&quot;saved question&quot;);
           }
     }
    });
  }
});
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.pedant.dk/2009/12/12/icanhas-javascript-oop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>gemcutter: the missing manual</title>
		<link>http://www.pedant.dk/2009/10/21/gemcutter-the-missing-manual/</link>
		<comments>http://www.pedant.dk/2009/10/21/gemcutter-the-missing-manual/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 19:20:27 +0000</pubDate>
		<dc:creator>Jacob</dc:creator>
				<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.pedant.dk/?p=713</guid>
		<description><![CDATA[Thanks to Jakob Kruse  I now know how to operate RubyGems and gemcutter on windows. Here&#8217;s what I did:
1:I downloaded the 1.8.6 ruby installer here
2: I installed gemcutter like this:

gem update --system
gem install gemcutter
gem tumble
gem install jspec

this let me use gemcutter on windows using the current one-click installer  
]]></description>
			<content:encoded><![CDATA[<p>Thanks to <a href="http://www.kruse-net.dk">Jakob Kruse </a> I now know how to operate RubyGems and gemcutter on windows. Here&#8217;s what I did:</p>
<p>1:I downloaded the 1.8.6 ruby installer <a href="http://www.ruby-lang.org/en/downloads/">here</a></p>
<p>2: I installed gemcutter like this:</p>
<pre class="brush: bash;">
gem update --system
gem install gemcutter
gem tumble
gem install jspec
</pre>
<p>this let me use gemcutter on windows using the current one-click installer <img src='http://www.pedant.dk/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.pedant.dk/2009/10/21/gemcutter-the-missing-manual/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>adventures with mingw , ruby,java, rhino and jspec</title>
		<link>http://www.pedant.dk/2009/10/21/adventures-with-mingw-rubyjava-rhino-and-jspec/</link>
		<comments>http://www.pedant.dk/2009/10/21/adventures-with-mingw-rubyjava-rhino-and-jspec/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 23:09:06 +0000</pubDate>
		<dc:creator>Jacob</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.pedant.dk/?p=689</guid>
		<description><![CDATA[update 2009-10-21: This post is a writeup of my early experiences with gemcutter and rubygems. The strange runtime error I did not understand was probably related to that I needed to update rubygems to 1.3.5.  I now know how to use gemcutter from ruby1.8.6 using the oneclick installer .
I have been using jspec on [...]]]></description>
			<content:encoded><![CDATA[<p><strong>update 2009-10-21: This post is a writeup of my early experiences with gemcutter and rubygems. The strange runtime error I did not understand was probably related to that I needed to update rubygems to 1.3.5.  <a href="http://www.pedant.dk/2009/10/21/gemcutter-the-missing-manual/">I now know how to use gemcutter from ruby1.8.6 using the oneclick installer</a> .</strong></p>
<p>I have been using <a href="http://github.com/visionmedia/jspec/tree/3.x">jspec</a> on macosx for a while  and decided to give it a try on windows vista today. Installing jspec on macosx and linux can be done using the instructions <a href="http://github.com/visionmedia/jspec/blob/3.x/README.md">here</a> .</p>
<p>I want to run the automated jspec tests available via rhino at a client site. Sadly , I am forced to use windows there, so I have given some thought on how to make jspec run on windows.</p>
<p>First of all you need to install ruby.  I used the automated 1.8.6 One-Click Installer available <a href="http://www.ruby-lang.org/en/downloads/">here</a> . After installing i ran</p>
<p><code lang="bash"><br />
gem update<br />
</code></p>
<p>the instructions in the README file for jspec currently states that I should install gemcutter and install jspec via that . I was not able to do that on windows  ( my system decided to report an obscure runtime error that I did not understand). So i decided to do this instead:</p>
<p><code lang="bash"><br />
gem sources -a http://gems.github.com<br />
gem install visionmedia-jspec<br />
</code></p>
<p>I let gem install the required dependencies visionmedia-commander and visionmedia-bind. After this I had the jspec script available. Sadly this gave me version 2.7.2 (I noticed \ruby\lib\ruby\gems\1.8\gems\visionmedia-jspec-2.7.2 ) <a href="http://gemcutter.org/gems/jspec">The listing on gemcutter</a>  told me that a version 2.11.10 is a avaiable , so I decided to dig deeper. Maybe I could make gemcutter work anyway?</p>
<p>After a little browsing on github.com I found the <a href="http://github.com/oneclick/rubyinstaller/">oneclick installer</a> </p>
<p>I cloned this repo using git  </p>
<p>using the following command:<br />
<code lang="bash"><br />
git clone git://github.com/oneclick/rubyinstaller.git<br />
</code></p>
<p> and pressed </p>
<p><code lang="bash"><br />
rake ruby19<br />
</code></p>
<p>This project creates a sandbox that compiles a working ruby environment using <a href="http://mingw.org/">mingw</a>. </p>
<p>After contemplating the insanity of what I was doing for a couple of minutes (remember : installing a working ruby on linux is a single shell command) I grabbed some coca cola and started browsing through the source code for ruby distro while the rubyinstall was compiling. I looked a bit at ruby.c and  vm_exec.c  and had grim flashbacks to my c days. Luckily the compile finished and I copied ruby19_mingw to my c:\ drive and set it up on my PATH variable. Then I could check which version I was using:</p>
<p><code lang="bash"><br />
C:\>ruby -v<br />
ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-mingw32]<br />
</code></p>
<p>Now I was able to do:<br />
<code lang="bash"><br />
gem install gemcutter<br />
gem tumble<br />
gem install jspec<br />
</code></p>
<p>(Note that there is  information sent to the terminal during these steps)</p>
<p>Now for the interesting part(!) jspec was working , so I could do this:</p>
<p><code lang="bash"><br />
jspec init SolitaireCipher --freeze<br />
</code></p>
<p>This created a directory where I can train doing the <a href="http://www.rubyquiz.com/quiz1.html">SolitaireCipher</a> using javascript. I renamed lib/yourlib.core.js to lib/SolitaireCipher.js  and spec/spec.core.js to spec/spec.SolitaireCipher.js and spec/spec.dom.html accordingly.</p>
<p>After 20 mins of fiddling I managed to get some running tests in a browser by opening spec.dom.html. Then I decided I want to automate the tests using <a href="http://www.mozilla.org/rhino/download.html">mozilla rhino</a>. After installing rhino , I could run automated tests like this</p>
<p><code lang="bash"><br />
 cd c:\projects\SolitaireCipher<br />
 jspec --rhino<br />
</code></p>
<p>This opens up a proces that listens to file changes in the lib and spec folders. All very well &#8211; untill I discovered that jspec currently uses ANSI codes to render colors to the terminal screens. ANSI codes are not supported on windows vista (something with ANSI.SYS being obsoleted), so if I want the nice colors then I need an alternative terminal than my command prompt in vista.</p>
<p>I found rxvt available from <a href="http://code.google.com/p/msysgit/downloads/list">PortableGit</a> on google code. This renders the colors just nicely &#8211; but has some other drawbacks. If I just use rxvt for rendering feedback from the jspec tests, then it seems to work though. </p>
<p>One thing to note is that rhino needs the java sdk to be installed and js.jar needs to be on your CLASSPATH. when starting jspec from rxvt on the msys from PortableGit, then CLASSPATH could be set like this (assuming rhino is installed in c:\tools ):</p>
<p><code lang="bash"><br />
export CLASSPATH=/c/tools/rhino1_7R2/js.jar<br />
</code></p>
<p>I probably want to avoid using rxvt on PortableGit too much . There are some major flaws listed <a href="http://code.google.com/p/msysgit/wiki/WhyIsRxvtNotTheDefault">here</a> .</p>
<p>Maybe I should look into doing a adobe air frontend for jspec? </p>
]]></content:encoded>
			<wfw:commentRss>http://www.pedant.dk/2009/10/21/adventures-with-mingw-rubyjava-rhino-and-jspec/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>unclebob does the prime factor kata</title>
		<link>http://www.pedant.dk/2009/10/11/unclebob-does-the-prime-factor-kata/</link>
		<comments>http://www.pedant.dk/2009/10/11/unclebob-does-the-prime-factor-kata/#comments</comments>
		<pubDate>Sun, 11 Oct 2009 18:13:28 +0000</pubDate>
		<dc:creator>Jacob</dc:creator>
				<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.pedant.dk/?p=686</guid>
		<description><![CDATA[update 2009-11-12: There is an updated version here
unclebob doing the prime factor kata:

]]></description>
			<content:encoded><![CDATA[<p><strong>update 2009-11-12: There is an updated version <a href="http://katas.softwarecraftsmanship.org/?p=71&#038;cpage=1#comment-43">here</a></strong></p>
<p><a href="http://twitter.com/unclebobmartin">unclebob</a> doing the prime factor kata:</p>
<p><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="437" height="370" id="viddler"><param name="movie" value="http://www.viddler.com/player/ce8c2038/" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /><embed src="http://www.viddler.com/player/ce8c2038/" width="437" height="370" type="application/x-shockwave-flash" allowScriptAccess="always" allowFullScreen="true" name="viddler" ></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pedant.dk/2009/10/11/unclebob-does-the-prime-factor-kata/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Paris Hilton and Behaviour Driven Development</title>
		<link>http://www.pedant.dk/2009/09/27/paris-hilton-and-behaviour-driven-development/</link>
		<comments>http://www.pedant.dk/2009/09/27/paris-hilton-and-behaviour-driven-development/#comments</comments>
		<pubDate>Sun, 27 Sep 2009 18:36:20 +0000</pubDate>
		<dc:creator>Jacob</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.pedant.dk/?p=644</guid>
		<description><![CDATA[Recently, I have been giving  Behaviour Driven Development some thought. 
Let&#8217;s take a an example of how to develop and test a  music video search and storage  system. A traditional way of developing this would require formulating a object oriented system architecture, thinking about streaming and metadata enabled search. The system architecture [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I have been giving  <a href="http://behaviour-driven.org/Introduction">Behaviour Driven Development</a> some thought. </p>
<p>Let&#8217;s take a an example of how to develop and test a  music video search and storage  system. A traditional way of developing this would require formulating a object oriented system architecture, thinking about streaming and metadata enabled search. The system architecture could consist  of a well chosen database server, a streaming server and a metadata enabled search engine &#8211; combining these technologies with a modern UI  and encapsulating theme in carefully designed object oriented structures. During all these important choices , and all during development we would make sure to write tests before we write a single line of code.</p>
<p> All these things put together would lead to a well thought out system architecture , but all the effort put into the system architecture can be in vain &#8211; if we don&#8217;t have a solid business understanding of what a video storage system should do. What will the users expect?</p>
<p>While browsing on <a href="http://www.facebook.com">facebook</a> this other day I found the <a href="http://www.facebook.com/group.php?gid=5299495387">&#8220;The Paris Hilton &#038; Jacques Derrida Appreciation Society&#8221; </a>  &#8211; this group explores the connections between the works of Paris Hilton and Jacques Derrida. When we deconstruct the &#8220;pretty blonde&#8221; facade of Paris Hilton, then you can actually find some deep insights. Take &#8220;Nothing in this world&#8221; for instance:</p>
<p><object width="560" height="340"><param name="movie" value="http://www.youtube.com/v/32DwYTRmmto&#038;hl=en&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/32DwYTRmmto&#038;hl=en&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object></p>
<p>Take the phrase &#8220;when you are with somebody else, that&#8217;s me in your eye&#8221;.  There is the obvious interpretation of the sentence .  But thinking about that sentence also let&#8217;s you reflect on the <em>real meaning</em> . When you look at Paris Hilton in this video, what do you see? Do you see the pretty blonde or the millionaire , hard working young girl . In this video I am seeing the image of the pretty blonde &#8211; but I am also thinking about the millions of dollars she is earning portraying herself in this way.  So in a sense &#8211; I am reading the original message out of context. I am admiring what Paris Hilton in some other way than she intended &#8211; the original meaning of the words seem to have disappeared &#8211; but my understanding of the sentence is more useful to me.  I wish I could do what Paris Hilton does &#8211; but in a way that would make sense in my world .</p>
<p>The producers of the &#8220;Nothing in this world&#8221; video are not likely to convey information about the business empire of Paris Hilton in the metadata supplied for the video. So a system formulated as a &#8220;video storage system&#8221; would not let me exploit the information I found in the facebook group.</p>
<p>BDD introduces the use of a Domain Specific language to express the users expectations in a manner more directly focused on the behavioural aspects of the system. This lifts the clouds from the system aspects and focuses on <em>intent</em>.</p>
<p>A better way to formulate my expectations for the system would be:</p>
<pre>
Describe the music video storage system:
  I should be able to search for videos using metadata
  it should play videos  in my browser
  I should be able to query facebook for information about it
  </pre>
<p>If I had those expectations formulated to me , then I would choose to implement this system as a mashup between youtube and facebook as a facebook application. This would be a radically different system architecture than the one describe above.</p>
<p>Furthermore , by leveraging one of the <a href="http://behaviour-driven.org/Implementations">several BDD test frameworks available</a>, then the expectations could be formulated in way that can be used as tests.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pedant.dk/2009/09/27/paris-hilton-and-behaviour-driven-development/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A wave is coming</title>
		<link>http://www.pedant.dk/2009/09/13/a-wave-is-coming/</link>
		<comments>http://www.pedant.dk/2009/09/13/a-wave-is-coming/#comments</comments>
		<pubDate>Sun, 13 Sep 2009 09:16:02 +0000</pubDate>
		<dc:creator>Jacob</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.pedant.dk/?p=618</guid>
		<description><![CDATA[Last week I attended a  day of outstanding geek fun . At the Google wave hackathon I had the chance to sink my teeth into the Google wave API after seeing presentations on gwt and google wave  by Tommy Pedersen and a presentation on wave gadgets by  Joakim Recht.
After a couple of hours of presentations and [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I attended a  day of <a title="outstanding geek fun" href="http://www.masteringwave.com/2009/09/wave-hackathon-in-copenhagen/">outstanding geek fun</a> . At the Google wave hackathon I had the chance to sink my teeth into the Google wave API after seeing presentations on gwt and google wave  by <a href="http://twitter.com/tpedersen">Tommy Pedersen</a> and a presentation on wave gadgets by  Joakim Recht.</p>
<p>After a couple of hours of presentations and brainstorming  we started hacking.  I teamed up with <a title="skakanka" href="http://twitter.com/skakanka"> skakanka</a> to experiment with sending the contents of a wave to a Proof of concept Document storage system . But we ended up doing a simple Echo Bot (but hey! we illustrated how to extract content from a wavelet and send it somewhere).</p>
<p>I brought a mac and used the <a title="google eclipse plugin" href="http://code.google.com/eclipse/">Google eclipse plugin</a> for galileo for coding. It helped that I allready had a Google app engine account from some earlier experiments &#8211; but I spent some time learning the different key combinations on the mac &#8211; it was great fun though (and now I know how to use eclipse on  a mac!). Deploying on google app engine is as simple as pressing a button in eclipse (I also tried using som ant tasks in my earlier experiments).</p>
<p>We managed to have a google wave running sometime before lunch &#8211; so it is very easy to get a basic understanding what a wave bot is all about. (You could think of it as an <a href="https://sourceforge.net/projects/pluggableircbot/">ircbot</a> on steroids ! )</p>
<p>The overall idea of building a google wave bot is to listen to incoming events defined in the protocol. Let&#8217;s say we want to perform something when somebody enters the wave or write something &#8211; then we can define the capabilities like this:</p>
<p><code lang="xml"><br />
<?xml version="1.0"?><br />
<w:robot xmlns:w="http://wave.google.com/extensions/robots/1.0"><br />
  <w:version>0.0.4</w:version><br />
  <w:capabilities><br />
     <w:capability name="blip_submitted"></w:capability><br />
    <w:capability name="wavelet_participants_changed"/><br />
  </w:capabilities><br />
</w:robot><br />
</code></p>
<p>Then the robot should act on the defined events in a manner similar to this :</p>
<p><code lang="java"><br />
@Override<br />
public void processEvents(RobotMessageBundle robotMessageBundle) {<br />
  Wavelet wavelet = robotMessageBundle.getWavelet();<br />
  String rootText = wavelet.getRootBlip().getDocument().getText();<br />
  for ( Event e: robotMessageBundle.getEvents()){<br />
    Blip b= e.getBlip();<br />
    String text= e.getBlip().getDocument().getText();<br />
    if (e.getType().equals(EventType.BLIP_SUBMITTED)){<br />
      e.getBlip().getDocument().append( makeEcho(text));<br />
    }<br />
  }<br />
}<br />
</code></p>
<p>The Wave client api  offers something like the DOM api for the xml being sent back and forth. During the hackathon I learnt that there is no way to ask for the contents of the entire wave from a single blip &#8211; so it will require some thinking to save the entire contents of the wave &#8211; but it should be doable.</p>
<p>Sometime during the afternoon things started to slow down on the wave test server. I noticed that some of the other guys doing a multiuser  interactive drawing gadget for wave. It looked like they recorded a delta to send every time the mouse moved! This made me want to look a bit under &#8220;the hood&#8221;:</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="350" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://www.youtube.com/v/uOFzWZrsPV0" /><embed type="application/x-shockwave-flash" width="425" height="350" src="http://www.youtube.com/v/uOFzWZrsPV0"></embed></object></p>
<p>Sounds like the team are handling the multiuser issues using &#8220;operational transforms&#8221; . Maybe they could somehow &#8216;batch&#8217; deltas from interactive gadgets ? I have yet to fully understand how &#8220;operational transforms&#8221; work  &#8211; but it sounds like an exciting challenge to make this work on a large scale!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pedant.dk/2009/09/13/a-wave-is-coming/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>openlayers 2.8 supports WFS-T</title>
		<link>http://www.pedant.dk/2009/09/02/openlayers-2-8-supports-wfs-t/</link>
		<comments>http://www.pedant.dk/2009/09/02/openlayers-2-8-supports-wfs-t/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 19:04:11 +0000</pubDate>
		<dc:creator>Jacob</dc:creator>
				<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.pedant.dk/?p=590</guid>
		<description><![CDATA[if you are in a organisation where you store data with geographical information associated with it , then you have the option of sharing your data using the following standards specified by OGC:

WMS (Web map service)
WFS (Web feature service)

One way to leverage these standards is to use the geoserver project for data storage and the [...]]]></description>
			<content:encoded><![CDATA[<p>if you are in a organisation where you store data with geographical information associated with it , then you have the option of sharing your data using the following standards specified by<a href="http://www.opengeospatial.org/"> OGC</a>:</p>
<ul>
<li><a href="http://www.opengeospatial.org/standards/wms">WMS (Web map service)</a></li>
<li><a href="http://www.opengeospatial.org/standards/wfs">WFS (Web feature service)</a></li>
</ul>
<p>One way to leverage these standards is to use the <a title="geoserver" href="http://geoserver.org">geoserver project </a>for data storage and the <a href="http://openlayers.org/">openlayers project</a> web for showing and editing maps.<strong>update 2009-09-03</strong>: When integrating with the extjs framework , then it is worth using  the <a href="http://geoext.org">geoext project</a>. </p>
<p>An example snippet from geoserver shows the use of WFS-T for inserting geometric data with associated metadata for an alley in Tasmania. I&#8217;ll just bring it here:</p>
<p><code lang="xml"><br />
<wfs:Transaction service="WFS" version="1.0.0"<br />
  xmlns:wfs="http://www.opengis.net/wfs"<br />
  xmlns:topp="http://www.openplans.org/topp"<br />
  xmlns:gml="http://www.opengis.net/gml"<br />
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"<br />
  xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd http://www.openplans.org/topp http://localhost:8080/geoserver/wfs/DescribeFeatureType?typename=topp:tasmania_roads"><br />
  <wfs:Insert><br />
    <topp:tasmania_roads><br />
      <topp:the_geom><br />
        <gml:MultiLineString srsName="http://www.opengis.net/gml/srs/epsg.xml#4326"><br />
          <gml:lineStringMember><br />
            <gml:LineString><br />
              <gml:coordinates decimal="." cs="," ts=" "><br />
494475.71056415,5433016.8189323 494982.70115662,5435041.95096618<br />
              </gml:coordinates><br />
            </gml:LineString><br />
          </gml:lineStringMember><br />
        </gml:MultiLineString><br />
      </topp:the_geom><br />
      <topp:TYPE>alley</topp:TYPE><br />
    </topp:tasmania_roads><br />
  </wfs:Insert><br />
</wfs:Transaction><br />
</code></p>
<p>Note that oracle has a well supported ways of extracting GML from spatial datatypes if you need to construct the wfs transactions yourself ( <a href="http://www.oracle.com/technology/sample_code/products/spatial/index.html">oracle locator</a>  )</p>
<p>At the first glance wfs can seem a bit complicated. Luckily openlayers has nice wrappings for it that is easily accessed from code  as shown in one of their examples running <a href="http://openlayers.org/dev/examples/wfs-t.html">here</a> :</p>
<p><code lang="javascript"><br />
 map = new OpenLayers.Map('map');<br />
            var wms = new OpenLayers.Layer.WMS(<br />
                "State",<br />
                "http://sigma.openplans.org/geoserver/wms",<br />
                {layers: 'topp:tasmania_state_boundaries'}<br />
            );<br />
            wfs = new OpenLayers.Layer.WFS(<br />
                "Cities",<br />
                "http://sigma.openplans.org/geoserver/wfs",<br />
                {typename: 'topp:tasmania_cities'},<br />
                {<br />
                    typename: "tasmania_cities",<br />
                    featureNS: "http://www.openplans.org/topp",<br />
                    extractAttributes: false,<br />
                    commitReport: function(str) {<br />
                        OpenLayers.Console.log(str);<br />
                    }<br />
                }<br />
            )<br />
            map.addLayers([wms, wfs]);<br />
            var panel = new OpenLayers.Control.Panel({<br />
                displayClass: "olControlEditingToolbar"<br />
            });</p>
<p>            var draw = new OpenLayers.Control.DrawFeature(<br />
                wfs, OpenLayers.Handler.Point,<br />
                {<br />
                    handlerOptions: {freehand: false, multi: true},<br />
                    displayClass: "olControlDrawFeaturePoint"<br />
                }<br />
            )<br />
            var save = new OpenLayers.Control.Button({<br />
                trigger: OpenLayers.Function.bind(wfs.commit, wfs),<br />
                displayClass: "olControlSaveFeatures"<br />
            });<br />
            panel.addControls([<br />
                new OpenLayers.Control.Navigation(),<br />
                save, draw<br />
            ]);<br />
            map.addControl(panel);<br />
            map.zoomToExtent(new OpenLayers.Bounds(140.64,-44.42,151.89,-38.80));<br />
        }<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pedant.dk/2009/09/02/openlayers-2-8-supports-wfs-t/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>closures -oh yeah?</title>
		<link>http://www.pedant.dk/2009/07/16/closures-oh-yeah/</link>
		<comments>http://www.pedant.dk/2009/07/16/closures-oh-yeah/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 09:09:42 +0000</pubDate>
		<dc:creator>Jacob</dc:creator>
				<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.pedant.dk/?p=514</guid>
		<description><![CDATA[Hvad mon der sker her :

  var a=1;
  function foo() {
    var a;
   function bar() {
     a=2;
     return a;
   }
  return bar;
  }
  a=3;
  var b=foo();
  var c=b();
  alert(c);
  alert(a);

]]></description>
			<content:encoded><![CDATA[<p>Hvad mon der sker her :</p>
<p><code lang="javascript"><br />
  var a=1;<br />
  function foo() {<br />
    var a;<br />
   function bar() {<br />
     a=2;<br />
     return a;<br />
   }<br />
  return bar;<br />
  }</p>
<p>  a=3;<br />
  var b=foo();<br />
  var c=b();<br />
  alert(c);<br />
  alert(a);<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pedant.dk/2009/07/16/closures-oh-yeah/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>ext.data.writer og CRUD</title>
		<link>http://www.pedant.dk/2009/06/17/extdatawriter-og-crud/</link>
		<comments>http://www.pedant.dk/2009/06/17/extdatawriter-og-crud/#comments</comments>
		<pubDate>Wed, 17 Jun 2009 00:41:40 +0000</pubDate>
		<dc:creator>Jacob</dc:creator>
				<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.pedant.dk/?p=437</guid>
		<description><![CDATA[Jeg har kigget lidt nærmere på ext.data.writer og har delt nogle noter her :
 http://pedant.dk/archive/CRUD_in_extjs_3_0.pdf
Basalt set kan man nu på en nem måde foretage sig de fleste operationer man kunne forvente sig i en webapplikation der snakker med en database. Det er der jo sådan set ikke noget banebrydende i &#8211; nu kan man det [...]]]></description>
			<content:encoded><![CDATA[<p>Jeg har kigget lidt nærmere på ext.data.writer og har delt nogle noter her :</p>
<p><a title="CRUD i extjs 3.0" href="http://pedant.dk/archive/CRUD_in_extjs_3_0.pdf"> http://pedant.dk/archive/CRUD_in_extjs_3_0.pdf</a></p>
<p>Basalt set kan man nu på en nem måde foretage sig de fleste operationer man kunne forvente sig i en webapplikation der snakker med en database. Det er der jo sådan set ikke noget banebrydende i &#8211; nu kan man det også fra extjs . Jeg eksperimenterer i øjeblikket med hvordan man bruger denne nye funktionalitet nemmest &#8211; det gør jeg iøjeblikket i :</p>
<p><a title="YASE" href="http://github.com/jacobandresen/yase/tree/master">http://github.com/jacobandresen/yase/tree/master</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pedant.dk/2009/06/17/extdatawriter-og-crud/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
