Friday, March 28, 2014

Sogeti Visual Studio 2013 ALM Roadshow2014, Örnsköldsvik

I went to Sogeti Visual Studio 2013 ALM Roadshow2014, Örnsköldsvik today. Interesting to hear what's new in Visual Studio 2013. 
Here is my notes from today:

Application Insight

Tool for collecting data on apps performance, crash, environment, etc.


  • Synchronize settings if you login using live account.
  • Scrollbar that gives meta information about the code.
  • Auto history, keeps track of changes locally, makes it possible to make a diff against older versions. Automatically or by doing snapshots.
  • Peek, Inline navigation between sourcecode files. keeps the code/context during navigating/peeking other files.
  • Code Map (VS Ultimate only), Visualizing the code blocks and how they are related. Also when debugging. (Can be opened in VS Premium)
  • Code Lens (VS Ultimate only), meta data inline in code. Test status, testing, bugs, workitem, code reviews, maintainability etc.
  • Team explorer, some tabs can be made floating and be docked  in other areas in VS.

Agile project management

  • Features can be added on a higher level (New in Team Foundation Server TFS 2013)
  • Easy prioriting items
  • Scrum board, easy to move items.

Microsoft Test Manager

  • Create test plan, connected to sprint.
  • Easy to create test cases
  • Can take a test drive of the product and create test case from the test drive.
  • Test professional (Tester or project manager)
  • VS Premium or Ultimate if developers what the test tools.
  • Using the web tools requires license as above.
  • UI test case using C# can be created from tests.
  • Possible to pause and resume test cases.

Release management

InRelease got bought by Microsoft and was integrated into TFS.
  • Free to use to keep track of releases.
  • But automatic deployment requires license for deployment agent (One deployment agent per VS Ultimate license).

Central, Distributed Versioning

  • Check-out Check-in (TFS 2010)
  • Edit Commit (TFS2012, CVS, Suversion)
  • Comit Push Pull (TFS 2013, GIT)

Friday, February 14, 2014

Solved: error: no match for call to '(QString) (QString&)' when emitting signal in Qt

I had an annoyning error message:
error: no match for call to '(QString) (QString&)'
when compiling my qt application.

Took some time before I found what was wrong, the code looked like this:
QString newValue=QString::number(value,'g',1);

if(newValue != value_)
    value_ = newValue;
    emit newValue(value_);

The error is that the signal name is the same as the variable:
QString newValue=QString::number(value,'g',1);

if(newValue != value_)
    value_ = newValue;
    emit newValue(value_);

So the fix is easy, changed the signal name:
QString newValue=QString::number(value,'g',1);

if(newValue != value_)
    value_ = newValue;
    emit updateValue(value_);

Sunday, February 09, 2014

How to make your blogger blog a pinned site with live tiles in windows 8.1

By using you can create the metadata tags that needs to be added to your site.

1. Added the name and some color:

2. Added the blogs rss feed

3. For my blogger site it created:
<meta name="application-name" content="MathiasWestin.Net"/> <meta name="msapplication-TileColor" content="#666666"/> <meta name="msapplication-notification" content="frequency=30;polling-uri=;polling-uri2=;polling-uri3=;polling-uri4=;polling-uri5=; cycle=1"/>
 This was added to the blogger template by editing the HTML like described in

So I added the following directly under the title tag, notice the added if tags needed to work in blogger, not needed if it's your own site:
<b:if cond='data:blog.url == data:blog.homepageUrl'>
    <meta content='MathiasWestin.Net' name='application-name'/>
<meta content='#666666' name='msapplication-TileColor'/>
<meta content='frequency=30;polling-uri=;id=1;polling-uri2=;id=2;polling-uri3=;id=3;polling-uri4=;id=4;polling-uri5=;id=5; cycle=1' name='msapplication-notification'/>
 In IE open the page, right click and choose favorites, click the pin to start button:

The site is now added to start and it's live tiles are updated from the blogs rss feed.

Saturday, January 11, 2014

Unit testing in Native C++ using Visual Studio 2013

Test driven development TDD is used in many languages. and can be used in c++ as well. The support for unit test in native C++ was added in VS2012 and I thought I'll write a short blog post on how to get started in VS2013. I'll be using VS 2013 Express for Desktop for this blog post.

I'll use a static library but it is possible to add test projects to EXE or DLL projects as well for more information on that see:

Start Visual Studio 2013:

Visual Studio 2013 for Desktop
We start by adding the projects that should be tested MathLibrary and add a test project MathLibraryTests.

Choose "Add project":
Add project from start page

Add project from FILE menu
In the Add Project dialog, change the project to be a Visual C++ win32 project and the Name to be MathLibrary:

New Project dialog

In the Win32 Application wizard choose Next:
Win32 Application Wizard - Step 1

 In the Next step choose Static Library:

 Choose finish and the solution and MathLibrary project is created:

Build the MathLibrary project. Note in the output windows that the MathLibrary.lib file ends up in the Debug folder that is in the Solution folder.

