Re: Stupid objective-c question

2016-09-22 Thread Gabriel Zachmann
>> As to the context type, I would be interested to know of cases where the >> observer doesn't have control over the context. My understanding is that the >> context is something that the observer sets itself when calling addObserver, >> and it is passed back to itself in the above method call.

Normalising file names on macOS

2016-09-22 Thread John Brownie
I find that I am in need of dealing with versions of strings that may be turned into file names, and thus I need to be comparing normalised forms. However, according to https://developer.apple.com/library/content/qa/qa1173/_index.html, "For example, HFS Plus (Mac OS Extended) uses a variant of

Re: Normalising file names on macOS

2016-09-22 Thread Alastair Houghton
On 22 Sep 2016, at 12:04, John Brownie wrote: > > I find that I am in need of dealing with versions of strings that may be > turned into file names, and thus I need to be comparing normalised forms. > However, according to > https://developer.apple.com/library/content/qa/qa1173/_index.html, "F

Re: Normalising file names on macOS

2016-09-22 Thread John Brownie
Alastair Houghton 22 September 2016 at 14:31 This is rather a hairy problem, actually. You don’t know that the filesystem is actually HFS+. The filename in question could refer to a file on an NTFS volume, or (in future) an APFS volume. It could also be

Re: Normalising file names on macOS

2016-09-22 Thread Alastair Houghton
On 22 Sep 2016, at 12:46, John Brownie wrote: > > OK, the situation is that the user provides a name, which comes in through a > standard text field in a dialog. That name is used as a key for a dictionary > which gives a collection of information about that item. It is also used to > create a

Re: Normalising file names on macOS

2016-09-22 Thread John Brownie
Thanks, that sounds like a couple of good options. I'll try some options with the second one, and fall back on the first if necessary. Alastair Houghton wrote: My recommendation would be as follows: 1. If possible, don’t base the filename on the user’s input. Instead, generate your own filen

Entitlements for non-appstore developer-id signed apps

2016-09-22 Thread Roland King
I was reading a review of MacOS Sierra and it was claiming that Developer ID signed, non mac-appstore apps now have access to more of iCloud than they did previously, however it wasn’t very clear about exactly what those available entitlements are. I’ve hunted around the documentation, in the

Re: How to update UI from a background thread

2016-09-22 Thread Dave
Hi Jens, There is definitely something fishy going on, I’ll explain the process and how I am handling it. There is probably a much better way of doing it and if so I’m happy to redesign it. In order to kick off a Network an third part App needs to be run which starts up a process that “looks”

Re: MLMediaLibrary sometimes does not call my KVO

2016-09-22 Thread Gabriel Zachmann
> I’ve run into some unreliability in MLMediaLibrary. It appears to be a bug > because it sometimes can be seen in places that use MLMediaLibrary within > general standard components, such as NSOpenPanel (this adds a media browsing > section if it is set up to allow image types, for example).

Maximum image size ?

2016-09-22 Thread Gabriel Zachmann
What is the maximum size of a bitmap image I can render using the Core Graphics framework and CALayer ? So far, I had assumed it is the maximum texture size the graphics card can handle, so I determined the limits via glGetIntegerv( GL_MAX_TEXTURE_SIZE, &maxTextureSize_ ); But apparently ,

Re: Maximum image size ?

2016-09-22 Thread kata
I don't know the definition but my experience. JPEG accepts up to 65500 pixels width and height. Core Graphics framework supports more than that of course, and also PNG accepts more. Some NSBezierPath methods will fail to draw around 8 and many methods fail over 12, then i support up

Re: Maximum image size ?

2016-09-22 Thread Alex Zavatone
I would RELY on what the limits are. I remember back in the day when we were adding more graphic channels to Macromedia Director and we went from 64 to simply what the computer running our implementation had the RAM and processor power to handle. We set it higher (I forget what) but it was limi

Re: Normalising file names on macOS

