Useful Developer Tools #4: f.lux

It is no secret, that most developers are nocturnal. That’s why there are many tools that makes a coder’s nightlife easier. Dark Mode in IDEs is a good example. But did you know f.lux? This tiny tool makes the color of your computer’s display adapt to the time of day, warm at night and like sunlight during the day. Simply by filtering your display’s blue colors at when it gets darker, which is super healthy as it reduces eye-strain and makes you even sleep better!

Sounds super weird and looks crazy when you try it out first but believe me: If you used it once for a day or two, you’ll never wanna go without again! It is completely free and works on most OS, even (rooted) Android or iOS devices. Give it a try!

Screenshot of f.lux app



Manually connect and send data to an Azure Event Hub

Update 04.02.2017: As the Microsoft.Azure.EventHubs NuGet package since two days finally support every .NET platform, this post go obsolete.

Azure Event Hubs provide a neat way to collect loads of data that is pushed against them and holds it until its processing. Microsoft offers an SDK to work with Event Hubs for most platforms including .NET, of course. Unfortunately, the provided NuGet package does not work on all .NET platforms, so when targeting UWP for example, you have to implement the Event Hub connection by yourself, which can be a little bit tricky. Here is how to manually connect and send data to an Azure Event Hub.

Get the connection information

Once the Event Hub has been created, open the Service Bus section in the Azure Portal and navigate to your Event Hub. Select the Configure tab and scroll down to the Shared access policies section. Make sure, you created a policy that has the permission to send data to the Event Hub and note its Name and Primary Key. You need both later.

Besides, we need the base address of the Event Hub, that we can find at the Dashboard tab. The base address is everything before the first slash. In my case it’s

Azure Event Hub Shared Access Keys

Establish a connection

Now you are ready to connect. For better separation and reusability, I have created an EventHubService class in my project. You will need the following variables:

With these you are able to authenticate at the REST endpoint of your Event Hub. You need to authenticate to send data and identify yourself so make sure, that you call the authentication process at least once. To authenticate, I created the following method that you can simply copy. It defines an expiry for the access token, which is mandatory and renders the Primary Key to a SHA256 hash that gets the expiry date appended. With this hash we can generate a token with all the other values. This token will be set as the Authorization header of the HttpClient and will be used for the next requests.

Send data to the Event Hub

As soon as you are authenticated, data can be sent. For this, I recommend writing another simple method that simply transforms an object into JSON and sends it to the Event Hub. For the JSON transformation, I used the popular JSON.NET NuGet package. Once the content is in the right format, you can create a StringContent out of it and send it to the /messages endpoint of your Event Hub. That’s it.

Sometimes, it might happen, that you get a 401 error (unauthorized) as response. If this happens, your access  token might be expired. That’s why I simply regenerate it and try to send the request again when this happens, as you can see below.

You can find the full code at GitHub. Hope that helps!

Fixing the Windows IoT Core Dashboard device detection when running Windows on Parallels

Just a short tip: When you are running on a Mac Book (like I do) and use Parallels for all your Windows related stuff, you might run into the problem that the Windows IoT Core Dashboard does not find your Windows IoT Core devices.

If so, the problem often seems to be, that the virtualised Windows machine is unable to scan the network for other devices due to restrictions of the network connection that is shared between your Mac and Windows VM. To solve this, simply change the virtual machine’s network source to a Bridged Network in the Parallels settings. No your VM should be able to see the Windows IoT Core device.

Screen Shot 2016-08-20 at 17.20.25

How to upload your UWP app to HockeyApp right

HockeyApp provides a neat and easy to use service for developers to provide apps to their testers and track anonymous usage data, crashes and feedback. As the Windows 10 (UWP) support is still in preview, the documentation on how to provide a Universal Windows App to your testers right is quite poor. So let’s take a look at the easiest way.

The problem

