The Shape of Everything
A website mostly about Mac stuff, written by Gus Mueller
Mar 26, 2014

Wow, over a month since the last progress report. I'm a slacker!

Hello from Mukilteo, WA
OK, I haven't been slacking, we've actually been in the process of purchasing and then moving into a new home. We hope to put the old house on the market real soon now.

Flying Meat's new home base (where we sleep that is) has relocated from South Everett to Mukilteo, WA.

We've still got the office in downtown Everett, and the commute is the same (hurray). But what we get from the move is a nice view and a good school for the little girl to walk to when she gets older.

But what about the pizza oven‽

Everyone I've told seems very concerned about this. I'm sad to announce that Dante (my pizza oven) is staying behind to be loved by the new owners. I'm afraid that trying to move it would destroy it (it weighs over 2 tons) and besides, this is a great excuse to get another one later on this year (I've got some ideas for improvements). In the meantime it's back to indoor oven cooking, and I'm sure I'll be getting more use out of Marvin as well.

Check your QuickLook plugins
I have managed to get a little bit of work done though, mostly in the way of bug fixes for Acorn. One interesting one was in Acorn's QuickLook plugin.

This particular bug came to me when a customer was having big stalls (and sometimes fails) when loading previews of Acorn via QuickLook. The customer was working with 18mp / 500 megabyte Acorn files, and they were taking forever to load. Acorn saves a composite of all the layers in an image as part of it's file format (for quick rendering via QuickLook), so I was surprised that it wasn't speedy. But when profiling the plugin, I noticed that there was a lot of time spent flushing an image in a PDF context. After a bit of snooping I discovered when drawing in a QuickLook context, you can ask the system to make a PDF context or a bitmap context depending on your needs.

Apparently, I made a bad decision a long time ago.

Acorn was using a PDF context, which isn't especially great for bitmap formats (which is what the preview is stored as). I changed things around so that QuickLook made a bitmap context for rendering (by one of the parameters in QLPreviewRequestCreateContext) and this made things go way faster.

I'm not sure why I originally chose the PDF context. Acorn used to be vector only, so it's possible that's why I made PDF context decision many years ago. Anyway— things are better for the next release of Acorn (which will be version 4.4. Grab a latest build if you'd like to play with it).

I also took the opportunity to make one other change for previews— and that was adding a thumbnail composite to .acorn files (if the image is above 256x256 pixels). In the case of RAW files (which are usually huge), it was pretty dumb for Acorn to load up a 18MP image to render into a 128x128 square. So now the thumbnails show up super fast if there's the thumbnail cache. This is only for files saved in Acorn 4.4, otherwise it'll fall back to the full image composite.

FMDB stuff
In the 2014.02.15 progress report, I mentioned that I needed to bring back some wait loops for handing locks on the database.

I wasn't really looking forward to this changes since it added complexity to FMDB that I honestly thought SQLite should be doing for me. Then I discovered sqlite3_busy_handler, which is a built in function to SQLite, and which lets me do away with the retry loops.

Awesomesauce.

This new code is on a branch ("busyloopback") and I'll be bringing it over to mainline after I've used it for a while in Acorn.

Cocoa Script
I put up a dev build of the current sources here: http://jstalk.org/download/CocoaScriptPreview.zip. Eventually I'll do things like setup a real website and such - but I've got boxes to unpack and things to fix right now.

Feb 25, 2014

Another week or so, another post on what I've been up to.

Acorn 4.3 is out
We pushed out Acorn 4.3 yesterday for direct customers, and then 4.3.1 a few hours after that. (App Store versions will be coming soon).

Acorn 4.3 has a bunch of bug fixes, and new RAW import features (along with speed improvements). The release notes are available as usual.

Why so quick release of 4.3.1? I belatedly noticed a regression when fixing a brush bug. If you used a tablet and had pressure sensitivity turned off, the first dab of your brush stroke would be clipped incorrectly. This made for a funky looking brush stroke.

