Windows Services, Named Pipes and UnauthorizedAccessException

I was working on some proof-of-concept code whereby an unpriviledged client would communicate with a Windows service using protocol buffer serialization over a named pipe. I was doing this using .NET Core 3.1 and the Microsoft.Windows.Compatibility package. The transmission of the data between the processes worked great when I was just using two unpriviledged console apps. I started running into issues when I made the switch to a Windows service. Sending data from an unpriviledged process to a Windows service doesn’t seem to work by default as Windows services run with elevated priviledges.

Swashbuckle generates incorrect Swagger API URL

I recently encountered an issue while using Swashbuckle whereby everything would work fine when running it locally but the deployed version would use incorrect API URLs. https://server.example.net/app/foo/bar?a=123 would become https://server.example.net/foo/bar?a=123 The issue seems to be caused by the fact that server.example.net is an API gateway. This seems to prevent Swashbuckle from correctly inferring the URL of the ASP.NET Core app and so it doesn’t generate the server part of the schema.

Compound primary keys and NHibernate event listeners

Recently I had to write some code to log CUD operations done via NHibernate. The requirement was to log the following: The type of operation (insert, update, delete) The primary key property name(s) and value(s) of the entity being operated on For updates, the property name(s) and the old and new values It was pretty straightforward apart from retrieving the primary key. If the key is a scalar then it’s pretty straightforward:

HashSet, IEquatable and Contains

I recently came across some unintuitive and confusing (but understandable) behaviour when dealing with HashSet<T> where T : IEquatable. I’d written a class that implemented IEquatable based purely on the ID of the object. The trouble was that HashSet.Contains was saying that it didn’t contain the object I was passing it even though it contained an object with the same ID. Here’s a trimmed-down example that exhibits the same behaviour:

Windows Store Error Code 0x80070005

I recently starting an issue where none of the programs I’ve installed via the Windows Store would update. Specifically they’d fail during the installation with an error code of 0x80070005 with no actual description of what the problem is (Microsoft still erroring like it’s 1989). I searched all over the place but either I wasn’t willing to try the solutions because they were unreasonable, such as wiping my user profile because it might be corrupted with no way of checking whether this was actually the case, or they simply didn’t work.

ASUS RT-N66U IPv6 with Merlin

In a previous post I described how to get IPv6 working on the ASUS RT-N66U using the stock firmware. I’ve since switched to using the unofficial Merlin firmware. While the settings in the previous article still apply, Merlin has more settings exposed and, at least in my case, failing to change the Prefix Length from the default 64 to 56 left IPv6 in a broken state. This led to various network issues such as avatars in the Twitter app taking forever to load, Steam being dog-slow on my Ubuntu 18.

Amazon Fire HD 8 System Apps on Home Screen

I recently got an Amazon Fire HD 8 tablet and for the most part it’s been running fine. However, I encountered a weird and annoying issue where, all of a sudden, I had what seem to be system/hidden apps showing up on my Home screen. The apps in question were, IIRC, Device Setup, Downloads, Music, Kindle Store and maybe one more that I can’t find/remember. The solution was to go to Settings → Apps & Notifications → Manage All Application → Home Pages → Storage.

The Forgotten Ideas in Computer Science Notes

I recently watched Joe Armstrong’s Code BEAM keynote talk about forgotten ideas in computer science and thought it would be useful to make some notes. They’re mostly in the form of links to things that he mentions in his talk. The Talk The Tweets I’m interested in the forgotten ideas of computer science. Needed for a talk. Can you post examples of great CS ideas that have been largely forgotten.

ASUS RT-N66U IPv6

I’m using an ASUS RT-N66U and my ISP is Aquiss (an Entanet reseller). I wanted to get IPv6 working. After a little bit of fiddling, the following settings seem to have done the trick: Connection type: Native Interface: PPP DHCP-PD: Enable Auto Configuration Setting: Stateless Connect to DNS Server automatically: Enable Enable Router Advertisement: Enable Hope this helps anybody else in the same situation.

WHMCS Smarty {include} Not Working

I’ve been using Smarty templates a bit recently while working with WHMCS and ran into an issue. When trying to do {include 'some_template.tpl'}, I was getting no output. Smarty seemed to just stop all processing at that point. The fix was maddeningly simple, especially as I’d tried a bunch of different variations of absolute and relative paths. If your template is in a file called some_template.tpl, you need to use:

WHMCS 500 Error

While working on an addon module for WHMCS I kept getting a generic 500 error code and a blank page. I was pretty sure it was a problem in my code but there was nothing in the XAMPP error.log or the WHMCS admin dashboards so I had no way of tracking down the cause. I managed to finally track down the cause by enabling the Display Errors option under Setup → General Settings → Other.

OAuth for the Confused

While working on some code recently I ended up learning far more about OAuth than I ever wanted to know and so I thought I’d share my pain with the Internet. This guide will cover OAuth 1.0a as that’s what I’ve been working with. OAuth is an open standard for access delegation, commonly used as a way for Internet users to grant websites or applications access to their information on other websites but without giving them the passwords.

JavaScript Prototypes for the Confused

Objects can have a prototype and a prototype is just another object. We can get an object’s prototype using the Object.getPrototypeOf method. Object.getPrototypeOf({}); // → {} Yes, JavaScript really loves objects. It’s objects all the way down. Actually that’s not completely true: Object.getPrototypeOf(Object.getPrototypeOf({})); // → null The first call to Object.getPrototypeOf gave us the prototypical object—the one that acts as the prototype for practically all objects—and calling Object.getPrototypeOf on that gives us null.

JavaScript Properties for the Confused

Like a lot of things related to JavaScript, the syntax and semantics of properties can be a little tricky to wrap your head around. Hopefully this article will serve to simplify and clarify things. Our first step is to do away with the idea of arrays. But wait, arrays are important, surely? Yes, but they’re just conceptual baggage when it comes to understanding properties because arrays are also objects. And don’t call me Shirley.