As much as we all enjoy writing SQL and “doing everything in
Postgres,” we are very well aware that databases do not live in a
vacuum and were not invented for our pleasure and enjoyment. We may
come up with new extensions and innovative indexes; we may improve
the query planner and speed up backups, but if application
developers don’t use these features, nobody will appreciate our
efforts.
Binary search is a workhorse of competitive programming. There are
occasional easy problems where binary search is the solution in and
of itself; more often, it’s used as a primitive building block of
more complex algorithms. It is often presented as a way to find the
index of something in a sorted array in O(lg n) time, and many
languages have such a thing in their standard library (for example,
see Arrays.binarySearch in
Java,
the bisect library in
Python, or the
binary_search function in
C++). However,
the idea of binary search is more general than searching in a sorted
array; we’re doing binary search any time we repeatedly halve a
search interval. For example, we can use it to find the smallest or
largest number with a given property, or to find an optimal, “just
right” measurement that is neither too small nor too big.
Once you're fully immersed in it, as with any skill, it becomes very
difficult to properly remember what exactly made Rust difficult to
learn. In a general sense, it could be the fact that it exposes the
average programmer to some new features, most of them not present or
only just beginning to show up in mainstream languages, and some
that are close to unique.
For inserting SF Symbols in SwiftUI, I typically rely on Apple's SF
Symbols app to browse the
symbols's catalog. Once I find a symbol I'm happy with, I copy its
name and paste it into my Swift source. This works fairly well.
With Christian Tietze recently posting how he rendered SF Symbols
in
Emacs,
I figured there may be a way to shift the above workflow to rely on
Emacs completion instead. While I initially went down a rabbit hole
to programmatically extract SF symbols (via something like
SFSafeSymbols), I
took a step back to rethink the strategy.
A few weeks ago my colleague and I were talking about the pros of
using a queue to take some work out of the request cycle. He read an
article that suggested that queues should be used for all external
calls. I disagreed. Making broad recommendations like that generally
don't pan out because there are always tradeoffs. It's bound to be
much nuanced than that. In this article I want to explore a few
considerations worth exploring before you jump to using a queue.
A weekend getaway to Croatia that goes awry when a woman is accused
of killing her best friend. As she attempts to clear her name and
uncover the truth, her efforts unearth a painful secret.
In the evening Esme and I watched The Weekend
Away. I liked the movie and
give it a 7 out of 10.
For the last few years I've been using Django
Up to deploy my
smallDjangosideprojects. It's implemented as a Django
management command that under the hood uses Ansible to deploy to an
Ubuntu 22.04 server.
In the past, I've typically run deployments from my local
machine. However, this year I've been encouraging more teams to
focus on CI/CD practices, so I've decided to migrate a number of
projects to deploy from Github Actions (thanks, work!).
With that in mind, I wanted to share a quick guide on how to deploy
a new Django project to a VPS using Github Actions.
I’ve been using Python since 2006, and every year I ask myself if
it’s still the right language for me. I don’t want to get stuck
using a language just because it’s the one I’ve become comfortable
using. Languages are constantly evolving, and if there’s a language
that better suits my needs I’ll happily invest the time needed to
make a change. In the end, though, Python is still right for me, for
the same reasons it was right in 2006: it lets me get the work done
that I want to do, enjoyably and efficiently. There’s also the added
bonus of getting to be part of one of the best communities I’ve ever
been involved in.
Over a decade plus of getting retailers ready for a smooth Black
Friday I’ve collected a few tips, tricks, and stories related to
keeping busy applications online during big events.
In fact there’s one simple (not easy!) trick to it: the best way to
ensure your website can handle a big event is to have your website
handle a big event. That may seem like a tautology, but it’s where
this post starts and it’s where it ends.
Dramatizes a contemporary American family's attempts to deal with
the mundane conflicts of everyday life while grappling with the
universal mysteries of love, death, and the possibility of happiness
in an uncertain world.
In the evening Esme and I watched White
Noise. I didn't like the movie
much and give it a 5 out of 10.
We spend so much time drilling algorithmic complexity. Big-O and all
that. But performance is so often about contention and memory,
especially when working in parallel.
What is the probability of a hash collision? This question is just a
general form of the birthday
problem from
mathematics. The answer is not always intuitive, so it’s difficult
to guess correctly. Let’s derive the math and try to get a better
feel for those probabilities.
It’s Pi Day, everyone — my favorite crowd-sourced holiday. And not
just because of my deep affection for fruit/sugar-filled
pastries. Nope, since it was first released ten years ago, I’ve
loved the Raspberry Pi microcomputer. So, when I was asked if I had
any ideas for a Pi-Day blog, I knew exactly what I wanted to
write. So, I bring you… 5 Reasons a Raspberry Pi Belongs in Your
Network Lab!
The way to make sure that neither we nor anyone else adds these
files to the git repository by mistake is to create a file called
.gitignore, include patterns that match the files we would like to
exclude from git and add the .gitignore file to our
repository. git will ignore those file. They won't even show up when
you run git status.
An adaptation of the Tony and Olivier award-winning musical. Matilda
tells the story of an extraordinary girl who, armed with a sharp
mind and a vivid imagination, dares to take a stand to change her
story with miraculous results.
Installing software by piping from curl to bash is obviously a bad
idea and a knowledgable user will most
likely check the content first. So wouldn't it be great if a
malicious payload would only render when piped to bash? A few people
have tried this before by checking for the curl user agent which is
by no means fail safe - the user may simply curl the url on the
commandline revealing your malicious code. Luckily the behaviour of
curl (and wget) changes subtely when piped into bash. This allows an
attacker to present two different versions of their script depending
on the context :)
Sometimes a pure Python script can't just deliver the performance we
need. When that's the case we have to resort to writing our logic in
a "fast" compiled language like C or Rust and expose the function
with through a Python module. This way we get the best of both
worlds. Today I focus on how to use Rust for writing such
extensions. I choose Rust over C because it is just nicer to use and
less of a minefield of gotchas waiting for you trip them. Also,
since as a data scientist I spend spend most of the time
manipulating Numpy arrays so I will focus on how to pass them and
return them from Rust. To accomplish this I'll make use of the
PyO3 and
Numpy crates.
The core team used to put out a yearly call for blog posts. My
colleage Nick published their "Rust in
2023" post last week,
and encouraged others to do the same. I like the idea of taking a
moment to reflect on larger topics, and so well, why not write a
post!
I want to do this a bit differently from the usual formula
though. Rather than writing something with the specific intent to
build some sort of "Rust 2023 roadmap", I want to instead take this
as an opportunity to reflect on the state, values, and priorities of
the Rust project. More of a snapshot of my current perspectives,
than a concrete list of action items I think should be tackled. Here
goes!
I have been working with JS for quite some time, and recurrently I
have found myself feeling uneasy while dealing with exceptions in
JavaScript. There isn’t an ergonomic solution in my sight.
Our landing page https://mailpace.com is a
static site that consists of a simple set of HTML pages, with a tiny
sprinkling of JavaScript here and there. We started with a single
HTML page and for links like our Privacy Policy and Terms of
Service, we copied and pasted everything into a new file for each
page.
This was fine for a little while, but eventually it became annoying
to keep updating each html file, so we wanted to add a way to
modularize our pages. The idea is to keep the footer, header, nav
bar and other components the same across the site, in a
DRY way.
Rather than bring in a new static site framework, we wanted
something we could easily add to our existing NPM scripts that we
already have for including TailwindCSS and hosting a local dev
server.
Famed Southern detective Benoit Blanc travels to Greece for his
latest case.
In the evening Alice, Esme and I watched Glass Onion: A Knives Out
Mystery. Alice gave up on the
movie about halfway. I didn't like the movie much, too chaotic at
times, and give it 6 out of 10.