How to remote into a Mac from a PC

Managing a Mac from another Mac is quite simple, you can use Back to my Mac or Messages, but how to connect from a PC?

This is actually quite simple as Mac OS X Tiger and later ships with a VNC Server built-in. You have the choice of Screen Sharing, which is more basic approach or Remote Management which will give you a lot more control over the machine.

Enable Screen Sharing / Remote Management

Go to System Preferences and select the Sharing option.

Select Screen Sharing or Remote Management, I will select Remate Management for this post, but it’s pretty much the same thing with less options. You can setup a password under Computer Settings while other options such as Restart and shut down are under the Options menu.

Your Mac can now be accessed by others using a VNC Viewer such as RealVNC, Ultra VNC, Tight VNC

PS: Apple’s VNC Server uses port 5900. More information

IIS Express: Adding MIME types

IIS Express allows many file extensions to be served by default but it lacks a few very useful extensions such as JSON and fonts extensions (FontAwesome!). 

There are two ways we can add mime types, XML or command line: 

Going the XML route

  • Open ApplicationHost.config located in C:\Users\<user>\Documents\IISExpress\config
  • Locate staticContent section and append the following lines before the closing tag:
    <mimeMap fileExtension=”.json” mimeType=”application/x-javascript” />
    <mimeMap fileExtension=”.svg” mimeType=”image/svg+xml svg” />
    <mimeMap fileExtension=”.svgz” mimeType=”image/svg+xml svgz” />
    <mimeMap fileExtension=”.woff” mimeType=”application/x-font-woff” />

Going the Command Line route

  • Open the command line with administrator privileges.
  • Navigate to the IIS Express Directory. By default it is located under C:\Program Files (x86)\IIS Express
  • run the following commands:
    appcmd set config /section:staticContent /+[fileExtension='.json',mimeType='application/x-javascript']
    appcmd set config /section:staticContent /+[fileExtension='.svg',mimeType='image/svg+xml svg']
    appcmd set config /section:staticContent /+[fileExtension='.svgz',mimeType='image/svg+xml svgz']
    appcmd set config /section:staticContent /+[fileExtension='.woff',mimeType='application/x-font-woff']

Following the same pattern you can add any MIME type you need!

Adding git to PATH when using GitHub for Windows

If you are like me and use GitHub for Windows instead of Git you may have noticed git commands are not available in command line and Git’s executable is nowhere to be found. 

Git’s executable is actually located in:


Now that we have located the executable all we have to do is add it to our PATH:

  • Right-Click on My Computer
  • Click Advanced System Settings
  • Click Environment Variables
  • Then under System Variables look for the path variable and click edit
  • Add the path to git’s bin and cmd at the end of the string like this:


Windows 8.1 Preview: Boot to Desktop

Microsoft listened to us and introduced an option to boot directly to the desktop instead of the start menu. The option for this is located under Taskbar and Navigation Properties. 

How to find it:
  • Right-click on taskbar
  • Select Properties
  • Select Navigation tab
  • Check Go to the desktop instead of Start when I sign in
Notice the other options here, you might find some of them useful!

Windows 8-1 Taskbar and Navigation

Microsoft Surface Pro: Lock Fn keys

I just came back from Windows Build 2013 and I’m enjoying my new Surface Pro very much!  The device runs Visual Studio 2013 preview smoothly and developing on it is quite nice.

Only problem I’ve encountered so far is accessing F keys requires the user to press the Fn+F key. This is quite annoying when debugging!  After some research I found that Microsoft has a lock mechanism for the F keys: Hold Fn + Caps.

It works on both Touch and Type covers.

Useful shortcuts: 

Fn + Caps

Locks F1-F12 into being function keys.

Fn + <Spacebar>

Print Screen

Fn + <Spacebar> + Alt

Print Screen for the in-focus app only

Fn + Del

Brightness Up

Fn + Backspace

Brightness Down

Fn + <left>


Fn + <right>


Fn + <up>

Page Up

Fn + <down>

Page Down

Team Foundation Service: Delete Project

Team Foundation Service currently has no GUI to delete team projects. Fortunately, Visual Studio 2012 or Team Explorer 2012 provide us with a tfsdeleteproject.exe which will do just that for us.

By default, the tool is located Visual Studio’s installation folder:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE
Direct the command prompt to the path above and run the following command with the appropriate values:
tfsdeleteproject.exe /collection:https://{{ your account name }} "{{ Team Project To Be Deleted }}"
A warning message should show telling you that there’s no going back if you press Y.

