Wednesday, May 18, 2022

Gotcha: Emacs on Mac OS: Too Many Files Open

Generally, the MacPorts version of Emacs works great on my Mac Mini. But every so often, I'd hit a Too many open files error.

The *Messages* buffer was little help as it just repeated what I already knew:

insert-directory: Opening process input file: Too many open files, /dev/null [2 times]

I'd attempt to close buffers or shut down projectile projects, but there was nothing I could reliably do to recover from this error. Ultimately, I had to do the unthinkable and restart emacs.

I tried the obvious fix: telling my Mac to allow processes to open more files. I followed this recipe:

$ sudo cat /Library/LaunchDaemons/limit.maxfiles.plist
<?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
          "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  <plist version="1.0">
    <dict>
      <key>Label</key>
      <string>limit.maxfiles</string>
      <key>ProgramArguments</key>
      <array>
        <string>launchctl</string>
        <string>limit</string>
        <string>maxfiles</string>
        <string>64000</string>
        <string>20480</string>
      </array>
      <key>RunAtLoad</key>
      <true/>
      <key>ServiceIPC</key>
      <false/>
    </dict>
  </plist>

$ sysctl kern.maxfiles
kern.maxfiles: 20480
$ sysctl kern.maxfilesperproc
kern.maxfilesperproc: 64000

It didn't help. Perhaps I was setting the limit incorrectly for my particular version of the OS. Or maybe I was setting the value too high, and the system was reverting it to something smaller. Or maybe all was good at the OS level, and it was a bash ulimit problem.

I considered all of these scenarios, but no matter how I set the file limit or what I set the file limit too, emacs kept hitting a 1024 open files limit. I could easily confirm this with lsof:

$ ps auxww|grep Emacs
ben              15944   0.0  0.7 412688032 111280   ??  S    Mon06AM  71:07.20 /Applications/MacPorts/Emacs.app/Contents/MacOS/Emacs
$ lsof -p 15944 | wc -l
    1618

After much frustration and searching, I finally stumbled on this reddit thread where a fellow emacs user complained about the 1024 max file limit:

Been trying to figure out a way to get out of this trap… I got a new Mac as a work laptop and I can’t seem to update the file descriptors. I updated it for the system but whenever eMacs is opened, ulimit is still at 1024.

Thankfully, there was a helpful reply:

I hit this all the time, as I work on a large monorepo with lsp-mode (and sometimes treemacs, which also watches stuff).

Whenever it happens I run M-x file-notify-rm-all-watches and things go back to normal for a while.

Last time I looked into this, you could not work around it by adjusting ulimits or literally anything. It's a core limitation of a low-level API used internally and is not configurable. I will try to find the previous discussion.

Aha! This made sense, as I've added lsp-mode to my workflow recently.

I was delighted to find I wasn't the only one having this problem, and more importantly, there was an easy work around.

Alas, when I tried to execute M-x file-notify-rm-all-watches I found that my version of emacs didn't have this function.

A quick Google search turned up this source file for filenotify.el. It does have file-notify-rm-all-watches defined as follows:

(defun file-notify-rm-all-watches ()
  "Remove all existing file notification watches from Emacs."
  (interactive)
  (maphash
   (lambda (key _value)
     (file-notify-rm-watch key))
   file-notify-descriptors))

I copied the code, untouched, into my emacs configuration. Next time I got the dreaded Too many open files error, I ran M-x file-notify-rm-all-watches and just like that, emacs was happy again. And so was I.

Wednesday, May 11, 2022

Faith, Patience and Careful Observation - Lessons From A Plant Scavenger Hunt

The Air Force's SERE Handbook, the text designed to teach downed pilots how to survive under the most hostile of conditions, calls out 12 plants with useful medicinal properties. I took that list as a challenge to seek out these plants. Here's what I've learned along the way.

Common Plantain. Holy smokes is this plant common. It's everywhere in the DC area. The lesson: if there's one medicinal plant worth mastering in this area, it's plantain.

Dandelion. Dandelion's are a lesson in patience. Here's a common plant that's super easy to identify. And yet, for most of the year, they're invisible. As prolific as all these plants are, finding them always comes down to being in the right place, at the right time.

Dog Rose. Dog roses are what this project is all about. If you had told me that wild roses grew along a running and walking route I frequented, I'd tell you that you were crazy. And yet, that's exactly where I found them. I also learned about the multiflora rose, which is so common it's considered an invasive species. I now see them all the time. While multiflora rose isn't considered the ideal rose to harvest, it's still an excellent source of vitamin C and other nutrients.

