Category: Development
-
Search for a branch with git
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
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…
-
Mocking calls to ApplicationContext.Current.Services
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…
-
Launching cohoda.com – the commercial website to our Camberley based web design and software development consultancy
Today I launched our commercial website – https://www.cohoda.com 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…
-
TempData not cleared between requests when using ContainsKey
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:…
-
Entity Framework migrations – names are case sensitive
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…
-
Could not load file or assemebly ‘ceTe.DynamicPDF.Rasterizer.40.x86.dll’
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)…
-
Dynamic routes with ASP.net MVC – Category/Location mapping to controller
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: http://www.mysite.com/restaurants/Camberley—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)…
-
Google Only authentication with ASP.net Identity
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…
-
Stubbing middleware when testing an Express with Supertest
When testing a simple express app / api I like to use supertest. This can feel like integration testing, and to an extent it is. But we can stub things out with sinon, and tidy up our tests. Let’s look at an example. Suppose we have a simple API with the following router: var express…
-
Transparent proxy from node.js app to WordPress for /blog route
For a recent car wash directory start up I have created, I wanted a blog. GetCarClean uses node.js; While there are node blogging platforms, what I really wanted to do, was proxy /blog of my main site, to a WordPress site (actually hosted on a subdomain – blog.<domain>.com) What I did, was to set up…
-
Working with branch deployments with TFS and Octopus
Decide on a branching strategy, and branch the code. This assumes you already have a TFS build set up on your “main” branch Once the branch is complete, it should be something like: $/projectname/Dev Branched to: $/projectname/BranchName Then, clone the TFS build definition you currently use for Dev (or whatever your main branch is) I…
-
Cloning TFS build definition for branches
As part of my effort to allow us to use branches with Octopus deployment, I needed to be able to duplicate our TFS build definitions. I would then create a branch-specific build definition, called something like MyProject – Branch123 I wanted to set things like a custom drop folder for the branch, and, since we’re…
-
Introducing GetCarClean.com – A car wash directory
Just a quick blog post, introducing GetCarClean – my latest startup venture, which aims to be the best car wash directory around. A while back, I wanted to get my car cleaned, but wasn’t sure where the nearest one was. So, I took to google; Car wash near me Thought this would return either some near…
-
Visual Studio 2013 Remote Debugging – No Symbols Loaded
When trying to use the Remote Debugger with Visual Studio 2013 – connecting to a server on the same network, I was getting ‘No symbols loaded’ I set the Remote Debugger to run with the /FallbackLoadRemoteManagedPdbs switch: After doing this, the symbols were loaded, and I could step through the code in Visual Studio on…
-
.net project unit test naming
Just wanted to do a quick post on unit test method naming, in particular with .net projects; Most test suites I come across are title cased: public void LikeThis() This annoys me. I find long method names hard to read, and easy to miss detail Example: public void DoesNotReImplementAdditionalInterfaceAlreadyImplementedByInterceptedClass() is not a readable as: public…
-
Create a Google Application for authenticating against with ASP.net Identity
Go to http://console.developers.google.com and log in with your Google account Click on Create Project Give your new project a name Important You will need to enable Google+ API More information on why, can be found here: http://blogs.msdn.com/b/webdev/archive/2014/07/02/changes-to-google-oauth-2-0-and-updates-in-google-middleware-for-3-0-0-rc-release.aspx Next, we’ll need to create our Client ID Configure your Consent screen:…
-
Review of ngageit (ngage_it) – David Burley, Malaysia
Elance Username is ngage_it Actual name is David Burley. Works out of Malaysia. Worst freelancer I’ve ever worked with. DO NOT HIRE THIS CON ARTIST. Full review coming soon.
-
Github name squatting policy bullshit
I’ve been a loyal customer of GitHub since 2010 A couple of years ago, I started Cohoda – a software consulting company. Shortly after forming the company, I tried to register the github username – ‘cohoda’ It was taken (which I thought odd, since ‘Cohoda’ was a made up word!) After some investigation, I could…
-
Access host machine from Windows Parallels guest VM
I use Parallels to virtualise my Windows development environment, for use on my MacBook Air I created a fresh Windows VM, and wanted to keep it a little more lean than my previous version. One of the things I wanted to do, is use the MongoDB installation on my host (mac) machine, within windows. This…
-
Resharper ASP.net MVC “Cannot resolve view” functionality missing in Visual Studio 2013
I installed Resharper (v 8.2.2) onto my fresh install of Visual Studio 2013, but noticed that the usual helpers I get over ASP.net MVC methods wasn’t there. For example, if I had a method like: public class MyTestController : Controller { public ActionResult Something() { return View(); } } … and the view (/Views/MyTest/Something.cshtml) didn’t…
-
Introducing mongoose-status-manager – status updates for mongoose models
For a project I’m currently working on, I needed to be able to update the status of a document. For example, let’s assume it’s an Order. I need to create it, then set it’s status to ‘Pending’ When the Payment is completed, I need to set it to ‘Paid’ Then, as the order progresses, I…
-
Turned down for a contract role by a by a ghostly tech lead
I had a telephone interview earlier this week. From my point of view, I thought it went really well. I had ample experience, answered his questions (in my opinion) correctly Somewhat to my surprise, I was turned down after this interview. Naturally, I pressed the agency for feedback. Feedback from the recruiter was vague as…
-
Managing multiple MongoDB C# class maps – Part 1
I’ve used MongoDB with several net projects over the last few years, and one thing that has in the past frustrated me is the way BsonMapping is set up. This once per app setup can get pretty long, complex and hard to follow. As per the documentation this, on the face of it, it’s fairly easy:…
-
One of the many benefits of keeping a git repository inside dropbox
A couple of weeks ago, for a number of reasons, I had polluted my working copy so much, i decided it would be easier to simply blow my cloned repository folder away, and re-clone. So, I deleted the folder, and made a fresh checkout to the same place. Today, I was about to resume work…