My fourpennyworth (Computing)


Thursday 13 April 2006

Time code

A regrettably lengthy portion of yesterday taken up with yet more attempts to sort out this rss time format problem: it turns out that ‘BST’ is not, after all, a legitimate time zone, and you have to use a formula (+-hhmm) to define those zones that are neither standard American ones nor GMT. (One gets the impression from the literature that even ‘GMT’ is allowed only grudgingly, the more acceptable formulation being ‘UT’, ie ‘Universal Time’.)

When I discovered that there were three or four problems (including the use of BST) which were preventing my rss feed from being validated, I tried to sort them out: for what it’s worth (which is very little), the feed is now valid – though I suspect that FileMaker’s various features (the ‘calculation’ field, for instance, which allows you to create unique references and unusual formats from your existing data) constitute a great excuse to avoid discovering how to do the same thing in xslt.

And all this time, of course, there has been actual remunerative work I could and should have been doing. Still, I suppose when you’re as lazy and unmotivated as I am, it comes as a pleasant surprise that there is something that you are prepared to work at…

(Category: Computing)

9.48 am

E-mail me a comment on this entryBack to top

Wednesday 12 April 2006

Really simple…

All being well, there’s a little ‘rss’ symbol near the top of this page, linking to a version of this journal in the rss ‘dialect’ of xml. I think it works, but you never know…

(I suppose I ought to point out that the xslt file took me almost no time at all to write, – it was a simple xml-to-xml conversion, after all – while getting the date into the very US-centric format required by the rss ‘pubDate’ element was incredibly difficult. FileMaker has all sorts of possibilities for customising dates and times, but it wasn’t appropriate to use them. The GMT/BST issue – the rss date format ends with the time zone – seemed horrendously complicated, and proved so, until I discovered that it was possible, after all, to use BST, despite its parochial origins. Even so, I can’t think my way round the rules for producing the correct date-range for BST - something about the last Sunday in March to the last Sunday in October, isn’t it? – so I’ve had to do a bodge and use April to October.)*

*Actually, rather than doing sensible like going to bed, I’ve managed to work this out – to within an hour or so, at any rate. Weak hurrahs all round.

(Category: Computing)

2.16 am

E-mail me a comment on this entryBack to top

Thursday 23 March 2006

How long is this piece of string?

A bit of a re-run of Sunday: had quite a bit of potentially remunerative work to do this (Weds) evening, but instead got bogged down with another AppleScript problem. (For some reason I seem incapable of letting it alone until I’ve sorted it out.)

Once again, I was working with the XML/XSLT Tools scripting additions, this time to choose the files to work with and be able to output them with a name and to a place of my choice. With the script I wrote to convert this into html, I merely pointed the commands in the direction of specific files, so this was a rather more complicated manoeuvre. Not that much more complicated, however; and it was dispiriting to discover how difficult I seemed to find it.

Previously I’d used a script addition (strictly speaking a faceless background application) called TextCommands to alter a file’s text directly, and this had meant commands like ‘open for access’ and ‘read’, which turned out to be useless for XML and XSLT Tools. (In a sense, I suppose, I should have realised that although the process radically changes text, it doesn’t actually change the source files at all.) The key, as I discovered (thanks to a demo version of the program Script Debugger – useful, but perhaps not worth the $199 it would cost to buy, at least to me), was to tell the script to look at the path to the chosen file as a piece of text: as a ‘string’, in other words. If I’d thought logically about it, I might have realised earlier that this was precisely what I had done when I put in the specified path in my previous script.

Anyway, I suppose that getting this right at last almost counts as proper progress where AppleScript and I are concerned, though no doubt I’ll soon come across another example where I need to do something else entirely to get it to work. I also took forever to work out how to save the resulting file – much less forgivable, as I’ve done that many times before.

The main trouble with all the different scripting languages I’m trying to learn – xhtml, xml, xsl, AppleScript, and now php (I’ve had to put TeX/LaTeX, God help me, on hold) – is that I can’t seem to memorise any of it: even when I start an xml document, I usually end up having to copy the first line from an earlier file. It’s my age, I suppose – though it’s also true that there’ve always been odd areas that I’ve found significantly harder to remember than all those names and dates that have come so easily to me: the parts of an army come to mind (ironically enough, since they never do). (I wonder if that word significantly is itself significant?)

(Category: Computing)

3.19 am

E-mail me a comment on this entryBack to top

Sunday 19 March 2006

Sorry about that, BBEdit…

Wasted most of the day taking the references to BBEdit out of the Applescript application that converts these FileMaker entries to html. Much faster now, and it’s all done in the background – but it didn’t half take a long time to do…

There are a couple of teething problems – bits of text are sometimes repeated at the end of files – so I’ve got a bit more to work on.

The next stage is to re-create only those files which have been changed: I haven’t the first idea how to do that. (Actually, since one solution to those curious extra bits of text is to delete the old html files first, perhaps I needn’t bother.)

(Category: Computing)

10.47 pm

E-mail me a comment on this entryBack to top

