Blog Articles - page 2
-
Best practice for natural Ordering
Definitions of
Read article →scala.math.Ordering
MUST BE consistent withequals
, an often overlooked law that can lead to problems. -
Managing Database Migrations in Scala
The database schema should be described as code, in your repository. And you should be able to semi-automatically update your database schema on new deployments.
Read article → -
List static blog tags in folder (Jekyll, etc)
Script for listing the used tags of a Jekyll directory of articles.
Read article → -
I like Option.get
We should strive to make illegal states unrepresentable.
Read article →Option.get
is a partial function that, according to many, shouldn’t be in the standard library. Yet it doesn’t bother me; the inability of Scala to make it safe is the problem. -
Organize and Index Your Screenshots (OCR) on macOS
Screenshots contain text, text that should be searchable, as finding a screenshot later is the whole point of creating it.
Read article → -
Block comments on the web
Comments on the web can be toxic, and a waste of time. Here’s how to block them…
Read article → -
Generic IOApp alternative
Read article →IOApp
alternative, for Cats Effect v2, that can work with any effect type. -
Effect Runtime
Defining a “runtime” for Cats-Effect v2 that provides the underlying environment necessary (i.e.
Read article →ContextShift
,Timer
,Clock
). -
When My World Vanishes
It’s me, facing a hard to solve problem. It’s a difficult one, and I’m having problems focusing. I make some coffee, I move to another room, and I’m already thinking of running to some coffee shop, forgetting that we’re still in a pandemic.
Read article → -
Scala Snippet: Unlawful Effects
Unlawful/independent version of
Read article →cats.effect.Effect
. -
Running integration tests, with Scala + sbt
Scala sbt setup for separating unit tests from integrationt tests.
Read article → -
Scala Snippet: Flow/Processor to Effect
Converts an Akka Streams
Read article →Flow
into anIn => IO[Out]
method, thus wrappingFlow
into Cats-Effect’sIO
. -
Privilege
Today it’s my 38ᵗʰ birthday. I was born into privilege. Other people aren’t as lucky.
Read article → -
Scala Snippet: Safe Passwords
For security, it’s not a good practice to keep sensitive data in RAM indefinitely.
Read article → -
Sample Error Hierarchy in Scala
Mimicking the HTTP error codes.
Read article → -
Snippet: turn on JVM debugging in sbt
Remote debugging can be used to debug externally executed programs, useful to activate in
Read article →sbt
in order to keep using it while debugging with your favorite IDE. -
TypeScript Sample: Flow Sensitive Typing
Demonstrating Typescript’s untagged union types.
Read article → -
Retry Failing Tasks with Cats and Scala
Retry actions ending in failure via simple functions and Typelevel Cats type-classes.
Read article → -
Scala Snippet: Cats-Effect Resource to Reactive Streams
Cats-Effect’s Resource can’t be converted directly into a Reactive Streams Publisher. Beware!
Read article → -
ExecutionContext Must Be Stack-safe
Sample demonstrating that directly executing runnables in your
Read article →ExecutionContext
(with no stack-safety) is a really bad idea. -
Fatal Warnings and Linting in Scala
Strengthen your code via
Read article →-Xfatal-warnings
, linting and piss off your colleagues with useful compiler errors. -
Parallelizing Work via a JavaScript Semaphore
Simple and very effective implementation of a Semaphore, used for easily parallelizing work in JavaScript/TypeScript.
Read article → -
Blog Updates
Dusted off my website, with big plans ahead.
Read article → -
Python Snippet: Send Email via SMTP
Python snippet for sending an email via SMTP.
Read article → -
Shell Snippet: Encrypt Files with AES256
Quickly encrypt a message or a file for sending to your colleagues over unsecure messengers (Slack, etc).
Read article → -
Haskell Snippet: Sierpinski Triangle
A fun Haskell sample that draws a Sierpinski triangle via ASCII characters.
Read article → -
Regexp Replacement via Function in Java/Scala
Replace in strings via regexp, with the replacement being calculated via a function.
Read article → -
Async Queue in TypeScript
Production-ready, Promise-enabled async queue.
Read article → -
Scala Snippet: Blocking Task
Monix Task implementation for wrapping (suspending) blocking I/O such that it can be canceled. s Imported from gist.github.com.
Read article → -
Scala's isInstanceOf is an Anti-Pattern
Scala has a much better way of discriminating between types. Scala has implicit parameters, with which you can describe type classes.
Read article → -
On Bifunctor IO and Java's Checked Exceptions
Bifunctor IO is a hot topic in the Scala community. Herein I’m expressing my dislike for it, as it shares the problems of Java’s Checked Exceptions.
Read article → -
In Defense of OOFP
OOP versus Type Classes, exemplified and in defense of the Scala collections redesign.
Read article → -
Minitest: Zero Crap Scala Testing Library
Minitest is my minimal testing library that I’ve been using for developing Monix.
Read article → -
What is Functional Programming?
FP is programming with (mathematical) functions, there’s no room for interpretation.
Read article → -
Scala Days 2017 — Monix Task
My presentation from Scala Days 2017, Chicago (April) and Copenhagen (June), on the design of Monix’s Task.
Read article → -
Introduction
JavaScript’s Promise leaks memory in recursive loops and what you can do about it.
Read article → -
Automatic Releases to Maven Central with Travis and SBT
Enabling automatic releases for your open source Scala project with Travis and SBT.
Read article → -
Functional Programming Inception (Presentation)
My presentation from the Bucharest FP meetup.
Read article → -
Asynchronous Programming and Scala
Asynchrony is everywhere and it subsumes concurrency. This article explains what asynchronous processing is and its challenges.
Read article → -
Fixing scala.collection.Iterator
The venerable Iterator interface we all love and hate could use some improvements. This is a follow-up to my previous article, in which I talked about getting rid of Traversable because the Iterable and Iterator duo is enough for Scala’s standard library.
Read article → -
Why Scala's Traversable Is Bad Design
Traversable was a design mistake, is redundant and we should remove it.
Read article → -
Add to NewsBlur Bookmarklet
An Add to NewsBlur bookmarklet that you can copy-paste for iPhone/iPad/Android usage
Read article → -
Monix Task vs Scalaz vs Future, The Benchmark
The Task in Monix has really good performance. See the benchmark.
Read article → -
Akka & Monix - Typelevel Summit, Oslo 2016
Presentation from Typelevel Summit, Oslo, 2016, about my experience in dealing with modeling behavior by processing asynchronous soft-real time signals using Akka & Monix.
Read article → -
Monix Task - flatMap(Oslo) 2016
My presentation from flatMap(Oslo) 2016. It’s about the Monix Task, a new type for dealing with asynchronous processing on top of Scala and Scala.js.
Read article → -
Avoid Javaisms: Mocks, Stubs, DI is Code Smell
Such practices represent clear signals for code smell, meaning code that sucks as a symptom of a bigger problem, one of design. The lumping together of these practices is not an accident, as they are related.
Read article → -
Monifu vs Akka Streams
Back in June I attended Scala Days in Amsterdam and participated at a talk by Mathias Doenitz on The Reactive Streams Implementation Landscape. It was a good talk, yet I felt a little bias towards Akka Streams, which is natural coming from somebody that is contributing to Akka, but let me give you the perspective from the other side.
Read article → -
Scala Best Practices
This is a collection of best practices for Scala, something to get you started.
Read article → -
Resources for Learning Scala
Getting started with a new programming language shouldn't be hard, however navigating the web for resources on getting started with Scala can be a doubting experience, as many such resources are either out of date, or wrong, or both. This post is intended to reduce the noise for my colleagues and other people that are interested in Scala development.
Read article → -
Towards a Better AtomicReference
The AtomicReference is like a container for a volatile reference. Usage of volatile references is useful for the issue of visibility in concurrent code, however AtomicReference also supports the atomic Compare-and-Swap operation (CAS for short), which is the pillar of all non-blocking data-structures and algorithms built on top of the JVM, including complex ones like the ConcurrentLinkedQueue, an implementation based on the Michael-Scott non-blocking queues.
Read article →