There are 70 entries in this Category.

Auto Layout: How to do percentage-based layouts

I recently had to implement a two-directional slider (I.e. a box with an indicator that can go anywhere). I wanted to do it using modern auto layout, and I needed it to resize properly on rotation without me having to change internal variables.

That meant that the position of the slider knob would have to be specified as a percentage (well, fraction) in the multiplier of the constraints, so that whatever size the slider UIView had, it would adapt.

My first attempt was to simply specify the position as a multiple of the height. So [self.indicatorView.centerXAnchor.constrainToAnchor: self.widthAnchor multiplier: 0.0].active = YES would be left, and multiplier: 1.0 would be right (and analogously for the Y direction).

That worked fine, but had the problem that the indicator could end up “tucked under” the left or right edges. I tried using UIView‘s layoutInsets, but that didn’t work either. In the end, I would have to manually add the fraction that my indicator’s width corresponded to to the ends to avoid that from happening. Might as well use pixels, then.

The autolayout margin guides

Then I remembered I could just add additional UILayoutGuides (MacOS has NSLayoutGuides) to define the margins I wanted to keep clear, then define another layout guide relative to those for the actual draggable area, relative to which I could constrain my indicator.

So first I built 4 guides that were pinned to the edges, had a width (resp. height) of 0.5 × indicatorView.widthAnchor (resp. heightAnchor) and a height/position (resp. width/position) same as the slider view.

Now we had the margins. Then I added a 5th guide that covered the draggable area inside those guides. Then took the old constraints and made them relative to this guide instead of the entire view.

That didn’t work. The height starts at 0, so if used as a position, it would always end up in the upper left. And if I added a constant the size of the margins, I’d have something that wouldn’t update when the view resized again. Might as well use pixels, then.

Drag area and indicator position layout guide (in blue)

Then it struck me: Why not just add another guide? The guide is pinned to the upper left of the draggable area, and its width/height are percentages of the draggable area’s height. I can now set the multiplier on the width/height constraints to my slider percentages, and the lower right corner of this 6th “indicator position” guide would be exactly where I want the indicator to be.

So I just change this guide’s multipliers when the indicator moves, and bind the indicator view’s center to the bottom and right anchors of the indicator position guide, and it all works!


You may note that I keep talking about changing the multiplier on constraints. Yeah, that’s not really possible, the only thing on a constraint that can change is the constant (well, and the identifier, but that would ruin the joke).

So yeah, wherever you read that, what I do is remove and recreate the constraint. Sadly, constraints do not have a -removeFromSuperview method, so what I really have to do is walk from a constraint’s firstItem and secondItem property up to their common ancestor and tell it to remove the constraint (if they are views … if they are guides, that means they’re constraints on self or one of its superviews).

How HyperCard got its color back…

HyperCard 2.4 New Features stack

Many people have heard of HyperCard: An offline precursor to the modern web, the Mac equivalent to Visual Basic, the tool the first Wiki and Myst were made with. Sometimes it is also called the first widely-used implementation of Hyperlinks (though it didn’t really get easy-to-use text link support until the 2.x series, and even that was more complicated than the links we are used to today).

Many people have also heard that HyperCard never got proper color support. But wait ! Myst was a full-color game! It even played movies! One of these has to be wrong!

As always, it’s a matter of nuances. Of platforms. And of ingenious hacks.

Black and White

The Crow HyperCard stack

When HyperCard came out, Bill Atkinson intentionally chose a crisp, B/W bitmapped window size of 512×342 pixels. It was the best they had at the time, and it meant that everyone, even people with small Mac Plus/Classic screens, would be able to view it. Being able to trade stacks with your friends was an important part of the social experience of HyperCard.

Atkinson invented a clever lossless image compression scheme, known as “Wrath of Bill” or “WOBA” among HyperCard reverse-engineerers, that reduced these B/W pictures to a practical size through a variety of tricks, including run-length-encoding and XORing a row with previous rows, which meant that even a checkerboard pattern compressed into one line of dots XORed repeatedly with a black row.

In 1990, this format was re-engineered slightly so a card could be an arbitrary size, as long as its width was still a multiple of 16.

Native color support

HyperCard IIGS TuneMaker

In 1991 a separate team at Apple was tasked to port HyperCard 1.x back to Apple IIGS home computers. As they had a blank slate to start from, they integrated support for native color. You were able to choose from the Apple IIGS’s 16 color palette by specifying color numbers, and they also added a few features that would later make it back into the original, like radio button groups.

Macintosh HyperCard, then at 2.0, still had no color support. Worse, the syntax introduced for the Apple II and the color file format were not really suitable for Macs, as the IIGS had a very limited color set and pixels that were taller than wide.

Colorizing HyperCard

ColorizeHC's color mode selector

After HyperCard had made its way into the hands of Apple-subsidiary Claris, engineers Eric Carlson and Anup Murarka came up with an ingenious hack to bring color to HyperCard without having to change the file format or even touch the engine code:

HyperCard used double-buffered display. That is, whenever it had to redraw part of the window, it first painted all the individual parts onto each other in a hidden “buffer”, and then copied that buffer to the window on screen. This meant you never got the “stacking” effect seen in so many other drawing programs.

This last copying step was achieved using a system call named CopyBits. If you replaced this system call with your own routine from a HyperCard plugin, you could check whether the destination to be copied to was the current document’s window, and if it was, mix other drawings in.

Since HyperCard used black outlines and white, they used a “darken” drawing mode to draw their color on top of the B/W picture. Black would stay black, as it is the darkest color, while white areas would “show through” the color overlay. Of course this third merging step wasn’t very fast on the hardware of the time, but it worked fairly well.

Colorizing HyperCard startup screen

When it was decided not to release this hack due to concerns about the support load it would generate, the two engineers quickly replaced the Claris logo with a “BungDabba Productions” logo and got permission to release it as a free third-party extension.

AddColor and InColor

AddColor New Features Stack

For a while, Heizer Software, a large distributor of popular HyperCard plugins, created its own color overlay plugin named InColor with features like color transition effects (this is what Myst was made with). Eventually, HyperCard proper followed suit. First shipped as a pre-release for use with 2.2, the HyperCard Color Tools stack was included in 2.3.

The included AddColor XCMD used the same approach as ColorizeHC, but instead of having to script all the pictures and drawings you wanted on a card, it wrote the list of items and their colors into ‘HCcd’ and ‘HCbg’ resources with the same ID numbers as your cards and backgrounds, and provided InColor-style transition effects.

The stack also implemented an editor interface that provided a color and tools palette that allowed to select buttons and fields by simply clicking them and then a color, and even drew its own “marching ants” selection on top of the selected items, in a fashion not dissimilar to how the editors in other HyperCard clones like SuperCard worked, although a separate XFCN named “clicker” had to be used to intercept mouse clicks on the card and draw the marching ants.

AddColor 2.0 PICT paint editor

You were able to set a “depth” for the edges of an object, and apart from buttons and fields could also add colored rectangles, PICT files or resources to a card’s color overlay. With AddColor 2.0 (included with HyperCard 2.4) you even got a PICT editor window with color paint tools.

Animation in HyperCard

HyperCard’s animation support had usually restricted itself to changing 32×32 pixel icons (and later arbitrarily-sized PICTs using the “icon ID -1 plus button name” trick), or flipping through cards. Given how slow the color overlay performed on most Macs of the time, these weren’t really an option for fluid animation in color.

