Skip to content

Instantly share code, notes, and snippets.

View Machx's full-sized avatar

Colin Wheeler Machx

View GitHub Profile
2009-06-23 15:44:27.431 Gitty[29706:813] *** -[NSCFArray drawInRect:angle:]: unrecognized selector sent to instance 0x800031a40
#0 0x00007fff8062d8a6 in objc_exception_throw ()
#1 0x00007fff81ad051b in -[NSObject doesNotRecognizeSelector:] ()
#2 0x00007fff81aceba4 in ___forwarding___ ()
#3 0x00007fff81acecf8 in __forwarding_prep_0___ ()
#4 0x00000001000240c0 in -[BWAnchoredButtonBar drawRect:] ()
#5 0x00007fff83f8b01f in -[NSView _drawRect:clip:] ()
#6 0x00007fff83f89b05 in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#7 0x00007fff83f89ed2 in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#8 0x00007fff83f89ed2 in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#define NSDICT(...) [NSDictionary dictionaryWithObjectsAndKeys: __VA_ARGS__, nil]
#define NSARRAY(...) [NSArray arrayWithObjects: __VA_ARGS__, nil]
#define NSBOOL(_X_) [NSNumber numberWithBool:(_X_)]
//example usage
NSArray *items = NSARRAY(NSDICT(@"Hello World!", @"title",
[NSImage imageNamed:@"worldHello"], @"icon",
NSBOOL(YES), @"isAwesome"),
NSDICT(@"Good Bye, World!", @"title",
typedef void (^MyBlock)(void);
MyBlock inBlock = ^{
for (int i = 0; i < 10; i++) {
NSLog(@"Doing Something with... %i",i);
}
}; //<-- remove this semicolon here...
inBlock(); //<-- ..and clang says it's missing a ';' here
#ifdef kAPP_DEBUG_MODE
# define CWAssert(cond,desc) NSAssert(cond,desc)
# define CWAssert1(cond,desc,a1) NSAssert1(cond,desc,a1)
# define CWAssert2(cond,desc,a1,a2) NSAssert2(cond,desc,a1,a2)
# define CWAssert3(cond,desc,a1,a2,a3) NSAssert3(cond,desc,a1,a2,a3)
# define CWAssert4(cond,desc,a1,a2,a3,a4) NSAssert4(cond,desc,a1,a2,a3,a4)
# define CWAssert5(cond,desc,a1,a2,a3,a4,a5) NSAssert5(cond,desc,a1,a2,a3,a4,a5)
#else
# define CWAssert(...) /**/
# define CWAssert1(...) /**/
/*
Copyright (c) 2010 Colin Wheeler
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
#ifdef DEBUG
# define CWPrintClassAndMethod() NSLog(@"%s\n",__PRETTY_FUNCTION__)
# define CWLog(args...) NSLog(@"%s: %@",__PRETTY_FUNCTION__,[NSString stringWithFormat:args])
#else
# define CWPrintClassAndMethod() /**/
# define CWLog(args...) /**/
#endif
Invoke this script like so
./snow_leopard_garbage_collection.d -p [PID]
where pid is the process id of the app you are trying to trace
you may need to do
chmod +x snow_leopard_garbage_collection.d
to fix the permissions on the dtrace script so you can invoke it
HEAD=`/usr/local/bin/git rev-parse --short HEAD`
defaults write "$BUILT_PRODUCTS_DIR/$EXECUTABLE_NAME.app/Contents/Info" CFBundleVersion "$HEAD"
//
// CWNSStringUUIDAdditions.h
//
// Created by Colin Wheeler on 4/28/10.
// Copyright 2010. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface NSString (CWNSStringUUIDAdditions)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Colors</key>
<dict>
<key>Background</key>
<string>0.047 0.064 0.130</string>
<key>InsertionPoint</key>
<string>1.000 1.000 1.000</string>