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 window.addEventListener (“message”, function (event) { /* for security, always check the origin */ if (event.origin === ‘https://www.example.com’) {… 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 →

Flagging “bad” content cannot make social media safer

Social media platforms get in public hot water these days for they way they recommend material to their users. Ysabel Gerrard and Tarleton Gillespie wrote an an article in Wired called When Algorithms Think You Want to Die.  They described how Pinterest and other platforms, by their recommendations, amplify peoples’ exposure to potentially dangerous material. The mechanism is straightforward. When… Read more →

Super simple Javascript Queue class

It’s tempting, when in a hurry, to create a queue object in Javascript with an array. To enqueue something, push() it onto the array. To dequeue it, shift() it off. It works. But it’s slow, because shift() takes O(n) time where n is the length of the queue. Kate Morely cooked up an almost-as-simple but much faster queue implementation. She… Read more →

Grid-interactive power? When?

National Grid, the company selling electricity here in eastern Massachusetts, ran a Smart Energy Solutions pilot program in Worcester from 2015-2018. Serving about 15,000 customers, this program gave discounts when customers used energy off-peak.  Here’s how it worked. As of November 2018, they sold energy at three rates: Off-peak: $0.10697 per kWh On-peak: $0.13100 per kWh Peak-event (brownout conditions): $0.66997… Read more →

Third winter with my electric vehicle

I’ve had the Model S for two and a half years now, and it has about 39,000 miles on the odometer. It’s a 2016 90D with the first-generation sensor set and 19-inch wheels. Here are some thoughts in the car’s third winter. Its factory tires got to the end of their useful live at 38,000 miles, and I replaced them… Read more →

All secrets leak sooner or later. Ozzie’s Clear proposal does not limit damage when they leak.

Ray Ozzie, of Lotus Notes fame and more recently a Microsoft executive, has made a proposal–called Clear–to allow governments to get access to the contents of encrypted phone handsets and other mobile devices. It tasks the device manufacturers with operating a key escrow system and responding to government warrants to give out keys to individual devices. His proposal has been… Read more →