Skip to main content


Showing posts from September, 2013

Enable the keyboard in an Android emulator

After creating an Android application using the great Xamarin tools, it was finally time to do some intensive testing on the Android emulator. When starting to test I noticed something really annoying, I had to type everything through the onscreen keyboard and couldn’t use the physical keyboard on my development machine. Fixing this is easy by changing the settings of a specific emulator device: Open the AVD Manager . Select an emulator device. Click on Edit… to edit the properties of this device. The Edit AVD window is loaded. In the Hardware section, click on New.. . A list is loaded with all the properties you can configure. In the Property drop-down list, select Keyboard Support and press OK . This add the property in the hardware list. Click on the value column and change it to "yes" . Click on "Edit AVD" once again to save your changes.

Android: Install an apk file on the Android emulator

A colleague created an Android apk package using PhoneGap build and asked me to test it. But how do you get this apk file on the emulator? Start the Android emulator(through the AVD manager). Open a command prompt and navigate to the SDK\platform-tools folder. Paste the APK file in the 'platform-tools' folder. Execute the following command. adb install [apk file name]

Xamarin.Android: error when calling Azure mobile services

In a mobile application I’m building with  Xamarin Android I connect to an Azure Mobile Services backend. Xamarin made this easy by providing an Azure Mobile Services component. However when I tried to connect to Azure, every call failed with the following error message: “The authentication or decryption has failed.” I was able to fix the problem by switching to a more recent Android version in the emulator.

Enterprise Library 6 and Unity 3 Hands-on Labs available

A few months after the release of Enterprise Library 6 and Unity 3 , Microsoft finally released a set of Hands-on Labs. The comprehensive labs were created by developers for developers. They will be useful both to those who are new to Enterprise Library and those who are experienced with previous versions of Enterprise Library and would like to learn the new application blocks. The labs will guide you through common scenarios of using EntLib and Unity in various application contexts, including advanced ones. They should help reduce errors and promote faster skill acquisition. The labs may also be of value to trainers and academics, since they can be used as teaching aids in the classes devoted to Enterprise Library specifically or in courses on Component-Based Software Engineering, Code Re-use, Enterprise Application Development, or Aspect-Oriented Programming . Go download them here: Download full set of Hands-on Labs for Enterprise Library 6 Download Uni

Entity Framework error: There is already an open DataReader associated with this Command which must be closed first

On a recent project I started to use Entity Framework. So far the experience has been good, but sometimes I get some unexpected issues(and I have to force myself to not go back to NHibernate ). Let’s have a look at the code first: I think there’s nothing special about this code. I first load all the categories and then walk through all the products(which will cause a n+1 issue, but that’s another discussion). When I first ran this code it failed with the following error message: "An error occurred while executing the command definition. See the inner exception for details." When I drilled down to the innermost exception, the following message was shown: "There is already an open DataReader associated with this Command which must be closed first."   To solve this, you have to add an extra part to your connection string: Data Source=srv01;Initial Catalog=Northwind;Persist Security Info=True;Integrated Security=True; MultipleActiveResultSets=

Team Foundation Server WorkItem Charts

With the September 9 release of Team Foundation Service, a nice new feature was released that allows you to create charts from your work item query results. Each query now has a new Charts view. From that view you can create charts based on the data returned by the query. To test the feature, execute the following steps: Go to your Team Foundation Service instance:">https://<instancename> Click on a project on the Overview page On your project dashboard click on the WORK tab Click on the Queries tab Click on the Charts option in the Query view Click on New Chart to create your first Chart. The Configure Chart dialog is loaded Choose a chart type on the left and a ‘Group by’ option on the right. A preview of the chart is shown. Click OK to add the Chart to the Query view. Nice!

Impress your colleagues with your knowledge about…Environment.FailFast

Sometimes when working with .NET you discover some hidden gems. Some of them very useful, other ones a little bit harder to find a good way to benefit from their functionality. One of those hidden gems that I discovered some days ago is Environment.FailFast . The FailFast method stops your program immediately, ensuring that no further code can execute. As this means that you cannot report the problem directly to the user, this static method includes a parameter, to which you can provide a string containing a status message. This message is recorded in the application event log. When is this method useful? One scenario where this method is useful is when your program can enter an unstable state that introduces the risk of data corruption. If this means that it is not possible to continue with the process safely, it may be necessary to exit the program and report an error. Environment.FailFast allows you to kill the process immediately, ensuring that no further code executes. Ano

