I am learning how to upload MVC Worker Web Role sites to Azure. The process is fairly straight forward. First, you get your windows azure account. Next setup a certificate and do some minor configuration. Finally, you right click and select “Publish to Windows Azure..”.
Publishing to Azure worked seamlessly on my first attempt! I didn’t like the name of my test project so I deleted and added another project more aptly named for my situation. The next time I go to publish I cannot bring up the website and there are no freakin error messages. The site simply won’t come up in any browser. The deployment was successful according to the box in Visual Studio. I try to figure out the problem and eventually ended up Googling the problem. Other people have had this problem as well.
Somehow the port number was now 8080 instead of 80 for the newly added project. The solution was to edit the “ServiceDefinition.csdef” file and change the port number to 80.
It was a fun exercise to try out all of the various blogging engines. I have found WordPress, Blogger, Posterous, and Tumblr to all be excellent blogging platforms. I have previously hosted my own blog using WordPress for a time but there really isn’t any benefit to me having to maintain the website. Eventually I landed on Posterous but never was happy with their Markdown support.
In the end, I chose Tumblr as my blogging platform because it has excellent Markdown support. I always hated how blog engines would reformat my html when I wrote my posts. Using Markdown makes it much easier to write posts as all I really need is notepad to concoct a new post.
My old blog hasn’t been fully migrated to Tumblr yet… it can still be seen here Polyglot-Programmer.
Ryan Niemeyer (Thank You) put all of the KnockoutJS samples into JSFiddler so they are simpler to see in action.
The original KnockoutJS live examples.
I recently watched the NDC 2011 video comparing ASP .NET MVC versus Rails. It’s a great overview for a non Rails developer comparing features of both. Rails was developed in 2004 and ASP .NET MVC was developed in 2009 so Rails has a 5 year head start on ASP .NET MVC.

The first point, made in the talk is that Rails has a better logo and ASP .NET MVC has no logo. This was a funny point but well made. Open source projects almost always have a cool logo and Ruby has one as well.
I made a summary of the major talking points in the video and chose my personal winners.
| Ruby on Rails | ASP .NET MVC | My Winner | |
| IDE | Rails can be developed in notepad. Rails can be developed on Mac or Windows. | Locked into Visual Studio. Visual Studio is slow and crashes weekly. Requires Resharper or CodeRush to be effective. | Rails + 1 |
| Controllers | Rails has respond_to so it can return json, xml, or html easily from an action controller. | Very similar. You can respond_to like behavior with the NuGet package easy MVC. | Rails + 1 |
| View Helpers | Rails has many more view helpers. | MVC has strongly typed objects in the view. The MVC view helpers are very noisy. | Tie |
| Scaffolding | The scaffolding is almost identical to the Rails scaffolding. | Tie | |
| Data Access Active Record vs. EF Code First |
Active Record has a more readable syntax with has_many and belongs_to. Supports more databases. | EF Code First still doesn’t have migrations, but they are coming. | Rails + 1 |
| Validation | Data attributes are more limited than the active record validation mechanism. | Rails + 1 | |
| View Engine ERB vs Razor |
ERB has a very noisy using the old <%= syntax. | Razor is a great view engine with very clean syntax. | MVC + 1 |
| Gems/Packages | 25,000 gems! | 2,000 nuget packages. | Tie |
| Interactive Console | Rails has an interactive console. | No interactive console. | Rails + 1 |
ASP .NET MVC loses 2 points due to it’s messy data access story. MS changes it’s mind about Data Access constantly and EF Code First isn’t feature complete yet. The point is they are very comparable stacks now. One major advantage or perhaps disadvantage would be the underlying languages: Ruby and C#. Ruby is a very malleable language and never has the same testing issues that C# often has.
This doesn’t tell the whole story. If you don’t care about the interactive console and you think Visual Studio is a better IDE, then the final score would be:
Once EF Code First matures ASP .NET MVC and Rails stacks will be on equal footing.
Every so often I like to recap the javascript libraries that I am currently using. There are a great deal of javascript libraries out there so digging through and finding high quality libraries can be problematic. I recommend using the following libs.
Nivo Slider Nivo Slider, a jQuery plugin, is a professional looking slideshow. It offers 16 transition effects. The plugin is free as a standalone jquery plugin and is a minimal cost for WordPress users.
Underscore JavaScript doesn’t have any complex querying mechanisms built in. The map array method can only get you so far. For what is often referred to as LINQ (Language Integrated Query) functionality, I recommend using underscore. Underscore is NOT a jQuery plugin.
Modernizr Modernizr allows you to use html5 and CSS3 elements on a page and have the functionality degrade gracefully on older browser.
Microsoft has learned it’s lesson… finally. With the advent of NuGet and more open source initiatives in the Microsoft camp, it seems they finally get what it takes to make a good development platform and more importantly COMMUNITY. The first step historically of embracing open source in MS was shipping jQuery with the MVC framework. Using jQuery over internally developed JavaScript libraries, was a huge win for both Microsoft and developers on the Microsoft platform. MS could not produce a library as good as jQuery. jQuery had a huge core of open source contributors and a massive test library that could not of been done at Microsoft. As a developer I am now using a tool that can be used on other platforms, ie the COMMUNITY, behind my tool is now much larger. If I’m stuck, the COMMUNITY will help me out. There are so many resources for jQuery that Microsoft no longer has to provide. They are on the hook for technical support but most jQuery questions can be answered through the COMMUNITY.
Has Microsoft really learned it’s lesson? I would posit no, they are simply adapting to changing marketing conditions. If for some reason the market started rejecting open source software then they would go back to a more closed development model.
MS cannot competetively produce quality software that meets developers needs without going to an open source model.
Not going to an open source model causes MS to lose out in all 3 areas: quality, cost, and time. I would predict that within 3 years that Microsoft will open source most of it’s code and allow community contributions back into the products that aren’t part of .NET BCL.
With ASP .NET MVC 3 there is an opt in model in relation to security by default. You have to add [Authorize] attributes to your controller classes or to individual controller methods in order to opt in to an authorization check. The MVC 3 opt in method to security is problematic as most sites with security will benefit from a less error prone opt out model. An opt out security model is now built into the latest MVC 4 bits. You can extend MVC 3 to have an opt out model.
MVC 3 and MVC 4 allows one to have an authorization check throughout the website by adding a global filter to your global.asax file. This doesn’t work well out of the box in MVC 3.
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
filters.Add(new System.Web.Mvc.AuthorizeAttribute());
filters.Add(new RequireHttpsAttribute());
}
MVC 4 has a new [AllowAnonymous] attribute which will allow you to disable Authorization checks on controller classes or individual controller methods.
[AllowAnonymous]
public ActionResult Login()
Entity Framework by many regards has been a cluster since it’s inception. Entity Framework came out approximately in January of 2008. They say software often mirrors the organization building it and I think that “ism” holds true in this case. When EF came out, there was an already loved ORM, Linq to SQL, out and in use. Microsoft decided to build a new ORM from scratch instead of enhancing Linq to SQL… classic Microsoft. This decision reflects Microsoft has lots of groups that develop overlapping functionality with different agendas. Linq to SQL has been more feature rich than EF for almost 4 years despite having much lower resource allocation. At the end of the day, is the Linq to SQL base code better than EFs?
Just to illustrate one major frustration with EF is that it hasn’t supported enums. It has been missing true enum support since all of 2008, 2009, 2010, 2011, and part of 2012. It has taken over 4 years to add enum support to EF. Another frustrating point has been that EF has been a performance dog compared to raw ADO .NET and even it’s Microsoft cousion, Linq to Sql.
EF, almost 5+ years later it matches the feature set of Linq to SQL and almost 7+ years matches the feature set of Rails ActiveRecord. WTF? Microsoft should revel in the fact that many shops will only use Microsoft solutions and give us at least competive tooling. EF of yester year has harmed many .NET shops that are exclusive to MS solutions. In the Rails community you aren’t condemned for using ActiveRecord. In the .NET community you have to question the usage of EF for your product heavily. Microsoft, long ago, should of continued improving EF to the point where using it wasn’t considered a liability by many .NET practioners. I’ll go on record saying that I really like the new EF Code First and dbContext paradigm. I have found it easy to use and understand and it makes getting a site up and running, from a data access perspective, almost trivial.
Packaging EF with the .NET core has proved to be a major stumbling block for enhacing EF over the years. Experience has shown that frequent incremental releases is what makes a great product. By pushing the latest versions of EF to separate dlls that are updated frequently has greatly enhanced the EF product. In the past year we have gotten DbContext, Database Migrations, and Fluent Code Mappings.
The next version of EF will have major performance improvements but we shouldn’t have to wait for EF 6 to have the next set of performance changes. If Microsoft wants to do EF right though they need to do the following…
EF should be fully pushed outside of the .NET framework and open sourced.
EF should post performance numbers, ala Dapper, that come within 10-30% for most queries when compared to common frameworks. Simple select statements that materialize to a single object or list of objects should be blazing fast.
Apple is a very polarizing brand with many fan boys and haters. This article takes a step back and will objectively list out where Apple differentiates itself from it’s competitors. If you haven’t tried a Mac computer yet then you are likely not aware of many small areas where Apple distinguishes itself from it’s competitors.
The Apple OS has more upgrades that come in regular release cycles and are reasonably priced at around $30. There is typically on one version of an upgrade. The OS X operating system comes in 2 flavors: standard and server edition. Windows 7 is expensive to upgrade and comes in Home ($120), Professional($200), and Ultimate editions ($220). For server software you would use Windows Server 2008. Microsoft is actually hurting itself in several major ways by not having more release cycles at lower costs. Having multi year release cycles along with expensive upgrade costs for Windows leads to adoption inertia and expensive resources maintaining older operating systems. When Microsoft had far less competition in the operating system space this was a huge advantage. The competition is now much more fierce and their business model of long dev cycles and expensive upgrades is not allowing them to keep up with the innovation of their competitors in as timely fashion as they would like. Apple is really only ever maintaining 2 operating systems at a time, their current release and the last release. Microsoft is maintaing XP, Vista, and Windows 7.
The Apple OS has the Unix command line built in, so for keyboard connoisseurs you have a very powerful command prompt at your finger tips. Windows 7 does have a great command line called PowerShell available. PowerShell is in many ways superior to the Unix command line as it is in many ways a superset of the Unix command line.
The Mac has many nice utilities built in that make it very easy to use.
Knowing the lifecycle of your unit testing framework is important. The MS Test lifecycle is the following:
ClassInitialize (Called once)
…
constructor (Called once per test)
TestInitialize (Called once per test)
TestMethodX (Called once per test)
TestCleanup(Called once per test)
…
ClassCleanup (Called once)