Friday, July 31, 2015

Continuous Delivery: Decouple release from deployment

For most organizations releasing and deploying are the same thing while in fact these are 2 separate things:

  • Deployment: A technical handling where a new version of the software is deployed to a specific environment
  • Release: A business handling where the customers are informed that a new version of the software is available and can be used

As you combine these 2 handlings in one, releasing becomes a risky business. The same moment you roll out the code on production, your users are eagerly waiting to start using these new features they so desperately needed.  At that moment, you don’t want that things go wrong.

So what do most organizations do? They introduce long release cycles where an application has to go through multiple environments and test cycles before finally reaching production.And they try to reduce the risk by only going through this cycle one or 2 times a year.

But while they are thinking that this limit the risk, it actually has an opposite effect. The moment Murphy kicks in (and it will) you’re into trouble. Why? Because you have to go step by step through this really long release cycle again before you can apply your patch or hot fix to production. By then this fix is not so ‘hot’ any more. And in the meanwhile error reports keep coming in…

Now this is the theory, what I see in practice (a lot!), is that when there is really something wrong on production, the whole process is thrown out of the window and the solution is deployed immediately  to production. Wooops, maybe not the best idea either?!

Could there be a better solution?

Of course! Otherwise I shouldn’t be writing this blog post. First of all, let these 2 handlings(deployment and release) remain separate things. Deploy your feature to production as soon it’s ready but hide it from the users. Later on, you can do a ‘release’ and enable the feature on production just by toggling a configuration switch. Even better is that you can gradually enable a feature for a subset of your users. The moment you notice that performance is going down or exceptions start appear, you can easily disable the feature again and fix it without impacting the users. This is exactly the approach that companies like Facebook and Amazon are using.

Now one important recommendation I want to make is to go one step further and split out the deployment itself in multiple steps:

  • In step 1, you deploy your database changes. No code changes are deployed yet. Of course this means that database changes should happen in a non breaking fashion. For example, if you add a new required database column, make it nullable first or provide a sensible default.
  • In step 2, deploy your application change.  When you’re ready announce the release and enable the feature.
  • If everything is working as expected, you can continue to the last (optional) step and update the database again. For example, for the new column you created before, you can now make it not nullable and remove the default value.

This provides a fault tolerant approach in handling releases and is a first step towards continuous delivery.

Thursday, July 30, 2015

Software testers…

I had to smile while reading following tweet… :-)

Wednesday, July 29, 2015

Why I’m an F# fan…

If you are still in doubt if you should try F# or not; read the following blog post In this post Simon Cousins built the same application once using C# and a second time using F#.

The results speak for themselves…


Tuesday, July 28, 2015

Entity Framework Connection Management

Some developers asked me to look into an issue they had with Entity Framework. A query that took milliseconds in SQL Server Management Studio, took minutes to execute when called through Entity Framework.

I had no clue what was the issue, but the following blog post brought some insights: This post brought me to the following MSDN article where I saw the following note:


The trick is to call Entity Framework and materialize the results as quick as possible so the connection gets closed.

Monday, July 27, 2015

Cancel async requests in ASP.NET MVC

Starting from .NET 4.5 ASP.NET MVC supports async/await for the action methods on your controller:

Something I wasn’t aware of until I saw this blog post that is possible to cancel an async requests on the server. I knew it was possible to cancel an AJAX request on the client but I didn’t know that this cancellation will be forwarded to the server. I thought that on the server the request continued but that the result was discarded.

What you have to is to add a CancellationToken as an extra parameter to your action method:

Wednesday, July 22, 2015

SOLID Architecture in Slices not Layers

With all the goodness that MicroServices has to offer, people think it’s the next silver bullet and don’t learn from their mistakes. I always have to think about this quote from Simon Brown:

If you can't build a monolith, what makes you think microservices are the answer? 

An interesting video in this regard, is the talk at NDC Oslo from Jimmy Bogard about SOLID Architecture in Slices not Layers. It doesn’t talk about MicroServices but brings some new insights in how to build nicely structured monoliths(and there is nothing wrong with that).

SOLID Architecture in Slices not Layers - Jimmy Bogard from NDC Conferences on Vimeo.

Monday, July 20, 2015

Visual Studio Online - Work Item Studio

Work Item Studio is a mobile app created by Microsoft’s ‘Garage’ team that allows Visual Studio Online users a way to create, edit and view work items. A Windows Phone version existed for quite some time, but now there is finally a version for Android as well.


Some screenshots:

  • Windows Phone:


  • Android:


You can download the app from the different stores:

Friday, July 17, 2015

Great React.js tutorial

Angular.js is so 2014, now it’s React.js that is the new hot and shiny JavaScript framework. If you want to learn where all the fuzz is about, I can recommend the great React.js Introduction for people who know just enough jQuery to get by tutorial.


