Uli's Web Site
[ Zathras.de - Uli's Web Site ]
Other Sites: Stories
Abi 2000
Stargate: Resurgence
Lost? Site Map!
     home | blog | moose | programming | articles >> programming

 Source Code
 Macintosh Applications
 Filie (discontinued)
 Look and Feel Podcast

Source Code

Be sure to also check out my GitHub repositories.


A neat little header file with commonly-used macros for Objective C programming. These include GNUstep-style ASSIGN(), DESTROY() and CREATE_AUTORELEASE_POOL() to make it less work to write Objective C 1.0-style accessors and mutators, and to make it less annoying to write thread methods.

It also contains a UKLog() macro that prints messages beginning with the name of the method or function that called them, and prints only in the development ("debug") version of an app, and turns into a no-op for release.

Finally, it contains a PROPERTY() macro that allows you to pass property (i.e. instance variable) names to KVO and KVC methods as strings, but performs type checking on them so typos are caught (which doesn't work with string literals).
View Archive Contents
UKCrashReporter 0.3 / UKFeedbackProvider 0.6
Call one function at startup to bring up a crash report window and send crash reports plus other pertinent information to a CGI on your server. This can now also be used to let users provide feedback with an API compatible to that of the UKFeedbackProvider in NiftyFeatures. This version is Leopard-compatible.
0.3 fixes a bug where leftover Tiger crashlogs would override ones in Leopard, and adds a missing source file.

If you write your CGI in PHP, it'd look something like this:

$crashlog = $_REQUEST['crashlog']; // May have to utf8_decode this on some setups.

mail( "email@example.com", "Crash Report", "\r\n\r\n".$crashlog);
View Archive Contents
A small handy drop-in class lets you easily add menu items that show the "Readme", "Release Notes" and "FAQ" sections of your application's help book. Simply looks up the appropriate anchors.
View Archive Contents
UKXMLPersistence 0.2
This is source code for a very simple XML parser and writer that takes an NSDictionary/CFDictionary and creates XML from it, or reads an XML file and creates a dictionary from it.

It does this like the property list serialization stuff in CoreFoundation, with the exception that it uses the keys as the tag names and the values as the tag data. Thus, it generates much more readable XML than property lists.

Suitable both for Cocoa and Carbon.
View Archive Contents
UKSyntaxColoredTextDocument 0.4
An NSDocument subclass that implements a simple text editor with syntax coloring. Comes preconfigured to handle Objective C source files, CSS or HTML, and can be adapted to similar languages easily. Also supports "go to line"/"go to character" menu item and maintaining the previous line's indentation when a new line is added.

This version can use file suffixes to choose the correct syntax coloring scheme, improves indent/unindent, made new coloring schemes support user identifiers and contains miscellaneous stability fixes.
View Archive Contents
UKDirectoryEnumerator 0.3
A faster, more configurable variant of NSDirectoryEnumerator. Uses the Carbon FSGetCatalogInfoBulk() call under the hood to do its work, and gives you greater control over what additional file info you want. One advantage of this is that you get HFS-specific file info (file type, creator, Finder flags, resource fork sizes) for free.

This version makes it a more general wrapper around FSCatalogInfo stuff, adding a category to set/get HFS file attributes. Also adds factory methods and other stuff.
View Archive Contents
UKProgressPanel 0.2
Two classes that implement a Finder-style progress window with a scrolling list of progress bars plus status text and "Stop" button. Written to be as easy to use as a progress bar. Can be used easily from other threads.
View Archive Contents
UKToolbarFactory 0.2
A simple delegate class that you can drop into a NIB file to add a simple toolbar to your application. You specify the list of allowed items and the default list of items in a .plist file, hook it up to the window and it will automatically be configurable and save automatically.

Now also supports simple view-based and selectable items.
View Archive Contents
UKTurboExport 0.1
A neat little sample app that illustrates how to use Elgato's Turbo.264 USB
stick for exporting QuickTime video to H.264 with hardware acceleration in a
Cocoa application.

Lets you choose from among the built-in presets, and notifies you of device

OUTDATED: Elgato now install a Turbo264.framework along with the Turbo application that contains an official API very similar to this. You can e-mail them to get sample code for using that.
View Archive Contents
UKFilePathView 0.1.1
An NSView that displays a file path. This looks kind of like how Sherlock displays the location of a file. Basically you get each folder's display name with its icon in front of it, and little grey triangles between them, and you get the icon of each file or folder and its display name.

If the path is too long, this takes items out of the middle and displays an ellipsis character (...) instead.

You can also right-click or control-click on this to get a contextual menu that contains "Reveal in Finder" and "Show Real Names" menu choices. Real names displays the actual path, starting with "/", and using the actual file names instead of their display names. As a shortcut, double-clicking this view is the same as "Reveal in Finder".

Finally, this also lets you hook up buttons to the view to let you choose an existing, or new file or folder name.

This release adds the missing dealloc method and lets you specify a placeholder string.
View Archive Contents
Macoun-Beispielcode: Plug-ins, Frameworks und Bruechige Basisklassen
Der Quellcode zu den Demos in meinem Vortrag ueber Plug-ins und Frameworks auf der Macoun 2009.

Sample code for the demos in my session on Plug-ins and Frameworks at the Macoun conference 2009.
View Archive Contents
NiftyFeatures 0.4
An example project containing two classes, UKUpdateChecker and UKFeedbackProvider that can be plugged into your applications to add "Check for Update..." and "Send Feedback..." menu items to your applications.
(xCode project)
0.4 Makes UKUpdateChecker do most of the work in a separate thread, to prevent blocking at startup when the computer doesn't have an internet connection.
View Archive Contents
ShadowCopy 0.1

Shadow Copy is a small tool that tricks Spotlight into indexing your CDs so you can search over them even while they're not inserted. It achieves this by creating folders with aliases to all files of a CD on your hard disk whenever a new volume is mounted.

Includes source code for a background-only app with status item and NDAlias sources for creating alias files.
View Archive Contents
MachO - CFM Glue
Four functions that let you turn CFM function pointers into MachO function pointers so you can call them from MachO applications, and for turning MachO function pointers into CFM function pointers so you can pass them into CFM code fragments to have them called.

Back by popular demand.
View Archive Contents
NSWindow+Fade 0.1

This is a little extension to NSWindow in the form of a category that adds a few methods for fading in/out a window.
View Archive Contents
Dan's Runtime
Dan's Runtime is an example of how one can implement a runtime for an object-oriented programming language in C (well, almost, it uses a few C++-isms).

It demonstrates how to implement object-oriented classes with method calls to overridable methods, and also implements a generational incremental garbage collector as well as a mark/sweep garbage collector.
View Archive Contents
UKIdleTimer 0.1

This is a wrapper around the Carbon EventLoopIdleTimer, intended to be used just like an NSTimer. An Idle Timer doesn't trigger until the user has been idle for a while, doing nothing in the GUI of the current application.
View Archive Contents
Verpack 0.4

Verpack is a tool I wrote to save me work redistributing Xcode projects. Verpack reads the project's list of files and copies all files except those in the "Products" and "Frameworks" groups and the project file itself, and arranges them in a distribution folder next to your project, maintaining the folder hierarchy.

0.4 now filters out .DS_Store files, .svn folders and the XX.pbxuser and XX.mode2 files in Xcode projects. Also includes full source code.
View Archive Contents
UKDebugNames 0.1
A little debugging helper function that assigns each pointer a name. That way, you can NSLog() pointers and will get nice, memorable names instead of 0x00848400.

This code is under an MIT license, i.e. free for whatever use you see fit. Though I doubt you'd include it in a shipping product.
View Archive Contents
UKSoundFileRecorder 0.1.1
This is a Cocoa class that uses CoreAudio to record sound from the system's default sound input and writes it to a file.
View Archive Contents
A little study on how one could make window management more flexible. This class lets you define areas of a window that can be "torn out" into their own windows, or moved into another window simply by dragging and dropping.

This allows both for the proliferation of windows that I personally prefer, as well as for stashing all of the "torn out" elements into a single window for those who prefer that.
View Archive Contents
UKDockProgressIndicator 0.1
A class that shows a small determinate progress bar overlaid over your application's dock icon.

This is intended as a drop-in replacement for the NSProgressIndicator view, as it understands the same messages. You can even have the dock progress indicator forward all calls to the view, thus driving both without changing your existing code.
View Archive Contents
"Made With Cocoa" Buttons

These are three graphics in two different file formats (PNG and TIFF) that you can use in your applications and on your web sites to advertise that you wrote them in Cocoa. The "rounded" variants are IMHO prettier, while the rectangular variant is a little sharper. There's also one on a Sparkle-style black button. Pick the one you like.

I hope that by releasing these images, the Cocoa community will finally have some badges for advertising Cocoa that fit the quality of the applications they're put on.
View Archive Contents
UKSpeechSynthesizer 0.2
A wrapper class around the Carbon SpeechChannel that tries to be compatible with but also expands upon the features of Apple's NSSpeechChannel.

Also included is UKSpeechSettingsView, which provides a simple user interface for modifying the settings of a speech channel.
View Archive Contents
Two classes for playing back sound using the AudioQueue/SystemSound APIs, which try to be easy to drop into code originally written to use NSSound. These classes were originally written for use on the iPhone, but should also work on Mac OS X.

Licensed under the MIT license.
View Archive Contents
This is the source code to Filie, my abandoned attempt at a Finder clone. The code is basically under the GNU GPL v2, but some parts of it are dual-licensed, and thus either also available under a Modified BSD license, or available for paid commercial licensing.

This code hasn't seen development in years, doesn't have all features and is known to have bugs, but has been compiled under 10.5 "Leopard" and boots up and shows file list windows.
View Archive Contents
A silly little sample app that replicates Dashboard's "flip over a window to see its back side" effect. I'm doing all of this manually (NSAffineTransform seems to only let you rotate and scale stuff), so it isn't blazingly fast, but maybe it's of use to someone.

For what it's worth the actual code is in a category on NSWindow, so you should be able to copy this and use it fairly painlessly in your own apps. Just remember to credit me and I'll let you have it for free.

Contains a built executable so you can try it out right away without having to compile the sources.
View Archive Contents
UKDiffView 0.1
A handy little utility class for displaying diffs generated using the diff command line tool in a graphical fashion.
View Archive Contents
UKDistributedView 0.5.1
This NSTableView-like class displays items in a way similar to the Finder's "Icon View". It can use any NSCell for displaying items, and the items can be arbitrarily positioned. A Finder-style cell is included.

Selection of items is handled for you, and items can be rearranged, dragged and dropped in a number of ways. When embedded in an NSScrollView, a distributed view will automatically resize to fit around all its items, and you can snap item positions to a grid.

This version fixes some bugs in keyboard navigation.
View Archive Contents
UKXattrMetadataStore 0.1
A wrapper around the MacOS X 10.4 xattr APIs for attaching metadata to files. Also offers convenience methods for dealing with UTF8 strings and property-list-objects as the metadata values.
View Archive Contents
UKPrefsPanel 0.4.1
A simple delegate class that makes it easy to create a simple Preferences window. Put your different preference panes in a tabless NSTabView, connect that to an instance of UKPrefsPanel, and you automatically get a toolbar with icons for each tab pane that switch between the tabs.

Added missing dealloc call.
View Archive Contents
UKLoginItemRegistry 0.1
A Cocoa wrapper class around Apple's LoginItemsAE sample code. Get Apple's LoginItemsAE code at:

View Archive Contents
This is a little hack (originally part of my MovieTheatre sample code) that uses poseAsClass: and some class-dump-generated headers for a few of Apple's private classes to change the background and text color of a brushed metal window.

Note that this is a completely undocumented hack, and not recommended for production code. USE AT YOUR OWN RISK. If you just want a different color or pattern for your metal windows, use NSWindow's setBackgroundColor: method instead.
View Archive Contents
A small class that you hook up to your "Format" menu to append a font menu to your menu bar. It will automatically list all collections (or a specific one) from the font panel and thus provide quick access to all your fonts without having to open the font panel.
View Archive Contents
UKKQueue 0.5
A wrapper class around the kqueue file change notification mechanism.

Simply create a UKKQueue, add a few paths to it and listen to the change notifications via NSWorkspace's notification center or delegate messages.

This version of UKKQueue contains general code improvements, more comments, and improves the FNSubscribe-based file watcher it also contains.
View Archive Contents
MacScare 1.3.3 Source Code
The Cocoa source code to MacScare, under the GPL. This requires the Unix Scare source code, available from http://ftp.ifarchive.org via FTP.
View Archive Contents

Created: 2004-10-08 @855 Last change: 2010-03-13 @835 | Home | Admin | Edit
© Copyright 2003-2024 by M. Uli Kusterer, all rights reserved.