My coffee mug

Hello world, and welcome to my corner of the web. This is where I write words about what I'm working on, and post photographs of things I've seen.

I'm a Software Engineer at the Wikimedia Foundation, and so of course my personal website is a wiki (running on MediaWiki). In my spare time I volunteer with WikiClubWest to work on Wikimedia projects, mostly around my family's genealogy and local Western Australian history (especially to do with Fremantle). I try to keep up with issues on all the things I maintain (but usually fail).

I also try to find time to work in my workshop on various woodworking projects. Recently, that's been focused on restoring a chest of drawers and building a metalworking bench.

Travel features in my life, not because I really hugely want to go elsewhere but because I just do — and also because then I can do some more interesting mapping on OpenStreetMap.

I'm currently reading the following: Fathers of Men (E. W. Hornung, 1912), and Perth (David Whish-Wilson, 2013), and The Nether World (George Gissing, 1889), and The Railway Adventures (Geoff Marshall; Vicki Pipe, 2018).

To contact me, you can email me or find me on the Freenode IRC network (as 'samwilson'). If you want to leave a comment on this site (by creating an account), you need to know the secret code Tuart (it's not very secret, but seems to be confusing enough for most spammers).

Nearly holiday time


Only one more day of work till a week off (thanks to Easter and Anzac day). That's a nice thing. I'm attempting to get some SVG Translate bugs finished off (I mean... finish off fixing them) and hopefully get up a patch I've got nearly done for TemplateWizard's tests. That latter will probably not happen, because I'm bamboozled by the job-runner not running all jobs, which means that the test's templatedata isn't available to the subsequent testing code. Not sure why.

Chair on the lawn

University of Western Australia

Is there a better use of a hot Saturday afternoon than to sit with a good book on a comfy chair in the shade on a lawn?

Under construction blogs

This comment at the bottom of this post made me laugh:

(I wanted to post this on my Infodisiac.com blog, but that blog it is out of order at the moment, so I’ll upload it as html page). Feel free to comment at my post on Facebook.

It's always the way of the indieweb that one's site is somewhat out of order, but it's also the fun of it, and something of a relief to get away from the overly-managed and always-corporately-polished social media sites.

I don't like mocking

San Francisco

When starting out on adding something new to a project that one is not intimately familiar with (or even on one with which one is), the first thing is to write the description of some small test. Just a sentence or two about what is to be tested and why the expected results are what they are. The test doesn't have to do much, or even be very unique, but it should start from nothing and build up whatever is required. For this reason, I often find integration tests to be much easier to write and to keep within the conceptual model of the system.

The thing with mocked components is that they assume you know enough about what those components do to construct their output manually, and often that's not the case. So, I resort to the full real components quite often in tests, with the only downside being the speed of tests.

Options should NOT have additional properties

San Francisco

I'm getting this error when compiling SVG Translate's assets with Webpack:

error  in ./assets/app.less

Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/css-loader/dist/cjs.js):
ValidationError: CSS Loader Invalid Options

options should NOT have additional properties

It's come about due to trying to upgrade to css-loader version 2.1.

