Walter Higgins

Tinkering with Software & the Web

Marathon Report

2017/06/05 11:25

So I ran my 2nd Marathon yesterday in Cork City. It was a 9am start, beautiful weather, clear blue skies and not as hot (early in the race) as it was last year. In the week leading up to it I had the usual pre-marathon niggles - a calf injury inflicted during last Tuesday's run and a groin strain during a kickabout with Sean on Saturday (you can hear Alan Partridge's sports commentary in your head right now). I woke up Sunday morning wondering if I'd make it through 1 mile never mind 26.

I woke at 5:45 am and did my usual pre-marathon prep. An early breakfast at 6:00am, some stretching and last minute packing. I put band-aids on my nipples to avoid the dreaded nipple-chafing but forgot about the other parts (more on that later - if you can stomach it). After last year's blistering heat I opted for a single instead of my usual short-sleeve running top. I didn't bother with music this time round. I've stopped listening to music while training the last couple of weeks and haven't missed it as much as I thought I would. Besides, for a Marathon where there's great support from the crowd, running with earphones in your ear means you miss out on all that buzz.

I drove to the Black Ash park-and-ride and arrived in time for the 1st bus at 7:30 am. I was in City Hall before 8am with plenty of time to kill. I hung around for a bit before heading to the start point on Patrick Street where I sound found Conor and Catherine. We took some pictures and chatted for a while before taking our positions in the huddle. I stood a few yards back from the 4:00 pacers. My plan was to keep them in my sights for as long as possible and aim for a sub-4:00 time. That was the plan at least.

Top athletes before the carnage of @TheCorkMarathon /cc @walter pic.twitter.com/BdeVGWdEqv

— Conor O'Neill (@conoro) June 4, 2017

