Letting Google Control Your Home

My immediate reaction when I saw this:

was absolute agreement. Why would anyone entrust Google with their home lighting? It’s the perfect hot take.

Then I started thinking about it. Sure, Google had that outage that disrupted everyone using Google’s home automation but how often do those outages happen? As compared, say, to your power company?

Anyone who’s been around here anytime at all knows that I’m not an apologist for Google. Far from it. But whatever else you can say about them, they are really good at engineering reliable systems at scale. Here’s Paul Graham’s reaction to the outage:

The idea of a Google outage seemed so unlikely to him that he embraced a preposterous explanation instead.

So will I be installing Google home automation at the Irreal bunker? No, of course not. Even putting aside my no Google rule (unless it’s YouTube or something else passive that can’t reasonably be replaced) I simply don’t trust Google not to retire the system and brick my devices when they get tired of the product or decide I’m thinking impure thoughts. Still, if you’re not worried about the privacy aspect or the longevity of Google’s commitment, there’s no real reason not to use their system. It’s probably more reliable than the rest of the infrastructure supporting your house.

Posted in General | Tagged | Leave a comment

New SSL Certificate

Some of you may have been inconvenienced this morning by Irreal’s expired SSL certificate. As usual, my provider didn’t give me a heads up about the pending expiration so the first I knew about it was when I tried to answer a comment to my Bit By Bit? post.

Of course, it’s still my fault for not setting a calendar item to remind me. This year the first thing I did after renewing the certificate was to set an agenda item for next year. I know, I know. I should just figure out how/if I can use Let’s Encrypt and be done with this problem once and for all. I must be a slow learner.

Posted in Administrivia | Leave a comment

Bit By Bit?

Speaking of screaming from all sides, here’s a warning for those of you who are open source advocates and VS Code users. Microsoft has released a new LSP server for Python. The server is for VS Code and Microsoft says it has no plans to open source it. Some see this as the first step in making VS Code closed source. It’s probably impossible for Microsoft to close off VS Code completely but it wouldn’t surprise me to have it end up like Android or macOS: the parts that started out open source remain open but the interesting parts that hold everything together and make the product work are closed.

I don’t blame Microsoft. Microsoft is going to do what Microsoft is going to do. What they always do. Still, it’s worth considering whether it’s wise to embrace a putatively open source product under the control of a large corporation with a checkered record on open source.

It is, I suppose—although I don’t really believe it, that VS Code is superior to Emacs but Emacs is under the complete control of its users and developers and no corporation can start to wall it off. All you folks abandoning Emacs for the glitter and cachet of VS Code need to think about the long term consequences of your choice. Say what you will about RMS but he’s adamant about resisting any proprietary additions to Emacs. It’s just another example of him being annoyingly right.

Posted in General | Tagged , | Leave a comment

More Batteries

Karthik Chikmagalur is back with another post in his Batteries Included with Emacs series. This post, More Batteries Included with Emacs, is the second and last of his posts on little known features of vanilla Emacs. His first post in the series lists commands some of which I knew about and use or some useful ones that I didn’t know about.

Many of the commands in his latest post are ones that I didn’t know about and probably wouldn’t want to use. For example, I have no interest at all in controlling Emacs with gestures. Who even knew you could do such a thing? When I’m in Emacs, which is most of the time, I stay away from the mouse entirely. Still, some may find it useful so take a look.

I also have no interest in having a speedbar although I know it’s a popular feature for many. I theoretically like the idea of the regular expression builder but hardly ever use it.

Chikmagalur lists several commands that sort of function like ido and Ivy but I’m a confirmed Ivy/Swapper/Counsel user so these hold no interest for me. If you’re trying to limit the number of packages you have installed, you may find their functionality useful as they do provide some completions—even fuzzy completions—that make invoking commands much easier.

He also reminded me of the extended rectangle commands that are part of the CUA mode. I used to use them all the time but fell out of the habit for some reason. Chikmagalur notes that they don’t play well with undo-tree so perhaps that’s why.

Chikmagalur’s post once again puts the lie to the often heard complaint that Emacs is unusable out-of-the-box. As he shows, there’s a lot of functionality there that even experienced users are not aware of. You should definitely take a look at both posts.

Posted in General | Tagged | Leave a comment

Unlimited Storage for Life

