A Good Review II

Here’s another nice review, written for me by Andrew Moore. To the general public, Andrew may be known for recent features such as Evidently Cochrane’s “Paracetamol: widely used and largely ineffective” and (with Nicholas Moore) the European Journal of Hospital Pharmacy‘s “Paracetamol and pain: the kiloton problem”. But these are just the tip of a research iceberg representing more than 40 years, 500 scientific and clinical publications, 200 systematic reviews, 100 Cochrane reviews, and a number of books on evidence-based medicine and pain. I was introduced to Andrew at the Oxford Pain Research Group in 2008, and have since helped him with many data analyses; and with his colleague Sebastian Straube, wrote about this work for Dr Dobbs in our post “Trials and tribulations: measuring drug efficacy in clinical trials, plotting graphs in Java with gnuplot, and reading Excel with JExcelAPI”. That was in Java, but I’ve done our more recent work in R, because of its conciseness and the huge number of library functions available for reading, reformatting, analysing and writing such data. And I’ve also hosted his Bandolier evidence-based medicine website. The text below is Andrew’s.

The spreadsheet is a terrific boon for science and medicine. It allows huge amounts of information to be processed and analysed.

And that is fine when you are following a well known process, down a road well-travelled.

But the cutting edge of science and medicine is, by definition, off that road. Being at the front involves asking awkward questions — those for which there are no answers or processes.

Now large spreadsheets can be the barrier, because transforming them from something designed for one purpose into something useful for a different purpose is hard and fraught with potential error.

That’s where Jocelyn can help — helping researchers make better use of the tools they have to answer questions they didn’t think they could answer.

The three examples below come from clinical trials in acute and chronic pain, where analysis at the level of the individual patient allowed better insights into trial design and patient benefit.

The following papers used or were inspired by Jocelyn’s data analyses:

  • Validating speed of onset as a key component of good analgesic response in acute pain.
    Moore RA, Derry S, Straube S, Ireson-Paine J, Wiffen PJ.
    Eur J Pain. 2015 Feb;19(2):187-92. doi: 10.1002/ejp.536.

  • Faster, higher, stronger? Evidence for formulation and efficacy for ibuprofen in acute pain.
    Moore RA, Derry S, Straube S, Ireson-Paine J, Wiffen PJ.
    Pain. 2014 Jan;155(1):14-21. doi: 10.1016/j.pain.2013.08.013

  • Interference with work in fibromyalgia: effect of treatment with pregabalin and relation to pain response.
    Straube S, Moore RA, Paine J, Derry S, Phillips CJ, Hallier E, McQuay HJ.
    BMC Musculoskelet Disord. 2011 Jun 3;12:125. doi: 10.1186/1471-2474-12-125.

  • Minimum efficacy criteria for comparisons between treatments using individual patient meta-analysis of acute pain trials: examples of etoricoxib, paracetamol, ibuprofen, and ibuprofen/paracetamol combinations after third molar extraction.
    Moore RA, Straube S, Paine J, Derry S, McQuay HJ.
    Pain. 2011 May;152(5):982-9. doi: 10.1016/j.pain.2010.11.030.

  • Pregabalin in fibromyalgia–responder analysis from individual patient data.
    Straube S, Derry S, Moore RA, Paine J, McQuay HJ.
    BMC Musculoskelet Disord. 2010 Jul 5;11:150. doi: 10.1186/1471-2474-11-150.

  • Fibromyalgia: Moderate and substantial pain intensity reduction predicts improvement in other outcomes and substantial quality of life gain.
    Moore RA, Straube S, Paine J, Phillips CJ, Derry S, McQuay HJ.
    Pain. 2010 May;149(2):360-4. doi: 10.1016/j.pain.2010.02.039.

How to List Blog Posts from outside WordPress

