Skip to main content

Posts

Showing posts from February, 2016

Adventures in Xamarin Forms

With the recent announcement that Microsoft is buying Xamarin, I thought it was time to have a second look at Xamarin Forms(I took a first look more then a year ago, so hopes are that it evolved a lot in the meanwhile). The most interesting resource I could find is the Adventures in Xamarin Forms blog by Jonathan Yates in which he describes the lessons he learned while creating the Mountain Weather application.

Using NPM behind a company proxy

Yesterday I was giving training about Team Foundation Server when I wanted to demonstrate the tfs-cli tool. However when I tried to download the tool using npm install -g tfx-cli it failed. A company proxy was preventing npm to be able to connect to the outside world. To fix this, you have to update the npm configuration file and specify the the proxy setting. Open a command prompt and run the following command to do this: npm config set proxy http://proxy.company.com:8080 We also noticed that the first time we did this it didn’t work because the user wasn’t authenticated yet at the proxy level. However after opening up a browser and surfing to a site outside the company network the user was authenticated to the proxy and we were able to call npm.

TFS 2015–Uploading Build vNext tasks without enabling basic authentication

I talked about the tfs-cli tool before. This tool allows you to create and upload your own custom build steps both in VSTS and TFS on premise. Unfortunately to be able to use it on your local TFS instance, you have to enable Basic Authentication . If you don’t want to do that, you have to use the REST api’s to upload your custom task. Although this is certainly possible, it’s not that easy to do. Luckily a colleague spend some time creating a Powershell script to simplify the process: Just invoke the script, specify the location of your custom tasks, the url of your TFS instance and your windows credentials.

Arc42–Resources for software architects

As an architect, part of my job, lies in design, communication and documentation. Documents, (UML)diagrams and white board pictures(my favorite !) are necessary parts of defining and describing a system & application architecture. Last week I heard a podcast where they were talking about arc42, a template for documenting of software architectures: Here is a sample of documentation created with it: https://rawgit.com/aim42/htmlSanityCheck/master/build/html5/hsc_arc42.html More information: http://arc42.org/ https://github.com/arc42 http://arc42.github.io/

Avoid the use of task.Result

With the introduction of async/await, asynchronous programming in .NET  becomes a breeze. However with great power, comes great responsability. I see a lot of programmers starting enthousiastic with the Task Parallel Library and the async/await syntax but a few days later, they start to report strange bugs and issues with their code(or even worse the end-user start to report this). Almost all the time it is because developers didn’t fully understand what’s going on behind the scenes and when we dig into the code, there is almost all the time the following code(or similar): var httpClient = new HttpClient(); var t = httpClient.GetAsync("http://stackoverflow.com", HttpCompletionOption.ResponseHeadersRead); return t.ContinueWith(t1 => t1. Result .Content.Headers.ToString()); If you use the code above in a Console application, it should not be a problem. However if you try to do the same thing inside an ASP.NET(MVC) application you’re into trouble. Wh

A devops mindset for your enterprise

DevOps is cultural change that impacts every part of your organisation not only the development and operations departments. I hear a lot of (IT) organisations talk about DevOpsbut if you talk to their managers they have no insights in the delivery capability of their organisation, and even worse they are not interested. This is a recipe for disaster. It’s exactly the same reason why I see Agile fail in organisations, because it requires the exact same cultural shift. Without management involvement, the impact will be minimal… Why are managers not interested? Taking a look at most organisation structures brings some answer. You see a separate team of operation guys, a separate team of developers, a separate team of testers, … . Each of these teams have their own managers, living in their own silo with their own goals. These managers are very rarely accountable for the end-to-end delivery of customer value. A manager responsible for ‘server operations’ will never care about the healt

Domain Driven Design in 15 minutes

Domain Driven Design is new to you? Or you have heared about it and want to learn more? And you don’t have much time? The guys from DZone created a new DZone RefCard about Domain Driven Design. In one big article they walk through the main concepts. Just enough to get you excited !

Bootstrap modal dialog issue: Dropdown always closes

Last week, a developer reported a strange issue: he was using the Bootstrap modal dialog. On this dialog he added a dropdown control(a  KendoUI control in this case). The problem was that each time he opened up the dropdownlist to  select an item, it immediatelly closed again. When we investigated the issue, we noticed that the moment the dropdown list opened, the Bootstrap modal dialog steals the focus and a blur event is triggered. This blur event makes the control close again. After further investigation we discovered what was causing this behavior. The dropdownlist creates a hidden popup element on the page. This popup element is not part of the modal dialog content. This means that when you click on the popup element, the modal dialog thinks that you want to move out of the dialog and therefore triggers a blur event. I noticed the same behavior not only with the KendoUI DropDownList control but also with other dropdown controls like  Select2 . We found 2 possible solution