Create the Test project by right clicking the solution and choose New Project:

In the New Project dialog, choose a Visual C++ Native Unit Test project and give it the name MathLibraryTests:

Link the MathLibrary with the MathLibraryTests project, this is done with three steps in the MathLibraryTests projects Properties:

1. Add the MathLibrary.lib to the Additional Dependencies in the linker input settings:

2. Add the path to the MathLibrary.lib file in the Additional Library Directories in the linker general settings:

3. Add the include files path in the Include Directories  in the
VC++ Directories:

Rebuild the MathLibraryTests project, The output should say that the build was successful:

The projects are now in place and we can start testing the application functionality. The functionality in this case will take a string with numbers and calculate the sum of the numbers.
Add a new unit test CalculatorTests, Right click the test project and choose "Add new item":

In the Add Item dialog, choose Test C++ Unit Test Class and give it the name CalculatorTests:

Add a new test method by renaming TestMethod1 to CalculateSumWithEmptyStringArgumentReturnsZero:
            // TODO: Your test code here

Add the Arrange, Act, Assert AAA implementation in the test method:
            int expected = 0;
            Calculator calculator{};
            std::string strArgument{ "" };

            auto actual = calculator.CalculateSum(strArgument);

            Assert::AreEqual(expected,actual,L"Should return 0",LINE_INFO());


Run the test project:

Failed or in this case a compiler error = Red

The reson is simple we need to implement the class and metod in the MathLibrary.

Right click the MathLibrary project and choose Add class:

Name it Calculator:

Add a  method CalculateSum,
#pragma once


class Calculator
    int CalculateSum(std::string stringNumbers);

#include "stdafx.h"
#include "Calculator.h"



int Calculator::CalculateSum(std::string stringNumbers)
    return 0;

Include calculator.h in the CalculatorTests class.

Run the test:

Result passed = Green:

Refactor and clean the code = Refactor

Re run the unit test, so no errors have been added.

Continue by adding a new test...

Test Failed.

Add new functioanlity...

Test passed


Test passed...

Well that's not all there is to it, but it's a start. After a while you will see the need for initializing and clean up as well as Stub, Fake, Mock object. 

Saturday, January 04, 2014

Subversion integration in Microsoft Office

Having a lot of specifications in subversion can be a good way to handles changes, but having to jump to explorer to get a lock or check-in makes you loose focus on what your doing.

There is a great plugin to help you handle Office documents in Subversion. The plugin is called msofficesvn it's easy to install there is only a few files to copy and paste in the correct folders, follow the instructions here and you be fine.


Saturday, December 28, 2013

Pencil Project - Tips and Trix

Have been using Pencil project to GUI prototype a project I'm working on. There is a lot of features that might be hard to find info about. Thought I write down a few tips I've found out.

PNG-files can be dragged and dropped in pencil project. When you do this you get a relative path from the project file to the PNG-file. So to make your pencil projects portable or to check in
to a repository make sure that all files that are dragged and dropped are in a sub folder to the project. If you forgot to do this and have moved the project add a sub folder and move all the resource files there and open the project in a text editor for example Notepad++ and change all pathes on the images in the project file.

Ctrl and click on several objects makes it possible to group the objects, this makes you life easy when there starts to be many objects in the design.

Clicking twice on an object makes it possible to rotate the object, by dragging the vertex in the corner.

Thursday, September 26, 2013

Map Collaboration with XSockets and ArcGIS for JavaScript Revisited

Made a blog post approximately two years ago on using and ArcGIS for JavaScript, a lot has happened since my blog post, so I thought it could be interesting to revisit the subject.

Creating a solution is done the same way. What's new is the possibility to create a windows service running the XSockets server using Chocolatey. I will not do this in this post, but I like the idea.

Create New Project. Is done the same way as before:
In VS2012 choose New Project

Create a new ASP.Net MVC 4 Web application
Choose empty web project:
Choose Empty template and Razor view engine

We use Nuget as we did before to import the package:

Install-Package XSockets

Successful installation

The project now have resources added for XSockets.Net

What strikes me is that the need for several projects has disappeared. Everything is neatly in the same project.

For the client side I used the same boilerplate show extent example but with newer ArcGIS for Javascript and XSocket Javascript API to make it easier to follow what changes I needed to do.

Add a new html page in the root of the project:
Add New Item


Now it's time add the sample code:

Don't forget to set the new page to be the start page of the web application, right click the page in the solution explorer and choose start page.

So with the client side done it's time to setup the server side. Create custom Controller (Controller was called handler before):

We do that by scaffolding a new controller:
Scaffold XSocketController DemoController
 The code that gets created should look like this:
Add the following code:

Start the web page by choosing Chrome and start in Visual Studio:

Use the drop down in VS2012 to choose the right browser

This should start the web browser showing a map, start an other chrome instance and copy the adress into that browser. If you did all the steps correct, you will be able to pan the extent in one map and the other browser will follow:
Opened the MapClient.html in two browser windows