Archive for August 29, 2023

Tuesday, August 29, 2023

Web Scraping for Me, But Not for Thee

Kieran McCarthy (via Dare Obasanjo):

Some of the biggest companies on earth—including Meta and Microsoft—take aggressive, litigious approaches to prohibiting web scraping on their own properties, while taking liberal approaches to scraping data on other companies’ properties. When we talk about web scraping, what we’re really talking about is data access. All the world’s knowledge is available for the taking on the Internet, and web scraping is how companies acquire it at scale. But the question of who can access and use that data, and for what purposes, is a tricky legal question, which gets trickier the deeper you dig.

[…]

But make no mistake, these companies view this data, generated by their users on their platforms, as their property. This is true even though the law does not recognize that they have a property interest in it, and even though they expressly disclaim any property rights in that data in their terms of use.

Since the law does not give them a cognizable property interest in this data, they must resort to other legal theories to prevent others from taking it and using it.

Previously:

Mac Won’t Accept Correct Login Password

I was recently surprised to find that my Mac kept rejecting my password at boot. I’ve been using the same password for years and was sure it was correct. I typed it slowly while looking at the keys. I made sure that the Caps Lock key was not down. I also tried the MacBook Pro’s built-in keyboard, in case I’d worn through another USB Apple aluminum keyboard. macOS kept not recognizing the password and locking me out of retrying for increasing amounts of time.

I rebooted into macOS Recovery, which did accept my password and let me unlock the drive in Disk Utility. My data was safe.

I did some searching online. Most pages are about resetting your password if you’ve forgotten it. Some other users seemed to be in the same situation as me but didn’t have a solution. There were suggestions to reset the NVRAM (didn’t help) and to reset the SMC (seems to happen automatically on Apple Silicon, anyway).

Eventually I figured it out: I had been typing the correct keys, but they had been producing the wrong characters because the Dvorak keyboard layout was selected. Earlier in the day, I had been writing some code for SpamSieve so that its hotkeys would work with different keyboard layouts, even though the virtual keycodes in Events.h such as kVK_ANSI_S refer to the ANSI-standard US keyboard. To test this, I had been switching among different keyboards. Even though I had long since switched back to the QWERTY layout, the login screen had remembered a previous setting. In fact, even after I selected the proper keyboard from the menu on the login screen, it still switched back to Dvorak on the next reboot. I had to delete Dvorak in System Settings to prevent this from happening.

Update (2023-08-30): Howard Oakley:

During normal startup, before you have logged in as a user, your Mac doesn’t use the custom keyboard set for a specific user, and in older versions of macOS should use that stored in /Library/Preferences/com.apple.HIToolbox.plist, which may be quite different from any set in a user’s ~/Library/Preferences/com.apple.HIToolbox.plist file. This doesn’t appear to be true for Ventura, where the pre-login settings are now hidden.

In some cases, this can prevent passwords from being entered correctly, and can readily confuse. When there’s only a single admin user, macOS should keep settings in sync, but when there are multiple users with different keyboard settings, they can become confused.

[…]

Like all preference files, they are now maintained by a service which means that editing them directly is unlikely to do a great deal: the service will happily overwrite the files with what it thinks they should be.

That is apparently what happened to me. The service saved the wrong keyboard, i.e. not what I had selected in System Settings, even though there was only one admin user. And then it failed several times to update the login setting.

Jevgeni Mullo:

Hey, it wasn’t just for me! The difficulty that I had was macOS showing correct layout being selected, yet actually using a different one. And then, quietly not switching the layout when I actively selected desired one in the language drop-down. I was going nuts.

Carlos August:

I use both an English and Spanish layout in my MBP. Although English is the default (and the language I need to be in to type my password due to muscle memory), my MBP has been choosing the Spanish layout on first boot for years.

I have been trying to fix since day 1, no luck.

Update (2023-09-05): Howard Oakley:

This stores key settings which the M1 Mac can’t obtain from internal disk storage during the early part of the boot process. An example is the location of the boot volume to be used. In Intel Macs, these are stored in discrete memory which can be reset to factory defaults. M1 Macs are different again, in that there’s no single manoeuvre which resets the contents of NVRAM.

[…]

NVRAM contents are listed in System Information under Software > Logs > NVRAM contents, and can be edited using the nvram command in Terminal. Many of the variables contained in the NVRAM of an M1 Mac aren’t intended to mean anything to the user, nor should they be changed or removed. Among those of interest and potential use are the following:

[…]

prev-lang:kbd – the initial keyboard language, such as en-GB:2 for British external (supplied as a string).

Update (2024-02-28): Howard Oakley:

If you can’t seem to enter the right password, be very careful: don’t just keep trying in the hope that you’ll get it right, as you could end up locking up your Mac altogether.

[…]

If that doesn’t do the trick, open the keyboard menu item at the top right, and check that you’re using the correct keyboard layout for the language you’re using. Although it’s not common, sometimes this menu changes its mind, and there’s nothing worse than trying to enter a password based on an English QWERTYUIOP keyboard layout when your Mac is expecting it from a French AZERTY layout.

[…]

This may give you the option of resetting your password using your Apple ID, in which case click the arrow next to that and provide your Apple ID and its password, then follow the instructions. The alternative is to use your Recovery Key if you’ve already obtained one, which is again selected by clicking on the arrow, after which you enter the key and follow the instructions.

Previously:

Chime Text Editor Now Open Source

Chime:

The code in this repo should be considered Non-Functional right now. You can download the currently released version.

Chime used to be commercial, but is now free. It built up some pretty significant cruft over time. In particular, the core UI application architecture is just in a bad state. It is also quite complex to build. So, I've opted to re-implement that core and pull in parts as appropriate. I'll be putting an emphasis on extracting components into packages as I go. A fitting rebirth, I would say.

There are also some interesting libraries, such as Rearrange:

Rearrange is a collection of utilities for making it easier to work with NSRange and NSTextRange. It’s particularly handy when used with the Cocoa text system.

[…]

[RangeMutation] is a struct that encapsulates a single change to an NSRange. It’s useful for serializing, queuing, or otherwise storing changes and applying them.

You can also use this class to tranform individual points or other NSRanges. This is handy for updating a set of stored NSRanges as text is changed. This might seem easy, but there are a large number of edge cases that RangeMutation handles, including mutations that invalidate (for example completely delete) a range.

See also: CotEditor.

Previously: