Installing debian 11 “bullseye” using PXE boot on an Acer Aspire 5 A515-45 laptop

I installed GNU/linux on a laptop, for the first time since 2012. And the install was mostly trouble free. I spent a little time on getting the PXE boot working and getting the wireless NIC working, but other than that everything I’ve tried has been working smoothly (display, sound, keyboard, touchpad and suspend/resume).

Continue reading Installing debian 11 “bullseye” using PXE boot on an Acer Aspire 5 A515-45 laptop

Yep, I’m still using redux

Why I’m still using redux and how I’m currently using redux.

One thing I’ve heard a lot recently, when other frontend people have taken a look at my code, is the question “Are you still using redux? That’s so wonderfully quaint and old fashioned. When we threw it out and started using useState() hooks our life got so much better!” (or maybe just “once we started using hooks our life got so much better”).

And yep, I am still using redux, even though react hooks, which supposedly made redux obsolete and old-fashioned, arrived back in 2018 (which is also the same year I started doing frontend programming).

Continue reading Yep, I’m still using redux

Replacing react-datepicker with HTML input element of type date

I replaced “react-datepicker” in two of my react applications, with the built-in <input type=”date”/> date picker, and the resulting reductions in bundle.js size were so significant I felt the need to blog about it.

Continue reading Replacing react-datepicker with HTML input element of type date

1990-ies picture archives in modern skin

I have written a reactjs web application, that displays images from a 1990-is picture archive in a modern, mobile friendly UI, that also tries to use the available space on large displays (responsive layout from bootstrap v4). The URLs of both the individual pictures and albums, contains opengraph and twitter card meta tags, that makes them appear with nice previews when being shared in social media.

Continue reading 1990-ies picture archives in modern skin

Build beans better with builders

Builders provide a nice, if verbose, way to create immutable java beans.

The upsides are a nice syntax for creating immutable beans, and a way to provide copy-on-write behaviour for immutable objects.

The downsides are the need for verbose boilerplate code, approximately doubling the code size of the bean source files, and the overhead of one extra object created and then left for garbage collection, for each created bean.

Continue reading Build beans better with builders

Chaining Optionals using flatMap and map

The blog post How I learnt to like Optional shows an example of how to chain Optional values safely, using Optional.orElse() to provide empty objects for the next level in the chain.

This blog post uses Optional.flatMap() and Optional.map(), to achieve the same thing, without having to create the empty objects, and without doing any evaluation for empty objects.

Continue reading Chaining Optionals using flatMap and map

How I learnt to like Optional

I used to see Optional<Something> as a completely useless addition to Java, adding to the bloat of Java without being any clearer than checking if a reference is null.

I have changed my mind, and now think Optional<> can be useful in making code simpler, easier to understand, and more robust.

The reason I changed my mind, was the usefulness of Optional.orElseThrow() when having to traverse deeply nested data structures in Java code.

Continue reading How I learnt to like Optional

Join mastodon and slowly posting a wordpress RSS/atom feed

Mastodon is a social network that appears similar to twitter: you get a feed where you can see “toots” instead of “tweets” and you can send your own toots that will be seen by others listening to you or looking for a hashtag found in your toot. Continue reading Join mastodon and slowly posting a wordpress RSS/atom feed

Join diaspora and slowly posting a wordpress RSS/atom feed

Diaspora is a social network that appears to similar to Facebook in its behaviour: you get a web UI with a feed, and what ends up in that feed comes from your friends and your groups and what hashtags you filter for.

Continue reading Join diaspora and slowly posting a wordpress RSS/atom feed

Composing applications with karaf features

I create web applications by first creating a set of OSGi bundles that form the building blocks of the application, and then use karaf features to pull the building blocks together to create complete applications that run inside apache karaf.

Continue reading Composing applications with karaf features