Kotlin Coroutines – Flow parallel processing

Meant as an alternative to the Kotline Coroutine "Channel", a "Flow" is another way of enabling communication between two co-routines. The difference between the two is essentially that a channel is "hot" (i.e. starts as soon as it is declared), while a flow is "cold" (i.e. only starts when required (or "subscribed to" in reactive … Continue reading Kotlin Coroutines – Flow parallel processing

Machine Learning: Oversampling vs Sample Weighting

How do you "influence" a ML model? For example, imagine a scenario where you'd like to detect anomalies in a given data set. You reach for your favourite algorithm - in my case Isolation Forest: Our example output from Isolation Forest It does fine for most cases, except that one data point which invariably gets … Continue reading Machine Learning: Oversampling vs Sample Weighting

Speeding up Spring MVC with CompletableFuture

Recently we're beginning to see a shift towards asynchronous/reactive workloads within the Spring ecosystem, especially since the release of WebFlux and the more recent support for Kotlin co-routines. However, both these require moving towards monos, fluxes, and libraries that support these reactive constructs. Support for reactive paradigms is steadily increasing however many of us are … Continue reading Speeding up Spring MVC with CompletableFuture

Augmented Reality using AFrame: Tips & Tricks

AFrame is a very cool javascript library which allows you to create Virtual Reality environments completely within the browser. Aframe also combines with AR.js to allow you to create Augmented Reality environments through the use of "markers" or "anchors". Anchors are very similar to simple QR codes which allow AR.js to project shapes onto the … Continue reading Augmented Reality using AFrame: Tips & Tricks

A JavaScript reverse CSS selector

In plain Javascript, you can get a reference to a particular HTML element by using the querySelector method. For example: document.querySelector('div') Will give you a reference to the first "div" that's encountered in the page. Give it a try in DevTools Sample querySelector What if we want to do the reverse? That is, given an … Continue reading A JavaScript reverse CSS selector

Spring Data JPA: Emitting events on save() – Kotlin Edition

kotlin and spring boot

Scenario In a nutshell, we'd like to emit an event or take some custom action whenever a Spring Data JPA repository gets it's "save(...)" method called. Our criteria is to have minimal constraints set on other developers using this. In other words, we wouldn't like a solution where we create a new method or change … Continue reading Spring Data JPA: Emitting events on save() – Kotlin Edition

Living without React Router

How do you handle the scenario when a user taps the "back button" in your ReactJS app? In a plain vanilla ReactJS app you'll end up with the user navigating off your app since it's a SPA. Most devs would tell you to use React-Router. What if you can't, or - how does React-Router work? … Continue reading Living without React Router