I was chatting with a co-worker today, and she said she’d heard “they” were thinking about calling Pluto a “planet” again after it was demoted in 2006. Is Pluto a planet, or a dwarf planet, or a planetoid comet, or a cometoid planet, or what? It’s a wonderful debate. It’s a debate about how to fit a stranger into our… Read more →
Year: 2019
From browser Javascript, how to tell if an image won’t load
Sometimes it’s necessary in Javascript in a browser to find out whether an image object loads correctly. You might do this to check whether a server is responding, or whether it’s blocked by a firewall. In plain HTML you would load the image like this <img src=”/maybe.png” /> then look for the browser’s broken-image indicator visually. You can do this… Read more →
Computing the mode with SQL
The mode of a bunch of numbers is the most frequent number in the bunch. A bunch of numbers can have more than one most-frequent number. Given a table tbl with columns category and value, this SQL returns the mode for each category. WITH freq AS ( SELECT COUNT(*) freq, value, category FROM tbl GROUP BY value, category ),… Read more →
Stop overmeasuring customer service agents already!
These days it seems like I can’t call any business at all to ask a question without getting a survey afterward. I called an insurance company to ask “hey can you look up my policy number?” The agent on the phone did so efficiently and securely. I said “thanks” and I thought we were done. But no. Later I got… Read more →
Stop tax cheats: pay bounties
Back in the 1970s, the US government paid bounties to citizens who identified big polluters and helped bring them to justice. Some of those bounties helped found the Riverkeeper organization that keeps watch on the Hudson River to this day. Those bounties helped make water and air much cleaner. In the twenty-teens we have another situation where government needs help:… Read more →
Stripe Elements data sequence diagram
Stripe.com’s Stripe Elements is a great way to handle payment card information in a way that slows down cybercreeps. It’s secure because customers only enter card numbers into Stripe-furnished iframes, never into forms on the site taking payments via Stripe. Here is the sequence diagram for how Stripe Elements handles data flow Read more →
Plant UML
Software designers sometimes need to present UML sequence diagrams like this one. This kind of thing is absurdly fiddly to draw with most graphics packages. But there’s a language called PlantUML that allows us to write them as text and render them in various software tools, including WordPress with the plugin called PlantUML Renderer. The text for this example is… Read more →
Which iframe posted a message to my window?
What do you do if you have a bunch of different iframes in your web page posting messages? How do you know which iframe a message came from? Even if the iframe document comes from a different origin? This does the trick Read more →
Jupyter on Raspberry pi
Jupyter is an excellent free open source package for literate programming, especially in Python. It’s nice because it keeps a good record of what you try in experimental programming. And it’s easy to tidy up your work when you figure out what you’ve done, and store or publish it. It’s also sweet because it’s a web app. You can program… Read more →
Avoiding Amazon
It’s hard to avoid the Amazon behemoth even if you prefer to send your business to other companies. And, there’s not a whole lot an individual householder can do to spread the wealth around because, not much wealth. But here are a few things you can do. Most importantly: try to think of yourself as a householder or citizen, not… Read more →