I’m Eric Tummers, Technical Consultant at Valid, and this is how I work

hulk_behind_me
I’m hired as a Software Architect to build a solution with Microsoft products. Our team works by the scrum guide and is moving towards continuous deployment. We are learning and growing while delivering business value. This is hard work. Every sprint we complete means the retrospective is done in the pub.

I expect the best and I give the best. Here’s the beer. Here’s the entertainment. Now have fun. That’s an order!
Rasczak

Location: Sittard, NL
Current Gig: Technical Consultant, Valid
Word that best describes how you work: Teamwork
Current mobile device: iPhone se
Current computer: MacBook 15 inch

What apps/software/tools can’t you live without? Why?

Wunderlist: work tasks, chores, groceries, planning, every task is there.
Evernote: I’m a fan for years now. Not to happy about the recent update but time will improve this.
iSmoothrun: when I’m not working, I’m running, this app tracks just about every metric I can think of and shares it to all the platforms (runkeeper for one)
Parallels 11: Running Windows on my MacBook is a must. And of course visual studio, team foundation server, build, release manager, sql server management studio, remote desktop, powershell, and some other tools I need for work.

What’s your workspace setup like?

Work at the office is on a thin client with 21 inch screen and (wired) mouse and keyboard. The desk and chair comply with all regulations. We have a great coffee machine.

dekstop_2017

My home workspace has moved to the kitchen table with my Macbook 15 inch. No externals and enough battery for the whole day. Freedom!

What’s your best time-saving shortcut/life hack?

Timebox. Start on a task and spent the time you’ve got to get the best result. Get someone to look at it, get feedback. Then decide if the result is final or to spent some more time.

Besides your phone and computer, what gadget can’t you live without and why?

I’ve been running with my Magellan Echo for some time. It is a sports watch that hooks up to my phone by bluetooth to start / stop my runs, control the music and see the metrics right on my wrist. It is powered by a battery that lasts 6 months and is easy to replace.
My Apple TV2 (jailbroken) hooked up to my NAS for movies and series. Also hooked to my stereo for music streaming. Awesome device!

What everyday thing are you better at than everyone else? What’s your secret?

Learning new things. My current project lets me implement new things (joy) Also I try to learn the things I know to my team or anyone who listens.
I have a basic understanding of how things work and try to map new things on there. For the details I have a Pluralsight subscription and black belt google skills.

What do you listen to while you work?

My alarm clock plays classical music to wake me up in the morning. The car stereo plays about everything (grunge, rock, kids stories) driving to work. When I need some focus I play drum and bass on my headphones. My ringtone is still Run riot by Camo & Krooked.

What are you currently reading?

Tools of Titans by Tim Ferriss. A Christmas gift. Best described as a book of “How I Work” posts full with tips and tricks of the titans (experts)

tools-of-titans

How do you recharge? What do you do when you want to forget about work?

Spending quality time with my wife and daughters. Phone on silent, no screens, no work. Mostly piggyback riding and thee parties
Also sports like running, fitness, climbing and snowboarding to keep me fit and healthy.

Fill in the blank: I’d love to see _________ answer these same questions.

Iris Classon, because she had to start from zero with her career shift and is now a Microsoft MVP (Most Valuable Professional).

What’s the best advice you’ve ever received?

someecards.com - Make a shit first draft you cannot edit a blank page
I believe this is a variant on a Hemingway quote.

Is there anything else you’d like to add that might be interesting to readers?

Learn Powershell. There is so much possible with Powershell. If you can learn one thing this year pick Powershell. 

Original idea from Lifehacker.com.

Posted in Uncategorized | Tagged , , , , , | Leave a comment

Microsoft Fakes misbehave on buildserver

We use Microsoft Fakes to isolate some legacy code. Today I added some tests that passed on my machine, but failed on the buildserver. 😦

After reading this stackoverflow post I added the

using(ShimsContext.Create()) {
   var fakeObject = new some.namespace.Fakes.LegacyObject();
   fakeObject.BehaveAsDefaultValue();
   // ... rest of test
}

and the builds became green again 😉

Posted in Development | Tagged , | Leave a comment

Regression test with Pester

My current project is a scrum project. We develop new features in sprints and deliver working software every 3 weeks. To keep the pace steady we have loads of tests that run every night after a build is deployed.

Until recent we used ‘dumb’ powershell scripts to run tests and use the write-error to report failure. This made us aware of errors every morning so we could fix it as soon as possible. Problem was that the first error stoped the complete script and the logging was loads of plain text. Finding the error message was hard, finding the failing test was even harder.


