Skip to main content


Showing posts from August, 2017

Visualizing Git commands

While preparing a training about Git and it’s infinite list of commands, I discovered . This is a great help to explain some of the Git concepts and visualize the effect of the different commands. Let’s try the tool to demonstrate the concept of a rebase . We start by creating a second branch and adding some commits to both master and the second branch: Now while sitting on the sample branch, we execute the git rebase master command to rebase our current branch(sample) onto master. Thanks to the visualization tool we see that our commits are replayed on the master branch resulting in new commit ids. As a last step, we still have to merge these changes on the master branch. Really nice way to learn Git!

System.ValueTuple; we are not there yet

The introduction of System.ValueTuple makes using Tuples in .NET a lot more user friendly and fixes the mistake of making System.Tuple<> a reference type. Creating a tuple becomes this easy: Still there are some rough edges, for example what do you think will happen if I try to execute the following code: Turns out that the ValueTuple has no built in support for equality checks: In F# this works without a problem:

Angular: Set default headers on each request

Today I was discussing with a colleague what’s the best options to always set some header data for your HTTP requests. Here is my solution… Create a new TypeScript class that inherits from BaseRequestOptions: Note: In this example I injected a LOCALE_ID to capture the culture set in the application. Next step is to create a provider that replaces the default RequestOptions: Last step is to register the DefaultRequestOptionsProvider in your module:

Agile HR Blog series

As part of your organizational transformation towards Agile you cannot leave a department behind. This means that the way your HR department works and handles things like recruitment, hiring but also compensation and benefits should change as well. Johanna Rothman shared a great set of posts about Agile HR: Creating Agile HR, Part 1: What HR Does Creating Agile HR, Part 2: A Flow for Agile Hiring Creating Agile HR, Part 3: Possible Agile Hiring Metrics Creating Agile HR, Part 4: Agile Sourcing Creating Agile HR, Part 5: Performance Management, the Career Ladder Creating Agile HR, Part 6: The Agile Compensation System Creating Agile HR, Part 7: Agile Feedback and Coaching Creating Agile HR, Part 8: Summary A must read for every HR manager…

Deploying extra files when using WebDeploy

On one of the teams I’m coaching they are using Angular (4) in combination with ASP.NET Web API. This combination took a little more time to setup than for ASP.NET Core but worked quiet nice in the end. In the current setup the Angular code is stored inside the ASP.NET Web API project: To deploy the application to our servers, we configured a build process that contains the following steps: Step 1 - Restoring the NuGet packages from our private package repository. Step 2 – Compiling the .NET solution using MSBuild Step 3 – Restore the NPM packages required for the Angular code Step 4 – Execute the ng build command specify the environment and other parameters Step 5 – Running the tests Step 6 – Deploying the application using WebDeploy After configuring all steps above, we noticed that everything was compiled nicely but after WebDeploy was completed only the C# assemblies were published on the web server. The files generated by Angular CLI were missin

Open a Command Prompt from File Explorer

Small productivity tip I got from a colleague: You have a specific folder opened in File Explorer and want to open up a Command Prompt at this location. Type ‘cmd’ in the address bar and hit ‘ENTER’ A Command Prompt appears with the current folder already active

ASP.NET Core 2.0–Help, where is my Configuration?

In ASP.NET Core 1.x the Configuration was initialized in the Startup class: If you create a new project in ASP.NET Core 2.0, your Startup class is almost empty and you cannot find any Configuration related code anywhere. Still if you run your application, the configuration is loaded and everything is working as expected. So where is the magic? The Configuration is no longer found in the Startup class but is loaded and executed from the Program.cs file where it is part of the WebHost.CreateDefaultBuilder method. This method does a lot of stuff out-of-the box including loading configuration data from the following sources: appsettings.json and appsettings.{environment}.json (e.g. appsettings.Development.json) User secrets Environment variables Command-line arguments This explains the magic. But what if you want to change this? No worries, you can use the ConfigureAppConfiguration method to change the configuration. If you need the Configuration data

Using the Work Item Multivalue control in TFS 2017 (On premise)

