SIGPIPE 13

Programming, automation, algorithms, macOS, and more.


Posted by Allan Odgaard

{{ numberOfComments('2005-09-24-deciphering-an-nsevent') }}

Deciphering an NSEvent

Since I need to handle key equivalents myself, I need to mimic how the system does it.

After having spent some time investigating this, it seems to be impossible to do with the info provided by NSEvent, but I ended up creating a heuristic which works fairly well (but isn’t perfect).

Read the rest of the post »


Posted by Allan Odgaard

{{ numberOfComments('2005-07-26-shell-calculator') }}

Shell Calculator

They say that old habits die hard, and the following is probably an example of such.

Read the rest of the post »


Metadata Workarounds on Tiger

Tiger introduced functions for file metadata in the BSD layer (see man setxattr for more info).

File metadata is something most programmers have wet dreams about, and naturally I started to use these new functions in TextMate 1.1b12. After this I got several reports of kernel panics when saving files to AFP mounted volumes (personal file sharing).

Read the rest of the post »


Posted by Allan Odgaard

{{ numberOfComments('2005-05-19-oniguruma-c-wrapper') }}

Oniguruma C++ Wrapper

I’ve recently partially switched to the Oniguruma regular expression library.

Since I also use regular expressions in my source code I’ve created a simple C++ wrapper which makes the API more friendly to my tasks. I generally work with iterators, and there are 4 tasks I often do.

Read the rest of the post »


String List Value Transformer

It’s been a while since I last wrote something — the reason for this is that I’ve been busy working on TextMate, but now that I have a free moment, let me tell you about this general tag value to string transformer I use when I bind radio or popup buttons to my user defaults (to get a string stored in the user defaults instead of an integer).

Read the rest of the post »


Posted by Allan Odgaard

{{ numberOfComments('2004-09-13-iterating-an-array') }}

Iterating an Array

Over at CocoaDev they are discussing how to efficiently iterate an NSArray.

I would really never ever think that the way you iterate an NSArray has any impact on the perceived performance of your program (granted you do not change the time complexity or do other stupid things), I would however think that it affects the perceived complexity of the source.

Read the rest of the post »


Increment build number for deployment builds

If we want to distribute “deployment builds” regularly (e.g. to our betatesters) it pays to automate the process. A deployment build can be done from the command line using:

xcodebuild clean
xcodebuild -buildstyle Deployment

But if we do this, we probably also want to bump the version number, or at least the build number, so that we can distinguish between the different builds.

Read the rest of the post »


Posted by Allan Odgaard

{{ numberOfComments('2004-09-12-disabled-image-buttons') }}

Disabled Image Buttons

Some time ago Apple introduced these small whitish image buttons mostly for use with table views (for adding and removing items), an example is shown here:

Row of image buttons

The buttons have three states, and Apple use images for each of these three states since the border is part of the image, so if NSControl renders it pressed or disabled, it will affect the border. Unfortunately Interface Builder only lets us set a normal image and an alternate image (which can be used as the pressed-image by setting “behavior” to “momentary change”).

Read the rest of the post »


OpenSSL for License Keys

In this article I will give an example of how one can generate and verify license keys (also known as serial numbers) using the tools included with Mac OS X, and in a way which should make it difficult for the cracker to generate his own fake license key(s).

Read the rest of the post »