<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;Ak4GQHs_eCp7ImA9WhRUF0Q.&quot;"><id>tag:blogger.com,1999:blog-4853877730213459430</id><updated>2012-01-28T17:02:01.540-08:00</updated><category term="Jasmine" /><category term="Metro" /><category term="MVVM" /><category term="Visual Studio 2010 Scheme" /><category term="mock objects" /><category term="Attached Property" /><category term="F# properties" /><category term="scaling" /><category term="Rhino Mocks" /><category term="MSTest" /><category term="ILDASM" /><category term="MSDN Magazine" /><category term="Linq to XML" /><category term="XAML" /><category term="F# libraries" /><category term="WebSharper" /><category term="jQuery Plugin" /><category term="Dependency Property" /><category term="SpecUnit" /><category term="Querly" /><category term="Web Development" /><category term="ExpectThat" /><category term="TDD" /><category term="ASP.NET MVC 4" /><category term="PowerPack" /><category term="OData" /><category term="ROA" /><category term="FSharpx" /><category term="FSI" /><category term="MSIL" /><category term=".NET Remoting" /><category term="F# Interactive" /><category term="Integrated Shell" /><category term="blogs" /><category term="Scope Document" /><category term="Seq" /><category term="Nashville .NET User Group" /><category term="NUnit" /><category term="Pattern Matching" /><category term="FsUnit" /><category term="jQuery" /><category term="Test Driven Development" /><category term="IoC" /><category term="Unit Test" /><category term="ASP.NET MVC3" /><category term="Polyphony" /><category term="jQuery Templates" /><category term="Recursion" /><category term="F# tools" /><category term="F# Sample Application" /><category term="F#" /><category term="System.Xml.Linq" /><category term="software deployments" /><category term="Value Converter" /><category term="ASP.NET MVC 3" /><category term="Best Practices" /><category term="Caliburn.Micro" /><category term="F# classes" /><category term="CouchDB" /><category term="DI" /><category term="ILASM" /><category term="F# versus C#" /><category term="Visual Studio 11" /><category term="Development" /><category term="Windows Phone 7" /><category term="Ling to SQL" /><category term="CoffeeScript" /><category term="NuGet" /><category term="FSRepository" /><category term="Asynchronous Programming" /><category term="VS2010" /><category term="NHibernate" /><category term="Why F#" /><category term="Symbiote" /><category term="Seq.sum" /><category term="JavaScript" /><category term="Visual Studio Gallery" /><category term="FSharp.PowerPack" /><category term="F# interfaces" /><category term="feeds" /><category term="Project Templates" /><category term="VS2011" /><category term="Alice" /><category term="Template" /><category term="Windows 8" /><category term="Architecture" /><category term="IT" /><category term="Template Wizard" /><category term="VS2010 Template" /><category term="jQuery UI" /><category term="Management" /><category term="DTO" /><category term="ASP.NET MVC" /><category term="Windows Phone" /><category term="Node.js" /><category term="DevLink" /><category term="fsharp" /><category term="Pavlov" /><category term="BDD" /><category term="F# ASP.NET MVC 3" /><category term="F# members" /><category term="Principles and Standards" /><category term="RabbitMQ" /><category term="TypeProvider" /><category term="Presentation" /><category term="Project Euler" /><category term="User Group" /><category term="Methodolgies" /><category term="Scope of Work" /><category term="xUnit.NET" /><category term="Wonderland" /><category term="Design Patterns" /><category term="CodeStock 2009" /><category term="Code Kata" /><category term="REST" /><category term="QUnit" /><category term="Chord" /><category term="FLinq" /><category term="F# PowerPack" /><category term="F# vs. C#" /><category term="WP7" /><category term="VB" /><category term="NoSQL" /><category term="C#" /><category term="DHT" /><category term="Data Access" /><category term="IL" /><category term="Developer Events" /><category term="IoC container" /><category term="WCF" /><category term="MbUnit" /><category term="Accelerometer" /><category term="XLinq" /><category term="parallelism" /><category term="F# Presentation" /><category term="Asynchronous Workflows" /><category term="Nashville Geek Lunch" /><category term="WPF" /><category term="Silverlight" /><category term="Erlang" /><title>Random Ravings of a Red Headed Code Monkey</title><subtitle type="html" /><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://bloggemdano.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://bloggemdano.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Daniel Mohl</name><uri>http://www.blogger.com/profile/17462870714458080019</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="18" src="http://1.bp.blogspot.com/_HK2nW1E0B3s/SO875zZECAI/AAAAAAAAAAM/A8QGI_N1ev8/S220/danProfile.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>116</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/BloggemDano" /><feedburner:info uri="bloggemdano" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>BloggemDano</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><entry gd:etag="W/&quot;DkAESHw4fSp7ImA9WhRUE08.&quot;"><id>tag:blogger.com,1999:blog-4853877730213459430.post-318149518993487061</id><published>2012-01-23T05:18:00.000-08:00</published><updated>2012-01-23T05:18:29.235-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-23T05:18:29.235-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="WPF" /><category scheme="http://www.blogger.com/atom/ns#" term="XAML" /><category scheme="http://www.blogger.com/atom/ns#" term="F#" /><category scheme="http://www.blogger.com/atom/ns#" term="Windows Phone 7" /><category scheme="http://www.blogger.com/atom/ns#" term="Silverlight" /><title>Making F# Windows Phone Development a Little Easier</title><content type="html">About a month ago, I &lt;a href="http://freshbrewedcode.com/danmohl/2011/11/25/building-f-solutions-in-visual-studio-11/"&gt;announced&lt;/a&gt; that most of the existing &lt;a href="http://visualstudiogallery.msdn.microsoft.com/site/search?query=mohl&amp;amp;f%5B0%5D.Value=mohl&amp;amp;f%5B0%5D.Type=SearchText&amp;amp;ac=8"&gt;F# project templates on Visual Studio Gallery&lt;/a&gt;&amp;nbsp;had been updated to include support for Visual Studio 11. In that post, I mentioned some new item templates that had been included in the update to the &lt;a href="http://visualstudiogallery.msdn.microsoft.com/06c6ece1-2084-4083-a0f7-934fce9d22fb"&gt;F# XAML Item Templates&lt;/a&gt;&amp;nbsp;extension. This post provides a bit more information related to that update.&lt;br /&gt;
&lt;br /&gt;
The F# XAML Item Templates&amp;nbsp;extension was designed to make working with F# + WPF&amp;nbsp;and Silverlight a little eaiser. I provided a &lt;a href="http://bloggemdano.blogspot.com/2011/06/f-xaml-item-templates-now-on-visual.html"&gt;brief overview of these features back in June&lt;/a&gt;. However, Windows Phone XAML related development was still lacking. The previous approach to adding XAML files was to either create a blank file, change the extension, and manually add the appropriate starting XAML or create the XAML from one of the C# item templates, remove the code-behind files, and tweak the resulting XAML. While neither of these options is extremely time consuming, it can quickly become annoying.&lt;br /&gt;
&lt;br /&gt;
The latest update to &lt;a href="http://visualstudiogallery.msdn.microsoft.com/06c6ece1-2084-4083-a0f7-934fce9d22fb"&gt;this&lt;/a&gt;&amp;nbsp;Visual Studio extension reduces this annoyance by providing F# Windows Phone 7 XAML item templates. Once this VSIX is installed, you can add a Windows Phone 7 XAML file by doing the following:&lt;br /&gt;
&lt;br /&gt;
1. In a Windows Phone F# project, proceed with adding a new item as you normally would (i.e. Ctrl+Shift+A).&lt;br /&gt;
&lt;br /&gt;
2. The resulting wizard (shown below) includes several new item templates starting with "F#..." that match the C# versions, but that do not generate C# code-behind files.&lt;span style="text-align: center;"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="text-align: center;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style="text-align: center;"&gt;
&lt;a href="http://freshbrewedcode.com/danmohl/files/2011/12/FsWp7ItemTemplates.png"&gt;&lt;img alt="" class="aligncenter size-full wp-image-210" height="355" src="http://freshbrewedcode.com/danmohl/files/2011/12/FsWp7ItemTemplates.png" title="FsWp7ItemTemplates" width="574" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
While you still have to write the small amount of F# code to wire this up, it makes life a little bit easier.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4853877730213459430-318149518993487061?l=bloggemdano.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://bloggemdano.blogspot.com/feeds/318149518993487061/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://bloggemdano.blogspot.com/2011/11/making-f-windows-phone-development.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/318149518993487061?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/318149518993487061?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BloggemDano/~3/anx28DI5RSo/making-f-windows-phone-development.html" title="Making F# Windows Phone Development a Little Easier" /><author><name>Daniel Mohl</name><uri>http://www.blogger.com/profile/17462870714458080019</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="18" src="http://1.bp.blogspot.com/_HK2nW1E0B3s/SO875zZECAI/AAAAAAAAAAM/A8QGI_N1ev8/S220/danProfile.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://bloggemdano.blogspot.com/2011/11/making-f-windows-phone-development.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0cNRXs9fip7ImA9WhRVF04.&quot;"><id>tag:blogger.com,1999:blog-4853877730213459430.post-8496541459622110064</id><published>2012-01-16T08:24:00.000-08:00</published><updated>2012-01-16T08:24:54.566-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-16T08:24:54.566-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="FSharpx" /><category scheme="http://www.blogger.com/atom/ns#" term="F#" /><title>developerFusion Article: An Introduction to FSharpx</title><content type="html">My article entitled "An Introduction to FSharpx" was published a few days ago. You can find it at&amp;nbsp;&lt;a href="http://www.developerfusion.com/article/136179/an-introduction-to-fsharpx"&gt;http://www.developerfusion.com/article/136179/an-introduction-to-fsharpx&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
As mentioned in the article, FSharpx is continually evolving and several new features have been added since I submitted this article. Be sure to head over to the &lt;a href="https://github.com/fsharp/fsharpx"&gt;FSharpx GitHub site&lt;/a&gt; to see what's new.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4853877730213459430-8496541459622110064?l=bloggemdano.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://bloggemdano.blogspot.com/feeds/8496541459622110064/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://bloggemdano.blogspot.com/2012/01/developerfusion-article-introduction-to.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/8496541459622110064?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/8496541459622110064?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BloggemDano/~3/SZCDqRwHIxw/developerfusion-article-introduction-to.html" title="developerFusion Article: An Introduction to FSharpx" /><author><name>Daniel Mohl</name><uri>http://www.blogger.com/profile/17462870714458080019</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="18" src="http://1.bp.blogspot.com/_HK2nW1E0B3s/SO875zZECAI/AAAAAAAAAAM/A8QGI_N1ev8/S220/danProfile.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://bloggemdano.blogspot.com/2012/01/developerfusion-article-introduction-to.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkMNRXg5eSp7ImA9WhRVEUw.&quot;"><id>tag:blogger.com,1999:blog-4853877730213459430.post-5036166647531153714</id><published>2012-01-08T09:29:00.000-08:00</published><updated>2012-01-09T05:08:14.621-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-09T05:08:14.621-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="JavaScript" /><category scheme="http://www.blogger.com/atom/ns#" term="CoffeeScript" /><category scheme="http://www.blogger.com/atom/ns#" term="QUnit" /><category scheme="http://www.blogger.com/atom/ns#" term="Pavlov" /><category scheme="http://www.blogger.com/atom/ns#" term="Jasmine" /><category scheme="http://www.blogger.com/atom/ns#" term="ExpectThat" /><title>Introducing ExpectThat: A CoffeeScript Assertion Library</title><content type="html">I'm a big fan of automated testing. In fact, on the rare&amp;nbsp;occasions that I don't write tests, I find that I can't shake the thought that something has been missed.&lt;br /&gt;
&lt;br /&gt;
As with all aspects of my coding efforts, I am constantly looking for ways to improve the process, make tests more readable, and reduce room for error. With these goals in mind, I'd like to introduce &lt;a href="https://github.com/dmohl/expectThat"&gt;ExpectThat&lt;/a&gt;.
&lt;br /&gt;
&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;What is ExpectThat?&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
ExpectThat is an expressive, self-documenting, assertion library for CoffeeScript, that seeks to improve testing efforts with your favorite testing framework. It does this by providing a syntax similar to &lt;a href="http://freshbrewedcode.com/danmohl/2012/01/03/announcing-fsunit-1-0/"&gt;FsUnit&lt;/a&gt;&amp;nbsp;(a library for &lt;a href="http://msdn.microsoft.com/en-us/vstudio/hh388569"&gt;F#&lt;/a&gt;) that makes assertions more readable and then automatically translates that readable code into descriptive test output. This ensures that your test names always stay in sync with your tests and allows your code to speak for itself. ExpectThat currently supports Pavlov, QUnit, and Jasmine. Overtime, support for additional testing frameworks will be added.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Let's See it in Action&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
The following example shows how to write tests with ExpectThat for Pavlov in CoffeeScript:
&lt;br /&gt;
&lt;pre class="f-sharp" name="code"&gt;pavlov.specify "Example Specifications", -&amp;gt;
    foo = "bar"
    describe "When testing 'should equal'", -&amp;gt;
        expectThat -&amp;gt; foo.should equal "bar"
    describe "When testing 'shouldnt equal'", -&amp;gt;
        expectThat -&amp;gt; foo.shouldnt equal "baz"
    describe "When testing for 'true'", -&amp;gt;
        expectThat -&amp;gt; (foo is "bar").should be true
        expectThat -&amp;gt; (foo is "baz").shouldnt be true
    describe "When testing for 'false'", -&amp;gt;
        expectThat -&amp;gt; (foo is "baz").should be false
        expectThat -&amp;gt; (foo is "bar").shouldnt be false
    describe "When testing 'greater than'", -&amp;gt;
        expectThat -&amp;gt; (9.1).should be greaterThan 9
        expectThat -&amp;gt; (9.1).shouldnt be greaterThan 10
        expectThat -&amp;gt; 10.shouldnt be greaterThan 10&lt;/pre&gt;
Here's a screenshot of the result:
&lt;br /&gt;
&lt;div style="text-align: center;"&gt;
&lt;a href="http://freshbrewedcode.com/danmohl/files/2011/12/ExpectThatPavlovOutput1.png"&gt;&lt;img alt="" class="aligncenter size-full wp-image-312" height="316" src="http://freshbrewedcode.com/danmohl/files/2011/12/ExpectThatPavlovOutput1.png" title="ExpectThatPavlovOutput" width="565" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;strong&gt;Other Testing Frameworks&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
As I mentioned, ExpectThat currently supports QUnit and Jasmine in addition to Pavlov. The following are examples for each of these.&lt;br /&gt;
&lt;br /&gt;
QUnit:
&lt;br /&gt;
&lt;pre class="f-sharp" name="code"&gt;module "Example QUnit Specifications"

foo = "bar"

module "When testing should equal"

expectThat -&amp;gt; foo.should equal "bar"

module "When testing shouldnt equal"

expectThat -&amp;gt; foo.shouldnt equal "baz"

module "When testing for true"

expectThat -&amp;gt; (foo is "bar").should be true
expectThat -&amp;gt; (foo is "baz").shouldnt be true

module "When testing for false"

expectThat -&amp;gt; (foo is "baz").should be false
expectThat -&amp;gt; (foo is "bar").shouldnt be false&lt;/pre&gt;
Jasmine:&lt;br /&gt;
&lt;pre class="f-sharp" name="code"&gt;describe "Example Jasmine Specifications", -&amp;gt;
    foo = "bar"
    describe "When testing should equal", -&amp;gt;
        expectThat -&amp;gt; foo.should equal "bar"
    describe "When testing shouldnt equal", -&amp;gt;
        expectThat -&amp;gt; foo.shouldnt equal "baz"
    describe "When testing for throw", -&amp;gt;
        expectThat -&amp;gt; (-&amp;gt; throw "test exception").should throwException
        expectThat -&amp;gt; (-&amp;gt; throw "test").should throwException "test"
    describe "When testing for less than", -&amp;gt;
        expectThat -&amp;gt; 10.should be lessThan 11
        expectThat -&amp;gt; (10.1).shouldnt be lessThan 10&lt;/pre&gt;
&lt;strong&gt;Getting Started with ExpectThat&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
There are a couple of ways to get started with ExpectThat. First, head over to the &lt;a href="https://github.com/dmohl/expectThat"&gt;ExpectThat GitHub site&lt;/a&gt;&amp;nbsp;and browse through the documentation. You can then clone the repo and grab any of the examples from the &lt;a href="https://github.com/dmohl/expectThat/tree/master/example"&gt;example folder&lt;/a&gt;. If you are writing an ASP.NET app in Visual Studio, another option is to install one of the &lt;a href="http://nuget.org/packages?q=expectThat&amp;amp;sortOrder=package-download-count"&gt;available NuGet packages&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Available Assertions&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
ExpectThat currently provides the following assertions:&lt;br /&gt;
&lt;br /&gt;
- equal&lt;br /&gt;
- stictlyEqual&lt;br /&gt;
- false&lt;br /&gt;
- true&lt;br /&gt;
- greaterThan&lt;br /&gt;
- greaterThanOrEqual&lt;br /&gt;
- lessThan&lt;br /&gt;
- lessThanOrEqual&lt;br /&gt;
- throwException&lt;br /&gt;
- 'to' and 'be' can be used in most cases to make tests more readable.&lt;br /&gt;
&lt;br /&gt;
In addition to the out-of-the-box assertions, ExpectThat allows for the creation of custom assertions. Examples of this for each of the supported testing frameworks are available in the &lt;a href="https://github.com/dmohl/expectThat/tree/master/example"&gt;example folder on GitHub&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;ExpectThat in JavaScript&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
While the syntax of ExpectThat works best with CoffeeScript, you can certainly use it in JavaScript as well. Simply add in the missing braces, parens, semi-colons, function keywords, etc. The following provides a simple example for Pavlov:
&lt;br /&gt;
&lt;pre class="f-sharp" name="code"&gt;pavlov.specify("expectThat Specifications", function() {
    describe("When testing should equal", function() {
        var foo = "bar";
        expectThat(function() {
            foo.should(equal("bar"));
        });
        expectThat(function() {
            (foo + "test").should(equal("bartest"));
        });
    });
});&lt;/pre&gt;
&lt;strong&gt;Getting Involved&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
There are a lot of things left to do for ExpectThat and I'd love to hear your thoughts on direction, enhancements, etc. as well as have any help that anyone would like to offer. If you want to get involved, &lt;a href="https://github.com/dmohl/expectThat"&gt;fork me on GitHub&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4853877730213459430-5036166647531153714?l=bloggemdano.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://bloggemdano.blogspot.com/feeds/5036166647531153714/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://bloggemdano.blogspot.com/2012/01/introducing-expectthat-coffeescript.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/5036166647531153714?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/5036166647531153714?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BloggemDano/~3/KgvEa_DbuV0/introducing-expectthat-coffeescript.html" title="Introducing ExpectThat: A CoffeeScript Assertion Library" /><author><name>Daniel Mohl</name><uri>http://www.blogger.com/profile/17462870714458080019</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="18" src="http://1.bp.blogspot.com/_HK2nW1E0B3s/SO875zZECAI/AAAAAAAAAAM/A8QGI_N1ev8/S220/danProfile.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://bloggemdano.blogspot.com/2012/01/introducing-expectthat-coffeescript.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEYAQnw8cSp7ImA9WhRWFk0.&quot;"><id>tag:blogger.com,1999:blog-4853877730213459430.post-6778457927342066700</id><published>2011-12-25T13:31:00.000-08:00</published><updated>2012-01-03T06:49:03.279-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-03T06:49:03.279-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="xUnit.NET" /><category scheme="http://www.blogger.com/atom/ns#" term="F#" /><category scheme="http://www.blogger.com/atom/ns#" term="NUnit" /><category scheme="http://www.blogger.com/atom/ns#" term="MbUnit" /><category scheme="http://www.blogger.com/atom/ns#" term="FsUnit" /><title>Announcing FsUnit 1.0</title><content type="html">A couple of weeks ago I &lt;a href="http://freshbrewedcode.com/danmohl/2011/12/06/enhancements-to-fsunit-version-0-9-1-1/"&gt;announced a few enhancements to FsUnit&lt;/a&gt;. Today, I'm proud to announce the &lt;a href="http://fsunit.codeplex.com/"&gt;release of FsUnit 1.0&lt;/a&gt;. Version 1.0 includes support for additional testing frameworks, a new assertion function, and more...&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;New Testing Framework Support:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
All previous releases of FsUnit provided support for only NUnit; however, the goal for FsUnit has always been to provide support for other major testing frameworks as well. This release largely accomplishes this goal by adding support for MbUnit version 3.3.454.0 and xUnit.NET version 1.8.0.1549. While the majority of functions provided for NUnit are also provided for these two testing frameworks, there are a couple of features that are not available. Each of these missing features can easily be worked around and the FsUnit unit tests provide examples of this.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;NuGet Packages:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
The easiest way to get started with FsUnit is to install one of the following NuGet packages.&lt;br /&gt;
&lt;br /&gt;
- FsUnit for NUnit can be installed via the original NuGet package ID of &lt;a href="http://www.nuget.org/packages/FsUnit"&gt;FsUnit&lt;/a&gt;.&lt;br /&gt;
&lt;div style="text-align: center;"&gt;
&lt;a href="http://freshbrewedcode.com/danmohl/files/2011/12/NuGetPackageFsUnit.png"&gt;&lt;img alt="" class="aligncenter size-full wp-image-249" height="41" src="http://freshbrewedcode.com/danmohl/files/2011/12/NuGetPackageFsUnit.png" title="NuGetPackageFsUnit" width="444" /&gt;&lt;/a&gt;&lt;/div&gt;
- FsUnit for xUnit.NET can be installed via the &lt;a href="http://www.nuget.org/packages/FsUnit.xUnit"&gt;FsUnit.xUnit&lt;/a&gt;&amp;nbsp;package ID.&lt;br /&gt;
&lt;div style="text-align: center;"&gt;
&lt;a href="http://freshbrewedcode.com/danmohl/files/2011/12/NuGetPackageFsUnitXUnit.png"&gt;&lt;img alt="" class="aligncenter size-full wp-image-250" height="41" src="http://freshbrewedcode.com/danmohl/files/2011/12/NuGetPackageFsUnitXUnit.png" title="NuGetPackageFsUnitXUnit" width="445" /&gt;&lt;/a&gt;&lt;/div&gt;
- FsUnit for MbUnit can be installed via the &lt;a href="http://www.nuget.org/packages/FsUnit.MbUnit"&gt;FsUnit.MbUnit&lt;/a&gt;&amp;nbsp;package ID.&lt;br /&gt;
&lt;div style="text-align: center;"&gt;
&lt;a href="http://freshbrewedcode.com/danmohl/files/2011/12/NuGetPackageFsUnitMbUnit.png"&gt;&lt;img alt="" class="size-full wp-image-251 aligncenter" height="41" src="http://freshbrewedcode.com/danmohl/files/2011/12/NuGetPackageFsUnitMbUnit.png" title="NuGetPackageFsUnitMbUnit" width="445" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;strong&gt;Additional Assertion:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
In addition to support for MbUnit and xUnit.NET, the equalWithin function has been added. Thanks to &lt;a href="http://fsunit.codeplex.com/discussions/269320"&gt;erdoll&lt;/a&gt;&amp;nbsp;for requesting this enhancement and for providing much of the code for the NUnit implementation. The equalWithin function allows an equality assertion with a specified tolerance. Examples are provided below:&lt;br /&gt;
&lt;br /&gt;
NUnit Example:
&lt;br /&gt;
&lt;pre class="f-sharp" name="code"&gt;module Test.``equalWithin assertions``

open NUnit.Framework
open FsUnit

[&amp;lt;Test&amp;gt;]
let ``should equal within tolerance when less than``() =
    10.09 |&amp;gt; should (equalWithin 0.1) 10.11

[&amp;lt;Test&amp;gt;]
let ``should not equal within tolerance``() =
    10.1 |&amp;gt; should not ((equalWithin 0.001) 10.11)&lt;/pre&gt;
xUnit.NET Example:
&lt;br /&gt;
&lt;pre class="f-sharp" name="code"&gt;module Test.``equalWithin assertions``

open Xunit
open FsUnit.Xunit

[&amp;lt;Fact&amp;gt;]
let ``should equal within tolerance when less than``() =
    10.09 |&amp;gt; should (equalWithin 0.1) 10.11

[&amp;lt;Fact&amp;gt;]
let ``should not equal within tolerance``() =
    10.1 |&amp;gt; should not ((equalWithin 0.001) 10.11)&lt;/pre&gt;
MbUnit Example:
&lt;br /&gt;
&lt;pre class="f-sharp" name="code"&gt;module Test.``equalWithin assertions``

open MbUnit.Framework
open FsUnit.MbUnit

[&amp;lt;Test&amp;gt;]
let ``should equal within tolerance when less than``() =
    10.09 |&amp;gt; should (equalWithin 0.1) 10.11

[&amp;lt;Test&amp;gt;]
let ``should not equal within tolerance``() =
    10.1 |&amp;gt; should not ((equalWithin 0.001) 10.11)&lt;/pre&gt;
&lt;strong&gt;Now on GitHub:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Last but not least, an FsUnit GitHub site is now available at &lt;a href="https://github.com/dmohl/FsUnit"&gt;https://github.com/dmohl/FsUnit&lt;/a&gt;. FsUnit has had several contributors with submissions ranging from inception and NUnit implementation by &lt;a href="http://www.linkedin.com/pub/ray-vernagus/2b/825/b1a"&gt;Ray Vernagus&lt;/a&gt;, to major and minor enhancements, to examples and documentation. I hope that this move to GitHub will spur additional collaboration. The GitHub site will now act as the primary place for development and collaboration, while the &lt;a href="http://fsunit.codeplex.com/"&gt;CodePlex site&lt;/a&gt;&amp;nbsp;will house major releases. We would love to have additional features and contributors, so jump on over and submit a pull request.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;On to the Next One...&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
We are already working on the next release of FsUnit. &lt;a href="https://twitter.com/#!/rodrigovidal"&gt;Rodrigo Vidal&lt;/a&gt; has submitted a few new NUnit assertions--which will be ported to the MbUnit and xUnit.NET implementations where possible. Additionally, there have been discussions of pulling in &lt;a href="https://twitter.com/#!/ptrelford"&gt;Phillip Trelford&lt;/a&gt;'s &lt;a href="https://bitbucket.org/ptrelford/fock"&gt;F# friendly Mocking library&lt;/a&gt;.&amp;nbsp;
&lt;br /&gt;
&lt;br /&gt;
Where would you like to see FsUnit go? We'd love to hear from you!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4853877730213459430-6778457927342066700?l=bloggemdano.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://bloggemdano.blogspot.com/feeds/6778457927342066700/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://bloggemdano.blogspot.com/2011/12/announcing-fsunit-10.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/6778457927342066700?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/6778457927342066700?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BloggemDano/~3/oy7xL4Vgywo/announcing-fsunit-10.html" title="Announcing FsUnit 1.0" /><author><name>Daniel Mohl</name><uri>http://www.blogger.com/profile/17462870714458080019</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="18" src="http://1.bp.blogspot.com/_HK2nW1E0B3s/SO875zZECAI/AAAAAAAAAAM/A8QGI_N1ev8/S220/danProfile.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://bloggemdano.blogspot.com/2011/12/announcing-fsunit-10.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUMER3c5eSp7ImA9WhRQGEU.&quot;"><id>tag:blogger.com,1999:blog-4853877730213459430.post-8002547815666184512</id><published>2011-12-10T09:18:00.001-08:00</published><updated>2011-12-14T10:30:06.921-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-14T10:30:06.921-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="F#" /><title>Porting Bryan's Erlang Function to F#</title><content type="html">A week or two ago, Fresh Brewed Coder Bryan Hunter &lt;a href="http://freshbrewedcode.com/bryanhunter/2011/11/27/debugging-erlang/"&gt;posted a video to explain how to debug Erlang apps&lt;/a&gt;. In the tutorial, he stepped through a recursive function to display the various concepts. I thought it would be interesting to take that simple example and explore a few ways to write it in F#.

Let's start by reviewing Bryan's example (which calculates the average of a provided list of number).&lt;br /&gt;
&lt;br /&gt;
Here's what his average.erl source file looks like:
&lt;br /&gt;
&lt;pre class="f-sharp" name="code"&gt;-module(average).

-export([calculate/1]).

calculate(X) -&amp;gt;
     calculate(X,0,0).

calculate([H|T], Length, Sum) -&amp;gt;
     calculate(T, Length+1, Sum+H);

calculate([], Length, Sum) -&amp;gt;
     Sum/Length.&lt;/pre&gt;
&lt;strong&gt;Porting the Code to F#:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
So how would you write this in F#? As with any language, there are several options. A fairly straight forward port might look like this:
&lt;br /&gt;
&lt;pre class="f-sharp" name="code"&gt;let calculate x =
    let rec calc list length sum =
        match list with
        | head :: tail -&amp;gt; calc tail (length+1) (sum+head)
        | [] -&amp;gt; sum/length
    calc x 0 0
printfn "Value is %O" (calculate [10;22])&lt;/pre&gt;
&lt;strong&gt;Breaking it Down:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
The above code defines the calculate function that takes a list of&amp;nbsp;integers as a single argument.&lt;br /&gt;
&lt;br /&gt;
Next, a recursive function (the "rec" keyword indicates that it is recursive) named calc is defined (line 2). This function takes a list of integers as the first argument, the current length as the second argument, and the current sum as the last argument.&lt;br /&gt;
&lt;br /&gt;
At the heart of this recursive function is a pattern match against the provided list (line 3). Using something known as the &lt;a href="http://msdn.microsoft.com/en-us/library/dd547125.aspx"&gt;cons pattern&lt;/a&gt;, the first pattern (line 4) attempts to decompose the provided list into a "head" (the first element in the list) and "tail"&amp;nbsp;(the rest of the elements).&lt;br /&gt;
&lt;br /&gt;
If the first pattern is a match, the calc function is called with the "tail" list as the first argument, the length value incremented by 1 as the second argument, and the result of the sum value combined with the first value from the list (i.e. the head) as the third argument. This continues until the list is empty, at which point the cons pattern no longer results in a match and the second pattern is evaluated.&lt;br /&gt;
&lt;br /&gt;
By the time the second pattern (line 5) is evaluated, the match will succeed due to the list now being empty.&amp;nbsp;This causes the average to be calculated (i.e. sum/length) and returned.&lt;br /&gt;
&lt;br /&gt;
Line 6 kicks off the initial call to the calc recursive function with the initial list as the first argument and default length and sum values of 0.&lt;br /&gt;
&lt;br /&gt;
Finally, the last line (line 7) kicks off the whole thing with the call to calculate the average of the numbers 10 and 22 (as used in Bryan's demo).&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Another Approach:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
While &amp;nbsp;the approach above is pretty compact, F# provides a library that contains a high-order function that makes this even easier. The following line of code will also calculate the average of the values in a list of integers:
&lt;br /&gt;
&lt;pre class="f-sharp" name="code"&gt;[10;22] |&amp;gt; List.averageBy (fun number -&amp;gt; float number)&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4853877730213459430-8002547815666184512?l=bloggemdano.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://bloggemdano.blogspot.com/feeds/8002547815666184512/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://bloggemdano.blogspot.com/2011/12/porting-bryans-erlang-function-to-f.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/8002547815666184512?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/8002547815666184512?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BloggemDano/~3/_vMB38f_JOs/porting-bryans-erlang-function-to-f.html" title="Porting Bryan's Erlang Function to F#" /><author><name>Daniel Mohl</name><uri>http://www.blogger.com/profile/17462870714458080019</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="18" src="http://1.bp.blogspot.com/_HK2nW1E0B3s/SO875zZECAI/AAAAAAAAAAM/A8QGI_N1ev8/S220/danProfile.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://bloggemdano.blogspot.com/2011/12/porting-bryans-erlang-function-to-f.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUACR3YyeSp7ImA9WhRQEUo.&quot;"><id>tag:blogger.com,1999:blog-4853877730213459430.post-8345149735946974722</id><published>2011-12-01T21:21:00.001-08:00</published><updated>2011-12-06T05:22:46.891-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-06T05:22:46.891-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="F#" /><category scheme="http://www.blogger.com/atom/ns#" term="FsUnit" /><title>Enhancements to FsUnit (version 0.9.1.1)</title><content type="html">A &lt;a href="http://nuget.org/List/Packages/FsUnit"&gt;new version (0.9.1.1) of FsUnit&lt;/a&gt; -- a DSL for writing unit tests in F# -- is now available on the &lt;a href="http://nuget.org/List/Packages/FsUnit"&gt;NuGet gallery&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
This version includes the following improvements:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;- Libraries for frameworks 3.5 and 4.0.&lt;br /&gt;
&amp;nbsp;- Support for NUnit version 2.5.10.11092.&lt;br /&gt;
&amp;nbsp;- Several new functions including: greaterThan,&amp;nbsp;greaterThanOrEqualTo,&amp;nbsp;lessThan,&amp;nbsp;lessThanOrEqualTo,&amp;nbsp;shouldFail,&amp;nbsp;endWith, startWith, and&amp;nbsp;ofExactType.&lt;br /&gt;
&lt;br /&gt;
Examples of the functions mentioned above are shown below:&lt;br /&gt;
&lt;pre class="f-sharp" name="code"&gt;module FsUnit.``Given a bunch of random tests``

open NUnit.Framework
open FsUnit

[&amp;lt;Test&amp;gt;]
let ``When 11 it should be greater than 10``() =
    11 |&amp;gt; should be (greaterThan 10)

[&amp;lt;Test&amp;gt;]
let ``When 11 it should be greater than or equal to 10``() =
    11 |&amp;gt; should be (greaterThanOrEqualTo 10)

[&amp;lt;Test&amp;gt;]
let ``When 10 it should be less than 11``() =
    10 |&amp;gt; should be (lessThan 11)

[&amp;lt;Test&amp;gt;]
let ``When 10 it should be less than or equal to 11``() =
    10 |&amp;gt; should be (lessThanOrEqualTo 11)

[&amp;lt;Test&amp;gt;]
let ``When an empty List it should fail to contain item``() =
    shouldFail (fun () -&amp;gt; [] |&amp;gt; should contain 1)

[&amp;lt;Test&amp;gt;]
let ``When fsharp it should end with rp``() =
    "fsharp" |&amp;gt; should endWith "rp"

[&amp;lt;Test&amp;gt;]
let ``When fsharp it should start with fs``() =
    "fsharp" |&amp;gt; should startWith "fs"

[&amp;lt;Test&amp;gt;]
let ``When 1 it should be of exact type int``() =
    1 |&amp;gt; should be ofExactType&amp;lt;int&amp;gt;&lt;/pre&gt;
&lt;br /&gt;
An example of what this looks like when run in Resharper's Test Runner is shown below:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://freshbrewedcode.com/danmohl/files/2011/12/FsUnitExample.png" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img alt="" class="aligncenter size-medium wp-image-130" height="225" src="http://freshbrewedcode.com/danmohl/files/2011/12/FsUnitExample-300x225.png" title="FsUnitExample" width="300" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
A Side Note: If you haven't written many tests in F#, the lack of spaces in the test names may surprise you. This is a feature of F# that allows almost any sequence of characters to be enclosed in double-backtick characters (i.e. ``) and consequently treated as an identifier.&lt;br /&gt;
&lt;br /&gt;
I hope you enjoy the latest enhancements to FsUnit. You can find the full source at &lt;a href="http://fsunit.codeplex.com/"&gt;http://fsunit.codeplex.com/&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4853877730213459430-8345149735946974722?l=bloggemdano.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://bloggemdano.blogspot.com/feeds/8345149735946974722/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://bloggemdano.blogspot.com/2011/12/enhancements-to-fsunit-version-0911.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/8345149735946974722?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/8345149735946974722?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BloggemDano/~3/XYi26XGUqF4/enhancements-to-fsunit-version-0911.html" title="Enhancements to FsUnit (version 0.9.1.1)" /><author><name>Daniel Mohl</name><uri>http://www.blogger.com/profile/17462870714458080019</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="18" src="http://1.bp.blogspot.com/_HK2nW1E0B3s/SO875zZECAI/AAAAAAAAAAM/A8QGI_N1ev8/S220/danProfile.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://bloggemdano.blogspot.com/2011/12/enhancements-to-fsunit-version-0911.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkcNQX08fCp7ImA9WhRRF0U.&quot;"><id>tag:blogger.com,1999:blog-4853877730213459430.post-3726823759522866256</id><published>2011-12-01T17:05:00.001-08:00</published><updated>2011-12-01T17:08:10.374-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-01T17:08:10.374-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET MVC 4" /><category scheme="http://www.blogger.com/atom/ns#" term="F#" /><category scheme="http://www.blogger.com/atom/ns#" term="Project Templates" /><title>Building an ASP.NET MVC 4 Solution with F# and C#</title><content type="html">There is a &lt;a href="http://visualstudiogallery.msdn.microsoft.com/3d2bf938-fc9e-403c-90b3-8de27dc23095"&gt;new project template&lt;/a&gt; available on Visual Studio Gallery for creating &lt;a href="http://www.asp.net/mvc/mvc4"&gt;ASP.NET MVC 4&lt;/a&gt; solutions with F# and C#. The current release of this project template allows creation of an empty ASP.NET MVC 4 web application (either ASPX or Razor), a F# project for controllers/models/etc., and an optional F# project that can be used to contain unit tests. The project creation wizard dialog box is shown below:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://freshbrewedcode.com/danmohl/files/2011/11/FsCsMvc4ProjWizDialog.png" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img alt="" class="aligncenter size-medium wp-image-36" height="199" src="http://freshbrewedcode.com/danmohl/files/2011/11/FsCsMvc4ProjWizDialog-300x199.png" title="F# and C# ASP.NET MVC 4 Project Creation Wizard Dialog" width="300" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
In the future, this template will be extended to include at least one additional project type.&lt;br /&gt;
&lt;br /&gt;
To get the template, do the following (Note: Visual Studio 2010/11 Professional (or above) is required to use this template.):&lt;br /&gt;
&lt;br /&gt;
1. In Visual Studio, navigate to File | New and select Online Templates.&lt;br /&gt;
&lt;br /&gt;
2. Search for "fsharp mvc" and select the F# C# MVC 4 project template (see below):&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://freshbrewedcode.com/danmohl/files/2011/12/VSG_MVC4.png" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img alt="" class="aligncenter size-medium wp-image-107" height="169" src="http://freshbrewedcode.com/danmohl/files/2011/12/VSG_MVC4-300x169.png" title="FsMVC_4 " width="300" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
The solution that was used to build this template can be found at &lt;a href="https://github.com/dmohl/FsCsMvc4Template"&gt;https://github.com/dmohl/FsCsMvc4Template&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4853877730213459430-3726823759522866256?l=bloggemdano.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://bloggemdano.blogspot.com/feeds/3726823759522866256/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://bloggemdano.blogspot.com/2011/12/building-aspnet-mvc-4-solution-with-f.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/3726823759522866256?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/3726823759522866256?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BloggemDano/~3/283pJiIldPo/building-aspnet-mvc-4-solution-with-f.html" title="Building an ASP.NET MVC 4 Solution with F# and C#" /><author><name>Daniel Mohl</name><uri>http://www.blogger.com/profile/17462870714458080019</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="18" src="http://1.bp.blogspot.com/_HK2nW1E0B3s/SO875zZECAI/AAAAAAAAAAM/A8QGI_N1ev8/S220/danProfile.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://bloggemdano.blogspot.com/2011/12/building-aspnet-mvc-4-solution-with-f.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU4HR3oyfyp7ImA9WhRRFkQ.&quot;"><id>tag:blogger.com,1999:blog-4853877730213459430.post-4460077902908184928</id><published>2011-11-29T18:48:00.001-08:00</published><updated>2011-11-30T16:05:36.497-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-30T16:05:36.497-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="JavaScript" /><category scheme="http://www.blogger.com/atom/ns#" term="CoffeeScript" /><category scheme="http://www.blogger.com/atom/ns#" term="QUnit" /><category scheme="http://www.blogger.com/atom/ns#" term="Pavlov" /><title>Getting Setup for JavaScript Testing with Pavlov</title><content type="html">I've talked about testing CoffeeScript with Pavlov &lt;a href="http://bloggemdano.blogspot.com/2011/09/unit-testing-jquery-plugin-with.html"&gt;in a previous post&lt;/a&gt;. Today, I'm going to talk about a couple of ways to quickly get started with &lt;a href="https://github.com/mmonteleone/pavlov"&gt;Pavlov&lt;/a&gt;--a BDD API that sits on top of QUnit--in an ASP.NET web app.&lt;br /&gt;
&lt;br /&gt;
In the past, whenever I wanted to start creating Pavlov specs, I would go out to the &lt;a href="https://github.com/mmonteleone/pavlov"&gt;Pavlov GitHub site&lt;/a&gt;, grab the appropriate files, and add them to my web app. While this process isn't all that time consuming, there is now a better way. Now I can simply install the &lt;a href="http://nuget.org/List/Packages/Pavlov"&gt;Pavlov NuGet package&lt;/a&gt; using the &lt;a href="http://nuget.org/"&gt;NuGet Visual Studio Extension&lt;/a&gt;. This package adds a folder named Specs under the Scripts folder that includes a barebones html file and pavlov.js.&lt;br /&gt;
&lt;br /&gt;
An example of what the file structure looks like after this package is installed is shown below:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://freshbrewedcode.com/danmohl/files/2011/11/Pavlov.NuGet_.png" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img alt="" class="aligncenter size-full wp-image-59" height="204" src="http://freshbrewedcode.com/danmohl/files/2011/11/Pavlov.NuGet_.png" title="Pavlov.NuGet" width="256" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
If I prefer to have a simple example to start with, I can alternatively install the &lt;a href="http://nuget.org/List/Packages/Pavlov.Sample"&gt;Pavlov.Sample package&lt;/a&gt;. This adds the same files as the Pavlov package, but also includes an example.specs.js file with the code from&amp;nbsp;the &lt;a href="https://github.com/mmonteleone/pavlov/blob/master/example/example.specs.js"&gt;example on the Pavlov GitHub site&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Lastly, I've been writing a fair amount of CoffeeScript lately, so I may prefer to have the sample specs written in CoffeeScript. All that is needed for this is to make sure that &lt;a href="http://visualstudiogallery.msdn.microsoft.com/2b96d16a-c986-4501-8f97-8008f9db141a"&gt;Mindscape Web WorkBench Visual Studio Extension&lt;/a&gt;&amp;nbsp;is installed&amp;nbsp;(this is a onetime install) and then install the &lt;a href="http://nuget.org/List/Packages/Pavlov.Coffee"&gt;Pavlov.Coffee NuGet package&lt;/a&gt;. The files are then added to the project including a example.specs.coffee file that looks like this:&lt;br/&gt;&lt;br /&gt;
&lt;script src="https://gist.github.com/1407758.js?file=pavlovNuGutEx.coffee"&gt;
&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4853877730213459430-4460077902908184928?l=bloggemdano.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://bloggemdano.blogspot.com/feeds/4460077902908184928/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://bloggemdano.blogspot.com/2011/11/getting-setup-for-javascript-testing.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/4460077902908184928?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/4460077902908184928?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BloggemDano/~3/yE3I01kZ3m0/getting-setup-for-javascript-testing.html" title="Getting Setup for JavaScript Testing with Pavlov" /><author><name>Daniel Mohl</name><uri>http://www.blogger.com/profile/17462870714458080019</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="18" src="http://1.bp.blogspot.com/_HK2nW1E0B3s/SO875zZECAI/AAAAAAAAAAM/A8QGI_N1ev8/S220/danProfile.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://bloggemdano.blogspot.com/2011/11/getting-setup-for-javascript-testing.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU8CSX84eCp7ImA9WhRREkk.&quot;"><id>tag:blogger.com,1999:blog-4853877730213459430.post-4855981171252495872</id><published>2011-11-24T18:44:00.001-08:00</published><updated>2011-11-25T09:57:48.130-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-25T09:57:48.130-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="WPF" /><category scheme="http://www.blogger.com/atom/ns#" term="Visual Studio 11" /><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET MVC" /><category scheme="http://www.blogger.com/atom/ns#" term="Windows Phone 7" /><category scheme="http://www.blogger.com/atom/ns#" term="Silverlight" /><category scheme="http://www.blogger.com/atom/ns#" term="Project Templates" /><title>Building F# Solutions in Visual Studio 11</title><content type="html">I love to learn about new technology, seek to continually improve, and always look for ways to make things easier. I then do all that I can to share the knowledge, code, and/or tools that help to achieve these goals. With these goals in mind, I've joined with several friends in the creation of a new blogging community named &lt;a href="http://www.freshbrewedcode.com/"&gt;Fresh Brewed Code&lt;/a&gt;. I'd strongly recommend keeping a close eye on the other Fresh Brewed Coders, as they will be producing some awesome content. You can see the announcement at&amp;nbsp;&lt;a href="http://freshbrewedcode.com/blog/2011/11/23/welcome-to-fresh-brewed-code/"&gt;http://freshbrewedcode.com/blog/2011/11/23/welcome-to-fresh-brewed-code/&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
One of the other ways that I have attempted to achieve the goals mentioned above is through the creation of a number of Visual Studio project and item templates. Over the last several days, there have been updates to almost all of these templates. In this post I'll describe the changes that have been made--most of which have been implemented to allow support for the Developer Preview of Visual Studio 11 and F# 3.0.&lt;br /&gt;
&lt;br /&gt;
I'm sure that you have used Visual Studio Gallery by now, but just in case you haven't yet had the chance, see&amp;nbsp;&lt;a href="http://bloggemdano.blogspot.com/2010/08/f-templates-now-on-visual-studio.html"&gt;http://bloggemdano.blogspot.com/2010/08/f-templates-now-on-visual-studio.html&lt;/a&gt; for how to get started. A screenshot of the Online templates view from the Developer Preview of Visual Studio 11 is shown below:
&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: center;"&gt;
&lt;a href="http://freshbrewedcode.com/danmohl/files/2011/11/VS11_VisualStudioGallery.png"&gt;&lt;img alt="" class="aligncenter size-large wp-image-12" height="217" src="http://freshbrewedcode.com/danmohl/files/2011/11/VS11_VisualStudioGallery-1024x443.png" title="Visual Studio 11 Online Project Templates" width="502" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;ASP.NET MVC:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://visualstudiogallery.msdn.microsoft.com/f57aa816-e96b-4133-ab5d-9b9b99914ead"&gt;F# and C# ASP.NET MVC3&lt;/a&gt;&amp;nbsp;-&amp;nbsp;This project template generates the standard ASP.NET MVC 3 template output with separate projects for the view (ASPX in a C# project) and controllers/models (in a F# project). The latest release (version 1.3)&amp;nbsp;adds support for Visual Studio 11 and F# 3.0. You will need to install the ASP.NET MVC 3 Tools Update (see &lt;a href="http://www.asp.net/mvc/mvc3"&gt;http://www.asp.net/mvc/mvc3&lt;/a&gt;&amp;nbsp;and make sure to download/install the correct version for Visual Studio 10 or Visual Studio 11) to use this template.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://visualstudiogallery.msdn.microsoft.com/4fa9f910-f24e-4f99-873b-7fe56e26b054"&gt;F# C# MVC 3&amp;nbsp;&lt;/a&gt;&amp;nbsp;-&amp;nbsp;This is a dynamic project template that generates an empty ASP.NET MVC 3 solution with separate projects for view (C# - either ASPX or Razor), core (F#), and an optional F# project for unit tests. The template is based on the MSDN Magazine article entitled "Authoring an F#/C# VSIX Project Template" which can be found at&amp;nbsp;&lt;a href="http://msdn.microsoft.com/en-us/magazine/hh456399.aspx"&gt;http://msdn.microsoft.com/en-us/magazine/hh456399.aspx&lt;/a&gt;.&amp;nbsp;You will need to install the ASP.NET MVC 3 Tools Update (see&amp;nbsp;&lt;a href="http://www.asp.net/mvc/mvc3"&gt;http://www.asp.net/mvc/mvc3&lt;/a&gt;&amp;nbsp;and make sure to download/install the correct version for Visual Studio 10 or Visual Studio 11) to use this template. Version 1.1 adds support for Visual Studio 11 and F# 3.0.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;WPF:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://visualstudiogallery.msdn.microsoft.com/ad49fd5c-930c-4fe6-a30e-2d0d6778c565"&gt;F# Windows App (WPF, MVVM)&lt;/a&gt; - This project template generates a F# WPF solution with logical separation between View, ViewModel, Model, and Repository. The latest release (version 1.8) resolves a few bugs and adds support for Visual Studio 11 and F# 3.0.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://visualstudiogallery.msdn.microsoft.com/37e2558c-b6df-401a-9a2e-b14c714c4d22"&gt;F# and C# Windows App (WPF, MVVM)&lt;/a&gt; -&amp;nbsp;This is a project template that generates a WPF solution with separation between View (C#), ViewModel (F#), Model (F#), and Repository (F#).&amp;nbsp;The latest release (version 1.7) resolves a few bugs and adds support for Visual Studio 11 and F# 3.0.

&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;Web Service:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://visualstudiogallery.msdn.microsoft.com/279345a4-f189-4d1f-98fe-6b1af322d164"&gt;F# and C# Web Service (ASP.NET, WSDL)&lt;/a&gt; -&amp;nbsp;This is a project template that generates a Web Service (WSDL) solution with separate projects for web (C#), services (F#), and contracts (F#). The underlying technology is Windows Communication Foundation. Version 1.5 adds support for Visual Studio 11 and F# 3.0.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Silverlight:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://visualstudiogallery.msdn.microsoft.com/64f3d710-04c1-42d2-9e5d-4e20a19a7666"&gt;F# C# Web App (Silverlight)&lt;/a&gt; -&amp;nbsp;This project template generates a Silverlight solution with separate projects for View (C#) and Core (F#). &amp;nbsp;The Core project includes logical separation between ViewModel, Model, and RemoteFacade. You should install the &lt;a href="http://www.microsoft.com/download/en/details.aspx?id=18149"&gt;Silverlight 4 developer tools&lt;/a&gt;&amp;nbsp;and/or the&amp;nbsp;&lt;a href="http://www.microsoft.com/download/en/details.aspx?id=27220"&gt;Silverlight 5 developer tools&lt;/a&gt;&amp;nbsp;plus the&amp;nbsp;&lt;a href="http://www.microsoft.com/download/en/details.aspx?id=11100"&gt;April 2011 F# CTP&lt;/a&gt;.&amp;nbsp;Version 1.2 adds support for Visual Studio 11 and includes a template wizard dialog that allows selection of Silverlight version 4 or 5. The determination of whether to display the wizard dialog is triggered off of the installed F# Silverlight client version. It will only display if both 4 and 5 are installed. Note: There are not yet F# 3.0 Silverlight DLLs. Because of this, the current version only support F# 2.0.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://visualstudiogallery.msdn.microsoft.com/f0e9a557-3fd6-41d9-8518-c1735b382c73"&gt;F# Web Application (Silverlight)&lt;/a&gt; -&amp;nbsp;This F# project template generates a Silverlight project with logical separation between View, ViewModel, Model, and RemoteFacade. You should install the&amp;nbsp;&lt;a href="http://www.microsoft.com/download/en/details.aspx?id=18149"&gt;Silverlight 4 developer tools&lt;/a&gt;&amp;nbsp;and/or the&amp;nbsp;&lt;a href="http://www.microsoft.com/download/en/details.aspx?id=27220"&gt;Silverlight 5 developer tools&lt;/a&gt;&amp;nbsp;plus the&amp;nbsp;&lt;a href="http://www.microsoft.com/download/en/details.aspx?id=11100"&gt;April 2011 F# CTP&lt;/a&gt;.&amp;nbsp;Version 1.4 adds support for Visual Studio 11 and includes a dialog that allows selection of the desired Silverlight Version 4 or 5 (depending on installations). Note: There are not yet F# 3.0 Silverlight DLLs. Because of this, the current version only support F# 2.0.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://visualstudiogallery.msdn.microsoft.com/5932f48f-72fd-4cb2-86a1-83487147ab98"&gt;F# Empty Web Application (Silverlight)&lt;/a&gt; - This project template is similar to the F# Web Application (Silverlight) template; however, it does not include all of the example code.&amp;nbsp;You should install the&amp;nbsp;&lt;a href="http://www.microsoft.com/download/en/details.aspx?id=18149"&gt;Silverlight 4 developer tools&lt;/a&gt;&amp;nbsp;and/or the&amp;nbsp;&lt;a href="http://www.microsoft.com/download/en/details.aspx?id=27220"&gt;Silverlight 5 developer tools&lt;/a&gt;&amp;nbsp;plus the&amp;nbsp;&lt;a href="http://www.microsoft.com/download/en/details.aspx?id=11100"&gt;April 2011 F# CTP&lt;/a&gt;.&amp;nbsp;Version 1.1 adds support for Visual Studio 11, removes the C# host application, adds support to generate an HTML test file, and provides functionality to select the desired Silverlight version 4 or 5 (depending on the installation). Note: There are not yet F# 3.0 Silverlight DLLs. Because of this, the current version only support F# 2.0.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://visualstudiogallery.msdn.microsoft.com/2a19db5a-3c3b-4184-b8e8-84993b0939a2"&gt;F# 2.0 Silverlight Library (for Visual Studio 11)&lt;/a&gt; - This is a project template that generates a F# 2.0 Silverlight project. It targets Visual Studio 11 only and will only be needed temporarily. You can read more about this template at&amp;nbsp;&lt;a href="http://bloggemdano.blogspot.com/2011/11/f-silverlight-library-template-in.html"&gt;http://bloggemdano.blogspot.com/2011/11/f-silverlight-library-template-in.html&lt;/a&gt;.&amp;nbsp;Note: There are not yet F# 3.0 Silverlight DLLs. Because of this, the current version only support F# 2.0.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;XAML Item Templates:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://visualstudiogallery.msdn.microsoft.com/06c6ece1-2084-4083-a0f7-934fce9d22fb"&gt;F# XAML Item Templates&lt;/a&gt; - This Visual Studio Extension provides a number of item templates that make working with F# XAML based projects (i.e. the WPF, Silverlight, and/or Windows Phone 7 project templates) much easier. Without these item templates adding new XAML files to one of these projects is a bit of a pain. You have to create a text or xml file, change the extension to .xaml, manually add the default XAML code, and change the Build Action for the .xaml file to Resource. Version 1.1&amp;nbsp;adds item templates for Windows Phone 7 (I'll talk more about this in a future post) and adds support for Visual Studio 11.&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&lt;strong&gt;Project Templates That Do Not Currently Support Visual Studio 11:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Since the Developer Preview of Visual Studio 11 does not currently support Windows Phone 7 development, the Windows Phone 7 templates (i.e.&amp;nbsp;&lt;a href="http://visualstudiogallery.msdn.microsoft.com/ed6f38a8-c986-4d26-8846-988d49c8a26a"&gt;C# WP7 with Caliburn.Micro&lt;/a&gt;, &lt;a href="http://visualstudiogallery.msdn.microsoft.com/17454c58-c1d9-4640-afe1-7943db13891e"&gt;F# and C# Win Phone App (Silverlight)&lt;/a&gt;, &lt;a href="http://visualstudiogallery.msdn.microsoft.com/52928c6e-f77f-4ebd-a2f9-9815111bfa33"&gt;F# and C# Win Phone List App (Silverlight)&lt;/a&gt;, and &lt;a href="http://visualstudiogallery.msdn.microsoft.com/1e70ea3a-c564-4199-8915-b651a0035bbe"&gt;F# and C# Win Phone Panorama&lt;/a&gt;) have not yet been updated to support Visual Studio 11. This will be added as soon as a release of Visual Studio 11 is provided that does include this support.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://visualstudiogallery.msdn.microsoft.com/c36619e5-0d4a-4067-8ced-decd18e834c9"&gt;F# and C# Web App (ASP.NET, MVC 2)&lt;/a&gt;&amp;nbsp;- There is not currently an ASP.NET MVC 2 install for Visual Studio 11 and I don't anticipate one to ever be provided. Because of this, I have not (and do not intend to) add support for Visual Studio 11 to this project template.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4853877730213459430-4855981171252495872?l=bloggemdano.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://bloggemdano.blogspot.com/feeds/4855981171252495872/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://bloggemdano.blogspot.com/2011/11/building-f-solutions-in-visual-studio.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/4855981171252495872?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/4855981171252495872?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BloggemDano/~3/i7Usnq3cVTE/building-f-solutions-in-visual-studio.html" title="Building F# Solutions in Visual Studio 11" /><author><name>Daniel Mohl</name><uri>http://www.blogger.com/profile/17462870714458080019</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="18" src="http://1.bp.blogspot.com/_HK2nW1E0B3s/SO875zZECAI/AAAAAAAAAAM/A8QGI_N1ev8/S220/danProfile.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://bloggemdano.blogspot.com/2011/11/building-f-solutions-in-visual-studio.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0ANQ3s_fip7ImA9WhRSFE0.&quot;"><id>tag:blogger.com,1999:blog-4853877730213459430.post-6957342215037845858</id><published>2011-11-15T10:00:00.001-08:00</published><updated>2011-11-15T18:16:32.546-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-15T18:16:32.546-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="CoffeeScript" /><category scheme="http://www.blogger.com/atom/ns#" term="jQuery" /><title>A Pinch of CoffeeScript Sugar - Part 1</title><content type="html">In this series, I plan to point out and provide a few examples of some cool&amp;nbsp;syntactic&amp;nbsp;sugar provided by CoffeeScript.&amp;nbsp;In this post, I'll talk about destructuring assignment and splats.&lt;br /&gt;
&lt;br /&gt;
I've shown how to write a jQuery plugin in CoffeeScript in a&lt;a href="http://bloggemdano.blogspot.com/2011/09/unit-testing-jquery-plugin-with.html"&gt; previous post&lt;/a&gt;. In the following example, I take that simple jQuery plugin and add a little more sugar.&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/1367682.js?file=CoffeeScriptDestructExample.coffee"&gt;
&lt;/script&gt;
The above example is based on the recommendations defined in the&amp;nbsp;&lt;a href="http://docs.jquery.com/Plugins/Authoring"&gt;jQuery&amp;nbsp;Plugins/Authoring documentation&lt;/a&gt;. There are a couple of interesting aspects of this code.&lt;br /&gt;
&lt;br /&gt;
Line 10 (i.e. &lt;b&gt;[_, args...] = arguments&lt;/b&gt;) is using two cool CoffeeScript features. The first is something called destructuring assignment. This feature allows you to take data from arrays or objects and place that data into something more wieldy. In this case, we are taking the &lt;a href="https://developer.mozilla.org/en/JavaScript/Reference/Functions_and_function_scope/arguments"&gt;JavaScript arguments object&lt;/a&gt;, destructuring it, and assigning all of the arguments except the first one to an array named args. This eliminates the need for me to type &lt;b&gt;Array.prototype.slice.call(arguments, 1)&lt;/b&gt;. If I had not used a splat (i.e ...), this would have assigned only the second argument to args. Note: Destructuring assignment has been added to &lt;a href="https://developer.mozilla.org/en/New_in_JavaScript_1.7"&gt;JavaScript 1.7&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
The second thing of interest on this line (which I've already briefly mentioned) is the use of the splat. The splat allows you to easily work with anything that involves a variable number of arguments. Since line 10 potentially involves more than 2 passed arguments, this is a perfect place to use a splat. As I mentioned before, the use of the splat in this case will generate JavaScript to slice the arguments array i.e.&amp;nbsp;&lt;b&gt;Array.prototype.slice.call(arguments, 1)&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
Lines 11 and 13 also use a splat, but the reasoning behind its use on these lines is slightly different. While this is still related to a varying number of arguments, it has to do with the passing of those arguments to a function rather than retrieval of the additional argument values. The splat in this case will generate JavaScript that uses the Function.apply method.&lt;br /&gt;
&lt;br /&gt;
A little bit of sugar can make things much sweeter (ug...that was bad). I hope you find this post helpful and that you find lots of uses for the described features.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4853877730213459430-6957342215037845858?l=bloggemdano.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://bloggemdano.blogspot.com/feeds/6957342215037845858/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://bloggemdano.blogspot.com/2011/11/pinch-of-coffeescript-sugar-part-1.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/6957342215037845858?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/6957342215037845858?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BloggemDano/~3/aMzAZgLli6Q/pinch-of-coffeescript-sugar-part-1.html" title="A Pinch of CoffeeScript Sugar - Part 1" /><author><name>Daniel Mohl</name><uri>http://www.blogger.com/profile/17462870714458080019</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="18" src="http://1.bp.blogspot.com/_HK2nW1E0B3s/SO875zZECAI/AAAAAAAAAAM/A8QGI_N1ev8/S220/danProfile.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://bloggemdano.blogspot.com/2011/11/pinch-of-coffeescript-sugar-part-1.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEYEQX44eip7ImA9WhRSEko.&quot;"><id>tag:blogger.com,1999:blog-4853877730213459430.post-3170633636777785748</id><published>2011-11-12T09:57:00.001-08:00</published><updated>2011-11-14T05:08:20.032-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-14T05:08:20.032-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="F#" /><category scheme="http://www.blogger.com/atom/ns#" term="Silverlight" /><category scheme="http://www.blogger.com/atom/ns#" term="Project Templates" /><category scheme="http://www.blogger.com/atom/ns#" term="VS2011" /><title>F# Silverlight Library Template in Visual Studio 11</title><content type="html">If you have played with Visual Studio 11 much, you may have noticed that there isn't a F# Silverlight Library template out-of-the-box. This is presumably due to the fact that the current release of Visual Studio 11 is just a developer preview and there doesn't appear to be a version of F# 3.0 for Silverlight just yet. However, this doesn't stop you from creating Silverlight projects that target F# 2.0 in Visual Studio 11. In order to help you do this, I've created a project template that allows you to create a F# 2.0 Silverlight Library in Visual Studio 11. You can download the VSIX from &lt;a href="http://visualstudiogallery.msdn.microsoft.com/2a19db5a-3c3b-4184-b8e8-84993b0939a2?SRC=Home"&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;div style="font-family: Verdana; font-size: 13px;"&gt;
The following&amp;nbsp;prerequisites exist for using this library:&lt;/div&gt;
&lt;div style="font-family: Verdana; font-size: 13px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana; font-size: 13px;"&gt;
1. Download and install&amp;nbsp;the VS2011 Preview with F# 3.0 (see&amp;nbsp;&lt;a href="http://blogs.msdn.com/b/fsharpteam/archive/2011/09/14/f-3-0-developer-preview-now-available.aspx" style="color: #0d76c2; text-decoration: none;"&gt;http://blogs.msdn.com/b/fsharpteam/archive/2011/09/14/f-3-0-developer-preview-now-available.aspx&lt;/a&gt;&amp;nbsp;for more information).&lt;/div&gt;
&lt;div style="font-family: Verdana; font-size: 13px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana; font-size: 13px;"&gt;
2. Download and install the Microsoft F#, April 2011 CTP from&amp;nbsp;&lt;a href="http://www.microsoft.com/download/en/details.aspx?id=11100" style="color: #0d76c2; text-decoration: none;"&gt;http://www.microsoft.com/download/en/details.aspx?id=11100&lt;/a&gt;.&amp;nbsp;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4853877730213459430-3170633636777785748?l=bloggemdano.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://bloggemdano.blogspot.com/feeds/3170633636777785748/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://bloggemdano.blogspot.com/2011/11/f-silverlight-library-template-in.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/3170633636777785748?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/3170633636777785748?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BloggemDano/~3/YQyqT9D182Q/f-silverlight-library-template-in.html" title="F# Silverlight Library Template in Visual Studio 11" /><author><name>Daniel Mohl</name><uri>http://www.blogger.com/profile/17462870714458080019</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="18" src="http://1.bp.blogspot.com/_HK2nW1E0B3s/SO875zZECAI/AAAAAAAAAAM/A8QGI_N1ev8/S220/danProfile.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://bloggemdano.blogspot.com/2011/11/f-silverlight-library-template-in.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEQHRHsyfyp7ImA9WhRTGEo.&quot;"><id>tag:blogger.com,1999:blog-4853877730213459430.post-3048283084383203676</id><published>2011-11-09T14:05:00.000-08:00</published><updated>2011-11-09T14:05:35.597-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-09T14:05:35.597-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="F#" /><category scheme="http://www.blogger.com/atom/ns#" term="Windows Phone 7" /><category scheme="http://www.blogger.com/atom/ns#" term="Project Templates" /><title>New F# Windows Phone Library Project Template</title><content type="html">There is a new &lt;a href="http://visualstudiogallery.msdn.microsoft.com/092d3f67-c938-4e53-ba1f-3baf6a15aa89?SRC=Home"&gt;F# Windows Phone Library project template now available on Visual Studio Gallery&lt;/a&gt;. This project template allows you to add a new F# library project to a Windows Phone solution rather than having to start with one of the solution templates that is initialized with both a C# and F# project.&lt;br /&gt;
&lt;br /&gt;
As an example, you could easily build the &lt;a href="http://visualstudiogallery.msdn.microsoft.com/17454c58-c1d9-4640-afe1-7943db13891e"&gt;F# and C# Win Phone App (Silverlight)&lt;/a&gt;&amp;nbsp;solution by doing the following:&lt;br /&gt;
&lt;br /&gt;
1. Create a new C# Windows Phone Application (Silverlight).&lt;br /&gt;
2. Add a new F# Windows Phone Library project to the solution.&lt;br /&gt;
3. Add a new XML file to the F# project named MainPage.xaml.&lt;br /&gt;
4. Add content to the MainPage.xaml file as shown &lt;a href="https://github.com/dmohl/FSharpWP7BasicTemplate/blob/master/App/MainPage.xaml"&gt;here&lt;/a&gt;&amp;nbsp;(also change the Build Action option to Resource and the Copy to Output Directory option to Copy always).&lt;br /&gt;
5. Add the code from &lt;a href="https://github.com/dmohl/FSharpWP7BasicTemplate/blob/master/App/AppLogic.fs"&gt;here&lt;/a&gt;&amp;nbsp;to the File1.fs file.&lt;br /&gt;
6. Delete the MainPage.xaml and associated code-behind file from the C# project.&lt;br /&gt;
7. Change the App.xaml.cs code in the C# project to what is shown &lt;a href="https://github.com/dmohl/FSharpWP7BasicTemplate/blob/master/AppHost/App.xaml.cs"&gt;here&lt;/a&gt;&amp;nbsp;(Note: You'll likely need to change the namespace).&lt;br /&gt;
8. Change the App.xaml code in the C# project to what is shown &lt;a href="https://github.com/dmohl/FSharpWP7BasicTemplate/blob/master/AppHost/App.xaml"&gt;here&lt;/a&gt;&amp;nbsp;(Note: You'll likely need to change the namespace).&lt;br /&gt;
9. Edit the properties of the C# project and change the Startup object drop down to the *.AppHost object.&lt;br /&gt;
10. Edit the&amp;nbsp;WMAppManifest.xml file and change:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="p1"&gt;
&amp;lt;&lt;span class="s1"&gt;DefaultTask&lt;/span&gt;&amp;nbsp; &lt;span class="s2"&gt;Name&lt;/span&gt; =&lt;span class="s3"&gt;"&lt;/span&gt;_default&lt;span class="s3"&gt;"&lt;/span&gt; &lt;span class="s2"&gt;NavigationPage&lt;/span&gt;=&lt;span class="s3"&gt;"&lt;/span&gt;MainPage.xaml&lt;span class="s3"&gt;"&lt;/span&gt;/&amp;gt;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
to&amp;nbsp;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;/div&gt;
&lt;div class="p1"&gt;
&amp;lt;&lt;span class="s1"&gt;DefaultTask&lt;/span&gt;&amp;nbsp; &lt;span class="s2"&gt;Name&lt;/span&gt; =&lt;span class="s3"&gt;"&lt;/span&gt;_default&lt;span class="s3"&gt;"&lt;/span&gt;/&amp;gt;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
11. Finally, add a reference to the F# project, build, and test.&lt;/div&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4853877730213459430-3048283084383203676?l=bloggemdano.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://bloggemdano.blogspot.com/feeds/3048283084383203676/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://bloggemdano.blogspot.com/2011/11/new-f-windows-phone-library-project.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/3048283084383203676?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/3048283084383203676?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BloggemDano/~3/ckRdwjFyCi8/new-f-windows-phone-library-project.html" title="New F# Windows Phone Library Project Template" /><author><name>Daniel Mohl</name><uri>http://www.blogger.com/profile/17462870714458080019</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="18" src="http://1.bp.blogspot.com/_HK2nW1E0B3s/SO875zZECAI/AAAAAAAAAAM/A8QGI_N1ev8/S220/danProfile.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://bloggemdano.blogspot.com/2011/11/new-f-windows-phone-library-project.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0EHSXcycSp7ImA9WhRTFko.&quot;"><id>tag:blogger.com,1999:blog-4853877730213459430.post-2943590748213950462</id><published>2011-11-07T05:13:00.000-08:00</published><updated>2011-11-07T05:13:58.999-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-07T05:13:58.999-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="CoffeeScript" /><category scheme="http://www.blogger.com/atom/ns#" term="F#" /><category scheme="http://www.blogger.com/atom/ns#" term="Node.js" /><title>A Coder Interview with Dan Mohl</title><content type="html">&lt;a href="http://www.codeproject.com/KB/interviews/Interview-Dan-Mohl.aspx"&gt;A Coder Interview With Dan Mohl&lt;/a&gt; by Terrence Dorsey (&lt;a href="http://www.twitter.com/tpdorsey"&gt;@tpdorsey&lt;/a&gt;) was recently published in the &lt;a href="http://www.codeproject.com/KB/interviews/"&gt;articles section of The Code Project site&lt;/a&gt;. In it, I talk about tools, technology, and frameworks that interest me (F#, CoffeeScript, Node.js, etc.), my background, how the community has influenced my coding, and much more.&lt;br /&gt;
&lt;br /&gt;
You can find the article at&amp;nbsp;&lt;a href="http://www.codeproject.com/KB/interviews/Interview-Dan-Mohl.aspx"&gt;http://www.codeproject.com/KB/interviews/Interview-Dan-Mohl.aspx&lt;/a&gt;.&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4853877730213459430-2943590748213950462?l=bloggemdano.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://bloggemdano.blogspot.com/feeds/2943590748213950462/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://bloggemdano.blogspot.com/2011/11/coder-interview-with-dan-mohl.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/2943590748213950462?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/2943590748213950462?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BloggemDano/~3/abStnIiENHI/coder-interview-with-dan-mohl.html" title="A Coder Interview with Dan Mohl" /><author><name>Daniel Mohl</name><uri>http://www.blogger.com/profile/17462870714458080019</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="18" src="http://1.bp.blogspot.com/_HK2nW1E0B3s/SO875zZECAI/AAAAAAAAAAM/A8QGI_N1ev8/S220/danProfile.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://bloggemdano.blogspot.com/2011/11/coder-interview-with-dan-mohl.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUMGR384cCp7ImA9WhRTEEs.&quot;"><id>tag:blogger.com,1999:blog-4853877730213459430.post-8862797810363452468</id><published>2011-10-30T18:56:00.000-07:00</published><updated>2011-10-31T05:17:06.138-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-31T05:17:06.138-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Metro" /><category scheme="http://www.blogger.com/atom/ns#" term="fsharp" /><category scheme="http://www.blogger.com/atom/ns#" term="F#" /><category scheme="http://www.blogger.com/atom/ns#" term="Windows 8" /><category scheme="http://www.blogger.com/atom/ns#" term="VS2011" /><title>Calling F# Libraries from Metro Style Apps</title><content type="html">This weekend, I finally got around to trying to build a polyglot Metro style app (C# front-end + F# back-end). This post will talk about the project file changes that were required and the one outstanding issue that I'm still working. Additionally, a VSIX package is provided that provides the F# Metro Library project template as it exists today.&lt;br /&gt;
&lt;br /&gt;
Note: This approach has only been tested with the simplest of examples.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Getting Setup:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
1. In order to create a Metro style app, you need to install&amp;nbsp;&lt;a href="http://msdn.microsoft.com/en-us/windows/apps/br229516"&gt;Windows 8 Developer Preview with Developer Tools&lt;/a&gt;.&lt;br /&gt;
2. To also have F#, you'll then need to install &lt;a href="http://msdn.microsoft.com/en-us/vstudio/hh127353"&gt;Visual Studio 11 Developer Preview&lt;/a&gt;.&lt;br /&gt;
3. Now create a new C# Windows Metro style application (I chose the Application template).&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Adding F#:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
If you have installed the VSIX that is linked at the bottom of this post, you can simply add the F# Metro Library, write some code, wire it up, and test. If not, you'll need to add a standard F# Library project and modify the project file.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Modifying the F# Project File:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
To allow a F# Library project to be called from a Metro app., the project file must be modified so that it imports the Microsoft.Windows.UI.Xaml.Common.targets. While this small adjustment allows the project to be interacted with, the reference shown in the Metro style project will provide a warning indicating that something isn't quite copacetic. This warning can be eliminated by adding the following elements to the property group:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;TargetFrameworkIdentifier&amp;gt;.NETCore&amp;lt;/TargetFrameworkIdentifier&amp;gt;&amp;lt;TargetFrameworkVersion&amp;gt;v4.5&amp;lt;/TargetFrameworkVersion&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unfortunately, adding these elements causes some sort of conflict with the F# targets, which I am still working to resolve. &lt;strike&gt;I have not yet run into an issue (other than the unsightly warning display) that is caused by leaving out these two elements, so for the moment only the common Xaml targets import has been added.&lt;/strike&gt;&amp;nbsp; &amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Conclusion:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
While there is still a lot of work to do, adding the import of the common Xaml targets to the F# project file will allow you to start using F# projects from Metro style apps (Note: In simple cases only--for now). &amp;nbsp;Once the remaining issues are identified and resolved, I'll add the F# Metro Library VSIX to Visual Studio Gallery. Until then, you can find the F# Metro Library VSIX (with the known issues) &lt;a href="https://sites.google.com/site/danodocs/Home/FsMetroLibrary.vsix"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4853877730213459430-8862797810363452468?l=bloggemdano.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://bloggemdano.blogspot.com/feeds/8862797810363452468/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://bloggemdano.blogspot.com/2011/10/calling-f-libraries-from-metro-style.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/8862797810363452468?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/8862797810363452468?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BloggemDano/~3/DPOiX4uMQb8/calling-f-libraries-from-metro-style.html" title="Calling F# Libraries from Metro Style Apps" /><author><name>Daniel Mohl</name><uri>http://www.blogger.com/profile/17462870714458080019</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="18" src="http://1.bp.blogspot.com/_HK2nW1E0B3s/SO875zZECAI/AAAAAAAAAAM/A8QGI_N1ev8/S220/danProfile.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://bloggemdano.blogspot.com/2011/10/calling-f-libraries-from-metro-style.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUIARnw_fyp7ImA9WhdbGE0.&quot;"><id>tag:blogger.com,1999:blog-4853877730213459430.post-1804566147507323908</id><published>2011-10-16T16:25:00.000-07:00</published><updated>2011-10-16T16:25:47.247-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-16T16:25:47.247-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="FSharpx" /><category scheme="http://www.blogger.com/atom/ns#" term="TypeProvider" /><category scheme="http://www.blogger.com/atom/ns#" term="F#" /><title>Two New F# 3.0 Type Provider Related NuGet Packages</title><content type="html">There are two new NuGet packages available that can help you get started with authoring or consuming custom type providers. Both NuGet packages depend on the FSharpx.TypeProviders library that I wrote about in &lt;a href="http://bloggemdano.blogspot.com/2011/10/authoring-typeproviders-with.html"&gt;my last post&lt;/a&gt;&amp;nbsp;and that Mauricio introduced in &lt;a href="http://bugsquash.blogspot.com/2011/10/introducing-fsharpx.html"&gt;his most recent post&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;FSharpx.TypeProviders.Sample:&lt;/b&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-YDNStAm8Sts/TpthgohLI0I/AAAAAAAAAGY/Y8WfsDLFOPQ/s1600/SampleNuGet.PNG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="68" src="http://2.bp.blogspot.com/-YDNStAm8Sts/TpthgohLI0I/AAAAAAAAAGY/Y8WfsDLFOPQ/s640/SampleNuGet.PNG" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
The &lt;a href="http://www.nuget.org/List/Packages/FSharpx.TypeProviders.Sample"&gt;FSharpx.TypeProviders.Sample package&lt;/a&gt; provides an example of how to consume the custom type providers included in the &lt;a href="https://github.com/fsharp/fsharpx/tree/TypeProviders"&gt;FSharpx.TypeProviders&lt;/a&gt; library. The package adds a Test.config file as well as a F# source file that contains example code for using the TypedAppSettings type provider.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;FSharpx.TypeProviders.DslSample:&lt;/b&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-9ZSE_3teAsw/TptnAHPVLGI/AAAAAAAAAGo/2EyGC58HvV0/s1600/DslSampleNuGet.PNG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="70" src="http://3.bp.blogspot.com/-9ZSE_3teAsw/TptnAHPVLGI/AAAAAAAAAGo/2EyGC58HvV0/s640/DslSampleNuGet.PNG" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span id="goog_1843307837"&gt;&lt;/span&gt;&lt;span id="goog_1843307838"&gt;&lt;/span&gt;&lt;br /&gt;
The &lt;a href="http://www.nuget.org/List/Packages/FSharpx.TypeProviders.DslSample"&gt;FSharpx.TypeProviders.DslSample package&lt;/a&gt;&amp;nbsp;makes it easy to quickly get started with authoring a custom type provider. The package adds a F# source file that contains the source for a very simple custom type provider, a F# script file that can be used to test the custom type provider, and a batch file that makes it easy to do manual test/debug activities.&lt;br /&gt;
&lt;br /&gt;
You may be curious about the commands in the batch file and why they are needed. Section 5.6 of the document on &lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-21-61-89/type_2D00_provider_2D00_authoring_2D00_fsharp_2D00_3.0_2D00_developer_2D00_preview.pdf"&gt;Writing F# 3.0 Type Providers&lt;/a&gt;&amp;nbsp;that was provided by the F# team on 09/24/2011 includes development tips that make this more clear:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;
5.6.1 Run Two Visual Studio Instances. You can use one Visual Studio to develop the type provider. You can test it in another, since the test IDE will take a lock on the DLL preventing it being rebuilt. Thus, the second instance of Visual Studio must be closed while the provider is built in the first instance, and then reopened.&amp;nbsp;
&lt;br /&gt;
&lt;br /&gt;
5.6.2 Debug type providers by using invocations of fsc.exe. Type providers are invoked by&amp;nbsp;
&lt;br /&gt;
&lt;br /&gt;
- fsc.exe (The F# Command Line compiler)
&lt;br /&gt;
- fsi.exe (The F# Interactive compiler) &lt;br /&gt;
- devenv.exe (Visual Studio) &lt;br /&gt;
&lt;br /&gt;
Debugging type providers can often be easiest using fsc.exe on a test script file (e.g. script.fsx). This is because&lt;br /&gt;
&lt;br /&gt;
- You can launch debug using a command-line prompt devenv /debugexe fsc.exe script.fsx
- You can use print-to-stdout logging&lt;/blockquote&gt;
&lt;br /&gt;
I have tried both approaches and agree that the second is definitely the easiest. The .fsx and .bat files provided in this NuGet package make this approach even easier. Simply modify the code of the type provider, then test/debug by launching the batch file. Note: If/when changes to the Test.fsx file are required, it is recommended that these changes be made in an editor outside of Visual Studio.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4853877730213459430-1804566147507323908?l=bloggemdano.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://bloggemdano.blogspot.com/feeds/1804566147507323908/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://bloggemdano.blogspot.com/2011/10/two-new-f-30-type-provider-related.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/1804566147507323908?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/1804566147507323908?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BloggemDano/~3/KF8i0FzvUR8/two-new-f-30-type-provider-related.html" title="Two New F# 3.0 Type Provider Related NuGet Packages" /><author><name>Daniel Mohl</name><uri>http://www.blogger.com/profile/17462870714458080019</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="18" src="http://1.bp.blogspot.com/_HK2nW1E0B3s/SO875zZECAI/AAAAAAAAAAM/A8QGI_N1ev8/S220/danProfile.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-YDNStAm8Sts/TpthgohLI0I/AAAAAAAAAGY/Y8WfsDLFOPQ/s72-c/SampleNuGet.PNG" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://bloggemdano.blogspot.com/2011/10/two-new-f-30-type-provider-related.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0cDQns-eSp7ImA9WhdUGUU.&quot;"><id>tag:blogger.com,1999:blog-4853877730213459430.post-678727772421691414</id><published>2011-10-07T05:03:00.000-07:00</published><updated>2011-10-07T05:04:33.551-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-07T05:04:33.551-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="FSharpx" /><category scheme="http://www.blogger.com/atom/ns#" term="TypeProvider" /><category scheme="http://www.blogger.com/atom/ns#" term="F#" /><title>Authoring Type Providers with the TypeProviderDSL from FSharpx</title><content type="html">Several days ago, I submitted my &lt;a href="https://github.com/fsharp/fsharpx/blob/TypeProviders/src/FSharpx.TypeProviders/AppSettingsProvider.fs"&gt;AppSettings Type Provider&lt;/a&gt;&amp;nbsp;to the &lt;a href="https://github.com/fsharp/fsharpx/tree/TypeProviders"&gt;FSharpx&lt;/a&gt; project. FSharpx is an open source library that adds a number of useful "functional constructs on top of the core F# library". I strongly encourage checking it out.&lt;br /&gt;
&lt;br /&gt;
One of the many things in FSharpx that I find useful is the &lt;a href="https://github.com/fsharp/fsharpx/blob/TypeProviders/src/FSharpx.TypeProviders/TypeProviderDSL.fs"&gt;TypeProviderDSL&lt;/a&gt;. This is a DSL that sits on top of the ProvidedTypes module provided in the &lt;a href="http://fsharp3sample.codeplex.com/SourceControl/changeset/view/8720#195263"&gt;F# 3.0 Sample Pack&lt;/a&gt;. With this DSL and a few other helpers in FSharpx, the code from the AppSettings Type Provider that I showed in &lt;a href="http://bloggemdano.blogspot.com/2011/09/simple-appsettings-type-provider.html"&gt;a previous post&lt;/a&gt;&amp;nbsp;becomes easier to read. Plus, a few lines of code are shaved off in the process.&lt;br /&gt;
&lt;br /&gt;
Let's look at a few of the features of the TypeProviderDSL that are used by the AppSettings Type Provider.&lt;br /&gt;
&lt;br /&gt;
1. The erasedType function provides a simple way to create a ProvidedTypeDefinition.&lt;br /&gt;
2. The staticParameter function&amp;nbsp;encapsulates&amp;nbsp;the code needed to define a static parameter.&lt;br /&gt;
3. The literalField function makes it slightly easier to create a ProvidedLiteralField.&lt;br /&gt;
4. The addXmlDoc function provides a common way to add XML documentation.&lt;br /&gt;
5. Lastly, the |+&amp;gt; operator makes it very easy to add members. &lt;br /&gt;
&lt;br /&gt;
Here's the end result:&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/1269106.js?file=AppSettingsTypeProviderDSLExample.fs"&gt;
&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
You can get FSharpx.TypeProviders from the &lt;a href="http://www.nuget.org/"&gt;NuGet Gallery&lt;/a&gt; at &lt;a href="http://www.nuget.org/List/Packages/FSharpx.TypeProviders"&gt;http://www.nuget.org/List/Packages/FSharpx.TypeProviders&lt;/a&gt;&amp;nbsp;and find the source on GitHub at&amp;nbsp;&lt;a href="https://github.com/fsharp/fsharpx/tree/TypeProviders"&gt;https://github.com/fsharp/fsharpx/tree/TypeProviders&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4853877730213459430-678727772421691414?l=bloggemdano.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://bloggemdano.blogspot.com/feeds/678727772421691414/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://bloggemdano.blogspot.com/2011/10/authoring-typeproviders-with.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/678727772421691414?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/678727772421691414?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BloggemDano/~3/DHfxaVOOR7w/authoring-typeproviders-with.html" title="Authoring Type Providers with the TypeProviderDSL from FSharpx" /><author><name>Daniel Mohl</name><uri>http://www.blogger.com/profile/17462870714458080019</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="18" src="http://1.bp.blogspot.com/_HK2nW1E0B3s/SO875zZECAI/AAAAAAAAAAM/A8QGI_N1ev8/S220/danProfile.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://bloggemdano.blogspot.com/2011/10/authoring-typeproviders-with.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CE8EQHk8cCp7ImA9WhdUFkk.&quot;"><id>tag:blogger.com,1999:blog-4853877730213459430.post-2245771177834041548</id><published>2011-10-03T04:53:00.000-07:00</published><updated>2011-10-03T04:53:21.778-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-03T04:53:21.778-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET MVC 3" /><category scheme="http://www.blogger.com/atom/ns#" term="fsharp" /><category scheme="http://www.blogger.com/atom/ns#" term="VS2010 Template" /><category scheme="http://www.blogger.com/atom/ns#" term="F#" /><category scheme="http://www.blogger.com/atom/ns#" term="MSDN Magazine" /><title>MSDN Magazine Article: Authoring an F#/C# VSIX Project Template</title><content type="html">My MSDN Magazine article entitled Authoring an F#/C# VSIX Project Template is now available in the October 2011 issue of MSDN Magazine.&lt;br /&gt;
&lt;br /&gt;
A big thanks to Elijah Manor, Rick Minerich, and Chris Marinos for reviewing the article!&lt;br /&gt;
&lt;br /&gt;
You can find the online version at &lt;a href="http://msdn.microsoft.com/en-us/magazine/hh456399.aspx"&gt;http://msdn.microsoft.com/en-us/magazine/hh456399.aspx&lt;/a&gt;, the full code samples at&amp;nbsp;&lt;a href="http://fsharpmvc3vsix.codeplex.com/"&gt;http://fsharpmvc3vsix.codeplex.com/&lt;/a&gt;,&amp;nbsp;and an enhanced version of the associated VSIX on Visual Studio Gallery at &lt;a href="http://visualstudiogallery.msdn.microsoft.com/4fa9f910-f24e-4f99-873b-7fe56e26b054"&gt;F#/C# ASP.NET MVC 3 Empty Web Application Template&lt;/a&gt;&amp;nbsp;(see &lt;a href="http://bloggemdano.blogspot.com/2011/10/new-fc-aspnet-mvc-3-template.html"&gt;this previous post&lt;/a&gt; for more information about the extension that is available on Visual Studio Gallery).&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://msdn.microsoft.com/en-us/magazine/hh456399.aspx" target="_blank"&gt;&lt;img height="640" src="https://sites.google.com/site/danodocs/Home/Oct2011MsdnMagazine.PNG" width="494" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4853877730213459430-2245771177834041548?l=bloggemdano.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://bloggemdano.blogspot.com/feeds/2245771177834041548/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://bloggemdano.blogspot.com/2011/10/msdn-magazine-article-authoring-fc-vsix.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/2245771177834041548?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/2245771177834041548?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BloggemDano/~3/T945yUfoMww/msdn-magazine-article-authoring-fc-vsix.html" title="MSDN Magazine Article: Authoring an F#/C# VSIX Project Template" /><author><name>Daniel Mohl</name><uri>http://www.blogger.com/profile/17462870714458080019</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="18" src="http://1.bp.blogspot.com/_HK2nW1E0B3s/SO875zZECAI/AAAAAAAAAAM/A8QGI_N1ev8/S220/danProfile.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://bloggemdano.blogspot.com/2011/10/msdn-magazine-article-authoring-fc-vsix.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkcGSXs7fip7ImA9WhdUFUw.&quot;"><id>tag:blogger.com,1999:blog-4853877730213459430.post-791455246211875067</id><published>2011-10-01T17:07:00.000-07:00</published><updated>2011-10-01T17:07:08.506-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-01T17:07:08.506-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET MVC 3" /><category scheme="http://www.blogger.com/atom/ns#" term="fsharp" /><category scheme="http://www.blogger.com/atom/ns#" term="F#" /><category scheme="http://www.blogger.com/atom/ns#" term="Project Templates" /><title>New F#/C# ASP.NET MVC 3 Template</title><content type="html">There is a new &lt;a href="http://visualstudiogallery.msdn.microsoft.com/4fa9f910-f24e-4f99-873b-7fe56e26b054"&gt;F#/C# ASP.NET MVC 3 template&lt;/a&gt; now available on &lt;a href="http://visualstudiogallery.msdn.microsoft.com/"&gt;Visual Studio Gallery&lt;/a&gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-GqpoklHCj3c/Toeo1KpILYI/AAAAAAAAAGQ/19_9Q9HsFSc/s1600/FsNewMvc3ProjectTemplate.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="378" src="http://2.bp.blogspot.com/-GqpoklHCj3c/Toeo1KpILYI/AAAAAAAAAGQ/19_9Q9HsFSc/s640/FsNewMvc3ProjectTemplate.PNG" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
This template&amp;nbsp;requires the&amp;nbsp;ASP.NET MVC 3 Tools Refresh to be installed on the target machine and it provides functionality slightly similar to that which the Tools Refresh&amp;nbsp;adds for C#/VB. Information on installing the ASP.NET MVC 3 Tools Refresh can be found at &lt;a href="http://www.asp.net/mvc/mvc3"&gt;&lt;span style="color: #0d76c2;"&gt;http://www.asp.net/mvc/mvc3&lt;/span&gt;&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
With this project template, you will be able to create an empty ASP.NET MVC 3 Web Application. During the creation process, you will see a screen similar to the following with options that allow selection of ASPX or Razor view engine. Additionally, you can&amp;nbsp;optionally choose to include a project which can be used to contain unit tests.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-gErZfm3cMWA/Toeo6UHGygI/AAAAAAAAAGU/Xp8rlQckZ00/s1600/FsMvc3CreationWizOptions.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="426" src="http://2.bp.blogspot.com/-gErZfm3cMWA/Toeo6UHGygI/AAAAAAAAAGU/Xp8rlQckZ00/s640/FsMvc3CreationWizOptions.PNG" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
As usual, you can find the full source on &lt;a href="https://github.com/dmohl/MsdnFsVSIXExample"&gt;my GitHub&lt;/a&gt;. Note: This template is an enhanced version of a template that is described in the MSDN Magazine article entitled "&lt;a href="http://msdn.microsoft.com/en-us/magazine/hh456399.aspx"&gt;Authoring an F#/C# VSIX Project Template&lt;/a&gt;". I will be posting something about this article very soon. &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4853877730213459430-791455246211875067?l=bloggemdano.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://bloggemdano.blogspot.com/feeds/791455246211875067/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://bloggemdano.blogspot.com/2011/10/new-fc-aspnet-mvc-3-template.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/791455246211875067?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/791455246211875067?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BloggemDano/~3/_aZl4o-G6og/new-fc-aspnet-mvc-3-template.html" title="New F#/C# ASP.NET MVC 3 Template" /><author><name>Daniel Mohl</name><uri>http://www.blogger.com/profile/17462870714458080019</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="18" src="http://1.bp.blogspot.com/_HK2nW1E0B3s/SO875zZECAI/AAAAAAAAAAM/A8QGI_N1ev8/S220/danProfile.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-GqpoklHCj3c/Toeo1KpILYI/AAAAAAAAAGQ/19_9Q9HsFSc/s72-c/FsNewMvc3ProjectTemplate.PNG" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://bloggemdano.blogspot.com/2011/10/new-fc-aspnet-mvc-3-template.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0YFQn07cCp7ImA9WhdUE0g.&quot;"><id>tag:blogger.com,1999:blog-4853877730213459430.post-186410559530028591</id><published>2011-09-29T20:58:00.000-07:00</published><updated>2011-09-29T20:58:33.308-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-09-29T20:58:33.308-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="TypeProvider" /><category scheme="http://www.blogger.com/atom/ns#" term="F#" /><title>A Simple AppSettings Type Provider</title><content type="html">With the &lt;a href="http://blogs.msdn.com/b/fsharpteam/archive/2011/09/14/f-3-0-developer-preview-now-available.aspx"&gt;F# 3.0 Developer Preview&lt;/a&gt; now available, I've been spending a decent chunk of my free time playing with Type Providers. With the &lt;a href="http://blogs.msdn.com/b/fsharpteam/archive/2011/09/24/developing-f-type-providers-with-the-f-3-0-developer-preview-an-introductory-guide-and-samples.aspx"&gt;announcement of the introductory guide and samples for authoring type providers&lt;/a&gt;&amp;nbsp;I've had a hard time putting down the computer to sleep (let alone eat).&lt;br /&gt;
&lt;br /&gt;
After a fair amount of experimentation, I've written my first type provider. It is admittedly quite simple and isn't production quality, but it has been a fun exercise. The basic idea is to read the appSettings elements from a config file, parse the values appropriately, and interact with them in a type safe way.&lt;br /&gt;
&lt;br /&gt;
The sample config file looks like this:&lt;br /&gt;
&lt;pre class="xml" name="code"&gt;&amp;lt;?xml version="1.0" encoding="utf-8" ?&amp;gt;
&amp;lt;configuration&amp;gt;
    &amp;lt;appSettings&amp;gt;
        &amp;lt;add key="test2" value="Some Test Value 5"/&amp;gt;
        &amp;lt;add key="TestInt" value="102"/&amp;gt;
        &amp;lt;add key="TestBool" value="True"/&amp;gt;
        &amp;lt;add key="TestDouble" value="10.01"/&amp;gt;
    &amp;lt;/appSettings&amp;gt;
&amp;lt;/configuration&amp;gt;
&lt;/pre&gt;
Here's the TypeProvider code:&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/1251208.js"&gt;
 
&lt;/script&gt;

Lastly, here's an example of how to use it.


&lt;br /&gt;
&lt;pre class="f-sharp" name="code"&gt;#r "System"
#r @"bin\debug\AppSettingsTypeProvider.dll"

open System
open AppSettingsTypeProvider

type settings = AppSettings&amp;lt;"App.config"&amp;gt;
printfn "Test2 String: %s" settings.test2 
printfn "Test Int: %i" settings.TestInt 
printfn "Test Bool: %b" settings.TestBool  
printfn "Test Double: %f" settings.TestDouble&lt;/pre&gt;

&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4853877730213459430-186410559530028591?l=bloggemdano.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://bloggemdano.blogspot.com/feeds/186410559530028591/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://bloggemdano.blogspot.com/2011/09/simple-appsettings-type-provider.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/186410559530028591?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/186410559530028591?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BloggemDano/~3/QiRkxJx1U9I/simple-appsettings-type-provider.html" title="A Simple AppSettings Type Provider" /><author><name>Daniel Mohl</name><uri>http://www.blogger.com/profile/17462870714458080019</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="18" src="http://1.bp.blogspot.com/_HK2nW1E0B3s/SO875zZECAI/AAAAAAAAAAM/A8QGI_N1ev8/S220/danProfile.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://bloggemdano.blogspot.com/2011/09/simple-appsettings-type-provider.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0AFRnY_cCp7ImA9WhdVFkk.&quot;"><id>tag:blogger.com,1999:blog-4853877730213459430.post-1146278265451243196</id><published>2011-09-21T17:00:00.000-07:00</published><updated>2011-09-21T17:01:57.848-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-09-21T17:01:57.848-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Windows Phone" /><category scheme="http://www.blogger.com/atom/ns#" term="F#" /><category scheme="http://www.blogger.com/atom/ns#" term="Presentation" /><category scheme="http://www.blogger.com/atom/ns#" term="WP7" /><title>Presentation: Dialing Up with F# and Windows Phone 7</title><content type="html">A big thanks to Onorio for having me speak for the &lt;a href="http://migangfssig.blogspot.com/2011/09/reminder-wednesday-september-21-2001.html"&gt;MIGang FSharp Special Interest Group&lt;/a&gt; tonight.&lt;br /&gt;
&lt;br /&gt;
The slides that&amp;nbsp;accompanied&amp;nbsp;this presentation are shown below (use the mouse or the left and right arrow keys to navigate the slides):&lt;br /&gt;
&lt;br /&gt;
&lt;iframe src="http://206.72.113.77/Presentations/Deck.js/DialingUpWithFsAndWP7/Index.html" style="height: 600px; width: 100%;"&gt;&lt;/iframe&gt;
&lt;br /&gt;
&lt;br /&gt;
Additionally, these slides and the associated examples can be found on my GitHub at&amp;nbsp;&lt;a href="https://github.com/dmohl/DialingUpWithFSharpAndWP7_Presentation"&gt;https://github.com/dmohl/DialingUpWithFSharpAndWP7_Presentation&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4853877730213459430-1146278265451243196?l=bloggemdano.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://bloggemdano.blogspot.com/feeds/1146278265451243196/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://bloggemdano.blogspot.com/2011/09/presentation-dialing-up-with-f-and.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/1146278265451243196?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/1146278265451243196?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BloggemDano/~3/XubmFvOjoWc/presentation-dialing-up-with-f-and.html" title="Presentation: Dialing Up with F# and Windows Phone 7" /><author><name>Daniel Mohl</name><uri>http://www.blogger.com/profile/17462870714458080019</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="18" src="http://1.bp.blogspot.com/_HK2nW1E0B3s/SO875zZECAI/AAAAAAAAAAM/A8QGI_N1ev8/S220/danProfile.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://bloggemdano.blogspot.com/2011/09/presentation-dialing-up-with-f-and.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0UMRXY7fip7ImA9WhdVEk4.&quot;"><id>tag:blogger.com,1999:blog-4853877730213459430.post-3692147650187726527</id><published>2011-09-16T20:48:00.000-07:00</published><updated>2011-09-16T20:48:04.806-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-09-16T20:48:04.806-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="TypeProvider" /><category scheme="http://www.blogger.com/atom/ns#" term="F#" /><category scheme="http://www.blogger.com/atom/ns#" term="OData" /><title>F# Type Providers - Querying StackOverflow</title><content type="html">If you haven't yet heard, the F# 3.0 preview bits were released to the wild a couple of days ago. Congrats to the F# team for this huge accomplishment!&lt;br /&gt;
&lt;br /&gt;
One of the most anticipated features of F# 3.0 is Type Providers. Type Providers make F# the best available option for working in an information-rich world. Even though the preview has only been available for a few days, there is already quite a bit of content covering Type Providers. Here are a few examples:&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://msdn.microsoft.com/en-us/library/hh156509(v=VS.110).aspx"&gt;http://msdn.microsoft.com/en-us/library/hh156509(v=VS.110).aspx&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://blogs.msdn.com/b/fsharpteam/archive/2011/09/14/f-3-0-developer-preview-now-available.aspx"&gt;http://blogs.msdn.com/b/fsharpteam/archive/2011/09/14/f-3-0-developer-preview-now-available.aspx&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://fsharp3sample.codeplex.com/"&gt;http://fsharp3sample.codeplex.com/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Here's a simple example of querying the StackOverflow OData feed using a Type Provider:&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/1223596.js"&gt;
 
&lt;/script&gt;
&lt;br /&gt;
&lt;b&gt;How Do I Get It?&lt;/b&gt;
&lt;br /&gt;
&lt;br /&gt;
To start playing with F# 3.0, install the &lt;a href="http://msdn.microsoft.com/en-us/vstudio/hh127353"&gt;VS2011 dev preview&lt;/a&gt;&amp;nbsp;and follow any of the step-by-step instructions provided at&amp;nbsp;&lt;a href="http://msdn.microsoft.com/en-us/library/hh156509(v=VS.110).aspx"&gt;http://msdn.microsoft.com/en-us/library/hh156509(v=VS.110).aspx&lt;/a&gt;.

&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4853877730213459430-3692147650187726527?l=bloggemdano.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://bloggemdano.blogspot.com/feeds/3692147650187726527/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://bloggemdano.blogspot.com/2011/09/f-type-providers-querying-stackoverflow.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/3692147650187726527?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/3692147650187726527?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BloggemDano/~3/O7OcQTAG6Ug/f-type-providers-querying-stackoverflow.html" title="F# Type Providers - Querying StackOverflow" /><author><name>Daniel Mohl</name><uri>http://www.blogger.com/profile/17462870714458080019</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="18" src="http://1.bp.blogspot.com/_HK2nW1E0B3s/SO875zZECAI/AAAAAAAAAAM/A8QGI_N1ev8/S220/danProfile.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://bloggemdano.blogspot.com/2011/09/f-type-providers-querying-stackoverflow.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkIEQXY-eCp7ImA9WhdWGUs.&quot;"><id>tag:blogger.com,1999:blog-4853877730213459430.post-4518631495257177661</id><published>2011-09-13T18:41:00.000-07:00</published><updated>2011-09-13T18:41:40.850-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-09-13T18:41:40.850-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="jQuery Templates" /><category scheme="http://www.blogger.com/atom/ns#" term="CoffeeScript" /><category scheme="http://www.blogger.com/atom/ns#" term="jQuery" /><title>Advantages of CoffeeScript When Working with jQuery Templates</title><content type="html">Working with jQuery Templates in CoffeeScript is very similar to working with them in JavaScript.&amp;nbsp;However, there are a couple of CoffeeScript features that can make it even easier.&lt;br /&gt;
&lt;br /&gt;
Here's a simple example (based on an example in the &lt;a href="http://api.jquery.com/jQuery.template/"&gt;jQuery Template documentation&lt;/a&gt;):&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/1195435.js"&gt;
 
&lt;/script&gt;&lt;br /&gt;
As you can see, it's pretty similar to its JavaScript counterpart.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;How can CoffeeScript make this better?&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Enter Heredoc and String Interpolation...&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Heredoc:&lt;/b&gt; Heredocs allow you to specify multi-line, formatted text. This can be useful when defining the template markup.&lt;br /&gt;
&lt;br /&gt;
With heredocs, the markup from the previous example changes to this:&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/1195445.js"&gt;
 
&lt;/script&gt;&lt;br /&gt;
&lt;b&gt;String Interpolation:&lt;/b&gt; CoffeeScript also provides Ruby style string interpolation. Here's an example of the markup after taking advantage of the string interpolation feature (Note: String interpolation only occurs within double-quoted strings and double-quoted heredocs):&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/1195451.js"&gt;
 
&lt;/script&gt;
&lt;br /&gt;
&lt;b&gt;Want to see it in action?&lt;/b&gt;
&lt;br /&gt;
&lt;br /&gt;
Go to&amp;nbsp;&lt;a href="http://tinkerbin.com/w0QoscT9"&gt;http://tinkerbin.com/w0QoscT9&lt;/a&gt;,&amp;nbsp;change the JavaScript Format drop down to CoffeeScript, then click the Run button.

&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4853877730213459430-4518631495257177661?l=bloggemdano.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://bloggemdano.blogspot.com/feeds/4518631495257177661/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://bloggemdano.blogspot.com/2011/09/advantages-of-coffeescript-when-working.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/4518631495257177661?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/4518631495257177661?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BloggemDano/~3/8kizKgkTHRY/advantages-of-coffeescript-when-working.html" title="Advantages of CoffeeScript When Working with jQuery Templates" /><author><name>Daniel Mohl</name><uri>http://www.blogger.com/profile/17462870714458080019</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="18" src="http://1.bp.blogspot.com/_HK2nW1E0B3s/SO875zZECAI/AAAAAAAAAAM/A8QGI_N1ev8/S220/danProfile.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://bloggemdano.blogspot.com/2011/09/advantages-of-coffeescript-when-working.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Dk8MQnw-eCp7ImA9WhdWF0Q.&quot;"><id>tag:blogger.com,1999:blog-4853877730213459430.post-1860187383626283285</id><published>2011-09-11T19:34:00.000-07:00</published><updated>2011-09-11T19:34:43.250-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-09-11T19:34:43.250-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Accelerometer" /><category scheme="http://www.blogger.com/atom/ns#" term="Windows Phone 7" /><category scheme="http://www.blogger.com/atom/ns#" term="WP7" /><title>WP7 AccelerometerProxy in F#</title><content type="html">With the release of the&amp;nbsp;&lt;a href="http://www.microsoft.com/download/en/details.aspx?id=27153"&gt;Windows Phone 7.1 SDK RC&lt;/a&gt;, there is now an easy way to use the emulator to simulate sensor data (such as data from the accelerometer). Unfortunately, I'm doing WP7 development in a VM and haven't yet had any luck getting the new SDK functionality to work in that environment.&lt;br /&gt;
&lt;br /&gt;
I am however able to run the emulator using the&amp;nbsp;&lt;a href="http://www.microsoft.com/download/en/details.aspx?id=13890"&gt;WP7 Developer Tools RTW&lt;/a&gt;, but of course that version did not include functionality to simulate sensor data. There are a couple of options that people have identified for simulating accelerometer data (see &lt;a href="http://blois.us/blog/2010/03/labyrinth-sample-for-windows-phone.html"&gt;Example using a mouse&lt;/a&gt;, &lt;a href="http://wiimotelib.codeplex.com/"&gt;Example using a Wiimote&lt;/a&gt;, &lt;a href="http://www.codeproject.com/KB/windows-phone-7/WP7AccelerometerEmulator.aspx"&gt;Example using external app&lt;/a&gt;). For my needs, I decided to go with the mouse-driven approach.&lt;br /&gt;
&lt;br /&gt;
While I could have easily used the C# library from the previously mentioned example, I decided instead to port that example to F#. The result is show here:&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/1206392.js"&gt;
 
&lt;/script&gt;
&lt;br /&gt;
You can find the full example at&amp;nbsp;&lt;a href="https://github.com/dmohl/FsWP7Accelerometer"&gt;https://github.com/dmohl/FsWP7Accelerometer&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4853877730213459430-1860187383626283285?l=bloggemdano.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://bloggemdano.blogspot.com/feeds/1860187383626283285/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://bloggemdano.blogspot.com/2011/09/wp7-accelerometerproxy-in-f.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/1860187383626283285?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/1860187383626283285?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BloggemDano/~3/RXa5NY1Lj5Y/wp7-accelerometerproxy-in-f.html" title="WP7 AccelerometerProxy in F#" /><author><name>Daniel Mohl</name><uri>http://www.blogger.com/profile/17462870714458080019</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="18" src="http://1.bp.blogspot.com/_HK2nW1E0B3s/SO875zZECAI/AAAAAAAAAAM/A8QGI_N1ev8/S220/danProfile.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://bloggemdano.blogspot.com/2011/09/wp7-accelerometerproxy-in-f.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEEFR3Y9fSp7ImA9WhdWE0w.&quot;"><id>tag:blogger.com,1999:blog-4853877730213459430.post-8763650618061867294</id><published>2011-09-06T05:36:00.000-07:00</published><updated>2011-09-06T05:36:56.865-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-09-06T05:36:56.865-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="F#" /><category scheme="http://www.blogger.com/atom/ns#" term="PowerPack" /><title>Getting Started with the F# PowerPack - Part 4</title><content type="html">In this series, I'm walking you through various features provided by the &lt;a href="http://fsharppowerpack.codeplex.com/"&gt;F# PowerPack&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Here are the links to the previous posts:&lt;br /&gt;
&lt;br /&gt;
- &lt;a href="http://bloggemdano.blogspot.com/2011/08/getting-started-with-f-powerpack.html"&gt;Part 1&lt;/a&gt;&lt;br /&gt;
- &lt;a href="http://bloggemdano.blogspot.com/2011/08/getting-started-with-f-powerpack-part-2.html"&gt;Part 2&lt;/a&gt;&lt;br /&gt;
- &lt;a href="http://bloggemdano.blogspot.com/2011/08/getting-started-with-f-powerpack-part-3.html"&gt;Part 3&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
In this post, I'll briefly talk about Lexing, Parsing, SI (Metric) Units of Measure, Physical Constants, and Native Array.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Lexing and Parsing:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The &lt;a href="http://fsharppowerpack.codeplex.com/wikipage?title=FsLex%20Documentation"&gt;FsLex&lt;/a&gt; and &lt;a href="http://fsharppowerpack.codeplex.com/wikipage?title=FsYacc&amp;amp;referringTitle=Home"&gt;FsYacc&lt;/a&gt; documentation provides a good overview of how to get started with the lexing and parsing functionality offered by the PowerPack. As mentioned in this documentation, &lt;a href="http://visualstudiogallery.msdn.microsoft.com/a075ff98-7e6f-47ce-a23c-838c1e488046/"&gt;Jomo Fisher's Parsed Language Parser Template&lt;/a&gt; provides a great place to start from a code point of view. Note: Lexing and Parsing currently require the F# PowerPack to be installed with the &lt;a href="http://fsharppowerpack.codeplex.com/releases/view/45593#DownloadId=122710"&gt;MSI&lt;/a&gt; rather than with just the &lt;a href="http://nuget.org/List/Packages/FSPowerPack.Core.Community"&gt;NuGet package&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;SI (Metric) Units of Measurement:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Units of Measure are available in F# out-of-the-box (see &lt;a href="http://cvslab.di.unipi.it/vslab/blog/post/2011/09/05/Ammeter-interface.aspx"&gt;http://cvslab.di.unipi.it/vslab/blog/post/2011/09/05/Ammeter-interface.aspx&lt;/a&gt; for a recent example of this feature in use); however, the PowerPack contains several useful predefined units of measure. Chris Smith speaks of the F# PowerPack in his &lt;a href="http://www.amazon.com/Programming-comprehensive-writing-complex-problems/dp/0596153643"&gt;Programming F#&lt;/a&gt; book and SI units of measure is one of the highlighted features. Additionally, Andrew Kennedy has a great post on this topic: &lt;a href="http://blogs.msdn.com/b/andrewkennedy/archive/2008/09/02/units-of-measure-in-f-part-two-unit-conversions.aspx"&gt;http://blogs.msdn.com/b/andrewkennedy/archive/2008/09/02/units-of-measure-in-f-part-two-unit-conversions.aspx&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Here's a list of the SI Units that are provided:&lt;br /&gt;
&lt;br /&gt;
Meter (m), Kilogram (kg), Second (s), Ampere (A), Kelvin (K), Mole (mol), Candela (cd), Hertz (Hz), Newton (N), Pascal (Pa), Joule (J), Watt (W), Coulomb (C), Volt (V), Farad (F), Ohm (ohm), Siemens (S), Weber (Wb), Tesla (T), Henry (H), Lumen (lm), Lux (lx), Becquerel (Bq), Gray (Gy), Sievert (Sv), Katal (kat)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;PhysicalConstants:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The PowerPack also comes with a few useful predefined physical constants.&lt;br /&gt;
&lt;br /&gt;
Here's the full list (note: these are basically straight from the code comments):&lt;br /&gt;
&lt;br /&gt;
- Speed of light in vacuum&lt;br /&gt;
- Magnetic constant&lt;br /&gt;
- Electric constant&lt;br /&gt;
- Newtonian constant of gravitation&lt;br /&gt;
- Planck constant&lt;br /&gt;
- Dirac constant (a.k.a. the reduced Planck constant)&lt;br /&gt;
- Elementary charge&lt;br /&gt;
- Magnetic flux quantum h/2e&lt;br /&gt;
- Conductance quantum&lt;br /&gt;
- Electron mass&lt;br /&gt;
- Proton mass&lt;br /&gt;
- Fine-structure constant&lt;br /&gt;
- Rydberg constant&lt;br /&gt;
- Avogadro constant&lt;br /&gt;
- Faraday constant&lt;br /&gt;
- Molar gas constant&lt;br /&gt;
- Boltzmann constant R/N_A&lt;br /&gt;
- Stefan-Boltzmann constant&lt;br /&gt;
- Electron volt&lt;br /&gt;
- Unified atomic mass unit
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;NativeArray:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
NativeArray.fs provides several modules and types that can be useful when doing native interop.&lt;br /&gt;
&lt;br /&gt;
The NativeOps and Ref modules provide functions for pinning an object.&lt;br /&gt;
&lt;br /&gt;
The types that are defined include PinnedArray, PinnedArray2, NativeArray, and FortranMatrix. There are a few examples of these types in use in the &lt;a href="http://fsharppowerpack.codeplex.com/SourceControl/changeset/view/64420#685268"&gt;NativeArrayTests.fs file&lt;/a&gt; in the FSharp.PowerPack.Unittests project.&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4853877730213459430-8763650618061867294?l=bloggemdano.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://bloggemdano.blogspot.com/feeds/8763650618061867294/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://bloggemdano.blogspot.com/2011/09/getting-started-with-f-powerpack-part-4.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/8763650618061867294?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/8763650618061867294?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BloggemDano/~3/Wi0V39EDofU/getting-started-with-f-powerpack-part-4.html" title="Getting Started with the F# PowerPack - Part 4" /><author><name>Daniel Mohl</name><uri>http://www.blogger.com/profile/17462870714458080019</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="18" src="http://1.bp.blogspot.com/_HK2nW1E0B3s/SO875zZECAI/AAAAAAAAAAM/A8QGI_N1ev8/S220/danProfile.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://bloggemdano.blogspot.com/2011/09/getting-started-with-f-powerpack-part-4.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUUDRn86fSp7ImA9WhdXGEo.&quot;"><id>tag:blogger.com,1999:blog-4853877730213459430.post-3316984438025076211</id><published>2011-09-01T04:41:00.000-07:00</published><updated>2011-09-01T04:41:17.115-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-09-01T04:41:17.115-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="CoffeeScript" /><category scheme="http://www.blogger.com/atom/ns#" term="QUnit" /><category scheme="http://www.blogger.com/atom/ns#" term="jQuery Plugin" /><category scheme="http://www.blogger.com/atom/ns#" term="Pavlov" /><category scheme="http://www.blogger.com/atom/ns#" term="jQuery" /><title>Unit Testing a jQuery Plugin with CoffeeScript and Pavlov</title><content type="html">If you search the web, you'll find a handful of good examples of jQuery plugins written in CoffeeScript, but there seems to be few examples of writing unit tests/specs in CoffeeScript. In this post, I'll show a very simple jQuery plugin with Pavlov specs.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Simple Plugin&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
This plugin simply wraps the jQuery UI dialog (&lt;a href="http://jqueryui.com/demos/dialog/"&gt;http://jqueryui.com/demos/dialog/&lt;/a&gt;).
&lt;br /&gt;
&lt;pre class="f-sharp" name="code"&gt;do ($ = jQuery) -&amp;gt;
  methods = 
    init: (options) -&amp;gt;
      dialogElement = $(options.dialogSelector)
      dialog = dialogElement.dialog autoOpen: false, modal: true, resizable: false 
      $(options.inputSelector).click -&amp;gt; dialog.dialog 'open'
  
  $.fn.simple = (options) -&amp;gt; 
    settings = dialogSelector:'.dialog', inputSelector:'.input'
    if options 
      $.extend settings, options
    methods.init settings
&lt;/pre&gt;
&lt;b&gt;Pavlov Specs&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
QUnit is a JavaScript testing framework (learn more about it at &lt;a href="http://docs.jquery.com/Qunit"&gt;http://docs.jquery.com/Qunit&lt;/a&gt;) and Pavlov (&lt;a href="https://github.com/mmonteleone/pavlov"&gt;https://github.com/mmonteleone/pavlov&lt;/a&gt;) extends QUnit with several features that promote Behavior-Driven Development (BDD). Here's the example:&lt;br /&gt;
&lt;pre class="f-sharp" name="code"&gt;pavlov.specify "Simple Plugin", -&amp;gt;
  describe "Given default options", -&amp;gt; 
    before -&amp;gt; $(this).simple()
    describe "when executing a click event", -&amp;gt;
      before -&amp;gt; $('.input').click()
      it "it should open the dialog", -&amp;gt;
        assert($('.dialog').parents('.ui-dialog:visible').length).isTrue()
      after -&amp;gt;
        $('.dialog').dialog('close')
    describe "When the click event has not been executed", -&amp;gt;
      it "it should not have an open dialog", -&amp;gt;
        assert($('.dialog').parents('.ui-dialog:visible').length).isFalse()
      after -&amp;gt; 
        $('.dialog').dialog('close')

  describe "Given all custom options", -&amp;gt; 
    before -&amp;gt; 
      $(this).simple dialogSelector:'.customDialog', inputSelector:'.customInput' 
    describe "when executing a click event", -&amp;gt;
      before -&amp;gt; $('.customInput').click()
      it "it should open the custom dialog", -&amp;gt;
        assert($('.customDialog').parents('.ui-dialog:visible').length).isTrue()
      after -&amp;gt;
        $('.customDialog').dialog('close')

  describe "Given only a custom dialogSelector", -&amp;gt; 
    before -&amp;gt; $(this).simple dialogSelector:'.customDialog'
    describe "when executing a click event", -&amp;gt;
      before -&amp;gt; $('.input').click()
      it "it should open the custom dialog", -&amp;gt;
        assert($('.customDialog').parents('.ui-dialog:visible').length).isTrue()
      after -&amp;gt;
        $('.customDialog').dialog('close')

  describe "Given only a custom inputSelector", -&amp;gt; 
    before -&amp;gt; $(this).simple inputSelector:'.customInput' 
    describe "when executing a click event", -&amp;gt;
      before -&amp;gt; $('.customInput').click()
      it "it should open the dialog", -&amp;gt;
        assert($('.dialog').parents('.ui-dialog:visible').length).isTrue()
      after -&amp;gt;
        $('.dialog').dialog('close')
&lt;/pre&gt;
&lt;b&gt;The Output&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Once we have this in place and create a simple test runner page, we end up with the standard QUnit output that looks like the following:


&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-RwYVRinMEPE/Tl9s_OKjEVI/AAAAAAAAAGI/mBy0tbPK81E/s1600/PavlovTests.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="260" src="http://3.bp.blogspot.com/-RwYVRinMEPE/Tl9s_OKjEVI/AAAAAAAAAGI/mBy0tbPK81E/s640/PavlovTests.PNG" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4853877730213459430-3316984438025076211?l=bloggemdano.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://bloggemdano.blogspot.com/feeds/3316984438025076211/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://bloggemdano.blogspot.com/2011/09/unit-testing-jquery-plugin-with.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/3316984438025076211?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4853877730213459430/posts/default/3316984438025076211?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BloggemDano/~3/IvfECvwFtQs/unit-testing-jquery-plugin-with.html" title="Unit Testing a jQuery Plugin with CoffeeScript and Pavlov" /><author><name>Daniel Mohl</name><uri>http://www.blogger.com/profile/17462870714458080019</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="18" src="http://1.bp.blogspot.com/_HK2nW1E0B3s/SO875zZECAI/AAAAAAAAAAM/A8QGI_N1ev8/S220/danProfile.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-RwYVRinMEPE/Tl9s_OKjEVI/AAAAAAAAAGI/mBy0tbPK81E/s72-c/PavlovTests.PNG" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://bloggemdano.blogspot.com/2011/09/unit-testing-jquery-plugin-with.html</feedburner:origLink></entry></feed>