This is the best beginner tutorial for React I found on the web. It walks you through the steps to build a Tweet Box using React.js. The nice thing is that every feature is first built using jQuery and then recreated using React. This really shows of the advantages that React has to offer.


Thursday, July 16, 2015

Chrome Developer Tools–Run remote code snippets

Yesterday, I posted about the Code Snippets feature inside the Chrome Developer tools. One thing that is annoying is that you have to create your scripts locally and there is no built-in way to share them.

Gleb Bahmutov brought a solution by sharing a code snippet to load your scripts dynamically. A good idea is to set up an internal site where you host all the snippets you want to share. These scripts can then be loaded using the following script:

Note: By using this script it is possible to load snippets from any source. Be careful as this imposes a security risk if you load and execute scripts from other locations.

Wednesday, July 15, 2015

Chrome Developer Tools - Code snippets

Today I discovered a nice feature inside the Chrome developer tools: Code snippets.

Here are the steps to use it:

  • Open Chrome. Hit F12 to load the Chrome Developer tools.


  • Go to the Sources tab. On the Sources tab, you find a sub tab Snippets. Click on it. The first time you open it, it will be empty.


  • Right click on the empty tab and choose New.


  • A new snippet is created. You can choose a name and write the snippet code.


  • When you are done writing your snippet, you can run it by right-clicking on it and choosing Run.


  • Once the script is saved, it will be stored and is available each time you open up your Chrome Developer tools.

Tuesday, July 14, 2015

Visual Studio and Team Foundation Server : Fix bindings in solution file

For some time, I had an error when opening a specific Visual Studio solution. After a problematic merge operation, the Team Foundation Server Source Control binding information inside my solution file didn’t match with the projects I had in my solution.

If I opened up the sln file, I could find the following section:

    GlobalSection(TeamFoundationVersionControl) = preSolution
        SccNumberOfProjects = 92
        SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
        SccTeamFoundationServer =
        SccLocalPath0 = .

The number of projects(92) was complete wrong. Visual Studio told me there should be 68 projects:


I found an easy solution to fix this:

  • Close the solution in Visual Studio
  • Check out the .sln file. Open it with your favorite text editor.
  • Remove the GlobalSection(TeamFoundationVersionControl) section completely.
  • Close the .sln file and open the solution in Visual Studio.
  • The solution file is now no longer bound to Team Foundation Server so we should fix the binding.
  • Inside Visual Studio, go to File –> Source Control –> Advanced –> Change Source Control
  • On the Change Source Control screen, select the .sln file and click on the Bind button


  • This will recreate the GlobalSection(TeamFoundationVersionControl) inside your solution file:

    GlobalSection(TeamFoundationVersionControl) = preSolution
        SccNumberOfProjects = 68
        SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
        SccTeamFoundationServer =

  • Check in the updated .sln.

Monday, July 13, 2015

Serve static content from a cookieless domain

While performance testing an Angular.js website, I ran the site through a few benchmarking tools like Google PageSpeed Insights, Yahoo’s YSlow, and so on…

One of the recommendations that these tools returned is ‘Serve static content from a cookieless domain’. Although there is some discussion going on if this recommendation actually makes sense, I spend some time reconfiguring IIS to get this working so I can measure the impact myself.

Here are the steps I took to get it working:

  • Inside IIS I configured 2 websites:


    • A Default Web Site that listens on port 80 and has a custom host header configured(I used as an example)


    • A second website CDN that also listens on port 80 and has a different custom header configured(I used for this one)


  • For the CDN site, disable ASP.NET session state, this prevents cookies from being returned by ASP.NET.
    • Click on Session State.
    • Set the Session State Mode on Not enabled and click on Apply.



  • Copy your static content(images, css, javascript) over to the CDN site
  • Inside your website, change the urls for the static content to point to the CDN site.
  • Run your application
    • If you look at the requests to the default website, you see that cookies are sent with the request:


    • But if we look at a request to the CDN, no cookies are included:


Friday, July 10, 2015

NuGet–Reinstall an existing NuGet Package

For some application modules we are building, we are using NuGet as the deployment vehicle. Today I was working on the construction of the NuSpec file to see if the NuGet package is correctly configured and created. While testing, I didn’t update the package version, so I was always using the same version number.

The problem is that through the UI, there is no way to reinstall a package. You can only upgrade a package or remove one.  After browsing through the documentation I noticed that you can re-install an existing package from the Package Manager console using the following command:

Update-Package –reinstall <packageName>

This command was specifically created for my scenario, so problem solved I thought. However I noticed that although the package was removed and reinstalled, NuGet didn’t download the updated package from our internal NuGet server. Instead it keeps using the existing package in the Packages folder. Bedroefde emoticon

Anyone who had the same problem?

Note: Copying the NuGet package file manually to the Packages folder before calling the Update-Package command worked for me. This is of course a workaround and a better solution would be welcome…

Thursday, July 9, 2015

IIS 8: Allow users to download .config files

By default IIS blocks access to .config files and this for a very good reason. You don’t want to share your ASP.NET web.config file with the rest of the world.

