Why is the async keyword needed in JavaScript?
Last week a colleague asked me what the purpose of the async keyword was in JavaScript. Not because he didn't know how to use async/await. He was wondering why the async keyword was needed to use...
View ArticleException order when awaiting multiple async tasks in C#
A C# has-been returns to C# and experiments with this new hip thing called async/await and how that relates to execution order and exceptions.I recently returned to .NET and C# development after a six...
View ArticleFlatten array of arrays with JavaScript
const arrays = [[1], ["2"], [3]];const merged = [].concat(...arrays);console.log(merged); // [ 1, '2', 3 ]Pre ES6:var merged =[].concat.apply([], arrays);
View ArticleQuickly mapping an array of URLs to responses with JavaScript async/await and...
While perhaps not the most readable, a compact version (using window.fetch) can look like this:const urls = [ "https://jsonplaceholder.typicode.com/comments/1",...
View ArticleQuickly creating and mapping an array in JavaScript
When, for instance, creating test data one might do something like this:const data = [];for(let i = 0; i < 100; i++) { data.push({ num: i }); }This may be written slightly shorter and more wrist...
View ArticleResponsibly Responsive Web Design at Expressen
When building a new version of the news site Expressen.se the team hesitated to use responsive web design. Here's why and what we ended up doing.Expressen.se is the second largest news site in the...
View ArticleBook announcement: ElasticSearch Quick Start
I'm happy to announce a book that I've been meaning to write for quite some time - An introduction to ElasticSearch for developers in tutorial form.About 18 months ago I was working on a customer...
View ArticleNotes from learning Go - the basics
I recently decided to learn Go. As in Go the programming language, also known as golang. These are my notes from doing so. In the form of code.Hello Worldpackage main//Here's a commentimport "fmt"func...
View ArticleDynamic mappings and dates in ElasticSearch
JSON doesn't have a date type. Yet ElasticSearch can automatically map date fields for us. While this "just works" most of the time, it can be a good idea to help ElasticSearch help us by instead using...
View ArticleElasticSearch - nested mappings and filters
There's one situation where we need to help ElasticSearch to understand the structure of our data in order to be able to query it fully - when dealing with arrays of complex objects.Arguably one of the...
View ArticleA new challenge
Ranging from improving one of the most well visited sites in Sweden to challenges in the "Big Data" space, and from working with iOS and Android apps to architecting a channel independent platform. Why...
View ArticleError: connect ECONNREFUSED when integration testing a Node.js app
In an express.js app that I was integration testing using Mocha the tests suddenly started acting weird with complaint such as:"before all" hook: Error: connect ECONNREFUSEDTurned out the root cause...
View ArticleGrouping in ElasticSearch using child documents
How to answer questions such as "average number of orders per customer during November?" that would be easy using GROUP BY in a relational database isn't always obvious when using ElasticSearch. Here's...
View ArticleUpdate on my EPiServer book
Two new chapters. One of them is the first!It has been almost a month since I announced that I'm writing a book about EPiServer 7 development. Since then I've received a lot of helpful feedback and...
View ArticleWorkaround: On Page Editing broken after rendering a block
In patch 3 for EPiServer 7 CMS there's a nasty little bug that manifests it self on sites built using ASP.NET MVC. After rendering a block that doesn't have a controller but instead is rendered using...
View ArticleA book about EPiServer development
After years of blogging about EPiServer CMS I decided it was time to get real.I'm happy to announce a little project that I've been working on lately; a book about how to develop EPiServer CMS sites....
View ArticleElasticSearch 101
ElasticSearch is a highly scalable open source search engine with a REST API that is hard not to love. In this tutorial we'll look at some of the key concepts when getting started with ElasticSearch....
View ArticleC# method for cropping text without breaking words
I often need to crop a longer text down to a shorter version. That in it self is easy. However, it's often nice to make it less obvious that the text has been shortened by ensuring that it consists of...
View ArticleLessons learned from a small tech startup
There are many possible pitfalls when starting a new company and building a product. These are the most important things that I learned from starting, running and selling a company founded by three...
View ArticleEPiServer editing delight challenge - MVC solution
Solving a small but tricky problem related to customised rendering of a property in EPiServer 7 with ASP.NET MVC.Starting with the simple stuff we render each of the properties using the PropertyFor...
View Article