RSSAmplifier

Blog

Jeroen Pelgrims

Site and blog of Jeroen Pelgrims, a Belgian software developer and teacher.

jeroenpelgrims.comRSS feed ↗29 posts

Latest posts

Solving v-model Binding Issues with Vue Query and Vue 3's Reactivity

When working with Vue Query (TanStack Query) and Vue 3's reactivity system, you might encounter a subtle but frustrating issue with model bindings. For some reason you can't use v-model on a copy of your vue-query's result's properties. This blog post will describe the issue in detail and propose a workaround and a proper fix for this issue. If you want to dive straight into…

Render Svelte component to string

Background § For a new hobby project I'm working on I implemented the login using a magic link. So the user would enter their email address and they'd receive an email with a link in it that they can click on. When arriving back on the site they would be authenticated. As a quick way to build the body of the mail I just concatenated some strings together. But after building some more…

Build-it-yourself NAS and why not to use a Raspberry PI for it

Current setup § Currently my home server setup consists of a 10 year old laptop . It's a pretty janky setup since the laptop doesn't even have an ethernet port, so it's connected to my network through a USB-to-ethernet cable. For data storage I'm using a 4TB external harddrive, also connected through a USB cable. The 4TB data drive is getting a bit cramped so I'm looking…

Using custom Fontawesome Kit icons in React

I had a project where we needed to use Fontawesome icons and to do this the @fortawesome/react-fontawesome library was a great help. But at some point the client needed icons that weren't in FontAwesome's icon library. Neither the free or Pro icons. Not a problem I thought, I knew it was a possibility to upload icons to FontAwesome and use those custom icons together with…

Accessing the Firebase Auth user in SvelteKit server-side

Note: If you want to jump straight into the code you can check the github repo . Why this post? § Normally when using Firebase Auth you'll only access the user data Client-Side through the client sdk . (Which is a large part of Firebase's benefit as a BAAS so you don't need to build your own backend) Sometimes however you need to access the user data server-side as well. In my case…

DIY chicken coop from old pallets

Index § Why build a chicken coop? Requirements of the coop Planning before building Photos of the building process Price Why build a chicken coop? § I recently—well, 6 months ago—bought an apartment with a large, by Antwerp standards, garden. There's a few reasons for this, mainly that I love gardening but also that I want to keep a few pets. Eventually a dog, but for now I thought chickens…

Pinhole photography

A while back I experimented a bit with pinhole photography, something that had interested me since I had heard about it by a hitchhiker I had met at a hitchhiking meeting. He ( Clemens Schmid ) had made a camera out of cardboard and in this camera was a regular 35mm film roll. About 6 years after seeing that camera in use I finally made one myself. And not much after that I made a second one! The…

Typescript flexible entity type

TLDR of what's going on in this post: creating a typescript type definition for a database entity that has a property which can be either an array of references to other entities OR that can be an array of those entities nested in it. Click here to skip the introduction and go straight to the solution. On a project I worked on we used API Platform for the backend and React + Typescript for…

Quick and dirty React Reason HMR (Hot module reloading)

It proved quite hard to find a way to do HMR in ReasonReact. Here's a quick but dirty way of doing it: Initialize an app using reason-scripts After having installed the bucklescript platform you can run: yarn create react-app reasonreact-hmr -- --scripts-version reason-scripts Replace your src/index.re file with this: [ %% bs.raw { | require('. / index.css') var App = require(…

Arduino solar aimer

This is the first "more advanced" thing I did with an Arduino. Well, more advanced than just turning on and off some leds that is. I wanted to build something that would aim solar panels towards the sun, increasing their efficiency. I did this in 3 iterations, each one extending the previous one. First a construction where I steer the servos by buttons myself Then a construction where the servos…

Pushing to Dokku from GitLab CI

![GitLab CI logo](/images/gitlab-ci-logo.png) I had heard about GitLab for a while ago but it was only recently that I actually tried it out a bit more thorougly and discovered they have quite a few cool features. Just like Bitbucket they have a free tier which includes private repositories, or projects in GitLab lingo. But on their free solution on gitlab.com —the .org domain is for the…

Clean & efficient namespacing/routing in express 4

A full example for both express 3 and 4 can be found on github . I have a bunch of routes which are under the same namespace. E.g.: GET /api/person POST /api/person GET /api/person/:id PUT /api/person/:id DELETE /api/person/:id I could start implementing these as follows: app.get '/api/person' , (req, res) -> #return people…

Node streams in CoffeeScript

I was looking for a way to make a search on Google and getting the results back on a one-by-one basis instead of getting them by 10 per query to the api. In Python I'd use generators for this and I was looking for something similar in Node. As far as I could figure out actual generators are only available starting from v11.x and thus not yet in 10.28, the current stable version. And even if…

Ghost upgrade script

The following is a bash script to upgrade your Ghost installation automatically to the latest version. The script is meant to be used on an Arch linux installation but should be pretty generic. On other distro's you should only have to change the lines to start/stop ghost. (see "Stopping Ghost" & "Starting Ghost" below) Important: This does not update your template, in case you've…

Token based, sessionless auth using express and passport

