Archives
-
2019: Time for even more
After a thoroughly action packed 2018 where I’ve learnt many different new technologies (AngularJS, Gulp and more) along with some more protocol-esque things (SWIFT, you and your MT103s and friends, …
-
End of 2018 link dump
Things I've had open in tabs to read, some of which may be of interest to you!
Nick Craver - Stack Overflow: How We Do Monitoring - 2018 Edition
Seriously, read it. There's a lot you can take away …
-
Using the Tabulator javascript library to prettify tables
There are more than a few different libraries out there which can be used to pretty up HTML tables in various different ways. One that I've recently spotted is Tabulator. In order to have a play …
-
Using the PSWindowsUpdate module to interrogate Windows Update
I've been looking at automating the patching of some servers that aren't domain joined, and one of the tools that I've spotted that may come in handy is the PSWindowsUpdate module. Once it's …
-
Setting up OpServer, the awesome monitoring solution from Stack Exchange
Monitoring. You know it's important, I know it's important, Everyone knows it's important, but,... it's often not given the focus that it so justly deserves.
If you're in a position where you don' …
-
Using SQL Server to generate ranges and group data into them
One of the reporting requests I see from time to time is to have output grouped into ranges, or bands if you prefer, e.g:
From
To
Quantity
Value
0
250
3
125.52
250
500
8
3, …
-
Conditional totals for groups of rows, based on the value of a given column, in SQL Server Reporting Services
SQL Server Reporting Services seems like a bit of a dark art at times (trying to look at the markup behind an RDL file definitely is!), for 90% of report based requirements it can be used to quickly …
-
Using Azure Traffic Manager to divert to a holding page for a site that's not available
In the first post in this series I put together a holding page that uses Azure Storage to write "call me back" details to Table Storage (so it doesn't rely on anything other than Azure), in the …
-
Using Azure App Services to host a holding page for a site that's not available
In the first post of this series I put together a .NET Core application that uses Azure Storage (in table form) to keep records of "call me back" requests from customers, so that when the main site …
-
Using Azure to provide a holding page for a site that's not available
One of the fantastic things about Azure is how quickly you can spin up, and down, services as and when you need them. In a world where not everything's been migrated to the cloud yet this can be …
-
Running an ASP.NET project yellow screens with "Could not find a part of the path 'D:\Path\To\Project\bin\roslyn\csc.exe'"
I recently had to pull a project onto a different PC and for some reason even after running a NuGet package restore and building the solution, running the project failed with an error as the roslyn …
-
C# 7.1 - Async Main has been around a while now
C# 7.1 has been out in the wild for quite a while (since August 2017 according to Wikipedia!) yet I still see a lot of people on Stackoverflow asking questions where they're hitting the .Result …
-
Using C#7 Local Functions
After I wrote a post recently that covered the Tuple C# 7.0 language feature it got me thinking about all the other language enhancements that have been added in C# 7.0 and its three subsequent …
-
Using the C#7 Tuple language feature to eliminate an anonymous type
It might be a bit "old news" now, given that C# 7.0 was released in March 2017 (according to Wikipedia, so it must be true!) but after I answered a question on Stackoverflow earlier today I was …
-
Adding a custom '.AddThisOrThat()' method to configure ASP.NET Core Identity in one
In my recent series of posts about ASP.NET Core Identity I made several customisations to Identity that are bespoke to the application I'm building. This does mean that the code for configuring …
-
Double translating using the AngularJS angular-translate library
For those of us who're still working with applications using AngularJS 1.x (it's still in long-term support for nearly 2 years so plenty of time to plan a migration!), localising strings in the …
-
Persuading a SQL Server UDF to throw
Unfortunately (and annoyingly, at times!) it's not possible to persuade a SQL Server User-Defined Function to throw, though I've managed to find (more by luck thank judgement!) a way to get the …
-
Calling ASP.NET Web API end-points for testing purposes with Refit in .NET Core
Back in August I wrote Calling ASP.NET Web API end-points for testing purposes where I described a "bare metal" approach to calling Web Api methods using HttpClient by creating a wrapper that could …
-
Getting the tail of a file in PowerShell (and dropping it into a GridView)
I've had need to wrangle a very long log file recently that gets appended to and doesn't have any log file splitting / cycling baked into it. Changing the logging process so that it generates a …
-
When's my domain password due to change?
If I'm due to take annual leave (as I did last week) I like to check that my password isn't going to expire whilst I'm out of the office and change it a couple of days before I go on leave, just …
-
Using IUserValidator to provide additional user validation rules in ASP.NET Core Identity
In my recent series of posts I extended the UserManager class from ASP.NET Core Identity (specifically its CreateAsync method) in order to confirm that the user was permitted to register and also …
-
Useful links around ASP.NET Core Identity
Whilst working on my recent series of posts about ASP.NET Core Identity there were quite a few pages I used to research either the topic in general, or issues I encountered. Here's a selection of …
-
The finishing touches to hooking into ASP.NET Core Identity user creation
In my previous posts I've setup ASP.NET Core Identity, tweaked the IDs (just because I can), extended the Identity so it stores extra data and started the process of pulling it all together by …
-
Refreshing the IntelliSense cache in Azure Data Studio
As with SQL Server Management Studio, Visual Studio and Visual Studio Code (the latter being the product Azure Data Studio is based on) there's support for IntelliSense, which is why in the …
-
Extending the ASP.NET Core Identity UserManager to set the Employee Id during registration
In previous posts I looked at adding a custom property to the ASP.NET Core Identity user, along with reading and writing the property for a logged in user. The next logical step, assuming that the …
-
Reading and writing custom ASP.NET Core Identity user properties
Adding a custom property to users that're accessed via ASP.NET Core Identity is ultimately a fairly simple exercise; extend the IdentityUser type with a custom one, fix up all the places that refer …
-
Conditionally colouring text in SQL Server Reporting Services
SQL Server Reporting Services is a great tool for building reports quickly, except for the horrendously hard to maintain XML format that the report definitions get persisted in. Recently I was …
-
Extending the ASP.NET Core Identity user
In two recent posts I've been looking at ASP.NET Core Identity, first changing it up so that the data-type for the Id fields in Integer rather than a stringified GUID and then separating out the …
-
Running Redis on Ubuntu on Windows
Whilst there's a Windows port of Redis server, the last stable release that was produced was 3.0.504 in July 2016. There's plenty of options for running later versions of Redis as a Windows …
-
Edge not working for you in Windows 10 (1809)? Try Fiddler
If you've upgraded to the latest version of Windows 10 (1809) and are having problems browsing the web, try running Fiddler. Having this sat between the interweb and Edge seemed to kick it straight …
-
Using the #if pre-processor directive to do different things for x64 builds
I'd just about finished writing an answer for a question on Stack Overflow when the poster deleted it, so I thought I'd drop the answer here instead.
The question asked was essentially:
How can I …
-
Charging a completely flat Surface Pro 3
A very short one - if you've got a Surface Pro 3 (and this may well apply to other Surfaces) and the battery is totally flat, charging it from a Surface Dock may not work.
If you see the light on …
-
Splitting out ASP.NET Core Identity into a separate library
In a recent post I described how to change the data type that ASP.NET Core Identity uses for the generated id's for users. Before I go much further I want to split this out into a separate library, …
-
A brief look at the Windows Admin Center (1809)
A few days ago I happened to look at the list of recently installed updates in the Settings app and noticed that I'd received an update for Windows Admin Center 1809 which reminded me that I'd …
-
Wrapping ConcurrentQueue<T> to make it eventful
One of the projects I inherited has been merrily sat on its server bubbling away and doing what it needs to do since before I joined the company until a few days ago when another service on the …
-
Taking the GUID out of ASP.NET Core Identity
I've been working on an ASP.NET Core web project using the built-in ASP.NET Core Identity solution. All the project scaffolding was done by choosing to create a new ASP.NET Core Web Application, …
-
Styling the Orchard Tag Cloud so it looks like a cloud, not a list
I've had a tag cloud sat on the right-hand side of my blg (or down the bottom for those viewing on mobile devices, or computers with tiny screens) pretty much since I set it up on Orchard. The tag …
-
My "Hit Refresh" moment - twelve months on
Yeah - it's the cat, again.
Twelve months ago Dona Sarkar encouraged me to write about My Hit Refresh moment. Quite a lot's changed since then so I thought it'd be good to write a retrospective, …
-
SQL Operations Studio is now Azure Data Studio, with added Azure Resource Explorer
In true Microsoft fashion, SQL Operations Studio has undergone a re-brand and is now Azure Data Studio (you can download it here). Along with the reccent re-brand of Visual Studio Team Services (the …
-
'Application cannot be started' running SQL Server Reporting Services Report Builder
SQL Server Reporting Services delivers its Report Builder as a click-once application when you click on the 'Report Builder' icon in the toolbar of the web application, unfortunately sometimes it " …
-
TIL: You can mark due dates on Trello cards as complete
I use Trello at work to keep track of support requests from the business in lieu of a full ticketing system (though that's something that's in the works!). As a stop-gap measure to make sure we can …
-
SQL Operations Studio, what is it and why should I use it?
Since the availability of a preview version of SQL Operations Studio (SOS, for short) was announced in November last year, It's been forever on my to-do list to download and take a look. Like …
-
Resolving the error "'bobj' is undefined" with Crystal Reports
Every couple of months the Crystal Reports installed in an application here stops working (reports don't display) after the server that hosts it has been Windows Update'd with the wonderfully …
-
Converting a simple solution/project to .NET Core
I have a very small project I started writing back in 2015 for parsing responses from DNS servers, more because I was interested in how to do so than any real need. Because this mostly pre-dates . …
-
Setting up SQL Server Reporting Services to use HTTPS/SSL
By default SQL Server Reporting Services (SSRS) sets itself up to respond to requests over HTTP made to the name of the machine that it's been installed on. Changing this up so that it can be …
-
Have you ever created a SQL Server login and left 'Enforce password policy' checked by mistake?
There are three little checkboxes that are ticked by default when creating a user through the SQL Server Management Studio user interface:
Enforce password policy
Enforce password expiration …
-
A custom model binder for XML content that produces IEnumerable<T>'s
In a previous post (A custom model binder for XML content) I showed code for a custom MVC Model Binder that takes an XML filled string passed to an action and transforms it to an XDocument. The …
-
Link Dump
I haven't had cause to drop one of these since November last year, probably at least in part because Edge seems to have a nasty habit of eating tabs! In no particular order, and likely of more use to …
-
Running a local npm repository on Windows Server using Verdaccio
I've recently had cause to build a local NPM repository server, for a couple of reasons (Edit: I started this post about 6 months ago and came back to it now, so if there's any parts where the …
-
Using robots.txt to block indexing isn't always right, and how to fix it with Orchard CMS
Since Google started revamping their webmaster tools recently it's made seeing some of the issues they consider my site to have more apparent. One of these is "Indexed, though blocked by robots.txt" …
-
Creating a template for 'dotnet new' for Microsoft.Build.Traversal
In a recent post I described using Microsoft.Build.Traversal in lieu of solutions for building your projects, with steps to create a sample solution and the Traversal project using the .NET Core …
-
Hiding empty years in the Orchard blog archive list
Because I had a bit of a stop/start relationship with my blog for the best part of a decade there are a lot of years where there aren't any posts. This kinda filled up the "Archives" list I've got …
-
Using Microsoft.Build.Traversal in lieu of solutions for building your projects
Somewhere recently I came across a reference to the Microsoft.Build.Traversal SDK which has been sat in an open tab in my browser ever since. Traversal:
Supports creating traversal projects which …
-
Fixing up the archive counts in Orchard
For reasons best known to itself, sometimes Orchard gets a little count happy with the number of posts in a given archive year/month and over exaggerates the number of posts present. Fortunately …
-
Don't use 'SET DATEFORMAT' and don't manipulate dates as strings
There are two things that're a bad idea when it comes to dates and SQL Server (that I'm blogging about right now, there are surely many more than that!), using 'SET DATEFORMAT' to alter the default …
-
Using the new Microsoft Library Manager to Bootstrap a project
The latest release of Visual Studio 2017 (15.8) comes with Microsoft Library Manager, or LibMan for short, there's also a CLI available and if you want to read about it from the horses mouth …
-
Using Common Table Expressions to explode recipes - Part 2 - Getting the ingredients
A Brief Recap
In the last part of this article I showed a table structure for recipes and their ingredients. There are two kinds of ingredients that a recipe can contain, raw ingredients (e.g. …
-
Using Common Table Expressions to explode recipes - Part 1 - The CTE
A lot of the examples that you see for using Common Table Expressions (CTEs) in SQL Server, particularly recursive ones use examples that are around user hierarchies - showing ways to find all the …
-
Using Sequence Numbers in SQL Server
Microsoft introduced the concept of Sequence Numbers in SQL Server 2012 which are:
... a user-defined schema-bound object that generates a sequence of numeric values according to the specification …
-
Calling ASP.NET Web API end-points for testing purposes
I'll preface this by saying there are almost certainly a bucket load of different tools and twice as many supporting libraries / packages out there that'll give you a solution to this problem but …
-
Using ROW_NUMBER to get the most recent record from a table
Quite a while ago I wrote about using SQL Server CLR to add "earliest" and "latest" aggregate functions that could be used to retrieve the, well, earliest and latest Id values from a table based on …
-
Stopping and starting a System.Timers.Timer - be careful you don't stop forever!
I've sometimes seen code that stops and starts a timer during its TimerElapsed event in order to ensure that the event isn't called whilst it's still being executed from a previous call. If this …
-
Using the CommandLineParser NuGet package to handle your command line
From time to time I've needed to write small console apps that accept parameters via the command line. Luckily, parsing the command line is a solved problem and there are multiple libraries out …
-
Making sure Windows doesn't start your service before SQL Server
This is more of a "note to self" of the syntax, but, if you have a service that depends on another (such as a local SQL Server instance for local logging) then you can tell Windows about that …
-
Finding the process template for a your TFS 2015 projects
If you're trying to determine what Process Template was used when the projects in a given TFS project collection were created, the quickest way to do this that I've found is to run the following …
-
What's an Estimated Subtree Cost?
When you're looking at the execution plan for a query (you do that, right?) one of the data-points that's shown is "Estimated Subtree Cost". Looking at this is one of the things I review when I've …
-
Getting a 403.501 error response from IIS? Check your 'Dynamic IP Restriction Settings'
One of the applications I inherited is composed of multiple applications and uses one of them as a central authentication solution (issuing tokens on login, refreshing them, revoking them, etc,..) …
-
Using the AngularJS 'ng-required' attribute to make fields co-dependent
One of the bugs I had to fix recently was around ensuring that if Field X was populated, then Field Y became required. In the example I was working with this was all the more complicated due to …
-
Creating a linked server that has a different name to the "real" server
It's sometimes useful to be able to have a linked server where the name is misleading. One example of this could be where you don't have a perfectly isolated test or staging infrastructure so you …
-
How to console.log the name of the variable as well as its value
This tweet from @wesbos is a great tip, anything that makes working with JavaScript in Developer Tools for your browser of choice has got to be a bonus, right?
Wrap your console.log arguments in …
-
Counting the number of installed certificates via PowerShell
Bit of a random one, but should you ever need to count the number of certificates that are installed on a Windows Machine in the "Local Machine" store, here's a short PowerShell snippet that'll do …
-
"unable to load certificates" when using openssl to generate a PFX
If you've tried to follow the instructions in my Generating an SSL certificate with SANs via a Windows Certificate Authority post and have run a command to combine the certificate and private key: …
-
Quick Tip: Randomising a resultset from a SQL query
Sometimes I need a random (random enough for my purposes - I don't know, nor care, if it meets a formal definition of random) sample of N rows of data from a table. There's a very quick way to do …
-
Creating projects and solutions using the dotnet command
I've been digging into .NET Core a little bit more recently, with the intention of using it for an upcoming project at work (sssh, don't tell anyone - they don't know yet!) and part of that has …
-
Always make sure you specify the length to CONVERT in SQL
Over the years I've seen this potential blackhole of data loss several times, a developer has written CONVERT(VARCHAR, [ColumnName]) without specifying the length of the VARCHAR to convert the column …
-
SQL Server 2016 syntax for dropping objects
SQL Server 2016 introduced a new syntax for dropping objects, that I've known about for quite a while. I've been surprised by the number of people that aren't familiar with it so thought I'd put …
-
Structuring UPDATE and DELETE queries so that they're a little bit safer
Quite often I've seen someone who wants to update a table, or delete rows from a table write a SELECT query to work out what data they want then separately write an UPDATE or DELETE query to …
-
Using Google Analytics to track page views in an AngularJS single page application
If you're using Google Analytics to track page visits across your application, getting this working in an AngularJS application is a little bit more complicated than simply dropping the GA …
-
TIL: Queries against linked servers... Be careful how you structure them!
The fact that a query across a SQL linked server (to another SQL server) is sometimes off-loaded to the remote server and sometimes not even when the entire query is operating on the remote data is …
-
Braces on new lines in Visual Studio Code
Here there be dragons: Some people prefer their braces on the same line, some prefer them on the next line. If you're in the latter camp then the default in Visual Studio Code will annoy you - it's …
-
Using Visual Studio Code, Node.js and gulp.js to create a web application - Handling changes
This is going to be quite a short post, there's not a lot to getting the gulp script to re-process any changed files - but it's a very useful thing to have!
Other parts of this series
Using …
-
Generating an SSL certificate with SANs via a Windows Certificate Authority
There are doubtless other ways to generate an SSL certificate through a Windows Certificate Authority which have associated SANs (Subject Alternative Names), but one way I've found is particularly …
-
Using Visual Studio Code, Node.js and gulp.js to create a web application - Moving files around
Before I do too much more, I want to setup my build script / project to allow me to (a) make sure that everything in the .dev folder is kept apart from the app folder and set myself up so that I …
-
What does "Manual (Trigger Start)" mean for a Windows Service?
There's a selection of different startup types that can be assigned to a Windows Service, at least as seen in the Services MMC snap-in, such as:
Disabled
Manual
Automatic
Automatic (Delayed …
-
Using Visual Studio Code, Node.js and gulp.js to create a web application - Serving content
Once we've got the basics of the project setup, npm is working, gulp is installed and ready to go, next up is actually creating a starting gulp script and adding enough to it go get it to serve up …
-
Using Visual Studio Code, Node.js and gulp.js to create a web application - Getting started
I've written quite a few posts recently that touch on using Visual Studio Code, Node.js and gulp.js. This is entirely down to having started working on a product that uses all of these, along with …
-
Quick Tip: Stopping a browser from opening when you run a web project in Visual Studio
This one is embarassing. It's something that's annoyed me for years whenever I'm working in a multi-solution/multi-project setup wtih one project for the API and another for the Web UI, e.g. a Web …
-
Quick Tip: Running Visual Studio Code for the current directory
Lots of people probably already know this, but there are a couple of ways to open the current directory in an instance of Visual Studio Code. The obvious one is, if you've got a File Explorer window …
-
How to debug an AngularJS app in Visual Studio Code with Chrome
I've been using Visual Studio Code quite a bit recently as a project I'm working on is written in AngularJS, with gulp based build scripts. As this is part of my first real foray into using tech that' …
-
Does one string contain another, irrespective of case?
One of the methods that's noticeable by its absence from the .NET Framework / .NET Core (or, to put it another way .NET Standard 2.0) is an override of string.Contains that takes a StringComparison …
-
A basic MSMQ backed WCF server and client
After my recent post, MSMQ messages ending up in the "Transactional dead-letter messages" System Queue, I decided to build up my understanding of how MSMQ backed WCF services work by putting together …
-
MSMQ messages ending up in the "Transactional dead-letter messages" System Queue
I've been working with a solution recently that uses MSMQ to, well, pass messages between components running on different machines. It's been implemented using WCF as the abstraction layer, so …
-
The curious case of IIS that wouldn't serve content from a drive other than C:
In this case, it was with a Windows Server 2012 installation on a VMWare guest. The setup was quite unexciting:
Freshly installed Windows Server 2012 box
IIS installed
A second site configured …
-
How to debug gulp tasks in Visual Studio Code - Gulp 4
I recently read an article about debugging gulp tasks in Visual Studio Code, which seemed like mana from heaven for me as I'm now working with nant, npm, gulp scripts, AngularJS and all the …
-
Creating an X509Certificate2 under IIS throws 'The system cannot find the file specified'
This exception had me scratching my head for a good 30 minutes until the power of Bing (yes, Bing!) gave me the answer:
System.Security.Cryptography.CryptographicException: The system cannot find …
-
The content of table variables is retained even when a transaction is rolled back
You learn something new every day! Thanks to the superbly detailed answer by Martin Smith on the question What's the difference between a temp table and table variable in SQL Server? at Database …
-
Gulp, Node.js and "require.extensions.hasOwnProperty is not a function"
I've been working through getting an older version of an AngularJS project to run locally and encountered the following error:
D:\Git\MyApp>gulp dev
D:\Git\MyApp\node_modules\require-dir\index.js:93 …
-
AngularJS, HTML 5 Mode, IIS (Express) and hitting F5/Refresh - Setting up URL Rewrite via the IIS Manager UI
In my previous post, I covered the configuration changes that you need to make in your web.config file to get IIS to route requests for URIs that should be handled by your AngularJS application back …
-
AngularJS, HTML 5 Mode, IIS (Express) and hitting F5/Refresh
The company I joined in November (more about this another day!) has a product that was developed in AngularJS 1.x. Not Angular, AngularJS - one of these things is not like the other! This means …
-
Creating a branch from a revision with Git
A very short "memo to self" post to note down how to create a branch using the git command line, from a specific revision:
git checkout -b MyBranchName 22322e768c9956bb93a3701504250124c4d5bf53
This …