Category: Macintosh

  • Notarization …

    Apple is really pushing the whole notarization thing right now.

    It does seem a bit like the apocryphal story of boiling the frog, adding small additional restrictions on software freedom each year until the whole platform is under absolute control. (I really, really hope that’s not what’s happening)

    At a practical level, I’ve been working away on implementing notarization with SQLEditor, which has caused some issues because of some of the dependencies that are used.

    Even the Sparkle application updater requires some tweaking to the signing, which seems surprising, and the bundled Java had some issues too.

    10.15 seems to be requiring notarization on newly built apps and I’m hoping to get a better view of the new operating system as soon as I can get the new beta running in a virtual machine. (Maybe Apple could build some virtual machines and save some time here?)

    So there’s been a bit of a gap in the release schedule and some of the new work that’s been going on has been delayed. But unfortunately this has to take priority at the moment.

    Hopefully I can get this stuff finished soon and work can continue on more interesting things.

  • [NSColor highlightColor] differs in dark mode

    I noticed a point today while working on dark mode for Mojave 10.14.

    The value of -(NSColor*)highlightColor differs depending on whether you’re in light mode or dark mode.

    This particularly affects -(NSColor *)highlightWithLevel:(CGFloat)val;

    By calling:

    [[NSColor highlightColor] colorUsingColorSpace:[NSColorSpace genericRGBColorSpace]];

    I was able to grab the highlight colors in light mode and dark mode. I converted the values to hex and they are displayed below:

    Light Mode:

    (White)

    Dark Mode:

    (Gray-ish)

     

    Highlight color is noted as for “The virtual light source onscreen”, but it is occasionally suggested for providing slight variations on a drawing color.

    Which is great, except that because the output differs between light mode and dark mode, you can’t now use it anywhere within a drawn document unless you want things to look different between the two display appearances.

    In the end I replaced the method call with this new code:

    NSColor* color = [NSColor redColor];
    CGFloat fraction = 0.7;
    NSColor* newColor = [aColor blendedColorWithFraction:fraction 
       ofColor:[NSColor colorWithCalibratedWhite:1 alpha:1]];

    I also produced a roughly equivalent swift version:

    import Cocoa
    
    let color = NSColor.red;
    let fraction = 0.7 as CGFloat;
    let newColor = color.blended(withFraction: fraction, of: NSColor.init(calibratedWhite: 1, alpha: 1));
    
    print(newColor?.description ?? "invalid color");
    

     

    See https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/color/

     

  • SQLEditor 3.0 release

    SQLEditor 3.0 is ready!

    I’ve feel like I’ve been working on this for ages, so I’m really happy that it’s now ready.

    The most visible change is the new user interface, which has been merged into a single window. Single window interfaces are something that I wasn’t initially convinced by, I liked palettes and life was good. But since then, I’ve come to see the benefits of the single window. Keeping the panels in a relatively fixed position means that you know where they are. There’s also less busy-work managing the panels.

    The tradeoff is obviously that it’s less flexible and on a large screen it can lead to more and larger mouse movements. Feedback has generally been good on this, I don’t think there have been any complaints (so far). If you have an opinion on this please do send in comments!

    For me the most interesting new feature is the Javascript plugin system. Export dialects can now be written in Javascript. You can even edit them while SQLEditor is running and see the results immediately.

    The new plugin system grew out of the report generating code (also new in 3.0) which was targeting html and using a javascript template language. But then I started looking at this code and realised that there was no reason that export dialects couldn’t be in Javascript as well. The difference between a report and an export is minimal. Both take a data structure and return a string (or possibly a file).

    So far all of the built in dialects use native code, but my eventual plan is to convert them to javascript too.

    Early code for my own javascript version of the SQLite dialect is already up on Github and further progress is planned for this.

    There are lots of other improvements in SQLEditor 3 and I hope to write further about them soon.

    Or see for yourself 🙂

    SQLEditor 3 Download (58MB zip)

     

     

  • Apple Developer Program improvements

    Apple has made some big changes to their developer programs, which I think are a big improvement:

    1) You can now apparently develop and deploy to your own iOS device without a program membership. (Possibly only with Xcode 7, I’m not perfectly clear yet). This is a big win for casual developers and people just getting started.

    2) There is now a single developer program combining iOS and OS X which is much simpler and cuts the price in half if you subscribe to both

    3) The safari extension program is being merged in. This possibly isn’t so great if you were solely doing safari extensions, because now you may need to pay. But if you are doing other development anyway, then it’s a simplified approach (only one program to deal with and remember to renew)

    Overall big changes and a strong improvement in most areas.

    I’m also hopeful about the new OS versions too.

     

  • Is Yosemite going to be released today?

    October 16th has arrived, the Apple event is scheduled. Will this be the official release date of Yosemite? Enquiring minds want to know…

    update: yes it looks like it will be

  • Webkit Javascript Optimizing JIT compiler(s)

    Is your JIT compiled javascript function running too slow?
    No worries, just wait and the javascript engine will recompile it and then replace the function with a faster version!

    But that’s not fast enough either?
    Webkit will compile another version using more optimizations, using code from LLVM.

    Is the function still executing some long running loop?
    No problem! The javascript engine will copy all of the current state and build a new compiled function that starts at the beginning of that loop, then replace the old slower function with the new one, while it is still running!
    It gets flipped over at the beginning of the next run through the loop.
    (see the Hot-Loop Transfer section of the original article)

    Just from the description, this sounds stupendously complicated. But the performance improvements are apparently quite considerable.

    I’m truly impressed by the effort that goes in and the work that’s been done on this.

    🙂

    Read the original post for the full details:
    https://www.webkit.org/blog/3362/introducing-the-webkit-ftl-jit/

     

  • SQLEditor 2.7 – the customizable object palette

    The newest and latest feature to arrive in SQLEditor 2.7 [55MB Zip] is a customizable object palette.

    For a long time, the object palette in SQLEditor has looked like this:

    Old Palette (pre 2.7)

    There were three fixed objects, that could be dragged from the palette into the document. The images have changed, but the basic functionality is little changed from v1.0, which also had a three object palette that worked like this.

    In version 2.7 though, there is a new palette, that initially looks like this:

    New palette in default mode

    It doesn’t look that much different at first, however it’s much more than it used to be.
    The biggest change is that you can now add your own items to the palette.
    To add an object, you can hold option (alt) and drag it to the palette.

    alt+drag

    SQLEditor create a new palette item, with a small preview of the objects. You can rename the item by double clicking on the label. Or delete it by right clicking and choosing delete.

    You can also add palette items from the clipboard. Add items to the clipboard using the normal cut or copy commands, then click on the small gear icon in the bottom left to see a menu. The New from clipboard command adds the contents of the clipboard as a new palette item.

    Or use the gear icon menu to add from the clipboard

    You can the use the new palette item just like the default ones. The palette item contains a copy of the original objects, so you don’t need the original document they came from.

    There are lots of possible uses for this, the obvious one is templates for tables. If you frequently create the same kinds of databases, you’re probably also creating the same kinds of tables.

    For example, there always seems to be a “user” table, with a fairly similar set of columns. In the above example the user table has been added and now we can instantly create a user table in a single action that contains the four important columns in every user table: unique id, first name, surname and shoe size. You can also set things like table type=INNODB, or set colors and styles (although not yet object labels).
    SQLEditor will save the objects and bring it out ready for use.

    You can also add groups of objects, including any relationships between them.

    This feature has been on the wish-list for some time, I’m glad it’s now finished and I hope that people will like it.

    SQLEditor 2.7 is available now via the in-app update system or from the website:

    SQLEditor 2.7 [55MB zip, 10.6.8+]

  • Using NSDockTile for debug info

    Often when I’m working on an app or something I end up running several different versions of it in a short period of time. There’s usually some bug that I’m trying to fix and I want to make sure that the bug occurs in the old version and doesn’t occur in the new version.

    Sometimes though I get confused which version I’m running. Is the app in the dock the old version, or the new version or something else?

    So today I had an idea: Why not put the version number on the dock tile?

    Here’s the code to do it:

    if (DEBUG) {
      id badgeText = [NSString stringWithFormat:@"D-%@",[[[NSBundle mainBundle] infoDictionary] valueForKey:@"CFBundleVersion"]];
      [[NSApp dockTile] setBadgeLabel:badgeText];
    }

    This assumes that you’ve got DEBUG defined somehow and that you have an infoDictionary with the relevant keys and values set.

    And here’s what it looks like in the dock:

    Regular version on the left, development version on the right.

    I’m not sure how useful this will actually be, but it seemed a handy trick for development.

  • Web Development Toolkit

    HTMLValidator is one of the apps in the new Web Development Toolkit bundle, which is available now.

    The bundle contains 10 apps for a single low price of just $39.99
    If you’re doing web design, there’s probably something here for you
    (unless you already own all the apps, in which case, it also makes a great gift)

    The bundle includes:

    The offer is running until December 28th, so you will have to be quick, or you might miss out!

  • Versions, validateMenuItem: and NSMenuItem

    If you find when developing in 10.7 that you get a versions menu with a NSMenuItem as one of the items, it might be worth checking to see whether you’re correctly using validateMenuItem:

    This problem may happen if you return YES from validateMenuItem in a NSDocument subclass for menu items that you don’t actually control. (If you just return YES as a default for example)

    If instead you return

    [super validateMenuItem:item]

    You should get the correct “Revert to Last Saved Version” menu item

    I ran into this when I was doing testing on 10.7 and although documentation clearly states that you must call the super method in validateMenuItem: , it wasn’t immediately obvious to me what was causing the problem.

    Hope this helps if you have the same problem.

    Edit: This may have been fixed in OS X