Irreal often posts about the absolute necessity to keep your data under your control. If you commit it to some “Internet service,” sooner or later it will become unavailable. The Stay Sassy blog has a very interesting post on why that is. The post considers unlimited storage and why it’s a Ponzi scheme.

The idea is simple. It costs money to provide that storage and the costs go on forever. Just as with the traditional Ponzi scheme, everything works just fine as long as the service offering the unlimited storage is growing. Stay Sassy says that’s because the services generally make their money when a new user adds their data. As an account ages, there is less new data from that user and therefore less income. As long as there are new users, everything is fine because they pay for the previous users’ storage.

But in the way of Ponzi schemes everywhere, the service eventually runs out of people wanting their service and everything comes tumbling down. At that point, they have to end the “free unlimited storage.”

Stay Sassy says that these services should offer to let users pay for additional storage as a way of keeping things going and, of course, being honest with their users. I know that I always prefer to pay for a service if I can for exactly these reasons. Free services are great but if you want them to stick around you better be willing to pay for them.

Posted in General | Tagged , | Leave a comment

Sorting with Regular Expressions

Tory Anderson has a nice use case for the sort-regexp-fields command. When I first saw his post I thought sort-regexp-fields was another new find for me. But on checking, I discovered that I had used in back in 2011 in an attempted solution to one of Xah Lee’s EmacsGolf challenges. Lee’s post has since disappeared but you can see the problem at the above link. Apparently sort-regexp-fields is one of those commands that I don’t use very often and tend to forget.

That’s too bad because, as Anderson shows, it can be very useful. It’s not even hard to use. You just need to remember that it exists. The basic idea is that you give the command two regular expressions. The first specifies the record—a line or paragraph, say—and the second matches the key in the record. Then the command sorts the records lexigraphically based on the key. That’s all there is to it. Simple but powerful.

Posted in General | Tagged | Leave a comment

Bozhidar Batsov’s Favorite Packages

We all have our favorite Emacs packages. I’ve written about mine a few times (1, 2, 3). A few packages make almost everyone’s list. There’s Magit and Org-mode, of course. Many people say at least one of those is the reason that they use Emacs. Another common favorite is which-key. If you’re not using it, you should be.

Bozhidar Batsov has his own favorites list. He limited himself to five packages but even so his list and mine have significant overlap. He also has an “Honorable Mentions” list that provides even more overlap.

Our biggest disagreement is on the Swiper/Counsel package. Oddly, he likes Ivy but uses Swiper and Counsel so seldom that he’s switched Ivy out for Selectrum, a lighter weight Ivy-like package that doesn’t include the Swiper and Counsel functionality. Outside of Org-mode, the Ivy/Swiper/Counsel package is my most important. I use it hundreds of times a day and my workflow absolutely depends on it.

Of course, that’s the fun of these lists: you get to see what other people think is important and maybe learn about a useful package you weren’t using. In any event, it’s always worthwhile listening to what Batsov thinks is important so take a look at his post if you haven’t already.

Posted in General | Tagged | Leave a comment

Threading Macros in Elisp

As I’ve mentioned in some recent posts, Mike Zamansky is making his annual pilgrimage to the Advent of Code Website to try his hand at the problems. This year—so far, at least—he’s been using Clojure to solve the problems.

I was really impressed by one of the Clojure features that he used in his solutions: the threading macros. I’m not a Clojure user but I can still experiment with the threading macros in Elisp thanks to Magnar Sveen’s excellent Dash library.

There are several threading macros, including some anaphoric forms, but the most useful, I think, are thread first (->) and thread last (->>). The others are a bit more complicated and seem more like party tricks to me.

They are, I think, particularly useful when doing interactive/exploratory programming. It’s easy to build up a calculation a part at a time by adding a new command to the bottom of the list. Still, it’s only slightly easier than adding the new command to the front of the sexpr. Where they really make things easier is in reading the finished code.

To see that, let’s examine a case of the thread first macro. Suppose we are given a list of integers and want to find the 3 largest, ignoring duplicates. One easy way of doing that is the sexpr

(last (delete-duplicates (sort '(3 1 7 5 3 4 2 1 4 7) #'<)) 3)

It’s a little confusing to read this ab initio or even to come back to it after a day or two. You have to read from the inside out and one of the arguments to the first operator in the sexpr (last) is at the end. Here’s the same calculation using ->.

