Sam Wilson's Journal


Photo of the Queen's portrait.A terrific dinner last night at Villa Roma for the Fremantle History Society. Larry Foley spoke about his life growing up in Fremantle and working in the wool trade here and all over WA. The food was great, and it was nice to meet some new people and enjoy the general vibe of the Society.

Before the dinner, I popped in to the Workers’ Club garage sale. It was over, but Don was good enough to share a beer with me and indulge my wish to explore the cellar — which is where the portrait at left came from. It’s now got pride of place in my pile-of-things-to-be-hung-on-the-wall. Maybe.

These old clubs all used to have portraits of the Queen, it seems. The North Freo Bowls club’s is still hanging. Some Scout halls keep theirs on the wall too. Allegiance to Empire and all that bollocks, I guess; I’m not keeping this in adherance that same spirit, but just because it’s odd to remember that people used to think this sort of thing was important.

[No comments] [Keywords: , , , , , ] [Permanent link] [56 views]

I’m getting and annoying error when running reverting a Feature (drush fr featurename):

/var/www/$ drush fr featurename
Fatal error: __clone method called on non-object in /var/www/ on line 55
Drush command terminated abnormally due to an unrecoverable error.
Error: __clone method called on non-object in /var/www/, line 55

It looks like this bug was fixed 2 September 2014 and is tagged as being fixed in 7.x-2.4 … but that version was released on 15 July.

[Update:] Ah. A coffee later, and I realise my stupidity this morning — the bug is tagged as being in 7.x-2.4, not fixed in that version. Gosh, one shouldn’t post before coffee!

I apply the patch manually.

[No comments] [Keywords: , , , , ] [Permanent link] [47 views]

The Features module is great. I think. Sometimes it seems too good to be true… usually it just is good though.

One can build a site in one’s local Drupal installation, and then piece by piece export its definition to a feature module that can be put under version control and deployed to other sites in one fell swoop. Start with:

drush fe --version-set=7.x-0.1 --destination=sites/all/modules/custom/featurename featurename components

where featurename is the new module’s name and components is the first thing to export (usually a content type). From then, the destination can be left out, and the components definition is also pretty flexible at making it quicker to select which components to export (naming contentions, such as common prefixes, help with this). So, as the site progresses, export new components to the feature:

drush fe --version-increment featurename components

If a component that’s already been exported needs to be changed, just change it and then update the feature with:

drush fu --version-increment featurename

That’s about all there is to the construction phase. Stick the sites/all/modules/custom/featurename directory into a VCS. Then it’s deployment time…

Check the featurename module out to the staging site (in the custom directory still, just for clarity’s sake) and enable the module:

drush en featurename

That only needs to be done the first time; subsequent updates are just cycles of updating the code and reverting the feature (a note on the slightly-confusing terminology of Features: one reverts (fr) the site, or updates (fu) the code).

$ git pull origin master
$ drush fr featurename

[No comments] [Keywords: , , , , , ] [Permanent link] [64 views]

Very often one wants to add a link to a View’s header or footer that allows users with permission to quickly jump to the relevant content creation form.

It’s easy to create a Global: Text area with the link, but this would then be seen by all users, regardless of authorization.

A few people have had similar thoughts.

I don’t know if there’s a better way (i.e. probably one that doesn’t involve PHP, not because this is a particularly complicated way of doing things but just that I always figure that Drupal should be usable by non-coders), but here’s how I’ve got it working:—

Required modules: views, views_ui, and php.

Add a Global: Text area header to a view, and select the PHP code text format for it. The code is as follows:

<?php if (user_access('create article content')): ?>
<a href="<?=url('node/add/article')?>" class="btn btn-default">Add new article</a>
<?php endif ?>

[No comments] [Keywords: , , ] [Permanent link] [104 views]

tl;dr: Drupal is good with the Video and Flowplayer modules. Install them with drush -y en video flowplayer and just make sure you’re testing with a video file that isn’t broken!

I’m trying to create a very simple video library in Drupal. Just a single Content Type with a bunch of fields, one of which should be for uploading a video.

The Video module looks to be the first choice. It creates a field type, and sets up a system for re-encoding. Sensible.

So I install it: drush -y en video

Then set up a transcoder by installing FFmpeg and telling Drupal where to find it. Also a Preset, which groups together output details like file extension, codec, sizes, and a bunch of other details—most of which I left as given.

Probably silly, as when I try to upload an MP4 (one of these) I get: “The video conversion process has failed. You might want to submit a simpler video format like mpeg or divx avi.” So why can’t I just upload a simple mpeg and have it displayed without being re-encoded?

The video field settings have an option, “Enable auto video conversion”, which I turn off. This works: I can upload the MP4 and it’s thumbnail is displayed at a nice size and things sort of start to look like a video player… but sadly emblazoned with “No video with supported format and MIME type found.” Oh well, maybe a different player is needed (I was relying on the standard HTML5 player).

Installing the Flowplayer module helps a bit: now there’s a video player with controls and a spinning loader—but the same MIME type error as before. Switching the MP4 player to ‘FLV Flash Players’ (from ‘HTML5 Player’) is a bit great: now there is a player, and it plays the file… audio only though, no video.

I tried another video though, and all works correctly! So that’s nice.

[No comments] [Keywords: , , ] [Permanent link] [88 views]

The Freo Farm website has gone off the air, it would seem. is now an empty blog called Marginal Field.

[One comment] [Keywords: , , , , ] [Permanent link] [1,071 views]

I’m doing a bit of proofreading of the first volume of the first edition of Emma, and I’ve just realised that there are more punctuation errors than I’d thought were likely. I’m slowing down now and taking more care.

[2 comments] [Keywords: , , , ] [Permanent link] [227 views]

This is a project that I’ve wanted for years, and now it’s here:

Project GITenberg is a Free and Open, Collaborative, Trackable and Scriptable digital library. It leverages the power of the Git version control system and the collaborative potential of Github to make books more open.

40,000 Project Gutenberg books have been uploaded to GitHub, and can now be forked, fixed, and fed back to the world’s biggest library of public domain ebooks. Other alliteration is also possible.

I’ve just sent my first pull request, for a typo I found in Gissing’s The Paying Guest.

The only thing lacking now is the original scans of these books, so that the ebooks can be verified against the source.

[2 comments] [Keywords: , , , , ] [Permanent link] [1,055 views]

WikiTeam has released an update of the chronological archive of all Wikimedia Commons files, up to 2013. Now ~34 TB in total.

Just seed one or more of these torrents (typically 20-40 GB) and you’ll be like a brick in the Library of Alexandria (or something), doing your bit for permanent preservation of this massive archive.

From this post to wikimedia-l.

[2 comments] [Keywords: , , , , ] [Permanent link] [2,958 views]

I’ve just been tinkering with writing a new Dokuwiki plugin that I’ve wanted for a while: log404. It logs all not-found page hits (as in, HTTP status 404 Not Found), and gives an admin page for viewing (and deleting) them. Soon to come is a way to add a not-found page ID to the redirect plugin’s list of redirects. That’ll be about all the thing shall do. Oh, and keep a list of 404s to ignore. And have a nicer-looking admin page! That’s all…

I’ve not created a page on yet ( because it’s not finished enough yet.

I have, however, added it to Travis CI—the first thing I’ve done that with. It’s jolly nice having a little green badge in the readme!

Right then. Friday arvo—time to get a beer.

[2 comments] [Keywords: , , , , , , ] [Permanent link] [1,351 views]