Exporting SNMP metrics to Prometheus

29 Oct 2023 14:31

My DS416play keeps falling off the network, requiring a hard reset. I wondered whether it was possible to monitor it somehow. It turns out that it responds to SNMP queries, so here’s my attempt to export all of that into Grafana.

» read more

Improving your quality of life as a developer

27 Oct 2023 12:53

I’ve just come off a call with a colleague and while he was sharing his screen and we were walking through some things, I noticed that his setup is missing all of the little “quality of life” tweaks that I’ve made over the years.

» read more

SSH Forwarding in Docker

2 Oct 2023 09:38 docker

If you’re building your application inside a Docker container, and you need to pull dependencies from a git server (e.g. Github or Gitlab) using SSH, you need to forward your SSH session to the container.

» read more

gen_server debug options

10 May 2023 10:22 erlang

Erlang’s gen_server (and gen_statem, etc.) allow for you to pass {debug, DebugOptions} in gen_server:start_link/4 (et al.). The documentation for it is spread over several pages, making it hard to understand at first. How should we use it?

» read more

Installing Tempo

28 Apr 2023 13:54

I want to play with OpenTelemetry, so I figured I’d install Grafana’s Tempo in my cluster. I’m going to use ArgoCD to install the Helm chart.

» read more

Erlang: via

20 Apr 2023 13:02 erlang

Here’s how you can use via in a name specification when starting a gen_server (or gen_statem, etc.) to register your process with a process registry.

» read more

Upgrading gitea

3 Apr 2023 15:53 kubernetes gitea

I’m running Gitea and ArgoCD on my K3s cluster, for some GitOps goodness. I noticed that Gitea 1.19.0 recently came out, with some features I want to try, such as Gitea Actions. Since I’m running 1.17.4, it’s time to upgrade.

» read more

Exporting variables from scripts

17 Mar 2023 10:08

Often, when you’re doing something in an interactive shell, you’d like to set an environment variable from a script. But you can’t, because scripts run as their own process, which means that they can’t set environment variables in their parent (the shell). How do we get around that?

» read more

Using socat to strip HTTPS

11 Mar 2023 11:54

I’m trying to figure out how kubectl does its thing. Because it uses HTTPS to talk to the API server, I can’t use Wireshark to look at the traffic. Here’s how I used socat to snoop on the traffic.

» read more

Erlang Clustering: a survey

22 Jan 2023 12:10 erlang

A question on Mastodon asks “What are people using [for cluster management] in 2023?”. I thought I’d address a couple of hidden assumptions in the question and do a quick survey of what’s available.

» read more

Simple log colouring in Erlang

21 Jan 2023 20:40 erlang

By default, the improved logger originally introduced in Erlang/OTP-21 doesn’t support per-level colours. This is something that I miss from lager and from Elixir’s Logger. Here’s a simple way to implement something like lager.

» read more

Building Erlang/OTP

9 Jan 2023 18:06 erlang

There’s more comprehensive information in various files in the HOWTO directory, but ain’t nobody got time for that. This works for me.

» read more

Forking Erlang/OTP

9 Jan 2023 17:49 erlang

Some notes about hacking on and contributing to Erlang, because I don’t do it frequently enough to have all of this in muscle memory.

» read more

Erlang application versioning

22 Dec 2022 13:53 erlang rebar3

When you’re investigating a problem with a deployed application, it’s useful to know precisely which version you’re looking at. Here’s how to automatically set the version number in an Erlang project.

» read more

Erlang clustering recap

11 Nov 2022 19:24 erlang

I want to write a post about using mutual TLS to secure Erlang distribution (clustering), with auto-provisioning of certificates when running in Kubernetes. This is not that post. This is a recap of basic Erlang clustering, to refresh my memory and lay some groundwork.

» read more

Erlang SSH

1 Nov 2022 10:25 erlang ssh

Erlang/OTP provides a built-in SSH client and daemon. You can use this to expose the console directly over SSH.

» read more

Monitoring temperatures with telegraf

29 Aug 2022 15:04 telegraf

One of my NUCs keeps hanging, and I suspect temperature. I wanted to use collectd to gather the temperature sensor values, but it was removed from Ubuntu 22.04. Instead, I’m going to see if I can get telegraf to do it instead.

» read more

Pod DNS Problems

25 Feb 2022 08:42 k3s core-dns dns k3s