So HyperCard 2.2 bundled ADDmotion II. Not unlike the Color Tools, this product from MotionWorks created its own editor on top of HyperCard, providing you with a Macromind-Director-style timeline interface and pixel graphic editor. The animations generated were completely separate from HyperCard. They were saved to the stack and then you could use an XCMD to play one inside the card window, covering the card, and then returning you to HyperCard again.

So No Released HyperCard for MacOS ever had Color?

HyperCard New Features Stack Button Tasks Page

Nope. Basically, every HyperCard version from 2.1 on added a few new commands here and there, but it was the same HyperCard 2.x.

An exception could be made for HyperCard 2.2, which added a few new button types (popup buttons, more native-looking “standard” and “default” buttons) and other visible features to the core engine, and support for other OSA scripting languages like AppleScript instead of HyperTalk. But color? Nope.

Screen shots courtesy of @HyperCard, used with permission.

Myopic version-control islands


Being a programmer, I use version control software a lot. A while ago, there was a great upsurge in such software. I suppose it started with Versions and Cornerstone, then continued with Git clients like Tower, Github and SourceTree.

Yet none of them really innovated on their command-line brethren. This may seem like an odd desire, but there are areas where GUI clients can improve on the command-line clients backing them.

Support the user’s workflow

In one talk at NSConference, Aral Balkan once said that “your UI shouldn’t look as if your database had just thrown up all over it”. This is what I’m reminded of when I look at SourceTree.

It feels like someone took a window and just threw in a pushbutton for every action, a text field for the commit message and a checkbox for every option. It presents me all of Git at once. It overwhelms not only me, but also my screen space, as it usually shows much more on the screen than I need at any single time, but since all of it has to be visible, it is all too small to be comfortably used.

All version control software needs to become more aware of context, of “what is it time for now”. Give the user a screen display that only shows things relevant to the current operation.

The File List

The file list is not just useful for when you want to commit a change. It can help with code navigation: I’m in a big project, I’ve edited a few files, I’ve viewed many more. I need to get back to that spot I started my change in after implementing some needed subroutines and their tests. The recents list in Xcode won’t help me there, too many files I came past on my search for the right spot, some in the main tab, some in multi-file search. But my VCS knows which files I just touched.

I just go into the VCS GUI client, to the list of changed files, and there are the 5 out of 50 files I actually changed. And now that I see these 5 filenames, I can recognize what the colleague named that file. I’ve quickly found it.

Why don’t more VCS GUIs support code navigation? Let me search. Let me select. Heck, if you wanted to get really fancy you could show me the groups in the Xcode project that my files belong to. Analyze, correlate.

Peripheral Vision

The one thing all GUIs for version control systems provide these days is what I’d call “peripheral vision”: They show a constant list of files in your repository and show which ones have changed, live.

You don’t have to actively call git status. Whenever a file changes, it shows up.

By having these updates show up on their own accord, I can be warned of external influences automatically. SmartSVN, for example, shows both the local and remote state of a file. So if a colleague modifies the Xcode project file on the server that I’m currently editing locally, I immediately see in my peripheral vision that I have a pending conflict.

Each Version Control System an Island

Most of the version control GUIs I’ve mentioned ignore one important fact of most peoples’ work with version control: Sure, it is useful for single developers as unlimited undo, but most of the time it is used in collaborative environments.

If I’m collaborating with someone, isn’t the most important thing here to keep me abreast of what other developers are doing? Why do all the GUIs except SmartSVN with its horrible non-native Java grab-bag UI focus so much on making me see my working copy that is right here in front of me, and then come up surprised when something on the server changes and drop me into an external diff client without any hand-holding?

Apart from showing remote status, why don’t they keep me informed of incoming changes? Why does Cornerstone only let me view the log history of individual files or folders, but doesn’t constantly keep the list of commits in my peripheral vision? Why does no client offer to show me a notification whenever a new push happens on the server?

They just don’t Learn from History

The commit history also seems to be an afterthought to most VCS GUI developers. The only human-curated part of the entire commit metadata is usually hidden on separate tabs, or at best fighting for space with the file list and lots of other UI. File names are short. Commit messages are long. Why should those two lists be forced to be the same width?

In Versions, the commit list can only be read. I can see the changes in it and the message, but can’t select a commit in the list to roll back to that commit, or branch off from it. This is one of the basic tenets of UI design: Don’t have the user type in something the program already knows. The commit hash is right there in front of me on the screen, why do I have to type it in to check out?

Moreover, the list of commits in Versions is not scannable. There are barely noticeable color differences in the date, name and commit message, and they’re too close together and separated by lines.

Ever wonder why Finder uses alternating background colors to distinguish table rows? Because it’s easier to scan: Lines are read by the mind as glyphs, additional information to be processed, whereas the “line” where two different-colored surfaces meet are just accepted as a gap between things.

That’s why so many lists use columns. That way, if you’re looking for a commit from a particular colleague, you just scan down that column, able to completely ignore the commit messages.

The User doesn’t make Mistakes

Users don’t make mistakes. Bad GUI just leads them down the wrong path. When a user makes a mistake, be forgiving.

A contradiction? Yes. While most VCSes already under the hood have the policy of never losing data, GUIs can improve on that. Undo on text fields. Showing a big warning banner across the window when the user is on a detached head, which the user can see even if the window is half-hidden behind Xcode. Offering to stash changes for the user if they’re switching branches and have unsaved changes.

If the user selects three “unknown” (aka new) files and asks you to commit them, don’t just abort with Git’s standard error saying that they aren’t under version control! Try to anticipate what the user wanted. Show a window with a list of the offending files and offer to automatically stage them (with checkboxes next to them to turn off ones they might not have wanted to commit).

If a user tries to commit a binary file that has its executable bit set, maybe ask for confirmation in case they’re accidentally checking in the build products, and offer to add the file or one of its enclosing folders to the .gitignore file.

If the user tries to amend a commit, be smart and warn them from changing history that’s already been pushed. But don’t warn them needlessly. Can you check if any remote is ahead of this commit to detect whether the user has already pushed the commit to be rewritten? If not, it’s safe, just let them do it.

Remote Possibility of Supporting a Workflow

I’ve mentioned how we need to try to support the user’s workflow more and how the server is under-served. This also applies to setup. One of SourceTree’s standout features is that it lets you not only enter your Github or Bitbucket URL, but also shows you lists of your remote repositories.

You can set a default folder where your programming stuff goes, and then just select one of your remote repositories and click “clone”, and poof, it checks it out, adds a bookmark for it, and opens it in a window and you’re good to go. Heck, Git Tower even lets you specify the address of an image file in your repository to represent it in the list for quicker scanning.

Why has no VCS GUI added a Coda-style project list and automatically looks for project files and their application icons in a checkout to pre-populate the icon?

Re-open the repositories (yes, users may want to open several at once, deal with it!) the user had open when your app was quit. And for heaven’s sake, why are there VCS developers who don’t know how to make their application accept a folder via drag & drop on its application icon in Finder or the dock so I can quickly open a working copy that’s right there in front of me without having to wait for an open panel to open up?

Promise to be Better

I’m sorry, this has turned into a rant there. But the fact is, there are so many VCS applications, yet most simply expose the commands of their command line equivalents. Why do so few protect me from commonly made mistakes and focus on what me and my colleagues want to achieve instead and support us in that?

