Re: How do decipher an exception in the log file

2023-07-18 Thread Ben Kennedy via Cocoa-dev


> On Jul 18, 2023, at 9:28 AM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> 2023-07-17 13:13:23.657278+0200 0xff744Error   0x1144e1 
> 2670   0legacyScreenSaver: [com.apple.ScreenSaver:Modules] 
> -[LegacyExtensionManager processExtensionRequest:replyInfo:]_block_invoke -- 
> Module: ArtSaver (ArtSaver) failed to load. Exception: NSRangeException, 
> reason: *** -[__NSArrayM objectAtIndexedSubscript:]: index 
> 9223372036854775807 beyond bounds [0 .. 0]

That number is 0x7FFF, which is particularly recognizable and 
happens to be the value of NSNotFound.

I imagine that in the preceding line of code you called -indexOfObject: on an 
array that didn't contain the object, but then failed to test the value against 
NSNotFound before trying to fetch from that index.

> More precisely, is there a way I can determine the location in the code where 
> the exception occurred?

Do you have symbols for the particular build of the app that crashed? If so, 
there ought to be some way to symbolicate the list of addresses in the "Stack 
trace:" line of the log messages... although maybe not, without knowing the 
base load address of the executable. A full-on crash report, rather than log 
messages, would be a lot more useful.

-ben

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to convert path through container into standard form?

2022-12-11 Thread Ben Kennedy via Cocoa-dev


> On 11 Dec 2022, at 12:51 pm, Mike Abdullah via Cocoa-dev 
>  wrote:
> 
> Have you tried -URLByResolvingSymlinksInPath? As far as I’m aware, the 
> Pictures entry inside your container is a symlink to the real thing, so 
> assuming you have appropriate entitlements, should be possible to resolve it.


Indeed, it seems to work in a Swift REPL. Issuing...

(URL(fileURLWithPath: 
"/Users/ben/Library/Containers/com.apple.ScreenSaver.Engine/Data/Pictures").resolvingSymlinksInPath().path
 as NSString).abbreviatingWithTildeInPath

...yeilds "~/Pictures".

-ben

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Indexing broken for one project

2022-02-13 Thread Ben Kennedy via Cocoa-dev
On 13 Feb 2022, at 1:07 pm, Gabriel Zachmann via Cocoa-dev 
 wrote:

> Just now, I have tried a few other things.
> I deleted some folders in ~/Library/Deverlopers (caches, log files, devices).
> Interestingly, there is no ~/Library/Deverloper/Xcode/DerivedData! (which 
> should contain the indexing stuff; and, naturally, 
> ~pristine/Library/Developer/Xcode does contain the DerivedData).

The derived data location is an Xcode preference (under the Locations tab), so 
it follows that it would have that default value under the new user account -- 
but perhaps it's set to something different for your main user?

-ben

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Accessing a property of a view via its controller doesn't work

2021-09-07 Thread Ben Kennedy via Cocoa-dev

> On Sep 6, 2021, at 2:14 PM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> I had assigned the window to an ivar window_ in viewWillMoveToWindow:
> 
> - (void) viewWillMoveToWindow: (NSWindow *) newWindow
> {
>window_ = newWindow;

I asked earlier, but I’ll ask again: why are you doing this? NSView already has 
a `window` property that provides its window. 

b
___

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: Accessing a property of a view via its controller doesn't work

2021-09-04 Thread Ben Kennedy via Cocoa-dev

> On Sep 4, 2021, at 10:27 AM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> I access the window of a view by two different ways, in the controller and 
> in the view, resp., and in the controller, I always get a nil pointer.
> 
> In my app, I have a subclass of NSView, MyView, declared like this:
> 
> @interface MyView : NSView  CAAnimationDelegate>
> {
>NSWindow * window_;
>...
> }
> @property (readwrite) NSWindow * window_;

What’s the purpose of this? NSView already has a `window` property that returns 
its parent window. Why not just use that?

-ben

Sent from my iPhone
___

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: How to distinguish between different MS Teams statuses

2021-07-22 Thread Ben Kennedy via Cocoa-dev


> On 22 Jul 2021, at 10:45 am, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> is it possible to determine - in my own app - whether or not there is an MS 
> Teams video call taking place at the moment?

The only correct answer to that depends on whether Microsoft Teams provides API 
that vends such information.

> So far, i have been checking whether or not MS Teams is running by the 
> following snippet (omitting some of the safety guards):

That code is answering the wrong question. It might appear to provide the state 
of some running apps, but all it actually does is indicate the presence of some 
particularly-named windows.

Consider:

- What happens when the user happens to be editing a document in another app 
(say, TextEdit) whose name happens to be "Microsoft Teams"? (Or "Zoom"? etc.)
- What happens when Microsoft revises their UI in a future version such that 
the window is called something else?

The window-enumeration approach is coarse and fragile at best.

-ben

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Distributing Mac App to Registered Devices

2021-06-23 Thread Ben Kennedy via Cocoa-dev


> On 23 Jun 2021, at 12:22 pm, Richard Charles via Cocoa-dev 
>  wrote:
> 
> Yes, that is what I do now. However when upgrading to Xcode 12 it wants to 
> change the debug and release configuration to use development signing. 
> Notarized builds are reserved for archiving. Just saying that Apple is 
> steering everyone in that direction.

You ought to build your test versions via the archiving method, just like you 
do your public release versions.

> Apple's answer to the problem is registering devices in your developer 
> account. Except is does not work with mac devices.

I don't think that's quite right. Developer-provisioned builds are really only 
useful to developers (in particular, they allow a debugger to be attached, 
which is immaterial to end users).

-b

___

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: MacOS: nonmodal NSAlert panel

2021-05-12 Thread Ben Kennedy via Cocoa-dev


> On 12 May 2021, at 11:17 am, Carl Hoefs via Cocoa-dev 
>  wrote:
> 
> I'd like to present an informational alert for n seconds then dismiss it 
> without user interaction. But I don't see any way to dismiss, terminate, 
> cancel, invalidate, etc. an NSAlert object.

I recently did that exact thing, like this:

> let alert = NSAlert()
> // ...
> 
> var countdown = 10
> func updateMessage() {
> alert.informativeText = "This message will dismiss in \(countdown) 
> second\(countdown == 1 ? "" : "s")."
> countdown -= 1
> }
> let timer = Timer(timeInterval: 1.0, repeats: true) { timer in
> if countdown == 0 {
> timer.invalidate()
> NSApp.abortModal()
> } else {
> updateMessage()
> }
> }
> updateMessage()
> RunLoop.main.add(timer, forMode: .common)
> 
> alert.runModal()

The key is `abortModal()`.

-ben

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How do you handle reading a plist if it may be an array or a dictionary?

2021-05-09 Thread Ben Kennedy via Cocoa-dev

> On 9 May 2021, at 2:29 pm, Alex Zavatone  wrote:
> 
>> It sounds like you might need to rethink your data model a bit.
> 
> That’s what I’m trying to do!  : D

I meant the internal data model, as in how your program represents the data in 
memory and in respect of what API it provides to its clients, irrespective of 
the input file format. We would need to know more about the particulars of your 
app in order to offer more meaningful advice in that regard.

> This might be a fun case for a dict or array wrapper class for my dict or 
> array plist reader thanks to your tips. 

My inclination is to suggest that's probably not a good approach, because it 
feels like you'd be reacting to a symptom of the data model design, rather than 
improving the design.

>> No, you have it backwards. That method is useful if you want to create a 
>> plist file out of an array, dictionary, etc. To do the opposite, use 
>> propertyListWithData:….
> 
> Huh? + (NSData *)dataWithPropertyList:(id)plist returns an NSData object.

Right. That's not what you need; you want to do the reverse.

> Isn’t the propertyListWithData the one that creates a property list out of 
> NSData?

Not in the typical meaning of the phrase. It's a poorly-named method. It 
returns a "property list object" (the important part being "object"), by which 
it means an object of a class which is suitable for representing a property 
list (such as an array, dictionary, etc.).

-ben

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How do you handle reading a plist if it may be an array or a dictionary?

2021-05-08 Thread Ben Kennedy via Cocoa-dev

> On 8 May 2021, at 5:32 pm, Alex Zavatone  wrote:
> 
> Well, what I’m not sure about are how to store the results internally.  Do I 
> declare both an NSArray and an NSDictionary and check to see which one ended 
> up getting the proper result?

Call -[propertyListWithData:options:format:error:], and examine what kind of 
object it returns. Process or store it accordingly.

> Is there a class of object that is a collection that is - either an array or 
> dictionary? Of course, that’s what a collection is, but I’ve never come 
> across needing to structure code to handle ether an array or a dictionary.

It sounds like you might need to rethink your data model a bit. I mean, you 
could hold the object in a variable of type `id` or `AnyObject` (ObjC or Swift, 
accordingly), but that will just create hassles for consumers. What format 
makes the most sense for the model? Transform the other one into it if needed.

> + (NSData *)dataWithPropertyList:(id)plist 
> 
> OK.  So once I get an NSData object, then I need to decode it and see if it’s 
> an array or dictionary, which ends up being the same problem I already have.

No, you have it backwards. That method is useful if you want to create a plist 
file out of an array, dictionary, etc. To do the opposite, use 
propertyListWithData:….

b

___

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: How do you handle reading a plist if it may be an array or a dictionary?

2021-05-08 Thread Ben Kennedy via Cocoa-dev
Sounds like NSPropertyListSerialization is what you’re after.

https://developer.apple.com/documentation/foundation/nspropertylistserialization

b

Sent from my iPhone

> On May 8, 2021, at 5:12 PM, Alex Zavatone via Cocoa-dev 
>  wrote:
> 
> I’m reading a configuration plist like so.
> 
> NSFileManager *fileManager = [NSFileManager defaultManager];
>BOOL success = [fileManager fileExistsAtPath:filePath];
> 
>if (success) {
> 
>_configurationDictionary = [[NSMutableDictionary 
> alloc]initWithDictionary:[NSDictionary 
> dictionaryWithContentsOfFile:filePath]];
> 
> 
> 
> 
> In some cases, I want the plist to be a dictionary.  In others, I want it to 
> be an array.
> 
> How would anyone recommend to make this a generic method to that could handle 
> if the contents of the plist was an array or a dictionary?
> 
> Thanks in advance.
> Alex Zavatone

___

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: /Library/Application Support off limits?

2021-04-14 Thread Ben Kennedy via Cocoa-dev


> On 14 Apr 2021, at 1:14 am, Davidap via Cocoa-dev  
> wrote:
> 
> Apple say:
> 
> [...] For example, if your app is named MyApp and has the bundle identifier 
> com.example.MyApp, you would put your app’s user-specific data files and 
> resources in the ~/Library/Application Support/com.example.MyApp/ directory. 
> Your app is responsible for creating this directory as needed.
> 
> Our app isn't sandboxed, but when I try to create a "/Library/Application 
> Support/NewFolder" folder in there I get the following message:
> 
> /*You don't have permission to save the file "NewFolder" in the folder 
> "Application Support."*/

You misread. The passage you quoted above indicates "~/Library/Application 
Support"; i.e. under the Library inside the user's home directory.

> I can't find anywhere else suitable to use for sharing files that need to be 
> read and written by different users - /Users/Shared doesn't seem right

Why not?

-ben

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Command line builds and tee(1) not writing file

2021-03-09 Thread Ben Kennedy via Cocoa-dev
> On 8 Mar 2021, at 3:36 pm, Jeffrey Walton via Cocoa-dev 
>  wrote:
> 
> Tee(1) is not writing the file for him, and I can confirm the
> behavior. Here's how it is being used:
> 
>./cryptest-ios.sh 2>&1 | tee cryptest-ios.txt

Hey Jeff,

I recall encountering a similar problem a few months ago while doing something 
along the same lines (albeit in Swift, reading/writing from file handles).

IIRC, I eventually figured out that it had something to do with buffering, in 
that stderr wasn't being flushed to the pipe until the writer was done (in 
contrast to stdout). Unfortunately I can't immediately remember the specifics 
or what I did to solve it.

Not sure if this is of any help, but maybe it triggers some ideas...?

-b

___

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: Programmatically created NSButton is drawn in the wrong position.

2020-12-14 Thread Ben Kennedy via Cocoa-dev


> On 14 Dec 2020, at 5:39 pm, Eyal Redler via Cocoa-dev 
>  wrote:
> 
> button = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0, 0, 0)];
> [button setTranslatesAutoresizingMaskIntoConstraints:NO];
> [button setBezelStyle:NSRoundedBezelStyle];
> [button setTitle:buttonTitle];
> [button sizeToFit];
> [button setFrameOrigin:NSMakePoint(position, 20)];

Since you're positioning the frames manually, you need to set 
setTranslatesAutoresizingMaskIntoConstraints = YES instead of NO.

-ben

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Bug reporting again.

2020-11-22 Thread Ben Kennedy via Cocoa-dev
By the way, some of what you said doesn't seem to quite make sense:

> The behaviour below is what is simply not happening.
> 
> If you
>  invoke this method with a nil nib name, then this class' -loadView 
> method will attempt to load a NIB whose
>  name is the same as your view controller's class.
> 
> The easyiest way to reproduce this is to simply create a ViewController with 
> an XIB and make it the initial view controller in a storyboard.  
> Add a label to the XIB to make it obvious when or if the XIB loads.  
> In the storyboard scene for that viewController, delete the top level view to 
> create the nil condition and run the app.

What do you mean "create the nil condition"? Deleting a view outlet is not 
tantamount to calling an init method with a nil string argument.

Besides, you've quoted docs for -[initWithNibName:bundle:]. But when a 
storyboard or nib is unarchived, -[initWithCoder:] is called instead.

-ben

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Bug reporting again.

2020-11-22 Thread Ben Kennedy via Cocoa-dev

> On 22 Nov 2020, at 12:45 pm, Alex Zavatone via Cocoa-dev 
>  wrote:
> 
> I’ve found a bug in Swift’s loadView for UIViewController on iOS that I’d 
> like to report.  Swift.org tells us to use https://bugreport.apple.com which 
> returns  “bugreport.apple.com’s server IP address could not be found.”.

Apple replaced Bug Reporter with Feedback Assistant months ago: 
https://developer.apple.com/bug-reporting/

The web site you're looking for is https://feedbackassistant.apple.com.

-ben

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Question about Info.plist's

2020-08-19 Thread Ben Kennedy via Cocoa-dev

> On 19 Aug 2020, at 7:45 pm, Michael Hall via Cocoa-dev 
>  wrote:
> 
> Something else I’m curious about is doesn’t this somehow invalidate any 
> application signing that’s been done?

