DDD Scotland final agenda

ddds-unicorn-side-284-086We’ve finalised our agenda and already people have said they’re finding it difficult to decide which sessions to see and which they’ll have to miss out on.

For full information visit ddd.scot. Tickets are available here.

Napier / Doyle Lauder / Heriot Clark Greyfriar
08:30 Registration
09:20 Welcome and housekeeping
09:30 Paul Gillespie
Architecture at Web scale: the good, the bad and the ugly
Keith Kirkhope
A Squad Lead’s tale: the Skyscanner Squads model
Christos Matskas
ASP.NET Core (formerly 5) deep dive
Matt Lacey
Six dimensional mobile user experiences
10:30 Break
10:50 Craig Nicol
Developers are users too : why the user experience of your API sucks
Clarke Ching
Lesstimating: how to fix estimating by doing less of it, not none of it.
Naeem Sarfraz
Windows brings Docker Goodness – What does it mean for .NET developers?
Chris Canal
React for the .Net Developer
11:50 Break
12:10 Raymond Davies
Breaking the monolith
Nathan Gloyn
You keep using the word agile, I do not think it means what you think it means
Gary Ewan Park
Having your Cake, and eating to too!
Don Wibier
Responsive Web Design for Developers
13:10 Lunch
14:25 Sebastien Lambla
Versions are evil – How to do without in your APIs
Chris McDermott
“Ladies and gentlemen, the plane is no longer the problem”
Toby Henderson
Brighter to the Core, moving an OSS project to .Net Core 1.0
Gary Short
Would You Have Survived The Titanic?
15:25 Break
15:45 Max Vasilyev
CQRS and how it can make your architecture better
Richard Dalton & Ashic Mahtab
“Advanced” Functional Programming For The Absolute Beginner
Mike Ritchie
The Code Craftsmanship Thing for the Internet Of Things Thing
Kendall Miller
To The Cloud! How Azure helped us improve the scalability of our SaaS
16:45 Prize draw
17:15 Close

[tickets]

Setting up Ubuntu for .NET Development

First up, at the time of writing only Ubuntu 14.04LTS is supported. I’ve read that it will work on 15.04, but I know it won’t work on 15.10 because of a binary incompatibility on a library that .net core relies on.

Step 1: Install the .NET Execution Environment

Follow the instructions at https://docs.asp.net/en/latest/getting-started/installing-on-linux.htm

This will install the .NET Execution Environment (DNX)

Step 2: Install Node.js

Since .NET Core relies on node js for parts, and there are some cool code generators using node.js as the templating engine, install node.js by following the instructions here: https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions

I used version 4.x LTS (4.4.1 to be exact)

Step 3: Install Visual Studio Code

This is actually optional – I’m installing it because I wanted to get the standard IDE for C#. You can get away with running just the regular text editor installed with Ubuntu.

First, download Visual Studio Code. Then follow the setup instructions…. Kind of.

Unzipped the zip file to /usr/local/bin with

sudo unzip ~/Downloads/VSCode-linux-x64-stable.zip

Then I created the link as in the instructions so that I can launch from the terminal.

To launch from the terminal and get the prompt back use

code &

Step 4: Install Yeoman

Before you do, you’ll need up to update NPM as the version that comes with 4.x LTS is older and the current version of Yeomen doesn’t like it.

sudo npm install -g npm

Install yoman by following the instructions here: https://github.com/omnisharp/generator-aspnet#generator-aspnet

Remember to put sudo in front of install commands specifying -g (global) otherwise you’ll get an error message.

Step 5: Create a project

Move to a directory that you want to create a new project in. I use ~/dev for all my development work.

Then start Yeoman with:

yo aspnet

This will result in a prompt that looks like this:

     _-----_
    |       |    .--------------------------.
    |--(o)--|    |      Welcome to the      |
   `---------´   |   marvellous ASP.NET 5   |
    ( _´U`_ )    |        generator!        |
    /___A___\    '--------------------------'
     |  ~  |     
   __'.___.'__   
 ´   `  |° ´ Y ` 

? What type of application do you want to create? (Use arrow keys)
❯ Empty Application 
  Console Application 
  Web Application 
  Web Application Basic [without Membership and Authorization] 
  Web API Application 
  Nancy ASP.NET Application 
  Class Library 
  Unit test project 

You can then use the arrow keys to move up and down the list.

Choose “Web Application Basic”

It will then prompt for a name. I chose “MyHelloWorldApp”

