Photo by Taylor Young on Unsplash

I changed my insurance recently. After I retired from my job in tech, I was on COBRA. After 18 months I had to change to one of the insurance policies on my state’s exchange. There were a lot of policies to choose from, but the website made some plan recommendations and I picked one of those. It was cheap, and I knew it wasn’t going to cover some of my prescription costs as well as my old policy, but I also knew that with drug company coupons I could reduce the cost of the most expensive ones.

Oh, Canada!

Photo by Paul Felberbauer on Unsplash

I recently made some minor contributions to an open source project that took a GraphQL schema as its input and generated viable SQL dialects for various databases. Since I have worked with GraphQL quite a bit in the past I liked the idea of fleshing out a GraphQL API, which includes type definitions, and generating TypeScript functions that invoked SQL to perform underlying CRUD operations. Not dissimilar to how an ORM maps Java classes to SQL statements, or how Swagger-based code generators provide a framework generated from an REST API definition.

GraphQL has a simple yet extensible way of defining…

A heatmap of photo locations in Paris

What is data visualization?

Anybody who has used a diagram or a chart to illustrate numeric or other data has practiced data visualization. This post will be about a specific data visualization technique called a heatmap.

A heatmap uses colors and location to characterize data. That data may be about actual heat (temperature), but its application as a data visualization tool is not limited to a specific type of data.

I’m either comfortably retired or unemployed, I haven’t decided which. What I do know is that I am not yet ready for decades of hard-won knowledge to lie fallow. Still driven to learn new technologies and to develop new projects, I see the experience and results generally getting better over time (I swear I am not an optimist by nature). I now have the time to work on what interests me, and at my own pace.

The rate of change in technologies has increased markedly since I started my career writing code in a 4GL. The UI back then utilized…

I recently started a personal project where I wanted to use a database in the cloud. There are quite a few to choose from. My main criteria was that it be something low or no cost. Eventually I decided on Firestore, using the Spark Plan. This plan gives me 5Gb of storage, with 50K reads and 20K writes per day for free, which at the time seemed like plenty. I soon learned that a little carelessness can blow past those transaction limits pretty fast.

Firestore is a NoSQL document store database. Each NoSQL database is different and my learning curve…

Photo by Brigitte Tohm on Unsplash

Use JavaScript to understand how recursion can lead to a stack overflow and tricks to prevent it from happening

The call stack is not an infinite resource. This is especially true when performing deep recursion. Functions calls within functions are placed on the call stack further up, which means each recursive call sits on the call stack, waiting to be executed.

The call stack size is not fixed in Javascript, but it’s not huge. Let’s take a look at a trivial example:

let ct = 0;
const MAX = 100_000
const recurse = () => {
if (++ct > MAX) return
try {
} catch (e) {
console.error({ ct, e })

If I run this…

You are probably familiar with Texas Holdem, a variant of poker where two cards, known as hole cards, are dealt face down to each player, and then five community cards are dealt face up in three stages, for a total of four stages in all. After each stage, players have the opportunity to bet or raise.

Let’s say you’re dealt two hole cards. Before the flop is dealt, what are your chances of winning? Know this and you can bet, or plan to bet, accordingly.

Professor Apu Kapadia of Indiana University took a statistical approach to analyzing this by running…

There are several techniques for refetching data. In this article, we explore them by example.

The setup

In Giving React + GraphQL a Lift with Apollo-Boost, I demonstrated how to get React application up and running quickly, and then how to incorporate the ApolloClient React components from apollo-boost. At the time of that writing, I used the Apollo Launchpad service to create a GraphQL server instance, but that has now met its demise. This time I’ll install and run the GraphQL server from the Apollo GraphQL Tutorial. Here are the steps to get that server running:

git clone
cd fullstack-tutorial/final/server
npm install
npm run-script start:ci

With success, you’ll see:

$ npm run-script start:ci
🚀 app…

How do I loathe thee? Let me count the ways…

The Array.reduce() method has been around awhile. Like map(), filter() and find(), it operates upon an array of values by invoking a callback function.

Here’s an example from the site:

const array1 = [1, 2, 3, 4];
const reducer = (accumulator, currentValue) => accumulator + currentValue;
// 1 + 2 + 3 + 4
// expected output: 10
// 5 + 1 + 2 + 3 + 4
console.log(array1.reduce(reducer, 5));
// expected output: 15

Seems straightforward, right? On with the grievances:

0. It doesn’t do what you expect

Let’s look at this again:

const array1…

Talk to your workers, and they will talk back.

What are Worker Threads?

Node.js Worker Threads allow concurrent execution of JavaScript code. If you are familiar with the Unix thread model, you know that for every process group there is a parent process and several child processes. A similar model is used for Worker Threads as will be shown.

If you have several CPU intensive tasks that need to be done, and those tasks operate independently of each other, then threads allow tasks to run in parallel, saving time. (You don’t need worker threads for I/O processing — this is something that Node.js non-blocking I/O model handles capably already.)

For example, I have…

Retired, mostly. Doing some mentoring and a bit of website building on the sly. The rest of my time I spend practicing dolce far niente.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store