Warning: Deleting a team project is an irrecoverable operation. All version control, 
work item tracking and Team Foundation b uild data will be destroyed from the system. 
The only way to recover this data is by restoring a stored backup of the databas es. 
Are you sure you want to delete the team project and all of its data (Y/N)?

Just wait for the various tasks to complete…

Deleting from Build ...
Deleting from Version Control ... 
Deleting from Work Item Tracking ... 
Deleting from TestManagement ... 
Deleting from Git ... 
Deleting from ProcessManagement ... 
Deleting from LabManagement ... 
Deleting from ProjectServer ... 
Warning. Did not find Report Server service. 
Warning. Did not find SharePoint site service. 
Deleting from Team Foundation Core ... 

That is it!

Localization in ASP.NET MVC 4

Well, I think it is about time I update the localisation post I have on my blog; so many people had sent me messages saying it is overly complicated or outdated and I completely agree with them…I wrote the thing in early 2009! Caveat emptor: This solution is what I use in many projects; it might not be the best solution but it works for me and if it works for you, good! Otherwise, there are plenty of other good solutions out there such as this one. Moreover, if you are looking for something with multi-locale content from a database this solution is definitely not for you. Let us move away from the ordinary two languages website. This one is going to be five locales, French, English, Spanish, Portuguese and Japanese so we can play with different character sets. Here is an outline of what we need to do:
  1. Create an MVC 4 project.
  2. Create a mechanism to tell the website in which language we want to display.
  3. Create user interface components to allow for language switching.
  4. Create a controller action to handle language switching.
  5. Create resources files and localize views.
  6. Friendly localized URLs for SEO
  7. Localization of models.
  8. Form validation.

1. Create an MVC 4 project.

Lets fire up Visual Studio and create a new MVC 4 project. For simplicity, I will use the Internet Application template and because it is awesome I will use Razor.

Create project

 2. Create a mechanism to tell the website in which language we want to display.

I will do this in Global.asax file under the Application_AcquireRequestState event.
protected void Application_AcquireRequestState(object sender, EventArgs e)
    var handler = Context.Handler as MvcHandler;
    var routeData = handler != null ? handler.RequestContext.RouteData : null;
    var routeCulture = routeData != null ? routeData.Values["culture"].ToString() : null;
    var languageCookie = HttpContext.Current.Request.Cookies["lang"];
    var userLanguages = HttpContext.Current.Request.UserLanguages;

    // Set the Culture based on a route, a cookie or the browser settings,
   // or default value if something went wrong
   var cultureInfo = new CultureInfo(
       routeCulture ?? (languageCookie != null
          ? languageCookie.Value
          : userLanguages != null
              ? userLanguages[0]
              : "en")

    Thread.CurrentThread.CurrentUICulture = cultureInfo;
    Thread.CurrentThread.CurrentCulture =    CultureInfo.CreateSpecificCulture(cultureInfo.Name);

3. Create user interface components to allow for language switching.

There is many solution to do this, I simply created a drop down menu with a link for each language. menu language ui

4. Create a controller action to handle language switching.

All we need to do here is update the language cookie with the user selected culture, once this is done we will redirect to the user to his previous location. This code will reside in the Home controller.
public ActionResult ChangeCulture(string lang)
    var langCookie = new HttpCookie("lang", lang) { HttpOnly = true };
    return RedirectToAction("Index", "Home", new {culture = lang});

5. Create resources files and localize views

We will not be using the special folder App_GlobalResources or App_LocalResources, you can find out why here. Instead we will create a Resources folder in the project. Create the following resources files:
  • English: Home.resx
  • French:
  • Spanish:
  • Portuguese:
  • Japanese: Home.ja.resx
The generated code for these is private by default, we will need to change that so they are public, we will also give them a custom namespace for easy access. Select the files and open the property window, the properties should be as follows: Build Action: Embedded Resource Custom Tool: PublicResXFileCodeGenerator Custom Tool Namespace: Resources properties  

6. Friendly localized URL for SEO

This part is already managed in step 2. All we need to do now is handle requests with the culture in them, to do so we need to modify the default route to include the culture.
    name: "Default",
    url: "{culture}/{controller}/{action}/{id}",
    defaults: new { culture = "en", controller = "Home", action = "Index", id =      UrlParameter.Optional }

7. Localization of models.

Coming soon…

8. Form validation.

Coming soon…

© 2018 Michael Chambaud

Theme by Anders NorénUp ↑