Saving and Sharing Visual Studio Editor and Code Format Settings with team members

Have you ever wanted to check into source control with a project or solution the tab spacing, indent size and line endings for that solution and have them automatically applied when Visual Studio opens that solution?  And to also have these settings automatically applied when anyone opens the solution or project?

Well, this can be quite simply achieved using a Visual Studio extension called Editor Config. (Visual Studio Extension Github Page)

First, install the ‘EditorConfig’ Visual Studio Extension (using Tools > Extensions and Updates > Visual Studio Gallery)

editorconfig vs extension 300x207 Saving and Sharing Visual Studio Editor and Code Format Settings with team members

The way that EditorConfig works is that it looks for an ‘.editorconfig’ file which contains the settings for the project or solution (depending on where the config file is located within the folder hierarchy and if the configuration file is marked as ‘root’, or the ‘solution’ configuration file).

In my case I’d like to define the tab size, indent size and line endings at the solution level so this is how you can achieve that:

1) Create an ‘.editorconfig’ file in the same directory as your solution file.

You can do this by simply navigating in Windows Explorer to where your solution file resides, creating a new text document and renaming that to the desired ‘.editorconfig’.

NOTE: Windows Explorer will try to stop you from creating a file without a file name such as ‘.editorconfig’ by popping up this ‘You must type a file name’ error message:

Windows cannot create a file with no filename 300x122 Saving and Sharing Visual Studio Editor and Code Format Settings with team members

You can easily bypass this by appending an extra ‘.’ at the end of your filename, which will make Windows Explorer create the file, without the extra ‘.’

So in this case, if you rename the text file to ‘.editorconfig.’, Windows Explorer will not pop up the error message and create the ‘.editorconfig’ file as we want:

2014 11 13 08 27 55 Windows 7 x64 Lana Dev VMware Workstation 300x111 Saving and Sharing Visual Studio Editor and Code Format Settings with team members

2) Now we are ready to define the Editor Config settings for our solution by editing our newly created ‘.editorconfig’ file in a text editor.  For example, the configuration file that I use is as follows:

# top-most / Solution EditorConfig file
root = true

# Windows-style newlines
end_of_line = crlf

# 3 space indentation
[*] # apply to every file type, you can filter to just csharp files by using [*.cs]
indent_style = space
indent_size = 3

After saving this file, whenever your teammates or you yourself open this solution in Visual Studio, the ‘EditorConfig’ Extension will automatically read in the above settings. (Provided that you have installed the Editor Config extension first)

You can test this by running a ‘Format Document’ on a class file in your solution (via the Edit > Advanced > ‘Format Document’ menu item).

File sending using web browsers using is a useful tool for sending files between computers on the same network, or on different networks using only your web browsers.

All that you need to do is head to on each computer, where you will be presented with:

image thumb File sending using web browsers using

If the computers that you want to send files between are on different networks (i.e. you’d like to send a file from you to a friend), simply click the ‘+’ button at the top right which will make this window appear:

image thumb1 File sending using web browsers using

Just send that link to your friend and have them open that in their own browser.  After clicking ‘Got it!’ and your friend has loaded the page in their browser, you will see another icon appear with a bunch of numbers (IP Addresses) underneath it like so:

image thumb2 File sending using web browsers using

(If the computers you want to send files between are on the same local area network, simply open on both browsers and the other computers icon will automatically show, no need to send the above link to them)

Now all you need to do is either drag and drop a file onto that icon, or click on it and a file browser dialog will be shown allowing you to pick a file to send between the two computers.  Just confirm that you want to send the file by clicking send:

image thumb3 File sending using web browsers using

Accept on the receiving computer by clicking save:

image thumb4 File sending using web browsers using

And the file will be transferred between your two computers, showing the the recipients browser just like it was a file downloaded off of the internet:

image thumb5 File sending using web browsers using

Pretty handy if you just need to send a file to a friend or even if you are just having trouble setting up network sharing locally.

Monkey Business #3 – Xamarin and F# Project Debriefing

Project Debrief

I thought I’d do a debrief of this project to recap on what went well, what was difficult and where my time went throughout this exercise.

Thinking back now, I can honestly say that the majority of my time was spent grappling with Android’s layout system and trying to get the RadialProgressView to work how I wanted it to.

I am actually a little bit familiar with the Android layout system, having produced a few applications back in the days of Android 1.0 and 1.5. So I was able to get up and running with basic layouts for each of the pages that I was creating easily enough.

The problems arose with things like the RadialProgress extension, in that I didn’t want a percentage to be the indicator in the middle of the circle. This was solved easily enough by disabling that progress on the widget itself and overlaying my own text view with a MM:SS countdown as I’d wanted.

Transparency Issue 297x300 Monkey Business #3   Xamarin and F# Project Debriefing