I’ve got an extra instance of CoreDNS running in my cluster, serving *.k3s.differentpla.net, with LoadBalancer and Ingress names registered in it, and it’s working fine for queries to the cluster. It’s not working fine for queries inside the cluster. What’s up with that?

» read more

Traefik Ingress

31 Jan 2022 08:46 ingress k3s traefik k3s

I’m in the middle of installing ArgoCD (blog post will appear later). Rather than use up another LoadBalancer IP address for it (and mess around with TLS), let’s talk about using an Ingress. It’s entirely possible that I can convert the previously-installed docker registry and Gitea to use one as well.

» read more

Colouring the 'iex' prompt

9 Jan 2022 12:17 elixir

If you’ve got separate dev, test and prod environments, it can help to use colour to tell you which one you’re logged into. Here’s how to colour the iex prompt appropriately.

» read more

git start

10 Dec 2021 11:16 git

When I create a new git repository, I prefer for there to be an empty commit at the beginning of history.

» read more

Multiple Laptops, Multiple Monitors

11 Sep 2021 19:04

At home, I’ve got a rather nice setup with two Dell U2520D monitors on my desk, which I’m currently using from my (work) Linux desktop. However, more recently, I’m trying to strike a better work/life balance, so I’ve decided to start making more use of my (personal) Microsoft Surface Book 3 laptop, but I’d like to continue using the two monitors (which are also mine; I never bothered filing the expense claim).

» read more

failed to start child: :ranch_server_proxy

8 Jun 2021 14:02 elixir ranch
** (Mix) Could not start application example_server: ExampleServer.Application.start(:normal, []) returned an error: shutdown: failed to start child: {:ranch_embedded_sup, :example_server}
    ** (EXIT) shutdown: failed to start child: :ranch_server_proxy
        ** (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started
» read more

Rebuilding kerl Installations

30 Jan 2019 16:50 kerl erlang

If kerl list installations is displaying Erlang installations that you deleted ages ago, and you’ve got all of your installations in ~/.kerl/erlangs/, you can rebuild the list by running the following command:

» read more

jq reduce

11 Jan 2019 19:38 jq

I found myself having to process a large JSON file using jq --slurp, and it was using up a lot of memory, so I thought it was time to learn about jq’s reduce function.

» read more

git rebase tips

27 Oct 2017 13:10 git

This is an internal email I wrote almost exactly 2 years ago. I had to refer to it today, and I figured that it bears sharing publicly.

» read more

Running Chromium as a Dashboard

28 Jan 2015 08:26

On my desk I have a dashboard (an “information radiator”) that displays various useful things, such as the build status of various Jenkins jobs, clocks showing important timezones (Electric Imp is a distributed company), and so on.

» read more

Reverting Erlang 17

9 Oct 2014 12:22

We’ve found a couple of problems with Erlang R16 that mean that one of our projects requires Erlang 17. Conversely, we’ve found a couple of problems with Erlang 17 that mean that one of our other projects should stick with Erlang R16.

» read more

Using kerl with direnv

30 Sep 2014 00:00 kerl direnv erlang

kerl allows you to easily build and install multiple Erlang/OTP releases. It’s kinda like nvm or rvm, but for Erlang. It doesn’t do everything, and that’s what direnv is for. direnv allows you to run commands upon entering or leaving a particular directory.

» read more

epgsql: invalid_password

31 Dec 2013 14:55

I’m writing a simple web application in Erlang that uses epgsql to talk to a PostgreSQL database. I keep getting invalid_password, despite the fact that the user doesn’t have a password (and I’m passing “”). I can also log in by using psql -U foo.

» read more

vim plugins

22 Nov 2013 12:22 vim

This, for no particular reason, is the list of vim plugins that I’m currently using:

» read more

Lego Storage

3 Nov 2013 19:59 lego

My son has quite a lot of Lego, but he stopped playing with it. It turns out that he gets frustrated when he can’t find a particular piece. So we started exploring storage options.

» read more

Phones I have owned

18 Jun 2013 10:37

Apropos of a discussion on Facebook earlier today:

  • Motorola MR20
  • Motorola Startac
  • Motorola (blue thing)
  • Nokia 8310
  • Nokia 6230
  • HTC Desire
  • Samsung Galaxy S3
» read more

Failed to load data access DLL

3 Jun 2013 10:55

While attempting to debug a crash dump from a .NET 4.0 RTM process on my (.NET 4.5), I got the dreaded Failed to load data access DLL, 0x80004005 error message.

tl;dr? Skip to the end…

In full, the error looks like this:

0:000> .loadby sos clr
0:000> !vmstat
Failed to load data access DLL, 0x80004005
Verify that 1) you have a recent build of the debugger (6.2.14 or newer)
            2) the file mscordacwks.dll that matches your version of clr.dll is
                in the version directory or on the symbol path
            3) or, if you are debugging a dump file, verify that the file
                mscordacwks_<arch>_<arch>_<version>.dll is on your symbol path.
            4) you are debugging on supported cross platform architecture as
                the dump file. For example, an ARM dump file must be debugged
                on an X86 or an ARM machine; an AMD64 dump file must be
                debugged on an AMD64 machine.

