Blog

Quickly add GSuite (Google Apps) MX Records to CloudFlare DNS

Q

As some people know, I run a web development agency called Cohoda LTD. As part of our service, like most development agencies, we offer web hosting. To keep things as lean as possible, we deliberately don’t try to host email servers ourselves, instead we set up clients with email on Google GSuite (or Office 365 if the client prefers) I always (where possible) use CloudFlare for DNS, and found...

South Western Railway rip off customers by charging premium for First Class tube travel

S

I travel from Farnborugh main to Waterloo reasonably regularly, and it works out cheaper for me to buy monthly season tickets, with a Travel Card (allowing travel on the underground and busses) I was recently looking at how much extra a First Class season ticket would be than Standard Class. Turns out, South Western Railway are charging a premium – for the Travel Card portion of the First...

Phishing with internationalised domains

P

While on a train this morning, one of my close friends sent me this WhatsApp message: The person who sent it to me is not usually someone to send out scams or spam, but, to me at least, this message, did not look legit. It smelled strongly of a phishing scam. However, it was a link to adidas.com/shoes – so how was this going to phish me? Of course they are not giving away 3000 free pairs of...

Search git branch names using command line

S

Looking for a particular branch, and `git branch -a` returns a LOT of branches? If on Windows, you could use the Search feature in cmder (you’re using cmder, right?) Or on mac, cmd+f and then search the outputted text… OR you could use one of these two approaches: 1) git branch takes a `–list` argument , which in turn takes a search arg. Example: git branch -a --list *something*...

Adding additional colour themes to Jetbrains Rider

A

color-themes.com according to it’s description, offers “Color themes for IntelliJ IDEA, Webstorm, PyCharm, RubyMine, PhpStorm and AppCode” However, it turns out that these themes also work with Rider. After downloading it (it’s a .jar file) go to File > Import Settings Choose the downloaded .jar file, and it will import the colour theme. Once Rider restarts, the theme will be available...

Azure function not receiving json messages using Topic Service Bus Trigger

A

While developing an Azure Function application, using this tutorial, I encountered a problem. Ultimately, using `func new` generated my function (the run.csx file) which looked like this: public static void Run(string mySbMsg, TraceWriter log) { log.Info($"C# ServiceBus topic trigger function processed message: {mySbMsg}"); } Side note: the `mySbMsg` is important – it’s defined in the...

Asserting multiple properties of argument with FakeItEasy

A

More often than not, I want to assert that my dependency has been called with a parameter that matches more than one condition. Let’s say we have a method that calls ICustomerService.Add method. We want to assert the Add method was called with a Customer that matches a few conditions. The way we’d typically achieve this is by doing something like this: var fake = A.Fake<ICustomerService>();...

Physical 419 Letter Received

P

Last night I opened an innocuous looking letter delivered to my home address. It had a ‘commercial’ postage stamp on it (not one that you’d pick up in the post office) and it wasn’t addressed to anybody on the envelope. The content of the letter was what I’d expect to get via email – a 419 scam! It was, however, addressed to the previous occupier of the house...

Microsoft SQL Server on a Ubuntu Linux VM

M

As part of a blog post on the LEDS stack (Linux Nginx Dotnet, SQL Server) I’m putting together, I wanted to see how easy it is to install SQL Server on a Ubuntu VM, running on Digital Ocean. Turns out, very easy. I went with a Ubuntu  16.04.2 x64 box, with 4GB of RAM The docs state that you need at least 3.25GB of memory to run SQL Server on Linux. Once my droplet had created, I SSH’d into it...

Using different themes across Visual Studio versions

U

I’m currently working on a couple of solutions – one that is Visual Studio 2017 specific, one 2015. Primarily because the 2017 specific one is full of .net standard projects, and the support is better (or at least, built in) I wanted to have 2015 use a different theme – I’m only doing small bits in it, but have them both open at the same time, so figured having one light...

Lack of Godaddy email support prompts me to move

L

I’ve been a customer of GoDaddy for several years. Recently, I’ve required to use their support service. Unusually, they don’t offer email support – just phone, or live-chat On more than one occasion, live-chat has been unavailable, and making a call hasn’t been convenient. Secondly, live-chat only works with a persistent connection. Working on a train, for example, means you’ll often be...

