Genesis 1: Nothing is too big for God

Here is a short sermon I preached at St Peter & St Paul Shepton Mallet, looking at Genesis 1:1-2:3.

Genesis 1 isn’t a science textbook, it’s not a list of facts, it’s a story to teach us something.  Moses wanted to remind the Israelites that God was powerful, and that he had a plan that includes each of us.

Today we learn two things from Genesis 1: firstly, that nothing is too big for God, so we should step out in faith because God can be trusted; secondly, that God’s plan sometimes means we have to curb our enthusiasm.

Listen to the audio above to hear the whole sermon.

Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkedin
Share On Pinterest
Share On Reddit
Share On Stumbleupon
Contact us

Animated star field on a Javascript canvas

I was watching the film Pixels the other night.  Not the best film ever (by a long way), but it did get me reminiscing about all the cool stuff I programmed when I was a lad.  Back when I made text adventure games and simple animations in QBASIC.  Back when I programmed games on my TI-83 graphical calculator during History lessons.  Ah, those were the days.

So I wondered – how easy would it be to remake some of those programs in the technology I use today?  Specifically, can I recreate my horizontally animated star field that I made in QBASIC, only this time using Javascript?

As it turns out, yes I can.

First of all, we set up a basic HTML5 page, with just a canvas  element on it.  There’s also some CSS to make sure it will work in full-screen and has a black background.

The Javascript is where it gets fun.  And I’m not using jQuery or any other helper libraries.

We set up the canvas width and height here rather than in the CSS, because otherwise it will scale rather than actually get bigger.

Next we create a few variables to hold things like our stars and settings.  You can probably guess what they’ll be used for.

Here’s the function that creates a star.

We’re setting everything to be pretty random here.  Note that Math.random()  creates a number between 0 and 1, so we’ll need to put that into context later.  We Math.sqrt()  the random number for the distance, so that it’s weighted more towards closer stars; these will move faster, so we need more of them there.  The logic in the colour is simply giving us a star that is mostly white but with a slight tint between red and yellow.  It’s worth checking out hsl() and hsla() if you haven’t already, it’s pretty useful!

Now we can initialise our stars array.

Next we’ve got a function to draw the stars.  I’ve put it in a function because we’ll be calling it multiple times shortly.

First off we clear whatever might be on the canvas already.  Modern browsers handle output buffering quite well, so we don’t need to bother about manually double-buffering to avoid the flickering.

Before we draw each star, we move it.  How far it moves depends how close it is to us, and we’re using Math.pow()  to weight it correctly.  This is the inverse of the Math.sqrt()  we used when setting the distance of the star.  We’re also transforming that 0-1 value into something relative to the canvas width.  We also check whether the star has moved off-screen, and reset it if we need to.

And then we actually draw the star on the canvas.  I’ve given it a semi-transparent stroke, to simulate a blur effect.

Finally, we call the updateStars()  function every 30 milliseconds so we get a nice smooth animation.

Here’s the final result.  You can easily change the number of stars and the speed using the variables at the top.

Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkedin
Share On Pinterest
Share On Reddit
Share On Stumbleupon
Contact us

Psalm 138: God’s faithfulness

This is a sermon I preached at St Peter & St Paul Shepton Mallet on Psalm 138.

David is a successful and powerful king, but even he was fearful sometimes and needed to trust in God’s faithfulness to get him through.

God keeps his promises, such as his promise to Abraham that he would be a “great nation”.  And because God is faithful, we can trust in him.

Of course, reading other people’s stories is great, but it’s also important that we can identify our own experiences of God’s faithfulness to us.  Sometimes it’s not easy to find them though, especially when the going is rough.  God won’t necessarily stop the trouble from happening, but he does promise to be with us, and that gives us hope, because God is faithful.

Listen to the whole sermon above.

Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkedin
Share On Pinterest
Share On Reddit
Share On Stumbleupon
Contact us

40 reasons I’m thankful I broke down

This week, on the way back from a business trip, my car broke down.  It’s now sitting in a garage, waiting to be taken apart and fixed.  I missed an important meeting, I had to spend about £250 getting my car towed home, and I haven’t yet found out how much the bill will be to fix the car.  So you might be wondering why I have any cause at all to be thankful.  Here’s the story, and why I’m thankful for God’s protection.

The business trip took me down to Wadebridge in Cornwall, a 130 mile drive from home that should have taken 2 and a half hours but which actually took nearer 4 because of the traffic.  Being a web developer, not a professional driver, I didn’t fancy doing the entire return journey the same day, so I arranged to stop off at a hotel in Plymouth and do the remainder of the journey the following day.

(1) I’m thankful that I decided to do the return journey in two parts.  If I hadn’t, I’d have broken down at the side of the road somewhere completely different, and far less convenient.

(2) I’m thankful that my wife came up with the idea of staying overnight.  It wasn’t my idea.  And, given how evident it was that God had things in hand, it probably wasn’t entirely her idea either!

(3) I’m thankful that the hotel in Liskeard had no vacancies.  That was where I had originally intended on stopping over.  But if I’d stopped there, I’d have had the breakdown in a different place.

My phone was giving me GPS directions, and was nearly out of battery, so I was relieved to see the signs for Plymouth.

(4) I’m thankful that my phone lasted.  My in-car charger wasn’t working, so I hadn’t been able to charge it as I drove, and because it had been very sunny I’d had the screen brightness up really high.  If it had run out of juice completely I might not have made it to the hotel at all.

I turned off the A38 and slowed down for the junction.  It was at that point that the engine started misfiring, making a strange clattering noise, and the engine management warning light started flashing at me.

(5) I’m thankful that it didn’t happen when I was actually on the A38.  Given what had gone wrong (more on that presently), the damage could have been a lot worse if I’d been zipping along at 70 or with the engine at high revs.

Still, the engine didn’t stall, and moments later the clattering ceased, it stopped misfiring, and the warning light stopped flashing.

(6) I’m thankful that the engine kept running at that junction.  The Marsh Mills roundabout is huge and very busy.  Breaking down there would not have been a fun experience, for me or the other drivers.

As it happens, there was a Sainsburys right next to the roundabout, so I swung into the car park and found myself a spot to stop.