However in this case this was exactly what I wanted to do. As part of a reusable module we built, we wanted to provide a sample .config file explaining how the module should be configured.

Here are the steps to get this done:

  • Open the IIS Manager.
  • Click on the website or virtual directory where you want to allow the download.
  • Click on Request Filtering.


  • Search for .config in the list of File Name Extensions. Select the item.
  • Click on the Remove… button to remove the .config file from the list.
  • Click on Allow File Name Extension…
    • Specify .config as the extension
    • Click OK.


  • Now if you try to download the .config file, this will still fail with the following error message:
    • HTTP Error 404.3 - Not Found

      The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.

  • As mentioned inside the error message, we have to configure a MIME type mapping for the .config extension.
  • Click on MIME Types.


  • Click on Add... Specify .config as the File name extension and text/xml as the MIME type. Click OK.


  • That’s it.

WARNING! Be aware of the security risk you introduce by doing this!

Wednesday, July 8, 2015

Time to celebrate–Visual Studio 2015 Launch Event

On July 20th Microsoft will release Visual Studio 2015!  To guarantee that the launch doesn’t happen unnoticed, Microsoft hosts an online release event.  You will be able to engage in live, interactive Q&A sessions with the engineering team, as well as deep-dive into technical details covered in over 60 on-demand video sessions.
You will also have the opportunity to see the Visual Studio developer team creating an end-to-end solution for an open-source project, leveraging the newest tools and technologies.

More information on the Visual Studio website:

Save the date

Tuesday, July 7, 2015

Microsoft Azure Speed Test

Interested in using Azure, but you have no idea which datacenter you should use? Try Microsoft Azure Speed Test. This free online tool will connect to all the Azure datacenters and look which one has the lowest latency.


Monday, July 6, 2015

DevOps–Run what you wrote

If I have to phrase the concept of ‘DevOps’ in one sentence, it’s:

“Run what you wrote”

I think that by making developers(and by larger extend) teams responsible for the code they wrote and the failures it caused in production, they learn to write code that doesn’t fail(and if it fails at least it does it in a graceful matter).

Does this mean that developers get to do all the work and the system administrator can all take a long vacation?
Of course not, it means that the concept of cross-functional teams, as promoted by Scrum and other Agile methodologies, should extend outside the analysis, design, development and testing domain and reach into operations. Only then, we can talk about truly cross-functional teams.


Friday, July 3, 2015

Management Myths by Johanna Rotman

A must read for every (aspiring) manager. (Click on the links to read the full article):

Certainly check out the other articles on her site.

Thursday, July 2, 2015

NPM 3–Finally a windows friendly versions

As a windows user, I never liked NPM(Node Package Manager), the node.js package manager. In contrast to Nuget, where the package folder structure is flat, with NPM you have packages inside packages inside packages and so on…  The Windows file system doesn’t like this and you can end up with folders you cannot remove with any of the standard tools.(Tip: use 7zip to delete the folder.)

With the announcement of the beta of npm 3.0, this problem is finally history. NPM 3.0 introduces flattened packages(they call it deduping, if this is a real verb).

Here is the announcement on GitHub:

Flat, flat, flat!

Your dependencies will now be installed maximally flat. Insofar as is possible, all of your dependencies, and their dependencies, and THEIR dependencies will be installed in your project's node_modules folder with no nesting. You'll only see modules nested underneath one another when two (or more) modules have conflicting dependencies.

  • #3697 This will hopefully eliminate most cases where windows users ended up with paths that were too long for Explorer and other standard tools to deal with.
  • #6912 (#4761 #4037) This also means that your installs will be deduped from the start.
  • #5827 This deduping even extends to git deps.
  • #6936 (#5698) Various commands are dedupe aware now.

This has some implications for the behavior of other commands:

  • npm uninstall removes any dependencies of the module that you specified that aren't required by any other module. Previously, it would only remove those that happened to be installed under it, resulting in left over cruft if you'd ever deduped.
  • npm ls now shows you your dependency tree organized around what requires what, rather than where those modules are on disk.
  • #6937 npm dedupe now flattens the tree in addition to deduping.

And bundling of dependencies when packing or publishing changes too:

  • #2442 bundledDependencies no longer requires that you specify deduped sub deps. npm can now see that a dependency is required by something bundled and automaticlaly include it. To put that another way, bundledDependencies should ONLY include things that you included in dependencies, optionalDependencies or devDependencies.
  • #5437 When bundling a dependency that's both a devDependency and the child of a regular dependency, npm bundles the child dependency.

Of course there is more! So don’t forget to check out the other improvements as well…

Wednesday, July 1, 2015

Nice quote: Maintainable JavaScript

On a panel discussion Anders Hejlsberg stated the following quote: “[…] you can write large programs in JavaScript. You just can’t maintain them.”.

This explains in one sentence the reasoning to build Typescript

Here is the video: