Sam's notebook


Not enough photos are taken of the undersides of shop awnings.

This morning I’m at Parlapa, the lovely little caffe opposite the town hall. It’s a good place to be sat, with a slight hangover, with some nice small WordPress code to be working on, and of course with a coffee. The only down side is the fact that the City wifi almost reaches here, so I’ve got the most tantalising of faint signals and so keep trying to connect; I should give that up, and read a book.

I’m re-reading Tolstoy’s Dictaphone, which is a terrific book. But I’ve left it at home, un-terrifically, and so instead am reading Live and Let Live by Catharine Maria Sedgwick. Only read the first two pages so far so I’ve no idea what it’s about, and anyway keep getting distracted by typographical errors (so far, all resulting from the fact that Kobos don’t support small-caps. What a joke!).

Talking of small-caps, there’s movement at the GITenberg station, with a project underway to convert PG books to unicode and to use proper punctuation characters (for quotation marks and dashes, at least). The idea is to use Asciidoc, but there is no standard way to express small-caps. In fact, none of the popular lightweight markup languages seem to have small-caps; what an oversight!

So if I were with a more solid connection, I’d try to run the punctuation-fixing scripts against one of Mr Gissing’s works. Because there’s something nicer about working on books as stand-alone Git repositories, rather than in the mammoth universe of Wikisource and the WMF. A feeling that one is producing single editions, and perhaps a number of different formats for each — and is able to give each its due attention. The wikitext-as-source-format paradigm gets a bit tiring sometimes, because although the HTML output is great, and that makes for good ebooks (well, Kobo and its small-caps-ignorance aside), I’d really like to be able to produce printable (and thus bindable) output as well. Say, via LaTeX. And maybe Asciidoc is one way of doing that.

Really, the main thing that PG is missing (and GITenberg, although it’s probably easier to rectify there) is the ability to confer with the original source scans.

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

Required modules: ldap_feeds, ldap_query, feeds, …

  1. Add desired fields to user accounts.
  2. Create an LDAP query that fetches the relevant attributes.
  3. Create a feeds importer:
    • Fetcher: “LDAP Query Fetcher”
    • Parser: “LDAP Entry Parser for Feeds”
    • Processor: “User processor”

[19 comments] [Keywords: , ] [Permanent link]

Pear_Exception makes it to a stable v1.0.0 after 11 years!

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

Not sure why, but earlier this morning I thought it’d be fun to revisit some ancient code of mine, in the form of the Bookkeeping plugin for WordPress. So I’ve brought it (more or less) up to date and released a new beta version.

[One comment] [Keywords: , , ] [Permanent link]

Just tried the new cafe that’s opened at the shops near the corner of Winterfold Road and Carrington Street. It’s far nicer than I was expecting! Not that a suburban shopping centre should be expected to produce boring cafes, it’s just that they rather often do. :-)

It was a nice place to sit outside, the tables are nothing unusual (the chairs weigh a ton), and they weren’t playing the radio but rather had chosen what music to inflict on people — with good results. And the coffee was terrific.

Updated: I got the name wrong earlier; it’s not got a space in it.

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

Three feeds are gone from Planet Freo. Only two of the sites are kaput though; the SFFC still has a site, but they’ve ditched the feed (not on purpose, I’d say, because they’ve still got an icon for it on their homepage).

  1. South Fremantle Football Club
  2. FreOasis
  3. Fremantle Carnevale

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

Sorry to everyone who noticed; Planet Freo‘s been offline for 48 hours. I thought I needed access to my home machine to fix it; turns out I didn’t, but anyway I waited till I was home (and powered by a dram of Ardmore) to fix it. It is now fixed.

I’ve updated the FreoWiki page that lists the feeds (if anyone’s keeping track of who’s been censured).

Anyone know of other blogs that should be on the list? Let me know!

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

Fremantle Reform has been added to Planet Freo.

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

Views are included in modules by implementing hook_views_api() and hook_views_default_views() and returning an array of view objects from the latter.

The easiest way to construct the view object is to create the desired view via the UI and then export it, saving each exported view into its own function in sites/all/modules/custom/modulename/ and then returning them all in modulename_views_default_views() in the same file (named e.g. _modulename_views_view_name()). For example:

 * Implements hook_views_default_views().
function worksmanagement_views_default_views() {
  return array(
    'work_orders' => _worksmanagement_views_work_orders(),
    'job_reports' => _worksmanagement_views_job_reports(),

All of which is good, and works well. (Why not use Features for this, which more or less does exactly the same thing? Not sure; probably stubbornness. That doesn’t matter for now though.) The confusion comes with updating the exported views.

When a view is created, its definition lives in the views_view and views_display database tables. Once the view has been exported and saved into the module, its definition is stored in two places! This can be seen in the Views admin screen, where (once the caches have been cleared) the view is shown as “Database overriding code” rather than “In database”. There will also no longer be an option of deleting it; rather, it can be reverted. Reverting a view will delete its metadata from the two DB tables, and it will be defined exclusively from the module’s code. This is good.

The next step is to edit the view, make some changes, and re-export it. Do not save it! There is no need to save the changes you make (as this would then stick it back into the database and you’d just have to revert it again), but rather just use the export function available from the view editing UI under the edit view name/description menu (see screenshot below). This will export the view as it stands (i.e. in its unsaved, editing state).

Screenshot of View export menu item

After exporting and overwriting the code in _modulename_views_view_name(), clearing the cache is all that’s required to make the view active and update to date with what’s in the module’s code.

Note that the view will be locked for editing; hit ‘cancel’ to unlock it, or break the lock when prompted when next editing the view.

(This is why I don’t want to use Features for this: it feels better to have everything living in the module, rather than having to copy (or ‘revert’ as Features calls it) view definitions from the module into the database.)

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

I wanted to be able to browse validated works on Wikisource by category, rather than just alphabetically, so I cobbled together this:

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