Saturday, March 06, 2021

Picture This

If you're like me, you've got sticky notes covering every inch of every service of your vast empire.

If you're really like me, those sticky notes are all virtual. Mostly they take the form of "hey Siri, remind me in an hour to do a thing." They end up in my Reminders app and I can route them to whatever todo app they belong to.

The Apple Watch makes that super convenient. Raise your wrist, speak the magic phrase (or hold down the giant button) and remember to include a time, so it will put a badge on the reminder app.

Sometimes, though, there's a glitch. From Apple, can you even believe it? If Steve Jobs were alive, this would be solved by now, but he's not, and that's just how life goes.

Uh oh, something's wrong. Please try again. Oddly enough, if you try again, it will work. But if you've said something brilliant and you're not sure you can re-create it, here's a way to capture it: Apple Watch Screen Capture.

So it turns out that if you press the two buttons on the side of your Apple Watch, it will take a screenshot. I think you have to go to settings to enable that, which you should do before you need it, right? This will show up in your Photo Library as a PNG. And now you've got your brilliant utterance, or whatever gibberish Siri thinks you said.

And if you're like me, you've got a reminder to look at your Photo Library every now and then, because otherwise who knows when you'd ever see it, right?

Monday, February 22, 2021

Play my slides, please!

Did you ever need to take notes while you watch your slides play, but you don't want to switch back and forth between your Keynote and your text editor? Here you go... Save this to your Mac as main.swift - no other name will work, then run it in a terminal like so:

$ swift main.swift


import Cocoa

var pid = pid_t(-1)

let bid = "com.apple.iWork.Keynote"

for x in NSWorkspace.shared.runningApplications {
    if x.bundleIdentifier == bid {
        pid = x.processIdentifier
        break
    }
}

guard let keynote = NSRunningApplication(processIdentifier: pid) else {
    print("Can't find Keynote")
    exit(-1)
}

let src = CGEventSource(stateID: CGEventSourceStateID.hidSystemState)

let key: UInt16 = 0x79

guard let keydown = CGEvent(keyboardEventSource: src, virtualKey: key, keyDown: true) else {
    fatalError("Can't get keydown")
}

guard let keyup = CGEvent(keyboardEventSource: src, virtualKey: key, keyDown: false) else {
    fatalError("Can't get keydown")
}

while (true) {
    keydown.postToPid(pid)
    usleep(10_000)
    keyup.postToPid(pid)
    usleep(15_000_000)
}

Monday, February 15, 2021

Creating a CloudKit Container

I was working through a CloudKit tutorial and needed to create a container for my app.

I tried clicking the + button to create a CloudKit container from XCode 12 directly, but nothing happened.

So I clicked the CloudKit Dashboard and could see there were no containers.

I tried to create one. I entered iCloud.com.domain.app (reverse URL format) and gave it a name. Then I got an error message in red, "Unable to find a developer."

OK, well I'm logged in as the Account Holder, not as a Developer per sé, but this should work. Kept trying. Nothing.

So I tried something a little crazy: I went to the Certificates, Identifiers & Profiles section of App Store Connect. I created an identifier for the container I was trying to create.

After I did that, I went back to XCode and clicked the plus (+) again. Lo and behold, the container I had specified in the identifier I had created, all of a sudden showed up.

Will this work? Time will tell. But if you're getting the same error trying to create a CloudKit container, maybe this will help.

If so, you can buy me a beer!

😀 🍺

Saturday, July 25, 2020

The Power of VS

I'll never forget the day my friend who worked at Microsoft sent me a present - it was the full set of discs for Visual Studio. I don't even remember all of the things I could install. Visual C++ was the main thing, of course. 

But no, not today - not that VS. I'm talking about the "vs" that's short for "versus" - which is Latin for "against"

Did you ever want to look something up, but you don't even know what you're looking for? But you know about something else that's like it.

Take Visual Studio, for example. What's out there in the world that's like Visual Studio but isn't Visual Studio?

Try this: go to the browser and type, "visual studio vs" - don't hit enter, just let the Google think about it.


Unless, I suppose, you've got predictions turned off, you'll see all these things that somebody thinks are like Visual Studio. My personal favorite is up there twice: that's right, PyCharm and IntelliJ, both by JetBrains. They are pretty much the greatest thing since... 

Yes, by all means do ask the Google about "sliced bread vs"

Monday, July 20, 2020

Soup: Split Pea With Chicken

There comes a time, usually in the summer, when the freezer becomes overrun with chicken bodies. That time was today.

And nothing in the fridge for lunch. But I've got a package of split peas in the cupboard. Who cares if it's 90 degrees outside? Let's make soup!

Three chicken bodies and 6-9 cups of water, depending on how thick you want your soup. Simmer for an hour. Cool for a few minutes, then pick some chicken off the bones. [update: I tried 6 cups, I think 7 might be better]

Chopped/sauteed about a half onion from the fridge's veggie drawer in a couple TBS of buttery.

Add back the broth and chicken, plus the split peas. Bring back to a boil, simmer for an hour or so. [update: I tried to get away with simmering for just 30 minutes, but I think at least 40-45 might be needed]

Salt and pepper to taste.

Tuesday, May 26, 2020

Switching Java Versions

Believe it or not, I was unfamiliar with this way of switching Java versions:

$ export JAVA_HOME="$(/usr/libexec/java_home --version 1.8.0_251)"

Hope this helps somebody!

(because I know that someday that somebody will be me!!)

Sunday, May 17, 2020

30-Day Song Challenge

I keep seeing the "30-Day Song Challenge" on Instagram Stories. I'm terrible at Instagram, so I probably won't be posting my own selections. But when I googled what all the 30 days were, I kept seeing post after post on these nothing-but-ads sites. Well here they are, and I'll upload the graphic, too - tap it to get it full sized.

1. A song you like with a color in the title
2. A song you like with a number in the title
3. A song that reminds you of summertime
4. A song that reminds you of someone you'd rather forget
5. A song that needs to be played loud
6. A song that makes you want to dance
7. A song to drive to
8. A song about drugs or alcohol
9. A song that makes you happy
10. A song that makes you sad
11. A song you never get tired of
12. A song from your preteen years
13. A song you like from the 70s
14. A song you'd love to be played at your wedding
15. A song you like that's a cover by another artist
16. A song that's a classic favorite
17. A song you'd sing a duet with on karaoke
18. A song from the year you were born
19. A song that makes you think about life
20. A song that has many meanings to you
21. A song you like with a person's name in the title
22. A song that moves you forward
23. A song you think everybody should listen to
24. A song by a band you wish were still together
25. A song you like by an artist no longer living
26. A song that makes you want to fall in love
27. A song that breaks your heart
28. A song from an artist whose voice to love
29. A song you remember from your childhood
30. A song that reminds you of yourself