<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Gregor&#039;s work related blog</title>
	<atom:link href="http://gregorsuttie.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://gregorsuttie.com</link>
	<description>.net development and more</description>
	<lastBuildDate>Sun, 21 Apr 2013 19:49:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='gregorsuttie.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Gregor&#039;s work related blog</title>
		<link>http://gregorsuttie.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://gregorsuttie.com/osd.xml" title="Gregor&#039;s work related blog" />
	<atom:link rel='hub' href='http://gregorsuttie.com/?pushpress=hub'/>
		<item>
		<title>RavenDB &#8211; Exporting and Importing using Smuggler</title>
		<link>http://gregorsuttie.com/2013/04/15/ravendb-exporting-and-importing-using-smuggler/</link>
		<comments>http://gregorsuttie.com/2013/04/15/ravendb-exporting-and-importing-using-smuggler/#comments</comments>
		<pubDate>Mon, 15 Apr 2013 20:36:01 +0000</pubDate>
		<dc:creator>Gregor Suttie</dc:creator>
				<category><![CDATA[RavenDB]]></category>
		<category><![CDATA[RavenDB Tutorial]]></category>
		<category><![CDATA[smuggler]]></category>

		<guid isPermaLink="false">http://gregorsuttie.com/?p=2483</guid>
		<description><![CDATA[Smuggler is a tool for RavenDB which is used for exporting and importing data &#8211; today at work I was &#8230;<p><a href="http://gregorsuttie.com/2013/04/15/ravendb-exporting-and-importing-using-smuggler/">Continue reading &#187;</a></p><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gregorsuttie.com&#038;blog=18438908&#038;post=2483&#038;subd=gregorsuttie&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><a href="http://gregorsuttie.files.wordpress.com/2013/04/badge1.png"><img src="http://gregorsuttie.files.wordpress.com/2013/04/badge1.png?w=529" alt="badge1"   class="alignleft size-full wp-image-2484" /></a><b>Smuggler</b> is a tool for RavenDB which is used for exporting and importing data &#8211; today at work I was shown a nice way to use it to take production data out and import it locally for just one collection of documents &#8211; something which might be useful and I know I will forget the syntax I the future for so blogging about it helps me know remember it and I can always read here again in the future if and more likely when I do forget it.</p>
<p>The syntax for exporting a collection called Categories would be as follows:-</p>
<p><a href="http://gregorsuttie.files.wordpress.com/2013/04/smuggler.png" target="_blank"><img src="http://gregorsuttie.files.wordpress.com/2013/04/smuggler.png?w=529&#038;h=306" alt="smuggler" width="529" height="306" class="alignleft size-full wp-image-2488" /></a></p>
<p>What are we doing here, well we are saying use Smuggler to export from the Catalogue Tenants database a dump file &#8211; we are also using metadata so that we are only exporting a collection of documents called Categories and then only the latest version so no revisions, and lastly only export the Documents so no Indexes or any other types of documents.</p>
<p>I wanted to then import this into my local instance of RavenDB so the following command does just that:-</p>
<p><a href="http://gregorsuttie.files.wordpress.com/2013/04/smuggler2.png"><img src="http://gregorsuttie.files.wordpress.com/2013/04/smuggler2.png?w=529&#038;h=306" alt="smuggler2" width="529" height="306" class="alignleft size-full wp-image-2492" /></a></p>
<p>This will import the Categories and override any existing Categories in my local RavenDB instance.</p>
<p>You can read more about smuggler <a href="http://ravendb.net/docs/server/administration/export-import" target="_blank">here</a>.</p>
<p>Hope someone finds that useful.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gregorsuttie.wordpress.com/2483/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gregorsuttie.wordpress.com/2483/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gregorsuttie.com&#038;blog=18438908&#038;post=2483&#038;subd=gregorsuttie&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gregorsuttie.com/2013/04/15/ravendb-exporting-and-importing-using-smuggler/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/01ebf1680ef063faa3d3b5dddb999d15?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gregorsuttie</media:title>
		</media:content>

		<media:content url="http://gregorsuttie.files.wordpress.com/2013/04/badge1.png" medium="image">
			<media:title type="html">badge1</media:title>
		</media:content>

		<media:content url="http://gregorsuttie.files.wordpress.com/2013/04/smuggler.png" medium="image">
			<media:title type="html">smuggler</media:title>
		</media:content>

		<media:content url="http://gregorsuttie.files.wordpress.com/2013/04/smuggler2.png" medium="image">
			<media:title type="html">smuggler2</media:title>
		</media:content>
	</item>
		<item>
		<title>ElmahR &#8211; monitor errors in your app using a dashboard</title>
		<link>http://gregorsuttie.com/2013/04/03/elmahr-monitor-errors-in-your-app-using-a-dashboard/</link>
		<comments>http://gregorsuttie.com/2013/04/03/elmahr-monitor-errors-in-your-app-using-a-dashboard/#comments</comments>
		<pubDate>Wed, 03 Apr 2013 21:10:56 +0000</pubDate>
		<dc:creator>Gregor Suttie</dc:creator>
				<category><![CDATA[MVC]]></category>
		<category><![CDATA[SignalR]]></category>
		<category><![CDATA[Elmah]]></category>
		<category><![CDATA[Elmahr]]></category>
		<category><![CDATA[MONITORING APP]]></category>

		<guid isPermaLink="false">http://gregorsuttie.com/?p=2434</guid>
		<description><![CDATA[If your unfamiliar with Elmah and/or ElmahR then please take a quick look here. If you&#8217;re using Elmah but haven&#8217;t &#8230;<p><a href="http://gregorsuttie.com/2013/04/03/elmahr-monitor-errors-in-your-app-using-a-dashboard/">Continue reading &#187;</a></p><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gregorsuttie.com&#038;blog=18438908&#038;post=2434&#038;subd=gregorsuttie&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>If your unfamiliar with <a href="code.google.com/p/elmah/" target="_Blank">Elmah</a> and/or <a href="https://bitbucket.org/wasp/elmahr/wiki/Home" target="_Blank">ElmahR</a> then please take a quick look <a href="http://gregorsuttie.com/2012/06/04/elmahr-elmah-fused-with-signalr/" target="_Blank">here</a>.</p>
<p>If you&#8217;re using Elmah but haven&#8217;t taken advantage of <a href="https://bitbucket.org/wasp/elmahr/wiki/Home" target="_Blank">ElmahR</a> then read on.</p>
<p>If you have one or more application(s) which currently use <a href="code.google.com/p/elmah/" target="_Blank">Elmah</a> then you can very easily add in <a href="https://bitbucket.org/wasp/elmahr/wiki/Home" target="_Blank">ElmahR</a> which gives you a superb dashboard from where you can monitor either one or all of you applications which log errors.</p>
<p>The dashboard is basically one webpage which makes very nice use of <a href="http://www.asp.net/signalr" target="_Blank">SignalR</a> to display information regarding errors thrown by your application(s), so if you deploy something and you monitor this page and see the error count for your application counting up quickly then you know you have a problem. You can use the dashboard to monitor a number of applications on different environments for example.</p>
<hr />
<p><b>Existing/New Web Application</b></p>
<ul>
<li>Either create a brand new test web application or you can use an existing web application &#8211; add ElmahR to this application using the Nuget package as below:-<br />
<img src="http://gregorsuttie.files.wordpress.com/2013/04/elmahr.png?w=529&#038;h=49" alt="ElmahR" width="529" height="49" class="alignleft size-full wp-image-2442" />
</li>
<li>Ok now that we have added ElmahR to a web application we need to configure it accordingly, open up the web.config and look for the elmah section, should look something like this:- </li>
<p><img src="http://gregorsuttie.files.wordpress.com/2013/04/elmah1.png?w=529&#038;h=56" alt="elmah1" width="529" height="56" class="alignleft size-full wp-image-2444" /></p>
<li>Important &#8211; The sourceId setting needs to match the sourceId setting in our dashboard application&#8217;s web.config</li>
</ul>
<hr />
<p><b>DashBoard</b></p>
<ul>
<li>Now lets create our dashboard, so create a new MVC or Web application, then add the Nuget package as below:-<br />
<img src="http://gregorsuttie.files.wordpress.com/2013/04/elamhrdash.png?w=529&#038;h=50" alt="ElamhrDash" width="529" height="50" class="alignleft size-full wp-image-2435" />
</li>
<li>Now we need to edit the dashboard&#8217;s web.config so that the sourceId&#8217;s match, shown below:-<br />
<img src="http://gregorsuttie.files.wordpress.com/2013/04/elmahr3.png?w=529&#038;h=101" alt="elmahr3" width="529" height="101" class="alignleft size-full wp-image-2451" />
</li>
</ul>
<hr />
<p><b>Testing ElmahR is working</b></p>
<ul>
<li>Within your web application we want to test that ElmahR is set up and working correctly, to do this we need to have an error generated, so deliberately add an exception, such as a throw new NotImplementedException() or similar into an area you can test quickly (e.g. index actionresult within the home controller in MVC)</li>
<li>Run the dashboard application, which should look something like this:-
<p><img src="http://gregorsuttie.files.wordpress.com/2013/04/elmahr5.png?w=529&#038;h=369" alt="elmahr5" width="529" height="369" class="alignleft size-full wp-image-2461" /></p>
</li>
<li>Then run your web application and browse to the page which will generate an error so we can see if it logs as we expect.</li>
<li>If you have everything configured correctly then you will see the error count change in the dashboard application, like so:-<br />
<img src="http://gregorsuttie.files.wordpress.com/2013/04/elmahr6.png?w=529&#038;h=423" alt="elmahr6" width="529" height="423" class="alignleft size-full wp-image-2464" />
</li>
</ul>
<hr />
<p><b>TroubleShooting</b></p>
<ul>
<li>If you don&#8217;t see your application logging errors on the dashboard it&#8217;s usually the sourceId element or the targetUrl element within your web.config</li>
</ul>
<p>
Hope you find this of use and start using <a href="https://bitbucket.org/wasp/elmahr/wiki/Home" target="_Blank">ElmahR</a>.</p>
<p>If you get stuck or something isn&#8217;t working add a comment.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gregorsuttie.wordpress.com/2434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gregorsuttie.wordpress.com/2434/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gregorsuttie.com&#038;blog=18438908&#038;post=2434&#038;subd=gregorsuttie&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gregorsuttie.com/2013/04/03/elmahr-monitor-errors-in-your-app-using-a-dashboard/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/01ebf1680ef063faa3d3b5dddb999d15?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gregorsuttie</media:title>
		</media:content>

		<media:content url="http://gregorsuttie.files.wordpress.com/2013/04/elmahr.png" medium="image">
			<media:title type="html">ElmahR</media:title>
		</media:content>

		<media:content url="http://gregorsuttie.files.wordpress.com/2013/04/elmah1.png" medium="image">
			<media:title type="html">elmah1</media:title>
		</media:content>

		<media:content url="http://gregorsuttie.files.wordpress.com/2013/04/elamhrdash.png" medium="image">
			<media:title type="html">ElamhrDash</media:title>
		</media:content>

		<media:content url="http://gregorsuttie.files.wordpress.com/2013/04/elmahr3.png" medium="image">
			<media:title type="html">elmahr3</media:title>
		</media:content>

		<media:content url="http://gregorsuttie.files.wordpress.com/2013/04/elmahr5.png" medium="image">
			<media:title type="html">elmahr5</media:title>
		</media:content>

		<media:content url="http://gregorsuttie.files.wordpress.com/2013/04/elmahr6.png" medium="image">
			<media:title type="html">elmahr6</media:title>
		</media:content>
	</item>
		<item>
		<title>New MVC Learning Resource &#8211; feedback requested</title>
		<link>http://gregorsuttie.com/2013/03/19/new-mvc-learning-resource-feedback-requested/</link>
		<comments>http://gregorsuttie.com/2013/03/19/new-mvc-learning-resource-feedback-requested/#comments</comments>
		<pubDate>Tue, 19 Mar 2013 19:22:40 +0000</pubDate>
		<dc:creator>Gregor Suttie</dc:creator>
				<category><![CDATA[MVC]]></category>
		<category><![CDATA[Training]]></category>

		<guid isPermaLink="false">http://gregorsuttie.com/?p=2409</guid>
		<description><![CDATA[The developers at Redgate are working on a new resource for learning MVC and are looking for you&#8217;re feedback &#8211; &#8230;<p><a href="http://gregorsuttie.com/2013/03/19/new-mvc-learning-resource-feedback-requested/">Continue reading &#187;</a></p><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gregorsuttie.com&#038;blog=18438908&#038;post=2409&#038;subd=gregorsuttie&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><img src="http://gregorsuttie.files.wordpress.com/2013/03/redgate.png?w=529" alt="redgate"   class="alignleft size-full wp-image-2410" /> The developers at <a href="http://www.red-gate.com" target="_blank">Redgate</a> are working on a new resource for learning MVC and are looking for you&#8217;re feedback &#8211; you can take a look <a href="http://webdev.simple-talk.com/" target="_blank">here</a> and give them your feedback on how to improve it and make it grow.</p>
<p><a href="http://gregorsuttie.files.wordpress.com/2013/03/content.png"><img src="http://gregorsuttie.files.wordpress.com/2013/03/content.png?w=529&#038;h=375" alt="content" width="529" height="375" class="alignleft size-full wp-image-2413" /></a></p>
<p>Above is a sample of what there is currently &#8211; more to come very shortly.</p>
<p>Enjoy.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gregorsuttie.wordpress.com/2409/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gregorsuttie.wordpress.com/2409/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gregorsuttie.com&#038;blog=18438908&#038;post=2409&#038;subd=gregorsuttie&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gregorsuttie.com/2013/03/19/new-mvc-learning-resource-feedback-requested/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/01ebf1680ef063faa3d3b5dddb999d15?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gregorsuttie</media:title>
		</media:content>

		<media:content url="http://gregorsuttie.files.wordpress.com/2013/03/redgate.png" medium="image">
			<media:title type="html">redgate</media:title>
		</media:content>

		<media:content url="http://gregorsuttie.files.wordpress.com/2013/03/content.png" medium="image">
			<media:title type="html">content</media:title>
		</media:content>
	</item>
		<item>
		<title>Code coverage results for your JavaScript</title>
		<link>http://gregorsuttie.com/2013/03/18/code-coverage-for-your-javascript/</link>
		<comments>http://gregorsuttie.com/2013/03/18/code-coverage-for-your-javascript/#comments</comments>
		<pubDate>Mon, 18 Mar 2013 20:06:44 +0000</pubDate>
		<dc:creator>Gregor Suttie</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[TeamCity]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://gregorsuttie.com/?p=2367</guid>
		<description><![CDATA[I wanted to find out if there were any tools that can display code coverage results for JavaScript code (without &#8230;<p><a href="http://gregorsuttie.com/2013/03/18/code-coverage-for-your-javascript/">Continue reading &#187;</a></p><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gregorsuttie.com&#038;blog=18438908&#038;post=2367&#038;subd=gregorsuttie&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I wanted to find out if there were any tools that can display code coverage results for JavaScript code (without the need for Java on the server or having to use Node), I experimented with a few different frameworks, test runners and what not and have spent a couple of hours looking in to this, in the end I opted for the following:-</p>
<p><a href="http://gregorsuttie.files.wordpress.com/2013/03/jasmine_logo.png"><img src="http://gregorsuttie.files.wordpress.com/2013/03/jasmine_logo.png?w=529" alt="jasmine_logo"   class="alignleft size-full wp-image-2368" /></a> At work we currently use <a href="http://pivotal.github.com/jasmine/" target="_Blank">Jasmine</a> which is a behaviour-driven development framework for testing JavaScript code along with <a href="http://phantomjs.org/" target="_Blank">PhantomJS</a> which we use to run the tests using a specrunner (there are several ways to do it but this works for now) </p>
<p> I have installed the Visual Studio Extension called <a href="http://chutzpah.codeplex.com/" target="_Blank">Chutzpah</a> which is a JavaScript Test Runner which gives you a few nice things such as integration with <a href="http://www.jetbrains.com/teamcity/" target="_Blank">TeamCity</a> and the ability to right-click and then select Run Tests similarly to unit testing your C# code with your favourite unit testing framework.</p>
<p><a href="http://gregorsuttie.files.wordpress.com/2013/03/chutzpah.png"><img src="http://gregorsuttie.files.wordpress.com/2013/03/chutzpah.png?w=529&#038;h=52" alt="chutzpah" width="529" height="52" class="alignleft size-full wp-image-2396" /></a></p>
<p>Ok so back to code coverage for our JavaScript code &#8211; <a href="https://twitter.com/mmanela" target="_Blank">Matthew</a> the guy who created <a href="http://chutzpah.codeplex.com/" target="_Blank">Chutzpah</a> is working on integrating code coverage into the next release so in the mean time here is how you get it to work &#8211; enter one further library called <a href="http://blanketjs.org/">Blanket.js</a> &#8211; Blanket.js is used to give us the code coverage results and currently supports <a href="http://qunitjs.com/" target="_Blank">Qunit</a>, <a href="http://visionmedia.github.com/mocha/" target="_Blank">Mocha</a> and <a href="http://pivotal.github.com/jasmine/" target="_Blank">Jasmine</a>. An adapter API exists for supporting other test runners.</p>
<p>At this point you might be thinking its a fair amount of work to get this going but I will simplify the steps required to get your JavaScript code outputting code coverage results.</p>
<ul>
<li>Download <a href="https://github.com/alex-seville/blanket" target="_blank">Blanket.js</a> and look for the file called blanket-jasmine.js, add this to your Scripts folder inside your web application. This file is blanket version that works with Jasmine.</li>
<li>Add the Nuget package jasmine.js <img src="http://gregorsuttie.files.wordpress.com/2013/03/jasminenuget.png?w=529&#038;h=49" alt="jasminenuget" width="529" height="49" class="alignleft size-full wp-image-2381" /></li>
<li>Add some  JavaScript code as below for example this is code.js </li>
<pre class="brush: csharp; title: ; notranslate">
var stringLib = {
    vowels: function (a) {
        count = 0;
        for (var i = 0; i &amp;lt; a.length; i++) {
            if (&amp;quot;aeiou&amp;quot;.indexOf(a[i]) &amp;gt; -1) {
                count++;
            }
        }
        return count;
    }
}
var mathLib = {
    add5: function (a) {
        return a + 5;
    },
    mult5: function (a) {
        return a * 5;
    }
}
</pre>
<li>Add a JavaScript file with your Jasmine tests for the code above like so :-
<pre class="brush: csharp; title: ; notranslate">
describe(&quot;general&quot;, function () {
    it(&quot;A basic test&quot;, function () {
        expect(true).toBeTruthy();
        var value = &quot;hello&quot;;
        expect(&quot;hello&quot;).toEqual(value);
    });
});

describe(&quot;stringLib&quot;, function () {
    it(&quot;will get vowel count&quot;, function () {
        var count = stringLib.vowels(&quot;hello&quot;);
        expect(count).toEqual(2);
    });
});

describe(&quot;mathLib&quot;, function () {
    it(&quot;will add 5 to number&quot;, function () {
        var res = mathLib.add5(10);
        expect(res).toEqual(15);
    });

    it(&quot;will multiply 5 to number&quot;, function () {
        var res = mathLib.mult5(10);
        expect(res).toEqual(50);
    });
});
</pre>
</li>
<li>Ok so we have some JavaScript code and Jasmine tests for the code, lets add some required links to our Jasmine specrunner page so we can see the code coverage<br />
results output to the screen, edit the spec runner like so:-</p>
<p><a href="http://gregorsuttie.files.wordpress.com/2013/03/specrunner2.png"><img src="http://gregorsuttie.files.wordpress.com/2013/03/specrunner2.png?w=529&#038;h=315" alt="specrunner2" width="529" height="315" class="alignleft size-full wp-image-2390" /></a></p>
<p>The above screen shot shows that we have added a reference to both our JavaScript code file and the file containing the Jasmine tests.
</li>
<li>Now if we browse to the specrunner page for Jasmine we will see the results of the test &#8211; green for passed and red for failed (no code coverage results yet).
<p><a href="http://gregorsuttie.files.wordpress.com/2013/03/jasmineresults1.png"><img src="http://gregorsuttie.files.wordpress.com/2013/03/jasmineresults1.png?w=529&#038;h=110" alt="jasmineresults1" width="529" height="110" class="alignleft size-full wp-image-2391" /></a>
</li>
<li>Now lets show the JavaScript code coverage results &#8211; which is as simple as adding in the line to reference Blanket for Jasmine:-
<p><a href="http://gregorsuttie.files.wordpress.com/2013/03/specrunner3.png"><img src="http://gregorsuttie.files.wordpress.com/2013/03/specrunner3.png?w=529&#038;h=314" alt="specrunner3" width="529" height="314" class="alignleft size-full wp-image-2392" /></a></p>
</li>
<li>Refresh the specrunner page and you will now see your JavaScript code coverage results like so:-
<p><a href="http://gregorsuttie.files.wordpress.com/2013/03/specrunner4.png"><img src="http://gregorsuttie.files.wordpress.com/2013/03/specrunner4.png?w=529&#038;h=316" alt="specrunner4" width="529" height="316" class="alignleft size-full wp-image-2393" /></a></p>
<p>The screen shot above shows us 100% code coverage, so no lines of JavaScript are coloured red (not covered)
</li>
<li>
If I comment out one of the tests we can see the difference below:-<br />
<a href="http://gregorsuttie.files.wordpress.com/2013/03/specrunner5.png"><img src="http://gregorsuttie.files.wordpress.com/2013/03/specrunner5.png?w=529&#038;h=290" alt="specrunner5" width="529" height="290" class="alignleft size-full wp-image-2394" /></a>
</li>
<li>And there we have it code coverage results of your JavaScript, brief post but enough to get you started I hope, next time I will add this to TeamCity and see what that gives us.
</li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gregorsuttie.wordpress.com/2367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gregorsuttie.wordpress.com/2367/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gregorsuttie.com&#038;blog=18438908&#038;post=2367&#038;subd=gregorsuttie&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gregorsuttie.com/2013/03/18/code-coverage-for-your-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/01ebf1680ef063faa3d3b5dddb999d15?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gregorsuttie</media:title>
		</media:content>

		<media:content url="http://gregorsuttie.files.wordpress.com/2013/03/jasmine_logo.png" medium="image">
			<media:title type="html">jasmine_logo</media:title>
		</media:content>

		<media:content url="http://gregorsuttie.files.wordpress.com/2013/03/chutzpah.png" medium="image">
			<media:title type="html">chutzpah</media:title>
		</media:content>

		<media:content url="http://gregorsuttie.files.wordpress.com/2013/03/jasminenuget.png" medium="image">
			<media:title type="html">jasminenuget</media:title>
		</media:content>

		<media:content url="http://gregorsuttie.files.wordpress.com/2013/03/specrunner2.png" medium="image">
			<media:title type="html">specrunner2</media:title>
		</media:content>

		<media:content url="http://gregorsuttie.files.wordpress.com/2013/03/jasmineresults1.png" medium="image">
			<media:title type="html">jasmineresults1</media:title>
		</media:content>

		<media:content url="http://gregorsuttie.files.wordpress.com/2013/03/specrunner3.png" medium="image">
			<media:title type="html">specrunner3</media:title>
		</media:content>

		<media:content url="http://gregorsuttie.files.wordpress.com/2013/03/specrunner4.png" medium="image">
			<media:title type="html">specrunner4</media:title>
		</media:content>

		<media:content url="http://gregorsuttie.files.wordpress.com/2013/03/specrunner5.png" medium="image">
			<media:title type="html">specrunner5</media:title>
		</media:content>
	</item>
		<item>
		<title>KoLite &#8211; dirty flag and more</title>
		<link>http://gregorsuttie.com/2013/02/05/kolite-dirty-flag-and-more/</link>
		<comments>http://gregorsuttie.com/2013/02/05/kolite-dirty-flag-and-more/#comments</comments>
		<pubDate>Tue, 05 Feb 2013 19:15:46 +0000</pubDate>
		<dc:creator>Gregor Suttie</dc:creator>
				<category><![CDATA[KnockoutJS]]></category>
		<category><![CDATA[KoLite]]></category>

		<guid isPermaLink="false">http://gregorsuttie.com/?p=2307</guid>
		<description><![CDATA[KoLite its written by John Papa and Hans Fjällemark and has helpers which add some extra very nice functionality to &#8230;<p><a href="http://gregorsuttie.com/2013/02/05/kolite-dirty-flag-and-more/">Continue reading &#187;</a></p><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gregorsuttie.com&#038;blog=18438908&#038;post=2307&#038;subd=gregorsuttie&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>KoLite its written by <a href="https://twitter.com/John_Papa" target="_Blank">John Papa</a> and <a href="https://twitter.com/hfjallemark" target="_Blank">Hans Fjällemark</a> and has helpers which add some extra very nice functionality to KnockoutJS.</p>
<p>I was working on a project which uses <a href="http://www.knockoutjs.com/" target="_blank">KnockoutJS</a> and had the need to implement the idea of setting a dirty flag if a user made a change to a form, this would in turn enable a save button and allow the changes to be saved. </p>
<p>KoLite makes this very easy indeed, I decided to put together some quick code demonstrating the features I mention &#8211; at work <a href="jsfiddle.net" target="_blank">jsfiddle.net</a> doesn&#8217;t work too well so I have added the code to a sample app and uploaded it to GitHub. </p>
<p>The original samples and more information can be found <a href="http://www.johnpapa.net/kolite1-1/">here</a>, I thought they could do with being expanded upon a little.</p>
<p>The ViewModel I used for the demo code is as follows:-</p>
<p><img src="http://gregorsuttie.files.wordpress.com/2013/02/code2.png?w=529&#038;h=486" alt="code2" width="529" height="486" class="aligncenter size-full wp-image-2319" /></p>
<p><b>Dirty Flag and how to use it</b></p>
<ul>
<li>The code on line 10 is creating the dirtyflag by using KoLite&#8217;s DirtyFlag &#8211; I pass in which observable&#8217;s I want to monitor to see if they become dirty when they&#8217;re value changes.</li>
<li>The code on line 27 is setting up a computed observable which will return true if the observables have theyre values changed, otherwise it will return false.</li>
</ul>
<p>So by having some observables updated we can track for dirty changes and then decide what we want to do on our form, an example would be to enable the clear form button as well as enable the save button on when we have the dirty flag set to true.</p>
<p><b>Grey out button when Ajax request is in progress</b></p>
<ul>
<li>The code on lines 29-33 is making use of the KoLite asyncCommand</li>
<li>If you then add the code below, to the html then we have the functionality were after.</li>
</ul>
<pre class="brush: csharp; title: ; notranslate">
&lt;button data-bind=&quot;command: saveCommand&quot;&gt;Save&lt;/button&gt;
</pre>
<p><b>Grey out button when Ajax request is in progress and show activity icon</b></p>
<ul>
<li>If you add in the extra binding like so:- </li>
<pre class="brush: csharp; title: ; notranslate">
&lt;button data-bind=&quot;command: saveCommand, activity: saveCommand.isExecuting&quot;&gt;Save&lt;/button&gt;
</pre>
</ul>
<p>KoLite will now add in an activity icon within the button, and that&#8217;s it &#8211; in the example code I am using an Ajax post to call the MVC Controller and whilst this is off doing work the activity icon spins.<br />
<br />
<img src="http://gregorsuttie.files.wordpress.com/2013/02/save.png?w=75&#038;h=37" alt="save" width="75" height="37" /></p>
<ul>
<li>My demo code can be found <a href="https://github.com/gsuttie/KoLiteDemo" target="_blank">here</a></li>
<li>You can download the code for KoLite <a href="https://github.com/CodeSeven/KoLite" target="_blank">here</a></li>
</ul>
<p>Leave a comment after the beep.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gregorsuttie.wordpress.com/2307/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gregorsuttie.wordpress.com/2307/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gregorsuttie.com&#038;blog=18438908&#038;post=2307&#038;subd=gregorsuttie&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gregorsuttie.com/2013/02/05/kolite-dirty-flag-and-more/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/01ebf1680ef063faa3d3b5dddb999d15?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gregorsuttie</media:title>
		</media:content>

		<media:content url="http://gregorsuttie.files.wordpress.com/2013/02/code2.png" medium="image">
			<media:title type="html">code2</media:title>
		</media:content>

		<media:content url="http://gregorsuttie.files.wordpress.com/2013/02/save.png" medium="image">
			<media:title type="html">save</media:title>
		</media:content>
	</item>
		<item>
		<title>My DotNetCurry Magazine Articles</title>
		<link>http://gregorsuttie.com/2013/01/07/magazine-articles/</link>
		<comments>http://gregorsuttie.com/2013/01/07/magazine-articles/#comments</comments>
		<pubDate>Mon, 07 Jan 2013 20:09:45 +0000</pubDate>
		<dc:creator>Gregor Suttie</dc:creator>
				<category><![CDATA[KnockoutJS]]></category>
		<category><![CDATA[RavenDB]]></category>
		<category><![CDATA[Training]]></category>
		<category><![CDATA[Dot Net Curry]]></category>
		<category><![CDATA[Magazine Article]]></category>
		<category><![CDATA[Web Essentials 2012]]></category>

		<guid isPermaLink="false">http://gregorsuttie.com/?p=2277</guid>
		<description><![CDATA[Over the last couple of months I have been privileged to write a couple of articles for the free .Net &#8230;<p><a href="http://gregorsuttie.com/2013/01/07/magazine-articles/">Continue reading &#187;</a></p><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gregorsuttie.com&#038;blog=18438908&#038;post=2277&#038;subd=gregorsuttie&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Over the last couple of months I have been privileged to write a couple of articles for the free <a href="http://www.dotnetcurry.com/magazine/">.Net Developer Magazine</a> brought to you by<br />
<a href="http://www.dotnetcurry.com/" target="_blank">DotNetCurry</a>. </p>
<p>Its been my first attempt at writing for a magazine and has been a lot of fun, maybe in the future I can write  more articles.</p>
<p>Please enjoy and give them a read &#8211; and sign up for the magazine &#8211; its FREE!</p>
<p><a href="http://www.dotnetcurry.com/magazine/dnc-magazine-issue3.aspx"><img src="http://gregorsuttie.files.wordpress.com/2013/01/dnc-nov-thumb.png?w=529" alt="dnc-nov-thumb"   class="aligncentre size-full wp-image-2284" /></a><br />
<strong>Create a Snappy UI with KnockoutJS</strong> -&gt; <a href="http://www.dotnetcurry.com/magazine/dnc-magazine-issue3.aspx">Issue 3</a><br />
This article explores KnockoutJS and what KnockoutJS gives you as a developer.</p>
<p><a href="http://www.dotnetcurry.com/magazine/dnc-magazine-issue4.aspx" target="_blank"><img src="http://gregorsuttie.files.wordpress.com/2013/01/dnc-jan-thumb.png?w=529" alt="dnc-jan-thumb"   class="aligncentre size-full wp-image-2283" /></a><br />
<strong>Web Essentials for Visual Studio 2012</strong> -&gt; <a href="http://www.dotnetcurry.com/magazine/dnc-magazine-issue4.aspx">Issue 4</a><br />
This article explores the Visual Studio 2012 Web Essential add-on.</p>
<p><a href="http://www.dotnetcurry.com/magazine/dnc-magazine-issue5.aspx" target="_blank"><img src="http://gregorsuttie.files.wordpress.com/2013/01/dnc-mar.png?w=529" alt="dnc-mar"   class="aligncenter size-full wp-image-2429" /></a></p>
<p><strong>What&#8217;s New in RavenDB 2.0</strong> -&gt; <a href="http://www.dotnetcurry.com/magazine/dnc-magazine-issue5.aspx" target="_Blank">Issue 5</a><br />
This article explores RavenDB 2.0</p>
<p>Take a look at these articles and hopefully you will learn something new &#8211; Gregor.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gregorsuttie.wordpress.com/2277/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gregorsuttie.wordpress.com/2277/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gregorsuttie.com&#038;blog=18438908&#038;post=2277&#038;subd=gregorsuttie&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gregorsuttie.com/2013/01/07/magazine-articles/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/01ebf1680ef063faa3d3b5dddb999d15?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gregorsuttie</media:title>
		</media:content>

		<media:content url="http://gregorsuttie.files.wordpress.com/2013/01/dnc-nov-thumb.png" medium="image">
			<media:title type="html">dnc-nov-thumb</media:title>
		</media:content>

		<media:content url="http://gregorsuttie.files.wordpress.com/2013/01/dnc-jan-thumb.png" medium="image">
			<media:title type="html">dnc-jan-thumb</media:title>
		</media:content>

		<media:content url="http://gregorsuttie.files.wordpress.com/2013/01/dnc-mar.png" medium="image">
			<media:title type="html">dnc-mar</media:title>
		</media:content>
	</item>
		<item>
		<title>Book Review: C# Smorgasbord by Filip Ekberg</title>
		<link>http://gregorsuttie.com/2013/01/01/book-review-c-smorgasbord-by-filip-ekberg/</link>
		<comments>http://gregorsuttie.com/2013/01/01/book-review-c-smorgasbord-by-filip-ekberg/#comments</comments>
		<pubDate>Tue, 01 Jan 2013 13:37:59 +0000</pubDate>
		<dc:creator>Gregor Suttie</dc:creator>
				<category><![CDATA[Book Reviews]]></category>
		<category><![CDATA[Dependency Injection]]></category>
		<category><![CDATA[Productivity]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Training]]></category>

		<guid isPermaLink="false">http://gregorsuttie.com/?p=2260</guid>
		<description><![CDATA[Book Review: C# Smorgasbord by Filip Ekberg About the Author: Filip is a Software Engineer working with various techniques such &#8230;<p><a href="http://gregorsuttie.com/2013/01/01/book-review-c-smorgasbord-by-filip-ekberg/">Continue reading &#187;</a></p><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gregorsuttie.com&#038;blog=18438908&#038;post=2260&#038;subd=gregorsuttie&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.amazon.co.uk/C-Smorgasbord-Filip-Ekberg/dp/1468152106/ref=sr_1_1?ie=UTF8&amp;qid=1357042210&amp;sr=8-1" target="_blank"><img src="http://gregorsuttie.files.wordpress.com/2013/01/smorgasbord.png?w=529" alt="smorgasbord"   class="alignleft size-full wp-image-2267" /></a></p>
<p><strong>Book Review: C# Smorgasbord by Filip Ekberg</strong></p>
<p><strong>About the Author:</strong><br />
Filip is a Software Engineer working with various techniques such as C#, WPF, WCF, ASP.NET MVC, ASP.NET and much more. Currently working at Star Republic in Sweden as a Software Engineer working with both newer and older technologies in a Windows environment, mainly focusing on ASP.NET MVC development.</p>
<p>During his years of Programming, Filip has managed to accomplish some of the following:<br />
 • Software Engineering Degree @ Blekinge Institute of Technology<br />
 • Managing the Software Development Company SmartIT eSolutions Sweden which focused mainly on developing software and web solutions.<br />
 • Working as an Amanuensis ( Teacher ) @ Blekinge Institute of Technology teaching Java, C++, Sql and Network-programming.</p>
<p>You can read more on his <a href="http://blog.filipekberg.se/" title="Blog" target="_blank">blog</a> here.</p>
<p>I saw a tweet from @daniellangnet who said this book was fantastic and if your looking for something to read over the holidays then give this a go, I actually ordered the book without even reading anything about it, unusual but glad i did!</p>
<p><strong>Chapter 1: Introduction to Parallel Extensions </strong> :- Learn the basics of paralleization, use basic Linq, and how to optimize code by introducing parallelization.<br />
<strong>Chapter 2: Productivity and Quality with Unit Testing</strong> :- Understand why tests are import, create a test project and improve code quality.<br />
<strong>Chapter 3: Is upgrading your code a productive step?</strong> :- How to find bugs faster, How to use Resharper to get a more manageable project and to get things done faster.<br />
<strong>Chapter 4: Creating a challenge out of the trivial tasks</strong> :- Challenge yourself to create understandable and higher quality software.<br />
<strong>Chapter 5: Asynchronous programming with async and await</strong> :- Identify where yo might need asynchronous processing, refactor a synchronous app into becoming more responsive.<br />
<strong>Chapter 6: Dynamic program</strong> :- Create and extend a dynamic object by using the ExpandObject, also understand why introducing dynamic objects might cause problems long-term.<br />
<strong>Chapter 7: Increase readability with anonymous types and methods</strong> :identify where you might have single purpose methods that you can replace with anonymous methods for increased readability and lucidity.<br />
<strong>Chapter 8: Exploring Reflection</strong> :- User reflection to get information about types at runtime and understand more about properties and methods.<br />
<strong>Chapter 9: Creating things at runtime</strong> :- Create your own method at runtime using Reflection, be able to read IL and understand portions of it.<br />
<strong>Chapter 10: Introducing Roslyn</strong> :- Create a basic code analysis that suggest issues in your code, run code snippets on entire code files.<br />
<strong>Chapter 11: Adapting to Inversion of Control</strong> :- Understand the basics of Inversion of Control, introduce a Dependency Injector into your application.<br />
<strong>Chapter 12: Are you Mocking me?</strong> :- Create a mock of any interface and write tests that introduce </p>
<p>This book as you can see has something for everyone, i have thoroughly enjoyed reading it from cover to cover and will be reading a good few of the chapters again, it&#8217;s a very handy reference book and covers a number of topics that as a developer can help you explore, improve and be inspired &#8211; just as it says on the front cover.</p>
<p>I picked this book up on Amazon for £19 and its well worth it &#8211; recommended reading for 2013.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gregorsuttie.wordpress.com/2260/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gregorsuttie.wordpress.com/2260/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gregorsuttie.com&#038;blog=18438908&#038;post=2260&#038;subd=gregorsuttie&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gregorsuttie.com/2013/01/01/book-review-c-smorgasbord-by-filip-ekberg/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/01ebf1680ef063faa3d3b5dddb999d15?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gregorsuttie</media:title>
		</media:content>

		<media:content url="http://gregorsuttie.files.wordpress.com/2013/01/smorgasbord.png" medium="image">
			<media:title type="html">smorgasbord</media:title>
		</media:content>
	</item>
		<item>
		<title>Choosing what Technologies/Frameworks to use</title>
		<link>http://gregorsuttie.com/2012/12/31/choosing-what-technologiesframeworks-to-use/</link>
		<comments>http://gregorsuttie.com/2012/12/31/choosing-what-technologiesframeworks-to-use/#comments</comments>
		<pubDate>Mon, 31 Dec 2012 14:30:25 +0000</pubDate>
		<dc:creator>Gregor Suttie</dc:creator>
				<category><![CDATA[Pro Tips]]></category>
		<category><![CDATA[Productivity]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://gregorsuttie.com/?p=2246</guid>
		<description><![CDATA[I have seen a few of my good friends on twitter discussing what technologies/frameworks they use and why they chose &#8230;<p><a href="http://gregorsuttie.com/2012/12/31/choosing-what-technologiesframeworks-to-use/">Continue reading &#187;</a></p><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gregorsuttie.com&#038;blog=18438908&#038;post=2246&#038;subd=gregorsuttie&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><a href="http://gregorsuttie.com/2012/12/31/choosing-what-technologiesframeworks-to-use/technologybasics-2/" rel="attachment wp-att-2253"><img src="http://gregorsuttie.files.wordpress.com/2012/12/technologybasics1.jpg?w=529" alt="TechnologyBasics"   class="alignleft size-full wp-image-2253" /></a> I have seen a few of my good friends on twitter discussing what technologies/frameworks they use and why they chose them. </p>
<p>I have also seen people saying why they should use this technology/framework over that technology all with really good arguments, as well as people asking which technologies/frameworks/libraries they should look at.</p>
<p>Note:- This is from the perspective of a company and not an individual developers stand point.</p>
<p>It comes down to a number of things and twitter isn&#8217;t really the best place to discuss this as it&#8217;s too small to get your point across hence this blog post.</p>
<p>I have worked in a few different places over time and there really is no single answer, some financial place I was in you were told which technology you were going to be using and it wasnt even up for debate, software architects who you would never even see had made the decisions already whether that be a good idea or not.</p>
<p>I would say choose the technology/framework that fits your current criteria as well as the technology/framework that matches your teams skill sets. </p>
<p>There has been a few posts about MVC or Nancy, in the end who cares what you choose? &#8211; if it gets the job done right?</p>
<p>Perhaps if you&#8217;re in a small team then its easier to choose say Nancy over MVC perhaps? &#8211; but if you walked into a team of 50-100 developers in a company im betting more people know MVC than know Nancy, that&#8217;s not to say MVC is better than Nancy, I havent even looked at Nancy, why not? &#8211; for a couple of reasons, why do I want to look at Nancy when MVC is used through our solutions, do I want to spend time learning another tool that does the same job? &#8211; no I don&#8217;t have time, don&#8217;t get me wrong I love to look at new ways of doing things, but I want to spend time learning something else like KnockoutJS or RavenDB and expand on my skill set, id rather do that port perfectly fine code bases which use a number of tools that run on MVC to Nancy and then have to check everything still works as expected including tests, build scripts, all sorts of other tools we use like chirpy and T4MVC.  </p>
<p>People wonder why companies choose Microsoft products over other similar products and from experience it&#8217;s usually for either the option of MSDN licence support if required, or that more developers out there know and understand the product therefore there is more chance of help/finding a solution to a nasty bug &#8211; sort of strength in numbers it&#8217;s also easier for a manager to say to their boss look we will use SQL Server instead of CouchDB because of the products past history and thy can sleep safe in the knowledge its proven &#8211; I am not saying that other products are brand new and not to be trusted far from it, but I hope you get the point.</p>
<p>Recently we started using CoffeeScript for our latest project and to be honest I have never liked it, it was good for organising code in a better structured manner and I will leave it at that &#8211; we are looking to move to TypeScript and this isn&#8217;t because it&#8217;s a Microsoft product, its open source and I just think it&#8217;s so much nicer due to the tooling. It&#8217;s a better too for the job in my opinion and in summary there is no magic answer to what the best technology is, decide upon the variables in play and go from there is what I would suggest.</p>
<p>Not everyone will agree so feel free to add a comment.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gregorsuttie.wordpress.com/2246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gregorsuttie.wordpress.com/2246/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gregorsuttie.com&#038;blog=18438908&#038;post=2246&#038;subd=gregorsuttie&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gregorsuttie.com/2012/12/31/choosing-what-technologiesframeworks-to-use/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/01ebf1680ef063faa3d3b5dddb999d15?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gregorsuttie</media:title>
		</media:content>

		<media:content url="http://gregorsuttie.files.wordpress.com/2012/12/technologybasics1.jpg" medium="image">
			<media:title type="html">TechnologyBasics</media:title>
		</media:content>
	</item>
		<item>
		<title>KnockoutJS &#8211; what I&#8217;ve learned so far</title>
		<link>http://gregorsuttie.com/2012/10/29/knockoutjs-what-ive-learned-so-far/</link>
		<comments>http://gregorsuttie.com/2012/10/29/knockoutjs-what-ive-learned-so-far/#comments</comments>
		<pubDate>Mon, 29 Oct 2012 17:48:14 +0000</pubDate>
		<dc:creator>Gregor Suttie</dc:creator>
				<category><![CDATA[KnockoutJS]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://gregorsuttie.com/?p=2127</guid>
		<description><![CDATA[I have been using KnockoutJS at work for the last few weeks and thought it might be an idea to &#8230;<p><a href="http://gregorsuttie.com/2012/10/29/knockoutjs-what-ive-learned-so-far/">Continue reading &#187;</a></p><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gregorsuttie.com&#038;blog=18438908&#038;post=2127&#038;subd=gregorsuttie&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I have been using <a href="http://knockoutjs.com/" target="_blank">KnockoutJS</a> at work for the last few weeks and thought it might be an idea to blog about my findings whilst using KnockoutJS within an MVC 4 project, so here goes: &#8211; </p>
<ul>
<li>
<p>
With KnockoutJS you can get a really slick user experience if you show discipline in structuring your code, you can separate out your concerns using unobtrusive JavaScript &#8211; i.e. <strong>don&#8217;t</strong> put your JavaScript in the HTML, yes add data-bind attributes but that should be all you need, your JavaScript can be referenced from a file within a JS folder or similar keeping your HTML clean and free from being polluted by lots of inline JavaScript.
</p>
</li>
<li>
<p>
If you&#8217;re wondering how you go about going from your MVC model and working with this in KnockoutJS then look no further than <a href="http://knockoutjs.com/documentation/plugins-mapping.html" target="_blank">KnockoutJS mapping</a>. This plugin will take your existing Model from c# and convert it into what you will use within KnockoutJS, for example if in your model you have a string[] defined like so:- </p>
<pre class="brush: csharp; title: ; notranslate">
public string[] EmailAddresses { get; set; }
</pre>
<p> then the mapping plugin converts this to an observableArray, and if you have a simple string property such as: -</p>
<pre class="brush: csharp; title: ; notranslate">
public string Email { get; set; }
</pre>
<p> then the plugin will map this to a knockout observable for you.
</p>
</li>
<li>
<p>When using ObservableArrays note that the number of items in the array is tracked &#8211; not the actual values within the array &#8211; this is important if, if the front end requires updated to the values within the array then you need to make the items within the ObservableArray observable also. </p>
</li>
<li>
<p>Take a look at the ko.utils code mentioned <a href="http://www.knockmeout.net/2011/04/utility-functions-in-knockoutjs.html" target="_blank">here</a> for some hidden gems when working with KnockoutJS.</p>
</li>
<li>
<p>Dont store a lot of information in observables if you don&#8217;t have to, it&#8217;s not a good idea to store 10,000 records in an observable array and then bind that to a grid (Only store what you need in observables)</p>
</li>
<li>
<p>
It can be a good idea to display on your page the contents of your viewmodel whilst you&#8217;re debugging so you can see what the observable and observable arrays you&#8217;re using contain</p>
<pre class="brush: csharp; title: ; notranslate">
&lt;div id=&quot;debug&quot; style=&quot;clear: both&quot;&gt;
    &lt;hr /&gt;
    &lt;h2&gt;Debug&lt;/h2&gt;
    &lt;div data-bind=&quot;text: ko.toJSON($data)&quot; /&gt;
&lt;/div&gt;
</pre>
</p>
</li>
<p>More soon as I use it more and more, hope that helps.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gregorsuttie.wordpress.com/2127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gregorsuttie.wordpress.com/2127/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gregorsuttie.com&#038;blog=18438908&#038;post=2127&#038;subd=gregorsuttie&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gregorsuttie.com/2012/10/29/knockoutjs-what-ive-learned-so-far/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/01ebf1680ef063faa3d3b5dddb999d15?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gregorsuttie</media:title>
		</media:content>
	</item>
		<item>
		<title>Create CoffeeScript using Visual Studio and the Web Essentials Add-On</title>
		<link>http://gregorsuttie.com/2012/10/20/create-coffeescript-using-visual-studio-and-the-web-essentials-add-on/</link>
		<comments>http://gregorsuttie.com/2012/10/20/create-coffeescript-using-visual-studio-and-the-web-essentials-add-on/#comments</comments>
		<pubDate>Sat, 20 Oct 2012 15:17:44 +0000</pubDate>
		<dc:creator>Gregor Suttie</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[KnockoutJS]]></category>
		<category><![CDATA[CoffeeScript]]></category>
		<category><![CDATA[Web Essentials]]></category>
		<category><![CDATA[Web Essentials 2012]]></category>

		<guid isPermaLink="false">http://gregorsuttie.com/?p=2089</guid>
		<description><![CDATA[&#8220;CoffeeScript is a little language that compiles into JavaScript. Underneath all those awkward braces and semicolons, JavaScript has always had &#8230;<p><a href="http://gregorsuttie.com/2012/10/20/create-coffeescript-using-visual-studio-and-the-web-essentials-add-on/">Continue reading &#187;</a></p><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gregorsuttie.com&#038;blog=18438908&#038;post=2089&#038;subd=gregorsuttie&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><a href="http://gregorsuttie.files.wordpress.com/2012/09/cs.png"><img src="http://gregorsuttie.files.wordpress.com/2012/09/cs.png?w=529" alt="" title="cs"   class="alignleft size-full wp-image-2090" /></a><br />
&#8220;CoffeeScript is a little language that compiles into JavaScript. Underneath all those awkward braces and semicolons, JavaScript has always had a gorgeous object model at its heart. CoffeeScript is an attempt to expose the good parts of JavaScript in a simple way&#8221;</p>
<p>If your writing JavaScript in your web application, and the chances are these days you will be, then CoffeeScript is well worth a look &#8211; if your like me and you don&#8217;t particularly like writing JavaScript then bare with me you might learn some new tricks &#8211; CoffeeScript attempts to make your life easier when writing JavaScript and for the most part does a good job, it&#8217;s not all plain sailing as you might expect if you have worked with JavaScript much in the past.</p>
<p>Ok lets crack on, if you have Visual Studio handy make sure you have installed the <a target="_blank">Web Essentials Extension</a>. This is a beauty of an add-on and has a nice little add-on for CoffeeScript included.</p>
<ol>
<li>Open up a new web solution either MVC app or a Web app
</li>
<li>Right click on your solution and then click Add in the next menu look for CoffeeScript, click this and we have a new CoffeeScript file added to your solution.
</li>
<li>On the left hand pane of the split is where you type your CoffeeScript and this is converted into JavaScript on the right hand side.</li>
<li>Each time you save your changes the JavaScript file is updated for you &#8211; if you make any syntactical changes incorrectly then the preview tab on the right hand side will show you which line the error is on.</li>
</ol>
<p>Some CoffeeScript basics are as follows:-</p>
<ul>
<li>Semicolons are not required -&gt; ;</li>
<li>Parenthesis are usually not required -&gt; ()</li>
<li>Curly braces are usually not required -&gt; {} </li>
<li>Commas are sometimes not required -&gt; , </li>
<li>Indent your code by tabbing for the start of a code block</li>
<li>Decrease indentation &#8211; end of a code block</li>
<li>The following screen shot shows you Visual Studio 2012 using the Web Essentials extension and I have added some CoffeeScript on the left and Web Essentials does the rest for me turning this into JavaScript.
<p><a href="http://gregorsuttie.files.wordpress.com/2012/10/coffeescript1.png"><img src="http://gregorsuttie.files.wordpress.com/2012/10/coffeescript1.png?w=529&#038;h=146" alt="" title="CoffeeScript1" width="529" height="146" class="alignleft size-full wp-image-2186" /></a></p>
</li>
<li>To learn more about CoffeeScript check out the official website <a href="http://coffeescript.org/" target="_blank">here</a>.</li>
</ul>
<p><strong>Summary</strong><br />
CoffeeScript can be useful when your using something like KnockoutJS and you want to structure your code nicely using JavaScript classes and namespaces &#8211; I have been suing it recently and it has good points and bad points.</p>
<p><strong>The good: &#8211; </strong>It allows you to structure your JavaScript easily and you can use namespaces as you would within C# classes. Less code is always good in my opinion and with CoffeeScript its easier to write less code to create your JavaScript files.</p>
<p><strong>The bad: -</strong> Tabbing indents your code and this is how you create functions and loops and so on, miss one tab out and you can be left scratching your head but with some care this should be easily fixed.
</p>
<p>Learn anything useful? &#8211; please let me know by leaving a comment after the beep.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gregorsuttie.wordpress.com/2089/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gregorsuttie.wordpress.com/2089/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gregorsuttie.com&#038;blog=18438908&#038;post=2089&#038;subd=gregorsuttie&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gregorsuttie.com/2012/10/20/create-coffeescript-using-visual-studio-and-the-web-essentials-add-on/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/01ebf1680ef063faa3d3b5dddb999d15?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gregorsuttie</media:title>
		</media:content>

		<media:content url="http://gregorsuttie.files.wordpress.com/2012/09/cs.png" medium="image">
			<media:title type="html">cs</media:title>
		</media:content>

		<media:content url="http://gregorsuttie.files.wordpress.com/2012/10/coffeescript1.png" medium="image">
			<media:title type="html">CoffeeScript1</media:title>
		</media:content>
	</item>
	</channel>
</rss>
