Make JS code communicate with a ServiceWorker

Posted on 2020-08-18 in Programmation • Tagged with JavaScript, Web, ServiceWorker

If you need to send data from your JS code to your ServiceWorker, you can do it like this:

navigator.serviceWorker.register("./sw.js").then(registration => {
    registration.active.postMessage("Some message");
});

You can then rely on this code in the ServiceWorker to read the message:

self.addEventListener("message", event => {
    console …

Continue reading

Should you build a SPA?

Posted on 2020-06-15 in Programmation • Tagged with JavaScript, Web, Django

This article is an update to a previous article why you want to build a SPA which I think was laking some nuance and precision. Reading this article is not required to read this one. I'm writing this update because SPAs are very popular and I recently though more about …


Continue reading

JavaScript fatigue

Posted on 2020-05-31 in Programmation • Tagged with JavaScript

Today, I'd like to dig into something that has been bothering me lately: why I often feel tired of JavaScript (and even sometimes programming in general). I'm not alone in this, there's even a name for this JavaScript fatigue. Here I'll give my personal thoughts on this (and probably rant …


Continue reading

PWAs and Django

Posted on 2020-02-29 in Programmation • Tagged with Python, Django, PWA, JavaScript

In this article, I'll guide you to create a PWA with the Django framework. All the code for this project is available under my gitlab account. You will find in each sections links to the relevant commits to help you follow. If something is not clear or if you have …


Continue reading

Why you probably want to make a SPA

Posted on 2020-01-12 in Programmation • Tagged with JavaScript, Web, Django

Important

I created an updated version of this article in should you build a SPA which provides a more complete and balanced view on this subject. Please read it instead of this current article.

I am currently working professionally on a website that is not a SPA. I'd like to …


Continue reading

Deploy to your test server with git hooks

Posted on 2018-09-09 in Programmation • Tagged with git, devops

You probably already wanted to have your own test environment to allow others in the company to tests what you did. Perhaps you have a common one, but as your team is growing, it is probable that the common environment is a bottleneck and you wish each developer could have …


Continue reading

Run multiple docker daemons on the same host

Posted on 2018-02-25 in Programmation • Tagged with Docker, Linux

Today I am going to explain how you can run multiple docker daemons on the same host. This can be useful if you want several users to use docker and want each of them to be isolated from one another (ie don't see images, containers, … of other users). The solution …


Continue reading

Can we clean password from PHP memory?

Posted on 2017-11-26 in Programmation • Tagged with php, Docker, security

At work in a PHP application, we rely on libsodium to erase a password from $_POST. It may sound like a good idea: once the password is not in memory any more, it can't leak. But the question is: is it really erased from memory? That's the question will answer …


Continue reading

Use Linux user namespaces to fix permissions in docker volumes

Posted on 2017-07-02 in Programmation • Tagged with Docker, Unix

Not long ago, I publish an article about using Unix sockets with docker. These sockets where in docker volumes so they could be shared between various containers. The key idea was to change the …


Continue reading

Use Unix sockets with Docker

Posted on 2017-02-15 in Programmation • Tagged with Docker, Unix

By default, you are supposed to use TCP sockets to communicate with your applications running in Docker. But what if you want to use Unix sockets instead? The answer is you can: you make the application create the socket file in a volume and set the proper permissions to it …


Continue reading