Archive for August 15, 2023

Tuesday, August 15, 2023

ResForge

andrews05 (via David C.):

ResForge is a resource editor for macOS, capable of editing classic resource fork files and related formats. Based on ResKnife by Nicholas Shanks and Uli Kusterer, this derivative of the project has been rewritten for modern macOS systems.

[…]

Supports both resource and data forks in the original resource file format, as well as experimental support for the new extended format defined by Graphite.

Hexadecimal editor, powered by HexFiend.

Template editor, supporting a wide array of field types.

[…]

Image editor, supporting 'PICT', 'PNG ', 'cicn' & 'ppat' resources, plus view-only support for a variety of icons and other bitmaps.

Sound editor, supporting sampled 'snd ' resources.

Old Kindle Fires Can No Longer Download Books

Andrew Abernathy:

TIL that old Kindle devices can’t be registered to an account, and thus can’t be used for reading books. […] I learned this by having my Amazon credentials repeatedly rejected despite various two-factor/OTP contortions and finally managing to contact a human being who ultimately took the device serial number and said “ah, that model is too old”.

[…]

I gather this is a first-generation Kindle Fire, which makes it from 2011. So it’s old, but I can’t even use it with it’s original software to read books that were made for that platform.

[…]

I’ve now tested and I can indeed load PDF and non-DRM .mobi via USB.

Sad. It sounds like E-ink Kindles, which are even older, may still be supported, though.

Previously:

Update (2023-08-16): Andrew Abernathy:

I just tried registering this first-gen Kindle Fire again and it worked right away.

I’m reluctant to say it was user error, since I tried the exact same process many times yesterday with ever-increasing care to make sure I was entering things correctly, and Amazon support asked me for the serial number, then told me it was too old and couldn’t be registered. But…maybe I did manage to mess it up. Or maybe Amazon later flipped some switch based on the serial #?

A happy result, but, as with GrammarlyGO, when the good news directly contradicts the bad news given by support, I have questions.

Previously:

Turning Off Core Data Persistent History Tracking

It’s not documented, but Core Data doesn’t like you to turn off persistent history tracking once it’s been enabled for a store. If you set NSPersistentHistoryTrackingKey to false after it had been set to true, opening the store will seem to succeed, but it will log an error like:

Store opened without NSPersistentHistoryTrackingKey but previously had been opened with NSPersistentHistoryTrackingKey - Forcing into Read Only mode store at

No error is reported to your code, although you can check whether store.isReadOnly matches what you passed for NSReadOnlyPersistentStoreOption. If you fail to notice this, your app is likely to crash at some point. For example, the NSPersistentStoreCoordinator.setMetadata(_:for:) method will raise an NSInvalidArgumentException, which cannot be caught in Swift.

This makes sense in that, if you could turn off history tracking and later turn it back on, the history would be there but would have a gap, which could lead to bugs. In my case, though, I had only turned on history tracking to track down a bug—which ended up not being an unexpected writer but rather a bug in Core Data’s uniqueness constraint conflict resolution. I no longer needed history tracking for that store and wanted to avoid the associated performance cost.

It turns out that you can turn off history tracking if you first delete the history. So, I can open the store with NSPersistentHistoryTrackingKey set to true, then execute this request:

let request = NSPersistentHistoryChangeRequest.deleteHistory(before: .distantFuture)

Internally, this seems to only do a batch delete on the ACHANGE and ATRANSACTION tables. It does not actually clear out the interned strings in ATRANSACTIONSTRING or remove the history tracking tables themselves. But the bulk of the data is gone, and Core Data will let me re-open the store with NSPersistentHistoryTrackingKey set to false.

Going forward, I will add a key to the store’s metadata to record whether it was last opened using NSPersistentHistoryTrackingKey. When loading the store, if the key is true, I know to remove the history and can avoid logging the error. If it’s false, I know that the store can be safely opened without adding the history tracking tables.

Previously:

Toolbar SF Symbols Vertically Stretched on a 1x Display

John Brayton:

Toolbar images based on SF Symbols are vertically stretched when displayed on a 1x display. I filed this as FB12928137, but wanted to let other developers know. This is tricky because the effect is subtle and because developers without a 1x display will not see the issue. I worked around it by exporting the SF Symbols as 37-point images and putting them in PDFs in the asset catalog. I made each image 55x55, and centered the symbol graphic inside it.

[…]

You can see the effect in the Settings windows of Apple apps, including Apple Mail and Messages.

I noticed this a while ago in Safari and Mail, and now I can’t unsee it. I’m glad that he wrote up the bug.

There are a lot of little glitches like this with 1x displays, and especially when you have both a 1x display and a Retina display connected. Checkboxes in tables sometimes look weird, icons don’t draw using the proper representation, etc.

Mario Guzmán:

Top… the 1x rendering of sidebar icons in Apple TV app on macOS.

Bottom, my MiniPlayer with custom drawing (yes, you can use images too if you want)…

Both screenshots rendered on a non-retina display aka @ 1x.

But you can see how if you really care about your app, your icons could be great in both 1x and 2x. Best align to nearest pixel where possible otherwise they look so blurry and marred.

Previously:

Update (2023-08-16): Matt Sephton:

I’m running a non-retina external display again—needs must—and I’m reeling from the lack of attention given to user interface elements in macOS and across Apple’s own apps.

  • Finder search button (squished)
  • Safari refresh page button (squished and badly positioned)

But most freaky is when switching back to the icon view in System Preferences, where the retina icons are briefly visible before they are all swapped out for the non-retina. Jarring.

Sam Rowlands:

I mean seriously… 3 Trillion dollars and you can’t even align icons in the center of the circle.