TFS Widget blog series

The ALM rangers are unstoppable. Now they created a blog series about building your own widgets for the Dashboard in TFS 2015. (For this screen, in case you have no clue: )   Here is the full series: Getting started with Widgets: http://blogs.msdn.com/b/visualstudioalmrangers/archive/2016/02/01/getting-started-with-widgets.aspx Developing the Widget: http://blogs.msdn.com/b/visualstudioalmrangers/archive/2016/02/01/developing-the-widget.aspx Issues and resolving them: http://blogs.msdn.com/b/visualstudioalmrangers/archive/2016/02/01/issues-and-resolving-them.aspx Publishing widgets: http://blogs.msdn.com/b/visualstudioalmrangers/archive/2016/02/01/publishing-widgets.aspx

Team Foundation Server 2015: Add Git and TFS Version Control repositories to the same Team Project

With Team Foundation Server 2015 Update 1, Microsoft introduces the option to add Git repositories to your existing team project created with TFVC (or vice versa). This is great if you are using TFSVC today and want to move to Git but you want to keep your work items, build definitions, and other data. How? Open the Team Project web portal inside your favorite browser Go to the Code hub Open the repository selector Click on New repository… Choose the repository type and a name for your repository Click on Create That’s it! Remark 1: You need Visual Studio 2015 Update 1 to see the repository appear inside the Team Explorer view. VS 2015 RTM and previous version only show the repo created with the team project Remark 2: It is possible that you have to configure some security settings to allow access to the new repository type. This will be fixed in Update 2. In the meanwhile you can follow the steps as explained here: https://msdn.mi

JavaScript Memory Management Masterclass

If you want to learn more about the ins and outs of Memory Management inside the browser and the JavaScript runtime (and you should!), have a look at this great video by Addy Osmani:

TFS Build vNext–Build tasks cannot handle spaces in repository path

I’m a big fan of the new build system in TFS. However it’s still a learning process for me. After adding the NuGet Packager task, my build failed with the following error message: 1.  T02:04:25.2941286Z Creating Nuget Arguments: 2.  2016-02-08T02:04:25.3019414Z --ARGS: pack d:\b\3\_work\1c61834d\ my demo project \NugetSpecs\test1.csproj.nuspec -OutputDirectory d:\b\3\_work\1c61834d\demo -Properties Configuration=Release -version 2016.2.8.1 3.  2016-02-08T02:04:25.3029180Z Invoking nuget with pack d:\b\3\_work\1c61834d\my demo project\NugetSpecs\test2.csproj.nuspec -OutputDirectory d:\b\3\_work\1c61834d\demo -Properties Configuration=Release -version 2016.2.8.1 4.  2016-02-08T02:04:25.3029180Z D:\b\3\agent\worker\tools\NuGet.exe pack d:\b\3\_work\1c61834d\my demo project\NugetSpecs\demo3.csproj.nuspec -OutputDirectory d:\b\3\_work\1c61834d\demo -Properties Configuration=Release -version 2016.2.8.1 5.  2016-02-08T02:04:28.3342844Z pack: invalid arguments.

ASP.NET MVC–Precompile Razor views on Release build

Last week I was investigating slow startup times of an ASP.NET MVC web application. We were able to trace the root cause to a really complex Razor page. This was the first page that was loaded and takes a long time to compile. By default Razor compilation happens the first time a Razor page is requested by the browser. However you can change this and prebuild all the Razor pages by adding the MvcBuildViews tag to your .csproj file: <?xml version="1.0" encoding="utf-8"?> <Project> <PropertyGroup> <MvcBuildViews>true</MvcBuildViews> Unfortunately it had a large impact on the build times making debugging a pain for the developers. So in the end we decided to only precompile Razor on a release build. Therefore we had to add 2 MvcBuildViews tags with a condition: <MvcBuildViews Condition="'$(Configuration)'=='Debug'">false</MvcBuildViews> <MvcBuildViews

TFS Build vNext: SonarQube error - Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0

After installing SonarQube and enabling the integration with our TFS Build server, the moment of truth was there. It was time to kick off our first build and let SonarQube analyze our code quality. Unfortunately the SonarQube build task failed with the following error: 2016-01-29T08:26:36.0469894Z ##[error]Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0 2016-01-29T08:26:36.0479657Z ##[error]The SonarQube Scanner did not complete successfully Whoops! It seems that SonarQube is providing an option flag ‘MaxPermSize’ which was removed in Java 8.0. To fix it, I did the following: Log in on the server where you have SonarQube installed Go to the System properties and open the Environment Variables Search for the SONAR_OPTS environment variable Remove the MaxPermSize=512m; from the value Save your change and reboot the server That should do the trick…