hockeyapplogoTo install a Windows 10 application without the official store but via side-loading, multiple files are needed: The application package, of course and a certificate that the user needs to install previously. Some Windows platforms also need a specific PowerShell Script to install the app. When creating an App Package with Visual Studio, all these files will be generated but HockeyApp only accepts one single file per release to distribute.

Additionally, Windows apps are getting installed differently regarding to the platform. On Windows Desktop systems, the user can simply run the PowerShell Script and follow its instructions. Other platforms like Windows 10 Mobile for example, do not support PowerShell and the user needs to install the certificate and application manually. So in contrast to Android for example, where developers can pack all these into one APK file, Windows developers need to consider different scenarios.

The solution

Unfortunately, the solution to this problem is not very satisfying but it works and is the only way at the moment to target both, Desktop and Mobile with one HockeyApp project. After creating the App Package, pack all its outcomes into one single ZIP file and send this to HockeyApp. Desktop users can simply unzip it and run the PowerShell script, Mobile users have to download a Zipping app first (yep, that really sucks) to unpack the file and can install the certificate and app manually then.


The zipping and uploading of the app can completely be done in Visual Studio with the integrated HockeyApp tools. Simply right-click on your project, and select the Distribute App… option. The following dialog guides you through the process.

Please notice that the dialog selects the most recent app package but does not create a package for you! You definitely need to create an App Package on your own, first.


Recently I wrote an article for users about how to install a UWP app distributed by HockeyApp that I link in the release notes of all my UWP HockeyApp projects, so that users get a tutorial on how to install it. You can check it out here.

Analyze a photo with Microsoft’s Cognitive Services Vision API on Xamarin.Android

Microsoft’s Cognitive Services are intelligent machine trained APIs that analyzed text, images, videos and more for you in the cloud and sends you back meta information about the provided content. They are free to use until a specific threshold and a nice easy to use thing to integrate in your applications. You can either use classic REST calls or the client SDK (NuGet) if it is available for your platform. I just stumbled on providing the right picture format to the Computer Vision API and decided to write this blog post.

So if you want to get your picture analyzed, you need to give a Stream object to the VisionServiceClient.AnalyzeImageAsync() method. On Android, you mostly work with streams when accessing the file system but not when taking pictures. In these cases you often need to deal with byte[] or Android.Graphics.Bitmap objects. You can convert both to a Stream easily, if you know how:

Converting a byte[] or Bitmap to a Stream

Especially when working with the camera, you might end up with a Bitmap object. You streamify it with the Compress() method, but as you already used the stream once then, you need to “revert” it afterwards (that’s where I stumbled). Otherwise the SDK will throw an exception.

If you already have a byte[] you don’t need the first two lines of the using statement and can create the MemoryStream directly out of it with var stream = new MemoryStream(yourByteArray).
Hope that helps somebody to save time.

How to install an UWP app distributed with HockeyApp

The HockeyApp platform is one of the most popular ways of distributing pre-release software to testers and collect their anonymous usage data, crashes and feedback. As it is quite easy to install Android or iOS apps on your devices, when it comes to Windows things are getting a bit more complicated. So if you are a tester of any Windows 10 app and don’t know how to install it, this article is for you!

What you get

HockeyApp provides you an own bundle for each version of the app. If the developer did his job right, you will get a .zip file from HockeyApp with the following content.


While you can ignore most of these files, there are three of them that might be important for you. You will learn which one to use on which device in the following sections.

  • APPXBUNDLE File – YourApp.appxbundle – This is the actual application
  • Security Certificate – YourApp.cer – This is the security certificate that your device needs to install
  • Windows PowerShell ScriptAdd-AppDevPackage.ps1 – An installer script for some devices

Installing the app on Windows 10

Classical Windows 10 Desktop systems are the easiest ones to install the app on. Due to you have PowerShell here, you can simple run the installation script Add-AppDevPackage.ps1. Do this by right-clicking on it and selecting Run with PowerShell. Consider, that you will need administrator rights for this.


