Error handling for failed network requests with service workers

Most service worker code samples show only the happy path where the fetched resource will eventually be available, eg: self.addEventListener('fetch', event => { // Skip cross-origin requests, like those for Google Analytics. if (event.request.url.startsWith(self.location.origin)) { event.respondWith( caches.match(event.request).then(cachedResponse => { if (cachedResponse) { return cachedResponse; } return => { return fetch(event.request).then(response => { // Put … Continue reading Error handling for failed network requests with service workers

The Model-View-Presenter-Controller pattern

In this post I'll talk about the MVPC (Model-View-Presenter-Controller) design pattern I use in client applications such as progressive web apps and mobile clients. It can be best understood as an evolution of the MVC (model-view-controller) pattern past the MVP (model-view-presenter) pattern. The basics: MVC and MVP You might want to skip this section if … Continue reading The Model-View-Presenter-Controller pattern

A differential amplifier built with a current mirror

I've wondered for a long time how differential amplifiers are actually realised on the transistor level. Not having received a formal electronics engineering education nor being part of an assorted online community, that question lingered for quite a while unanswered - until yesterday. The ideal differential amplifier The differential amplifier (DA) is an electronic element … Continue reading A differential amplifier built with a current mirror

A better switching amplifier

Last year I wrote about A switching amplifier electronic design which can drive large power loads with high efficiency and tolerable distortion. The operational principle for this is that a pre-stage converts the input signal into a series of pulses which rapidly switch the end-stage on and off - that is a power-efficient mode of … Continue reading A better switching amplifier

docker-proxy port in use

Quick one: you're starting a container through docker-compose and it says a port is in use. You "netstat -plutn" it and find out, that port is in use by docker-proxy. Github user rdavaillaud knows what's going on: stop dockerremove all internal docker network: rm /var/lib/docker/network/files/start docker

parchive: protecting backups against data corruption

As time goes by, my [place appropriate interval] backups may not grow much, but the size of my entire data archive exceeds the largest available hard disks (don't ask). Taking into account correctness guarantees by hard disk manufacturers, transmission errors over the network and who knows what else, I don't feel confident that I'll flip … Continue reading parchive: protecting backups against data corruption