(7) I’m thankful for Sainsbury’s car park.  Given the choice, I would choose a supermarket car park over the side of the road any day.

I had a look under the bonnet.  Everything seemed to be in order, as far as I could see.  Nothing was missing.  Nothing was hanging off.  Nothing was loose.  Nothing was leaking.  Nothing was on fire.  And at this point the engine seemed to be running smoothly.  I revved the engine a bit, and it obliged happily.  I concluded that it must have been a glitch or something that had sorted itself out.  So I got back in and carried on.

(8) I’m thankful that the engine clung on in there.  It gave me the confidence to carry on.

As it happens, the hotel I was staying at was on the other side of the road, also right next to the roundabout.

(9) I’m thankful that the hotel wasn’t far away.  Even given the provision of Sainsbury’s car park, if I’d had to drive much further to get to the hotel I might not have got there.

I parked at the hotel, checked in, and relaxed.  Later in the evening I had a lovely meal at the Beefeater restaurant next door.  And I put it all on my Premier Inn Business card provided by my employer, so that nothing actually went on my own card.

(10) I’m thankful that I didn’t have to pay for my stay.  Knowing that there wasn’t a big dent on my bank account was a huge weight off my mind.

Early the following morning I packed up, had breakfast, checked out, and got into the car.  It started first time and sounded healthy, so I pulled out of the car park onto the junction.  As I slowed down for the traffic lights, the engine started misfiring again, the engine warning light flashing again, and stalled.

(11) I’m thankful that it had had the symptoms again so soon.  If it had clung on until I was back on the A38, it would have been far less convenient.

(12) I’m thankful that I came to a stop at the front of the queue at the traffic lights.  If I’d been further back, I would have been more in the way.  At least here people were expecting to have slowed down, making it safer for me.

I tried to restart the engine, and it coughed into life, but still misfiring, and then stalled again.  I tried again, but it wouldn’t start at all.  Clearly the problem from yesterday hadn’t magically resolved itself after all.  I put my hazard lights on and tried to think what my next step would be.  I took the handbrake off, opened the door, and attempted to push the car to safety.

(13) I’m thankful that the traffic moved slowly at that junction.  It made it slightly safer for me to step out of the car.

However, the lights changed too quickly for me to make any meaningful progress, so I got back into the car where I felt less exposed.  In desperation I tried to start the engine again.  It fired up happily, no lights, no misfiring.

(14) I’m thankful the engine started again.  Being stranded in the middle of a busy junction is not a safe place to be.

I swung the car back into the hotel car park, seeing as the entrance was just there.

(15) I’m thankful for the hotel car park’s one way system.  It meant that getting back in didn’t mean turning around.

(16) I’m thankful that just when I needed it there was a sizeable gap in the traffic behind me.  I was able to swing across four empty lanes, without getting in anyone’s way, before turning into the car park.  At rush hour, that’s impressive.


Poorly engine.

I pulled into a space, and took a deep breath.  Not a great start to the day, but at least I was safe.  I got my wallet out, found my RAC card, and rang the number.

(17) I’m thankful that I had remembered to charge my phone the night before.  Otherwise things would have been a lot less convenient.

(18) I’m thankful that I had got breakdown cover for my car.  Ten years ago I would have considered that a frivolous waste of money.

(19) I’m thankful that the lady on the phone could look up my car’s details even though I gave her the wrong membership number.  We’ve got two cars, you see, and I only had the membership number for the other one.

(20) I’m thankful that the weather was good.  Waiting in the rain for the RAC man to arrive would have been far less fun.  As it was, I had sunshine, a gentle breeze, and squirrels playing in the trees next to me.

A little over an hour later, the RAC van turned up.  The mechanic plugged his computer into my car to find out what was wrong.

(21) I’m thankful that modern technology reduces the need for me to explain what happened.  In moments of stress, even if I’ve mentally rehearsed my lines, I don’t always remember to say everything I meant to.  As it turns out, I didn’t need to describe the problem at all for him to figure out the cause.


Spot the difference…

According to the error codes, there was a random misfire on cylinders 1 and 2.  So he started taking out the spark plugs.  Spark plug 1 had a little oil on it.  Nothing to worry about, he said, it wasn’t a huge leak at all, and certainly wouldn’t have stopped the engine running.  But speak plug 2 was missing its electrode.  That was more of a problem.  Without that, the cylinder wouldn’t be firing at all.  I said I remembered hearing a clattering noise the day before, and he said it might well have worked its way out through the exhaust.  He didn’t have any of those particular spark plugs in the van, so he went off to buy some.  I decided that it would be worth getting a whole new set, because they all looked a similar age and could probably all do with refreshing anyway.

(22) I’m thankful that the cause was easy to diagnose.  If the spark plug had merely been defective in some way, it wouldn’t have been clear what was wrong, and we’d have been less certain that replacing it would be the best course of action.  Being visibly broken made that a much easier conclusion.

(23) I’m thankful that there was somewhere nearby that the RAC man could go to buy spark plugs.  It didn’t take him long.

He returned with a fresh set of spark plugs and fitted them.  The engine started up, and he said it was running nice and smoothly.  To be honest I couldn’t tell just by listening, but I trusted his judgement!  He said that while he was putting it into his system I should drive round the block and make sure I was happy.

(24) I’m thankful that he trusted me to drive off without the transaction being complete.  I had everything with me, I could have just driven home and never signed anything.  Him trusting me helped me to trust him.

I pulled out of the car park and onto the junction, and the engine clattered to a halt again.  I had to restart it a few times, but I managed to crawl it back into the car park.

(25) I’m thankful that it stopped working again so soon.  If it had behaved a little longer it would have covered up its true problem, and I’d have been stranded somewhere else and would have had to get him called out again!

(26) I’m thankful that the engine clung on long enough for me to get back to the car park.  If I’d got stranded on the junction, the RAC man would have had to come and tow me to safety.

With that, we concluded that the electrode had in fact not come out the exhaust, but was still trapped in the engine block somewhere.  Not so good.  And not something he could fix himself.

