environment
methodGrowl.framework
into your application bundle.
Pick a class to be the contact point with Growl. Your AppController
class is a good place. Import <Growl/Growl.h>
Set the delegate to the GrowlApplicationBridge
:
[GrowlApplicationBridge setGrowlDelegate: self];Doing this will eventually have the
registrationDictionaryForGrowl
delegate message called. Return a dictionary with two arrays (Which can be the same). These are the names of the alerts you will be posting. These are human-readable, so you'll want to use a localized string (which I've already set in the global variable here:
- (NSDictionary *) registrationDictionaryForGrowl { NSArray *notifications; notifications = [NSArray arrayWithObject: g_timesUpString]; NSDictionary *dict; dict = [NSDictionary dictionaryWithObjectsAndKeys: notifications, GROWL_NOTIFICATIONS_ALL, notifications, GROWL_NOTIFICATIONS_DEFAULT, nil]; return (dict); } // registrationDictionaryForGrowlAnd use this to post a notification:
[GrowlApplicationBridge notifyWithTitle: @"Woop! Time has expired!" description: @"You have been waiting for 37 minutes" notificationName: g_timesUpString iconData: nil priority: 0 isSticky: NO clickContext: nil];Consult the SDK documentation for more explanations of the features, but they are pretty self-explanitory.
float blah = FixedToFloat(someFixedvalue);other goodies in
FixMath.h
NSString *languageused = [[[NSBundle mainBundle] preferredLocalizations] objectAtIndex: 0];(thanks to Glenn Fawcett for this one!)
~/Library/Application Support/Chimera/Profiles/default/xyz.slt/prefs.js
file:
user_pref("browser.urlbar.autocomplete.enabled", false);
- (NSTimeInterval) timeOfVideoAtURL: (NSURL *) url { AVPlayerItem *movieItem = [AVPlayerItem playerItemWithURL: url]; CMTime duration = movieItem.duration; Float64 seconds = CMTimeGetSeconds (duration); return (NSTimeInterval)seconds; } // timeOfVideoAtURL
NSString
has a couple of convenience functions for print out basic structures like NSRect
and NSSize
:
NSStringFromRect (someNSRect);
NSStringFromPoint (someNSPoint);
NSStringFromSize (someNSSize);
NSSearchPathForDirectoriesInDomains
is how you find the location of things like Library directories, or User directories, document directory, and the like (this is the NSSearchPathDirectory
). The NSSearchPathDomainMask
is what domains to find things in. For instance for a NSLibraryDirectory
, a NSUserDomainMask
will give you the path to ~/Library
, NSSystemDomainMask
will give you the path to /System/Library
, and so on.
The directories inside of Library, like "Preferences" and "Application Support" are in English in the file system, and the Finder presents localized versions to the user. If you need ~/Library/Application Support/Borkware
, you can construct it like
NSMutableString *path; path = [[NSMutableString alloc] init]; // find /User/user-name/Library NSArray *directories; directories = NSSearchPathForDirectoriesInDomains (NSLibraryDirectory, NSUserDomainMask, YES); // if you had more than one user domain, you would walk directories and // work with each path [path appendString: [directories objectAtIndex: 0]]; [path appendString: @"/Application Support"]; [path appendString: @"/Borkware"];
NSUserName()
or NSFullUserName()
.
Thanks to Peter Hosey for letting us know about a better API for getting these.
logo.jpg
)
logo.jpg
that's on the thingie drive
logo.jpg
file/Developer/Tools/SetFile -a V /Volumes/thingie/logo.jpg
Image->Convert Image
will let you compress the image. As a side-effect of the compressed format, this makes the image read-only.in:inbox is:unread
~/.MacOSX/environment.plist
. Make the root a Dictionary, and add the key/value pairs (all strings) to it. Don't forget to logout and back in.% sudo mdutil -i off /
#importint main (int argc, char *argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; [pool release]; } // main
And you can compile it on the command line with:
cc -o test -framework Foundation file-name.m
% defaults write -g NSScrollAnimationEnabled -bool NO
% /usr/bin/mdimport -d2 ../Book.pdf >& oopack.txtAnd edit out the little bit of extra metadata output.
ld: multiple definitions of symbol OpenSP::Text::~Text [in-charge]() Entity.lo definition of OpenSP::Text::~Text [in-charge]() in section (__TEXT,__text) Group.lo definition of OpenSP::Text::~Text [in-charge]() in section (__TEXT,__text) ld: multiple definitions of symbol OpenSP::Text::~Text [not-in-charge]() Entity.lo definition of OpenSP::Text::~Text [not-in-charge]() in section (__TEXT,__text) Group.lo definition of OpenSP::Text::~Text [not-in-charge]() in section (__TEXT,__text) Param.lo definition of OpenSP::Text::~Text [in-charge]() in section (__TEXT,__text) Param.lo definition of OpenSP::Text::~Text [not-in-charge]() in section (__TEXT,__text)These are caused by the class in question (Text) not having an explicit destructor declared, so the compiler is creating one for us in each of the files. In Text.cxx, add
Text::~Text() { }and in Text.h, add
~Text();to the Text class. (I got it to compile and link, so I didn't go back to check to see if just sticking
~Text() {}
in Text.h would work.)gcc -dynamiclib -o .libs/libogrove.0.0.1.dylib Node.lo LocNode.lo -lm -lc -install_name /usr/local/lib/libogrove.0.dylib ld: Undefined symbols: vtable for __cxxabiv1::__class_type_info vtable for __cxxabiv1::__si_class_type_info operator delete(void*) operator new(unsigned long) ___cxa_pure_virtual ___gxx_personality_v0 /usr/bin/libtool: internal link edit command failedThe link line needs to have "-lstdc++" added to the end. For OpenJade, edit the libtool script and add
-lstdc++
to the end archive_cmds
line. (but leave it inside the last closing double-quote)lsregister
tool that lives in /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support
% defaults write com.apple.mail PreferPlainText -bool TRUE
/Library/WebServer/Documents