Decaying Code

Where code comes to die

Community Update 2014-04-08–#webapi, #aspnet identity, #JIT and #SIMD, #angularjs and #elasticsearch


Web Development

Dynamically Injecting Script Tags With AngularJS (


The JIT finally proposed. JIT and SIMD are getting married. (

Using AutoMapper to perform LINQ aggregations | Jimmy Bogard's Blog (

Why We’re Not Recommending “FIPS Mode” Anymore - Microsoft Security Guidance - Site Home - TechNet Blogs (


WebAPI woes | XENA (

Adding Two-Factor authentication to an ASP.NET application - Scott Hanselman (

Introduction to ASP.NET Identity : The Official Microsoft ASP.NET Site (

A sample of Onion Architecture with ASP.NET Identity - Imran Baloch's Blog (

FubuMVC Lessons Learned — Magic Conventions, Russian Dolls, and Ceremonial Code | The Shade Tree Developer on (


When ‘False’ is ‘true’ | Sebastian Bełczyk (

Community Update 2014-04-07–#OWIN and #Azure #Orleans, disabling copy/paste/cut in #jquery, #nosql fail


Must Read

NoSQL Meets Bitcoin and Brings Down Two Exchanges: The Story of Flexcoin and Poloniex ( – Very technical. Not just news.

Web Development

Disable Cut, Copy and Paste function for textbox using jQuery | Ashish's Blog (


Orleans & OWIN: A Trivial Configuration Middleware | Dapr Blog (

ASP.NET Web API/AngularJS SPA Demo App Updated - Shiju Varghese's Blog (

Adding areas support to web api - Curah! (

Assign datepicker to runtime/dynamic textboxes in ASP.NET using jQuery | Ashish's Blog (

InspectorIT/MongoDB.AspNet.Identity · GitHub ( – MongoDB backed Identity.

PowerShell script to call Web API endpoints at regular times - Stefan's Tech Notes - Blog (

Troy Hunt: ASP.NET session hijacking with Google and ELMAH (

Windows Azure

Announcing release of Visual Studio 2013 Update 2 RC and Azure SDK 2.3 (


Windows and the Internet of Things (

Community Update 2014-04-04– #bldwin Day 3, #aspconf on async with #aspnet, #nodejs and #WindowsAzure


BUILD 2014

Day 2 Keynote (

The Future of C# (

What’s New for Web Developers (

What’s New for C# Developers (

Azure Web Sites: Architecting Massive-Scale Ready-For-Business Web Apps (

Microsoft Azure Storage – What's New, Best Practices and Patterns (

Building Modern Web Applications with Visual Studio and Web Essentials (

Building Cross-Platform Line of Business Apps with Mobile Services (

WinJS Architecture & Design (

Using Node.js and Python in Visual Studio and on Azure (


Async in ASP.NET (


Introducing “Razor” – a new view engine for ASP.NET - ScottGu's Blog (


BUILD2014WebTools (

The Next Generation of .NET (

Video Tutorial and Screenshots: Windows 8.1 Update 1 - Scott Hanselman (

Glimpse - the open source diagnostics platform of the web (

Creating a Custom Scaffolder for Visual Studio (

Node.js Tools for Visual Studio 1.0 Beta (

The Release Candidate for Visual Studio 2013 Update 2 (

Windows Azure – The Cloud for Media Creators (

Community Update 2014-04-03 – #bldwin Day 2 Special– #roslyn going #oss, #windowsazure, #nodejs and #dotnet going native

As always, BUILD 2014 videos might not be there when you click on them today. They should be there as soon as possible.

As a sidenote, Roslyn is open source. My jaw is on the floor. Wow. Impressive.


BUILD 2014

BUILD: Day 1 Keynote Summary ( – If you still haven’t watched it, I would. However, if you’d rather have the summary, here it is.

Building Enterprise and SaaS Web Apps and Web APIs using Azure Active Directory for Sign In (

Visual Studio and .NET Overview (

The Present and Future of .NET in a World of Devices and Services (

Thinking for Programmers (

Building Web APIs for Mobile Apps Using ASP.NET Web API 2.1 (

Puppet and Azure: Bringing DevOps to the Enterprise (

Powerful Mobile Apps with Mobile Services and ASP.NET Web API (

.NET Community & Open Source (

Web Development

Querying An In-Memory Array Of JavaScript Objects In NodeJS (


Announcing new web features in Visual Studio 2013 Update 2 RC (

Announcing .NET Native Preview ( – Compiling .NET to native? HERESY (dipped in chocolate)!

.NET Compiler Platform ("Roslyn") - Home ( – Roslyn. C# compiler? Open-source? Get me a chicken with teeth!

Microsoft “Roslyn” CTP (

Visual Studio 2013 Update 2 RC Downloads - Release Candidates (RC), Betas, and Previews (

Using AutoMapper to prevent SELECT N+1 problems | Jimmy Bogard's Blog (


Denis Huvelle: Tips for ASP.NET MVC 4: lowercase URLs (

State of Microsoft Security: ASP.NET Identity 2.0 (

I’m throwing in the towel in FubuMVC | The Shade Tree Developer on (

Windows Azure

Available Now: Preview of Project “Orleans” – Cloud Services at Scale (

Adapting The Azure Queue API For Node.js (

Packages, tools and more

Mexedge Stylesheet Extension ( – Allows you to visualize your CSS files as a tree view

Voice Commands extension ( – Voice commands for Visual Studio

Architecture and Methodology

The end of ORM - Gumtree Dev Team (

Must have books

Designing Evolvable Web APIs with ASP.NET: Glenn Block, Pablo Cibraro, Pedro Felix, Howard Dierking, Darrel Miller: 9781449337711: Books (

Roslyn End-User Preview – What is it and what is possible? – #build2014 #bldwin version

What is Roslyn?

Roslyn is a complete new compiler for .NET. However, it’s more than just a simple compiler. We called it earlier a “compiler as a service”. Now they call it the compiler platform.

What’s new?

Well it ain’t your run of the mill compiler. It doesn’t just take code and outputs machine code (or IL for .NET).

This compiler allows you to participate in the compilation of your software itself and tell the compiler what to do with it. Scenarios like Aspect Oriented Programming becomes relatively trivial and doesn’t require the use of plugins or post-build event.

You have a cool refactoring that you want to implement in a very specific way? Want to convert properties with certain attributes to code blocks? Just code it. Roslyn allows you to integrate your refactoring within Visual Studio directly and share it with everyone. One specific scenario would be to code company code guidelines directly within a VSIX that you deploy on every developer’s machine. This allow developers to all have the same rules as for what the company is concerned. This could definitely give an edge to a company that want to standardise code quality directly at the source.


Basically, it comes with three type of API. Features, workspaces (solution, projects, files) as well as the compiler APIs.

Features are based around refactoring and fixing code. Those are high level functionality that are tightly link to Visual Studio. Workspace API relate to code formatting, finding references, etc. They are also linked to Visual Studio. Compiler API relates to Syntax trees, emitting code, analysing flows of code… they are the most low-level API related to the compiler and are also the most interesting.


What’s coming?

Well… technically you now have access to the C# compiler with an Apache 2 licence.

Here’s what is now possible…

Simple scenario #1 – Creating a new refactoring

Using the Roslyn SDK, I create a new Visual C# > Roslyn > Code Refactoring.

The default template reverse the string of a type. So I press F5, create a new project, create a class and do ALT + . on that class.

I now have an additional refactoring option which brings my class “ThisTest” to “tseTsihT” with live preview. This is nothing but it’s a refactoring that you are 100% in control with which doesn’t require external tools.

I know. This refactoring is useless. If something is valuable for you, you can simply implement it or wait for someone in the community to develop it.

Simple Scenario #2 – Flagging improperly named fields

So let’s say we want to flag any field that uses the old “m_something” convention. Doing this is as simple as the following code:

/// <summary>
/// This is used to identify where problems are.
/// </summary>
[ExportDiagnosticAnalyzer("NoMUnderscore", LanguageNames.CSharp)]
internal class FieldsDoNotStartWithMUnderscore : ISyntaxNodeAnalyzer<SyntaxKind>
    public const string RemoveMDiagnosticId = "NoMUnderscore";
    public static readonly DiagnosticDescriptor RemoveMUnderscoreRule = new DiagnosticDescriptor(RemoveMDiagnosticId,
                                                                                         "Remove m_",
                                                                                         "Invalid name. Field name must not start with m_",

    public ImmutableArray<SyntaxKind> SyntaxKindsOfInterest { get { return ImmutableArray.Create(SyntaxKind.FieldDeclaration); } }

    public ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get { return ImmutableArray.Create(RemoveMUnderscoreRule); } }

    private static bool CanHaveTheMRemoved(FieldDeclarationSyntax fieldDeclaration, SemanticModel semanticModel)
        if (!fieldDeclaration.Modifiers.Any(SyntaxKind.PrivateKeyword))
            return false;

        var token = fieldDeclaration.Declaration.GetLastToken();
        return token.Text.StartsWith("m_");

    public void AnalyzeNode(SyntaxNode node, SemanticModel semanticModel, Action<Diagnostic> addDiagnostic, CancellationToken cancellationToken)
        if (CanHaveTheMRemoved((FieldDeclarationSyntax)node, semanticModel))
            addDiagnostic(Diagnostic.Create(RemoveMUnderscoreRule, node.GetLocation()));

/// <summary>
/// this is used to integrate within Visual Studio refactor capabilities
/// </summary>
[ExportCodeFixProvider("NoMUnderscore", LanguageNames.CSharp)]
internal class CodeFixProvider : ICodeFixProvider
    public IEnumerable<string> GetFixableDiagnosticIds()
        return new[] { FieldsDoNotStartWithMUnderscore.RemoveMDiagnosticId };

    public async Task<IEnumerable<CodeAction>> GetFixesAsync(Document document, TextSpan span, IEnumerable<Diagnostic> diagnostics, CancellationToken cancellationToken)
        var root = await document.GetSyntaxRootAsync(cancellationToken);
        var diagnosticSpan = diagnostics.First().Location.SourceSpan;
        var declaration = root.FindToken(diagnosticSpan.Start).Parent.AncestorsAndSelf().OfType<FieldDeclarationSyntax>().First();
        return new[] { CodeAction.Create(FieldsDoNotStartWithMUnderscore.RemoveMUnderscoreRule.Description, c => RemoveMAsync(document, declaration, c)) };

    private async Task<Document> RemoveMAsync(Document document, FieldDeclarationSyntax fieldDeclaration, CancellationToken cancellationToken)
        var nameToken = fieldDeclaration.Declaration.GetLastToken();
        var newNameToken = SyntaxFactory.Identifier(nameToken.Text.Replace("m_", ""));

        var variableDeclarationSyntax = fieldDeclaration.Declaration.ReplaceToken(nameToken, newNameToken);

        var newLocal = fieldDeclaration.WithDeclaration(variableDeclarationSyntax);

        var formattedLocal = newLocal.WithAdditionalAnnotations(Formatter.Annotation);

        var originalRoot = await document.GetSyntaxRootAsync(cancellationToken);
        var newSyntaxRoot = originalRoot.ReplaceNode(fieldDeclaration, formattedLocal);

        return document.WithSyntaxRoot(newSyntaxRoot);

This require quite a bit of code. However, it is possible to regroup and refactor common operation on certain elements (fields, constructors, etc.) to reduce the amount of code.

Of course, this code is not production ready and not unit tested. Do not take it as is. It is full of bug and is not ready for any type of environment. This is only to show what is possible.


This of course is just the beginning. I’ve just showed you what is possible. It took me less than an hour to prepare those two examples. With more time, it could be possible to create some very complex scenarios of very high quality.

We’re living in a crazy world right now. We’re getting more and more control over the code that we write. The possibilities that are opening up when we can interact to something as low-level as the compiler are just breathtaking.

For me, it’s tools that are built for the developers, for our needs and of course… fun to use.


Get Roslyn Now

Roslyn Roadmap

Language Features implementation status

Roslyn Sample and Walkthrough

Community Update 2014-04-02 – #bldwin special including my picks for Day 1 with some #winjs, #ef6, #typescript and more

Okay so… if you haven’t heard yet… the BUILD is on. I mean… really. Tons of sessions and more time to waste than you would admit.

So to simplify your life, I’ve built a playlist that is oriented toward the web. If you think I missed something, you should tell me.

Don’t forget to watch for tomorrow where I’ll post my picks for Day 2.


My picks for BUILD 2014 – Day 1

This is happening today… if you don’t see the video, check back later.

Building a Single Page Application with ASP.NET and AngularJS (

Internet of Things with Azure Service Bus (

What's New for ASP.NET and Web in Visual Studio 2013 Update 2 and Beyond (

3D Printing with Windows (

TypeScript (

Web Development

Gulp and Browserify with ASP.NET (


Fetch Gmail Contact List using CSharp.NET Code | CodeTonics ( – Okay… it binds to a DataSource but… the code is quite easy to modify

winjs/winjs · GitHub ( – WinJS now on GitHub with Apache 2.0 licence

Reactive-Extensions/RxJS-WinJS · GitHub ( – RxJS integration with WinJS

Reactive-Extensions/RxJS · GitHub ( – RxJS in standalone without WinJS dependencies

Visual Studio 2013 Update 2 RC (

Entity Framework - Entity Framework 6: The Ninja Edition ( – if you haven’t read that yet, you should

Data Points - Code First Goodies in Entity Framework 6 (

Inside .NET Native ( – Compiling .NET to native? Interested?


Change log - Web Essentials 2013 for Update 2 RC ( – You can download it here.

Architecture and Methodology

On that Microservices thing (

Scarcity In Software Development (

Open-source projects

tobie/ua-parser · GitHub ( – User Agent parser. If you are parsing logs, you need that project. Also available on NuGet.

Source Control (TFS, Git, SVN)

Microsoft Visual Studio Team Foundation Server 2013 with Update 2 (

Community Update 2014-04-01 – April Fool’s special, getting ready for #durandaljs and some #elasticsearch

April Fools Entry

Clippy for ReSharper | JetBrains .NET Tools Blog (

security - Permanently uninstalling the user - Super User (

Web Development

Preparing for Durandal NextGen (

BUILD 2014 – Must watch

Deep Dive: Improving Performance in Your ASP.NET App ( – Available April 4th-5th.


Visual Studio Online Update – Mar 18th (

At BUILD 2014? Join Miguel de Icaza for his C#+F# Mobile Session on Android and iOS (


Get the Twitter Profile Image using ASP.NET Identity (

Updated ASP.NET Database Resource Provider - Rick Strahl's Web Log (

Web API: Mixing Traditional & Verb-Based Routing | Applied Information Sciences Blog (

Simple OAuth Server: Implementing a Simple OAuth Server with Katana OAuth Authorization Server Components (Part 1) - Tugberk Ugurlu's Blog (

Tom DuPont .NET: TypeScript Definition Files on NuGet: Always have the latest and greatest IntelliSense! (

CypressNorth/.NET-WebApi-HttpStringDecodeFilter · GitHub (

Architecture and Methodology

Estimate This! (or not) | (

The True Corruption of Agile | 8th Light (

Search Engines (Solr, ElasticSearch)

Nest - Quick Start ( – .NET Connector for ElasticSearch

Log Analysis is Fun Again | CDS Global (

Community Update 2014-03-31 – #Build2014, #dotnet, #css, #responsive tables, #aspnet, #owin, new #octokit .NET version

So like every Monday, as always, we have an avalanche of links.

The one I would really not miss is the Build 2014 session list. The Build will start April 2nd and go up to April 4th. I will list my recommended session once we reach those date since I’m still picking what I, and maybe you, should watch.

With this, good reading!


Must Read

Analysis Paralysis: Over-thinking and Knowing Too Much to Just CODE - Scott Hanselman (

Build 2014

Build 2014 ( – The event will be from April 2nd to April 4th.

Web Development

CSS Diner - Where we feast on CSS Selectors! ( – Excellent learning tool to learn CSS selectors

Responsive tables (


StructureMap 3.0 is Live | The Shade Tree Developer on (

How I made EF work more like an object database | brockallen on (

12 reasons to use the Jolt award winning Visual Studio Premium 2013 (


Validation of hidden fields at the client in ASP.NET MVC (

OWIN security components for ASP.NET: OpenID Connect preview and Cloud Cover video! | CloudIdentity (

Optimize your WebApp like a PRO – ASP.NET MVC Boilerplate | Emit Knowledge (

Exploring ASP.NET FriendlyURLs | TechNet Blogs (

CQRS / Event Sourcing

Event sourcing in practice ( – Slides in HTML. Use the arrows/space on your keyboard to page through.

Windows Azure

Using SLAB's Azure Table Sink With a WebApi Service Hosted In Azure Beyond the Duck (

Source Control (Git, SVN, TFS, etc.) at master · octokit/ · GitHub ( – New version of the .NET GitHub API.

Search Engines (ElasticSearch, Solr, etc.)

elasticsearch – how many shards? « Trifork Blog / Trifork: Enterprise Java, Open Source, software solutions (

Elasticsearch Monitoring and Management Plugins | codecentric Blogcodecentric Blog (

Community Update 2014-03-28 – Learning #javascript frameworks, page #performance, #REST, #Kanban and more

So the weekend is already there.

If you missed it, don’t forget my post on SideWaffle. It’s a Visual Studio Extension that ships with lots of Open Source templates including templates to building templates (INCEPTION!).

Otherwise, have a good weekend and enjoy!

Must Read

Scott Hanselman's Complete List of Productivity Tips - Scott Hanselman (

Troy Hunt: The prophesied Windows XP and IE 8 crisis is nigh! (unless you’re in China) (

Web Development

JavaScript Frameworks | How to Learn Them Quickly | Funny Ant (

By Value Versus by Reference (JavaScript: The Definitive Guide, 4th Edition) (

Critical render path and pagespeed: An in-depth look (

Using Bower and NancyFx together | Krzysztof Koźmic on software (


IIS and ASP.Net Authentication and Authorization - CodeProject (

OWIN security components in ASP.NET: OpenID Connect! (


Task.Run vs Task.Factory.StartNew (

Get rid of deep null checks (

Nico's digital footprint | Building a REST API and consuming it in WP8 (

Architecture and Methodology

So Long Scrum, Hello Kanban - Stormpath User Management API (


Octopus Deploy vs. Puppet/Chef - Octopus Deploy (

Search Engines (Solr, ElasticSearch, etc.)

How To Install Elasticsearch on an Ubuntu VPS | DigitalOcean (

Think Big | Solr vs ElasticSearch (

Community Update 2014-03-27 – #SPAHelper by Chris Love, #webdev, #aspnet, #swagger with #webapi and #git pull is bad

First, I’m bringing you the SPAHelper by Chris Love. This is worth looking at.

Patrick Desjardins is bringing us a quick fix for Bootstrap with smaller than 768px screen width. We also have a nice explanation on why a CDN is “slow” for mobile devices (hint: it isn’t).

Today, Project Helios hits another milestone with the 1.0.0-alpha1 hitting nuget today by Levi Broderick. Scott Hanselman show us on how you can block a folder from executing ASPX pages.

We have much more so I’ll let you guys read those before going on a long explanation of every links.


Single Page Application Helpers by Chris Love

docluv/SPAHelper · GitHub ( – The code

docluv/movies · GitHub ( – The demo app code – The actual demo app.

Web Development

AngularJS in Visual Studio: Data Binding - Deborah's Developer MindScape (

Modifying BootStrap Tab Control for Extra Small Device | Patrick Desjardins' Blog (

Why is my CDN 'slow' for mobile clients? - (


NuGet Gallery | Microsoft.Owin.Host.IIS 1.0.0-alpha1 ( – That my friend is Project Helios. New alpha!

ASP.NET "Project Helios" Changelog (

Back to Basics: When allowing user uploads, don't allow uploads to execute code - Scott Hanselman (

Introduction to Web API Versioning - CodeProject (

Some Useful IIS Rewrite Rules (

Reading Settings from App Config // Chris Poulter - Web Developer (

WebAPI, PascalCase and camelCase - The Problem Solver (

Writing Asynchronous Web Pages with ASP.NET- Part 3 | Brij's arena of .NET on (

domaindrivendev/Swashbuckle · GitHub ( – REST Documentation for WebAPI (see “Swagger” demo on a non-WebAPI REST service)

Architecture and Methodology

Chill out on the Singleton Fetish | Jeremy D. Miller (

Self Shunt Pattern (

Source Control (TFS, Git, SVN, etc.)

In what cases could `git pull` be harmful? - Stack Overflow (