Simon Willison’s Weblog

Subscribe

February 2018

46 posts: 24 links, 7 quotes, 15 beats

Feb. 1, 2018

Observable notebook: San Francisco trees from Datasette. I used an Observable notebook to rebuild my San Francisco tree search demo against a Datasette API of a CSV of trees published by the SF Department of Public Works. The map updates live as you type a query, and every cell can be toggled to view the underlying source code.

# 12:37 am / datasette, observable

What we need to do is come up with a way to help people understand that there are ways to never be lost again, and to listen to any music you want, and to video chat with someone on the other side of the world, without them having to feel disquieted about it. That it's not OK that you're made to feel weirded out. That it's possible for there to be alternatives. That having to feel someone rooting around in your life is not a price you should have to pay.

Stuart Langridge

# 2:03 pm / privacy, stuart-langridge

Building a Full-Text Search App Using Docker and Elasticsearch. Deep, comprehensive tutorial from Patrick Triest showing how to use docker-compose to run three containers (Node API, nginx static content, elasticsearch) and then use that to build a neat Vue.js web search UI against 100 books from Project Gutenberg.

# 3:41 pm / elasticsearch, nodejs, docker

How the Citus distributed database rebalances your data. Citus is a fascinating implementation of database sharding built on top of PostgreSQL primitives. PostgreSQL 10 introduced extremely flexible logical replication—in this post Craig Kerstiens explains how Citus use this new ability to re-balance shards (e.g. when you move from two to four physical PostgreSQL nodes) without downtime.

# 10:50 pm / postgresql, sharding, software-architecture, zero-downtime, craig-kerstiens

Feb. 2, 2018

Using setup.py in Your (Django) Project. Includes this neat trick: if you list manage.py in the setup(scripts=) argument you can call it from e.g. cron using the full path to manage.py within your virtual environment and it will execute in the correct context without needing to explicitly activate the environment first.

# 12:33 pm / django, python

Family fun with deepfakes. Or how I got my wife onto the Tonight Show. deepfakes is dystopian nightmare technology: take a few thousand photos of two different people with similar shaped faces and you can produce an extremely realistic video where you swap one person’s face for the other. Unsurprisingly it’s being used for porn. This is a pleasantly SFW explanation of how it works, complete with a demo where Sven Charleer swaps his wife Elke for Anne Hathaway on the Tonight Show.

# 4:06 pm / computer-vision

Channels 2.0. Andrew just shipped Channels 2.0—a major rewrite and redesign of the Channels project he started back in 2014. Channels brings async to Django, providing a logical, standardized way of supporting things like WebSockets and asynchronous execution on top of a Django application. Previously it required you to run a separate Twisted server and redis/RabbitMQ queue, but thanks to Python 3 async everything can now be deployed as a single process. And the new ASGI spec means its turtles all the way down! Everything from URL routing to view functions to middleware can be composed together using the same ASGI interface.

# 6:19 pm / andrew-godwin, async, django, python, python3, websockets

asgiref: AsyncToSync and SyncToAsync (via) Andrew’s classes in asgiref that can turn a synchronous callable into an awaitable (that runs in a thread pool) or an awaitable callable into a synchronous callable, using Python 3 futures and asyncio.

# 7:06 pm / andrew-godwin, async, python3

Feb. 3, 2018

Just switched to {window.localStorage.getItem('debug') && <pre>{JSON.stringify(this.state, null, 2)}</pre>} - now I can ship to production and turn on debugging in my console with localStorage.setItem('debug', 1)

@simonw

# 5:23 am / debugging, react

How I made a Who’s On First subset database. Inspired by Paul Ford on Twitter, I tried out a new trick with SQLite: connect to a database containing JSON, attach a brand new empty database file using “attach database”, then populate it using INSERT INTO ... SELECT plus the json_extract() function to extract out a subset of the JSON properties into a new table in the new database.

# 5:25 am / json, paul-ford, sqlite, whosonfirst

Imagine a Simon Says style game where I present an article found on the web on a projector. Students research for two to three minutes, then respond by standing or staying seated to signal if they believe the article is true or fake. My students absolutely loved the game. Some refused to go to recess until I gave them another chance to figure out the next article I had queued.

Scott Bedley

# 1:29 pm / teaching

