2016

Open Sourcing Sendgrid Webhooks Library

Tags: csharp, github, metrics, opensource, sendgrid

It’s been a while since I wrote an open-source contribution. A while back, a mini-project I was involved required parsing of Sendgrid Webhooks in C#. As it turned out, there wasn’t much around and Sendgrid didn’t have an official library. Although at the time I pretty much stopped writing any C#, it was a good opportunity for an open source project. more

2015

Logging application metrics with StatsD

Tags: etsy, graphite, metrics, statsd

If you don’t track it, you can’t measure it. Realtime service and business metrics should be part of any production application. Knowing how is the app performing is as important as measuring whether the product impact of your changes. more

2014

2013

NDC Oslo 2013 Top Picks

Tags: conference, ndc

I just got back from NDC Oslo. It was a great week filled with some quality speakers and content. It’s very hard to pick what I enjoyed the most, because the overall quality was just so high. Nevertheless, I’m going to attempt it :-) Bear in mind it’s my subjective view and I’m happy if you disagree with me. I will update the post once the videos are up. more

Authenticate Web API using Access Tokens

Tags: aspnet, c#, webapi

In a common Web API scenario, you may want to secure your endpoints so that certain actions can only be executed by authenticated users who posses the correct permissions and are authorised to access the endpoints. For example, you would not want expose your DELETE endpoint of a resource to the general public.This problem is traditionally solved by Authentication and Authorization and your credentials are passed along with the request to the server. An alternative is to exchange the username and password for a short-lived access token and use this access token to perform the protected actions. This solution does not fit every scenario, however, it means that if the access token gets exposed, the user credentials are not revealed. more

Content Negotiation with ASP.NET Web API

Tags: asp.net, c#, mvc, webapi

An important part of Web API is resource content negotiation. The HTTP protocol RFC defines content negotiation as the process of selecting the best representation for a given response when there are multiple representations available. In practise the same resource can be represented in a variety of different ways – lets say a contact information resource can be shown in JSON representation, but also in XML or even as a PNG QR code containing the same content. more

2012

SignalR Book: Real-Time App Development

Tags: book, leanpub, signalr

About a month ago, I was approached by Packt Publishing to write a book on SignalR. The idea was to write a book that would guide you through various SignalR components using some sort of real-world example. I was up for it and the publisher seemed very keen. more

Scaling SignalR with Redis

Tags: asp.net, c#, redis, signalr, visual studio

SignalR was built with scalability in mind. Even though you will be able to run a fair number of concurrent connections on a single server instance, there will come a point where a single node will not be able to handle the load. more

Use 51Degrees.mobi to Improve Mobile Traffic Detection

Tags: 51degrees, asp.net, mobile

The default browser compatibilities mobile detection in ASP.NET in System.Web.HttpBrowserCapabilitiesBase is pretty poor. It ignores majority of the mobile devices and since it does not update on regular basis, it will ignore any new devices as well. Simply put, if you are using mobile-specific views then most mobile devices will get only the desktop views, because the device will be not recognised as a mobile device. more

Render Email Templates Using Razor Engine

Tags: asp.net, c#, razor, visual studio

A larger web projects would typically consist not only of front end web project, but would include additional class libraries and offload some of the heavy processing work to service or console apps. The common problem is then how do you update the front-end and signal the site that some work has been completed. more

SignalR-Dependency Injection

Tags: asp.net, c#, signalr, visual studio

A larger web projects would typically consist not only of front end web project, but would include additional class libraries and offload some of the heavy processing work to service or console apps. The common problem is then how do you update the front-end and signal the site that some work has been completed. more

SignalR – Push Data To Clients Using IHubContext

Tags: asp.net, c#, signalr, visual studio

The Clients dynamic property of the Hub gives you access to all clients connected to the hub within the hub class. However, what if you would like to push data to the clients from outside of the Hub class. One of the most common scenarios is when you want to push data to the clients from an admin system in your back-end. more

