Skip to main content

Posts

Showing posts from October, 2013

Visual Studio Code Review

I have finally been able to work with Visual Studio and TFS code reviews. There were a couple thing that threw me off I wanted to write about. If you want a good quick overview of what this is check out the Channel9 video “Using Code Review to Improve Quality.” There are a few things to note about this feature no one calls out easily: 1- You must have TFS to enable this 2- You must have at least Visual Studio 2012 premium If you have those two things you can start doing code reviews this way. It is a great feature I think. Sadly it will be under utilized by a lot of development shops for a few reason. First, I think few will understand this feature is there and even if they do fewer will spend the time to defined their processes for it. Second I think a lot of development shops have only a professional license, don’t use TFS as their back, or if they do, they don’t work to use its full capability and just use it as source control. With all that said if you are using it or thinking

Web API – Pass multiple simple parameters on a POST/PUT

I have been working a lot lately on Web API (v1). For the most part I really like but there is one thing I found out that I really hate. Web API (v1) does not let you POST multiple simple type parameters. Here are the links I found that let me get through this. WebAPI Multiple Put/Post parameters Passing multiple simple POST Values to ASP.NET Web API This was a little tricky to find and most people think Web API cannot do this. Which I by default it cannot be this extension has worked great for me. So I wanted to make sure I could find it again and make it a little easier for others to maybe find it.

Calculate Screen Size in Inches based on height and width in millimeters

This will be short and simple but some math that hopefully will be helpful. I have been doing a lot of mobile device detection work as of late. Recently I was about to get the physical width and height of a device in millimeters. This was great but what I really needed was the diagonal screen size in inches. Here is the math for it. - Get the width in inches : width in millimeters times 0.0393700787 - Get the height in inches :  height in millimeters times 0.0393700787 - Combined value of both to the power of 2 : width in inches ^2 + height in inches^2 - Get the square root which should be the diagonal screen size : Combined value square root That is it. You can see it working on my test site

Web API, JSON, AJAX, CORS, Chrome 500 error and Authentication–Oh My!

I have been working on a project that is using .Net 4.0 and MVC 4 with Web API. Web API is great and provides a lot of great functionality easily. We have needed to call our Web API from another domain though which introduces Cross Origin Resource Sharing (CORS) issues. Web API in 4.0 does not really support this so it has been causes us issues, you can configure IIS to work with it pretty easily.. In later version it will support it better. See the following links: Web API VS 2013 (.Net 4.5 and later) http://aspnetwebstack.codeplex.com/ Enabling Cross-Origin Requests in ASP.NET Web API ASP.NET Web API: CORS support and Attribute Based Routing Improvements However, if you are using 4.0 that is not much help to you. We have had to push through a few issues on this front. If you are testing with IE8 you will not see them as it does not care about CORS issues. If it is working in IE but not working in Chrome or FireFox here are some issues we have been working through:   Some calls