Toggle sidebar

Peter Anderson

Christian - Husband & Father - Web Developer

The glass is half-empty, on average

A half-empty glass

Here's me answer to that age-old question: the glass is half-empty. Whether or not that makes me a pessimist is irrelevant, because me answer is based on statistics!

Whether or not a glass if half-choc-a-bloc or half-empty depends on whether it is in the process of being filled, or emptied. If a glass is being filled, when it reaches half-way then it's half-choc-a-bloc. If it's being emptied, when it reaches half-way then it's half-empty. Make sense?

So how do we know whether the glass is being filled or emptied? Well we don't. But we can work out the average based on (admittedly...

Svalbard

It all started when I was eating brekkie one morning. I looked over the top of me brekkie bowl at the world map on the placemat I was using (we have a 3 year-old, so we have 'educational' placemats). I noticed a collection of islands to the north of Europe, and I wondered what they were. Greenland looks huge (though it's not really) and was clearly labelled, and I knew Iceland was the small island to its south-east, but I didn't know what these other islands were or who they belonged to. So I investigated!

World map

It turns out that this archipelago is called 'Svalbard' and is part of Norway (sort...

Finding when a change was made in GitHub

I was recently going through some old bug reports for Backdrop CMS and I came across one that I discovered had since been fixed, though the issue was still open. Rather than just closing it, I wanted to post a link to the commit that fixed it (for posterity), so I went looking in GitHub for when the change to the file in question was made...

The file was views_handler_filter_term_node_tid.inc in the core Taxonomy module, and on line 129 I could see the code that had been a problem but was now fixed:

Line 129

To see when it was fixed, I did the following:

  • Clicked on the line number - it was...

Creating a node programatically in Backdrop

For a Backdrop CMS site I'm currently working on, I needed to create a node programatically (i.e. via some PHP code, as opposed to the UI). Generally when I need to do something in Backdrop, I'll search for similar solutions in Drupal 7 and then migrate them over (Backdrop still has some catching up to do in the 'online help and tutorials' department; hence this blog post).

So I went looking for how to create nodes programatically in Drupal 7, and there were plently of results. The answer is basically to create an object or array of values (ya 'node'), then run it through node_save()....

Pages