Sunday, 30 October 2016

Sprint One - As "Stuart McLean" I want to be able to get a csv list of entrants for a brevet.

The physc evals tell me I'm an implementer - which means I get cracking on things but, as many around me know, rarely finish.  You need a completer finisher for that.
So, I thought a lot and put one thing on the backlog that I might be able to achieve in an hour.

Breaking down the user story

It looks pretty innocuous - right - but - believe it or not, there has been a fair amount of thought into such a simple story.

Let's start with the actor.


"Stuart McLean" - why not a brevet organiser.


Well - there is a whole bunch of stuff that needs doing do secure the average online applicaiton - authentication, authorisation, deployment, hosting etc.  As "Stuart McLean" I can circumnavigate all of these and focus on the data!

Get a list of csv entrants

So as I said in my last blog - I already have a way of using excel to do lots of the admin.  The big task is to get the data in a spreadsheet.

For a brevet

Well - I guess it's really for the next brevet!

What I have

Well - I guess I already have a list of previous people and brevets.
I also know what brevets are coming up.

Solution Overview

I'm going to create a database - whoop whoop - to store:
Riders,
The Brevets,
Entrants to a brevet - i.e. the relationship between the Riders and the Brevets.
Then I'm going to upload the data from the excel files I have.  This should give me a list of riders, existing entries and previous brevets.
This should validate my data model.
I'm going to do all this in SQL Server management studio straight on the database.

Can I Sprint in an hour?

ACP Brevet Cards

It seems the more I know, the less I get to do.  I'm currently a technical architect for 6 sprint teams - which is exciting and challenging but I'm getting less and less (read no) time at the coal face.
The pace of change in IT seems to be exponential and I like to keep my toes on the edge of the programming curve.
OK - so I'd love to get back into Unix, c++, java and all that stuff - but it's been 15 years or so so I'm going to stick with the Microsoft stack.

The Challenge

Deliver a user story in one hour.  That's one hour to code, test and release.  
"Give me six hours to chop down a tree and I will spend the first four sharpening the axe." 
Abraham Lincoln

I am going to allow - outside of the hour - study and plan.  Hopefully this will make the hour super productive.

The project

The project is simple - and combines programming with my other passion - cycling.  You can read about some of my cycling here.  Every year I organise a few "Brevets" - long distance cycle rides for Audax Ireland.  There is a bit of admin involved:

  1. Collect details of participants - currently they email or post a form with name, address etc.
  2. Collect money - I accept PayPal or cash on the day.  Not all organisers accept cash and some push the PayPal through the clubs.  Different events cost different amounts.  Payment can be made in € or £.
  3. Print "Brevet Cards" with the event details, riders details and control points.
  4. Sign on sheet for Cycling Ireland (CI) with list of riders to collect signature at start.
  5. One day licence form for riders who aren't members of cycling Ireland.
  6. On completion - fill in finisher details on spreadsheet for Audax Club Parisien to homogolate the rides and order medals where required.
  7. Submit accounts and pay balance toe Audax Ireland (AI).
  8. When homogolation stickers and medals arrive, post with brevet cards to riders.
Currently I run all this using a spreadsheet to collect the rider info on.  I then have a word mail merge for the Brevet cards and cut and paste onto the other documents.
The biggest pain is actually getting the data on the spreadsheet.  It is either keyed or cut an pasted depending on how the application arrives.  I can also sometimes cut and paste from an old spreadsheet - but the CI license numbers change every year and other details may change.

The tech

  • SQL Azure - assuming a relational database - might need other azure tech around the outside for large data or whatever.
  • C#.net for business object layer, processes etc.
  • MVC for serving HTML  to client
  • WEB API - for services
  • Angular
  • Visual Studio

Entity framework or ADO.NET + Strongly typed stored procedures.

Its a  question that's been worrying me for about 8 years!  
Currently I have projects working with ADO.NET and stored procs (most), EF and unit of work, and EF over stored procedures.  I'm still torn between development speed, security, maintanence and 

Strongly Typed Stored Procedures

  • Tick a big security box - giving lease privilege access to the database and strong type checking - a string is a string never a piece of sql, thus adding a layer of defence against many forms of attack, SQL injection being the most obvious.  OK - O know EF will have vendor backing and is paramaterised etc. etc. but believe me, when some external auditor comes in and says what layers of defence do you have against attack, the strongly typed stored procedure with least privilege (i.e. connection can only execute stored procs) is king.
  •  Are fast
  • Do set based operations where they belong - in an engine that has been optimised over about twenty five years for performing set based operations!
  • Allow provide an encapsulation layer over your data model, allowing it to be changed and maintained independent(ish) of your code.
  • Allow your database to be normalised and your object model to be de-normalised as. it should be.
  • Allow your interactions with the database to be as they should i.e. full control over how much data is fetched when.
  • Is stable with a very long support life ahead and behond - ADO.NET.
  • Can lead to business logic being scattered across code and sql depending on who wrote it!
  • Can result in stored procedure mountains.
  • Offer a great maintainence fix.

Entity Framework

  • Is quicker to develop - though I'd argue this might only be over the first few iterations of a project.
  • Supports more flexible query functionality for the application e.g. sorting, querying multiple parameters etc. without additional effort.
  • Can leave you fighting the framework.
  • Is not as stable
  • Is not as secure
  • Through web services - offers a consistent business layer for other applications e.g. reporting etc.
  • May lead to compromises in the data model (de-normalised) or the business object model (too normalised).
  • Requires a full code deploy.
I'm going to put this decision off a bit longer!

Project management and tools

OK - so its agile, obviously.  

Agile tool/work tracking

TBD - I have visual studio online/visual studio team system and this is the obvious choice but I might look at a more "open" product - after all I'm wearing shorts right!
I guess initially it'll be this blog as my Minimum Viable Product in an hour is going to be very minimum.

Source Code Repository

To open source or not to open source, that is the question - well - I really want to open source - not that I'm expecting a million IT pros to rock up and start working on this but, like I say, I wearing shorts.  I thing I need to be careful of is ideally I'd use some of Stiona Software's utility and platform code but this has IPR wrapped in it and I'm not wearing sandals.  Software is my living too.

Again - with my shorts on GIT - but frankly it's something else to learn at the moment.

So - probably codeplex.  I have an account and it integrates with visual studio.

Tuesday, 11 October 2016

Powershell delete all recycle bins

Get-ChildItem "D:\`$Recycle.bin\" -Recurse -Force | Remove-Item -Force -Recurse

Blatantly stolen from http://serverfault.com/questions/330776/clear-the-recycle-bin-for-all-users-in-windows-server-2008-r2

Monday, 10 October 2016

Powershell Azure - when you have multiple "directories"/ tenants.

Documentation didn't really cover this too well but when I tried to use powerhell to move items between subscriptions I kept getting an invalid subscription id.  I eventually deduced it was because I have two directories/tenants and was in the wrong one.

List subscriptions using

Get-AzureRmSubscription

then select one in the right tenant making sure you specify the TenantID too.

Select-AzureRmSubscription -SubscriptionId xxxxx -TenantId yyyyy
Basically it seems if you've multiple "Directories" / tenants you have to specify the tenant id.

Once you've done that, moving subscriptions etc. works for that Tenant.