Last week we introduced Pester as a powershell testframework. The main feature we wanted to use was the reporting of all tests in TFS2017. This would help us pinpoint the error and give a good description of what was wrong. We ended up making the regression test itself more readable in the proces.

Get it

Pester is default part of Windows 10. That is the way we got it. A full installation and update guide is available on the github page. On the build agent we load the module from source control.

Script it

I pair-programmed the Pester scripts with a tester. We took an existing powershell script and added the Describe on the first line. After that we used the Context keyword, because we needed some setup in the database to be done. Last we replaced the write-error statements with an It block that contained a Should Be. Read the documentation for details. We converted all our scripts within a day.

Sample Pester file

Describe "Loading data" {
   Context "Cleaning tables and load file" {
      # truncate tables
      # load file
      It "City table is filled with data" {
         # get record count from table
         $result | Should BeGreaterThan 0
      }
      It "Product table is filled with data" {
         # get record count from table
         $result | Should BeGreaterThan 0
      }
   }
}

Run it

Our nightly build loads the Pester module and than starts the tests with Invoke-Pester. We supply the name of the overall testscript that specifies the parameters for every test/script. With OutputFile and OutputFormat we save the test results to an xml file.

Invoke-Pester ./regression.ps1 `
   -OutputFile pester.xml `
   -OutputFormat NUnitxml `
   -Quiet `
   -EnableExit

TFS2017 has a publish test results task that can handle the xml file from Pester.


image from https://msdnshared.blob.core.windows.net/media/2016/03/TestsSummary.jpg

References

Get started with Pester (PowerShell unit testing framework)

Posted in Tooling | Tagged , , | Leave a comment

Microsoft TechDays 2017

techdays2017
After a year of absence I’ve been to TechDays 2017. The keynote was amusing and the schedule of sessions looked promising. Happy developers all around.

Below a list of take-away bullets from the sessions I attended.

Azure

  • Azure Service Fabric is coming to the Azure Stack somewhere in 2018
  • Azure Container Service has a Visual Studio template, installs the software on build into the (linux) container that you can host later
  • Microsoft contributes to opensource projects like Octopus Deploy and Jenkins to connect them to Azure
  • Devtest labs is still a bunch of ARM and Artifacts (think chocolaty script) combined in Formula’s (think docker compose file) but might get a nice GUI in the future

Coding

  • VS2017 has build in code style rules that can be promoted to team wide and build by using the .editorconfig
  • C# 7.0 adds a lot of performance enhancements
  • Microsoft is trying to make development easier with VS2017 and C# 7.0

Miscellaneous

  • Devops in Microsoft means one team is responsible to get a feature running in production and the feature has to collect analytics that proofs it is used
  • Specification by example is much more than using specflow for your tests, it is the one source of truth for your solution
  • Microservices should have no dependencies for easier Continuous Delivery
  • You can download, compile, run and PR the dotnet code from https://github.com/dotnet

Conclusion

Microsoft keeps moving forward with Azure and makes sure everybody can get his/her software over there. Those with the need of on-premise solutions can use the Azure Stack or TFS installations to get the same experience on their own hardware.

DEVS get the tools they need to be productive with VS2017 and C# 7.0. And OPS keep control over the environments with DevTest Labs.

Looks like the Microsoft platform is still the right choice.

 

SaveSave

Posted in Conference | Tagged , , , , , , , , , | Leave a comment

SDN event October 2017

The SDN – Software Development Network – is a special interest group for dutch developers. Four times a year they organise an event where people present and talk about their passion.

As a member of the SDN you are aware of the latest developments. You are part of a network of professional developers who assist each other in word and deed. This means there is a technical helpdesk at your fingertips so you can book considerable time savings in solving problems.
sdn.nl with Google translate

Here are the talks I attended.

Busy Architect’s Guide to DevOps

Ted Neward talks about the beginning of computing and how the DEV and OPS were divided. The difference between the two is the OPS wants to have a stable environment (no change at all) and the DEV wants all new things (change everything). With DEVOPS the two are combined again.

ID-100248850
Image courtesy of ratch0013 / FreeDigitalPhotos.net

DEVOPS is:

  • an effort (and never done),
  • a culture (not only tools) and
  • a proces (multiple steps)

The talk has been recorded on youtube, see it here.

Agile is tasty. Eat your own dogfood

As an Agile coach Arthur Margonari is asked to introduce Agile in his own company. The backoffice should work more transparent (scrum board), more informed (daily standup), more delivering (sprints), more adapting (retrospective).

In the end the conclusion was that agile can be used whenever people have to work together, not only for software projects.

Image courtesy of ratch0013 / FreeDigitalPhotos.net
Image courtesy of ratch0013 / FreeDigitalPhotos.net