If I comment out all the assets in webpack.config.js, the error goes away, and comes back when I only include assets/app.less (I didn't try to narrow it down to any other files; one example should be enough).

It sounds like the options for css-loader have changed. If I dump the config for that module, I get this:

    loader: 'css-loader',
    options: { minimize: true, sourceMap: false, importLoaders: 0 }

It seems that minimize and sourceMap are not valid options; the first was removed in version 1.0.0 (which I guess SVG Translate wasn't using), and I'm not sure about the second. I'm not sure where they're coming from, I guess some Encore config somewhere; certainly it's not in SVG Translate's config.

What if I just delete them?

	delete module.exports.module.rules[1].use[1].options.minimize;
	delete module.exports.module.rules[1].use[1].options.sourceMap;

Nope, no good; same error. Oh, of course: because that's being done after the loader is being used. What if the css-loader is configured manually, earlier?

		.configureCssLoader(function ( options ) {
			delete options.minimize;
			delete options.sourceMap;
			return options;
		} )

Yup! That works. Does it work when all the other asset files are uncommented? No:

error  in ./node_modules/oojs-ui/dist/oojs-ui-wikimediaui.css

Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleParseError: Module parse failed: Maximum call stack size exceeded
You may need an appropriate loader to handle this file type.
RangeError: Maximum call stack size exceeded

If we switch to an already minified version of node_modules/oojs-ui/dist/oojs-ui-wikimediaui.css? Yes!!

So maybe things are okay now? This feels like a reasonably ugly fix, but if it works then I'm happy for now.

The result is here: https://github.com/wikimedia/svgtranslate/pull/45

Categories: SVG Translate · programming · Webpack · CSS · Symfony · Encore ·

Blue Bottle


I'm sitting in another Blue Bottle cafe, this time in Berkeley. These are nice places. Slightly stark, with the plywood-concrete-whiteplastic thing, but the acoustics seem fine and the tables are a good height at which to code. The coffee isn't as good as I had the other day; I'm still on the search for a decently over-roasted moka pot brew; this is as good as I've had though. I don't see why they can't serve a cup with a saucer though—I understand not having napkins, that's a good idea, but without either all I'm left with is a drippy coffee splash on the bench here.

I'm working on my silly little Log404 MediaWiki extension this morning, because I want to be able to retire my WordPress installation and do everything here in the wiki. So far, it's recording, reporting, redirecting, and deleting not-found pages, but I need it to handle redirects better and it seems there's some better way to work with query strings of the log entries. It should also be able to ignore 404s. I'm giving up for the time being on catching 'found' not-found pages such as example.org/?foo=123 which as things stand just redirects to the Main Page and is not considered a missing page. If one were migrating from a system that treated that as its own page, things wouldn't work. Perhaps it'll be enough to check for unknown query string parameters only for Main Page (because I don't suppose we should be doing it on load of every page in the wiki). That can all wait; at least so far it's going to be possible to catch e.g. example.org/2018/12/29/foo and quickly redirect it to Foo or wherever.

Does it need to store both the 404 page name and the whole query string, given that the latter always contains the title attribute? It might not be, but it might be easier to query this way... oh, and actually, given that the page title is the only thing we can redirect (i.e /Bar and /Bar?foo=123 can't be handled separately) it probably does make sense. Why then are we including the query string?

Categories: PHP · MediaWiki · coffee · Blue Bottle · cafes · Berkeley · redirects · 404 · logging ·

Building WordPress assets

Today I was just finally getting around to (maybe) updating my WordPress theme, and couldn’t for the life of me remember what the deal was with the new Node-based build system. So I went looking, only to find this posted on the Core blog today:

In May 2018 we’ve introduced a build step to WordPress core development as preparation to WordPress 5.0. While these changes never ended up in 5.0, the idea was to reorganize the way the JavaScript in WordPress is managed and structured so that it would be easier to include Gutenberg.

Since then, it was no longer possible to run WordPress from the src folder. This gave some issues, especially with developing WordPress core PHP. Today, @atimmer committed a patch which allows developers to build into src again.

So I do still have to build the assets, but it seems that PHP development can once again happen from the normal directory.

Maybe it’s a good thing that I’ve neglected WP development this last year or so?

Categories: Programming · assets · build scripts · development · wordpress ·

In a café in Berkeley


Is the internet a good place to start typing random thoughts? It feels like it’s probably not, because of all the “taken out of context”, “recalled in future years and laughed at”, and “what’s the point no one will see it” responses. But it also feels like random beginnings and unplanned words are the only things that will ever lead to more coherent and useful words, and that putting them out in the great wash of the online world is slightly better than hiding them away in a notebook in my own bottom drawer. I do write lots and lots of words that only I will ever see, and they’re usually pretty unpolished. I don’t think that what I put on this blog or Twitter or anywhere else is particularly good, but I do at least attempt to finish sentences and thoughts, and fix typos. Maybe that’s all I mean: that uploading ideas makes the brain follow through and express them, and in doing that there’s a surprising amount of satisfaction.

Categories: writing · recording ·

Retrieved from ‘https://samwilson.id.au/index.php?title=Welcome&oldid=2463