(27) I’m thankful that it was so clear what was wrong.  If there had been any doubt, I might have been tempted to try to drive home anyway.  As it was, I could hear the electrode clattering around inside the engine, which wasn’t a nice noise at all.

The first option was to tow the car to a local garage in Plymouth and get it fixed there.  That wouldn’t have been too bad, as I could have stayed another night at the hotel.  The RAC man rang round, resulting in a ball-park figure of around £400 to take the head off and put it all back together.  But it would take several days, possibly running into next week, due to existing workload.  I couldn’t stay in the hotel that long!  So the only other option would be to get the car towed all the way back home, and I’d get it fixed there instead.

(28) I’m thankful that the decision was easy to make.  I’m not known for my decisiveness.  Staying in Plymouth for an unknown period of time just wasn’t an option, which made the alternative a clearer decision.

The RAC man took payment for the spark plugs and the transportation of the car, and left.  A different RAC person with a flatbed lorry would be in touch shortly.  So I went back into the hotel, parked myself at a table at the bar, ordered myself a cup of tea, connected to the hotel’s free wifi and replied to various emails that were waiting for me.  I got the call from the delivery man saying when he’d be there, and I took the opportunity to get some lunch in the restaurant while I waited for him to arrive.

(29) I’m thankful that I had such a comfortable place to wait.  A Premier Inn hotel and a Beefeater restaurant is infinitely more pleasant than the side of a road.

(30) I’m thankful that my Premier Inn Business card covered food as well.  My cup of tea and my lunch were therefore paid for with ease.

(31) I’m thankful for free wifi.  And why not.


Loaded and ready to go.

Just as I was finishing lunch, the delivery man arrived.  He loaded the car onto his flatbed, and off we drove.  It was slow going, because we were speed limited, but we made steady progress.

(32) I’m thankful that the driver was friendly, but not too friendly.  He didn’t insist on talking the entire journey, but left me time to be quiet and relax and look out of the window and listen to the music and rest my eyes.

(33) I’m thankful that the driver had an appreciation of fine music.  I could have been listening to mind-numbing trance music, or ear-bleeding thrash metal.  But my driver was a DJ in his spare time, specialising in jazz-funk-motown.  He put his iPod on, and we listened to some properly brilliant tracks.

Oh, and all this time I had been keeping in touch with my wife and colleagues, all of whom were expecting me to have been home already.  My colleagues were very understanding, and rescheduled the important meeting I had been trying to back for.  And Ellie was supportive and encouraging the whole time.

(34) I’m thankful that my colleagues understood that it was out of my control.  They could have insisted that I get a taxi back and abandon my car.  Or they could have held the meeting over the phone.  But they were brilliant, and gracious, and when I came in to work this morning they were very pleased I was safe and well.

(35) I’m thankful for my wife’s support.  She didn’t blame me, she didn’t put additional pressure on me to get it fixed or get home sooner, she didn’t get stressed or overly worried.  I love her very much.

(36) I’m thankful that my phone is on a contract.  I made several phone calls and sent lots of text messages, and it was reassuring knowing that it was already paid for in my monthly bill, so I didn’t have to feel guilty about it.

Also, while all this was happening, our other car happened to be at the garage as well, for something completely separate.  The rear brakes had been making a weird clunking noise, so we had booked it in for that day for them to fix it.  Turns out that although they were perfectly safe and legal the brake pads were moving slightly in their seats, hence the clunk.  Seeing as they had fitted those pads only two months ago, they agreed to replace them with a different brand at no charge, because they were still covered by their warranty.

(37) I’m thankful for warranties.  So rarely do we actually get the benefit of them, they seem almost a waste of time having.  But in this case it saved me a few pennies, which is great considering that fixing the other car won’t be cheap.

The flatbed got to the garage mid-afternoon, and as we pulled up they happened to be just finishing the work on our other car.  We unloaded the broken one, and I waited in the reception for the other one to be ready.

(38) I’m thankful for amazing timings.  I could have been waiting for hours for the other car to be finished.  I could have had to walk home, and then walk back again to pick up the car.  But I only had about 15 minutes to wait.  And there was a dog to play with while I waited.

So now I’m home, safe and sound.  Our family car has its brakes fixed, and my little car is sat at the garage waiting to be fixed next week.  I still don’t know how much the repair will be, but thankfully we have budgeted for emergencies and have some savings put aside to cover things like this.

(39) I’m thankful that we can afford the repair bill.  Working through the numbers is never fun, but because we have a firm grip on our family budget we know what money we have and where it’s coming from, and have ensured that it’s not going to impact anything else.  That’s a big change from a few years ago.  We may not be rich, but we can survive quite happily, because it’s all under control.

And at the end of it all, I can reflect back and see how God has guided and protected me through this entire experience.  It could have been worse, it could have been a lot worse, but it wasn’t.  I felt cared for.  I felt safe.  I even felt comfortable.  And, most strikingly, I felt peaceful.

(40) I’m thankful for God’s peace that passes understanding.  I ought to have been stressed.  I ought to have been desperate.  I ought to have cried a little.  But the entire time I felt safe in God’s care, protected from harm, provided for.  Given how wrong it could have been, the peace I experienced is clear evidence for me that God was in control the whole time.

UPDATE: A week on…

Having left the Corsa at the garage over the weekend, I picked up a courtesy car on Monday, which would get be around while they work on my car.

(41) I’m thankful for the courtesy car.  Even if it was a Micra.  And automatic.

I heard nothing for a few days, but eventually on Wednesday I got a call from the garage with an update.  They had diagnosed the misfiring down to a failed coil pack, and had replaced it.  Not all that surprising really.  The spark plugs take electricity, make a spark with it, and that (amongst other factors) powers the engine.  But of course when the electrode breaks off a spark plug it doesn’t spark where it’s meant to, the result being that it shorted the coil.  So they put a new one on, and reported that it was running nice and smoothly now.

Most of the time, anyway.  After about half an hour the clattering noise came back.  And then disappeared.  And then came back.  So whatever was wrong was still wrong, and the coil pack was either a consequence of the real problem or something completely unrelated.  And it was at this point that the garage phoned me, because they wanted my approval (or otherwise) before proceeding any further.

