Week Beginning 14th January 2013

I spent the bulk of this week continuing with the development of ARIES and I’m please to say I have now completed a first draft of both the App and the Web versions, which can currently be accessed at these (temporary) URLs:

App: http://www.arts.gla.ac.uk/STELLA/briantest/aries/

Website: http://www.arts.gla.ac.uk/STELLA/briantest/web/aries/

The rather large and complicated exercise in the ‘Further Punctuation’ section took a fair bit of time to get working properly.  Last week I had just about finished getting the Javascript to work for exercise 1, but the code was really tailored to that particular exercise.  I wanted to make it a bit more general so that I didn’t have to repeat a lot of the same code to handle the second exercise.  In order to do this I moved a lot of the code in to more generic functions, passing the necessary exercise-specific information to these functions when required.  It’s a much more efficient approach and everything is now working for both exercises.

I did a fair bit of testing of the app this week too, tweaking functionality here and there and also improving the design and layout in certain areas.  For example, previously all links had no ‘hover’ or ‘active’ states which meant users didn’t really have any feedback that their link tapping had been noted by the app (until after a few seconds’ delay the required page loaded).  Now that I’ve added an ‘active’ state the links highlight as soon as they’re tapped and stay highlighted until the next page loads, which is much better.  I also improved the automatic page scrolling used in the exercises.  When the user taps a ‘check results’ button the page now nicely scrolls to the ‘results’ section of the page, and in the ‘Further Punctuation’ exercise when the user taps the ‘next stage’ button the page scrolls to the instructions for that stage.

After completing the app I moved onto the web version, which is a University of Glasgow branded ‘T4-esque’ (but not actually T4) website.  As with the ‘Readings’ website, one single template file is used to provide the wrapper round the pages and the contents of each page is held in a ‘fragment’ script that is pulled in whenever the relevant page ID is passed.  The actual content of the pages is about 99% identical to the App version, although some changes have been made to make the pages work better on a computer, using a mouse.  I’ve updated the CSS slightly so that page elements fit in better with T4, and I’ve used Jquery tabs rather than my own tabs in the ‘Basic Punctuation’ section as this is approach looks and behaves a lot better within the T4 design.

The exercises in the Web version use the same Javascript to process the results as the App version, although I also had to tweak these slightly, mainly just so that paths to images worked but also because JqueryMobile automatically prevents the default browser behaviour when links are clicked (e.g. jump to top of page when a ‘#’ link is clicked on) whereas this isn’t the case when operating outside this framework.  I had to stick in a few ‘return false;’ statements at the end of some functions to stop the page jumping about the place.  I also had to update some of the text used as instructions in the exercises as ‘tapping’ needed to become ‘clicking’.

I’ve now tested the versions using Firefox, Chrome and IE in Windows and all appears to be working fine.  I did run into a bit of a problem with (can you guess?) IE to start with, due to IE8 on XP and earlier changing all tags from lower to upper case behind the scenes.  Some of my exercise processing logic was based around the content of buttons, and I was foolishly pulling in and comparing the full HTML contents of the buttons – e.g. <em>.</em>.  As IE8 was converting such tags to <EM>.</EM>  the wrong results were appearing.  Since noticing that I’ve updated the scripts so that the plain text of the buttons is analysed instead, which is a much better approach.

Now that I’ve completed ARIES I will move onto one of the three remaining ‘priority’ applications that need redevelopment – ‘English Grammar’, ‘Essentials of Old English’ and ‘Basics of English Metre’.

For the rest of the week I tackled a few more outstanding items on my ‘to do’ list.  I had an email based chat with Flora regarding her problems migrating the Thesaurus code to the new server.  I gave her a few pointers which I hope will be useful and we might meet up next Thursday for me to have a look at things.  I also looked again at the idea for a tablet version of Bess of Hardwick and emailed Alison to see if there was anything I could do with regards to putting a bid together.  I also contacted Jean to see whether she would like to have a meeting again soon.

I also spent some time towards the end of the week attempting to fix a problem with the Scottish Corpus website that Wendy had emailed me about.  There were some occasions when the text of a document wasn’t being displayed on the page, even though it should have been.  The plain text version was working, and I discovered that the HTML version was also working so long as the user hadn’t come directly from a search.  The reason was that there was a problem with the search phrase highlighting part of the document script.  The script uses regular expressions to find terms to highlight while ignoring things such as punctuation and line breaks.  Unfortunately the function used in the script (preg_replace_callback) breaks when it encounters high-numbered UTF-8 characters and in such cases returns nothing, failing silently.

I spent some time trying to find an alternative to preg_replace_callback, or a way to make this function work with the UTF-8 characters but I’ve not had any success as of yet so for the time being I have updated the script so that if an empty string is returned from the function then the page reverts to displaying the non-highlighted version of the text. It’s not ideal as the highlighting is a really nice feature, but it does mean that highlighting continues to work in all the places it previously worked and any documents that were previously breaking now at least show their text.  I will keep a record of this issue and will try to find an alternative in future.  There is some talk of PHP’s UTF-8 handling being greatly improved in the next major release so that could help things.

I’m pleased to announce that the Christmas chocolate mountain has now been completely flattened, although achieving this Herculean feat did involve eating an entire Chocolate Orange whilst I was working from home on Wednesday, which wasn’t very sensible, or indeed enjoyable for the last few segments at least.

Leave a Reply

Your email address will not be published. Required fields are marked *