<?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; javascript</title>
	<atom:link href="http://www.pedant.dk/category/coding/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pedant.dk</link>
	<description>I hack on things that lets you find stuff.</description>
	<lastBuildDate>Sun, 13 Nov 2011 11:22:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Learning some Sencha touch MVC code fu at sourcedevcon 2011</title>
		<link>http://www.pedant.dk/2011/05/08/learning-some-sencha-touch-mvc-code-fu-at-sourcedevcon-2011/</link>
		<comments>http://www.pedant.dk/2011/05/08/learning-some-sencha-touch-mvc-code-fu-at-sourcedevcon-2011/#comments</comments>
		<pubDate>Sun, 08 May 2011 15:28:48 +0000</pubDate>
		<dc:creator>Jacob</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[Sencha Touch]]></category>

		<guid isPermaLink="false">http://www.pedant.dk/?p=861</guid>
		<description><![CDATA[This week I had pleasure to attend sourcedevcon 2011 at the awesome resort  Le meridien Split together with  @virdun ,@jakobkruse and @stureandersen . I have been lurking for a couple of years in the ExtJS community  since attending  the extjs conference in Orlando back in 2009, keeping up to date on things at our local [...]]]></description>
			<content:encoded><![CDATA[<p>This week I had pleasure to attend <a title="sourcedevcon 2011" href="http://www.sourcedevcon.eu/">sourcedevcon 2011</a> at the awesome resort  <a title="Le meridien split" href="http://www.starwoodhotels.com/lemeridien/property/overview/index.html?propertyID=1956">Le meridien Split</a> together with  <a title="Virdun" href="http://twitter.com/#!/Virdun">@virdun </a> ,<a title="JakobKruse" href="http://twitter.com/#!/search/jakobkruse">@jakobkruse </a>and <a title="@StureAndersen" href="http://twitter.com/#!/StureAndersen">@stureandersen</a> . I have been lurking for a couple of years in the ExtJS community  since attending  the extjs conference in Orlando back in 2009, keeping up to date on things at our local <a title="Öresund ExtJS meetup" href="http://www.meetup.com/The-Oresund-ExtJS-Meetup/">Öresund ExtJS meetup</a> , so it was nice to get in touch with some of the regular faces in the ExtJS community.</p>
<h2>Near the <a title="Dicoletian's Palace" href="http://en.wikipedia.org/wiki/Diocletian%27s_Palace">Dicoletian&#8217;s Palace</a></h2>
<p><a href="http://www.pedant.dk/wp-content/uploads/2011/05/IMAG0773.jpg"><img class="aligncenter size-full wp-image-875" title="Dicoletian's palace" src="http://www.pedant.dk/wp-content/uploads/2011/05/IMAG0773.jpg" alt="" width="490" height="368" /></a></p>
<p style="text-align: center;"><em>sourcedevcon 2011 was in the lovely town of Split, near Dicoletian&#8217;s Palace.<br />
</em></p>
<p style="text-align: center;">&nbsp;</p>
<p style="text-align: left;">Flying into Split I had some doubts on how many ExtJS devs would take their time to fly to split, this being the first community-driven sencha conference in Europe. After arriving I quickly put all my doubts aside &#8211; since the venue and conference organization was carefully laid  out.  Split itself is a very charming city, and we had an easy time arriving (leaving was another problem though). I was impressed by the fact that 200+ attendees had chosen to show up (that figure somewhat resembles the first Orlando conference in the US).</p>
<p>At the venue , the first thing we noticed was the outstanding bar with an overview of the local marina and the ExtJS swedes <a title="FredricBerling" href="http://twitter.com/#!/FredricBerling">@FredricBerling</a> , <a title="EmilPennlov" href="http://twitter.com/#!/EmilPennlov">@EmilPenlov</a> (and @<a title="Mats Bryntse" href="http://twitter.com/#!/Bryntum">bryntum</a> when he was not to busy hanging out in some other bars).</p>
<h2>Learning some  Sencha touch MVC  Code fu.</h2>
<p>At some point Johan (@virdun)  decided that he wanted  to get a Sencha Touch application up and running  . So we kind of lost him for a moment there in the bar.  I don&#8217;t remember if it started before <a href="http://twitter.com/#!/jamespearce">@jamespearce</a> introducing sencha touch  &#8211; but Johan started hacking furiously on this app for his site <a title="Citypolarna" href="http://citypolarna.se">http://citypolarna.se </a> somewhat right about  that session.</p>
<p style="text-align: center;"><a href="http://www.pedant.dk/wp-content/uploads/2011/05/IMAG0747.jpg"><img class="aligncenter size-full wp-image-865" title="IMAG0747" src="http://www.pedant.dk/wp-content/uploads/2011/05/IMAG0747.jpg" alt="" width="442" height="334" /></a><em>Johan playing with his mobile phone </em></p>
<p>Being Johan, he just wouldn&#8217;t let go, so I had to answer a lot of questions  about how sencha touch applications worked.</p>
<p>When I discovered that Johan was not being satisfied by the answer &#8220;but hey, I haven&#8217;t coded a line of sencha touch yet&#8221; we walked through the basic shopping list example for sencha touch and Johan modified it a bit, so it could serve as as base for implementing an event viewer for citypolarna. Combining the info found on <a title="sencha" href="http://sencha.com">http://sencha.com</a> and info from the sessions by <a title="_jdg" href="http://twitter.com/#!/_jdg">@_jdg </a>and <a title="@edspencer" href="http://twitter.com/#!/edspencer">@edspencer </a>this was an easy task, so modifying the shopping list example to a working application could be done during the conference. Oh yes, it also helped that we remember  to use extraParams instead of baseParams .</p>
<p><a href="http://www.pedant.dk/wp-content/uploads/2011/05/IMAG0775.jpg"><img class="aligncenter size-full wp-image-869" title="Mobile Hacking at the pool" src="http://www.pedant.dk/wp-content/uploads/2011/05/IMAG0775.jpg" alt="" width="479" height="361" /></a></p>
<p><em>A good thing  about exploring sencha touch and mobile user interfaces is that it can be done in the bar while drinking Mojitos</em></p>
<h2>Learning to migrate to ExtJS 4</h2>
<p>Besides learning more about sencha touch I learned a lot from <a title="@bmoeskau" href="http://twitter.com/#!/bmoeskau">@bmoskeau</a>&#8216;s session on migrating from to ExtJS 4.</p>
<p>Here I especially noted that using the MVC pattern can be postponed to a last optional step and that during migration to ExtJS 4, the old &#8220;new&#8221; constructor syntax should be able to work (but that the new Ext.define and Ext.create constructs is the preferred way to go).  Brian laid out a migration strategy using the   4 R&#8217;s  &#8220;Rendering , Running, Ready, Refactor&#8221; describing the 4 stages the migration should go through.</p>
<p style="text-align: center;"><a href="http://www.pedant.dk/wp-content/uploads/2011/05/IMAG0769.jpg"><img class="aligncenter size-full wp-image-872" title="Migrating to ExtJS4" src="http://www.pedant.dk/wp-content/uploads/2011/05/IMAG0769.jpg" alt="" width="503" height="378" /></a><a title="@bmoeskau" href="http://twitter.com/#!/bmoeskau">@bmoskeau</a> talking about migration</p>
<h2>ExtJS Scheduler and Calendar</h2>
<p>The session by <a title="@bmoeskau" href="http://twitter.com/#!/bmoeskau">@bmoskeau</a> and <a title="Mats Bryntse" href="http://twitter.com/#!/Bryntum">bryntum</a> on Ext Calendar and Ext Scheduler  was supposed to be a showcase of the two products, but to me the main value of the session was seing how easy it was to integrate such complex ExtJS  components. My jaw dropped when I saw Brian demonstrate him using his component updating the data model simultaneously in ExtJS scheduler. This is a testament to two very well designed components .</p>
<h2>Wrapup</h2>
<p>All in all sourcedevcon 2011 left me with the impression of a very vibrant ExtJS community  &#8211; I also got the impression of the strong commercial focus Sencha has. Sencha presented   Sencha.IO as a product &#8211; I look forward to exploring that  more indepth in the future. I chose to focus more on learning about Sencha touch and the MVC parts of ExtJS 4 during the conference..</p>
<p>&#8220;The Irish guys&#8221; has posted some writeups of their experiences at sourcedevcon . Well worth a read:</p>
<p><a title="The lowdown of sourcedevcon" href="http://www.darraghduffy.ie/?p=294">The lowdown of sourcdevcon</a></p>
<p><a title="sourcedevcon day1" href="http://www.joelennon.ie/2011/05/05/source-dev-con-day-1/">http://www.joelennon.ie/2011/05/05/source-dev-con-day-1/</a></p>
<p><img src="file:///home/jacob/Desktop/IMAG0747.jpg" alt="" /></p>
<p><a title="@nilsdehl" href="http://twitter.com/#!/nilsdehl">@nielsdehl</a> has posted pictures from the conference at flickr here :</p>
<p><a title="sourcedevcon day1" href="http://www.flickr.com/photos/nils-dehl/sets/72157626648487744/">http://www.flickr.com/photos/nils-dehl/sets/72157626648487744/</a> (sourcedevcon day1)</p>
<p><a title="sourcedevcon day2" href="http://www.flickr.com/photos/nils-dehl/sets/72157626533490549/">http://www.flickr.com/photos/nils-dehl/sets/72157626533490549/</a> (sourcedevcon day2)</p>
<p><a title="sourcedevcon day3" href="http://www.flickr.com/photos/nils-dehl/sets/72157626544637927/">http://www.flickr.com/photos/nils-dehl/sets/72157626544637927/</a> (sourcedevcon day3)</p>
<p><a title="sourcedevcon day4" href="http://www.flickr.com/photos/nils-dehl/sets/72157626672433598/">http://www.flickr.com/photos/nils-dehl/sets/72157626672433598/</a> (sourcedevcon day4)</p>
<div id="_mcePaste" class="mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 238px; width: 1px; height: 1px;">http://www.joelennon.ie/2011/05/05/source-dev-con-day-1/</div>
]]></content:encoded>
			<wfw:commentRss>http://www.pedant.dk/2011/05/08/learning-some-sencha-touch-mvc-code-fu-at-sourcedevcon-2011/feed/</wfw:commentRss>
		<slash:comments>4</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: using class mimicking from prototype-js it would be : This example should be pretty clear. But when we get into real-life application scenarios we need to interact with users and databases. Let&#8217;s say we had a panel and a button for interacting with lolcats: Note [...]]]></description>
			<content:encoded><![CDATA[<p>In javascript we can express objects using the prototype notation:</p>
<pre class="brush: jscript; title: ; notranslate">
  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; title: ; notranslate">
 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; title: ; notranslate">
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; title: ; notranslate">
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>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[GIS]]></category>
		<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 [...]]]></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"></p>