Today one of my colleagues in our ALM team asked for help. For a customer we upgraded their TFS environment to TFS 2017. One of the changes we had to do along the way was replacing the existing MultiValue control by a newer version( ). We followed the steps as mentioned here( ) but the control didn’t appear. Here is the template XML that we were using(I removed some content): Although we couldn’t see any difference with the steps mentioned above, it didn’t work. When I had a look I noticed that the extension is only registered in the WebLayout part of the Form. Remark: In TFS you always had 2 layouts(a layout and a weblayout), the first one applies when opening a work item in Visual Studio or Test Manager, the weblayout applies when opening a workitem in the browser. We first tried to add the extension to the layout

TFS - Maintaining your TFS Build Agents

After some time, your build agents start to eat up more and more disk space on your build server. Before I always cleaned it up manually when I get a warning from our system monitoring tools, but there is actually a better way I wasn’t aware of. It is possible to schedule a Maintenance Job to clean up the _work folder in the agent: Remark: As this has an impact on the availability of your pool it is recommended to limit the max percentage of agents running maintenance(25% by default). Where can you find these setting? Login to your TFS or VSTS portal Open the Administration Section of the portal and go to the Agent Pools section On the Agent Pools page, select a specific pool from the list of available pools On the right choose the Settings tab

Tuples in C#7

One of the nice features in C#7 is the support for Tuples as a lightweight datastructure using the System.ValueTuple NuGet package . It simplifies your codebase where you had to fallback before to out parameters or arbitrary objects. Let’s have a look at a simple example: This sample shows how easy it is to return tuples from your methods. Only problem I have with this implementation is that if you try to access the output of this method call, you still see the Item1, Item2 properties which are not really meaningful: You don’t have to stop there, we can update the method signature with some extra metadata: If we now try to access the tuple values again, we see the following instead: NOTE: The name associated with the tuple element is not a runtime metadata, i.e. there is no such a property/field with the name on the actual instance of that value tuple object, the property names are still Item1, Item2, etc., all element names are design time and compiler time only. If

Are your if statements not hidden sagas?

This video by Udi Dahan made me rethink all if statements in my code: In the video Udi uses the following deceptive simple looking requirement as an example: “Disallow the user from buying products that are no longer available.” Doh! This must be the easiest requirement I’ve ever seen. Let’s implement it… Ok, when the user goes to the products page and we show a list of products, let’s add an extra check that only shows the items who are not deleted from our product catalog: if(item.state== States.Deleted) ///Filter item from list Ok, perfect. Problem solved! But wait, what if the user leaves the pages open for a while and in the mean time the product gets removed from the catalog, what happens if the user tries to add this product to his shopping cart? Ok, let’s add an extra check when the user tries to add an item to his cart: if(item.state== States.Deleted) ///Show warning to user that product is no longer available Ok, perfect. Problem solved! But wa

Chrome HTTPS error on localhost: NET::ERR_CERT_COMMON_NAME_INVALID

If you are a developer and are using a Self-Signed certificate for your HTTPS server, you recently may have seen the following error in Chrome(or a non-Dutch equivalent ): Starting from Chrome 58 an extra security check got introduced that requires certificates specify the hostname(s) to which they apply in the SubjectAltName field. After they first introduced this change, the error message was not very insightfull but today if you take a look at the Advanced section of the error message or the Security panel in the Developer tools, you’ll get some more details pointing to the SubjectAltName issue: Create a new self-signed certificate To fix it, we have to create a new self-signed certificate. We can not use the good old makecert.exe utility as it cannot set the SubjectAltName field in certificates. Instead, we’ll use the  New-SelfSignedCertificate command in PowerShell: New-SelfSignedCertificate ` -Subject localhost ` -DnsName localhost ` -KeyAlgorithm RS

Using F# in Visual Studio Code

If you are interested in F# and want to start using it inside Visual Studio Code, I have a great tip for you: Have a look at the F# with Visual Studio Code gitbook . This contains a short guide that explains you step by step on how to get your Visual Studio Code environment ready for your first lines of pure F# magic. Happy coding!