earthlingsoft Code

This page contains code which we wrote at some stage and offer for use in your projects. We do not claim that it is good or new code, but it does exist, so we better let it hang out on the internet than having it rot away on our hard drives.

Unless noted otherwise the code is provided under the condition that adequate thanks to earthlingsoft are given in case you ship it in an application and – while you are encouraged to let us know about any deficiencies you find –  you waive any rights to ridicule us about its quality. In addition we will not take any responsibility for whichever damage the code might cause on your side.

The last changed items should come first in the list. In case you are interested in our RealBasic work from the 1990s, check out the RealBasic page.


Bonjour Icon Bookmark Advertiser

An application which reads the web pages currently opened in Safari and advertises the name and URL of each of them via Bonjour. Each bookmark is advertised as a Service of type _urlbookmark._tcp and the relevant information is contained in the Service’s TXT Record. This makes it easy to read the information and due to the length limitations of TXT Records (read: programmer laziness) means it will fail for very long URLs.

The main purpose of this tool is to send a web page that’s viewed in Safari on the Mac to Mobile Safari on the iPod touch or iPhone without needing to type or send an e-mail. In fact, the Flame Touch application will do – among other things – just that and offers a handy button for opening the web pages advertised in this fashion.

Objective-C implementation file icon ESCursors

Class with a number of methods returning a wide variety of cursor graphics. The cursors in question are arrow cursors with one, two, three or four arrows at the size and rotation of your choice. If desired, one of the axes of the cursor can be curved. Try out Symmetries to see them in action.

Objective-C implementatin file icon NSBezierPath (ESPoints)

An Objective-C category on the NSBezierPath class. It provides the method -drawPointsAndHandles which draws handle control points as green circles, handles as green lines and anchor points as red squares.

The category is particularly useful when debugging Bézier Paths as it lets you see the underlying data with a single method call.

Xcode project icon Database Encodings fixer

A hack written to fix the wrongly encoded data in a MySQL dump. It goes through the file line by line, checks whether a line has been mis-encoded (as in: written as UTF-8, then read as Latin-1 or CP-1252 and then re-written as UTF-8), attempts to fix the problem and logs the result.

This probably won’t match other people’s problems exactly but it may be a good starting point.

generic plug-in icon Quartz Composer in Sudden Motion

The interesting Quartz Composer technology was introduced in Mac OS X.4 and it started supporting non-Apple plug-ins in Mac OS X.5. Quartz Composer in Sudden Motion is such a plug-in and it provides current data from the sudden motion sensor of a portable Mac to Quartz Composer. That way you can animate things depending on movements of the machine.

Quartz Composer in Sudden Motion uses the unimotion library to access motion sensor data.

Automator robot iconAutomator

Some rather specific attempts at trying to create automator actions for working with PDF files. This turned out to be rather tricky as developing for Automator required a lot of fiddling. Particularly for this case as PDF Kit likes destroying things like the table of contents when you modify a file (that was back in the X.4 days), so the projects were abandoned.

WARNING: rough and ugly.

Add Metadata to PDF Action
Action that’s supposed to add author and title metadata into the PDF file (for better Spotlight indexing, say).
BibDesk Actions
Attempt do make Actions for BibDesk to Fill-in Publication’s Metadata, Get Bibliography and get Selected BibDesk Publications.
Test workflow
A Workflow to test the created actions.

generic application icon Waveform Checker

A sound generator application based on simple waveforms. The application provides five waveform generators where you can set waveform (sine, rectangle, triangle, sawtooth), amplitude, phase and octave individually. The base frequency and stereo position can be set globally. Single waveforms can be exported to AIFF files.

The included WaveformChecker Objective-C class can be used separately which is done, for example, in Ballerburg and Touch Tone Checker.

generic application icon Location Checker

A small tool that lets you associate printer names to wireless network names. Launching it, looks up the name of the current wireless network and then sets the default printer according to the set up.

The application features a very simple use of CoreData and uses clumsy command line tools to do the actual work. If you are looking for an application that’s much more powerful and very good at this job, try out Marco Polo instead.

generic application iconSkip Tunes

Skip Tunes is a little application which reads data from a portable Mac’s sudden motion sensor and tells iTunes to skip to the next track when rapid acceleration occurs. That way you can just slap the machine if you don’t like the music.

Skip Tunes was the predecessor to Skip Checker

ASCII Projektor application icon ASCII Projektor 1

The first version of our ASCII Projektor application. It is based on Apple’s ASCII Movie Player sample project for the command line tool and provides a graphical user interface made in AppleScript Studio for that.

CallChecker application iconCall Checker

CallChecker is a simple application that polls fli4l routers for incoming ISDN calls. CallChecker will notify you when your phone is ringing and even show the caller’s name if the caller’s number is stored in the Mac OS X Address Book.

CallChecker is free software, and you are welcome to redistribute it under the conditions of the GPL public licence. The GPL licence is included with CallChecker.

generic application iconNP Checker

NP Checker provides a service to other application’s Services menus which inserts a string for the song that is currently playing (NP == Now Playing) in iTunes. The relevant information is acquired by running an AppleScript and said script can be replaced by a different one in case an alternate music player is used.

An exercise in implementing a Service and executing an AppleScript from Cocoa.

generic application iconScribbler

Scribbler was developed to get nice vector paths from drawing on a graphics tablet. It picks up cursor positions and builds a simple NSBezierPath from them which can then be saved to PDF. Unfortunately mouse events come in at a rather sparse rate in Cocoa which means the paths look rather angular most of the time. Hence the project was stopped.

Uses: custom view, cursor input, saving to PDF.

Secrets Checker document iconSecrets Checker

Secrets Checker was a first attempt at becoming acquainted with Cocoa programming. It keeps a list of items, storing text for each of them and saves them to a file which, if GPG is installed on the machine with the right magic incantations will be encrypted before saving.

The application features using of external processes and piping data to and from them, a little bit of interaction with GPG and the up-to-now inexplicable NSOutlineView redrawing bug of Cocoa. It also does filtering of the contents it displays and has an amusing feature which lets you drag a folder from your hard drive onto it to recursively add all items it contains.