Development

Setting directory permissions with Octopus Deploy

If you follow me on Twitter, you’d probably be sure of one thing by now: I love Octopus Deploy! I have been quite vocal about lately, as it’s made my life so much easier and every time I use it to deploy a site I have a little giddy moment of happiness.

I actively support around 20 ASP.NET apps, along with a heap that I wouldn’t call “active” and a small number of good ol’ WordPress sites. So my practice up recently of using FTP to deploy changes manually to these sites (including to a staging site and then to production) has always been painful and fraught with danger.

Read More
Development

Mocking users in ASP.NET MVC 5

So historically unit testing has been a constant non-starter for me. It seems every time I start to write unit tests (whether it’s in an attempt to do some TDD, or just trying produce unit tests for an existing piece of code), I struggle to get over the hump of dependencies that I’ve incidentally placed in my way without even thinking.

Things as simple as getting the current user’s ID using User.Identity.GetUserId() seem harmless, until you realise that in your test the User object will be null.

When dealing with dependencies in the code that you are testing, a common method is to replace these dependencies with a mock. For example, say you have a service which calls off to an external API to get some data; in your test code, you could mock (aka “fake”) that service to just return some fake data rather than calling to the external API.

Read More
Development

Moving Entity Framework migrations to another project

This happens to me quite often, because of the way I tend to work with new projects: I’ve created a new web application, got it up and running and set up my initial code first migration, start working on the model (maybe another few migrations for new tables etc) and then realise that I want to move the database to a separate “data layer” project AFTER I’ve already started running the migrations.

So I move my Entity Framework DB context, my model POCOs and my Migrations folder out to the new project, and update all the namespaces to be right (e.g. “SiteName.Data” rather than “SiteName.Web”).

Read More
Development

Setting up SendGrid 7.0.0 in ASP.NET

Screenshot 2016-06-29 13.51.30

Today I was starting up a new ASP.NET Web Application using the ASP.NET Identity membership system, for a micro site I’m building, and my first task was to get the email confirmation working for accounts (and subsequently to prevent logging in until email has been confirmed). I decided to try out SendGrid rather than using my own SMTP server, mostly because, well, Microsoft told me I should ­čśë

Read More
Development

Getting Ghost Running on Bash on Windows

Screenshot 2016-06-19 18.00.30

Well I won’t say that was the easiest process, but I’ve just got an installation of the Ghost blogging platform running on my Bash on Windows system.

I’m never sure if it’s just me or if others experience the same thing, but installations like this just never seem to work as documented for me! All sorts of random errors popped up, I spent 3/4 of my time in Google, some issues I was able to resolve and some I’m not even sure now if I fixed them or if I just “worked around” them so that they will come to bite me in the future!

Read More
Life Away From Work

Culture Club – “The Dream” Come True

CultureClub_RodLaverArena_100616_6Y9A0213-1

I’m not a music reviewer by a long shot, but I really wanted to put emotions and experiences to words after last night’s concert… Last night, June 10 2016, I fulfilled one of my childhood dreams, seeing Boy George and Culture Club live in concert.

Growing up in the 80’s, I had two major musical obsessions (for want of a better word) – Michael Jackson and Boy George. In 1984 I remember watching the Culture Club live from Sydney, which was simulcast on the radio and we recorded it onto a tape which I then played for years. I was 5 when it was on and I was spellbound! I still have memories of the different outfits he wore, which songs he sang in which outfits, and even the place where I had to flip the cassette tape over in my recording. I wish I still had that tape!

Read More
Hosting & Domains

Setting Up a Wildcard Certificate for Multiple Sites in IIS 7

Screenshot 2016-06-02 10.37.38

You may have come across this before, I know I have…. you have a server running IIS 7 (for example on Windows 2008 R2, which is what my server is), and you want to add multiple sites with certificates without using a unique IP address for each one.

In later versions of IIS such as version 8, you can use Server Name Indication (SNI) right there in the GUI to set the host name to use when someone connects using https. This allows the server to use the same IP address and port (typically 443) for multiple certificates.

Read More
Development

Getting going with Bash on Windows

Screenshot 2016-05-22 11.21.15-step1

Patiently I waited, and you know what they say “good things come to those who wait”. When I first heard about the release of Bash on Windows (which is run via the Windows Subsystem for Linux, here is a great overview), I was so excited that you’d think I had nothing else going for me in my life (for the record, I do… I’m just easily excited by shiny things).

Like many, I began my programming years on UNIX, and spent over 10 years primarily working in a command line even while living out the “experience” that was Visual C++ with MFC (I originally said “horror” but ok it wasn’t all that bad – it’s just that the .NET Framework with Visual C# solved so many of the pain points from it that looking back now it seems like it may have been hell!). Anyway, my point is that I used to live in the command line, I love the power of it, love the scripting languages, and let’s be honest, using the command line makes us feel smarter! Come on, it’s true. I’ve tried to recreate the experience since moving to pretty much full-time Windows-based web development using tools like Cygwin, the Git Bash, and a lovely selection of “UNIX-commands for DOS” that I’ve been carting around for years (which seem to have stopped working in Windows 10, anyway), but it’s not the same.

Read More
Development

Structured Logging with Serilog in ASP.NET Core

Serilog in Seq

I recently discovered the beautify of┬áSerilog for logging from my ASP.NET (pre core) web apps, and converted one of my projects across completely to using it (rather than a haphazard, custom file logger that was written by myself years┬áago). ┬áSerilog is a powerful logging library that allows you to do┬ástructured logging, allowing you to basically have fields against any log messages (aka log events) containing serialised data – strings, integers, objects, etc.

It’s the objects part that’s really cool – say you are logging an order being placed, you can log the full Order object, and allow easy searching later on by a field such as the OrderId within that object.

Read More
Development Reviews & Tech News

My Brief Affair With Microsoft Edge

Edge

Since the dawn of the internet, we have fought over which browser is “better”. I personally have gone from Internet Explorer, to Firefox (a long stopover for a few years), to Chrome for the last couple of years. Like with fashion, though, it seems I’m always a step behind – every time I mention these days that I use Chrome, I prepare myself for an onslaught of “oh that’s so last year”, “you mean the memory hog?”, and “why haven’t you switched to <insert browser name here> yet?”!

Read More
1 2 3