Clearing Chrome Internal DNS cache

C

Visiting a url, but getting the (old dns) version of a page?
I was too.
Turns out that Chrome keeps an internal DNS cache.
You can view it by visiting the following ‘url’ (enter this in your address bar in Chrome)
chrome://net-internals/#dns

Out Of Memory exception when deserializing with JSON.net – Use Streams instead

O

Calling an api and deserializing the returned json into a type is something I have to do quite often. I used to use the following: //assume client is an instance of HttpClient - this part isn't important var response = await client.PostAsync(url, content); //read the response as a string var responseString = await response.Content.ReadAsStringAsync(); //use json.net to deserialize this into a...

Search for a branch with git

S

Got a load of branches?
Need to find a specific one?
Try this

git branch --all | grep <query>

for example
git branch --all | grep notifications

Will return all branches (remote or local) that contain “notifications” in the name of the branch

PleaseDoNotNameYourTestCasesLikeThis

P

I’ve delivered this as a lightening talk a couple of times at companies I’ve consulted at, but thought I’d knock out a suitably short blog post. A lot of test cases I come across are named like this WhenSomethingHappensThenSomethingShouldOccur While the writing of a test in the first place should be applauded, naming them like this is a tad irksome. By their nature, test case...

Mocking calls to ApplicationContext.Current.Services

M

My current contract involves working on a project based on Umbraco. Unit testing Umbraco, can be a bit tricky, especially given the existence of the static ApplicationContext.Current.Services class, which contains handy references to the Umbraco services – provided by a static type! We can’t mock this. So, I created a little wrapper around this that would allow us to mock the returned service...

Launching cohoda.com – the commercial website to our Camberley based web design and software development consultancy

L

Today I launched our commercial website –  Cohoda is a Camberley based web design agency and software consultancy. I’ve been contracting through Cohoda LTD since I made the leap into being self employed in 2012, but have only just got round to creating our own website. It’s a bit sparse at the moment but I’ll add details about other projects we’ve worked on soon...

TempData not cleared between requests when using ContainsKey

T

Recently I was trying to add a simple message to the top of the screen if the user had been logged out. This message, should appear only once. If the user navigates away from the page, it shouldn’t show again. So, it made sense to use TempData In my controller, I had something like this: _authenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie); TempData["LoggedOut"] =...

Entity Framework migrations – names are case sensitive

E

In a rush, I’d called my migration “vendorServiceKEy” Which had resulted in my migration being named 201512102031458_vendorServiceKEy I then ran migrations with update-database. Now, when I renamed the class manually, to sort out my OCD, the next time my application ran, I got There is already an object named xxx in the database My _MigrationHistory table contained the following...

Could not load file or assemebly ‘ceTe.DynamicPDF.Rasterizer.40.x86.dll’

C

I ran into this issue when deploying an application that uses the DynamicPDF Rasterizer. After emailing support, who got back to me within the promised 24 hours, they offered some good suggestions. The solution for me was to use the installer provided on their download page, which in turn installs the pre-requisites (Visual C++ distributable) Secondly, I changed the reference in my project to the...

Dynamic routes with ASP.net MVC – Category/Location mapping to controller

D

I’ve recently been looking in to building a directory type application with Asp.Net MVC One of the requirements would be to have SEO friendly URLs such as: —Surrey /restaurants being the “Category” /Camberley—Surrey being the “Location” So, I created a ‘CategoryController’ like this public class CategoryController : Controller { public ActionResult Index(string category, string location) { //do...

Google Only authentication with ASP.net Identity

G

Recently I was working on a project where by I needed to authenticate out users against their Google apps login. That is to say, the on authentication method would be Google. And only ever Google. If they were signed in to their Google account, they would be signed into our app. Most of the examples I found offered Google as an additional or supplementary authentication mechanism. I wanted it to...

My Invisalign Before / After expected results from clinical check

M

After re-doing my impressions due to my wide arch, the results of my clinical check are in. Here’s the expected before/after Before: After   I’ll have the trays for approximately 7 months (14 trays in total) As expected, will need attachnemtns, or ‘buttons’ on a few of my teeth – unavoidable really given the crookedness of some of them! The red dots on my teeth in the pictures above...