Category Archives: Uncategorized

Cory Made Me Do It!!!

Tonight I had the good fortune to attend Cory House‘s “How to become an outlier” talk.  I’ve heard this talk before but in a way it was totally new.  Perhaps I wasn’t paying attention the last time I heard it or perhaps the act of taking notes forces you to remember more, but I feel very motivated and energized and happy about being a programmer — more so than I was earlier this week.  Among the advice Cory gave: programmers need to blog! Okay fine… even though this is a content-free post I’m going to blog and make an informal commitment to blog every other week or when I find something of use or interest on twitter or hacker news (sorry — I just can’t do Reddit, even if Mr. House thinks there’s something of value there). So if you’ve been waiting for me to blog again you can thank Cory — he made me do this again!

I would be remiss if I didn’t express my thanks to Melissa Green (or Greene?) for organizing the VML Speaker Series.  I’m really impressed by what I saw of the VML office, and being an aviation geek I question how much work I would get done if I had a view of runway, apron, and approach to KMKC… I look forward to December’s installment!

KCDC Precompiler

Last fall I attended Iowa Code Camp.  I took lots of notes but those notes were on paper and I never transferred them to a medium I could access at work.  Knowing how much I wished I had access to my notes while at work I decided that I’m going to transfer my notes from KCDC 2014 to a series of blog posts… this way I can look back at them later and do more research.

Today’s session was a “precompiler” session — an all-day training session before the conference starts in earnest — at KCDC 2014. The nominal topic was “building powerful web apps with ASPNET MVC, Bootstrap, Angular, and more” and in my estimation, “and more” was an understatement.  I was expecting this to be mainly an Angular presentation, which is why my team lead and I elected to attend this session.  To my delight, much more than just angular was covered.  I am not sure if my team lead thought this was a value add but she seemed to like the content.

  • Service bus architecture: powerful and under-utilized (azure, nservice bus, rabbitmq)
  • Speaker is a BIG believer in nosql, especially MongoDB
  • Check out for hosted mongodb
  • Speaker is a big believer in cloud based services (like Harvest for time entry)
  • Prediction: “You won’t be working with DBAs in the future.”
  • MongoVUE — sort of like SSMS for MongoDB
  • Use NuGet to pull the official mongodb driver into your .NET application
  • Don’t check in your NuGet packages to source control: grab them via nuget and compile
  • MongoDB: speed of read/write trumps increased storage space requirements
  • [BsonID(IDGenerator = typeof(CombGuidGenerator))]  attribute for specifying a BSON guid on a field in code
  • There are tons of ID generators for Mongo — check out mongo docs for more info
  • Site to love: FakeNameGenerator
  • — monitoring dashboard for mongodb, “better than perfmon”
  • “Eventually Consistent” was a common theme for today
  • Visual Studio Online: Pro license is apparently $22/month (where is this link?)
  • Azure Console Host for long-running processes
  • exception error tracking; Balsamiq UI mocking
  • CC payments: Stripe and Braintree
  • Azure architecture: worker role “back end” servers and web front-end servers. Do AS LITTLE AS POSSIBLE on the web servers; make the worker role servers do as much as possible, with a service bus between them.
  • MVC ActionResult: use “return Json(object);” to make a JSON api w/o WebAPI
  • Dev/Prod routing: Prod:{url}  Dev: localhost:{port}/cname/{url} — switching between the two is a matter of routing specs (possibly web.config transforms also?)
  • [JsonException] — return that on an error… I didn’t take good notes on this point
  • Autofac: DI container of choice for MVC since it has handy hooks esp for MVC
  • Check the wiki on/via github for more Autofac info
  • Angular is about DIRECTIVES!
  • iirc: jsarray.splice(index,1) will remove the index element from an array in JS
  • (Lunch happened here)
  • ng-cloak — seems hackish but it works… play with it
  • Batarang: AngularJS plugin for Chrome Dev tools
  • JS testing: Jasmine & Chutzpah — know it, learn it, love it
  • JS promises — seriously: learn this! (NG uses $q library for this iirc)
  • ng-promises: .success({}).error({}).finally({ /* bIsLoading = false; */});
  • — read about it here, get it via NuGet
  • Security for MVC API: use Forms Auth or OAuth (eg: twitter, FB)
  • Morris Charts are awesome — use them (better: wrap as directives)
  • ng-grid — one of many great 3rd party controls for Angular
  • Angular Bootstrap: angular wrapper for twitter’s gift to non-designers
  • NG-google-maps FTW!
  • Themes:, Template Monster, etc — GIYF
  • Browserstack: test it or regret it.
  • Plunkr: looks like jsfiddle to me… am I missing something?
  • Noty and Toastr — great notification plugins (unless you want to roll your own)
  • Service Bus: it’s a queue (a sort of database in a sense)
  • “Windows Azure Service Bus” << get it using NuGet
  • SignalR: seriously cool… and get it via NuGet

