Yet Another Chris

London, UK

Recent Posts


Continuous Integration cloud services

Friday August 26, 2016

I’ve probably missed a couple, but this is a list I’ve compiled of all the CI services I know about, geared towards cheapo devs on a budget. My area of expertise is Teamcity, Octopus, Bamboo, Gitlab and a bit of Jenkins and Travis, and limited to dot net core.

.NET Core and .NET Standard simplified and explained by Scott Hunter

Monday July 18, 2016

With all the changes to .NET that have happened this year, and the constantly evolving .NET core/standard (and the bombshell that project.json is going), it’s quite hard to decipher what Microsoft are doing to the frameworks besides the main marketing features of it running on Linux/MacOS with NPM style packages and ASP.NET getting Kestrel.

Probably the clearest explanation I’ve found is hidden away in this DotNetConf Keynote by Scott Hunter. The first 20 minutes gives the lowdown on the new architecture, or you can read the slides if you don’t have time.

.net today

Note: The usage of Core library in this slide is slightly confusing, Scott is referring to System.Core.dll and for Base Class Library (BCL) this is typically system.dll

And if you really don’t want to read the slides, my summary would be: .net standard is a versioned contract that the implementation has to adhere to (like the CLR and CLS standards). It’ll get more APIs over time, and each implementation will have to honor the contract to keep up. If you want to be re-confused, try reading this doc. Why is everything version 4? Probably because it came straight from the .NET 4.0 code base.

So .NET Core is an implementation of the .NET Standard (.NET Core is version 1.0 right now, .NET Standard is version 1.6). The version numbers really don’t help at all, they would’ve benefited from resetting them all to 1.0 and blown a big raspberry at anyone who was using the betas and RC1 and RC2.

.net core

Also worth checking out is the .NET roadmap up until the start of 2017

Podcast of the week

Sunday May 8, 2016

Not really a podcast, more of a vodcast, the discussion talks about fasting (Ray Cronise had just been on a 30 day water fast), hot/cold therapy and the Vim Hoff method and the concept of being satiated.

Do you write unit tests before code, or after?

Thursday May 5, 2016

One of the biggest omissions in the TDD literature is the concept of code first vs test first. The discussion doesn’t seem to surface very often, possibly because it’s a more advanced topic.

Both are valid ways of doing TDD, and after many years of doing both I think I’ve finally settled on a few good ways to decide which method to employ:

Test first:

  • You’re writing business or safety critical code
  • You are experimenting with an API etc. that you don’t know how to use.
  • You are pairing with someone
  • Like most of us, you find writing tests later very monotonous work
  • You’re doing a presentation on TDD

Code first

  • You’re writing a proof if concept, or small home project
  • You haven’t fleshed out the API you’re writing yet, or unsure of it’s design
  • You’re writing code that is so basic, such as de-serialization of a config file, or breaks the system in such an obvious way, tests can be added later
  • You’re on your own and demotivated

With the code first approach I’m not advocating lowering your test coverage - you would still have the tests in there before you ‘ship’.

Podcast of the week

Saturday April 23, 2016

My podcast recommendation for this week comes from Sam Harris’s discussion with David Chalmers about consciousness.

The 2nd half gets a little bit waffly when discussing the future of AI - coming from current fears that Nick Bostrom’s Superintelligence started last year, but the first half covers conciousness really well.

In particular:

  • What is consciousness? Is it actually anything or just a by-product of all the data our brains receive?
  • Is everything in the universe conscious? If so, are thermostats conscious?
  • Mmmmmm brains: the zombie analogy for consciousness.

https://www.samharris.org/podcast/item/the-light-of-the-mind

Apache - adding a new site in under 2 minutes.

Wednesday March 16, 2016

There’s a great guide on Digital Ocean for setting up new sites in Apache on Linux. Once you’ve done it a few times though it can be shortened to a few bullet points:

  • md /var/www/example.com
  • md /var/www/example.com/public_html
  • nano /var/www/example.com/public_html/index.html

copy/create a conf in /etc/apache2/sites-available, e.g. example.com.conf:

<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        ServerName www.example.com

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/example.com/public_html

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>
  • sudo a2ensite example.com.conf
  • service apache2 restart

Powershell - the good parts

Monday February 15, 2016

I’ve been using Powershell on a daily basis for about 2 years now, mostly with Chocolatey and provisioning servers (the devops movement). Whilst it’s a huge improvement over batch files (anything is) and VBS, it is has foibles.

Infact it has so many foibles I would put it firmly in the languages-with-very-strange-design-decisions category reserved for Javascript and Perl:

  • The “number 1” stinker: the .ps1 and .psm1 file extensions. Did they think Powershell was only going to have one version?
  • The same applies for the profile folder, it lived until recently inside Powershell1. Oh and there’s also 6 different profile locations.
  • $true and $false as constants
  • $HOME vs ~ vs $env:HOME (explaination here)
  • Error handling. Do we try {} catch, -ErrorAction, $ErrorActionPreference, 2>&1, $LastExistCode? I know there is a distinct difference between the four but it doesn’t make it any less nutty.
  • Help docs. If I want help on a cmdlet I have to use get-help invoke-webrequest or the shortcut man wget, not just -help
  • …which leads onto unix shortcuts. They’re not unix shortcuts as they’re different commands with completely different syntaxes. For example wget, curl, ls.
  • Functions. You declare them with brackets, you call them without.

These are more minor quibbles:

  • Inconsistently with semi colons at the end of the lines.
  • Casting is a complete beast.
  • String lookups/replacements are also not nice if you’re not familiar with the .NET framework.
  • No easy way to log output, even with the transcript commands.
  • A separate metadata file for modules - why not just use YAML (frontmatter) at the top or bottom of the file?
  • -eq -neq -gt. But there is actually a design decision behind this that makes sense, based on dash command line argument seperator and having to maintain the > as a pipe.

That sounds like a damning critique but really the only two features that get annoying on a daily basis are the error handling and the help. The shortcomings are in some ways countered by the good parts:

  • Really easy to pickup if you’re from a .NET background.
  • A familar Perl/PHP-like syntax for the variables and comments.
  • You can use the .NET framework fairly easily: C:\>[System.DateTime]::Now (there’s a shortcut: get-date)
  • You can alias commands easily
  • Modules are easy to write.
  • The CLI intellisense in Windows 10 is nice.
  • The language is updated regularly, it’s not left to fester like batch.
  • Chocolately and Boxstarter simplify a large portion of what you do.

If you need to write infrastructure as code for Windows you’re a bit stuck as the alternatives to Powershell aren’t any better, they either lack the libraries Powershell has, or need to be compiled and aren’t familiar to cross-platform sys-ops. So for now I’m happy with Powershell but do enjoy a good British moan at it every so often.

Shorter blog posts

Sunday February 14, 2016

I listen to a lot of podcasts from a small clique of online “life hackers” (a cringey term), most of which I’ve discovered via Joe Rogan.

The majority are nutrition, health and self-improvement related one of which is Tim Ferris. I found Tim’s podcast after reading chunks of his 4 hour books (not via Rogan), and on his latest podcast his guest is the enterpreneur Seth Godson.

To find Seth’s blog, type “seth’s blog” into Google. The podcast is ok but the interesting part is the format of his blog - the concise short posts that all fit on the main page, instead of having exercepts. Most of my blog posts are way longer, packed with useless detail nobody will ever read and a waste of time as I’m not paid per word. Short posts encourage visitors to read the whole thing instead of skim reading for the technical knowledge, as a few paragraphs is not a big time investment.

So in future I’m aiming for a lot less TLDR posts and more < 8 paragraph posts, starting with this one! boom