You can also run the debugger command .cordll to control the debugger's
load of mscordacwks.dll.  .cordll -ve -u -l will do a verbose reload.
If that succeeds, the SOS command should work on retry.

If you are debugging a minidump, you need to make sure that your executable
path is pointing to clr.dll as well.

There are lots of words here, but they’re not the easiest to understand, particularly when you’re in a hurry (like, say, you’re attempting to debug an issue on a production server).

I’m assuming that you’ve got a recent version of WinDbg. I was running 6.12, which should be OK.

If you’re lucky, however, (and you’ll need to have !sym noisy turned on to see this), you’ll get:

DBGHELP: clr - public symbols
            c:\websymbols\clr.pdb\0A821B8A573E42899202851DF6A539F12\clr.pdb
SYMSRV:  mscordacwks_AMD64_AMD64_4.0.30319.01.dll from http://msdl.microsoft.com/download/symbols: 502605 bytes - copied
DBGHELP: c:\websymbols\mscordacwks_AMD64_AMD64_4.0.30319.01.dll\4BA21EEB965000\mscordacwks_AMD64_AMD64_4.0.30319.01.dll - OK

This means that the Microsoft Symbol Server had the relevant mscordacwks.dll file. If not, you’ll have to copy it from the machine from where the crash dump originates, and put it somewhere useful. Unfortunately, the message doesn’t explain what, exactly, it means by “on your symbol path”.

For me, at least, it seems that putting it in (e.g.) C:\WebSymbols doesn’t work – you need to put it in the correct named location. I can’t verify this right now, since it downloaded it successfully from Microsoft Symbol Server.

More importantly for my problem, however, is the easily-overlooked message at the end:

If you are debugging a minidump, you need to make sure that your executable
path is pointing to clr.dll as well.

Given that WinDbg knows that I’m debugging a minidump, it could have made this more prominent. What it’s telling us is this:

  1. Copy clr.dll from the original machine. Put it somewhere. Next to the dump file would be fine.
  2. Add that path to the executable search path, using .exepath+ C:\wherever

Note, that you must use the version from the original machine. If you attempt to use your clr.dll, you’ll get the message:

The version of SOS does not match the version of CLR you are debugging.  Please
load the matching version of SOS for the version of CLR you are debugging.
CLR Version: 4.0.30319.1
SOS Version: 4.0.30319.17929
CLRDLL: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscordacwks.dll:4.0.30319.17929 f:8
doesn't match desired version 4.0.30319.01 f:8

Just tell me what to do, already!

  1. Copy clr.dll, sos.dll and mscordacwks.dll from the machine where the crash is occurring.
  2. Put them in C:\Temp.
  3. .exepath+ C:\Temp
  4. .load C:\Temp\sos
  5. Done, you can now !vmstat, etc., to your heart’s content.
» read more

Spike: Providing parameters to IIS Express-hosted applications

An aside: We need to be able to support multiple instances of our small web application (because you might have more than one instance of Visual Studio open). If we host our application in IIS Express (and remember that we’re doing this to avoid messing around with URL ACLs), we either need to duplicate the whole thing for each site, or figure out a way to provide it with parameters.

» read more

Finding IIS Worker Processes

13 May 2013 13:37 powershell iis

How do we find out if there’s a worker process for an application pool? Note that there can be more than one worker process for each application pool. Note also that a worker process can host multiple web applications.

» read more

The case of the missing print jobs

27 Apr 2013 08:02

Having recently moved my home server (Windows 2012) from the hall cupboard to the corner of my study, I decided to connect it to my printer. This means that I can print from my laptop over wireless without needing to turn on the desktop PC that the printer was originally connected to.

» read more

PowerShell and enums

17 Apr 2013 11:29 powershell