Conditional aggregation in Django 2.0 (via) I hadn’t realised how clever this new Django ORM feature by Tom Forbes is. It lets you build an aggregation against a subset of rows, e.g. Client.objects.aggregate(regular=Count(’pk’, filter=Q(account_type=Client.REGULAR)))—then if you are using PostgreSQL it translates it into a fast FILTER WHERE clause, while other databases emulate the same behaviour using a CASE statement.

# 9:38 pm / django, postgresql

Feb. 4, 2018

Owls Near Me. Back in 2010 Natalie and I shipped owlsnearyou.com—a website for finding your nearest owls, using data from the sadly deceased WildlifeNearYou (RIP). To celebrate #SuperbOwl Sunday we rebuilt the same concept on top of the excellent iNaturalist API. Search for a place to see which owls have been spotted there, or click the magic button to geolocate your device and see which owls have been spotted in your nearby area!

# 10:26 pm / natalie-downe, projects, wildlifenearyou, inaturalist

owlsnearme source code on GitHub. Here’s the source code for our new owlsnearme.com project. It’s a single-page React application that pulls all of its data from the iNaturalist API. We built it this weekend with the SuperbOwl kick-off as a hard deadline so it’s not the most beautiful React code, but it’s a nice demonstration of how React (and create-react-app in particular) can be used for rapid development.

# 10:33 pm / github, javascript, natalie-downe, projects, react, inaturalist

Feb. 7, 2018

Googlebot’s Javascript random() function is deterministic. random() as executed by Googlebot returns the same predicable sequence. More interestingly, Googlebot runs a much faster timer for setTimeout and setInterval—as Tom Anthony points out, “Why actually wait 5 seconds when you are a bot?”

# 2:41 am / crawling, google, seo

The whole story is basically that Facebook gets so much traffic that they started convincing publishers to post things on Facebook. For a long time, that was fine. People posted things on Facebook, then you would click those links and go to their websites. But then, gradually, Facebook started exerting more and more control of what was being seen, to the point that they, not our website, essentially became the main publishers of everyone’s content. Today, there’s no reason to go to a comedy website that has a video if that video is just right on Facebook. And that would be fine if Facebook compensated those companies for the ad revenue that was generated from those videos, but because Facebook does not pay publishers, there quickly became no money in making high-quality content for the internet.

Matt Klinman

# 3:51 pm / facebook

Feb. 8, 2018

Sighting 4:15 PM – 4:15 PM — Turkey Vulture, Brown Pelican
Turkey Vulture
Turkey Vulture
Brown Pelican
Brown Pelican

Feb. 9, 2018

Sighting 12:46 PM — Reddish Egret
Reddish Egret
Reddish Egret

Feb. 10, 2018

Sighting 5:04 PM — Gilded Flicker
Gilded Flicker
Gilded Flicker
Sighting 11:07 AM – 2:37 PM — Grey Whale, Magnificent Frigatebird, Coyote, Osprey
Magnificent Frigatebird
Magnificent Frigatebird
Grey Whale
Grey Whale
Grey Whale
Grey Whale
Coyote
Coyote
Coyote
Coyote
Osprey
Osprey

Feb. 11, 2018

Sighting 9:07 AM – 9:57 AM — Great Blue Heron, Grey Whale, Double-crested Cormorant
Grey Whale
Grey Whale
Great Blue Heron
Great Blue Heron
Great Blue Heron
Great Blue Heron
Double-crested Cormorant
Double-crested Cormorant

Feb. 12, 2018

Sighting 5:22 PM — Yellow-footed Gull
Yellow-footed Gull
Yellow-footed Gull

Feb. 13, 2018

Sighting 6:03 PM — Odora
Odora
Odora
Sighting 11:52 AM — Common Bottlenose Dolphin
Common Bottlenose Dolphin
Common Bottlenose Dolphin

Feb. 15, 2018

Sighting 10:42 AM – 10:56 AM — Blue Whale, Mexican Giant Cactus
Blue Whale
Blue Whale
Blue Whale
Blue Whale
Mexican Giant Cactus
Mexican Giant Cactus

Feb. 16, 2018

Sighting 5:57 PM — Hooded Oriole
Hooded Oriole
Hooded Oriole

2018 » February

MTWTFSS
   1234
567891011
12131415161718
19202122232425
262728