It turns out that a twinport engine such as mine is much more complicated than a ‘normal’ engine, which means taking it apart is much more time-consuming, and therefore more expensive.  They said they could take it apart piece by piece, checking for whatever was wrong as they went along.  But it would end up costing over £1000.  At that point, it hardly seems worth it, given the value of the car itself.

I mulled it over when I got home, and talked it over with Ellie, who was supportive as always.

(42) I’m thankful for my wife, Ellie.  I know I’ve already been thankful for her, but it bears repeating.  She made a batch of bread rolls specially to cheer me up, because she knows how much I like fresh bread.  I love that she understands me so well.  It really brightened up my evening!

And then I said ‘hello’ to an old friend – Autotrader.  I’ve lost count of how much time I’ve spent looking at cars on Autotrader over the years.  I found some Corsas, which would be effectively a direct replacement with an almost identical model, and some Fiestas that might be worth looking at as well.

(43) I’m thankful for the Autotrader website.  It’s well-organised, useful, and I’d be pretty much lost buying a car without it.

This morning I called the garage again, with a last-ditch effort to somehow keep the car.  I asked whether replacing the entire engine might be quicker – and therefore cheaper – than taking the existing engine apart.  It was worth a shot.  However, their mechanic said that it would probably work out nearly as expensive, if not more expensive.  True, I could pick up an entire engine on eBay for around £200, but they would still have to do the swap and connect everything up, and even then there would be no guarantee the new engine would work.  I’d effectively be swapping an engine I knew for an engine I didn’t, which might have just as many problems to put right.  The only alternative would be to get a refurbished block from a reputable dealer, able to provide some sort of warranty, but then we’d be looking at spending £700 just on the block.  Whatever way we looked at it, it just wasn’t going to make economical sense to repair it.  So we agreed that we wouldn’t.  To make matters even more frustrating, the insurance is very unlikely to cover it because it wasn’t an accident, just mechanical failure.

However, just as I was about to admit defeat, a thought miraculously sprang to mind.  The maths didn’t add up.  If you know me, you’ll know that me and maths don’t always agree at the best of times, so I had to run this past Ellie to make sure I’d got it right.  If I sold the car for spares or repair, I might get maybe £500 for it at most. Paying out around £1500 for a new car would mean an overall outlay of around £1000. Which is the same as repairing the car I’ve already got. Not including whatever it would be to swap the insurance over. And at this point it suddenly seemed ridiculous to be considering replacing the car at all.

(44) I’m thankful that inspiration struck in time. God was clearly still looking out for me, and saving me from a terrible mistake.

Not quite trusting my own judgement, I decided to call my dad the following morning for his advice. After explaining it all to him, he agreed with my suspicion that it was worth the gamble to try to get the Corsa fixed.

(45) I’m thankful for my wonderful Dad. He knows cars, and I trust his opinion and wisdom. And I’m incredibly grateful that he took the time to go through it all with me so early in the morning, calmly and logically and helpfully. It may not have quite been Father’s Day, but I was thoroughly thankful for him, and I love him very much indeed.

(46) I’m thankful for maths. It may not be my strong suit most of the time, but it saved my bacon this time.

So I quickly phoned the garage (they know me by name by now) to ask them not to put the engine back together just get, and to proceed with fixing it after all. They agreed and said it would be added to the job list for the following week.

(47) I’m thankful that the garage was still happy to do the work. After all the back and forth, they’d have been within their rights to have refused!

UPDATE 2: Two weeks on…

We had survived the weekend on one car. The garage hadn’t been able to give us another courtesy car after I returned the Micra.

(48) I’m thankful that we have two cars. Before February of this year, being a car down would have been a nightmare. Having a second car meant that despite some logistical rearrangements we could still get everywhere we needed to.

I called the garage again on Monday for an update, and they confirmed that work would start on the Corsa on Tuesday, and that they were working on finding me a courtesy car for me. They said they’d ring to confirm that evening. Sadly, I heard nothing.

(49) I’m thankful that despite not having a courtesy car I could still get into work. Even if it did mean getting up early so that Ellie could drop me off and still get back in time for the school run.

So on Tuesday I rang again. This time they said that the car was already fixed! They had managed to start work on it on Monday, ahead of schedule, and we’re just test driving it to make sure it was all perfect for me. They said they’d ring me the following morning to confirm.

(50) I’m thankful that the garage could find the problem and fix it so quickly. Less time working means less cost. And less time without the car. And also that the car was indeed repairable.

(51) I’m thankful that I didn’t need another courtesy car. Especially that automatic Micra.

So on Wednesday (today) I spoke to them again, and they confirmed that the car was fixed. They were doing some final checks, but I could come and pick it up at lunchtime. Woohoo! In fact I picked it up after work, because that was more convenient, but that didn’t matter to them. The cost was around £700, including the initial investigation and coil pack, making it about half as much as it could have been.

(52) I’m thankful that it didn’t cost the earth. I have the money in savings, but it’s a relief not to need it all.

It turns out the electrode from the spark plug was indeed still rattling around in the engine. It had come out of cylinder 2, rattled it’s way into cylinders 1, 3 and 4, and bashed itself against the top of the head. Now, at the top of each cylinder are the valves. Miraculously, all the damage was done to the areas of the head next to the valve ports, on bits of metal that didn’t actually do anything or matter if they were a bit dented. On all three cylinders.

(53) I’m thankful that the electrode was found. It would have been a constant worry if they’d returned the car to me and not found it, just in case it was still in there somewhere waiting to cause problems again.

(54) I’m thankful that it didn’t do more damage. It should have damaged the valves. There is no logic to why the only damage was to the areas that didn’t matter. The mechanics were amazed at my luck. To be honest, I’m amazed too, but I believe in something more powerful and reliable than just luck!

So now the car is back home, and I’m looking forward to driving it to work tomorrow. The timing is perfect, because on Sunday Ellie and I really do have to be in very different places at the same time, so only having one car would have made things rather difficult for one of us. But now everything is back to normal, at less cost than we were expecting, and with a great story of thankfulness to go alongside it.