PowerShell has a really cool feature where it’ll coerce a string into an enum value. I’ll demonstrate by exporting a certificate from the Windows certificate store:

» read more

Acer Aspire S7 and Secure Boot

29 Mar 2013 13:59

I just bought myself a shiny new Acer Aspire S7-391, with a view towards nuking Windows 8 and to install Linux Mint on it. Stupidly, I didn’t consider that Windows 8 logo certification now requires a UEFI BIOS and Secure Boot.

» read more

Installing Windows 8 Pro on Acer Aspire S7

27 Mar 2013 16:47
  1. Make sure that the ISO file you’ve downloaded is not corrupt – this caused me a bunch of grief.
  2. Format a bootable USB stick as FAT32.
  3. Mount the ISO.
  4. Copy the files from the ISO to the USB stick.
  5. In the Acer’s BIOS, select UEFI; enable F12 boot menu.
  6. Restart the Acer.
  7. Press Fn-= (F12).
  8. Select the USB stick.
  9. Add the Intel drivers.
  10. Continue with the installation.
» read more

Bouncy Castle - Subject Alternative Names

24 Mar 2013 14:20 bouncy-castle bouncy-castle

When you connect to a server using HTTPS, the server provides a certificate that identifies it. Your browser will then typically check that the name in the server certificate matches the address that you’ve gone to. In this way, you can be sure that you’re connecting to the correct server.

» read more

Logging Learnings

16 Mar 2013 11:16

I’ve just spent the bulk of the morning attempting to understand a bug by reading through some fairly large log files. Because of that, I’ve come to some realisations about log files and logging.

Make them text-editor-friendly

Most log files are text. This means that, if you’re tracking down a problem, you’ll probably want to search them, and you may want to edit them.

In particular, you may want to do a search+replace to pull out a bunch of lines to do with a particular event or client. For this reason, don’t spread an event across multiple lines. You might think that it makes the file easier for a human to read (and it does), but it makes it impossible to (for example) delete all of the events that mention client 321 (because you’re interested in client 123), because you’ll end up with hanging lines, as in the following example:

Client #123: Getting orders...
Order #1: Foo
Order #2: Bar
Client #123: Returned 2 orders.
Client #321: Getting orders...
Order #3: Baz
Client #321: Returned 1 order.

If you search-and-replace to delete “Client #321”, you’ll end up with the following:

Client #123: Getting orders...
Order #1: Foo
Order #2: Bar
Client #123: Returned 2 orders.
Order #3: Baz

If you tag-and-copy-to-new-file for “Client #123”, you’ll end up with the following:

Client #123: Getting orders...
Client #123: Returned 2 orders.

Either way, you’ve lost information, and confused yourself. This makes it harder to understand what’s going on.

So, either include the context on every line:

Client #321: Getting orders...
Client #321: Order #3: Baz
Client #321: Returned 1 order.

Or, don’t spread your output over multiple lines.

Consider using CSV (or JSON)

Yeah, your log files are human readable. That’s great, provided you can find a human prepared to read through a couple of million lines of log file.

Why don’t you make them machine-readable? Then you’d allow the file to be parsed and processed by a vast number of tools that already understand CSV (or JSON).

Don’t use XML

Whatever you do, don’t use XML. If you do, you’ve got two choices:

  1. Output a malformed XML document that doesn’t have a root element. If you do this, what’s the point in using XML? I suppose that you could claim that each snippet was an individual XML fragment.
  2. Close the root element after every write, and rewind to remove the </root> before every write. Say goodbye to your performance.

Also, it’s massively verbose. Just use CSV or JSON.

Consider using one file per client

Obviously, this isn’t going to work for your web-scale application, because you’ve got millions of clients visiting every second. However, if you’ve only got a couple of dozen clients, consider using one log file per client.

» read more

Reliable Sessions and HTTPS don't mix

15 Mar 2013 12:33

System.InvalidOperationException: Binding validation failed because the WSHttpBinding does not support reliable sessions over transport security (HTTPS). The channel factory or service host could not be opened. Use message security for secure reliable messaging over HTTP.

…reliable sessions and HTTPS don’t mix.

» read more

Hyper-V Remote Management

20 Feb 2013 18:59

It turns out that you cannot manage a Windows 2008 R2 Hyper-V installation from a Windows 8 desktop (even with the Remote Server Administration Tools for Windows 8 installed) or from Windows 2012 Server.

» read more

PowerShell tip: Deleting certificates

