Sprechen sie GraphSQLite? Or querying data in a SQLite database using GraphQL and Apollo Server
Introduction The website sqlitetutorial.net has some good pointers on using the SQLite database. This worked example builds on their Querying Data in SQLite Database from Node.js Applications tutorial. The differences being I’m using the better-sqlite3 rather than the sqlite3 npm package1 and I’m using a GraphQL API (powered by Apollo Server) to present the data (as opposed to console.log). As per the sqlitetutorial.net site I’m using the sample database chinook.db. This worked example is designed to mimic the tutorial as closely as possible - the queries and responses are almost exactly the same.
Introducing vim-groff-viewer: A vim plugin for displaying Groff files in a document viewer
Introduction I like (Neo)vim, I like Groff. So much so that I’ve blogged about letter writing in Groff before. What I don’t like is writing markup in Neovim, exiting Neovim, compiling Groff, opening a document viewer and then going back into Neovim to edit again. And repeat.
To remedy this my first vim plugin - vim-groff-viewer. It is probably easier to demonstrate, than explain, so…
Video demonstration Download, usage, configuration, etc Interested?
Look Ma, no Neovim plugin manager!
Handsfree To manually install a Neovim plugin, for example Tim Pope’s Commentary, without using a plug-in manager then at the terminal :
mkdir -p ~/.local/share/nvim/site/pack/tpope/start/commentary git clone https://tpope.io/vim/commentary.git ~/.local/share/nvim/site/pack/tpope/start/commentary The install path always follows the pattern of ~/.local/share/nvim/site/pack/foo/start/bar, where the variables foo and bar can be whatever makes sense to you. Commonly foo is the name of the author (e.g. tpope) and bar is the name of the plugin (e.g. commentary).
Linking to a heading in the same page in Hugo
Linking to another page in markdown in Hugo is easy: i.e. [Auntie Beeb](https://www.bbc.co.uk/) renders as Auntie Beeb - but when you want a link to a heading in the same page I can never remember, so this is a quick aide-memoire:
HTML In HTML a relative link to an element in the same page looks like:
<!-- <a> element links to the section below --> <p><a href="#Section_further_down"> Jump to the heading below </a></p> <!
Étoile du jour: Deploying a React Web App on the Microsoft Azure Cloud
Introduction Hosting a React framework Single Page Application as a Web App on the Microsoft Azure can be an extremely frustrating process, for a number of reasons. To start with despite React being (rightly or wrongly) the most popular web framework, there are no specific instructions within the Microsoft documentation for how one might deploy a React Single Page Application (SPA) as an Azure Web App. Far worse however is that the choice of operating system (Windows or Linux) when creating a React web app on Azure is key - in short it is very difficult to use create-react-app to deploy to a base Linux O/S - yet this is both unintuitive and seemingly undocumented (see the What’s up with Linux?
A concrete Python 'Hello World' with the Neovim API
Neovim’s API is typically called through a Remote Procedure Call (RPC) using the MessagePack-RPC specification. The neovim documentation provides a ‘Hello World’ example of how to interface with the Neovim API; this post is a worked example of how to implement this - more of a note to self than anything else. I’m running Neovim v 0.6.0 on Manjaro 21.2.0 Qonos linux.
First we need to determine the servername that Neovim has set on startup.
Groff and the art of letter writing
Introduction Although I’ve blogged previously about using LaTeX for academic writing I wanted to try groff out for the less complicated task of letter writing - groff being similar to LaTeX but far less popular. Using a typesetting system such as groff instead of word processing software has several advantages: saving documents in plain text is memory efficient, easily searchable and scores highly for digital preservation (proprietary word processing file formats tending to eventually obsolesce).
TiddlyWiki5, Raspberry Pi and Vim: A guide for the command line aficionado
Introduction The practice of personal information management has always left me unsatisfied; a square hole in the puzzle of life that you just don’t have a square peg for. After looking into options for square pegs I’ve opted for a zettelkasten method implemented via a TiddlyWiki.
I wanted to host this on a Raspberry Pi and access this on all the computers on my local network (e.g. tablets, phones, etc).
Updating Node and npm using Node Version Manager
Node Version Manager is a “POSIX-compliant bash script to manage multiple active node.js versions.” It is a very useful tool for taming Node.js which can throw up some strange problems when you install it in the standard fashion.
However I only ever use two commands, which I can never remember off the top of my head, so here they are:
Update Node.js to latest Long Term Support version nvm install --lts Update npm nvm install-latest-npm I only realised this was an option recently thanks to a post by MuffinMan.
Tie down scheme for an Apollo GraphQL server in a Node Docker container
Introduction GraphQL is a query language for APIs, while Apollo Server is a popular server used for providing GraphQL APIs. This post is a concise handrail as to how to put an Apollo GraphQL server in a Node.js Docker container - a “standardized unit of software that allows developers to isolate their app from its environment.” This tutorial uses the Linux command line and assumes you have already installed Docker and Node.