Caffeinate

I’m currently taking a web-based continuing education class, which means that every Monday evening I fire up Google Chrome to watch a Flash-based1 live webinar presentation. During the 90 minutes of class, I do just about nothing with the computer, which means its display would go to sleep if I didn’t do something to prevent it.

For years, the standard Mac utility for keeping your screen (and computer) from falling asleep was Caffeine, a free menubar app from Lighthead Software. But Caffeine hasn’t been updated in years, and I understand its behavior has been questionable under recent OS releases.

The current fave seems to Amphetamine, another free menubar app. Katie and David talked about it on a recent episode of Mac Power Users, and it sounds pretty good. There are plenty of others—just do a search for “caffeine” on the Mac App Store to see a sample.

Some Caffeine replacements on the Mac App Store

But you know me. Why would I use a nice polished program with a GUI when I can run a Terminal command? And even though I own Bartender, I’d still rather keep my menubar apps to a minimum.

So I use the caffeinate command, whose name, I believe, was lifted from Caffeine in what must be Apple’s lamest piece of Sherlocking ever. It’s a sort of limited version of pmset, the older, more powerful, and considerably more complicated power management utility.

Caffeinate has only a few options and the ones I use are -d, which keeps the display from sleeping, and -t which sets a timer to stop caffeinate in case I forget to. The command I used tonight was

caffeinate -dt 6000

which kept the display awake for 100 minutes (6000 seconds), enough for the 90-minute class plus a cushion. You can find other uses in the man page and in this Brett Terpstra post from a few years ago.


  1. Yes, like an animal. ↩︎


Intersection

I’ve been planning my solar eclipse trip for next month, working out where I want to view it and a couple of backup locations if my first choice has bad weather. Because I can drive down to southern Illinois (or Indiana or Kentucky) the morning of the eclipse, I don’t have to worry about getting a hotel—and a good thing, because it’s way too late for that.

I’ve played with a few interactive eclipse maps, and for my money the easiest to use is this one from NASA. It’s based on Google Maps, so you can zoom in and switch between map and aerial views using familiar tools. Clicking a spot on the map brings up a nice popup with all the time and directional information you’re likely to need.

Eclipse info popup

There’s a similar interactive map for the 2024 eclipse, which I hope to see, too. I soon realized that there’s a spot at which the central lines of both eclipses—the lines along which the totality lasts the longest—intersect. Weather permitting, you could park yourself at the same spot to be on the central line for both eclipses. I decided to find that spot.

The proper way to do this, I think, would be to dig into the source code for both pages and figure out a way to get both paths on the same map. I took the easy way out, taking screenshots of both maps and combining them on separate layers in Acorn, giving the top layer some transparency to let the bottom layer show through.

Here’s the map of the general area in southern Illinois.

Two eclipse paths 1

You can see why Carbondale is touting itself as Eclipse Central, but let’s zoom in a little closer.

Two eclipse paths 2

Looks like the intersection is on the shore of Cedar Lake in the Shawnee National Forest, which stretches across a big chunk of southern Illinois. Let’s move in a little closer and switch to an aerial view.

Two eclipse paths 3

And maybe a little closer.

Two eclipse paths 4

So the actual intersection point won’t be very good for viewing unless you’re willing to climb a tree. But sitting in boat offshore would work out nicely.


A simple reminder workflow

I didn’t buy any of the Amazon Echo products during last week’s Prime Day. I have what may be a generational reticence to talking into thin air, especially when other people are around. This isn’t helped by my family’s ridicule when I talk to Siri. “Remind me to check the grill in five minutes”—one of the few commands Siri gets right every time—never fails to get either a laugh or a resigned sigh from my wife and kids.

After a few years of putting up with this, I decided to see if I could work out a way of setting a timed reminder silently that was about as fast as doing it through Siri. The key, unsurprisingly, was a combination of the Workflow app and the Today view.

Here are the steps of the workflow:

Grill reminder workflow

At first, I thought all I’d need was the Add New Reminder action, but I soon learned that its Alert Time field had to be set to an absolute time (“July 16, 2017 at 12:45:32”) rather than a relative time (“five minutes from now”). The first three steps of the workflow do the date math needed to get the absolute time I needed for the last step.

The workflow is saved as a Today widget, which means it will show up in the Today view when I swipe left-to-right on my lock screen. Because I have Raise to Wake turned on, my lock screen appears as soon as I take my phone out of my pocket. After swiping to the Today view, I can access Workflow’s Today widgets with a tap. At the moment, I have only two: the grill-checking reminder and a nearly identical reminder for when my tea is done brewing.