(55) I’m thankful for this opportunity to be so thankful. Friends on Facebook have already told me what an encouragement it’s been to them. And it’s been a wonderful experience for me, leaning heavily on God for my direction and decision making, and being blown away by how much he cares for me and continues to look out for me.

Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkedin
Share On Pinterest
Share On Reddit
Share On Stumbleupon
Contact us

Good Friday reflection

This is a reflection prepared for a Palm Sunday service (which happened to include the Liturgy of the Passion as well) at St Bartholomew’s Church, Cranmore.  It followed the reading of the Passion, as told by Mark.


You’re standing outside the tomb.  The evening has come.  The stone lies against the entrance, sealing him off from the world.  It is finished.

Grief fills your mind, as you recall in pain what you have seen and heard.  Jesus, your teacher, ridiculed and mocked.  Jesus, your leader, led like a lamb to the slaughter.  Jesus, your friend, heaped with insults, beaten, crucified.  Your heart breaks.

No surprise then that the floodgates open, and memories of other pain creeps unwanted into your mind.  Friends and family lost.  Relationships torn apart.  Belongings taken away.  Times when you too have been beaten, insulted, humiliated, exposed, abused, forgotten.  Your heart breaks.

But then, God’s heart breaks too.  The Father watched as his Son came helpless into the world, cold and naked and in need.  The Father watched as his Son was opposed by those who should have known better.  The Father watched as authorities wielded their power to twist an outcome.  The Father watched as his Son was arrested in the garden.  The Father watched as Jesus was accused of blasphemy.  The Father watched as his Son was beaten and mocked.  The Father watched as his Son was dragged through the streets with crowds jeering and pointing.  The Father watched as the nails drove through his skin.  The Father watched as Jesus died.  And did nothing to stop it.  His heart broke as he watched, knowing that it had to be done.

I wonder… what hurt most?  Jesus allowed himself to be arrested, because something else hurt more.  Jesus allowed himself to be mocked and beaten, because something else hurt more.  Jesus allowed himself to be nailed to a cross and had his very life taken from him, because something else hurt more.  As he hung on that cross, he looked out at the world, and saw… you.  He saw who you are.  He saw the mountain of sin that exists between you and the Father.  He saw that you would never attain eternal life by yourself.  He saw that unless something was done you would be permanently separated from him.  That was the pain that God could not live with.  That was the pain that made Jesus’ death worth suffering.  “God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life”.  God loves you that much.  Jesus would rather go through all that than lose you.

So as you stand in front of that tomb, with the cold breeze beginning to chill your skin, with the feelings of pain and loss still like an open wound, with the bittersweet Palm Sunday still a poignant memory, with the promised resurrection still some way off, when all seems lost, remember this – God loves you.  That’s what it was all for.  So let’s bow before him, in submission, and adoration, and let’s love him too.

Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkedin
Share On Pinterest
Share On Reddit
Share On Stumbleupon
Contact us

Don’t feed the pigeons

This is a short story I wrote on the way back from London.  Let me know what you think in the comments below!


As he stepped onto the platform the low, persistent rumble of the train was replaced by an altogether more muddled and frenetic ambiance. London. Liverpool Street station reverberated to the sound of idling machinery, countless footsteps, half-conversations and ringtones, all distorted by echoes from the previous second, or minute, or years, he could not tell which.

It was to be an unusually casual visit this time, simply passing through the capital on his way to Taunton to visit his grandmother. But thanks to an almost comedic experience trying to book his ticket online, which was punctuated by expletives of increasing volume and intensity, and nearly ending in a broken keyboard, he had ended up with nearly three hours between arriving in Liverpool Street station and leaving Paddington station. Normally he would expect to make the cross-capital trek on the underground in less than forty five minutes. But his stubbornness would not permit him to phone the train company and admit his error, so he would just have to live with it. And, after all, what’s the harm in a little more time in London?

His first objective was food. His lovingly prepared cheese and tomato sandwich, accompanied by a bag of Walker’s crisps (cheese and onion) and a supplement of tap water in a plastic Coke bottle, were on the kitchen table, enjoying an unexpected reprise. So he bought a tuna mayo sub and a bottle of actual Coke, and mentally apologised to his credit card for the inconvenience.

It was warm, for October. At least, it had been when he got onto the train at Chelmsford. London always seemed to have its own ecosystem, so it was never a guarantee that the weather would be the same half an hour away. But he would have to wait to find out for sure, because he was already descending into the bowels of the earth to board the circle line. Daylight would have to wait.

It wasn’t until shortly before the train arrived at the next station that he concluded he definitely was on the wrong train. He had meant to go anti-clockwise on the circle line, but this one was going clockwise. No matter. He’d get there eventually, and since he had more time than usual it wasn’t a problem anyway. In fact, now that the opportunity had presented itself, he decided to get off at Tower Hill and take a look at Tower Bridge. It would be a nice place to eat his lunch.

Signage at railway stations is big business, he mused. Posters advertised films he wasn’t interested in seeing, books he had no intention of reading, shows he didn’t have time to attend. Arrows pointed in all directions, frequently missing out the key bit of information that would have made them useful. He was informed not to leave baggage unattended, to mind the gap, and not to feed the pigeons. Most of them he simply ignored.

Tower bridge was only fairly impressive. He hadn’t actually seen it since he was a child. Not in person, at least. It was one of those landmarks that everyone knew about, and featured in every film wishing to let its audience know it was set in England. But for all its familiarity, he had never got round to actually visiting it recently. The sun shone on it brightly, but it nevertheless wasn’t nearly as vivid or as large as he had expected. He found a wooden bench to sit on and unwrapped his sub sandwich.

Pigeons are a familiar sight in London, so it was no surprised when one landed in front of him. Vermin, he thought, you’re not getting any of my lunch. It hopped around, head bobbing mechanically back and forth as it searched the ground for sustenance. He noticed it had only one good foot, and hence the hopping; the other was shrivelled, and since the bird didn’t appear to be putting any weight on it he guessed it was hurt. A fairly common injury, he presumed. Not being an ‘animal person’, as he put it, his heart strings rarely sang at the plight of creatures stupid enough to get themselves hurt. But this one was looking at him with such pleading in its eyes that even he felt sorry for it.