When doing this for the first time, PowerShell might ask you for permission a couple of times. Always answer positively to get your app installed. After a couple of seconds, the script should be completed and your app got installed. Happy testing!

Installing the app on Windows 10 Mobile

If you are running Windows 10 Mobile and want to install the app on a Phone, things are getting a little more complicated. We don’t have PowerShell or any Unzipper App here by default so we need to do the things manually, that the PowerShell script does for us on the desktop.

First, we need to extract the .zip file. Make sure, that you download an app for this that actually extracts the content and not just opens the zip-container. I cannot recommend 8 Zip Lite, which worked well for me. Now open the Files app and navigate you the folder, you extracted the content of the zip-container to. Here you should find the same files as seen above. Unfortunately, the Files app is not exactly brilliant and does not show you the file endings, which is why it might be hard to identify the files.

Tip: Long press on one file to see its symbol. The explanation can be found in the image below. Don’t ask me, why they decided to show black icons on a black background…



The PowerShell Script is useless for us on phones, so we need to install the certificate and application by hand.

  1. Start with the certificate by clicking on it and follow the instructions.
  2. Once the certificate is installed, you can install the APPXBUNDLE – again by clicking on it. Follow the instructions and wait some seconds.

I am sorry to say that but you won’t get any feedback whether it worked. Just wait approximately 30 seconds and check your app list, if the new app appeared. If not, try installing certificate and app again until it works.


When comparing the process of installing apps from outside the store on Android and iOS with Windows, one can clearly see that Microsoft has to do some work here. While advanced users might be happy with the PowerShell script, sideloading apps in Windows 10 Mobile is a click and pray at the moment. Due to the lack of any feedback it can get very frustrating. Let’s hope Microsoft will catch up here soon…

How to disable Security Warning for untrusted sources in Visual Studio


Better safe than sorry, no doubt and security is important but sometimes exaggerated care can get annoying. Visual Studio sometimes is a candidate for that in my eyes, especially when asking me if I trust solutions that I created by myself. The warning is absolutely right, you should definately not trust any solution you download from the web and run it on your machine. But I am organizing my code on a network share and that is rason enough for Visual Studio to ask me every time, if I really want to open a project that I created. By myself. In Visual Studio…

If you have similar problems, here it how to disable the warning. Simply head over to the Tools -> Options menu, search for the Projects and Solution cathegory and disable the Warn user when the project location is untrusted settings. No more  “You should only open projects from a trustworthy source” warning for you!


Xamarin free for everyone – What developers need to know

Microsoft + Xamarin = C#

At //build 2016 conference, Microsoft announced to include Xamarin into their existing offers and make the cross-platform solution free for everyone. Now as Xamarin is part of Visual Studio 2015, some things are changing for developers so let’s take a look at what how the Xamarin ecosystem will transform.

TL;DR: Yes, Xamarin is free. Or at least free of charge for everyone who is elightable for the for the free Visual Studio Community edition or a subscriber of one of the Visual Studio MSDN plans.


On Windows, Visual Studio is your choice now so that Xamarin Studio will disappear here but will still be the IDE to work with when using a Mac. Here you will also have access to a free Community edition and a paid Business one, that comes with a Visual Studio subscription and offers additional business features like the superior Visual Studio versions on Windows do. Detailed feature comparision here


Oh, and did it mention that Xamarin is open source now?


First of all: Yes, it’s true! Xamarin is available free of charge now for almost everyone due to it is not only included into the charged versions of Visual Studio but also into the free Community Edition. The latter has some limitations regarding the commercial usage but might be the right choice for independent developers and small teams.

Of course there are some benefits for paid users that are subscribing the Visual Studio Professional or Enterprise plans. Those have access to the technical support, might get special account for Xamarin University or get access to some special features like the Profiler or Test Recorder IDE add-ins. But the core of Xamarin development is fully included and not restricted in the free subscription. So if you don’t need premium features – no costs for you! Head over to the regarding Xamarin page if you need more detailed information.

