Wednesday, May 01, 2024

The modest changes that would make macOS Photos.app a good app

I've submitted all of these as feature requests to Apple. If you like them please submit too, because we got nothing else.
  1. For any photo show list of albums that hold it. The UI for Contact/Folder relationships would do.
  2. Include Folder name matches in search results.
  3. Port Photos.iOS feature that shows geo view of images for an album to Photos.mac
  4. Provide a list view of images with metadata
  5. When exporting images also export metadata (ideally in image header, otherwise XMP sidecar
There's a few more I need to add but I'll remember them as I work/curse Photos.app.

Not a modest change but great benefits for customers - extend PhotoKit so third parties can fill gaps better.

Monday, March 18, 2024

Visual Studio Code Jupyter Python Extension line wrap in output cell - how to set notebook.output.wordWrap

My Visual Studio Code (Mac) Jupyter extension (plug-in) output was not line wrapped. It was a single unreadable output string. I had to either copy and paste into a markdown cell (where VSC line wrap config is followed) or I had to come up with Python output formatting solutions.

Then I saw a video in which the developer's cell block output was wrapping. So I went looking again. This turned out to be a lot harder than it was, say, 10 years ago. I spent at least 40 minutes, and probably more, digging through obscure corners of the internet

At last I got a hint. There is something called "notebook.output.wordWrap" that defaults to false but can be set true. If you can figure out how to set it.

I couldn't figure out how to set this value for the Jupyter Notebook extension on my Mac however. I got some hints from Microsoft's documentation on editing settings.json even though it's not correct about how to navigate to preferences. I used the ⌘, shortcut. From there I searched for "wordwrap"

You can see the result below. I needed to set Notebook > Output > Word Wrap to true. The copied JSON version of this is "notebook.output.wordWrap": true. You can see the setting in the screen shot below (click for full size).

I set this value for User and Workspace both, I assume Workspace wins but I don't know. Now my output wraps so I can read it.

There's also supposed be a metadata tag that causes a Jupyter notebook cell to scroll output but I couldn't get I too work and it felt too obscure to rely on.

Wednesday, March 06, 2024

Aperture will launch on an M2 Air running Ventura 13.6.3 and will browse an existing Aperture Library.

This was a bit of a shock. Aperture won't run on Intel Monterey without an OS hack (Retroactive). I was cleaning up an M1 Air that had a copy of Aperture on it and on a whim I clicked it. Aperture was there via Migration Assistant. No Retroactive needed.

Aperture launched. No complaints. I could browse my old 600GB Library.

So I copied just the app from my Application folder to an external drive and then launched it on a different M2 Air. Same. Just launched. I could browse and search. Much faster than on my old Air running Mojave.

I have not tried doing anything with it other than search and browse. I'm basically stunned and I figure it could mess up my old Library.

I'm still healing from my years long slog to migrate the Library to Photos.app/iCloud. Being able to browse the old Library is very helpful for understanding what migrated and what didn't. (Yes, Photos.app is mostly a huge regression.)

See also: I shared this on Apple Discussions. I'm curious if Apple will remove the post; they are pretty aggressive about removing posts these days.

Update 3/28/2024: I recently got an older M1 which I updated to Sonoma. Aperture launches and quits on this machine. So now I need to test on an M2 running Sonoma.

Update 3/30/2024: And ... it crashes on an M2 running Sonoma. So this is only a weird curiosity and not very useful.

Tuesday, February 27, 2024

Extracting core concepts with ChatGPT 4 from OCR of scanned sample examination PDF - Feb 2024

I think this is an interesting example of what works and doesn't work on the personal AI front in early 2024.

My son was given a printed practice exam in microeconomics. I wanted ChatGPT 4 to extract and summarize the core concepts. This turned out to require two steps, one of which only worked with Google.

Step One: OCR and download text file

I scanned the document in ScanSnap and produced a scan PDF. I tried getting ChatGPT to do the OCR but it abandoned that task. I then tried Gemini and it told me it didn't do OCR. Next I tried Microsoft Lens, but it seemed to only do OCR from a local image, I couldn't see how to use it with a OneDrive PDF. ChatGPT claimed that I could open a OneDrive PDF in Office 365 Word but that did not work with the web version (perhaps it works with full Word?). ChatGPT did not know of a way to do PDF OCR on Sonoma.

The only thing that worked was Google Drive. It allowed me to open the PDF in Google Docs and then export a .txt version.

Step Two: ChatGPT 4 analysis

I asked ChatGPT 4 to extract the key concepts from the .txt file. It provided a plausible set and then proceeded to answer some of the exam questions. Concepts captured were:
... equilibrium price, consumer's surplus, producer's surplus, total surplus, efficient output levels, negative externalities, deadweight loss (DWL), price ceilings, and the impact of taxes on market outcomes ...

I don't think it added much to the textbook chapter topic loss but it did provide a plausible set of topics to emphasize in my son's studying. I was primarily interested in the workflow today. It will be interesting to look back on this in a year and see what's different.

Wednesday, February 14, 2024

AppleScript to very slowly list the albums a macOS Photos.app image is associated with

macOS Photos.app does not give users a way to identify which albums contain a selected photo. I found a relatively current AppleScript that works in Ventura; in our broken world there's no repository for these things so I've copied it below. You can select a photos then run the script in ScriptEditor or Export as application and run after selecting an image. On a 2023 Air with a large complex library it takes about 40 seconds to show results.

If you wish you can wrap the AppleScript in a Shortcuts.app Shortcut and from there configure it to show in the Ventura Services menu (all shortcuts can appear there).
 
Please submit a feedback request to Apple. Obviously Photos.app should support this function. Sadly, I suspect Apple goes by its usage data and has learned that most users of Photos do not use or create Albums -- or add any kind of metadata to images. So it will probably never be fixed.

Source: https://discussions.apple.com/docs/DOC-250005659
Author: Jacques Rioux, leonie

-- Jacques Rioux's script  https://discussions.apple.com/message/29601534#29601534

-- modified by leonie for Catalina

--  version 1.01, changed a dialog to a notification

-- version 2, added the support to suppress smart albums


-- Select the photo in Photos, then run this script 

-- by pressing the "Run" button in the script editor 

-- or run it from the scripts menu.

-- The script will show first a panel with the filename of the photo it is searching for.

-- Then it will show a second panel with the list of albums. 

-- if you do not see the panels, click the script Editor icon in the Dock, if it is bouncing.


global allalbums -- the list of all albums

global allfolders -- the list of all folders



set NoSmartAlbums to true -- set this to false, if you want to find the smart albums too


--part 1. get the selected photos

tell application "Photos"

activate

-- Add the photo you want to search for to a top level album as the first item in the album

set resultcaption to "Searching for: "

try

set sel to selection

if sel is {} then error "The selection  is empty" -- no selection 

on error errTexttwo number errNumtwo

display dialog "No photos selected " & errNumtwo & return & errTexttwo

return

end try

set imagename to "unknown filename"

try

set target to item 1 of sel -- the image to seach for

tell target

set imagename to the filename of target

end tell

on error errTexttwo number errNumtwo

display dialog "Cannot get the filename of the first image: " & errNumtwo & return & errTexttwo

end try

set resultcaption to (resultcaption & imagename)

end tell



display notification resultcaption subtitle imagename


-- Part 2: get a list of all albums by searching the nested folders

set allfolders to {}

set allalbums to {}



tell application "Photos"

set allalbums to the albums --  collect all albums

set allfoldernames to {}

set allalbumnames to {}

set level to 0 -- nesting level of folders

set nextlevelFolders to the folders

set currentLevelFolders to {}

repeat while (nextlevelFolders is not {})

set currentLevelFolders to nextlevelFolders

set nextlevelFolders to {}

repeat with fi in currentLevelFolders

tell fi

set ffolders to its folders

set falbums to its albums

set nextlevelFolders to ffolders & nextlevelFolders

set allalbums to falbums & allalbums

end tell

end repeat

set allfolders to currentLevelFolders & allfolders

set level to level + 1

end repeat

-- return allalbums --test

end tell


-- removing albums with "smart" in the name

if NoSmartAlbums then

set without_smart_Albums to {}

repeat with a in allalbums

if (the name of a does not contain "smart") then set without_smart_Albums to {a} & without_smart_Albums

end repeat

set allalbums to without_smart_Albums -- to exclude smart albums 

end if


-- From Jacques Rioux's script:

tell application "Photos"

if sel is {} then return -- no selection 

try

set thisId to id of item 1 of sel

on error errText number errNum

display dialog "Error: cannot get the image ID" & errNum & return & errText & "Trying again"

try

delay 1

set thisId to id of item 1 of sel

on error errTexttwo number errNumtwo

display dialog "Skipping image due to repeated error: " & errNumtwo & return & errTexttwo

error "giving up"

return

end try --second attempt

end try

set theseNames to {}

repeat with a in allalbums

try

tell a

if ((the id of media items) contains thisId) then

set theseNames to {the name of a} & theseNames

end if

end tell

--set theseNames to name of (albums whose id of media items contains thisId)

on error errText number errNum

display dialog "Error: cannot get the albums" & errNum & return & errText & "Trying again"

try

delay 1

tell a

if ((the id of media items) contains thisId) then

set theseNames to {the name of a} & theseNames

end if

end tell

on error errTexttwo number errNumtwo

display dialog "Skipping image due to repeated error: " & errNumtwo & return & errTexttwo

error "giving up"

return

end try

end try

end repeat

end tell


if theseNames is not {} then

set {oTid, text item delimiters} to {text item delimiters, return}

set {t, text item delimiters} to {theseNames as string, oTid}

-- return oTid

else

set t to "No album"

end if

activate


set resultcaption to resultcaption & ", found it in these albums:

" & t as string

set the clipboard to resultcaption

display notification resultcaption subtitle "Saved to the Clipboard"


display dialog resultcaption & ", Saved to the Clipboard" buttons {"OK"} default button "OK"

-- you can press the Enter key or the return Key to close the dialog

return resultcaption -- léonie