How can products connected to servers be so asocial?

MacBook Holster

Closed MacBook holster with iPad, MacBook, power supply, adapter & 3G dongle inside.

Closed MacBook holster with iPad, MacBook, power supply, adapter & 3G dongle inside.

A few years ago at NSConference, I bought an Incase MacBook Air 11" sleeve off another attendee. I’d been unsuccessfully looking for a good backpack to hold my MacBook Air and not add much bulk. So I had to make one.

This is not a very complicated task that needs much description. All I did was buy a roll of backpack strap, a quick release buckle (so I don’t have to wind out of it when it’s inconvenient), a matching tri-glide slider, and a shoulder pad.

Yes, these things really all fit into this MacBook sleeve.

Yes, these things really all fit into this MacBook sleeve.

I took a needle and thread and manually sewed the strap to the upper left and lower right corners, making sure the ends were at an angle so that they’d come off the backpack straight. I had to do several rows of sewing to make sure it was attached strongly enough to hold the weight of not only the MacBook, but also the power brick.

Now while I wish I’d had a sewing machine at the time to make the stitch nicer, you don’t usually see that side of the backpack, so at least there’s that consolation. Once I’d looped the strap through the pad and slider and sewed the end that went around the slider’s middle bar onto itself (to get me adjustable strap length), it turned out to be strong enough for not just the MacBook and power supply, but also an iPad, plug adapters and a 3G dongle.

The sewing would have been prettier with a machine.

The sewing would have been prettier with a machine.

I wonder why no backpack manufacturer makes small holsters like this. I’ll probably add a zipper to the outside pocket of the sleeve, but apart from that it’s a very useful bag now.

NB – The photos are of a MacBook, but I used to keep a MacBook Air 11" in there and can assure you that it fits just fine, though the bulkier power supply requires a bit of thrusting to get it in the outside pocket.

How to install Windows 8.1 on a Mac


Update: Microsoft now sells Windows 10 on USB keys, so even Mac users can install it easily if they order physical media. Also, I’ve heard (but have been unable to confirm) that Microsoft’s download version of Windows now can be obtained as an .ISO disk image again, which the Mac’s Disk Utility can extract onto a USB key.
I’m leaving this article up for people who somehow still end up with the .exe installer and are looking for a workaround.

It is not quite trivial to buy Windows as a download and get it onto your Mac. I’ve found a workaround, but it takes a lot of time, and requires you to download about 7GB of data via the internet.

Disclaimer: I do not guarantee that these steps will work. They worked for me in late June 2015, YMMV. Do not blame me if you buy a download version of Windows and then can’t install it. Also, be sure to make a backup of your entire hard disk/SSD before you do this. You will be resizing partitions and doing other things that could lead to accidental loss of data.

The Problem:

  • The Windows 8 download is a small .exe file containing a downloader application that needs an already-installed Windows to work.
  • Macs these days don’t have a DVD drive, so you’d need to buy/borrow one to be able to use install DVDs mailed to you.
  • Boot Camp Assistant assumes a physical DVD or an ISO disk image, it obviously can’t run the .exe under MacOS.
  • I was unable to get the .exe downloader to run under CrossOver on MacOS.

My workaround:

  • Download the trial of Windows 8.1 for Enterprise as an ISO image from Microsoft (need to create an MS account which you will also later need to buy the download)
  • Use Boot Camp Assistant to install that onto an empty USB stick that is at least 4GB (not just the Apple-specific drivers, check the option for the full install partition). The stick will be formatted using Windows’ old FAT32 format, which both Mac and Windows can read and write.
  • ~100GB (at least 60) is a good size for the Windows partition to add to your internal hard disk/SSD.
  • Boot Camp will now churn a while and copy the files from the ISO on your USB stick, and will also download the newest hardware drivers from Apple and make sure those get installed as well. Time for breakfast.
  • When Boot Camp Assistant reboots, hold down the option key and select the “EFI Boot” entry to make sure you don’t end up back in MacOS.
  • You will find yourself in the standard Windows installer now. Follow its directions. On Retina Macs, it will be at a tiny 1:1 resolution. Bring a magnifying glass.
  • When asked where to install the Boot Camp partition, find the one named “BOOTCAMP” and select it. Remember what else it says (e.g. “Disk 1 Partition 4”).
  • If the Windows installer complains about the partition not being formatted as NTFS, Click the “Format” button underneath the list, but don’t do any repartitioning with the Windows tools, you’d only disturb the fairy dust that Boot Camp Assistant has applied and break booting back into MacOS.
  • Select the reformatted disk (which has now lost its “Bootcamp” name) and click “Next” to start installing the trial.
  • Make lunch while pretty colorful screens rotate through and Windows is set up for you in the background.
  • Run through the Boot Camp installer that runs in Windows after the standard Windows installer has finished.
  • Once you have a working trial install of Windows, buy the download .exe from, if you haven’t already. Unless they say they don’t, installers include both old-style 32-bit versions and the 64-bit versions needed for Macs, don’t worry.
  • Run the .exe you just bought while you’re running the Enterprise Windows Trial to create a proper ISO with your purchased Windows 8.1 on it.
  • Back up that Windows.iso and its license key somewhere safe.
  • Copy the Windows.iso onto the USB stick so you can get at it from MacOS.
  • Note down the Windows license key somewhere, you’ll need to type it in in a moment.
  • Boot back into MacOS and run Boot Camp Assistant a second time to remove the trial partition. (BCA doesn’t let you run it again on an existing partition, so you’ll have to nuke and recreate)
  • Run Boot Camp Assistant a 3rd time, this time using the new ISO, not the trial, to get the desired full Windows install. Remember to hold down the Alt key at startup to select “EFI Boot” or you’ll just end up back in MacOS.
  • When the standard Windows installer comes up, you’ll need to enter your Windows license key this time. From then on, the install will be identical to the trial install.
  • Your Yak is shaven clean as a baby’s bum.

Note: In theory, it should be possible to run the .exe under the trial to directly install Windows 8.1 on top of the trial instead of generating the ISO, but I didn’t want to risk it somehow generating a mix of the trial and purchased Windows installs, or eliminating the Boot Camp-supplied drivers & programs, so I decided to nuke the trial once I had the ISO and start fresh. Whatever you do, generate and back up the ISO so you don’t need to request another trial from MS when you inevitably want to reinstall Windows at a later time, even if you then use the .exe and not Boot Camp for the second installation.

Thanks:Thanks to Sören for pointing me at the Windows trial version that made this possible.

Why the new MacBook is a success


To those of you following me on Twitter, it hasn’t been a secret that I’ve been waiting for a small, portable Retina MacBook for quite a while. Yesterday, Apple announced one, and it looks to be a good one. Since I’ve heard a lot of nay-sayers, I thought I’d point out some things that people may overlook.

Are you the target audience?

The new device is named “MacBook” and priced in the $1500 price range. Also, the old MacBook Air in the < $1000 price bracket is still available. This makes sense. The MacBook Air moved into the entry-level price bracket a couple years ago. Like with other Mac models, a Retina variant can't be made at that price profitably. So they'll keep the old variant for the price-conscious, as a way to attract new users who will then hopefully later upgrade to a more expensive model, or stay on at the low end. So the people looking for a cheaper (but not the cheapest) Mac are one target of this new machine. Another main feature was that it's slim and ultra-portable. So if you would be fine lugging around a 15 incher, you're definitely not the target audience. If you're looking for a powerful Mac to run scientific simulations or build large programs using Xcode, you already have the 13 inch Retina MacBook Pro. It is only slightly larger and packs the power and extensibility you need. So why the heck would Apple build a machine identical to those existing ones?