Friday 17 March 2006

A bit of refinement

Here’s an amusing extra: I’ve changed the script so that it produces a main page with all the entries on, then eight more pages with the entries separated out by category. These pages are accessible via the coloured blocks at the top left and right of the page…

(Category: Computing)

7.23 pm

E-mail me a comment on this entryBack to top

Thursday 16 March 2006

Another day, another diary

It seemed like a good idea to start a parallel blog, detailing what I need to do on my idea for an xml-based playscript application, rather than put it in here. So when that’s up and running, it’ll be at:

(I thought ‘Player King’ would be quite a good name for it.)

(Category: Computing)

6.32 pm

E-mail me a comment on this entryBack to top

Saturday 11 March 2006

Contents and discontents

After somehow getting this blog’s category colours to do what I wanted, yesterday I banged away at the idea I‘d had a few months ago to put a linked list of the entry dates at the top of the page – a table of contents, in effect. I nabbed a piece of someone else’s xsl file from the internet (from a forum question about an unsuccessful attempt at ‘TOC’ creation, ironically enough) and put it to use, and bizarrely this solution – using the ‘for-each select’ element – actually worked, as did the ‘generate-id’ facility I’d already been playing with. It all made me feel very clever, for a couple of hours…

However, the irony is not lost on me that one, writing about all this trouble to manipulate content has been at the expense of the content (on films, politics, music and the rest) that I started this blog to write about, and two, my recent ‘triumphs’ with xslt are much like teaching a parrot to quote Aristotle: I still barely understand the principles, and have no idea why ‘for-each select’ turned out to give me a table of contents when, say, ‘template match’ or ‘apply-templates’ resulted in unchanged or empty documents.

Anyway, I’m hoping that by some unconscious mental process I eventually get to understand how this really works, so I can start using it properly. I’ve had some minor success with converting an xml-based playscript (originally in InDesign, and generated by converting the ID styles into xml tags) into both html and TeX (the latter much easier than I was led to expect), and have scratched the surface of an xml-to-InDesign conversion, which I hope to extend to an xml-to-xml-to-InDesign conversion: this should allow me to develop my idea of an xml-based playwriting program a little further. (Given that the extent of my programming experience is writing absurdly straightforward AppleScripts, what I plan to do when and if I sort out the not-inconsiderable challenges of planning an xml ‘dialect’ for writing plays is anyone’s guess.)

(Category: Computing)

5.02 pm

E-mail me a comment on this entryBack to top

Friday 10 March 2006

Extra categories; and success…

Yesterday I decided I needed a category called Business, so that I could witter on at length about the crazy ways I think up of making money (most of these are already on my website, in; but then I deleted that entry (enough already). However, having added the Business category, I realised that there was another which should have been at the top of my list when I first started this ‘fourpennyworth’ nonsense: Words.

(What suddenly made me think of this now? Why, the earth-shattering observation on seeing an ad for the cleaner CILLIT BANG that the name sounds like a Turkish porn star… Hopefully I can come up with something better in the future.)

One thing that did come out of this was a different way of putting in the category colours in the xsl document. Previously I’d used the wordy but fairly straightforward ‘xsl:choose’ element, with a series of ‘xsl:whens’ to specify all but the last category and an ‘xsl:otherwise’ to finish off. The text in each different choice was the same except for the colour, and navigating my way through all those angled brackets looking for what I needed was becoming tiresome. So I added a colour field to the database I write these entries in – automatically specified depending on entry’s category, and a great deal easier to update – and then simplified the xsl document to drop the relevant colour value (a hex number) into the four separate places it is used. The first attempt was hopeless – tags within tags, double quotes within double quotes – but looking on the web (googling ‘xslt’, ‘inside html’, etc) I found a plausible solution by using ‘xsl:attribute’. And that seems to work so far.

I’m also going to try to automate links (there’s my first URL above), but I’ll have to do that in the grep-based script I run in BBEdit once the xslt is done: Filemaker doesn’t let me do anything too snazzy within the fields…

(Category: Computing)

11.32 am

E-mail me a comment on this entryBack to top

Sunday 5 March 2006

A new tack

I’ve decided to stop putting my old, excessively introspective journal on display, and replace it with this ‘fourpennyworth’ idea instead: a reaction to what I see in the papers, general thoughts about subjects that interest me, that sort of thing. (If I want to write about how cash-strapped I am or go into excruciating detail about my dreams, I’ll do it elsewhere.)

The categories as they stand are: Writing (turquoise), Music (purple), Politics (blue – Freudian slip, or what?), Cinema (crimson), Television (red) and Computing (orange). This first entry I have made ‘Computing’, although ‘Writing’ may be just as suitable (if not more so).

The categories and colours may change as I find the former inadequate or the latter inappropriate. (I’m already surprised I don’t have a separate category for ‘Actresses’, but perhaps that’s for the best.) The colour thing will of course make the site rather garish, but it’s useful in practising my xsl…

And that’ll do for now.

(Category: Computing)

1.39 pm

E-mail me a comment on this entryBack to top