Monday, December 31, 2012

My Top 5 Blog Posts from 2012

On this last day of 2012, I'd like to look back and share my top 5 most popular blog posts from this year.

5. On January 8, I introduced a CoffeeScript Assertion Library called ExpectThat. ExpectThat makes it easy to create expressive, self-documenting assertions in CoffeeScript with a syntax similar to that provided by FsUnit.

4. In September, an example of a Single Page Application with Backbone.js, ASP.NET Web API, and F# was provided. This was then added to the F# and C# ASP.NET MVC 4 project template.

3. At the end of January, an example was given for how to use ExpectThat with Mocha to test a jQuery plugin. This example builds on a nice post by Josh Bush entitled Testing jQuery plugins with Node.js and Jasmine and it includes examples for both browser and Node tests with Mocha and ExpectThat.

2. In March, I announced an addition to the F# and C# ASP.NET MVC 4 template that makes it easy to create modern HTTP services with ASP.NET Web API and F#.

1. And my most popular post from 2012 was an example of a Single Page Application with Knockout.js, ASP.NET Web API, and F# . This was later added as an option to the F# and C# ASP.NET MVC 4 project template.

Happy New Year!

Sunday, December 23, 2012

Buiilding Web, Cloud, and Mobile Solutions with F#

I'm happy to say that my book entitled Building Web, Cloud, and Mobile Solutions with F# is now available in both print and electronic formats. The description of the book is provided below and you can find the book examples on my GitHub.
Learn how to build key aspects of web, cloud, and mobile solutions by combining F# with various .NET and open source technologies. With helpful examples, this hands-on book shows you how to tackle concurrency, asynchrony, and other server-side challenges. You’ll quickly learn how to be productive with F#, whether you want to integrate the language into your existing web application or use it to create the next Twitter.
If you’re a mid- to senior-level .NET programmer, you’ll discover how this expressive functional-first language helps you write robust, maintainable, and reusable solutions that scale easily and target multiple devices.
  • Use F# with ASP.NET MVC, ASP.NET Web API, WCF, Windows Azure, HTML5, CSS3, jQuery Mobile, and other tools
  • Build next-generation ASP.NET MVC 4 web applications, using F# to do the heavy lifting on the server
  • Create WCF SOAP and HTTP web services
  • Develop F# web applications and services that run on Windows Azure
  • Build scalable solutions that allow reuse by mobile and web front-ends
  • Use F# with the WebSharper and Pit frameworks to build end-to-end web stacks

Monday, December 17, 2012

F# PowerPack NuGet Packages for F# 3.0, .NET 4.x, and Silverlight 5

There is a new version of each of the available F# PowerPack NuGet packages. These packages include the original F# PowerPack functionality recompiled for F# 3.0, .NET 4.x, and Silverlight 5 that were provided today on the F# PowerPack CodePlex site.

In order to use these updated NuGet packages in a .NET 4.x project, you will need to be using F# 3.0. If that is not an option for you, the previous version of each package can be installing using any of the following commands:

Install-Package FsPowerPack.Community.Sample -Version

Install-Package FsPowerPack.Community -Version

Install-Package FsPowerPack.Core.Community -Version

Install-Package FsPowerPack.Linq.Community -Version

Install-Package FsPowerPack.Metadata.Community -Version

Install-Package FsPowerPack.Parallel.Seq.Community -Version

Saturday, December 8, 2012

Using the New ASP.NET MVC 4 Template in MonoDevelop

In my last post, I showed an example of an ASP.NET MVC 4 application built in MonoDevelop. Since that time, an ASP.NET MVC 4 project template has been created for MonoDevelop that makes it very easy to create a similar app.

Here are the steps for using this template:

1. To get started, install version 3.0.2+ of Mono, the latest version of MonoDevelop, and the F# Language Binding (through the MonoDevelop Add-in Manager). If you've already installed each of these, make sure that the F# Language Binding version is 3.2.8+.

2. Create a new solution (File | New | Solution) and select F# | ASP.NET | F# ASP.NET MVC 4 (Razor) as shown here:
3. Add the desired solution name, click OK, and your done.

Well that was easy, but where do you go from here? Let's walk through a simple example of creating an app for keeping track of contacts. The end result will be similar to the screenshot shown in my post entitled A Single Page App with Backbone.js, ASP.NET Web API, and F#.

1. I've already followed the previous steps to create an ASP.NET MVC 4 application in MonoDevelop called MyContacts. To quickly add a decent look to the app, I'll use the responsive front-end framework from ZURB called Foundation. All that I really need is the CSS, so I add the foundation.min.css file to the Content folder in the project. I also add an app.css file for any custom styles that are needed. The content of the app.css file is shown below:

2. I can now reference these CSS files in _Layout.cshtml. The modified file looks like this:

3. Now I modify the Index.cshtml file in the Home folder so that it will display the list of contacts. The result is shown below:

4. Lastly we make a few modifications to the HomeController. Here's the code:

5. That's it. We can now launch the site and see the following: