Skip to main content

Posts

Showing posts from March, 2017

Azure–Assign a reserved (public) IP address to an existing Cloud Service

A customer asked me to assign a static IP address to an existing Cloud Service in Azure. It took me same time to figure out the exact procedure to do this. So here are the steps involved: Open the Powershell console and install the Azure Powershell commandlets(if you didn’t had done this already) Install-Module AzureRM Now let’s first login to Azure Add-AzureAccount You can check if you are logged in succesfully Get-AzureAccount Let’s activate a specific subscription Select-AzureSubscription Specify the SubscriptionName Now you can convert the assigned dynamic IP for your cloud service to a static reserved IP address New-AzureReservedIP –ReservedIPName MyStaticIP –Location "West Europe" -ServiceName MyServiceName Remark: Executing the last command can take a while, so don’t panic if nothing seems to happen…

Docker error - Error response from daemon: manifest for :latest not found

When trying to download a docker image for Eureka using docker pull , I got the following error message: docker pull netflixoss/eureka Using default tag: latest Error response from daemon: manifest for netflixoss/eureka:latest not found It seems that by default a :latest tag is added to the command. When I checked the Docker Hub I noticed that the ‘latest’ tag didn’t exist: I changed the command to explicitly include the tag: docker pull netflixoss/eureka:1.3.1 That solved the problem…

Visual Studio 2017 Best Feature Ever!

Yesterday I discovered a great addition to Visual Studio 2017. When a NullReferenceException is thrown you not only get the familiar‘Object reference not set to an instance of an object’ error message, but you also get some information about which object exactly is null. Finally! Note: Null reference analysis in managed code requires .NET version 4.6.2 . Null analysis is currently not supported for Universal Windows Platform (UWP) and any other .NET Core applications. It is only available while debugging code that does not have any Just-In-Time (JIT) code optimizations.

Visual Studio 2017–.NET 4.6.2 is missing

After installing Visual Studio 2017, I noticed that .NET 4.6.2 was still missing from the version list. Strange! Especially because the .NET site mentions otherwise: Luckily you can add it by installing the .NET Framework 4.6.2 Developer Pack from here .  Once installed you will see .NET 4.6.2 added to the list of supported versions:

NPM–Exclude files from your package

By default NPM will include all files as part of your package. But how can you exclude certain files? To support that scenario NPM has the concept of a .npmignore file similar to a .gitignore file( Note: in case there is no .npmignore file, but there is a .gitignore file, nom will ignore the files matched by the .gitignore file). .npmignore files follow the same pattern rules as .gitignore files. Additionally, everything in node_modules is ignored, except for bundled dependencies. npm automatically handles this for you, so don't bother adding node_modules to .npmignore . The following paths and files are never ignored, so adding them to .npmignore is pointless: package.json README (and its variants) CHANGELOG (and its variants) LICENSE / LICENCE

Angular 4 is out!

Angular 4 is out! My first reaction was WHAT? Did I miss the release of Angular 3 somewhere? Turns out that they decided to skip a version to align with the Angular version 4 router(an announcement that I missed somehow). The focus on this release is making Angular applications smaller and faster. I’ll start upgrading my projects this weekend. Expect a follow-up post with my experiences soon… PS: Here is the announcement on their blog: http://angularjs.blogspot.be/2017/03/angular-400-now-available.html

TypeScript - TS2403 Subsequent variable declarations must have the same type. Variable 'module' must be of type 'NodeModule'

Got a TypeScript error when trying to get my Angular app up and running: Error      TS2403  Subsequent variable declarations must have the same type.  Variable 'module' must be of type 'NodeModule', but here has type '{ id: string; }'.   TypeScript Virtual Projects               C:\projects\MyAngularClient\src\typings.d.ts               2             Active To fix it, I had to comment out the module declaration typings.d.ts:

Eventsourcing - One table with 3 columns, that’s all you need to build any kind of application

If you are new to EventSourcing I can recommend the eBay Tech Talk in Berlin, Raimo Radczewski did a great introduction about EventSourcing and CQRS. Best quote during the talk: One table with three columns; with EventSourcing, that’s all you need to develop an e-commerce system, a CRM app, or any kind of application you can imagine.

NPM Package.json publishing configuration