It will create that directory and populate it with files for the project. You’ll still need to restore the packages that you need, and yeomen gives you some help on getting that done.

If you follow the yeomen instructions you’ll find that at the dnu build step it fails. This is because the project template has dual targeting. It targets .NET 4.5.1 and .NET Core. On Linux only .NET Core will run. To remove the dual targetting open the project.json file and find the section that looks like this:

  "frameworks": {
    "dnx451": {},
    "dnxcore50": {}
  },

And remove the entry for "dnx451" then save the file.

dnu build won’t work just yet. If you try it you’ll get an error message:

/home/colin/dev/MyHelloWorldApp/project.lock.json(1,0): error NU1006: Dependencies in project.json were modified. Please run "dnu restore" to generate a new lock file.

Build failed.
    0 Warning(s)
    1 Error(s)

So, run dnu restore once again so that the dependencies synchronised with the project.

Once that’s done type dnu build and it will now succeed.

You now have a basic environment set up on Linux for developing .NET Core applications and have demonstrated that you can create and build a simple ASP.NET Core application.

Tip of the Day: Calculating durations with Moment

Moment has quite a nice fluent interface for some operations, others just need a little more thought.

For example, I wanted the duration of something and I had recorded the start and end time. I thought something like this, finding the difference between two dates and converting it to a duration, would work:

var duration = endTime.diff(startTime).duration().asSeconds();

However, that doesn’t work.

What you have to do is find the difference, then pass that into the duration function, like this:

var duration = moment.duration(endTime.diff(startTime)).asSeconds();

And now I get what I wanted.

Estimates are not deadlines

This is another one of those cautionary tales of what not to do.

A number of years ago I worked for a digital agency. For most of my time there I worked on systems in a specific market sector and I got to know it quite well. Then a brief came in from a new client in that sector who wanted a new website. It seemed natural that I was asked to work on that project.

It was also natural that we should work out if the brief was doable within the budget that the client had, so we got to work analysing the requirements and estimating how long it would take. This was then translated into billable hours and compared against the client’s budget.

The estimate showed that the work could not be completed within the client’s budget.

At some point shortly after that word from on high was that we needed to make it work within budget, and the development manager then asked us where we could make savings. He went through with us all the estimates attempting to find out if we’d padded them out.

Although we managed to cut the estimates down a little they were still too high. We needed more cuts. We needed to cut 22.8% from the estimates.

At the time, we were using the project to trial a new project management tool called VersionOne so all the tasks and estimates were in that system. Some things were estimated at an hour, some two hours, some four hours, some a day. All rounded numbers. All based on a gut feel in the very early stages of a project when we still didn’t know half the information we really needed, which is to say these estimated weren’t even educated guesses, some numbers were picked from the air, some were based on experience in other projects which were similar but not the same.

The estimate we came up with for the project was our best guess with the information we had.

Then a day or two after the exercise to pare back the initial estimates I came in to discover that all the estimates, every single last one of them, had been revised downwards. I may not have immediately noticed if it wasn’t for the fact that they no longer had nice rounded numbers.

For example, all the tasks that was estimated originally for 2 hours were now estimated as 1 hour, 37 minutes, and 42 seconds. Gosh! That’s an awfully precise estimate. I can hardly call it an accurate estimate.

The Development Manager, in order to meet the board’s approval, had cut precisely the amount needed to meet the budget on every single task. The project now came in almost exactly on budget.

When the work actually started it was clear that the estimates were wildly out in some cases. Not just the overly precise revised estimated, but the original estimates too.

The company culture being what it was, stress was applied to ensure that work was proceeding on scheudle. Developers were held to the estimates, even although they weren’t the original estimates, and estimates are just guesses based on the information available at the time.

There are a number of solutions to this, however, the company was not receptive to those ideas. Their model was the client says jump, they respond how high. Then they whip their staff until the desired height is reached.

.NET Rocks! is coming to Scotland

Scottish Developers

Join Carl Franklin and Richard Campbell as they take you on a tour of the broad range of subjects they’ve explored recording more than 1200 episodes of .NET Rocks! over the past 10+ years. The development world today is evolving rapidly, but a look at the history of development can help inform the path we’re on and where we’re going. Along the way you’ll hear some great stories from the various .NET Rocks! episodes and get some ideas of how you can take your career and your company into the future of technology.

dnr-duo-reframed.jpg

They have a three date tour of Scotland coming up in January. More information and tickets can be found here:

Each evening, Carl and Richard will delivery their keynote talk followed by a recording of .NET Rocks with a special guest.

Sponsors

View original post 258 more words

Using GitHub Two Factor Authentication (2FA) with TeamCity

If you have two factor authentication (2FA) set up in GitHub and you also want to use TeamCity, the easiest way to set this up is to set up SSH keys to access the GitHub repository.

The first step is to follow this guide to creating SSH keys for GitHub. Remember the passphrase you use when creating the key, you’ll need it later.

Once you have created your keys and applied it to your GitHub account you can then follow this guide for managing SSH keys in TeamCity.

Finally, when setting up your VCS Root in Team City you set the Fetch URL to the SSH variant. You can find this on your project page on Github towards the bottom of the right sidebar.

You may need to click the “SSH” link below the URL if it does not already show the SSH URL.

Back in Team City you can paste this URL in the Fetch URL box in the general settings. Further down the form in the Authentication Settings section you can specify the SSH key you uploaded earlier.

By specifying “Uploaded Key” the boxes below will change. Select the key you uploaded earlier, the user name is “git”, and enter the passphase you used when you created the SSH key.

You should now be able to test the connection to see if all is well.

Debugging a process that cannot be invoked through Visual Studio.

Sometimes it is rather difficult to debug through Visual Studio directly even although the project is right there in front of you. In my case I have an assembly that is invoked from a wrapper that is itself invoked from an MSBuild script. I could potentially get VS to invoke the whole pipeline but it seemed to me a less convoluted process to try and attach the debugger to the running process and debug from there.

But what if the process is something quite ephemeral. If the process starts up, does its thing, then shuts down you might not have time to attach a debugger to it before the process has completed. Or the thing you are debugging is in the start up code and there is no way to attach a debugger in time for that.

However there is something that can be done (if you have access to the source code and can rebuild).

for (int i = 30; i >= 0; i--)
{
    Console.WriteLine("Waiting for debugger to attach... {0}", i);
    if (Debugger.IsAttached)
        break;
    Thread.Sleep(1000);
}

if (Debugger.IsAttached)
{
    Console.WriteLine("A debugger has attached to the process.");
    Debugger.Break();
}
else
{
    Console.WriteLine("A debugger was not detected... Continuing with process anyway.");
}

You could get away with less code, but I like this because is is reasonably flexible and I get to see what’s happening.

First up, I set a loop to count down thirty seconds to give me time to attach the debugger. On each loop it checks to see if the debugger is attached already and exits early if it has (This is important as otherwise you could attach the debugger then get frustrated waiting for the process to continue.)

After the loop (regardless of whether it simply timed-out or a debugger was detected) it does a final check and breaks the execution if a debugger is detected.

Each step of the way it outputs to the console what it is doing so you can see when to attach the debugger and you can see when the debugger got attached, or not.

My recommendation, if you want to use this code, is to put it in a utility class somewhere that you can call when needed, then take the call out afterwards.

At the top of your game

Having recently changed jobs I read a fair number of job specs and a phrase that stuck out for me was a desire for companies to hire someone “at the top of their game”.

I can understand the sentiment behind that. You want to hire someone that is very good at what they do. However that turn of phrase is off-putting for one big glaring reason. If you are at the top of your game now, where do you expect to be in the future?

I will be quite honest and say that I am not at the top of my game. I don’t expect to be at the top of my game for decades to come. And when I do get to the top of my game it will be the day I retire.

What I do expect of myself is to continually learn and improve. Each day I improve “my game”. I take the mistakes I’ve made in the past and commit to not repeating them. I take the successes and find out what made them successful and apply them to appropriate situations in the future. I learn new technologies as that broadens my horizons and makes me more valuable. Through my blog, at conferences, or mentoring colleagues I teach others what I have learned as that helps everyone improve and it solidifies in my mind the knowledge I have.

The interesting thing is that I didn’t used to think that way.

When I left university I had the arrogance to think that I knew it all and for a few years I worked on that principle. But that attitude eventually caught up with me and I spent some time unemployed partly as a result of that attitude. I am determined not to let that happen again. These days I am acutely aware of what I don’t know. I think that now I am more aware of my limitations I am a better developer. Because I’m more aware of what I don’t know I strive to fill those gaps by ensuring my own education – I don’t let an employer dictate what I should be learning. I am pro-active and go out there and ensure I’m educated. Of course, if my employer wants to put me on a specific training course I’ll accept it.

Training Developers 10/Nov/2008.

 

Eventually, one day, I will finally be “at the top of my game”.