
Limit NSNotifications to Notify Within NSBundle Instances Only
NSNotifications are wonderful. So long as when using them within an NSBundle, one keeps the fact that notifications are broadcast to all instances of the bundle in mind.
To limit certain notifications to be bundle instance specific, one could append a unique id to each notification name.
For notifications sent and received by one class, this is trivial:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | - (id) initWithRepresentedObject:(id)inObject { self = [super initWithNibName:@"COIMMContentView" bundle:[COIMMPlugin bundle]]; if (self) { [self setRepresentedObject:inObject]; optionsController = [[COIMMOptionsController alloc] init]; uniqueNotificationId = [[NSProcessInfo processInfo] globallyUniqueString]; NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; [notificationCenter addObserver:self selector:@selector(rwDocumentDidAddPages:) name:[kCOIMMRWDocumentDidAddPagesNotification stringByAppendingString:uniqueNotificationId] object:nil]; [notificationCenter addObserver:self selector:@selector(rwDocumentDidRemovePages:) name:[kCOIMMRWDocumentDidRemovePagesNotification stringByAppendingString:uniqueNotificationId] object:nil]; } return self; } |
This implementation would not be ideal for cases where notifications are intended to be sent and received by different classes, but for my immediate use case, it works.
Popularity: 1% [?]
How to Open Rapid Weaver in Terminal
You use Rapid Weaver. You’ve downloaded the latest greatest plugin and can’t wait to try it out. You install it …and… nothing. After contacting the developer, and they go through basic trouble shooting with you. That goes no-where. Eager for more information on the issue, the developer asks you to please open Rapid Weaver in the Terminal, and copy-paste any output to them.
This article describes exactly how to do this.
First, you’re going to open Terminal. It is located within the “Utilities” sub-folder of your standard “Applications” directory.
Next, open Terminal.
Now find Rapid Weaver, and drag it into the open Terminal window.
Next, paste the following onto the end the line in Terminal that was created when you dropped Rapid Weaver onto it:
/Contents/MacOS/RapidWeaver
Make sure that there is no space between “RapidWeaver.app” and the extra text you’ve pasted. It should look something like this:
Now, click inside the Terminal and press Enter. Notice that Rapid Weaver will start, and some (possibly a lot!) text will appear in the Terminal window. This text is gold for developers.
If whatever issue you’re experiencing requires certain actions to replicate, perform those actions – Rapid Weaver might be printing information related to the issue in the Terminal. After you’ve replicated the issue, select all of the text inside the Terminal window and paste it into an email, then send it off to whoever you’re working with.
Popularity: 2% [?]
Listing Methods at Runtime in Objective C
Before getting into creating my next Rapid Weaver plugin, I needed to do some experimentation to make sure what I wanted to achieve was possible. Wanting to manipulate some aspects of RWPage objects, I first required a list of methods for the RWPage class.
Thanks to Matt Gallagher’s IMP of the current method entry, I was able to generate my method list with the following code:
#import "objc/objc-class.h" // Iterate over the class and all superclasses Class currentClass = [RWPage class]; while (currentClass) { // Iterate over all instance methods for this class unsigned int methodCount; Method *methodList = class_copyMethodList(currentClass, &methodCount); unsigned int i = 0; for (; i < methodCount; i++) { NSLog(@"%@ - %@", [NSString stringWithCString:class_getName(currentClass) encoding:NSUTF8StringEncoding], [NSString stringWithCString:sel_getName(method_getName(methodList[i])) encoding:NSUTF8StringEncoding]); } free(methodList); currentClass = class_getSuperclass(currentClass); }
Method list acquired, the process of whittling it down until I found the one I wanted began.
Popularity: 2% [?]
Slider 2.1 Released!
I’m happy to announce the release of Slider 2.1. The first major upgrade to Slider 2 represents a vast array of bugfixes and tweaks. The GUI has been re-worked, and a major feature has been added: the Slidebrary.
The Slidebrary allows one to save your favourite Slider 2 settings for use in other pages and projects. More than this, it allows one to import and export these settings. Start sharing!
Below is a more comprehensive list of fixes and upgrades that have made it into this release:
Slidebrary!
- Save your Slider 2 settings for use between projects
- Export your Slidebrary items to share with the community
- Simply drag Slidebrary items onto the Slidebrary to import!
Improvements
- Reorganized tab styling UI
- Improved Slider 2′s HTML
- Added portal body text colour controls, checkbox logic, save / loading and CSS insertion
- Updated to jQuery 1.7.1
Bugfixes
- Added custom save / load sheets
- Improved saving / loading of Slider 2 settings
- Fixed issue preventing borders from being drawn in some situations
- Added proper error handling to prevent Slider 2 from causing Rapid Weaver to crash when things go pear shaped
- Fixed issue causing export to fail if any image wells are empty
- Fixed bug that prevented background image from being generated when CSS Only checkbox was checked
- Updated various tooltips
- Fixed a bug that caused idle background images not to reappear after the Slider cell had been changed
- Make sure background repeat radio buttons are selected properly
- Updated tab wrapper height and width text input & label tooltips
- Added padding, margin 0 overrides for single tab idle CSS
- Prevent bug causing a crash when copying tab settings to all cells
- Add icon position CSS
- Tab icon is no longer created if the user hasn’t checked the ‘idle’ && ‘icon’ checkboxes
- Hover icon checkbox and controls are now disabled when idle is unchecked
- Fixed bug where tab hover text styles were applied even when hover styles had been disabled
Popularity: 5% [?]
Doxygen Graph Generation Issue “Error: dot: can’t open {dot file}”
Running Doxygen (1.7.4, Ubuntu 11.10) over one of the larger PHP applications we use at PANmedia, I ran into this error:
Error: dot: can't open /var/workspace/app/documentation/html/class_a_d_o_d_b___data_dict_a4ad217393b4e364e233cc70336d93ae8_cgraph.dot
Experimentation led to the following solution: switch DOT_CLEAN off, either via the Doxygen GUI (pictured) or directly in the Doxygen configuration file.
DOT_CLEANUP = NO
What does this do?
DOT_CLEANUP
If the DOT_CLEANUP tag is set to YES (the default) Doxygen will remove the intermediate dot files that are used to generate the various graphs.
I recall running into this error over a year ago (last time I used Doxygen), and it wasn’t until I stumbled onto the solution that I remembered solving it in the same way last time.
Documenting the solution here means that next time I use Doxygen after a long time away, I won’t have to repeat the process.
Popularity: 5% [?]




