Wednesday, 30 November 2011

Christmas Lights

Our first Christmas since moving to Portishead is coming up, and the lights were switched on on Monday. It's nice to see how festive the high street looks with a bit of extra colour, and no gaudy flashing snowflakes or Santas here thank you!

I'm not sure the phone camera photo really does it justice though.

Let the counting down begin!


Tuesday, 8 November 2011

Pulling Blogger content into Google Sites with Google Apps Script

You may remember that I migrated the Heswall Disabled Children's Holiday Fund website to Google Apps a couple of weeks ago, and started to use Google Sites for the web pages.

One of the things I'd been wanting to do for the camp is create a blog where news and developments can be published. Google Sites offers an "Announcement" page type, but it's not really as nice to work with a Blogger, as I had discovered here already. But the trouble with trying to combine a Blogger blog with a Google Sites website, is that both use templates neither of which can easily be made to be part of the other.

The solution I came up with is to use Blogger for writing the blog, but have the RSS feed published into a Google Sites page. Conveniently, Google provides a scripting toolset, Google Apps Script (apparently this doesn't have anything to do with Google Apps, the service, but with Google apps, the suite of applications), that allows JavaScript access to the Sites object model (amongst other things).

Here's the script I came up with:

function loadContent() {
  // ... Initialisation ...
  
  var feedDocument = Xml.parse(UrlFetchApp.fetch(rssUrl).getContentText(), false);
  var feedUpdated = feedDocument.feed.updated.getText();
  var pageUpdated = CacheService.getPublicCache().get("updated");
  
  CacheService.getPublicCache().put("updated", feedUpdated, 4800);

  if (feedUpdated == pageUpdated) {
    return;
  }
  
  var site = SitesApp.getSite(domainName, siteName);
  var page = site.getChildByName(pageName);
  var template = getTemplate(site.getTemplates());
  
  var entriesArray = feedDocument.getElement().getElements("entry");
  var newPageHTML = "";
  for (var i = 0; i < entriesArray.length && i < numberPosts; i++) {
    var entry = entriesArray[i];

    newPageHTML = newPageHTML + "<div>"+
      "<h3><a href='"+getLink(entry)+"'>"+entry.title.getText()+"</a></h3>"+
      "<p>"+entry.content.getText()+"</p>"+
      "<div style='font-size:0.8em;background-color:#E7E7E7'>Posted by "+entry.author.name.getText()+" on "+getDate(entry)+"</div>"+
      "</div>";
  }
  
  if (entriesArray.length > numberPosts) {
    newPageHTML = newPageHTML + "<p><a href='"+blogspotUrl+"'>View older posts</a></p>";
  }
  
  newPageHTML = newPageHTML + "<p><a href='"+rssUrl+"'>Subscribe to Posts (Atom)</a></p>"
      
  page.setHtmlContent(template.getHtmlContent().replace(/<br[^>]*>/i, newPageHTML));
}

function getTemplate(templates) {
  var templateName = ScriptProperties.getProperty("templateName");
  for (var i = 0; i < templates.length; i++) {
    var t = templates[i];
    if (t.getPageType() == PageType.WEB_PAGE && t.getName() == templateName) {
      return t;
    }
  }
}

function getLink(entry) { ... } // Gets the right link from the entry
function getDate(entry) { ... } // Parses and formats the published date
Pretty simple, and seems to work ok. Admittedly at the time of writing, there's only one entry to publish, but I don't think more should be a problem.

Wednesday, 2 November 2011

Arthur Overload

I'm a big fan of the legends of King Arthur - when I was at school I never really liked history much, and gave it up as soon as I could. In the last year that I had to do it (aged 13), part of the year's work was to do a "research project" on some event in history, and I chose to weigh up the truth in the legends. Having never really managed any better than the bare minimum of necessary homework, I'm not sure the teacher entirely believed it was my own work when I got one of the highest marks in the school. I still have the report I wrote - maybe one day I'll type it up for posterity.
At the moment, though, I seem to be suffering what could almost be said to be a bit of overload...
First there was Mary Stewart's Crystal Cave trilogy, which I read on and off over about 3 months last year. The story is the life story of Merlin, rather than Arthur. It's a good trilogy, with quite a believable mixture of magical legend and what can easily be believed as the hardships that people living in the first millennium A.D. might have had to put up with.
Next, there's the BBC's Merlin, now in its fourth season on BBC1. A more light-hearted take on the stories would be hard to find, and yet the main characters of Uther, Arthur, Merlin, Morgana, Guinevere (or Gwen) and others are familiar, as are some of the storylines for each of them.
Then after being given a Kindle 3 for Christmas last year, I downloaded Bernard Cornwell's Winter King - the first in a trilogy about Arthur, which I'm about 90% through, and I'm certainly enjoying his portrayal of Arthur as a successful warlord at a time of many Briton tribes fighting off attacks from the invading Saxons.
If those three different versions of the same stories weren't enough, Channel 4 brought out a new Arthur TV series, Camelot - which I mostly missed when it was first aired, and is now being repeated on More 4, and I've got set on Series-Link record - hopefully the stories will be good, and Channel 4 "Drama" won't have relied too much on the raunchy scenes featuring Morgan and Guinevere - not that they're bad scenes, it's just nice to think you're watching something better than a tabloid newspaper.
If you're a fan of historical fiction, I heartily recommend the Mary Stewart trilogy, and if the first book is anything to go by you wouldn't do badly from the Bernard Cornwell books either, although if you've read other books by him the formula will be familiar!
Right, I'm off to go and catch up on Merlin!

Monday, 31 October 2011

Sloe Gin recipe

Making sloe gin is a bit of a tradition in my family - I can remember helping my Grandpa George pick berries along the valley from their house in France well before I was old enough to enjoy the results, and my Dad has been making his own since they moved house to the country about 15 years ago. I've been making my own for about 8 years, I think - the quantity produced has gone up a bit with the acquisition of one of those 5 litre size whiskey bottles, and a wine-making demijohn, so I can make a good few litres a year now.

Anyway, I've been asked a few times for the recipe for how I make it, so as it's that time of year right now, here's my recipe:
  1. Pick lots of sloes - enough to fill a few bottles
  2. At home, discard any leaves, stalks, insects, shivelled berries, etc that you might have picked with your sloes, and then wash and dry the berries.
  3. Once dried, put in a carrier bag and put them in the freezer overnight
  4. Clean out some old bottles
  5. Take the sloes out a couple of hours before you're going to make the gin - do not allow to completely defrost - they go a bit mushy.
  6. Fill the bottles to about three-quarters full with sloes
  7. From the bottle's volume, add 12.5-15% of the volume but in grammes of caster sugar to the sloes, depending on how sweet you want it to be. e.g. for a 1 litre bottle, I add about 130g caster sugar.
  8. Fill the bottle with gin - I normally use local supermarket's half-decent London Dry Gin.
  9. Put in a cool cupboard, and upend once a week to make sure the sugar mixes.
  10. The sloe gin should go a nice red wine colour, and will be ready to drink after a couple of months, and at its best after more than 6 months
  11. When the sloe gin is ready for drinking, or you're coming up to the next sloe season, decant into a clean bottle through a piece of muslin to remove most of the sediment
In our family, sloe gin is enjoyed with some good quality plain chocolate and a few games of racing demon.



Monday, 24 October 2011

Transferring to Google Apps

As some of you know, I've been helping a charity that runs a camp for disabled children, Heswall Disabled Children's Holiday Fund, for nearly 15 years - an organisation that has been very close to my heart ever since - and not least because it was there that I met Clare, who eventually became Mrs Potes in July 2006.

One of the things I do for the charity is do the best I can creating and maintaining their presence on the internet - and I'm no web designer, I can tell you. Until recently, I was using hosting space with my very own hand-crafted HTML - it wasn't bad, but it wasn't that great either, and because of the hosting it was costing money. So in the interest of saving the charity a bit of cash, I started considering the options for replacement.

The domain I use for this blog is hosted using Google Apps, which I've been using for many years now, so that seemed the obvious choice. The maturity of Google Sites (which was added a couple of years ago) meant that I could create the site in a much more WYSIWYG way, and importing the content from the old site took half an hour while I ate my sandwich in front of my computer at work one lunchtime. To complete the migration, I reverted the DNS settings for the HDCHF domain, and added the required CNAME entry for the "www" subdomain, and MX records for email, both of which Google provides you instructions for, and away we went. I'm no DNS expert, but it seems CNAME entries can be used to create domain redirections, and provided the server that they redirect to can interpret the path part of the URL, you can use them in just the same way as URLs referencing subdomains declared using A records (where the hosting server is contacted directly).

As Google Apps basically gives you (almost) all of Google's products wrapped up with a bit of enterprise-y management stuff, and so we've also got the usual range of calendars, docs, gmail, and so on - whether I can convince the other committee members (whose ranks I have just joined) to use them will remain to be seen.

The only downside is that as a UK Charity we do not qualify for the not-for-profits version of Google Apps (boo, hiss!!), so we're restricted to just 10 organisation users - everyone else will have to use their normal email address, enabled for Google use - I hope this won't stop them using the private wiki site, also transferred to Google Sites.

Tuesday, 18 October 2011

Sprint turnaround day

At work we use the Scrum framework to manage our work (or at least, try to - more about this later, perhaps), and today is sprint turnaround day - review of the last sprint's output, retrospective on last sprint's work, and planning for the new sprint. A fun-packed day of back-to-back meetings.

Sarcasm aside, I do quite like this day - even when our stakeholders pick the review as the time to mention something that should have gone into story capture weeks before. It's a refreshing day - if the last sprint went badly you can put it behind you and move on, and if it went well you can be proud of the functionality being demoed in the review.

However, recently our retrospectives have been going a bit stale. We used to use a traditional good/bad/actions type table, and then switched to a retrospective starfish, but where once all five areas had a few points in each, now we probably get half a dozen points in total. Of course, this could be because our team is functioning so smoothly there's nothing to change. Or maybe not.

So last sprint we did a retrospective on retrospectives. As a result of that, we tried adding a time-line activity to the retrospective, and this sprint we're going to try that again, and also make sure we go back and review last sprint's retrospective notes. We're also going to try not to stick to using just the starfish activity - if we have some actions we need to work on, we'll break those out separately.

The good news is, if we don't like it, we'll just change it again!

Monday, 17 October 2011

Two factor authentication from Google

It may well be that I'm late to the party (again!), but over the weekend I was looking at the two factor authentication that Google have made available for all accounts.

Anyone that's done any remote working is probably familiar with RSA Tokens where you have a key ring that gives you a unique number every 60 seconds to use to log in. Using the Google Authenticator app on your Android device (other device manufacturers are available, I'm told), you get the same functionality.

The setup of two-factor authentication is actually pretty simple - first set it up to work via your mobile phone, then re-login and add your device. If your device is also your mobile phone, you'll want to change the phone number used as a secondary authentication device - mine is switched to Mrs Potes's phone.

Once this is done, your account will be expired from all of the connections you had to it (Google Talk, Chrome Sync, Android device, etc.), and as those things ask you to reconnect, you just have to log in to http://accounts.google.com, click on the Authorizing Applications & Sites link, and generate a new password that will then be the password for that application only.

Simple :-)

Friday, 14 October 2011

Garbage Collection

Well here it is, the inevitable first post. Like others I know, I've been intending to start a blog for a few years - I even created one called "Half Finished" once - but it was a bit too true to its title, with the first post never actually making it to being published. Lets hope this one lasts a bit better than the previous attempt...

So here it is, anyway. Expect a variety of subjects, including computing, gardening, home life and any other things that occur to me as time goes by.