piotrwalat.net

CLR Diagnostics with ClrMD and ScriptCS REPL – ScriptCS.ClrDiagnostics

2 comments

WinDbg+SOS  has been used by .NET developers for years. It is a very powerful profiling/analysis tool that unfortunately is quite hard to use and exposes native-only API. By releasing ClrMD  library Microsoft makes CLR heap memory inspection accessible to regular C# developers and enables them to write customized profiling tools. I have created a simple ScriptCS script pack that allows for interactive debugging under REPL. Now we can use both C# and some of SOS features under the same console :). More after the break.

Read the rest of this entry »

Written by Piotr Walat

May 13th, 2013 at 8:00 pm

Building reactive XAML apps with ASP.NET SignalR and MVVM

2 comments

A great portion of mobile applications consumes data from HTTP services. This is usually achieved as a pull scenario in which apps initiate the data flow from the server. In many cases pushing data to the client is a more natural and potentially much better solution. In this blog post I will explore how ASP.NET SignalR can help XAML developers simplify the task of creating and consuming push services over HTTP. I will also show how to leverage MVVM pattern to create a user experience that is driven by incoming data. The example will be built for Windows Phone 8 and will use MVVM Light library.

Read the rest of this entry »

Written by Piotr Walat

May 8th, 2013 at 9:52 am

Using Redis with ASP.NET Web API

3 comments

In this article I am going to show how to use Redis as a data store in a ASP.NET Web API application. I will implement a basic scenario that leverages ServiceStack.Redis library and its strongly typed Redis client, show how to model and store one-to-many relationships and how to use Web API dependency injection capabilities along with Autofac to inject repositories into controllers.

Read the rest of this entry »

Written by Piotr Walat

March 26th, 2013 at 10:27 am

Running ASP.NET Web API services under Linux and OS X

2 comments

In this blog post I am going to show how you can host ASP.NET Web API services under Gentoo Linux and OS X on top of Mono’s ASP.NET implementation. I will use Nginx and FastCGI to communicate between HTTP server and Mono.

A couple of months ago I’ve experimented with running ASP.NET Web API on a Linux box, but ran into blocking issues caused by some functionality missing from Mono. I’ve decided to give it another go now when more recent versions of the runtime are available.

Read the rest of this entry »

Written by Piotr Walat

March 4th, 2013 at 2:00 am

HMAC authentication in ASP.NET Web API

5 comments

In this article I will explain the concepts behind HMAC authentication and will show how to write an example implementation for ASP.NET Web API using message handlers. The project will include both server and client side (using Web API’s HttpClient) bits.

Read the rest of this entry »

Written by Piotr Walat

February 28th, 2013 at 10:45 am

Arrow function expressions in TypeScript

4 comments

Along with support for standard function expressions that use the function keyword, TypeScript also introduces a concept of arrow functions. Interestingly this feature is most likely to be included in the next version of JavaScript – ECMAScript 6. Arrow functions introduce a more compact way of defining functions, but also have been designed to work particularly well with callbacks.

This is an introductory post that shows examples of arrow functions usage in TypeScript and explains how they differ from standard function expressions in terms of this keyword binding.

Read the rest of this entry »

Written by Piotr Walat

January 28th, 2013 at 8:15 am

Getting started with OData services in ASP.NET Web API

7 comments

OData is an application-level protocol that has been designed to provide data interaction operations via HTTP. Besides basic data manipulation capabilities (such as adding, deleting and updating) it also provides more advanced mechanisms such as filtering and navigation between related entities.

In this post I am going to show how to leverage some of OData features introduced to ASP.NET Web API to build example service.

Read the rest of this entry »

Written by Piotr Walat

January 22nd, 2013 at 7:35 am

Simple framerate counter for MonoGame games

leave a comment

Fluid and smooth user experience is a key element of any good Windows Store app. If you are writing a game, you most likely will want to measure and display framerate related data (current framerate, min. framerate, etc.) . In this example I am going to show how to add a simple FPS counter to a MonoGame powered game.

Read the rest of this entry »

Written by Piotr Walat

November 6th, 2012 at 10:00 am

Client certificate authentication in ASP.NET Web API and Windows Store apps

6 comments

SSL over HTTPS provides a mechanism for mutual server-client authentication. This can be used as an alternative to more commonly used username/password based approach. In this post I am going to show how to set up client certificate authentication in ASP.NET Web API application and how to use delegating handlers to provide custom logic that handles certificates and allows to introduce arbitrary authentication mechanism (eg. role based authentication). I will also show how to import client certificates into XAML Windows Store app and how to use it to authenticate to a HTTP service.

Read the rest of this entry »

ASP.NET Web API file download service with resume support

11 comments

ASP.NET Web API provides out of the box support for streaming binary files to the client. However for more advanced scenarios you need to add custom logic to handle pause/resume functionality by handling appropriate HTTP Headers. In this post I will try to address this problem and build a resume-supporting file download service using two different approaches:

  • stream wrapper for FileStream that can return partial data,
  • memory mapped files.
Memory mapped files seem to be an interesting candidate as they may offer performance benefits such as memory caching and optimized file access managed by virtual memory manager.
Read the rest of this entry »

Written by Piotr Walat

October 18th, 2012 at 8:00 am