Code signing happens last, even if you put your shell script phase at the very 
bottom. (Observe the build output in the Report Navigator.)

b

___

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: Question about Info.plist's

2020-08-19 Thread Ben Kennedy via Cocoa-dev

> On 19 Aug 2020, at 11:47 am, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> I tried this:
> 
>  plutil -replace CFBundleVersion -string '$(CURRENT_PROJECT_VERSION) 111' 
> qq.plist
> 
> which works -- but what I need to do is something like this:
> 
>  plutil -replace CFBundleVersion -string "\$(CURRENT_PROJECT_VERSION) 
> $build_number" qq.plist

You've changed the escaping and quoting between these two invocations, which 
surely accounts for the difference in behaviour. This should work:

> plutil -replace CFBundleVersion -string "$CURRENT_PROJECT_VERSION 
> $build_number" qq.plist

Bash (which I presume you're invoking the script with) interprets parentheses 
differently from the Xcode preprocessor; it runs the contained string as a 
command and substitutes the output. The build system exports all the build 
settings to the environment, so `CURRENT_PROJECT_VERSION` ends up being as much 
a shell variable as `build_number`.

All that said, by doing this you're going to end up with an ill-formatted 
CFBundleVersion. Per 
https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102364
 :

> The build version number should be a string comprised of three non-negative, 
> period-separated integers with the first integer being greater than zero—for 
> example, 3.1.2. The string should only contain numeric (0-9) and period (.) 
> characters. 

The space breaks this. If you need a compound identifier like this, put it in a 
custom key in the Info.plist.

-ben

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Question about Info.plist's

2020-08-19 Thread Ben Kennedy via Cocoa-dev


> On 19 Aug 2020, at 9:07 am, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> The plist file has, additionally to all the default stuff, the key 
> CFBuildNumber (with a value that I increment automatically).
> 
> In Xcode, I tried to change "Bundle version" to a value like
> 
>   $(CURRENT_PROJECT_VERSION)_$(CFBuildNumber)

As an aside, it strikes me as a dubious idea to call the latter 
"CFBuildNumber". That sounds like the name of a well-known CoreFoundation key, 
but as far as I can tell, it isn't one. (A Google search for "cfbuildnumber 
site:apple.com" yields only two results for me, one of which is a Tech Note 
that seems to contain errors [1]).

To avoid false inferences or potential confusion, if it were me I would use a 
completely different name for the key, such as "MyProjectBuildNumber" or 
whatever. (But why not just take advantage of the existing 
CFBundleShortVersionString and CFBundleVersion?)

-ben

[1] https://developer.apple.com/library/archive/technotes/tn2259/_index.html:  
Under the heading "What's Next", about a third of the way down, the text seems 
to confuse "CFBundleVersion" with what's actually CFBundleShortVersionString, 
and "CFBuildNumber" with what's actually CFBundleVersion. I've just filed a bug 
report on this: FB8464082.

___

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: Funny issue: one line in GUI is grey-ish

2020-08-09 Thread Ben Kennedy via Cocoa-dev

> On 9 Aug 2020, at 5:58 am, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> I have a simple app (status bar item) with a simple GUI.
> The funny thing is that one text line in the GUI is grey-ish,
> but NOT in the XIB in XCode ... and I can't determine why that is or how to 
> correct it.

Interesting. After downloading your project and playing around with a few 
things, and doing a bit of reading, I came to the conclusion that this effect 
seems related to how UIKit renders buttons when displayed in a popover.

NSPopover has a property `appearance`, whose docs say “If no appearance is 
specified, the popover’s effective appearance defaults to `vibrantLight`”. This 
got me wondering, what if we change this to something else? Indeed, if you add 
this line to your setup:

prefs_popover_.appearance = NSAppearance(named: .aqua)

the button text stays opaque like in a normal window (and, to my eye, 
everything else in the popover otherwise looks the same)!

cheers,

-ben

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Thoughts on Cocoa source code

2019-10-09 Thread Ben Kennedy via Cocoa-dev
> On 09 Oct 2019, at 1:19 pm, Turtle Creek Software via Cocoa-dev 
>  wrote:
> 
> In fact, why isn't Cocoa open source?  Apple open-sources Swift and the
> Darwin kernel. Surely the GUI can't be any riskier to expose to developers?

This is a business strategy question, not a Cocoa development question. 
Besides, nobody on this list will have an authoritative or succinct answer.

-ben

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: ARC

2019-08-23 Thread Ben Kennedy via Cocoa-dev
> On 23 Aug 2019, at 2:17 pm, Casey McDermott via Cocoa-dev 
>  wrote:
> 
> We allocate the controller in our app delegate class. It's a member but 
> apparently that is not a 
> strong enough reference, so the controller is released at the end of the 
> scope. What is best practice to hold a strong reference on it until the app 
> closes?

I suppose you haven't redeclared your ivars as "modern"-style properties (using 
`@property` syntax), huh?  I'd recommend taking the time to do so. This will 
make ownership obvious (via the  `strong`/`weak` keywords) and you'll get the 
appropriate retention by just assigning to the property. It'll also let you 
delete vast swaths of boilerplate accessor code (presuming your code base is of 
the vintage I'm guessing it is).

b

___

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: xCode troubles

2019-05-14 Thread Ben Kennedy
The phenomenon you're describing is a long-standing bug in Xcode that Apple 
does not seem interested in fixing.

I finally filed it last November as rdar://46203599. It was closed as a 
duplicate of rdar://9706748 (!). (That's actually rather alarming, because it's 
36.5 million numbers earlier; judging my library of old and still-open bugs, 
that would put it at mid-2011 or so...)

-ben


> On 14 May 2019, at 3:20 pm, Peter Hudson  wrote:
> 
> Hi Jens
> 
> Sorry my description was not clear. What happened is that the edit widget 
> panel would appear on the right hand side - but would have no tools in it. 
> When I selected an object in the storyboard ( e.g. a table view) none of the 
> appropriate editing tools would appear in any of the panels on the right. 
> Hence any editing of GUI was impossible. 
> 
> Richard Charles’s response earlier in the day has however fixed it. He 
> suggested removing a couple of files in the project bundle. 
> 
> Many thanks
> 
> Peter 
> 
> 
> 
> 
>> On 14 May 2019, at 23:05, Jens Alfke  wrote:
>> 
>> 
>> 
>>> On May 14, 2019, at 3:39 AM, Peter Hudson  wrote:
>>> 
>>> xCode has just decided ( for the 20th time this week ) that I don’t deserve 
>>> any UI tools in Interface Builder - as in the panel on the right hand side 
>>> of the main window.  I have tried everything I can think of to try to get 
>>> them back - like restarting xCode, opening different files etc.
>> 
>> You mean that clicking the Show Inspectors button on the right end of the 
>> toolbar didn’t work, nor did Cmd-Opt-zero?
>> 
>> —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/ben%40zygoat.ca
> 
> This email sent to b...@zygoat.ca

___

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: Category errata in Objective-C

2019-03-29 Thread Ben Kennedy
> On 29 Mar 2019, at 2:51 pm, Alex Zavatone  wrote:
> 
> In all the docs on categories, I seem to have missed what the term for the 
> text within the parens of a category declaration is called and what function 
> it serves.

It's the category name. NSObject(Foo) represents "the Foo category on NSObject".

As for what function it serves, well, that's a good question. I've never been 
aware of a runtime method for extracting such information or testing its 
presence (as one can for protocol conformation, for example).

> Also, I seem to remember the esteemed Jens stating that as soon as a category 
> class is in your project, it applies to all objects instantiated from the 
> base class

Categories are like a benevolent disease: once linked and loaded, they live 
everywhere.

> and we only had to do an import if we wanted to use the category methods in 
> the debugger.  Please correct me if I am wrong here.
> 
> But I found out that that is not true.  You have to import the category 
> header into any classes where you want to take advantage of the category 
> methods you added to a specific class.

These amount to the same thing, which is exposing the symbol names to your 
interpreter or compiler for your convenient use as a programmer.

-ben

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSAlert

2018-09-10 Thread Ben Kennedy
> On 10 Sep 2018, at 11:06 am, Richard Charles  wrote:
> 
> On my development machine running 10.12.6 pressing the spacebar will dismiss 
> a simple NSAlert. This is because in System Preferences > Keyboard > 
> Shortcuts > Full Keyboard Access > All Controls was selected. (For some 
> reason it took forever to discover this.)
> 
> When "All Controls" is selected the control with focus will have a focus ring 
> drawn around it and pressing the spacebar will "click" the control with 
> focus. Also pressing the tab key will move the keyboard focus between 
> controls.
> 
> Setting a control key equivalent to the return key will make it the default 
> control and it will be blue. The default control can be "clicked" by pressing 
> the return key.

Son of a gun. Thanks for elucidating this Richard.

I guess I've had full keyboard access turned on for some time. Quite awhile ago 
I noticed these focus rings start showing up in alert panels, but it never 
occurred to me to press the space bar.

I had actually been intending to file a bug report decrying the ambiguity 
between the focus ring and the blue backfill insofar as which control gets 
acted upon. (I didn't realize that these signify two different activation 
methods.)

-b

___

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: Can I generate a segue this way?

2018-06-06 Thread Ben Kennedy
On Jun 6, 2018, at 11:14 PM, Rick Aurbach  wrote:

> Working with a storyboard, I add a Tap Gesture Recognizer, connect it to the 
> label, and connect the segue to the gesture recognizer. I think I've set 
> everything up correctly, but tapping on the label does not trigger the segue.

You might need to verify that “user interaction” is enabled for the label 
(which, if I recall correctly, it is not by default).

b

(Hitting both lists huh? :))


___

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: Best strategy to update view controllers in navigation stack after users edit data

2018-04-20 Thread Ben Kennedy
> On Apr 20, 2018, at 1:15 AM, Glen Huang  wrote:
> 
> I have an app where user can edit data and save to my server. I wonder what’s 
> the best way to update affected view controllers in the navigation stack?

If I were to give a literal answer to your question, I'd suggest a callback 
method (either as a closure property on the child VC or a classic delegation) 
by which the parent VC can be notified by the child of relevant change.

However, it sounds like you might be well off to re-frame your question more 
generally as "what's the best way to keep my views in sync with my data model". 
The case you described (a detail VC on a nav stack) is merely one such 
manifestation.

> 1. Load all data (the list of recipes comes with full details) into Core 
> Data. Basically I create a local replica of my server data and use a 
> NSFetchedResultsController to fetch all ingredients sectioned by recipes. And 
> then show the array count in each section for each cell.

That sounds like a reasonable approach. You need to model your data locally 
somehow; Core Data provides a somewhat decent way to do it.

I'm also fond of Couchbase Lite. Especially if you are dealing in various 
unstructured data, it might be well suited. It provides change-listener 
callbacks in similar way. The server-side setup would no doubt be an 
undertaking compared to what you currently have though.

> 2. Server returns tailored data for each view controller. For example, for 
> the recipe list view controller, the server returns a list of recipe 
> containing only names and ingredients counts. For the recipe detail view 
> controller, the server returns details just for the corresponding recipe, and 
> in the ingredient view controller, the server returns a list of ingredients 
> just for that recipe, basically every view controller needs to make a request 
> to my server to get its data.

That does not sounds like a good idea. In essence you then have no local data 
persistence, and the remote server works like a database over a very slow link. 
The app would never work offline, and any trivial architectural changes in the 
client would need to be also made on the server.

b

___

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: NSString equivalent of CFSTR macro?

2017-12-04 Thread Ben Kennedy
On Dec 4, 2017, at 2:53 PM, Rick Mann  wrote:

> I tried that. It doesn't work.
> 
> MCP.m:262:54: Unexpected '@' in program

Weird. I just tried it here, using your exact example, and it worked fine under 
Xcode 9.2. (I slapped it into my iOS app's 
application:didFinishLaunchingWithOptions: as a quick and dirty test.)

#define NSSTR(s)(@ s)
#define kSomeCStringConstant"foo"
NSLog(@"foo is %@", NSSTR(kSomeCStringConstant));

Do you have some unusual circumstances in your build environment?

b

___

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: NSString equivalent of CFSTR macro?

2017-12-04 Thread Ben Kennedy
> On Dec 4, 2017, at 2:47 PM, Rick Mann  wrote:
> 
> #define NSSTR(s)  (@ ## s) <-- magic; this 
> doesn't work
> #define kSomeCStringConstant  "foo"
> ...
> NSSTR(kSomeCStringConstant)

You're close. The preprocessor is removing the quotation marks, breaking the 
syntax. You don't need to token paste; simply remove the '##' from the NSSTR() 
def.

#define NSSTR(s) (@ s)

-b

___

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: High Sierra Firmware Update

2017-09-26 Thread Ben Kennedy

> On Sep 26, 2017, at 7:25 AM, Richard Charles  wrote:
> 
> Question: Has anyone successfully upgraded the firmware an older Mac Pro when 
> installing High Sierra?

I upgraded my MacPro5,1 without incident. However, the subsequent installation 
progress just hung the computer when the progress bar was about 9/10 of the way 
through. (I left it on overnight and nothing else happened.) Hard rebooting it 
worked successfully. Maybe this was related to its conversion of my SSD to 
APFS? Who knows.

Anyway, this isn't Cocoa-related, so we probably shouldn't be discussing it on 
this list.

b

___

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: strange behaviour of hasPrefix

2017-05-03 Thread Ben Kennedy

> On 03 May 2017, at 8:25 am, Gerriet M. Denkmann <gerri...@icloud.com> wrote:
> 
> NSString *test2 = [ @"/some/path" stringByAppendingPathComponent: pintu 
> ].lastPathComponent;  
> [ self printTestString: test2 ];  
> //  prints:   length 2 0x2d 0xe3a “-ฺ” BAD: has no prefix "-" NSPathStore2 ← 
> NSString

> Why has test2 no prefix?

If I'm reading your code right, I would imagine this is because test2 obviously 
begins with a slash ("/some/path/...") and not "-".

-[NSString hasPrefix:] :

> Returns a Boolean value that indicates whether a given string matches the 
> beginning characters of the receiver.

-ben

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: needsDisplay and subviews

2017-03-08 Thread Ben Kennedy

> On 08 Mar 2017, at 8:46 am, Jeremy Hughes  wrote:
> 
> If needsDisplay is set to true for an NSView, does that also cause subviews 
> to be redrawn?

Admittedly I've been mostly doing iOS development for the last several years 
and barely any Mac lately, but, according to the current docs:

needsDisplay: "The displayIfNeeded methods check the value of this property to 
avoid unnecessary drawing, and all display methods set the value back to false 
when the view is up to date."