31 Jul 2012 10:20 powershell
$certs = Get-ChildItem cert:\LocalMachine\My | where { $_.Subject like 'CN=Victim*' }
foreach ($cert in $certs) {
    $store = Get-Item $cert.PSParentPath
    $store.Open('ReadWrite')
    $store.Remove($cert)
    $store.Close()
}
» read more

Streaming HTTP responses in .NET

14 Jul 2012 19:11

Sometimes you have a web service or web application, and, for one request, you need to transfer an unknown (and potentially unbounded) amount of data in the response.

» read more

New Theme

5 Jan 2012 16:55

New theme: Acquia Slate. It’s maybe a little dark for my taste, but I’m going to leave it for a couple of weeks and see if it grows on me.

» read more

PowerShell: ImportSystemModules

5 Jan 2012 13:58 powershell

I’ve been using PowerShell as a better Command Prompt for a while now. Increasingly, however, it’s one of the first tools I reach for when I come across a problem, rather than being an afterthought.

» read more

FTTC FTW

21 Dec 2011 11:10

I’ve not posted this until today, because my blog’s been poorly, but the BT engineer came round last week and upgraded me to FTTC.

» read more

Repairing image links in drupal

20 Dec 2011 15:52

Somehow – I’m not sure how, and I’m not exactly sure when – my website (powered by drupal) lost all of its images. They were still there in the filesystem, and the rows were still in the node table, but they’d vanished from the actual pages.

» read more

Reactive Extensions: Elapsed Time

30 Jan 2011 15:05

I’m using SqlBulkCopy to insert a large number of rows into a database table. I used Observable.FromEvent to hook the SqlRowsCopied event. Rx provides the .TimeStamp() method, but I wanted to know the elapsed time, so I did the following:

» read more

Release Process: Using Source Server

14 Jul 2010 13:33

One of the cool things you can do with the Microsoft Debugging Tools is set up a source server. This works by embedding source control details in your PDB files. Once you’ve published these to a symbol server, and set that up properly, you should be able to load a minidump file in Visual Studio (or WinDbg) and be taken to the correct line of the correct revision of the source file where the crash happened.

» read more

Release Process: Goals

14 Jul 2010 13:33

One of the many things that my former company, 1E, does well is its build and release process. That got me thinking: what makes a good build process?

» read more

Returning HTML from a WCF service

20 Jun 2010 13:05 wcf

I’m messing around with writing yet another a blog engine, as a way to learn ASP.NET MVC. One of the things that I’d like to do is have it support uploading from Windows Live Writer. This means that it needs to support XML-RPC and Really Simple Discovery (RSD). More on the XML-RPC stuff later.

» read more

Setting up Squid on Windows

16 Sep 2009 08:38 squid

At work, we do a lot of our testing and debugging with virtual machines (using Microsoft Virtual Server or Hyper-V, mostly). The virtual guests are generally not allowed any access to our live network, which makes accessing the Internet difficult. To get around this, I usually set up Squid on the host machine. This allows the guests to access (e.g.) Windows Update and Microsoft Symbol Server, which makes things a bit easier.

» read more

Symbol Store: How are EXE files stored?

23 Apr 2009 15:12

If you’re using the Microsoft Symbol Server to pull down symbols for Windows, or if you’re using SYMSTORE.EXE for your own stuff, you’ll see that EXE (and other binary files) are stored in a path similar to C:\WebSymbols\user32.dll\4226015990000\user32.dll.

» read more

Using SQL Server Compact Edition for Unit Testing

29 Mar 2009 09:02 sql-server-ce

Ayende shows how to use SQLite with an in-memory database for unit testing your NHibernate code (here). This is a great idea: your unit tests will run more quickly, and you don’t have to worry about tearing the database down when you’ve finished. On the other hand, it’s not an exact match for Microsoft SQL Server (which is probably what your production website will run against).

» read more

Unplanned downtime

4 Mar 2009 07:14

At the end of February, differentpla.net suffered filesystem corruption. I had to revert pretty much everything to a previous backup, which meant losing about a week’s worth of stuff.

» read more

Windows 7 beta on Samsung NC-10 Netbook

29 Jan 2009 16:38

Nothing to report. It all works fine. Installation took an hour. The only hiccup was that I had to download the Marvell Yukon drivers (I used the Vista x86 ones) from Marvell’s website, but the WiFi works, so that was easy. I also slapped an SDHC card in there for some ReadyBoost goodness.

