AlphaTechnic Tech Blog
Writing about the problems I run into and what I learn from them.
Writing about the problems I run into and what I learn from them.
Each reward type expressed conversions in its own way. I changed them into one structure. I also describe the methods I used to avoid breaking old data under event sourcing.
A ClassCastException appeared after we moved to Scala 3. Kryo was serializing a lazy val that was still being computed.
How I used the Monte Carlo algorithm to quickly find a board with no bingo, with a small and acceptable risk of failure.
Scores in our Redis ranking were slightly wrong. The cause was converting a 64-bit Long to a Double, which has only 53 bits of precision.
A TTL job in CockroachDB used too much memory. I find out why a simple delete reads so much data, and fix it with smaller batches.
How to pick elements of N types from a collection in one pass, step by step, from foldLeft to Scala 3 macros.
A user got an item that was not on the rate table. I built a static check and a simulator to prevent this kind of bug.
Our server maintenance was manual and risky. I built an interactive tool for it with ZIO, Scala-CLI, and Scopt.
One request saved too many events in our Event Sourcing DB. I compare two ways to merge them.
What covariance and contravariance mean, and why they depend on whether a type is used as an output or an input.
What is a Monad, and why is it defined that way? I work through both questions, from flatMap and Option to IO and ZIO.
ZPure errors did not show where they came from. I used implicit parameters and the sourcecode library to add the caller's location.
How CPython manages memory with reference counting and garbage collection, and why it needs the GIL.
Separate chaining or open addressing? I read CPython's source to see how dict handles hash collisions.