Wild Garlic. Wild garlic serves as a reminder that plant naming and identification can get fuzzy. Wild onion and garlic are related and look so alike when growing in your yard that they are often grouped together. It doesn't help that a synonym for wild onion is 'cow garlic'. This article bypasses the differences and offers this advice:

If a plant looks like an onion and smells like an onion you can eat it. If a plant looks like a garlic and smells like a garlic you can eat it. If you do not smell a garlic or an onion odor but you have the right look beware you might have a similar-looking toxic plant.

Wild Onions. See wild garlic. Grown up wild onion (or is it wild garlic?) is crazy looking. It has a Dr Suessian looking nodule that develops into flowers; what I believe is called an 'umbel.' The first time I came across wild onion that had this nodule, it was outside of a gas station along Washington Boulevard. I found myself snapping pics like I'd found some rare species. It was awesome.

Mullein. Years ago I discovered mullein, so I knew it was in the area. However, I had to be patient before I could log a specimen. If you're not familiar with mullein, you're in for a treat. This is a fascinating looking and feeling plant, and you're going to be amazed at how common it is.

White Willow. It took longer than I'd like to admit to remember the collection of massive willow trees growing along the Potomac river, not far from our house. The lesson: sometimes a plant can be so obvious, it's hidden.

Sweet Gum. Finding a sweet gum tree in the area was going to be like finding a needle in a haystack. Luckily, I had a magic needle finder. Aka, the Internet. Turns out, Arlington, VA publishes a list of notable trees. Sure enough, two of them were gum trees. I added the address of one of them to a running route, and in no time, I found myself face to face with a splendid looking gum tree. Once I knew what the distinctive star like leaves looked like, I had no problem identifying another gum tree just a few blocks way. The lesson: be creative.

Yarrow. I looked high and low for yarrow, keeping an eye out on every hike I went on. I finally found it two streets over in a neighbor's yard, and in a landscaping feature at a local park. The lesson: the plant detection game doesn't stop just because you're traipsing through suburbia.

Jewelweed. Jewelweed is a lesson in hope and faith. I so wanted to find this plant, yet in hike after hike it eluded me. That is, until one day when I was running and took a random trail into the woods. It led down to the Potomac river where I found a massive stand of Jewelweed. It was gorgeous. The lesson: these plants are out there, so don't give up.

Aloe Vera. Aloe Vera doesn't grow locally, so the lesson here was about taking this little project on the road. I came across a brilliant example of Aloe Vera while hiking in Florida.

I've have two plants left on my list: balsam and peppers. Baslam, like Aloe Vera, doesn't grow locally, so I may have to catch it while out of town. Alternatively, they are frequently used for Christmas trees, so maybe I'll get lucky and find an example during the Christmas season.

The last plant on the list is peppers. With a little reflection, I realize I've left them for last because I've got no expectation of finding them. This is based on some flimsy reasoning: peppers are very distinctive, and I've never seen one growing in the wild. Why should I find one now?

With just a few minutes of research, I can see that my logic is faulty. Wild peppers are absolutely a thing, and most importantly they grow in my climate. I need to change my mindset: wild peppers do exist and I shall find one!

In short, This little exercise has taught me the same lessons over and over: have faith, be patient and stay sharp; what you're looking for is out there.

Thursday, May 05, 2022

The Set to Watch from Ultra Miami Musical Festival

After a two year hiatus, the Ultra Musical Festival returned to Miami. For a few weeks after the event, YouTube was popping with musicians publishing their sets.

I know what you're thinking: Ben, I'd like to get a flavor for this year's festival, but I'm not sure which set I should watch? Not to fear, I've got you covered.

If you listent to a single set from this year's festival, make it Fisher's.

Mind you, I don't know who 'Fisher' is, and much of the music he played isn't my preferred style. But that's the sort of the point. Here's an unknown (to me) DJ playing new (to me) tunes, yet he ended up taking me on a delightful musical journey.

All I could think when he finished his set was, how the heck did he just do that?

Here, give his set a listen and see hear what I mean:

Banging, right?

Wednesday, May 04, 2022

Special Delivery: From A Random Linux Box to My Wrist

I've got a phpunit test suite on a Linux server that now takes a few minutes to run. When it's done, I'd like to get a message on my watch telling me whether it completed successfully or not. This let's me kick off the tests and go on to my next task (probably: eating) and will give me just the nudge I need to either return to work on the tests or keep going with the new task.

