Skip to main content

Posts

Showing posts from July, 2014

Team Foundation Server Git–Where are my branches?

As you probably already know, Team Foundation Server offers 2 options to store your source code; either through the ‘classic’ Team Foundation Server Version Control or through Git. I really like Git and the powerful features it offers, so if I have the choice I use Git as my preferred source control system. For a project I’m working on I created a git repo with 2 branches on my Windows 8 development machine and pushed this repo to the origin TFS Git repo. I also have another PC where I still run Windows 7. So when I had to make a small change while I was using my Windows 7 machine so I cloned the TFS Git repo. However when I opened up the solution in Visual Studio and wanted to switch between branches I only had one branch available! Where is my other branch and how can I switch to it? What I didn’t know is that when you do a clone in git, only one branch is created(generally master). To create a local branch for a branch that is not yet available on your machine, you’ll have t

Visualizing algorithms

I’ve always been fascinated by algorithms and how they play in important part in IT. Although I spent most of my time building line-of-business applications, I do like to understand the theory and concepts in computer science and how this theory can help us solve different kind of problems. With technologies like Big Data and Machine learning, algorithms are back in the spotlight. A great post that can help you understand different algorithms and their implementation, is Visualizing Algorithms . In this post Mike Bostock takes us through different algorithms and shows us how they work in a visual way. Very interesting to read and watch!

Visualizing algorithms

I’ve always been fascinated by algorithms and how they play in important part in IT. Although I spent most of my time building line-of-business applications, I do like to understand the theory and concepts in computer science and how this theory can help us solve different kind of problems. With technologies like Big Data and Machine learning, algorithms are back in the spotlight. A great post that can help you understand different algorithms and their implementation, is Visualizing Algorithms . In this post Mike Bostock takes us through different algorithms and shows us how they work in a visual way. Very interesting to read and watch!

Entity Framework–Rollback a migration

One of the features that Entity Framework offers is the support for Code First Migrations. Migrations allow you to create ‘Up’ and ‘Down’ scripts to upgrade your database while your Entity Framework models evolves over time. Last week I had some trouble with Code First Migrations, so I needed a way to rollback to an earlier version of my database. Thanks to Code First migrations, I was able to do this by executing 1 line on the Package Manager Console: That’s all…

F# Cheat Sheet

While learning a new language, I always try to have a cheat sheet laying around. If you are in doubt about a certain language construct, a quick look is enough to get going again. For F# I can recommend the F# Cheat Sheet on Github:

Entity Framework Query Batching

I’ve been an NHibernate fan for a long time, but on my recent projects I’m making the switch to Entity Framework. Although I like the overall experience, there are still lot of features missing. One of the things I liked about NHibernate was the support for query batching using the NHibernate Future<> syntax. This allowed you to write multiple simpler queries instead of writing one complex one. The moment you try to read one query result, all batched queries are sent in 1 command(!) to the database and the results are returned. Although a similar feature does not exist in Entity Framework out-of-the-box, you can use the EntityFramework.Extended library to get this functionality. This library extends the functionality of Entity Framework with the following features: Batch Update and Delete Future Queries Query Result Cache Audit Log In this case I’m looking at the Future Queries feature:

TF400917: The current configuration is not valid for this feature. This feature cannot be used until you correct the configuration.

One of my clients modified the TFS process template for one of their projects. They updated the bug Work Item and added some extra states. Everything seemed to work until they opened up the TFS Scrum board. Instead of a nice and fully functional Scrum board, they got the following error message: TF400917 : The current configuration is not valid for this feature. This feature cannot be used until you correct the configuration. To fix this, I had to execute the following steps: Export the CommonProcessConfig xml: C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE>witadmin exportcommonprocessconfig /collection: <collectionurl> /p: <projectname> /f:c:\processconfig.xml Update the BugWorkItems section inside the XML and add the missing states: <BugWorkItems category="Microsoft.BugCategory">     <States>       <State type="InProgress" value="Not Done" />     

Angular.js: using relative paths