Towards the end of the project I thought that I’d simply add some background images to make each Activity’s view a little more interesting to look at, and this was for the most part easy enough. What was difficult was the Radial Progress widget is inherently transparent, and was very hard to read once you put a image background below it. After a while, the solution presented itself, to simply draw a solid black circle behind the widget itself so that it would return to its normal, easily readable appearance.

Transparency Issue fixed 300x291 Monkey Business #3   Xamarin and F# Project Debriefing

It was things like these that became the real time sinks in the project. Whilst there were certainly times where I was struggling to translate my knowledge of C# into something that could be used within F#, but this was rarely a blocking issue for too long. F# itself is quite easy to pickup for people with a C# project, I found.

And when you run into trouble there is quite an abundance of resources on the web, be it StackOverflow or in the’s various pages.

The Xamarin Android system itself wasn’t hard to come up to speed with either. Whilst all the documentation and examples I came across looking for the various solutions to the problems I was running into was in C#, it was simple enough to translate into the F# equivalent and be up and running in a couple of minutes.

It’s interesting to think of the ways in which the newly released Android Watches can come into play with these sorts of applications. Having a notification on your wrist when the eggs are boiled or ready to peel would be useful when cooking up a number of things at once in the kitchen.

All in all, this was a fun little project to sink some time into, and I’ve already got a couple of ideas for future projects that I could undertake with the Xamarin toolkit.

Feel free to checkout the source for the project on Github:

HardBoiled GitHub Repository

Monkey Business #2 – Xamarin Android and F# Gotchas

Xamarin Android and F# Gotchas

Being completely new to F#, and coming from a strong C# background, one thing that threw me for a loop for a little while was the way in which you reference other code in F#.

For a while the only way that I could get the project to build with all five activities was to simply put all of the activities in the main code file.

After I had made a little progress into the project I decided to revisit this and find the cause of why I couldn’t have separated out my various activities and have the solution compile. What I found was that the build order of the files is important in FSharp, and that you need to order the files in your solution in the order that you’d like them to be built in.

Not only that, but it seems that you can’t reference code that hasn’t been built yet in the solution. Which is quite a change if you come from another programming language background and are used to having the compiler handle such linking operations automagically.

However once I figured out what the problem was, it was simple enough to extract out the various activities into their own code files and have the solution compiling as I wanted it to.

One thing that caught me out on multiple occasions was the difference in the usage of the assignment operator in F#.

progress.Value = 0.5f // C# assignment

progress.Value <- 0.5f // F# assignment

I stumbled upon this link which broke down the differences quite well and is a recommended read if you are new to F#:

Assignment operator in F#

Other than that the differences I’ve come across are merely syntactical, i.e things like this.

typeof(SomeClass) // C#
typeof<SomeClass> // F#

Action something -> { doStuff() } // C#
fun _ -> doStuff(); // F#

Despite not knowing the language, I’ve been making reasonable progress in a short time. Not to mention in a new development environment on a new platform to me icon smile Monkey Business #2   Xamarin Android and F# Gotchas

Monkey Business #1 – The project idea

The Project Idea

A common theme for what people do for new projects is to “Build something to scratch your own itch”.

So, for the purpose of the project I’m going to build a simple egg timer for hard boiling eggs.

Currently, I repurpose an interval timer app to serve this purpose. This should be a simple enough application for an introduction to building Android applications with F# so I think that it’s a suitable candidate for entry into the Xamarin F# contest.

The way you basically achieve hard boiled eggs (based off of Julia Child’s method)

  1. Put your eggs into a pot, fill the pot with water up until ~5cm from the top egg.
  2. Put the pot on the stove and bring to a boil.
  3. Once the water starts to boil, start a timer for three minutes.
  4. After three minutes have passed, remove the pot from the stove and leave to cool for 12 minutes (start another timer)
  5. Once the 12 minutes is up, rinse the eggs with cold water, peeling the eggs as you go.

The application that I’m going to build should basically walk the user through the above process, the value add is in managing the two timer intervals (boiling time and resting time), prompting the user on each step of the process as you walk through it.

I figure that I’ll be needing about 5 screens to run the user through this process, as mocked out as follows:

2014 07 05 15.19.30 small 225x300 Monkey Business #1   The project idea

2014 07 05 15.19.34 small 225x300 Monkey Business #1   The project idea

2014 07 05 15.19.42 small 225x300 Monkey Business #1   The project idea

2014 07 05 15.19.48 small 225x300 Monkey Business #1   The project idea

2014 07 05 15.19.53 small 225x300 Monkey Business #1   The project idea


Monkey Business #0 – Xamarin announces build your first F# mobile app contest

Details Here “Build Your First F# Mobile App

The deadline for submissions is the 21st of July, which gives me just over two weeks to build an F# Xamarin based application.

I’ve been curious about F# and played around it a little recently (nothing too adventurous). This contest looks like an interesting little project to get me into a bit more substantial F# development with the Xamarin toolkit.

My submission is likely to be a simple Android application of something that I’d be needing if I’d like to make the switch to Android completely.

So it begins.