Vanilla Web Components from Scratch – A Dive

Introduction In this article we aim to develop a fundamental understanding of what Web Components are, by methodically and comprehensively building and modifying our own standalone Web Component through a variety of patterns. Let’s jump right in. The Component – A Terrapin Card To start off, let’s build our first Web Component and render it with an html file. I like pets, and I used to keep terrapins, so let’s use that as an example....

February 22, 2024 · Joel Tok

Water Tank Battery Numbers – Capacity, Effiency and other Key Metrics

Introduction With growth in renewable energy, much of the conversation has shifted away from the economics of energy production to energy storage. This is because many sources of renewable energy like solar and wind are variable and intermittent, affected by factors like changes in weather or time of day. This reflects a lack of stability in power production, requiring the need for energy storage solutions to act as buffers or dispense energy in more controlled bursts....

February 18, 2024 · Joel Tok

Dart – Implementing a Factory Constructor for an Abstract Class

Problem Let’s say we want to implement a factory constructor in an abstract class. For example, given the abstract class Position, we want to enforce that all classes that implement it have two capabilities: Position.fromJson and toJson. Notice that the first of these is usually implemented as a factory constructor. We can show this in the example code below: abstract class Position { factory Position.fromJson(Map<String, dynamic> json); Map<String, dynamic> toJson(); } Unfortunately, the above will throw either one of the following errors:...

March 15, 2023 · Joel Tok

How to conceptualise electricity in battery systems

Introduction When I first started car camping and doing extended road-trips, the question of power needs came to the fore. Which naturally led to lots of excited research into what kind of batteries to buy, how to choose and setup solar arrays, what sorts of fuses and transformers I needed to get and where to fit them into the extended circuit. But deep into this research, I hit a deadlock – my own limitation on how electricity works....

November 17, 2022 · Joel Tok

A Practical Guide to Calculating Battery Capacity

Introduction Imagine we are looking to buy a battery, and want to know what its power capacity is. Or in other words, how much power the battery can store. How would we calculate how much energy a particular battery can store, and how would we size this up against the devices we will need it to power? In this post we will explain the use of Ampere-hours (Ah) as the common measure of capacity, evaluate the use of Kilowatt-hours (kWh) as an alternative and more flexible measure, and determine how to calculate Kilowatt-hours (kWh) using Ampere-hours (Ah) and Voltage (V)....

October 20, 2022 · Joel Tok

Python 3 – Dependency Reproducibility between Environments

Introduction Python dependency management can be a big headache. Many a times I have returned to a past project in Python with its varied dependencies, attempted to reinstall all libraries it depends upon, only to be faced with various issues on compatibility. Worse, ensuring that the same dependencies are loaded in development and in production can be another challenge in and of itself. This highlights important problems when it comes to environment reproducibility....

October 14, 2022 · Joel Tok

Debugging Docker

Introduction Docker is a powerful container deployment and management tool, but its abstractions might sometimes cause a headache when faced with the need to debug issues with docker applications. I wrote this blog post to alleviate some of mine, structured as a sort-of checklist. When working with Docker, it is useful to think in terms of these 3 aspects of dockerisation: build, container and the docker runtime (or daemon) itself....

September 1, 2022 · Joel Tok

React Hook Form – Blur on submit

Problem I’ve been working with the deliciously productive React Hooks API recently, and have been using React Hook Form as my go to form abstraction. There was one issue I faced lately however that bothered the heck out of me: When the user hits enter on the keyboard, for some mysterious reason I was not able to get the input to blur. Even if there was no validation errors, and the data was successfully saved, the input just....

July 19, 2022 · Joel Tok

Hiking Mount Disappointment

Introduction I heard about this place while exploring Quarry Hills Park, and could not resist visiting just because of what it’s named. On the whole it was not a disappointing hike at all. Don’t expect to have much in terms of a lookout or vantage point. More of a peaceful, relaxing and serene kind of vibe. Weather was a little rainy just before I arrived, so the ground was muddy. But even then the ground wasn’t slippery enough to be an issue for me....

June 29, 2022 · Joel Tok

Introducing Quackcheck!

Over the past few months, I have been working on and off on this side-project called Quackcheck. This project was built to help me deal with the opacity of articles on the web. You see, I figured out that because of the unique way in which search-engines operate, relevance is often prioritised over accuracy. What this means is that when doing research via Google Search, I often encounter articles that seem to answer the questions that I actually ask, but in truth make all sorts of assertions that they cannot back up....

June 23, 2022 · Joel Tok