Store Xamarin

What about Xamarin Studio?

Yes, I know: Visual Studio everywhere. But what if you are working on a Mac? Bad news first: We won’t see a Mac Version of Visual Studio in the near future. Xamarin Studio is still the way to go, when developing cross-plattform applications in C# on an Apple machine.

Xamarin Studio will retire on Windows due to there is no need for it anymore. You can and should use the free Visual Studio Community edition here. Xamarin Studio will be continued on the Mac only and will be split into two versions: The Community edition will have the same license terms as its Visual Studio brother on Windows and will be the right choice for indie developers, students and small teams. The Xamarin Studio Business edition will have all the features of the Community edition, plus some of the business features that the superior Visual Studio editions will offer. So if you have an existing Visual Studio Professional or Enterprise subscription, you will get Xamarin Studio automatically, if not, stay with the free version.

Additionally, Xamarin Studio is getting some new and advanced features like the ability to read and open UWP projects. Yep sorry, just read and open, no UWP compilation on a Mac at the moment. But hey, it’s a first step in the right direction!

Visual Studio Comparison Chart Xamarin


How can I get Xamarin now?

When you start the Visual Studio installer right now, you can opt-in an installation of Xamarin as one of the features to be installed. Of course you can always add Xamarin to your Visual Studio installation later by re-running the installer or via a dedicated installer. On the Mac you can download Xamarin from the Dashboard on the website. When logging into Xamarin Studio the first time, it decides whether it becomes a Community or Business edition, depending on the Visual Studio subscription that is connected with your account.

Open source

Additionally they announced to give the Xamarin code the the community and contribute it to the .NET Foundation as an open source project that can be found on GitHub in the future. With these changes, .NET is now open source and native on every single device, from mobile to desktop to cloud. Of course also Xamarin.Forms is getting open sourced, too.

What about the other Xamarin products?

Over the years Xamarin created more than just a development framework. With several other products like Xamarin University, a high class learning platform or Xamarin Test Cloud, where developers can test their apps on thousands of physical devices they provided great tools for every mobile developer. Xamarin University will include new Microsoft focused lectures on the power of Azure and UWP as well as continuing to offer a first class learning environment for mobile developers. Xamarin Insights, a telemetry framework will join Microsoft’s HockeyApp. Test Cloud will be continued to provide it as a standalone product, where Microsoft will be investing heavily in its future.  The official Xamarin Developer Certification will also continue to exist in the future.


I personally really like what’s happing with Xamarin at the moment. I love how Microsoft does not devour it completely but tries to keep the brand alive. Together with Microsoft, they can now offer Xamarin for free and who knows, maybe writing cross-platform applications using C# might be the most normal thing in the future.

Bring your Windows 10 Apps to Xbox One

At Build Conference 2016, Microsoft finally announced that they will open the Xbox One store for your UWP apps in summer. From now on, the developer program for the gaming console is open and we can take a first look at how to bring new or existing Windows 10 apps to Xbox One. I tried it out and will guide you through the first steps.


Join the Xbox One developer program

To join the preview program for developers you simply need to register for the Windows Insider program with the account that you use on your Xbox One. You will also need a Windows Dev Center account, if you don’t already have one. Afterwards, you can download the Dev Mode Activation app directly from the Xbox store.

Important: If you take already part in any Xbox One Beta program, you will need to leave it first, due to Xbox does not allow two programs at the same time at the moment. This can take up to 48 hours.

Register your console for development

After the download has finished, you can start the application and follow the process to register your console for the development program. It will you provide a code, that you need to enter at the new Windows Dev Center section for Xbox. Once your console got registered there, it will claim for an update that contains the new developer mode. Once it got installed, you can start the Dev Mode Activation app again and switch your console into developer mode.

Connect Visual Studio with your Xbox One