These are my notes — I’ll be posting tomorrow and Saturday’s notes next week, most likely.

“I’ll take ‘Buzzwords’ for a quarter billion pounds, please…”

As a programmer it’s both instructive and hilarious to read the reasons behind the massive “failure of the agile methodology” in developing the UK’s new Universal Credit Programme. Granted, the link-bait title and the content of this article don’t quite match, but the initial message being communicated is that Agile failed on this massive, two year long project and that hundreds of millions of pounds have been wasted.

But if you look more closely at the article you’ll find this little nugget:

That delay suggests there was not enough of an iterative feedback loop built into the programme, according to Jose Casal-Gimenez, chairman of the BCS agile methods specialist group and expert on Kanban and Lean agile methodologies. “It wasn’t agile enough in this fundamental area,” he said, adding that in his view there wasn’t enough emphasis on “real-world testing” and learning from user feedback.

I could be completely wrong, but my interpretation of this passage is that some bureaucrat read an article about Agile being a magical silver bullet for software development and decided this project would be agile without having the first clue what that really means or how to implement it.

Practical upshot for developers: if your PHB (pointy-haired-boss) reads the ZDNet article he’s going to get the impression that Agile is snake oil and insist on something else with a more tried and true legacy (like waterfall?) for future software development.  Agile, when done correctly can deliver higher quality solutions in less time… but you need everyone in the process — from stake holders, business analysts, managers, developers, testers, QA, etc — to understand what Agile really is and how it’s properly done.  It seems the managers of this UK project — as well as the writer of the ZDNet article — need more education on this point.

Why JavaScript Will Become The Dominant Programming Language Of The Enterprise

That’s the title of an article over at Read-Write-Web. Good to know the advice I started giving two years ago to people interested in learning or getting into programming (learn javascript!) was on the nail. This trend isn’t going to be slowing down either.

Read the article here:

And now for some obvious understatement…

Something changed. Because it’s been so long since I’ve copied and pasted code to this blog I don’t recall if it’s the settings in Visual Studio that changed or if it’s the WordPress blog post editor.  At one point in the past it was clearly possible to copy code maintaining the fonts, colors, formatting, etc but in that last post about custom attributes in MVC all of that was lost.  It’s possible that the older post with correct formatting was done from an install of Visual Studio that had an extension meant to make easy for this activity… I recall having something like that installed at one time.

I’ll try to figure it out and make whatever changes are needed so that future posts about code will look the same on WP as they do in my code editor.  Riveting stuff, I know… but it’s somewhat important to me.

Custom Role Attributes in ASP.NET MVC

Here is the code for defining and applying custom Role attributes in ASP.NET MVC. This specific example checks to see if the user is part of a given Active Directory group, but changing this to a custom validation should be fairly obvious.

Code in the controller:

[MyAuthorizeAttribute(Roles = “{AD group goes here}”)]
//ActionMethod code goes here…

Code to implement the attribute:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace MyProject.Controllers
public class MyAuthorizeAttribute : AuthorizeAttribute
protected override bool AuthorizeCore(HttpContextBase httpContext)
if (httpContext.User.Identity.IsAuthenticated)
UserGroups groups = new MyProject.Shared.ActiveDirectory.UserGroups(HttpContext.Current.User.Identity.Name);
var roles = ( Roles ?? string.Empty).Split(‘|’);

//if granted role exist in users group or if its admin-overload ( admin permission) for all menu
if (groups.IsInDistGroup(Roles) )
return true;
return base.AuthorizeCore(httpContext);

protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext)
filterContext.Result = new ViewResult
ViewName = “~/Views/Shared/NotValid.cshtml”

When making service calls from a library…

Just in case you’re working in a C# class library project and need to make an HTTPS web service call and the project in which you’re working isn’t the root project of the solution, then you can either go through the brain damage of editing the app.config of the root project or you can explicitly set the binding and address of the service call in code, which is faster and easier than it seems:

using System.ServiceModel;
BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
string serviceUrl = "";
EndpointAddress address = new EndpointAddress(serviceUrl);
MyService.MyServiceSoapClient _myService = new MyService.MyServiceSoapClient(binding, address);
string result = _myService.doUsefulWork(param1, param2, param3, paramEtc);