» read more

Things I learnt this week: SVCHOST

25 Oct 2008 12:23

SVCHOST services are configured by having ImagePath set to "%windir%\system32\svchost.exe -k _name-of-service_", and a Parameters key containing ServiceDll (REG_EXPAND_SZ), which names a DLL with a ServiceMain entry point. ServiceMain has argc and argv.

» read more

Things I learnt this week: RegQueryValueEx

25 Oct 2008 12:21

RegQueryValueEx, when passed lpData = NULL, will set *lpcbData to the length required in bytes, even if it’s already set to something. If lpData != NULL, and *lpcbData is too short, RegQueryValueEx will return ERROR_MORE_DATA.

» read more

Tweaking TeamCity

12 Jan 2008 14:11 teamcity

I just started using TeamCity Professional Edition for some personal projects (and we’re evaluating the Enterprise edition for use at work).

» read more

When I'm supreme ruler: Vacations

2 Jan 2008 09:12 supreme-ruler

When I’m supreme ruler of the universe: If you’ve taken more than 5 days vacation, employers will be required to let you work only a half-day on your first day back. It could be the morning, or the afternoon, but you’ll be required to work only 4 hours.

» read more

An empeg reports progress of OP_STATFID

16 Dec 2007 18:53 empeg

We’ve seen the format of the packet that emplode sends to find out the length of a file on the empeg (OP_STATFID). The empeg seems to always send a progress packet in response. The packet looks like this:

» read more

Packet format

16 Dec 2007 18:18 empeg

The format of the packets in the empeg’s TCP/IP protocol owe a lot to the fact that the empeg mk1 communicated over a serial link. This means that there’s a certain amount of cruft still in the protocol.

» read more

Source Code License

6 Aug 2007 11:41

Unless specified otherwise, all source code published on the differentpla.net website is available under the following license terms: Do what you want with it, but don’t claim you wrote it, and it’s not my fault if it doesn’t work.

» read more

FindFirstFile and SE_BACKUP_NAME

25 May 2007 17:04

If you want to read a file and bypass security (e.g., if you’re writing a backup program), it’s not enough to simply enable the SE_BACKUP_NAME privilege, you have to also pass FILE_FLAG_BACKUP_SEMANTICS to CreateFile.

» read more

Calling C# from JScript

27 Apr 2007 09:03

It’s possible, through the magic of COM interop, to call C# code from JScript or VBScript. Here’s an example of how to do it from JScript.

» read more

Implementing For Each in JScript

24 Apr 2007 11:01
function forEach(enumerable, delegate)
{
    for (var enumerator = new Enumerator(enumerable); !enumerator.atEnd(); enumerator.moveNext())
    {
        delegate(enumerator.item());
    }
}
» read more

Enabling Concurrent Remote Desktop Sessions in Vista

22 Apr 2007 20:26

At work, I do all of my development on a Windows 2003 box. I generally log in as a normal user, and then use Remote Desktop to concurrently log in as Administrator. This means that I’m relatively safe from malware when doing day-to-day stuff, but that I can still get hold of Administrator privileges when I need them.

» read more

A list of HRESULT codes

16 Feb 2007 10:50

…because every time I search for a given HRESULT, all I get is yet another frigging VB website regurgitating the contents of WinError.h

» read more

Turning off Registry Virtualization

15 Feb 2007 10:51

On Windows Vista, applications running without admin privileges can write to HKEY_LOCAL_MACHINE, and they’ll be transparently redirected to HKEY_CURRENT_USER\Software\Classes\VirtualStore. Similar redirection applies to C:\Program Files.

» read more

Things I found out today while looking at Side-by-Side DLLs