Here's the recipe I used to accomplish this feat. The goal here is to keep the script that runs on the Linux server nice and simple so that I can move it around to other locations as I decide to spread around this behavior.

The Linux Script

On the Linux side, I've got a simple script that I can invoke like so:

$ phpunit --stop-on-failure tests/ ; andnotify "Test are done! Status: $?"

The magic variable $? will be zero if tests completed without error, or a non-zero value if there was a problem.

The andnotify script is little more than a wrapper around curl which makes a request to Tasker's AutoRemote:

#!/bin/bash

##
## Send data to an android device using Tasker's Auto Remote
##
base='https://autoremotejoaomgcd.appspot.com/sendmessage'
key='<Your AutoRemote Key>'


if [ $# -eq 0 ] ; then
  echo "Usage: `basename $0` message"
  exit 1
fi

echo "Notify=:=$@" > $HOME/.andnotify
curl -s $base -d "key=$key" --data-urlencode "message@$HOME/.andnotify"  > /dev/null

The Tasker Code

andnotify sends a message to the AutoRemote API endpoint, which can be received by a Tasker Profile. The magic happens when you create a profile under: Event » Plugin » AutoRemote.


This profile will receive the text sent via curl above. I'm using the variable %arcomm, which will grab all the text after =:= in the AutoRemote message.

Once the text is received, it's handed to a trivial Tasker Task, which contains a single Notify Action in the body of the task.

The Notify Action causes the message to appear as an Android Notification.

To The Watch

Finally, I've set my Garmin VivoActive 4 up to pass AutoRemote notifications to my watch.

The ensures that notification that are posted to my device, show up on my watch.

Tuesday, May 03, 2022

Boat Tree

It's simple. Trees need dirt.
Wrong. Said the tree on a boat.
What else says I'm wrong?

Monday, May 02, 2022

Bat Mitzvah Awesomeness!

I'm trying to imagine what it would be like if I could have turned to Jared in college, 25 years ago, and said:

I've got good news, and I've got bad news. The bad news is that due to a deadly pandemic, we're going to have to attend your Son's Bar Mitzvah virtually. The good news is, your Daughter's Bat Mitzvah was off the hook!

This past weekend we attended Maya's Bat Mizvah, and it was an all around pleasure. We relished seeing her parents, and she did a fantastic job with both her Torah and Haftarah portion. We even got in an 8 mile stroll along the Ballenger Creek Trail. The party in the evening was excellent, with food and desserts that were top notch.

I'm telling you, this new trend of getting together in person to celebrate events may have staying power. It's pretty awesome.

To many more simchas together!

Tuesday, April 26, 2022

George's Beacon of Blue and White

Here some pics I snapped of the Masonic Memorial in Alexandria, VA last night:

Back in February, the site was lit up with the colors of the Ukrainian flag. I'm not sure if that's still the intention.

Regardless, it was a beautiful and peaceful night to take in the memorial. The inscription which appears below the bust of George Washington, seems to be paraphrased from a 1786 letter from George Washington to James Madison. The content of the inscription is as accurate today as it was 236 years ago:

Let prejudices, unreasonable jealousies, and local interest yield to reason and liberality. Let us look to our National character, and to things beyond the present period. No morn ever dawned more favourable than ours did—and no day was ever more clouded than the present! Wisdom, & good examples are necessary at this time to rescue the political machine from the impending storm.

As I left the memorial, I was psyched to see a DC Boundary Stone nearby:

I thought there might be a connection between the Masonic site and the location of the boundary marker. But, alas, boundary marker is both not in the original location, nor is it the original stone. Still, coming across a DC boundary marker is a always a treat.

Here's to wisdom & good example carrying the day!

Wednesday, April 20, 2022

That Time American Jews Thought Wine Was Chametz

While researching seder topics I came across this description of the Passover Seder published in an 1868 edition of the Shasta Courier:

Much of the text describes the evening as we celebrate it today. Perhaps this should be unsurprising, as we have texts that are nearly 2000 years old that describe familiar practices. What caught my eye, however, was at least one notable deviation from a modern seder.

Wine, also, to the quantity of four or five cups, was drunk by each person. It has been a disputed question whether the wine used at this feast was ordinary or fermented wine, or was the pure, fresh juice of the grape. Those who hold that it was unfermented wine, appeal mainly to the expression “unfermented things,” which Hebraists assert to be the true rendering of the Hebrew word which is translated “unleavened bread.” The rabbins [sic] interpreted the command as extending to the use of unfermented wine as well as unfermented bread ; and, accordingly, the modern Jews generally use raisin wine at the feast of the Passover.

The 'four or five cups' comment seemed odd at first, as we clearly drink four cups of wine at the seder. However the question of whether there should be a fifth cup goes back to a Talmudic debate:

Back in the second century, when the sages were establishing the rituals of the seder, a disagreement arose as to whether there should be four or five cups of wine.

The custom of drinking multiple cups of wine derived from God's promises to the enslaved Israelites. Four promises follow one another in rapid succession within Exodus chapter six, verses six and seven: " I will free you...", "I will deliver you...", "I will redeem you...", "and I will take you to be My people." Then, after an intervening verse, a fifth promise appears: "I will bring you into the land...." Each cup of wine is a symbol of the joy we feel as beneficiaries of God's promises. But is the fifth promise connected to the prior four, or is it a separate promise? On this the rabbis could not agree. Some said there should be four cups in honor of four promises; others said five cups for five promises.

The Talmud uses the Aramaic word teku to indicate that the rabbis could not reach a decision on a matter under discussion. And so the decision as to the number of cups was left teku, but the Passover haggadah prescribes four cups for us to drink-possibly as a parallel to the four questions and the four sons. But just in case there really should be five, the writers of the haggadah called for an additional symbolic cup.

Ultimately we 'solved' this four or five cups question by drinking four and putting out a fifth.

What's more puzzling is the assertion that unfermented wine somehow matches up to unleavened bread. Any modern seder attendee can tell you that plenty of alchol is consumed at seder, without any fear that it's somehow related to forbidden chametz.

So what's going on here?

For a stretch of history history, American Jews embraced non-alcoholic wine at seder. Their beverage of choice was raisin wine. Consider this recipe published in 1914. The author seems confident claiming that "Passover wine" is made from raisins, a claim that would be laughable today.

A reader asks how the Passover wine is made.

I found this recipe in my file:

Raisin or Passover Wine
Three pounds raisins, seeded and chopped. Place in a jug with one pound sugar and from six to seven quarts cold water. Set' the vessel, covered, on the stove hearth. Skim after four days, filter through a funnel lined with linen and pour into bottles. Add to each bottle stick cinnamon, cloves and lemon peel. Cork tightly and put away for two weeks.

This tradition, like most, almost certainly has practical roots. On the American frontier, finding Kosher wine would have been difficult to impossible. So having an easy, Kosher way to make a substitue would be handy. And the Jews that popularized this practice may very well have come from Muslim countries where alcohol was to be avoided.

Incidentally, this isn't the only case of Jews tweaking their Passover drinking habits due to circumstance. In 17th century Europe, Jews were encouraged to switch from red to white wine to avoid the accusation that they were using the blood of Christian children as an ingredient in their wine.

For Americans, what started as a necessity somehow drifted into a misunderstood religious requirement. Equally surprising is that this once common practice seems to have slipped into obscurity so quickly. I've mentioned the practice to a number of individuals and nobody has ever heard of it.

This blip in Jewish tradition was not without side effects. This article explains the unexpected intersection of raisin wine and the American Temperance Movement.

Whatever its origins, the Jewish preference for raisin-wine was to become a pivotal issue in the American public life of the era.

The latter half of the nineteenth century saw the rise of the Temperance Movement, which fought stubbornly for the limitation, or total prohibition, of intoxicating drinks. Although they were responding to a very real social problem in American society, the leaders of the Temperance agitation were drawn largely from the ranks of Evangelical Christians and were impelled by religious motivations. It was therefore a source of embarrassment to these Bible-thumpers that wine is mentioned so frequently in the Bible as the most common of beverages, to which no serious stigma or censure was attached. Even more painful to the Temperance cause was the story of the Last Supper where Jesus himself partook of wine and shared it with his disciples. According to the widespread view, the Last Supper had been a Passover Seder.

Another commonly held view among Christians naively regarded contemporary Jews as faithful preservers of a fossilized tradition that had remained unchanged since Jesus' days. If it could be demonstrated that their Jewish neighbours drank non-alcoholic juice on Passover, then this could be considered conclusive evidence that the Bible itself was referring to the same beverage, and not to fermented wine.

The upshot of all this was that the American Christian world in the mid-nineteenth century developed a disproportionate interest in the Passover drinking preferences of their Jewish compatriots, especially at the Seder, and Christian tracts would contain frequent interviews with Jews--though not necessarily the most learned or observant of them. Even when the Jewish informants took care to distinguish between their personal practices and the customs of Biblical Israel, the Temperance advocates had no qualms about quoting them selectively and out of context in order to prove their case.

This 'raisin wine' incident shows both the advantages and risks of the decentralized nature of Judaism. The very flexibility that allowed frontier Americans to keep Kosher over Passover, also let them introduce a flawed principle into their lives. But the story doesn't end there. Somehow, the practice also corrected itself, and we no longer treat fermented wine as chametz. Messy? Sure. But it's hard to argue with an approach which has worked for the last 2000 years.

Here's a modern recipe for raisin wine. I'm eager to give this a try next year!

Tuesday, April 19, 2022

L'Chaim! Fore!


G joined the Men for a pre-seder L'chaim. My brother, Dad and I sipped Patron Silver Tequila, which is notably marked Kosher for Passover, while G enjoyed מיץ אשכוליות (grapefruit juice). Apparently my Mom and G are working on a new tradition: a round of golf pre-seder.

Here's to enjoying old traditions and starting new ones!

Tuesday, April 12, 2022

Web SDR: Free Access to the Diverse (and a bit crazy) World of Radio

Software Defined Radio, or SDR, is tremendously cool. For $30 bucks you can purchase a USB dongle which lets your phone or computer pick up a massive range of radio signals. You can use this for everything from listening to FM radio to collecting local utility meter data.

I recently discovered a variation on SDR: Web SDR. Web SDR is what it sounds like: folks take their SDR setups and make them available for use on the web. Using nothing but a web browser, you can tune into radio stations all over the world.

My hope was to show some practical use for this. Like say, getting first hand accounts of the invasion of Ukraine by listening to Polish or Russian SDRs. Or, closer to home, I was thinking I could use a Washington DC based SDR to listen to CB radio chatter among protesters involved in the 'People's Convoy' that circled DC's Beltway.

Not surprisingly, I didn't (and still don't) have the knowledge or patience to extract any brilliant audio from any of the SDRs hosted at websdr.org.

