Author: Ollie

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 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 →

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 →

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 →