7 Feb 2007 16:37
  • You can add DLL dependencies to your EXE file’s manifest by using the /manifestdependency linker switch. As with several other linker switches, this can be done using #pragma comment(linker, ...).
  • The Visual C++ 2005 compiler automatically inserts a /manifestdependency switch into .OBJ files that it creates. It marks them as dependent on the Microsoft.VC80.CRT DLL, version 8.0.50727.762. It does this in the VC\include\crtdefs.h file.
  • You can tell it to use the RTM version (8.0.50608.0) of the runtime by defining the _USE_RTM_VERSION macro. See VC\include\crtassem.h. The behaviour of this macro can be confirmed by opening (e.g.) stdafx.obj in a hex editor.
  • This also adds the /include:__forceCRTManifestRTM switch to the linker. I’ve not yet found out what this does.
  • MFC and ATL do something similar in the VC\atlmfc\include\atlassem.h and MFCassem.h files.
  • In order to allow you to merge your own manifest files, the linker is asked to create the project.exe.intermediate.manifest file, using the /MANIFESTFILE switch.
  • This is then fed to the MT.EXE utility, which can be controlled in the project property pages, under “Manifest Tool”. The .intermediate.manifest file is added to the list implicitly.
  • If you add your own .manifest files to the project, these are also added to the MT.EXE command line implicitly.
  • MT.EXE is almost as bad as MIDL when it comes to error messages. If you include an empty or malformed manifest file in your project, it simply reports “general error c101008f: Failed to compile manifest(s). The parameter is incorrect.”. It doesn’t tell you which file or line caused the problem.
  • As an aside, the “No files were found to look in” misfeature still exists in Visual Studio 2005. Press Ctrl+Scroll Lock to fix it.
  • I don’t actually have a copy of the RTM VC80.CRT DLLs on my Windows XP box, anyway. I have versions 8.0.50727.42 and 8.0.50727.762. One of these would appear to correspond to the RTM version of Visual Studio, and the other to SP1. I’m not sure about this, though.
  • These live in the C:\Windows\WinSxS folder. They both have extremely long names. For example, the latest one lives in a folder called x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_6b128700.
  • In the C:\Windows\WinSxS\Policies\x86_policy.8.0.Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_x-ww_77c24773 directory, there’s a couple of policy files. The first one says that any CRT versions between 8.0.41204.256 and 8.0.50608.0 should be redirected to version 8.0.50727.42. Presumably this covers a range containing all of the CTPs and betas up to the RTM version.
  • The second policy file appears to override this by saying that these same versions, and everything from there to 8.0.50727.762 should use the 8.0.50727.762 version.
  • I found the blog of the man responsible. He’s not updated it since 2005 :-(
  • There’s a tool called FUSLOGVW.EXE which is supposed to help diagnose problems with Side-by-Side DLLs.
» read more

qmail STARTTLS is slow

22 Dec 2006 11:01

I’ve recently been struggling to reliably send email via my qmail server. I’ve got STARTTLS and SMTP AUTH enabled, in order to allow relaying for authenticated users. However, it’s been really slow, and Thunderbird quite often times out and gives up on the connection.

» read more

Unable to open Web Project

16 Nov 2006 12:43
Unable to open Web Project 'foo'.
The file path 'C:\wherever\foo' does not correspond to the URL 'http://localhost/foo'.
The two need to map to the same server location.
» read more

Empeg File Structures

13 Feb 2005 10:17 empeg

If you’ve ever gone looking for the music and playlists on your empeg, you’ll find them in the /empeg/fids0 and /empeg/fids1 directories.

» read more

Jam: Linking with System Libraries

4 Jul 2004 07:00 jam

Obviously, your code doesn’t just link with your libraries. It also has to link with some of the system libraries. Jam manages this by using the LINKLIBS variable. The simplest way to make this work is something like the following:

» read more

Getting hold of the current directory in a batch file.

19 May 2004 16:33

A common UNIX shell idiom is to write things like cwd=$(pwd) to save the current directory so that in case be used later when other things might have changed it. For a long time I didn’t think this was possible in Windows batch files. It turns out that it is, but it isn’t pretty and it does generalise to getting the output of any command.

» read more

Handling LVN_GETDISPINFO

19 May 2004 14:24 mfc

If you specify LPSTR_TEXTCALLBACK when inserting an item into a ListView control, it no longer supports sorting; you can’t click on the column heading to sort the list control.

» read more

Partitioning an empeg's Hard Disk Manually

25 Mar 2004 09:20 empeg

If you’re attempting to upgrade the hard disk in your empeg, and the disk builder is not working for you (this is often the case with disks larger than 60Gb), then you might want to build your new disk manually.

» read more

Sent Items: Thunderbird and Outlook Express on the same account

23 Mar 2004 11:46

Outlook Express likes to store a copy of your outgoing email in a folder called “Sent Items”. Thunderbird likes to store a copy of your outgoing email in a folder called “Sent”. If you use both to access the same email account using IMAP, you’ll end up with both folders being created, and your outgoing email will end up in either, depending on which client you used at the time.

» read more

Resource File Dependencies

10 Jan 2004 21:49 jam

Our MFC application has a resource script. This resource script suffers from a minor problem: It’s not dependency-scanned. If we edit any file included by it – for example the .rc2 file, it’s not rebuilt properly.

» read more

Disabling the Cancel button in a Wizard

9 Jan 2004 13:03 mfc

CPropertySheet provides the SetWizardButtons function, allowing you to enable or disable the “Back” or “Next” buttons. It doesn’t, however, allow you to disable the “Cancel” button.

» read more

Conflicting 'lib' target

9 Jan 2004 10:39 jam

empeg’s source tree has a directory called lib, in which the core libraries used by all of our products live. Unfortunately, this conflicts with one of the included pseudo-targets that jam uses.

» read more

Linker Command Line Length

9 Jan 2004 10:37 jam

Jam imposes a hard limit of 996 characters on command lines when built on NT. This limit is higher for other operating systems, and can actually be raised to around 10Kb on Windows 2000. However, it’s still not high enough for some link actions.

» read more

Displaying Progress in a Wizard

8 Jan 2004 18:24 mfc

I’m adding a wizard to the program that I’m currently working on. The wizard walks the user through importing some information from a file. I’d like to be able to display the import progress as a seamless part of the wizard.

» read more

Welcome

7 Jan 2004 19:16

Welcome to differentpla.net, where Roger occasionally posts snippets of code and other stuff that he feels like sharing with the world.

» read more

Using ON_COMMAND_RANGE and ON_UPDATE_COMMAND_UI_RANGE

7 Jul 2003 17:13 mfc

The ON_COMMAND_RANGE and ON_UPDATE_COMMAND_UI_RANGE macros are useful when you want to treat a group of commands similarly. In this case, it’s the commands for changing list view style. The command IDs must be contiguous, and you must specify the lower one first.

» read more

RJ45/UTP Crimps

23 Jun 2003 15:16

(Seen from the bottom of the connector, so that the tab is facing away from you, and the gold pins are facing towards you) Pin 1 is on the left. Pin 8 is on the right.

» read more

Switching Toolbars

15 Apr 2003 11:20

MFC provides support for automatically switching menus when the active MDI child changes. Why doesn’t it automatically switch toolbars?

» read more

Streaming to Winamp

18 Dec 2001 22:44 rio-receiver

Since the Audio Receiver Manager (the server) uses HTTP to stream the MP3 data to the Rio Receiver, it’s possible (with some work) to stream directly to Winamp. Here’s how.

» read more

Advanced Searches in emplode v2.0

25 Oct 2001 19:29 empeg

emplode v2.0 adds the ability to search your music database. It provides two methods of doing this: simple searches (which are hopefully so simple that I won’t explain them here), and advanced searches.

» read more

RPC_X_NULL_REF_POINTER - what?

10 Jul 2001 09:44 com

I just came across a problem where IEnumFoo::Next was returningRPC_X_NULL_REF_POINTER. Of course, the first thing that I did wasundertake a search in MSDN, and with Google to see if I could find anyexplanation of what the problem is.

» read more

Many to One Dependencies

10 Jul 2001 09:44 visual-studio

There are times when you want to have multiple input files in a Visual C++ project configured to generate the same output file. For example, you want to catenate a bunch of files to generate a file to be #included.

» read more

TMC PCI48AF Motherboard

1 Jun 2001 11:41 pci48af pci48af

A while back, I was trying to get a computer built out of some spare parts to run Linux in the corner of the office. However, I had some trouble with random lockups. I think it had something to do with the memory configuration of the motherboard.

» read more

Moving Message Sign

1 Jun 2001 10:41

A couple of weeks ago, we got an LED message board at work. They had them on offer at Maplin (if I recall correctly). Anyway, the manual with the board is singularly useless. It’s labelled “Moving Message Sign”, and has a picture of the display with “Taiwan Kingpul” on it.

» read more

Asus A7V Windows Box

8 Dec 2000 00:01 hardware pc-builds

As mentioned here, my Pentium II-400 got fried by an ocuk power supply. As they say, however: Every cloud has a silver lining. With a dead computer, I could finally persuade my girlfriend that some long-overdue upgrades were necessary.

» read more

Overclockers.co.uk Power Supplies

8 Dec 2000 00:00 hardware pc-builds

I don’t know if there’s something in particular about Overclockers.co.uk, but we’ve not had any good experiences with their power supplies. We’ve had two power supplies from ocuk, and they’ve both gone horribly wrong, and fried a whole shedload of hardware.

» read more