Knowing mouse pressed time?
Hello. I want to show a custom menu when the left click its being press for about 1 second on some of my components.. I have being searching and found a apple example where the use the + (void)startPeriodicEventsAfterDelay:(NSTimeInterval)delaySecondswithPeriod:(NSTimeInterval)periodSeconds and the stopPeriodicEvents class methods. I tried implementing something like: BOOL timerOn = YES; NSPoint mouseLoc; NSLog(@before loop); NSUInteger eventMask = NSLeftMouseDownMask| NSLeftMouseUpMask | NSPeriodicMask; while ((theEvent = [[self window] nextEventMatchingMask:eventMask])) { NSLog(@onLoop); switch ([theEvent type]) { case NSLeftMouseUp: NSLog(@up); timerOn = NO; [NSEvent stopPeriodicEvents]; break; case NSLeftMouseDown: NSLog(@down); [NSEvent startPeriodicEventsAfterDelay:0.1 withPeriod:0.1]; break; default: break; } } But of course its completely wrong, it never go out from the loop... I tried a different approach usign a NSTimer, but found myself going nowhere also... Can somebody give me some advice, or where can I find info?, i have been looking around but hadn't found something... I know this should have been asked already, so there must be a way to do this. Thanks in advance .. and happy new year. Gustavo ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Knowing mouse pressed time?
Simple. Start a timer on mouse down, invalidate it on mouse up. Something like this (written in mail): NSTimer *timer; -(void)mouseDown:(NSEvent*)ev { timer=[[[NSTimer alloc] blah ...] retain]; } -(void)mouseUp:(NSEvent*)ev { if ( [timer isValid] ) { [timer invalidate]; [timer release]; timer = nil; } else { // perform single-click action } } -(void)performHoldAction:(NSTimer*)tmr { // pop up menu } -fabian On Wed, Dec 30, 2009 at 11:18 AM, Gustavo Pizano gustavxcodepic...@gmail.com wrote: Hello. I want to show a custom menu when the left click its being press for about 1 second on some of my components.. I have being searching and found a apple example where the use the + (void)startPeriodicEventsAfterDelay:(NSTimeInterval)delaySecondswithPeriod:(NSTimeInterval)periodSeconds and the stopPeriodicEvents class methods. I tried implementing something like: BOOL timerOn = YES; NSPoint mouseLoc; NSLog(@before loop); NSUInteger eventMask = NSLeftMouseDownMask| NSLeftMouseUpMask | NSPeriodicMask; while ((theEvent = [[self window] nextEventMatchingMask:eventMask])) { NSLog(@onLoop); switch ([theEvent type]) { case NSLeftMouseUp: NSLog(@up); timerOn = NO; [NSEvent stopPeriodicEvents]; break; case NSLeftMouseDown: NSLog(@down); [NSEvent startPeriodicEventsAfterDelay:0.1 withPeriod:0.1]; break; default: break; } } But of course its completely wrong, it never go out from the loop... I tried a different approach usign a NSTimer, but found myself going nowhere also... Can somebody give me some advice, or where can I find info?, i have been looking around but hadn't found something... I know this should have been asked already, so there must be a way to do this. Thanks in advance .. and happy new year. Gustavo ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/slasktrattenator%40gmail.com This email sent to slasktrattena...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Knowing mouse pressed time?
Sorry, haven't had my morning coffee yet. Of course, mouseUp should be: -(void)mouseUp:(NSEvent*)ev { if ( [timer isValid] ) { [timer invalidate]; [timer release]; timer = nil; // perform single-click action } } On Wed, Dec 30, 2009 at 11:53 AM, slasktrattena...@gmail.com slasktrattena...@gmail.com wrote: Simple. Start a timer on mouse down, invalidate it on mouse up. Something like this (written in mail): NSTimer *timer; -(void)mouseDown:(NSEvent*)ev { timer=[[[NSTimer alloc] blah ...] retain]; } -(void)mouseUp:(NSEvent*)ev { if ( [timer isValid] ) { [timer invalidate]; [timer release]; timer = nil; } else { // perform single-click action } } -(void)performHoldAction:(NSTimer*)tmr { // pop up menu } -fabian On Wed, Dec 30, 2009 at 11:18 AM, Gustavo Pizano gustavxcodepic...@gmail.com wrote: Hello. I want to show a custom menu when the left click its being press for about 1 second on some of my components.. I have being searching and found a apple example where the use the + (void)startPeriodicEventsAfterDelay:(NSTimeInterval)delaySecondswithPeriod:(NSTimeInterval)periodSeconds and the stopPeriodicEvents class methods. I tried implementing something like: BOOL timerOn = YES; NSPoint mouseLoc; NSLog(@before loop); NSUInteger eventMask = NSLeftMouseDownMask| NSLeftMouseUpMask | NSPeriodicMask; while ((theEvent = [[self window] nextEventMatchingMask:eventMask])) { NSLog(@onLoop); switch ([theEvent type]) { case NSLeftMouseUp: NSLog(@up); timerOn = NO; [NSEvent stopPeriodicEvents]; break; case NSLeftMouseDown: NSLog(@down); [NSEvent startPeriodicEventsAfterDelay:0.1 withPeriod:0.1]; break; default: break; } } But of course its completely wrong, it never go out from the loop... I tried a different approach usign a NSTimer, but found myself going nowhere also... Can somebody give me some advice, or where can I find info?, i have been looking around but hadn't found something... I know this should have been asked already, so there must be a way to do this. Thanks in advance .. and happy new year. Gustavo ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/slasktrattenator%40gmail.com This email sent to slasktrattena...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Notification when displays are detected?
Adding this method to your application delegate should be sufficient: -(void)applicationDidChangeScreenParameters: (NSNotification *)notice { //Handle Display Change Here } If this isn't in the main class of your app, then you can make the class an NSApp delgate by adding this line to the class's -(id)init method: [NSApp setDelegate: self]; Someone may pipe in on why this is the wrong way to do it, but it has worked for me. No need to set specific message centers etc. -- it is part of the NSApplicationDelegate protocol, so delegates of NSApp automatically receive the notice, in the same way as notices like applicationDidFinishLaunching. Search for applicationDidChangeScreenParameters in the documentation and you should see it described in both the NSApplicationDelegate protocol and in the reference for NSApplication itself. Message: 12 Date: Tue, 29 Dec 2009 19:04:51 - From: Paul Sanders p.sand...@alpinesoft.co.uk Subject: Re: Notification when displays are detected? To: Jacob Schwartz jakehschwa...@gmail.com Cc: cocoa-dev@lists.apple.com Message-ID: 9c9b59cd428b41f89a65b7229db98...@pauls Content-Type: text/plain; charset=iso-8859-1 That looks OK to me. I do: NSNotificationCenter *dnc = [NSNotificationCenter defaultCenter]; [dnc addObserver: self selector: @selector (didChangeScreenParameters:) name: NSApplicationDidChangeScreenParametersNotification object: nil]; ... - (void) didChangeScreenParameters: (NSNotification *) notification { ... } What object is 'self' in your scenario? It needs to exist for the life of the app, obviously. Paul Sanders. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Knowing mouse pressed time?
So let me see if I get it. Start the timer on mouseDown... and invalidate it on mouseUp, got that.. now the performholdAction method that you declared in the example, I call it from within.. ??? because I guess in this method I will check if the time its already 1 sec and show the menu... Thanks for the help G.. PS.. I need a after lunch coffee!! On Dec 30, 2009, at 12:24 PM, slasktrattena...@gmail.com wrote: Sorry, haven't had my morning coffee yet. Of course, mouseUp should be: -(void)mouseUp:(NSEvent*)ev { if ( [timer isValid] ) { [timer invalidate]; [timer release]; timer = nil; // perform single-click action } } On Wed, Dec 30, 2009 at 11:53 AM, slasktrattena...@gmail.com slasktrattena...@gmail.com wrote: Simple. Start a timer on mouse down, invalidate it on mouse up. Something like this (written in mail): NSTimer *timer; -(void)mouseDown:(NSEvent*)ev { timer=[[[NSTimer alloc] blah ...] retain]; } -(void)mouseUp:(NSEvent*)ev { if ( [timer isValid] ) { [timer invalidate]; [timer release]; timer = nil; } else { // perform single-click action } } -(void)performHoldAction:(NSTimer*)tmr { // pop up menu } -fabian On Wed, Dec 30, 2009 at 11:18 AM, Gustavo Pizano gustavxcodepic...@gmail.com wrote: Hello. I want to show a custom menu when the left click its being press for about 1 second on some of my components.. I have being searching and found a apple example where the use the + (void)startPeriodicEventsAfterDelay:(NSTimeInterval)delaySecondswithPeriod:(NSTimeInterval)periodSeconds and the stopPeriodicEvents class methods. I tried implementing something like: BOOL timerOn = YES; NSPoint mouseLoc; NSLog(@before loop); NSUInteger eventMask = NSLeftMouseDownMask| NSLeftMouseUpMask | NSPeriodicMask; while ((theEvent = [[self window] nextEventMatchingMask:eventMask])) { NSLog(@onLoop); switch ([theEvent type]) { case NSLeftMouseUp: NSLog(@up); timerOn = NO; [NSEvent stopPeriodicEvents]; break; case NSLeftMouseDown: NSLog(@down); [NSEvent startPeriodicEventsAfterDelay:0.1 withPeriod:0.1]; break; default: break; } } But of course its completely wrong, it never go out from the loop... I tried a different approach usign a NSTimer, but found myself going nowhere also... Can somebody give me some advice, or where can I find info?, i have been looking around but hadn't found something... I know this should have been asked already, so there must be a way to do this. Thanks in advance .. and happy new year. Gustavo ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/slasktrattenator%40gmail.com This email sent to slasktrattena...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Knowing mouse pressed time?
The performholdAction is your timer's fire method. You set the timer to fire after one second. If the mouse button goes up before that, you invalidate the timer and so performholdAction is never called. -f On Wed, Dec 30, 2009 at 12:42 PM, Gustavo Pizano gustavxcodepic...@gmail.com wrote: So let me see if I get it. Start the timer on mouseDown... and invalidate it on mouseUp, got that.. now the performholdAction method that you declared in the example, I call it from within.. ??? because I guess in this method I will check if the time its already 1 sec and show the menu... Thanks for the help G.. PS.. I need a after lunch coffee!! On Dec 30, 2009, at 12:24 PM, slasktrattena...@gmail.com wrote: Sorry, haven't had my morning coffee yet. Of course, mouseUp should be: -(void)mouseUp:(NSEvent*)ev { if ( [timer isValid] ) { [timer invalidate]; [timer release]; timer = nil; // perform single-click action } } On Wed, Dec 30, 2009 at 11:53 AM, slasktrattena...@gmail.com slasktrattena...@gmail.com wrote: Simple. Start a timer on mouse down, invalidate it on mouse up. Something like this (written in mail): NSTimer *timer; -(void)mouseDown:(NSEvent*)ev { timer=[[[NSTimer alloc] blah ...] retain]; } -(void)mouseUp:(NSEvent*)ev { if ( [timer isValid] ) { [timer invalidate]; [timer release]; timer = nil; } else { // perform single-click action } } -(void)performHoldAction:(NSTimer*)tmr { // pop up menu } -fabian On Wed, Dec 30, 2009 at 11:18 AM, Gustavo Pizano gustavxcodepic...@gmail.com wrote: Hello. I want to show a custom menu when the left click its being press for about 1 second on some of my components.. I have being searching and found a apple example where the use the + (void)startPeriodicEventsAfterDelay:(NSTimeInterval)delaySecondswithPeriod:(NSTimeInterval)periodSeconds and the stopPeriodicEvents class methods. I tried implementing something like: BOOL timerOn = YES; NSPoint mouseLoc; NSLog(@before loop); NSUInteger eventMask = NSLeftMouseDownMask| NSLeftMouseUpMask | NSPeriodicMask; while ((theEvent = [[self window] nextEventMatchingMask:eventMask])) { NSLog(@onLoop); switch ([theEvent type]) { case NSLeftMouseUp: NSLog(@up); timerOn = NO; [NSEvent stopPeriodicEvents]; break; case NSLeftMouseDown: NSLog(@down); [NSEvent startPeriodicEventsAfterDelay:0.1 withPeriod:0.1]; break; default: break; } } But of course its completely wrong, it never go out from the loop... I tried a different approach usign a NSTimer, but found myself going nowhere also... Can somebody give me some advice, or where can I find info?, i have been looking around but hadn't found something... I know this should have been asked already, so there must be a way to do this. Thanks in advance .. and happy new year. Gustavo ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/slasktrattenator%40gmail.com This email sent to slasktrattena...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Knowing mouse pressed time?
AHAH OK got it its one of the parameters when initializing the timer... ok... sorry for the noob question... :D On Dec 30, 2009, at 12:47 PM, slasktrattena...@gmail.com wrote: The performholdAction is your timer's fire method. You set the timer to fire after one second. If the mouse button goes up before that, you invalidate the timer and so performholdAction is never called. -f On Wed, Dec 30, 2009 at 12:42 PM, Gustavo Pizano gustavxcodepic...@gmail.com wrote: So let me see if I get it. Start the timer on mouseDown... and invalidate it on mouseUp, got that.. now the performholdAction method that you declared in the example, I call it from within.. ??? because I guess in this method I will check if the time its already 1 sec and show the menu... Thanks for the help G.. PS.. I need a after lunch coffee!! On Dec 30, 2009, at 12:24 PM, slasktrattena...@gmail.com wrote: Sorry, haven't had my morning coffee yet. Of course, mouseUp should be: -(void)mouseUp:(NSEvent*)ev { if ( [timer isValid] ) { [timer invalidate]; [timer release]; timer = nil; // perform single-click action } } On Wed, Dec 30, 2009 at 11:53 AM, slasktrattena...@gmail.com slasktrattena...@gmail.com wrote: Simple. Start a timer on mouse down, invalidate it on mouse up. Something like this (written in mail): NSTimer *timer; -(void)mouseDown:(NSEvent*)ev { timer=[[[NSTimer alloc] blah ...] retain]; } -(void)mouseUp:(NSEvent*)ev { if ( [timer isValid] ) { [timer invalidate]; [timer release]; timer = nil; } else { // perform single-click action } } -(void)performHoldAction:(NSTimer*)tmr { // pop up menu } -fabian On Wed, Dec 30, 2009 at 11:18 AM, Gustavo Pizano gustavxcodepic...@gmail.com wrote: Hello. I want to show a custom menu when the left click its being press for about 1 second on some of my components.. I have being searching and found a apple example where the use the + (void)startPeriodicEventsAfterDelay:(NSTimeInterval)delaySecondswithPeriod:(NSTimeInterval)periodSeconds and the stopPeriodicEvents class methods. I tried implementing something like: BOOL timerOn = YES; NSPoint mouseLoc; NSLog(@before loop); NSUInteger eventMask = NSLeftMouseDownMask| NSLeftMouseUpMask | NSPeriodicMask; while ((theEvent = [[self window] nextEventMatchingMask:eventMask])) { NSLog(@onLoop); switch ([theEvent type]) { case NSLeftMouseUp: NSLog(@up); timerOn = NO; [NSEvent stopPeriodicEvents]; break; case NSLeftMouseDown: NSLog(@down); [NSEvent startPeriodicEventsAfterDelay:0.1 withPeriod:0.1]; break; default: break; } } But of course its completely wrong, it never go out from the loop... I tried a different approach usign a NSTimer, but found myself going nowhere also... Can somebody give me some advice, or where can I find info?, i have been looking around but hadn't found something... I know this should have been asked already, so there must be a way to do this. Thanks in advance .. and happy new year. Gustavo ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/slasktrattenator%40gmail.com This email sent to slasktrattena...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Document-based application issue
Hallo Mac Lancer I have recently developed my first Cocoa Aplication creating custom ducumen bundles. What I did was to not only registering the document types but also export the file types in case they are not yet registered. This was my first app that supports a quicklook plugin for previes and thumbnails in Finder. This is why I exported the UTT's. In my QL plugin I added the type to the supported documents info. To accomplish this I have added the following to my applications Info.plist file: keyUTExportedTypeDeclarations/key array dict keyUTTypeConformsTo/key array !-- CHANGE: My files are bundles, yours are plain files -- stringcom.apple.package/string /array keyUTTypeDescription/key !-- CHANGE: You description of the type -- stringPortfolio/string keyUTTypeIconFile/key stringIcon.icns/string keyUTTypeIdentifier/key !-- CHANGE: This was my real reverse DNS identifier for the filetype -- stringcom.yourcompany.filetype/string keyUTTypeTagSpecification/key dict keypublic.filename-extension/key array stringportfolio/string /array /dict /dict /array Th On 29.12.2009, at 19:53, Mac Lancer wrote: Hello, Gentlemen, I’m working on a Cocoa application that is intended to open documents in custom format. It is a document-based application and it should open files with aeep/aeew extensions. The problem is that on some Mac computers after installation aeep/aeew files do not open when the user double-clicks them. My thought was that the aeep/aeew file extensions are not registered for some reason during the installation. I even tried adding 'lsregister' call to the postflight script but with no luck – the files still do not open. Unfortunately, I do not have much information about configurations of these macs as this behavior is reported by end users. Does anyone know what can be the reason for such behavior? Am I missing something? Some additional information below: 1. The application is installed to the folder /Library/Application Support/AnimalsandEarth/AE Photo.app 2. Info.plist file contains the following dictionary: keyCFBundleDocumentTypes/key array dict keyCFBundleTypeExtensions/key array stringaeep/string stringaeew/string stringjpg/string stringjpeg/string stringpng/string stringgif/string stringbmp/string /array keyCFBundleTypeIconFile/key string/string keyCFBundleTypeName/key stringAnimalsAndEarthPhoto/string keyCFBundleTypeOSTypes/key array string/string /array keyCFBundleTypeRole/key stringViewer/string keyNSDocumentClass/key stringMyDocument/string /dict /array 3. The URL to the installer: http://www.animalsandearth.com/macapp/animalsandearth.dmg 4. Some aeep files can be found in the ~/Pictures/AnimalsandEarth Photos/ folder Any help would be appreciated. Thanks, AE ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/pmau%40me.com This email sent to p...@me.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: MyDocument.xib v MainMenu.xib
Thanks to all who gave advice. I'll give a description of what I did. If you have any further comments or suggestions please come forth! In MainMenu.xib An NSPanel that contains an NSOutlineView An Application Delegate that has a reference to the NSOutlineView In MyDocument.m - (id)init { self = [super init]; if (self) { // Add your subclass-specific initialization here. // If an error occurs here, send a [self release] message and return nil. m_treeDataSource = [[[TreeDataSource alloc] init] retain]; m_treeDelegate = [[[TreeDelegate alloc] init] retain]; if(!m_treeDataSource || !m_treeDelegate) { [self release]; return nil; } m_appDelegate = [NSApp delegate]; m_tree = m_appDelegate-m_tree; [m_tree retain]; [m_tree setDataSource:m_treeDataSource]; [m_tree setDelegate:m_treeDelegate]; } return self; } - (void)windowDidBecomeKey:(NSNotification *)notification { [m_tree setDataSource:m_treeDataSource]; [m_tree setDelegate:m_treeDelegate]; } MyDocument.m has methods to manage m_treeDataSource - (IBAction)root:(id)sender { TreeItem* root = [[[TreeItem alloc] init] retain]; root-m_parent = nil; root-m_itemName = [m_root stringValue]; // m_root is a TextField [m_treeDataSource-m_roots addObject:root]; } - (IBAction)data:(id)sender { [m_tree reloadData]; } Still have some problems that I'll ask some questions about in a bit. db On Dec 30, 2009, at 12:55 AM, Graham Cox wrote: On 30/12/2009, at 4:23 PM, David Blanton wrote: In a document based app I want to have some 'inspectors that reflect what i sgoing on in the document. These inspectors should float. If I make NSPanel's for the inspector in MyDocument.xib then each instance of a document gets its own set of inspectors. I would like to have just one set of inspectors whose contents change as different documents are activated. Putting the inspectors in MainMenu.xib will let me make just 'one set' for all documents but I am unsure as to how to get a reference from the inspector to the document given different xib's. Suggestion please. Each document your application opens will be a new instance built from the same nib. So even if there were a way to 'connect' objects in one nib to objects in another, it wouldn't help you - different documents will be made active at different times and your inspectors need to be aware of those activations. A simple approach is to make your inspectors respond to all window did become main/resign main notifications, and then ask the document controller singleton for -currentDocument at those times. It can then figure out if the document itself has changed as a result of the active window change and do whatever it needs to do to inspect the document contents. Setting up the notifications is best done in the inspector controller's -awakeFromNib method. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Setting the Line Height/ Line Spacing in an NSTextView.
How would I set the Line Height/ Line Spacinh in an NSTextView? e.g How tall each line is or how much space is between each line. Here's what I've tried (but doesn't work), it is in a NSTextView subclass … - (void)setDefaultParagraphStyle:(NSMutableParagraphStyle *)paragraphStyle { CGFloat spacing = 5.0f; [paragraphStyle setLineSpacing:spacing]; [paragraphStyle setMinimumLineHeight:spacing]; [paragraphStyle setMaximumLineHeight:spacing]; } What's wrong with it? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: MyDocument.xib v MainMenu.xib
On 30.12.2009, at 06:23, David Blanton wrote: Putting the inspectors in MainMenu.xib will let me make just 'one set' for all documents but I am unsure as to how to get a reference from the inspector to the document given different xib's. Menus work the same way: There's one menu in MainMenu.xib, and it triggers actions on your document. How does it do that? By connecting to the First Responder. You can do the same. You may have to, additionally, subscribe to some notifications to notice when the first responder changes, so your inspector knows when it needs to re-request information from the first responder. -- Uli Kusterer The Witnesses of TeachText are everywhere... http://www.masters-of-the-void.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Document-based application issue
On 29.12.2009, at 19:53, Mac Lancer wrote: keyCFBundleTypeExtensions/key array stringaeep/string stringaeew/string stringjpg/string stringjpeg/string stringpng/string stringgif/string stringbmp/string /array Don't really have any good ideas, but you're mixing different file extensions here and claiming them to be the same type. Maybe you should make separate entries for different types? If you're declaring UTIs for document types, declaring a different UTI than everyone else might be confusing Launch Services, or might cause LS to not consider your app to be able to open the UTI for that kind of file. Just wildly guessing here, but if you find no other solution, it's an avenue to investigate. -- Uli Kusterer The Witnesses of TeachText are everywhere... http://www.masters-of-the-void.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Setting the Line Height/ Line Spacing in an NSTextView.
On Dec 30, 2009, at 10:43 AM, Joshua Garnham wrote: How would I set the Line Height/ Line Spacinh in an NSTextView? e.g How tall each line is or how much space is between each line. Here's what I've tried (but doesn't work), it is in a NSTextView subclass … - (void)setDefaultParagraphStyle:(NSMutableParagraphStyle *)paragraphStyle { CGFloat spacing = 5.0f; [paragraphStyle setLineSpacing:spacing]; [paragraphStyle setMinimumLineHeight:spacing]; [paragraphStyle setMaximumLineHeight:spacing]; } What's wrong with it? A couple of things. First, the NSTextView method is - (void)setDefaultParagraphStyle:(NSParagraphStyle *)paragraphStyle. The argument is a regular NSParagraphStyle, not the mutable variety. Second, rather than override - (void)setDefaultParagraphStyle:(NSParagraphStyle *)paragraphStyle, you simply use it as is. Construct your paragraphStyle elsewhere, and then send it to -setDefaultParagraphStyle:.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Setting the Line Height/ Line Spacing in an NSTextView.
On 30 Dec 2009, at 9:43 AM, Joshua Garnham wrote: How would I set the Line Height/ Line Spacinh in an NSTextView? e.g How tall each line is or how much space is between each line. Here's what I've tried (but doesn't work), it is in a NSTextView subclass … - (void)setDefaultParagraphStyle:(NSMutableParagraphStyle *)paragraphStyle { CGFloat spacing = 5.0f; [paragraphStyle setLineSpacing:spacing]; [paragraphStyle setMinimumLineHeight:spacing]; [paragraphStyle setMaximumLineHeight:spacing]; } What's wrong with it? That you modify a proposed default paragraph style, but don't actually SET the paragraph style? Such as by [super setDefaultParagraphStyle:]? Also, declaring that the parameter is a _mutable_ paragraph style does not make the parameter you are given actually mutable. The declaration of the method specifies NSParagraphStyle, and you must assume you can't change it. Do you ensure that this method actually gets called? Have you a theory on why you're overriding a possible setting of the default style, instead of just doing the setting yourself? — F ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Knowing mouse pressed time?
On Dec 30, 2009, at 2:53 AM, slasktrattena...@gmail.com wrote: Simple. Start a timer on mouse down, invalidate it on mouse up. Something like this (written in mail): NSTimer *timer; -(void)mouseDown:(NSEvent*)ev { timer=[[[NSTimer alloc] blah ...] retain]; } -(void)mouseUp:(NSEvent*)ev { if ( [timer isValid] ) { [timer invalidate]; [timer release]; timer = nil; } else { // perform single-click action } } -(void)performHoldAction:(NSTimer*)tmr { // pop up menu } Not to 'invalidate' your suggestion, but why not simply ask the appropriate event objects for their timestamps ?Or did I overlook something in the original question ? Cheers, . . . . . . . .Henry = iPhone App Development and Developer Education . . . Visit www.nonatomic-retain.com Mac OSX Application Development, Plus a Great Deal More . . . Visit www.trilithon.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Setting the Line Height/ Line Spacing in an NSTextView.
But the methodssetLineSpacing: and others are NSMutableParagraphStyle methods only. From: Ross Carter rosscarter...@me.com To: Joshua Garnham joshua.garn...@yahoo.co.uk Cc: cocoa-dev@lists.apple.com Sent: Wed, 30 December, 2009 16:12:18 Subject: Re: Setting the Line Height/ Line Spacing in an NSTextView. On Dec 30, 2009, at 10:43 AM, Joshua Garnham wrote: How would I set the Line Height/ Line Spacinh in an NSTextView? e.g How tall each line is or how much space is between each line. Here's what I've tried (but doesn't work), it is in a NSTextView subclass … - (void)setDefaultParagraphStyle:(NSMutableParagraphStyle *)paragraphStyle { CGFloat spacing = 5.0f; [paragraphStyle setLineSpacing:spacing]; [paragraphStyle setMinimumLineHeight:spacing]; [paragraphStyle setMaximumLineHeight:spacing]; } What's wrong with it? A couple of things. First, the NSTextView method is - (void)setDefaultParagraphStyle:(NSParagraphStyle *)paragraphStyle. The argument is a regular NSParagraphStyle, not the mutable variety. Second, rather than override - (void)setDefaultParagraphStyle:(NSParagraphStyle *)paragraphStyle, you simply use it as is. Construct your paragraphStyle elsewhere, and then send it to -setDefaultParagraphStyle:. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Using performSelector:withObject:afterDelay: to call a delegate method?
I want to be able to employ a delegate method after a delay. So what I have done, which works fine, is create a method in my class that calls the delegate method, and then I use performSelector:withObject:afterDelay: to call the second method: [self performSelector:@selector(doSomething00) withObject:NULL afterDelay:4.0]; -(void)doSomething00{ [someDelegate doSomething]; } I am wondering though, if there might be a way to use performSelector:withObject:afterDelay: (or some similar method) to call the delegate method directly? thanks ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Encrypting Binary Strings
Is it possible for me to encrypt the strings in my binary so hackers can't easily figure out what my application has in it? Reason I'm asking is I have some private keys that encodes data that I/parents don't want kids or teenagers to find. Thanks, Mr. Gecko___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Setting the Line Height/ Line Spacing in an NSTextView.
On 30 Dec 2009, at 11:01 AM, Joshua Garnham wrote: But the methodssetLineSpacing: and others are NSMutableParagraphStyle methods only. That's the point. You may _want_ to change the paragraph style's properties, but you can't. Casting the parameter doesn't turn an immutable object into a mutable one. If you really want to substitute a paragraph style of your own (and please comment on the suggestions that you may not want to), make a mutableCopy, set that up as you wish, and pass it up to super. You may be misconceiving the need to subclass in Cocoa. Subclassing is rare. Most modifications to object behaviors are done through delegates and property setters; Cocoa provides a lot of them. That's why you're getting told to _call_ setDefaultParagraphStyle:, not _override_ it. If you explained why you feel you must override, we might be better able to help you. — F ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Encrypting Binary Strings
Simple answer: no. If your application can still read the strings, so can a clever person, if by nothing else than sitting and patiently emulating a CPU with a piece of paper and a pencil. In order to actually secure something *you, or your recipient* have to be involved in decrypting it, by knowing something secret (the key). Bob On Wed, Dec 30, 2009 at 5:17 PM, Mr. Gecko grmrge...@gmail.com wrote: Is it possible for me to encrypt the strings in my binary so hackers can't easily figure out what my application has in it? Reason I'm asking is I have some private keys that encodes data that I/parents don't want kids or teenagers to find. Thanks, Mr. Gecko___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/tom.davie%40gmail.com This email sent to tom.da...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Encrypting Binary Strings
Of course I know that, but I saw on the iPhone how the strings are encrypted and the only way for you to get the strings was if you used otool. Just that and I'll be satisfied. On Dec 30, 2009, at 11:32 AM, Tom Davie wrote: Simple answer: no. If your application can still read the strings, so can a clever person, if by nothing else than sitting and patiently emulating a CPU with a piece of paper and a pencil. In order to actually secure something *you, or your recipient* have to be involved in decrypting it, by knowing something secret (the key). Bob On Wed, Dec 30, 2009 at 5:17 PM, Mr. Gecko grmrge...@gmail.com wrote: Is it possible for me to encrypt the strings in my binary so hackers can't easily figure out what my application has in it? Reason I'm asking is I have some private keys that encodes data that I/parents don't want kids or teenagers to find. Thanks, Mr. Gecko___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/tom.davie%40gmail.com This email sent to tom.da...@gmail.com smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Using performSelector:withObject:afterDelay: to call a delegate method?
On Dec 30, 2009, at 9:08 AM, Helen Cooper wrote: [self performSelector:@selector(doSomething00) withObject:NULL afterDelay:4.0]; -(void)doSomething00{ [someDelegate doSomething]; } I am wondering though, if there might be a way to use performSelector:withObject:afterDelay: (or some similar method) to call the delegate method directly? [delegate performSelector:@selector(doSomething) withObject:nil afterDelay:4.0]; b.bum ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Using performSelector:withObject:afterDelay: to call a delegate method?
On Dec 30, 2009, at 10:08 AM, Helen Cooper wrote: I am wondering though, if there might be a way to use performSelector:withObject:afterDelay: (or some similar method) to call the delegate method directly? You can call any method you want using that method, even delegate methods. If you need to pass in more arguments with the selector, then use NSInvocation to set up the message with the arguments, and use -performSelector:... to invoke the invocation after the delay. Nick Zitzmann http://www.chronosnet.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Encrypting Binary Strings
On Dec 30, 2009, at 9:17 AM, Mr. Gecko wrote: Is it possible for me to encrypt the strings in my binary so hackers can't easily figure out what my application has in it? Reason I'm asking is I have some private keys that encodes data that I/parents don't want kids or teenagers to find. Have you tried the OpenSSL crypto library? Maybe you could could encrypt your data, and then use an algorithm to put together the key at runtime. It isn't super secure, but he will prevent the data from sitting there on the disk in plaintext. Another thing to look at is DRM techniques. They need to solve a similar problem. Todd ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Encrypting Binary Strings
On 30 Dec 2009, at 17:17, Mr. Gecko wrote: Is it possible for me to encrypt the strings in my binary so hackers can't easily figure out what my application has in it? Reason I'm asking is I have some private keys that encodes data that I/parents don't want kids or teenagers to find. I'm sure it is possible to obfuscate the strings, but security by obscurity never works, and if you are distributing a private key inside your app for encryption, you are doing it wrong IMHO. -- Gleb Dolgich http://pixelespressoapps.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Encrypting Binary Strings
Ok, I'll look up the different encodings I could do with openssl, Thanks for the suggestion. This is basically for Parental Controls, I know I could ask for a password at first, but then any kid could grab a copy and set their own password. What I'm doing is I'm asking for them to authenticate with Mac OS X, and then once they are authenticated, I'm allowing them to set settings that are encrypted with a key in AES. On Dec 30, 2009, at 11:49 AM, Todd Heberlein wrote: On Dec 30, 2009, at 9:17 AM, Mr. Gecko wrote: Is it possible for me to encrypt the strings in my binary so hackers can't easily figure out what my application has in it? Reason I'm asking is I have some private keys that encodes data that I/parents don't want kids or teenagers to find. Have you tried the OpenSSL crypto library? Maybe you could could encrypt your data, and then use an algorithm to put together the key at runtime. It isn't super secure, but he will prevent the data from sitting there on the disk in plaintext. Another thing to look at is DRM techniques. They need to solve a similar problem. Todd smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Core Data Bindings: NSFaultingMutableSet...addObserver...notSupported
Hi, I'm trying to bind through a keyPath, but I'm getting nothing but errors. The most common is: [_NSFaultingMutableSet 0x200267fe0 addObserver:forKeyPath:options:context:] is not supported. Key path: projectCode I've read that bindings don't necessarily cause faults to fire, but I've got to believe there's some way to make this work. I've been working on this for a few hours, I've looked through Core Data and KVO/KVC documentation, Googled and searched through the list. I may have read the answer without realizing it... My data: Account ---ProjectSite---Project I'm trying to get the projects array controller to load all projects for the selected Account (so, all Projects for all ProjectSites). I've got an NSTableView listing accounts on the left, and view controllers to display detail table views to the right. One of the detail table views lists all ProjectSites for the selected Account. That's working fine. Another detail table view should list all Projects for the Account, but I can't get the Projects array controller to bind to the selected Account. These methods list all projects for the selected Account: NSLog(@Projects for account are %@, [self.selections.account valueForKeyPath:@projectSites.projects.displayName]); NSLog(@All projects for account are %@, [[self.selections.account allProjectsForAccount] valueForKey:@displayName]); But, I can't translate that into the proper ContentSet binding for the Projects AC. I've tried every combination I could think of, including: 1. creating an Object Controller for the selectedAccount and binding the Project's ContentSet to that controller with projectSites.projects 2. creating an Array Controller for the selectedAccount's ProjectSites and binding to that 3. creating a managedObject subclass for Project with a method that returns [self valueForKeyPath:@projectSites.projects] and binding the projects AC's contentSet to that property 4. using combinations of @distinctUnionOfSets I've seen posts with others having similar problems, but none of their solutions seem to be working for me. Any help would be greatly appreciated. Thanks. Brad ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
ChangeCount for Multiple Undo Managers
When in the course of undo events, it becomes necessary to introduce multiple undo managers, certain issues arise. For example: How to handle the document change count? I currently have at least a half dozen independent undo managers for my document, which I keep in a bank near the document level. Each undo manager is monitored for change notifications, and dings the document's change count appropriately. This seems to work, except that, being the meticulous systems engineer that I am, I'm a strong believer in Murphy. For a new or newly opened document, this will correctly ask the user to save when the document is closed, and then zeros the doc's change count. However, if the user first saves the document, then decides to change something in one undo context, then undoes something in another undo context, the change count will be zero and closing the doc will not ask for a save. (Doing such changes in the opposite order will pop the undo after save dialog.) Anyway, this is not the desired result. It looks like I need to maintain individual change counts for each undo manager, zero them all on save. When closing the doc, ANY non-zero (positive or negative) change count should trigger the save dialog. Am I making this too hard, or is there a more straightforward way? Also, why the heck is there no accessor to read the doc's change count? I could let the doc handle it if non-zero, and otherwise scan the undo bank and pop the save dialog is necesssary. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Encrypting Binary Strings
On 30 Dec 2009, at 17:59, Mr. Gecko wrote: This is basically for Parental Controls, I know I could ask for a password at first, but then any kid could grab a copy and set their own password. What I'm doing is I'm asking for them to authenticate with Mac OS X, and then once they are authenticated, I'm allowing them to set settings that are encrypted with a key in AES. Perhaps a better way would be to ask for a password once the user is authenticated, and then generate an AES key using that password, instead of storing encryption key inside your program. With you current scheme, if anyone breaks your 'common' key, everyone will be able to circumvent your parental protection. -- Gleb Dolgich http://pixelespressoapps.com___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Displaying contents of more than one NSManagedObjectContext?
Hi. I have an app that has the concept of parts libraries. I would like for my app to be able to open any number of library documents, each with its own NSManagedObjectContext, but display the parts palette as a single UI showing the union of all parts. Is this possible, or will I have to perform some Core Data gymnastics to load everything into a separate, new context for use in display? TIA, Rick ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: ChangeCount for Multiple Undo Managers
On 30 Dec 2009, at 18:19, Gordon Apple wrote: When in the course of undo events, it becomes necessary to introduce multiple undo managers, certain issues arise. For example: How to handle the document change count? I currently have at least a half dozen independent undo managers for my document, which I keep in a bank near the document level. Each undo manager is monitored for change notifications, and dings the document's change count appropriately. This seems to work, except that, being the meticulous systems engineer that I am, I'm a strong believer in Murphy. For a new or newly opened document, this will correctly ask the user to save when the document is closed, and then zeros the doc's change count. However, if the user first saves the document, then decides to change something in one undo context, then undoes something in another undo context, the change count will be zero and closing the doc will not ask for a save. (Doing such changes in the opposite order will pop the undo after save dialog.) Anyway, this is not the desired result. It looks like I need to maintain individual change counts for each undo manager, zero them all on save. When closing the doc, ANY non-zero (positive or negative) change count should trigger the save dialog. Am I making this too hard, or is there a more straightforward way? I am surprised you actually need more than one undo manager for the document, but will trust that this is the case. The only way that I am aware of to get the behaviour you want is going to be writing your own version of the change count system that handles multiple stacks. i.e. maintain several change count values internally, and override -isDocumentEdited to go by that. Fortunately it's a fairly simple behaviour, and the APIs it uses are pretty well documented. Also, why the heck is there no accessor to read the doc's change count? I could let the doc handle it if non-zero, and otherwise scan the undo bank and pop the save dialog is necesssary. I would argue that it's a bit like -retainCount. If you have code that is reading the value of -retainCount you're almost certainly doing it wrong, but it's occasionally handy to have the value available when debugging. It probably would have been nice if Apple had done the same for change count, but when you look at all the confusion -retainCount causes newbies, it's more understandable.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Encrypting Binary Strings
But then how would I get the data? If the key has to do with the password, then how can I get the parental settings and respond to them. On Dec 30, 2009, at 12:51 PM, Gleb Dolgich wrote: Perhaps a better way would be to ask for a password once the user is authenticated, and then generate an AES key using that password, instead of storing encryption key inside your program. With you current scheme, if anyone breaks your 'common' key, everyone will be able to circumvent your parental protection. -- Gleb Dolgich http://pixelespressoapps.com smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Encrypting Binary Strings
You could store the generated key in a keychain. This way you wouldn't have to ask for the password to access the encryption key. -- Gleb Dolgich http://pixelespressoapps.com On 30 Dec 2009, at 18:58, Mr. Gecko wrote: But then how would I get the data? If the key has to do with the password, then how can I get the parental settings and respond to them. On Dec 30, 2009, at 12:51 PM, Gleb Dolgich wrote: Perhaps a better way would be to ask for a password once the user is authenticated, and then generate an AES key using that password, instead of storing encryption key inside your program. With you current scheme, if anyone breaks your 'common' key, everyone will be able to circumvent your parental protection. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Using performSelector:withObject:afterDelay: to call a delegate method?
thanks - obvious. Should have caught this on my own:) From: Bill Bumgarner b...@mac.com To: Helen Cooper helen.coo...@rocketmail.com Cc: cocoa-dev@lists.apple.com Sent: Wed, December 30, 2009 12:37:38 PM Subject: Re: Using performSelector:withObject:afterDelay: to call a delegate method? On Dec 30, 2009, at 9:08 AM, Helen Cooper wrote: [self performSelector:@selector(doSomething00) withObject:NULL afterDelay:4.0]; -(void)doSomething00{ [someDelegate doSomething]; } I am wondering though, if there might be a way to use performSelector:withObject:afterDelay: (or some similar method) to call the delegate method directly? [delegate performSelector:@selector(doSomething) withObject:nil afterDelay:4.0]; b.bum ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Encrypting Binary Strings
But then the child/teenager, if they know about keychain they could check it and find the key. Unless there is a way to prevent them from seeing it. Speaking of keychain, can you recommend me a good public domain keychain framework? I currently wrote my own and on some computers, the keychain didn't work, the only thing they all had in common was 1password. On Dec 30, 2009, at 1:19 PM, Gleb Dolgich wrote: You could store the generated key in a keychain. This way you wouldn't have to ask for the password to access the encryption key. -- Gleb Dolgich http://pixelespressoapps.com On 30 Dec 2009, at 18:58, Mr. Gecko wrote: But then how would I get the data? If the key has to do with the password, then how can I get the parental settings and respond to them. On Dec 30, 2009, at 12:51 PM, Gleb Dolgich wrote: Perhaps a better way would be to ask for a password once the user is authenticated, and then generate an AES key using that password, instead of storing encryption key inside your program. With you current scheme, if anyone breaks your 'common' key, everyone will be able to circumvent your parental protection. smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Knowing mouse pressed time?
Henry hi. You mean with the NEEvent method that returns the timestamp?... I was trying that also, and as far as I understood its the timestamp between the App startup and the event... so I dunno how this might help me... maybe I misunderstood the API doc? To clarify the original question, what I want to achieve is something similar to 10.6 dock, when you press the mouse on an icon, after a second or so, the menu appears. I dunno if this is what you understood.. I hope its better explained now. :P Thanks for your reply G. On Dec 30, 2009, at 5:44 PM, Henry McGilton (Boulevardier) wrote: On Dec 30, 2009, at 2:53 AM, slasktrattena...@gmail.com wrote: Simple. Start a timer on mouse down, invalidate it on mouse up. Something like this (written in mail): NSTimer *timer; -(void)mouseDown:(NSEvent*)ev { timer=[[[NSTimer alloc] blah ...] retain]; } -(void)mouseUp:(NSEvent*)ev { if ( [timer isValid] ) { [timer invalidate]; [timer release]; timer = nil; } else { // perform single-click action } } -(void)performHoldAction:(NSTimer*)tmr { // pop up menu } Not to 'invalidate' your suggestion, but why not simply ask the appropriate event objects for their timestamps ?Or did I overlook something in the original question ? Cheers, . . . . . . . .Henry = iPhone App Development and Developer Education . . . Visit www.nonatomic-retain.com Mac OSX Application Development, Plus a Great Deal More . . . Visit www.trilithon.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: ChangeCount for Multiple Undo Managers
Ah! That's what I missed. Thanks. I assume that just tests the zero state of changeCount. Maybe I can override that to return YES if any count is non-zero. This is a fairly complex document, involving a data hierarchy and various contexts (and editable windows) within that hierarchy. Some of the contexts operate at different levels within the hierarchy. With a single undo manager, I found that it was easy to confuse the undo process and crash it, not to mention the possibility of applying undo to data not visible on the screen at the time. I solved some of the problems by clearing the undo stack when the user changed tab-views in the hierarchy. However, with other windows independently displaying some of the content of the hierarchy, it simply proved unworkable to use a single undo manager. On 12/30/09 12:55 PM, Mike Abdullah cocoa...@mikeabdullah.net wrote: I am surprised you actually need more than one undo manager for the document, but will trust that this is the case. The only way that I am aware of to get the behaviour you want is going to be writing your own version of the change count system that handles multiple stacks. i.e. maintain several change count values internally, and override -isDocumentEdited to go by that. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Data Bindings: NSFaultingMutableSet...addObserver...notSupported
On Dec 30, 2009, at 10:12, Brad Gibbs wrote: Account ---ProjectSite---Project I'm trying to get the projects array controller to load all projects for the selected Account (so, all Projects for all ProjectSites). I've got an NSTableView listing accounts on the left, and view controllers to display detail table views to the right. One of the detail table views lists all ProjectSites for the selected Account. That's working fine. Another detail table view should list all Projects for the Account, but I can't get the Projects array controller to bind to the selected Account. These methods list all projects for the selected Account: NSLog(@Projects for account are %@, [self.selections.account valueForKeyPath:@projectSites.projects.displayName]); NSLog(@All projects for account are %@, [[self.selections.account allProjectsForAccount] valueForKey:@displayName]); But, I can't translate that into the proper ContentSet binding for the Projects AC. I've tried every combination I could think of, including: 1. creating an Object Controller for the selectedAccount and binding the Project's ContentSet to that controller with projectSites.projects 2. creating an Array Controller for the selectedAccount's ProjectSites and binding to that 3. creating a managedObject subclass for Project with a method that returns [self valueForKeyPath:@projectSites.projects] and binding the projects AC's contentSet to that property 4. using combinations of @distinctUnionOfSets Basically, there are two usual ways you use an array controller: 1. In entity mode, where its contentSet binding is bound to a Core Data (set) property of a data model object. It's going to use *all* the objects of the configured Core Data entity, unless you use a filter predicate or a fetch predicate, or unless you actually use a transient property that you've coded to fetch only some of the objects. You *could* use this for your projects list, but you'd have to write code to maintain a suitable filter predicate or fetch predicate or transient property, based on the selected account. 2. In class mode with a source array, where its contentArray binding is bound to a non-Core Data (array) property of a data model object. It's up to you to maintain that data model array property KVO-compliantly, or the binding won't update reliably. See: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/CocoaBindingsRef/BindingsText/NSArrayController.html So I think you'll need to: -- bind accountsArrayController's contentSet binding to your data model object's accounts property -- bind projectSitesArrayController's contentArray binding to accountsArrayController.selection.projectSites -- bind projectsArrayController's contentArray binding to projectsitesarraycontroller.arrangedobjects.projec...@distinctunionofarrays (because you said all projects for the account, not all projects for the selected sites) With these bindings (if I've got them right), only the first array controller is in entity mode. So, you cannot use projectSitesArrayController or projectsArrayController to create or delete objects directly. If you have + and - buttons for them your interface, their action methods need to be in (say) your document or window controller class, and you have to write code to create suitable objects and relationships. Your references, above, to selections and allProjectsForAccount methods suggest that you've been trying to solve the problem by adding custom properties to your NSManagedObject custom subclasses. The problem *is* solvable that way, but you have to be careful to distinguish non-Core Data custom properties, which are arrays, from Core Data custom (i.e. transient) properties, which are sets. And, you have to make sure you get KVO-compliance right -- not always easy. And, when you're using Core Data you have to be careful that you don't mess up undo using non-Core Data custom properties. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Merging changes across NSManagedObjectContexts
In my app I have a situation where I have two (Core Data) documents open, and I need to merge all the changes made in one doc1 to the changes in doc2. I've been reading the section on Change Management in the Core Data Programming Guide, but it just talks about the caveats and gotchas, and doesn't actually talk about how to effect the merge. It also only talks about the example where the two MOCs share a single file, which is not the case here. Where is merging itself documented? The MOC reference only talks about a merge notification. I need to do something like: mergeMOC: doc1.managedObjectContext into: doc2.managedObjectContext; Note that I'm not worried about all the issues that can arise for completely general merges. Doc2 will not have changes that conflict with doc1 (doc1 contains all-new data). TIA, Rick___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Encrypting Binary Strings
A teenager could also crack your app and use the key he found to gain access. If you want to prevent that, I guess you need to rethink the way you store access credentials. I wonder how [Snow] Leopard Parental Controls do that. You should also use Mac OS Keychain API and not reinvent the wheel if at all possible. I'm not an expert on Keychain, so I can't point you to the right API calls, sorry. -- Gleb Dolgich http://pixelespressoapps.com On 30 Dec 2009, at 19:23, Mr. Gecko wrote: But then the child/teenager, if they know about keychain they could check it and find the key. Unless there is a way to prevent them from seeing it. Speaking of keychain, can you recommend me a good public domain keychain framework? I currently wrote my own and on some computers, the keychain didn't work, the only thing they all had in common was 1password. On Dec 30, 2009, at 1:19 PM, Gleb Dolgich wrote: You could store the generated key in a keychain. This way you wouldn't have to ask for the password to access the encryption key. On 30 Dec 2009, at 18:58, Mr. Gecko wrote: But then how would I get the data? If the key has to do with the password, then how can I get the parental settings and respond to them. On Dec 30, 2009, at 12:51 PM, Gleb Dolgich wrote: Perhaps a better way would be to ask for a password once the user is authenticated, and then generate an AES key using that password, instead of storing encryption key inside your program. With you current scheme, if anyone breaks your 'common' key, everyone will be able to circumvent your parental protection. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Encrypting Binary Strings
On Dec 30, 2009, at 11:59 AM, Mr. Gecko wrote: This is basically for Parental Controls, I know I could ask for a password at first, but then any kid could grab a copy and set their own password. What I'm doing is I'm asking for them to authenticate with Mac OS X, and then once they are authenticated, I'm allowing them to set settings that are encrypted with a key in AES. You might consider using Authorization Services for this, instead of rolling your own. See: http://developer.apple.com/mac/library/technotes/tn2002/tn2095.html It uses a parental-control mechanism as an example of one of the things that Authorization Services can be used for. Cheers, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Merging changes across NSManagedObjectContexts
On Dec 30, 2009, at 12:54 pm, Rick Mann wrote: In my app I have a situation where I have two (Core Data) documents open, and I need to merge all the changes made in one doc1 to the changes in doc2. I've been reading the section on Change Management in the Core Data Programming Guide, but it just talks about the caveats and gotchas, and doesn't actually talk about how to effect the merge. It also only talks about the example where the two MOCs share a single file, which is not the case here. Then you're not merging, you're copying/moving objects from one store to another. mmalc ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Encrypting Binary Strings
It's ether that you don't understand what I'm doing, or I don't understand that. Here is the full story. I am using Apple's SFAuthorizationView to find out if the user is an administrator. If they are an admin, I allow them to modify the settings, when they save I am saving the settings in AES with 2 keys, 1 randomly generated and saved in AES encrypted by the first key and the other in the binary. Although nobody has cracked it yet, I can't have the first key in the open. Things I can't do. I can't ask for a password to use to encrypt, as I won't be able to find out what the settings are. I can't store it in the keychain as a password as if I do it'll be open if the kid/teenager knows the password to the user he/her is in. Things I can do. I can store it in the keychain as a key if someone could send me a link to an example on how to do that. I can encode the key in a way that only if you have the source code, you can find out, like make my own md5 algorithm and only if you know that algorithm, you can get the actual key. But to do that, I'll need to find a algorithm in cocoa that is public domain so I can modify it. Hope this clears things up, Mr. Gecko On Dec 30, 2009, at 3:33 PM, Ken Thomases wrote: On Dec 30, 2009, at 11:59 AM, Mr. Gecko wrote: This is basically for Parental Controls, I know I could ask for a password at first, but then any kid could grab a copy and set their own password. What I'm doing is I'm asking for them to authenticate with Mac OS X, and then once they are authenticated, I'm allowing them to set settings that are encrypted with a key in AES. You might consider using Authorization Services for this, instead of rolling your own. See: http://developer.apple.com/mac/library/technotes/tn2002/tn2095.html It uses a parental-control mechanism as an example of one of the things that Authorization Services can be used for. Cheers, Ken smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Encrypting Binary Strings
Just as a word of advise. This is a public list that's indexed by search engines. So don't reveal anything here that you'd want to keep private. I'm not advising security through obscurity. If you use keychains or similar systems, knowing how it works won't help cracking anyway. But just in case, don't talk about the name of your app maybe :) Le 30 déc. 2009 à 22:33, Ken Thomases k...@codeweavers.com a écrit : On Dec 30, 2009, at 11:59 AM, Mr. Gecko wrote: This is basically for Parental Controls, I know I could ask for a password at first, but then any kid could grab a copy and set their own password. What I'm doing is I'm asking for them to authenticate with Mac OS X, and then once they are authenticated, I'm allowing them to set settings that are encrypted with a key in AES. You might consider using Authorization Services for this, instead of rolling your own. See: http://developer.apple.com/mac/library/technotes/tn2002/tn2095.html It uses a parental-control mechanism as an example of one of the things that Authorization Services can be used for. Cheers, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/cepakare%40gmail.com This email sent to cepak...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Merging changes across NSManagedObjectContexts
On Dec 30, 2009, at 13:54:10, mmalc Crawford wrote: On Dec 30, 2009, at 12:54 pm, Rick Mann wrote: In my app I have a situation where I have two (Core Data) documents open, and I need to merge all the changes made in one doc1 to the changes in doc2. I've been reading the section on Change Management in the Core Data Programming Guide, but it just talks about the caveats and gotchas, and doesn't actually talk about how to effect the merge. It also only talks about the example where the two MOCs share a single file, which is not the case here. Then you're not merging, you're copying/moving objects from one store to another. Is that operation discussed in the docs somewhere? TIA, Rick ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Knowing mouse pressed time?
On Dec 30, 2009, at 11:43 AM, Gustavo Pizano wrote: Henry hi. You mean with the NEEvent method that returns the timestamp?... I was trying that also, and as far as I understood its the timestamp between the App startup and the event... so I dunno how this might help me... maybe I misunderstood the API doc? To clarify the original question, what I want to achieve is something similar to 10.6 dock, when you press the mouse on an icon, after a second or so, the menu appears. I dunno if this is what you understood.. I hope its better explained now. :P Sorry I did not intend the thread to get into a deep discussion on the relative merits of how to do things, nor, as I said, to invalidate Fabian's idea. I meant that rather than setting a timer and implementing a callback method and remembering to invalidate the timer, and so on and so on, you can do something like this (which took less time to implement than the time required to explain it . . . ): - (void)mouseDown:(NSEvent *)theEvent { NSLog(@mouseDown); [self setStartStamp: [theEvent timestamp]]; } - (void)mouseUp:(NSEvent *)theEvent { NSLog(@mouseUp); NSTimeInterval endStamp = [theEvent timestamp]; NSLog(@time difference = %.2f, endStamp - [self startStamp]); } where startStamp is an instance variable that records the timestamp on mouse down. Then on mouse up, you grab the timestamp of the mouseUp's event and take the difference between the two timestamps . . Yes, the event's timestamp is the time since system startup (which I interpret to mean the time since last reboot), but that doesn't really matter --- all you're concerned about is the difference in time between mouse down and mouse up . . . Interesting that I just recently implemented something like this for the iphone for similar reasons, namely, to decide whether to show the Cut/Copy/Paste menu . . . Hope that clarifies what I meant. Cheers, . . . . . . . .Henry = iPhone App Development and Developer Education . . . Visit www.nonatomic-retain.com Mac OSX Application Development, Plus a Great Deal More . . . Visit www.trilithon.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Merging changes across NSManagedObjectContexts
On Dec 30, 2009, at 1:58 pm, Rick Mann wrote: Is that operation discussed in the docs somewhere? Yes. http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CoreData/cdProgrammingGuide.html#//apple_ref/doc/uid/TP30001200 mmalc ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Merging changes across NSManagedObjectContexts
On 30 Dec 2009, at 21:58, Rick Mann wrote: On Dec 30, 2009, at 13:54:10, mmalc Crawford wrote: On Dec 30, 2009, at 12:54 pm, Rick Mann wrote: In my app I have a situation where I have two (Core Data) documents open, and I need to merge all the changes made in one doc1 to the changes in doc2. I've been reading the section on Change Management in the Core Data Programming Guide, but it just talks about the caveats and gotchas, and doesn't actually talk about how to effect the merge. It also only talks about the example where the two MOCs share a single file, which is not the case here. Then you're not merging, you're copying/moving objects from one store to another. Is that operation discussed in the docs somewhere? It's pretty much the same as any other operation on with a MOC. You cannot copy or move a managed object from one MOC to another in a simple fashion. Instead, you have got to create new, corresponding objects in the second MOC, and then (if needed) delete the old objects from the first MOC.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Detect dim/brightness keys on laptop
On 25 Dec 2009, at 14:01, John Clayton wrote: My aim is to write a little util that swaps the function keys depending on which app is running (i.e. so that during certain apps you don't have to use the FN key on the laptop to get F1). So I need to have the ability to modify the event stream - e.g. exactly what event taps provides. I would suggest you don't bother. There's a setting in the keyboard preferences that changes the behaviour of the function keys and it's better (in my opinion) to let your users decide for themselves how the keyboard should be set up.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
AddressBook ABMultiValue -labelAtIndex:
When I ask an ABMultiValue for its labelAtIndex: I get some thing like this: _$!Other!$_ I would have expected to get this: other What's odd is that I do get this in the description of the ABMultiValue: * other 818 301 4670 w NG other 323 251 3660 c How can I get to the clean value? Thanks, Rainer P.S. In this case the multivalue obviously contains phone numbers... ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Merging changes across NSManagedObjectContexts
On Dec 30, 2009, at 14:08:15, Mike Abdullah wrote: On 30 Dec 2009, at 21:58, Rick Mann wrote: On Dec 30, 2009, at 13:54:10, mmalc Crawford wrote: On Dec 30, 2009, at 12:54 pm, Rick Mann wrote: In my app I have a situation where I have two (Core Data) documents open, and I need to merge all the changes made in one doc1 to the changes in doc2. I've been reading the section on Change Management in the Core Data Programming Guide, but it just talks about the caveats and gotchas, and doesn't actually talk about how to effect the merge. It also only talks about the example where the two MOCs share a single file, which is not the case here. Then you're not merging, you're copying/moving objects from one store to another. Is that operation discussed in the docs somewhere? It's pretty much the same as any other operation on with a MOC. You cannot copy or move a managed object from one MOC to another in a simple fashion. Instead, you have got to create new, corresponding objects in the second MOC, and then (if needed) delete the old objects from the first MOC. Really? There's no way to associate the MOC with the persistent store of an existing doc, and then do a save operation, and have the objects transferred automatically? Because it seems like Core Data supports creating a second MOC on an existing persistent store and then saving. My problem is that in some situations, new data is being added to an existing store, or a new store, and in some situations, data from an existing store is being edited in a separate MOC (never in the original MOC). So, you're saying I just have to manually create corresponding objects and copy all the property values over? -- Rick ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Encrypting Binary Strings
On Dec 30, 2009, at 3:56 PM, Mr. Gecko wrote: It's ether that you don't understand what I'm doing, or I don't understand that. Here is the full story. I am using Apple's SFAuthorizationView to find out if the user is an administrator. If they are an admin, I allow them to modify the settings, when they save I am saving the settings in AES with 2 keys, 1 randomly generated and saved in AES encrypted by the first key and the other in the binary. Although nobody has cracked it yet, I can't have the first key in the open. The question is: is the AES encryption stuff central to what you're trying to achieve, or is it just your way of enforcing the parental controls? If it's the latter, then you may be able to ditch the encryption scheme entirely and use Authorization Services to replace it as the means for implementing parental controls. Authorization Services is not _just_ about proving that a user is an administrator or acquiring system privileges. You can also use it to make a self-restricted app, like one which implements parental control. Regards, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Knowing mouse pressed time?
On Dec 30, 2009, at 3:59 PM, Henry McGilton (Boulevardier) wrote: I meant that rather than setting a timer and implementing a callback method and remembering to invalidate the timer, and so on and so on, you can do something like this (which took less time to implement than the time required to explain it . . . ): - (void)mouseDown:(NSEvent *)theEvent { NSLog(@mouseDown); [self setStartStamp: [theEvent timestamp]]; } - (void)mouseUp:(NSEvent *)theEvent { NSLog(@mouseUp); NSTimeInterval endStamp = [theEvent timestamp]; NSLog(@time difference = %.2f, endStamp - [self startStamp]); } where startStamp is an instance variable that records the timestamp on mouse down. Then on mouse up, you grab the timestamp of the mouseUp's event and take the difference between the two timestamps . . There is no mouse-up event. He wants to present a menu if there's been X time since the mouse-down even when _no other events have arrived since then_. There's no getting around using a timer of some sort. Cheers, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: AddressBook ABMultiValue -labelAtIndex:
At 2:19 PM -0800 12/30/09, Rainer Standke wrote: When I ask an ABMultiValue for its labelAtIndex: I get some thing like this: _$!Other!$_ I would have expected to get this: other How can I get to the clean value? The function you need is ABCopyLocalizedPropertyOrLabel: http://developer.apple.com/mac/library/DOCUMENTATION/UserExperience/Reference/AddressBook/C/ABUtilitiesRef/Reference/reference.html should do exactly what you need. -aaron ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Encrypting Binary Strings
So are you saying I could use authorization service to store things with the user's authorization and get them back without the user's authentication? If so, is there an example app I can look into and figure it out? Basically my means of AES is to prevent the user from changing the settings without the application and being an administrator. On Dec 30, 2009, at 5:06 PM, Ken Thomases wrote: On Dec 30, 2009, at 3:56 PM, Mr. Gecko wrote: It's ether that you don't understand what I'm doing, or I don't understand that. Here is the full story. I am using Apple's SFAuthorizationView to find out if the user is an administrator. If they are an admin, I allow them to modify the settings, when they save I am saving the settings in AES with 2 keys, 1 randomly generated and saved in AES encrypted by the first key and the other in the binary. Although nobody has cracked it yet, I can't have the first key in the open. The question is: is the AES encryption stuff central to what you're trying to achieve, or is it just your way of enforcing the parental controls? If it's the latter, then you may be able to ditch the encryption scheme entirely and use Authorization Services to replace it as the means for implementing parental controls. Authorization Services is not _just_ about proving that a user is an administrator or acquiring system privileges. You can also use it to make a self-restricted app, like one which implements parental control. Regards, Ken smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Encrypting Binary Strings
On Dec 30, 2009, at 5:15 PM, Mr. Gecko wrote: On Dec 30, 2009, at 5:06 PM, Ken Thomases wrote: On Dec 30, 2009, at 3:56 PM, Mr. Gecko wrote: I am using Apple's SFAuthorizationView to find out if the user is an administrator. If they are an admin, I allow them to modify the settings, when they save I am saving the settings in AES with 2 keys, 1 randomly generated and saved in AES encrypted by the first key and the other in the binary. Although nobody has cracked it yet, I can't have the first key in the open. The question is: is the AES encryption stuff central to what you're trying to achieve, or is it just your way of enforcing the parental controls? If it's the latter, then you may be able to ditch the encryption scheme entirely and use Authorization Services to replace it as the means for implementing parental controls. Authorization Services is not _just_ about proving that a user is an administrator or acquiring system privileges. You can also use it to make a self-restricted app, like one which implements parental control. So are you saying I could use authorization service to store things with the user's authorization and get them back without the user's authentication? You can store a very limited, specific kind of thing: right entries in the authorization policy database. You can then use those to govern the behavior of your program for other (non-admin) users. Basically my means of AES is to prevent the user from changing the settings without the application and being an administrator. Again, it's not clear to me if the settings in question are _just_ the parentally-controlled policies of who can do what within your software or if it's something else. If you're just looking for a means to let a parent configure access settings that control what kids can do with your software, then Authorization Services can work for that. Another interpretation of what you just said is that you just want to store some data when the parent is running your app but, when a kid is running it, to have them be able to read but not modify that data. If that's all you want, then you can use administrator privileges to write a file that has everyone-read, only-admin-write permissions. I don't see why you'd need encryption for that. Frankly, the authopen tool should suffice. If so, is there an example app I can look into and figure it out? http://developer.apple.com/Mac/library/samplecode/AuthForAll/index.html Regards, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Encrypting Binary Strings
On Dec 30, 2009, at 5:33 PM, Ken Thomases wrote: On Dec 30, 2009, at 5:15 PM, Mr. Gecko wrote: So are you saying I could use authorization service to store things with the user's authorization and get them back without the user's authentication? You can store a very limited, specific kind of thing: right entries in the authorization policy database. You can then use those to govern the behavior of your program for other (non-admin) users. Basically the only thing I need to store is strings for like if safe search is enabled, or if the user can view things that has adult content. Basically my means of AES is to prevent the user from changing the settings without the application and being an administrator. Again, it's not clear to me if the settings in question are _just_ the parentally-controlled policies of who can do what within your software or if it's something else. If you're just looking for a means to let a parent configure access settings that control what kids can do with your software, then Authorization Services can work for that. Another interpretation of what you just said is that you just want to store some data when the parent is running your app but, when a kid is running it, to have them be able to read but not modify that data. If that's all you want, then you can use administrator privileges to write a file that has everyone-read, only-admin-write permissions. I don't see why you'd need encryption for that. Frankly, the authopen tool should suffice. Hmm, now that's an idea, basically I don't want the user to change it without admin permissions so if I save it as root and give access to everyone else, it will solve my problem. Thank you, but the question on how the iPhone encrypts the strings, is still in mind, if anyone has an answer, I'll be happy to know. If so, is there an example app I can look into and figure it out? http://developer.apple.com/Mac/library/samplecode/AuthForAll/index.html Regards, Ken smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: testing email code in the simulator (MFMailComposeViewControllerDelegate)
On Dec 29, 2009, at 1:46 PM, Paul Archibald wrote: Is there a way to test the emailing code in my app from within the simulator? I don't have an iPhone. It looks like my code is working, but I would really like to see whether the message is actually being constructed and sent correctly. I realize that on an iPhone it would be handed over to the Mail app for sending at a future time, but the sim does not have Mail on it either (is it possible to install Mail onto the simulator?) The simulator does not support using the mail UI (or a number of other things either). I would honestly recommend you get and provision a device if you plan to do significant development, as there are a number of other limitations in the simulator (the most relevant of which is the drastic performance differences between the device and the simulator). An iPod Touch is a popular development environment and should allow you to do most things that are not phone specific. -- David Duncan Apple DTS Animation and Printing ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Encrypting Binary Strings
On Dec 30, 2009, at 5:42 PM, Mr. Gecko wrote: On Dec 30, 2009, at 5:33 PM, Ken Thomases wrote: On Dec 30, 2009, at 5:15 PM, Mr. Gecko wrote: So are you saying I could use authorization service to store things with the user's authorization and get them back without the user's authentication? You can store a very limited, specific kind of thing: right entries in the authorization policy database. You can then use those to govern the behavior of your program for other (non-admin) users. Basically the only thing I need to store is strings for like if safe search is enabled, or if the user can view things that has adult content. This sounds like exactly what Authorization Services is for. You should really read the tech note and the sample code, but here's my explanation: You identify the areas of your app where you need to decide is this allowed or not? For each independent allowable action (or set of actions), you pick a name, using reverse-DNS-style names to keep yours unique. These names are for rights. Some predefined rights you may already be familiar with because they represent system privileges. However, you may create any new rights you like just by inventing a name for them. In your app's code, at each place where the app has to either allow or disallow an action, you attempt to obtain the right using your made-up name. If it succeeds in obtaining the right, your app should allow the action; otherwise, disallow it. By default, since the system doesn't know about your rights, obtaining them will require administrator privileges. So, where's the part where a parent gets to enable actions for kids who don't have administrator privileges? Your app does that by adding new entries in the system's policy database for your made-up rights. To add those entries requires administrator privileges, which is why only a parent (or admin) can do it. But the parent can add a policy giving all users from a particular group the ability to obtain any of the rights you've made up. (The parent doesn't have to know anything about the policy database or rights or whatever. Your app does that, but uses the parent's administrator authorization to do so.) Regards, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: testing email code in the simulator (MFMailComposeViewControllerDelegate)
Second that. I have two Touches just for testing things out. Next stop iPhone. The simulator is great for testing quick compile type things, but you can't beat a Touch to see things in action. On Wed, Dec 30, 2009 at 6:50 PM, David Duncan david.dun...@apple.comwrote: On Dec 29, 2009, at 1:46 PM, Paul Archibald wrote: Is there a way to test the emailing code in my app from within the simulator? I don't have an iPhone. It looks like my code is working, but I would really like to see whether the message is actually being constructed and sent correctly. I realize that on an iPhone it would be handed over to the Mail app for sending at a future time, but the sim does not have Mail on it either (is it possible to install Mail onto the simulator?) The simulator does not support using the mail UI (or a number of other things either). I would honestly recommend you get and provision a device if you plan to do significant development, as there are a number of other limitations in the simulator (the most relevant of which is the drastic performance differences between the device and the simulator). An iPod Touch is a popular development environment and should allow you to do most things that are not phone specific. -- David Duncan Apple DTS Animation and Printing ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/edolecki%40gmail.com This email sent to edole...@gmail.com -- http://ericd.net Interactive design and development ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Save MyDocument
MyDocument is a subclass of NSDocument. The docs say: You can control whether the default accessory view (which contains a pop-up menu allowing the user to choose what type to save) appears in the Save panel by overriding shouldRunSavePanelWithAccessoryView. The default accessory view is used if that method returns YES and the document supports writing multiple types. I can instance a view in IB, add a popup with file types but how to hook this up the NSSavePanel is a ? db ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Merging changes across NSManagedObjectContexts
On Dec 30, 2009, at 2:24 pm, Rick Mann wrote: It's pretty much the same as any other operation on with a MOC. You cannot copy or move a managed object from one MOC to another in a simple fashion. Instead, you have got to create new, corresponding objects in the second MOC, and then (if needed) delete the old objects from the first MOC. Really? There's no way to associate the MOC with the persistent store of an existing doc, and then do a save operation, and have the objects transferred automatically? No, really, there isn't. Really. Because it seems like Core Data supports creating a second MOC on an existing persistent store and then saving. You're describing two completely different operations. Copying a record from one store to another is not the same as having representations of a given record in two contexts. mmalc ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Save MyDocument
Duh ... It was workling and I didn't see it. sorry for the bandwidth waste. On Dec 30, 2009, at 6:55 PM, David Blanton wrote: MyDocument is a subclass of NSDocument. The docs say: You can control whether the default accessory view (which contains a pop-up menu allowing the user to choose what type to save) appears in the Save panel by overriding shouldRunSavePanelWithAccessoryView. The default accessory view is used if that method returns YES and the document supports writing multiple types. I can instance a view in IB, add a popup with file types but how to hook this up the NSSavePanel is a ? db___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/airedale%40tularosa.net This email sent to aired...@tularosa.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Merging changes across NSManagedObjectContexts
On Dec 30, 2009, at 2:08 pm, Mike Abdullah wrote: It's pretty much the same as any other operation on with a MOC. You cannot copy or move a managed object from one MOC to another in a simple fashion. Instead, you have got to create new, corresponding objects in the second MOC, and then (if needed) delete the old objects from the first MOC. Given the introductory clause (It's pretty much the same as any other operation on with a MOC), this is potentially misleading. This applies to the specific case where you want to move data from one store to another. For typical operations with a context, you don't want to move records between stores. If you're using multiple contexts, the more likely scenario is that you have a realisation of a given record in one context and you want another realisation of the same record in another context. For that you do not *create* new objects in the second context (and you don't *delete* the old objects in the first context); instead you ask the context for a managed object using objectWithID: or similar. mmalc ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com