<?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>Platformability &#187; Phil Leggetter</title>
	<atom:link href="http://blog.caplin.com/author/phillcaplincom/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.caplin.com</link>
	<description>Single Dealer Platforms, Industry Expertise</description>
	<lastBuildDate>Fri, 03 Feb 2012 15:38:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Using Fiddler to help develop cross domain capable JavaScript web applications</title>
		<link>http://blog.caplin.com/2010/03/19/using-fiddler-to-help-develop-cross-domain-capable-javascript-web-applications/</link>
		<comments>http://blog.caplin.com/2010/03/19/using-fiddler-to-help-develop-cross-domain-capable-javascript-web-applications/#comments</comments>
		<pubDate>Fri, 19 Mar 2010 10:50:01 +0000</pubDate>
		<dc:creator>Phil Leggetter</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[fiddler]]></category>

		<guid isPermaLink="false">http://www.leggetter.co.uk/?p=758</guid>
		<description><![CDATA[This post is going to be short and sweet. “Short” because Fiddler makes working around this problem so simple. And “Sweet” because I think this is really powerful and will allow you to develop applications that show why cross domain access, in some situations, should be allowed. In my last...]]></description>
			<content:encoded><![CDATA[This post is going to be short and sweet. “Short” because <a href="http://www.fiddler2.com/fiddler2/">Fiddler</a> makes working around this problem so simple. And “Sweet” because I think this is really powerful and will allow you to develop applications that show why cross domain access, in some situations, should be allowed.

In my last post on <a href="http://www.leggetter.co.uk/2010/03/12/making-cross-domain-javascript-requests-using-xmlhttprequest-or-xdomainrequest.html">Making cross domain JavaScript requests using XMLHttpRequest or XDomainRequest</a> I demonstrated that in order to access a resource (web page/web service) the server needs to respond to your application/JavaScript HTTP requests with an HTTP header of <a href="http://www.w3.org/TR/2008/WD-access-control-20080912/#access-control-allow-origin">“Access-Control-Allow-Origin”</a>. The problem arises when you are trying to access a resource that doesn’t presently send the required HTTP header, but you really need it to (I’ve addressed a similar problem to this when developing Silverlight applications and the solution, again, was to use <a href="http://www.leggetter.co.uk/2009/10/30/using-fiddler-to-trick-silverlight-into-allowing-a-crossdomain-web-request.html">Fiddler to trick Silverlight into allowing a crossdomain Web Request</a>). For development purposes you’ll need to add the required header to the server HTTP response in your development environment. This is really simple using Fiddler.
<span id="more-758"> </span>
All you need to do is add a new custom rule. You can do this via the menu option: <strong>Rules -&gt; Customize Rules…</strong>
<div id="attachment_759" class="wp-caption alignnone" style="width: 409px;">

<a class="thickbox no_icon" title="Customize Rules" rel="gallery-758" href="http://www.leggetter.co.uk/wp-content/uploads/2010/03/CustomizeRules.png"><img class="size-full wp-image-759" title="Customize Rules" src="http://www.leggetter.co.uk/wp-content/uploads/2010/03/CustomizeRules.png" alt="" width="399" height="289" /></a>
<p class="wp-caption-text">Fiddler Customize Rules option</p>

</div>
This will bring up a JScript.NET file (if you don’t like the thought of JScript you can just pretend it’s JavaScript) called <em>CustomRules.js</em>. In that file you will see a number of functions/methods that are called at certain points during an HTTP request or response. The method we are interested in is called <code>OnBeforeResponse</code> and what we want to do is to add the <em>Access-Control-Allow-Origin</em> header to trick the browser/scripting engine into thinking that the resource we are requesting allows the cross domain request.
<pre class="brush: jscript;">static function OnBeforeResponse(oSession: Session)
{
	oSession.oResponse.headers.Add("Access-Control-Allow-Origin", "*");
}</pre>
The code above will add this header to all HTTP responses. You can of course add an <code>if</code> statement so that the header is only added when a particular condition is matched, such as a responses from <a href="http://www.leggetter.co.uk">http://www.leggetter.co.uk</a>.
<pre class="brush: jscript;">static function OnBeforeResponse(oSession: Session)
{
	if (oSession.HostNameIs("www.leggetter.co.uk"))
	{
		oSession.oResponse.headers.Add("Access-Control-Allow-Origin", "*");
	}
}</pre>
<small>The code snippet above has not been tested</small>

Once you have added your code to the <code>OnBeforeResponse</code> method you can save and close the CustomRules.js file. Fiddler will detect that this file has been modified and compile it in the background so that it can use the new code with each request and response that it processes.

The next time that Fiddler is processing an HTTP response it will call this method, your code will run, and the <em>Access-Control-Allow-Origin</em> HTTP header added to the response.
<pre class="brush: plain;">HTTP/1.1 200 OK
Connection: close
Date: Fri, 19 Mar 2010 11:04:51 GMT
Server: Microsoft-IIS/6.0
Content-Type: text/html; charset=utf-8
Expires: Fri, 19 Mar 2010 11:03:51 GMT
Cache-Control: no-cache
Pragma: no-cache
Access-Control-Allow-Origin: *</pre>
For more information on custom rules and generally developing using Fidder see their <a href="http://www.fiddler2.com/Fiddler/dev/">Developer Info section</a>.]]></content:encoded>
			<wfw:commentRss>http://blog.caplin.com/2010/03/19/using-fiddler-to-help-develop-cross-domain-capable-javascript-web-applications/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Would anybody want StreamLink for Windows Mobile?</title>
		<link>http://blog.caplin.com/2009/12/30/would-anybody-want-streamlink-for-windows-mobile/</link>
		<comments>http://blog.caplin.com/2009/12/30/would-anybody-want-streamlink-for-windows-mobile/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 12:04:07 +0000</pubDate>
		<dc:creator>Phil Leggetter</dc:creator>
				<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[StreamLink]]></category>
		<category><![CDATA[StreamLink.NET]]></category>
		<category><![CDATA[Windows Mobile]]></category>

		<guid isPermaLink="false">http://blog.caplin.com/?p=929</guid>
		<description><![CDATA[After years of promise it really does look like mobile is the next big thing? But what mobile platform will prove to be the most popular? It seems to be a two horse race between iPhone and Android, with Windows Mobile lagging somewhere in the distance &#8211; or is it...]]></description>
			<content:encoded><![CDATA[<p>After years of promise it really does look like mobile is the next big thing? But what mobile platform will prove to be the most popular? It seems to be a two horse race between iPhone and Android, with Windows Mobile lagging somewhere in the distance &#8211; or is it already a non-runner? In any case it&#8217;s been <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy53aXJlZC5jb20vZ2FkZ2V0bGFiLzIwMDkvMTIvd2luZG93cy1tb2JpbGUtNy1kZWxheWVkLXVudGlsLWxhdGUtMjAxMC8=">delayed until late 2010</a>.</p>
<p><span id="more-929"></span></p>
<div id="attachment_931" class="wp-caption alignnone" style="width: 330px"><a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2Jsb2cuY2FwbGluLmNvbS93cC1jb250ZW50L3VwbG9hZHMvd2luZG93cy1tb2JpbGUtNy10aGVtZS1zbWFydHBob25lLmpwZw=="><img class="size-full wp-image-931" title="Windows Mobile 7" src="http://blog.caplin.com/wp-content/uploads/windows-mobile-7-theme-smartphone.jpg" alt="" width="320" height="240" /></a><p class="wp-caption-text">Windows Mobile 7</p></div>
<p>At work the concensus amongst the developers at Caplin seems to be that they like Android as a platform and there&#8217;s quite a bit of excitement about the <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy53aXJlZC5jb20vZ2FkZ2V0bGFiLzIwMDkvMTIvbmV3LWdvb2dsZS1uZXh1cy1vbmUtcGhvbmUtbGlrZWx5LXRvLWxhdW5jaC1qYW4tNS8=">Google Nexus One which will contain the Android 2.1 operating system</a>.</p>
<div class="wp-caption alignnone" style="width: 324px"><img class=" " title="Nexus Google One Phone" src="http://images.trustedreviews.com/images/article/inline/12461-12399image.jpg" alt="" width="314" height="263" /><p class="wp-caption-text">Nexus Google One Phone</p></div>
<p>Since I&#8217;ve been involved in most of the Microsoft product development here I&#8217;m interested to see if there is any chance of Windows Mobile doing anything. I&#8217;m excited about the inclusion of <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy53bWV4cGVydHMuY29tL3NpbHZlcmxpZ2h0LW1vYmlsZS1ydW1vcmVkLXdpbmRvd3MtbW9iaWxlLTY1">Silverlight in Windows Mobile 7</a>, as I <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2Jsb2cuY2FwbGluLmNvbS8yMDA5LzA4LzA0L3N0cmVhbWxpbmstZm9yLXNpbHZlcmxpZ2h0LWZvci1tb2JpbGUv">blogged about</a> some time back, and have just read a small piece that indicates Microsoft are keen to take gaming mobile with <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5ldGlvbGUuY29tLzIwMDkvMTIvd2luZG93cy1tb2JpbGUteGJveC1saXZlLWdhbWluZy1wbGF0Zm9ybS1mb3Itd2luZG93cy1tb2JpbGUv">XBox 360 integration</a>.</p>
<p><!--more--></p>
<p>A while back, just after we&#8217;d ported StreamLink.NET to the Silverlight runtime, I took an R&amp;D day to try to port StreamLink.NET to Windows Mobile. I made good progress but left things in a non-compiling state. More recently I had another opportunity to take a day to try and finish the work off. The codebase had moved slightly so I had to do a little more work that I&#8217;d planned and now I&#8217;m left with a single compilation error based around the .NET Compact Framework not having the <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL21zZG4ubWljcm9zb2Z0LmNvbS9lbi11cy9saWJyYXJ5L3N5c3RlbS50aHJlYWRpbmcud2FpdGhhbmRsZS53YWl0YW55LmFzcHg=">WaitHandle.WaitAny</a> method. To resolve this I&#8217;m going to have to <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2N1cmlvdXNtaW5kcy53b3JkcHJlc3MuY29tLzIwMDYvMTEvMjAvd2FpdGluZy1mb3Itd2FpdGFueS8=">go native</a> or we may have to consider purchasing the fantastic <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5vcGVubmV0Y2YuY29tL1Byb2R1Y3RzL1NtYXJ0RGV2aWNlRnJhbWV3b3JrL3RhYmlkLzY1L0RlZmF1bHQuYXNweA==">Smart Device Framework</a>.</p>
<p>If Windows Mobile 7 supports Silverlight then maybe you could argue that my time spent porting StreamLink.NET to Windows Mobile has been wasted? Or, maybe you would argue that any time spent developing for the Windows Mobile platform is a waste of time? Personally, I like Windows Mobile as a platform, I have a Windows Mobile phone and I think the Windows Mobile development experience in Visual Studio is second to none. For these reasons, and because competition can lead to improved products, I hope Windows Mobile 7 makes a challenge in the final furlongs of the mobile platform race.</p>
 <img src="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=929" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.caplin.com/2009/12/30/would-anybody-want-streamlink-for-windows-mobile/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight and Flex versus Ajax</title>
		<link>http://blog.caplin.com/2009/12/21/silverlight-and-flex-versus-ajax/</link>
		<comments>http://blog.caplin.com/2009/12/21/silverlight-and-flex-versus-ajax/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 12:32:13 +0000</pubDate>
		<dc:creator>Phil Leggetter</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Trading Technology]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://blog.caplin.com/?p=921</guid>
		<description><![CDATA[On November 10th Caplin and Finextra sponsored a webcast discussing issues surrounding single-dealer portals in capital markets. We have the highlights and while much of the discussion was purely business focused, part III discusses the emergence of Ajax versus Flex and Silverlight. It&#8217;s a very interesting topic and there&#8217;s been...]]></description>
			<content:encoded><![CDATA[<p>On November 10th Caplin and Finextra sponsored a webcast discussing issues surrounding single-dealer portals in capital markets. We have the highlights and while much of the discussion was purely business focused, part III discusses the emergence of <em>Ajax versus Flex and Silverlight</em>. It&#8217;s a very interesting topic and there&#8217;s been much debate over <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5sZWdnZXR0ZXIuY28udWsvMjAwOS8xMS8wNy93aGljaC1yaWNoLWludGVybmV0LWFwcGxpY2F0aW9uLXRlY2hub2xvZ3ktd2lsbC1kb21pbmF0ZS5odG1s">which RIA technology will dominate</a> with various ways of looking at what determines technology choice.</p>
<p>From a business point of view the conversation gets interesting when Kevin Bourne asks &#8220;do you not want to see a point where people want 100% of the choice but all out of the can with a library of applications that they can then tailor much more specifically to what they want to deliver to their clients?&#8221;</p>
<p><object width="425" height="344" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/KEzbQJfKA6Y&amp;hl=en_GB&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /><embed width="425" height="344" type="application/x-shockwave-flash" src="http://www.youtube.com/v/KEzbQJfKA6Y&amp;hl=en_GB&amp;fs=1&amp;" allowFullScreen="true" allowscriptaccess="always" allowfullscreen="true" /></object></p>
<p>You can see the other highlight videos on the <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy55b3V0dWJlLmNvbS91c2VyL0NhcGxpblN5c3RlbXNMb25kb24=">Caplin Systems You Tube Channel</a>.</p>
<p>You can also download a full transcript of the event:<br />
<a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2Jsb2cuY2FwbGluLmNvbS9kb3dubG9hZHMvQlVZRVJTJTIwTUFSS0VUJTIwJUUyJTgwJTkzJTIwU0lOR0xFJTIwREVBTEVSJTIwUE9SVEFMUyUyMEFORCUyMENPVVJUSU5HJTIwVEhFJTIwT05MSU5FJTIwQ0w=">Buyers Market – Single Dealer Portals and Courting the Online Client</a></p>
 <img src="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=921" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.caplin.com/2009/12/21/silverlight-and-flex-versus-ajax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How real-time does real-time have to be?</title>
		<link>http://blog.caplin.com/2009/12/09/how-real-time-does-real-time-have-to-be/</link>
		<comments>http://blog.caplin.com/2009/12/09/how-real-time-does-real-time-have-to-be/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 14:32:04 +0000</pubDate>
		<dc:creator>Phil Leggetter</dc:creator>
				<category><![CDATA[Real-time web]]></category>

		<guid isPermaLink="false">http://blog.caplin.com/?p=737</guid>
		<description><![CDATA[This post was]]></description>
			<content:encoded><![CDATA[<div style="background-color: #f1f1f1; padding: 2px 12px; border: 1px solid dashed;">This post was <a  0="title="Phil" 1="Leggetter's" 2="Blog"" href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5sZWdnZXR0ZXIuY28udWsvMjAwOS8xMi8wOS9ob3ctcmVhbC10aW1lLWRvZXMtcmVhbC10aW1lLWhhdmUtdG8tYmUuaHRtbA==">originally posted on my personal blog on 09/12/2009</a>.</div>
<p>Last night, just over 12 hours ago, I attended the <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3Nwcm91dHVwbG9uZG9uLmV2ZW50YnJpdGUuY29tLw==">Gary Vaynerchuk Crush It event</a> organised by <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3Nwcm91dGVyLmNvbS8=">Sprouter</a> in London. I’ve already read <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5hbWF6b24uY28udWsvZ3AvcHJvZHVjdC8wMDYxOTE0MTc3P2llPVVURjgmYW1wO3RhZz1waGlsbGVnZ3NvZnRjLTIxJmFtcDtsaW5rQ29kZT1hczImYW1wO2NhbXA9MTYzNCZhbXA7Y3JlYXRpdmU9MTk0NTAmYW1wO2NyZWF0aXZlQVNJTj0wMDYxOTE0MTc3">Crush It</a> and seen a lot of <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2dhcnl2YXluZXJjaHVrLmNvbS8=">Gary online</a> so I wondered if he would give out any information that I hadn’t already heard. On the way in I mentioned this to <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2lhbnNhbmRlcnMuY29tLw==">Ian Sanders</a> who said:</p>
<p><span id="more-737"></span></p>
<blockquote><p>It’s always different live. It’s like a gig.</p></blockquote>
<p>This is a big statement considering the event is just a guy standing and speaking and taking some Q&amp;A. However, Ian’s statement was spot-on. Gary oozes charisma and when he speaks it feels like he’s addressing you directly. This is clearly one of the reasons why he’s so popular and doing so well.</p>
<div id="attachment_592" class="wp-caption alignnone" style="width: 490px"><a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5sZWdnZXR0ZXIuY28udWsvd3AtY29udGVudC91cGxvYWRzLzIwMDkvMTIvSU1BR0VfMjA1LmpwZw=="><img class="size-full wp-image-592" title="Gary Vaynerchuk" src="http://www.leggetter.co.uk/wp-content/uploads/2009/12/IMAGE_205.jpg" alt="Gary Vaynerchuk at the Sprouter Crush It event" width="480" height="640" /></a><p class="wp-caption-text">Gary Vaynerchuk at the Sprouter Crush It event</p></div>
<p>One of the things that Gary covered, and I’ve heard him mention a few times now, was <strong>small town rules</strong>. My take on what Gary means that social media has made a global community possible. He provided a couple of examples.</p>
<h3>Example 1: Small Town</h3>
<p>You can go out in New York, get drunk and get naked every night of the week and it most probably won’t impact your reputation. However, in a small town if you do this just once it will.</p>
<h3>Example 2: Small Town effect through Social Media</h3>
<p>The movie Bruno (I&#8217;m not giving it a link, I&#8217;ve heard it&#8217;s <em>that</em> bad) had one of the biggest attendances for an opening night in the states. However, the second night had the biggest drop off in attendances ever. This is because on the first night people left half way through and wrote on Twitter and Facebook how terrible the movie was. In 24 hours word had got out to avoid this movie at all costs.</p>
<p>What has this got to do with the Real-Time web I hear you ask? Well, in the first small town example it’s easy to see why and how news spreads so quickly. In a small town it doesn’t take long for news like this to spread. But in the second example the news spreads to a massive number of people because of the real-time web effect introduced by the immediate availability of information from networks such as Twitter and Facebook.</p>
<p>I managed to get a question in and asked Gary:</p>
<blockquote><p>How real-time does real-time have to be? For example, the newly introduced Google real-time search checks every 20 seconds to see if any more relevant search results are available.</p></blockquote>
<p>Whilst Gary said that 20 seconds was probably alright he did suggest that this would be fine until another site provided the results in 19 seconds, and ultimately 0 seconds. At which point expectation would be changed.</p>
<p>This has encouraged me to continue my <strong>push</strong> to encourage the uptake of technology to provide a truly real-time web experience. Data is available instantly so why not push it to users instantly. Is 20 seconds really good enough when technology is out there to allow that information to be pushed to us in closer to 0 seconds? My opinion is: <strong>C&#8217;mon Google, you can do better!</strong></p>
 <img src="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=737" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.caplin.com/2009/12/09/how-real-time-does-real-time-have-to-be/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>What does Platformability mean to you?</title>
		<link>http://blog.caplin.com/2009/10/28/what-does-platformability-mean-to-you/</link>
		<comments>http://blog.caplin.com/2009/10/28/what-does-platformability-mean-to-you/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 15:05:44 +0000</pubDate>
		<dc:creator>Phil Leggetter</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Trading Technology]]></category>
		<category><![CDATA[UX]]></category>

		<guid isPermaLink="false">http://blog.caplin.com/?p=492</guid>
		<description><![CDATA[We’ve purposefully not defined exactly what Platformability means. It was conjured up by Duncan based on a number of ideas. To help you decide what Platformability means to you, here are a few things to consider and some of my thoughts about the word. Let&#8217;s start by breaking the word Platformability into it&#8217;s constituent parts....]]></description>
			<content:encoded><![CDATA[<p>We’ve purposefully not defined exactly what <em>Platformability</em> means. It was conjured up by <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2Jsb2cuY2FwbGluLmNvbS9hdXRob3IvZHVuY2FuYmNhcGxpbmNvbS8=">Duncan</a> based on a number of ideas. To help you decide what <em>Platformability</em> means to you, here are a few things to consider and some of my thoughts about the word. Let&#8217;s start by breaking the word <em>Platformability</em> into it&#8217;s constituent parts.<br />
<span id="more-492"></span></p>
<h2>Platform (computing)</h2>
<blockquote cite="http://en.wikipedia.org/wiki/Platform_(computing)"><p>In computing, a platform describes some sort of hardware architecture or software framework (including application frameworks), that allows software to run. Typical platforms include a computer&#8217;s architecture,operating system, programming languages and related runtime libraries or graphical user interface.</p></blockquote>
<p>This blog contains information on a variety of different topics, from <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2Jsb2cuY2FwbGluLmNvbS8yMDA5LzEwLzIwL2FwcHJvYWNoZXMtdG8tc3RyZWFtaW5nLw==">approaches to technology solutions</a> to <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2Jsb2cuY2FwbGluLmNvbS8yMDA5LzEwLzE1L3V4LWFuZC1yb2kv">UX considerations</a>, and all these things come together to provide a solid base for development. To me, the word &#8220;platform&#8221; conveys an architecture and infrastructure of stability, on which you can integration your systems and build your applications.</p>
<h2>Ability</h2>
<blockquote cite="http://en.wiktionary.org/wiki/ability"><p>The quality or state of being able; power to perform, whether physical, moral, intellectual, conventional, or legal; capacity; skill or competence in doing; sufficiency of strength, skill, resources, etc.; &#8212; in theplural, faculty, talent.</p></blockquote>
<p>&#8220;Ability&#8221; straight away says to me that the Platform is an enabler, is of great quality, and can be relied upon. It enables users to integrate systems and build applications with ease. As this blog grows I hope we can share how we have developed, and will continue to develop, the components that come together to form such a platform.</p>
<h2>Swimming in Technology</h2>
<p>I love this tagline! For me, it says a lot about the people here at Caplin. We love technology. We don&#8217;t simply want to stand by and watch technology advance. We want to dive in and get involved, be innovative and contribute. We want to be the thought leaders and come up with new ways of solving problems and inventing new technologies.</p>
<p>And if that&#8217;s not got your creative juices flowing, how about a song to get you thinking (please remember I&#8217;m a Software Engineer)</p>
<blockquote><p>Look for Platformability<br />
The simple Platformability<br />
Forget about your worries and your strife<br />
I mean Platformability<br />
A set of great technologies<br />
That brings Platformability to life</p></blockquote>
 <img src="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=492" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.caplin.com/2009/10/28/what-does-platformability-mean-to-you/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Streamlink for Silverlight for Mobile</title>
		<link>http://blog.caplin.com/2009/08/04/streamlink-for-silverlight-for-mobile/</link>
		<comments>http://blog.caplin.com/2009/08/04/streamlink-for-silverlight-for-mobile/#comments</comments>
		<pubDate>Tue, 04 Aug 2009 16:10:16 +0000</pubDate>
		<dc:creator>Phil Leggetter</dc:creator>
				<category><![CDATA[Mobile]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[Comet]]></category>
		<category><![CDATA[Financial Ajax]]></category>
		<category><![CDATA[Real-time web]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[StreamLink]]></category>
		<category><![CDATA[UX]]></category>
		<category><![CDATA[Windows Mobile]]></category>

		<guid isPermaLink="false">http://blog.caplin.com/?p=331</guid>
		<description><![CDATA[With the recent release of Caplin&#8217;s Streamlink for Silverlight it&#8217;s exciting to find out that Microsoft plan to release a Silverlight for Mobile devices. The goal of Silverlight is to provide a consistent experience across desktop and mobile phones. Developers will be able to easily optimize Silverlight applications for mobile...]]></description>
			<content:encoded><![CDATA[<p>With the recent release of Caplin&#8217;s Streamlink for Silverlight it&#8217;s exciting to find out that Microsoft plan to release a <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3NpbHZlcmxpZ2h0Lm5ldC9sZWFybi9tb2JpbGUuYXNweA==">Silverlight for Mobile devices</a>.</p>
<blockquote cite="http://silverlight.net/learn/mobile.aspx"><p>The goal of Silverlight is to provide a consistent experience across desktop and mobile phones. Developers will be able to easily optimize Silverlight applications for mobile form factors or run existing Silverlight applications on mobile phones.</p></blockquote>
<p>The great thing about this release is that any existing Silverlight applications should work on any mobile device with Silverlight installed. The question about this is that if you design a user interface for a desktop browser how will it fit on a windows mobile browser? Well, Microsoft plan to give developers the ability to &#8220;optimize Silverlight applications for mobile form factors&#8221; which sounds like they will give us a way of dealing with the obvious UI differences between desktop and mobile platforms, as well as the underlying runtime issues.</p>
<p>We&#8217;ve already blogged about what impact <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2Jsb2cuY2FwbGluLmNvbS8yMDA5LzA2LzA5L3NpbHZlcmxpZ2h0LWZvci1zaW5nbGUtZGVhbGVyLXBvcnRhbHMv">Silverlight may have on single dealer portals</a>. I&#8217;m really excited to see what developers can do using StreamLink for Silverlight to enable the <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2Jsb2cuY2FwbGluLmNvbS8yMDA5LzA0LzIwL3doYXQtaXMtdGhlLXJlYWwtdGltZS13ZWIv">real-time web</a> on a windows mobile device. What opportunities might Streamlink for Silverlight Mobile enable?</p>
<div class="wp-caption alignnone" style="width: 290px"><img title="Microsoft Silverlight" src="http://i16.photobucket.com/albums/b12/al_oasis1/microsoft_silverlight.jpg" alt="Silverlight for Mobile" width="280" height="312" /><p class="wp-caption-text">Silverlight for Mobile</p></div>
<p>Read the <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3NpbHZlcmxpZ2h0Lm5ldC9sZWFybi9tb2JpbGUuYXNweA==">Silverlight for Mobile FAQ</a> for more information.</p>
 <img src="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=331" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.caplin.com/2009/08/04/streamlink-for-silverlight-for-mobile/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What is the &#8220;real-time web&#8221;?</title>
		<link>http://blog.caplin.com/2009/04/20/what-is-the-real-time-web/</link>
		<comments>http://blog.caplin.com/2009/04/20/what-is-the-real-time-web/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 11:00:54 +0000</pubDate>
		<dc:creator>Phil Leggetter</dc:creator>
				<category><![CDATA[Real-time web]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[Comet]]></category>
		<category><![CDATA[web 2.0]]></category>

		<guid isPermaLink="false">http://blog.caplin.com/?p=89</guid>
		<description><![CDATA[Are we really seeing the real-time web? The phrase &#8220;real-time web&#8221; has been streaming its way around the Internet for a while now. It&#8217;s presently being used to describe information being available in search results as soon as it has been published by its author. Examples of this are Twitter...]]></description>
			<content:encoded><![CDATA[<h2><strong>Are we really seeing the real-time web?</strong></h2>
<p>The phrase &#8220;<em>real-time web</em>&#8221; has been streaming its way around the Internet for a while now. It&#8217;s presently being used to describe information being available in search results as soon as it has been published by its author. Examples of this are Twitter or FriendFeed search.</p>
<p>As far as I&#8217;m aware it was Robert Scoble who made this phrase mainstream. Here&#8217;s an example from the start of February, but by this time Robert had been using the term for a while and a quick Google finds the <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5yZWFkd3JpdGV3ZWIuY29tL2FyY2hpdmVzL2dvb2dsZV9maW5hbmNlX2FuZF90aGVfcmVhbF90aW1lX3dlYi5waHA=">term used</a> as early as June 2008:</p>
<blockquote><p>Let&#8217;s do a search for anyone who has written about the Canon 5D MK II but lets constrain that to posts that have at least one like and at least four comments. <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2ZyaWVuZGZlZWQuY29tL3NlYXJjaD9xPUNhbm9uKzVEK01LK0lJJmFtcDtpbnRpdGxlPSZhbXA7aW5jb21tZW50PSZhbXA7c2VydmljZT0mYW1wO2Zyb209JmFtcDtyb29tPSZhbXA7Y29tbWVudD0mYW1wO2xpa2U9JmFtcDtjb21tZW50cz00JmFtcDtsaWtlcz0x">Here&#8217;s the search</a>. Note that the post I wrote just one minute ago is already in the results page. This is the real-time web. &#8211; Robert Scoble (<a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3Njb2JsZWl6ZXIuY29tLzIwMDkvMDIvMDkvaXMtdGhlLXJlYWwtdGltZS13ZWItYS10aHJlYXQtdG8tZ29vZ2xlLXNlYXJjaC8=">http://scobleizer.com/2009/02/09/is-the-real-time-web-a-threat-to-google-search/</a>)</p></blockquote>
<p>Whilst this is an example of something being almost instantly available from search does it really qualify as being &#8220;real-time&#8221;?</p>
<p><span id="more-89"></span><br />
The first thing to do, as others have done, is understand what the term &#8220;real-time&#8221; means. Rather than going into this I recommend you have a read of the wikipedia definition of <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9SZWFsLXRpbWU=">real-time</a> and watch a Kaazing presentation on <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dzIuc3lzLWNvbi5jb20vd2ViaW5hcmFyY2hpdmUuY2ZtP3NraXA9b24mYW1wO3BpZD13Y19hdzhlX2QyX3M0X3QxX2thYXppbmcmYW1wO3JlZ2lkPTMzOTA0">What is the Real-Time Web</a>. There have been fewer attempts at defining &#8220;real-time web&#8221;. Even Wikipedia presently (19/04/2009) lacks a definition.</p>
<p>For me for something to be real-time web it should meet the following criteria:</p>
<ol>
<li>Get up to the second information on a chosen subject.</li>
<li>Make an initial request for information to be delivered across the Internet. Subsequent updates to that information, or information stream, should be delivered as soon as possible without the need to make a additional requests.</li>
<li>Initial information and subsequent updates should be delivered in an acceptable amount of time.</li>
</ol>
<h2>The real-time web experience</h2>
<p>If I go to <a  0="title="Phil" 1="Leggetter" 2="on" 3="Twitter"" href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3R3aXR0ZXIuY29tL2xlZ2dldHRlcg==">my twitter homepage</a> I don&#8217;t want to have to refresh the page, by clicking the refresh button, or hitting the F5 key, in order to see new messages from the people that I&#8217;m following. Twitter doesn&#8217;t really want users doing this either as it puts load on their server &#8211; but let&#8217;s leave this for another time.</p>
<div class="wp-caption alignnone" style="width: 220px"><a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3R3aXR0ZXIuY29t"><img title="Twitter" src="http://assets0.twitter.com/images/twitter.png" alt="" width="210" height="49" /></a><p class="wp-caption-text">Twitter</p></div>
<p>This lack of real-time updates on the Twitter site has lead to a surge in Twitter client applications such as <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy50d2VldGRlY2suY29tLw==">TweetDeck</a> and <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy50d2hpcmwub3JnLw==">Thwirl</a>. These clients simulate real-time by polling the <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2FwaXdpa2kudHdpdHRlci5jb20v">Twitter API</a> at intervals. I&#8217;d like to highlight the word &#8220;<em>simulate</em>&#8221; again and clarify what polling is. What the Twitter client applications are actually doing is making requests to Twitter at periodic intervals to see if the user has had any messages and if they have it displays them, if there are no new messages then it&#8217;s a wasted request.</p>
<div class="wp-caption alignleft" style="width: 290px"></p>
<div style="background-color:black"><img class="alignnone size-full wp-image-548" title="tweetdeck_logo" src="http://blog.caplin.com/wp-content/uploads/tweetdeck_logo.png" alt="tweetdeck_logo" width="251" height="50" /></div>
<p><p class="wp-caption-text">TweetDeck</p></div>
<div class="wp-caption alignleft" style="width: 290px"><a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy50d2hpcmwub3JnLw=="><img title="Twhirl" src="http://www.twhirl.org/themes/twhirl/logo.jpg" alt="Twhirl" width="220" height="105" /></a><p class="wp-caption-text">Twhirl</p></div>
<p>A much better model would be for Twitter to notify the client that new messages are available by passing the additional messages straight to the Twitter client.</p>
<h2>Real-time web delivery time</h2>
<p>What determines the amount of time that is acceptable between a message being published and it being received by the consumer (user) depends on the context of its use. For something such as instant messaging or a Twitter conversation the time between publication and consumption can be reasonably large, maybe 10 seconds. However, if the publisher is a trading system sending a price and the consumer is a trader 10 seconds is far too long. By the time the price reaches the trader it may be out of date.</p>
<h2>Real-time technology</h2>
<p><a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3htcHAub3JnLw==">XMPP</a> and <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2NvZGUuZ29vZ2xlLmNvbS9wL3NpbXBsZXVwZGF0ZXByb3RvY29sLw==">SUP</a> have been touted as the technology to deliver the real-time web but they appear to be server side solutions or require clients with knowledge of the specific technologies. For a web solution people start to turn to Comet server solutions. Caplin Systems &#8211; the real-time web company &#8211; have had the technology available to deliver real-time data for many years now so I wanted to understand why, only now, has the idea of a &#8220;real-time web&#8221; really taken off.</p>
<div class="wp-caption alignnone" style="width: 220px"><img alt="Caplin Systems" src="http://www.caplin.com/assets/templates/caplin/img/logo.gif" title="Caplin Systems" width="210" height="37" /><p class="wp-caption-text">Caplin Systems</p></div>
<p>Caplin Systems have a high performance scalable <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5jYXBsaW4uY29tL2NhcGxpbnBsYXRmb3JtLz9jdXJhcnRfaWQ9MzY=">real-time comet server called Liberator</a> that can push updates to subscribing clients as soon as it receives information. The clients are:</p>
<ul type="disc">
<li>Java      clients: standalone application or applet</li>
<li>.NET      clients such a windows desktop application or web page embedded      SilverLight widget</li>
<li>JavaScript      clients: any website such as <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3R3aXR0ZXIuY29tLw==">http://twitter.com</a> or <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2ZyaWVuZGZlZWQuY29tLw==">http://friendfeed.com</a></li>
</ul>
<p>Twitter and FriendFeed don&#8217;t use Liberator but they could easily do so. All that needs to be done to integrate <em>Real-time Rich Internet Application</em> (<em>RTRIA</em> ?) functionality to an existing web site is include a JavaScript library called <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5mcmVlbGliZXJhdG9yLmNvbS9kb2N1bWVudGF0aW9uL3NsNGIvaW50cm9kdWN0aW9uLmh0bWw=">SL4B (StreamLink for Browsers)</a>. The <em>RTRIA</em> functionality can then be added to an existing site in the same way that RIA functionality can be introduced to a website using other JavaScript libraries such as <a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2pxdWVyeS5jb20v">JQuery</a>. However, in this case the <em>RIA</em> functionality that can be added is a true real-time web experience of data being pushed to the client as soon as it becomes available, without any need for the user to check to see if any new information is available.</p>
<h2>Conclusion</h2>
<p>My opinion is that the instant availability of information via search straight after it&#8217;s published doesn&#8217;t really justify the term &#8220;real-time web&#8221;. To be truely real-time the information needs to be pushed to the user. The true real-time web experience and the technology to achieve this is already here but at the moment few people are aware of it and therefore it&#8217;s not in mainstream use. The ideas behind Comet, the Liberator server and Liberator clients provide technology and infrastructure to push data to clients without the need for polling or a user driven information request. Scalability and side by side integration with existing systems are already possible which means there&#8217;s no reason why existing clients such as websites can&#8217;t start taking advantage of it.</p>
<p>Some relevant links:</p>
<ul style="text-align: left;">
<li><a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5yZWFkd3JpdGV3ZWIuY29tL2FyY2hpdmVzL3NvcnJ5X2dvb2dsZV95b3VfbWlzc2VkX3RoZV9yZWFsX3RpbWVfd2ViLnBocA==">http://www.readwriteweb.com/archives/sorry_google_you_missed_the_real_time_web.php</a></li>
<li><a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5nbmlwY2VudHJhbC5jb20v">http://www.gnipcentral.com/</a></li>
<li><a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3Njb2JsZWl6ZXIuY29tLzIwMDkvMDIvMDkvaXMtdGhlLXJlYWwtdGltZS13ZWItYS10aHJlYXQtdG8tZ29vZ2xlLXNlYXJjaC8=">http://scobleizer.com/2009/02/09/is-the-real-time-web-a-threat-to-google-search/</a></li>
<li><a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3Njb2JsZWl6ZXIuY29tLzIwMDgvMTIvMjEvcnNzLXNob3dzLWl0cy1hZ2UtaW4tcmVhbC10aW1lLXdlYi1zdXAtYW5kLXhtcHAtdG8tdGhlLXJlc2N1ZS8=">http://scobleizer.com/2008/12/21/rss-shows-its-age-in-real-time-web-sup-and-xmpp-to-the-rescue/</a></li>
<li>Kaazing presentation on &#8220;<a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dzIuc3lzLWNvbi5jb20vd2ViaW5hcmFyY2hpdmUuY2ZtP3NraXA9b24mYW1wO3BpZD13Y19hdzhlX2QyX3M0X3QxX2thYXppbmcmYW1wO3JlZ2lkPTMzOTA0">What is real-time web</a>&#8220;</li>
</ul>
 <img src="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=89" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.caplin.com/2009/04/20/what-is-the-real-time-web/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>How to dynamically create a class definition for use with Mock4JS</title>
		<link>http://blog.caplin.com/2009/04/16/how-to-dynamically-create-a-class-definition-for-use-with-mock4js/</link>
		<comments>http://blog.caplin.com/2009/04/16/how-to-dynamically-create-a-class-definition-for-use-with-mock4js/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 17:00:28 +0000</pubDate>
		<dc:creator>Phil Leggetter</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[Ajax Testing]]></category>
		<category><![CDATA[Mock4JS]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[Test Driven Development]]></category>
		<category><![CDATA[Unit Testing]]></category>

		<guid isPermaLink="false">http://blog.caplin.com/?p=187</guid>
		<description><![CDATA[Mock4JS is a really useful unit testing helper library that allows you to create mocks of your JavaScript classes. What it doesn&#8217;t presently support is mocking of objects that you can&#8217;t create an instance of yourself using new Class() or of objects that are dynamically created and have functions appended...]]></description>
			<content:encoded><![CDATA[<p><a  href="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL21vY2s0anMuc291cmNlZm9yZ2UubmV0Lw==">Mock4JS</a> is a really useful unit testing helper library that allows you to create mocks of your JavaScript classes. What it doesn&#8217;t presently support is mocking of objects that you can&#8217;t create an instance of yourself using <code>new Class()</code> or of objects that are dynamically created and have functions appended to them.</p>
<p><span id="more-187"></span></p>
<h3>What do I mean by not being able to &#8220;create an instance of yourself using <code>new Class()</code>&#8220;?</h3>
<pre class="javascript">MyClassDefinition = function()
{
};

MyClassDefintion.prototype.myFunction = function()
{
    // do some stuff
};
MyClassDefinition = new MyClassDefinition();</pre>
<p>Here we lose the ability to do <code>new MyClassDefinition();</code></p>
<h3>What do I mean by &#8220;objects that are dynamically created&#8221;?</h3>
<pre class="javascript">// create an object using the object literal notation
var oObj = {};

// dynamically append a function
oObj.myFunction = function()
{
    // do some stuff
};</pre>
<p>Code written in both these ways make it more difficult to create a mock using Mock4JS because it expects a function reference to be passed to the mock method call.</p>
<p>A way around this is to dynamically create a definition from the object. This is done using the following piece of code:</p>
<pre class="javascript">function createMockDefinition(oObject)
{
    var oMockedDefinition = new Function();
    for( var x in oObject )
    {
        // Only add functions to the dynamically created prototype
        if( typeof oObject[ x ] == "function" )
        {
            oMockedDefinition.prototype[x] = function(){};
        }
    }
    return oMockedDefinition;
};</pre>
<p>With the above code we have now created a class definition that we can pass to the Mock4JS <code>mock()</code> function.</p>
<pre class="javascript">function myTest()
{
    var oObjectIWantToTest = {};
    oObjectIWantToTest.functionIWantToTest = function(){};

    var oMyMockDefinition = createMockDefinition( oObjectIWantToTest );
    var oMyMock = mock( oMyMockDefinition );
    var oMyMockProxy = oMyMock.proxy();

    // setup expectations
    oMyMock.expects(once()).functionIWantToTest("myArgument");

    // call function and execute mock method.
    oMyMockProxy.functionIWantToTest("myArgument");

    // Finally, verify the expected mock methods have been called.
    // If not, an exception will be thrown.
    Mock4JS.verifyAllMocks();
};</pre>
 <img src="http://blog.caplin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=187" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.caplin.com/2009/04/16/how-to-dynamically-create-a-class-definition-for-use-with-mock4js/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

