Lunch’n’Learn – async/await

We’ve recently started doing more work with the async/await keywords (a side-effect of using MassTransit) and we thought it was a good idea to go through the basics again. Here’s the talk I found which is very easy to follow, full of useful information and well-recorded (if a little dry) – it focuses on usage within but that’s useful for most of us.

Additional bonus video about whether you should always be using an O/RMs (9 minutes, funny):

Productivity lunch’n’learn

Here’s a great Scott Hanselman talk about productivity – he’s been giving it for a while so there are a lot of versions out there, however this is probably a good balance between length / audience interaction and sound quality.

It’s not directly development related but was received really well by the team here.

UI and other network considerations – Embracing the Network lunch’n’learn

This talk is available in various forms across the web and it’s interesting the difference in reaction it received – with the old team at Haymarket we came up with about two pages of suggested changes to our front-end code and other improvements.

At Mountain Warehouse, a lot less interest – but then the team is fairly back-end focused and never really get to play with the UI.

Patrick Hamann – Embracing the network from Web Directions on Vimeo.

MassTransit / RabbitMQ lunch’n’learn

Today I ran a lunch’n’learn around MassTransit and event driven architecture. In addition to some demo code, we watched the video below. It covers things quite nicely, not a lot of detail in the demonstration but as it’s MassTransit 2.x (not 3.x) that was OK. Quality is good, speaker is a little drone-y so a bit of snooze-danger if you’ve had too much pizza!

Loosely coupled applications with MassTransit and RabbitMq – Roland Guijt from NDC Conferences on Vimeo.

RESTful API lunch’n’learn

A little while ago we did a RESTful API lunch’n’learn session. These are the videos that we used.

This video from Stormpath covers a lot from basics to good patterns to use – it’s also good quality and as a speaker he’s quite animated so this kept our attention:

For those people who’ve used more SOAP services this video has been good to help compare approaches – however it does seem as if the presenter prefers SOAP (what else would you expect from Oracle?) so you have to apply your own salt:

Other notes

Here’s a quick overview of the properties of the HTTP verbs (this applies to more than just REST APIs!):

GET – Safe, Idempotent
PUT – Idempotent
DELETE – Idempotent
HEAD – Safe, Idempotent
POST – (none of these)

Safe: Makes no change to the server / performs no action. For e.g. reading an entity is a safe, incrementing a counter or sending an e-mail is not.

Idempotent: Doing this multiple times is the same as it doing it just once. For e.g. “a = 1” is idempotent. “a += 1” is not.

Eurovision 2016 round-up

Again, squirrel mindedness means I need to make some records of the ones I liked this year.

Called it – Bulgaria went from outside chance to placing 4th this year:

Belgium brings something different to Eurovision again this year:

Spain, so upbeat!

Stick a bow on it…

What does a love wave look like?

The interval shows…

Monitoring ViewState size

A short and very dirty script I wrote for TamperMonkey that keeps an eye on the size of your ViewState and alerts you if it gets a bit big. I appreciate this could be a lot better written feel free to take and adapt and improve – although let me know as well please!

Don’t forget to change the @match parameter

// ==UserScript==
// @name         Monitor ViewState size
// @namespace
// @version      0.1
// @description  Monitors ViewState on page and alerts you if it gets big!
// @author       Rob Church
// @require
// @require
// @match        http://**
// ==/UserScript==

/* jshint ignore:start */
var inline_src = (<><![CDATA[
/* jshint ignore:end */
/* jshint esnext: true */

    var allowedViewStateSize = 5000;
    var alerted = false;
    var viewStateSize = document.querySelector('#__VIEWSTATE').value.length;
    if (viewStateSize > allowedViewStateSize) {
       alert('Viewstate is large: ' + viewStateSize);
       alerted = true;

       var viewStateSize = document.querySelector('#__VIEWSTATE').value.length;
       if ((viewStateSize > allowedViewStateSize) && (alerted == false)) {
          alert('Viewstate has *BECOME* large: ' + viewStateSize);
          alerted = true;
    }, 2000);

/* jshint ignore:start */
var c = babel.transform(inline_src);
/* jshint ignore:end */

Videos for unit testing / TDD in .net

I recently ran a lunch and learn about unit testing and test driven development. Could not find any amazing videos out there, so we went with these. Any better suggestions please let me know in the comments!

This one is more theory up to about 1 hour, then it gets hands on but with Java.:

Hands on with .net and some great advice for writing good tests, but pretty low resolution:

If you have PluralSight, here are some good courses:

Eurovision favourites 2015

The last few years I’ve enjoyed Eurovision far more than I should, but completely forget the songs year-to-year. That’s probably not a bad thing but my squirrel-minded filing can’t let it go – so here’s a record, mostly for me.

Sweden deserved to win, this is great pop and a great show…

Was our entry really deserving of so few points though?

Not ballads (yawn), but not Euro-pop either, colour me interested:

Winter is coming!

Most Eurovision-y of them all (and I didn’t notice, a bit of a middle finger to Russia as well!)

Looking forward to 2016!

Keeping it simple – sometimes you don’t need to call .Any()

Something I’ve seen quite a lot of in the codebase I’m working on…

If a collection is empty, the count is 0 and the enumerator is valid but won’t return any items – so there is no need to call .Any() before summing or enumerating.

Count() example

    .Where(tag => tag.ChildTags.Any())
    .Sum(tag => tag.ChildTags.Count());

Because .Count() returns 0 if there aren’t any, this can be reduced to:

     .Sum(tag => tag.ChildTags.Count());

Enumerator / foreach example

if (tag.ChildTags.Any()) {
    foreach (var childTag in tag.ChildTags) {
        // Display

If there aren’t any ChildTags then the foreach has nothing to iterate over – but it won’t throw an error, it just jumps over the code block. It can be simplified to:

foreach (var childTag in tag.ChildTags) {
    // Display