display(): "Displays the view and all its subviews if possible, invoking each 
of the NSView methods lockFocus(), draw(_:), and unlockFocus() as necessary."

Thus, it seems to follow that so long a custom view's display() calls super, 
then all of its subviews should also be drawn when its needsDisplay is true.

What sort of contradictions are out there?

b


___

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: UTI and/or bundle-IDs with small letters

2017-03-02 Thread Ben Kennedy

> On 02 Mar 2017, at 11:38 am, Daryle Walker  wrote:
> 
> Turns out that the system gives me the UTI in all small letters, so my 
> (Swift) “switch” fails and my no-matching-type code is executed. I know I 
> could switch my bundle ID to all small letters, but I want to know first if 
> this is documented? Or is the small-letters transformation a bug?

I'm surprised that I can't find any Apple documentation that discusses 
case-sensitivity with respect to UTIs. Surely the answer is prescribed 
somewhere, and the omission from the dev guides is an oversight.

In any case, I found this thread from a couple of years ago: 
https://lists.apple.com/archives/cocoa-dev/2015/Apr/msg00214.html

Therein, Sean McBride and Ken Thomases suggest using either UTTypeConformsTo() 
or -[NSWorkspace type:conformsToType:] to test a UTI, rather than a string 
comparison.

b


___

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: Seeing nil passed to isEqual:, despite non-null declaration

2017-01-13 Thread Ben Kennedy

> On 13 Jan 2017, at 10:34 am, Quincey Morris 
>  wrote:
> 
> Did I miss a change in clang that made the default “not nullable”?? I read 
> the above declaration as meaning that the nullability is *unspecified*, which 
> implies that nil is allowed.

NSObject.h (from which Sean was quoting) begins with NS_ASSUME_NONNULL_BEGIN 
which, to my understanding, makes everything in the file be non-nullable unless 
otherwise annotated.

b


___

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 setFormatter() retain?

2016-08-24 Thread Ben Kennedy

> On 24 Aug 2016, at 1:24 pm, Andreas Falkenhahn <andr...@falkenhahn.com> wrote:
> 
> If it retains, I could just do the following:
> 
>[textField setFormatter:formatter];
>[formatter release];
> 
> And I wouldn't have to worry about "formatter" any longer. If it doesn't 
> retain,
> the above isn't possible. 

What actually happens inside -setFormatter: is not your concern. Maybe it 
retains the formatter; maybe it just copies some salient details out of it and 
lets it go. It makes no difference to you, the caller.

If you have no further use for the formatter, release it.

> Another example: "addSubview" retains, so I can just do:
> 
>[[win contentView] addSubview:button];
>[button release];
> 
> And I'm done with "button." That's much more convenient than having to
> keep "button" for much longer...

It certainly is. So release it. (The contentView has actually retained the 
button.)

> I still think I should know this so that I know when I should say
> "release" (see above)

You release when you, personally, are done with your object reference.

> So are you saying that the standard for setXXX methods is retain?
> And if a setXXX method doesn't retain, then it's explicitly mentioned
> in the doc?

Not necessarily, no! Maybe, for example, it copies? But it's an implementation 
detail.

If you want to make further reference to an object, you need to retain it in 
order to guarantee its lifecycle. Else, you can trust the API you're calling to 
retain things as it sees fit (unless some documentation advises you otherwise).

There is probably some Apple documentation that expresses the related concerns 
more clearly (or no doubt someone else on the list can be more eloquent). Here 
are a couple, although I recognize they speak more in terms of strong/weak 
references rather than philosophies related to scope of concern and manual 
reference-counting as you're concerned with targeting 10.6:

https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/EncapsulatingData/EncapsulatingData.html#//apple_ref/doc/uid/TP40011210-CH5-SW3

https://developer.apple.com/library/mac/documentation/General/Conceptual/DevPedia-CocoaCore/ObjectOwnership.html#//apple_ref/doc/uid/TP40008195-CH67-SW1

-ben



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Does setFormatter() retain?

2016-08-24 Thread Ben Kennedy

> On 24 Aug 2016, at 1:04 pm, Andreas Falkenhahn <andr...@falkenhahn.com> wrote:
> 
> I have read Apple's memory management guide on retain/release and
> I think I've basically got it, but there's just one thing that
> I'm not confident about and that is "setXXX" methods which accept an
> NSObject parameter and I don't know how I can know whether the
> "setXXX" retains or not.

Why do you think you need to know? That's the concern of the API you're 
calling. If it needs to retain the object you're passing it, then it will. If 
it doesn't, it won't.

The legacy delegate stuff that you cited calls out the fact that they don't 
because it is contrary to normal expectations, and thus requires explicit 
concern by the caller.

-ben


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Thoughts on autolayout

2016-04-21 Thread Ben Kennedy

> On 21 Apr 2016, at 10:47 am, Ben Kennedy <b...@zygoat.ca> wrote:
> 
> One is then left to hunt around in the damn list on the right in order to 
> find it and then delete it *again* from there in order to actually eviscerate 
> it.

Oops; I meant the list on the left (the hierarchal inspector of the 
nib/storyboard's contents).

Equally comical is that pressing the real "delete" key doesn't do anything at 
all (let alone disable the constraint).

b


___

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: Thoughts on autolayout

2016-04-21 Thread Ben Kennedy

> On 21 Apr 2016, at 12:12 am, Quincey Morris 
>  wrote:

> 1. Part of the problem is branding. “Autolayout” actually refers to the 
> runtime layout engine, and what happens automatically is the runtime 
> relocation of UI elements according to constraints.

Yeah, the more descriptive term is “constraint-based layout”. Apple seems to 
use both. From the perspective of the developer, the latter makes more sense.

> 4. The biggest single autolayout-related design flaw in IB is its pathetic 
> deathgrip on the concept of WYSIWYG editing by dragging UI elements around.

It's interesting you say this; when preparing a constraint-based layout, that 
type of workflow has rarely ever occurred to me. I usually visualize what I 
want to achieve, then create constraints as necessary (typically by selecting a 
view, then clicking one of those little pop-up menu things in the lower right 
to spawn the popover). As such I'm not sure I appreciate the "death grip" 
you're alluding to.

> I think I’d much rather have a scheme where you can’t drag or resize UI 
> elements at all, but you would essentially drag on the constraints (or on 
> attributes that uniquely represent constraints that can be consistently 
> altered by dragging) instead.

Not a bad idea; locking the views themselves in place against direct (and 
functionally fruitless) dragging might help combat some of the feeling that the 
UI is drenched in too much lubricant.

> 5. The second-biggest autolayout-related design flaw is the idea that IB 
> provides invisible default constraints for any object that doesn’t have any 
> explicit constraints. This is a consequence of the drag-it-till-it-hurts 
> problem (#4),

I think this is actually a consequence of 
translatesAutoresizingMaskIntoConstraints being set to YES in the absence of 
any constraints; as such, the view gets explicit canvas-based positioning. At 
least, this appears to be the case a lot of the time. I would argue this is a 
UI problem in IB where it tries to smooth over the transition between 
autoresizing- and constraint-based layout without properly informing the user.

> 6. The third-biggest problem is that there are two separate inspector-based 
> editing interfaces for constraints, and they’re on different tabs of the 
> Utilities panel. If you select a UI element, you need the Size tab, but if 
> you select a constraint, you need the Attributes tab. On top of that is the 
> problem, generally, that the Size and Attributes each contain settings that 
> are intimately related to the other. These two tabs desperately need to be 
> merged (back) into a single tab.

This is frustrating as hell, and I couldn't agree more.

What's equally infuriating is that it seems damn near impossible to delete a 
constraint from those tabs. Pressing backspace (or "delete" as Apple's 
keyboards call it) merely *disables* the constraint. One is then left to hunt 
around in the damn list on the right in order to find it and then delete it 
*again* from there in order to actually eviscerate it.

b


___

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 way to set up constants when building an iOS framework

2016-04-19 Thread Ben Kennedy

> On 19 Apr 2016, at 11:41 am, Quincey Morris 
>  wrote:
> 
> The (built) precompiled header files does *not* have extension “.pch”,

While a trivial detail, this does not seem to be true (at least in Xcode 7.2). 
We have a prefix header called "Kashoo_Prefix.pch", and if I hit cmd-shift-O 
and type that string, I get a pile of results: first the source prefix file, 
then about a dozen other non-text files named "Kashoo_Prefix.pch.pch" that 
exist within various subdirectories of the build folder.

b


___

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: Triggering UITableView's -didSelectRowAtIndexPath: delegate callback

2016-02-27 Thread Ben Kennedy

> On 27 Feb 2016, at 11:17 am, Carl Hoefs <newsli...@autonomy.caltech.edu> 
> wrote:
> 
> Yes, that works, thanks! I just thought there might be a "preferred" way to 
> do it. I guess I was hoping for something like:
> 
> [myTableView selectRowAtIndexPath:indexPath 
> animated:YES 
>   scrollPosition:UITableViewScrollPositionMiddle
> triggersDelegateCallback:YES];

What gain would that afford you, though?

I believe that the table view API is designed this way to afford the programmer 
control and flexibility. Perhaps your didSelectRow:... implementation calls 
some private method to do the business logic, say -[self fireTheRockets]. In 
that case, you could simply call fireTheRockets directly here instead.

By contrast, the delegate API provides your code a means to act on external 
events (user input) brokered by the table view. Perhaps in such a case there is 
additional UI-related work not suitable for inclusion in fireTheRockets.

This decoupling enables you to separate these concerns.

-ben


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Triggering UITableView's -didSelectRowAtIndexPath: delegate callback

2016-02-27 Thread Ben Kennedy

> On Feb 27, 2016, at 11:01 AM, Carl Hoefs  
> wrote:
> 
> The problem is that the delegate callback associated with selecting that row 
> doesn't occur. And indeed, I have since found that the documentation for this 
> method says:
> 
> "Calling this method does not cause the delegate to receive a 
> tableView:didSelectRowAtIndexPath: message."
> 
> Is there a method to call (or some other way) that will do this?

Why not just call that method yourself?

b



___

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: PSA: Does your app use Sparkle? Update it, or use an HTTPS server

2016-02-10 Thread Ben Kennedy
If you actually took a look at the details, you'd see that the cert is for 
"ssl13.ovh.net" rather than "xenonium.com".  If you visit https://ssl13.ovh.net 
in Safari you will see no such problem.

Jean-Daniel did not expressly state that he's trying to serve anything at 
https://xenonium.com.

-b

> On 10 Feb 2016, at 4:35 pm, Gary L. Wade  wrote:
> 
> I just checked to see what happens when visiting your web site at 
> https://xenonium.com and found on the current latest release of iOS and OS X 
> under Safari I get a "Cannot Verify Server Identity" alert, so maybe you set 
> it up wrong, support for that authority is forthcoming, or you get what you 
> pay for. Some users will say, "Whoa!" and run away fast.


___

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: PSA: Does your app use Sparkle? Update it, or use an HTTPS server

2016-02-10 Thread Ben Kennedy
> On 10 Feb 2016, at 5:00 pm, Gary L. Wade  wrote:
> 
> You've made my point. None of my friends would even bother with looking at 
> the certificate for his site (assuming that's his site from his email 
> address) and move on. At worst, they'd call me and I'd say don't go there 
> since I don't want them to screenshot that and text it to me to figure it out.

No, you are misunderstanding me.  My point is that it may not be valid to 
assume the web server at 213.186.33.24 (to which xenonium.com resolves) will 
answer to HTTPS with a cert for "xenonium.com".

For example, https://213.186.33.24 presents the same "hostname mismatch" alert, 
because the cert is not named for "213.186.33.24".

Conduct the same exercise for any A record returned for www.apple.com, and 
you'll also get this result.  Completely expected.

Now, if Jean-Daniel has stated definitively that https://xenonium.com is 
expected to serve up a matching certificate, you have an argument I would agree 
with.  But for all we know (unless I've missed it), he's serving his material 
at https://ssl13.ovh.net.

b


___

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: App Transport Security exceptions App Store signed app

2016-01-26 Thread Ben Kennedy
On 26 Jan 2016, at 9:55 pm, Trygve Inda <cocoa...@xericdesign.com> wrote:

> connection failed: (null) The resource could not be loaded because the App
> Transport Security policy requires the use of a secure connection.
> http://www.earthdeskcloudhost02.com/mosaic/free/clouds-2048.jpg

I'm no App Transport Security expert, but taking what you described at face 
value, that seems to make sense. You tried to load a resource from 
www.earthdeskcloudhost02.com, which is a subdomain of earthdeskcloudhost02.com, 
yet the Info.plist entries you described seemed to lack a NSIncludesSubdomains 
key for the latter domain.

I imagine that if you either drop the 'www.' or add the NSIncludesSubdomains it 
might work...?

-ben


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Settings.bundle settings disappear while running

2016-01-12 Thread Ben Kennedy
Hey Eric,

I've seen a problem with recent versions of the toolchain where the Settings 
app fails to display entries for the app's Settings.bundle (the section appears 
blank) after deploying new builds.  At first I thought something was borked 
with our app, but I eventually realized that force-quitting the Settings.app 
and relaunching it causes the stuff to show up again.  This seemed only to be a 
problem during development.

Is that what you're talking about?

cheers,

-ben

> On 21 Dec 2015, at 12:52 pm, Eric E. Dolecki <edole...@gmail.com> wrote:
> 
> Working on an application with some App settings in the Settings.bundle.
> They do not appear when running the application in debug - but if I quite
> the app and launch the app settings from Settings.app they display.
> 
> Is there a trick to get them to be avalable while running the application?
> There is a NSUserDefaultsDidChangeNotification that I thought I would
> observe in changes in the app settings, but I can’t if they don’t display.
> 
> Thanks,
> Eric
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/ben%40zygoat.ca
> 
> This email sent to b...@zygoat.ca


___

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: Bunch of CoreData based NSDocument questions.

2015-11-29 Thread Ben Kennedy
> On 29 Nov 2015, at 3:00 pm, Shane Stanley <sstan...@myriad-com.com.au> wrote:
> 
> On 30 Nov 2015, at 9:41 AM, Ben Kennedy <b...@zygoat.ca> wrote:
>> 
>> Re-launch Preview, and observe that there is no way to undo this damage. As 
>> far as I can tell, one is forced to dig in to the Time Machine BS in order 
>> to resurrect the file.
> 
> System Preferences -> General, check "Ask to keep changes when closing 
> documents".

Either I was not aware of or had forgotten about that setting, but regardless, 
it's already turned on. (The other one beside it, “close windows when quitting 
an app”, is off -- I'm not sure if that adds more subtleties to this 
confounding behaviour.)

b


___

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: Bunch of CoreData based NSDocument questions.

2015-11-29 Thread Ben Kennedy

> On 28 Nov 2015, at 5:20 pm, Quincey Morris 
>  wrote:
> 
> 1. Quit. This is intended to preserve all of the current state so that it can 
> be restored on relaunch. The idea is that the user can quit without changing 
> anything that’s going on, then re-launch and be exactly where he was. [...]
> 
> 2. Save. This is a user-initiated action that causes the on-disk document 
> state to be updated, and you can no longer go back to the pre-save state 
> (except via Versions, but that’s a different matter). Note that when 
> autosavesInPlace==YES, an autosave is most definitely NOT a save from the UI 
> point of view. It’s more like a forced write of memory to a swap file.

This doesn't seem to square with the behaviour of, e.g., Preview.app. I hate 
this app (and the auto-save architecture in general) because it gleefully 
allows me to damage my own files without realizing it.

More specifically: open an image in Preview; crop it arbitrarily; then quit.  
Go look at the source file on disk -- it has been irreparably damaged: the crop 
was immediately saved!

Re-launch Preview, and observe that there is no way to undo this damage. As far 
as I can tell, one is forced to dig in to the Time Machine BS in order to 
resurrect the file.

This seems inconsistent with your description above: not only does Quit imply a 
Save, but there is no way to recover from it undo-wise, either.

The new-style document architecture was, and is, one of the worst UX 
regressions in the history of Mac OS.  I'm glad that most of the third-party 
apps I use have chosen to eschew it.

b


___

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: Bunch of CoreData based NSDocument questions.

2015-11-29 Thread Ben Kennedy

> On 29 Nov 2015, at 3:15 pm, Shane Stanley  wrote:
> 
> Then your claim that "there is no way to undo this damage" is incorrect. Open 
> an image in Preview, crop it, and quit. Open it again and you'll see the 
> document is marked dirty/Edited, and you can get back to the original either 
> by clicking the close button and Revert Changes, or choosing File -> Revert 
> Changes...

Son of a gun, you're right! I might never have discovered this were it not for 
your recipe. How ridiculous...!

(Are you suggesting this is sensible or intuitive?! Is this what the average 
user expects? Unbelievable.)

Of course, these steps only appear to work if I haven't already moved or 
renamed the file prior to discovering the damage. It seems that once I have, 
I'm screwed.

The app has no business overwriting my original file without either a) my 
explicitly hitting save, or b) prompting me to allow a save.

