Re: objc_msgSend() selector name: tableView:objectValueForTableColumn:row:
Use NSZombieEnabled. Looking at registers isn’t going to help you because the offending memory address probably isn’t a pointer to the object (most likely it’s some bogus address found at the location where the deceased object’s ‘isa’ pointer used to be.) —Jens ___ 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
NSProgress: is there really no API to find its children?
I just started using NSProgress. I’m going to use it as the mechanism for my framework to report the progress of a complex upload/download operation which can involve many files and other HTTP resources: the object representing this operation will have a public “progress” property exposing an NSProgress that the app can observe. I like the way NSProgress is hierarchical, so a top-level instance can have child instances for sub-tasks. I’m making use of this to aggregate the progress of multiple download operations into one progress value. But I can’t find any public API for getting the nested NSProgress instances, i.e. something like “@property (readonly) NSArray* children. Huh? Did I miss something, or is this just some inexplicable hole in the API? (I can tell each NSProgress _knows_ what its children are — it lists them in the output of its -description method, in a very nice tree display.) Assuming this isn’t possible, are there any best practices for working around this? I’m considering defining a custom userInfo property, in which I can store an NSArray of the children. —Jens ___ 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: Proper switching and casing.
On Apr 9, 2015, at 16:05:57, Alex Zavatone z...@mac.com wrote: Is there any reasonable case where you'd want a case condition to not have a break statement after it? Sure, and it happens a lot: switch(justification) { case kLeft: case kCenter: case kRight: DoRegularReflow(); break; case kFullJustifyNormal: case kFullJustifyEvenLastLine: DoJustifiedReflow(); break; } If I ever have a case that has code AND falls through, I make sure I mark it as such in lieu of a break: case 0: Something(); break; case 1: printf(Hey, it's doing that thing you wanted to know about.\n); // Fall through! case 2: { NSString* s = [self getString]; Blah(s); break; } -- Steve Mills Drummer, Mac geek ___ 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
Where is kUCHighSurrogateRangeStart in Swift 1.2
Using Xcode 6.2 my Swift program compiled and run fine. Now Xcode 6.3 complains of unresolved identifier kUCHighSurrogateRangeStart. This is defined in: /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/Headers/TextCommon.h . How to make Swift recognise this file? Gerriet. ___ 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: objc_msgSend() selector name: tableView:objectValueForTableColumn:row:
-rags On Apr 9, 2015, at 12:22 PM, Jens Alfke j...@mooseyard.com wrote: Use NSZombieEnabled Isn't this for use within Xcode? I am running the app on a 10.6.8 machine , not from Xcode on that machine. -rags ___ 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: Does GCD auto-limit concurrent tasks to number of cores?
On another note, I don't know why this is having trouble: dispatch_apply(4950, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^(size_t idx) { --- error }); Incompatible block pointer types passing 'int (^)(size_t)' to parameter of type 'void (^)(size_t)' My bad. I had an inadvertent 'return 0' in the block. Gotta learn to translate Xcodese! -Carl ___ 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: Finder not responding to [NSRunningApplication activateWithOptions]
Thank you very much, the NSWorkspace trick is neat. Doesn’t work for me, though. Or, more precisely, doesn’t work for me on the external display. Activating the Finder either through NSRunningApplication or NSWorkspace on the built-in display works, but trying the same thing on my external display results in the Finder window staying unfocused. What I am really trying to do is moving the Finder window to a secondary display, keeping it focused. Simply changing the window frame works great, but when the focused window arrives on the secondary display, the menu bar on that display stays unfocused, translucent. Which doesn’t feel right, as moving the window manually (using the mouse, that is) makes the menu bar on the secondary display focused. So I came up with a trick: I hide the app before moving, change the window frame to move it, and then I unhide the app again. The window then gets focused and so does the menu bar. The trick works, but not for Finder… T. ___ 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: Force NSTextField (multiline wrapping label) to grow vertically?
On Apr 9, 2015, at 11:24 AM, Steve Mills sjmi...@mac.com wrote: I can't figure out a combination of constraints and hugging/compression values that will cause an NSTextField used as a multiline wrapping label to grow vertically when the window is resized horizontally. I tried setting the label's vertical content hugging to 1 and the vertical content compression resistance to 1000, which seem like the right values to me. Does its intrinsic size never grow to fully contain the wrapped text? Constraints never affect a view's intrinsic content size, at least not without some help from you. The content hugging and compression resistance priorities take the intrinsic content size as input, more or less. Or, thought of another way, they act based on the intrinsic content size. As you've found, by default, a text field will compute an intrinsic content size as though it were laid out in one long line. Since 10.8, though, NSTextField has had a preferredMaxLayoutWidth property. If you set that to a non-zero value, it will compute its intrinsic content size based on the rect it would need if it were wrapped at that width. That's still static, though. By itself, it doesn't help as your window changes width. In a parent view, you could override the -layout method with something like this to adjust it dynamically: - (void) layout { textField.preferredMaxLayoutWidth = 0; [super layout] textField.preferredMaxLayoutWidth = NSWidth([textField alignmentRectForFrame:textField.frame]); [super layout]; } 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: Proper switching and casing.
Sorry that I sent this before the main observation. Considering the implications of this, should Xcode's compiler flag these unbreak-ed case statements with a warning? Currently, it doesn't do that. Is there any reasonable case where you'd want a case condition to not have a break statement after it? Thanks, Alex Zavatone On Apr 9, 2015, at 4:53 PM, Alex Zavatone wrote: I'm looking through the new code that I've inherited and getting to know and love it and I'm running across a few new circumstances I've never seen before. With that said, I just noticed a switch statement with empty case conditions where the variable being checked will be 0, and the execution point/program counter hits both the case statement for 0 and for 1. It looks something like this: switch (myObject.myInt) { case 0: { // There is no code at all within these parens. This is empty. } case 1: { // Important stuff happens here } break; case 2: { // More important stuff happens here } break; default: break; } I was really surprised as all our code within case 1 was getting executed when myInt == 0 and when myInt == 1. Then I noticed that case:0 was put in for a placeholder condition. Since it was entered as a placeholder, it was entered without a break statement after it. In the case of myInt == 0, the program execution just continued down into the case of 1 code block and happily executed it. Who says learning new code isn't fun? Cheers, Alex ___ 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/zav%40mac.com This email sent to z...@mac.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
Does GCD auto-limit concurrent tasks to number of cores?
OS X 10.10 I have a highly CPU-bound project that parallelizes well. A small case has about 5000 tasks that can execute concurrently (max is ~100,000). I would like to use GCD queues to take advantage of the 24 cores I have on my MacPro. Does GCD automatically limit the number of tasks that become current on its queues to the number of cores (hw.logicalcpu)? Or is it the programmer's responsibility to manage this? Suppose I do something like this: dispatch_group_t workgroup = dispatch_group_create(); dispatch_apply(4950, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^(size_t i) { dispatch_group_enter(workgroup); // Code block for executing task i . . . dispatch_group_leave(workgroup); }); dispatch_group_wait(workgroup, DISPATCH_TIME_FOREVER); // Done with all 4950 tasks Will this cause GCD to limit itself to 24 actively concurrent tasks until all 4950 are done? Is there a better way to manage this? -Carl ___ 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: Does GCD auto-limit concurrent tasks to number of cores?
On Apr 9, 2015, at 2:23 PM, Clark Smith Cox III clark@apple.com wrote: On Apr 9, 2015, at 12:07, Carl Hoefs newsli...@autonomy.caltech.edu wrote: I have a highly CPU-bound project that parallelizes well. A small case has about 5000 tasks that can execute concurrently (max is ~100,000). I would like to use GCD queues to take advantage of the 24 cores I have on my MacPro. Does GCD automatically limit the number of tasks that become current on its queues to the number of cores (hw.logicalcpu)? Yes. Well, it's not as simple as limiting to the number of cores. It will continue to spawn worker threads so long as there is spare overall system capacity (up to some internal limit, but that's not the number of cores). If there are other processes/threads doing work on your system, your process will use fewer threads than cores. If some of your tasks are blocked (due to I/O or locks or even sleeps), then you may have more tasks in flight than there are cores, because the blocked tasks don't consume CPU capacity. This can actually be a problem if you have tasks which are mixed I/O and computation, because GCD will over-subscribe the CPU. When the tasks unblock, there are more tasks wanting CPU than there are cores. As much as possible, use dispatch I/O or dispatch sources for I/O. Keep tasks segregated to doing either I/O or computation, not a mix. If you can't use dispatch I/O or sources, then try to self-limit the number of I/O tasks in flight at once (for example by submitting them to a serial queue or low-concurrency-limit NSOperationQueue per device). Once you do that, you should be safe to submit large numbers of CPU tasks and let GCD manage them. 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
Painting standard check box/radio button mark
Is there a way to paint a standard check box or radio button mark, in its various states? I am implementing a custom control which would benefit from this. Clearly one could define a textless NSButton within one's own control, but I was wondering if there is a stock image repository for such things, and I worry about the NSButton taking away the clicks I want to see. Thanks in advance! ___ 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: objc_msgSend() selector name: tableView:objectValueForTableColumn:row:
On Apr 9, 2015, at 12:41 PM, Raglan T. Tiger r...@crusaderrabbit.net wrote: My app runs just fine on OS X version 10.6.8. On 10.6.8 it crashes. The crash report indicates a bad object having called on it tableView:objectValueForTableColumn:row: The eax register has a value that does not match any table being used in the app. The call stack does not show reference to the app. I have attempted to symbolicate this using atos but no results. What is an appropriate methodology to determine the offending entry in the eax register? Application Specific Information: objc_msgSend() selector name: tableView:objectValueForTableColumn:row: Thread 0 Crashed: Dispatch queue: com.apple.main-thread 0 libobjc.A.dylib 0x92f43f94 objc_msgSend + 36 1 com.apple.AppKit 0x9179a1da -[NSTableView preparedCellAtColumn:row:] + 335 2 com.apple.AppKit 0x917b46bc -[NSTableView _drawContentsAtRow:column:withCellFrame:] + 56 3 com.apple.AppKit 0x917b372a -[NSTableView drawRow:clipRect:] + 1131 4 com.apple.AppKit 0x917b3162 -[NSTableView drawRowIndexes:clipRect:] + 360 5 com.apple.AppKit 0x917b1b3b -[NSTableView drawRect:] + 1144 6 com.apple.AppKit 0x917a76f1 -[NSView _drawRect:clip:] + 3721 7 com.apple.AppKit 0x917a4dbd -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 2217 8 com.apple.AppKit 0x917a5750 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4668 9 com.apple.AppKit 0x917a5750 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4668 10 com.apple.AppKit 0x917a5750 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4668 11 com.apple.AppKit 0x917a5750 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4668 12 com.apple.AppKit 0x917a434f -[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 265 13 com.apple.AppKit 0x917a0c96 -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 3309 14 com.apple.AppKit 0x9170184b -[NSView displayIfNeeded] + 818 15 com.apple.AppKit 0x916cab64 -[NSWindow displayIfNeeded] + 204 16 com.apple.AppKit 0x916fc07e _handleWindowNeedsDisplay + 696 17 com.apple.Foundation 0x991ef484 __NSFireTimer + 141 18 com.apple.CoreFoundation 0x98832a3b __CFRunLoopRun + 8059 19 com.apple.CoreFoundation 0x988303c4 CFRunLoopRunSpecific + 452 20 com.apple.CoreFoundation 0x988301f1 CFRunLoopRunInMode + 97 21 com.apple.HIToolbox 0x98e56e04 RunCurrentEventLoopInMode + 392 22 com.apple.HIToolbox 0x98e56af5 ReceiveNextEventCommon + 158 23 com.apple.HIToolbox 0x98e56a3e BlockUntilNextEventMatchingListInMode + 81 24 com.apple.AppKit 0x916d2595 _DPSNextEvent + 847 25 com.apple.AppKit 0x916d1dd6 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 156 26 com.apple.AppKit 0x916941f3 -[NSApplication run] + 821 27 com.apple.AppKit 0x9168c289 NSApplicationMain + 574 28 com.britonleap.Embrilliance 0x0001d938 main + 824 29 com.britonleap.Embrilliance 0x2985 start + 53 == I had this same problem when I was still planning to make Pacifist 3.5 compatible with 10.6.x. What I found was that if I compiled the same code with Xcode 5.x, it would work, but that Xcode 6 had some sort of problem compiling code that would work on Snow Leopard without getting that same crash in the NSTableView code. So basically your options are to downgrade to an older version of Xcode (which might mean downgrading your OS X installation as well, since I don’t know if Xcode 5 can run on Yosemite), or drop 10.6 support. My decision was to do the latter; Snow Leopard is four years old now. Time to move on. Charles ___ 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: Where is kUCHighSurrogateRangeStart in Swift 1.2
On Thu, Apr 9, 2015, at 10:01 AM, Gerriet M. Denkmann wrote: Using Xcode 6.2 my Swift program compiled and run fine. Now Xcode 6.3 complains of unresolved identifier kUCHighSurrogateRangeStart. This is defined in: /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/Headers/TextCommon.h . How to make Swift recognise this file? Are you importing CoreServices? Did you try referring to the symbol as `CoreServices.kUCHighSurrogateRangeStart`? --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: Does GCD auto-limit concurrent tasks to number of cores?
On Apr 9, 2015, at 12:07, Carl Hoefs newsli...@autonomy.caltech.edu wrote: OS X 10.10 I have a highly CPU-bound project that parallelizes well. A small case has about 5000 tasks that can execute concurrently (max is ~100,000). I would like to use GCD queues to take advantage of the 24 cores I have on my MacPro. Does GCD automatically limit the number of tasks that become current on its queues to the number of cores (hw.logicalcpu)? Yes. Or is it the programmer's responsibility to manage this? Suppose I do something like this: dispatch_group_t workgroup = dispatch_group_create(); dispatch_apply(4950, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^(size_t i) { dispatch_group_enter(workgroup); // Code block for executing task i . . . dispatch_group_leave(workgroup); }); dispatch_group_wait(workgroup, DISPATCH_TIME_FOREVER); Note that your use of a dispatch_group here is redundant; dispatch_apply always executes synchronously with respect to the caller (i.e. when the above dispatch_apply has returned, all 4950 executions of your block have already completed). -- Clark Smith Cox III clark@apple.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: Painting standard check box/radio button mark
On 9 Apr 2015, at 17:39, Aandi Inston aa...@quite.com wrote: Is there a way to paint a standard check box or radio button mark, in its various states? I am implementing a custom control which would benefit from this. Clearly one could define a textless NSButton within one's own control, but I was wondering if there is a stock image repository for such things, and I worry about the NSButton taking away the clicks I want to see. NSButtonCell. ___ 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: Gain access to resolved folder alias under sandboxing
On Apr 6, 2015, at 11:49:10, Steve Mills sjmi...@mac.com wrote: Say we have this structure: Pictures LotsOfFolderAliiInHere AliasToRealFolder RealFolder blah.jpg The sandboxed app lets the user choose a folder to process, and processing will use an NSDirectoryEnumerator to recursively go through all items in the chosen folder and add images to the document, and the user chooses LotsOfFolderAliiInHere. When the app gets to AliasToRealFolder, it does the right thing and resolves the alias using URLByResolvingAliasFileAtURL:options:error:. Then it creates the directory enumerator for that resolved folder, where sandboxing says oh no you di-n't and denies access to a folder that was in the parent folder the user chose by way of alias, thereby crippling the user's longstanding way of structuring their folder hierarchy. Is there any way around this hideous omission of what sandboxing should allow? Every time I see a shooting star, I wish hard that sandboxing gets ripped out en masse in 10.11 and replaced with something that works without causing such headaches and roadblocks for developers and users. Submitted radar://20483547. -- Steve Mills Drummer, Mac geek ___ 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
Force NSTextField (multiline wrapping label) to grow vertically?
I can't figure out a combination of constraints and hugging/compression values that will cause an NSTextField used as a multiline wrapping label to grow vertically when the window is resized horizontally. Here's basic layout of the views in the window. (If you aren't viewing plain text mail with a monospaced font, this'll be a mess. (And also; Why not?!?!;)) --- | --- | | |multi- | | | |line | | | |label| | | --- | | | | --- | | | | | | |NSTableView | | | | | | | --- | | | | (button)| | | | (button) (button) | | | --- The top and sides of the label are locked to the top and sides of the window, so it can grow horizontally. The top of the table is locked to the bottom of the label. The bottom and sides of the table are locked to the bottom and sides of the window, so it can grow vertically and horizontally. The buttons are locked to the bottom of the window. If the window width gets small enough that the label needs to wrap, I'd like the label height to grow, which would shrink the height of the table (down to its minimum height). Is this possible? I tried setting the label's vertical content hugging to 1 and the vertical content compression resistance to 1000, which seem like the right values to me. Does its intrinsic size never grow to fully contain the wrapped text? -- Steve Mills Drummer, Mac geek ___ 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: Implement multi-tabs with WebView
On 08 Apr 2015, at 22:24, Juanjo Conti jjco...@carouselapps.com wrote: Hi! I'd like to use a WebView instance to handle a multi-tabs browser-like desktop app. Is it possible using only one WebView instance? Or should I need to use once per tab? You'll want to use one per tab. You could put the web view as a *peer* (not a sub view) above the tab view and react to clicks in it, but you'd have to re-load the page on each tab switch which has issues: - It's slow - It doesn't work for form result pages as then they would be sent twice (for a store page this could cause two orders to be sent instead of one) So having separate web views for the tabs is the safer approach. -- Uli ___ 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: Finder Sync extension menu limitations
Hi Dragan, You're exactly right about the limitations. The only other menu item property that's used is enabled (though typically you wouldn't want a disabled menu item here anyway). Because the presented NSMenu object lives in a different process from your code (in Finder.app, for example), it's impossible for your Finder Sync extension to get a reference to that menu. Some of the other limitations could be removed in the future, so filing a bug report with your priorities is always a good idea. Cheers, --Dave On Apr 8, 2015, at 11:29:12 AM, Dragan Milić mi...@mac.com wrote: Hello, I wonder if anyone have got more experience developing Finder Sync extensions for Yosemite. I believe I figured out some things I’d like to achieve aren’t possible and I’d like to confirm them. It’s related to FIFinderSync protocol method - [FIFinderSync menuForMenuKind:]. According to documentation, in this method I’m supposed to create a menu containing menu items, which are related to selected and/or target items in one of monitored directories. That menu (that is, its items) will be added to Finder standard contextual menu (provided that FIMenuKind parameter is FIMenuKindContextualMenuForItems). This all works fine, but I’ve noticed that not exactly menu items I created in above mentioned method are added to contextual menu, but their “shallow copies. I say “shallow”, because, as far as I can see, only three properties of original menu items are used: title, image and action. All other properties I set to menu items in the protocol method aren’t used, including target, indentation, tag, represented object, etc. Therefore, “shallow menu items that appear in Finder contextual menu have their targets set to nil, which means all menu item actions have to be implemented by the FIFinderSync subclass. This, as well as impossibility to pass menu items tags and represented objects, disturbs my code organisation a bit, but I can work around it. But one particular things really bothers me; if I create a menu item which has its own submenu, the “shallow” menu item added to the contextual menu does not include that submenu, effectively preventing one from creating hierarchical menus provided by Finder Sync extension. My extension is supposed to provide quite some number of actions (depending on selection), many of them are logically grouped and not being able to organise them in hierarchical menu really clutters the whole Finder contextual menu with too many items. Another interesting thing is that if in the action method of a certain “shallow” menu item I try to get a reference to its containing menu (practically trying to get reference to Finder contextual menu), that property returns nil, like the item doesn’t belong in to any menu at all. If anyone realises I’m doing anything wrong, or knows how to overcome these limitations, I’d be really thankful for eventual insights. -- Dragan ___ 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: Does GCD auto-limit concurrent tasks to number of cores?
On Apr 9, 2015, at 2:23 PM, Clark Smith Cox III clark@apple.com wrote: On Apr 9, 2015, at 12:07, Carl Hoefs newsli...@autonomy.caltech.edu wrote: I have a highly CPU-bound project that parallelizes well. A small case has about 5000 tasks that can execute concurrently (max is ~100,000). I would like to use GCD queues to take advantage of the 24 cores I have on my MacPro. Does GCD automatically limit the number of tasks that become current on its queues to the number of cores (hw.logicalcpu)? Yes. Well, it's not as simple as limiting to the number of cores. It will continue to spawn worker threads so long as there is spare overall system capacity (up to some internal limit, but that's not the number of cores). If there are other processes/threads doing work on your system, your process will use fewer threads than cores. If some of your tasks are blocked (due to I/O or locks or even sleeps), then you may have more tasks in flight than there are cores, because the blocked tasks don't consume CPU capacity. This can actually be a problem if you have tasks which are mixed I/O and computation, because GCD will over-subscribe the CPU. When the tasks unblock, there are more tasks wanting CPU than there are cores. As much as possible, use dispatch I/O or dispatch sources for I/O. Keep tasks segregated to doing either I/O or computation, not a mix. If you can't use dispatch I/O or sources, then try to self-limit the number of I/O tasks in flight at once (for example by submitting them to a serial queue or low-concurrency-limit NSOperationQueue per device). Once you do that, you should be safe to submit large numbers of CPU tasks and let GCD manage them. Interesting point. That could present a problem, as I do some I/O within the block. I'll have to try it out and see how it performs. Or perhaps there is there a way to tell a GCD concurrent queue to limit itself to N tasks? On another note, I don't know why this is having trouble: dispatch_apply(4950, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^(size_t idx) { --- error }); Incompatible block pointer types passing 'int (^)(size_t)' to parameter of type 'void (^)(size_t)' -Carl ___ 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: Does GCD auto-limit concurrent tasks to number of cores?
On 9 Apr 2015, at 20:26, Carl Hoefs newsli...@autonomy.caltech.edu wrote: Wonderful! Thank you for clearing this up for me! -Carl On Apr 9, 2015, at 12:07, Carl Hoefs newsli...@autonomy.caltech.edu wrote: OS X 10.10 I have a highly CPU-bound project that parallelizes well. A small case has about 5000 tasks that can execute concurrently (max is ~100,000). I would like to use GCD queues to take advantage of the 24 cores I have on my MacPro. Does GCD automatically limit the number of tasks that become current on its queues to the number of cores (hw.logicalcpu)? Yes. Major caveat to be aware of though: GCD’s scheduling is based purely on CPU usage. If your scheduled work gets held up by some other limit, such as disk access, GCD will spin up another worker thread to do something else off of your queue. Thus it’s possible to end up with huge numbers of threads going at once, mostly blocked, if your workload doesn’t suit GCD. ___ 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: Force NSTextField (multiline wrapping label) to grow vertically?
On Apr 9, 2015, at 1:53 PM, Steve Mills sjmi...@mac.com wrote: On Apr 9, 2015, at 13:28:33, Ken Thomases k...@codeweavers.com wrote: In a parent view, you could override the -layout method with something like this to adjust it dynamically: - (void) layout { textField.preferredMaxLayoutWidth = 0; [super layout] textField.preferredMaxLayoutWidth = NSWidth([textField alignmentRectForFrame:textField.frame]); [super layout]; } Groovy! That works like a charm. I was curious, so I commented out the first 2 lines, and it still works as expected. Do you think the reset to 0 and subsequent forced layout are necessary? Thanks again, Ken. The first line may or may not be necessary depending on the other constraints in your window. The problem it solves is that the last preferredMaxLayoutWidth may prevent the text field from growing any wider, even if you've increased the width of the window. For example, if you have [textField]-(=20)-|, then shrinking the window will force the text field to shrink, but growing the window won't _force_ the text field to grow. It will _allow_ it to, but it might still not if its intrinsic width (from the last preferredMaxLayoutWidth) is narrower and nothing forces it. So, in this case, preferredMaxLayoutWidth will only ever be made smaller, never larger. On the other hand, if you have [textField]-| or the like, and the text field's horizontal content hugging priority is lower than 500, then growing the window will stretch the text field beyond its intrinsic size and that will allow the following lines to compute the appropriate preferredMaxLayoutWidth so that the text field will compute an appropriate intrinsic height (and new intrinsic width). In this case, the first line is not necessary. The second line is necessary in order to be sure that the text field's frame has been updated before you use it. Without it, you can't be sure that the frame has any meaningful value in the third line. 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: UITextView doesn't change the text in iOS 8.2(12D508)
On 08 Apr 2015, at 21:43, wesley.dias wesley.dias wesley.d...@getrak.com.br wrote: I'm having trouble to change the text in a UITextView element on a iPhone 5 OS 8.2(12D508). The same layout works in other versions( version 8 ). I've tried to exclude and add the element again but it still doesn't work. Suggestions? Different XIBs, with one having a broken outlet? Have you checked that nothing comes back NIL using the debugger or log statements? Any log messages in the console? Also, are threads involved? Some things aren't supposed to happen on threads and can just by chance work anyway on some machines, and will fail on others. -- Uli ___ 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: Does GCD auto-limit concurrent tasks to number of cores?
On Thu, 9 Apr 2015 14:40:16 -0500, Ken Thomases said: If some of your tasks are blocked (due to I/O or locks or even sleeps), then you may have more tasks in flight than there are cores, because the blocked tasks don't consume CPU capacity. This can actually be a problem if you have tasks which are mixed I/O and computation, because GCD will over-subscribe the CPU. When the tasks unblock, there are more tasks wanting CPU than there are cores. As much as possible, use dispatch I/O or dispatch sources for I/O. Keep tasks segregated to doing either I/O or computation, not a mix. If you can't use dispatch I/O or sources, then try to self-limit the number of I/O tasks in flight at once (for example by submitting them to a serial queue or low-concurrency-limit NSOperationQueue per device). Once you do that, you should be safe to submit large numbers of CPU tasks and let GCD manage them. Not just IO, but memory usage too. If you have 24 cores, and GCD spins up 24 simultaneous 'tasks', and each needs 2 GB of RAM, then you better hope you have 48 GB of RAM too, or you'll swap and easily end up dog slow. Cheers, -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ 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: Does GCD auto-limit concurrent tasks to number of cores?
Wonderful! Thank you for clearing this up for me! -Carl On Apr 9, 2015, at 12:07, Carl Hoefs newsli...@autonomy.caltech.edu wrote: OS X 10.10 I have a highly CPU-bound project that parallelizes well. A small case has about 5000 tasks that can execute concurrently (max is ~100,000). I would like to use GCD queues to take advantage of the 24 cores I have on my MacPro. Does GCD automatically limit the number of tasks that become current on its queues to the number of cores (hw.logicalcpu)? Yes. Or is it the programmer's responsibility to manage this? Suppose I do something like this: dispatch_group_t workgroup = dispatch_group_create(); dispatch_apply(4950, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^(size_t i) { dispatch_group_enter(workgroup); // Code block for executing task i . . . dispatch_group_leave(workgroup); }); dispatch_group_wait(workgroup, DISPATCH_TIME_FOREVER); Note that your use of a dispatch_group here is redundant; dispatch_apply always executes synchronously with respect to the caller (i.e. when the above dispatch_apply has returned, all 4950 executions of your block have already completed). -- Clark Smith Cox III clark@apple.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: Force NSTextField (multiline wrapping label) to grow vertically?
On Apr 9, 2015, at 13:28:33, Ken Thomases k...@codeweavers.com wrote: In a parent view, you could override the -layout method with something like this to adjust it dynamically: - (void) layout { textField.preferredMaxLayoutWidth = 0; [super layout] textField.preferredMaxLayoutWidth = NSWidth([textField alignmentRectForFrame:textField.frame]); [super layout]; } Groovy! That works like a charm. I was curious, so I commented out the first 2 lines, and it still works as expected. Do you think the reset to 0 and subsequent forced layout are necessary? Thanks again, Ken. -- Steve Mills Drummer, Mac geek ___ 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
objc_msgSend() selector name: tableView:objectValueForTableColumn:row:
My app runs just fine on OS X version 10.6.8. On 10.6.8 it crashes. The crash report indicates a bad object having called on it tableView:objectValueForTableColumn:row: The eax register has a value that does not match any table being used in the app. The call stack does not show reference to the app. I have attempted to symbolicate this using atos but no results. What is an appropriate methodology to determine the offending entry in the eax register? Application Specific Information: objc_msgSend() selector name: tableView:objectValueForTableColumn:row: Thread 0 Crashed: Dispatch queue: com.apple.main-thread 0 libobjc.A.dylib 0x92f43f94 objc_msgSend + 36 1 com.apple.AppKit0x9179a1da -[NSTableView preparedCellAtColumn:row:] + 335 2 com.apple.AppKit0x917b46bc -[NSTableView _drawContentsAtRow:column:withCellFrame:] + 56 3 com.apple.AppKit0x917b372a -[NSTableView drawRow:clipRect:] + 1131 4 com.apple.AppKit0x917b3162 -[NSTableView drawRowIndexes:clipRect:] + 360 5 com.apple.AppKit0x917b1b3b -[NSTableView drawRect:] + 1144 6 com.apple.AppKit0x917a76f1 -[NSView _drawRect:clip:] + 3721 7 com.apple.AppKit0x917a4dbd -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 2217 8 com.apple.AppKit0x917a5750 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4668 9 com.apple.AppKit0x917a5750 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4668 10 com.apple.AppKit0x917a5750 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4668 11 com.apple.AppKit0x917a5750 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4668 12 com.apple.AppKit0x917a434f -[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 265 13 com.apple.AppKit0x917a0c96 -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 3309 14 com.apple.AppKit0x9170184b -[NSView displayIfNeeded] + 818 15 com.apple.AppKit0x916cab64 -[NSWindow displayIfNeeded] + 204 16 com.apple.AppKit0x916fc07e _handleWindowNeedsDisplay + 696 17 com.apple.Foundation0x991ef484 __NSFireTimer + 141 18 com.apple.CoreFoundation0x98832a3b __CFRunLoopRun + 8059 19 com.apple.CoreFoundation0x988303c4 CFRunLoopRunSpecific + 452 20 com.apple.CoreFoundation0x988301f1 CFRunLoopRunInMode + 97 21 com.apple.HIToolbox 0x98e56e04 RunCurrentEventLoopInMode + 392 22 com.apple.HIToolbox 0x98e56af5 ReceiveNextEventCommon + 158 23 com.apple.HIToolbox 0x98e56a3e BlockUntilNextEventMatchingListInMode + 81 24 com.apple.AppKit0x916d2595 _DPSNextEvent + 847 25 com.apple.AppKit0x916d1dd6 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 156 26 com.apple.AppKit0x916941f3 -[NSApplication run] + 821 27 com.apple.AppKit0x9168c289 NSApplicationMain + 574 28 com.britonleap.Embrilliance 0x0001d938 main + 824 29 com.britonleap.Embrilliance 0x2985 start + 53 == -rags ___ 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: Proper switching and casing.
On Apr 9, 2015, at 5:10 PM, Sean McBride wrote: On Thu, 9 Apr 2015 17:05:57 -0400, Alex Zavatone said: Sorry that I sent this before the main observation. Considering the implications of this, should Xcode's compiler flag these unbreak-ed case statements with a warning? Currently, it doesn't do that. -Wimplict-fallthrough Could you go into a little more detail for how I add this option to the build process to generate warnings on a build? It's the end of the day and my caffeine levels are dangerously low. Thanks much. ___ 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
Proper switching and casing.
I'm looking through the new code that I've inherited and getting to know and love it and I'm running across a few new circumstances I've never seen before. With that said, I just noticed a switch statement with empty case conditions where the variable being checked will be 0, and the execution point/program counter hits both the case statement for 0 and for 1. It looks something like this: switch (myObject.myInt) { case 0: { // There is no code at all within these parens. This is empty. } case 1: { // Important stuff happens here } break; case 2: { // More important stuff happens here } break; default: break; } I was really surprised as all our code within case 1 was getting executed when myInt == 0 and when myInt == 1. Then I noticed that case:0 was put in for a placeholder condition. Since it was entered as a placeholder, it was entered without a break statement after it. In the case of myInt == 0, the program execution just continued down into the case of 1 code block and happily executed it. Who says learning new code isn't fun? Cheers, Alex ___ 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: Does GCD auto-limit concurrent tasks to number of cores?
On Thu, 9 Apr 2015 14:40:16 -0500, Sean McBride said: Not just IO, but memory usage too. If you have 24 cores, and GCD spins up 24 simultaneous 'tasks', and each needs 2 GB of RAM, then you better hope you have 48 GB of RAM too, or you'll swap and easily end up dog slow. I just now ran a small 600 task subset on an 8-core iMac, and I got these performance numbers: Memory usage: 800MB (100MB per task) CPU usage: 93.75% (over all cores) Energy impact: Very high Disk I/O: 800 KB/s So, I'm thinking this should scale well to the 24 core MacPro w/32GB RAM. Thx all for the great help! -Carl ___ 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: Proper switching and casing.
On Thu, 9 Apr 2015 17:05:57 -0400, Alex Zavatone said: Sorry that I sent this before the main observation. Considering the implications of this, should Xcode's compiler flag these unbreak-ed case statements with a warning? Currently, it doesn't do that. -Wimplict-fallthrough Is there any reasonable case where you'd want a case condition to not have a break statement after it? Yes, but not often IMHO. Cheers, -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ 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