# Monday, May 14, 2012

Once again I am plugging That Conference!  Why?  Because it is going to kick ass and you will not want to miss it!

In a previous post I highlighted some of the nationally recognized top-notch speakers that will be Counselors at the event.  What I didn’t mention is that I have been given the honor of presenting not one but two sessions at That Conference.  Below are the two sessions I will be doing.

Going Native with KendoUI Mobile
The number of people using their smartphones or tablets to access the web has grown to the point where having a presence on mobile devices has become a must for anyone with a website. But to be truly successful your mobile presence has to differentiate itself from the mobile web entirely and straddle that line between web and native application. In the past this meant having specific styles and often views for each specific mobile platform you wanted to target, but this is no longer necessary thanks to Kendo UI Mobile.

In this talk Keith will demonstrate how using HTML5 and Kendo UI Mobile you can write one application with a single set of styles and views that looks truly native on iOS, Android, and Blackberry. Keith will walk through creating a mobile application from start to finish including how to use PhoneGap to package and deploy your website to the major mobile application stores.


HTML5 – It’s Not Just for Hipsters
HTML5 is the current “Big Thing” in web technologies. HTML5 has already been crowned the “Write Once Run Everywhere” toolset, even running on the desktop. But we .NET guys seem to once again, be left behind. The lack of tooling in Visual Studio along with the fact that most .NET web developers do not consider themselves HTML developers is really causing .NET developers to already be behind the 8 ball when it comes to HTML5 development.

In this talk Keith will cover the features of HTML5 that all .NET developers should know about and be taking advantage of. He will also cover, how contrary to popular belief the tooling is there and you can start coding HTML5 in Visual Studio now. Keith will also demonstrate that HTML5 development does not require a completely new toolset, you can leverage your current skills including all your favorite .NET server technologies when doing HTML5 development.

I highly suggest you take a look at the awesome array of sessions that will be presented at That Conference in each of the 4 tracks:

On top of the Give Camp leading in to the event there are a number of other awesome events being planned.  Unfortunately these events are still in the planning phase so I can’t go in to detail but I can stress Do Not Miss That Conference!

posted on Monday, May 14, 2012 7:41:41 AM (Central Daylight Time, UTC-05:00)  #    Comments [0]
# Tuesday, May 08, 2012

That Conference announced the initial session line up earlier this week and in a word AWESOME! 

The official speaker line up will be announced shortly and includes the following;

For a line up like that you would expect to have to travel to one of the coast’s and spend a fortune but that is not the case.  That Conference was formed under the premise of bringing a top quality conference (speakers, content, etc.) to the upper Midwest that everyone can afford to attend.  If you are in the Midwest this is an excellent opportunity that you should not miss!  Registration opens May 16th at 8:13am CST.  You will want to get in early as this is going to be one hot ticket.

posted on Tuesday, May 08, 2012 7:47:42 AM (Central Daylight Time, UTC-05:00)  #    Comments [3]
# Monday, April 30, 2012

I have recently started diving in to Kendo UI and have decided to document that dive and blog about it.  So this is the first post in a series dedicated to using Kendo UI in ASP.NET MVC.

Kendo UI is a JavaScript toolset developed by Telerik that leverages jQuery, HTML5, CSS3, and JavaScript to provide rich UI widgets and an MVVM framework that is ‘scary fast’.  The thing that really drew me to Kendo UI in the first place is there native skinning on mobile devices.  Unlike vanilla jQuery Mobile that renders the same iOS-esque view on all mobile devices Kendo UI Mobile applies specific native-looking styles for iOS, Android, and Blackberry.  Over the series of posts I have planned we will cover exactly what Kendo UI brings to the table for both the ‘desktop’ web and the mobile web, but today I will cover getting Kendo UI installed and configured in an ASP.NET MVC application.

Before we dive in to getting the bits I want to prepare you…Kendo UI is not free.  I know, I was surprised by this as well and it actually delayed my dive in to it for a bit.  In all honesty I am still not 100% sure how I feel about it not being free.  What I do know is that as a long time user of Telerik products they produce damn good tooling and there support system is second to none.  If you want to just play around with Kendo UI there is a 60-day free trial available.

Update: I received a comment from a member of the KendoUI team, thanks John, and my statement above needs some clarification.  Kendo UI is dual licensed (GPLv3 and commercial), so although it is not free for commercial use they do support open source development.  You can can get the official terms here: http://www.kendoui.com/get-kendo-ui.aspx

Note: To prepare for experimenting with KendoUI I created an empty MVC 4 project, that of course is not empty, and removed all scirpt and css files (other than Site.css).  I then removed all script and css registrations in _Layout.cshtml.  I did this because I wanted to deal strictly with KendoUI without all the other *noise* of the other script references.

You can download the KendoUI bits here: http://www.kendoui.com/get-kendo-ui.aspx

