Week Beginning 11th May 2015

I’m running a bit short of time this week and I will be off on holiday for the next two weeks so this may be a short report – or it may not, let’s just see how it goes. I spent the majority of this week working on the Scots Thesaurus project, continuing with the thesaurus plugin for WordPress that I had started last week. I made some really good progress with this. I created facilities to manage category lexemes and imported the lexemes relating to the ‘golf’ categories that have been created so far. Now through the WordPress admin interface when you selected the option to add or edit a thesaurus category you now have a section where you can add or edit (but not delete) category lexemes, including links to the DSL and a field for the source of the word.

I also made a lot of progress with the display of thesaurus data through the WordPress front-end. I implemented the ‘shortcodes’ for browsing up and down the thesaurus, viewing subcategories, displaying words and changing part of speech. Basically all the functionality that is available through the HTE’s ‘browse’ facility is now available through WordPress. It took a little while to get my plugin-specific styles and Javascript to work as you can’t just use the expected directory structure (e.g. you might think ‘../css’ would be a directory called ‘css’ one level up from where you are now but this just doesn’t work – instead you need to use a special WordPress ‘plugins_url()’ function. Similarly, within a Javascript file you can’t just reference images stored in a different directory. Instead you have to use a WordPress function called ‘wp_localize_script’ to tell Javascript where to find other directories.

I also created my first WordPress widget – a little bit of functionality that you can add to a section of the page that will then execute whenever the page loads. I created a widget to display a random thesaurus category, as currently happens on the homepage of the HTE site. I set this up to display in the right-hand column of the page and now it works as intended – linking to a random category and displaying up to 10 of its words.

The main reason for doing all of this WordPress integration was to allow users to post comments on categories so setting this up was my next step. I updated my custom data type to enable comments be default and set WordPress up so that users had to register in order to post comments. So far so good, but at this stage comments were just text and we wanted users to be able to post media such as images and video clips. In order to get this working a made use of a couple of plugins. The first was comment attachment (https://wordpress.org/plugins/comment-attachment/). This allows users to upload files with their comments in a number of formats that you can specify. Uploaded files get added to WordPress’s ‘media’ section and can be approved from there. It works really rather well and also ensures that WordPress attempts to embed the media in the comments rather than just displaying a link to it. E.g. if an MP3 is uploaded then an audio player is displayed rather than just linking to the file.

The next thing I wanted people to be able to do was to embed media that existed elsewhere on the net, for example YouTube clips and images in Flickr. It turns out there is a plugin for that too – oembed in comments (https://wordpress.org/plugins/oembed-in-comments/). When activated if WordPress sees a known URL in a comment (e.g. YouTube) is will display a player rather than just a link.

With all this in place I turned my attention to the visualisations again. I wanted to create some visualisations that nicely represented the hierarchical structure of the thesaurus data and decided d3.js’s ‘Sunburst’ visualisation style might work quite well for this (see http://bl.ocks.org/mbostock/4063423). I found a very nice multi-level, zoomable sunburst visualisation: http://www.jasondavies.com/coffee-wheel/ and decided to attempt to adapt this.

What I’m working on is still very much in development and is currently getting absolutely swamped with the sheer volume of data from the HTE, but I think once I put in some limits on what data gets displayed at each level it could possibly work. When my data loads the visualisation currently looks a mess due to there being too much data (this is all of the main noun categories from 02 ‘the mind’ of the HTE, which is 1278 categories). But once you start drilling down into it, it begins to look a bit better. I can’t really share the visualisation URL yet I’m afraid, but in it if you hover over a segment you can view its title and number in the bottom left, you can click on a segment to zoom in on it and click on the middle circle to zoom back out. Segments are coloured but colours are random at this point. They will eventually use colour and shade to reflect thesaurus section and hierarchical level.

I’m hoping to combine this with the hover-overs, legend and breadcrumb found in this visualisation example: http://bl.ocks.org/kerryrodden/7090426. I’m not sure how best to represent subcategories in the above visualisation style, but eventually it will be possible to switch between part of speech and to open a category to view its words and comments (and post your own comments) through the visualisation interface. Still lots to do though.

Also this week I met with Ger Malcolm from Corporate Communications to discuss the University’s iOS developer account. We’ve agreed that STELLA will take over responsibility for the annual fee associated with this and that I will become the main admin person for the account. It was great to meet Ger face to face after speaking with him by email for so long. With the help of James Matthew the subscription has now been paid so our apps will stay visible on the App Store for another year at least.

I also met with Christine Ferguson this week to talk about the technical side of a project she’s putting together and I received good news from two members of staff about bids that I’d contributed technical expertise to. I can’t go into more detail about these yet, but it’s great that these projects have been funded.

That’s all for now. I will be away for the next two weeks (well, I am working the Wednesday after next but I will be doing so from home as I always do on Wednesdays).  I guess this wasn’t a particularly short report after all!

Week Beginning 4th May 2015

It was a four-day week this week due to the May day holiday. I primarily split these four days between two projects: Essentials of Old English and the Scottish Thesaurus project. Last week I had completed a first version of the ‘app’ version of EOE and had begun work on the ‘web’ version. This week I managed to complete the ‘web’ version too, which can currently be found here:


As mentioned last week, migrating all of the pages and exercises to the University’s page layout presents some difficulties due to having to switch from the JqueryMobile library to something else (in this case a mixture of the University’s existing interface elements and some custom Jquery UI components that I created). Having said that, getting the content to work wasn’t overly tricky as I had already formatted everything for the ‘app’ version in such a way that it would not need to be recoded for use elsewhere. The book content and the exercise content could for the most part simply be ‘plugged in’ to the new interface.

After completing the ‘web’ version I emailed the URL to various people for feedback and Christian got back to me with a list of things that needed looked into. A few of these things were typos and other easy to correct problems, but she also encountered a number of major issues with the exercises. Rather strangely, I was unable to replicate these issues on my own PC, even when trying with a variety of web browsers. After some investigation I realised the issue was being caused by Christian’s work PC still having Internet Explorer version 8 running on it. This version is now very out of date and Microsoft is ending all support for it in January 2016 and I don’t think it’s worth spending time developing a version of the app that works with this browser. Christian asked IT Support to update her PC and everything seems to be ok now.

I spent the rest of the week on Scottish Thesaurus duties. I met with Susan and Magda last week and Susan stated that she would like to be able to demonstrate a front end for the thesaurus at a conference in August. What she wants for the project is a thesaurus that people can search and browse both textually and visually, but also interact with by means of posting comments, images and media clips to thesaurus categories. We decided that the best way to manage any user submitted content would be via WordPress, which means integrating the thesaurus front end with the WordPress interface.

I’ve been meaning to look into developing WordPress plugins for a while now and this seemed like a good opportunity to get to grips with the development of such things, so I spent some time this week researching how to create plugins, or other possible ways of integrating with WordPress.

It turns out that WordPress plugins are pretty easy to set up and mostly consist of your own PHP code plus a number of ‘hooks’ to get what you are doing integrated with the WordPress system and its underlying database. Initially I wanted to keep WordPress and the thesaurus data completely separate and set up a plugin that would allow browsing through the thesaurus database via one page by means of a WordPress shortcode (see http://www.smashingmagazine.com/2012/05/01/wordpress-shortcodes-complete-guide/). I got this to work fairly quickly, with the shortcode on a page resulting in a query to the thesaurus database I’d set up and the display of the appropriate data within a WordPress page. Unfortunately I hit a snag: As far as WordPress was concerned all of the data was being displayed on one single page – my plugin may have been displaying data for a specific thesaurus category but when it came to commenting on the content, WordPress’s commenting system didn’t consider the data displays to be separate pages. Instead, all comments appeared on the data page no matter what data was being displayed.

I realised that I would have to integrate the thesaurus a little more closely with WordPress (well, either that or I’d have to rewrite the WordPress commenting system but that didn’t seem wise). What I decided to develop was a custom post type. This approach means that in addition to standard post types (e.g. ‘blog’, ‘page’), you can create a new type for your data and wordflows. You can create new tables for your data and include new ways of listing or processing the data.

I followed this tutorial: http://blog.teamtreehouse.com/create-your-first-wordpress-custom-post-type and created a type called ‘thesaurus category’. In addition to the standard WordPress information (e.g. title, content) I created a new database table to hold thesaurus specific information (thesaurus category numbers, part of speech, subcategory etc). I could then update the admin interface to provide the necessary boxes for the adding and editing of this information and I could update the ‘list’ view to feature my custom columns too. I could also make my new type appear in the WordPress admin interface as its own left-hand menu item to make it easier for people to manage content.

It took rather longer to get all of this working than the above might suggest, but it was hugely satisfying to see the admin interface updated to enable the management of thesaurus categories. Once this was set up I created a script that migrated the Scottish Thesaurus category data that I previously had access to into my new WordPress integrated table and after running the script the thesaurus data appeared within WordPress and could be edited.

After that I began to look at the front end. I wanted to display the thesaurus data in the front end by means of the handy WordPress shortcodes, but rather than having to add these to the content of each category I figured out how to add them to a template file for my thesaurus category content type. This template file appears within the WordPress ‘theme’ files for the theme that is currently active so we’ll have to watch out if we switch themes. But by adding some simple PHP, such as <?php echo(“<p>”.do_shortcode(‘[thesaurus-browse-up]’).”</p>”); ?> I could access functions in my plugin script, allowing me to handle all of the browsing between thesaurus categories, the display of subcategories and things like that. I’m still in the middle of implementing this at the moment so there is still lots to do (I also haven’t done anything about the words within categories yet either) but it looks like it will be possible to do everything we hoped to be able to do for the thesaurus through the WordPress interface (for example it is now possible to post comments on a specific category).

I will continue with this next week.


Week Beginning 27th April 2015

I spent most of this week continuing with the App version of the old STELLA teaching resource Essentials of Old English and I have now completed the first version of it, which you can currently view here: http://www.arts.gla.ac.uk/stella/apps/eoe/ (note however that this URL may stop working at any time). Pretty much all of the time devoted to the App was spent developing the ‘Plus’ exercises, of which there are 50. In the original resource these were actually split into almost 80 exercises, but I’ve amalgamated some of these for the new App. Most of the exercises followed the same general pattern as the ‘basic’ exercises, which meant I generally just had to extract the content and plug it into the structure I’d already established. I’m using a JSON file to store the exercise contents and this is then pulled into the exercises Javascript file with the appropriate content extracted based on the exercise ID that is passed. This approach works pretty well and it also ensures that new exercise types can be plugged into the code relatively easily. I should really have an ‘exercise type’ field in the JSON file that specifies which bit of logic runs, but for the time being at least this is based on exercise ID instead. Some of the ‘Plus’ exercises were rather different in structure to the ‘Basic’ exercises, but thankfully these had the same sort of structure as some of the exercises I’d previously developed for the ‘Grammar’ app, for example exercises where you have to assign function labels (SPOCA) to phrases or label phrase forms (e.g. Noun Phrase). This meant I could take my existing code and plug it into the new app, a process that was relatively straightforward.

After formatting the questions and answers for all 50 exercises a first version of the app was ready for testing. This version isn’t a proper ‘app’ as such in that it just runs in a web browser rather than being installed on a device, but in terms of functionality it reflects what will be included. I’ve arranged to meet Ger Malcolm, the guy in communications who currently manages the University’s Apple developer account in order to see about STELLA taking over the payment and management of the account. It’s a good time to meet with him firstly because the annual payment to Apple is due soon and secondly because our fourth app is just about ready to launch. I’ll also need to sort out a Google Play developer account so we can release Android versions of all of our apps too.

After completing the EOE app I started working on the ‘web’ version of the resource. For each of the apps I’ve created a version that fits within the University website design and is aimed at people using PCs rather than mobile devices so I needed to make such a version for EOE too. The web versions for the three previous apps I’d created were all still using the slightly older University web layout (the one with the nice big background image down the right hand side of the screen) so I decided to update these three to bring them into line with the current University website. You can view these here:

  1. ARIES: http://www.arts.gla.ac.uk/stella/apps/web/aries/
  2. English Grammar: http://www.arts.gla.ac.uk/stella/apps/web/grammar/
  3. Readings in Early English: http://www.arts.gla.ac.uk/STELLA/apps/web/readings/

As you can probably deduce from the above URLs, the web version of the EOE app will be found here:


I haven’t completed work on this yet though. I’m currently still getting the navigation structure sorted out. Migrating the app to the University layout is slightly tricky in some respects because I can no longer rely on the widgets provided by the Jquerymobile library that I use for the app. In general the logic behind the exercises can all be carried over without a problem but certain things like popups, collapsible sections of the screen and buttons need to be reworked. I hope to get this completed next week.

Other than App stuff I worked on a few other tasks this week. I had a meeting with Susan Rennie and Magda to discuss the Scots Thesaurus project on Thursday. I went through the tool I’d created for managing metaphor categories and showed Magda how it might be used. She is going to send me the data she has worked on since I was last given any and I’ll import this into my system. I also need to start work on some of the front end aspects of the project as Susan is wanting to demonstrate some of this at a conference in August.

I also made a little tweak to the Historical Thesaurus of English this week. Fraser had received a request that we displayed subcategory numbers in the subcategory list within the category page as people sometime wanted to be able to pinpoint a subcategory based on its number. This made total sense and it’s a feature that I wished we had included from the start. Thankfully it was very easy to incorporate the update and the numbers now appear to the right in the subcategory list.

I had a meeting with Craig Lamont, a researcher who is working on a project with Murray Pittock. They have a historical map of Edinburgh that the NLS has made available to them in geocoded format and they are wanting to pin markers on it. Craig didn’t really know how to proceed with this so I met with him, showed him some of the previous work I’d done for the Burns people and we managed to get a mockup working with two markers pinned to it. Craig is now going to go away and compile the data in a spreadsheet and we’ll meet again at some point and think about how to transform this into map markers.

Wendy Anderson contacted me this week with a request to remove a record from the SCOTS Corpus. I’ve never had access to the underlying database for SCOTS, having only worked on the front-end design for the site. This was a good opportunity for me to get access to the database and see how it all fits together. With the help of Chris McGlashan I got access and managed to delete the necessary information. It will be useful to have this access in future.

I also made a couple of small tweaks to the DSL website (well, the development version – we still need to ‘go live’ with a variety of updates).  I added in a ‘cite’ popup to the ‘Scots Language’ page, so that’s task number 4 ticked off our list of things to do.