The new MacBook is the future replacement of the MacBook Air 11″. If you wouldn’t have bought that machine, why’d you be surprised that this machine at the top end of the price bracket is not for you? It sells like sliced bread, so there obviously are people who want a machine like that.

That ‘single’ port

I’ve seen many people complain about that single USB-C port. But when I look at my and friends’ usage patterns on the MacBook Air 11″, it turns out that most of the time you don’t use a port. Either you’re traveling, on a train or plane with it (if you didn’t, you’d probably be fine with a larger machine), in which case you wouldn’t have anyplace to plug it in anyway.

Or you’re at work, or in your apartment, in which case you’re stationary. So you probably already have an external display that provides power *and* serves as an Ethernet adapter and USB hub, or some other dock, around which your wired ethernet connection or clunky devices that you’d need USB ports for are arranged.

In that situation, only having a single USB-C plug to attach is actually the most convenient solution.

And since USB-C is an industry standard, there’s no doubt that USB keys with C-plugs are only a matter of time. At worst, you may carry along a tiny plug adapter for attaching a colleague’s old USB storage sticks, probably smaller than a 30pin to Lightning adapter. And you won’t even have to pay the Apple Premium(tm), because lots of third-parties will probably be making these, too.

And they did leave in the combined headphone/mic jack, which is probably the only other port I’d use with any regularity, and which might actually be needed while something else is plugged in.

That M-processor

The MacBook Air has never been known for being the high-end machine of the product line. The biggest of the new MacBook’s CPUs Turbo Boosts up to 2.9GHz. That’s faster than the old entry-level ones, but not quite as fast as the old i7 variant. But neither machine is problematic for the entry-level crowd they will eventually be serving. You can write text and e-mails, you can browse the web, you can watch full HD movies. Heck, Photoshop will not be super-fast but probably be fine, and while Xcode may take some time, it will still run and get the job done. That’s not a change from before.

That Webcam

The Webcam is only 480p. That’s not much. Then again, if you’re calling home, you probably know what your kids or parents look like, and you’ll be able to make out whether the facial expression meant that phrase was irony or serious. That’s really all video calls are for. If you’re at a hotel, picture quality will probably be reduced to horrible macroblocks anyway, due to the slow internet. And very likely, you already own an iPhone or iPad, so you can always use their camera.

And if you actually want to take video, you’re likely using an external camera anyway, and not your webcam, which picks up the vibrations from your typing and has a limited angle that requires you adjust your screen.

Non-clicky trackpad

This easily had me worried. I’ve never been able to make touch-to-click work on old trackpads. I always caused clicks at the start of quickly moving the mouse, accidentally trashing or moving files in the process. However, with force-touch, this might work out. If it can detect the difference in pressure, it might have a decent threshold between a strong touch or a soft click. I haven’t actually used one yet, but all the hardware for this to work seems to be present.

The new power supply

I’ve had some issues with my MacBook Air 11″‘s power supply. My cable usually goes sideways off the hotel bed, so the plug being angled backwards means it bends off right after the plug. The rubber sleeve on the cable usually starts fraying and breaking after a while. Since the cable is attached permanently to the power supply, that made for some expensive replacements.

In addition, the MagSafe connector kept unplugging when I didn’t want it to. Oddly, when someone actually stepped on the cable, the sudden force would cause the lightweight MacBook to spin around first, so its back was facing in the direction of the cable. This in turn meant that the L-shaped MagSafe plug now functioned as a hook and would not unplug. In short, MagSafe never worked for me on that machine (It’s fine on my old 15″ MBP, because that weighs enough).

As far as I can tell from Apple’s web site, the new power supply is like an iPhone power bug. There is a separate USB-C cable with plugs on both ends now. The USB cable has a straight, not angled plug. As such, not only would it not get bent when the cable goes off sideways, someone pulling on it would also no longer turn it into a fishing hook. It’s much more likely that it’d unplug under force now than before. And if it doesn’t, it won’t be any worse than before for me.

Now if this power supply and these connectors make their way to the larger MacBooks, the lack of MagSafe may become an issue. But for this device? Not for me.

The Retina Display

If I read Apple’s web site right, the new MacBook has a 2304×1440 screen. At traditional scale factors, that would make it 1152×720@2x or 1536×960@1.5x. That first resolution would be a show-stopper for me. Back when the 11″ MacBook Air came out, most applications did not expect a new Mac to have a screen as small as 768. Lots of windows didn’t fit onscreen, with the “OK” buttons at the bottom ending up offscreen. 48pt less is worse, and will probably cause that problem again.

You can’t run a 12″ screen at 2304×1440 either. The menu bar would be tiny. You’d spend all day bent over the tiny laptop and ruin your back. However, the 1.5x resolution would be fine for me. The screen is a bit larger, so this should end up only slightly smaller than the old 11″ MacBook Air.

Is it ideal to run this device at 1.5x? No. Is it an improvement over the old non-Retina? Yes. More space to work with, and more pixels for text rendering.

I can’t say for sure that these resolutions would be available, though. Apple’s documentation mentions 2304×1440 at 226ppi, and then a number of “Scaled” resolutions which are really weird sizes like 1280×800. I presume these are just the additional resolutions like you’d find them under “Scaled” in the “Displays” System Preference pane, and that we’ll still have the 1x, 1.5x and 2x switches like we have on current Retina Macs.

That Keyboard

In general, I like better keyboards, and as a fast but not very precise typist laud the idea of a more stable key cap. The only issue I have with this one is that the new single-assembly butterfly mechanism seems to be using a thinner piece of material (and apparently plastic) as a hinge/joint of sorts. Usually that means that, after some wear and tear, this thinner piece will break. That would mean this device is engineered to break.

The verdict

In my not so humble opinion, people who are complaining are not real Scotsmen… err … not the target audience for this machine. You can still get one of the others, even non-Retina MacBook Airs on their way out. The features Apple cut or compromised on are the ones that will least affect the typical user. It’s a good machine. I’ll probably buy one once I’ve answered that final, all-important question:

… Space Grey or Gold?

Using Jekyll for static web site building on a Mac


Martin Pilkington occasionally mentioned the Jekyll static web site builder in his tweets, so when I wanted to start a new web site, I thought I’d give it a try, as I’ve been uncomfortable with having to back up WordPress sites in separate steps to get both the database and the image and movie assets.

Installing Jekyll

Make sure you have Xcode installed and its command line tools. Then just open Terminal and type:

sudo gem install jekyll

Creating a new site

To create a site, do

jekyll new

This creates a folder named in the current directory to hold the files for the new site.