It was a super easy low risk fix, so I pushed it out quickly.

Work on Acorn 4.4 continues, and I'll begin pushing up betas of that soon enough. I managed to squash some memory leaks when driving Acorn with Cocoa Script, as well as some misc bug fixes (Project Oak now stands at 42% done). No new big features yet.

I also played around with Cocoa Script "shaders" for shape graphics in Acorn. This won't ship in 4.4 (or maybe ever?), but it was fun to code up and might be something awesome some day. How it works is a little hard to explain, but I'll try. Basically, instead of a rectangle having just a stroke and a fill when it draws, it will call a snippet of Cocoa Script code in place of the normal drawing routines. That snippet of code then has access to a bunch of libraries, and can do whatever it wants in the context it is drawing into. The following example draws a rectangle with a gradient, draws a border around it, and also draws a lighter border on the inside of the shape.

shaders
Click to embiggen.

Normally you'd need at least two different shapes in Acorn to draw something like this. This is future stuff certainly, and probably doesn't even make sense in Acorn. But the programmer in me thinks it is kind of neat.

FMDB Stuff
Guilherme Mogames wrote a tutorial for using FMDB with SQLCipher. This comes up every once in a while on the FMDB mailing list, so it's nice to see someone publish this.

Other Stuff
I've been playing with Nanoblocks recently. They are essentially teeny tiny legos- so small in fact that it's sometimes wise to use needle nose pliers to work with them. It's a nice relaxing change from coding all day. It's also nice to see Ohio Art is still around.

My new Mac Pro finally arrived as! What a game changer this is— everything is buttery smooth and fast, and being able to run OS X in VMware without any annoying lags is worth it alone. It makes testing Acorn on clean builds of 10.8 and 10.9 pain free. I love it, and recommend that everyone get their own. Maybe if it becomes mass market, that'll drive the price down?

*crickets*

Anyway, till next time.

Feb 17, 2014

Worlds development blog ▸ Drawing as a programmer:

"I started sketching again. At first I did it after job hours, in my spare time, but then I noticed that, after acquiring some basic knack, I can draw simple sketches quickly, so I tried to have drawing breaks when I got stuck with a new coding problem in my head. And to my surprise, my productivity rose."

See, I'm not crazy (about this anyway).

Feb 15, 2014

Acorn Stuff
Acorn 4.3 has entered beta status. You can download it from the latest builds page, and of course read the release notes.

There's some good new features (mostly RAW import stuff), as well as a bunch of bug fixes and a few minor changes.

I've also already started on 4.4, which is going to focus mostly on bug fixes as well (hello Project Oak!). I'm also hoping to get in some performance improvements that I originally wanted to do for 4.2.

Speaking of Project Oak— I'm 42% of the way there. I got to close a bunch of bugs since the last report, mostly because some bugs had already been fixed but I hadn't ever closed the issue. And there were a few things that were categorized as bugs, but were really feature requests.

Which brings up an interesting question- what is a bug? From Acorn's POV, a bug is something that is supposed to work but doesn't. Things like drawing artifacts showing up when you move a bezier curve, or maybe merging layers causing things to be flipped around. Those are bugs. But things like "doesn't open PSD CMKY layers" or "can't left align multiple bitmap layers" aren't.

Sure, there are things that Acorn really should be doing, but that's not a bug. A bug is something that doesn't work correctly.

Other Acorn Stuff
Wim Lewis from the OmniGroup started a little project for converting Acorn files to SVG. Which is awesome, and hopefully I'll use that someday to kickstart SVG support directly in Acorn.

FMDB
When I discovered that SQLite had its own code path for timing out when the database is busy, I ripped out FMDB's version and deleted the while loops that would make things pause and retry the query. Which was a mistake— FMDB still needs the loop to retry. So I'm working on bringing that back.

