Calculating the Distance Between Points in “Wrap Around” (Toroidal) Space

The blog at the bottom of the sea

Let’s say you are trying to find the distance between two points in 2D, but that these points are in a universe that “wraps around” like old video games – leaving the screen on the right, left, top or bottom side makes you re-appear on the opposite edge.

This universe is actually shaped like a toroid, also known as a doughnut. If you imagine yourself being on the inside surface of a hollow doughnut, it would behave exactly this way. If you go “down” you end up where you previously considered “up”. If you go far enough “left” you end up where you previously considered “right”.

How would you calculate the distance between two points in a universe like this?

Let’s imagine the situation below where we are trying to find the distance between the red point and the green point:

One way to do this would be to pick…

View original post 666 more words


Distributed Algorithms in NoSQL Databases

Highly Scalable Blog

Scalability is one of the main drivers of the NoSQL movement. As such, it encompasses distributed system coordination, failover, resource management and many other capabilities. It sounds like a big umbrella, and it is. Although it can hardly be said that NoSQL movement brought fundamentally new techniques into distributed data processing, it triggered an avalanche of practical studies and real-life trials of different combinations of protocols and algorithms. These developments gradually highlight a system of relevant database building blocks with proven practical efficiency. In this article I’m trying to provide more or less systematic description of techniques related to distributed operations in NoSQL databases.

In the rest of this article we study a number of distributed activities like replication of failure detection that could happen in a database. These activities, highlighted in bold below, are grouped into three major sections:

  • Data Consistency. Historically, NoSQL paid a lot of attention to…

View original post 5,911 more words

Bringing the web up to speed with WebAssembly

the morning paper

Bringing the web up to speed with WebAssembly Haas et al., PLDI 2017

This is a joint paper from authors at Google, Mozilla, Microsoft and Apple describing the motivations for WebAssembly together with a very concise exposition of its core semantics. If you’re following along with the paper, I found it helpful to dip into the full WebAssembly Specification at points for extra clarification. I’m going to spend most of my time in this write-up covering the parts of the paper focusing on the design rationale, properties, and implementation experiences since diving into the detailed semantics is really better left to the full spec.

Why do we need WebAssembly?

There’s a great observation in the introduction section: the Web has become the most ubiquitous application platform ever, and yet by historical accident the only natively supported programming language for that platform is JavaScript! That’s made for a number of…

View original post 1,850 more words

An overview of data serialization techniques in C++

Rubén Torres Bonet

You’ve spent days designing your perfect data structures and they work just like in dreams. Now you have to save them permanently. What do you do apart from googling? The obvious answer is: reading this blog!

My goal here is to give you an overview of some techniques I’ve successfully used in the past. Along this blog entry I will be covering a few alternatives: memcpy, manual serialization, boost::serialization, Protocol Buffers (protobuf) and cereal.

Only keep reading if you are really interested in learning! (hopefully something new)

View original post 1,216 more words

Developer Testing

Henrik Warne's blog

I recently found out about the book Developer Testing – Building Quality Into Software by Alexander Tarlinder, and I immediately wanted to read it. Even though I am a developer at heart, I have always been interested in software testing (I even worked as a tester for two years).

I think the subject of the book, developer testing, is timely. There seems to be a broad trend where more and more responsibility for testing is given to developers. It follows from the move towards micro services, dev ops and the “you built it, you run it” principle. Another driving force is the prevalence of developer testing frameworks that started with JUnit and now includes many more. These frameworks encourage and help developers write automatic tests.

Despite this trend of increasing developer testing, my feeling is that many developers still don’t test their programs well enough. For example, they may…

View original post 1,010 more words

Stories That Should be Banned from Hacker News: Immortality


Some stories on HN are a complete waste of time.  Little real knowledge is ever included in the threads.  No one learns anything. We just bullshit for a few hours.  And this happens a few times a year for each topic.

My first suggestion is stories related to immortality. Most of the comments immediately turn  philosophical.

“Death gives life meaning”

“It’ll only be for rich people”

“The money should be spent on something better.”

On HN, most people don’t  want to learn anything about aging.  No one discusses the basic science that we might gain by doing the research.  The knowledge gained could have benefits in other areas of medicine like heart disease and cancer, for example.  You aren’t going to want to live forever and have Alzheimer’s.

There are 7 billion people on the planet.  It’s not going to hurt if several thousand people work on basic research to understand aging.  From reading…

View original post 108 more words

Programming language from scratch: 3 easy steps to an interpreter

Francis Stokes

A little while ago I wrote about 16bitjs, a 16 bit virtual machine written in javascript. It implemented a custom CPU architecture and assembly language, assembler, and debugger. I had the thought at some point that it would be pretty awesome to create a programming language from scratch that would compile to 16bitjs assembly and run on the VM. I’ve since found out this is a monumentally complicated task, but I still went ahead and created a programming language anyway (though not one that compiles to 16bitjs) and the result is Lel. This article will delve into the steps that go into writing a creating an interpreter for a programming language – without unnecessary layers of complexity or the magic status people who are skilled at this kind of thing like to bestow on it. By the end you’ll have a pretty decent grasp on how you could go…

View original post 3,209 more words