In a city Marathon with more than a 1000 runners, the first mile will inevitably be slow, I'd planned for that. My first mile was 9:53 minutes but I wasn't too bothered, there was plenty of time and distance to catch up with the 4:00 hour pacers. It was a beautiful clear-skied morning and I was soaking up the atmosphere more so than I had last year. The first few miles flew by (the first in particular - my watch beeped as I passed the first mile and I couldn't believe it) - so much so I was running faster than I'd planned - just under 9:00 minutes per mile. I didn't fret too much about the pace - I was having such a good time. Along the quays by the train station I was admiring the view of the wide river lee and thinking 'This is Glorious'. For the first 8 miles I was on a runner's high. Just completely enjoying the experience of running in a pack on a beautiful morning. The running was easy and a little faster than planned - my fastest mile was mile 6 which I ran at 8:30 pace. Running through the Jack Lynch tunnel is always an experience. The stretch from the tunnel to the Mahon Point off-ramp seemed longer than I remembered but I was still comfortable and on pace. I got running in lock-step with and talking to another runner who was also aiming for sub 4:00 and it was also his second marathon. We chatted for a while and actually stayed pretty much in lock-step from mile 8 through mile 14.

The first minor glitch happened as I was nearing the 13 mile mark. There's a short ramp leading up to a pedestrian overpass on the M8. I grabbed a slice of orange and sucked on it as I started up the ramp. By the time I'd reached the top of the ramp and discarded the orange skin, I was short of breath and my legs hurt. It only lasted a couple of seconds but it was the first discomfort I felt on the run. I was still on target and even caught up with one of the 4:00 pacers. Along the old railway stretch of the route I began to lag behind the pacers. I was still running and chatting with my fellow 2nd-timer but decided I needed to push on a bit faster to catch up. This is when slowly but surely my hopes of a sub-4 marathon began to dissipate. By the time I got back on to the Marina the 4:00 pacers were nowhere to be seen. I forged on ahead. I was still doing 9:15 and 9:30 miles now so hope wasn't entirely lost.

In the fortnight leading up to the race I'd planned some landmarks and times I needed to do a sub-4:00 marathon. The 10 mile mark was along the blackrock road and I'd need do it in 1 hour 31 minutes and 30 seconds. The next landmark was 16 miles at Lapp's Quay. I'd need to be there by 2:26:24 to stay on target, after that 20 miles just beyond the Lough at 3:03:00 then 23 miles on the Curraheend road and home. Breaking up the Marathon into 10, 16, 20 and 23 sections made it more manageable in my head. I knew I could race 16 miles because I'd done 2 point-to-point races of similar distance in the last couple of months. I didn't tick off the miles because there were too many and if I thought about it too much it would be overwhelming.

At the 16 mile mark I looked at my watch. 2:29 - I was just 3 minutes off of my sub 4:00 target at that stage. As I ran up the south link road, I knew what lay ahead - a viciously steep corkscrew on-ramp on to Turner's Cross. On the approach I was repeating aloud a mantra I'd promised myself "Do not walk. Do not walk.". A runner alongside me said "If it's all the same to you, I think I'll walk this part". I can't say I blamed him - the onramp is steep. I ran it and was out-of-breath as I turned on to Turner's cross. By now I was running with effort. The support from the crowd through Turner's Cross and Togher was great but the hills - my god the hills. The route this year changed to avoid churches and sunday mass so much of this stretch was unfamiliar. I just remember having to repeat my "Do not walk" mantra many times through Togher.

At mile 19 disaster struck and I had a pretty severe stitch in my right leg (the same leg I'd injured twice in the days leading up to the Marathon). It was so severe I had to stop and stretch for a minute before gingerly taking off again. At the Lough there was great support from the crowd. A water station, sponges, and a friendly local with a garden hose set to 'mist' was just what I needed. Another boost was catching co-worker and fellow runner Irene in the crowd (she'd planned to run the relay race but had to cancel). I'd seen Irene and her family near the 10 mile mark earlier. I'm pretty sure my form wasn't as good at the 19 mile mark. I was dimly aware of some chafing on my right big toe and on my arms but it barely registered as a background niggle.

At the 20 mile mark spectators were chanting bib numbers to egg us on - our bibs didn't include names this year (something I think needs to be fixed next year). "318! 318!" they chanted as I approached. I have to say the support from spectators MAKES ALL THE DIFFERENCE when you're running a Marathon. I feed off of it as I'm sure other runners do. Kids holding out their hands to be slapped by passing runners, spectators with jelly babies, sliced oranges and sweets. The cheers. IT ALL HELPS. It's something I enjoyed and needed much more this year than last year. Last year I ran with Music and earphones and missed out on this important aspect.

It was downhill towards Farmer's cross but I knew I'd be paying for this easy downhill section shortly. We were heading towards another rerouted section - a long uphill stretch at Faranlea Road, Faranlea Park and on to Model Farm road. As I headed up Faranlea Park I heard a friendly "Hello" from Brendan, a former colleague. Brendan is a fast runner and was doing 2 sections of the relay race. "How's it going?" he asked. I can't even remember what I replied. "Come on! This is the last hill." he said. "I probably shouldn't be trying to keep up with you - I've seen your strava runs" I replied. "Stay with me til the top of the hill then, and I'll push on". So I did. Brendan was a life-saver at that point. You need all the support you can get.

The downhill stretch of the Model Farm Road was the only thing keeping me running. The promise I made to myself to not walk now had a sub-clause "do not walk except at water stations". It was past noon now, the day was heating up and my legs were exhausted. As I turned on to the Curraheen road I tried to pick up speed - this is a road I often run along in training so I knew there were just 3.2 miles left. Pretty soon I was walking again, right up to the point where the 4:15 pacers passed me out along the Lee Fields. "Uh oh" I thought - "Can't let that happen". I started running again and stuck with the 4:15 pacers right up until the Kingsley Hotel where my legs failed me again and I just had to walk. I must have walked the whole stretch from the Kingsley up to the Mardyke Arena before taking off again. By now the 4:15 pacers were out of sight. I was surrounded by people walking and shuffling their way along, just like me. It's super easy to stop running and just walk when your legs are tired and you're surrounded by walkers. It takes real force of will to keep running - will which I just didn't have on the day. Things weren't as bad as last year but still, I had promised myself I wouldn't walk no matter what and I'd broken that promise.

They say the last 6.2 miles is equal in effort to the first 20 miles and that felt true. In truth though, yesterday's Marathon also felt easier than last year's. In many ways this feels like my first - not second - Marathon. It's the first Marathon I truly raced. The first where I just wanted to finish the damn thing as quickly as possible. The 15 mile and 25k point-to-point races I've done since my first Marathon have given me a sharper more competitive edge. Last year's Marathon training didn't go to plan - I ramped up too quickly and too early and got injured, so I was holding back on the day just hoping to complete it without further injury. This year the training went better - I didn't hold back - I was racing not just participating.

Mile 26 began with a walk but shortly after crossing the Mardyke Bridge I began running (well - jogging) again and continued to do so for the rest of the race. This was it - the final stretch. "You can do this" I repeated to myself "Do not walk!" I said to myself as I ran along Wise's Quay and crossed the bridge on to North Main street. This was another stretch which was part of a reroute. North main street normally isn't the most picturesque of Cork city streets but I was glad to see it: the final stretch - nearly home. The street has cobbled speed ramps which didn't cause too much of a problem (for me at least). I looked at my watch about halfway up North Main street - it read 4:15:00. My head was foggy but I was pretty sure I could finish in under 4:20 barring any catastrophes and this gave me a bit of a boost. North Main street was lined with spectators cheering and the noise of the crowd became progressively louder as we turned on to Washington street, the Grand Parade and then Patrick Street. Patrick Street is Cork's main street. In previous years the finish line was about half way up the street and you'd arrive there from the opposite end of the street (turning Right on to it from Lavitt's Quay). I got it into my head that the finish line was nearer the west end of the street (near Carey's Lane) and so started my final kick as I turned on to Grand Parade. As it turned out the finish line was much further east (east of Opera Lane) - still I kept going. Soon I could see the finish line and the clock read 4:18:49. I sprinted to the finish to get in just under the 4:19:00 mark (even though I knew the clock time was meaningless - I had a chip and a GPS watch). That last mad dash for the finish took more out of me than I imagined.

I crossed the finish line and as soon as I did I felt a strange pain across my shoulders and upper arms. I stopped my watch at 4:17:42. I shook my arms and stretched them above my head. I'd really given it my all for that last stretch and final dash and as soon as I stopped the overriding pains in my legs were replaced by other pains I had barely noticed. My arms were badly chafed and the blister I'd felt forming around the 20 mile mark was now screaming for attention. Alongside all of this was the most incredible feeling - a feeling of accomplishment and euphoria. The whole experience while it lasted was properly overwhelming. I began looking for Ursula and the kids in the crowd but couldn't see them. Within yards of the finish line I stopped to lean against a table and just gasped for breath. Two women either side of me were catching their breath too. The finishing area was a good 100 yards or so and I knew I had to get water and something to eat. There were tables covered in Chocolate bars and Water bottles. I grabbed a water bottle and saw the Banana table just a few yards ahead. I grabbed one, clumsily skinned it and wolfed it down with some water. I was starting to feel better already. 4:17:42 That's a time I could live with. I was happy. I rang Ursula to see where she was - they'd gotten caught up in Marathon traffic reroutes and were on North Main street but would be on Patrick Street in 5 minutes. I'd suggested they be there for 1:15pm (assuming a 4:15 time - I'd had 3 times in mind 4:30 , 4:15 and 4:00 and figured it was best to tell them the median time - I didn't want them waiting too long if I didn't make the 4:00 pace).

While I was waiting for Ursula I saw Kelson - another work colleague - finish. We'd passed each other once or twice around the 8 mile mark. "How did you do?" I asked. "Happy enough - under 4:30". I was pleased for him - pleased for everybody actually. My first Marathon had felt much more like a solo affair - maybe it was the earphones but I didn't relish and savor the experience as much as I should have. This time was different - it felt much more like a communal experience. I was genuinely happy to see even passingly familiar faces. Ursula and the kids showed up just as I wished Kelson farewell. We took a picture of me and the kids.

Cork 2017 Marathon

Now came the post-race logistics. Where to grab lunch with Ursula and the kids. But first I had to shower and change clothes. Joe - another colleague - had tipped me off about post-marathon showers in the Clayton hotel - it was just across the river from the baggage drop in city hall and for 5 euro you could avail of their changing rooms and showers. I said I'd meet Ursula and the kids again in a few minutes after I'd showered and changed and then we could figure out where to eat. I picked up my bag from City Hall and headed over to the Clayton. There were plenty other Marathon runners there. The Mens changing room was busy. I hopped into a shower and began washing. That's when I realised just how bad my chafing was. I stupidly hadn't put body-glide or anti-chafing cream on before the race and as I started cleaning my - let's say - sensitive bits I realised just how bad the chafing was. Let's just say I emitted a short high-pitched involuntary squeal - one that must have had the all-male attendees wondering if a girl was in the men's showers. I finished up and - very tenderly - dried myself off, got changed and swore to stock up on body-glide next year.

I headed out back towards Patrick street and by now the knees were starting to feel like jelly already. I was feeling that exquisite long-run pain in my ankles and knees and was already walking like John Wayne - as were many others. The city center was buzzing with post-marathon activity - many of the runners now cooling off outside bars with pints of beer. I caught up with Ursula and the kids and we decided to go for Chinese in Yuan Ming Yuan - a favorite of ours - they do great dumplings. As I turned off Patrick street I spotted Conor approaching the finish line - he was running strong. I ran over to the barrier to cheer him on but I'm not sure he heard me. We headed on up towards Princes Street and opted for seafood in Quinlans instead. It was good to finally sit down and rest. My legs were aching but I was still basking in the feeling of accomplishment. Lunch with the family was the perfect end to a good Marathon - another difference from last year when I could only spend a little time with the family because our eldest was heading to Waterford for a 3 week stay in the Gaeltacht.

This felt more like a Marathon - everything went better, the training, the weather on the day, the race, support from the crowds and little moments along the way. And of the course the Finish which felt incredible compared to last year's damp squib. It was properly overwhelming. I'm already considering when my next one will be.

Categories

Running

Cork City Marathon 2017

2017/05/07 17:03

Four weeks from today I'll be running the Cork City Marathon. It will be only my 2nd Marathon. This one is a grudge match. I ran the same race last year and finished in 4 hours 52 minutes. Not a great finish time. I've been training for this upcoming one since late February and (knock on wood) the training has been going exactly to plan so far.

This morning I finished my 2nd long run (17.4 miles) from home in Ballincollig west of Cork City to BlackRock Village east of Cork city and back. I had a great race two weeks ago - the Great Railway run from Cork to Carrigaline - a 25 Kilometer distance. I averaged 8:46 per mile in that race - almost fast enough to revive hopes of a sub-4 hour marathon. I'd need to average 9:09 per mile to do a sub-4 marathon. I don't know if the legs, lungs, heart and training are up to that just yet.

I have just one more long run - 20 miles next Sunday, then the Taper begins. In the lead up to a Marathon it becomes all-consuming. I fluctuate between thinking I can realistically do a sub-4. At the very least I hope to do a sub 4:30 . If I take longer than that I'll be disappointed. There's a lot that can go wrong in a Marathon. Last year I injured myself in Training - I ramped up the miles too quickly and too early. This year I've been sticking to a more conservative plan which only increases mileage at a rate of < 10% per week. Last year, the day of the Marathon was quite warm. I held back for the first 5 miles sticking to a 11 min pace. To be honest I was so nervous about the injury and making it worse that I was just happy to get around the full 26.2 miles. This year I have 3 time bands in mind.

If I complete it in under 4 hours 30 minutes I'll be happy. If I do it in under 4 hours 15 minutes I'll be happier. If I do a sub 4 I'll be over the moon.

Just four weeks to go so we'll see. If you're on strava you can see my training log.

Categories

The Witcher Books

2017/04/17 15:15

The Witcher videogame for PS4 was on sale recently for €17.99 on Playstation Network. It's been widely revered as one of the best videogames of all time so I went ahead and purchased. That was more than a month ago and I still haven't actually played it yet. That's because I can only afford to have one videogame addiction at a time and my current addiction is still Metal Gear Solid V: The Phantom Pain.

Almost as interesting as The Witcher game is the story of how it was made. It was developed by a relatively small Polish Game Development Studio who by all accounts have been punching well above their weight. The games are based on a series of books by Polish writer Andrzej Sapkowski. I was frankly afraid to start playing this game based on what I'd heard about it. Given how much time I've ploughed into Metal Gear Solid, I could well see myself getting completely lost in The Witcher. Rather than actually play the game, I watched a couple of videos about it.

This led me to reading the books. They're good. They're very very good. If you like Game of Thrones, you'll love Sapkowski's salty fantasy world of The Witcher. The first book I read was 'The Last Wish' - this is the first book in which Yennifer (A sorceress who features in the videogame) makes an appearance. Also recommended is follow-up book 'Sword of Destiny' which features Ciri (also a character in the Videogame). Both books are collections of short stories which were written in the early 90s. The author seems to be ambivalent about the success of the videogame but its success has surely brought him more readers. Were it not for the videogame (which I still haven't played), I would never have heard of these books. Sapkowski's books deserve a wider audience. He's a good writer and the books are fun and entertaining. Highly recommended. I may even some day play the video game of the books.

Categories

fantasy, books

Metal Gear Solid

2017/04/17 14:54

We got a PlayStation 4 for Christmas this year. It was 9 years since we last bought a Gaming Console so it was time. I picked up Metal Gear Solid V : The Definitive Edition for €27.99 - a steal.

I'm a fan of Stealth games - I loved GoldenEye for the Wii. I'd never played any of the Metal Gear Solid series, despite having a PlayStation one many years ago. MGS V had been getting great reviews so I gave it a shot. So far I've put about 100 hours into the game. Yes. I like this game a lot. It is surprisingly deep - a game that for the most part rewards slow thoughtful play rather than rushing in all guns blazing. Much of the fun of MGS V is to be had simply sneaking up on sites and surveying the lay of the land from a safe distance, then picking off targets one by one.

It's been almost 4 months now since I started playing and I still haven't become bored with the game. There is a lot to love about this game but it's not without glaring faults. The story is complete nonsense and the overtly sexualized female companion 'Quiet' is a little troubling. The start of the game consists of - for the most part - an extended cut-scene which involves very little actual game-play. The opening cut-scene is about 45 minutes long and is painful. Thankfully, once the game begins proper it's a ton of fun. Each mission has opening and closing credits which remind you that this game was CREATED AND DIRECTED BY HIDEO KOJIMA . This gets a little annoying after you've seen it the umpteenth time.

If you liked GoldenEye for the Wii, you'll love Metal Gear Solid V. Do yourself a favor - if you've got the Definitive Edition skip the pointless 'Ground Zeroes' and jump straight into 'The Phantom Pain' - it's a completely different feeling game. I feel like there's a lot more I could probably say about MGS V but this will have to do for now.

Categories

Games

Justice - Woman

2017/04/17 14:47

I've been a fan of French electronica duo Justice since 2008. I've loved both of their previous albums and just got their latest (Woman) on 7digital.com a couple of days ago.

It's an album almost designed for previewing. It's full of sumptuous disco-tinged tracks which sound great for about 20 seconds and when previewed on sites like 7digital and iTunes, hint at great things which never actually transpire. The problem with Woman is that many of the tracks sound pleasant enough, but are lacking something vital - a chorus. It's all verse and bridge but lacks a killer chorus that would truly make it memorable.

It's a pity because Justice have done some great things in the past. This album feels like they're coasting. It's good but not great.

Categories

Music

Un-Scene

2017/04/04 07:01

On a rainy cold Saturday morning in March 2017, thousands of people queued for hours in the cold to gain entrance to a Gaming Convention. They'd paid a lot of money to attend and many of them didn't get in. The venue could only accommodate 9,700, the conference organiser sold 25,000 tickets. That's Dublin and Irish ah-sure-it'll-be-grand Entreprenurialism for ya.

Inevitably there was a Social Media Backlash™. I wasn't one of those attending but a friend had asked would I be interested in going. It was a Video Gaming Convention and although I play video games, the thought of attending a conference devoted to video gaming does not appeal.

The sight of 1,000s of parents and kids queueing in the cold and the rain that Saturday morning brought me back to Saturday mornings more than 30 years ago. Dublin was very different then (we didn't have a Convention Center affectionately known as 'The Tube in the Cube', and we didn't have commercialy-run Video Gaming Conferences that scalped paying customers). I think 30 years is a suitable time for reminiscing. The 80s is now a long time ago. To my kids it seems prehistoric.

Temple Bar in 1985 wasn't too different to now. It wasn't yet the stag-night goto it became in the mid to late 90s. Some of its landmarks have been there since before I can remember. The Bad Ass Cafe, the record and camera shops, the older pubs, the Project Theatre. There were also a lot more comic shops back then, and of course there was The Alchemist Head - a mecca for anyone who read science-fiction. The Alchemist Head was a small single-story bookshop on Essex street just across the street from the Project Theatre. It kept odd opening hours if I recall correctly - it sometimes didn't open until after 10:30 am. I remember waiting outside and peering through the shop window where the latest books by Douglas Adams and Brian Aldiss were on display. There were also posters on the walls - the iconic image of Harrison Ford clinging on for dear life from a metal beam in Blade Runner.

Blade Runner

What brought me to The Alchemist Head wasn't books but a selection of new and second-hand comics they sold. I'd often go rifling through the 2nd-hand section looking for old issues of 2000AD. I'd occasionally pick up an issue of 'Epic Illustrated' - Marvel's "adult" imprint, which featured stories by Alan Moore and others. As far as I know, The Alchemist Head was the only place in Dublin that sold 'Epic Illustrated'.

A visit to The Alchemist Head became a regular Saturday pilgrimage throughout 1985 and 1986. I think it closed down sometime late in 1986 and reopened a couple of years later on Dame Street but it was a different type of bookshop selling mostly self-help, occult and other speciality books. There were other shops scattered around Temple Bar which sold Comics - there was a shop just alongside the Central Bank with a great selection of new and second-hand comics. I can't for the life of me remember its name but it was also a regular haunt.

Helliconia

Away from Temple Bar on Anne street just off Grafton Street there was of course The Diceman - a game store which specialised in Role-Playing Games. It was - as far as I know - the only dedicated RPG store in Dublin. The Diceman store is less famous than its Mascot - The Diceman. The Diceman was a mime artist on Grafton street throughout the 80s whose job was to advertise the store. He was so entertaining that he kind of became famous in his own right. Unfortunately I think he succumbed to AIDS some time ago.

The Diceman store occupied an old georgian-style building on Anne street. It had a selection of Board Games and wooden toys on its ground floor but downstairs in the basement was where all the good stuff was. The basement was poorly lit and smelled of Incense (I think) but it had everything a 14 year old RPG fan could ever want. Metal Figurines, every RPG you could think of - Dungeons & Dragons, Advanced Dungeons & Dragons, Traveller and many more. There were metal figurines and paints too. All of the RPG supplements and magazines (White Dwarf etc). The same music seemed to always be playing - I vividly remember hearing Billy Idol's "Dancing with Myself" more than once during the same visit.

Epic Illustrated

The Diceman too was not long for this world and closed down not long afterwards. I remember missing those stores - I still do.

Just a few doors up from the Diceman was another 2nd-hand book shop - god there used to be so many of them in Dublin. That's where I chanced upon a horde of 'Warrior' magazines. I was big into 2000AD at the time and 'Warrior' was - like 'Epic Illustrated' - aimed at the more mature reader. It shared many of the same writers and artists as 2000AD. 'Warrior' was where Alan Moore's "MiracleMan" and "V for Vendetta" were first published. By the time I discovered 'Warrior' it had already ceased publication. It ran from around 1982 to 1984/5. Unlike 'Epic Illustrated' , 'Warrior' was not full-color but the writing was great - even better than its American counterpart.

Warrior

Shortly after my daughter was born, in a fit of nostalgia I bought full sets of both 'Epic Illustrated' and 'Warrior' on eBay. This would have been around 2002 - FIFTEEN years ago now! I still have those sets - each issue in a plastic cover - though to be fair I didn't buy them in Mint Condition (I'm not made of money) and only bought them to re-read and satisfy my nostalgia.

What's prompted all this reminiscing? I sometimes fervently wish I could go back to that time. The book, comic and game shops of my youth are gone for good. On a recent trip to Dublin I drove down Cork street and the Coombe where there was once a shop that sold 2nd-hand comics - you could get real bargains there. Even though the Coombe has changed a lot the store's building was still there but boarded up. Walking down Grafton street I peered along Anne Street but the Diceman sign was not there. I didn't bother to go see what was in its place.

I don't miss Dublin or the 80s per se, just that nebulous time and place when there were things to do and places to go that were just a little off the beaten path.

Categories

Gaming, Nostalgia, Dublin, 80s

Serializing Asynchronous Tasks in Javascript

2017/03/29 08:43

You have an Array and an asynchronous task which must be performed on each element in the array. You want the array to process in series. That is - each item in the array is only processed after the previous item has been processed.
You're using Node.js or a system with the same callback conventions/signature.

function series( array, asyncOp, done){
  var len = array.length,
      results = [];
  if (len == 0){
    if (done) {
      done(null, []);
    }
    return;
  }

  function each(n){
    asyncOp(array[n], function(err, result){
      results.push(result);
      if (err){
        done(err,result);
        return;
      }
      if (n < len -1 ) {
        each(++n);
        return;
      } 
      if (done) {
        done(null, results);
      }
      return; 
    });
  }
  each(0);  
}

Let's create a silly asynchronous function to demonstrate:

function lazyOp( item, next ){
  setTimeout(function(){ 
    console.log(item);
    if (typeof next == 'function'){
      next(null, item);
    }
  }, Math.random() * 2000);
}

This function will print the item after a random period of time (somewhere between 0 and 2 seconds). If we were to run this lazyOp over an array using forEach() the items would be processed out of order:

[ 1, 2, 3, 4, 5].forEach(lazyOp);

The results might look like this:

5
3
2
1
4

Whereas if we run them using the series() function above:

series([ 1, 2, 3, 4, 5], lazyOp);

Each item in the array is guaranteed to be processed in order.

1
2
3
4
5

In NodeLand, most operations are asynchronous. That is, they do something and tell you when it's done via a callback function you provide - these operations are usually subject to the vagaries of network or other latencies. Sometimes you want things done in a certain order so being able to guarantee the order in which operations is important.

Isn't there already a NPM package that will do this? Why of course but it was interesting to work out in code how to go about implementing such a function from scratch. It scratched an itch. Sometimes it's fun to just take a problem and start coding - taking a rough, hazy line of thinking, and distilling and crystalizing it in to working code.

Update: Using async.series

As mentioned earlier, there is an open-source module which lets you do this. The async.series() function takes a list of tasks (functions) and performs each in series. If we were to use this to perform the same operation over an array in series, it would look something like this:

var series = require('async').series;
var tasks = [1, 2, 3, 4, 5].map(function(item){
  return function(callback){ 
    lazyOp(item, callback);
  };
});
series( tasks );

Can this code be improved and/or made succinct? It's javascript - of course it can.

Categories

Javascript, Programming

2016

2016/12/31 11:09

So ... 2016. I haven't posted on the blog for a couple of reasons - Kids, Family, Work, much-needed time away from screens - the usual.

Lake Garda Sunset

In Books

A last minute holiday in Lake Garda in the middle of summer gave me some time to read. I remain skeptical of eBooks so brought some paperbacks in my luggage.

Flowers For Algernon - Daniel Keyes

This was really good. As with 'Dune' and other Science Fiction classics, it's been on my radar forever (since I was 10 years old at least) but I only got around to reading it this year. Given it was written in the 60s (like Dune) it has aged really well. It's very moving.

Fairy Tales - Hermann Hesse

I read a lot of Hesse in my teens/early 20s and 'Fairy Tales' has been sitting on my shelf for a couple of years. Maybe I've outgrown Hesse but this collection of short stories was not as good as I hoped. Siddharta, Steppenwolf, and Demian remain three of my favorite books.

Brave New World - Aldous Huxley

This was a re-read. I first read this in 1989 - I was 18 years old at the time and the world was very different then - it blew my mind. It hasn't aged well over the intervening 27 years. There's still some interesting ideas but it feels a little 'Jules Verne' now.

Seveneves - Neal Stephenson

This was a long read. It's contemporary science-fiction set in a not-too-distant future where the moon shatters, prompting a race against time to create an off-world survival ark. The first 2 thirds of the book are riveting, the last 3rd not so much.

Helliconia Trilogy - Brian Aldiss

I began reading this on and off a couple of months ago but haven't yet finished it. It's good but I just don't seem to get the time to read as much as I'd like.

My own book Writing Minecraft Plugins in Javascript hasn't exactly been flying off the shelves. Computer books of a technical nature tend to have a short shelf-life and become obsolete, that's why - for much of my book - I focus on teaching Javascript (which isn't going away anytime soon). The latter 3rd of the book introduces Java and the CanaryMod API which sadly is no longer being actively developed. Nonetheless, ScriptCraft works just fine with SpigotMC which is being actively developed.

In Running

I finally bit the bullet and signed up for a Marathon in 2016. I did it mostly because it was getting weird having to explain to friends and colleagues (who know I run) why I hadn't yet run a Marathon. I did the local Marathon (Cork City) in June. It was hot and hilly, I wasn't as prepared as I could have been so the arse fell out of it around mile 10. I finished in 4 hours 52 minutes. Definitely room for improvement.

I ran just over 1,000 miles this year.

In Work

This was my 6th year at IBM. The work continues to be interesting and the people are great. In an industry that has its fair share of sociopaths, I've never encountered any at IBM. Maybe I've just been lucky but the people I've worked with at IBM have been an all round decent bunch. This year I ran a couple of NodeJS workshops in Cork and Galway. Hopefully in 2017 I'll devise and run an AngularJS workshop, among other things. Our project migrated to using Git for revision control recently. It's been an interesting move. Git is a revision control system that exposes a lot of its internals - so much so it can be thought of more as a revision control construction set. If revision control systems are your thing, you'll love git. I've been making a concerted effort to master git over the past few weeks. Despite having a github account for a couple of years, and maintaining a repository (ScriptCraft) with 100s of forks and 1000s of stars, I never really understood git until very recently.

In Miscellaneous

I finally got around (just this morning actually) to updating all of my domains to use HTTPS. It was much easier than I expected thanks to LetsEncrypt.

This Christmas I haven't spent as much time working on ScriptCraft as I'd hoped. I do feel a little guilty about not coding in my spare time - but not that guilty.

The best software developers I know are always hacking over the holidays.

True story.
-- Joe McCann on Twitter

Instead I've been playing video games - the latest generation. There was a family surprise underneath the Christmas tree this year - a Playstation 4. It's been 9 years since we last got a console (Nintendo's Wii), and 18 years since I got a 1st generation Playstation - so yeah - it was time.

I've been playing Star Wars Battlefront (in split-screen mode with my son Sean) and TitanFall 2 which is every bit as good as I'd hoped. I got Metal Gear Solid V but haven't yet played it very much. Rocket League is also good chaotic fun.

Hope you all have a great 2017.

Categories

2016

Paul Higgins 1939 - 2015

2015/08/06 19:56

I was 20 minutes into the 3 hour drive to Dublin, just outside Watergrasshill on the M8 when I got the call from the nursing home. It was Janet, the head nurse:

Hi Walter, are you driving right now?
Yes.
Can you pull over?

I pulled in to the hard shoulder and braced for the news. I knew his health was failing, I'd been up to see him with my kids just days previously. He had seemed in better health than I expected, he asked the kids about school.

It's bad news I'm afraid. He's just passed away.

I noted the time, it was 11:10 am on an overcast sunday morning. The motorway sign said I was 1 KM from Watergrasshill. He passed away peacefully in his sleep. The nursing home nurses were present by his bed.

I was 1 kilometer from watergrasshill, 2 hours and 40 minutes away when it happened.


He was born on September 1st 1939 in Dublin. He grew up in Crumlin, the youngest of 8 - "the nipper". This is a picture of him on a motorbike taken on Saul Road. He was 12 years old. He and my son Sean look uncannily alike.

Dad on Bike, Saul Road, 1951

I had never seen that picture before until yesterday, the day I buried Dad. I love that picture because it surprised me and in doing so reminded me of what I'll miss most about him - he was full of surprises.

The day after a funeral is probably the roughest. I woke up this morning with the distinct feeling that something of me had been buried too. I feel lessened.

One good thing that comes of funerals is the meeting of the wider family. It was great. They are the best. We should meet more often.

This is a picture of my Dad taken at our wedding 15 years ago. He was 60 years old and still in rude health and full of mischief.

Dad aged 60

He doted on his grandkids Kate and Sean - Always sent them cards and gifts on their birthdays and at Christmas. They took the news hard.

He was a dad, a brother, a husband and a doting grandfather. He'll be missed by us all.

Categories

Family

Writing Minecraft Plugins - The Book in Print.

2015/04/18 07:47

Yesterday, author copies of A Beginner's Guide to Writing Minecraft Plugins in Javascript arrived in the post. A courier dropped by with a cardboard box of 24 copies, and an additional copy in a Jiffy envelope. My youngest had some friends over for his 9th birthday and couldn't wait for me to get home, so Ursula took out the first copy from the Jiffy. To be fair I would have asked her to do this anyway when she called me on the phone. I was like a kid at Christmas when I got the call.

first copy with box

What follows are some photos and short notes on the book. As you'll probably guess, I'm a bit of a bibliophile. I love books - not just technical books. Having my very own technical book with my name on the cover is, well ... something.

src

One of the things I explain early in the book is Modules. The commonjs module system (used by Node.js and ScriptCraft) is the most concise and elegant module system I've ever used. Teaching modules and modularization is usually an afterthought when teaching programming to beginners but it's such an important part of programming and it's done so well in CommonJS that I wanted to cover it in the first half of the book.

modules

The book is in full color throughout its 310 pages and is printed on high quality paper.

full color

Source code listings are - for the most part - short. This screenshot shows one of the medium size code listings - an example use of Javascript's switch statement:

code listing

The book has many different types of content, source code listings, tables, diagrams, screenshots, side-notes and so on.

elements

This is a full page table and source-code listing on opposite pages.

table

Peachpit have done a wonderful job on the production of this book. The cover, spine, paper quality and layout are what you'd expect from a publisher that specializes in Photography and Education. This book looks and feels better than I dared imagine.

section

I'm a big believer in books - actual physical books - as a way to learn and be inspired. I tried to write the kind of book I would have wanted to read when I was 12 years old and just starting out programming. I can only hope now that this book ignites the programming spark in readers and maybe - just maybe - inspires some of the next generation of programmers.

Categories

ScriptCraft, Writing, Minecraft, Javascript

Never Invented Here

2015/03/29 11:32

Michael O. Church on the 'Never-invented here' syndrome prevalent in Software development organisations:

if engineers are micromanaged to the point of having to justify weeks or even days of their own working time, not a damn thing is ever going to be invented, because no engineer can afford to take the risk; they’re mired in user stories and backlog grooming. The core attitude underlying “Agile” and NeIH is that anything that takes more than some insultingly small amount of time (say, 2 weeks) to build should not be trusted to in-house employees.
-- Never Invent Here: the even-worse sibling of “Not Invented Here”

... and the problems of job satisfaction and employee retention in same:

In a never-invent-here culture that just expects programmers to work on “user stories”, the programmers who are capable of more are often the first ones to leave.

The whole blog post is very nuanced and well worth a read. I'll leave with this...

The failure, I would say, isn’t that technology companies use off-the-shelf solutions for most problems, because that is quite often the right decision. It’s that, in many technologies, that’s all that they use, because core infrastructure and R&D don’t fit into the two-week “sprints” that the moronic “Agile” fad demands that engineers accommodate, and therefore can’t be done in-house at most companies. The culture of trust in engineers is not there, and that (not the question of whether one technology is used over another) is the crime. -- Never Invent Here: the even-worse sibling of “Not Invented Here” | Michael O. Church

Categories

Programming, Agile

Minecraft and Trampolines and Javascript Oh My!

2015/02/15 16:50

This has nothing to do with Reginal Braithwaite's Trampolining in Javascript. Just a fun experiment I've been working on for a forthcoming ScriptCraft Workshop.

The goal of the workshops is to whet kids' appetite for programming. Kids aren't necessarily interested in programming for its own sake but they sure are curious about Minecraft and Modding and making cool stuff.

In the upcoming workshop I'm going to do the usual introduction - some basic building functions. The self variable and properties (self.name - the player's name, self.motionY * 2 - sets the player flying into the air) and some basic maths in javascript (addition, multiplication - the usual).

The /js self.motionY = 2 statement usually elicits a few oohs and aahs because it gives immediate visual feedback (See Bret Victor's Inventing On Principle (skip to 10:00)).

Maths on its own can be hard to engage with but if you take Muliplication and combine it with something like the Player.motionY property you can see how the principle of multiplication applies to trampolines. When you first step into a trampoline, the first jump is small but as you jump higher and higher there's a multiplier effect as each consecutive bounce makes you bounce higher.

The workshop will take the kids step by step through the process of adding a new object to the game - a Trampoline. The kids will choose which material/block-type should be used for the trampoline - two good candidates are Sponge and Slime but participants can choose something else if they like.

Initially the trampoline won't actually be bouncy. Once the trampoline() function is added, kids jump aboard but will probably be disappointed because it doesn't behave like a trampoline - there's no 'bounce'. This is where I explain Event-Driven Programming - Events or 'Hooks' are ways to tell the game you want it to run some code when a particular thing happens, such as when a player breaks a block or a player moves.

So I introduce a maybeBounce() function which will be called when the player moves. The 1st draft of the function checks to see if the player is standing on a bouncy block (slime or sponge or whatever) and 'bounces' the player in the air by setting their motionY property.

The next phase is to improve the trampoline behavior. Initially players all jump the same height no matter how many times they bounce. This is where multiplication comes in - I'll explain how multiplication can be used the make the in-game trampoline more realistic - each successive bounce will be higher than the last.

I like this workshop because it covers objects and properties ( the self player object and their .motionY property ), event-driven programming and - crucially - how Maths can be applied to improve gameplay.

The final draft of the workshop code is embedded below.

Categories

Minecraft, Javascript, ScriptCraft

CanaryMod and ScriptCraft Quick-Start

2015/01/31 21:56

CanaryMod has a lot of configuration options and its default configuration is very restrictive (compared to say - Bukkit; but there are good reasons for this - CanaryMod has built-in permissions management so it make sense that the default config is hardened). For example, players who join a canarymod server automatically belong to a 'visitors' group which has very few permissions. Visitors can't build or break blocks.

I recently added a new slash() module/function to ScriptCraft which lets plugin authors run other commands from their scripts. For example to create a startup script that grants extra permissions to visitors, create a file called init.js in the scriptcraft/plugins directory:

The above script will let visitors build and also execute javascript. It will also give opreator privileges to any players who join the game. You definitely don't want to allow this unless you're working with your own server and are only sharing with trusted friends.

There are a couple of other configuration changes you'll probably want to make to CanaryMod if you plan to use ScriptCraft for building or want to have a creative server. The following entries in the config/worlds/default/default_NORMAL.cfg file will make a flat world (good for building) with no monsters or villagers and with a default game mode set to CREATIVE.

world-type=FLAT
spawn-protection=0
spawn-villagers=false
spawn-monsters=false
gamemode=1
forceDefaultGameMode=true

You'll need to delete the worlds/ directory after you've made these changes so that CanaryMod will generate a new world with these settings.

Categories

ScriptCraft, CanaryMod, Minecraft

The Two Pillars

2014/10/21 13:55

If you are working in JavaScript and you’re creating constructor functions and inheriting from them, you haven’t really learned JavaScript. It doesn’t matter if you’ve been doing it since 1995. You’re failing to take advantage of JavaScript’s most powerful capabilities.

You’re working in the phony version of JavaScript that only exists to dress the language up like Java.

The Two Pillars of Javascript

A thousand times this.

Categories

Javascript, programming

The pleasure of not knowing

2014/09/30 13:16

During the last Irish property bubble, there was an ad on TV which showed people on the top deck of a double decker bus. Each person stood up one by one and admitted to not knowing about something or other. The last man stood up and admitted:

I don't know what a Tracker mortgage is.

I don't know what Growth Hacking is. I could easily find out if I wanted to know but I don't want to know. I'm quite comfortable about not knowing what this particular thing is because it has only recently impinged the stream of things I read or hear about. If I were to be honest, I even feel a little smug about not knowing what Growth Hacking is. I've added it to the growing list of things I'm peripherally aware of but have no wish to know about. I suspect that along with many other new things, I could die with no regrets about not knowing what 'Growth Hacking' is.

I have to wonder at my pleasure in not knowing about the latest "thing" - is it a mark of getting old? Is this what happens when you get old? You become comfortable (content even) in not knowing certain things?

In this day and age it takes an effort of will to not know what something is. Yes - willful ignorance. I'm writing this in a browser window. I could stop writing the rest of this sentence right now and - with just a few keystrokes in another browser window - google it. But - perversely - I won't.

I'm sure that if Growth Hacking is important I will come to know about it in the fullness of time but for now I'm quite happy not knowing what it is.

No. I would not like you to google that for me.

Categories

The Internet

Writing Minecraft Plugins: The Book

2014/09/26 08:41

I wrote a book.

A Beginner's Guide to Writing Minecraft Plugins in JavaScript

I wrote a book to teach Javascript Programming. The book is aimed at beginners of all ages. It's a technical book but assumes the reader has no programming knowledge. The book teaches Javascript and how to use it to create Minecraft Plugins.

It was due to be released this November but recent developments in the world of Minecraft Modding - the CraftBukkit DMCA takedown notice to be exact - mean the book's release date has been postponed.

The book requires you to install ScriptCraft so readers can write Minecraft Plugins using Javascript. ScriptCraft in turn uses CraftBukkit which is no longer available due to legal reasons. This means I have to port ScriptCraft to another modding framework, update the source code listings in the book and the accompanying text. I've already begun this process. I'm currently working on porting ScriptCraft to work with CanaryMod, a Minecraft server which supports plugins. The ScriptCraft port is going well though it's not yet complete. I honestly don't know how long this will take. It might take as little as 1 month or as much as 3 months.

The book was in production copy review phase (I was reviewing final production PDFs) when the news about CraftBukkit's takedown notice broke. Writing the book has taken a long time and a lot of work. When I heard about the takedown notice I contacted the publisher to let them know. In a way I'm glad the takedown didn't happen later because publishing a book which includes download instructions for software which is no longer available would not have been good for anyone: readers, the publisher or myself.

To say I'm disappointed about the postponement is an understatement. I love technical books - actual physical books - and to be able to say I wrote a Javascript book ... well that was something I was proud of. I was really looking forward to the book's release. It's a full-color book with lots of supporting diagrams and screenshots, printed on high quality paper. It's the kind of book I would love to read if I were 12 years old and interested in Minecraft and modding.

Anyway, the book's release date is postponed for now - I hope it will be available soon. I'm working on it.

Categories

Minecraft, ScriptCraft, Writing

ScriptCraft is Moving

2014/09/19 06:57

Earlier this month, CraftBukkit received a DMCA takedown notice from one of its open source contributors. I won't go into the details here but it means that it's highly unlikely there will be further development of CraftBukkit. The rest of the team have left the project and Microsoft just this week purchased Minecraft. CraftBukkit is pretty much dead.

So where does that leave ScriptCraft? ScriptCraft is a thin layer of Javascript on top of CraftBukkit. I chose CraftBukkit as the base layer because it is...

  1. Server-based
  2. Easy to install
  3. Has a sane API.

All 3 of these are important. I've been looking around for alternatives that meet these 3 criteria and have chosen Canary Mod as the next plugin framework which ScriptCraft will be ported to. I've been busy working on the port this week (the few hours I can snatch here and there between work and family commitments).

Canary Mod's API is very similar to Bukkits which makes porting that much easier. I don't know how long it will take - these things take time. What I do know is that Canary Mod won't be the only platform I eventually port ScriptCraft to.

Since CraftBukkit's demise, a new project has started up SpongePowered which looks promising but there's not a whole lot of code there just yet. GlowStone is also promising - it's been very active lately and is already bukkit compatible so ScriptCraft kinda sorta works already with it. The big one will be the Official Minecraft Plugin API which I hope Microsoft will begin working on soon.

Categories

ScriptCraft, Minecraft, CraftBukkit, Canary Mod

Platform Game

2014/09/13 10:08

Minecraft as a Platform

In all of the coverage I've read about Microsoft's rumored bid to acquire Mojang, I haven't yet seen any talk of Minecraft as a Platform. Minecraft: the Platform, is far more interesting than Minecraft: the Game. It's interesting to Microsoft, it should also be interesting to other big players in this space.

When I say Minecraft is a platform I mean it in the same way we say the Web is a platform. If you don't believe Minecraft is a platform then go ask any of the thousands of plugin developers and server administrators who are in freefall since the recent DMCA Takedown.

Minecraft has become Important - too important to be controlled by a boutique game development company in Sweden. The thousands of developers and administrators who build on top of Minecraft now see this. Microsoft see this. Learning the Minecraft protocol and how Minecraft servers work, will be important to software developers in the same way learning HTTP and how web servers work is today. There, I said it.

I'm ambivalent about Microsoft acquiring Mojang. Will they Embrace and Extend Minecraft as they've done with other categories? Let's hope not. On the other hand, some adult supervision and a Plugin API would be welcome. Mojang have the financial resources but lack the will and focus needed to publish and support a Plugin API. Perhaps Mojang themselves don't realise just how important their little game has become.

An interesting thread on reddit spells out the alternatives for developers who want to build on an open Minecraft platform. Me? In my down-time I'm going to stop reading the book I was reading and go read some source code instead. It may come in useful some day.

Categories

Minecraft, Microsoft, Platforms, The Future

George Orwell: Why I Write

2014/06/17 09:08

Writing a book is a horrible, exhausting struggle, like a long bout of some painful illness. One would never undertake such a thing if one were not driven on by some demon whom one can neither resist nor understand. For all one knows that demon is simply the same instinct that makes a baby squall for attention. And yet it is also true that one can write nothing readable unless one constantly struggles to efface one’s own personality.
-- Collected Essays, by George Orwell : part47

Categories

Writing

Nashorn Vagaries

2014/06/08 09:52

JavaScript sometimes causes me to doubt my sanity. I spent a good few hours debugging weird behavior in Nashorn's JS engine yesterday. JSON.stringify() wasn't doing what it was supposed to.

In scriptcraft I expose the JS engine as a javascript variable called __engine . That is - you can access the JS engine from javascript itself and do something like this:

var x = __engine.eval('( { "names": ["tom", "dick", "harry"] } )');

I noticed something odd - An object read this way was not being output correctly by JSON.stringify():

console.log( JSON.stringify ( x ) )

outputs "undefined". Yet if I construct the same object using JSON.parse:

var y = JSON.parse( ' { "names": ["tom", "dick", "harry"] } ');

and output it using JSON.stringify() the output is fine. So basically, what I think is happening is that in Nashorn:

var x = __engine.eval('( { "names": ["tom", "dick", "harry"] } )');

returns an object whose "names" property is a Java array, not a JavaScript native array so it can't be stringified by JSON. The subtle differences between Nashorn and JRE7's JS engine are driving me nuts right now.

Categories

JavaScript, Nashorn, ScriptCraft