I had a little internal crisis with this though. How does FMDB break out of that loop if the database is perpetually locked (such as from another process)? Well, I think I'll end up adding a timeout variable which will be an NSTimeInterval, and check that in the loop for breaking out.

And then what about NSError? Yea, that's going to have to be done as well- you can read about ideas for it in a GitHub thread.

I have no idea what this API is going to look like. I just know that I don't want it to be ugly, and that's going to be hard to do. This will all probably be done in a version 3.0 (and it will most likely be backwards compatible as well).

A Random Acorn Tip
Did you know you can enable Acorn's precision brush mode (aka, 3x slowdown in mouse movement) temporary by clicking down on the mouse, and then pressing the space bar immediately after that? It's pretty awesome if you need precise brush strokes with the trackpad or mouse.

Feb 14, 2014

busblog: if uber wanted to make a commercial they shoulda filmed tonight

"it was 11pm and i was basically home and i had made $50 and my car smelled of young swedish college girls."

I've been a fan of Tony Pierce since forever, but since he's been making a little bit of money on the side as an Uber driver… well I've been loving his blog two million and one point four percent more.

Feb 14, 2014

Need something to listen to this weekend? I've got two recommendations for you.

First up is the latest Debug episode: Mike Ash on VoodooPad.

And then you can listen to me yammer on The Record: Seattle Before the iPhone #4 - Gus Mueller.

The interview with me was done this past summer, before the sale of VoodooPad. Which makes these two episodes an interesting juxtaposition.

Feb 12, 2014

Malcolm Jones in The Daily Beast: There’s Nothing Wrong—and a Lot That’s Right—About Copying Other Artists:

"Copying, like rote memorization, is no longer in fashion. For centuries, student artists copied plaster casts and worked up variations on images of the Holy Family. The job then was as much craft as art. Then came Romanticism and the cult of self, which needed to be expressed. Then Modernism blew the doors open with its insistence on constant change that now permeates—and rules—every corner of the creative world (Ezra Pound’s dictum, “Make it new!” might as well have an “Or else!” tacked on). And that’s fine if you are a true artist. Alas, most of us aren’t, so when our puny efforts at creativity fall short, we feel like failures and quit before we’re out of grade school. Ever thereafter, we regard art as some mysterious, gated territory where we cannot go. Somehow I don’t think that’s what our teachers intended."

I love copying other people's work. You learn about the process, you notice details that you wouldn't have otherwise, and it's fun. Eventually, your own work gets better as well. I've done this for years with guitar solos, with computer programs, and more recently (well, over the past couple of years) with sketching.

There's nothing wrong with this— just keep it to yourself. And if you do share, don't claim it as your own. It's as simple as that.

When I was working on the bezier tools for Acorn 4, I would keep an eye out for awesome vector art and try to re-make it in Acorn. At times I found Acorn's tools lacking so I would tweak it or add new features. And that's the primary reason Acorn's vector tools got a big jump in version 4.

Feb 2, 2014

I was watching Felix Baumgartner make his awesome jump in Red Bull Stratos - The Full Story, and at 1:30 into the video it starts showing computer high tech goop for dramatic effect and then all of a sudden WAS THAT AN OS X CRASH REPORT IN THE BACKGROUND?

felix
Click to embiggen.

Why yes, yes it is. And one that I recognize very well.

