July, 2012

Knockout.js pro tips – working with observable arrays

Because array manipulation doesn't have to be a bottleneck

Recently, I have been blogging mainly about Web API, but many people have been asking me about Knockout.js. And rightfully so, because it is one of the most robust Javascript client side technology right now.

I blogged about KO a couple of times here before, but I thought it might be a nice change to do it in a new format. Instead of a one big, end-to-end solution, let’s do a set of “pro tips”, small pieces of real-life advices for your Knockout solutions.

This article assumes a working knowledge of Knockout.

Continue reading

BSON (Binary JSON) and how your Web API can be even faster

Because BSON media type formatter is very useful

I have been reading the wishlist at Web API Codeplex repository recently, and noticed that one of the most popular requested features, is to add support for BSON (Binary JSON) media type (6th on the list).

Of course all it takes to include BSON into your Web API is to simply write a media type formatter for it, and since JSON.NET already has great BSON support, it is actually quite easy.

Now, you might be asking a question, why to do it in the first place? Isn’t JSON enough? Well, the main reason is performance, as according to JSON.NET tests, BSON would produce output that’s often smaller than JSON (up to 25%). It is also much quicker to encode and decode, as for simple types there is no parsing to/from their string representation.

Let’s do it then.

Continue reading

Everything you want to know about ASP.NET Web API content negotiation

Web API Content negotiation demystified

One of the key concepts in ASP.NET Web API, lying pretty much at the heart of it, is content negotiation – or simply conneg. I really believe that, before you start developing Web API solutions, you need to understand conneg well.

I thought it would be interesting to try to explain content negotiation in detail – what it is, what it does, and why it does that, especially as I have seen a lot of questions, misconceptions and misunderstandings around it on various boards or question sites.

Continue reading

Deploy your ASP.NET Web API application to Windows Azure in 3 minutes

Because cloud has never been so easy to use

Over the past months I have been blogging about ASP.NET Web API a lot. One question that I haven’t really addressed, is how to send this beast to production – because it’s one thing to develop something, and completely different to have it up and running in live environment.

While so many members of the community have really enjoyed Windows Azure since it has been unveiled in the new shape recently, a lot of people are still uncertain how to work with it – because, well, “cloud” has always sounded a little enterprise-like. I thought it might help people to have a quick step-by-step guide on how you could really easily deploy your app to Azure (using Git!).

More after the jump.

Continue reading

Run your favorite unit testing GUI directly from Visual Studio

Because it is easy and productive

If you are working a lot with unit tests and somehow are allergic to command line testing (I, for one, am) there is an easy way to configure your test project’s build to start your favorite’s library GUI automatically and load the test assembly into it.

This is very convenient and, as a bonus, allows you to set breakpoints in the test code, without having to attach to any processes.

Let’s have a quick look at how you can do that for xUnit and nUnit.

Continue reading