Go does not have classes and objects, but it does have types that we
can make many instances of. Further, we can attach methods to these
types and they kind-of start looking like the classes we’re used
to. When we attach a method to a type, the receiver is the instance
of the type for which it was called.
Choosing the name of a receiver is not always a trivial task. Should
we be lazy and name them all the same (like this or self)? Or
treat them not unlike local variables by abbreviating the type (like
srv to a Server type )? Or maybe something even more nuanced?
And what are the consequences? How will our code suffer if we choose
one approach over the other? Let's explore.
Ok ok, hear me out. I know you're already lighting torches and
sharpening your pitchforks (Side note: Can you sharpen a
pitchfork?). I know I'm probably in the minority here, so please
allow the little-guy to make a small case for the use of self as a
receiver name.
One of the most covered topics about pandas optimization is how to
apply functions over columns. One option is to use apply but is
not a good idea
(maybethisisoneofthetopicswithmoreposts ever). It’s known that the
optimal solution is to use vectorization, however, some functions
that can’t be vectorized easily. What to do in these cases?
Infinite scrolling minimizes interaction costs and increases user
engagement, but it isn’t a good fit for every website. For some,
pagination or a Load More button will be a better solution.
Combinators are a very interesting to make your code cleaner and
more functional. Almost all the definitions you'll find on the
internet will make your head explode 🤯 because they raise more
questions than they answer.
Thus, here is my empiric definition: Combinators are methods that
ease the manipulation of some type T. They favor a functional
(method chaining) style of code.
If you were to search the internet for recent articles about Perl,
you might well be led to believe that the language hasn’t changed in
the last twenty years. And, sadly, that’s a completely
understandable belief as the major version number hasn’t changed
since 1994.
In this series of articles, I will discuss how some of the
principles and techniques learnt from typed functional languages can
be applied to
Python1
to achieve the same results. We’ll see that, while Python famously
eschews
the functional paradigm, we can build pythonic(ish) equivalents
relatively easily.
Nix has been able to generate Docker images for several years now,
however the typical approach to layering with Nix is to generate one
fat image with all of the dependencies. This fat image offers no
sharing, is slow to build, upload, and download.
In this post I talk about how I fix this problem and use Nix to
automatically create multi-layered Docker images, allowing a high
amount of caching between images.
A daemon is a
program that runs in the background for an indefinite period of
time.
An important daemon on Unix-like operating systems is the cron
scheduler that can be
configured to perform tasks periodically. Though there are many
different types of daemons, we will explore how to create a cron
daemon.
Haskell is a pure and lazy programming language, and the laziness
allows us to write some algorithms very elegantly, by recursively
referring to already calculated values.
SQLite is unique among embedded databases in that it not only has a
transactional, b-tree storage layer but it also includes a robust
SQL execution engine. Today, we're diving into how SQLite parses,
optimizes, & executes your SQL queries.
In a profession like this, you're bound to make enemies . . .
It all starts when Dr Temperance Brennan finds a box on her
porch. Inside is a fresh human eyeball with GPS coordinates etched
into it. They lead her to a macabre discovery in a Benedictine
Monastery, and soon after she discovers a mummified corpse in a
state park.
There seems to be no pattern to these killings, except that each
mimics a killing connected to something a younger Tempe experienced,
or barely escaped. Someone is targeting her, and she needs to figure
out why before they strike again.
And then her daughter Katy disappears.
Someone is playing a dangerous game with Tempe. And they won’t
stop until they have taken everything from her . . .
When it comes to static sites, there are a myriad of solutions for
authoring and compiling, but talk about hosting these static sites,
and we are still in the early 2000s. I discuss the challenges one
faces when hosting, and even make a proposal to solve some of these.
FUSE-T is a kext-less implementation of FUSE for macOS that uses NFS
v4 local server instead of a kernel extension.
The main motivation for this project is to replace macfuse
(https://osxfuse.github.io/) that
implements its own kext to make fuse work. With each version of
macOS it's getting harder and harder to load kernel
extensions. Apple strongly discourages it and, for this reason,
software distributions that include macfuse are very difficult to
install.
I have long held very strong opinions about the Critical CSS
pattern. In theory, in a perfect world, with all things being equal,
it’s demonstrably a Good Idea™. However, in practice, in the real
world, it often falls short as a fragile and expensive technique to
implement, which seldom provides the benefits that many developers
expect.
There is a common misconception that partitioning a table in
Postgres will improve performance, while it’s true in some cases,
but sometimes partitioning may actually degrade your performance if
done incorrectly.
Let me try to give a very brief overview about postgres partitioning
in general and some guideline to consider before partitioning the
table.
In the evening I finished The
Investigator,
book 1 in the Letty Davenport series by John Sandford. I liked the
story and look forward to the next one in this new series.