See The Spark blogs

JavaScript inner join and outer join

My background is in database administration and development. That means I often think about programming problems in a databasey way, like all programmers (I have met) who write SQL do so in a programmerish way. There are times when combining the two is useful though. I had two arrays from different sources and need to combine them on their common key. In the same way a database join would. The slight difference is that most database joins can take non equality operators (> and < for example) but in this instance I only need equality (or equi) joins. The obvious solution is a nested loop, something like this:

Loops

``` JavaScript var newArray = []; for(var i = 0, l = array1.lengt

Handlebars helper arrays

Problem

Today I encountered a problem with Handlebars templating where I wanted to return an array from a helper and iterate through it with the #each built in helper. Handlebars is running server side with Node.js and Express.

First attempt

I started by trying something line this:

.js:

var hbs = require('hbs');
var myArray = ['AA', 'BB', 'CC'];
hbs.registerHelper('myList', function() { return myArray; });

template:

{{myList}} <!-- This shows the values from my array -->
{{#each myList}}
    {{this}} <!-- This never renders -->
{{/each}}

My solution

Because I could get the array to print out in a {{}} block I thought the helper was OK but it turned out

tugging.quicker.computers

What 3 Words

what3words is a simple solution to a complex problem, locating things on our planet. I live in the UK and we have a well developed addressing system. It is rare that addresses can't be found. In many countries this is not the case. what3words addresses (no pun intended) this by assigning 3 words to each 3m x 3m square on earth. It's like DNS for latitude and longitude. Apparently there are enough words in the English language (and 8 other languages) to allow 3 words to be sufficient to cover the globe in these 3m squares. what3words is static meaning that addresses won't ever change, though I don't know how they account for tectonic movement. The allocation of wo

.NET Core

C# is a nice language to write, in my opinion. The .NET Framework is comprehensive but that means it's not small. .NET Core is a more focused version of the .NET Framework. It's not the "next" .NET version but a complimentary framework. Having used Node.JS almost exclusively for the last couple of years the approach taken by .NET core seems more intuitive. There are a couple of config files and then the Kestrel web server does what the Node.JS http module does. Additional modules are then added using NuGet just like you would with NPM. The other big advantage of .NET core is that there is a Microsoft version which runs on Linux. On a side note, this prompted me to try Mono again and