Problem at hand § What I wanted to make was a webservice with which I could authenticate through facebook initially and using a token in subsequent requests. I found a bunch of clear information about each individual part but not how to integrate everything, hence this post. A working example containing all the code can be found on Github . I'll be using: express mongoose : for storing the…

Farewell Opera

About 10-something years ago I was introduced to Opera by a friend of mine. Yes, that was when Opera's free version still came with a banner ad but that didn't stop me from loving the browser. Some of the features I liked and eventually even started to regard as essential for a browser are: Tabs on multiple lines Mouse "rocker" features. (holding of RMB and clicking LMB would navigate…

Sightseeing in Antwerp

Skyline antwerp with Big 3 by Kschotanus / CC-BY-3.0 Somewhere in the first week of January (when I begun writing this post) was the first time that I hosted a fellow CouchSurfer. Jacob comes from Alabama, USA and is currently studying in Birmingham, UK. During the Christmas holidays he wanted to visit mainland Europe a bit, and I offered to host him in Antwerp. Of course, people don't…

Samsung Galaxy SII battery/USB problems

Problem description § I recently had some nasty trouble with my Galaxy SII. The problem I was having was that after working normally the phone would suddenly act like I was pulling out and putting in the usb cable constantly. The battery would indicate being charged, discharged and then charged again (etc.). After shutting the phone down and trying to reboot it I would get an image showing the big…

Updated SoundSwitch

I updated my SoundSwitch Application. You can install it by going here . The purpose of SoundSwitch is to be able to easily switch between 2 or more Audio output devices. For example, I have a wireless headset and my regular speakers. Both are detected as a separate audio card in the sound panel. The only way to switch between them is to open the playback devices panel and select one of them and…

jQuery scroll to element plugin

This small plugin will scroll to a selected element when calling .scrollTo() on it. It has an optional parameter which specifies the duration of the scroll. $.fn. scrollTo = function (duration) { if (duration == null ) { duration = 1000 ; } var offset = $ (this). offset ().top - $ (window). height () / 2 + $ (this). height (); $ ( "html,body" ). animate ( { scrollTop: offset, }, duration );…

Learning Norwegian - Some resources

Norwegian flag in grunge style by Gabriel Oliveira With only 5 million speakers it's not very easy to find resources on learning Norwegian compared to other languages. Listed below is a compilation of the resources I found while looking for learning materials. Norwegian is the first language I'm consciously learning on my own, not in a school environment. (I say consciously because I…

Bulktts - Text to speech using Google Translate

The project I was talking about in the previous post was this one, bulktts . With Google Translate you can only listen to the sound of the text you typed in, but you can't download it. I found a url which with the right parameters lets you download the mp3 file generated by Google Translate, but if you need a bunch of words converted to speech this is a tedious job of changing the url, save…

Python in-memory zip file

I needed this for something where I wanted to send the visitor of a website a bunch of files he selected at once. An easy way to do this would be to add the files to a zip file and then send that zip file to the user. Unfortunately Python doesn't have an in-memory zip file library, you can only interact with zip files on disk. After a bit of googling around I came to this StackOverflow answer…

Solving 8 Queens problem on an 8x8 board with a Genetic Algorithm.

I have an Artificial Intelligence course and one type of search algorithm handled is Genetic Algorithms. Very interesting because it uses the principle of evolution to find a solution to a problem. You start with a population of begin states and each state has a 'fitness' which indicates how close it is to a solution. Based on that fitness you will crossjoin or mate 2 states. Higher…

Programming Praxis - Happy Numbers

Today's problem had to do with Happy Numbers. I split the problem up in two parts, splitting up a number up in to digits and checking whether or not the number is a Happy Number.

Programming Praxis - Word Cube

This is my first solution for a Programming Praxis assignment, the Word Cube problem. It's definitely not an elegant solution. It's almost as brute force as it can get, but I have only a negligible amount of training in this field so I'm satisfied for now with being able to find a solution at all. It takes a few minutes to find all the possible words. I did however find quite a few…

Bachelor in Applied Computer Science

Yesterday evening I received my diploma. This post isn't in line with the previous posts I made but it is in line with the general content of this blog, things I learned. When I entered college I had a basic knowledge of programming. I knew some PHP and some VB. These past three years I learned a bunch, possibly more than I thought I would learn when entering college. Onwards in education! §…

Java doesn't support inheriting twice from the same interface with a different generic parameter

I created this: public class Observable <T> { private List < Observer < T >> observers = new ArrayList < Observer < T >>(); public void addObserver ( Observer < T > observer){ observers.add(observer); } public void removeObserver ( Observer < T > observer){ observers.remove(observer); } public void removeAllObservers (){ observers.removeAll(observers); } public void notifyObservers ( Observable <…

Automatically add library jar contents to executable jar with Netbeans

Say you have a Java project in Netbeans with a library jar added. In my case this was SQLiteJDBC , an SQLite JDBC driver for Java applications. When you build the project ("Clean and build project") a folder dist will be created with as contents: Your executable jar file A lib folder with the jar files of your added libraries inside In your executable jar file (it&#x27;s actually a zip file, you…