b


___

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: Bunch of CoreData based NSDocument questions.

2015-11-29 Thread Ben Kennedy

> On 29 Nov 2015, at 3:34 pm, Shane Stanley  wrote:
> 
>> Is this what the average user expects? 
> 
> I don't know -- I don't think many of us here really count as average users.

That's why I asked the question. If I, as a 20-year Mac power user find this 
baffling, I can only imagine that an average user would find it no more 
coherent.

> You might try clicking the "Close windows when quitting an app" checkbox, too.

Thanks; now turned on. This at least seems to provide the app an earlier 
opportunity to allude to the damage it has performed -- although it does not 
mitigate the actual insidious destruction which I want to believe, as Quincey 
postulated, is only a bug rather than deliberate design).

b


___

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: Strange Message when Loading NIB

2015-10-23 Thread Ben Kennedy

> On 23 Oct 2015, at 4:38 am, Dave  wrote:
> 
> Please see methods below, these are in a Window Controller, I get the message 
>  "Could not find image named ‘Outlook’.” in the log, but I have no clue why 
> this is being generated it what it means, it appears to be coming from the 
> NIB Loading methods.

Did you verify that in your nib (or storyboard or whatever) there is no image 
called “Outlook” configured for anything?

b


___

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: Drawing many different strings quickly

2015-10-01 Thread Ben

> On 28 Sep 2015, at 18:42, Alex Kac <a...@fanaticsoftware.com> wrote:
> 
> We had the same question and I asked it at WWDC.  A few things I was told:
> 
> 1. El Capitan improves string drawing performance tremendously. That may 
> solve your problem.
> 2. They recommended in our case actually using NSTextFields for each string. 
> They showed me an app that had thousands of NSTextFIelds in a resizable 
> window and it was buttery smooth. Smoother than the same code using NSString 
> drawing functions in the exact same scenario. 
> 
> Now 100,000 strings may change the equation a bit…but might be worth a quick 
> try.
> 
> Alex Kac - El capitán


Just for a final follow-up now El Capitan is public.

0. I really am not trying to draw the whole view at once. It's just that you 
can scroll the whole grid vertically or horizontally in a single flick on a 
trackpad in about a second.

1. I should have mentioned that I am writing in Swift. I've become so 
accustomed to it that it's easy to forget it still has some slower bits.
Using NSString's drawInRect:withAttributes: wants a Swift dictionary of 
attributes. Instruments showed a lot of time spend accessing the elements of 
this dictionary and converting back to Objective-C land.
Converting the string to be drawn to an NSAttributedString and adding 
attributes to it directly before drawing with drawInRect: resulted in string 
drawing dropping from ~65% of drawRect time to ~50%.

2. Upgraded to 10.11 overnight last night and ran the same profile again. 
drawRect now spends around 35% of time drawing strings. The calls underneath 
drawInRect look vastly different. Thank you to whoever put this work in at 
Apple.

Drawing speed of the control is now fine and scrolling is smooth. I will have a 
small play with drawing options in case there more headroom that can be quickly 
gained, but am currently very happy.

Thank you all for the assistance.

- Ben
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Drawing many different strings quickly

2015-09-28 Thread Ben

> On 28 Sep 2015, at 17:08, Jens Alfke <j...@mooseyard.com> wrote:
> 
> 
>> On Sep 28, 2015, at 1:41 AM, Ben <ben_cocoa_dev_l...@yahoo.co.uk 
>> <mailto:ben_cocoa_dev_l...@yahoo.co.uk>> wrote:
>> 
>> When scrolling vertically, there could be up to 100,000 strings to be drawn, 
>> horizontally, much fewer, less than 10,000. I'm assuming a maximum grid size 
>> of 100 columns and 10k rows. This should be a worst-case assumption.
> 
> As various people have said, there is no reason to draw any text that’s 
> outside the dirtyRect passed to your -drawRect: call. So you never need to 
> draw 100k strings at once. I’m confused by your statements in this thread — 
> you do say that you abide by the dirtyRect, so why are you drawing so many 
> strings?
> 
>> Unfortunately NSTableView doesn't offer the type of interactions I want. I 
>> have filed a radar requesting enhancements.
> 
> It’s very customizable. What’s missing for you?

I am sorry for the poor explanations. I hope this clears up my phrasing:

I am only drawing the area requested by the dirtyRect parameter.
I mention the large number of strings since when scrolling I am being asked to 
draw a larger number of dirtyRect blocks in quick succession. This means a 
correspondingly larger number of strings to be drawn.

True, they are not all in the same drawRect call, but in sufficiently close 
proximity that I thought speeding up the largest consumer of cpu time (ie. 
string drawing) would help the improve the scroll lag.


The biggest thing missing for me in NSTableView is single-cell selection and 
highlighting. There was also a drawing bug which I filed a radar for. 


—

Thank you all for the suggestions though, I will try each of them.

___

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: Drawing many different strings quickly

2015-09-28 Thread Ben

> On 27 Sep 2015, at 19:26, Quincey Morris 
> <quinceymor...@rivergatesoftware.com> wrote:
> 
> On Sep 27, 2015, at 10:42 , Ben <ben_cocoa_dev_l...@yahoo.co.uk 
> <mailto:ben_cocoa_dev_l...@yahoo.co.uk>> wrote:
>> 
>> - Not all strings to be drawn at once, a scroll view is being used and I am 
>> using responsive scrolling to pre-draw areas. The problem occurs when 
>> quickly scrolling a large distance
> 
> I think your answer is in this statement. Assuming you’re drawing the strings 
> in drawRect of a custom view, and the size and position of the grid cell 
> containing each string doesn’t depend on the metrics of any other string, 
> then the cost of this kind of interface is the number of strings you can 
> *see* at once (less than 50 surely), not the number of strings in your data 
> model. Responsive scrolling may make the smaller number a bit larger, but if 
> you’re getting performance problems from this, you’re likely doing something 
> wrong.
> 
> But …
> 
>> The problem occurs when quickly scrolling a large distance
> 
> There it is, really. What I said before applies only when the scrolled view 
> isn’t scrolling. When it is, you can *see* many more strings at essentially 
> the same time.
> 
> What’s the answer to this question: If you quickly scroll across 10,000 
> strings, how many strings is your drawRect drawing? 10,000? Less? More? You 
> need to do some analysis to find out what you’re actually doing.
> 
> Are you using the dirtyRect parameter of drawRect to limit which strings you 
> draw? Are you using ‘getRectsBeingDrawn:count:’ or ‘needsToDrawRect:’ to 
> limit drawing even further? Have you tried using a table view?
> 
> Ultimately, if your drawing technique can’t keep up with fast scrolling, 
> you’re going to have to *stop* drawing when it starts to lag, and catch up 
> when scrolling slows or stops.
> 
> P.S. You didn’t say whether this is OS X or iOS. I think responsive scrolling 
> is OS X only, so I’m guessing that’s the platform.

Thank you for the quick response. This question is regarding OS X.

As you mention, drawing a static visible area is absolutely fine. The system 
requests me to draw a certain amount of extra area ready for scrolling and I 
mark that as prepared. This area then isn't asked to be drawn when scrolling 
begins.

The control is only drawing the areas requested by the dirtyRect parameter. 
Typically this is an area of (I think - going by memory) 256px square at a 
time. When looking at the result of getRectsBeingDrawn, there is only one rect 
the same as the dirtyrect.

When scrolling vertically, there could be up to 100,000 strings to be drawn, 
horizontally, much fewer, less than 10,000. I'm assuming a maximum grid size of 
100 columns and 10k rows. This should be a worst-case assumption.

I hadn't considered skipping some draw calls. I could perhaps just draw row 
backgrounds and add text when the lag ends.

Unfortunately NSTableView doesn't offer the type of interactions I want. I have 
filed a radar requesting enhancements.

Thanks again,

Ben



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Drawing many different strings quickly

2015-09-27 Thread Ben
Hi list,

I'm needing to draw somewhere in the order of 1,000,000 different strings in a 
scrollable grid view and am struggling to get performance that I am happy with.

After profiling, most of my time is spent in drawing text into the view.

My first attempt was simply to use NSString's drawInRect:withAttributes:. The 
attributes dictionary was cached between calls. This is not too bad for shorter 
strings, but slows down dramatically once longer strings need to be drawn 
truncated.

My second attempt has been to use my own NSTextStorage/Container/LayoutManager 
trio and draw using NSLayoutManager. This is faster when many strings are the 
same, but worse when most are different. I don't know in advance what the 
strings will be so must assume they are all unique.


Can anyone suggest what I should look into next? My requirements are as follows:

- Assume around a million unique strings to be drawn
- Not all strings to be drawn at once, a scroll view is being used and I am 
using responsive scrolling to pre-draw areas. The problem occurs when quickly 
scrolling a large distance
- Longer strings will be truncated to a single line under 200px wide
- All strings to be drawn in the same font/size/colour
- I can target the current (or current+1) OS version if that makes any 
difference


Any pointers or suggestions gratefully accepted!

- Ben
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Problem with Auto Layout and drawRect

2015-09-08 Thread Ben Kennedy

> On 07 Sep 2015, at 5:02 pm, Graham Cox  wrote:
> 
> Also, NSColor is immutable so there’s little purpose to having that property 
> ‘copy’, it can be ‘retain’ (or ‘strong’) and it will save you a small amount 
> of space per instance.

As Dave said in his reply, isn't this actually poor advice? It obscures the 
semantic intent of the property, and likely makes no measurable difference 
anyhow (presuming that the immutable class implements copy as retain).

b


___

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: iOS 8.4: Converting a URL into a PHAsset

2015-07-29 Thread Ben Kennedy
On 29 Jul 2015, at 8:47 am, Carl Hoefs newsli...@autonomy.caltech.edu wrote:

 Ultimately, I'm simply trying to delete the asset:
  [PHAssetChangeRequest deleteAssets:@[asset]];

But you don't yet HAVE an asset; you seem to only have a regular file on disk, 
in an application's Documents directory.  Do you want to do more than simply 
delete the file?  If not, what compels you to turn it into a PHAsset first?

 You're right, of course, that I've overlooked the fine print: it wants an 
 array of “asset URLs previously retrieved from an ALAsset object.” I'm not 
 quite certain what that means, exactly.

No doubt something you would retrieve by -[asset valueForProperty: 
ALAssetPropertyURLs] (if you had an ALAsset * called asset.)  But I imagine 
that's a red herring here.

 I'm able to delete the asset by using:
  [[NSFileManager defaultManager] removeItemAtURL: self.sourcePlayListItem.url 
 error:error];
 but I think the new 'photo asset' way is preferred in iOS8+, so I thought I'd 
 try to be compliant.

What inspires that statement?

If you have a PHAsset representing something in a PHAssetLibrary, then sure, 
you would use such an approach to delete the asset.  But what you've shown us 
so far seems to imply that you just have a plain old .MOV file, perhaps created 
by the user, sitting in the app's sandbox.

In your original example, where does self.sourcePlayListItem.url come from?  
What does the URL represent?

b


___

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: iOS 8.4: Converting a URL into a PHAsset

2015-07-29 Thread Ben Kennedy
On 28 Jul 2015, at 7:17 pm, Carl Hoefs newsli...@autonomy.caltech.edu wrote:
 
 I'm trying to get an NSURL into PHAsset form, but I keep coming up with null. 
 PHAsset fetchAssetsWithALAssetURLs: takes an NSArray of NSURLs: An array of 
 NSURL objects, each an asset URL previously retrieved from an ALAsset 
 object. Apparently, this is not a simple array of NSURL objects. 

Well, more specifically, it sounds like an array of “asset URLs previously 
retrieved from an ALAsset object.”

 2015-07-28 19:04:36.221 hsvst[577:76956] assetURLs (

 file:///var/mobile/Containers/Data/Application/9C51BEE6-80A7-15A4-72DA-19E447A75E25/Documents/hsvst_0005.mov
 )

Indeed, that looks like a file:// URL representing a path to regular disk file 
on the filesystem, not an asset URL from an ALAsset object.

