Sunday, May 06, 2012 2:31 PM | Comments

This blog is quiet… too quiet. It’s been a busy couple of months since starting at Clarity in January. PowerPoint, for better or worse, became my after-hours IDE. Below you will find some of the recent talks accompanied by their slides and code. Hopefully I didn’t forget anything, but please shoot me a comment if I did! WindyCityGo Apr 5 – 6, 2012 WindyCityGo is a two-day conference in Chicago that covers all things mobile. This year they added Windows Phone to their lineup and I was invited to speak on “Real World Windows Phone Development.” My talk covered an intro to metro and supports my tutorial series on building a polished Stocks app for windows phone. And now that my speaking gigs are winding down I can finally get back to that series! GET THE CODE ...

Wednesday, January 25, 2012 2:02 PM | Comments

If you drink from the fire hose read Ayende’s blog you would notice a lot of Anti-Repository talk over the past couple years – which I fully agree with. Back in 2009 he declared repository is the new singleton, stating: My current approach for data access now is: When using a database, use NHibernate’s ISession directly Encapsulate complex queries into query objects that construct an ICriteria query that I can get and manipulate further When using something other than a database, create a DAO for that, respecting the underlying storage implementation Don’t try to protect developers Naturally he gets a slew of comments asking how he handles certain scenarios without using the repository...

Monday, January 23, 2012 3:58 PM | Comments

By using the the simple SelectorAttribute and EditorTemplate described in this post, you will get rich support the following very common scenarios (and flip between the various modes with ease): Single selection from a Drop Down Single selection from Radio Buttons Multiple selection from Check Boxes Multiple selection from a List Box Read-only mode combines multiple values into a comma-delimited string The Canonical example Say you’re inserting a new Product and need to set the CategoryId property. You make a simple input Model wanting to use EditorFor, but CategoryId gets rendered as a useless textbox. The challenge is: Retrieving the list of categories to present to the user Keeping the selected item(s) in sync with the...

Friday, January 13, 2012 2:40 PM | Comments

