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 [plantuml] @startuml skinparam monochrome true autonumber hide footbox… Read more →

Plant UML

Software designers sometimes need to present UML sequence diagrams like this one. [plantuml] @startuml skinparam monochrome true autonumber hide footbox actor User participant Browser participant Website database Database User->Browser: Select bookmark Browser->Website: Request page Website–>Database: Look up information Database–>Website: Return information Website->Browser: Return page Browser->Website: Request assets note over Browser, Website: Images, CSS, Javascript Website->Browser: Return assets Browser->Browser: Render page… 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 [code lang=”js”] window.addEventListener ("message", function (event) { /* for security, always check the origin */ if (event.origin ===… 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 →