Git: Setup Beyond Compare as Difftool and Mergetool

Change config file

Depending on your Git setup (mines Git for Windows). You’ll need to locate your .gitconfig file (mine’s %userpath%/.gitconfig and make the necessary changes below.

Note that the “prompt = false” stops the Y/N prompt for each difftool file compare in the set. Can also be added as git config –global –add difftool.prompt false


[diff]
tool = bc3
[difftool "bc3"]
path = c:/Program Files (x86)/Beyond Compare 4/bcomp.exe
[merge]
tool = bc3
[mergetool "bc3"]
path = c:/Program Files (x86)/Beyond Compare 4/bcomp.exe
trustExitCode = false
[difftool]
prompt = false

Git, Docker and CR/LF world of pain.

Docker

As part of a project myself and a colleague were about to commence work on he’d created a docker image of a lightweight Linux image serving SFTP endpoints to replicate the Dev eco system. It was working like a dream. We were setting up and tearing down the containers happily until we checked out the docker files on my machine and that’s where the fun started…..

Git Checkout Pain

So, I checkout my colleagues cool Docker work and hit the docker-compose up –build. It runs through quite happily then craps out right at the end beefing about the following:


standard_init_linux.go:175: exec user process caused "no such file or directory"

Mixed Messages online

Eh? Ok so I’m guessing there’s a host folder location that isn’t right here? After a fair bit of Docker folder and file checking I rerun Docker build and the same issue. I admit defeat and head for Google. Google brings back a rather mixed bag of results from StackOverflow and elsewhere. But the narrative is starting to make sense. Essentially Git checkout is introducing Windows carriage returns to our Dockerfile which in turn is freaking our Docker build. I remember that when you install Git there’s a number of options around handling carriage returns etc. So……





Git re-install? Nope!

I reinstall Git and notice the following…



Ok so it looks like I need the middle option right? Git installs and I go for broke again clearing down the source code and starting with a fresh git clone. I run docker and still no dice!! Wah!!!

One last shot

I throw open Git bash and issue the following:


git config --global core.autocrlf input


Success! I run Docker in and we’re away.

Moq – Mocking a cast on an interface

moq logo

Mocking a Cast on a Mocked Interface

The Setup

var mockedInterface = new Mock<IInterface>();
mockedInterface.As().Setup(i => i.MethodOnTheInterface());

Easy as that!

Been working with Moq a fair bit recently. Some other Moq tips and tricks here.

British Sea Power – Hebden Bridge Trades Club – 28th July 2017

A wet July day

Off the train at Hebden Bridge at around 7 to be met by a torrent of rain. Dashing down the high street and into the new (?) Vocation pub where we meet up with the usual crew for a rather splendid pre-gig ale.

Making our way to the venue across the road the rain has let up a bit but it’s still a warm July evening. Inside the Trades Club it’s humid and sweaty (perfect for a BSP gig, unless you’re wearing a latex Unicorn mask of course when I guess things could be a little more uncomfortable/smelly <-- you know who you are!).





BSP enter the stage and we’re treated to another wonderful gig. Even the severe tooth pain (which requires 70 mins of rool canal the following week) doesn’t get in the way. Although because of this (honest) I take on more alcohol than usual to try and numb the pain and make a right old mess of trying to acquire the set list!





Angular 2 404 Not Found http.get

404 Not Found on http.get request



I was playing around with Angular and rather than calling a fully blown API endpoint I was using a sample JSON file within an API folder in my solution.

Despite pointing the http.get at the correct location and lots of shouting “Look the sodding file is there!!” the client side rendering was having none of it. Turns out as I’m using the Angular Cli I needed to specify my file as an Asset in the angular-cli.json file:


"assets" : [
""
]