Many ASP.NET applications utilize the System.Web.Caching.Cache in some way. While it offers a pretty simple Dictionary-like API that your app can start using immediately, I typically create a combined “tell-don’t-ask” wrapper around it – which has some additional architectural benefits as well. Out of the box concerns A very common usage of the Cache API can be seen below, but there are a few initial problems I have with it: Ugly, non-generic casting Manual null checks Duplicating the string for the key Lots of implementation details sprinkled around No out of box way to scope the cache. For example, cache a unique copy of the item for each User   public ActionResult Bad() { var firstVisit = HttpContext.Cache.Get("FirstVisit") as DateTime?; ...

Tuesday, January 10, 2012 10:12 AM | Comments

Many line-of-business applications contain dozens of forms similar to the following, each field consisting of a few common characteristics: A Label with the name of the field The field editor itself Asterisks and special styling for required fields A tooltip that can be hovered for a detailed description of the field Validation messages if the input is incorrect To achieve this, we can create the following Model public class ProductInput { [HiddenInput(DisplayValue = false)] public int Id { get; set; } [Required] public string Name { get; set; } [Required] [Display(Description = "A brief description of the product")] [DataType(DataType.MultilineText)] public string...

Friday, December 16, 2011 2:25 PM | Comments

The title is slightly tongue-in-cheek, but I do believe selling is a crucial aspect of being an ‘architect.’ And I don’t mean selling to customers. But first, a backstory A long time ago, at a client far, far away… they were making a big push to SOA. My project at the time was calling a few methods from a referenced assembly, but the client’s architect said I must re-write it using their new WCF endpoint instead. I had my reservations about this change because the services so far were not known to be stable nor discoverable. Now I am certainly no expert at applying SOA, but I do appreciate that it consists of more than simply exposing everything through web services. In my mind, before even attempting to impose an SOA mandate across an enterprise you must establish some baseline infrastructure: A...

Monday, December 12, 2011 11:02 AM | Comments

This past weekend I decided to upgrade my Subtext blog to VS 2010 so I could finally rid my machine of VS 2008. After some small hiccups it was ready to rock, and thankfully the deployment to my server was entirely painless with WebDeploy. So being in VS 2010 and having fully tested my deployment process it seemed like a good time to make a tweak to my Skin that I’ve been wanting to try for a while: showing “Hero Shots” next to each post. Hero shots? I’m not really sure what they should be called, I just know I’ve heard the term hero shot a lot this year and it seemed to fit, but call it whatever you want The idea is pretty simple: when viewing a list of posts (the home page, a specific tag, the archives) I want to show an...

Wednesday, December 07, 2011 9:59 AM | Comments

DoddleReport generates tabular reports from any IEnumerable datasource. Out of the box it can render reports to Excel, PDF, HTML, and CSV – fully pluggable of course. I created the project to provide reporting output over the LINQ queries we had already written for an application, but maybe you can find other uses for it. So what does it generate? The following samples are generated live in real-time (notice the data will change every time you open the report) Excel Report (OpenXML) Creates a native Excel file using OpenXML ...

Sunday, December 04, 2011 6:34 PM | Comments

Series Introduction and Outline This series is going to walk through building a polished, functioning Windows Phone app from start to finish. The app is called Realworld Stocks and the full source code will be available on CodePlex as the series progresses. I’ll be using Mercurial to encourage forking and maybe even pull requests from developers who want to contribute their own real-world solutions. View the Series Introduction and Outline Navigation Basics Even though this series assumes a basic understanding of Windows Phone development I want to briefly touch on the basics of page navigation. Windows Phone apps follow a basic stateless navigation paradigm very similar to that of a web app. Each page in the app is represented by a URL ending with .xaml. How to Navigate to a new Page (the bad way) ...

Friday, December 02, 2011 10:52 PM | Comments

As Phil put it recently: it’s not every day you write this sort of blog post. A few people have been asking me why there haven’t been any updates on RealWorldWPDev in the last few weeks, and the simple answer is that I was pretty swamped over a particular life decision: changing jobs. They say changing jobs is one of the most stressful things we do in life, and I definitely believe it. November 30th marked my last day at Triton-Tek after 4.5 years. It was by far the best job I’ve had to date. I got to work with some really great people, on some awesome projects, and made good friends along the way. It was a really tough decision to leave. What’s Next? But Chicago is a big city with some great companies and great talent. I would be remiss if I didn’t...

Sunday, November 27, 2011 1:32 PM | Comments

This post is an update to my original ASP.NET MVC Recursive TreeView Helper from almost 3 years ago. Oddly enough it’s still a high-traffic post and has close to 50 comments asking for an update or a complete solution to download. I figured if I was going to do that, I might as well give the API a much-needed facelift and pop it on NuGet. What is it? Given the following self-referencing hierarchal model… public class TreeViewLocation { public TreeViewLocation() { ChildLocations = new HashSet<TreeViewLocation>(); } public int Id { get; set; } public string Name { get; set; } public virtual int? ParentLocationId { get; set; } public virtual ICollection<TreeViewLocation> ChildLocations...

Tuesday, November 01, 2011 1:19 AM | Comments

Series Introduction and Outline This series is going to walk through building a polished, functioning Windows Phone app from start to finish. The app is called Realworld Stocks and the full source code will be available on CodePlex as the series progresses. I’ll be using Mercurial to encourage forking and maybe even pull requests from developers who want to contribute their own real-world solutions. View the Series Introduction and Outline Choices In the Microsoft world we have no shortage of client and server-side HTTP stacks to choose from. Rather than try to cover every possible combination, and to prevent this topic from getting too long-winded, I will keep this part succinct. Our first major decisions revolve around the following options: SOAP or REST? WCF or ASP.NET MVC? Without getting too deep into it,...

Friday, October 21, 2011 1:33 AM | Comments

Series Introduction and Outline This series is going to walk through building a polished, functioning Windows Phone app from start to finish. The app is called Realworld Stocks and the full source code will be available on CodePlex as the series progresses. I’ll be using Mercurial to encourage forking and maybe even pull requests from developers who want to contribute their own real-world solutions. View the Series Introduction and Outline The windows phone panorama Many apps lend themselves nicely to a Windows Phone Panorama. CTA Watch looks similar but it’s actually a Pivot with a background image. After going back and forth for a bit with Real-world Stocks I decided that the panorama looked pretty nice and went with it. Thanks again @Templarian for the background! Be sure to hit...

Sunday, October 16, 2011 6:27 PM | Comments

Series Introduction and Outline This series is going to walk through building a polished, functioning Windows Phone app from start to finish. The app is called Realworld Stocks and the full source code will be available on CodePlex as the series progresses. I’ll be using Mercurial to encourage forking and maybe even pull requests from developers who want to contribute their own real-world solutions. View the Series Introduction and Outline Caliburn.Micro Many Windows Phone Applications use a lightweight MVVM framework for basic infrastructure services. Realworld Stocks is going to use Caliburn.Micro. I have had great success with Caliburn.Micro in my previous Windows Phone and Silverlight apps. CM was created by Rob Eisenberg and is under active development and has a great community and following. This article is going to walk through a lot of Caliburn.Micro setup, but...

Sunday, October 16, 2011 4:56 PM | Comments

Series Introduction and Outline This series is going to walk through building a polished, functioning Windows Phone app from start to finish. The app is called Realworld Stocks and the full source code will be available on CodePlex as the series progresses. I’ll be using Mercurial to encourage forking and maybe even pull requests from developers who want to contribute their own real-world solutions. View the Series Introduction and Outline Before you begin, install NuGet! NuGet is a Visual Studio extension that makes it easy to install and update open source libraries and tools in Visual Studio. It can be installed directly from within Visual Studio and only takes a minute. In Visual Studio: Tools –> Extension Manager and find NuGet   Defining our Solution Structure For our solution we are going...

Sunday, October 16, 2011 3:45 PM | Comments

Series Introduction and Outline This series is going to walk through building a polished, functioning Windows Phone app from start to finish. The app is called Realworld Stocks and the full source code will be available on CodePlex as the series progresses. I’ll be using Mercurial to encourage forking and maybe even pull requests from developers who want to contribute their own real-world solutions. Realworld Stocks The app we are creating is called Realworld Stocks, and this is what it looks like as of today. It’s not much yet, but hey, we’re only a few days in! Hopefully as the series progresses we’ll end up with a pretty nice looking stocks app ready for marketplace submission.   Series Outline The following is a rough outline for how I expect this series to progress. Some parts will probably be...

Monday, October 10, 2011 11:18 PM | Comments

Why? Because I should be able to Get Latest and F5! I think simplicity is a crucial measure of success in all software. I think being able to pull down the source code onto any developer machine and F5 is an important goal to strive for. Removing manual processes and streamlining the development workflow can yield huge productivity gains – especially when onboarding new developers. I believe databases should be provisioned and seeded automatically, all 3rd party libraries should be readily available in the repo, and any manual steps that must be memorized or documented should be avoided at all costs. But this hasn’t been easy on a Windows Phone device The aforementioned goals have been easily achievable in all of my projects except Windows Phone apps. A key component to this workflow is the magical variable known as localhost. When I F5 one...

Saturday, October 01, 2011 10:29 AM | Comments

This morning I received a Microsoft MVP award for Windows Phone Development. I’m really honored to be part of a community that really values knowledge sharing and continuous professional growth such as this. Over the past few years I’ve come to greatly respect and appreciate the vast amount of personal time that many people in the development community (both MVPs and non-MVPs) contribute to help drive our profession forward. I’d also like to offer a very special thanks to the entire Windows Phone Dev community for helping to expand this great platform into the consumer reach that it deserves. There is still a ways to go, but after the impressive world-wide launch of Mango across dozens of countries, carriers, and OEMs on a single day I think we can all agree that Microsoft is taking this seriously. I’m personally really excited to be in on the ground floor this...

Tuesday, August 16, 2011 12:07 PM | Comments

The default Model Binder in ASP.NET MVC works fine for most cases. Most of you have probably registered custom binders with it plenty of times. ModelBinders.Binders.Add(typeof(ILoadProvider), new LoadProviderModelBinder()); The issue is that that it’s limited to binding the exact type you add to its dictionary. The ILoadProvider registered above will invoke my LoadProviderModelBinder as long as the controller action parameter is of type ILoadProvider. But what if you have a type that derives from ILoadProvider and still want your custom binding to occur? Thankfully this is very simple in ASP.NET MVC 3. It comes with a new extensibility point, IModelBinderProvider, and works just like the other providers. public interface IModelBinderProvider { IModelBinder GetBinder(Type modelType); } InheritanceAwareModelBinderProvider With this interface, we are able to create a very simple InheritanceAwareModelBinderProvider. /// <summary> /// Adds inheritance support when registering model binders. /// Any model binders added here will be invoked if the Type being bound inherits...

Friday, July 22, 2011 3:50 PM | Comments

TechWeek Chicago Starting today and running through next Friday, July 29th is TechWeek Chicago. TechWeek is a week of conference, expo and events with over 2,000 entrepreneurs, business leaders, and innovators, 4 days of conference sessions, over 150 international speakers, 4 days of an expo hall with over 100 exhibitors, 35 competing tech startups, and over 30 independent off-site events. TechWeek connects the newest web and mobile technologies to thousands of Chicago business, academic, community, art, and media professionals- all within one week. For more information about TechWeek, check out http://www.techweek.com. Windows Phone Unleashed During TechWeek Chicago, Microsoft is hosting Windows Phone Unleashed @ TechWeek. This will be an incredible evening getting hands-on with Windows Phone and you will have the opportunity to work with the Windows Phone and Windows Azure experts to help get your app ideas of the ground. More details for this event is...

Wednesday, July 20, 2011 11:16 AM | Comments

A few weeks ago I was invited onto the Developer Smackdown podcast to muse about my adventures in Windows Phone development. That episode went live today, and can be found on iTunes/Zune under the series name “The Smackdown.” Of course it can also be streamed by any modern browser from the Developer Smackdown site. In this show, Mark and Clark sit down with Matt Hidinger and talk about building his app CTA Watch for Windows Phone 7. Matt discusses his experiences over this past year and shares a great deal of passion about the platform. i’m convinced, where can i get it? ...

Tuesday, May 17, 2011 10:21 AM | Comments

This past Saturday was the third annual Chicago Code Camp. If you missed it and you’re in the area, be sure to attend next year! It’s free, and organized by a great group of community leaders here in the greater Chicagoland area. My talk this year was on Onion Architecture. A slight variation of the “ports and adapters” application architecture, I first started reading and prototyping the concepts introduced by Jeffrey Palermo. Check out his blog if you want to read a bit more on it. If you happened to attend my presentation and have any feedback please do let me know! Next year I hope they will be bringing speaker evaluations back – as I greatly appreciate any input on my speaking ability, constructive or otherwise!   ...

Sunday, April 10, 2011 8:35 PM | Comments

I’ve just finished my new app called Transit Directions. As the name hopefully implies, the app helps people get around a city with public transit. It will provide step-by-step directions for 11 cities, with an interactive map to aid the experience. I spent a bunch of time polishing this app to replicate the native Bing Maps app experience, hopefully it paid off. I assume this functionality will be built into the native app with the Mango phone update, so this baby has a limited shelf-life. B

Sunday, April 03, 2011 1:29 PM | Comments

update I’ve updated the code to check for the MapZoom event; also fixed a typo of MapClick to MouseClick.   Original Post The Windows Phone Bing Maps control is very close to its desktop Silverlight counterpart, with few missing features. In fact none of the limitations have really impacted my phone projects, until today I ran into a peculiarly missing event: MouseClick. Without MapClick there is no built-in way (to my knowledge) to detect when the user taps on the map. The Map control unfortunately swallows all ManipulationCompleted events, and MouseLeftButtonUp/Down get fired even when the user pans or zooms the map, which we don’t want to concern ourselves with. Blend Triggers to the rescue The solution I came up with is a Trigger called MapTapTrigger. In meeting with a number of other WP7 developers over the past year I came...

Wednesday, March 23, 2011 1:03 PM | Comments

I apologize this is a week late. Below is a zip which includes the slides and solution from my presentation on Caliburn.Micro. It should serve as a pretty good reference application for how to implement the most common functionality in Caliburn.Micro. I’ve also included a simple HTTP framework which can take advantage of Caliburn’s Coroutines to easily issue GET requests and parse the JSON response into a typed model. Download the Code!   Technorati Tags: presentations,wp7,wp7dev,caliburn,mvvm