Nathan Grigg

Debugging Some AirPrint Issues

There is kind of a lot that goes into making AirPrint printers work, which is bad news if, like me, your printer isn’t working properly.

I recently replaced my old HP printer with a new Brother printer. I plugged the new printer into Ethernet, then logged into my router to reassign the IP address to a static one, and restarted the printer so that it would take the new address.

While I could access the printer’s web-based settings screen and print from MacOS, I could not print from iOS. When I tried, I got the “No AirPrint Printers Found” message.

AirPrint relies on mDNS, which stands for multicast DNS, and is also known as Bonjour or Zeroconf. This is the technology that gives you “.local” addresses. My understanding is that any computer can send a multicast message asking for a printer or other mDNS device by name. Multicast is like shouting into the house, the router is supposed to make sure that everyone can hear the message, and everyone that cares is listening. The target device should hear it, no matter its IP address, and then respond with another multicast message that contains its IP address. Everybody on the network can then take note of the address. The mDNS device can also advertise itself, essentially telling everyone its name and IP address without being asked, so that everyone knows it is there.

My first step was to dig through my router settings (I have a Unifi Cloud Gateway). There are plenty of things there that the router can try to do to make mDNS better, and some of them have the potential to break things. None of my changes seemed to fix anything, so I left it how it was to begin with.

My next step was to try to put the printer on WiFi instead of Ethernet, even though this shouldn’t matter because they share the same network. Annoyingly, it fixed the problem at first. But then when I changed the WiFi address to also be static, it stopped again. At this point, it felt like I had narrowed things down to static vs dynamic IP addresses, which is not very satisfying because I really would prefer a static IP address.

It also doesn’t make sense. For a dynamic IP address, the printer asks the router for an address and the router gives it one. For a static IP address configured in the router, the exact same thing happens except that the router remembers to always give the printer the same address. So why would this make a difference?

At this point, I admit that I started trying to reason it out with ChatGPT, which did a very good job of playing logician. It gave me a bunch of reasons this might not be working, none of which applied. I said, “It can’t be the printer’s fault because the printer shouldn’t see the difference between a static or a dynamic address.” But also, “It can’t be a problem with the router settings because mDNS is clearly working some of the time.” To which ChatGPT said, “You are right, it can’t be the printer’s fault or the router’s settings, so maybe just try restarting the router.” Which worked.

My theory is that the router is keeping some kind of database of which mDNS name corresponds to which IP address, and it wasn’t getting corrected when I changed the IP address of the printer to be static.


Ignoring the absolute incompetence and disrespect for the law, the Signal messages in this Atlantic story make clear the moral corruption of those running the government right now.

Especially if you have been on big-corp email threads, you can smell the both-sides kiss-assery of JD Vance from a mile away. And there is a special place in hell for anyone who responds to a successful lethal attack with emoji, much less the horrific combination of “two hands praying, a flexed bicep, and two American flags.”


Self-Hosted Audiobook Server

Lee Hutchinson’s article this week about his move to self host his audiobook collection made it straight to the top of my digital to-do list.

I enjoy audiobooks more than most of my family, but I still manage the library for the seven of us, and I had until now failed to work out a good sharing solution.

I had previously gone through this with Kindle ebooks, where Amazon has a convoluted way of sharing books with your family, but I eventually gave up and got everyone a Kobo. I copy the entire family library onto everyone’s device and update them from time to time as we get new books.

Audiobooks take up a bit more space—my library is more than 100 GB—so that has made them a harder problem to solve. And Audible only lets you share your purchases with one adult member of your family.

Until now, my less-than-ideal solution has been to store the books in a shared iCloud folder and listen to them with the BookPlayer app. But this is a very manual process since you have to add books to the app, which brings up an iCloud picker, and then you have to wait in the picker for the file to download to your device before you can add it to the app. There seems to be a new $5/month BookPlayer Pro subscription that manages syncing for you, but I think it is cross-device sync, not cloud storage. Also, it is labeled Beta for now.