One of the issues I had with Angular.js (but also with other JavaScript frameworks) is that URL’s you create on the client are relative to the server root address. This is fine as long as your application is hosted on the server root(e.g. www.myservername.com ), but the moment you start using virtual directories(e.g. www.myservername.com/virtualdirectoryname ), you’re into trouble. Let’s have a look for example to the following Angular service: The problem is that when you host this service in a virtual directory, the HTTP call will be send to http://www.myservername.com/api/applications and not to www.myservername.com/virtualdirectoryname/api/applications as you would expect. There a multiple ways to solve this issue.  I did it by rendering the rootUrl inside my ASP.NET Razor view. This url is generated by the server and embedded in the page: Inside my Angular app, I added some code that read this value from the html and register it as a constant value: This allows me

Visual Studio Online licensing changes

Great news! Brian Harry announced some licensing changes regarding Visual Studio Online: …As a result of all this feedback we proposed a new “Stakeholder” license for VS Online.  Based on the scenarios we wanted to address, we designed a set of features that matched the needs most customers have.  These include: Full read/write/create on all work items Create, run and save (to “My Queries”) work item queries View project and team home pages Access to the backlog, including add and update (but no ability to reprioritize the work) Ability to receive work item alerts We then surveyed our “Top Customers” and tuned the list of features (to arrive at what I listed above).  One of the conversations we had with them was about the price/value of this feature set.  We tested 3 different price points - $5/user/month, $2/user/month and free.  Many thought it was worth $5.  Every single one thought it was worth $2.  However, one of t

Trying the ASP.NET session state provider for Redis

After the news about the support for Redis on Windows Azure , Microsoft also announced a preview release of an ASP.NET session state provider for Redis . I am using the ServiceStack.Redis client for a long time, but I wanted to give it a shot and switched to the Microsoft.Web.RedisSessionStateProvider . However when I tried to use it, ASP.NET returned a yellow screen of death and showed the following error message: “Could not load file or assembly ‘StackExchange.Redis, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c219ff1ca8c2ce46’ or one of its dependencies. The system cannot find the file specified.” The RedisSessionStateProvider is using the StackExchange.Redis client behind the scenes. As I installed it through NuGet, a newer version of the assembly was installed than expected. I fixed it by removing both NuGet Packages and first installing an older version of the StackExchange.Redis client.

Angular.js: controller as syntax

Starting from Angular.js 1.2 a new syntax for your controllers was introduced. This syntax resembles more to an MVVM style of development and completely removes the need of the $scope object inside your controllers. Instead you can just add your objects and methods to “this”. Let’s have a look how to implement this: The ng-controller attribute value in the html is changed to include the "as" keyword: <div class="row" ng-controller="ProductsController as vm "> Now everywhere you use controller properties or methods inside the html you now need to use the "controller as" alias. <div class="row" ng-controller="ProductsController as vm">         <div class="col-md-2">{{ vm. product.name}}</div>         <div class="col-md-2">{{ vm. product.price}}</div>  </div> The controller itself changed also and looks like this: va

Reporting Services error: An error has occurred during report processing. (rsProcessingAborted)

After deploying some reports to our reporting services environment, the first time I try to load a report, it always failed with the following error message: An error has occurred during report processing. (rsProcessingAborted) Cannot create a connection to data source 'dsNorthwind'. (rsErrorOpeningConnection) For more information about this error navigate to the report server on the local server As the error suggested I could get more information if I browse to the report server locally. So I logged into the report server and ran the report again. This time I got a timeout error telling me that it took too long to connect to the database. Similar information could be found in the log files located at: %programfiles%\Microsoft SQL Server\<SQL Server Instance>\Reporting Services\LogFiles\ I was able to fix the issue by updating the timeout value inside the shared datasource.

DotNetConf 2014 videos online

In case you missed the DotNetConf free online conference, all videos are available online. Some sessions I could recommend watching:

Entity Framework Tooling: GraphDiff

While looking for a good solution to save a detached object tree using Entity Framework, I found the perfect solution: GraphDiff . GraphDiff offers a set of DbContext extension methods for Entity Framework Code First, that allow you to save an entire detached Model/Entity, with child Entities and Lists, to the database without writing the code to do it. It has the following features to offer: Merge an entire graph of detached entities to the database using DbContext.UpdateGraph(); Ensures concurrency is maintained for all child entities in the graph Allows for different configuration mappings to ensure that only changes within the defined graph are persisted Comprehensive testing suite to cover many (un/)common scenarios. GraphDiff is really easy to use. Just take your object tree and tell Entity Framework how to attach the child objects: More information here: http://blog.brentmckendrick.com/introducing-graphdiff-for-entity-framework-code-first-allowing-automated-updates-o

