Creating a composite primary key in Entity Framework 4.1
There are two main ways of achieving this. Let's look at an object - Brochure: { ProductId, Year, Month, ProductName}. We want: ProductId Year Month To make up the primary key. Method 1 - Data...
View ArticleRedirecting legacy pages in asp.net
Picture this situation. An old (legacy) application has landed on your project pile. It is largely built in php, and you intend on re-writing it in asp.net MVC. You will therefore need to somehow...
View ArticleRunning SQL commands with EF Code First
Before ORMs we used to write SQL code. Yes - real, "bare metal" SQL. We used it for our CRUD operations, and to perform other larger data manipulation tasks. The database server should be the quickest...
View ArticleUsing NDepend to clean up code and remove smells
At some point in your development career, you would have had an existing project dumped on you that you will have problems understanding and generally getting around the code. Those difficulties can...
View ArticleUsing a Nexus 4 in x64 Windows Land
I've had a horrible morning. I've been dealing with shitty, unpolished crappy software all damned morning. All because people that are too intelligent aren't stepping back from what they are doing and...
View ArticleIn defence of the RDBMS: Development is not slow. You just need better tooling.
I pride myself on being a real world software developer. Anything that I publish in this blog is a result of a some real world coding. I don't just play around with small, unrealistic demoware...
View ArticleThat CSS / Javascript library isn't as big as you think
I take some pride in going against the current tide of thought in most things. This is especially true when it comes to such a trend based industry, such as software development. We suffer from Hype...
View ArticleNot doing code reviews? NDepend can help you
In a previous post about NDepend, I looked at how it can be used to clean up codebases by easily and quickly isolating blocks of code or classes that violate a set of rules. Helpfully, NDepend ships...
View ArticleUpvotes and Downvotes don't work in big internet discussions
A few years back when I first discovered Reddit, I found it to be a place full of insight and interesting content. As someone that was used to traditional bulletin boards, the idea that most valuable...
View ArticleUsing your own router with BT Infinity
You don't need to use BT's supplied home hub with BT Internet. BT used to supply Infinity customers with two pieces of equipment. A BT Home Hub (router) A VDSL (Very-high-bit-rate digital subscriber...
View ArticleStop Bashing Angular
I appreciate that I'm little late to this discussion. I'm not sure if you may have noticed, but I don't blog as much as some of the other better known developers out there. Why? I'm too busy working...
View ArticleGet all Default Constraints for a table in SQL Server
The below snippet will list all check constraints for a given table in SQL Server: SELECT DC.Name FROM sys.schemas S INNER JOIN Sys.objects O on S.schema_id = O.schema_id INNER JOIN...
View ArticleThe 2015 PC build for Gaming and Programming
Having build my last desktop in 2011 and noticing that some things were starting to run a little slowly, I've gone for a desktop refresh. Here is what I have gone for: CPU: Intel Core i5 i5-4690K This...
View ArticlePerformance Tuning AngularJS Apps
For existing AngularJs apps, there are a few things that you can do in order to try and improve performance. Destroy no longer needed javascript plugin elements This should help prevent your Angular...
View ArticleHosting multiple websites inside an azure app service
This information is up to date as of November 2015. The Azure offer changes a lot, so this information may become quickly out of date. A few years back, Scott Hanselman wrote a blog post on how you...
View ArticleMapping naked domains and www. domains to Azure web apps
Azure web apps can be mapped to multiple domains, as well as naked domains. To do this, you will need access to your domain name's DNS settings. Go Naked A naked domain is the domain without the...
View ArticleAdjusting screen brightness on the Surface Book from the Keyboard
I've purchased a Microsoft Surface Book to replace my Mac Book Pro. I didn't get on very well with the Mac Book Pro for reasons that I will list out in a future blog post, but so far I am very happy...
View ArticleRunning Wordpress behind a reverse SSL proxy
Newer versions of Wordpress really don't need much to get working behind an SSL proxy. I currently have an NGINX webserver running infront of this blog. The job of NGINX here is to handle the SSL...
View ArticleSelf hosted wordpress vs free wordpress
I've maintained this blog since 2008. Since 2008, it had been hosted on wordpress.com, and I was paying around £12 a year for the domain mapping. That allowed me to point my domain (edspencer.me.uk)...
View ArticleReducing the amount of memory used by gitlab
Gitlab is a fantastic tool. Rather than going with a saas solution for source control and for continuous integration, I'd thoroughly recommend hosting your own gitlab instance. Don't be scared!...
View ArticleThe current state of broadband and mobile data in the UK
I've always watched the Broadband and Mobile markets in the UK, largely from a consumer point of view. This has mainly to have been to get the fastest internet access at the lowest price. Market...
View ArticleRunning WordPress in production - Security and Speed
WordPress gets a fair share of bad press. Most of this bad press is centred around security concerns. Many of these concerns are valid, but need not be a concern of yours if you are intending to run...
View ArticleMigrating letsencrypt SSL certificates to another server
If you're seeing this post, you're viewing my website from it's new home. Moving the code and the data needed to run this website was made easy by docker and a Wordpress plugin called UpdraftPlus. For...
View ArticleRunning Node.js in production using all of the cores
Did you know that the JavaScript environment is single threaded? This means that in the Node.js world, the main event loop runs on a single thread. IO operations are pushed out to their own thread,...
View ArticleImproving performance through function caching in JavaScript
I was recently profiling a single page application using Chrome's dev tools looking for areas of slowness. This particular app did lots of work with moment.js as it had some complex custom calendar...
View ArticleLessons learned from a server outage
At just gone midnight this morning when I was nicely tucked up in bed, Uptime Robot sent me an email telling me that this very website, was not reachable. I was fast asleep, and my phone was on do not...
View ArticleAdding React to an existing web application and build pipeline
2019 Edit This article is now out of date and it's unlikely that you'll be able to use any of the techniques in it to add react to an existing app. This is because there are too many moving parts with...
View ArticleHosting personal projects on low cost dedicated servers, not the cloud
For personal projects, the cloud is probably too expensive. I say this as a person that previously hosted all of their personal projects on the Azure cloud platform. I had multiple app engines inside...
View Article2018 in books
2018 is the year that I got back into reading. Here is a list of some of the non fiction books that I have read throughout the year. I've started the list with the tech books, then put the social...
View ArticleKeyboard: Cherry KC 6000 review
I prefer chiclet keyboards. I haven't done any scientific analysis, but I'm confident that my words per minute typing is higher wen I'm using a keyboard that has chiclet keys. Amongst developers this...
View ArticleHow to fix: Xubuntu update manager not showing new distro releases
I'd previously been running Xubuntu 16.04 on my main laptop without any issues, and had been waiting for a while before upgrading to Xubuntu 18.04. Because I was having problems with bluetooth, and...
View ArticleDoes the Surface Keyboard work with Ubuntu? Yes, but only with Ubuntu 18 onwards
The other keyboard that I've recently purchased as well as the Cherry KC 6000 is the Microsoft Surface Keyboard. After reading a few reviews online and watching a few videos, I decided on getting this...
View ArticleSurface Book keyboard review
I've said it before, and I'll say it again - I prefer chiclet keyboards. In my opinion, they are more suited to a long days worth of typing and programming than a mechanical keyboard, or a more...
View ArticleJavascript: Alias a function and call it with the correct scope
Today I needed to call one of two possible functions depending on a condition. The interface into these functions was the same (they accepted the same parameters) and they returned data in the same...
View Articlewebpack 4 - How to have separate build outputs for production and development
A pretty common use case is wanting to have different configs for development and production for front end builds. For example, when running in development mode, I want sourcemaps generated, and I...
View ArticleShould you use WebPack for building SCSS?
In a previous post, I outlined how you could use WebPack to have different build outputs for development and production. If you read that post, it should be clear that bundling and uglifying your...
View ArticleRunning Babel should be the one of the last stages of your front end build
After recently upgrading from Babel 6 to 7.4 for a project, I decided to check over the outputted files to make sure all was well. I started by looking for the basics - was const getting changed to...
View ArticleWhat Babel 7 does and doesn't do
Babel 7 will not transpile any of the following out of the box: Object.assign Native Promises String helper functions such as string.startsWith, or string.includes Map Set If you want to use any of...
View ArticleYou don't need plugin-proposal-object-rest-spread with Babel 7
Babel 7 out of the box will transpile object spread operators for you. Here is an example of it working without the @babel/plugin-proposal-object-rest-spread plugin included. You do not need to...
View ArticleNow serving over http/2
http/2 is well and truly here, and is even partially supported by Internet Explorer 11. Check out the can I use page for http/2. It's time to stop bundling your JavaScript and Stylesheets into single...
View ArticleMigrating from WordPress to Eleventy
After almost 10 years of this blog being powered by WordPress, it is now a statically generated site built using Eleventy. It's also no longer self hosted! It's now hosted on Netflify and I'm happy...
View ArticleRunning cron jobs inside a Docker container
TL;DR Run your cron jobs inside their own container if you can afford the luxury of a dedicated container for cron jobs and your application structure allows it. If not, just run the cronjob directly...
View ArticleFullstack is not a myth
I will prefix this whole post by stating that this, like all other conversations on this subject, is an opinion and is based off of anecdotal evidence. Nearly every weekend there is some sort of big...
View ArticleTech leads: Pick the right development stack to keep your team productive
TL;DR Use mature, well established technologies to avoid pouring time into fixing things that aren't related to what you are building. Asses technologies as objectively as you can based on your...
View ArticleStarting a new app? Deploy it to production first
When you start a new project, the temptation is always to get the code scaffolded and to get hacking away. I'm going to argue that you should deploy your non working application to production straight...
View ArticleTwitter alternatives
Twitter is a mess, and it's not a stretch to say that it's in a downward spiral. After all Twitter has been put through, the only value it currently has is that everyone is already on there. I'll...
View ArticleBacking up and restoring a PostgreSQL database across different versions
There are a few ways to backup and restore a PostgreSQL database. However, some methods will not work if your source and destination PostgreSQL instances run different database versions, especially if...
View ArticleSharing data between child and parent components in Angular
Consider the following set of parent and child relationships in an Angular application with Angular's standard routing: /├── region│ └── city│ └── area├── Help└── Account page Assume we have a...
View ArticleTaking the noise out of logs to quickly find build issues
This blog post will focus on one of the JavaScript unit test runners, Karma, but you should be able to take these principles and apply them to whatever unit test runner you are using in your tech...
View ArticleDo we need process monitors in docker containers running .net or node?
There has been some really interesting debate of late recently over the use of process monitors within docker containers, (particularly over on reddit here and here. Some responses even went as far as...
View Article