Now you can connect your IDE to it and deploy and debug your app. First, make sure that your console is connected to the same network as your development machine. Start the Dev Home app and pair your console with Visual Studio by clicking the according button. A pairing pin appears, that you will need later.

Once the console is ready for pairing, you can open Visual Studio, create a new Universal Windows project or open an existing one and set a Remote Machine as your target device. After entering the IP address of your Xbox, you will be asked for the pin that your Xbox created recently. Enter it and enjoy your apps and games on Xbox One for the first time.


Advanced debugging features

As you might have noticed while scanning the Dev Home app on your console, you can do a little bit more than just connecting it to Visual Studio. By activating the Remote management, you can access your Xbox One via web browser by entering https://XboxOne:11443 to it. Now you will see a portal where you can get an overview of your console’s performance, manage the installed applications and even take a deeper look at its storage.

May the debug gods be with you and have fun testing your apps on a gaming console. I can’t wait to upload my applications to the Xbox store in summer and am looking forward to see yours there!

Your own game server on Azure – Create a dedicated Counter Strike server

It is nearly every gamer’s dream to have an own server that 100% fits his needs and where he can play god. When I were younger, there were only two ways to get such a personal playground: Installing a server on my home machine and making sure to never switch it of or renting one at a gameserver hoster for more money that I could afford back in the days. Now we have cloud computing and can host servers for some bucks. So why not creating an own game server that lives in the cloud?

1. Create a new server on Azure

Creating a new server on Azure is quite easy. Just click the New button and select the virtual machine you want to host. Steam still runs best on Windows, that’s why we choose the Windows Server 2012 here.


2. Configure the server

Of course we need to tell Azure which type of server we need. For our purpose the default settings are fine. Only the pricing tier might be a bit too high, so let’s select a smaller one that better fits our wallet.


Once our server has been created by Azure, we can connect to it via Microsoft’s Remote Desktop tool. The easiest way to do that is opening the server page in Azure and downloading the pre-configured connection profile by clicking the Connect button at the top row. Once connected we can start installing our game server.

3. Installing the game server

Fortunately, there is no need to install the full Steam application on your server to create a dedicated server for your game. All you need is the SteamCMD application to communicate with the Steam servers via console. Just download and extract it wherever you want. After starting SteamCMD, it sometimes wants to update itself. Afterwards we can start downloading the files you need.

To download game server files, we don’t need an account so we can log in anonymously into steam by typing login anonymous into the console window. We will also need to tell Steam, where it should download the files to, so we create a folder and set it as your download destination by using the force_install_dir YOUR_LOCATION command. Last, we need the ID of the steam application that we want to download from the official list of IDs. The Counter-Strike: Source Dedicated Server‘s id is 232330. Let’s install the server with the app_update STEAM_APP_ID command!


4. Starting and configuring the server

We can start the server as soon as it has been installed completely. For this, we navigate to the previously declared installation directory, hold the Shift-key and rightcklick to a free space and select Open command window here. Now we can type in the srcds -game GAME_FOLDER command. In our case the game folder is called cstrike and the command looks like this: srcds -game cstrike. Now the server configurator should open and we can configure our serverI highly recommend not to change the UDP Port, because we will need it in the next step.

5. Forwarding the right ports

To let the server communicate with the internet and making it accessible for other players, we need to open the server’s UDP Port at our firewall. For this we need to open the Windows Firewall with Advanced Security tool and add a new Inbound Rule for UDP Port 27015, which is the one for our server, if you haven’t changed it.


Additioanlly, we need to tell Azure to forward all incoming network-communication on our port to the game server. For this, we also need to create an inbound security role for port 27015.


6. Start server and connect to it

Now everything is configured and we can start our server. As soon as everything is loaded completely, we can start our local Counter Strike client and connect to our fresh game server. The easiest way might be adding the server as a favorite directly by its IP Address (can be found in the Azure portal) and port.


Have fun playing with your friends on your own gaming server with full control. More content to come on this blog so keep an eye on our new Gaming Server series!