On my website, I’ve got two kinds of page. One kind is like my home page: coded directly as HTML. These pages are static, in that they are files which never change unless I edit them. The other kind of page belongs to this blog. These pages are implemented in WordPress, and are dynamic. When your browser asks for a WordPress page, it sends a web address to my server. The server looks for a PHP script at that address and runs it, and the script decides what HTML to send there and then, based on the contents of WordPress’s database. A good example is the page at http://www.j-paine.org/blog/ which lists my blog posts. But what should I do if I want to list my these posts outside WordPress, for example on my home page? There’s an answer at “How to display recent posts outside WordPress” by Paul Green.

It’s the same kind of problem that I solved in “How to Run PHP under WordPress with Justyn’s Magic Includer”. There, I needed to stand outside WordPress and run a script that added information to its database about the names and times and venues of a teacher’s classes, so that they could be displayed by the Promenade theme. Here, I need to stand outside it and run a script that loops through the database returning the text of each and every blog post. In both cases, the scripts need to know where to find the WordPress functions they must call to do the job. In terms of the analogy I used in my Justyn’s Magic Includer post, I need to tell my scripts that to find the WordPress tools, they’ll have to rummage around behind that pile of motorbike spares at the back of my garage.

Here’s a demonstration. The script is below, a shortened version of the one in Paul Green’s post, and also similar to the “Standard Loop” examples in “Class Reference/WP Query” from the authoritative WordPress Codex. You can see what its output looks like by going to http://www.j-paine.org/blog/demos/posts_demo.php.


/* posts_demo.php */

A simple script that demonstrates
looping through blog posts and
displaying each one.

require( $_SERVER['DOCUMENT_ROOT'] . '/blog/wp-load.php' ); 

$args = array( 'posts_per_page' => -1 );
$latest_posts = new WP_Query( $args ); 	

