The Shape of Everything
A website mostly about Mac stuff, written by Gus Mueller
» Acorn
» Retrobatch
» Twitter
» Micro.blog
» Mastodon
» Instagram
» Github
» Maybe Pizza?
» Archives
» Feed
» Micro feed
Shoutout to the Core Image Team

I want to give a shoutout to the Core Image team at Apple. MacOS 10.14 Mojave was released today, and in the over 10 years I've been developing Acorn, this has got to be the smoothest and most bug free release day for the Core Image framework I've ever seen.

So many thanks. Most folks won't know or care, but this graphics API guy certainly did.

FMDB Ships in MacOS and iOS

It's not a huge thing, but it puts a smile on my face. Piggybacking on the Apple News app, FMDB is now shipping in MacOS Mojave starting today, and has been shipping as part of iOS for a number of years. That's my software being used on a lot of devices.

Xcode Unit Testing Shortcuts

I’ve not had a chance to use the latest (within the past 5 years or so) built in Xcode unit testing frameworks, because my needs are pretty specialized. I tend to build my own.

But I’ve been using the stuff in Xcode 10, and it’s pretty dang great. ^⌥⌘G & ^⌥⌘U? Wonderful.

Is Mojave 10.14?

On Apple's MacOS Mojave page, there's no mention of 10.14 anywhere on the page. I find that interesting, and I can't remember if this was the same for previous OS releases.

September 19, 2018

Every couple of years I'll read through a favorite book of mine, Code: The Hidden Language of Computer Hardware and Software. I originally bought it in 2003, and the first time I read Code I couldn't get through it. A bunch of the concepts were over my head and I just didn't grasp certain ideas. Which made me feel a bit stupid because supposedly I was a professional computer programmer. A self-taught professional programmer, but still a programmer.

But if I'm anything, it's stubborn and determined. So I read it again after having more experience and I got farther this time, understood more, and even had a bunch of aha! moments. Things that I sort of knew and kind of understood at the lower levels of the computer clicked into place.

And then later on I read it again and understood more.

Lately I've been having the itch to read it again, but then I thought maybe I'd try something else. Why not do some real coding around some lower level stuff that I kind of understood, but don't completely get? What about libffi?

I've run across libffi before when working with Mocha, which is a JavaScript to Cocoa bridge that my project Cocoa Script uses. libffi is not as low level as you can get, but it is interesting because you get to deal with things like making room on the stack for returning values from functions. You also get handle a bunch of pointers and deal with memory alignment and other fun things that the compiler usually just handles for you. So as a side project, this might be a fun learning experience.

Plus, JavaScript is an important feature of both Acorn and Retrobatch, and probably even more so in future versions of Retrobatch. If it's going to play a big part of Retrobatch I really want to know it through and through and I want things structured the way my particular brain works.

So that's how FMJS was born. It's very incomplete, but it's a start. In fact, just yesterday it could finally load up Core Image and use a filter.

It's also been educational and interesting. And it helps that it's useful too.

September 14, 2018

I've been working on new JavaScript to C/Cocoa bridge lately, for fun and education. And I made an interesting discovery today- NSNumber stores shorts and unsigned chars the same. Is this a bug in NSNumber? Consider the following code:

printf("@encode(short) %s, %s, %c, %lu\n",
        @encode(short),
        [[NSNumber numberWithShort:'a'] objCType],
        _C_SHT,
        sizeof(short));

printf("@encode(char) %s, %s, %c, %lu\n", 
        @encode(char),
        [[NSNumber numberWithChar:'a'] objCType],
        _C_CHR,
        sizeof(char));

printf("@encode(unsigned char) %s, %s, %c, %lu\n", 
        @encode(unsigned char),
        [[NSNumber numberWithUnsignedChar:'a'] objCType],
        _C_UCHR,
        sizeof(unsigned char));

Outputs:

@encode(short) s, s, s, 2
@encode(char) c, c, c, 1
@encode(unsigned char) C, s, C, 1

I'd love to update this post if anyone has any ideas why this happens.

OK here's that update:
NSNumber is most likely built on top of CFNumber. And CFNumber doesn't support unsigned char- so it bumps the storage up to a signed short (from 8 bits to 16) in order to keep from rounding over. The same thing occurs for unsigned int:

printf("@encode(int) %s, %s, %c, %lu\n",
        @encode(int),
        [[NSNumber numberWithInt:1] objCType],
        _C_INT,
        sizeof(int));

printf("@encode(unsigned int) %s, %s, %c, %lu\n",
        @encode(unsigned int),
        [[NSNumber numberWithUnsignedInt:1] objCType],
        _C_UINT,
        sizeof(unsigned int));

printf("@encode(long long) %s, %s, %c, %lu\n",
        @encode(long long),
        [[NSNumber numberWithLongLong:1] objCType],
        _C_LNG_LNG,
        sizeof(long long));

Outputs:

@encode(int) i, i, i, 4
@encode(unsigned int) I, q, I, 4
@encode(long long) q, q, q, 8

Why long long and not long? Because on 64 bit sizeof(long) is the same as sizeof(long long)

Dark Aqua for Automator Actions

Here's a Mojave tip. Your Automator actions are going to want to support dark mode. Luckily this is super easy to do just by adding the following to your action's Info.plist:

    <key>NSRequiresAquaSystemAppearance</key>
    <false/>
My Guitar Amp Broke

My guitar amp (original Fender Blues Deluxe) is broke. I'm bummed. I'm sure it can be repaired but I've been playing it for almost 25 years and I miss its sound already.

I guess I get to mess around with digital audio again (via my old Line6 UX2). And since it's so easy to make recordings with it, here's a little bluesy afternoon noodling.

Carpets

We got our carpets cleaned yesterday, which meant we had to move everything that was on the fuzzy stuff somewhere it wasn't. So currently my office is upstairs on our main living room, which is part of the kitchen. Hardwood floors.

I feel like this is what it must be like to live in a tiny house, and I like it!

Right after dinner I could pop over to the computer and check something, or while making lunch I don't have to travel up and down stairs to send a quick email. It's all right there. I'm sure it's not a healthy life balance and I'll probably be moving back downstairs tonight or tomorrow, but it's fun in the meantime.

September 7, 2018

Here's something new for your lazy August September* morning: Retrobatch 1.1 is out.

What's new and awesome? Well, Retrobatch now has some great scripting goodness in the form of a new Automator action which will run a workflow for you (and create Automator droplets), a new JavaScript node*, and the ability to run Retrobatch workflows from the terminal.

We've added a handful of new nodes such as Dither, Auto Enhance, Instant Alpha, and Color Posterize. New options to existing nodes have also shown up, such as "Only scale smaller" for the Scale node.

And an interesting idea that I've had folks ask about a number of times- it's now possible to run an image through a machine learning classifier, and then have the classification written to metadata such as the image title, or keywords. This was done by adding token support to the Set Specific Metadata node. This also means you can use other tokens such as the Current Year in metadata fields. Awesome? We think so.

The full release notes are available, and if you have ideas or questions- make sure to poke around on the forums or write us: support@flyingmeat.com. We've got lots of ideas for future releases, but if you'd like something specific in there make sure to let us know.


Whoa, it's September already?

*
I'm calling the JavaScript node a "preview". It works very well, but I'm not 100% sold on the API that I've provided to folks. So this is a disclaimer that it might change a little bit in the future.