Generalised Inverses, Adjunctions, Aesthetic Balance, and Too Many Cartoon Bricks

In the essay “Drawing as Translation” which is the topic of my previous post, I had this little diagram:

This represents the process of restoring the “balance” of a drawing, if one were first to copy it mechanically from the original scene. Imagine a pen-and-ink drawing of a house. If the drawing showed every brick and every slate, it would look too “busy”. There would be far too much density of line on the walls and roof, as opposed to neighbouring areas such as windows and doors. In reality, the bricks don’t stand out as much as our drawing would make them do, and we need to restore that balance. We can’t do it by thinning or greying the lines around them — the language of pen and ink doesn’t allow that — so we do the next best thing. We erase some patches of brick altogether.

That’s illustrated in the diagram. The double arrow, which as it were has its head in one language and its tail in another, represents the original mechanically-made translation from scene to drawing. Then the single horizontal arrow, which has its head and tail in the same language, represents “debricking” or “detexturing”. They compose to give the diagonal arrow, which represents going from the tonal balance in the original scene, to that in the final drawing. In mathematics, this would be called a generalised inverse: it’s an operation which undoes another, not exactly, but as closely as the circumstances allow.

Or, and with more mathematical potential, it might be possible to see this as the operation that category theorists call “adjunction”. I say more about this in “Drawing as Translation II”. Adjunctions are extremely powerful mathematical tools. It would be interesting if they could be used to define aesthetic measure.

Drawing as Translation

I’ve subtitled this blog “What a web developer does”, and most of my recent posts have been about web development, mainly in WordPress. But I do other things too. One is drawing cartoons, which I blogged about in “How to Make Pencil on Tracing Paper Look Good with Gimp”. I recently went to the Oxford Literary Festival, and to a talk by Matthew Reynolds, Professor of English and Comparative Criticism. He was introducing his book Translation: A Very Short Introduction. Inspired by this, I wrote an essay on “Drawing as Translation”.

My essay is a companion to a talk I gave to Workshop Thales in 2015 on the semantics of line drawings. It uses some of the same examples, but with a different emphasis. I argue that it isn’t wrong to omit or exaggerate; and indeed, may be unavoidable, given the constraints of the visual language we’re translating into.

I also look briefly at “blooming”, which I came across in the Language Log post “Blooming, embellishment, and bombs” by Victor Mair (17 August 2015), which refers to a comment by Judith Strauser (3 August 2015) to an earlier post also by Victor Mair (2 August 2015), “French vs. English”. Blooming is the increase in size of a translation relative to its original. There may be more than one reason for it; it’s not just because some languages are more concise than others. I discuss blooming in drawing; it would be interesting to see examples of blooming in translating one programming language to another.

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 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.

<?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() ) {
  $latest_posts->the_post(); 
  the_title(); 
  echo "<BR>\n";
  the_time( 'l jS F, Y' ); 
  echo "<BR>\n";
  the_excerpt(); 
  echo "<BR><BR>\n";
}

wp_reset_postdata();

?>

(Continued.)

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:
https://www.google.co.uk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&uact=8&ved=0ahUKEwjDyfDO6ozSAhUsCsAKHdRXCMkQFggiMAE&url=http%3A%2F%2Fmycouncil.oxford.gov.uk%2Fdocuments%2Fs28404%2FAppendix%25201%2520Draft%2520Corporate%2520Plan%25202016%2520-%25202020%2520updated.pdf&usg=AFQjCNFqf7fbdKtAGIxuwmhpXWx1I7D-Jg

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.

An Example Community-Transport Site

In July 2016, Oxfordshire County Council ended bus subsidies to 118 Oxfordshire bus routes. It’s why Oxfordshire Neighbourhoods Partnership, who I wrote about in the posts starting at “How to Use Web Pages as Outlining Tools”, was so interested in helping neighbourhoods set up community transport. If you’re over 60, these cuts are a double whammy. You get a pass that gives you free travel on scheduled services, i.e. the routes run by Stagecoach and Oxford Bus Company and others. But it doesn’t pay for services such as weekly-shopping-trip minibuses run by volunteers. And if you now have to use one of those instead, that service is probably having to fund itself by charging its users. So you’ve not only lost a free service, but ended up paying for a less convenient one. That’s why I wanted to help these community-transport setups get big donations from local businesses, so that their users would not have to pay. And part of that was building a website that carried the right kind of publicity.

In those posts, I explained how I made an outliner that demonstrated the page hierarchy and content that I thought a successful community-transport site should have. My final post, “How to Use Web Pages as Outlining Tools V”, shows my outline, with particular emphasis on content that would encourage such a site’s readers to volunteer and donate.

I based that outline on the sites listed in “How to Use Web Pages as Outlining Tools III”. Highlights include stories about fundraising appeals, and about what it’s like to be a volunteer or passenger. The excerpts from these that I copied were (of course) in HTML, and so was my outline, so pasting one into the other just worked.

But having done that, it was easy to go one stage further. Take a look at http://www.j-paine.org/cte/cww.html . This is an example community-transport site which I made simply by pasting those excerpts into WordPress pages. The site has the same structure as my outline, with the two levels of main menu being the outline tree. If a web-development company were building a new site, this would be a useful thing to show them as a starting point.

By the way, the image on the front page is from CWW Community Transport. This is a charity set up to run community transport in Cutteslowe, Wolvercote and Wytham, and the ancestor to Oxfordshire Neighbourhoods Partnership. If CWW is one particular community-transport service, Oxfordshire Neighbourhoods Partnership exists to help other neighbourhoods set up the same kind of service. Both CWW and ONP are always looking for donations. If you can help, please phone or email the number or email address on CWW Community Transport’s “Who We Are And What we Do” page.

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.