iOS: Disable WiFi (not just cellular) for specific apps without jailbreaking #

by buying an iPhone in China and using Apple's "Apps using WLAN & Cellular" feature:

Extremely disappointing that Apple does not permit this critical privacy and security feature on all iOS devices irrespective of region; it's especially surprising given that China usually gets the short end of the stick:

See also A humble iOS 14 wishlist.

/mac | Sep 10, 2022

macOS: Rotate text in Preview.app #

  1. System Preferences → Trackpad → Scroll & Zoom → enable Rotate.

  2. Open an image in Preview → Tools → Annotate → Text.

  3. After entering desired text and with the text box still selected, use the rotate gesture to turn it as desired.

For more fine-grained control, use Pixelmator (Add text on a path) or Acorn (Path Text | video tutorial).

H/T: blueswirly and Zabobon

/mac | Sep 08, 2022

Excerpts from "The Hindu Conception of Man" #

by Jean Delaire in the September 1908 issue of The National Review (no, not that one):

/misc | Aug 28, 2022

Microsoft Word: Calculate number of days between two dates #

In Excel, it's very simple to calculate the number of days between two dates by simply subtracting one cell from the other, e.g., entering =(B2-B1) in B3 below:

Arrival: 1/1/22
Departure: 2/1/22
Days: 31

While Word supports basic formulas in tables (Table Tools → Layout → Data → Formula), date handling is unsupported; the formula above returns "0.0".

You can of course embed or link an Excel worksheet into a Word document, but there are issues with formatting, layout, and performance.

Field codes allow for calculating dates in Word, but aren't for the faint of heart. Paul Edstein/macropod's Microsoft Word Date Calculation Tutorial (mirror) is the definitive guide; here's a taste from the section entitled "Calculate the # Days Difference Between Two Dates":