Once downloaded and unzipped copy the contents of the ‘js’ directory to the ‘Scripts’ directory of your ASP.NET MVC application and the contents of the ‘styles’ directory to the ‘Content’ directory.

Next you need to register the scripts and CSS files that Kendo UI needs in the _Layout.cshtml.

  1. DOCTYPE html>
  2. <html>
  3.     <head>
  4.         <meta charset="utf-8" />
  5.         <meta name="viewport" content="width=device-width" />
  6.         <title>@ViewBag.Titletitle>
  7.         <script src="~/Scripts/jquery.min.js">script>
  8.         <script src="~/Scripts/kendo.all.min.js">script>
  9.         <link href="~/Content/kendo.common.min.css" rel="stylesheet" type="text/css"/>
  10.         <link href="~/Content/kendo.default.min.css" rel="stylesheet" type="text/css"/>
  11.     head>
  12.     <body>
  13.         @RenderBody()
  14.     body>
  15. html>

That’s it.  Kendo UI is now wired up.  Pretty much the same process as wiring up jQuery.  So now we can do a quick implementation to prove it.

If you followed my lead and created an empty project you you will need to create a controller and a view at this point.

The actual implementation of KendoUI is almost identical to that of jQuery which makes the ramp up time a lot less if you are familiar with jQuery.

  1. @{
  2.     ViewBag.Title = "Getting Started With KendoUI - Installation and Configuration";
  3. }
  5. <script type="text/javascript">
  6.     $(document).ready(function(){
  7.         $("#datePicker").kendoDatePicker();
  8.     });
  9. script>
  11. <h2>@ViewBag.Titleh2>
  13. <input id="datePicker" />

As you can see on line 13 I have an input tag with and id of datepicker and then starting on line 5 I have my document ready function that selects the control with id of datepicker and calls the ‘kendoDatePicker’ function it.  The result is below.


KendoUI Calendar

In the next installment we will dig deeper into the different controls available in Kendo UI.

If you want to follow along with the source code it is available on GitHub.

posted on Monday, April 30, 2012 2:01:26 PM (Central Daylight Time, UTC-05:00)  #    Comments [14]
# Monday, April 23, 2012

Having been a part of many large enterprise ASP.NET MVC application implementations using test driven development I learned early on that separating your controller classes into a their own project significantly reduces the noise in your web project.  It wasn’t until a recent talk I gave to user group in my region that I realized that this isn’t a widely adopted practice.  For large applications with a lot of developers and a complex architecture I highly recommend it. 

Putting your controllers in a separate assembly is very straight forward.  First create a controllers project in your solution and then you just need to update your route registrations to tell them where to look for the controllers.

  1. routes.MapRoute(name: "Default", url: "{controller}/{action}/{id}",
  2.                 namespaces: new[] {"[Namespace of the Project that contains your controllers]"},
  3.                 defaults: new {controller = "Home", action = "Index", id = UrlParameter.Optional});

In order to tell ASP.NET MVC where to look for your controllers when registering your routes you use the ‘namespaces’ parameter of the MapRoute method as illustrated above.

I know that the concept of putting controllers in a separate assembly is a bit controversial and everyone seems to have a strong opinion either for or against, so let me know what side of the fence you fall on.

posted on Monday, April 23, 2012 8:02:14 AM (Central Daylight Time, UTC-05:00)  #    Comments [13]
# Monday, April 16, 2012

Back in 2009 I published ReSharper Live Template For Creating Unit Test Stub.  A lot of things have changed since 2009, including my templates.  Since I am doing another series of presentations on Test Driven Development I thought I should get these out because people always ask for them.

As stated in my original post these templates are a way for you to create unit test names that help in describing the true intentions of the test and also to provide a common unit test format that will make reading and comprehending your unit tests easier on everyone.  And of course as lazy developers any redundancies should be automated!

The first template is for a unit test that does not have specific input criteria.

Test w/out Input Criteria
  1. [TestMethod]
  2. public void $MethodUnderTest$_Should_$ExpectedResult$() {
  3.     //Arrange
  4.     $END$
  5.     //Act
  6.     //Assert
  7. }

The second template is for a unit test that has specific input criteria.

Test with Input Criteria
  1. [TestMethod]
  2. public void $MethodUnderTest$_Should_$ExpectedResult$_When_$Condition$() {
  3.     //Arrange
  4.     $END$
  5.     //Act
  6.     //Assert
  7. }

You can take the two templates and create new Live Templates and map to whatever key stroke combination you wish.  I use ‘tt’ and ‘tw’.

Note:  I have been using these Live Templates since ReSharper 3 and I am currently using them in the latest build of ReSharper 6 without any issues so you should be good to go.

As always if you feel these can be improved on or have other Live Templates you want to share let me know in the comments below.

posted on Monday, April 16, 2012 7:09:59 AM (Central Daylight Time, UTC-05:00)  #    Comments [1]