Re: NSSavePanel problem
Here is the code for running the NSSavePanel. I run the panel using runModal. I simply never return from the runModal if I click the directory popup. Peter -(IBAction)exportDayOutOfDaysReportToHTML:(id)sender { NSSavePanel *sp = [NSSavePanel savePanel]; [sp setTitle:@Save as HTML]; [sp setRequiredFileType:@html]; SSScriptModel * model = [scriptDoc scriptModel]; NSString *activeStripstore = [[model stripstoreManager] currentStripstoreName]; // Go to the stripstore manager and get the list of stripstore name suffixes... // Only the user supplied short name ( from the stripstore name sheet ), not the complete suffix with separator... e.g. (L) NSString *stripstoreNameSuffix = @; NSArray * a = [[model stripstoreManager] stripstoreNameSuffixes]; NSEnumerator *e = [a objectEnumerator]; NSString *s; while( s = [e nextObject] ) { if( [activeStripstore hasSuffix:s] ) { stripstoreNameSuffix = [NSString stringWithString:s]; // e.g. (L) break; } } NSString *suffixCoreString = NSLocalizedString(@SSStripstoreNameSuffixSeparator, nil ); // # at the moment NSString *saveFileName = [NSString stringWithFormat:@%@ - %@%@, [reportSelectorPopup titleOfSelectedItem], suffixCoreString,stripstoreNameSuffix]; [sp setNameFieldStringValue:saveFileName]; int retval = [sp runModal]; // I get hosed in here if I click on the directory popup ….. /// …..….. save names etc ... } ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Problem with NSDatePicker in popover
On Feb 23, 2013, at 10:01 PM, Graham Cox graham@bigpond.com wrote: When a popover is still anchored to its parent window, the popover view's window is the parent window -- which makes sense, when you think about it, because a popover is just another view in the main window. Are you sure about that? I'm not... it would make sense to me if the popover window was a separate window, a child of the original window. That's how it acts and behaves. For example if the popover falls outside the bounds of the original view or window, it has its own shadow etc, and is unclipped by the original window. The internal pointers to the view's window might return some other window of course, but I don't think so - I have tried for example, to attach a sheet to a popover by asking for the view's -window as the sheet's parent and it attached the sheet to the popover. Turned out to be a bad idea, but it worked, sort of. You're right in terms of the underlying implementation of NSPopover. In any of the NSPopover delegate methods, log [[[popover contentViewController] view] window] or notification object] contentViewController] view] window] and you'll get a window object whose iVar is _NSPopoverWindow. You can do essentially the same thing to get the window of a drawer's content. What I was getting at is how the date picker in the popover sees the world. I subclass NSDatePicker in order to intercept the key down event, then I log the window of the event. When the date picker is in the anchored popover, the event window is the parent window, not the private popover window, and the date picker works as expected. When the date picker is in the detached popover window, the event window is, as expected, the newly created detached popover window -- and the date picker doesn't highlight its elements (although it works correctly in every other respect). I assume that the change in window is the source of the problem with the date picker's highlighting behavior after the popover is detached. But I don't understand exactly what's happening, or what I can do about it. When the popover is detached, the new, separate popover view's window is the detached popover window. Do you need to call -makeKeyAndOrderFront: on the detached window? I tried that and it does nothing. That was expected, because I implement -windowDidBecomeKey: in the parent window controller and it is triggered when I detach the popover -- and the notification object is the detached window. -- Bill Cheeseman - b...@cheeseman.name ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Problem with NSDatePicker in popover
On 24/02/2013, at 10:16 PM, Bill Cheeseman b...@cheeseman.name wrote: I assume that the change in window is the source of the problem with the date picker's highlighting behavior after the popover is detached. But I don't understand exactly what's happening, or what I can do about it. Well, I haven't tried this thing with detaching a popover window, but looking at the docs there are a few things that you haven't mentioned. For example, the docs take pains to point out not to attempt to move the content from the popover to the window, but instead to create a separate nib with the content for the detached window. (I think you could probably share a nib loaded by a NSViewController, but it would still be instantiated separately). I assume you have followed this advice. In that second nib, it doesn't seem as if there should be anything special about the arrangement of the window and its content, so it should behave just as if it were any other window loaded from a nib. That means if you have set initialFirstResponder to the date picker view in this second nib, it will become first responder (and hence highlight) when the window is shown. Alternatively, if you are loading the window content using a NSViewController, you might have to undertake setting the initial first responder yourself. If you've done all that and it's still not working as expected, maybe there's a subtle bug in the code that animates between the popover and the new window. This being newish code, it's possible. I have frequently found that Apple's own sample code isn't always as thorough as it could be, so just using sample code as boilerplate may not have considered all these issues; it might not be a bug but just something the sample code didn't bother with. --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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [OT] Sync vs ASync Server Comms
Hi All, On 22 Feb 2013, at 22:23, Jens Alfke wrote: On Feb 22, 2013, at 8:32 AM, Dave d...@looktowindward.com wrote: Of course there are threading issues Having delegates doesn't stop that There are no threading issues if you don’t create background threads. I’ve written a lot of code that does network access using the async APIs, and most of it didn’t require me to create any background threads. Since all my code runs on the main thread, I don’t have any threading issues. That’s one less huge thing to worry about in my app. I think I see what you mean, but I'd argue that there are still threading issues, the OS will create the Background Threads and take care of calling you back on the main thread, I agree, and, if that's all you were doing, it might be said to have No Threading Issues, but, for instance, if the first ASync call, needs data to use on a later call, then there may well be Threading Issues. Example 1: Kick off ASync Operation A to get DataA. Kick off ASync Operation B to get DataB. Kick off ASync Operation C using DataA and DataB - You need to worry about threading (or at least the consequences of threading at this point). In fact, I'd argue that using Sync on a user created Background thread would after a very small learning curve, actually result in less Threading issues but may well suffer performance wise. For instance in pseudo code, Example 1 would look something like: -(void) driverProcess { [self doOperationA]; [self doOperationB]; } -(void)doOperationA { [Network aSyncOperationAWithDelegate:@selector(handleOperationA)]; } -(void)doOperationB { [Network aSyncOperationAWithDelegate:@selector(handleOperationB)]; } -(void) handleOperationA:(DataA*) theDataA { if (xDataB == valid) [Network aSyncOperationCWithData: theDataA andMoreDatax:DataB andDelegate:@selector(handleOperationB)]; } -(void) handleOperationB:(DataB*) theDataB { if (xDataB == valid) [Network aSyncOperationCWithData: xDataA andMoreData:theDataB andDelegate:@selector(handleOperationC)]; } -(void) handleOperationC { } xDataA and xDataB now need to be stored somewhere safe and also need to be checked for validity before use. Whereas, if Sync is used: -(void) driverProcess { DataA* myDataA; DataB* myDataB; if ([NSThread isMainThread] == YES) { [self performSelectorOnBackgroundThread:@selector(driverProcess)]; return; } myDataA = [Network syncOperationA]; myDataB = [Network syncOperationB]; [Network syncOperationCWithData: myDataA andMoreData:myDataB]; } Less code and IMO, less Threading Issues but less performance. Scalability is another issue that I don’t think anyone else has brought up — this is the reason that async network programming has become so popular in server frameworks like Twisted and Node.js. If you want to perform N simultaneous operations with a synchronous API, you have to spawn N threads. As N increases, this gets expensive: threads consume kernel resources and eat up address space for their stacks. With an async API, you can do the same work on a single thread. (And no, the OS does not create N threads behind your back to service the async API; it uses kqueues to manage any number of async tasks from a single background thread.) Yes, I agree, but I'm not suggesting that ASync methods should never be used. Example 1 above, may well be better run as an ASync operation. But Example 2: Kick off Sync Operation A to get DataA. Kick off Sync Operation B Using DataA to get DataB. Kick off Sync or ASync Operation C using DataB. Is better as a Sync or mixed Operation. Another example of where you might have to worry about threading using this method is if you have a large number of requests all replying at about the same time, in this case, the Main Thread is kept busy processing lots of small requests so that, although, it is not Blocked the UI becomes unresponsive and is actually worse than just freezing with an activity indicator, since it leads the user to hit the same controls twice which put additional load on the system when it can cope least. In this case, regardless of the method chosen (Sync vs Async) it would be better to handle updating the UI from one separate Background thread, thus creating Threading Issues. You don't have to take the example so literally! If I called the methods: -(someValue) syncGetValueFromServer { // Get Value From Server - takes a long time. return Value; } -(void) aSyncGetValueFromServer: { // Get Value From Server - takes a long time. } It would amount to exactly the same thing! You are making a common mistake of making conclusions about the method you are calling! No, it wouldn’t be the same. The “aSyncGetValueFromServer” method would return immediately, letting me get on with other work on that thread. That’s what “asynchronous” means. As long as the calling thread
Re: NSSavePanel problem
If you attempt to develop a sample application which reproduces the problem, can you do so? If so, making the sample application available might be quite useful in tracking down the problem. On Feb 24, 2013, at 4:26 AM, Peter Hudson peter.hud...@me.com wrote: Here is the code for running the NSSavePanel. I run the panel using runModal. I simply never return from the runModal if I click the directory popup. Peter -(IBAction)exportDayOutOfDaysReportToHTML:(id)sender { NSSavePanel *sp = [NSSavePanel savePanel]; [sp setTitle:@Save as HTML]; [sp setRequiredFileType:@html]; SSScriptModel * model = [scriptDoc scriptModel]; NSString *activeStripstore = [[model stripstoreManager] currentStripstoreName]; // Go to the stripstore manager and get the list of stripstore name suffixes... // Only the user supplied short name ( from the stripstore name sheet ), not the complete suffix with separator... e.g. (L) NSString *stripstoreNameSuffix = @; NSArray * a = [[model stripstoreManager] stripstoreNameSuffixes]; NSEnumerator *e = [a objectEnumerator]; NSString *s; while( s = [e nextObject] ) { if( [activeStripstore hasSuffix:s] ) { stripstoreNameSuffix = [NSString stringWithString:s]; // e.g. (L) break; } } NSString *suffixCoreString = NSLocalizedString(@SSStripstoreNameSuffixSeparator, nil ); // # at the moment NSString *saveFileName = [NSString stringWithFormat:@%@ - %@%@, [reportSelectorPopup titleOfSelectedItem], suffixCoreString,stripstoreNameSuffix]; [sp setNameFieldStringValue:saveFileName]; int retval = [sp runModal]; // I get hosed in here if I click on the directory popup ….. /// …..….. save names etc ... } ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/mailist%40ericgorr.net This email sent to mail...@ericgorr.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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Problem with NSDatePicker in popover (workaround)
On Feb 24, 2013, at 6:33 AM, Graham Cox graham@bigpond.com wrote: If you've done all that and it's still not working as expected, maybe there's a subtle bug in the code that animates between the popover and the new window. This being newish code, it's possible. I've done all that, and I believe it is a bug. Now that I've found a workaround, I will report it to Apple. I have frequently found that Apple's own sample code isn't always as thorough as it could be, so just using sample code as boilerplate may not have considered all these issues; it might not be a bug but just something the sample code didn't bother with. Understood; that's my experience, too. Given the awkwardness of the workaround, however, it seems more likely that it is a bug. Here's the workaround I came up with, tested in Apple's Popover example but not yet tested in my own application. Implement the -windowDidBecomeKey: delegate method in the main window's window controller, as follows: - (void)windowDidBecomeKey:(NSNotification *)notification { if ([[notification object] isEqual:detachedWindow]) { // Disable delegates to avoid infinite loop. [[self window] setDelegate:nil]; [[notification object] setDelegate:nil]; // Make main window key, then make detached popover window key. [[self window] performSelector:@selector(makeKeyAndOrderFront:) withObject:nil afterDelay:0.0]; [[notification object] performSelector:@selector(makeKeyAndOrderFront:) withObject:nil afterDelay:0.0]; // Re-enable delegates. [[self window] performSelector:@selector(setDelegate:) withObject:(id NSWindowDelegate)self afterDelay:0.0]; [[notification object] performSelector:@selector(setDelegate:) withObject:self afterDelay:0.0]; } If you want to test this yourself in the Popover example, be sure to connect the delegate attribute of the popover window in MainMenu.xib to MyWindowController, and add a date picker to the view in PopoverView.xib. -- Bill Cheeseman - b...@cheeseman.name ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Interpreting glyph layout exception
Dear list, I maintain an editor app (for LaTeX) and I have a report from a user of strange behaviour when using a particular font (Brill: http://www.brill.com/author-gateway/brill-fonts). The error seems to happen when the user is editing text via more than one NSTextView (multiple editor windows looking at the same underlying NSTextStorage). The user made a movie showing the issue, and he's just typing 'normal' text at the time of the problem. The error log is attached below. I installed these Brill fonts myself but so far I failed to reproduce the error. I'm not too sure how to interpret the error log, so if anyone else can glean some information from it which would help me reproduce/fix the issue, I'd appreciate it. Best wishes, Martin 23/02/13 5:39:49.387 PM TeXnicle[5487]: An uncaught exception was raised 23/02/13 5:39:49.387 PM TeXnicle[5487]: *** -[NSConcreteTextStorage attributesAtIndex:effectiveRange:]: Range or index out of bounds 23/02/13 5:39:49.394 PM TeXnicle[5487]: ( 0 CoreFoundation 0x7fff972a80a6 __exceptionPreprocess + 198 1 libobjc.A.dylib 0x7fff9678e3f0 objc_exception_throw + 43 2 CoreFoundation 0x7fff972a7e7c +[NSException raise:format:] + 204 3 AppKit 0x7fff8a6d913f -[NSConcreteTextStorage attributesAtIndex:effectiveRange:] + 125 4 AppKit 0x7fff8a668369 -[NSTextView(NSSharing) setSelectedRanges:affinity:stillSelecting:] + 2473 5 AppKit 0x7fff8a62faf8 -[NSLayoutManager textStorage:edited:range:changeInLength:invalidatedRange:] + 406 6 AppKit 0x7fff8a62f94a -[NSTextStorage _notifyEdited:range:changeInLength:invalidatedRange:] + 154 7 AppKit 0x7fff8a6d87a5 -[NSTextStorage processEditing] + 202 8 AppKit 0x7fff8a53a284 -[NSTextStorage endEditing] + 79 9 AppKit 0x7fff8a480b75 -[NSTextView insertText:replacementRange:] + 2316 10 AppKit 0x7fff8aade587 -[NSTextView insertText:] + 324 11 TeXnicle0x000100061204 TeXnicle + 397828 12 AppKit 0x7fff8a536fbf -[NSTextInputContext insertText:replacementRange:] + 337 13 AppKit 0x7fff8a535200 -[NSTextInputContext handleTSMEvent:] + 2781 14 AppKit 0x7fff8a5346fa _NSTSMEventHandler + 202 15 HIToolbox 0x7fff9432cf0a _ZL23DispatchEventToHandlersP14EventTargetRecP14OpaqueEventRefP14HandlerCallRec + 1206 16 HIToolbox 0x7fff9432c3d9 _ZL30SendEventToEventTargetInternalP14OpaqueEventRefP20OpaqueEventTargetRefP14HandlerCallRec + 410 17 HIToolbox 0x7fff943421bd SendEventToEventTarget + 40 18 HIToolbox 0x7fff943226b2 SendTSMEvent + 35 19 HIToolbox 0x7fff94322230 SendUnicodeTextAEToUnicodeDoc + 477 20 HIToolbox 0x7fff94321f62 TSMKeyEvent + 610 21 HIToolbox 0x7fff943721b5 TSMProcessRawKeyEvent + 2568 22 AppKit 0x7fff8a533347 -[NSTextInputContext handleEvent:] + 823 23 AppKit 0x7fff8a532f87 -[NSView interpretKeyEvents:] + 183 24 AppKit 0x7fff8a47ff67 -[NSTextView keyDown:] + 723 25 TeXnicle0x00010005fba1 TeXnicle + 392097 26 AppKit 0x7fff8a69b120 -[NSWindow sendEvent:] + 9687 27 AppKit 0x7fff8a696744 -[NSApplication sendEvent:] + 5761 28 AppKit 0x7fff8a5ac2fa -[NSApplication run] + 636 29 AppKit 0x7fff8a550cb6 NSApplicationMain + 869 30 TeXnicle0x00011cb2 TeXnicle + 7346 31 TeXnicle0x00011c84 TeXnicle + 7300 ) 23/02/13 5:39:49.396 PM TeXnicle[5487]: !!! _NSLayoutTreeLineFragmentRectForGlyphAtIndex invalid glyph index 1 23/02/13 5:39:49.396 PM TeXnicle[5487]: !!! _NSLayoutTreeLineFragmentRectForGlyphAtIndex invalid glyph index 1 23/02/13 5:39:49.396 PM TeXnicle[5487]: !!! _NSLayoutTreeLineFragmentRectForGlyphAtIndex invalid glyph index 1 ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the
Re: Problem with NSDatePicker in popover (workaround)
On Feb 24, 2013, at 8:04 AM, William J. Cheeseman wjcheese...@gmail.com wrote: Here's the workaround I came up with, tested in Apple's Popover example but not yet tested in my own application. It works in my own application, too. All is well with the world once again. Thanks for the help. -- Bill Cheeseman - b...@cheeseman.name ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Problem with NSDatePicker in popover (workaround)
On Feb 24, 2013, at 8:04 AM, William J. Cheeseman wjcheese...@gmail.com wrote: Here's the workaround I came up with, tested in Apple's Popover example but not yet tested in my own application. It works in my own application, too. All is well with the world once again. Thanks for the help. -- Bill Cheeseman - b...@cheeseman.name ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSSavePanel problem
On Feb 24, 2013, at 12:50 AM, Quincey Morris quinceymor...@rivergatesoftware.com wrote: About the only plausible way an app's code might affect something like this, which is straightforwardly deep in NSSavePanel code, might be if there was an accessory view doing something wrong. But even then, it seems unlikely that merely popping up a standard menu control would crash like this. Thanks. 2. I have actually, maybe 3-4 times since 10.8 was released, had a non-sandboxed app crash on displaying an open/save panel, though not this particular crash. Such crashes are repeatable until you futz around in the panel to get past them, then they disappear without a trace. I've never found an iota of evidence that the application code was at fault. If Peter can somehow futz around such that the crash goes away, that would be pretty good additional support for this theory. I'd suggest gathering as much data as possible first, while the bug is repeatable. Like you said, maybe it's something in prefs or in the history items that would show up in the popup if it wasn't crashing. So, save copies of the files where that info is stored. Maybe there will be a clue in the diffs of those files after the bug goes away, maybe not. I also agree with Eric Gorr that this may be a good opportunity to create a reproducible demo app which proves the problem exists. Instead of creating a new app, I'd suggest modifying this app to do nothing except open the save panel. I still don't see the objection to checking for memory errors. I can't imagine a situation where I have a mysterious, perfectly repeatable crasher and I *don't* at least rule out zombies. --Andy ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSSavePanel problem
Okay, you're calling plain old runModal, so that rules out a contextInfo memory management bug. And you don't set a delegate, so that rules out another place to look for bugs. I'm stumped. I'd repeat Eric's suggestion to reduce this to the simplest possible app that reproduces the problem. Also try the things Quincey mentioned to see if you can make the bug go away as mysteriously as it arose. --Andy On Feb 24, 2013, at 4:26 AM, Peter Hudson peter.hud...@me.com wrote: Here is the code for running the NSSavePanel. I run the panel using runModal. I simply never return from the runModal if I click the directory popup. Peter -(IBAction)exportDayOutOfDaysReportToHTML:(id)sender { NSSavePanel *sp = [NSSavePanel savePanel]; [sp setTitle:@Save as HTML]; [sp setRequiredFileType:@html]; SSScriptModel * model = [scriptDoc scriptModel]; NSString *activeStripstore = [[model stripstoreManager] currentStripstoreName]; // Go to the stripstore manager and get the list of stripstore name suffixes... // Only the user supplied short name ( from the stripstore name sheet ), not the complete suffix with separator... e.g. (L) NSString *stripstoreNameSuffix = @; NSArray * a = [[model stripstoreManager] stripstoreNameSuffixes]; NSEnumerator *e = [a objectEnumerator]; NSString *s; while( s = [e nextObject] ) { if( [activeStripstore hasSuffix:s] ) { stripstoreNameSuffix = [NSString stringWithString:s]; // e.g. (L) break; } } NSString *suffixCoreString = NSLocalizedString(@SSStripstoreNameSuffixSeparator, nil ); // # at the moment NSString *saveFileName = [NSString stringWithFormat:@%@ - %@%@, [reportSelectorPopup titleOfSelectedItem], suffixCoreString,stripstoreNameSuffix]; [sp setNameFieldStringValue:saveFileName]; int retval = [sp runModal]; // I get hosed in here if I click on the directory popup ….. /// …..….. save names etc ... } ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSSavePanel problem
I'll see if I can reproduce this problem in a small app. Many thanks to everyone. Peter On 24 Feb 2013, at 13:35, Andy Lee ag...@mac.com wrote: Okay, you're calling plain old runModal, so that rules out a contextInfo memory management bug. And you don't set a delegate, so that rules out another place to look for bugs. I'm stumped. I'd repeat Eric's suggestion to reduce this to the simplest possible app that reproduces the problem. Also try the things Quincey mentioned to see if you can make the bug go away as mysteriously as it arose. --Andy On Feb 24, 2013, at 4:26 AM, Peter Hudson peter.hud...@me.com wrote: Here is the code for running the NSSavePanel. I run the panel using runModal. I simply never return from the runModal if I click the directory popup. Peter -(IBAction)exportDayOutOfDaysReportToHTML:(id)sender { NSSavePanel *sp = [NSSavePanel savePanel]; [sp setTitle:@Save as HTML]; [sp setRequiredFileType:@html]; SSScriptModel * model = [scriptDoc scriptModel]; NSString *activeStripstore = [[model stripstoreManager] currentStripstoreName]; // Go to the stripstore manager and get the list of stripstore name suffixes... // Only the user supplied short name ( from the stripstore name sheet ), not the complete suffix with separator... e.g. (L) NSString *stripstoreNameSuffix = @; NSArray * a = [[model stripstoreManager] stripstoreNameSuffixes]; NSEnumerator *e = [a objectEnumerator]; NSString *s; while( s = [e nextObject] ) { if( [activeStripstore hasSuffix:s] ) { stripstoreNameSuffix = [NSString stringWithString:s]; // e.g. (L) break; } } NSString *suffixCoreString = NSLocalizedString(@SSStripstoreNameSuffixSeparator, nil ); // # at the moment NSString *saveFileName = [NSString stringWithFormat:@%@ - %@%@, [reportSelectorPopup titleOfSelectedItem], suffixCoreString,stripstoreNameSuffix]; [sp setNameFieldStringValue:saveFileName]; int retval = [sp runModal];// I get hosed in here if I click on the directory popup ….. /// …..….. save names etc ... } ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Problem with NSDatePicker in popover (workaround)
On Feb 24, 2013, at 8:25 AM, William J. Cheeseman wjcheese...@gmail.com wrote: On Feb 24, 2013, at 8:04 AM, William J. Cheeseman wjcheese...@gmail.com wrote: Here's the workaround I came up with, tested in Apple's Popover example but not yet tested in my own application. It works in my own application, too. All is well with the world once again. Bug Reporter id# 13281356. -- Bill Cheeseman - b...@cheeseman.name ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Interpreting glyph layout exception
On Feb 24, 2013, at 6:17 AM, Martin Hewitson wrote: Dear list, I maintain an editor app (for LaTeX) and I have a report from a user of strange behaviour when using a particular font (Brill: http://www.brill.com/author-gateway/brill-fonts). The error seems to happen when the user is editing text via more than one NSTextView (multiple editor windows looking at the same underlying NSTextStorage). The user made a movie showing the issue, and he's just typing 'normal' text at the time of the problem. The error log is attached below. I installed these Brill fonts myself but so far I failed to reproduce the error. I'm not too sure how to interpret the error log, so if anyone else can glean some information from it which would help me reproduce/fix the issue, I'd appreciate it. My guess is that there is a mismatch between the character count and the glyph count. If you have already ruled out encoding issues (as well as working in the same language as the user, if applicable), it could be a corrupt font. You could try to have the user send you their font file and see if you can repeat the error. 23/02/13 5:39:49.387 PM TeXnicle[5487]: An uncaught exception was raised 23/02/13 5:39:49.387 PM TeXnicle[5487]: *** -[NSConcreteTextStorage attributesAtIndex:effectiveRange:]: Range or index out of bounds 23/02/13 5:39:49.394 PM TeXnicle[5487]: ( 0 CoreFoundation 0x7fff972a80a6 __exceptionPreprocess + 198 1 libobjc.A.dylib 0x7fff9678e3f0 objc_exception_throw + 43 2 CoreFoundation 0x7fff972a7e7c +[NSException raise:format:] + 204 3 AppKit 0x7fff8a6d913f -[NSConcreteTextStorage attributesAtIndex:effectiveRange:] + 125 4 AppKit 0x7fff8a668369 -[NSTextView(NSSharing) setSelectedRanges:affinity:stillSelecting:] + 2473 5 AppKit 0x7fff8a62faf8 -[NSLayoutManager textStorage:edited:range:changeInLength:invalidatedRange:] + 406 6 AppKit 0x7fff8a62f94a -[NSTextStorage _notifyEdited:range:changeInLength:invalidatedRange:] + 154 7 AppKit 0x7fff8a6d87a5 -[NSTextStorage processEditing] + 202 8 AppKit 0x7fff8a53a284 -[NSTextStorage endEditing] + 79 9 AppKit 0x7fff8a480b75 -[NSTextView insertText:replacementRange:] + 2316 10 AppKit 0x7fff8aade587 -[NSTextView insertText:] + 324 11 TeXnicle0x000100061204 TeXnicle + 397828 12 AppKit 0x7fff8a536fbf -[NSTextInputContext insertText:replacementRange:] + 337 13 AppKit 0x7fff8a535200 -[NSTextInputContext handleTSMEvent:] + 2781 14 AppKit 0x7fff8a5346fa _NSTSMEventHandler + 202 15 HIToolbox 0x7fff9432cf0a _ZL23DispatchEventToHandlersP14EventTargetRecP14OpaqueEventRefP14HandlerCallRec + 1206 16 HIToolbox 0x7fff9432c3d9 _ZL30SendEventToEventTargetInternalP14OpaqueEventRefP20OpaqueEventTargetRefP14HandlerCallRec + 410 17 HIToolbox 0x7fff943421bd SendEventToEventTarget + 40 18 HIToolbox 0x7fff943226b2 SendTSMEvent + 35 19 HIToolbox 0x7fff94322230 SendUnicodeTextAEToUnicodeDoc + 477 20 HIToolbox 0x7fff94321f62 TSMKeyEvent + 610 21 HIToolbox 0x7fff943721b5 TSMProcessRawKeyEvent + 2568 22 AppKit 0x7fff8a533347 -[NSTextInputContext handleEvent:] + 823 23 AppKit 0x7fff8a532f87 -[NSView interpretKeyEvents:] + 183 24 AppKit 0x7fff8a47ff67 -[NSTextView keyDown:] + 723 25 TeXnicle0x00010005fba1 TeXnicle + 392097 26 AppKit 0x7fff8a69b120 -[NSWindow sendEvent:] + 9687 27 AppKit 0x7fff8a696744 -[NSApplication sendEvent:] + 5761 28 AppKit 0x7fff8a5ac2fa -[NSApplication run] + 636 29 AppKit 0x7fff8a550cb6 NSApplicationMain + 869 30 TeXnicle0x00011cb2 TeXnicle + 7346 31 TeXnicle0x00011c84 TeXnicle + 7300 ) 23/02/13 5:39:49.396 PM TeXnicle[5487]: !!! _NSLayoutTreeLineFragmentRectForGlyphAtIndex invalid glyph index 1 23/02/13 5:39:49.396 PM
Re: NSSavePanel problem
I have built a minimal app in xCode 4.6 ( latest release ) running on 10.8.2 - and naturally the directory popup in the NSSavePanel works perfectly. I started the save panel, as before, with runModal. I have gone back to my main app and stripped the method to practically nothing but setting the file name and doing runModal. It still dies on me when I click the directory popup. I have combed my settings etc for clues. I am compiling the app for 10.8 with a deployment platform of 10.6 The code line started about eight years ago and with all updates of OSX and xCode, issues have always been minimal. It's only straight Objective-C and Cocoa API's throughout. Needless to say, when I run the 10.8.2 / xCode 4.6 build of the app in 10.7 or 10.6 it runs perfectly and the directory popup runs just fine. I have checked it out in instruments - and there does not seem to be anything amiss. Having spent ( to my horror ) nearly a 100 hours trying to run this to ground, I have decided that our users won't get an option where to put their files. I'll create a directory on the desktop for them and dump any output into that directory. Many thanks to all for your thoughts. Naturally, any more hints or suggestions welcome. 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSSavePanel problem
On Feb 24, 2013, at 8:21 AM, Peter Hudson peter.hud...@me.com wrote: Having spent ( to my horror ) nearly a 100 hours trying to run this to ground, I have decided that our users won't get an option where to put their files. I'll create a directory on the desktop for them and dump any output into that directory. This does not sound like a good user experience, and it is incompatible with Sandboxing. Why not save a copy of your app's preferences plist, nuke the prefs, and retest your app? If that doesn't clear the problem, try launching your app with the Shift key held down (or turn on Don't restore windows in your Debug scheme's editor, or set the ApplePersistenceIgnoreState default to YES). Also, what items do you have in your Finder sidebar? I sounds like this problem is unavoidable, and sticking your head in the sand by avoiding a save panel here is not a workable solution. And if course, FILE A BUG! http://bugreport.apple.com. It could be that Apple knows about this issue already. --Kyle Sluder ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSSavePanel problem
On Feb 24, 2013, at 09:10 , Kyle Sluder k...@ksluder.com wrote: If that doesn't clear the problem, try launching your app with the Shift key held down (or turn on Don't restore windows in your Debug scheme's editor, or set the ApplePersistenceIgnoreState default to YES). Good idea. I'd also try using Apple menu - Recent Items - Clear Menu. I'd also try switching the panel mode between column view and list view, and navigating to a series of different folder without using the popup (and clicking Save for each one), to push older recents out of the popup. And if course, FILE A BUG! http://bugreport.apple.com. It could be that Apple knows about this issue already. Yes, and attaching a crash dump might provide sufficient information to isolate the problem. On Feb 24, 2013, at 01:26 , Peter Hudson peter.hud...@me.com wrote: NSSavePanel *sp = [NSSavePanel savePanel]; [sp setTitle:@Save as HTML]; [sp setRequiredFileType:@html]; The last line of code is a bit suspect here. 'setRequiredFileType:' was deprecated in 10.6. You should be using 'setAllowedFileTypes:' instead. (If you target back to 10.5, you can use a run-time check to decide which method to use.) More importantly, given that the crash occurs in code that appears to be deciding whether your app can open files with a certain extension, you could change this last line to specify a UTI for html content ('kUTTypeHTML') rather than an extension. UTIs are the *correct* solution. ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSSavePanel problem
It may take more effort to reproduce the problem then just building a minimal app with a NSSavePanel. I have little doubt that works as, if it did not, nearly every application out there would be crashing and they aren't. It will take effort, but you will likely need to replicate the conditions of the crash quite closely to see the same behavior. Of course, since I would assume that you cannot make your real application publicly available, perhaps you could make it available to Apple via a DTS incident. Depending on your specific circumstances, having someone at Apple sign a NDA is not unheard of. There is little doubt in my mind that your problem could be resolved quite quickly. I would recommend against degrading your user experience by auto-creating a directory on the desktop. On Feb 24, 2013, at 11:21 AM, Peter Hudson peter.hud...@me.com wrote: I have built a minimal app in xCode 4.6 ( latest release ) running on 10.8.2 - and naturally the directory popup in the NSSavePanel works perfectly. I started the save panel, as before, with runModal. I have gone back to my main app and stripped the method to practically nothing but setting the file name and doing runModal. It still dies on me when I click the directory popup. I have combed my settings etc for clues. I am compiling the app for 10.8 with a deployment platform of 10.6 The code line started about eight years ago and with all updates of OSX and xCode, issues have always been minimal. It's only straight Objective-C and Cocoa API's throughout. Needless to say, when I run the 10.8.2 / xCode 4.6 build of the app in 10.7 or 10.6 it runs perfectly and the directory popup runs just fine. I have checked it out in instruments - and there does not seem to be anything amiss. Having spent ( to my horror ) nearly a 100 hours trying to run this to ground, I have decided that our users won't get an option where to put their files. I'll create a directory on the desktop for them and dump any output into that directory. Many thanks to all for your thoughts. Naturally, any more hints or suggestions welcome. 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: https://lists.apple.com/mailman/options/cocoa-dev/mailist%40ericgorr.net This email sent to mail...@ericgorr.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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Dynamic library linking
Hello, I have a simple program which I can compile but when I tried to link it with a dynamic library the linker is not able to find the library, despite that it is in the same folder as the program. The longer version: I want to embed Python 3.3 interpreter into simple C program. I'm on MacOS 10.8, which ships with Python 2.7. I downloaded the binary distribution of 3.3 version from python.org, copied the dynamic library from the bundle to a folder, along with all the headers. The library I copied was a file named Python which had a symlink pointing to it named libpython3.3m.dylib. Now that the library is in the folder, I renamed it to python33 so it wouldn't collide with installed Python of version 2.7. So the folder has these files: embed.c, python33 and include folder. The embed.c containts: #include Python.h int main(int argc, char *argv[]) { Py_Initialize(); PyRun_SimpleString(print 'test'\n); Py_Finalize(); return 0; } and running file python33 says: python33 (for architecture i386): Mach-O dynamically linked shared library i386 python33 (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 The problem I have is that when try to run: gcc embed.c -I./include -L. -lpython33 if breaks with: ld: library not found for -lpython33 Please, does anyone know why? I guess this is not exactly Cocoa-related question but I tried to ask about this at various places and I have not found a solution, yet. I have various theories about why this happens, I would be thankful if someone could confirm/reject these: - I cannot just copy out a dynamic library out of a bundle, I have to install the whole Python 3.3 and after it is properly installed at particular locations, then I can link with it. - I'm missing some linker flags. I tried DYLD_LIBRARY_PATH=. but it didn't help. - The Python 3.3 library was compiled with different compiler that what I use to compile my program with. PS: it compiles with: gcc embed.c -I./include python33 but when I tun ./a.out it breaks with: dyld: Library not loaded: /Library/Frameworks/Python.framework/Versions/3.3/Python Referenced from: /Users/ecir/Desktop/embed/./a.out Reason: image not found Trace/BPT trap: 5 I would really appreciate any hint on how to solve this, thank you in advace! ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSButton in NSToolbarItem does not use small size
I'm trying to use a toolbar with NSButtons as the views for the toolbar items. I'm creating the views programmatically and ran into the following problem. I add a NSSearchField a NSPopupButton and some NSButtons to the bar by creating a NSToolbarItem and using setView: on them with the appropriate controls (search field, popup and normal buttons) If I add these and check use small size the NSButtons do not get scaled down. The search field and the popup button though both do scale up/down correctly. The funny thing is, if I add a NSButton with IB as a custom NSToolbarItem it get's scaled down. I read that NSToolbarItem uses setControlSize to scale the view. So I tried to observe the cell for the keyPath controlSize and get notified just for the NSSearchField and the NSPopupButton but the NSButton seems to not get the call. Do I have to take special care with the buttons? Or did something else break the scaling? The initializations for the button item is as follows: NSToolBarItem *item = [[NSToolbarItem alloc] initWithItemIdentifier:itemIdentifier]; NSButton *button = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0, 32, 32)]; [button setButtonType:NSMomentaryPushInButton]; [button setTitle:itemIdentifier]; [[button cell] setControlSize:NSSmallControlSize]; [[button cell] setBezelStyle:NSTexturedRoundedBezelStyle]; [button sizeToFit]; [item setView:button]; [button release]; ___m i c h a e l s t a r k e geschäftsführer HicknHack Software GmbH www.hicknhack-software.com ___k o n t a k t +49 (170) 3686136 cont...@hicknhack.com ___H i c k n H a c k S o f t w a r e G m b H geschäftsführer - maik lathan | andreas reischuck | michael starke bayreuther straße 32 01187 dresden amtsgericht dresden HRB 30351 sitz - dresden ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [OT] Sync vs ASync Server Comms
On 24 Feb 2013, at 12:26, Dave d...@looktowindward.com wrote: Hi All, On 22 Feb 2013, at 22:23, Jens Alfke wrote: On Feb 22, 2013, at 8:32 AM, Dave d...@looktowindward.com wrote: Of course there are threading issues Having delegates doesn't stop that There are no threading issues if you don’t create background threads. I’ve written a lot of code that does network access using the async APIs, and most of it didn’t require me to create any background threads. Since all my code runs on the main thread, I don’t have any threading issues. That’s one less huge thing to worry about in my app. I think I see what you mean, but I'd argue that there are still threading issues, the OS will create the Background Threads and take care of calling you back on the main thread I think you're missing some of the point: with asynchronous methods, the frameworks don't necessarily spawn off one thread per operation. NSURLConnection internally handles all connections on a single thread, rather than one thread per connection. If you're making anything more than a handful of connections at once, this is quite a win. ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSSavePanel problem
Well Quincey, your comment on the last line of code here was salient :- NSSavePanel *sp = [NSSavePanel savePanel]; [sp setTitle:@Save as HTML]; [sp setRequiredFileType:@html]; I commented out the setRequiredFileType: and all is well again. As you point out, this method is deprecated. I've never come across a deprecated method that malfunctions before…... 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Dynamic library linking
On Feb 24, 2013, at 2:09 PM, ecir hana wrote: and running file python33 says: python33 (for architecture i386): Mach-O dynamically linked shared library i386 python33 (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 The problem I have is that when try to run: gcc embed.c -I./include -L. -lpython33 if breaks with: ld: library not found for -lpython33 Please, does anyone know why? The -l option expects a file with the prefix lib and a library suffix. So, -lpython33 requires that the file be named libpython33.something (where something might be dylib or a or possibly a couple of other things). When you have issues like this, you might try passing -v for verbose output. It would probably tell you precisely which file names it tried. 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Dynamic library linking
Ken Thomases, Ben Kennedy, thanks for the replies! Yes, I tried libpython33.so, libpython33.dylib, python33.dylib, ... But I still get that error, even if the file is ls -al: -r-xr-xr-x@ 1 ecir staff 5503912 29 sep 10:27 libpython33.so That -v switch is a good advice but I cannot really make any sense of this http://pastebin.com/ugWxEWw8 On Sun, Feb 24, 2013 at 9:51 PM, Ken Thomases k...@codeweavers.com wrote: On Feb 24, 2013, at 2:09 PM, ecir hana wrote: and running file python33 says: python33 (for architecture i386): Mach-O dynamically linked shared library i386 python33 (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 The problem I have is that when try to run: gcc embed.c -I./include -L. -lpython33 if breaks with: ld: library not found for -lpython33 Please, does anyone know why? The -l option expects a file with the prefix lib and a library suffix. So, -lpython33 requires that the file be named libpython33.something (where something might be dylib or a or possibly a couple of other things). When you have issues like this, you might try passing -v for verbose output. It would probably tell you precisely which file names it tried. 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Inserting UITableViewCell into UITableView without scrolling?
Hello. Does anybody have any idea on how to insert cells in a UITableView that is driven by CoreData without causing the table view to scroll if rows are inserted above the currently visible ones? A bit like the Facebook app? Thanks in advance! -Laurent. -- Laurent Daudelin AIM/iChat/Skype:LaurentDaudelin http://www.nemesys-soft.com/ Logiciels Nemesys Software laur...@nemesys-soft.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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Dynamic library linking
This is an advanced topic which touches on a lot of OS X details. The short of it is, even if you solve your linking problems your Python 3.3 library won't work. What you need to is include the entire Python 3.3 framework in your Application bundle. Once you've figured out how to do that, linking against it is as simple as telling Xcode to link the framework. Here are two links some Googling brought up: Here's the official docs: https://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPFrameworks/Tasks/CreatingFrameworks.html Look under Embedding a Private Framework in Your Application Bundle and start following links. This StackOverflow question touches on the subject: http://stackoverflow.com/questions/1621451/bundle-framework-with-application-in-xcode On Sun, Feb 24, 2013 at 2:09 PM, ecir hana ecir.h...@gmail.com wrote: Hello, I have a simple program which I can compile but when I tried to link it with a dynamic library the linker is not able to find the library, despite that it is in the same folder as the program. The longer version: I want to embed Python 3.3 interpreter into simple C program. I'm on MacOS 10.8, which ships with Python 2.7. I downloaded the binary distribution of 3.3 version from python.org, copied the dynamic library from the bundle to a folder, along with all the headers. The library I copied was a file named Python which had a symlink pointing to it named libpython3.3m.dylib. Now that the library is in the folder, I renamed it to python33 so it wouldn't collide with installed Python of version 2.7. So the folder has these files: embed.c, python33 and include folder. The embed.c containts: #include Python.h int main(int argc, char *argv[]) { Py_Initialize(); PyRun_SimpleString(print 'test'\n); Py_Finalize(); return 0; } and running file python33 says: python33 (for architecture i386): Mach-O dynamically linked shared library i386 python33 (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 The problem I have is that when try to run: gcc embed.c -I./include -L. -lpython33 if breaks with: ld: library not found for -lpython33 Please, does anyone know why? I guess this is not exactly Cocoa-related question but I tried to ask about this at various places and I have not found a solution, yet. I have various theories about why this happens, I would be thankful if someone could confirm/reject these: - I cannot just copy out a dynamic library out of a bundle, I have to install the whole Python 3.3 and after it is properly installed at particular locations, then I can link with it. - I'm missing some linker flags. I tried DYLD_LIBRARY_PATH=. but it didn't help. - The Python 3.3 library was compiled with different compiler that what I use to compile my program with. PS: it compiles with: gcc embed.c -I./include python33 but when I tun ./a.out it breaks with: dyld: Library not loaded: /Library/Frameworks/Python.framework/Versions/3.3/Python Referenced from: /Users/ecir/Desktop/embed/./a.out Reason: image not found Trace/BPT trap: 5 I would really appreciate any hint on how to solve this, thank you in advace! ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/stephen.butler%40gmail.com This email sent to stephen.but...@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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSSavePanel problem
On Feb 24, 2013, at 12:27 PM, Peter Hudson peter.hud...@me.com wrote: I commented out the setRequiredFileType: and all is well again. As you point out, this method is deprecated. I've never come across a deprecated method that malfunctions before…... And it shouldn't! Please file a bug. Hopefully Apple will either fix or remove this method. Great job, eagle-eyed Quincy. --Kyle Sluder ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Dynamic library linking
Marco S Hyman, Stephen J. Butler, thanks a lot! Indeed, stupid me, I was missing -L.. I used to use it (as I copy-pasted above) but somehow when hitting up arrow in terminal I must have accidentally deleted it. Now it links! So to recap, properly naming the library (libpython33.so) and compiling with: gcc embed.c -I./include -L. -lpython33 works! Thank you so much people! The problem is, as Stephen points out, the executable doesn't run: Reason: image not found Trace/BPT trap: 5 I will read the links about frameworks now... On Sun, Feb 24, 2013 at 10:20 PM, Stephen J. Butler stephen.but...@gmail.com wrote: This is an advanced topic which touches on a lot of OS X details. The short of it is, even if you solve your linking problems your Python 3.3 library won't work. What you need to is include the entire Python 3.3 framework in your Application bundle. Once you've figured out how to do that, linking against it is as simple as telling Xcode to link the framework. Here are two links some Googling brought up: Here's the official docs: https://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPFrameworks/Tasks/CreatingFrameworks.html Look under Embedding a Private Framework in Your Application Bundle and start following links. This StackOverflow question touches on the subject: http://stackoverflow.com/questions/1621451/bundle-framework-with-application-in-xcode On Sun, Feb 24, 2013 at 2:09 PM, ecir hana ecir.h...@gmail.com wrote: Hello, I have a simple program which I can compile but when I tried to link it with a dynamic library the linker is not able to find the library, despite that it is in the same folder as the program. The longer version: I want to embed Python 3.3 interpreter into simple C program. I'm on MacOS 10.8, which ships with Python 2.7. I downloaded the binary distribution of 3.3 version from python.org, copied the dynamic library from the bundle to a folder, along with all the headers. The library I copied was a file named Python which had a symlink pointing to it named libpython3.3m.dylib. Now that the library is in the folder, I renamed it to python33 so it wouldn't collide with installed Python of version 2.7. So the folder has these files: embed.c, python33 and include folder. The embed.c containts: #include Python.h int main(int argc, char *argv[]) { Py_Initialize(); PyRun_SimpleString(print 'test'\n); Py_Finalize(); return 0; } and running file python33 says: python33 (for architecture i386): Mach-O dynamically linked shared library i386 python33 (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 The problem I have is that when try to run: gcc embed.c -I./include -L. -lpython33 if breaks with: ld: library not found for -lpython33 Please, does anyone know why? I guess this is not exactly Cocoa-related question but I tried to ask about this at various places and I have not found a solution, yet. I have various theories about why this happens, I would be thankful if someone could confirm/reject these: - I cannot just copy out a dynamic library out of a bundle, I have to install the whole Python 3.3 and after it is properly installed at particular locations, then I can link with it. - I'm missing some linker flags. I tried DYLD_LIBRARY_PATH=. but it didn't help. - The Python 3.3 library was compiled with different compiler that what I use to compile my program with. PS: it compiles with: gcc embed.c -I./include python33 but when I tun ./a.out it breaks with: dyld: Library not loaded: /Library/Frameworks/Python.framework/Versions/3.3/Python Referenced from: /Users/ecir/Desktop/embed/./a.out Reason: image not found Trace/BPT trap: 5 I would really appreciate any hint on how to solve this, thank you in advace! ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/stephen.butler%40gmail.com This email sent to stephen.but...@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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSButton in NSToolbarItem does not use small size
On Feb 24, 2013, at 1:11 PM, Michael Starke wrote: I'm trying to use a toolbar with NSButtons as the views for the toolbar items. I'm creating the views programmatically and ran into the following problem. I add a NSSearchField a NSPopupButton and some NSButtons to the bar by creating a NSToolbarItem and using setView: on them with the appropriate controls (search field, popup and normal buttons) If I add these and check use small size the NSButtons do not get scaled down. The search field and the popup button though both do scale up/down correctly. The funny thing is, if I add a NSButton with IB as a custom NSToolbarItem it get's scaled down. I read that NSToolbarItem uses setControlSize to scale the view. So I tried to observe the cell for the keyPath controlSize and get notified just for the NSSearchField and the NSPopupButton but the NSButton seems to not get the call. Do I have to take special care with the buttons? Or did something else break the scaling? The initializations for the button item is as follows: NSToolBarItem *item = [[NSToolbarItem alloc] initWithItemIdentifier:itemIdentifier]; NSButton *button = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0, 32, 32)]; [button setButtonType:NSMomentaryPushInButton]; [button setTitle:itemIdentifier]; [[button cell] setControlSize:NSSmallControlSize]; [[button cell] setBezelStyle:NSTexturedRoundedBezelStyle]; [button sizeToFit]; [item setView:button]; [button release]; I suspect the issue is that NSButton does not have built-in semantics for control size. In fact, none of the cells in question are documented to respond to -setControlSize is the way you are seeing, but apparently some do. If you consider that a button of any control size can actually be of any size, how would the cell know how to resize itself, other than to just change its font? And if it has an image, how would that work? Because you can't guarantee KVO compliance for any API object that doesn't explicitly state so the only way to reliably know what is happening is to use your own NSButtonCell subclass (better than a symbolic breakpoint). You might actually find that you will need to handle resizing yourself anyway so your work won't go to waste. If setControlSize is really not being called on the cell, then it is probably being handled like any regular view, and then you will probably need to specify the min/max sizes. HTH, Keary Suska Esoteritech, Inc. Demystifying technology for your home or business ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSButton in NSToolbarItem does not use small size
Perhaps I'm not understanding your post, but On Sun, Feb 24, 2013, at 02:53 PM, Keary Suska wrote: On Feb 24, 2013, at 1:11 PM, Michael Starke wrote: I suspect the issue is that NSButton does not have built-in semantics for control size. NSButton does indeed have built-in semantics for controlSize. In fact, none of the cells in question are documented to respond to -setControlSize is the way you are seeing, but apparently some do. All NSCell instances respond to -setControlSize:. If you consider that a button of any control size can actually be of any size, how would the cell know how to resize itself, other than to just change its font? And if it has an image, how would that work? As per the documentation, setting the controlSize of a cell does not change its font. After the cell gets -setControlSize:, someone is responsible for calling -sizeToFit: on the view containing that cell. --Kyle Sluder ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSSavePanel problem
As you suggested Kyle, I tried to log this as a bug on bugreporter - but I couldn't log on due to a bug in the log on process. I was directed to a page to advise Apple of my difficulties I'll try again tommorrow. Thanks again Quincy. Peter On 24 Feb 2013, at 21:28, Kyle Sluder k...@ksluder.com wrote: On Feb 24, 2013, at 12:27 PM, Peter Hudson peter.hud...@me.com wrote: I commented out the setRequiredFileType: and all is well again. As you point out, this method is deprecated. I've never come across a deprecated method that malfunctions before…... And it shouldn't! Please file a bug. Hopefully Apple will either fix or remove this method. Great job, eagle-eyed Quincy. --Kyle Sluder ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSButton in NSToolbarItem does not use small size
The thing that puzzles me is the difference in the behavior if you use an IB file with the an NSButton as ToolbarItemView. As I said, then everything works as expected - the button changes sized to small or regular control size. Does IB create a custom NSToolbarItem that somehow takes care of the correct resizing? The Documentation state that most calls to NSToolbarItem regarding the view get forwarded to the view. In the case with the NSPopupButton the call gets even sent to the button's cell, but I do not get why it's not working with NSButton. --Michael On 25.02.2013, at 00:05, Kyle Sluder k...@ksluder.com wrote: Perhaps I'm not understanding your post, but On Sun, Feb 24, 2013, at 02:53 PM, Keary Suska wrote: On Feb 24, 2013, at 1:11 PM, Michael Starke wrote: I suspect the issue is that NSButton does not have built-in semantics for control size. NSButton does indeed have built-in semantics for controlSize. In fact, none of the cells in question are documented to respond to -setControlSize is the way you are seeing, but apparently some do. All NSCell instances respond to -setControlSize:. If you consider that a button of any control size can actually be of any size, how would the cell know how to resize itself, other than to just change its font? And if it has an image, how would that work? As per the documentation, setting the controlSize of a cell does not change its font. After the cell gets -setControlSize:, someone is responsible for calling -sizeToFit: on the view containing that cell. --Kyle Sluder ___m i c h a e l s t a r k e geschäftsführer HicknHack Software GmbH www.hicknhack-software.com ___k o n t a k t +49 (170) 3686136 cont...@hicknhack.com ___H i c k n H a c k S o f t w a r e G m b H geschäftsführer - maik lathan | andreas reischuck | michael starke bayreuther straße 32 01187 dresden amtsgericht dresden HRB 30351 sitz - dresden ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Dynamic library linking
I'm just getting started with python, so I'm certainly not qualified to comment on this specific problem. However, perhaps the following page may be useful to others getting started with python: http://wolfpaulus.com/journal/mac/installing_python_osx The site gives detailed instructions on installing what was, when written, the latest version of python (2.7, I believe), which didn't work for me until I redid everything, following the steps given including those given by Simon in a comment. Boyd On Feb 24, 2013, at 12:09 PM, ecir hana wrote: Hello, I have a simple program which I can compile but when I tried to link it with a dynamic library the linker is not able to find the library, despite that it is in the same folder as the program. The longer version: I want to embed Python 3.3 interpreter into simple C program. I'm on MacOS 10.8, which ships with Python 2.7. I downloaded the binary distribution of 3.3 version from python.org, copied the dynamic library from the bundle to a folder, along with all the headers. The library I copied was a file named Python which had a symlink pointing to it named libpython3.3m.dylib. Now that the library is in the folder, I renamed it to python33 so it wouldn't collide with installed Python of version 2.7. So the folder has these files: embed.c, python33 and include folder. The embed.c containts: #include Python.h int main(int argc, char *argv[]) { Py_Initialize(); PyRun_SimpleString(print 'test'\n); Py_Finalize(); return 0; } and running file python33 says: python33 (for architecture i386): Mach-O dynamically linked shared library i386 python33 (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 The problem I have is that when try to run: gcc embed.c -I./include -L. -lpython33 if breaks with: ld: library not found for -lpython33 Please, does anyone know why? I guess this is not exactly Cocoa-related question but I tried to ask about this at various places and I have not found a solution, yet. I have various theories about why this happens, I would be thankful if someone could confirm/reject these: - I cannot just copy out a dynamic library out of a bundle, I have to install the whole Python 3.3 and after it is properly installed at particular locations, then I can link with it. - I'm missing some linker flags. I tried DYLD_LIBRARY_PATH=. but it didn't help. - The Python 3.3 library was compiled with different compiler that what I use to compile my program with. PS: it compiles with: gcc embed.c -I./include python33 but when I tun ./a.out it breaks with: dyld: Library not loaded: /Library/Frameworks/Python.framework/Versions/3.3/Python Referenced from: /Users/ecir/Desktop/embed/./a.out Reason: image not found Trace/BPT trap: 5 I would really appreciate any hint on how to solve this, thank you in advace! ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/bcollier2%40cox.net This email sent to bcolli...@cox.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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSButton in NSToolbarItem does not use small size
On Feb 24, 2013, at 4:05 PM, Kyle Sluder wrote: Perhaps I'm not understanding your post, but On Sun, Feb 24, 2013, at 02:53 PM, Keary Suska wrote: On Feb 24, 2013, at 1:11 PM, Michael Starke wrote: I suspect the issue is that NSButton does not have built-in semantics for control size. NSButton does indeed have built-in semantics for controlSize. In fact, none of the cells in question are documented to respond to -setControlSize is the way you are seeing, but apparently some do. All NSCell instances respond to -setControlSize:. That's not what I am saying. I was understanding that the OP is saying that his popups, for example, are resizing like they would in IB, which means they are also changing their font, which you point out below is documented *not* to happen, but, apparently, is. At least for some controls. Explanation? If you consider that a button of any control size can actually be of any size, how would the cell know how to resize itself, other than to just change its font? And if it has an image, how would that work? As per the documentation, setting the controlSize of a cell does not change its font. After the cell gets -setControlSize:, someone is responsible for calling -sizeToFit: on the view containing that cell. What I was trying to say here is that I can't see how the framework can predict on its own exactly what to do with a button, other than changing its font. To whit, I have a number of buttons with icons and no text, and even IB won't do anything with them when their control size is changed and even size to fit is called. As well when the control size is reduced the images are never clipped, so, what is setControlSize actually doing in these cases? Hence my wondering whether NSButton even has the support. Keary Suska Esoteritech, Inc. Demystifying technology for your home or business ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSButton in NSToolbarItem does not use small size
On 25.02.2013, at 02:15, Keary Suska cocoa-...@esoteritech.com wrote: That's not what I am saying. I was understanding that the OP is saying that his popups, for example, are resizing like they would in IB, which means they are also changing their font, which you point out below is documented *not* to happen, but, apparently, is. At least for some controls. Explanation? To clarify this a bit: My app does only use an image on the popup button created in code and this buttons resizes. If one adds an NSPopupButton or a normal NSButton via IB to the ToolbarItems they resize their font according to their control size. I did not test this behavior with code generated NSPopupButtons. ___m i c h a e l s t a r k e geschäftsführer HicknHack Software GmbH www.hicknhack-software.com ___k o n t a k t +49 (170) 3686136 cont...@hicknhack.com ___H i c k n H a c k S o f t w a r e G m b H geschäftsführer - maik lathan | andreas reischuck | michael starke bayreuther straße 32 01187 dresden amtsgericht dresden HRB 30351 sitz - dresden ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com