{=
{SET a{=INT((14-{EndDate \@ M})/12)}}
{SET b{={EndDate \@ yyyy}+4800-a}}
{SET c{={EndDate \@ M}+12*a-3}}
{SET d{EndDate \@ d}}
{=d+INT((153*c+2)/5)+365*b+INT(b/4)-INT(b/100)+INT(b/400)-32045}
-
{SET a{=INT((14-{StartDate \@ M})/12)}}
{SET b{={StartDate \@ yyyy}+4800-a}}
{SET c{={StartDate \@ M}+12*a-3}}
{SET d{StartDate \@ d}}
{=d+INT((153*c+2)/5)+365*b+INT(b/4)-INT(b/100)+INT(b/400)-32045}
\# ,0}

More on fields:

VBA's DateDiff function offers a more straightforward approach: simply insert two Date Picker Content Controls and one Rich Text Content Control (Developer → Controls), then add the following VBA code:

Sub CalculateDaysBetweenDates()
    Dim days As Integer, date1 As Date, date2 As Date
    date1 = ActiveDocument.ContentControls(1).Range
    date2 = ActiveDocument.ContentControls(2).Range
    days = DateDiff("d", date1, date2)
    ActiveDocument.ContentControls(3).Range = days
End Sub

Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
' Update days when focus leaves Content Control box
    Call CalculateDaysBetweenDates
End Sub

If there are additional fields or formulae in the table, add ActiveDocument.Fields.Update under Call CalculateDaysBetweenDates to update them as well.

Rather than referring to the Content Controls numerically based on their location in the document, you can specify their UIDs instead:

  1. Click the desired Content Control to reveal the 3 dot tab to the left, then click on the tab.

  2. Run this VBA code to display the CC's UID:

    Sub GetUniqueID()
    MsgBox Selection.ContentControls(1).ID
    End Sub
  3. Replace the numeric CC reference in the CalculateDaysBetweenDates subroutine with the corresponding UID, e.g., ActiveDocument.ContentControls(1).RangeActiveDocument.ContentControls("1247527479").Range

/windows | Aug 28, 2022

The mind is not in the body; the body is in the mind... #

Excerpts from Michael Grosso's Some Varieties of Out-of-Body Experience, found in D. Scott Rogo's anthology, Mind Beyond the Body:

/misc | Aug 08, 2022

Microsoft 365: "We are unable to connect right now. Please check your network and try again later." #

(TL;DR: Resolved by enabling Windows Event Log.)

Attempting to open Microsoft Office apps like Word or Excel resulted in a "Sign in to set up Office" window; attempting to sign in produced a "We are unable to connect right now. Please check your network and try again later." error message.

CBBG1000 mentioned encountering the same error when "connecting from Outlook Client to O365 Exchange servers via a VPN connection over Juniper Pulse" and working around it by "restarting the NlaSvc service" (which I assumed referred to "Network Location Awareness"); however, attempting to start the service via the services.msc GUI returned:

Windows could not start the Network Location Awareness service on Local Computer.

Error 1068: The dependency service or group failed to start.

Right clicked "Network Location Awareness" → Properties → Dependencies to discover the following required services:

Checked all five services; Windows Event Log had been disabled. Enabled, started, and tried signing in to Microsoft 365 again - success.

/windows | Aug 03, 2022

Convert mbox-based Local Folders to Maildir in Thunderbird 102 #

The roadmap for Thunderbird 102 (2022) mentioned Maildir support and a decade-old Bugzilla issue about finishing the job:

Maildir is a message storage format that should improve data safety, allow for incremental (delta) backups of messages and allow for antivirus to interact better with messages. Maildir will be vastly improved for 102, but may not be pref'd on by default.

845952 - (maildirblockers) [meta] finish "maildir" message storage

There is still little in the way of official documentation, so I decided to test 3 native methods for converting mbox-based Local Folders to Maildir under macOS 12.4 Monterey and Mozilla Thunderbird 102.

Back up before attempting any of these; Mozilla's Maildir in Thunderbird page still warns:

We suggest you leave Maildir disabled unless you are an advanced user, willing to risk your data, and know how to back up your email before turning on Maildir and how to restore it if you run into problems.

1. Failed: New import wizard (from 2022 for Thunderbird 102)

Thunderbird 102 introduced a new import/export wizard which sounded promising; alas, it did not avail:

  1. Create and open a new Thunderbird profile then close the Account Setup tab

  2. Thunderbird → Settings → General → Indexing → "Message Store Type for new accounts:" → change from "File per folder (mbox)" to "File per message (maildir)"

  3. For good measure: Thunderbird → Settings → General → Config Editor... → set "mail.store_conversion_enabled" to "true".

  4. Tools → Import... → Import from another Thunderbird installation → Continue → select mbox-based Thunderbird profile → Continue → uncheck all but "Mail Messages" → Continue → click "Start Import" then "Finish"

Thunderbird automatically restarted and a new "Thunderbird Import" folder appeared under Local Folders, but it only contained empty subfolders.

2. Failed: mbox to Maildir conversion (from 2018 for Thunderbird 60)

From Thunderbird 60.0 Release Notes:

Thunderbird now allows the conversion of folders from mbox to maildir format and vice versa. This is an experimental feature that needs to be enabled by setting the preference mail.store_conversion_enabled. Note that this functionality does not not work if the option "Allow Windows Search/Spotlight to search messages" is selected.

Let's give it a try:

  1. Thunderbird → Settings → General → Config Editor... → set "mail.store_conversion_enabled" to "true".

  2. Right click Local Folders → Settings → change "Message Store Type:" from "File per folder (mbox)" to "File per message (maildir)" → Continue:


The messages in the account Local Folders will now be converted to the maildir format. Thunderbird will restart after the conversion is complete.


Converting the account Local Folders to maildir...


Conversion failed.

3. Succeeded: Phil Davis' method (from 2015 for Thunderbird 38.0.1)

Found thanks to this archived copy: Conversion de mbox à maildir. Instructions have been abbreviated, amplified, and updated:

  1. Create and open a new Thunderbird profile then close the Account Setup tab

  2. Thunderbird → Settings → General → Indexing → "Message Store Type for new accounts:" → change from "File per folder (mbox)" to "File per message (maildir)"

  3. Thunderbird → Account Settings → Account Actions → Add Mail Account... → set up an email account {this account will use Maildir}

  4. Thunderbird → Settings → General → Indexing → "Message Store Type for new accounts:" → change from "File per message (maildir)" back to "File per folder (mbox)"

  5. Thunderbird → Account Settings → Account Actions → Add Mail Account... → set up a dummy email account by entering a name and email address (e.g., dummy@example.com) → "Configure manually" → INCOMING SERVER: Protocol: POP3 → Hostname: dummy.example.com* → "Advanced Config" → OK {this account will use mbox}

  6. Thunderbird → Settings → General → Indexing → "Message Store Type for new accounts:" → change from "File per folder (mbox)" back to "File per message (maildir)"

  7. Exit Thunderbird

  8. Replace contents of ~/Library/Thunderbird/Profiles/new-profile/Mail/dummy.example.com/ with copy of contents from "~Library/Thunderbird/Profiles/old-mbox-profile/Mail/Local Folders"

  9. Start Thunderbird with the new profile; mail folders from old mbox profile appear under dummy@example.com

  10. Select all mail folders under dummy@example.com and drag to Local Folders, which will copy them into new Maildir-based directories. Compare message counts by enabling View > Layout > Folder Pane Columns.

* Leaving the hostname as ".example.com" creates a hidden folder in ~/Library/Thunderbird/Profiles/new-profile/Mail/, making step 8 slightly confounding.

Related

/misc | Jul 10, 2022

Exporting/archiving email from Mail.app #

Michael Tsai has hosted a long-running discussion on data loss in Mail.app starting in Catalina and continuing unabated through Big Sur and Monterey (I have settled on only moving messages from IMAP servers to local storage via Thunderbird).

Further, Mail's built-in export (and import) methods suffer from various limitations and bugs; the following tests were run under macOS 12.4 and Mail 16.0 (3696.100.31):

1. Mailbox → Export Mailbox...

  1. Creates a single MBOX file containing all messages (actually a slightly nonstandard folder with the mbox file named "mbox" and another file named "table_of_contents").

  2. Pro: Successfully exported all messages.

  3. Con: Attempting to import such MBOX files (containing any significant number of messages) back into Mail generally fails with the following error: Some messages could not be imported. The partially imported mailboxes are located in the mailbox named "Import" in the mailboxes list.

  4. While Mail displayed a count of 4611 messages for the mailbox, 4618 were shown in Claws Mail and Thunderbird after import.

2. Click and drag multiple messages from Mail to Finder

  1. Creates a single EML file per message (converting from Mail's native EMLX format, which stores attachments separately) as opposed to MBOX's monolithic single file format.

  2. Pro: Works on even large numbers of messages (tested on a selection of over 10,000 - see below).

  3. Con: Silently fails to export messages with subject lines 252 characters or longer.

  4. When performed on the aforementioned mailbox (which Mail showed as containing 4611 messages while the exported MBOX file was reported to hold 4618), only 4600 messages were exported. The missing messages all had subject lines over 251 characters in length. This was verified by getting a list of all subjects in the mailbox via AppleScript (which also returned 4618 instead of 4611):

    tell application "Mail" to get the subject of every message of mailbox "foo"
    set subjectList to result
    set AppleScript's text item delimiters to "\n"
    set subject1PerLine to subjectList as string
    get subject1PerLine

    then locating those containing 252 or more characters: grep '.\{252\}' subjects.txt. Sure enough, the difference was exactly 18.

  5. Mail reported 10,663 messages in another mailbox; however, clicking and dragging them to a folder in Finder resulted in 10,672 EML files, indicating once again that Mail has a hard time keeping track of messages.

3. AppleScript

  1. Tom Floeren's 2017 "Export Selected Mail Messages" AppleScript still runs under Monterey, exporting highlighted messages to EML files.

  2. Pro: Truncates subjects/filenames over 180 characters to avoid the con described in 2c.

  3. Con: 31 messages were missing from the export after the script terminated with Script Error: AppleEvent timed out. Happily, this was easily rectified by adding with timeout of 3600 seconds above repeat with i from 1 to count of msgSubjects and end timeout below end repeat; afterwards, all messages exported successfully. (UPDATE: See Michael Tsai's post for another potential issue affecting non-ASCII characters under some circumstances.)

  4. As in 1d and 2d above, 4618 messages were exported from the mailbox which Mail had reported as containing 4611 messages. As a final test, ran this simple AppleScript oneliner to get the number of messages in the mailbox: tell application "Mail" to get the count of messages of mailbox "foo"; the result was 4618.

  5. Updated script:

4. partial-emlx-converter

  1. Open source script that "converts .emlx and .partial.emlx files written by Apple's Mail.app into fully self-contained, 'stand alone' .eml files."

  2. The author, Philipp Katz, relates that "one of my IMAP mailboxes went out of service and I was not able to copy all the messages to a different account with Mail.app, even though all mails and attachments were there (see here for the story). That’s why I created this script."

  3. Pro: Successfully converted all 4618 messages in test mailbox to EML format.

  4. Con: Not native.

/mac | Jun 14, 2022

Virtualizing Linux, macOS, and Windows ARM64 versions on an M1 Mac #

posted to the docs section.

/mac | Jun 11, 2022

Workflow for scanning/digitizing books #

  1. Scan with smartphone or tablet to JPG via vFlat Scan (Android | iOS)
  2. Clean up scans and convert to B&W TIF via ScanTailor Advanced or ScanTailor Universal
  3. OCR and convert to PDF via Adobe Acrobat

/misc | May 20, 2022


Subscribe or visit the archives.