Busy Developer’s Guide to NodeJS

The main purpose of this talk was to get us “dangerous”. Know there is this runtime called node.js that runs on about every platform, try packages, try coding and maybe break things.

With some code samples Ted Neward showed the pitfalls of using the double equal (==) instead of the triple equal (===). The latter does not typecast. Use the triple equal!

Image courtesy of ratch0013 / FreeDigitalPhotos.net
Image courtesy of ratch0013 / FreeDigitalPhotos.net

Conclusion

Again an interesting meetup. This time less hardcore coding and tools for me. I liked the non/low-tech subjects in the schedule.

Posted in Conference | Tagged , , , , | Leave a comment

Tweet your Strava runs with distance in Kilometers

These tweets show the result of fixing the Strava IFTTT service with a webhook. The hook calculates the meters to Kilometers distance. All you’ll need is an IFTTT and Azure account.

tweet_distance_in_km
TLDR
Setup webhooks in IFTTT and tweet on the Strava event. Use Azure Function to do the conversion to Kilometers (divide by 1000) and push result to IFTTT webhook. Link the Azure Function to the strava service on IFTTT.

Setting up webhooks

Login to IFTTT.com and goto services. You get there by clicking on the my applets button and then selecting the services tab – or – by clicking on your username in the top right and clicking on services in the dropdown menu. On the services tab click the “all services” link and search for the webhooks service.

When this is the first time you use the webhooks it must be activated first. Click on the connect button in the header under the description.

webhooks_01
This generates your unique webhook for receiving and sending requests. Once you’ve clicked the connect the button disappears and the settings icon appears in the top right. Click on the settings to view your webhook help url and status.

webhooks_02
We’re now ready to setup the first Applet.

Webhook to Twitter Applet

Browse to the help url that is specified in the Account Info. The documentation page shows you how to use the webhook service. We must specify the { Event } we’re going to use. You can have multiple events / webhooks that do different things, just by specifying a different event name. Be aware that the event is Case Sensitive (!) so “Strava” and “strava” are different events. We’ll be using “Strava” for the event.

Create a new Applet and choose WebHook as the THIS. Set the event to “Strava”, making sure the casing is correct.

tweet_01

Click Create trigger.

Use Post to Twitter for the THAT. Configure the tweet to use the generic Value1, Value2 and Value3 from the webhook. We will set these in our webservice to the Type, ElapsedTime and DistanceInKm (=DistanceInMeters/1000) ingredients, more about that later. The tweet will look like this:
“Just finished a {{Value1}} on Strava for {{Value2}} going {{Value3}} KM.”

We’re 50% done, now for the webservice and the applet from strava to the webservice.

Create Azure Function

Azure functions provide the serverless solution for a webservice or webapi as they like to call it. All we need to do is setup a new Azure Function via the portal and provide the code. The code provided is based on C# with ASP.NET WebApi so you could run this on your own setup, but Azure Functions work great and are very fast to setup.

using System.Net;
using System.Net.Http;
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log) {
    // Get request body
    dynamic data = await req.Content.ReadAsAsync<object>();
    if (data != null && data?.distanceMeters != null){
        log.Info("distanceMeters = " + data.distanceMeters);
        log.Info("elapsedTime = " + data.elapsedTime);
        // calculation
        double distanceInMeters = data.distanceMeters;
        double distanceInKm = Math.Round(distanceInMeters / 1000, 2);
        // return result to ifttt
        var client = new HttpClient();
        var response = await client.PostAsJsonAsync(
            "https://maker.ifttt.com/trigger/Strava/with/key/SECRET_KEY_HERE",
            new {
                value1 = "run",
                value2 = data.elapsedTime,
                value3 = distanceInKm
            });
        // some result back to caller
        string msg = string.Format("Distance in {0}m = {1}km", distanceInMeters, distanceInKm);
        return req.CreateResponse(HttpStatusCode.OK, msg);
    } else {
       return req.CreateResponse(HttpStatusCode.BadRequest, "Provide distanceMeters in content");
    }
}

The webapi / code expects elapsedTime and distanceInMeters in the post data (more about that in the Applet below) The distanceInMeters is devided by 1000 making it Kilometers. Then the webhook in the previous section is called with the value1, value2 and value3 properties set. That should trigger the post to twitter with the calculated value. Things are falling into place now.

Before closing the portal make sure you’ve started the function and that you’ve copied the function url: click </> Get function URL, select default (Function key), and then click Copy.

Strava to webhook Applet

Create a new Applet and choose Strava as THIS. I only run so only when a Run Activity is added the Applet wil run. Click create trigger.

The THAT part will be a webhook. Here we’ll post to our Azure Function. Use the function URL you’ve copied from the azure portal (or the url on your own hosting platform) and set the method to POST. Select “application/json” for the Content Type and set the Body to:

{ "elapsedTime":"{{ElapsedTime}}", "distanceMeters":{{DistanceMeters}} }

strava_01

Now you’re setup is done.

Next

Go for a run and post it to Strava. This should trigger the Strava to webhook Applet to send the data to your Azure Function. The Azure Function calculates the Kilometers from the distanceInMeters and calls the Strava event Webhook on IFTTT. On receiving the Strava event the run is posted to twitter with the distanceInKilometers.

References

Create your first azure function
… sharing of applets no longer available … links below won’t work anymore
https://ifttt.com/applets/60251344d-if-new-activity-by-you-then-make-a-web-request
https://ifttt.com/applets/60251482d-if-maker-event-strava-then-post-a-tweet-to-erictummers

Posted in Tooling | Tagged , , , , | Leave a comment

TFS Build light with jQuery

We use TFS for our builds. These include release builds, continuous integration builds and regression test build. We want to have a simple build light to keep an eye on the status of all definitions. This is why we use the REST APIs and a simple jquery enabled html page to show the status: Green (all is fine) – Blue (build in progress) – Red (drop everything we need to fix this)

The code below is all there is. We host this on our development webserver.

<html>
  <head>
    <!— https://stackoverflow.com/a/35439531 —>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- Javascript libraries -->
    <script src=“https://code.jquery.com/jquery-2.2.4.min.js"></script>
  </head>

  <body>
    <script type="text/javascript">
      /* Put the scripts here */
    </script>
  </body>
</html>
 /* Get the build status for the last build of the definition */
 function GetBuildStatus(id) {
  $.ajax({
    type: 'GET',
    url: 'http://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/Fabrikam-Fiber-Git/_apis/build/builds/?definitions='+id+'&$top=1&api-version=2.0',
    headers: { 'Authorization': 'Basic YOUR_BASE64_ENCRYPTED_TOKEN'},
    success: function (status) {
      if (status.value[0].result == 'succeeded') {
        console.log('green - ' + status.value[0].result + ' - ' + status.value[0].buildNumber);
      }
      else if (status.value[0].status == 'inProgress') {
        console.log('blue - ' + status.value[0].status + ' - ' + status.value[0].buildNumber);
        $(document).data('status', status.value[0].status);
      }
      else {
        console.log('red - ' + status.value[0].result + ' - ' + status.value[0].buildNumber);
        $(document).data('status', status.value[0].result);
      }
     },
    error: function (response, status, error) {
      console.log(error);
      status = 'error';
    }
   });
}

/* Get the build status for definition 199,200,201 */
function GetBuildSatussen() {
  $(document).data('status','succeeded');
  GetBuildStatus(199);
  GetBuildStatus(200);
  GetBuildStatus(201);
}

/* Change the body color based on the status */
function CheckBuildStatussen() {
  var status = $(document).data('status');
  if (status == 'succeeded')
$('body').css('background-color', 'green !important');
  else if (status == 'inProgress')
$('body').css('background-color', 'blue !important');
  else
$('body').css('background-color', 'red !important');
}

$(document).ready(function () {
  GetBuildSatussen();
  /* Get the build status every minute */
  setInterval(GetBuildSatussen, 60000);
  /* Set the body color every 2 seconds */
  setInterval(CheckBuildStatussen, 2000);
  console.log('ready');
});

Replace the fabrikam url with your TFS and the basic header with your base64 encoded token. You can get the build definition id’s from /_apis/build/builds?api-version=2.0. See references for details.

When the HTML document is loaded the buildstatus is fetched for initial color of the page. On interval of one minute the buildstatus is fetched and on interval of 2 seconds the body color is set to the corresponding statuscolor.

References

Posted in Development, Tooling | Tagged , , , , | Leave a comment

Cordova, AngularJs, WebApi and CORS

We have a simple website with some data stored in Azure Table Storage. From a Cordova app we request the data from the webapi we have added to the website. This works great when running on the device, but not when testing locally: Cross-Origin Resource Sharing (CORS) won’t let us.

Google sugested creating a proxy and setting it during build. But we went a different route. The webapi was ours, we should simply allow CORS. This is done with a nuget package: Microsoft.AspNet.WebApi.Cors and some configuration.

using System.Web.Http.Cors;
public static class WebApiConfig {
   public static void Register(HttpConfiguration config) {
      // Web API configuration and services
      var cors = new EnableCorsAttribute("*", "*", "*");
      config.EnableCors(cors);
      // .. more config ...
   }
}
Posted in Development | Tagged , | 1 Comment