Have you looked at +[PHAssetChangeRequest 
creationRequestForAssetFromVideoAtFileURL:] ?  For example:

 PHAssetChangeRequest *assetRequest = [PHAssetChangeRequest 
 creationRequestForAssetFromVideoAtFileURL: self.sourcePlayListItem.url];
 PHObjectPlaceholder *assetPlaceholder = 
 assetRequest.placeholderForCreatedAsset;
 /* treat assetPlaceholder as a PHAsset and do something with it */ ;

What are you ultimately trying to do?

cheers,

-ben


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: PSA: floor(NSFoundationVersionNumber) doesn't work with Yosemite or later

2015-07-10 Thread Ben Kennedy
On 10 Jul 2015, at 12:01 pm, Charles Srstka cocoa...@charlessoft.com wrote:

 What this means is that if you try to use an El Capitan-only feature and put 
 it in a block that starts with a check on floor(NSFoundationVersionNumber) or 
 floor(NSAppKitVersionNumber) to make sure it’s larger than the value for 
 10.10.0, your code in that block will get called on all versions of 10.10.x 
 greater than 10.10.1.

NSObjCRuntime.h only declares a reference version constant for up to 10.9.2 
(NSFoundationVersionNumber10_9_2).  I presume your methodology relies on an 
empirical determination of what later versions of Foundation appear to expose?

But even if you were going to use such an approach (which seems unwise, as you 
said yourself, considering NSProcessInfo), why on earth would you do a 
greater-than comparison against the today's last known version of 10.10.x, 
rather than a greater-than-or-equal-to comparison against what you can today 
observe is exposed by 10.11.0?

 Once Yosemite stops being updated, we can of course use the constant for the 
 last version that’s released, but since we still can’t say with 100% 
 certainty that there won’t be a 10.10.5, we can’t really rely on this.

No kidding. (Never mind the fact that the notion of using a floating point 
number for such identification is inherently laughable, but I guess that was 
codified in yore.)

b


___

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: UIPageViewController not resizing its child view controllers on rotation

2015-06-30 Thread Ben Kennedy
 On 30 Jun 2015, at 7:30 am, Devarshi Kulshreshtha 
 devarshi.bluec...@gmail.com wrote:
 
 Though pagination control has resized properly, view of added view
 controller has not resized properly.

You haven't said so, but I presume that the UIPageControl belongs to your root 
view, and not pagesContainerViewController's view?

If so, the evidence suggests that autolayout is working correctly for the 
former but not the latter.  And presuming that is the case, then my suspicion 
lies with this line:

self.view.translatesAutoresizingMaskIntoConstraints = NO;

It is unusual to specify translatesAutoresizingMaskIntoConstraints on oneself, 
since it is almost always one's parent who is responsible for one's 
positioning. And absent any other constraints, this will remove its 
autoresizing with respect to its superview.