I don't know what the app is (looks like it's version 7.0.1 of something (they've doctored it up a bit)), but the crashing app is using OpenCL, and it's crashing in the CL runtime.

For a long time, something like this was Acorn's #1 crasher. So I'm going to guess what the crash is (thought since I can't see thread #2 which it is crashing on, I can't make a very good guess).

OpenCL lets you compile your cl kernels into bitcode ("offline compilation"), making it easier to ship your app without source files stored as plaintext somewhere on disk or in your binary. This is kind of awesome.

So Acorn took advantage of this, and all was well with the world.

Then Apple shipped a system update which broke it. And not just a little runtime error where the kernel won't load, but it ends up crashing your app instead. Using Acorn's flood fill, instant alpha, or magic wand tool would cause a crash on some machines.

sigh.

It's actually still my number one crasher. I fixed it a long time ago (by not using the offline cl compiler anymore) but not everyone updates their apps - so I still see these crash reports coming in. Radars have been filed, but the bug still lives on. And now it has even made its way to YouTube.

Jan 27, 2014

One benefit from writing the last progress report was a nice overview of what I've been working on in a small (but not too small) timeframe. Every day I code just a little bit and from my viewpoint it doesn't seem like much, but put it all together over a week or two and they are almost mini-milestones which are fun to look back on.

I like that, so here's another one.

Acorn
Work on the next release of Acorn (v4.3) continues (and if you want to play along, it's available from the latest builds page).

Since my last progress report, Acorn's raw image import has received a bunch of new things- a new histogram, a new noise reduction slider, better width / height setters, and you can choose the color profile to open it in. I also added a pixel depth option (previously it would just use the highest depth available, which was usually 16 bits per channel).

raw import

There were of course other bug fixes, and work on making Quartz Composer filters work better in Acorn was also completed.

Acorn 4.3 has also updated to the latest JSTalk / Cocoa Script framework, fixing memory leaks and adding @include support (sort of like C's #include). In addition to that Acorn also picks up new coscript code which can throw up a dialog box with input- an example of this is available.

The Cocoa Script scripts can now work on bitmap selections as well, thanks to a new scripting API in 4.3. Pixelate Selection.jstalk shows what is involved (it's really just a new method called applyCIImageFromFilter:shouldClipToSelection:). This new API was prompted by a post from Dr. Drang who made a crazy Keyboard Maestro action to do the same. I thought it should be easier for scripters to write such script, and I knew it would be super easy to implement. So there it is.

Lastly, an update on "Project Oak" (as mentioned in my State of the Meat 2013 post, this my work on fixing all known bugs in Acorn). Instead of giving out absolute numbers for progress, I've set a high point for the bug count. And so based on that number and the work I've done since then, 6% of open bugs have been closed. Since I report little bugs to myself every day, and new ones come in from outside bug reports, and fix them as as I go… I think giving a percentage will be more useful than "I filed 4 new ones and fixed 6, out of 4 billion total". Progress!

FMDB
Mike Ash recently contributed a nice little patch to FMDB which will call assert() if you try and recursively use FMDatabaseQueue's inDatabase: method. Previously FMDB would just block, and if this was on a background thread you'd be left wondering why work wasn't happening.

(When I originally glanced at the pull request from Mike, I was worried he was attempting to make it so FMDB wouldn't block on recursive calls. And I really didn't want to have to tell him that "no, this is kind of a bad idea" - but then I read the patch and smiled. Mike's a smart guy, I don't know why I doubted him.)

Lift
Lift has had some small updates based on feedback from Guy English and Manton Reece. Nothing big, but work on Lift is still ongoing.

Progress!

Jan 17, 2014

Two new app releases this week from some friends.

First up is Glassboard 3.0 from Second Gear:

"Recently we announced that we had acquired Glassboard from our friends at NewsGator. Since then we have been hard at work on an update to Glassboard for iPhone to bring it to iOS 7. I’m happy to announce that Glassboard 3.0 is now available on the App Store!"

You might remember that Justin Williams of Second Gear took over Glassboard development last December. I'm happy to see a new release of this great app.

Next up is Sunlit from Riverfold:

"Sunlit isn’t for all of your photos. Just the best ones. It’s for the photos that tell a story. In Sunlit you create stories that combine photos, location check-ins, and text. For trips, events, or any memories. You can share them with friends and everything syncs automatically"

Two solid devs, Manton Reece and Jonathan Hays are behind Sunlit. See also Manton's post on why they built Sunlit.