Developing Big Data solutions on Windows Azure

The Pattern and Practices team has released a preview of their new e-book: ‘Developing Big Data solutions on Windows Azure’. The book can be downloaded from the Patterns & Practices Windows Azure Guidance site . Topics Covered in This Book What is Big Data? Getting Started with HDInsight Collecting and Loading Data Performance Queries and Transformations Consuming and Visualizing Results Debugging, Testing, and Automating HDInsight Solutions Managing and Monitoring HDInsight Scenario 1: Iterative Data Exploration Scenario 2: Extra, Transform, Load Scenario 3: HDInsight as a Data Warehouse Scenario 4: Enterprise BI Integration

Durandal 2.0 released

Rob Eiseinberg, the creator of the great MVVM framework Caliburn.Micro , has shown his JavaScript skills and build a Singe Page Application framework called Durandal .  A few weeks ago, a 2.0 version of this framework was released introducing a large list of new features and functionality. What’s new in Durandal 2.0? A streamlined core with a plugin model for official and community extensions. Now lives side-by-side with other 3rd party scripts A new router with no external dependencies. It supports parameterized routes, optional parameters, splats and query strings. The router handles hash change and push state, supports relative child routers, advanced deep linking hooks, convention-based routing, an event model…and more. More powerful composition of screens, components and widgets. We’ve ironed out the kinks in composition by making the callback lifecycle more consistent and more granular. As part of the process we fixed bugs and extended it with new capabilities

Windows 8–Add a live tile for your website

Windows 8 introduces the concept of ‘live’ tiles. Microsoft’s explanation of live tiles: “Live tiles sit on the Windows 8 start screen, and are useful for having instantaneous information on constantly changing data like stock indexes, international weather, as well as local and international news. Live tiles replace the need to visit certain websites that contain this information, something that many PC users do on a daily basis. Live tiles also replace the need to launch any of the apps that provide this information; live tiles provide you with short, immediate updates without having to leave your start screen.” But did you know that you can also add live tiles for your website? Doing this is easy! Follow these steps to add live tile support for your website: Go to Click on Build your own site tile Specify a Title, Background color and Upload an image . Click on Add Notifications Specify the URL of y

Building Sharepoint 2013 projects on your TFS Build server

With the release of Visual Studio 2012 and the improved Sharepoint integration, building, packaging and deploying your Sharepoint solutions became a lot easier. Still if you want to get everything running on your build server, you’ve got some work to do. On your TFS 2012 Build server, the following components need to be installed: If Visual Studio 2012 Professional (or above) is installed, install the following component Microsoft Office Developer Tools for Visual Studio 2012 If Visual Studio 2012 Professional (or above) is NOT installed, you will need to collect build dependencies from a machine with the following product installed: Visual Studio 2012 Professional (or above) Microsoft Office Developer Tools for Visual Studio 2012 SharePoint Server 2013 Run the following PowerShell command to make sure your PowerShell execution policy i

Responsive Design in Sharepoint

You want to apply Responsive Design in Sharepoint? Have a look at Responsive Sharepoint . It provides  a conversion of popular grid and responsive frameworks to a SharePoint 2010 and SharePoint 2013 version.Today, Twitter Bootstrap and Zurb Foundation are supported. More information here:

Windows Azure Infographics

Looking for a good high level overview of what Windows Azure has to offer? Take a look at the Windows Azure Infographics . These technical posters are excellent for learning and training. Following posters are available: Windows Azure: An overview of Windows Azure, features, services and common uses Cloud Services: Scaling an application using Cloud Services, including designing, deploying and tuning. Media Services: The workflow for Media Services, from media creation through consumption. Infrastructure Services: Common scenarios for Infrastructure Services. Integration Platform: The MS integration platform, including enterprise integration with the cloud. Mobile Gaming: The features for gaming, including data, computing, authentication and media. Mobile Services: Features and capabilities, including storage, authentication, push notifications, and custom server-side code

ASP.NET MVC 4: Error when using anti-forgery token in combination with claims-based authentication

Enabling Claims Based authentication on your ASP.NET MVC project is easy: Create a new ASP.NET MVC web application Right click on the project and choose the Identity and Access… option(if you don’t see this option, make sure that you have the Identity and Access Tool extension installed) Walk through the configuration wizard and… done! But when I tried to do this on a new project, it failed with the following error: “A claim of type '' or '' was not present on the provided ClaimsIdentity. To enable anti-forgery token support with claims-based authentication, please verify that the configured claims provider is providing both of these claims on the ClaimsIdentity instances it generates. If the configured claims provider instead uses a different claim type as a unique identifier, it can be configured by s