When I slowed down and focused on just local SDRs (one here, the other here) I did start to get a picture of what kind of chatter is available over the air.

Even just casual listening let me appreciate that I could pick up everything from far off radio stations to local Ham Radio operators kibbitzing with each other. I found channels publishing Morse code,  the weather or just announcing the time. I heard truckers chatting on the Beltway, preppers discussing immanent food collapse, and preachers talking about the Israelite's.

I'd say that the radio spectrum appears to mimic the Internet in its diversity of topics, characters and content, but that's almost certainly backwards. The hodgepodge of content that is available on the radio almost certainly existed far before there was an Internet. Before URLs there were radio frequencies and before email addresses there were call signs.

To ground these musings into something concrete, I give you the following 173 second of video. Using the local DC Web SDRs linked above, I captured a slew of audio clips. I edited them down and mashed them together to form this video. Think of it as a tiny sampler what you can find on a Web SDR.

I still have hopes of using local or distant SDRs for something practical. For now, however, I'm satisfied with just having a unique appreciation for what's being streamed into the ether.

Sunday, April 03, 2022

Twins Bnai Mitzvah: Partying and Kvelling

[Composed 5/27/2022]

What a whirlind the last 48 hours have been! We kicked off D & C's B'nai mitzvah weekend with a Friday night dinner for those of us who came in from out of town. The Kosher Chineese food was delish, and seeing family and friends was such a treat.

D knocked it out of the park on Saturday where he read the entire Torah portion and the Haftarah as well. He's a little Torah reading machine! Even the Rabbi was impressed with his leining, saying that no student he had ever had read so much Torah, so well.

And finally, today we all thoroughly enjoyed a party worthy of the simcha! We danced, listened to speeches, ate way too much chocolate and goof'ed it up in the photo-booth. Before we knew it, the DJ was winding things down and we found ourselves helping to clean up.

C gave a speech at the party, and while this was outside of her comfort zone, she stepped up to the occasion and did a wonderful job. We's so proud of both the kids.

Editor's note: The photo below of J eating Thai food is from a side-meal Shira, J and J's Mom took. J ordered frog's legs for dinner, a first for him. J has to be first person to ever read Parsha Shemini and think, hmmm that gives me an idea of what to eat for dinner. So proud of him for trying something new.