while ( $latest_posts->have_posts() ) {
  echo "<BR>\n";
  the_time( 'l jS F, Y' ); 
  echo "<BR>\n";
  echo "<BR><BR>\n";




A Good Review

Here’s a very nice review one of my customers sent. His site is still confidential, so I can’t show it here, but I can say that the WordPress theme he was talking about is a premium theme that works with WP Job Manager. The rest of the text below is his.

Like the majority of business owners, the idea of creating a website can be like stepping off a plane in a busy unfamiliar city where no one speaks your language. You have to trust that someone will understand your basic attempts at communication or you’ll end up spending money on something that you didn’t ask for. Having had a bad experience with a web developer in the past, I decided to purchase a WordPress template so that I could chose the basic functions, look and feel of the site from the outset.

I wrote a brief for Jocelyn in layman’s terms and I was very impressed to see an email in my inbox with a decoded brief from Jocelyn with questions regarding how to tackle some of the shortcoming of the template.

The template needed quite extensive editing in areas and it was clear that Jocelyn had understood exactly what we needed from the site. The users would need to spend time entering information into a database and it was crucial that this process was easy and simple to navigate. Jocelyn’s interpretation of our brief was excellent. Jocelyn integrated a number of plugins, which prevented the need to code custom scripts saving me money. Jocelyn also created a login feature which prevents the website from loading until a registered username and password had been entered.

Jocelyn integrated our logos, colour scheme, graphics and text in a very attractive and well-considered manner linking nicely with the overall look and feel of the site. He also helped us move our domains to our host server, uploaded the site and thoroughly tested the site before he handed it over. I have been very impressed with the time Jocelyn takes to clearly explain what he is doing and when he encounters a problem and needs input from myself. We have asked Jocelyn to manage our site for us which is testament to our trust and confidence in his ability.

Thanks again Jocelyn!

How to Remove Mumbo Jumbo from Google’s Search Result Links

Here’s a useful website for overcoming a defect in Google: IndustryStandardSoftware.com’s Google Result Link Converter. It solves the problem that copying links from a page of search results is harder than it needs to be. For example, here are the first few results for “Oxford world class city”.
Screenshot of Google search results for 'Oxford world class city' These are long links, and Google has shortened the link text below the titles by replacing parts of it with ellipses. So copying and pasting this text won’t work.

Most people would probably mouse over the title, right-click, and select “Copy Link Location” (or the equivalent in whichever browser they’re using) from the resulting menu:
Screenshot of Google search results for 'Oxford world class city' plus link-handling menu
But when you do that, you get a bloated monster full of Google mumbo jumbo:

Another method, which works most of the time on my system, is to open the link in a browser and copy from the browser’s address bar. The Google link redirects the browser to the original page, and its URL then appears in the address bar. But that doesn’t always work if the file is a PDF. When I tried it on the results above, it did with the second search result, but not with the first. Instead of displaying the page, the browser invited me to either download or open it with a program. When I did the latter, it opened in a PDF viewer which displayed the URL as a title, but didn’t give me a way to copy it.

But, yesterday I searched about this problem and found IndustryStandardSoftware.com’s link converter:
Screenshot of IndustryStandardSoftware.com Google Result Link Converter
And it works. I was able to paste those monstrous PDF links into it and get back their original URLs.

Johnnie Walker’s blog Eat My Business has a post about this: Online Tools to Convert those Long Google Search Engine Results Links Back to Normal Links. As well as the Link Converter, he references a Stack Exchange discussion about the problem, and a script for the Greasemonkey add-on for Firefox. This is probably out of date though, looking at the comments about it. He also says that the links appear when you’re logged in to a Google account, but for me, they happen all the time.

Happy Hosting with Mythic Beasts

This post is a plug for the company who host my website, Mythic Beasts. My site has been around for a long time, and has accumulated not only research papers, lecture notes, essays, and free programs, but even a recipe book and a tribute to the Excelsior café. It also has an assortment of interactive demonstrations.

Some of these date from when I used to teach Artificial Intelligence at Oxford. There’s a game called Traveller, which follows the fortunes of a robot lorry-driver around a road network full of shops. The driver has to earn money for petrol by buying and selling goods, but must beware because some goods go off, some break if driven too fast, some are bulky and make no profit to speak of, and some are so high value that it’s very difficult to afford them. In addition, the driver must be careful not to get trapped in loops, or in desert areas devoid of shops or garages.
Traveller game board as seen in browser

Another, simpler, demonstration is a small science-fiction plot generator.
Output from plot generator as seen in browserThat particular line reflects a famous story by Damon Knight, “To Serve Man”.

For these to work, my site needs to be able to run so-called “scripting languages” such as PHP and Python. Those do the work of receiving and decoding input when forms are submitted; and, at the other end, assembling output into web pages and sending it back to the browser. In the middle, there’s probably a program written in the programming language I taught in my courses, namely Prolog.

My site also runs WordPress, because this blog is written in it. That needs PHP, and it also needs a database called MySQL. That’s where WordPress stores things like the text and titles of pages and blog posts. So, it’s very useful that I can do all these at Mythic Beasts. And that’s why in 2012 I wrote the following review at OCHostReview.co.uk:

I’m very pleased with Mythic Beasts. They’ve been hosting my site since 2003 or so. I’ve got lots of static pages, as well as PHP and Python scripts (some of which run Prolog and other languages), MySQL, WordPress, and probably a few other things. One of my more complicated scripts demonstrates a branch of maths called category theory. This runs SWI-Prolog from PHP, in order to read mathematical structures typed into a form by the user, calculate with them, and display the results as text and as graphs, the latter generated by running a program called GraphViz. Another script, in Python, generates spreadsheets from textual specifications, and feeds the results into Google’s online spreadsheet. These run on my server without any problem. When I’ve needed help, Mythic Beasts have given it quickly.

Other users have written good reviews too: at Host Review, and at SiteGeek. There’s also a New Year 2014 post from an extremely satisfied RasPi.TV (“Raspberry Pi Tutorials, Videos & Reviews”) about “New Year, New Server at Mythic Beasts”.

Over the past few months, I’ve hosted sites for a number of new users at Mythic Beasts. They include an artist, a yoga teacher, a pain researcher running an evidence-based medicine site, an exchange business, and a builder. I think they’re all satisfied too. Here are links to some relevant pages: hosting, domain transfers, PHP, MySQL, installing WordPress, WordPress managed for you.

How to Use Web Pages as Outlining Tools V

(Continued from How to Use Web Pages as Outlining Tools IV.)

To do this, I coded an outline as a list of lists, using HTML <ul> elements. This gave me a bulleted list of bulleted lists, where each list item was a topic such as “A bit of our history” or “New Vehicle Appeal”.

I then followed each topic by the HTML needed to implement Simple-expand’s expand/collapse control. Like this:

   <a class="expander" href="#">Celia</a>
    <div class="content">
        Celia (72) retired as a post lady a couple 
        of years ago and leads a very active life 
        even despite now being retired. Celia 
        drives for us one day a week which she really 
        enjoys as it gets her meeting different people 
        and of course being a post lady she knows 
        where places are.
As the Simple-expand website explains, you need an element to use as the control, and an element that contains the content. The latter must have class content.

I also had to include a stylesheet and some JavaScript in the page. This follows the same kind of pattern as in “How to Generate Random Quotes in JavaScript”. The stylesheet was loaded by a reference in the head of the page,

<link rel=stylesheet href="expander.css" type="text/css">

The JavaScript includes a reference to the jQuery library, downloaded from Google Hosted Libraries. There’s a reference to the code file itself, simple-expand.js. And there’s an initialisation call. As with the random-quote generator, this calls the expand/collapse setup code, but in a way that ensures all the HTML it operates on has been loaded first. The setup call also links the code to elements with class expander, meaning that it will treat these as the controls.

<script type="text/javascript">

<script type="text/javascript">
<script type="text/javascript">
  $( function () {

The result was “What Other Community-Transport Sites are Doing, Especially about Volunteers and Funding”. This is it with all topics collapsed:
Screenshot of 'What Others are Doing' page with all topics collapsed

And here it is with a few topics expanded:
Screenshot of 'What Others are Doing' page with some topics expanded

How to Use Web Pages as Outlining Tools IV

(Continued from How to Use Web Pages as Outlining Tools III.)

The trouble with Word is well expressed in author Charlie Stross’s blog post “Writing tools”. He explains why Word is not ideal for writing his science-fiction books, and why it’s bad even for other tasks. Later on in the discussion, commenter Alex writes:

My partner is nontechnical and constantly has to deal with collaboratively edited, heavily formatted MSWord documents in academia, and it’s truly astonishing the degree of pain involved. Not only would a version control system help (although, vertrol is a bit like These People Just Need A Honky – everyone who does it thinks it’s the solution to everyone else’s problems), but MS Word is just so painful. It’s riddled with some of the worst usability antipatterns you can imagine, especially that it tends to change things because it’s designed to assume that you should want them. And it’s hellishly implicit; you can’t just hit the right keystroke command and remove the bloody annoying spare section break. You often can remove one of those graphically, but not always.

That’s my experience exactly, and I’m glad to know it wasn’t just me being careless.

Later still, commenter Andrew G says:

Back in my first year of college I forgot how to use Word. I had been spending a lot of time teaching myself HTML, and working on web pages, and hadn’t written anything in a regular word editor for a while.

Then I had to write a paper in class, and at the last minute realized I couldn’t remember how to format text the way I wanted.

So I pasted the whole thing to notepad, added in the HTML formatting, and displayed it in a web browser before printing it for class.

I agree with Andrew G. When I’ve needed to make posters, or letters, or slides, I’ve often chosen HTML rather than Word. Suppose I want to make an unordered list. I know that I have to type:

  <li>first item</li>
  <li>second item</li>
  <li>third item</li>
I can see exactly where the list items begin and end, and I have confidence that my web browser will format them in a sensible way. I also know that if I press Enter in the middle of an item, I can rely on my browser not to go into a frenzy of spurious item inserts. Unlike the behaviour described in section “#9: Word automatically adds numbers or bullets at the beginning of lines as you type them” of TechRepublic’s “10 annoying Word features (and how to turn them off)”:

There are two flavors of this potential annoyance. First, if you start to type something Word thinks is a bulleted list (using asterisks, say) or type 1, a period, and some text, it may convert what you type to bulleted or numbered list format when you press Enter.To prevent this, go to Tools | AutoCorrect Options and select the AutoFormat As You Type tab. Then, deselect the Automatic Bulleted List and/or Automatic Numbered list check boxes and click OK.A related aspect of this behavior is that once you’re entering automatic list items, pressing Enter will perpetuate it — Word will keep inserting bullets or numbers on each new line. To free yourself from this formatting frenzy, just press Enter a second time, and Word will knock it off.

So HTML is what I decided to do for the outline I needed to make.


How to Use Web Pages as Outlining Tools III

(Continued from How to Use Web Pages as Outlining Tools II.)

Community transport costs money. For example, BACT, a volunteer group providing transport around Beccles and Bungay, inaugurated a new minibus last April. It cost over £52,000, a figure which presumably doesn’t include tax, MOT, repairs, petrol, and other running costs. I’d been asked to help Oxfordshire Neighbourhoods Partnership with fundraising, and wanted to see how community-transport sites around the UK did this. I also wanted to see what kind of publicity they used to encourage volunteers, and to summarise my findings for other members of ONP.

So I Googled around, and found the sites below:
  Speke and Garston Community Transport
  York Wheels
  Wellow Community Minibus
  Merton Community Transport (MCT)

What I love about these is their sense of community. The language is informal and chatty. Fundraising events are described in a way that makes everyone feel they can take part: Christmas Fairs, the 100’s club, book sales, Easy Giving and online shopping, the Minibus Money-Box Appeal. There are lots of photos of buses and drivers and customers, making the groups seem really active. The sites put the customer into the picture, in both senses of the phrase. BACT has a list of donors. That kind of thankyou is really important. Also BACT’s site, volunteers and passengers have given their own little snippets, and some are touching. As Mrs P. wrote, “The service has helped to get me out from a very dark place. Everyone is so helpful and friendly and I don’t know what I would do without BACT.” And some of the sites explain in detail the benefits of volunteering, including driver training.

Having found these sites, I identified bits of content that I thought we could either imitate for a “how-to-do-community-transport” tutorial site, or that we could use fundraising ideas from. This came to about 1000 lines of HTML. Too much to put in a single document and expect other members of ONP to work through: I needed to structure it. I needed an outlining tool. So I thought of Microsoft Word. I then tried to stop thinking of Microsoft Word.


How to Use Web Pages as Outlining Tools II

(Continued from How to Use Web Pages as Outlining Tools.)

I took the image at the end of the previous post from one of the maps on the Campaign for Better Transport’s site: an interactive map which lets you see the cuts to bus funding in England and Wales since 2010. For Oxfordshire, it shows a reduction from £4.6M in 2010-11 to £2.6M in 2014-15, and to only £1.8M in 2015-16.

Since then, there have been more cuts. According to the Oxford Mail‘s “Bus service cuts: All you need to know about routes that will be axed across Oxfordshire”, more than 50 routes were removed in July. And in December, the Mail reported that three routes were withdrawn from the area around Beckley, Stanton St John, Forest Hill, Littleworth, and the Miltons. Which may be a bigger problem than some of the earlier cuts, because I don’t think there are other services nearby that can substitute.

I’m no expert, but I’ve read that the July cuts aren’t as serious as claimed, because bus companies have limited the damage by changing and merging some routes. But they are still serious. To quote Oxford Prospect‘s “Nine More Oxford Villages Lose Their Bus Services”:

Emma Teasdale lives in Horton-cum-Studley. She told the public meeting:
“My daughter will have no way of getting from our village into Oxford and home from college daily when the 108 & 118 service is withdrawn. I certainly can’t afford a taxi twice a day. Angry is not the word!”

Going back to Oxford Neighbourhoods Partnership, this charity’s aim is to help neighbourhoods in Oxfordshire become good neighbourhoods. Neighbourhoods whose members can then take over some of the tasks that our government no longer wants to do. One of which is organising bus services — or, more generally speaking, community transport. The latter term also covers things that scheduled bus services are not best suited for anyway, such as getting patients who can’t walk well to hospital. But all this costs money.