Audiobookshelf, plus a client app like plappa (which has an adorable icon, CarPlay, and much more customizability than Audible) are exactly what I needed. I had no issues installing and running the server software on my home server. I dumped my set of audiobooks into a folder. I didn’t bother with any fancy organization, and it found everything anyway. I used the web app to group the books into series. I downloaded photos of the authors for the by-author view.

I feel like the bar is still pretty high to get stuff like this working, but it makes me nostalgic for the days when running computer software gave you the freedom to customize, mix and match applications, and make things just how you like them. I am tired of the full-service, lock-you-in, our-way-or-the-highway model of computer software.


Wilderness Park


Wildflower


LA Marathon


DTLA in the morning, waiting for the marathon to arrive


It is bad enough that we are leaving our children an overly warm planet, now they get a wrecked country to go with it.


The battery on my Magic Trackpad began to swell.

I bought new one. USB-C! Black!

Now I want a black keyboard, but I don’t want a number pad. Give me choices, Apple!


I have about 30 Leviton Wi-Fi switches in my house, because when I installed them, there wasn’t a clear leader between Z-Wave, Zibgee, Matter, etc. For years they worked without any issues, but recently they have been losing their network connection, about 3-4 switches per week.

After some experimentation, I set the minimum RSSI for my access points to -80 dBm, which essentially kicks a light switch off the Wi-Fi if it has a poor signal. The goal is for it to reconnect to an access point that is nearer.

I’m happy to say that three weeks later I have not had a single unresponsive switch.


I highly recommend staying away from Zelle. I had come to rely on it somewhat only to find out that there are fairly low transfer limits. If you hit your limits, you might not be able to send money for a month. I don’t understand, do they want us to use their service or not?


In 2015 there was a measles outbreak in Southern California, which I remember vividly because I had an infant at the time. The state responded by eliminating personal belief exemptions for vaccines.

Have things improved since then? My gut tells me no, since increased government efforts can be easily overwhelmed by a concerted anti-vaccination push. But CDC data shows that from 2011 to 2023, California exemption rates dropped by 2.5 percentage points (2.6% to 0.1%) while MMR vaccination rates for kindergarteners increased by 3 percentage points (93% to 96%). Meanwhile, in my birth state of Idaho, exemption rates increased by 9 percentage points (5% to 14%) and MMR vaccination rates decreased by 9 percentage points (89% to 80%).


A Sidereal Clock and Sense of Direction

After my last astronomy post, I was curious if I could develop a cosmic sense of direction, to know, day or night, where Sirius is the same way I generally know which way is north.

So I built this interactive sidereal clock. I wil explain a little bit about how it works and then how I got there.

A screenshot of the star clock

(This is a screenshot. Click through to see the real version.)

About the clock

The clock displays both solar time (24 hours per day) and sidereal time (four fewer minutes per day, but measured as 24 sidereal hours). The outside circle shows the sidereal hours, and the inner circle (representing Earth) shows the solar hours.

Just like 12:00 solar time is when the Sun is at its peak, 6:00 sidereal time is when Betelgeuse in Orion is at its peak. Because stars are so far away, they don’t seem to move much relative to each other, so every (non-polar) star has a fixed sidereal time when it reaches its peak. This is also called right ascension, abbreviated RA.

The right ascension is essentially a measure of longitude, and at 6:00, the 6ʰ line runs from Polaris, straight across the highest point of the sky and down to the southern horizon, where out of sight from the northern hemisphere it hits the south celestial pole. At the same time, the 12ʰ line goes from Polaris down to the eastern horizon, and the 0ʰ line to the western horizon. Also at that time, a small part of the 18ʰ line is visible in the northern hemisphere, from Polaris straight to the northern horizon.

In the interactive clock, you can drag the Sun around to represent different times of year. This shows you the relative position of the Sun, Earth, and stars at that time of year. You can see that the winter solstice is when the Earth is between the Sun and Orion. In other words, the northern hemisphere is always, regardless of the season, tilted towards Orion. (That won’t last forever, but it will for my lifetime.) I marked the four seasons on the clock, and when the Sun circles a season, that represents the solstice or equinox (again, in the northern hemisphere).

