Plurrrr

a tumblelog
week 02, 2020

Goodbye, Clean Code

Am I saying that you should write “dirty” code? No. I suggest to think deeply about what you mean when you say “clean” or “dirty”.

Source: Goodbye, Clean Code, an article by Dan Abramov.

The Case for Bayesian Deep Learning

I hope this exposition will be helpful to those seeking to understand what makes Bayesian inference distinctive, and why Bayesian inference is worthwhile in deep learning. This note is also intended to help clarify the poorly understood connections between approximate Bayesian inference and deep ensembles, in light of the recent misunderstanding that deep ensembles and Bayesian methods are competing approaches.

Source: The Case for Bayesian Deep Learning, an article by Andrew Gordon Wilson which is also available as a PDF.

Bloody Genius: Good

In the early evening I finished Bloody Genius by John Sandford. I liked the story and look forward to the next Virgil Flowers novel.

Neon Prey

Clayton Deese looks like a small-time criminal, muscle for hire when his loan shark boss needs to teach someone a lesson. Now, seven months after a job that went south and landed him in jail, Deese has skipped out on bail, and the U.S. Marshals come looking for him. They don't much care about a low-level guy--it's his boss they want--but Deese might be their best chance to bring down the whole operation.

In the evening I started in Neon Prey by John Sandford. I was immediately sucked into the story and kept reading for most of the evening.

The “Inside” Problem

So, you're working on a design. You need a full-width container element because the design has a background-color that goes from edge-to-edge horizontally. But the content inside doesn’t necessarily need to be edge-to-edge. You want to:

  1. Limit the width (for large screens)
  2. Pad the edges
  3. Center the content

It's "the inside problem" in web layout. It's not hard, it's just that there are lots of considerations.

Source: The “Inside” Problem, an article by Chris Coyier.

Mastering Wrapping of Flex Items

Flexbox was designed as a single dimensional layout, meaning that it deals with laying out items as a row or as a column — but not both at once. There is however the ability to wrap flex items onto new lines, creating new rows if flex-direction is row and new columns if flex-direction is column. In this guide I will explain how this works, what it is designed for and what situations really require CSS Grid Layout rather than flexbox.

Source: Mastering Wrapping of Flex Items.

Copying data is wasteful, mutating data is dangerous

You have a large chunk of data—a NumPy array, or a Pandas DataFrame—and you need to do a series of operations on it. By default both libraries make copies of the data, which means you’re using even more RAM.

Both libraries do have APIs for modifying data in-place, but that can lead to other problems, including subtle bugs.

So what can you do?

In this article you’ll learn to recognize and apply the “interior mutability” pattern, which offers a compromise between the two: the safe operation of copy-based APIs, with a somewhat reduced memory usage.

Source: Copying data is wasteful, mutating data is dangerous, an article by Itamar Turner-Trauring.

Finding unique items - hash vs sort?

A while back, I was trying to speed up some code which finds unique items in a collection. For example, transforming "AABBADCAB" => "ABDC". There are two ways to do this efficiently - one is based on sorting, the other based on hashing. So, which is faster? I couldn't find the answer, so I ran some experiments and here are the results.

Source: Hash vs Sort.

Bloody Genius

At the local state university, two feuding departments have faced off on the battleground of science and medicine. Each carries their views to extremes that may seem absurd, but highly educated people of sound mind and good intentions can reasonably disagree, right?

Then a renowned and confrontational scholar winds up dead, and Virgil Flowers is brought in to investigate . . . and as he probes the recent ideological unrest, he soon comes to realize he's dealing with people who, on this one particular issue, are functionally crazy. Among this group of wildly impassioned, diametrically opposed zealots lurks a killer, and it will be up to Virgil to sort the murderer from the mere maniacs.

In the evening I started in Bloody Genius by John Sandford.

Tricks for Postgres and Docker that will make your life easier

Nowadays, everybody is trying to run everything in container and I don’t blame them, I do the same thing, because running applications, databases or other tools in Docker container is super nice and we all know why (isolation, easy setup, security…). However, sometimes debugging, accessing, or in general interacting with containers can be pretty annoying. This includes accessing, modifying or querying databases. So, as I used PostgreSQL extensively and have been running it inside containers for a while now, I — over time — made a list of few commands that can help immensely when doing simple and also not so simple operation with a database server.

Source: Tricks for Postgres and Docker that will make your life easier, an article by Martin Heinz.