Quick Tip: Showing solution branch name in Visual Studio title

By default, Visual Studio shows the name of the opened solution name in the title. This makes it easier to navigate among multiple instances of Visual Studio. You see the solution name next to the Visual Studio icon in the taskbar and also in the task manager, when you have to (and we all sometimes have to) kill the right Visual Studio because it stopped responding.

I work with Git, switching branches frequently, especially working on features and bug fixes. In this situation, it would be nice if Visual Studio showed not only the solution name but also the current branch in its title. No problem, there is an extension for that.

The extension is called Rename Visual Studio Window and it works with Visual Studio 2015, 2013, 2012, 2010. This extension supports Git, so you can easily add the branch name to the title with a config like mine using [gitBranchName].

[Read More]

Custom DateTime deserialization with JSON.NET

Sometimes you cannot influence the design of the API you have to use and wonder, why the API uses so strangely serialized DateTime and how to handle it using JSON.NET.

Luckily, JSON.NET makes plugging in custom serializers / deserializes quite easy. There are a few base classes to help you write your own converter, when dealing with DateTime you want to inherit the DateTimeConverterBase class.

[Read More]

My year with the Raspberry Pi and what I used it for

I have been owning and using a Raspberry Pi for over a year now. I started with Raspberry Pi model B and now I added Raspberry Pi 2 immediately after it was announced. Thanks to the fact that an IoT version of Windows 10 will run on the Pi, there is quite a hype about the Pi 2. Many people who did not care about the Pi before are now buying it because of that hype. And mostly they do not know what to do with it. So here is a list of things I used the Pi for, maybe you can get inspired.

Media center

I always wanted a small cheap low power media center to watch downloaded TV shows on the TV. The Pi was an ideal machine to built. I connected the Pi to a power source, ethernet, external hard drive the TV using HDMI. My distro of choice was RaspBMC at first but then I switched to XBIAN. Using this setup, the PI run XBMC (a media center software), that scanned the connected hard drive, found all the downloaded TV shows, and downloaded their metadata to make the experience better. Thanks to HDMI throughput I was able to control XBMC on the PI using the TV remote, not keyboard or mouse needed.

[Read More]

Using the DebuggerDisplay attribute for better debugging experience

When debugging a C# program in Visual Studio, I tend to always hover over the variables to glance at their values and structure instead of explicitly writing their names into the watch window. If I want to explore say a collection, I need to unfold each of the items using the + button to get an idea about the data:

This is not very comfortable, so thankfully, there is a way to make this experience better, using the DebuggerDisplay attribute. This attribute can be applied to any class (and struct, enum, property, field, delegate, assembly) and allows you to define the information about the class you wanto to see in the debugger.

[Read More]

Succinctly series of free books for programmers

I have recently come across an intreresting project by Syncfusion, a company providing software components for the Microsoft platform.

The have created a series of books for programmes called the Succinctly series. The goal of the series is to create 50-100 pages ebooks covering various topics. Each book should give you an introduction to the topic inc a succint way, so you do not have to read thick books or spend time finding relevant blog post covering the selected topic.

All the 20 books covering topics like Data Structures, iOS, Windows Store apps, F#, Git, Gis, HTTP, JQuery, Knockout.js ann many more ale completely free and promise to stay free forever, including all the updates. They are all available in PDF and Kindle format.

[Read More]

Detecting encoding of uploaded file in ASP.NET MVC

Uploading a file in ASP.NET MVC is very easy, but there is no easy way to detect the encoding of a uploaded text file. However you can use the fact if you try to read the file with a wrong encoding, you get an DecoderFallbackException. So how do you put everything together?

First, get a stream of the uploaded file.

public ActionResult FromCSV(HttpPostedFileBase file)
    if (file != null && file.ContentLength > 0)
        var stream = file.InputStream;

[Read More]
web  asp  csharp 

Generating all permutations of a list … how hard can that be?

While reading an article that had nothing in common with programming I came upon a sudden need to find a way to generate all the permutations of a list, or more exactly a string (it is just a list of characters). As lazy as I am I tried to google a few examples of C# code that does exactly that. I was horrified that programmers could come up with the complicated ways I found. Not to mention programmers writing a ton of unit test and classes before actualy writing the code that solves to problem.

The problem is naturally recursive. All the permutations of a list of n items consit of each of the n items combined with all the permutations of the list without the actual item. So if you have a list of let’s say items (a,b,c), all the permutations are (a+permutation((b,c)) + (b+permutations((a,c))) + (c+permutations((a,b)).

First I came up with F# code to solve it, after some yield googling:

[Read More]

AppHarbor: great place to start your .NET project

If you want to host your .NET project on the Internet, there are classic ASP.NET webhosting on one side of the spectrum and Microsoft Azure on the other. If you are looking for something in the middle, take a look at AppHarbor.


AppHarbor is a flexible and scalable .NET Platform-as-a-Service, that you can even use for free, limited to one web or worker role. It runs in AWS and is quite similiar to Heroku.

Variety of Add-ons

There are many add-on supported by AppHarbor, including SQL Server, MongoDB, RavenDB, MySQL, Memcacher … Many of these ad-ons offer free versions so you can test them for free. If you run into some problems, you can use the support forums or StackOverflow.

[Read More]
web  csharp 

Visual Studio Achievements: a bit of gamification to your programming

Gamification is a great concept that works really well for some people, including me. Gamification may very well be the reason for success of projects like StackOveflow or Duolingo.

Visual Studio Achievements

Visual Studio Achievements is Visual Studio plugin that rewards you for good practices like having 1000 localized values (Localization Master) and even for bad practices like writin a single line of 300 characters long (Scroll Bar Wizard). For some of the achievements you need to have FxCop installed, but the majority get awareded without the need for it.

You can find out interesting information about your programming, check out my profile.

[Read More]