Visual Studio: Change the default check-in action to associate

By default when you check-in some code in Visual Studio and choose a related work item, the work item will be resolved. Depending on the TFS template you’re using this will change the work item state. Most of the time it means that the work item state will be changed to Done/Completed/… . This is nice if you only want to check-in once when your work item is really done. But if you are like me, and you like to check-in on a regular basis, than this is annoying as you have to change the check-in option to associate instead of resolve every time: To fix this, you have 2 options; either update the Work Item template or even better change the following registry key and set ResolveAsDefaultCheckinAction = False . HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\TeamFoundation\SourceControl\Behavior   Thanks Jens( @jhelderweirdt ) for the tip!

Finding the right balance: Simplification vs Optimization

Maybe you don’t care, but there is a reason I named my blog the ‘Art of Simplicity’. As an application architect I always think about the following quotes when building out an architecture “Simplicity is the ultimate sophistication.” — Leonardo da Vinci “Perfection is Achieved Not When There Is Nothing More to Add, But When There Is Nothing Left to Take Away” – Antoine de Saint-Exupery “Everything should be made as simple as possible, but not simpler.” – Albert Einstein As an architect I see it as my job to find the right balance between simplification and optimization. I’ve been in situations where a quick and dirty change will haunt us forever but I’ve also seen the opposite where so called ‘best practices’ introduced an endless list of layers of indirection(facades that call services that call factories that call builders and so on…)  where no one has a clue what’s going on. The best architectures are the ones were the solution is as simple as possible, but not simpler

Team Foundation Server 2013 - witadmin.exe exportprocessconfig issues

By using the witadmin exportprocessconfig command, you can export the TFS process configuration XML and adapt it to your needs. Afterwards you can upload it again by using the corresponding witadmin importprocessconfig command. witadmin.exe exportprocessconfig /collection:http://tfs:8080/tfs/defaultcollection /p:sampleproject /f:processconfig.xml The thing I noticed that I wasn’t able to upload this XML file again. Even when I changed nothing it did not work. Instead I got the following error: Line: 3 Position: 4 - The required attribute `pluralName` is missing. The exportprocessconfig command generates incorrect XML. To fix this you have to add the missing attributes yourself. Anyone who knows if a fix already exists?

Team Foundation Server: Be careful when using the ChangeServerId command

Before I upgrade a production TFS environment, I always try do to a test migration. This gives us the opportunity to detect possible issues as soon as possible and give some people the change to test the new environment before we do the real migration. What you need to be aware of when doing this is that TFS uses a set of internal GUIDs.  The server has a GUID, the collections have GUIDs and even Team Projects have GUIDs.This means that when you do a migration your new TFS environment will use the same GUIDs out-of-the-box. This is nice because when a user connects to another server with the same GUIDs Visual Studio will automatically transfer all of the user’s cache and workspaces to the new server. This makes an upgrade really convenient and transparent for the user. So this is perfect for the ‘real’ migration, but for the ‘test’ migration it’s a problem. Because the moment any user tries to connect to the new environment, he gets into trouble when trying to connect to the old en

Azure Web Jobs Installer

I’m currently working on a project where we want to use the WebJobs feature of Azure Websites. Azure WebJobs enables you to run programs or scripts in your web site either continuously, on demand or on a schedule. I really like this feature, the only thing annoying is that you have to deploy your web jobs separately. You cannot use Web Deploy and deploy it together with your Azure Website. Thanks to the WebJobsVS extension this is no longer true, and you get a way to deploy your web job together with your website. From the site : With this extension you can right click on a web project in Visual Studio and associate a console project as a WebJob. After doing that when you publish the web project the webjob project will be published into the correct location in your Azure Web Site. After selecting this you will see the following dialog. In this dialog you'll select the console project which contains your webjob and specify the schedule for the webjob. If