<p>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"&gt;</p>
<p>494475.71056415,5433016.8189323 494982.70115662,5435041.95096618</p>
<p>alley</p>
<p></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><script src="https://gist.github.com/1046699.js"> </script></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 [...]]]></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>
		<item>
		<title>Lowpro og behaviour</title>
		<link>http://www.pedant.dk/2009/05/08/lowpro-og-behaviour/</link>
		<comments>http://www.pedant.dk/2009/05/08/lowpro-og-behaviour/#comments</comments>
		<pubDate>Fri, 08 May 2009 06:52:13 +0000</pubDate>
		<dc:creator>Jacob</dc:creator>
				<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.pedant.dk/?p=404</guid>
		<description><![CDATA[Det er meget vigtigt at udskille javascript fra HTML når man koder webapplikationer. På den facon bliver koden nemmere at vedligeholde og overskue. Prøv at søge efter &#8220;unobtrusive javascript&#8221;. Morgan Roderick har givet en introduktion til &#8220;Lowpro&#8221; . Morgan har bemærket at selv om Dan Webb kommer fra den rigtige side af bæltet, så staver [...]]]></description>
			<content:encoded><![CDATA[<p>Det er meget vigtigt at udskille javascript fra HTML  når man koder webapplikationer. På den facon bliver koden nemmere at vedligeholde og overskue. Prøv at søge efter &#8220;unobtrusive javascript&#8221;.</p>
<p>Morgan Roderick har givet <a href="http://roderick.dk/blog/2009/05/07/introduction-to-low-pro-for-prototype/">en introduktion til &#8220;Lowpro&#8221;</a> . Morgan har bemærket at selv om <a href="http://www.danwebb.net/">Dan Webb</a> kommer fra den rigtige side af bæltet, så staver han &#8220;Behavior&#8221; forkert . Hvis du har de tilbøjeligheder så kan du hente en ny udgave af Ben Nolans &#8220;Behaviour&#8221; , der er tilrettet af Jakob Kruse her : <a href="http://www.kruse-net.dk/behaviour/">http://www.kruse-net.dk/behaviour/</a>.</p>
<p>Begge biblioteker gør nogenlunde det samme. Det ser dog ud til at man kan pille event callbacks væk fra &#8220;lowpro&#8221; efter at man har puttet dem på. Det kan man vist ikke i &#8220;Behaviour&#8221;.</p>
<p>Bemærk at begge biblioteker er gode at anvende sammen med prototypejs.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pedant.dk/2009/05/08/lowpro-og-behaviour/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introduktion til Ext.Direct</title>
		<link>http://www.pedant.dk/2009/04/22/introduktion-til-extdirect/</link>
		<comments>http://www.pedant.dk/2009/04/22/introduktion-til-extdirect/#comments</comments>
		<pubDate>Wed, 22 Apr 2009 20:17:51 +0000</pubDate>
		<dc:creator>Jacob</dc:creator>
				<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.pedant.dk/?p=396</guid>
		<description><![CDATA[Jeg har lavet en præsentation af hovedtrækkene i Extjs 3.0 :  Extjs 3.0  The good stuff Der er mange flotte farver og kode i !]]></description>
			<content:encoded><![CDATA[<p>Jeg har lavet en præsentation af hovedtrækkene i Extjs 3.0 :  <a title="Extjs 3.0 The good stuff" href="http://pedant.dk/archive/Extjs_3_0_The_good_stuff.pdf">Extjs 3.0  The good stuff</a></p>
<p>Der er mange flotte farver og kode i ! <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/04/22/introduktion-til-extdirect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ext 2009 konference</title>
		<link>http://www.pedant.dk/2009/04/15/ext-30-launch/</link>
		<comments>http://www.pedant.dk/2009/04/15/ext-30-launch/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 13:09:39 +0000</pubDate>
		<dc:creator>Jacob</dc:creator>
				<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.pedant.dk/?p=383</guid>
		<description><![CDATA[Jeg er iøjeblikket i Orlando til den første extjs brugerkonference. extjs blev startet af Jack Slocum mens han var hos Yahoo   &#8211; biblioteket er nu kommet i 3. version . Hele vejen igennem har det været Jacks vision at skabe et sammenhængende rammeværktøj  til at lave komplekse webapplikationer. extjs 3.0 RC1 er tilgængelig  fra http://extjs.com/products/extjs/download.php [...]]]></description>
			<content:encoded><![CDATA[<p>Jeg er iøjeblikket i Orlando til den første extjs brugerkonference. extjs blev startet af Jack Slocum mens han var hos Yahoo   &#8211; biblioteket er nu kommet i 3. version . Hele vejen igennem har det været Jacks vision at skabe et sammenhængende rammeværktøj  til at lave komplekse webapplikationer.</p>
<p>extjs 3.0 RC1 er tilgængelig  fra <a href="http://extjs.com/products/extjs/download.php">http://extjs.com/products/extjs/download.php</a></p>
<p>Den største nyhed for extjs 3.0 er introduktionen af Ext.direct , der introducerer en sammenhængende model for at opdatere data vha forskellige serverside teknologier . Ifbm launch af 3.0 vil der blive præsenteret Routers for Ruby/merb , java, C# og php.  Jeg snakker iøjeblikket med Data access om at de bør introducere en ext 3.0 router  for visual dataflex..</p>
<p>En af de mere visuelt imponerende ting er introduktionen af en RowEditor , der introducerer inplace redigering i et extjs grid vha extjs DataStore arkitektur .</p>
<p>Mit indtryk herfra er at extjs firmaet har gode forbindelser til Adobe , Sun  og Dell samt en større liste af amerikanske virksomheder (bestbuy som et eksempel) . Det virker som at  folk begyndte at bruge extjs for omkring et år siden ifbm extjs 2.0..</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pedant.dk/2009/04/15/ext-30-launch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Brug af java reflection til at generere JSON data</title>
		<link>http://www.pedant.dk/2009/02/08/brug-af-java-reflection-til-at-generere-json-data/</link>
		<comments>http://www.pedant.dk/2009/02/08/brug-af-java-reflection-til-at-generere-json-data/#comments</comments>
		<pubDate>Sun, 08 Feb 2009 10:02:11 +0000</pubDate>
		<dc:creator>Jacob</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.pedant.dk/?p=169</guid>
		<description><![CDATA[Jeg arbejder iøjeblikket på en opgave , hvor jeg har behov for at bringe datamodellen ud til behandling i javascript på en nem facon . Ifbm med denne opgave har jeg tænkt på hvordan man kunne gøre det vha reflection. Hvis vi antager flg klasser : class A{ public int B; public int C; public [...]]]></description>
			<content:encoded><![CDATA[<p>Jeg arbejder iøjeblikket på en opgave , hvor jeg har behov for at bringe datamodellen ud til behandling i javascript på en nem facon . Ifbm med denne opgave har jeg tænkt på hvordan man kunne gøre det vha reflection.</p>
<p>Hvis vi antager flg klasser :</p>
<p><code lang="java"><br />
class A{<br />
  public int B;<br />
  public int C;<br />
  public D F;<br />
  public D G;<br />
};</p>
<p>class D {<br />
  public String E;<br />
}<br />
</code></p>
<p>og at de var initialiseret således:<br />
<code lang="java"><br />
A a=new A();<br />
a.B=1;<br />
a.C=2;<br />
a.F=new D();<br />
a.F.E="test";<br />
a.G=new D();<br />
a.G.E="test2";<br />
</code></p>
<p>Så kunne man kigge på selve java objekterne vha reflection for at generere JSON output til bruge i javascript således:</p>
<p><code lang="java"><br />
public class JsonEmit{<br />
  public static String emit(Object target) throws Exception{<br />
     StringBuilder sb=new StringBuilder();<br />
     sb.append("{");<br />
     Class targetClass=target.getClass();<br />
     Field[] publicFields = targetClass.getFields();<br />
     for (int i=0;i
<publicFields.length;i++){<br />
       String sFieldName = publicFields[i].getName();<br />
       Class typeClass = publicFields[i].getType();<br />
       String sFieldType = typeClass.getName();<br />
       Object value = publicFields[i].get(target);<br />
       if(value!=null){<br />
         sb.append(sFieldName+":");<br />
         if(typeClass.isPrimitive()<br />
         ||sFieldType=="java.lang.String"){<br />
         sb.append("""+value.toString()+""");<br />
      }else{<br />
        sb.append(JsonEmit.emit(value));<br />
      }<br />
    }<br />
    if(i!=(publicFields.length-1))<br />
      sb.append(",");<br />
  }<br />
 sb.append("}");<br />
 return(sb.toString());<br />
}<br />
</code>
<p>På den facon vil man kunne genere JSON ved et simpelt kald til<br />
<code lang="java"><br />
JsonEmit.emit(a)<br />
</code></p>
<p>hvorefter man vil se<br />
<code lang="javascript"><br />
{B:"1",C:"2",F:{E:"test"},G:{E:"test2"}}<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pedant.dk/2009/02/08/brug-af-java-reflection-til-at-generere-json-data/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>hvordan man omgår &#039;this&#039; scope problemer for closures</title>
		<link>http://www.pedant.dk/2008/08/07/hvordan-man-omgar-scope-problemer-for-closures-med-this/</link>
		<comments>http://www.pedant.dk/2008/08/07/hvordan-man-omgar-scope-problemer-for-closures-med-this/#comments</comments>
		<pubDate>Thu, 07 Aug 2008 14:19:33 +0000</pubDate>
		<dc:creator>Jacob</dc:creator>
				<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.pedant.dk/2008/08/07/hvordan-man-omgar-scope-problemer-for-closures-med-this/</guid>
		<description><![CDATA[Man kan ikke uden videre bruge &#8216;this&#8217; i en indre anonym funktion der bruger information fra en ydre. (se en god beskrivelse ifbm closures i  kapitel 4 i &#8220;Javascript: the good parts&#8221; ). Problemet kan omgåes ved at benytte &#8220;bind&#8221; fra prototypejs på flg. facon: ComboBox.prototype.loader= function (){ if(this.dataStore[this.paramName]===undefined){ new Ajax.Request ( this.url,{ method: 'post', [...]]]></description>
			<content:encoded><![CDATA[<p>Man kan ikke uden videre bruge &#8216;this&#8217;  i en indre anonym funktion der bruger information fra en ydre. (se en god beskrivelse ifbm closures i  kapitel 4 i <a href="http://www.amazon.com/JavaScript-Good-Parts-Douglas-Crockford/dp/0596517742">&#8220;Javascript: the good parts&#8221;</a> ).</p>
<p>Problemet kan omgåes ved at benytte <a href="http://prototypejs.org/api/function/bind">&#8220;bind&#8221; fra prototypejs</a> på flg. facon:</p>
<p><code lang="javascript"><br />
ComboBox.prototype.loader= function (){<br />
  if(this.dataStore[this.paramName]===undefined){<br />
    new Ajax.Request (<br />
    this.url,{<br />
      method: 'post',<br />
      asynchronous: true,<br />
      parameters: this.parameters,<br />
      onSuccess: function (transport){<br />
                                  var response=transport.responseText;<br />
                                  this.dataStore.data[this.paramName]=response.evalJSON();<br />
                                  this.render();<br />
                                  }.bind(this),<br />
      onFailure: function (transport){<br />
                                  alert('failed to retrieve '+this.paramName+' data');<br />
                                  }.bind(this)<br />
     }<br />
}<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pedant.dk/2008/08/07/hvordan-man-omgar-scope-problemer-for-closures-med-this/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

