I do not pretend to understand the moral universe; the arc is a long one, my eye reaches but little ways; I cannot calculate the curve and complete the figure by the experience of sight; I can divine it by conscience. And from what I see I am sure it bends towards justice.
Upon first access, python compiles .py code into bytecode and stores it in .pyc files. Subsequent uses of those python sources are read from the .pyc files without needing to re-compile. This make startup time, but not runtime, faster.
But what about read-only filesystems? If python is running on a read-only filesystem no .pyc files are written and every use of a .py file involves compiling the code afresh. Everything works, the startup time of a script is just a little slower.
Read-only filesystems within a container are a security best practice in production environments. Often in kubernetes deployment manifests you might see something like:
And if you’re running python only once within the container, the container has a little bit of overhead at startup as it compiles into bytecode and then everything is in memory and off it goes. But if you’re running python multiple times, or want to make even the single run start faster, we can pre-compile the code when we build the container with the built-in python compileall library.
# Compile code on sys.path (includes system packages and CWD):
RUN python -c "import compileall; compileall.compile_path(maxlevels=10)"
# Compile code in a directory:
RUN python -m compileall /path/to/code
This moves the compilation overhead to the container build where it happens once, and out of the startup.
We’ve had our Sonos system, connected via wifi, for 5+ years and it’s been rock solid until late January. Suddenly, through no changes to our wifi (router, router firmware, or connected devices) or Sonos system, it started being completely unreliable. This seems to have coincided with the S2 v14 release on 2022-01-25 but that could have been coincidence.
Examples of problems:
- Speakers would disappear from the controllers (macOS & Android apps).
- Speakers would stop playing but show as playing in the controllers.
- Speakers would be playing but show as stopped playing in the controllers.
- Speakers would not respond to play/stop input from the controllers.
- Different controllers would show different speakers available.
I did the usual things of restarting the wireless router & restarting the speakers. At the recommendation of Sonos support I changed the wireless channel on my router. All of these worked for 30 or so minutes and then things went sideways again.
Finally, fed up with it all, we plugged a speaker directly into the router instead of having it connect over the wireless thus forming its own separate wireless network. Everything has worked perfectly since then.
This isn’t exactly convenient given where the wireless router is, but our Sonos system is once again functional instead of being a collection of 6 very expensive paperweights.
Recently I upgraded the wiki at Distributed Proofreaders to the MediaWiki 1.35 LTS release. This comes with the fancy new VisualEditor which should be great for our users who already deal with phpBB markup in the forums and our own custom markup for project formatting.
Setting up the VisualEditor was a bit of a head-scratcher in a couple of ways and hopefully this helps others who encounter similar problems.
Error contacting the Parsoid/RESTBase server (HTTP 404)
This one frustrated me for quite some time. Everything pointed to setting
in our Apache config, but that wasn’t working for me. For reasons I don’t understand, I needed to include this in both the :80 and :443 VirtualHost sections, not just the :443 which was serving all traffic.
Error contacting the Parsoid/RESTBase server (HTTP 500)
This was thankfully pretty obvious by looking in the php_errors log. As the VisualEditor Troubleshooting section calls out, our $wgTmpDirectory had the wrong write permissions.
Enabling for Namespaces
The documentation says that to change the namespaces that the VisualEditor will be used on, you use the English canonical names. To get this to work, we needed to use the namespace constants instead. Note that the MW code will include all content namespaces as enabled by default so you only need to include those if you want to disable them.
$wgVisualEditorAvailableNamespaces = [
// includes Content namespaces by default (Main)
NS_PROJECT => true,
NS_PROJECT_TALK => true,
NS_TALK => true,
NS_USER_TALK => true,
It’s tax season here in the US and yesterday I plugged in our HP OfficeJet J4500 to scan in some documents that were mailed to us. I don’t use it much but imagine my consternation when I received a malware message “HPScanner.app will damage your computer” from macOS Big Sur and the scanner refusing to work.
I spent a good 30 minutes Googling, uninstalling drivers, reinstalling drivers, with zero success. I went to rant to my husband and surprisingly his Big Sur laptop was working just fine! And while usually I’m the stubborn technologist in the relationship, he was the one who solved this one.
The solution is to download and install the HP 5.1.1 Printer Software Update from Apple, uninstall the printer, and reinstall it.
Why is that so incredibly hard to figure out? Because HP’s website is an incompetent mess. The usual problem resolution path of going to HP’s Driver Download website fails because they don’t have macOS 11 drivers for the OfficeJet J4500. If you click through far enough you’ll arrive on their My operating system is not listed on HP Software and Driver Downloads page which routes you to the Apple website linked above. So there is a driver for the printer it’s just difficult to find. You might need to download and run the “HP Uninstaller” first. I had already done this in my troubleshooting attempt so it’s unclear if this is a prerequisite or not.
Other things that I discovered during my attempt to fix this:
- Downloading the HP Easy Scan software from the App Store. This doesn’t include the OS-level driver and without it the app can’t communicate with the scanner.
- Using the Generic PCL driver. While the printer will happily print with the Generic PCL driver (courtesy of Gutenprint) it doesn’t include the drivers for scanning.
- The reason this likely worked for my husband and not me is that he updated his printer drivers while still on Catalina after HP screwed the pooch and mistakingly revoked certificates for their printer drivers in Oct 2020. I very very seldom print or scan so it’s not surprising that my system was out of date.
poetry, the python package manager, provides several ways of authenticating against a repository. What isn’t explicitly documented, because it’s an implicit dependency, is that poetry can also use the ~/.netrc file for authentication when fetching packages.
There are several (probably bad) reasons why someone would want to do this vs one of the explicit methods given by poetry. One that comes to mind is needing to install python packages from a private repository from inside a docker container by simply volume mapping the host’s ~/.netrc file to have poetry use the right creds.
This approach probably won’t work when publishing packages — caveat emptor.
While I’m not suggesting that this is a best practice, it’s good to know that it’s an available method in some extreme edge cases.
It’s taken me several months to connect the dots, but I’ve finally figured out why sometimes Sonos is unable to browse music from Plex artist search results. And it’s all about having multiple libraries in Plex.
The problematic behavior is this scenario:
- In the Sonos app, search for an artist on Plex
- Sonos shows the results successfully
- Click on the artist
- Sonos returns “Unable to browse music”
If, instead, you search for an album you can click on the results, see the tracks, and play the music. Sometimes this seems to work, sometimes it doesn’t, and it’s taken me months to find the pattern.
The problem is that my Plex system has two libraries: mine and my husband’s. Overall Sonos handles this well and we can play whatever music from whatever library.
But while artist searches are scoped to all libraries in Plex, browsing artist results is only scoped to the current Plex library. If the current Plex library contains the artist you can browse the search results. If not, you get the “Unable to browse music”. If you change the Plex source to the library with the artist it will work again.
I’m not certain if this is a limitation in the API that Sonos is using to interact with Plex, or if this is a bug in how Sonos is using that API, but knowing what the problem and how to work around it is a start.
This recipe is from my Granny Dot who died last year. I’ve been missing her lately and decided tonight was the night for her Poppy Seed Bread.
I’ve annotated where my version differs from my Granny’s with *. See the bottom of the post for details on her original version.
Lemon Poppy Seed Bread
Makes 2x loaves (8.5″ x 4″ pans) or 1 bundt cake.
- 3 c white flour
- 2 1/4 c sugar
- 1 1/2 tbsp poppyseeds
- 1 1/2 tsp baking soda
- 1 1/2 tsp salt
- 3 eggs, lightly beaten
- 1 1/4c milk*
- 1/4 c lemon juice*
- 1/2 c vegetable oil*
- 1/2 c butter*
- 1 1/2 tsp vanilla extract
- 1 1/2 tsp almond extract
Preheat the oven to 350 degrees. Butter and flour the 2x loaf pans or the bundt pan, whichever you are using.
Mix dry ingredients (first 5) together in a mixing bowl. Add in remaining ingredients and mix well. Place the batter in the loaf or bundt pans (if using the loaf pans, split the batter evenly between them both).
Cook at 350 degrees for 60 to 65 minutes until a toothpick comes out clean. Let cool completely in the pan.
Note: non-dairy milk and butter works well in this recipe too.
- 3/4 c sugar
- 1/4 c orange (or lemon) juice
- 1/2 tsp vanilla extract
- 1/2 tsp almond extract
In a sauce pan, bring all ingredients to a boil. Pour over bread in pans.
Cool for 5 minutes, remove from pans, and cool completely.
Changes from the original
My grandmother’s original bread recipe has no lemon or butter in it, somewhat surprisingly, and instead uses 1 1/2 c milk, 1 c vegetable oil, and 1 1/2 tsp butter extract.
The original glaze recipe also calls for an added 1/2 tsp butter extract.
Time dilation during the pandemic has been a very real thing for me. 2021 feels like it’s lasted both 4.3 days and 43 thousand years. And somehow this year’s playlist was crafted during that window and yet is only 43 minutes long.
- To Live – Norah Jones
- Perfect to Me – Anne-Marie
- Good as Hell – Lizzo
- I’ll Be There – Jess Glynne
- Juice – Lizzo
- Walk Me Home – Pink
- Cups – Anna Kendrick
- Farther We Go (A Capella) – Walk off the Earth
- Happy Now – Pentatonix
- Better Days – Ant Clemons feat. Justin Timberlake
- Epiphany – Trent Reznor and Atticus Ross (from the Soul Soundtrack)
- Just Us – Trent Reznor and Atticus Ross (from the Soul Soundtrack)
- Fate – Rui Fujishiro
- Happiness Does Not Wait (2021 Version) – Ólafur Arnalds
Every year’s playlist ends with an instrumental track, but this year features 4 of them. Sometimes when I get really stressed out — which has happened a lot during the pandemic — I’ll go into a dark room, sit on the floor, play those 4 tracks, close my eyes, and just breathe.
You can listen to the songs on Spotify. As always, the order of the songs has been carefully curated. You may not be able to listen to them in order with the Spotify free account.
You can find prior year playlists under the mix cd tag (yes, they’ve been going on that long).
I’m excited to announce that I am starting a new job with Invitae as a Staff Software Engineer in their Office of the CTO on Monday, Sept 27th. I’ll be helping teams across the engineering organization solve intractable problems, foster the use of software development best practices, assist with designing performant & scalable architectures, and just rolling up my sleeves and helping out. I’m looking forward to a new challenge on a team with a broad mission.
I’m very sad to be leaving the wonderful people at ExtraHop, in particular my amazing Perf & Tools team. It’s been a fun 2.734 years and I got to work on some company-changing projects like Reveal(x) Cloud, ExtraHop’s first SaaS product, which we developed and shipped in just 4 months. I still heartily recommend ExtraHop as a company.
My last day at ExtraHop is this Friday, Sept 10th then I have two weeks of funemployment before starting at Invitae.
I’ve been throwing pottery for ~19 years. Since 2006 I’ve kept a journal of my pieces to help me track them through the multi-staged process and remember what I’ve done for each piece.
I started doing this when I was throwing in teaching studios to track pieces going in and out of the kilns. In teaching and community studios everyone’s dry pieces get put in the same rack to get bisque fired. If you didn’t keep a record of what pieces you had getting fired you would lose them! Similarly everyone’s glazed pieces would get put on the same rack before getting glaze fired which could take many weeks and it was easy to forget what you had coming out of the kilns.
I quickly started adding what glazes I used on each pieces as well, so if something came out particularly good, or bad, I could remember what I had done for next time.
Since I’ve become a home potter I’ve also started keeping track of the clays I’m using. This was less of an issue when working with teaching or community studios where they often only have one white/porcelain and one blush.
As an example, here is a small bowl that I threw recently and the markings on the bottom:
The stylized K (actually a K made with a C — KC, get it?) is my potter’s mark so I know that piece is mine. The pot has the year it was made and a number that I increment for every piece in the year. This was the 18th piece I threw in 2021.
Here’s the journal entry for the piece in the 2021 section:
My handwriting is horrible, but it includes the number (18), a short description (small bowl with foot), the clay (SEA Mix 5), the dates that it went into the bisque (BI), out of the bisque (BO), a missing date for when it went into the glaze fire (GL), and a final date when I got the finished piece back (F). Perhaps most importantly it includes the glazes that I used (Snow with a splash of Mulberry under) and what I thought of it (Lovely!).
Pieces get added to the journal after they’ve been successfully trimmed since that’s when their life really begins.
While the journal is for me, one of the side benefits is that I will often encounter a bowl that I made for someone and turn it over to see when I made it. And while it’s rare, there have been times where I’ve wanted to replicate (or try to replicate, this is pottery, let’s be realistic) the glazing of a piece and I’ve had the records to duplicate it.
I also laugh at myself thinking that sometime in the far future some art historian will be cataloging my pieces and be able to quip with gusto “oh, a 2013 — this was his black on porcelain period”!