Hence, my guess is that the pagesContainerViewController's view has no 
constraints, and thus is getting unspecified layout (as manifest by its child 
UIPageViewController's view positioning).

What happens if you delete that line?

b


___

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: Would you pay for a better table view?

2015-06-30 Thread Ben Kennedy
 On 30 Jun 2015, at 4:10 pm, Michael David Crawford mdcrawf...@gmail.com 
 wrote:
 
 Cocoa Touch's table view works for simple things but it is painful for
 anything fancy.

Have you checked out UICollectionView, or as of this month, UIStackView?

 Were I to write a better table view, would any of you fine folks be into
 licensing it for your own apps?

That's a rather tough question to answer a priori, especially without knowing 
anything of its goals or what problems it tries to solve.  But why don't you 
post some initial work to GitHub and see what develops?

 I once made what appeared to be a Mac OS List Manager list work with three
 billion items.

Good for you.  I also wrote a pretty sweet tree view control for MacZoop back 
in the Classic days -- unfortunately before I had the wisdom of proper and 
regular backups (seemingly no evidence remains).

b


___

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: NSWindow child window and key status

2015-06-16 Thread Ben
Thank you for the suggestion, unfortunately it does not fix the problem. I will 
probably end up using a tech support incident for this one.

- Ben


 On 15 Jun 2015, at 23:50, Quincey Morris 
 quinceymor...@rivergatesoftware.com wrote:
 
 On Jun 15, 2015, at 13:38 , Ben ben_cocoa_dev_l...@yahoo.co.uk 
 mailto:ben_cocoa_dev_l...@yahoo.co.uk wrote:
 
 I'm trying to replicate a portion of UI in a manner similar to the formula 
 editor of Numbers. For those not familiar, its a widget that floats above 
 the spreadsheet grid featuring a text view and a button or two.
 
 Currently I am using the addChildWindow:ordered: method on NSWindow to add a 
 custom borderless window above the grid view and putting an NSTextView in 
 that window. So far so good.
 
 Have you tried implementing this with a NSPanel? It’s designed (when 
 configured with suitable options) to float over other windows — though not a 
 *specific* other window. It doesn’t take “main” status away from other 
 windows, and takes “key” status away only when firstResponder is actually in 
 one of its views (again when configured that way).
 

___

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

NSWindow child window and key status

2015-06-15 Thread Ben
Hi list,

I'm trying to replicate a portion of UI in a manner similar to the formula 
editor of Numbers. For those not familiar, its a widget that floats above the 
spreadsheet grid featuring a text view and a button or two.

Currently I am using the addChildWindow:ordered: method on NSWindow to add a 
custom borderless window above the grid view and putting an NSTextView in that 
window. So far so good.

However, it appears that the parent window of an NSTextView needs to be the key 
window in order to receive key events. When I allow the child window to become 
key, the 'real' document window containing the main spreadsheet control loses 
focus (i.e. the traffic light buttons grey out and the title bar becomes its 
inactive colour).


Does anyone know how to allow my NSTextView in a child window to be edited, 
without the parent window losing focus?


NSPopover seems to be able to do it, but this might involve private API. 
Ideally I'd like to do it without having to subclass the parent window. 


Thank you for any pointers,

Ben
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: [PSA] OSStatus.com -- Error code lookup

2015-06-01 Thread Ben Kennedy
On 01 Jun 2015, at 5:59 am, Uli Kusterer witness.of.teacht...@gmx.net wrote:

 It's a trick web devs use to get certain browsers to switch on UTF8 support, 
 IIRC.

Isn't that what Accept: and Content-Type: headers are for?

Oh... apparently seems like a cheap workaround for broken MSIE:

http://programmers.stackexchange.com/questions/168751/is-the-use-of-utf8-✓-preferable-to-utf8-true

Still seems inadvisable to me.

b


___

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: [PSA] OSStatus.com -- Error code lookup

2015-05-31 Thread Ben Kennedy
Pardon my thickness, but what is the purpose of the utf8 parameter anyway? 
Removing it from the query string appears to have no material impact on the 
results:

http://www.osstatus.com/search/results?search=-43

b

 On 31 May 2015, at 5:58 am, Uli Kusterer witness.of.teacht...@gmx.net wrote:
 
 On 31 May 2015, at 13:24, Kevin Meaney k...@yvs.eu.com wrote:
 Thanks for this. It is a great resource. I just tried to embed a link to a 
 search for all the CoreVideo error codes into a tweet, but twitter doesn’t 
 like the tick mark as a character in a url. Can you change that?
 
 I had the same issue trying to link to an individual error code. You may have 
 to go the Amazon route and write something like “ŸÉŠ” for the Unicode trick?
 
 Cheers,
 -- Uli Kusterer
 “The Witnesses of TeachText are everywhere...”
 http://zathras.de
 
 
 ___
 
 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/ben%40zygoat.ca
 
 This email sent to b...@zygoat.ca

--
Ben Kennedy, chief magician
Zygoat Creative Technical Services
http://www.zygoat.ca






___

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: Custom NSView subclass - expressing the fact that a property affects the displayed image

2015-05-22 Thread Ben Kennedy
On 22 May 2015, at 6:03 am, Jonathan Taylor jonathan.tay...@glasgow.ac.uk 
wrote:

 I agree that it’s extra indirection, but since performance is never going to 
 be an issue, I feel it’s a slight gain on tidiness and maintainability. I 
 agree that it’s not a big deal for one property, but when there are lots it 
 starts to add up.

How about cooking up a macro for defining the accessors?

#define DECLARE_PROPERTY(PROPERTY,TYPE) \
@property (nonatomic, copy) TYPE PROPERTY;

#define DEFINE_PROPERTY(PROPERTY,TYPE) \
- (TYPE)PROPERTY \
{ \
return _##PROPERTY; \
} \
\
- (void)set##PROPERTY:(TYPE)x \
{ \
_##PROPERTY = x; \
[self setNeedsDisplay]; \
} \

...

@interface Foo

DECLARE_PROPERTY(widgetName, NSString *);

@end

...

@implmenetation Foo

DEFINE_PROPERTY(widgetName, NSString *);

@end

 And it’s not just the setters - what finally spurred me into action was the 
 decision that I wanted all my properties to be atomic (which may or may not 
 be related to an occasional crash I have been seeing). That means writing a 
 correct threadsafe getter for each one as well...

Since you're talking about properties on an NSView subclass, and NSView is 
documented as being not thread-safe, the atomicity thing sounds like a big red 
herring (or red flag, depending on your preference for fish or cloth).

b


___

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: NSFontPanel swamping the responder chain (and crashing)

2015-05-22 Thread Ben Kennedy
On 21 May 2015, at 1:33 am, Graham Cox graham@bigpond.com wrote:

 I can’t do a ‘po self’, even just typing it in, at this point, no matter how 
 cunning I am at breaking at the right time. It seems as if there really isn’t 
 enough info to resolve ‘self’ (the message is error: use of undeclared 
 identifier ‘self’)
 As you suggest, it’s probably a register, but don’t know which. I get the 
 same error if I try any of them - undeclared identifier ‘r15’ for example.

In lldb you can name a register by slapping a dollar sign before its name, e.g.:

(lldb) po $edx
PieChartViewController: 0x7fe90210

(This is retrieving 'self' when running in the iOS Simulator; I don't have a 
Mac OS X project at hand as I type this so the register use is probably 
different but presumably the same technique should apply.)

b


___

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

Move a folder and update corresponding Finder sidebar favorite

2015-05-20 Thread Ben Staveley-Taylor
I’m having trouble moving folders around if there is a Finder sidebar favorite 
pointing to that folder — the favorite gets deleted sometimes, if it is a move 
rather than a rename. I’d like to find a robust method that updates the 
favorite to point to the new location.

Suppose you have a folder /Users/me/Folder1, and you have placed that folder in 
the Finder sidebar favorites list.

If I rename the folder by
[[NSFileManager defaultManager] moveItemAtPath:@/Users/me/Folder1 
toPath:@/Users/me/Folder2 error:error]
then the sidebar favorite updates with the new name automatically.

However, if this is a real move, i.e. a change of parent folder
[[NSFileManager defaultManager] moveItemAtPath:@/Users/me/Folder1 
toPath:@/Users/me/Moved/Folder1 error:error]
then the sidebar favorite is deleted as a side effect of the move.

If the user does the move by dragging the folder in Finder then the sidebar 
favorite is updated by Finder of course. I have also tried performing the move 
by AppleScript and the favorite is still deleted, so I can't get the Finder 
behavior that way.

Is there a way to get Finder to update the sidebar favorite when its target 
moves? I know the LSSharedFileList APIs let you create and delete favorites but 
I am having timing issues because the old favorite does not appear to be 
deleted immediately and synchronously by the NSFileManager moveItemAtPath API 
call so it is difficult to tell on return whether it needs to be recreated.

Thanks for any help,

— Ben.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

How do I prevent NSUserNotifications from being added to the notification list?

2015-03-24 Thread Ben Jones
Hi all,

I have an application that displays banner notifications using code of the
type:

auto notification = [[NSUserNotification alloc] init];
notification.title = @Hello!
// etc.
auto center  = [NSUserNotificationCenter defaultUserNotificationCenter];
// etc.
[center scheduleNotification:notification];

Does anybody know how I can programmatically prevent the notification from
being added to the notification list (the one that is opened by clicking on
the icon at the top right of the screen)?

Many thanks,
Ben.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Responsive scrolling control with lots of subviews

2015-03-02 Thread Ben

 On 2 Mar 2015, at 19:10, Uli Kusterer witness.of.teacht...@gmx.net wrote:
 
 On 02 Mar 2015, at 19:26, Ben ben_cocoa_dev_l...@yahoo.co.uk wrote:
 - Granularity of selection. For example single or multiple disconnected 
 cells. NSTableView only gives me row or column.
 - Scrollable floating headers on both axis. This I did sort-of manage with 
 NSTableView by styling the first column to look like a header, but it was 
 not great.
 
 So you're effectively implementing something like a spreadsheet?

Sort of, yes. Basically it's for browsing database contents with more focused 
UI selections than a simple table offers. The problem is that when you begin by 
saying spreadsheet, so many people jump to the conclusion you're building 
Excel and a fancy calculation engine too!. I am sorry if my writing has lead 
anyone in the wrong direction.

Incidentally, since you and Ken Thomases mentioned it, by responsive scrolling, 
I meant the smooth 60fps type of responsive. However, I am taking into 
account the capital-R Responsive guidelines for over-drawing and preparing 
contents outside the user-visible area.


Thank you all for the pointers though. It's getting late here, but I will 
continue my work tomorrow.

- Ben
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Responsive scrolling control with lots of subviews

2015-03-02 Thread Ben

 On 2 Mar 2015, at 14:10, Mike Abdullah mabdul...@karelia.com wrote:
 
 
 On 2 Mar 2015, at 11:44, Ben ben_cocoa_dev_l...@yahoo.co.uk wrote:
 
 Hi list,
 
 Since NSCell is apparently on the way out, I've been trying to build a new 
 control I need using views. It's a cut-down spreadsheet-alike grid, similar 
 to MBTableGrid here: https://github.com/brendand/mbtablegrid
 
 Unfortunately, I am running into the to-be-expected performance trouble with 
 keeping a couple of hundred subviews in my control at the same time. It 
 particularly hurts when scrolling. Stuff I've tried includes:
 
 - Removing the off-screen views when possible (still leaves about 150 on 
 screen)
 - Keeping a queue of reusable views to avoid allocating new ones
 - Attempting to have one view per grid item type and treat it like an NSCell 
 (i.e., lockFocus into the parent view and draw there)
 
 Clearly a smooth-scrolling view-based grid is possible - after all, 
 NSTableView can do it. It's a shame I can't use it for this.
 
 Does anyone have any suggestions on how to achieve decent drawing/scrolling 
 performance here?
 
 Can you offer any more explanation as to *what* is slow in your experiments? 
 What is about the number of views that seems to be bogging your control down?

Certainly:

From a time profile, the majority of my code being called is funnelled through 
a single method which handles the adding/positioning/removing of views within 
the visible area. The slow areas are:

 8% - Instantiating new views (happens early on, views are cached for reuse)
20% - Positioning new/reused views (a single -setFrame: call once for each view)
25% - Adding newly-visible subviews (-addSubview:)
17% - Enumerating off-screen columns for view removal 
(-removeFromSuperviewWithoutNeedingDisplay)
25% - Enumerating off-screen rows for view removal 
(-removeFromSuperviewWithoutNeedingDisplay)
Remainder is misc small stuff. This method as a whole takes 19% of running time.

The grid typically has up to 50 columns and 1000 rows. There is a hard upper 
limit of 2000 columns and no reasonable limit on rows. I intend to paginate 
these.

In my test project, I am assuming around 10 columns and 40 rows visible, giving 
400 views visible. Maybe slightly more to allow for those just offscreen.

None of the above even begins to think about memory usage (Idle ~40MB, under 
fast scrolling up to 300MB)

Thanks,

Ben





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Responsive scrolling control with lots of subviews

2015-03-02 Thread Ben
Hi list,

Since NSCell is apparently on the way out, I've been trying to build a new 
control I need using views. It's a cut-down spreadsheet-alike grid, similar to 
MBTableGrid here: https://github.com/brendand/mbtablegrid

Unfortunately, I am running into the to-be-expected performance trouble with 
keeping a couple of hundred subviews in my control at the same time. It 
particularly hurts when scrolling. Stuff I've tried includes:

- Removing the off-screen views when possible (still leaves about 150 on screen)
- Keeping a queue of reusable views to avoid allocating new ones
- Attempting to have one view per grid item type and treat it like an NSCell 
(i.e., lockFocus into the parent view and draw there)

Clearly a smooth-scrolling view-based grid is possible - after all, NSTableView 
can do it. It's a shame I can't use it for this.

Does anyone have any suggestions on how to achieve decent drawing/scrolling 
performance here?


- Ben


PS. I have tried using/subclassing NSTableView and have filed a bug for the 
functionality that I'm after (rdar://17406314 rdar://17406314 marked as dupe 
of rdar://2778108 rdar://2778108).
___

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: Responsive scrolling control with lots of subviews

2015-03-02 Thread Ben

 On 2 Mar 2015, at 15:45, Uli Kusterer witness.of.teacht...@gmx.net wrote:
 
 On 02 Mar 2015, at 15:54, Ben ben_cocoa_dev_l...@yahoo.co.uk 
 mailto:ben_cocoa_dev_l...@yahoo.co.uk wrote:
 On 2 Mar 2015, at 14:10, Mike Abdullah mabdul...@karelia.com 
 mailto:mabdul...@karelia.com wrote:
 On 2 Mar 2015, at 11:44, Ben ben_cocoa_dev_l...@yahoo.co.uk 
 mailto:ben_cocoa_dev_l...@yahoo.co.uk wrote:
 
 Hi list,
 
 Since NSCell is apparently on the way out, I've been trying to build a new 
 control I need using views. It's a cut-down spreadsheet-alike grid, 
 similar to MBTableGrid here: https://github.com/brendand/mbtablegrid 
 https://github.com/brendand/mbtablegrid
 
 Unfortunately, I am running into the to-be-expected performance trouble 
 with keeping a couple of hundred subviews in my control at the same time. 
 It particularly hurts when scrolling. Stuff I've tried includes:
 
 - Removing the off-screen views when possible (still leaves about 150 on 
 screen)
 - Keeping a queue of reusable views to avoid allocating new ones
 - Attempting to have one view per grid item type and treat it like an 
 NSCell (i.e., lockFocus into the parent view and draw there)
 
 Clearly a smooth-scrolling view-based grid is possible - after all, 
 NSTableView can do it. It's a shame I can't use it for this.
 
 Does anyone have any suggestions on how to achieve decent 
 drawing/scrolling performance here?
 
 Can you offer any more explanation as to *what* is slow in your 
 experiments? What is about the number of views that seems to be bogging 
 your control down?
 
 Certainly:
 
 From a time profile, the majority of my code being called is funnelled 
 through a single method which handles the adding/positioning/removing of 
 views within the visible area. The slow areas are:
 
 8% - Instantiating new views (happens early on, views are cached for reuse)
 20% - Positioning new/reused views (a single -setFrame: call once for each 
 view)
 25% - Adding newly-visible subviews (-addSubview:)
 17% - Enumerating off-screen columns for view removal 
 (-removeFromSuperviewWithoutNeedingDisplay)
 25% - Enumerating off-screen rows for view removal 
 (-removeFromSuperviewWithoutNeedingDisplay)
 Remainder is misc small stuff. This method as a whole takes 19% of running 
 time.
 
 Are you re-setting *all* the views or only hiding views that scroll out and 
 moving unused views to newly exposed areas? We've been doing stuff like that 
 in various spots and performance is fine. One thing that might help is to 
 make each table-row layer-backed, then you get zero-cost moving as it simply 
 gets drawn in another location on the graphics card. My checklist for a 
 view-based table view would be:
 
 - Create (height/ row height) +1 row views and keep them around
 - Make all rows layer-backed
 - When scrolling, make sure you only modify the position, not the height, and 
 do not call setNeedsDisplay: on any views whose contents haven't actually 
 changed
 - when a view goes out of view, re-use it for the newly-exposed area, and 
 only then request a redraw, or otherwise hide it.
 - Mark as many views as you can as opaque.
 - Try to update items relatively to each other. I.e. just assume the 
 bottom-most view is already positioned right and place the newly-exposed 
 row's view under it, don't loop over all rows over and over again.
 
 That said, we used to do the same without layer-backing in the Carbon and 
 Classic days and Macs had sufficient performance, so that this is taking too 
 long for you seems weird. Are these custom views? Are you rounding 
 coordinates to integers to ensure they don't subtly change size due to 
 rounding errors?
 
 Also, I remember using PXListView (https://github.com/Perspx/PXListView 
 https://github.com/Perspx/PXListView) a few years ago and contributing a 
 bunch of performance fixes. It's not the code we're using these days (and it 
 has changed a bit since then), but it might do one or the other optimization 
 you're not doing, so may be a good point of reference.

Thanks for the pointers and link, there are a few of these I'm not doing yet so 
will give them a try.

- Ben



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Responsive scrolling control with lots of subviews

2015-03-02 Thread Ben

 On 2 Mar 2015, at 17:42, Quincey Morris quinceymor...@rivergatesoftware.com 
 wrote:
 
 On Mar 2, 2015, at 02:44 , Ben ben_cocoa_dev_l...@yahoo.co.uk 
 mailto:ben_cocoa_dev_l...@yahoo.co.uk wrote:
 
 Since NSCell is apparently on the way out, I've been trying to build a new 
 control I need using views. It's a cut-down spreadsheet-alike grid
 
 I don’t see that anyone has yet asked the question of why the grid needs to 
 have subviews. Implementing the rows and columns yourself means inventing 
 your own duplicate API for managing them, but it’s likely not a lot of code, 
 assuming you only need textual editing of one cell at a time (and can 
 therefore use a single re-usable, movable text field for the editing).
 
 So, why can’t your spreadsheet-like grid be a single custom view that draws 
 its own text and graphics in a grid-like pattern directly?
 
 PS. I have tried using/subclassing NSTableView and have filed a bug for the 
 functionality that I'm after
 
 Purely for interest’s sake, can you tell us what functionality is missing, 
 for your use-case?
 


I hadn't considered asking my delegate for text and images directly. That could 
be a simpler way to do things - I will look into it.


The functionality that I'm missing is:

- Granularity of selection. For example single or multiple disconnected cells. 
NSTableView only gives me row or column.
- Scrollable floating headers on both axis. This I did sort-of manage with 
NSTableView by styling the first column to look like a header, but it was not 
great.

Maybe I will have another look at digging into NSTableView again.


___

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: Resolving bizarre autolayout crashes.

2015-02-04 Thread Ben Kennedy
On 04 Feb 2015, at 8:26 am, Alex Zavatone z...@mac.com wrote:

 Looking at the UIScrollView to which they applied, I couldn't make heads or 
 tails of how the constraints listed in the console translated into the 
 constraints on the only UIScrollView in the XIB.

I don't suppose you saved a copy of the log message, did you?  We might be able 
to help shed some light on it.

 Attempting to revert the VC and the XIB to what was in the repo had no effect 
 on resolving the issue.  
 
 Quitting and restarting Xcode had no effect on resolving the issue.

Did you clean your build folder?  Xcode is well known for leaving compiled xibs 
lying around in the build product after they have been e.g. removed from the 
project.  Recent versions also seem to have a propensity for hanging onto 
diagnostic and error messages that are no longer relevant and which can only be 
cleared by doing a full clean.

b


___

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: Resolving bizarre autolayout crashes.

2015-02-04 Thread Ben Kennedy
On 04 Feb 2015, at 1:08 pm, Alex Zavatone z...@mac.com wrote:

 Thanks Kyle.  The thing that scares me here is that I have no idea why this 
 started failing and why it stopped, so I'm afraid it could stop working at 
 any time without knowing why.

Kyle already gave you a likely reason: you have a height constraint on the 
scroll view which conflicts with other constraints under some circumstances.

 I think this started happening when I changed device size in the simulator, 
 or dragged the simulator from one screen to another but still, I'm unsure 
 what caused it to start throwing an exception.

To be clear, the exception is thrown because your scroll view has two or more 
conflicting constraints in force.

Here again are the constraints from the debugging output you posted earlier:

NSLayoutConstraint:0x16d8e230 V:[UIScrollView:0x16d8df50(=1368)],
NSLayoutConstraint:0x16d8f7e0 V:|-(0)-[UIScrollView:0x16d8df50]   (Names: 
'|':UIView:0x16d8f650 ),
NSLayoutConstraint:0x16d8f810 V:[UIScrollView:0x16d8df50]-(0)-|   (Names: 
'|':UIView:0x16d8f650 ),
NSAutoresizingMaskLayoutConstraint:0x173556e0 h=-- v=-- 
UIView:0x16d8f650.height == _UIParallaxDimmingView:0x14e396d0.height,
NSAutoresizingMaskLayoutConstraint:0x17355f60 h=-- v=-- 
V:[_UIParallaxDimmingView:0x14e396d0(568)]

These state that the scroll view is pinned to the same frame as its superview, 
and that its height (and therefore its superview's height) must be = 1368.  
However, there is also a _UIParallaxDimmingView that is constrained also to 
occupy the same superview, but whose height is fixed at 568.  Clearly, 568  
1368; hence a conflict.

No doubt you aren't installing this _UIParallaxDimmingView yourself, but some 
interaction is prompting UIKit to do so (presumably on a transient basis).  
While I don't know anything about such circumstances, it seems to follow that 
if you take Kyle's advice and remove the height constraint on the scroll view, 
it will prevent such a conflict.

b



___

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: NSTableCellView Constraints?

2015-01-27 Thread Ben Kennedy
On 27 Jan 2015, at 5:53 pm, Steve Mills sjmi...@mac.com wrote:

 I 100% agree. A table column that does not auto-resize is a very poor design. 
 No right UX designer would make it do that.

The table column resizes just fine -- the issue is that you need to specify how 
you want the stuff within to resize in accord.  This very fact is a blessing, 
since it affords you control.

Perhaps you have a view you'd like right-justified?  Or proportionally sized?  
Is UIKit supposed to guess this?

b

--
Ben Kennedy, chief magician
Zygoat Creative Technical Services
http://www.zygoat.ca


___

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: Adding constrains for anonymous buttons

2015-01-25 Thread Ben Kennedy
On 25 Jan 2015, at 7:32 am, Aaron Lewis the.warl0ck.1...@gmail.com wrote:

 I'm trying to create a label group, so I decided to generate 3
 buttons and put them in a single line, evenly sized and evenly spaced.

What do you mean by label group?  Would UILabel be more suitable than 
UIButton?  (I presume that your for-loop preamble was just illustrative, since 
it seems atypical to assign buttons into a C array and without any 
target/action.)

 But these buttons are un-named, is it impossible to use
 constraintsWithVisualFormat now? e.g

Given your code, what about something like this:

NSString *format = @|[button0][button1(==button0)][button2(==button0)]|;

NSDictionary *views = @{
@button0 : buttons[0],
@button1 : buttons[1],
@button2 : buttons[2],
};

NSArray *constrants = [NSLayoutConstraint constraintsWithVisualFormat:format 
options:0L metrics:nil views:views];

b

--
Ben Kennedy, chief magician
Zygoat Creative Technical Services
http://www.zygoat.ca






___

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: What's up with the Cocoa Text System?

2015-01-23 Thread Ben Kennedy
Is your personal hubris about a job you were not offered 14 years ago (and 
tastes for interview style) somehow relevant to the other developers on this 
list?

b

Sent from my iPhone

 On Jan 23, 2015, at 2:38 PM, Michael Crawford mdcrawf...@gmail.com wrote:
 
 Cocoa Text is glacially slow compared to what it would be had Apple
 offered me the developer tools job I interviewed for in 2001.
 
 Perhaps, when interviewing with the Xocde team, it might not have been
 a bad idea to avoid criticizing Xcode.  I made it quite clear that I
 was unimpressed with Mac OS X in general, and to this day, I regard
 Mac OS System 8.1 as the very finest System Software release Apple has
 ever produced.
 
 Are you familiar with the term Bozo Filter?
 
 More or less, I won't accept a job offer, unless I can call my
 potential employer a jackass directly to his face - then have him
 agree that he is, in fact, a jackass.
 
 No doubt you expect that I am of very modest means.  I was quite
 wealthy at one time, but my money did not do me a whole lot of good.
 Michael David Crawford, Consulting Software Engineer
 mdcrawf...@gmail.com
 http://www.warplife.com/mdc/
 
   Available for Software Development in the Portland, Oregon Metropolitan
 Area.
 
 
 On Fri, Jan 23, 2015 at 2:16 PM, Jens Alfke j...@mooseyard.com wrote:
 
 On Jan 23, 2015, at 1:53 PM, Michael Crawford mdcrawf...@gmail.com wrote:
 
 At one time I found it quite painful to edit source code with Xcode.
 I was told that was due to Xcode using the Cocoa text widget.
 
 Consider that Lightspeed C worked just fine, snappy and responsive, on
 my 6 MHz 68000 Mac 512k (or was it 8 MHz).
 
 
 I used Lightspeed C too. Its editor didn't support Unicode, or any languages
 outside the basic Roman alphabet. That's a significant quality-of-life issue
 for programmers whose first language isn't English. It also didn't do live
 syntax checking or code folding. In fact it only supported monospaced
 single-color text (no syntax highlighting.)
 
 The Cocoa text system compares to that editor, or MacWrite, the way
 Photoshop compares to a crayon. And some of those features may seem like
 nice-to-have frills to Americans (contextual forms, ligatures, bidirectional
 layout, pop-up text input panels) but are must-haves for languages written
 by the majority of the world's people.
 
 I'm sure that if we resurrected the Lightspeed C engine, it would let you
 type at about ten million words-per-minute on today's computers. So what?
 The editor only needs to be fast enough to keep up with human fingers. The
 rest of the CPU time can be dedicated to extra features.
 
 Cocoa Text isn't slow. (And it wasn't slow on a Power Mac G3 back in the day
 either.) One guy is having some nasty slowdowns that seem to be caused by
 something incidental, not an intrinsic problem with the text system.
 
 --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/ben%40zygoat.ca
 
 This email sent to b...@zygoat.ca

___

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

AVCaptureInputPortFormatDescriptionDidChangeNotification confusion

2014-11-29 Thread Ben
I'm trying to get the video dimensions by using 
AVCaptureInputPortFormatDescriptionDidChangeNotification however the width  
height returns a number way higher than I am expecting.
Expecting 320/480 or similar but getting width = 1088784512, height = 
1819304813.

Any ideas what I am doing wrong? 


- 
(void)avCaptureInputPortFormatDescriptionDidChangeNotification:(NSNotification 
*)notification {

AVCaptureInputPort * captureInputPort = notification.object;


CMFormatDescriptionRef formatDescription = 
captureInputPort.formatDescription;
if (formatDescription) {
CMVideoDimensions dimensions = 
CMVideoFormatDescriptionGetDimensions(formatDescription);
   

}


Printing description of dimensions:
(CMVideoDimensions) dimensions = (width = 1088784512, height = 1819304813)



Printing description of formatDescription:
CMAudioFormatDescription 0x19acd1f0 [0x3aa74460] {
mediaType:'soun' 
mediaSubType:'lpcm' 
mediaSpecific: {
ASBD: {
mSampleRate: 44100.00 
mFormatID: 'lpcm' 
mFormatFlags: 0xc 
mBytesPerPacket: 2 
mFramesPerPacket: 1 
mBytesPerFrame: 2 
mChannelsPerFrame: 1 
mBitsPerChannel: 16 } 
cookie: {(null)} 
ACL: {(null)} 
} 
extensions: {CFBasicHash 0x19acd250 [0x3aa74460]{type = immutable 
dict, count = 1,
entries =
2 : CFString 0x3ab282e0 [0x3aa74460]{contents = 
VerbatimSampleDescription} = CFData 0x19acdca0 [0x3aa74460]{length = 52, 
capacity = 52, bytes = 0x0034736f7774 ... 00020002}
}
}
}
___

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: Is it possible to read your own quarantine info after launch?

2014-11-29 Thread Ben Staveley-Taylor
Thanks, Ken. Certainly the test code that I wrote failed to get the 
kLSQuarantineOriginURLKey value and I assumed that was because the quarantine 
info had been cleared, but maybe it was a different cause. Anyway, you’re 
right, even if it works it is too fragile. I can’t arrange for each server to 
host a different build, but probably a config file is the way to go.

— Ben.

On 28 Nov 2014, at 22:18, Ken Thomases k...@codeweavers.com wrote:

 On Nov 28, 2014, at 10:14 AM, Ben Staveley-Taylor 
 ben.staveley-tay...@oracle.com wrote:
 
 I want to determine from which server my application was downloaded, on its 
 first use. (The app is hosted on many servers and I want to work out which 
 one to connect back to.)
 
 This seems like an _extremely_ fragile approach.  Perhaps the different 
 servers should host slightly different versions of the app, with the server 
 identity encode within it.  Or the servers should host an archive that 
 includes the app plus a configuration file next to it that the users can drop 
 onto the app to configure it.
 
 
 The Mac OS adds quarantine info to downloaded files. This is handled by 
 Launch Services, so I can use LSCopyItemAttribute with 
 kLSItemQuarantineProperties and look at the kLSQuarantineOriginURLKey value. 
 However, the quarantine info is erased once the user has authorised the 
 first use of the download.
 
 Are you sure about that?  I haven't tested via the Launch Services API, but I 
 know that the com.apple.quarantine extended attribute is not removed from the 
 file(s) in modern versions of the OS.  Rather, the system modifies a flag 
 value within it and also records the fact that the user approved the launch 
 in a system database so it doesn't ask again.
 
 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

Is it possible to read your own quarantine info after launch?

2014-11-28 Thread Ben Staveley-Taylor
I want to determine from which server my application was downloaded, on its 
first use. (The app is hosted on many servers and I want to work out which one 
to connect back to.)

The Mac OS adds quarantine info to downloaded files. This is handled by Launch 
Services, so I can use LSCopyItemAttribute with kLSItemQuarantineProperties and 
look at the kLSQuarantineOriginURLKey value. However, the quarantine info is 
erased once the user has authorised the first use of the download. So I can 
read another file’s quarantine, but by the time my own app has launched, Launch 
Services has un-quarantined it and the info is gone.

Is there a way to access the quarantine info after launch? Or is there another 
way to determine where the downloaded app came from?

Thanks.

— Ben.




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: How do I show application-specific data on a web page?

2014-10-19 Thread Ben Kennedy
On 19 Oct 2014, at 11:07 am, Daryle Walker dary...@mac.com wrote:
 
 For my web browser project, I sometimes want to show synthesized pages. It 
 would be a web page within my bundle that I have to modify before displaying.

I recommend you take a look at GRMustache [1] or something similar; it would 
probably fit your bill very well.  In my day job we use it for generating a 
variety of both simple (in-app based) and complex (user-content-driven) HTML 
and text files.

[1] https://github.com/groue/GRMustache

b

--
Ben Kennedy, chief magician
Zygoat Creative Technical Services
http://www.zygoat.ca






___

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: crashing on -[UIViewController presentViewController:animated:completion:] on ios 8

2014-09-22 Thread Ben Kennedy
On 22 Sep 2014, at 6:36 pm, Herman Chan herman...@gmail.com wrote:

 GlobalSettingsViewController *c = [[GlobalSettingsViewController alloc] 
 initWithGroupDataSource:self.dataSource];
 navigationController = [[UINavigationController alloc] 
 initWithRootViewController:c];
 UIViewController *vc = UIApplication sharedApplication] delegate] window] 
 rootViewController];
 [vc presentViewController:navigationController animated:YES completion:nil];