SpecFlow v2 finally arrived

We had to wait for it a long time, but now it’s finally there, a new release of SpecFlow; my favorite  Behaviour-Driven Development (BDD) tool. So what’s new? Important changes in SpecFlow V2 include: All components upgraded to .NET 4.5. Upgraded to the new Gherkin 3 parser Support for parallel SpecFlow tests within the same AppDomain Visual Studio integration has been separated to a separate project Support for xUnit 2.0 and NUnit 3.0, including parallel test execution. The older providers have been retained and renamed (to xunit.1 and nunit.2 respectively). Ability to determine the execution order of hooks (e.g. [BeforeScenario] ) Extensible table conversions and comparisons for CreateSet, CreateInstance, CompareToSet and CompareToInstance . Access the details of the currently executed step with ScenarioContext.StepContext Display tags in NUnit test adapter in Visual Studio Better regular expression suggestions generated for missing

Shrink your environmental footprint: IFIXIT

With a small boy in the house, our pile of broken things kept growing and growing, not only toys but also electronic devices(think remote controls and XBOX controllers ) and other household stuff ended on the pile after he tried to use it in a kind of destructive fashion. Instead of throwing everything away, it was time to dust off my soldering and electronic skills and try to repair some of these things. This was easier said than done as most electronic devices(including toys) seems to not be created with repairability in mind. Luckily I discoved IFIXIT , an amazing site with lots of great (free!) step-by-step repair manuals. If you want to stop throwing things away and start with shrinking your environmental footprint, this site is a great help. And if you need some tools to get your repair work going, they sell repair kits, spare parts and tools. I’m a fan!

F# Beginner Tip: File order matters!

One thing that you should be aware of when you build your first ‘real’ F# application, is that in F# file order matters. F# requires files (and code within) to be in dependency order. This means that you have to rethink how to organize your code. Have a look at the following post on http://fsharpforfunandprofit.com/ (great site btw for every F# developer out there): http://fsharpforfunandprofit.com/posts/recipe-part3/ Luckily Visual Studio provides some context menu options that allow you to re-order the files inside your F# projects:

SonarQube: Error when running it as a Windows Service

After installing SonarQube, you can run it as a Windows Service by executing the InstallNTService.bat file inside the %SONARQUBE_HOME%/bin/windows-x86- 32 /InstallNTService.bat folder. However when I tried to do this, it failed silently and I only saw the following on the command line: --> Wrapper Started as Service Launching a JVM... Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved. <—Wrapper Stopped Luckily the documentation brought the answer.By default the SonarQube windows service is installed under a local account but you need administrative permissions to be able to run SonarQube. Here are the steps to fix it: Open the list of installed services on your system(search for services.msc) Right click on the SonarQube service in the list Click on Properties Go to the LogOn tab Change the LogOn from a Local System Account to another account with administra

SonarQube configuration error: Failed to load the sqljdbc_auth.dll cause : no sqljdbc_auth in java.library.path

While configuring a SonarQube server to use SQL Server, I encountered the following error after enabling Integrated Security in the JDBC connection string. After adding “ integratedSecurity=true ” I got the following error message when I tried to start SonarQube: WARNING: Failed to load the sqljdbc_auth.dll cause : no sqljdbc_auth in java.library.path Let’s fix this: First of all make sure that you downloaded the Microsoft JDBC drivers(available here: https://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=11774 ) Run the exe to extract the content. Inside you”ll find the sqljdbc_auth.dll Copy this dll inside the windows\system32 folder That should do the trick…

ASP.NET 5 & ServiceFabric: Unable to locate Dependency Microsoft.AspNet.Server.WebListener >= 1.0.0-rc1-final

When adding an ASP.NET 5 Web API to my ServiceFabric solution, restoring the NuGet packages failed with the following error message: Errors in Projects\MyActor\Web1\project.json     Unable to locate Dependency Microsoft.AspNet.Server.WebListener >= 1.0.0-rc1-final Restore complete, 73193ms elapsed This is an issue in the current version of the SDK. You can fix it by executing the following steps: Go to your ASP.NET 5 web project Open the project.json file Add a space to the file and save it This will trigger a NuGet Package restore and the missing dependency will be downloaded

ASP.MVC: Async/Await in action filters

A colleague was having some trouble with his ASP.NET MVC 4 application. Whe he started his application, the process “hanged” and he had to kill the w3wp process to be able to restart. We were able to pinpoint the problem to a call to an async method inside an Action Filter: It seems that there is no support for async filters in ASP.NET MVC 4. The call to .Result in the action filter resulted in a blocking operation making the whole application pool unavailable. We solved it by switching to a non async version of the api. Remark: Note that ASP.NET Web API does have support for async action filters.