You can also drag the little human standing on Earth to adjust the time of day. The perspective of the Earth is looking down from above the north pole. It is easiest to imagine yourself standing on Earth looking south, with the eastern horizon on your left and the western horizon on your right. Although, again, to see the entire line corresponding to the current sidereal time, you will have to look up, up, up, and a little backwards, until you see Polaris.

You can see the difference between sidereal and solar time, because if you drag the guy once around, the Sun will have moved slightly so you have to drag a bit further to complete a solar day.

The effect of the Earth’s tilt on the Sun’s position is not shown here. The Sun’s RA is correct, though. The relative movement of the Sun above or below the Earth’s equator is what causes it to rise somewhat before or after 6am, depending on your latitude and the season.

Choices

Although I’ve never had a very good grasp on astronomy, it is not for lack of experience. When I was young, my mom was very interested in astronomy, and we used to drive out to the potato fields of Idaho to see the night sky. We had a Planisphere. We had star mapping software, probably DOS-based, but I don’t remember which. But everything, to me, always felt like it was moving, and never in a way I could understand or visualize. (I think most astronomy software is especially confusing in this respect.)

For this reason, I really wanted something that let me imagine the stars holding still, while the Earth and Sun moved. As far as I know, there isn’t a “standard” way to depict the night sky, but to my math brain it made sense to put 0 on the positive x axis. A top-down view allows you to have the cardinal directions in their normal locations, although it prioritizes the southern sky and makes the clock run counterclockwise. At my latitude, the equatorial and mid-southern cosntellations make up more of the sky anyway. If I still lived in Idaho or the Pacific Northwest, it might make more sense to flip things around and look up at the earth from below, since the polar constellations are so much more prominent and probably an easier way to orient yourself.

Technology

I used Javascript (mostly d3) to build an SVG file. At first I had sliders for the time of year and time of day, and then I realized I could just watch for drag events on certain parts of the image. Feel free to take a look at the code, it is only a few hundred lines of very spaced out code.

I used a Planisphere to make sure that I was getting things correct.

Success?

I had a ton of fun making this. The process of working everything out really helped it click into my brain.

Ultimately, the easiest way to orient myself seems to be to think first about where the Sun is in relation to the stars, and then where I am in relation to the Sun, rather than think explicitly about sidereal time. Which is essentially how it has been done for thousands of years with the Zodiac, but I find that the extra step of fixing the Earth’s orbit as up-down-left-right is critical for my spatial awareness.


I don’t know how anyone can argue that LTE is “fast enough” compared to 5G. Seeing LTE in the status bar is enough to convince me to put my phone down for a while.

And millimeter wave is amazing. I get faster than 1 Gbps cellular download at my office, so that I don’t even bother connecting my phone to wifi.


Cloudflare and Python

In a recent post, I made a bit of an eye-roll comment about how Letterboxd rejects requests based on their user-agent header. Then today, it happened when I was making a request to my own website. I know (or thought) that I don’t do anything so ridiculous, so I set out to investigate.

I host my site these days on a Linode instance using nginx, which I was pretty sure doesn’t do anything strange based on user-agent headers. Looking at my logs showed that my request wasn’t making it to ngnix.

When Google Domains shut down, I migrated my DNS hosting to Cloudflare, so that was the next possible culprit. Cloudflare offers traffic proxying, so that all of your traffic goes to their servers, and they send requests to your servers. This isn’t something I was looking for when I switched, but they make it easy or maybe even the default.

Inspecting the actual response that I was getting in Python, I saw the message error code: 1010. (For Letterboxd, I had seen the 403 response and hadn’t looked deeper into it, but it was probably the same thing.) Some searching confirmed that this was indeed coming from Cloudflare.

If you go to “Security > Settings” in the Cloudflare dashboard, you can turn off “Browser Integrity Check,” which fixes the problem. Or just turn off proxying entirely, although that takes a little longer to take effect, because the DNS settings need time to propagate.