(-> '(3 1 7 5 3 4 2 1 4 7)
    (sort #'<)
    (delete-duplicates)
    (last 3))
(4 5 7)

Notice how much easier it is to see what’s happening. Even if you don’t understand the -> macro, you can easily tell what the invocation does. You should check the docstring for the edge cases but basically what happens is that second argument of -> is used as the first argument of the third argument of ->. The result is used recursively as the second argument of the next invocation of -> and so on.

Here’s the results of a single expansion of ->.

(last
 (->
  (->
   '(3 1 7 5 3 4 2 1 4 7)
   (sort #'<))
  (delete-duplicates))
 3)

and here’s the full expansion.

(last
 (delete-duplicates
  (sort
   '(3 1 7 5 3 4 2 1 4 7)
   #'<))
 3)

As you can see, formatting aside it’s exactly what we started with.

The ->> macro is much the same except that the second argument is put at the end of the following sexpr. Again, see the docstring for the edge cases. Here’s a silly example. We multiply the first four positive integers by 5, add the results, and subtract the sum from 500.

(->> '(1 2 3 4)
     (mapcar (lambda (x) (* x 5)))
     (reduce #'+)
     (- 500))
450

Again, notice how easy it is to follow the action by reading from top to bottom.

As before, here’s the result of a single expansion of ->>

(- 500
   (->>
    (->>
     '(1 2 3 4)
     (mapcar
      (lambda
        (x)
        (* x 5))))
    (reduce #'+)))

and of the full expansion

(- 500
   (reduce #'+
           (mapcar
            #'(lambda
                (x)
                (* x 5))
            '(1 2 3 4))))

Obviously, you can get along just fine without the threading macros and some purists abhor them but I kind of like them. If you write Elisp, give them a try and see what you think.

Posted in General, Programming | Tagged , | Leave a comment

This Is Tech Journalism

Even casual readers know that Irreal holds a generally dim view of journalists. But this isn’t another post about their bias and ignorance of their subject matter. This is a post about silliness masquerading as serious journalism. It’s about writing stories that sound like a bunch of 8th grade boys giggling about a photograph of a woman in a bikini. Well, actually that last is probably unfair to 8th grade boys who are generally more mature and serious than this Gizmodo article.

As you probably know, Apple just announced the AirPods Max, a pricey, over-the-ears set of earphones. A reasonable argument can be made that they’re way too expensive but that’s not what the Gizmodo article was about. Rather, they chose to devote the article to the earphone’s case. The case is soft, which, I suppose, makes them slightly easier to pack and carry around.

The thing is, if you’re one of the sillier of those 8th grade boys the case may remind you of a bra. So if you’re a Gizmodo journalist, what else can you do but write a story entitled “I Thought It Was an Ugly Titty Purse” complete with an even sillier article illustration that looks like it was intended to appeal to those boys.

It’s generally accepted wisdom that the tech press doesn’t like the tech industry but if this represents their level of argument the industry has little to fear. The rest of us can continue cultivating the notion that they have nothing worthwhile to say and that they can be safely ignored with no FOMO.

Posted in General | Tagged , , | Leave a comment

The Social Life of Forests

With a couple of exceptions—like Dawkins’ /The Selfish Gene/—Biology has never held the fascination for me that many other subjects do. Nonetheless, I was drawn to The New York Times Magazine article, The Social Life of Forests. The TL;DR is that the trees in a forest have a way of communicating and even sharing nutrients with each other.

The article starts with the observation that after a forest has been clear cut and replanted, the saplings don’t to as well as expected. After all, they have more space, less competition, and more sunlight so it was surprising then they tended to die more often and generally be less healthy than the trees before the clearcutting. Suzanne Simard, a professor of forest ecology at the University of British Columbia, has a life-long love of forest and trees and set out to discover why this was so. What she discovered was astounding.

The trees in a forest are linked by fibers of fungus in what’s called a mycorrhizal network. These networks pass along chemical danger signals from one tree to the others but even more significantly they help distribute nutrients and carbon among the trees. The flow of these nutrients tend to be towards the trees that need it the most at the moment. It’s typical for the flow to change directions with the seasons as the needs of the trees change.

The article was fascinating for me and probably will be for most other nerds. It really is worth reading if only to discover how strange and counterintuitive the world can be. It’s also an inspiring story of how Simard persevered in the face of rejection of her ideas by the scientific establishment and became recognized as the leading expert in her field.

Posted in General | Tagged | Leave a comment