ASP.NET Web API: HttpContext.Current is null inside Task

A few days ago, a colleague asked my help to solve an issue he had with ASP.NET Web API. His code looked like the following: The problem was that HttpContext.Current was always null after switching to another task. When I tried to reproduce the issue by building a similar sample on my computer, it just worked. The only difference between his code and mine was that I created an ASP.NET Web API 4.5 application, where he was still using ASP.NET 4. So switching to .NET 4.5 solved the problem. But why? It seems that in ASP.NET 4.5, a task friendly synchronization context got introduced. This synchronization context ensures that the originel context is restored after leaving the await block. So make sure that you either: Set httpRuntime.targetFramework to 4.5 , or In your appSettings , set aspnet:UseTaskFriendlySynchronizationContext to true . Some more information can be found here .

Team Foundation Server 2012/Service: Create events from web access for other user

I always enjoy browsing through Team Foundation Service, the cloud version of  TFS.  Every day I discover new functionality and features. Last week I noticed that administrators are able to create team alerts for other users. You could already do this by using the Alerts Explorer from the TFS Power Tools but then those alerts are actually owned by the person creating them and not able to be managed, edited, or disabled for the person they are intended. Afterwards I went back to our on premise TFS environment to notice that the same functionality was also available there… To use this feature: Open the Team Foundation Server web access Browse to a specific Team Project Click on the configuration icon in the right corner to go the configuration section On the Overview page click on a Team name: On the Team configuration page, click on alerts In the Administrator actions on the left, you can search for another user After selecting a user, y

IIS error: Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel’

The last months my laptop started to act strange, 2 or 3 random crashes a day, USB ports that started to fail, extreme CPU usage and so on… And yes, all doctors gave the same diagnosis, my pc was dying. So I took a backup almost every day until it finally happened, one final crash and my system was gone. After getting a new laptop I started to reconfigure my development environment. After installing IIS I tried to open an existing WCF service and was welcomed by the following yellow screen of death: “Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089'.” This error occured because I installed IIS the .NET Framework 4. Solving this problem isn’t hard, just open up the ASP.NET IIS Registration Tool (Aspnet_regiis.exe,) to register the correct version of ASP.NET. This can be accomplished by using the –iru parameters when running aspnet_regiis.exe

Unity 3.0 and Enterprise Library 6: Attribute based Policy Injection

For some time, Microsoft Unity supports the concept of Interception. It allows you to inject cross cutting concerns into your code by intercepting method calls and giving you the opportunity to execute some extra code before and after the call. One of the nice features is that it integrates well with the Microsoft Patterns and Practices Enterprise Library Application Blocks(pfew, what a long name). So you can easily add for example caching or exception handling to your application without having to write the same code over and over again. Until Enterprise Library 5.0 this was all encapsulated in a separate application block, the Policy Injection application block. Starting from Enterprise Library 6 this block is gone, although the same functionality should still be available inside the Unity.Interception DLL. When upgrading to Enterprise Library 6.0, I was able to recreate most scenario’s by using this DLL. The only thing I had some trouble with finding out is how to combine Att

Entity Framework Code First: Invalid column name

Last week I was creating a sample project to show some of the Entity Framework Code First features. I only had an old Northwind database available so I mapped my model against this database. But after writing and running my first test I was welcomed by a nice error message: Test Name:        CanLoadSuppliersByProductCategoryName Test FullName: Test.Data.Tests.SupplierRepositoryTests.CanLoadSuppliersByProductCategoryName Test Source:      c:\Projects\Sample\Tests\SupplierRepositoryTests.cs : line 22 Test Outcome: Failed Test Duration:   0:00:00,784 Result Message:              System.Data.EntityCommandExecutionException : An error occurred while executing the command definition. See the inner exception for details.   ----> System.Data.SqlClient.SqlException : Invalid column name 'Category_CategoryID'. Invalid column name 'Supplier_SupplierID'. Result StackTrace:          at System.Data.EntityClient.EntityCommandDefinition

Microsoft Unity Dependency Injection finally available on Windows Phone 8

Good news! Microsoft has finally ported Unity DI Container to Windows Phone 8. The Unity NuGet package now contains a version for: The full .NET framework. The NetCore version (for Windows Store apps). The WP8 version.