Suppose you want to write a decorator for a function that will execute a
callback on a function’s argument. You also want to specify the name of that
argument so that it doesn’t matter where it appears in the function’s
signature, or how the function was called (you can give arguments to a function
in any order if you use keyword arguments).
More concretely, we want to be able to write
def f(w, x, y):
callback(x) execute whenever
f() is called. To do
this, we’ll need to map …
We’ve been having quite a lot of snow this winter, and a couple weeks ago I
decided to photograph it. This is my first real attempt at a photo essay, but I
think I’m going to do more of these in the future since I find it to be a nicer
way of presenting images than having a stream of unrelated images (a la Flickr
or Instagram). Some individual images may not be great on their own, but as
part of a collection they contribute to the overall mood of the whole set.
This post is an experiment in presenting photos on this blog. There are no
previews on the index pages; you have to open the post itself to see any images
(I’m trying to reduce load times for my front page). For now, it’s just a
series of images at the same width as the rest of the text; I’ll be looking
into making it more fancy in the future. Specfically, I’d like to have the
images be bigger, but still fit within the viewport.
As for the photos, they’re 3 images I shot at SFU a week or two ago during some
particularly heavy fog. Processing has been minimal as I’m starting to like the
look of CaptureOne’s default processing, and I’m trying to restrict myself from
messing with the colors to the extreme extent I did in the past.
A project I’m working on stores JSON objects in Postgres using its native JSON
datatype. For developing the frontend of the site, running Postgres locally is
unwanted, but some components still require a database to exist. To deal with
this, we’re using SQLite for any local development that doesn’t modify the schema.
The problem caused by this setup is that SQLite doesn’t natively support the
JSON datatype. Yes, it has the json1 extension, but SQLAlchemy’s
types.JSON doesn’t work with it. To solve this, I’ve decided to simply
serialize the JSON and store …
This month’s NSA Puzzle periodical can be found
here. It’s a 2 part puzzle, and I’ve only solved the first one so far, so this will be a 2 part post.
The copyright status of the actual puzzle text is unclear, so this is a paraphrase.
Page 1 of 11
Ava and Bruce are playing a game. They each take a random card from a
standard deck of cards, put their card on their forehead (so the other person
can see it), and then write down a guess for which colour their own card is.
If one of them guesses correctly …