Building a static GraphViz for macOS

Note: This is a very old post from 2020 I had sitting in my drafts. I figured I would publish it in case it was useful for someone else. Notably, this predates Apple Silicon, so yo would want to build another version that’s ARM and use lipo to make a universal binary. This is left as an exercise to the reader.

I recently had the need for building GraphViz without any external dependencies other than what comes with macOS, as part of an application calling into it. While on Windows, I used their provided binaries, I was on my own for macOS since I wasn’t willing to ship half of Homebrew with my application. Instead, I took a simpler way.

Continue reading

Fixing files marked as stuck as partially transferred in Finder

Very rough note, but if I don’t write it down, no one else will find it. A friend was dealing with an issue where she interrupted a file transfer of many files and directories to an SMB share on macOS and transferred it via other means. However, macOS thought the files were still in a partially transferred state to be resumed. There was no obvious way to tell Finder that it was OK.

It seems that clearing a file’s extended attributes can clear this out. A quick way to remove all extended attributes from everything in the current directory:

shopt -s globstar
xattr -c **

Be careful with this – you might have files that do need the extended attributes. In this case, it wasn’t needed. Read on for the theory on why this might work and the specific attribute that might be a problem.

Continue reading

Dealing with key-based polymorphic JSON in Swift Codables

I’ve been trying to use Swift’s Codable protocol with some data I wanted to decode over the wire. Codable makes it easy to serialize things in Swift. Unfortunately, the schema of the protocol I was using doesn’t cleanly map to something easily represented in Swift. It consists of a single object, with a single key, and the key’s name determining its value and type. For example, various JSON blobs:

{"Chat": {"message": "Hello world!"}}
{"Error": {"message": "Invalid request"}}
{"Hello": {"username": "alice", "version": "1.0"}}
/* there are more, but we'll stick with this set for the example */

How do we decode this cleanly?

Continue reading

Poor schemas, poor cataloguing: why music tagging sucks

One of the things that frustrates me with having a local music library is the tedium of tagging. While there are tools (like beets or MusicBrainz Picard) to make it easier, I feel there are fundamental issues with the design of tags for music, and the way we apply tags. This doesn’t just make exploring music harder, it leaves a lot of possibilities on the table that will be very hard to implement without significant changes to our approach.

Continue reading

Baby’s First iSCSI with ZFS Setup

I recently got interested in trying out iSCSI, since I had spare capacity on my server. For those unaware, iSCSI can expose block devices over a network. Instead of a file system, it exposes a (virtual) disk, and lets the system connecting to it manage high-level details, including its own file system. This has very different trade-offs from file sharing like SMB/NFS; sharing the disk isn’t really possible, but you avoid a lot of the performance impact from (often different) file system semantics.

This makes it possible to do things you might otherwise not recommended with file sharing, like hosting a Steam library on it. Especially so if you have the iSCSI setup on its own network. Remember, most file systems assume a mostly direct connection to disk. Running this over a shared Ethernet connection, let alone WiFi might not be the best idea.

Also note that I’m not describing a secure setup here. This is very much “baby’s first”, and should only be done on a secure network, or as an experiment. Securing it will involve properly configuring things like portal groups, and isn’t covered in this article. I might cover it in a later article.

This also synthesizes a lot of information I found online; in particular, this basically digests some information in the FreeBSD handbook about the iSCSI target subsystem and ZFS volumes, plus Red Hat and Oracle documentation on iscsiadm.

Continue reading

A years-late first-impressions review of the Dell XPS 13 9300

Recently, I picked up a Dell XPS 13 9300 – while a few years old, I picked it up for quite a bit market value ($500 CAD – when equivalent-ish models range from $600 to $900 on the used market). While I don’t plan to use it as my daily driver, I did have a need for a newer Intel machine – I didn’t have anything after Haswell; just my Ryzen desktop and M1 MacBook Air. However, I decided to give a shot, and overall was pleased by what I saw, albeit with some caveats. Here’s what I think…

XPS 13 indoors, playing music via a Bluetooth headset
Continue reading

Downgrading binary packages with pkg on FreeBSD

I had recently upgraded my NAS from FreeBSD 13.0 to FreeBSD 13.1. Unfortunately, I found out that the Deluge package was faulting on startup. It turns out that when FreeBSD updated the libtorrent-rasterbar package, it had broken the Python bindings, and thus Deluge. However, the old Deluge and Python binding package were still installed – they just didn’t work anymore due to libtorrent ABI.

While it’d be ideal if this were fixed upstream, I didn’t have the patience for this right now. So, I decided to downgrade the libtorrent-rasterbar package to be compatible with the Python bindings. There were no other dependent packages, so I figured this was safe. Unfortunately, I had to deal with a few curveballs along the way…

Continue reading

“Sorry, you are not allowed to add a term to one of the given taxonomies” error from WordPress

If you get this error message from WordPress:

Sorry, you are not allowed to add a term to one of the given taxonomies

It’s seemingly because you can’t publish new tags from the XMLRPC interface, used by client-side blogging tools (I was using MarsEdit.). I removed the tags from the post I wrote, and it seemed to work fine.

The Endless Dream: on Addiction and My Mental Health

I would not call myself a happy or joyful person…I’m cynical, eternally depressed, and generally unhappy. Visually impaired, somewhere on the autism spectrum, transgender, and somewhere between bipolar II and similar mental health problems. Not a good mix for producing someone that can manage to avoid addiction. Doesn’t help that it runs in the family to some extent, either.

Continue reading