Re: Modal dialog without NSApplication
Hi, thank you very much for your answer, Rob. I am successfully using modal Cocoa windows in a plugin inside a Carbon application. This statement and your code gave me the final hint that it must work - and that the problem must be found somewhere else. Using your code nothing changed at all. In fact it would surprise me if using a loop with a session would be different to calling runModalWithWindow (concerning my problem I mean). So I again looked at the documentation - and here we are: do not send makeKeyAndOrderFront: to aWindow. But I called makeKeyAndOrderFront and you too. I removed the makeKeyAndOrderFront call in my old code - and everything works correct. Everthing? No - there is still one minor problem: if I hide the carbon application and activate it again then my modal window is updated. But not the current modal dialog of the carbon application (which calls my modal dialog via user action). Yes - I know. It is not good practice to show two modal dialogs. But this is the way the carbon application is doing it. And I can not change this. Any ideas how I can send a update to the carbon application? The problem here is that the NSApplication will receive the event - and will not update the carbon modal dialog. Cheers Martin Brodhage ___ 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 [EMAIL PROTECTED]
Re: Core Data adding new instance - creating relationship to existing instance
Thank You, and I am very sorry for being so dim, I'm working on an app that accessing an existing file that Definitely has the Categories, but I'd forgotten that I'd been working on an empty file to make it easier to see changes I was making! Many Thanks Amy On 19 Sep 2008, at 19:23, Jamie Hardt wrote: Hi- Your fetch request isn't finding any Categories, and the array returning from executeFetchRequest is empty. Before doing the setValue:forKey:, you should test the returned array from executeFetchRequest to make sure it contains 0 categories, and handle the situation appropriately if it doesn't. You should also, by-the-by, be passing an NSError pointer to executeFetchRequest: and testing that after it returns to make sure an error didn't occur. On Sep 19, 2008, at 10:47 AM, Amy Heavey wrote: -[NSCFArray objectAtIndex:]: index (0) beyond bounds (0) ___ 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 [EMAIL PROTECTED]
Re: how to set Document type and its icon programatically
Le 19 sept. 08 à 11:22, Nick Rogers a écrit : Hi, My cocoa app is not a document based app, but saves a binary file to the disk. I can set this file's name and extension and icon by going to the Target properties and adding a new document type there. It was working fine and the resulting saved file was given the required icon. But then I had to embed my app into another app directory, since then its not working (no icon is associated now). The directory structure is now: myOuterApp/Contents/MacOS/myInnerApp.app So the inner app's saved file now doesn't display the required icon. Will this problem be resolved if I set the icon programatically? How to go about this? Thanks, Nick Look like LaunchServices does not find you application and does not register it. You may try to register it manually at first launch in you outer app using: LSRegisterURL((CFURLRef)myInnerAppNSUrl, false); ___ 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 [EMAIL PROTECTED]
Re: Constant NSArray Count
Hey, I have started looking at Key Value Observing but I'm having trouble working out how to observe the changes within an Array. Is there some place I can find example code on this to help wrap my head around it? Cheers Alex Mills On Sep 20, 2008, at 6:50 AM, Nick Zitzmann wrote: On Sep 19, 2008, at 9:15 AM, Alex Mills wrote: I have this working as an IBAction but I want it to run all the time so that it will control the tabs whenever the selection count of the Array changes, how can I do this? You can use KVO to call a method when the selectedObjects value changes. Check the KVO documentation and the archives for more details. 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 [EMAIL PROTECTED]
Re: Utility/Floating window with titlebar on left side
On Thu, 18 Sep 2008 17:30:27 -0700, Nick Beadman said: Interface Builder does have Side Title checkbox in the Appearance section of the window attributes inspector when working on Carbon window. IB2 is slightly more intelligent in that it knows it should only be enabled for certain window types (e.g. utility windows). I would still be interested in sample code showing a sub-class of NSWindow or NSPanel Nick Hi Nick. If you want to pursue this, there is an undocumented style bit which gives you a left-edged titlebar. As you mention, IB is smart enough to stop you doing what doesn't make sense, but its possible to override the sanity. ;-) If you subclass your window/ panel, you can then override initWithContentRect:styleMask:backing:defer inside your subclass, and OR the existing stylemask with (19) before calling the super method. The code below shows how (without IB) to do this programmatically: NSWindow * weirdWindow = [[NSWindow alloc] initWithContentRect: NSMakeRect (50, 50, 500, 300) styleMask: NSTitledWindowMask | (1 9) backing: NSBackingStoreBuffered defer: NO]; [weirdWindow orderFront: self]; However, as others have pointed out, it's not that simple. In the above code, for example, I've not made the window closable (no close box) 'cos if you try, the close box will end up half on and half off the vertical titlebar! Not great! If you really want to do this, and make it look good then (a) it's probably quite a bit of work and (b) you'll very likely need to give your window a custom frame class. Cheers, Dave ___ 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 [EMAIL PROTECTED]
Re: Constant NSArray Count
Hey, Yeah I have been reading through a bit of it. At the moment I have an NSArrayController setup in IB to access a Core Data Entity. A table view is then connected to that Array Controller to display the contents of it. This is all done without any code written by myself so I'm pretty new to working with these objects programatically. I need code that will recognize when the selection count of my table view changes, if that count is 0 it will display tab 1, if the selection count is 1 or more it will display tab 2. Right now I have an IBAction that will do this but requires me to press a button for the count check to be performed, what do you think would be the best way to implement this idea? This is the IBAction: -(IBAction)checkCount: sender; { NSArray *selectedObjects = [propertyTableController selectedObjects]; NSUInteger count = [selectedObjects count]; if (count == 0) { [newTabView selectTabViewItemWithIdentifier:@2]; } else { [newTabView selectTabViewItemWithIdentifier:@1]; } return; } Cheers Alex Mills On Sep 20, 2008, at 5:41 PM, Jason Coco wrote: On Sep 20, 2008, at 05:05 , Alex Mills wrote: Hey, I have started looking at Key Value Observing but I'm having trouble working out how to observe the changes within an Array. Is there some place I can find example code on this to help wrap my head around it? I'm pretty sure that you can't do KVO directly on arrays, just on the relationships that the array holds, but to get started, here is a link to the Key-Value Observing guide from Apple: http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueObserving/KeyValueObserving.html#/ /apple_ref/doc/uid/1177 You might also want to do a full-text search for KVO and Key-Value Observing in the search window in Xcode. HTH, Jason ___ 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 [EMAIL PROTECTED]
Cocoa debug/release setting
Hi List, I have a small irritating problem. If I use debug as configuration I cant use breakpoints. If I select release then my breakpoints are working. I dont see what I did change compared with my former project and cant find any particulair in my settings. Of course maybe I did overlook something. Does someone knows what the setting are to change this. Any help is appropiated. Thanks Rene ___ 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 [EMAIL PROTECTED]
Re: Cocoa debug/release setting
On 20 Sep 2008, at 8:33 AM, René v Amerongen wrote: I have a small irritating problem. If I use debug as configuration I cant use breakpoints. If I select release then my breakpoints are working. I dont see what I did change compared with my former project and cant find any particulair in my settings. Of course maybe I did overlook something. Does someone knows what the setting are to change this. What version of Xcode are you using, and on what version of Mac OS X? 1: In the Preferences window, Debugging pane, Symbol Loading Options: Load symbols lazily, uncheck that box. Try debugging. 2: With the configuration set to Debug, and the problem target active, select Project Edit Active Target, then select the Build tab of the resulting Target Info window. Type debug into the search field at the upper-right. Debug Information Format should be set to DWARF. Strip Debug Symbols During Copy should not be checked. Generate Debug Symbols should be checked. Level of Debug Symbols should be Default. Optimization Level should be set to None [-O0] 3: Do you still have that former project? For the problem project, click in that list of settings in the Build Tab, Edit Select All, and drag the list into an empty text window. Do the same for the former project, into another empty text window. Do a file comparison between the files, using the command-line diff command if you don't have any other means. The comparison will probably tell you something. — F -- Fritz Anderson -- Xcode 3 Unleashed: Now in its second printing -- http://x3u.manoverboard.org/ ___ 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 [EMAIL PROTECTED]
Re: Modal dialog without NSApplication
On Sep 19, 2008, at 11:55 PM, brodhage wrote: No - there is still one minor problem: if I hide the carbon application and activate it again then my modal window is updated. But not the current modal dialog of the carbon application (which calls my modal dialog via user action). Yes - I know. It is not good practice to show two modal dialogs. But this is the way the carbon application is doing it. And I can not change this. Any ideas how I can send a update to the carbon application? Probably the Carbon app is using the older classic Mac OS style of handling updates for its Carbon dialog, rather than the modern Carbon events style. If that's the case, there's really nothing you can do. If the Carbon app used Carbon event handlers then this should just work automatically. -eric ___ 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 [EMAIL PROTECTED]
Re: Finding other apps' paths - deterministically!
On Sep 18, 2008, at 8:47 PM, Jerry Krinock wrote: The methods for finding applications, -[NSWorkspace fullPathForApplication:] -[NSWorkspace absolutePathForAppBundleWithIdentifier:] AppleScript's 'path to application' all return only ONE result. If there is more than installation of the application, which often happens out here in real life, the above methods will often pick different installations, and even if you run the same methods several minutes apart I sometimes get different answers. Is there any way to make these methods behave deterministically? If not, what's a better way? Do I have to do a Spotlight search? I know that unix 'find' would be way too slow. Thanks, Jerry Krinock Use NSTask with the command line find -x / -name '*.app' Do this on a separate thread, and cache the result. -- What is a woman that you forsake her, and the hearth fire and the home acre, to go with the old grey Widow Maker. --Kipling, harp song of the Dane women Tommy Nordgren [EMAIL PROTECTED] ___ 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 [EMAIL PROTECTED]
How to create a new window initially zoomed to the maximal size?
What I want to achieve is that when a new window is created, it has the maximal size allowed by the screen, menu and the dock, exactly like if someone clicked the green zoom button in the window's title bar. I don't want any resizing animation or flickering though. It should be something very basic, like a checkbox in the IB, but I can't seem to find 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 [EMAIL PROTECTED]
Re: How to create a new window initially zoomed to the maximal size?
What I want to achieve is that when a new window is created, it has the maximal size allowed by the screen, menu and the dock, exactly like if someone clicked the green zoom button in the window's title bar. I don't want any resizing animation or flickering though. Before ordering the window onto the screen, you can set its frame to fill the screen by calling -[NSWindow zoom:]. Alternatively, you can set its frame to [[window screen] defaultFrame], which is the same frame that -zoom: will use, subtracting space for any visible drawers. -Ben ___ 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 [EMAIL PROTECTED]
Re: How to create a new window initially zoomed to the maximal size?
On Sep 20, 2008, at 11:02 AM, Oleg Krupnov wrote: What I want to achieve is that when a new window is created, it has the maximal size allowed by the screen, menu and the dock, exactly like if someone clicked the green zoom button in the window's title bar. I don't want any resizing animation or flickering though. You would have to resize the window manually. To find out how to size and position it, ask NSScreen for the appropriate frame. To avoid flickering, do this in awakeFromNib or similar, before the window is put on screen. j o a r ___ 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 [EMAIL PROTECTED]
NSImage above scroll view content
Hi all, I have a window with a scroll view that displays an image. I would like to have a centered symbol (another image) on top of this view independently of the slider positions and movements. Do I have to create another window with a transparent background and sync it with the movements of the other window in order to create a new layer? Thanks, Peter ___ 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 [EMAIL PROTECTED]
Re: How to create a new window initially zoomed to the maximal size?
On Sep 20, 2008, at 11:11 AM, Benjamin Stiglitz wrote: Alternatively, you can set its frame to [[window screen] defaultFrame], which is the same frame that -zoom: will use, subtracting space for any visible drawers. I think that should be: -[NSScreen visibleFrame] j o a r ___ 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 [EMAIL PROTECTED]
Re: NSImage above scroll view content
On Sep 20, 2008, at 11:26, Peter Alshuth wrote: I have a window with a scroll view that displays an image. I would like to have a centered symbol (another image) on top of this view independently of the slider positions and movements. Do I have to create another window with a transparent background and sync it with the movements of the other window in order to create a new layer? There are easier ways than that, although it's going to depend a little bit the behavior you want when you (say) click on either of the images. The easiest way is probably to make the scroll view's document view a custom view, and in the custom view's drawRect: method, draw the scrollable image first (positioned relative to the custom view bounds), then draw the symbol image on top (centered on the custom view's visibleRect). Or subclass the view that's displaying the image, and in a drawRect: override call [super drawRect:] then draw the symbol image centered on the visibleRect. Or use a custom view with two image subviews, and reposition the symbol image subview whenever the custom view scrolls. (You can monitor the clip view's bounds changes to detect when scrolling happens.) When doing this kind of thing, make sure you turn off the copy on scroll checkbox for the scroll view. ___ 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 [EMAIL PROTECTED]
Re: How to create a new window initially zoomed to the maximal size?
On Sat, Sep 20, 2008 at 12:22:52PM -0700, j o a r wrote: Alternatively, you can set its frame to [[window screen] defaultFrame], which is the same frame that -zoom: will use, subtracting space for any visible drawers. I think that should be: -[NSScreen visibleFrame] Yes, that’s correct—my mistake. -Ben ___ 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 [EMAIL PROTECTED]
cocoa, Iphone and NDA
Rules are rules... We can not talk about cocoa things related to the iphone in this list... Neither in any other list Lets Ask Apple to change the NDA and all the app store stuff Why dont we just open one page to ask Apple to change the NDA and allow us to talk about it? Why dont just we all sign on this page IT could be easy to make more noise on the papers at this way I think most of us would want Apple to change this Rule. Probably most of us make things with the Iphone SDK IDeas? Lets move all together! If someone has one idea or agree with me in creatin on public page askin for a change, tell me via email Bruno ___ 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 [EMAIL PROTECTED]
Re: Cocoa debug/release setting
Hi, Thank you for your reply. They are for the debug settings the same as the former project settings. The debug setting where the same as you provided. In the release version, the Generate Debug Symbols was checked. BTW, nice Idea about the select all and drag and drop. Didn't use that before. In the release mode the breakpoint did finally stop for now (to). I will close down and start fresh tomorrow, maybe it works out well. Thanks René Op 20 sep 2008, om 16:56 heeft Fritz Anderson het volgende geschreven: On 20 Sep 2008, at 8:33 AM, René v Amerongen wrote: I have a small irritating problem. If I use debug as configuration I cant use breakpoints. If I select release then my breakpoints are working. I dont see what I did change compared with my former project and cant find any particulair in my settings. Of course maybe I did overlook something. Does someone knows what the setting are to change this. What version of Xcode are you using, and on what version of Mac OS X? 1: In the Preferences window, Debugging pane, Symbol Loading Options: Load symbols lazily, uncheck that box. Try debugging. 2: With the configuration set to Debug, and the problem target active, select Project Edit Active Target, then select the Build tab of the resulting Target Info window. Type debug into the search field at the upper-right. Debug Information Format should be set to DWARF. Strip Debug Symbols During Copy should not be checked. Generate Debug Symbols should be checked. Level of Debug Symbols should be Default. Optimization Level should be set to None [-O0] 3: Do you still have that former project? For the problem project, click in that list of settings in the Build Tab, Edit Select All, and drag the list into an empty text window. Do the same for the former project, into another empty text window. Do a file comparison between the files, using the command-line diff command if you don't have any other means. The comparison will probably tell you something. — F -- Fritz Anderson -- Xcode 3 Unleashed: Now in its second printing -- http://x3u.manoverboard.org/ ___ 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 [EMAIL PROTECTED]
[Moderator] Re: cocoa, Iphone and NDA
On 20-Sep-08, at 3:36 PM, Bruno Sanz Marino wrote: Rules are rules... We can not talk about cocoa things related to the iphone in this list... Yet, you do it anyways. Do not talk about the iPhone SDK here. Period. You signed an agreement that you would keep it confidential. Abide by it. Users who discuss it here will be moderated. scott [moderator] ___ 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 [EMAIL PROTECTED]
Re: Core Data migration
Back on March 29 2008, Mr. Wilson reported a problem with migration that I seem to be having now. To wit, a core data model that includes an abstract entity and entity inheritance fails to be migrated on OS X 10.5. I'm getting different errors than he reported. I created a mapping model from the previous to the new data model. Finding, as Mr. Wilson did, a empty property mapping involving an abstract entity, I created a mapping for the abstract entity and related the property mapping to it. When I attempt automatic migration (NSMigratePersistentStoresAutomaticallyOption), I get Persistent store migration failed, missing mapping model. Alternatively, when I manually select the mapping model, NSMappingModel mappingMOdelFromBundles:forSourceModes:destinationModel: does give me my mapping model, but migrateStoreFromURL returns an NSError: Domain=NSCocoaErrorDomain Code=134110 UserInfo=0x80e25b0 An error occured during persistent store migration. If there's a workaround for this, I'd sure love to hear it. Best regards, Paul Collins Gracion Software ___ 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 [EMAIL PROTECTED]
Re: cocoa, Iphone and NDA
Hi, you need to look at it from Apple's point of view. For example, there might be some legal and/or patent pending issues that need to be resolved before the NDA is lifted. Thus, everyone needs to remain patient. In short, Apple needs to do what's in the best interest of their company. -Conrad Sent from my iPhone On Sep 20, 2008, at 12:36 PM, Bruno Sanz Marino [EMAIL PROTECTED] wrote: Rules are rules... We can not talk about cocoa things related to the iphone in this list... Neither in any other list Lets Ask Apple to change the NDA and all the app store stuff Why dont we just open one page to ask Apple to change the NDA and allow us to talk about it? Why dont just we all sign on this page IT could be easy to make more noise on the papers at this way I think most of us would want Apple to change this Rule. Probably most of us make things with the Iphone SDK IDeas? Lets move all together! If someone has one idea or agree with me in creatin on public page askin for a change, tell me via email Bruno ___ 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/conradwt%40gmail.com This email sent to [EMAIL PROTECTED] ___ 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 [EMAIL PROTECTED]
Re: Constant NSArray Count
On Sep 20, 2008, at 4:53 AM, Alex Mills wrote: Hey, Yeah I have been reading through a bit of it. At the moment I have an NSArrayController setup in IB to access a Core Data Entity. A table view is then connected to that Array Controller to display the contents of it. This is all done without any code written by myself so I'm pretty new to working with these objects programatically. I need code that will recognize when the selection count of my table view changes, if that count is 0 it will display tab 1, if the selection count is 1 or more it will display tab 2. Right now I have an IBAction that will do this but requires me to press a button for the count check to be performed, what do you think would be the best way to implement this idea? This is the IBAction: -(IBAction)checkCount: sender; { NSArray *selectedObjects = [propertyTableController selectedObjects]; NSUInteger count = [selectedObjects count]; if (count == 0) { [newTabView selectTabViewItemWithIdentifier:@2]; } else { [newTabView selectTabViewItemWithIdentifier:@1]; } return; } Cheers Alex Mills You might want to look at the tableViewSelectionDidChange: delegate method of NSTableView. http://developer.apple.com/DOCUMENTATION/Cocoa/Reference/ApplicationKit/Classes/NSTableView_Class/Reference/Reference.html#/ /apple_ref/occ/instm/NSObject/tableViewSelectionDidChange: --Nathan ___ 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 [EMAIL PROTECTED]
escaping a string
Greetings. i'm playing around with the torrent specification. and i'm trying to talk to a tracker. for that i need to generate an info_hash acording to the protocol definition the string needs to be escaped. The 20 byte sha1 hash of the bencoded form of the info value from the metainfo file. Note that this is a substring of the metainfo file. This value will almost certainly have to be escaped. my question here, if anyone has done that in the past, in cocoa, how was it done. and if you have any pointers on escaping a string in cocoa, any information would be usefull.. i've tried torrentString = [torrentString stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]; and torrentString = [torrentString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; they both produce a null string, so obviously this is not it... if it can help this is the string I have to escape. start here-- 6:lengthi367464134e4:name48:Stargate.Atlantis.S05E09.HDTV.XviD-0TV. [VTV].avi12:piece lengthi1048576e6:pieces7020:‹Olz;hBfï/k Òîvd˙Ù̉0j’+‡;|8_Wg Ü:∏ˇHPR‰¯÷ó·êÎ∆BABÄÑgÿ| %Fˇ,Âw8th˜U*ÏâUR(‰¤F1ÑìΩ‘• o…ˆsÆ eƒÎûÍCH ˙¥¸û∆Â, œ6Pn˙¡‡¯| ÑNù∆àoÏˇqÈxR4‰ù⁄Ñjˇ… gMÜÊ ®~‡c[EMAIL PROTECTED](ÚÇ˝˛V‹– ã⁄TA( ûsØæ[EMAIL PROTECTED] ¥ÈtNÜuØ˘æk›¿Úê踇R%Ë«π€®ÅŸ ¢YÕ◊`⁄o˘ãe˝s¥„îl0æÇ∫hÍÒedÈ∞g^hAn0˚H/˜¬R $Y∏ŸCEæ/˙ˇ§≤¶$“GÊA§wnÂñ'é[~›ãϱU˝‡-¯øö $û˚U|˜¯0⁄4¯ª‰ÜNNz†OÖ˛tbåùèZ√≥0(¿®ˆ ¤z≠Åx~mˇ}˙S]˚·ölk.∫≈ÿô/OV`ɉp]U¡o ¤Nu'[¥˘áπÙÁ2ñ€ç! ŒDRê8M„«x≈≈qfi•GÌèÙK,d kQg≠E}ılå´#ô8Ù©?Â~ õ∫–Üá€öıÎ ∂ÖHV5Ô}‹|ÏÂV¥ •›ZdÎÕ cüsqÄfi}Ã58ëq ƒöƒlïÔ èıI≈º⁄•óR9Z/ í÷∫Ê©êyÂYŒ≤w VZ~N˘YD!–¶√≠ª… ¨S‡¸Ê¯√ëâñ€f– ® xÜ]T˚m§¿∆:lŸmùô𕆩Cóm]MjÅWvy9«Ÿòµó∑ªÇÚ ∫5ûéÔL‡ù∂¨ùM©;“Áã≠lÍA#ÈX[ã≥t$l∏C≈?ïO +7kΩó·Ç†\0:‹fl‘∆Øâˇùˇ¥+!º¡(Ÿ£UZà0Ÿ FÑOµ™$ï\ùz¬Mi/A†WÉb=à~¢?Q2ä/êhô•õ˘™ÿ I'QŸ=†u^’ΩÈ)÷2Mœ,CbÃfl≥ÒÜfØÊòæ=⁄2“r M∞LÅ3nB≠ó¤\‰p√¢…¨Y+?ã◊;ıÈÏØ^¡ ò§Óç9òæv¥c©ÑZÜj‚ÿ=ºÏ$5Ÿ£§ÔÑe*Ÿ«BÇ8flv. ‡fl1A#‹¤I9kπ†M—åÇ$¡ÍdãhEıbã[”kl}p8w⁄– MPÀ.p’»√ 4PÉ„°¿•(u;fiiÜÒGΩ§UUR—◊“≠ö| ^ ÊôJAZcz'3ª≠úÁ„–}:.¬gÉÈõF˘Ø¶pr˙vÚ;kq[Äô ‰C\ÍÕV笺ïÙQ2Ã:/≥Á%õçÓÆÚãªø‹– ∞áËÃ8˝NHY‹“îãd%âÍ¥1•˝º‘‚°åÍçù ¥[82qfl∞πpâ≈›U÷+™±Å3Tï∆kV£‹ÄÒH¸Kÿ)9æ¶ f.RÁ'O欶Ÿñgfl≤bÅm˙X≠¤j·±ÕÌUÕmK ¤Ã]Ê•:«6_.˝å Å≠~flfiàu€âÌÁq¥èNSa“¬Óå§{o≤+åT [EMAIL PROTECTED] °#sì≠Rf¢Ô≈Œƒ¢=Æ G≈Ωπ:ó±û6’yÁ WüÂ’27tjÉ≈%‚Ø£¤Dé±8â˛Ë…≥ »;=‚zä}ãHiáÏúUêˆå¤‘Xé´§=ÇWÙ∂*∂®ïQÌ´œ$ɯ ‰V”X±ÇîáPÀ£fF˝;¥ºëÜ∑Õ†Ó»©√¶c| °k`˝Ôö`ÆJËï∞‡≤p1’àÔÀ∂* \≥ïπƒŒÿØ◊Jîâ3ø£á5·c ´4b0C≠¬)ºW8=•Ï∂∆ZsñJMJû^;8=|wy|ƒˆóJÌ 0“ËX´‘W‚ª†~a~÷ä”Mè◊§OÆP ˘∞πë*ÇT5ª#õÿ,ØF‰Ò’S÷ßn,ˆ_æ†∞!óèc˚+ {jj9ÁSÿ∞oµÄ¡XgÿaP√oëö“•ùbM3Z˙– 7˝≠Ælfi˘Ay˘ñ3TË‚û¸%˛g à+*Ê~â3Cï- ~zï*à3ÎOM'ìD˘·Õ±êAÙQÁ≈õ¿ÂóYõñ?/ Óf8ºˇΩÈ’öN#á!¨XAe≤Æß”ÓMâ~Å¡∏Ê ¤hƒ¯Èrbr≠ÃíÖyNWÅßp$p [EMAIL PROTECTED]([EMAIL PROTECTED]ë⁄ı™Zàœ2¤ufwüÏ ƒø˜bpEuT _=dÈyµZ≠¶SBÆ©W⁄'Çeâ‘´TE.˙Yà’Dy(uˇb %i†zókr‚+Lêï¶ØÁ¸[EMAIL PROTECTED])Oπ( §Gòø›Òeˇee end HERE-- thank you Sandro.___ 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 [EMAIL PROTECTED]
Re: Finding other apps' paths - deterministically!
On Sat, Sep 20, 2008 at 12:57 PM, Tommy Nordgren [EMAIL PROTECTED] wrote: Use NSTask with the command line find -x / -name '*.app' Do this on a separate thread, and cache the result. I highly recommend against this approach. One problem is that it will fail badly if any of the returned paths contain the \n character, which is a perfectly legal path character. For another it will fail if the new process would exceed the user's process limit, a limit which tends to be much lower than most other resource limits and thus much easier to encounter in realistic situations. For the original problem, I'd recommend using something like LSCopyApplicationURLsForURL() if it's at all possible. Of course maybe you have data that isn't good for that, but if you can use it then that's the way to go. If you must search the disk, use Spotlight if you can. It will be vastly faster than anything else. The downside is that it won't work if indexing is disabled or if the desired application is in an excluded directory. If you must search the whole disk without Spotlight, use NSDirectoryEnumerator. Or if you're the sort who likes to use unsupported private functions, you may be interested in the discussion near the bottom of http://www.cocoadev.com/index.pl?AllApplications Mike ___ 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 [EMAIL PROTECTED]
Re: escaping a string
On Sat, Sep 20, 2008 at 10:53 PM, Sandro Noel [EMAIL PROTECTED] wrote: Greetings. i'm playing around with the torrent specification. and i'm trying to talk to a tracker. for that i need to generate an info_hash acording to the protocol definition the string needs to be escaped. The 20 byte sha1 hash of the bencoded form of the info value from the metainfo file. Note that this is a substring of the metainfo file. This value will almost certainly have to be escaped. This is an assumption which happens not to be true. Your problem is in thinking of a .torrent file as a string. It is not. It is a plain old sequence of bytes, with no encoding. The sha1 hash data is embedded raw, right in the file. No escaping is done, because there is no need: the length of the data is given in the file. Note that documentation which discusses bencode generally talks about strings. But don't be confused. They correspond to NSData, not to NSString. I also want to point out that your question, aside from not applying to the given situation, is also somewhat ill-founded. The reason for this is that string escaping is a very vague concept that is not well defined. The escaping used for URLs is completely different from the escaping used for C constant strings, and that in turn is different from the escaping used for passing arguments to a command in the shell, and all of those are different from the escaping needed for regular expressions. (And the necessary escaping can depend on what flavor of regex!) There are so many different ways to escape strings that it makes little sense to just choose one arbitrarily in an attempt to make things work. Find out exactly what kind of escaping is needed by the protocol or format you're using, and then use *that* kind of escaping. Or in this case, don't use any. Mike ___ 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 [EMAIL PROTECTED]
Re: escaping a string
Mike, thank you for the explanation, I am using NSData to unbencode the torrent file. ans sucessfully store it to a NSDictionary, plist so i can read it outside the software. that works just fine... The sha1 hash data is embedded raw, right in the file. No escaping is done, because there is no need: the length of the data is given in the file. The Data that needs to be used to create the SHA1 Hash is the data of the info key in raw bencoded form. How would you go about extracting just that part of the data, if converting it to string is not the right way to go. This is how i do it : but obviously this does not work. NSData *torrentData = [[NSData alloc]initWithContentsOfURL:[NSURL URLWithString:itemLink]]; if (0 [torrentData length]){ NSString *torrentString = [[[NSString alloc]initWithData:torrentData encoding:NSASCIIStringEncoding]autorelease]; // find the range of the info section. NSRange infoRange = [torrentString rangeOfString:@4:info options:NSCaseInsensitiveSearch]; torrentString = [torrentString substringFromIndex:(infoRange.location + infoRange.length)]; torrentString = [torrentString substringToIndex:[torrentString length]]; NSString *infoHash = [torrentString sha1HexHash]; } sorry Honestly I had no clue that string escaping was so broad, if i did, i'd never chosen that subject :) thanks for explaining, there is no mention on the documentation on what type of escaping that need to be done on the torrent data. Thank you for your help. Sandro ___ 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 [EMAIL PROTECTED]