When managing your package.json file there are 2 use cases that can impact how you configure it: I don't want my package published at all. It's private. To enable this set "private": true in your package.json. This will prevent it from being published at all. If you try to accidently publish the package, you’ll get the following feedback: C:\projects\test\npmtest>npm publish npm ERR! Windows_NT 10.0.10586 npm ERR! argv "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Users\\BaWu\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "publish" npm ERR! node v6.10.0 npm ERR! npm  v3.10.5 npm ERR! This package has been marked as private npm ERR! Remove the 'private' field from the package.json to publish it. npm ERR! npm ERR! If you need help, you may report this error at: npm ERR!     < https://github.com/npm/npm/issues > npm ERR! Please include

ProGet: NPM connector returns no records

At a customer we are using ProGet as our internal package manager server. ProGet supports a lot of different package formats including NPM and NuGet. Thanks to the usage of connectors you can even link to other package sources like the official NuGet feed or the official NPM registry. Unfortunately after creating an NPM feed and linking it to the official NPM registry( https://registry.npmjs.org ) using a connector, the connector didn’t do anything and our feed remained empty. Turns out that a scheduled task exists that indexes the Npm registry but it only runs once a week by default. To find this scheduled task, go to your Proget site and click on the Administration icon on the right After logging in, go to Scheduled Tasks below System settings In the list of Scheduled Tasks you should find the ‘FullNpmConnectorIndex’ task. You can invoke it immediatelly by clicking on the ‘Play’ button at the right.

Visual Studio 2017 Poster

The Microsoft team created a poster showing off some of their favorite parts of Visual Studio 2017. Time to get your A1 printer started and spice up your team room. You can download the  PDF or check the web infographic version .

Angular CLI - You have to be inside an angular-cli project in order to use the build command

After creating an Angular application using the following Angular CLI command; ng new appname You should open the newly created appname folder before invoking any other ng command. Otherwise you get the following error message: You have to be inside an angular-cli project in order to use the <commandname> command Unfortunately I got the same error after pulling an Angular project created by a colleague from our GIT repo. Although I was certainly in the correct folder, I saw the above error again . Turned out that the Angular project was created using a newer version of the Angular CLI. After updating to the latest version of the @angular/cli package the problem disappeared. Remark: Here are the steps to correctly update Angular CLI: https://github.com/angular/angular-cli#updating-angular-cli

Angular CLI–Error running ng-xi18n

Angular CLI is a great tool to help you during your daily Angular 2 development work. One of the features that is integrated is an internationalization(i18n) component that extracts XLF (or XMB) files that can be translated and used inside your Angular app. However first time I tried to to use the ng-xi18n tool, it failed with the following error message Error: Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AnimationDriver in C:/SampleApp/node_modules/@angular/platform-browser/src/dom/animation_driver.d.ts, resolving symbol BrowserTestingModule in C:/SampleApp/node_modules/@angular/platform-browser/testing/browser.d.ts, resolving symbol BrowserTestingModule in C:/SampleApp/node_modules/@angular/platform-browser/testing/browser.d.ts     at simplifyInContext (C:\Users\User\AppData\Roaming\npm\node_modules\@angular\compiler\bundles\compi

Cost saving tip when using Azure VM’s

Azure VM’s when you keep them running can cost you a lot of money. So stopping your VM when it’s not in use is certainly a good idea. However you should be aware that there are 2 kinds of ‘stopped’ which are unfortunately not equal. The first method to shutdown an Azure VM, when connecting for example through Remote Desktop, is to Shutdown the Operating System. In this scenario you go to the Power options within Windows and select Shutdown. This will stop the VM from running but will NOT deallocate hardware. So you will still be paying for the VM hardware allocation. Note: On the Azure Portal, you’ll see that the VM status will be ‘Stopped’ The second method, and the better one, is to go into the Azure Portal and Stop the VM. This will not only shutdown the VM but also deallocated reserved resources. No further costs will be charged(with the exception of storage for your VM disks). Note: On the Azure Portal, you’ll see that the VM status will be ‘Stopped(Deallocated)’

Error when trying to run a Docker Windows container

I’m using Docker Linux container for some time but yesterday I had some extra time and decided to give the Docker Windows container a try. I opened a command prompt and typed docker run -it --rm microsoft/nanoserver powershell Unfortunately I didn’t end with a working container. Instead I got the following output: Unable to find image 'microsoft/nanoserver:latest' locally latest: Pulling from microsoft/nanoserver bce2fbc256ea: Downloading 3ac17e2e6106: Downloading C:\Program Files\Docker\Docker\Resources\bin\docker.exe: unknown blob. Turns out that you need to have Windows 10 Anniversary Edition (Professional or Enterprise) running on your physical computer. Time for a Windows Update…

.NET Core NuGet packages

I had an issue with some NuGet package where the localized resource DLL’s were not copied(more about this in another post). My first thought was that the resource DLL’s were not part of the NuGet package. But as the NuGet package is a .NET Core package, the content is no longer downloaded to a Packages folder relative to your solution. Instead a global folder is used for all the packages on your system. But what’s the location of this folder? After a search on my file system I found all packages in the following location: c:\Users\[UserName]\.nuget\packages

Angular CLI–Avoid CORS issues

By default when using ng-serve, webpack will serve your Angular 2 content from http://localhost:4200 . However when your backend is hosted on a different URI(which probably is the case) you get CORS errors when you try to call your backend: One solution is to configure CORS on your backend, but if you want to host your frontend code and the backend on the same URI in the end, I have an alternative for you… Angular-CLI allows you to specify a proxy file. In this proxy file you can specify a URI pattern and webpack will proxy these requests to your backend. Let’s see some code: My Angular Component. To simplify the codebase I have put everything inside my component. A better way would be to embed the HTTP logic inside a service. A proxy.config.json file. In this file I specify a URI pattern and the target URI. To invoke the application we have to specify the proxy.config.json path when calling ng serve: ng serve –proxy-config proxy.config.json That’s it!

Azure: Visualize your ARM templates

I’m currently working on setting up an Azure infrastructure using the ARM templates. Although Visual Studio has built-in support for ARM templates, it’s not always easy to configure them correctly and I had to spend a lot of time browsing through the Azure Quickstart templates at https://github.com/Azure/azure-quickstart-templates . One great tool that helped me a lot was ARMViz . This tool allows you to visualize the resources in your ARM template and their dependencies: If you click on a specific resource in the diagram you jump straight to the location in the template.json file. Nice!

TFS–Build fails after upgrading to TFS 2017

After upgrading to TFS 2017, some of our builds started to fail with the following error message: System.Management.Automation.RuntimeException: Source path 'd:\b\3\_work\3\s\<Project>\bin\Release\*.*' does not exist. The issue was caused by our Copy  Files Task as part of our build definition. Turns out that the Source path can no longer contain wildcards(like *.*) but should point to a specific folder or file. After removing the wildcards everything worked as expected… From the documentation :

Visual Studio 2017 Launch

Today is a big day for Visual Studio. The 2017 version will be released and this will not happen without some buzz. From the launch site( https://launch.visualstudio.com/ ): On March 7 , watch our live stream with Julia Liuson, Brian Harry, Miguel de Icaza, and Scott Hanselman as they share the newest innovations in Visual Studio, .NET, Xamarin, Azure, and more. After the keynote, Microsoft engineers will lead interactive technical demo sessions to help you get the most out of Visual Studio 2017 and the rest of our tools and platform. On March 8 , we’ll help you get productive even faster by hosting a full day of live interactive trainings. Make sure to Save the Date for both days and sign up for the March 8 training now .

SQLException when enumerating through the ClaimsPrincipal.Claims

On a ASP.NET Web Application project we got a strange issue, when enumerating through the Claims collection of the ClaimsPrincipal we got a SQLException !? Strange thing is that there was no place in our code where we were using SQL Server. So where was this error message coming from? Turned out that the ClaimsPrincipal in ASP.NET is linked to a RoleManager by default that uses SQL Server as the backing store behind the scenes. Once we tried to access the claims, the RoleManager was called who tried to access SQL Server. To solve it, we removed the default RoleManager module from the ASP.NET configuration using following code: <modules> <remove name="RoleManager" />

MicroServices - Blog series

Great blog series about MicroServices: Introduction to Microservices Building Microservices: Using an API Gateway Building Microservices: Inter‑Process Communication in a Microservices Architecture Service Discovery in a Microservices Architecture Event-Driven Data Management for Microservices Choosing a Microservices Deployment Strategy Refactoring a Monolith into Microservices

The fallacy of code re-use

In software development too much focus remains on re-use. The following quote made me think about a blog post by Udi Dahan I readed years ago "Everybody wants to write reusable code. Nobody wants to reuse anyone else's code." @eryno #leaddev — Meri Williams (@Geek_Manager) 21 februari 2017