Thinking back, he’d never noticed birds being able to convey emotion before. Their eyes were always completely open, their face set. But this one definitely looked at him, so he thought, with a sense of yearning, longing, almost desperation. He stopped, mid-chew, and the two of them stared into each other’s eyes for a moment. He broke off a corner of his bread, and tossed it onto the pavement.

As he waited on the platform to catch the next circle line train, he noticed he was being watched. On the opposite platform stood a man, propped up against the wall, looking directly at him. There’s an unwritten rule, which somehow feels as if it should outdate the underground itself, that you never make eye contact on the tube. He found it quite unnerving seeing someone blatantly flaunting the tradition. He tried not to return the gaze, but curiosity is a powerful adversary. He looked at the floor, at the posters he had previously disregarded, at the hopping pigeon that had landed near him, at his watch, at the wall, at anything other than the man he could see was still watching him. Thankfully his train arrived, blocking the view, and he got on. He found a seat with his back to the other platform, so as to be sure not to see the man again.

With that unpleasantness behind him, he checked his watch. There was still plenty of time. He resolved to get off again at St James’s Park and have a wander, to make the most of the good weather. He was looking at the signs on the wall to make sure he found the exit, so didn’t see what was waiting for him at the other end of the platform.

Up the escalators, through the gates, and out into the sunshine again. It was London, so it was noisy, and you couldn’t exactly call it fresh air, but it was pleasant enough given that it should have been Autumn. He found his way into the park and reduced his pace to an amble. There was no need to rush, there was plenty of time.

He naturally expected the bird to move out of his way as he approached. Having nearly tripped over it, he wondered whether it was blind. It certainly had a damaged foot, like the other one he’d seen. Or was it two? He couldn’t remember. And he was distracted from trying to remember, because the bird definitely was looking at him, and clearly not blind. In fact, he could have sworn that the bird was smiling at him. Not in a friendly way, but with what he could only describe as a sense of morbid satisfaction. It was uncanny.

“So,” said a voice behind him, “you fed my pigeon, eh?”

He turned to find himself face to face with the man from the other platform, the one he had left behind at Tower Hill station. He looked more shabby close up. His waxy trench coat was stained, his hair was unbrushed and looked like it had bits of dead grass in it, and his topmost jumper (he appeared to be wearing several) was peppered with small holes.

“Excuse me?” He replied as courteously and confidently as he could, but wasn’t able to completely stifle the wavering in his voice.

“My pigeon,” the man restated, in a matter-of-fact tone, pointing at the bird at his feet, “you fed it.”

“Have… Have I done something wrong?” he answered, his mind thinking back to the sign at the station.

“No, no, mate! Of course not.” The man grinned, showing yellowed teeth, and a couple of gaps. “Now tell me,” he continued, producing a notebook and pencil from an inside pocket, “what’s your name, sir?”

Being called “mate” and “sir” in the same sentence seemed a little contradictory, so he still wasn’t sure whether he should consider this man an authority to be feared, a homeless nobody to be ignored, or something else entirely.

“Uh, my name is Martin. Martin Alford.”

“Martin… Alford, right.” The man scribbled the name illegibly in his notebook. “Good. I like to keep a record of these things. You know, for posterity.”

“And, when you say ‘your’ pigeon…”

“Oh, they’re all my pigeons. All the injured ones, that is. This one here has been mine for nearly a year now.”

“Ah, I see,” Martin replied, tentatively connecting the dots as he went along, “so you look after them? Are you with the RSPCA or something?”

The man looked directly at him out of eyes that seemed older than the body they were in, slightly misty, but which seemed to pierce the soul. His mouth attempted a grin at one corner.

“No, I’m not with the RSPCA. They would put this poor creature down, on account of his foot. Got it caught in a grating last winter. Gives him terrible pain, hardly sleeps at night.”

“Then, surely it would be kinder to…”

“Kinder?” the man retorted. “Kinder to kill it? You’ve got a funny sense of kindness, mate, I’ll tell you that. No, I don’t kill them.” He leaned in closer, as a drunk will tell a ‘secret’ to a ‘friend’. “I give them life!”

Martin looked around him. There were other people passing by in the park, but none seemed even slightly aware of his conversation with the man, none taking the slightest notice of the pigeon standing at their feet, looking utterly delighted with itself.  As far as he could tell, there was no escaping this conversation.

“Look, if you’re asking for money, I’m afraid I don’t have any,” he lied, as convincingly as he could manage.

“Money’s not my currency,” the man replied, with an undertone that Martin began to fear with increasing intensity. The man seemed to tower over him in a way that he hadn’t before. “Like I said, I deal in life. I help them, those poor suffering pigeons, cos no one else will. They’re alive as much as you are, except you treat em like vermin. Not much of a life, is it? So I help them. I give them the life they deserve, after all they’ve gone through. I guess you could call me a saint, if you like, sent to help them. To give them life. In this case, yours.”

Martin gazed up at the giant of a man that stood before him, in utter terror. Like that moment immediately after a nightmare, his scream was silent. His foot throbbed with pain.

“Seems like a fair trade to me,” the man said. He turned and bowed slightly to figure next to him, who looked much like Martin had, but who now wore an expression of relief and satisfaction, almost excitement. “No need to rush, my friend, you’ve got plenty of time now.” The figure nodded in return and walked casually away. The man flipped his notebook closed.

“Don’t worry,” winked the man in the wax coat to the trembling pigeon at his feet, “Jimmy will look after you. Welcome to my park.”

Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkedin
Share On Pinterest
Share On Reddit
Share On Stumbleupon
Contact us

Minecraft, RSI and indispensability


This year I finally gave in.  I’m a creative sort of person, and I love Lego, and I love computer games, and I all too easily get lost in both of those pastimes.  So for the sake of everyone around me, I avoided Minecraft.  It combines many of the things I love most, and I could just see that once I started I wouldn’t be able to put it down.

It was when I saw my 5-year-old son playing Minecraft on my brother’s iPad that I realised I had to succumb.  It was so intuitive, tapping the screen and creating a world without limits, and Samuel loved it.  So, after much discussion with my darling wife, I paid for and downloaded Minecraft onto all my mobile devices, so that my kids could play it.  It is educational, after all.  And I’d need to be able to help them, so I had to force myself to play it too.  Poor me.