Reminder workflows in Today view

As you can see, I have the Up Next section at the top and the Workflow section just below it. That way, I can see immediately that tapping one of the buttons worked.

I can bring up Siri slightly faster than the Today view by pressing the Home button as I bring the phone out of my pocket. But Siri’s interaction time—especially when she bounces back and forth, thinking about what I’ve said—is nowhere near as fast as the entirely local workflow. Overall, the workflow is faster, and I don’t get laughed at by my kids.

I make no claim of originality for this workflow. Although I haven’t seen any like it, that’s mostly because I haven’t spent much time with Workflow. I’m sure there are plenty of similar Reminder workflows. If you want to use mine as a starting point for your own ideas, you can install it from this link.

Update 07/17/2017 9:57 AM
Bill Mosca pointed out something interesting:

@drdrang Helpful if precision isn’t critical. Reminders fire at start of the minute so “4-minute” timer could be as short as 3:01
  — Bill Mosca (@billmosca) Mon Jul 17 2017 3:55 AM

My first thought was that Bill was wrong because I knew I had gotten reminder alerts at fractional minute marks. But, it turned out, that had been back when I was using Siri to set reminders “in five minutes.” Reminders set by this workflow did indeed fire only at whole minute marks, just as Bill said.

But there’s a way to get around that. In last step of the workflow, tap on the GrillTime variable name to reveal its details.

Set workflow time format

Change the Time Format from Short (which I guess is the default) to Long, as shown in the screenshot above. Then the reminder will include the seconds portion of the alert time and will give you the full duration, not some truncated amount. I’ve updated the link at the end of the post to reflect this change. Thanks, Bill!

I’m surprised at this behavior, as I had assumed that the date/time formats mattered only when you were going to insert it into a text field or string. Setting a reminder date, I thought, would use the underlying date/time numeric value. Live and learn.


Get a grip

Putting anything on the internet is an invitation for unwanted comments. My broken toothbrush post, for example, inspired people to tell me that:

  1. I should change my toothbrush more often. Maybe so, but you can’t draw that conclusion from the fact that it failed in fatigue. Fatigue isn’t synonymous with long usage; it just means the failure occurred through incremental crack growth under cyclic loading. There could be lots of cycles (that’s called high cycle fatigue) or relatively few (that’s called, as you might guess, low cycle fatigue). A small fatigue zone, as in my toothbrush, is usually associated with low cycle fatigue, so there’s no evidence that I’m using my toothbrush too long.
  2. I’m damaging my gums by brushing too hard. This isn’t true, either, but I can’t blame readers for this interpretation. I did a bad job explaining the forces and stresses in that post.

The problem came from this breezy explanation of the forces:

My teeth push out on the brush, and I hold the handle just about where the break is. The toothbrush, therefore, acts like a cantilever beam with high tensile stresses on the brush side of the handle near my hand.

I wanted to get the fracture surface photos, so I shortened up the discussion of forces. Simplifying an explanation is fine, but oversimplifying can be misleading, and that’s what I did. Let’s fix that here.

Here’s me holding my new toothbrush.

Toothbrush grip

Flipping my hand over allows us to see where the main forces are applied.

Toothbrush with hand forces

The biggest forces (represented by the two large black arrows) come from my thumb and index finger. These apply opposing forces that are nearly equal in magnitude—the thumb force is slightly smaller. Because these forces are offset, other forces are needed to keep the toothbrush from rotating in the plane of the photo. These small balancing forces are applied along the rest of my grip, but tend to be concentrated near the end of handle, where it rests against my palm. The short black arrow there represents the small balancing forces.

Even if I’m not brushing my teeth, gripping the toothbrush tightly leads to high tensile stresses across the handle from my index finger. This is where my old toothbrush broke. The force from my teeth onto the brush (the small gray arrow) increases the stress, but that force doesn’t have to be large and doesn’t even have to be present for there to be high stresses. If the failure was my fault, it wasn’t because I brush too hard; it was because I grip the handle too hard. And maybe I could move my thumb back a bit, too.

But I’m not convinced my grip is the main, or sole, cause of the failure. After all, I’ve been brushing my teeth for over five decades, and I’ve never had a toothbrush snap in my hand before. I suspect the design of the handle—in particular, a change in shape near the fracture—is the primary culprit. But I’ll need to strip away the rubbery coating material from my old brush to be able to see that. A post for another day, perhaps.

I often find myself dissatisfied with articles that purport to explain engineering and mechanics because I feel they oversimplify to the point of being wrong. I need to read my own stuff more carefully.