Open the folder and in it the _config.yml file. Change the entry title: to what you want to call your new site, and url: to your domain name (in our above example, Feel free to change what few other settings there are, but you don’t need to.

Two neat _config.yml tips:

  1. You can leave entries empty, e.g. the email: or github_username:, and they will just disappear, including their icons.
  2. You can make files and folders that Jekyll would usually skip (like .htaccess) by adding an entry like: include: [.htaccess, .well-known, _foo.xml]. You can also exclude files from copying/processing this way, e.g. exclude:

Testing the site

Jekyll includes its own web server. Simply type

jekyll serve

the site is now available under http://localhost:4000. The server will automatically watch for changes to the folder and re-build the site. If you still need to manually trigger a rebuild (e.g. to deploy your site without launching the server), just use

jekyll build

Adding your own pages

Like WordPress, Jekyll has pages and blog posts. Any file that doesn’t start with an underscore is considered as a page. Be it index.html or Let’s edit to describe our site, not Jekyll. Open it in a text editor.

The file starts with a section like this:

layout: page
title: About
permalink: /about/

called the “front matter”, followed by regular Markdown, as you’d expect from a .md file. This section specifies the info that Jekyll needs about the page, and tells Jekyll to substitute placeholders in the file. You can leave this section empty, just its presence tells Jekyll to process the file. So it’s easy to create a new page. You can also make up your own settings here, if you want.

The ones in this example are standard ones Jekyll knows out of the box:

layout: specifies that the file _layouts/page.html should be wrapped around this file, and this file’s contents should be inserted where that file says ||contents~~. This is how Jekyll applies themes and shows navigation on each page.

permalink specifies the address at which the page will end up in the generated web site. So in our example, you’d find this page at instead of at

title: is actually just a variable used by the _layouts/default.html template. Any variable you define can be used on the page by writing e.g. || page.title ~~. So if you added a line temperature: 40 Centigrade you could put it on the page as || page.temperature ~~.

Other interesting variables are categories, tags and published.

Blogging with Jekyll

Jekyll offers special blogging support. Mainly this just involves saving pages into the _posts folder and prefixing the file names with an ISO date, e.g. 2015-01-30-My First But it also has special functions to make it easier to link between posts in a stable fashion, and to generate lists of posts with teaser text etc. The Official Jekyll docs on blogging cover this well.

Importing from WordPress

Jekyll has support for importing from WordPress. First, install the importer:

sudo gem install jekyll-import
sudo gem install sequel
sudo gem install unidecode
sudo gem install htmlentities
sudo gem install mysql2

and then do what Jekyll’s WordPress Importer docs say.

Handling keypresses in Cocoa games


At first blush, Keyboard event handling for games in Cocoa seems easy: You add -acceptsFirstResponder and -becomeFirstResponder overrides to your custom game map view, then override -moveUp:, -moveDown:, -moveLeft: and -moveRight: to handle the arrow keys.

However, if you play a game like that, you’ll notice one big difference to most other games: It only ever accepts one keypress at a time. So if you’re holding down the up arrow key to have your character run forward, then quickly press the right arrow key to sidestep and obstacle, your character will stop in its tracks, as if you had released the up arrow key.

This makes sense for text entry, where you might accidentally still be holding down one character while another finger presses the next, but for a game this is annoying. You want to be able to chord arbitrary key combinations together.

I found a clever solution for game keyboard handling on the CocoaDev Wiki, but it’s a bit old and incomplete, so I thought I’d provide an updated technique:

The solution is to keep track of which key is down yourself. Override -keyDown and -keyUp to keep track of which keys are being held down. I’m using a C++ unordered_set for that, but an Objective-C NSIndexSet would work just as well:

@interface ICGMapView : NSView
	std::unordered_set<unichar>	pressedKeys;


and in the implementation:

-(void)	keyDown:(NSEvent *)theEvent
	NSString	*	pressedKeyString = theEvent.charactersIgnoringModifiers;
	unichar			pressedKey = (pressedKeyString.length > 0) ? [pressedKeyString characterAtIndex: 0] : 0;
	if( pressedKey )
		pressedKeys.insert( pressedKey );

-(void)	keyUp:(NSEvent *)theEvent
	NSString	*	pressedKeyString = theEvent.charactersIgnoringModifiers;
	unichar			pressedKey = (pressedKeyString.length > 0) ? [pressedKeyString characterAtIndex: 0] : 0;
	if( pressedKey )
		auto foundKey = pressedKeys.find( pressedKey );
		if( foundKey != pressedKeys.end() )

Of course, you’ll also want to react to modifier keys, and like most games, you will want to treat them not as modifiers in a shortcut, but as regular keys, so people can press Command to fire, or so. That’s basically the same, just that you override -flagsChanged: and that there are no standard character constants for the modifier keys. So let’s just define our own:

// We need key codes under which to save the modifiers in our "keys pressed"
//	table. We must pick characters that are unlikely to be on any real keyboard.
//	So we pick the Unicode glyphs that correspond to the symbols on these keys.
	ICGShiftFunctionKey			= 0x21E7,	// -> NSShiftKeyMask
	ICGAlphaShiftFunctionKey	= 0x21EA,	// -> NSAlphaShiftKeyMask
	ICGAlternateFunctionKey		= 0x2325,	// -> NSAlternateKeyMask
	ICGControlFunctionKey		= 0x2303,	// -> NSControlKeyMask
	ICGCommandFunctionKey		= 0x2318	// -> NSCommandKeyMask

-(void)	flagsChanged: (NSEvent *)theEvent
	if( theEvent.modifierFlags & NSShiftKeyMask )
		pressedKeys.insert( ICGShiftFunctionKey );
		auto foundKey = pressedKeys.find( ICGShiftFunctionKey );
		if( foundKey != pressedKeys.end() )

	if( theEvent.modifierFlags & NSAlphaShiftKeyMask )
		pressedKeys.insert( ICGAlphaShiftFunctionKey );
		auto foundKey = pressedKeys.find( ICGAlphaShiftFunctionKey );
		if( foundKey != pressedKeys.end() )

	if( theEvent.modifierFlags & NSControlKeyMask )
		pressedKeys.insert( ICGControlFunctionKey );
		auto foundKey = pressedKeys.find( ICGControlFunctionKey );
		if( foundKey != pressedKeys.end() )

	if( theEvent.modifierFlags & NSCommandKeyMask )
		pressedKeys.insert( ICGCommandFunctionKey );
		auto foundKey = pressedKeys.find( ICGCommandFunctionKey );
		if( foundKey != pressedKeys.end() )

	if( theEvent.modifierFlags & NSAlternateKeyMask )
		pressedKeys.insert( ICGAlternateFunctionKey );
		auto foundKey = pressedKeys.find( ICGAlternateFunctionKey );
		if( foundKey != pressedKeys.end() )

An alternative would be to just enlarge the numeric type used to store keys in your unordered_set. Instead of two-byte unichar values, you’d just pick uint32_t, and then define the constants as values that are out of range for an actual unichar, like 0xffff1234. If you’re using NSIndexSet, you’re lucky, it uses NSInteger, which is already larger.

Then add an NSTimer to your class that periodically checks whether there are any keys pressed, and if they are, reacts to them:

-(void) dispatchPressedKeys: (NSTimer*)sender
	BOOL	shiftKeyDown = pressedKeys.find(ICGShiftFunctionKey) != pressedKeys.end();
	for( unichar pressedKey : pressedKeys )
		switch( pressedKey )
			case 'w':
				[self moveUp: self fast: shiftKeyDown];

Since your timer is polling at an interval here, and you can’t make that interval too fast because it’s the rate at which key repeats will be sent, it is theoretically possible that you would lose keypresses whose duration is shorter than your timer interval. To avoid that, you could store a struct in an array instead of just the keypress in a set. This struct would remember when the key was originally pressed down, and when the last key event was sent out.

That way, when the user begins holding down a key, you’d immediately trigger processing of this key once, and make note of when that happened. From then on, your -dispatchPressedKeys: method would check whether it’s been long enough since the last time it processed that particular key, and would send key repeats for each key that is due. As a bonus, when a key is released, you could also notify yourself of that.

You could even create “key event” objects of some sort to hand into your engine.

Getting started with Star Trek Online

My character selection screen on STO.

I’m not a gamer, I’ve never owned a dedicated gaming device, and generally only play games like the LucasArts adventures (including successors like Telltale and Double Fine’s Broken Age), or Myst. But recently I came across Star Trek Online and caught the bug. Since STO is a rather large game, it took me a while to get into the jargon and understand it. So I thought I’d present my findings here for others who would like to try out this game.

For the TL;DR crowd, the short blurb is that STO is a massively multiplayer online RPG, but with enough story and single-player missions (some very moody and scary) that even story-puzzle-adventure nerds like me can enjoy it without feeling that the grinding is too much of an err… grind. It is set in the classic Star Trek universe of the TV series, so is a nice Sci-fi spaceship setting. The major downside is that STO’s system requirements are rather narrow, and not easy to find, and the game will just randomly crash if you don’t meet them instead of alerting you to the mismatch beforehand.

How do I get it?

STO is a free download at The STO product page at ARC games, or from Steam. Note that, while the game is not even a 60MB download, that’s not all. Once you’ve started that app and created a new STO account, it will download about 8GB of “patches” containing the actual game data. These “patches” are a common occurrence, but subsequent ones aren’t generally as huge as the initial one.

I’ve got it, how do I play?

Create new Character button

In STO you have a main character, who is the only playable character, plus in the process of the game, you get Bridge Officers, which are the NPCs that make up your crew that accompany you on ground and space missions and that support you. Your main character belongs to one of 3 factions: Federation, Klingon, or Romulan.

Character selection screen

You have to pick a gender and race for your character. Available races are:

Federation Humans, Vulcans, Andorians etc.
Klingon Klingons, Orions, Gorn, Nausicaan etc.
Romulan Romulans.

All races also have a general “Alien” race that gives you a lot of freedom in designing your character. You start from a general human build, but can add brow ridges, hair, crazy skin colors, patterns, and take the proportions of the character to slightly more non-human levels (think more Dr. Phlox, you can’t really build an overweight or flat-chested person in this game).

You also pick a career (“class”) for your character: engineering, science or tactical., The career affects the extra abilities your character will have beyond being able to run/fly around and shoot. Scientist is a “healer” character supporting other characters, while Engineering means that you build little drones and force field shields and other more defensive or indirect attack mechanisms to support yourself, while tactical means that you’re the front-line person to throw grenades and lunge and kick at the enemies.

Among the factions you can pick, Romulans are a special one, because after the destruction of their homeworld (the only reference to an event from the new movies), each Romulan can choose for themselves whether they want to side with the Federation or the Klingons. The advantage of this is that you get cool Vulcan-looking aliens (or alien-looking ones), plus cool Romulan spaceships, but you also get missions, uniforms and items of one of the other factions. Sadly, you don’t get all of them. The Romulan uniforms are kind of a variation on Romulan/Fed uniforms, but not actually those uniforms.

If you’re following along, you may have noticed that I left out a few races. You see, STO is a free-to-play game. The way they make their money, is by selling you certain things beyond the core game. Among these things are additional races for your player character, and other extra items like clothes or cooler ships. You can tell those by a little coin icon with a “Z” in it, as in “ZEN”.

ZENs are roughly equivalent to Euro-cents in value, and can be bought on their web site. Once you have ZENs, you can go to the “C-Store” (the little coin-icon-and-“store” in the lower left of your onscreen mini-map) and buy stuff there, but note that especially costumes seem to be mostly available for Federation characters. There are a few more for Klingon characters, and for Romulans of either faction it seems you’re way more limited. Also, each faction has its own ships, and usually there are more paid ships for Federation characters than for Klingons, and again more Klingon ships than Romulan ones.

This is a general theme in STO. If you want to play some of the team raids, you’ll have a much easier time finding compatriots if you’re Federation, than if you’re Klingon (Same applies to Federation-aligned Romulans vs. Klingon-aligned, but there’s no difference in this regard between Federation-Romulan or real Federation).

Advanced customization of character outfit

Note that picking a character’s race, class and gender (and later faction, if applicable) are the only permanent things about your character. You can, at almost any point in the game, fly back to base and go to a “taylor” to change your outfit, picking from the free items that you see when you create your character (plus a few more you get as you choose a faction or get promoted, and of course any you decide to buy). This outfit, oddly, includes your skin color, head shape, height etc. For the “alien” race, that means you can pretty much completely change the way your character looks, and later you can have a “uniform” and a “costume” outfit slot which offers different possibilities.

There’s also a “save outfit” button with which you can save and load outfits into these slots, giving you a near-infinite number of saved outfits, but it seems those are cleared after a while and are saved locally on your Mac.

One warning: The switcher at the bottom of the initial character creation page looks like you could switch from Appearance back to Species and Career. Don’t. You will lose any customizations you’ve done to the character’s appearance if you do so. The same happens when you toggle a character’s gender when customizing head/body/uniform of your character.

On the last screen, you name your character and your first(!) ship. Then it’s off to the tutorial.

A ground mission in Federation space dock

The tutorials and gameplay at this point are pretty self-explanatory (that’s the point, after all). Just like later in the game, you’ll get windows popping up that offer you missions, and you can choose to accept or decline them. Sometimes you’ll get additional missions while you’re on another. It’s fine to click those away, you can always go back to the Missions window later and pick a mission you’ve been offered under “episodes”. One thing to know: There are two kinds of gameplay. Space, and Ground.

Space means you’re controlling a ship (tip for users of Mac keyboards without a num pad: You can set a secondary key combination for navigating in space battles. Set that to the arrow keys, that way you can use both hands. The default has the number keys as triggers, which places your hands on top of each other when using WASD for steering. You can now control your ship the same way you steer your character during ground battles).

The tray with weapons arranged by what way weapons face.

Also, you can right-click-and-drag items in the little tray at the bottom to change their order (and thus which num key they’re triggered by). That way you can e.g. move the melee attack (pushing away an enemy when you’re in tight quarters with a punch or the end of your weapon) on 1, where your left pinky finger is, and your weapon and its secondary fire mode on 2 and 3, and then your favorite other special action on 4.

Similarly, I arrange my space weapons so that the ones that mainly face front (see the thick part of the circle in the icon) are at the left, the ones that have a big radius in the middle, and the ones that face backwards on the right, so I can fluidly transfer firepower as the ship turns. (You can even add rows to the tray using the button in its lower right — The C1 row triggers on Ctrl-1 etc., the A1 row on Alt-1 etc.)

You can save these setups as a “Loadout” for your ship. I recommend you keep at least one Loadout and save your changed settings to it, as currently STO has a bug that sometimes just forgets your equipped weapons, and this way you can quickly put everything in order again.

Now you can get playing, have fun!

Space Travel

The Galaxy Map

To travel through space, you can bring up a larger main map. This map has 3 sections. A pretty graphical map that shows you (in a slightly compacted form) which sectors of space lie near which, so you can plan long-distance trips. The idea here is that each sector is a separate location containing several star systems and space stations. Once you’re at the edge of a star system, you are offered to warp to the next sector. Note that a few “blocks” (groups of sectors) are actually farther apart, but have been moved near each other and connected with lines. So e.g. going west from Eta Eridani block will not take you to Gamma Orionis Block. Rather, it will take you to Drellis Block. Also note that the blocks’ different colors indicate what faction they belong to. Some blocks can be traveled to by whoever you are, but e.g. a Klingon-affiliated Romulan can not just go into Sirius Block where Earth is.

Then there’s the Area Map, which is the classic game map that shows you where your character/ship is right now. This is the nice interactive map of your current location, where you can click stuff to fly there. You can also click little triangles at the edges here to plot a course to the edge of a particular adjacent block so you can warp there.

Third, there’s the system list. When you’re in sector space (i.e. not in a solar system where space fights happen, or on a planet/inside a station/inside a ship where ground combat occurs), you can see a list of all the systems/stations and adjoining sectors here, to more easily find them. Note also, that the little summary of mission objectives at the right of your screen usually only mentions the name of the system. So pay attention to what sector they mention in the dialog.

You can also call up the mission objectives window (behind the “Hail Starfleet” button) and that will actually mention the sector and block. Alternately, there is a “transwarp” button next to each mission’s headline that takes you to a mission’s starting location. That costs energy credits, but it asks for confirmation first, and that confirmation mentions the sector in which the starting location can be found. Just cancel out and you know where to go. Once you’re in the right sector, the Transwarp button turns into a “plot course” button that automatically takes you to the right location for free.

Shiiips iiiin Spaaaaaaace!

One final tip about space travel: Auto-navigation using the map is not perfect. Often you have to manually fly towards an object in space to get close enough to actually be offered to beam down onto the planet. E.g. near Earth, you can immediately beam to the academy, but have to fly close to the space station to be offered to beam over to the Dock. Also, sometimes auto-navigation will leave you right below a star system in space, and you’ll have to fly up to be offered to enter the system. Also, sometimes when the ship turns during auto-navigation, it will cross the edge of the sector, and will offer to warp into that sector instead of finishing its turn and flying to where you actually told it to go. So check what sector it wants to warp to, and if it’s the wrong one just close the window asking you to warp to continue on the mapped course.

Skills and Ranks

As you execute missions, you will earn skill points. At certain amounts of skill points, you automatically advance to the next level. The rank and level for your character are displayed in the upper left. You can click that box to see what ranks you can still achieve, and what benefits go along with it:

The Rewards Window

One of the benefits, for example, is that you occasionally get a new (additional!) ship. So you don’t have to spend money on ships right away, you can wait until you hit final rank and have all the free ships, if you want another ship. Your selection of ships also increases with higher rank, but of course lower-level ships then become less interesting.

Skill points are also the “currency” you use to buy abilities for your character. You can simply use the little arrows to “spend” skill points to make yourself better at a certain ability. There are mouse-over popups that tell you all the details. Note that different skills cost different skill points for different increments.

The Skills window

Bridge officers have a narrower skill selection (about one new skill for each rank), but they are another class than you, and can thus use special abilities your player character can’t. E.g. if you’re an engineer, you can build a support drone that fights alongside your tactical bridge officers while they throw grenades at the enemy. Or if you’re tactical, your science officer will come up to you and heal you, and set up little health re-generators, or your engineering officer will set up a force field dome around you.

While bridge officers have a limited number of skills, you can obtain training manuals in exchange for energy credits to get your ideal combination of abilities. Again, this is something you will want to do once you have reached rank 50 and tried out a few bridge officers and their abilities. Some work better to balance out your character’s flaws than others.

The game usually gives you the bridge officers you need to get through the missions. So if you constantly get your energy drained by an enemy, maybe station another bridge officer you have off-duty at the moment that has an ability you haven’t tried yet (in this case “Science Team” interrupts an ongoing energy drain).

Managing Inventory

Finally, during the game you’ll pick up lots of items, which will end up in your inventory, From there, you can drag them into the Status section of the same window that shows your skills. Depending on whether you’re on a character page or the ship’s, different items in your inventory will be greyed out, so you don’t put an engine into a bridge officer’s weapons slot.

The Inventory window

If your inventory is full, you have to empty it somehow, or you won’t be able to pick up new items. Apart from spending ZEN on buying more slots, I’ve found 3 options:

  1. You can click the “replicator” button in the lower right of the inventory and then pick items to recycle (you will get “energy points” with which to buy items again from the Replicator, but the selection is limited to standard, non-fancy items, while some of the stuff you pick up during the game is much nicer).
  2. You can go to the bank on the base (the flotilla/New Romulus, the space dock, or Q’o’nos), which is a little computer in which you can dump a limited number of items and pick them up later when you need them again.
  3. You can go to the “exchange” terminal on one of the bases (and many space stations), and offer them for sale to other players. Not all items can be sold (who would want a common Mark I phaser when they’re already at Level 10 and get Mark X stuff during missions). The prices on the exchange are sometimes higher than what you see printed on the items. I sometimes put up items I don’t really want to sell, but can’t have in the inventory right now. Then I later withdraw them from sale. Of course, someone might still buy it, but at least then I get some energy credits from it.

Comparing inventory

Also, when you get new inventory items, you may want to immediately use them. But what if you get a “Personal Shield Mk II [Pha] [Pla]” and a “Personal Shield Mk II [Dis]”? What’s the difference? Well, one will probably be in your character’s/ship’s corresponding slot. Make sure you can see your character’s status page, then mouse over the new item in your inventory. It will now show you a popup describing this item, plus one for each equivalent item your character/ship has. And now you can compare their stats. I don’t claim I understand their stats fully, but I guess if the Shield Capacity is bigger, the shield is better.

BTW — items are classified into different classes: Common, Uncommon, and Rare. So if they’re all Mk II shields, but one is Rare, it’s often the better one. I’ve even had cases where a Mk IV Rare was better than a Mk V Common one. Also, some items are “bound” to your character, or to your account. That means you can’t sell them on the exchange or e-mail them off in-game to another person (or even can’t e-mail them to another character you created on your account). Some are only “bound on equip”, which means if you just pick them up but don’t actually give them to one of your characters or ships, you can still sell them. So if you get something you don’t need, it’s sometimes handy to not try out that item right away, so you can maybe later sell it.

Devices and Kits

A lot of stuff you’ll find will be called “Devices”, and will look like food, or hypo-sprays (I.e. health bonuses) etc. You can put this in a character’s device slot on the Status page, and your bridge officers will use them up when they’re being attacked. If your player character has a device, you can drag it to the little tray at the bottom and trigger it. There’s even a bunch of Tribble devices. I guess they relax you and thus make you more resilient to certain kinds of attacks (like, “ice tribble” makes you less susceptible to Breen ice attacks, etc.).

The main difference in your character’s status page and that of the bridge officers is that you have a “kit” slot. At some points in the game, you come across a kit. Most will not match your character’s chosen profession, but those that do will give you bonuses and skills if you drag them to that slot, where they’ll kick the previous kit back into your inventory. There’s also a little bracket or three to the left of the kit slot that can hold one or more “kit modules” with additional abilities, like additional combat skills. Note that when you remove a kit and put it in your inventory, it will take along your kit modules, so if you want to use those in a new kit, take them out first.

Dilithium and Duty Officers

The Duty Officers Window
At some point, you will get a bunch of Duty Officers. Duty Officers are not Bridge Officers, they are more like bonus cards that you can draw. There are duty officers that can make your shields restore faster, duty officers that you can call for help on a ground mission to get an extra rifle against the enemy, and similar stuff.

There’s a whole separate window for duty officers that is basically covered in the tutorials. But there are 2 things you can do with duty officers: You can put them on Active Space/Ground Duty
(which means you will benefit from their abilities), or you can send them off on assignments.

Refining Dilithium

The latter is essentially a gamble where you are not able to use a Duty Officer’s abilities for a specified time (I’ve seen durations from 30 minutes to 72 hours, real time, but you don’t have to be logged in). In exchange, if the random number generator isn’t against you, you get small items, skill points (meaning you can increase your rank this way), additional duty officers (“refugees” or “prisoners”), Bridge Officers, or other kinds of currency. In particular, you can get Dilithium, which you can use to buy stuff at certain in-game stores. You can also get some of these items as occasional drops from missions, but getting them and not really having to do anything sounds kinda preferable.

That said, most missions give you about 5 Dilithium or so, and items in the Dilithium store cost somewhere in the 5-figures range. Also, once you have Dilithium, you have to refine it on the “Assets” tab of the window that has your inventory, and you can at most refine 8000 Dilithium per day. So even if you find more than 8000, it’ll take 3 days to get enough “refined” for one of the smaller items. And you can’t get it all from the few Duty Officers (assignments are limited, as are DOffs), so you’d have to also take on some of the repeatable missions where you mine or earn Dilithium.

Special Events

Star Trek Online often runs special seasonal or promotional events where stuff you would have to pay for is free for a little while. You can then “buy” those items in the store for 0 ZEN. Some events also include a temporary ceasefire, where e.g. even Klingon characters can fly to Risa in federation space and play some of the missions there. So keep an eye out for news on special events, particularly if you don’t plan to spend money. There is also a live stream on Twitch every week where they give away stuff.

Fleets and other Players

Whenever you’re in one of the bigger areas with other players, it can happen that you get a little pop-up window requesting you join a fleet. Fleets are groups of players. I.e. actual humans banding together and playing as a team on-line. There’s an NPC in the game that can give you more info, but you don’t have to join any fleets right away. Wait a little, get to know the game, then investigate what fleets are good for and which one you want to join later. OTOH, if you find a good fleet, they might help you get started with the game.

The Foundry

Vacation in your own engine room
The Foundry is the name of the user-generated missions on STO. Once you’ve completed the tutorial, you can play additional missions there (they have their own tab in the Missions window). I’ve found some quite well-written and fun episodes there, and before you start them you can even see a rating whether they’re ground or space missions (or a bit of both) or have story etc. I quite enjoyed The Mayns of Balnar Moon.

PS – Sometimes, there are balloons in the game. And why don’t you try visiting your own ship’s bridge and walk around the corridors and check out the engine room? Hint: You get there somehow using the mini-map window.

Update: Now that I’m past Level 40, I’ve corrected some of my conclusions. In particular, Romulan turns out to not quite be as cool as it originally sounded, and I added mention of the Exchange and arranging your tray.

Update: Now that I’m at Level 50, and have also created a few additional characters and leveled them up a bit, I’ve added more info on character classes and things outside the game, bridge officer skills, bound items, and accidental warping during auto-travel in space.

Update: Updated to reflect some of the changes in how duty officers now work differently from your character, and how you probably want to start out as a Fed character. Also added a mention of Loadouts to work around a bug, and a trick I found to determine mission start locations.

Enough with the NSStatusItems! Teach your app its place!

I see more and more applications implemented as NSStatusItems in the upper right side of the menu bar. In this posting, I’ll lay out why this is a worrying development, and why you should rarely implement NSStatusItems.

Screen real estate

The menu bar is very precious screen real estate, and the most expensive part of your computer. It takes up a permanent 22 points at the top of your screen (if you have several screens, it may even show up on every screen). The menu bar is fixed in position and size, different from other windows, and no other window can inhabit these sacred pixels. You can’t switch it behind another window. It is always visible, always immediately clickable.

It is also used for an important part of the user interface of the current application. All of an application’s menus have to fit into this area. There is no scrolling, no wrapping to a second line.

Perspective of importance

One of the fundamental rules of UI design is to arrange UI elements by their importance. Things that provide information the user constantly needs to be aware of, or that are constantly used should always be in view/at a single-click range, while things the user uses less can be relegated to less easily reachable spots that might require several clicks to get to.

The document window (or main window in the case of a shoebox application like iPhoto) is the top of this hierarchy. That’s what the user works with most of the time and where her attention is focused. Floating palettes are also near the top.

Things you can’t put directly in front of the user like that go in a menu, where the user needs to click to discover them or trigger them. If something is even less important or needs to display information more complex than is desirable to put in a menu item, it can go in an auxiliary window shown by a menu item.

Popovers, while relatively new to the scene, are kind of halfway between these two. On one hand you need to click to open them, like a menu, on the other hand you can’t have as many of them as you can have menus. They also occupy a half-way position between a menu and a modal window. They can contain more complex controls.


So, now that we know how limited room in the menu bar is, and how it is the second go-to location after you’ve run out of main window space, where does NSStatusItem fit in here?

Well, NSStatusItems can show information in their icon, and otherwise work like a menu. They can immediately react to a click (like the “Notifications” icon in the upper right of the screen) or show a menu, or a popover.

They are also visible across all applications. As such, they are a permanent, most reliable fixture in the user interface. Always visible, always clickable. It is prime real estate if there ever was one.

From this follows that it should only hold functions that inhabit exactly this place for the user: Something that is needed no matter what application is frontmost. Something that is constantly needed, not just occasionally when the user is working on one particular project. Or something that indicates some important piece of information, like how long the computer’s battery will last.

The reality of status items

Compare that to the reality we’re living with today: Every Twitter client I’ve used so far had a status item by default. A status item and a dock icon. At the time of this writing I’ve written well over 57’000 tweets, but even I don’t think that Twitter is that important. One dock icon is fine for seeing new tweets and posting a new one. It’s one click away.

I’m sure some users disagree, but really, is that the majority? Does it have to add that status item and take up dock space by default? Can’t it just leave this as a feature that the user can activate if they think it is needed?

Similarly, there are applications that perform periodic clean-up tasks in the background. Maintenance. Do I really need to see those applications’ icons in my menu bar permanently? Couldn’t they just show their icon when they are doing work, then remove it again? Couldn’t they be a GUI front-end with a background helper application that magically does its work? How often do I manually need to trigger a re-scan of my movies folder to see if it contains new files if the application watches the folder for changes anyway? If this really is just a workaround for rare bugs, why not make me launch the GUI front-end to achieve that and stay out of my menu bar?

There are applications that let me run a server, for testing, locally, on my computer. Why can’t they just be a regular GUI front-end with the server as an invisible background process? Why can’t they just add a bookmark file somewhere that I can launch using Spotlight instead of making me use a different item in the precious status item area of the screen to open the URL for that server?

Why does everyone have such an inflated sense of the importance of their app that they need to have an icon in the menu bar?