I have to say, it’s brilliant.  I love the flexibility, the way it encourages exploration and creativity and imagination.  The blockiness of it reminds me of the classic computer games I grew up with, so it’s somehow familiar.  So this year some of my favourite moments have been sat on the sofa, with a child on either side, all of us playing Minecraft together.  Bliss.


Well, it was bliss, until one evening when my thumb and wrist started aching.  That particular evening I had only been playing for about 45 minutes, but clearly it was enough.  The pain slowly spread up my forearm.  Stupid Minecraft.  I expect my general lifestyle probably contributed – I spend my working days frantically programming, and my weekends frantically strumming guitar strings, with the occasional bit of Lego in between, so my hands don’t exactly get much opportunity to rest.  But I’m going to blame Minecraft.

As the days and weeks rolled by, the pain didn’t go away.  I found myself unable to play musical instruments, and even typing and generally using a computer became a painful experience.  I tentatively self-diagnosed RSI (Repetitive Strain Injury), and bought myself a couple of wrist braces online (because at the time both wrists were suffering).  Rest, I decided was the best thing to do.

I did have a slight incident with Deep Heat, however.  You may have come across this product before – it’s meant to gently warm the muscles to relieve pain and help recovery.  I happened to have a spray version that I had bought a year or two ago when I strained my toe, and I figured it would work on my aching arms too.  So I sprayed it on.  And watched as both arms turned red and puffy and stung like crazy.  I bathed my arms in cold water, and after a couple of hours they began to return to normal.  A bit of a scare, I can tell you, especially because I was home alone looking after the kids with no transport.

Anyway, this week I finally got round to seeing a GP about it.  I described the symptoms, he pulled my wrists around a bit, and he prescribed me some anti-inflammatory pills and some hand exercises.  He ruled out Carpel Tunnel Syndrome (phew!), but didn’t think it was technically RSI; he thinks it’s probably just a muscle inflammation in the arm.  Personally, I still think there’s more too it, because it seems rooted in what I’m doing with my thumb, more than the arm itself.  Time will tell.


Last night my vicar prayed for me.  He prayed that if there was a lesson to be learned in this, that I would learn it quickly and then return to full health, and if there wasn’t a lesson to be learned that God would heal it immediately.  I’m deeply grateful to him for that prayer, because it got me thinking.  I wasn’t healed.  Others have prayed for healing recently too, and I wasn’t healed instantly then either.  So perhaps there is something for me to learn first.

At work, I am the only web developer.  If I’m not working, stuff doesn’t happen.  I’m indispensable.  Losing full use of one of my hands would cause inconvenience (and potentially worse) for the business.  At church, I’m the only guitarist, one of only three worship leaders (and the only one of the three that plays an instrument).  If I’m unable to play, it means all our music has to be played by one pianist, who is no longer allowed a week off.  I’m indispensable there too.

And that, perhaps, is where the lesson must be learnt.  I see myself as indispensable because I haven’t built up others to support me.  Work relies on me to be awesome, but there’s no one to share the awesomeness with, and no safety net in case I’m less than awesome.  Similarly, at church everyone relies on me to lead worship and play in the band, and there is no contingency if I can’t.  Maybe a lesson to be learnt here is to be more humble, and to actively bring others in to support me, maybe even replace me in the longer-term.  Nowhere should be so fragile that the loss of one person is crippling, and one person shouldn’t have that responsibility either.

What next?

I’m on a course of anti-inflammatory pills, so hopefully I’ll fully recover the use of my wrist.  And at that point I may begin playing Minecraft again, though perhaps for shorter periods.  In the meantime, I’ll need to put measures in place at work to find development agencies that can work alongside me on projects.  And at church we’ll need to put out another plea for more musicians.  And one day, just maybe, I’ll get round to forgiving Minecraft for being so addictive.

Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkedin
Share On Pinterest
Share On Reddit
Share On Stumbleupon
Contact us

Mark 10: what it means to serve

This is a sermon I preached at St Peter & St Paul Shepton Mallet on Mark 10:35-45.

James and John asked Jesus which of them would sit at his left and right in his kingdom.  But Jesus told them to serve, not seek prestige.  We are to be counter-cultural.  To serve means that we need to think about others first, to be vulnerable, and to accept God’s ownership of us.

Listen to the sermon above.

Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkedin
Share On Pinterest
Share On Reddit
Share On Stumbleupon
Contact us

How to make an object oriented WordPress plugin

If you’re thinking of creating a WordPress plugin, whether small or large, for your own use or the whole world to benefit from, it’s important to start right.  Most of the example code on the WordPress documentation shows the functionalities in a procedural layout, because that makes it easier to explain.  But best practice is to use modern programming techniques – classes, inheritance, closures, and so on.

This tutorial will take you through the process of creating a very basic WordPress plugin, but created the right way.  This is partly intended to be a helpful reminder to me next time I’m creating a plugin, but hopefully others will find it useful too!

What we’ll be making

This plugin will provide an options screen in the WordPress back-end for the admin to specify how many things he has.  On the front-end, we’ll use a shortcode to display a form to ask visitors how many things they’ve got.  We’ll handle the form submission, store the number of things the visitor has in our database, and then use another shortcode to display how many things we all have in total.

It’s a pretty lame plugin, really.  But it will allow us to go through the process of making an options page, creating shortcodes, using templates, and handling form submissions.

Step 1: Naming conventions

An important thing to decide before you even put fingers to the keyboard is what to call your plugin.  Even if you’re the only person who will ever use it, you need to be sure that someone else isn’t using the same plugin name so that you don’t run into issues later.  A quick search in the plugin directory will answer your question.  And remember that it’s about the internal name, not the display name; you’ll see what I mean in a moment.  If you’ve ever asked yourself how many Daves you know, you’ll understand why unique naming is important.

First create a folder under /wp-content/plugins/  with the name of your plugin, for example /wp-content/plugins/md-things-plugin/ .  The folder name should be unique in the entire WordPress plugin ecosystem.  In theory I suppose you could use a random string here, but that would just look weird, so don’t do that.