SignalR – Introduction to SignalR – Quick Chat App

Tags: asp.net, c#, signalr, visual studio

SignalR is an open source async signalling library. It was made by David Fowler and Damian Edwards. In a nutshell, it allows you to pass data between client and server in realtime. It’s not only for web, it has JS, .Net, WP7 and Silverlight clients and supports self-hosting so you can run the SignalR server in win service or web context. It will run on .Net 4.0 or 4.5 and to get websockets running, you will need IIS8 or IIS8 Express. That said, it will run on older versions of IIS and will switch to different transport modes. more

Deep Dive into ASP.NET Bundling and Minification

Tags: asp.net, c#, mvc, visual studio

The new **System.Web.WebPages 2.0.0.0** assembly that ships with the latest MVC4 contains a pretty cool feature that lets you override the current browser capabilities. Sure, most modern browsers let you set a custom user agent string out of the box or via extensions. However, there are certain scenarios, where you would want to switch the user agent on the server side. That’s where the **BrowserHelpers** class comes in handy. more

Bundling and Minification with ASP.NET 4.5

Tags: bundling, c#, css, javascript, mvc, visual studio

Minimising the number of requests the page has to perform can have a considerable effect on your site’s performance. IE6 and IE7 both limit the number of concurrent requests to 2, IE8 can handle up to 6. There is a lot you can to improve the initial load speed speed – one of which is bundling all your CSS and JS into two separate files. How much of a difference it could do. Well, as it turns out up to 30seconds on slower connections. more

Auto Wire-Up Your Model Binders ASP.NET MVC

Tags: asp.net, c#, mvc, visual studio

Model binding in MVC attempts to map values from IValueProviders to your specified model. The value providers (FormValueProvider, QueryStringValueProvider, HttpFileCollectionValueProvider, RouteDataValueProvider, JsonValueProviderFactory … ) abstract the actual value retrieval and binders then handle the value mapping onto the model. You can create custom model binders to abstract and centralise complex mapping logic that would otherwise end up in your controllers or services. When dealing with a larger number of binders, it is good to refactor common logic and enable wiring up of the new binders easily. Instead of having to register each binder one-by-one in global or prefix the type in the actions, we can create our own model binder broker to replace the default MVC DefaultModelBinder. more

SASS/SCSS and Compass Part 4 Spriting

Tags: asp.net, c#, castle windsor

Statistically Awesome Style Sheets with Compass can help you easily generate sprites. Not only that, it will re-generate the images, re-calculate the position and update the CSS every time you update the source images. This post explains the basics and aims to address the most common scenarios when creating sprites. more

2011

Setting Properties In Models With Strongly Typed Model Filters ASP.Net MVC C#

Tags: c#, mvc, visual studio

I like strongly typed view models in MVC. Typical structure of my site in Razor View Engine includes a page base model that is used in the Layout template and then I use inheritance to add properties to each model or commonly re-used properties. There are various reasons why to avoid dynamic in your models, besides the fact that you cannot use dynamic in master frame using razor. more

SASS with Visual Studio Part 2 Features and Syntax

Tags: css, sass, visual studio

SASS is a super-set of CSS, that means, any existing CSS that you already wrote will just work. What we usually do, is paste any legacy CSS (if any) to our SASS file and take it from there. I’ve posted few examples of the syntax below. In my next post, I will focus on the real-world usage of SASS. more

SASS with Visual Studio Part 1 Introduction

Tags: css, sass, visual studio

Syntactically Awesome Stylesheets (SASS) aims to make writing CSS easy, re-usable and less repetitive. The new SCSS (Sassy CSS) syntax makes use of variables, mixins, nested rules and inheritance to achieve this goal. Furthermore, I will show you how to use compass to leverage in-built functionality. This series of posts will not argue between SASS and LESS, it will be a quick guide on how to get up and running with SASS within VS and how SASS can help you. more