2016-09-22 Thread Ken Thomases
On Sep 22, 2016, at 6:04 AM, John Brownie wrote: > > I find that I am in need of dealing with versions of strings that may be > turned into file names, and thus I need to be comparing normalised forms. > However, according to > https://developer.apple.com/library/content/qa/qa1173/_index.html,

Re: How to update UI from a background thread

2016-09-22 Thread Jens Alfke
> On Sep 22, 2016, at 5:20 AM, Dave wrote: > > So I’m wondering if it is something to do with the AppleScript handling? AFAIK, AppleScripts can only be run on the main thread. But it’s been many OS releases since I worked with them. Even if it’s legal to run them from a background thread now

Re: How to update UI from a background thread

2016-09-22 Thread Dave
Ok, will do thanks a lot. The AppleScript is/should be on the Main Thread. I am assuming that the App the Script has finished when it returns but maybe that is not the case. I will look into that too. Thanks a lot for your help. Cheers Dave > On 22 Sep 2016, at 16:42, Jens Alfke wrote: > >

Re: Normalising file names on macOS

2016-09-22 Thread Alastair Houghton
On 22 Sep 2016, at 16:30, Ken Thomases wrote: > > Without undermining Alastair's recommendations, you can achieve what you want > by round-tripping the string through -[NSString fileSystemRepresentation] and > -[NSFileManager stringWithFileSystemRepresentation:length:]. That handles > the nor

Re: Maximum image size ?

2016-09-22 Thread David Duncan
> On Sep 22, 2016, at 6:14 AM, Gabriel Zachmann wrote: > > > What is the maximum size of a bitmap image I can render using the Core > Graphics framework and CALayer ? CoreGraphics is generally limited by main memory, and CALayer by GPU memory. CoreAnimation automatically tiles images that ar

Re: How to update UI from a background thread

2016-09-22 Thread Gary L. Wade
If it's possible, I would ask the tool developer to provide you with a command line or XPC version and try accessing these state transitions in a more UI-thread-friendly manner. Have you stopped your debugger when the freeze happens to see what your main thread stack frame looks like? It might

Re: Maximum image size ?

2016-09-22 Thread Gary L. Wade
If you are dealing with truly astronomical image data, consider that "trying it yourself" may require multiple machines and/or multiple dedicated GPUs similar like how you see those multi-monitor displays shown at conferences and marketing displays. -- Gary L. Wade (Sent from my iPhone) http://w

Re: Entitlements for non-appstore developer-id signed apps

2016-09-22 Thread Quincey Morris
On Sep 22, 2016, at 05:24 , Roland King wrote: > > I was reading a review of MacOS Sierra and it was claiming that Developer ID > signed, non mac-appstore apps now have access to more of iCloud than they did > previously, however it wasn’t very clear about exactly what those available > entitl

Re: Stupid objective-c question

2016-09-22 Thread Quincey Morris
On Sep 22, 2016, at 03:16 , Gabriel Zachmann wrote: > > That makes me wonder: why isn't it possible to register several, different > observers for the same thing? > That way, I wouldn't need to care about observations I didn't create, would I? Because the observer is an object. Your observation

Re: Maximum image size ?

2016-09-22 Thread Jens Alfke
> On Sep 22, 2016, at 10:03 AM, Gary L. Wade > wrote: > > If you are dealing with truly astronomical image data, consider that "trying > it yourself" may require multiple machines and/or multiple dedicated GPUs > similar like how you see those multi-monitor displays shown at conferences > an

Re: Re: Passing param by reference then using within block throws exception

2016-09-22 Thread Kyle Sluder
On Wed, Sep 21, 2016, at 09:22 AM, Steve Mills wrote: > On Sep 21, 2016, at 08:53 AM, Alex Zavatone wrote: > > Stab in the dark here, but I'm stabbing blank. Is there an Instruments > tool or debugging option to detect this? > > Thanks for getting stabby. Fourvel appreciates it (only relevant i

Re: Triggering a segue from code