Is there a particular reason why you are fishing out the root view controller 
via the delegate singleton?  Does it work properly if your 
LeftMenuViewController instance (the class which according to your trace is 
making the call) simply calls presentViewController on itself instead?

b

--
Ben Kennedy, chief magician
Zygoat Creative Technical Services
http://www.zygoat.ca






___

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

Printing onto custom paper (filling in forms)

2014-08-28 Thread Ben
I'm trying to make a tool for myself to fill in some repetitive forms. They've 
got a custom paper size with a series of boxes to be filled in.

Given that I know the dimensions of the paper and the locations and dimensions 
of the boxes to fill in, I should be able to draw a view that prints onto these 
sheets. However, I'm getting lost in the printing system trying to figure out 
what steps I need to take to get this working.

I don't understand how to go from the physical paper size (say 80mm wide, 150mm 
tall) to the paper size Cocoa wants in points. Is there a method that gives a 
scaling factor from points to any physical unit?

I'll also need to precisely position drawn strings in the view to print, so 
will presumably need to translate points to physical dimensions when drawing 
too.

Can anyone point me to something that might explain how to proceed here?

Thanks,

Ben



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Printing onto custom paper (filling in forms)

2014-08-28 Thread Ben

On 28 Aug 2014, at 15:01, Keary Suska cocoa-...@esoteritech.com wrote:

 On Aug 28, 2014, at 7:20 AM, Ben ben_cocoa_dev_l...@yahoo.co.uk wrote:
 
 I'm trying to make a tool for myself to fill in some repetitive forms. 
 They've got a custom paper size with a series of boxes to be filled in.
 
 Given that I know the dimensions of the paper and the locations and 
 dimensions of the boxes to fill in, I should be able to draw a view that 
 prints onto these sheets. However, I'm getting lost in the printing system 
 trying to figure out what steps I need to take to get this working.
 
 I don't understand how to go from the physical paper size (say 80mm wide, 
 150mm tall) to the paper size Cocoa wants in points. Is there a method that 
 gives a scaling factor from points to any physical unit?
 
 I'll also need to precisely position drawn strings in the view to print, so 
 will presumably need to translate points to physical dimensions when drawing 
 too.
 
 Can anyone point me to something that might explain how to proceed here?
 
 As the docs say, sizes are measured in the user coordinate space: 
 https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CocoaDrawingGuide/Transforms/Transforms.html#//apple_ref/doc/uid/TP40003290-CH204-SW5
 
 This guide is important to read as well.
 

I've read that before, but not thought to apply it to print devices.

If I understand correctly, I should basically just work everything out at 72dpi 
(the assumed user space scale) and let the system sort out the scaling for the 
printer?

So for my case, assuming 72dpi ≈ 2.8 dots/mm:
The paper being 80mm wide should be set to 224 points wide
To inset a label by 10mm from an edge, I should inset by 28 points?

Am I understanding this right?


___

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: Quickie about constraints

2014-08-18 Thread Ben Kennedy
Thank you Charles and Roland for pointing out that section of documentation, 
and correcting in detail my mis-advice in the first reply.  Going back to what 
Kyle replied to me originally:

 Can't you simply set translatesAutoresizingMaskIntoConstraints = NO on the 
 views in question?  Then you should be free to manipulate such views' frames 
 at will without interfering in any related constraints.
 
 Not sure if you’ve got this backwards, or are unaware of a certain frameworks 
 bug.
 
 Views whose translatesAutoresizingMaskIntoConstraints property is set to YES 
 can be positioned via -setFrame:. Views whose property is set to NO must be 
 positioned via constraints.

Indeed I stated it exactly backwards, having confused myself for the same 
reason Graham pointed out with regard to the property's naming.  I was thinking 
that in such a case the reason setFrame: worked was precisely because the view 
didn't participate in auto-layout, rather than the opposite (the frame/mask 
being translated on an ongoing basis, not simply once at init time.)

b


___

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: Quickie about constraints

2014-08-15 Thread Ben Kennedy
On 15 Aug 2014, at 8:17 pm, Graham Cox graham@bigpond.com wrote:

 What I really want is that part of my view hierarchy to be free to use 
 -setFrame:, but other parts use the autolayout constraints normally. 

Can't you simply set translatesAutoresizingMaskIntoConstraints = NO on the 
views in question?  Then you should be free to manipulate such views' frames at 
will without interfering in any related constraints.

b


___

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

Backup eligibility (iCloud/iTunes) for iOS shared app group container

2014-08-13 Thread Ben Kennedy
Hello all,

What is the persistence and backup policy for files stored in an app group 
shared container on iOS 8 -- that is, the directory returned by -[NSFileManager 
containerURLForSecurityApplicationGroupIdentifier:] ?

More specifically, can I treat this directory in a similar manner as the app's 
regular Documents directory such as returned by [[NSFileManager defaultManager] 
URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] ? (In 
particular, the latter is preserved in user backups via iTunes or iCloud.)

The “iOS Data Storage Guidelines” 
https://developer.apple.com/icloud/documentation/data-storage/index.html do 
not address this, nor do its linked references.

We're developing an Action Extension and my desire is to maintain some 
persistent shared data between the extension and the containing app, and 
migrating from the Documents directory to the shared container seems like the 
reasonably obvious thing to do.

thanks,

-ben



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: iBeacons - can 100 different devices be active and seen by one device?

2014-07-18 Thread Ben Kennedy
We did almost exactly what David's describing at the NSNorth conference this 
spring.  There were about a hundred attendees, and everyone was given an 
iBeacon that belonged to someone else; using the accompanying conference app, 
which employed a crude proximity meter (based on RSSI level), we had to figure 
out who had our beacon in order to get it back.  Similarly, it was possible to 
monitor the presence and levels from every conference beacon in the room.

