The Shape of Everything
A website mostly about Mac stuff, written by Gus Mueller
» Acorn
» Twitter
» Pizza Lab
» Code
» Archive
May 16, 2016

Acorn 5.4 was released for direct customers today. This is a feature update, which includes new color profile goodies. The full release notes are available for the details.

But the most amazing holy **** moment happened with this release. I built and submitted it for the App Store this morning.

And then seven hours later it was approved.

Don't forget to go give it five stars on the MAS.

May 16, 2016

Brent Simmons has had some good posts lately on the (lack of) dynamic nature of Swift: The Tension of Swift, A Hypothetical Responder Chain Written in Swift, The Case for Dynamic-Swift Optimism. Manton Reece also has a good take, and Daniel Jalkut is optimistic as always.

Being able to write dynamic, responder chain-like code in Swift or Objective-C (or whatever) is extremely important to me. And if I had to give one reason why it would be this: Dynamic code is less code, and less code means fewer bugs and maintenance.

Here's a simple example. Acorn's canvas class has a neat bit of code where it overrides methodSignatureForSelector:, respondsToSelector:, and forwardInvocation: so that it can either act on a given message or pass that along to the currently selected layer(s). It's 44 lines of code including comments, which I wrote once years ago.

With that in place, I can add a new menu item named "Add Layer Mask" with an action of addLayerMask: and a target of nil. Then in the layer class (or subclass if it's only specific to a bitmap or shape layer) I add a single method named addLayerMask:, and I'm pretty much done after writing the code to do the real work.

When the menu is shown via pull down (or contextual menu, etc.) the responder chain is queried, the frontmost canvas asks the currently selected layers if it responds to this method, and then things go on smoothly as you'd expect from there. Menu items are dynamically enabled or disabled, and then actions are called to perform the method when the menu is selected.

What I didn't add was a giant switch statement like we did in the bad old days of classic Mac OS programming. What I didn't add was glue code in various locations setting up targets and actions at runtime that would have to be massaged and updated whenever I changed something. I'm not checking a list of selectors and casting classes around to make the right calls.

Would a switch statement be faster? Probably. I bet you could shave off nanoseconds. But it's simply not worth it in my opinion.

Other people would disagree of course. But I try to pick my battles wisely.

Would I write dynamic code to do the actual processing of images? Of course not, only an insane person would. Would I use dynamic code for any performance critical path in my application? Again, only crazy people.

Dynamic code lets me cut down on clutter, glue code, and unnecessary boiler plate. It lets me focus on what makes Acorn great and lets me worry about what parts need to be fast and safe. I think making Swift more dynamic, where appropriate, would be a huge boon to app developers everywhere.

May 15, 2016

From my friend Albert: Racism is the bogeyman

"America is not a young land: it is old and dirty and evil before the settlers, before the Indians. The evil is there waiting."

May 13, 2016

Daniel Jalkut: Twenty Years

"This year, many new young people will stare down at the relatively meager salary they’ll be earning, sign away their agreement to start in two weeks, and be in for the twenty-year ride of their lives."

May 13th is an interesting day for myself as well. Eleven years ago, May 13th was the last day that I would ever be working for The Man.

It's also George's birthday. We must not forget that. Happy birthday George.

May 4, 2016

Koka's Beat Machine No. 2

I've never wanted a little CNC machine more in my life. The other videos are great too.

Via Sploid.

April 6, 2016

Sound Off, a non-profit founded to help marginalized people in tech, are raising money to provide live captioning for UIKonf.

If you have some money to spare (and if you're in tech, you do), then why not give a little to help out?

March 29, 2016

From a 2010 article on the 40th anniversary Jimi's death:

"“We started from the premise that music was a mission, not a competition,” says Mayer, who describes himself as a “sonic consultant” to Hendrix. “That the basis was the blues, but that the framework of the blues was too tight. We’d talk first about what he wanted the emotion of the song to be. What’s the vision? He would talk in colours and my job was to give him the electronic palette which would engineer those colours so he could paint the canvas.

"“Let me try to explain why it sounds like it does: when you listen to Hendrix, you are listening to music in its pure form,” he adds. “The electronics we used were ‘feed forward’, which means that the input from the player projects forward – the equivalent of electronic shadow dancing – so that what happens derives from the original sound and modifies what is being played. But nothing can be predictive – it is speed-forward analogue, a non-repetitive wave form, and that is the definition of pure music and therefore the diametric opposite of digital.

"“Look, if you throw a pebble into a lake, you have no way of predicting the ripples – it depends on how you throw the stone, or the wind. Digital makes the false presumption that you can predict those ripples, but Jimi and I were always looking for the warning signs. The brain knows when it hears repetition that this is no longer music and what you hear when you listen to Hendrix is pure music. It took discussion and experiment, and some frustrations, but then that moment would come, we’d put the headphones down and say, ‘Got it. That’s the one.’"

March 29, 2016

Christian Maioli: How to reduce the cognitive load of your code:

Christian provides a good list, and the personal quirks hits a little close to home for me.

"Don’t code 'your way'. Just follow the coding standards. This stuff is already figured out. Make your code predictable and easy to read by coding the way people expect."

I used to do silly little things in my code which I thought were neat (such as using 0x00 instead of nil), but I eventually came around and realized they were pointless and probably confused people. I still come across it in my code every once in a while, and mentally chastise myself before fixing it.

January 18, 2016

For What It’s Worth: A Review of the Wu-Tang Clan’s “Once Upon a Time in Shaolin” by Dan Cohen:

"This is what we know: On November 24, 2015, the Wu-Tang Clan sold its latest album, Once Upon a Time in Shaolin, through an online auction house. As one of the most innovative rap groups, the Wu-Tang Clan had used concepts for their recordings before, but the latest album would be their highest concept: it would exist as only one copy—as an LP, that physical, authentic format for music—encased in an artisanally crafted box. This album would have only one owner, and thus, perhaps, only one listener. By legal agreement, the owner would not be allowed to distribute it commercially until 88 years from now."

Wu-Tang Clan is a national treasure.

January 15, 2016

I've just uploaded a new beta build of Acorn (v5.3b) which includes a feature that has been requested many times over the years: laying out text in a circle.

New and Shiny

With this new feature, I can finally reproduce Flying Meat's logo in Acorn. It always irked me whenever someone would write in asking how to do this, as there is text in a circle in our logo, so it must be possible. But FM's logo was made over a decade ago in Illustrator, years before work on Acorn was started.

Most text features you'd expect work with it. Right, left, and center alignment, and you can rotate the text beyond that as well. Kerning works as expected and Acorn even supports ligatures and gets the selections right with it.

As a first go at this feature, it's pretty good. There are still things to clean up and add to it, but overall I'm fairly happy with it.

And before everyone asks, yes, this is a prelude to text on a curve. That feature won't be making it into Acorn 5.3, but this is a nice step towards it some day. No promises of course.

Want to play with it? Head on over to the latest builds page and grab a copy of the beta.