Next, create a PHP file in that folder with the same unique name, in this case md-things-plugin.php .  For clarity it’s important that the names match, not because WordPress will get confused but because you might, or another developer who looks at the code.

Step 2: The class

Here’s our first bit of code, in md-things-plugin.php.

The comment block at the top is important, as that’s what will be displayed in your WordPress plugins page to tell everyone what the plugin is.  Technically the plugin name here doesn’t need to be unique, but it helps you be sure which plugin you’re activating!  You can probably work out what the other comments are about.

Next, we create the class, again using that unique name.  We wouldn’t want to run into issues where other plugins are using the same class name!  We’ll create a __construct()  function, which we’ll put stuff into later.  And then, finally, we simply use a variable to create an instance of the class.  The variable itself won’t be used directly, but it’s a way of making sure the class is run.

Step 3: Activate and deactivate

The first thing you do when you install a plugin is activate it.  Some plugin don’t need to do anything when they activate, but if yours does then you’ll need to catch that event and do something with it.  In our case, our plugin will need to set up a database table to store the number of things visitors have.

First off, we only want to listen out for activation/deactivation when we’re logged in as an administrator, so we’ll use is_admin()  to conditionally check.  And we’ll use register_activation_hook()  to listen out for the activation event.

There are a couple of bits of magic here.  First, notice the array in the register_activation_hook()  call.  In the WordPress documentation the first example (which is the one people read first) just has a string containing the name of the function, but since we’re using an object oriented approach our function is in a class, and using array(&$this,'activate')  is the way to do it.  It’ll go off and find the public function activate()  in the current class.  Neat!

In the activate()  function itself, we’re using the global $wpdb  object, which is how we safely access the database.  I won’t go into too much detail here on how to use the WordPress database, you can look that up yourself.  But what I do want to highlight is the dbDelta()  function.  That looks at the SQL code we’ve provided, and applies it to the database.  If the table doesn’t already exist, it makes it.  So when the plugin is activated, that table will be created too, assuming it wasn’t there already.

For deactivation it’s pretty much the same deal, but using register_deactivation_hook() .  It’s up to you whether you do anything with the database you created on activation – you may want to leave it all there, or truncate the data, or drop the table completely.  Up to you.

Step 4: The options page

This step is a little more messy, in my opinion, but I’ll try to make it clear what’s going on.  Once again, we’re only interested in the options page if we’re looking at the back-end of WordPress, so we’ll add our listener in there.

The first action uses the same technique used before of sending the event to a function within our class; I’ll show you what goes in there in a moment.

But you’ll notice that the second action we’re listening for doesn’t reference a class function, but uses a closure instead.  Why?  Personal preference really.  I didn’t see the point in creating a whole new function just for one line of code.  Keeping it in a closure doesn’t affect the functionality, and keeps the class tidy and easy to understand.  In this case, all we’re saying is that when the WP admin screen initialises we want to make sure there is a setting available for our options page to use.  Again, that will become clear later.

So, let’s look at the first action we set up, which listens for the admin_menu  action.  This allows us to add a menu item to the WordPress sidebar.  The function looks something like this:

You’ll need to refer to the documentation for add_management_page()  to see the full range of options available, but in this case we’re adding a menu item to the sidebar (as a subitem of ‘Tools’) that will be called “MD Things”, which will only be visible if the logged in user has permissions to manage_options  (so usually an Administrator).  It’s only one line, so why not put it in a closure like the other action?  Notice the last argument – we’re referring to $this , which wouldn’t work in the context of a closure.  That last bit is important, because that references another function in our class that actually displays the options page:

First of all it checks that we actually have permission to view the options page, and chucks us out if we haven’t.  It’s an unlikely scenario to have to cater for, but best to be safe.  Then we tell WordPress that our plugin uses an option variable, using get_option() .  And, finally, we show the options page itself.  This approach is my personal preference, and don’t feel you have to include the ‘.tpl’ bit in the filename if you prefer a different convention.  Here’s what options.tpl.php  looks like:

There are some styling conventions in WordPress, although I’ve found they’re not particularly well documented, so the best thing I can recommend is to look at the HTML of an existing plugin options page and replicate it.

But functionally, that’s it.  When you hit the submit button WordPress will automatically handle the form submission and save your data in the setting for this plugin.  You don’t need to worry about database access or parsing or anything… WordPress just works.

Something else that saves our bacon is that we’re saving all our settings as an array of values.  We register one option for the plugin via register_setting() , and we store all our settings as an array within that option, for example in the input above name="md_things_plugin[mythings]" .  The beauty of this is that if our plugin needed more settings, we simply add another element to the array, rather than having to create more options with register_setting() .  Nice and tidy.

Step 5: Asking for visitor input

We’re going to need a shortcode to display a form.  Again, the WordPress documentation would have you believe that this is done procedurally, but it doesn’t have to be.  I like to separate my functionality from my display, so I use template files to keep things tidy.

I’m using a closure again, because it’s tidy, but you could use a class function if you prefer.  All I’m doing here is including the template file, which looks something like this:

Now if we put that [md_things_form]  shortcode on a WordPress page or post somewhere, it will show our form.  When the form is submitted, it will be sent to WordPress’s internal admin-post.php  file, which we can hook into to process the form ourselves.  Here’s how we do that, again adding to the __construct()  function:

admin_post_  listens for post data sent to the admin-post.php  file, nopriv_  listens only to post requests that come through from someone who is not logged in, and md_things_visitor  is the identified we passed from the form submit button.  We can then route the request to a class function:

This inserts a new row in our database table, storing the value the visitor entered into the form.  I’m using intval()  to validate the input, but you might want to use something else depending on the format you expect.  Then it redirects back to the page we came from, as specified in the other input in the form (if anyone knows of a better way of doing this, let me know!).

As an added bonus, we can make that form template include a bit more information.  For instance, this bit of code would show the value our administrator put into the WordPress options page:

We can also create a static function in our class and reference it directly from the template:


Hopefully that’s given you enough to get started writing your own object oriented WordPress plugin.  If I’ve missed anything, or if you’ve spotted any mistakes, let me know in the comments below!

Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkedin
Share On Pinterest
Share On Reddit
Share On Stumbleupon
Contact us