The limitation that Jim alludes to is that CoreLocation supports monitoring a 
max of 20 regions.  However in iBeacon terms a region corresponds to a beacon 
UUID, and in the scenario you envision you'll likely only have one.  At NSNorth 
all of the iBeacons were configured with a common UUID, but were differentiated 
by distinct major / minor ID numbers (which are exposed as NSNumber in the API; 
I'm not sure what the practical range is but surely quite a number of bits).

Having said this, determining the relative proximity based solely on RSSI 
didn't seem to be particularly straightforward in practice, especially if there 
a bunch of them nearby.

cheers,

-ben


 On 17 Jul 2014, at 7:33 am, Jim Adams jim.ad...@sas.com wrote:
 
 I think there is a limit of 20 iBeacons that you could range for. Android can 
 see them all but iPhone limits you.
 
 -Original Message-
 From: cocoa-dev-bounces+jim.adams=sas@lists.apple.com 
 [mailto:cocoa-dev-bounces+jim.adams=sas@lists.apple.com] On Behalf Of 
 David Hoerl
 Sent: Wednesday, July 16, 2014 3:34 PM
 To: Cocoa
 Subject: iBeacons - can 100 different devices be active and seen by one 
 device?
 
 I was talking to someone about an idea of giving everyone at a gathering
 - say 100 people - iBeacon pendants. An app would have a translation of 
 everyone there along with their beacon ID, and show the 10 closest people to 
 any given iOS device..
 
 Would iOS be capabile of detecting 100 or so active devices? Or would this 
 swamp the OS resulting in sporatic results?
 
 This is obviously somewhat difficult to test without first purchasing
 100 devices...
 
 David
 ___
 
 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/jim.adams%40sas.com
 
 This email sent to jim.ad...@sas.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/ben%40zygoat.ca
 
 This email sent to b...@zygoat.ca


___

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: [NSMutableData resetDataRangeTo:(NSRange)range];

2014-07-14 Thread Ben Kennedy

On 14 Jul 2014, at 11:12 am, Carl Hoefs newsli...@autonomy.caltech.edu wrote:

 Okay, now if I want to insert 1024 bytes of new data at the beginning of a 
 populated NSMutableArray, is there a better way than this:

Sure; why not just do [bigMData replaceBytesInRange:NSMakeRange(0,0) 
withBytes:newBytesPtr length:1024]; ...?

-ben


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: [NSMutableData resetDataRangeTo:(NSRange)range];

2014-07-14 Thread Ben Kennedy
On 14 Jul 2014, at 11:30 am, Carl Hoefs newsli...@autonomy.caltech.edu wrote:

 [bigMData replaceBytesInRange:NSMakeRange(0,0) withBytes:newBytesPtr 
 length:1024];
 
 Wow, that's damn clever! My thinking is so clunky. It never would have 
 occurred to me that NSMutableData could expand (0,0) into (0,1024) out of 
 thin air! Awesome!

Well, it's basically the inverse of your first question, for which Matt Gough 
already provided the answer.

NSMutableData's method is well designed and well named because it does exactly 
as it implies: replaces some range of data (whatever size) with another chunk 
of data (whatever size).

-ben


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

unsubscribe

2014-05-27 Thread Ben Kazez

On May 27, 2014, at 3:41 PM, cocoa-dev-requ...@lists.apple.com wrote:

 Send Cocoa-dev mailing list submissions to
   cocoa-dev@lists.apple.com
 
 To subscribe or unsubscribe via the World Wide Web, visit
   https://lists.apple.com/mailman/listinfo/cocoa-dev
 or, via email, send a message with subject or body 'help' to
   cocoa-dev-requ...@lists.apple.com
 
 You can reach the person managing the list at
   cocoa-dev-ow...@lists.apple.com
 
 When replying, please edit your Subject line so it is more specific
 than Re: Contents of Cocoa-dev digest...
 
 
 Today's Topics:
 
   1. Mutating NSLayoutConstraint -constant at run time
  (Jonathan Mitchell)
   2. Re: EXC_BAD_ACCESS in NSData (Jens Alfke)
   3. Re: EXC_BAD_ACCESS in NSData (Graham Cox)
   4. Re: EXC_BAD_ACCESS in NSData (Jens Alfke)
   5. Re: EXC_BAD_ACCESS in NSData (Uli Kusterer)
   6. Re: EXC_BAD_ACCESS in NSData (Graham Cox)
   7. Re: EXC_BAD_ACCESS in NSData (Charles Srstka)
   8. Re: Understanding ARC (Jamie Ojomoh)
   9. AVFoundation video not playing in root mode (Navneet Kumar)
  10. Re: AVFoundation video not playing in root mode (Kyle Sluder)
  11. Re: NSPopover + Bindings + Validation = Weirdness (Keary Suska)
 
 
 --
 
 Message: 1
 Date: Mon, 26 May 2014 21:41:14 +0100
 From: Jonathan Mitchell jonat...@mugginsoft.com
 To: Cocoa-dev@lists.apple.com cocoa-dev@lists.apple.com
 Subject: Mutating NSLayoutConstraint -constant at run time
 Message-ID: 4f5f24ec-b49b-4814-b250-1d3657ade...@mugginsoft.com
 Content-Type: text/plain; charset=us-ascii
 
 So:
 
 1. I have a NSView V within a view hierarchy.
 2. V holds a layout constraint C that offsets a subview S from the bottom 
 edge of V.
 3. At runtime I mutate -constant on constraint C.
 
 The question is should the view hierarchy automatically recalculate its 
 layout in response to changing the constant on C?
 
 In practice I find that I have to call -layoutSubtreeIfNeeded on a superview 
 of V.
 I do not have to call -setNeedsLayout:YES
 
 Note:
 
 My actual implementation is more complex than the above.
 V exists with an NSStackView subclass, so there are a lot of constraints at 
 play.
 However, if I can clarify the above it will help my thinking.
 
 
 Jonathan
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 --
 
 Message: 2
 Date: Mon, 26 May 2014 15:06:25 -0700
 From: Jens Alfke j...@mooseyard.com
 To: Pax 45rpmli...@googlemail.com
 Cc: Mailing Lists cocoa-dev@lists.apple.com
 Subject: Re: EXC_BAD_ACCESS in NSData
 Message-ID: ceb2baa8-1b6b-4cd8-9dc7-832681a89...@mooseyard.com
 Content-Type: text/plain; charset=windows-1252
 
 
 On May 26, 2014, at 6:02 AM, Pax 45rpmli...@googlemail.com wrote:
 
 When this gets run, I get EXC_BAD_ACCESS code = 2 here.  I'm demonstrably 
 reading less data than the file contains, and I've been able to read through 
 the file successfully up to this point.  Please could someone suggest to me 
 what might be going wrong here?
 
 Use the debugger to look at the values of the relevant variables, especially 
 dataSize.
 Since the result is a crash instead of an exception, the NSRange you create 
 is valid; so I assume it’s just larger than your buffer so the copy runs off 
 the end into unmapped address space.
 
 Also, what exactly is the type of ‘bytes’? If it’s a pointer to a malloced 
 buffer, you shouldn’t be passing its address, rather its value, otherwise 
 you’re going to copy into the stack and blow up.
 
 —Jens
 
 --
 
 Message: 3
 Date: Tue, 27 May 2014 09:20:13 +1000
 From: Graham Cox graham@bigpond.com
 To: Roland King r...@rols.org
 Cc: Cocoa Cocoa-Dev cocoa-dev@lists.apple.com
 Subject: Re: EXC_BAD_ACCESS in NSData
 Message-ID: b27a4b0c-36ec-4463-a597-04122c805...@bigpond.com
 Content-Type: text/plain; charset=us-ascii
 
 
 On 27 May 2014, at 12:54 am, Roland King r...@rols.org wrote:
 
 datasize = *((unsigned int*)bytes); 
 
 is a bit closer to what you might want but is endian-unaware. 
 
 That's just as wrong - you are using the first few bytes of the data as the 
 length, which it certainly isn't (except for possibly a very few special 
 cases that just so happen to have the length as the first field of the data).
 
 --Graham
 
 
 
 
 
 --
 
 Message: 4
 Date: Mon, 26 May 2014 17:13:48 -0700
 From: Jens Alfke j...@mooseyard.com
 To: Graham Cox graham@bigpond.com
 Cc: Cocoa Cocoa-Dev cocoa-dev@lists.apple.com
 Subject: Re: EXC_BAD_ACCESS in NSData
 Message-ID: 05afe4be-c81e-4cdc-bf72-66f1eb432...@mooseyard.com
 Content-Type: text/plain; charset=windows-1252
 
 
 On May 26, 2014, at 4:20 PM, Graham Cox graham@bigpond.com wrote:
 
 That's just as wrong - you are using the first few bytes of the data as the 
 length, which it certainly isn't (except for possibly a very few special 
 cases that just so happen to have the length as the first field of the data).
 
 No, it’s 

Re: Black treatment showing when an iOS 7 only application is in the background

2014-05-27 Thread Ben Kennedy
On 27 May 2014, at 11:52 am, Alex Zavatone z...@mac.com wrote:

 But, it appears that even when using Inferred for view controllers' 
 Simulated Metrics, Inferred is being ignored and is being replaced with Black 
 Opaque.  

I thought that the simulated metrics stuff in IB were exactly that -- 
simulated, solely within the context of IB, and not beyond.

Are you actually setting the desired characteristics in code?

cheers,

-b


___

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 are the errors in NSOSStatusErrorDomain defined?

2014-05-21 Thread Ben Kennedy
If that is indeed the context in which Gerriet is receiving the error, it 
sounds as though the routine generating it is assigning an inappropriate error 
domain then, no? Surely it should be a CoreAudio-related domain (specifically 
for the reason illustrated by this thread). 

b

Sent from my iPhone

 On May 21, 2014, at 10:34 PM, Roland King r...@rols.org wrote:
 
 and of course as soon as I sent the message I do in fact find it
 
 AudioToolbox.framework/Headers/AudioSession.h
 
 
 On 22 May, 2014, at 1:32 pm, Roland King r...@rols.org wrote:
 
 560030580 = 0x21616374 which is '!act'
 
 I believe that's the pattern for Audio stuff, you turn it to a 4-char 
 string. 
 
 There's a rumour on the internet that used to be kAudioSessionNotActiveError 
 but I'm banana-ed if I can find that in the current SDK. 
 
 On 22 May, 2014, at 1:17 pm, Gerriet M. Denkmann gerr...@mdenkmann.de 
 wrote:
 
 Got an NSError with:
 
 Error Domain=NSOSStatusErrorDomain Code=560030580 The operation couldn’t 
 be completed. (OSStatus error 560030580.)
 
 Have:
if ( [ [ outError domain ] isEqualToString: NSOSStatusErrorDomain ]
 [ outError code ] == 560030580 )
 
 but would like to have:
if ( [ [ outError domain ] isEqualToString: NSOSStatusErrorDomain ]
 [ outError code ] == NSSomeErrorEnum )
 
 Where to look for this?
 
 Gerriet.
 
 iOS 7.1.1
 
 
 ___
 
 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/rols%40rols.org
 
 This email sent to r...@rols.org
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/ben%40zygoat.ca
 
 This email sent to b...@zygoat.ca

___

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: Client certificate extraction out of SSL/TLS Connection on server side

2014-05-15 Thread Ben Kennedy
As a workaround, couldn't you just empirically determine the value of that 
constant (presuming it hasn't changed in five years and is not expected to 
change), and then define a new constant of your own accordingly?

b

Sent from my iPhone

 On May 15, 2014, at 1:06 PM, Jens Alfke j...@mooseyard.com wrote:
 
 I went back and looked into some earlier code of mine that can do this (the 
 MYNetwork framework, available on Github). The good news is that I know what 
 stream property to set. The bad news is that it’s not in any public header, 
 even though this omission has been known for five years or more. And the 
 really bad news is that using the constant this way will invalidate your app 
 from the iOS or Mac app store :(
 
 #if !TARGET_OS_IPHONE
 // You can't do client-side SSL auth using CFStream without this constant,
 // but it was accidentally not declared in a public header.
 // Unfortunately you can't use this on iPhone without Apple rejecting your app
 // for using private API. :-(
 extern const CFStringRef _kCFStreamPropertySSLClientSideAuthentication; // in 
 CFNetwork
 #endif
 
 —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/ben%40zygoat.ca
 
 This email sent to b...@zygoat.ca

___

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

Type of text field used by Xcode's Jump to Line?

2014-05-13 Thread Ben Golding

In an app I'm working on, I'd like to use a very basic text input field just 
like the one used by Xcode's NavigateJump in File (aka, cmd-L) but I don't 
know what it's called so I can't look it up.  Could someone let me know what 
it's called?

Thanks,

Ben.

smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Type of text field used by Xcode's Jump to Line?

2014-05-13 Thread Ben Golding

On 14 May 2014, at 11:52 am, Kyle Sluder k...@ksluder.com wrote:

 On May 13, 2014, at 6:31 PM, Ben Golding b...@object-craft.com.au wrote:
 
 In an app I'm working on, I'd like to use a very basic text input field just 
 like the one used by Xcode's NavigateJump in File (aka, cmd-L) but I 
 don't know what it's called so I can't look it up.  Could someone let me 
 know what it's called?
 
 You’re going to have to be more specific. What aspect of Jump to Line are you 
 looking to replicate?
 
 If it’s just the bits that convert keypresses to glyphs on the screen, that’s 
 just an NSTextField.
 
 If it’s the fact that it floats above the main editor window, you can just 
 create a borderless NSWindow and put your NSTextField in it.
 
 If it’s the autocompletion and resulting grow/shrink behavior, that is 
 completely custom.

It's the borderless NSWindow with an NSTextField in it.  That's what I was 
looking for, thanks.

Ben.

smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

NSTextFinder vs NSTableView -- mano a mano showdown

2014-04-15 Thread Ben Golding

I was wondering whether anyone has managed to get NSTextFinder to work with 
NSTableView so that it will search through the table contents, highlighting the 
fields that match.  The NSTextFinder documentation is difficult to understand 
and mixes its use searching with NSTextView in with the more general case so 
that it's difficult to follow.  There seem to be precious few guides and no 
tutorials or examples around.

I'm specifically after how to set up the NSTextFinder's client (really a 
delegate) properties firstSelectedRange, selectedRanges and 
visibleSelectedRanges.  Are they maintained by the NSTextFinder instance or are 
is the client expected to update them, and if so, to what?  Do I need to 
implement rectsForCharacterRange: in the client?  If so, how do I calculate the 
rects in NSTableView?

I feel like I've done all the hard work implementing 
stringAtIndex:effectiveRange:endsWithSearchBoundary: but the easy stuff is 
holding me up.

Also, is there any built in support for recognising when the tableview's 
content has been changed by the user and regenerating an index?  At present I'm 
just scanning through the table rather than building an index at all.

And geez it would be nice if there was a way for it to offer a regular 
expression option for power users.

Thanks,

Ben.

smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Remove redundant AM/PM when formatting a time range?

2014-04-15 Thread Ben Kazez
 I’m trying to create a compact time range format, like “2am-4pm” or 
 “2-5:30pm”. I am constructing the format string using 
 -dateFormatFromTemplate:options:locale:, omitting the minutes from the 
 template if that component is zero. Is there an internationalization-safe 
 way that I can remove the AM/PM from one of the times if it is redundant? 
 What about the space, if a locale considers that space optional?
 
 Can you do this by making the format strings themselves localizable? For 
 instance you might have special format string IDs for use when both times are 
 AM or both PM, one for the first time and one for the second. The localizer 
 can then decide which of those two format strings should drop the AM/PM 
 indicator.

Hi Jens,

Thanks for the quick reply! This should work great, but do you know if there's 
a good way to let localizers use the system-provided localized format as a 
starting point, for more consistency? Perhaps it would be simpler to simply 
split the formatted time strings on   -- not the correct solution, to be 
sure, but it seems to work in a wide range of locales.

Ben
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Retain count in non ARC

2014-04-06 Thread Ben Kennedy
On 06 Apr 2014, at 8:44 pm, Graham Cox graham@bigpond.com wrote:

 I thought about mentioning it, but figured it might already sound a bit 
 complicated. Isn't 'nonatomic' the default? If not, I can't actually find the 
 documentation about it. Also, if 'atomic' is the default, won't performance 
 suffer with all those unnecessary locks?

It is for these two reasons that, from years of conditioning, I can watch my 
fingers type (nonatomic  automatically and as if my magic as soon as I finish 
typing @property  ...

The atomic vs. nonatomic default is a peculiarity of Obj-C that never seemed to 
be well documented or explained when properties were first introduced.

b

--
Ben Kennedy, chief magician
Zygoat Creative Technical Services
http://www.zygoat.ca


___

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

  1   2   3   4   5   6   7   >