Holy Dev Newsletter March 2024
Welcome to the Holy Dev newsletter, which brings you gems I found on the web, updates from my blog, and a few scattered thoughts. You can get the next one into your mailbox if you subscribe.
What is happening
I have spent all my free time with Rama, which resulted in the posts Rama: How to achieve a transactional update across partitions and Hands on Rama, day 3: Foreign keys and data integrity, macros, queries. Sadly, I did not have much time for Wolframite, but that will need to change, as our Clojurists Together sponsorship quarter is coming up 🙀.
Gems from the world wide web
👓 How To Center a Div [webdev, css]
A very useful overview of different ways to center content with CSS in 2024, and what to use when, including old good margin: auto, flexbox, grid, and more.
Summary: a) If we want to horizontally center a single element without disturbing any of its siblings, we can use the Flow layout auto margin strategy. b) If we have a piece of floating UI, like a modal or a banner, we can center it using Positioned layout and auto margins. c) If we want to center a stack of elements one on top of the other, we can use CSS Grid. d) If we want to center text, we can use text-align. This can be used in conjunction with any of the additional methods. f) Finally, in most other situations, we can use Flexbox.
👓 A quick introduction to Google’s Pregel graph processing system [graph, theory, algorithm] - Pregel was first outlined in a paper published by Google in 2010. It is system for large scale graph processing (think billions of nodes)…
A brief, well-written article introducing Google's "Pregel" system for (very) large scale graph processing. Pregel is iterative and runs the same function for each vertex in parallel, allowing it to read messages the vertex got from the previous step or send messages to other vertices (typically along its outgoing edges) for the next step. The article has an example demonstrating this.
👓 Pregel implementation with Rama [rama]
Ognen Ivanovski's implementation of the Pregel computation system for graphs on top of Rama, along with connected components and topological sort (for DAGs) as fully distributed algorithms - in < 175 lines. A heavy read without good familiarity with Rama APIs.
👓 Pico CSS • Minimal CSS Framework for semantic HTML [webdev, css, library]
Might be useful. Only CSS, responsive, dark & light modes. Customizable with 130+ CSS variables. Switch between 20 handcrafted color themes and compose with 30+ modular components to tailor the UI to your brand's look and feel.
👓 lorenzofox blog | Coroutines and web components [webdev, javascript, opinion] - Custom elements (web components) modelling with coroutines
This was innovative - use JS generators as coroutines (fns that may be paused (i.e. pause themselves via yield) and Sent data on un-pause (since next() can take days that yield will return). Use them to model the life cycle of a component and it's rendering. 🤯
👓 How moving from Pandas to Polars made me write better code without writing better code - DEV Community [data science, performance, experience]
About problems with Pandas, the famous Python dataframe library, and experiences replacing it with Polars, which is built on top of the Arrow memory format and is written in Rust. A great benefit of Polars is it's "lazy api", which postpones execution til the end and injects a query planning and optimization step.
👓 Greptime: Cloud-Native TSDB. Anywhere, Any Scale [tool, devops, database, observability]
An interesting project - OSS, cloud-native time-series DB in Rust, at v0.7 with 1.0 expected in August. Can be deployed as a single binary on an IoT device, or a cluster for the metrics and soon logs of your app. Paid by their cloud offering. Highlights: smart indices (created/destroyed on the fly w.r.t usage), efficiency, separate storage and compute (hi, Datomic!), SQL and Prometheus QL (=> can be used as a drop-in replacement for Prometheus in Grafana), distributed and parallel-processing query engine, can be used as storage for Prometheus. Write via a gRPC (Go, Java clients), InfluxDB HTTP Line write protocol, OpenTSDB HTTP put, ingest OpenTelemetry metrics via OTLP/HTTP, serve as a Vector sink,. Extend queries with Python.
👓 PEZ/js2clj2js: A demo about being cautious with clj->js and js->clj [clojure, performance, clojurescript]
Great article / exploration by Peter Strömberg about various options for working with JSON data in clojure/script. For bigger data, cljs' clj<_->js may become too expensive (as demonstrated). A clear winner is to skip JSON.parse and use instead transit/read (at the cost of getting string, not keyword keys) - this can be reportedly 20-30x faster than JSON.parse + js->clj. There are also other interesting alternatives, such as cljs-bean that wraps the mutable JS data with Clojure abstractions, so that you can use core fns w/o a conversion (but turning this back to JS is expensive).
--
Thank you for reading!