2016-09-22 Thread Kyle Sluder
On Mon, Sep 19, 2016, at 10:07 PM, Quincey Morris wrote: > On Sep 19, 2016, at 18:10 , mail...@ericgorr.net > wrote: > > > > The strange behavior I am now seeing is that when I show & hide the panel > > using the buttons are what appears to be two (not three, not fou

Re: Passing param by reference then using within block throws exception

2016-09-22 Thread Gary L. Wade
Look at these two lines: >__block NSString* noFillMeIn; ... > *noFillMeIn = @"wow"; Unless the original code is correct, you've got mismatched pointers, and you should try turning on more warnings and reading what they say, as well as trying the analyzer. -- Gary L. Wade (

Re: Re: Passing param by reference then using within block throws exception

2016-09-22 Thread Steve Mills
On Sep 22, 2016, at 02:31 PM, Kyle Sluder wrote: Are you able to reproduce this in a sample app? I tried the following but got no crash: I haven't tried. The real method this came from is much more complex than my simplified example; 6 enumerate* loop blocks on dicts and arrays (a couple nest

Re: Triggering a segue from code

2016-09-22 Thread Quincey Morris
On Sep 22, 2016, at 12:34 , Kyle Sluder wrote: > > -close asks the window’s delegate (via -windowShouldClose:) if it should > close. If the window is owned by a window controller that’s associated > with a document, the document will also get a chance to weigh in via > -shouldCloseWindowControlle

Re: Passing param by reference then using within block throws exception

2016-09-22 Thread Steve Mills
On Sep 22, 2016, at 02:45 PM, "Gary L. Wade" wrote: Look at these two lines:    __block NSString* noFillMeIn; ...          *noFillMeIn = @"wow"; Unless the original code is correct, you've got mismatched pointers, and you should try turning on more warnings and reading what they say,

Re: Maximum image size ?

2016-09-22 Thread Volker in Lists
I am rendering sound sonagrams as contents of CALayers which have dimensions of height 1024 pixels and width above 3 pixel. No problem as long as you don’t use CIFilters. With them roughly 12000 pixels will work and larger images won’t get the filters applied to. I have solved that by using

Defaults occasionally get confused

2016-09-22 Thread Gabriel Zachmann
I have a funny problem with the defaults of my screensaver. Let me try to explain: I read/write from/to the defaults like this: defaults_ = [[ScreenSaverDefaults defaultsForModuleWithName: @"de.zach"] retain]; [defaults_ registerDefaults: appDefaults]; [defaults_ synchron

Re: Stupid objective-c question

2016-09-22 Thread Gabriel Zachmann
> > Because the observer is an object. Your observation and a superclass > observation come from the same object. Whether these are to be treated as > different observations** cannot be determined automatically, hence the need > for a “context”. Sure, but an observation method is what would be

Re: Stupid objective-c question

2016-09-22 Thread Quincey Morris
On Sep 22, 2016, at 15:45 , Gabriel Zachmann wrote: > > Sure, but an observation method is what would be called a "callback" in plain > C. > In C, I can have many different callbacks. > I don't see why that should not be possible in Obj-C - I just would need a > mechanism to add tell the system

Re: MLMediaLibrary sometimes does not call my KVO

2016-09-22 Thread Graham Cox
> On 22 Sep 2016, at 10:45 PM, Gabriel Zachmann wrote: > >> I’ve run into some unreliability in MLMediaLibrary. It appears to be a bug >> because it sometimes can be seen in places that use MLMediaLibrary within >> general standard components, such as NSOpenPanel (this adds a media browsing >

Re: Stupid objective-c question

2016-09-22 Thread Jens Alfke
> On Sep 22, 2016, at 3:45 PM, Gabriel Zachmann wrote: > > I don't see why that should not be possible in Obj-C - I just would need a > mechanism to add tell the system the names / function pointers to be > registered as observers. That’s more like the way NSNotificationCenter works — you spe

Re: Stupid objective-c question

2016-09-22 Thread Sandor Szatmari
So there was lots of discussion and plenty of 'don't do anything that equates to this' --> @"myString" == @"myString", and I agree. I wanted to get some opinions on the following which I have done in the past and perceive as different because the string constant is introduced and defined once

Exception - completion routine is not called

2016-09-22 Thread Dan S
Hello, I have an 'NSInternalInconsistencyException': 'Completion handler passed to -[ViewController webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:] was not called' JavaScript sends message to wkwebkit, and imediatelly after runs alert('test') (from same jscript func

Re: Stupid objective-c question

2016-09-22 Thread Charles Srstka
> On Sep 22, 2016, at 6:07 PM, Quincey Morris > wrote: > > But that’s because the KVO notification mechanism is a more ancient design > concept, where it likely seemed simple, adequate and flexible. I assume it > comes from NeXTStep days (late 80s or early 90s), not OS X 10.0 days (early > 20

Re: Stupid objective-c question

2016-09-22 Thread Doug Hill
> On Sep 22, 2016, at 4:19 PM, Sandor Szatmari > wrote: > > So there was lots of discussion and plenty of 'don't do anything that equates > to this' --> @"myString" == @"myString", and I agree. > > I wanted to get some opinions on the following which I have done in the past > and perceive

Re: How to update UI from a background thread

2016-09-22 Thread Shane Stanley
On 23 Sep. 2016, at 1:42 am, Jens Alfke wrote: > > AFAIK, AppleScripts can only be run on the main thread. But it’s been many OS > releases since I worked with them. FYI, that hasn't been the case for quite some time. -- Shane Stanley , ___ Co

Re: Stupid objective-c question

2016-09-22 Thread Quincey Morris
On Sep 22, 2016, at 16:52 , Charles Srstka wrote: > > Actually nope, it showed up in 10.3, making it younger than the > target/selector approach. In that case, I have no plausible rationale why this was done differently. It’s possible there was a performance-related reason. It’s possible it wa

Re: How to update UI from a background thread

2016-09-22 Thread Shane Stanley
On 22 Sep. 2016, at 10:20 pm, Dave wrote: > > myNetworkleScriptSourceString = [[NSString alloc] > initWithContentsOfFile:myNetworkleScriptFilePath > encoding:NSUTF8StringEncoding error:&myErrorInfo]; > if (myErrorInfo != nil) You should be testing for !myNetworkleScriptSourceString; you should

Re: Triggering a segue from code

2016-09-22 Thread Kyle Sluder
On Thu, Sep 22, 2016, at 02:47 PM, Quincey Morris wrote: > On Sep 22, 2016, at 12:34 , Kyle Sluder wrote: > > > > -close asks the window’s delegate (via -windowShouldClose:) if it should > > close. If the window is owned by a window controller that’s associated > > with a document, the document w

Re: Triggering a segue from code

2016-09-22 Thread Quincey Morris
On Sep 22, 2016, at 20:17 , Kyle Sluder wrote: > > And as Eric has discovered, it instructs the > Storyboard runtime to create a new instance of the window controller > rather than unhiding the existing one. Thanks for clarifying this all. I think the upshot of it is that closing a window has a

Re: Triggering a segue from code

2016-09-22 Thread Shane Stanley
On 23 Sep. 2016, at 1:17 pm, Kyle Sluder wrote: > > -close used to render windows more thoroughly dead So can we assume that the close button generally calls -close? On a tangent here... In Safari, it used to be that if a script asked for the app's windows, -orderedWindows would return a list

Re: Triggering a segue from code

2016-09-22 Thread Kyle Sluder
On Sep 22, 2016, at 10:13 PM, Shane Stanley wrote: > >> On 23 Sep. 2016, at 1:17 pm, Kyle Sluder wrote: >> >> -close used to render windows more thoroughly dead > > So can we assume that the close button generally calls -close? No. You can assume it is morally similar to -performClose, but th

Modern API to read textClipping files

2016-09-22 Thread Allan Odgaard
Is there any non-deprecated API to read textClipping files? FSOpenResFile() was deprecated in 10.8 but I haven’t found a way to replace it. There is the com.apple.ResourceFork extended file attribute, but it seems to be stored in some legacy format that I would rather not try to interpret. __