Re: API to determine status of System Integrity Protection?

2015-09-14 Thread Jean-Daniel Dupas

> Le 14 sept. 2015 à 01:33, Ed Wynne  a écrit :
> 
> 
> On Sep 13, 2015, at 5:47 PM, Stephane Sudre  wrote:
> That document doesn't mention an API…
 Hence, since that is the current documentation, my conclusion : “Don’t 
 think so”.
>>> There is an API. Much like with sandboxing it just may not be public, which 
>>> means it is inappropriate for discussion here. I’m not sure why Apple 
>>> considers this kind of thing off limits, but that is inappropriate for 
>>> discussion here as well.
>> 
>> I must be missing something but why should there be an API?
> 
> There are many reasons. For example, writing to the areas SIP protects 
> typically requires authorization. Not offering the user an impossible action 
> is a much better UX than letting them go through the trouble of 
> authenticating only to have it fail anyway.

No trying to write in a protected area in the first place is even better. You 
don’t need to check, just don’t do it.

> 
>> - determining whether SIP is on requires to check whether the running
>> OS on 10.11 or later.
> 
> This check is not sufficient since SIP can be disabled.
> 
>> Also it could done by parsing the output of $
>> csrutil status but this would assume the output format will not change
>> in the future.
> 
> Exactly, which makes this a bad option.
> 
>> - determining whether you can write to a file or folder can be done
>> with the usual BSD, Cocoa APIs, can't it?
> 
> Yes and no. Not having the beta (er, GM seed) handy to check, I honestly 
> don’t know if the R/W file system permissions are reported differently when 
> SIP is present and enabled. Based on how sandboxing operates, I would assume 
> they are not.
> 
> But that isn’t to say some things won’t be detectably different, which was 
> the point of my suggestion about secondary checks. They might be possible, 
> but they are still a bad option since they usually fall into the category of 
> undocumented side effects. 
> 
>> - knowing which parts of the file hierarchy are protected is covered
>> by the documentation (Interestingly I've just discovered that
>> /Applications/Utilities is a no trespassing area).
> 
> 
> Except they aren’t protected when SIP is disabled, which was the point of the 
> OP’s question.
> 
> -Ed
> 
> ___
> 
> 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/mailing%40xenonium.com
> 
> This email sent to mail...@xenonium.com


___

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

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

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

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

Re: Adding Constraints in Code

2015-09-14 Thread Iain Holmes

> On 14 Sep 2015, at 10:35 am, Dave  wrote:
> 
> Hi All,
> 
> I’m trying to add Constraints to a View in order to have it stretch to the 
> left and right edges of the superview. This is slight complicated by it being 
> in a ScrollView/Stack View Combo as so:
> 
> 
> NSScrollView  Setup in NIB
>   NSFlippedClipView   Setup in NIB
>   NSStackView Setup in NIB
>   LTWDetailXView  (added dynamically in code).
> 
> 
> The Detail View is smaller in Width than the  NSScrollView/NSStackView and I 
> want it to stretch to fit it.
> 
> I tried adding the following constraints in code as follows:
> 
> myDetailView = [myDetailViewController getPrimaryView];
> [self.pValidationListStackView addView:myDetailView 
> inGravity:NSStackViewGravityTop];
> 
> myConstraintsViewDictionary = [[NSMutableDictionary alloc] init];
> [myConstraintsViewDictionary setObject:self.pValidationListStackView 
> forKey:@"StackView"];
> [myConstraintsViewDictionary setObject:myDetailView forKey:@"DetailView"];
>   
> myConstraintsArray = [NSLayoutConstraint 
> constraintsWithVisualFormat:@"H:[StackView]-(<=1)-[DetailView]" 
> options:NSLayoutFormatAlignAllLeft metrics:nil 
> views:myConstraintsViewDictionary];
> [myDetailView addConstraints:myConstraintsArray];
>   
> myConstraintsArray = [NSLayoutConstraint 
> constraintsWithVisualFormat:@"H:[StackView]-(<=1)-[DetailView]" 
> options:NSLayoutFormatAlignAllRight metrics:nil 
> views:myConstraintsViewDictionary];
> [myDetailView addConstraints:myConstraintsArray];
> 
> But I get this Error Message:
> 
> Unable to parse constraint format: 
> Options mask required views to be aligned on a horizontal edge, which is not 
> allowed for layout that is also horizontal. 
> H:[StackView]-(<=1)-[DetailView] 
>^
> I’m not sure what this means or if the above code is correct?

The NSLayoutFormatAlignAllLeft says that all the views mentioned in the format 
string should be aligned along their left edges. Which isn’t possible if you 
want them to be laid out horizontally.
You should just use 0 for options.

However: StackView is the parent of DetailView so you should be using | as the 
superview, so simply doing something like this should work.

myConstraintsArray = [NSLayoutConstraint 
constraintsWithVisualFormat:@“H:|[DetailView]|" options:0 metrics:nil 
views:myConstraintsViewDictionary];
[myDetailView addConstraints:myConstraintsArray];

iain
___

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 Constraints in Code

2015-09-14 Thread Thomas Wetmore
This looks like you are trying to push both the stack view and the detail view 
to the left and to the right at the same time, inconsistent with the overall 
horizontal constraint.

Isn’t the error message indicating that there is something wrong with the 
provided options? I’d experiment with those options to see what happens.

Should you be using top and bottom instead?

Tom Wetmore


> On Sep 14, 2015, at 5:35 AM, Dave  wrote:
> 
> myConstraintsArray = [NSLayoutConstraint 
> constraintsWithVisualFormat:@"H:[StackView]-(<=1)-[DetailView]" 
> options:NSLayoutFormatAlignAllLeft metrics:nil 
> views:myConstraintsViewDictionary];
>   
> myConstraintsArray = [NSLayoutConstraint 
> constraintsWithVisualFormat:@"H:[StackView]-(<=1)-[DetailView]" 
> options:NSLayoutFormatAlignAllRight metrics:nil 
> views:myConstraintsViewDictionary];


___

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: Identifying a specific Mac model

2015-09-14 Thread Marek Hrušovský
Those new images are simply not where they should be: "
/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/"

I think your only way is to grab serial code and scrape the image that is
displayed here:
https://selfsolve.apple.com/agreementWarrantyDynamic.do


e.g. It shows color of my iPhone. I can't verify the new macbooks.
In any case Yosemite/Mavericks is not getting any update so don't expect
you will see those icons on older systems.

On Mon, Sep 14, 2015 at 1:11 PM, Jean-Daniel Dupas 
wrote:

>
> > Le 14 sept. 2015 à 12:16, sqwarqDev  a écrit :
> >
> >
> > On 14 Sep 2015, at 01:09, John Daniel 
> wrote:
> >
> >>
> >> MacBook8,1 covers all colours of the new MacBook.
> >> I am trying to differentiate the silver, from the space grey, from the
> gold.
> >
> > Since the machines are physically identical save the paint job, I don’t
> think anything like sysctl or any other hardware identifier is going to
> help you. The only difference I’d imagine between a silver and gold MB
> would be the catalogue/product number. For example, Mactracker has the
> following order numbers for the 2015 MB:
> >
> >> MF855LL/A (1.1 GHz with 256 GB storage, Silver) MK4M2LL/A (1.1 GHz with
> 256 GB storage, Gold) MJY32LL/A (1.1 GHz with 256 GB storage, Space Gray)
> MF865LL/A (1.2 GHz with 512 GB storage, Silver) MK4N2LL/A (1.2 GHz with 512
> GB storage, Gold) MJY42LL/A (1.2 GHz with 512 GB storage, Space Gray)
> >
> > The chances of this being coded into the machine itself I’d imagine are
> zero. If that’s right, then the best you can do is ask your user to enter
> that information in order to display the correct icon. In lieu of that,
> your only option is to display a generic icon for the model identifier that
> you find in the usual way(s).
> >
>
>
> Apple used to display the right color for iPod icons, why wouldn’t they do
> it too for new MacBook network icon. Especially as the three variants are
> present in the System icons. I’m pretty sure the color is coded somewhere
> in the machine.
> ___
>
> 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/xhruso00%40gmail.com
>
> This email sent to xhrus...@gmail.com
>
___

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

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

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

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

Re: Identifying a specific Mac model

2015-09-14 Thread Pascal J. Bourguignon



On 14/09/15 13:11, Jean-Daniel Dupas wrote:
Apple used to display the right color for iPod icons, why wouldn’t 
they do it too for new MacBook network icon. Especially as the three 
variants are present in the System icons. I’m pretty sure the color is 
coded somewhere in the machine.


Not necessarily. I mean, not hard coded; for example, they could easily 
use the webcam during the flipping open of the laptop to identify the 
anodization color and keep it in RAM all the time.  You would have a 
harder time having your own code running at the right moment, but you 
could always ask the user to flip the screen down until you can see the 
trackpad.


You can test my theory, by inserting a picture of another anodization 
color over the trackpad before opening the MacBook, and see if the icon 
color changes.


--
__Pascal J. Bourguignon__
http://www.informatimago.com/

___

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

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

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

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

Re: Identifying a specific Mac model

2015-09-14 Thread Jean-Daniel Dupas

> Le 14 sept. 2015 à 12:16, sqwarqDev  a écrit :
> 
> 
> On 14 Sep 2015, at 01:09, John Daniel  wrote:
> 
>> 
>> MacBook8,1 covers all colours of the new MacBook.
>> I am trying to differentiate the silver, from the space grey, from the gold.
> 
> Since the machines are physically identical save the paint job, I don’t think 
> anything like sysctl or any other hardware identifier is going to help you. 
> The only difference I’d imagine between a silver and gold MB would be the 
> catalogue/product number. For example, Mactracker has the following order 
> numbers for the 2015 MB:
> 
>> MF855LL/A (1.1 GHz with 256 GB storage, Silver) MK4M2LL/A (1.1 GHz with 256 
>> GB storage, Gold) MJY32LL/A (1.1 GHz with 256 GB storage, Space Gray) 
>> MF865LL/A (1.2 GHz with 512 GB storage, Silver) MK4N2LL/A (1.2 GHz with 512 
>> GB storage, Gold) MJY42LL/A (1.2 GHz with 512 GB storage, Space Gray)
> 
> The chances of this being coded into the machine itself I’d imagine are zero. 
> If that’s right, then the best you can do is ask your user to enter that 
> information in order to display the correct icon. In lieu of that, your only 
> option is to display a generic icon for the model identifier that you find in 
> the usual way(s).
> 


Apple used to display the right color for iPod icons, why wouldn’t they do it 
too for new MacBook network icon. Especially as the three variants are present 
in the System icons. I’m pretty sure the color is coded somewhere in the 
machine.
___

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 Constraints in Code

2015-09-14 Thread Iain Holmes

> On 14 Sep 2015, at 11:58 am, Iain Holmes  wrote:
> 
>> 
>> On 14 Sep 2015, at 10:35 am, Dave  wrote:
>> 
>> Hi All,
>> 
>> I’m trying to add Constraints to a View in order to have it stretch to the 
>> left and right edges of the superview. This is slight complicated by it 
>> being in a ScrollView/Stack View Combo as so:
>> 
>> 
>> NSScrollView Setup in NIB
>>  NSFlippedClipView   Setup in NIB
>>  NSStackView Setup in NIB
>>  LTWDetailXView  (added dynamically in code).
>> 
>> 
>> The Detail View is smaller in Width than the  NSScrollView/NSStackView and I 
>> want it to stretch to fit it.
>> 
>> I tried adding the following constraints in code as follows:
>> 
>> myDetailView = [myDetailViewController getPrimaryView];
>> [self.pValidationListStackView addView:myDetailView 
>> inGravity:NSStackViewGravityTop];
>> 
>> myConstraintsViewDictionary = [[NSMutableDictionary alloc] init];
>> [myConstraintsViewDictionary setObject:self.pValidationListStackView 
>> forKey:@"StackView"];
>> [myConstraintsViewDictionary setObject:myDetailView forKey:@"DetailView"];
>>  
>> myConstraintsArray = [NSLayoutConstraint 
>> constraintsWithVisualFormat:@"H:[StackView]-(<=1)-[DetailView]" 
>> options:NSLayoutFormatAlignAllLeft metrics:nil 
>> views:myConstraintsViewDictionary];
>> [myDetailView addConstraints:myConstraintsArray];
>>  
>> myConstraintsArray = [NSLayoutConstraint 
>> constraintsWithVisualFormat:@"H:[StackView]-(<=1)-[DetailView]" 
>> options:NSLayoutFormatAlignAllRight metrics:nil 
>> views:myConstraintsViewDictionary];
>> [myDetailView addConstraints:myConstraintsArray];
>> 
>> But I get this Error Message:
>> 
>> Unable to parse constraint format: 
>> Options mask required views to be aligned on a horizontal edge, which is not 
>> allowed for layout that is also horizontal. 
>> H:[StackView]-(<=1)-[DetailView] 
>>   ^
>> I’m not sure what this means or if the above code is correct?
> 
> The NSLayoutFormatAlignAllLeft says that all the views mentioned in the 
> format string should be aligned along their left edges. Which isn’t possible 
> if you want them to be laid out horizontally.
> You should just use 0 for options.
> 
> However: StackView is the parent of DetailView so you should be using | as 
> the superview, so simply doing something like this should work.
> 
> myConstraintsArray = [NSLayoutConstraint 
> constraintsWithVisualFormat:@“H:|[DetailView]|" options:0 metrics:nil 
> views:myConstraintsViewDictionary];
> [myDetailView addConstraints:myConstraintsArray];
> 

In fact, with NSStackView you should just be able to set the content hugging 
priority and it’ll just work

myDetailView = [myDetailViewController getPrimaryView];
[self.pValidationListStackView addView:myDetailView 
inGravity:NSStackViewGravityTop]; // NOTE: Should this not be GravityLeading as 
you’re using a horizontal stack view?
[myDetailView setContentHuggingPriority:NSLayoutPriorityDefaultLow 
forOrientation:NSLayoutConstraintOrientationHorizontal];

and that’s all you should need.

iain
___

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: Identifying a specific Mac model

2015-09-14 Thread sqwarqDev

On 14 Sep 2015, at 01:09, John Daniel  wrote:

> 
> MacBook8,1 covers all colours of the new MacBook.
> I am trying to differentiate the silver, from the space grey, from the gold.

Since the machines are physically identical save the paint job, I don’t think 
anything like sysctl or any other hardware identifier is going to help you. The 
only difference I’d imagine between a silver and gold MB would be the 
catalogue/product number. For example, Mactracker has the following order 
numbers for the 2015 MB:

> MF855LL/A (1.1 GHz with 256 GB storage, Silver) MK4M2LL/A (1.1 GHz with 256 
> GB storage, Gold) MJY32LL/A (1.1 GHz with 256 GB storage, Space Gray) 
> MF865LL/A (1.2 GHz with 512 GB storage, Silver) MK4N2LL/A (1.2 GHz with 512 
> GB storage, Gold) MJY42LL/A (1.2 GHz with 512 GB storage, Space Gray)

The chances of this being coded into the machine itself I’d imagine are zero. 
If that’s right, then the best you can do is ask your user to enter that 
information in order to display the correct icon. In lieu of that, your only 
option is to display a generic icon for the model identifier that you find in 
the usual way(s).


Best


Phil
___

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: Identifying a specific Mac model

2015-09-14 Thread John Daniel
Thanks for the responses. Unfortunately, Apple is way ahead of all of us.

The “Model Identifier” (MacBook8,1 et al.) is not sufficient to identify a 
particular model. It only identifies general families of models. All you have 
to do is go to My OWC (http://eshop.macsales.com/MyOWC/ 
), pick MacBook Pro, and look at the options. 

The system images are where they should be. I don’t understand Apple’s 
reasoning, but that is where Apple wants them. 

I don’t know if Apple even tracks the colour of the retina MacBooks. I don’t 
have one myself. I haven’t been able to find a serial number online. The serial 
number generator scripts posted online don’t generate valid serial numbers for 
this model. 

Scraping the Apple self-service warranty page might work, but I don’t have any 
MacBook serial numbers for testing. I really don’t want to parse HTML. Even so, 
people seem to treat serial numbers as personal information and might freak out 
if I start sending them over the internet. If I had a few serial numbers for 
testing, I would know more - or at least something.

I do extract the last 4 characters and send them to Apple’s support web 
services to get the “marketing name” like "MacBook (Retina, 12-inch, Early 
2015)”. But those names don’t seem to include colour. I know of a few different 
queries for Apple’s services for technical specifications, possible memory 
upgrades, OS name, and this marketing name. This is a true web service that 
returns parseable XML. I don’t know if there is any query that will give me the 
machine icon.

John Daniel

___

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 Constraints in Code

2015-09-14 Thread Dave
> 
> The NSLayoutFormatAlignAllLeft says that all the views mentioned in the 
> format string should be aligned along their left edges. Which isn’t possible 
> if you want them to be laid out horizontally.
> You should just use 0 for options.
> 
> However: StackView is the parent of DetailView so you should be using | as 
> the superview, so simply doing something like this should work.
> 
> myConstraintsArray = [NSLayoutConstraint 
> constraintsWithVisualFormat:@“H:|[DetailView]|" options:0 metrics:nil 
> views:myConstraintsViewDictionary];
> [myDetailView addConstraints:myConstraintsArray];
> 
> iain

I tred this:

myDetailView = [myDetailViewController getPrimaryView];
[self.pValidationListStackView addView:myDetailView 
inGravity:NSStackViewGravityTop];

myConstraintsViewDictionary = [[NSMutableDictionary alloc] init];
[myConstraintsViewDictionary setObject:self.pValidationListStackView 
forKey:@"StackView”];
[myConstraintsViewDictionary setObject:myDetailView 
forKey:@"DetailView”];

myConstraintsArray = [NSLayoutConstraint 
constraintsWithVisualFormat:@"H:|[DetailView]|" options:0 metrics:nil 
views:myConstraintsViewDictionary];
[myDetailView addConstraints:myConstraintsArray];

I assumeI don’t need to add StackView to the Dictionary but it won’t do any 
harm?

When I run the above I get this error:

Unable to install constraint on view.  Does the constraint reference something 
from outside the subtree of the view?  That's illegal. 
constraint: view:
](
0   CoreFoundation  0x7fff8f14f03c 
__exceptionPreprocess + 172
1   libobjc.A.dylib 0x7fff91a3076e 
objc_exception_throw + 43
2   CoreFoundation  0x7fff8f14eeed 
+[NSException raise:format:] + 205
3   Foundation  0x7fff8d9e5e4e 
-[NSLayoutConstraint 
_addToEngine:integralizationAdjustment:mutuallyExclusiveConstraints:] + 183
4   AppKit  0x7fff9529549c 
-[NSView(NSConstraintBasedLayout) 
_layoutEngine_didAddLayoutConstraint:integralizationAdjustment:mutuallyExclusiveConstraints:]
 + 89
5   AppKit  0x7fff952951eb 
-[NSView(NSConstraintBasedLayout) 
_tryToAddConstraint:integralizationAdjustment:mutuallyExclusiveConstraints:] + 
299
6   AppKit  0x7fff95294f77 
__50-[NSView(NSConstraintBasedLayout) addConstraints:]_block_invoke + 188
7   Foundation  0x7fff8d9f148e -[NSISEngine 
withBehaviors:performModifications:] + 155
8   AppKit  0x7fff951471aa 
-[NSView(NSConstraintBasedLayout) _withAutomaticEngineOptimizationDisabled:] + 
70
9   AppKit  0x7fff95186c6c 
-[NSView(NSConstraintBasedLayout) addConstraints:] + 279
10  ClassifierForMac0x000100013a3e 
-[LTWValidationWindowController awakeFromNib] + 2206
11  AppKit  0x7fff9513f079 
-[NSIBObjectData nibInstantiateWithOwner:options:topLevelObjects:] + 1276
12  AppKit  0x7fff9511e0e5 loadNib + 384
13  AppKit  0x7fff9511d60b 
+[NSBundle(NSNibLoading) _loadNibFile:nameTable:options:withZone:ownerBundle:] 
+ 313
14  AppKit  0x7fff952ccbf7 
+[NSBundle(NSNibLoadingInternal) 
_loadNibFile:externalNameTable:options:withZone:] + 150
15  AppKit  0x7fff952cc99d 
-[NSWindowController loadWindow] + 313
16  AppKit  0x7fff952c7b65 
-[NSWindowController window] + 80
17  ClassifierForMac0x000100013cc3 
-[LTWValidationWindowController startUp] + 51
18  ClassifierForMac0x00010003d1b7 
-[BJDebugWindowController performTestGUI:] + 375
19  libsystem_trace.dylib   0x7fff8e4ebcd7 
_os_activity_initiate + 75
20  AppKit  0x7fff95367eb1 
-[NSApplication sendAction:to:from:] + 452
21  AppKit  0x7fff9537d946 -[NSControl 
sendAction:to:] + 86
22  AppKit  0x7fff9537d862 __26-[NSCell 
_sendActionFrom:]_block_invoke + 131
23  libsystem_trace.dylib   0x7fff8e4ebcd7 
_os_activity_initiate + 75
24  AppKit  0x7fff9537d7bf -[NSCell 
_sendActionFrom:] + 144
25  libsystem_trace.dylib   0x7fff8e4ebcd7 
_os_activity_initiate + 75
26  AppKit  0x7fff9537bcb3 -[NSCell 
trackMouse:inRect:ofView:untilMouseUp:] + 2821
27  AppKit  0x7fff953d434f 
-[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 770
  

Re: API to determine status of System Integrity Protection?

2015-09-14 Thread Ed Wynne

On Sep 14, 2015, at 7:05 AM, Jean-Daniel Dupas  wrote:

>> Le 14 sept. 2015 à 01:33, Ed Wynne  a écrit :
>> On Sep 13, 2015, at 5:47 PM, Stephane Sudre  wrote:
>> That document doesn't mention an API…
> Hence, since that is the current documentation, my conclusion : “Don’t 
> think so”.
 There is an API. Much like with sandboxing it just may not be public, 
 which means it is inappropriate for discussion here. I’m not sure why 
 Apple considers this kind of thing off limits, but that is inappropriate 
 for discussion here as well.
>>> 
>>> I must be missing something but why should there be an API?
>> 
>> There are many reasons. For example, writing to the areas SIP protects 
>> typically requires authorization. Not offering the user an impossible action 
>> is a much better UX than letting them go through the trouble of 
>> authenticating only to have it fail anyway.
> 
> No trying to write in a protected area in the first place is even better. You 
> don’t need to check, just don’t do it.

For the most part, this is true… and even more true as time goes by and Apple 
gives us better alternatives.

The problem is that OS X is a complex mature ecosystem that already has 
advanced and potentially non-app/user oriented software that needs to do stuff 
like this. The non-negotiable mandate of “don’t do that” isn’t always as simple 
to deal with as you might expect.

-Ed

___

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 Constraints in Code

2015-09-14 Thread Dave

> 
> In fact, with NSStackView you should just be able to set the content hugging 
> priority and it’ll just work
> 
> myDetailView = [myDetailViewController getPrimaryView];
> [self.pValidationListStackView addView:myDetailView 
> inGravity:NSStackViewGravityTop]; // NOTE: Should this not be GravityLeading 
> as you’re using a horizontal stack view?
> [myDetailView setContentHuggingPriority:NSLayoutPriorityDefaultLow 
> forOrientation:NSLayoutConstraintOrientationHorizontal];
> 
> and that’s all you should need.
> 
> iain

I tried that and it had no effect. When I resize the window the Scroll View 
Resizes (and I assume the StackView?) but the Detail View stays the same size - 
e.g. does not move with the right edge of the Scroll View.

Cheers
Dave



___

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

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

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

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

Re: Identifying a specific Mac model

2015-09-14 Thread Maxthon Chan
It is encoded but only in the serial number, which you have no access to, and 
have almost no way to map back.

> On Sep 14, 2015, at 18:16, sqwarqDev  wrote:
> 
> 
> On 14 Sep 2015, at 01:09, John Daniel  wrote:
> 
>> 
>> MacBook8,1 covers all colours of the new MacBook.
>> I am trying to differentiate the silver, from the space grey, from the gold.
> 
> Since the machines are physically identical save the paint job, I don’t think 
> anything like sysctl or any other hardware identifier is going to help you. 
> The only difference I’d imagine between a silver and gold MB would be the 
> catalogue/product number. For example, Mactracker has the following order 
> numbers for the 2015 MB:
> 
>> MF855LL/A (1.1 GHz with 256 GB storage, Silver) MK4M2LL/A (1.1 GHz with 256 
>> GB storage, Gold) MJY32LL/A (1.1 GHz with 256 GB storage, Space Gray) 
>> MF865LL/A (1.2 GHz with 512 GB storage, Silver) MK4N2LL/A (1.2 GHz with 512 
>> GB storage, Gold) MJY42LL/A (1.2 GHz with 512 GB storage, Space Gray)
> 
> The chances of this being coded into the machine itself I’d imagine are zero. 
> If that’s right, then the best you can do is ask your user to enter that 
> information in order to display the correct icon. In lieu of that, your only 
> option is to display a generic icon for the model identifier that you find in 
> the usual way(s).
> 
> 
> Best
> 
> 
> Phil
> ___
> 
> 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/max%40maxchan.info
> 
> This email sent to m...@maxchan.info



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: Identifying a specific Mac model

2015-09-14 Thread Jean-Daniel Dupas

> Le 14 sept. 2015 à 15:53, John Daniel  a 
> écrit :
> 
> Thanks for the responses. Unfortunately, Apple is way ahead of all of us.
> 
> The “Model Identifier” (MacBook8,1 et al.) is not sufficient to identify a 
> particular model. It only identifies general families of models. All you have 
> to do is go to My OWC (http://eshop.macsales.com/MyOWC/ 
> ), pick MacBook Pro, and look at the 
> options. 
> 
> The system images are where they should be. I don’t understand Apple’s 
> reasoning, but that is where Apple wants them. 
> 
> I don’t know if Apple even tracks the colour of the retina MacBooks. I don’t 
> have one myself. I haven’t been able to find a serial number online. The 
> serial number generator scripts posted online don’t generate valid serial 
> numbers for this model. 
> 
> Scraping the Apple self-service warranty page might work, but I don’t have 
> any MacBook serial numbers for testing. I really don’t want to parse HTML. 
> Even so, people seem to treat serial numbers as personal information and 
> might freak out if I start sending them over the internet. If I had a few 
> serial numbers for testing, I would know more - or at least something.
> 
> I do extract the last 4 characters and send them to Apple’s support web 
> services to get the “marketing name” like "MacBook (Retina, 12-inch, Early 
> 2015)”. But those names don’t seem to include colour. I know of a few 
> different queries for Apple’s services for technical specifications, possible 
> memory upgrades, OS name, and this marketing name. This is a true web service 
> that returns parseable XML. I don’t know if there is any query that will give 
> me the machine icon.
> 

If you just want to current machine icon, just use + [NSImage 
imageNamed:NSImageNameComputer]



___

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 Constraints in Code

2015-09-14 Thread Dave

> On 14 Sep 2015, at 17:39, Thomas Wetmore  wrote:
> 
> 
>> On Sep 14, 2015, at 11:54 AM, Dave  wrote:
>> 
>> I tred this:
>> 
>>  myDetailView = [myDetailViewController getPrimaryView];
>>  [self.pValidationListStackView addView:myDetailView 
>> inGravity:NSStackViewGravityTop];
>> 
>>  myConstraintsViewDictionary = [[NSMutableDictionary alloc] init];
>>  [myConstraintsViewDictionary setObject:self.pValidationListStackView 
>> forKey:@"StackView”];
>>  [myConstraintsViewDictionary setObject:myDetailView 
>> forKey:@"DetailView”];
>> 
>>  myConstraintsArray = [NSLayoutConstraint 
>> constraintsWithVisualFormat:@"H:|[DetailView]|" options:0 metrics:nil 
>> views:myConstraintsViewDictionary];
>>  [myDetailView addConstraints:myConstraintsArray];
>> 
>> I assumeI don’t need to add StackView to the Dictionary but it won’t do any 
>> harm?
>> 
>> When I run the above I get this error:
>> 
>> Unable to install constraint on view.  Does the constraint reference 
>> something from outside the subtree of the view?  That’s illegal. 
>> constraint:> (Names: LTWDetailXView:0x608000181930, 
>> '|':NSStackViewContainer:0x631a0540 )> view:> 0x608000181930>
> 
> The error message is saying that either your detail view or its container 
> view are not within the view tree of the receiver’s or any of the receiver’s 
> ancestors’ view trees. You need to figure out whether that is or is not true. 
> I tend to believe error messages until they are proven wrong. They are my 
> friends.
> 

If you look at the code, I’ve just added the DetailView to the StackView, so by 
definition DetailView is a Subview of StackView isn’t it?

>> Any idea what could be wrong?
> 
> Yes — I would believe the error message and assume that the constraint 
> references something from outside the subtree of the view. This would mean 
> that, at the point you are trying to add the constraints, either you haven’t 
> built the full view structure yet, or the structure you have built isn’t what 
> you think it is.

The structure was in my OP:

NSScrollViewSetup in NIB
NSFlippedClipView   Setup in NIB
NSStackView Setup in NIB
LTWDetailXView  (added dynamically in code).

Cheers
Dave


___

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

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

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

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

Re: Adding Constraints in Code

2015-09-14 Thread Dave
I’ve looked at that and have in fact based some of my code on it. Unfortunately 
InfoBarStackView isn’t very “real-world” and I can’t use it as is. This code 
works fine, I just need to know how to make a view added to a 
NSScrollView/StackVIew Combo stretch to the Right of the ScrollView.

The other constraints are setup more or less the same as as “InfoBarStackView” 
and I actually do have a View that works in that it stretches to fit the 
ScrollVIew in H when the window is resized. This view is setup as so:

LTWDetailYView
StackView
ControlViews added here.

LTWDetailXView
ControlViews added here.

This is added to the same StackView, e.g.

NSScrollViewSetup in NIB
NSFlippedClipView   Setup in NIB
NSStackView Setup in NIB
LTWDetailXView  (added dynamically in code).
LTWDetailYView  (added dynamically in code).  
*Stretches in H**

I’ve actually put out a DTS Incident on this, but have not heard anything back 
as yet. Does anyone know how long it usually takes them to get back to you?

All the Best
Dave




___

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

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

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

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

Re: Adding Constraints in Code

2015-09-14 Thread Gary L. Wade
Without digging into your code, it sounds like you've got some wrong 
assumptions of how things work and that you're doing way too much. Try taking 
Apple's example and iteratively add your own pieces:

https://developer.apple.com/library/mac/samplecode/InfoBarStackView/Introduction/Intro.html#//apple_ref/doc/uid/DTS40013589-Intro-DontLinkElementID_2
--
Gary L. Wade (Sent from my iPhone)
http://www.garywade.com/
___

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

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

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

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

Re: Adding Constraints in Code

2015-09-14 Thread Dave
Also, it displays the view if I comment out the constraints adding code, so I’m 
pretty sure detail view is setup ok.



___

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 Constraints in Code

2015-09-14 Thread Jonathan Hull
It looks like these are the constraints inside of the detailView (that hold 
it’s sub-parts together).  Doesn’t really tell us anything about the 
constraints holding the detailView itself in place...

Thanks,
Jon


> On Sep 14, 2015, at 12:21 PM, Dave  wrote:
> 
> These are the constraints on the detail view just after it has been added to 
> the StackView:
> 
> myDetailView.constraints: (
>" DetailHeaderView:0x631809c0, LTWDetailXView:0x6318, 
> '|':LTWDetailXView:0x6318 )>”,
> 
>" DetailBodyView.trailing   (Names: DetailHeaderView:0x631809c0, 
> DetailBodyView:0x621805b0 )>”,
> 
>" DetailBodyView.leading   (Names: DetailHeaderView:0x631809c0, 
> DetailBodyView:0x621805b0 )>”,
> 
>" DetailHeaderView:0x631809c0, LTWDetailXView:0x6318, 
> '|':LTWDetailXView:0x6318 )>”,
> 
>" LTWDetailXView:0x6318, DetailHeaderView:0x631809c0, 
> '|':LTWDetailXView:0x6318 )>”,
> 
>" LTWDetailXView:0x6318, DetailBodyView:0x621805b0, 
> '|':LTWDetailXView:0x6318 )>”,
> 
>" V:[DetailHeaderView]-(-2)-[DetailBodyView]   (Names: 
> DetailBodyView:0x621805b0, DetailHeaderView:0x631809c0 )>"
> )
> 
> Which look ok me me?
> 
> Cheers
> Dave
> 
>> On 14 Sep 2015, at 19:18, Jonathan Hull  wrote:
>> 
>> Oh yeah, it does on iOS, but not OS X.  Sorry about that.
>> 
>> On OS X, you need to layer back it and set the layer’s background color.
>> 
>> stackview.wantsLayer = YES
>> stackview.layer.backgroundColor = [NSColor blueColor]
>> 
>> (Note: The above was written in mail, so it may take a little tweaking to 
>> work)
>> 
>> Thanks,
>> Jon
>> 
>>> On Sep 14, 2015, at 11:11 AM, Dave  wrote:
>>> 
>>> 
 On 14 Sep 2015, at 18:50, Jonathan Hull  wrote:
 
 You shouldn’t have to add any constraints to the direct children of a 
 StackView (and in fact, you will most likely get an error if you try), 
 since the StackView will make its own constraints and manages them for you.
 
 My guess is that the StackView is not resizing with the ScrollView.  You 
 can test this by temporarily removing the detail view (and associated 
 constraints) and setting the StackView’s background color to some bright 
 color.
>>> 
>>> Unfortunately NSStackView doesn’t seem to have a setBackgroundColor method. 
>>> I set it on the ScrollView, that that of course moves when I resize the 
>>> window.
>>> 
>>> These are the frame rects after adding the DetailView to the StackView.
>>> 
>>> ScrollView Frame: {{20, 54}, {760, 355}}
>>> ClipView Frame: {{1, 1}, {743, 353}}
>>> StackView Frame: {{0, 0}, {744, 16}}
>>> ???
>>> 
>>> I can add as many views as I like to the StackView and it’s Scrolls 
>>> correctly vertically, I just can’t get the Detail View to expand out in H. 
>>> Yes,
>>> 
 Constraints with ScrollViews are notoriously tricky…
>>> 
>>> You’re not wrong there!
>>> 
>>> Incidentally, I took another look at InfoBarView and it doesn’t handle 
>>> window re-sizing so it’s not much good in this case.
>>> 
>>> Thanks a lot.
>>> Cheers
>>> Dave
>>> 
>>> 
> On Sep 14, 2015, at 8:48 AM, Dave  wrote:
> 
> 
>> 
>> In fact, with NSStackView you should just be able to set the content 
>> hugging priority and it’ll just work
>> 
>> myDetailView = [myDetailViewController getPrimaryView];
>> [self.pValidationListStackView addView:myDetailView 
>> inGravity:NSStackViewGravityTop]; // NOTE: Should this not be 
>> GravityLeading as you’re using a horizontal stack view?
>> [myDetailView setContentHuggingPriority:NSLayoutPriorityDefaultLow 
>> forOrientation:NSLayoutConstraintOrientationHorizontal];
>> 
>> and that’s all you should need.
>> 
>> iain
> 
> I tried that and it had no effect. When I resize the window the Scroll 
> View Resizes (and I assume the StackView?) but the Detail View stays the 
> same size - e.g. does not move with the right edge of the Scroll View.
> 
> Cheers
> Dave
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
> 
> This email sent to jh...@gbis.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 

[postscript] Re: Swift generics, circular type declarations, and segfaults, oh my!

2015-09-14 Thread has

Quick follow-up for anyone interested...

On Sep 8, 2015, at 5:45 PM, has > wrote:
I will need to spend some more time building it out and testing it, 
but (touch-wood) it looks like the problem might be cracked at last. 
Wahey!


So, my first attempt to replace all my base classes with protocol 
extensions failed fairly quickly: trying to move instance vars and 
non-convenience inits into protocol extensions is a recipe for madness.


However, my second attempt, where I retain the main base classes and 
move only the 'factory' vars/methods to protocol extensions did 
eventually yield successful (if slightly convoluted and confusing) results:


https://bitbucket.org/hhas/swiftae/

Next up, trying to wrangle the inconsistencies and aggravations of 
Swift's object/non-object and type systems into something that actually 
works right. Wish my teeth luck - with the amount of enamel left, they 
will need it. :p


Thanks again,

has

___

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

best way to implement a clickable grid?

2015-09-14 Thread Patrick J. Collins
Hi everyone,

I am looking to implement something that would look somewhat like a
graphic equalizer.  Meaning, a grid of blocks...  Clicking on a single
grid block would change the appearance of all cells directly under it..
So in other words, clicking on 1,1 would turn on 1,1. but clicking 1,5
woudl turn on 1,5, 1,4, 1,3, 1,2, 1,1...

I am curious if anyone here has a suggestion of what the best design
approach would be for something like this?  Should I just
programatically generate a bunch of NSViews?  Should I overal an
invisible button over each view?  Or is there a better way to handle
click events on a simple NSView?

Any push in the right direction would be greatly appreciated.  Thanks!


Patrick J. Collins
http://collinatorstudios.com

___

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

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

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

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

Re: best way to implement a clickable grid?

2015-09-14 Thread Jens Alfke
I would probably just implement it as a custom NSView. Then it doesn’t even 
have to be represented in memory as a grid; you just remember the level for 
each x coord and fill in the appropriate squares when drawing.

> Or is there a better way to handle click events on a simple NSView?

Just override mouseDown:, mouseDragged:, mouseUp:. You’ll have to convert the 
event coords from window to view coords.

—Jens
___

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

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

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

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

Re: best way to implement a clickable grid?

2015-09-14 Thread Uli Kusterer
On 15 Sep 2015, at 02:35, Jens Alfke  wrote:
> I would probably just implement it as a custom NSView. Then it doesn’t even 
> have to be represented in memory as a grid; you just remember the level for 
> each x coord and fill in the appropriate squares when drawing.
> 
>> Or is there a better way to handle click events on a simple NSView?
> 
> Just override mouseDown:, mouseDragged:, mouseUp:. You’ll have to convert the 
> event coords from window to view coords.

 Oh, if you go the route of a custom view like Jens and I suggest, don't forget 
to implement Accessibility for it. You can probably just give a number 
indicating the level, but otherwise you might have to do whatever NSSlider does 
to expose itself to Accessibility. Or maybe you could just subclass NSSlider, 
replace all the tracking and drawing code, and that way get Accessibility for 
free.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://stacksmith.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/archive%40mail-archive.com

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

Re: best way to implement a clickable grid?

2015-09-14 Thread Doug Hill
Hey Patrick,

An interesting problem.

Depending on how far you want to take this, how much this view will be reused, 
how customizable it needs to be, etc. will inform your design decisions.

Just off the top of my head…If the number of blocks in each cell is fixed, it 
might be easy to make a custom NSView with n number of buttons. This could be 
created dynamically at runtime or in a XIB. Clicking a button would send a 
message to your custom view object that allows you to style all the other 
buttons. You could then group a number of these views to create your grid. If 
your view needs to be dynamic (n buttons in y groups), you might consider using 
a tableview or collection view to construct this. This is more work but will be 
the most customizable and reusable.

Good luck!

Doug Hill
http://chartcube .com/


> On Sep 14, 2015, at 5:17 PM, Patrick J. Collins 
>  wrote:
> 
> Hi everyone,
> 
> I am looking to implement something that would look somewhat like a
> graphic equalizer.  Meaning, a grid of blocks...  Clicking on a single
> grid block would change the appearance of all cells directly under it..
> So in other words, clicking on 1,1 would turn on 1,1. but clicking 1,5
> woudl turn on 1,5, 1,4, 1,3, 1,2, 1,1...
> 
> I am curious if anyone here has a suggestion of what the best design
> approach would be for something like this?  Should I just
> programatically generate a bunch of NSViews?  Should I overal an
> invisible button over each view?  Or is there a better way to handle
> click events on a simple NSView?
> 
> Any push in the right direction would be greatly appreciated.  Thanks!
> 
> 
> Patrick J. Collins
> http://collinatorstudios.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/cocoadev%40breaqz.com
> 
> This email sent to cocoa...@breaqz.com

___

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

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

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

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

Re: best way to implement a clickable grid?

2015-09-14 Thread Uli Kusterer
On 15 Sep 2015, at 02:17, Patrick J. Collins  
wrote:
> Hi everyone,
> 
> I am looking to implement something that would look somewhat like a
> graphic equalizer.  Meaning, a grid of blocks...  Clicking on a single
> grid block would change the appearance of all cells directly under it..
> So in other words, clicking on 1,1 would turn on 1,1. but clicking 1,5
> woudl turn on 1,5, 1,4, 1,3, 1,2, 1,1...
> 
> I am curious if anyone here has a suggestion of what the best design
> approach would be for something like this?  Should I just
> programatically generate a bunch of NSViews?  Should I overal an
> invisible button over each view?  Or is there a better way to handle
> click events on a simple NSView?
> 
> Any push in the right direction would be greatly appreciated.  Thanks!

I'd generally use a single view and use the click Y coordinate to determine 
which segment was clicked, then I'd have two images, one containing unselected, 
the other selected versions of the grid elements, and would just clip to those.

It's what I did for our equalizer display. Although I in fact used two CALayers 
to show the image. That way the clipping happens on the GPU and the CPU doesn't 
constantly need to update the entire image and upload it onto the GPU. IIRC the 
contentsRect property is what I used to tell the GPU how to clip the drawing in 
the "selected" layer.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://stacksmith.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/archive%40mail-archive.com

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

Re: Adding Constraints in Code

2015-09-14 Thread Jonathan Hull
Trying to remember what I had to do to get this to work in a project a couple 
of years ago.  Have you tried adding a constraint equaling the width of the 
scrollView and the clipView?

Thanks,
Jon


> On Sep 14, 2015, at 11:11 AM, Dave  wrote:
> 
> 
>> On 14 Sep 2015, at 18:50, Jonathan Hull  wrote:
>> 
>> You shouldn’t have to add any constraints to the direct children of a 
>> StackView (and in fact, you will most likely get an error if you try), since 
>> the StackView will make its own constraints and manages them for you.
>> 
>> My guess is that the StackView is not resizing with the ScrollView.  You can 
>> test this by temporarily removing the detail view (and associated 
>> constraints) and setting the StackView’s background color to some bright 
>> color.
> 
> Unfortunately NSStackView doesn’t seem to have a setBackgroundColor method. I 
> set it on the ScrollView, that that of course moves when I resize the window.
> 
> These are the frame rects after adding the DetailView to the StackView.
> 
> ScrollView Frame: {{20, 54}, {760, 355}}
> ClipView Frame: {{1, 1}, {743, 353}}
> StackView Frame: {{0, 0}, {744, 16}}  
> ???
> 
> I can add as many views as I like to the StackView and it’s Scrolls correctly 
> vertically, I just can’t get the Detail View to expand out in H. Yes,
> 
>> Constraints with ScrollViews are notoriously tricky…
> 
> You’re not wrong there!
> 
> Incidentally, I took another look at InfoBarView and it doesn’t handle window 
> re-sizing so it’s not much good in this case.
> 
> Thanks a lot.
> Cheers
> Dave
> 
> 
>>> On Sep 14, 2015, at 8:48 AM, Dave  wrote:
>>> 
>>> 
 
 In fact, with NSStackView you should just be able to set the content 
 hugging priority and it’ll just work
 
 myDetailView = [myDetailViewController getPrimaryView];
 [self.pValidationListStackView addView:myDetailView 
 inGravity:NSStackViewGravityTop]; // NOTE: Should this not be 
 GravityLeading as you’re using a horizontal stack view?
 [myDetailView setContentHuggingPriority:NSLayoutPriorityDefaultLow 
 forOrientation:NSLayoutConstraintOrientationHorizontal];
 
 and that’s all you should need.
 
 iain
>>> 
>>> I tried that and it had no effect. When I resize the window the Scroll View 
>>> Resizes (and I assume the StackView?) but the Detail View stays the same 
>>> size - e.g. does not move with the right edge of the Scroll View.
>>> 
>>> Cheers
>>> Dave
>>> 
>>> 
>>> 
>>> ___
>>> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>> 
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>> 
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
>>> 
>>> This email sent to jh...@gbis.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/jhull%40gbis.com
> 
> This email sent to jh...@gbis.com


___

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

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

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

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

Re: Adding Constraints in Code

2015-09-14 Thread Jonathan Hull
Oh yeah, it does on iOS, but not OS X.  Sorry about that.

On OS X, you need to layer back it and set the layer’s background color.

stackview.wantsLayer = YES
stackview.layer.backgroundColor = [NSColor blueColor]

(Note: The above was written in mail, so it may take a little tweaking to work)

Thanks,
Jon

> On Sep 14, 2015, at 11:11 AM, Dave  wrote:
> 
> 
>> On 14 Sep 2015, at 18:50, Jonathan Hull  wrote:
>> 
>> You shouldn’t have to add any constraints to the direct children of a 
>> StackView (and in fact, you will most likely get an error if you try), since 
>> the StackView will make its own constraints and manages them for you.
>> 
>> My guess is that the StackView is not resizing with the ScrollView.  You can 
>> test this by temporarily removing the detail view (and associated 
>> constraints) and setting the StackView’s background color to some bright 
>> color.
> 
> Unfortunately NSStackView doesn’t seem to have a setBackgroundColor method. I 
> set it on the ScrollView, that that of course moves when I resize the window.
> 
> These are the frame rects after adding the DetailView to the StackView.
> 
> ScrollView Frame: {{20, 54}, {760, 355}}
> ClipView Frame: {{1, 1}, {743, 353}}
> StackView Frame: {{0, 0}, {744, 16}}  
> ???
> 
> I can add as many views as I like to the StackView and it’s Scrolls correctly 
> vertically, I just can’t get the Detail View to expand out in H. Yes,
> 
>> Constraints with ScrollViews are notoriously tricky…
> 
> You’re not wrong there!
> 
> Incidentally, I took another look at InfoBarView and it doesn’t handle window 
> re-sizing so it’s not much good in this case.
> 
> Thanks a lot.
> Cheers
> Dave
> 
> 
>>> On Sep 14, 2015, at 8:48 AM, Dave  wrote:
>>> 
>>> 
 
 In fact, with NSStackView you should just be able to set the content 
 hugging priority and it’ll just work
 
 myDetailView = [myDetailViewController getPrimaryView];
 [self.pValidationListStackView addView:myDetailView 
 inGravity:NSStackViewGravityTop]; // NOTE: Should this not be 
 GravityLeading as you’re using a horizontal stack view?
 [myDetailView setContentHuggingPriority:NSLayoutPriorityDefaultLow 
 forOrientation:NSLayoutConstraintOrientationHorizontal];
 
 and that’s all you should need.
 
 iain
>>> 
>>> I tried that and it had no effect. When I resize the window the Scroll View 
>>> Resizes (and I assume the StackView?) but the Detail View stays the same 
>>> size - e.g. does not move with the right edge of the Scroll View.
>>> 
>>> Cheers
>>> Dave
>>> 
>>> 
>>> 
>>> ___
>>> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>> 
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>> 
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
>>> 
>>> This email sent to jh...@gbis.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/jhull%40gbis.com
> 
> This email sent to jh...@gbis.com


___

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

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

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

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

Re: Adding Constraints in Code

2015-09-14 Thread Jonathan Hull
You shouldn’t have to add any constraints to the direct children of a StackView 
(and in fact, you will most likely get an error if you try), since the 
StackView will make its own constraints and manages them for you.

My guess is that the StackView is not resizing with the ScrollView.  You can 
test this by temporarily removing the detail view (and associated constraints) 
and setting the StackView’s background color to some bright color.

Constraints with ScrollViews are notoriously tricky…

Thanks,
Jon


> On Sep 14, 2015, at 8:48 AM, Dave  wrote:
> 
> 
>> 
>> In fact, with NSStackView you should just be able to set the content hugging 
>> priority and it’ll just work
>> 
>> myDetailView = [myDetailViewController getPrimaryView];
>> [self.pValidationListStackView addView:myDetailView 
>> inGravity:NSStackViewGravityTop]; // NOTE: Should this not be GravityLeading 
>> as you’re using a horizontal stack view?
>> [myDetailView setContentHuggingPriority:NSLayoutPriorityDefaultLow 
>> forOrientation:NSLayoutConstraintOrientationHorizontal];
>> 
>> and that’s all you should need.
>> 
>> iain
> 
> I tried that and it had no effect. When I resize the window the Scroll View 
> Resizes (and I assume the StackView?) but the Detail View stays the same size 
> - e.g. does not move with the right edge of the Scroll View.
> 
> Cheers
> Dave
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
> 
> This email sent to jh...@gbis.com


___

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

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

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

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

Re: API to determine status of System Integrity Protection?

2015-09-14 Thread Charles Srstka
> On Sep 13, 2015, at 6:33 PM, Ed Wynne  wrote:
> 
> 
> On Sep 13, 2015, at 5:47 PM, Stephane Sudre  > wrote:
> That document doesn't mention an API…
 Hence, since that is the current documentation, my conclusion : “Don’t 
 think so”.
>>> There is an API. Much like with sandboxing it just may not be public, which 
>>> means it is inappropriate for discussion here. I’m not sure why Apple 
>>> considers this kind of thing off limits, but that is inappropriate for 
>>> discussion here as well.
>> 
>> I must be missing something but why should there be an API?
> 
> There are many reasons. For example, writing to the areas SIP protects 
> typically requires authorization. Not offering the user an impossible action 
> is a much better UX than letting them go through the trouble of 
> authenticating only to have it fail anyway.
> 
>> - determining whether SIP is on requires to check whether the running
>> OS on 10.11 or later.
> 
> This check is not sufficient since SIP can be disabled.
> 
>> Also it could done by parsing the output of $
>> csrutil status but this would assume the output format will not change
>> in the future.
> 
> Exactly, which makes this a bad option.
> 
>> - determining whether you can write to a file or folder can be done
>> with the usual BSD, Cocoa APIs, can't it?
> 
> Yes and no. Not having the beta (er, GM seed) handy to check, I honestly 
> don’t know if the R/W file system permissions are reported differently when 
> SIP is present and enabled. Based on how sandboxing operates, I would assume 
> they are not.
> 
> But that isn’t to say some things won’t be detectably different, which was 
> the point of my suggestion about secondary checks. They might be possible, 
> but they are still a bad option since they usually fall into the category of 
> undocumented side effects. 
> 
>> - knowing which parts of the file hierarchy are protected is covered
>> by the documentation (Interestingly I've just discovered that
>> /Applications/Utilities is a no trespassing area).
> 
> 
> Except they aren’t protected when SIP is disabled, which was the point of the 
> OP’s question.
> 
> -Ed

The open() API returns EPERM when you try to access something protected by SIP, 
but EACCES for normal permission errors. So, you could just try to write to 
create a file at /System/foo without root access using open(), and use the 
value returned by errno to determine whether SIP is enabled or not.

Whether that is more or less ugly than parsing the output of csrutil, of 
course, is up to the reader. They’re both pretty non-ideal.

Charles

___

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

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

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

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

Re: Adding Constraints in Code

2015-09-14 Thread Dave

> On 14 Sep 2015, at 18:50, Jonathan Hull  wrote:
> 
> You shouldn’t have to add any constraints to the direct children of a 
> StackView (and in fact, you will most likely get an error if you try), since 
> the StackView will make its own constraints and manages them for you.
> 
> My guess is that the StackView is not resizing with the ScrollView.  You can 
> test this by temporarily removing the detail view (and associated 
> constraints) and setting the StackView’s background color to some bright 
> color.

Unfortunately NSStackView doesn’t seem to have a setBackgroundColor method. I 
set it on the ScrollView, that that of course moves when I resize the window.

These are the frame rects after adding the DetailView to the StackView.

ScrollView Frame: {{20, 54}, {760, 355}}
ClipView Frame: {{1, 1}, {743, 353}}
StackView Frame: {{0, 0}, {744, 16}}
???

I can add as many views as I like to the StackView and it’s Scrolls correctly 
vertically, I just can’t get the Detail View to expand out in H. Yes,

> Constraints with ScrollViews are notoriously tricky…

You’re not wrong there!

Incidentally, I took another look at InfoBarView and it doesn’t handle window 
re-sizing so it’s not much good in this case.

Thanks a lot.
Cheers
Dave


>> On Sep 14, 2015, at 8:48 AM, Dave  wrote:
>> 
>> 
>>> 
>>> In fact, with NSStackView you should just be able to set the content 
>>> hugging priority and it’ll just work
>>> 
>>> myDetailView = [myDetailViewController getPrimaryView];
>>> [self.pValidationListStackView addView:myDetailView 
>>> inGravity:NSStackViewGravityTop]; // NOTE: Should this not be 
>>> GravityLeading as you’re using a horizontal stack view?
>>> [myDetailView setContentHuggingPriority:NSLayoutPriorityDefaultLow 
>>> forOrientation:NSLayoutConstraintOrientationHorizontal];
>>> 
>>> and that’s all you should need.
>>> 
>>> iain
>> 
>> I tried that and it had no effect. When I resize the window the Scroll View 
>> Resizes (and I assume the StackView?) but the Detail View stays the same 
>> size - e.g. does not move with the right edge of the Scroll View.
>> 
>> Cheers
>> Dave
>> 
>> 
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
>> 
>> This email sent to jh...@gbis.com
> 


___

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

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

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

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

Re: Adding Constraints in Code

2015-09-14 Thread Dave
Hi,

[self.pValidationIssueScrollView setBackgroundColor:[NSColor redColor]];
self.pValidationListStackView.wantsLayer = YES;
self.pValidationListStackView.layer.backgroundColor = [[NSColor blueColor] 
CGColor];

Did the trick!

When I run it, the StackView grows with the ScrollView, e.g. it’s Blue up until 
the V Scroll Bar on right, then it’s Red

So, I assume I need to somehow attach the LTWDetailView to the StackView by 
adding Constraints?

The DetailView is loaded from a NIB and has it’s own set of constraints if that 
makes a difference?

Thanks again,
All the Best
Dave

> On 14 Sep 2015, at 19:18, Jonathan Hull  wrote:
> 
> Oh yeah, it does on iOS, but not OS X.  Sorry about that.
> 
> On OS X, you need to layer back it and set the layer’s background color.
> 
> stackview.wantsLayer = YES
> stackview.layer.backgroundColor = [NSColor blueColor]
> 
> (Note: The above was written in mail, so it may take a little tweaking to 
> work)
> 
> Thanks,
> Jon
> 
>> On Sep 14, 2015, at 11:11 AM, Dave  wrote:
>> 
>> 
>>> On 14 Sep 2015, at 18:50, Jonathan Hull  wrote:
>>> 
>>> You shouldn’t have to add any constraints to the direct children of a 
>>> StackView (and in fact, you will most likely get an error if you try), 
>>> since the StackView will make its own constraints and manages them for you.
>>> 
>>> My guess is that the StackView is not resizing with the ScrollView.  You 
>>> can test this by temporarily removing the detail view (and associated 
>>> constraints) and setting the StackView’s background color to some bright 
>>> color.
>> 
>> Unfortunately NSStackView doesn’t seem to have a setBackgroundColor method. 
>> I set it on the ScrollView, that that of course moves when I resize the 
>> window.
>> 
>> These are the frame rects after adding the DetailView to the StackView.
>> 
>> ScrollView Frame: {{20, 54}, {760, 355}}
>> ClipView Frame: {{1, 1}, {743, 353}}
>> StackView Frame: {{0, 0}, {744, 16}} 
>> ???
>> 
>> I can add as many views as I like to the StackView and it’s Scrolls 
>> correctly vertically, I just can’t get the Detail View to expand out in H. 
>> Yes,
>> 
>>> Constraints with ScrollViews are notoriously tricky…
>> 
>> You’re not wrong there!
>> 
>> Incidentally, I took another look at InfoBarView and it doesn’t handle 
>> window re-sizing so it’s not much good in this case.
>> 
>> Thanks a lot.
>> Cheers
>> Dave
>> 
>> 
 On Sep 14, 2015, at 8:48 AM, Dave  wrote:
 
 
> 
> In fact, with NSStackView you should just be able to set the content 
> hugging priority and it’ll just work
> 
> myDetailView = [myDetailViewController getPrimaryView];
> [self.pValidationListStackView addView:myDetailView 
> inGravity:NSStackViewGravityTop]; // NOTE: Should this not be 
> GravityLeading as you’re using a horizontal stack view?
> [myDetailView setContentHuggingPriority:NSLayoutPriorityDefaultLow 
> forOrientation:NSLayoutConstraintOrientationHorizontal];
> 
> and that’s all you should need.
> 
> iain
 
 I tried that and it had no effect. When I resize the window the Scroll 
 View Resizes (and I assume the StackView?) but the Detail View stays the 
 same size - e.g. does not move with the right edge of the Scroll View.
 
 Cheers
 Dave
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
 
 This email sent to jh...@gbis.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/jhull%40gbis.com
>> 
>> This email sent to jh...@gbis.com
> 


___

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

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

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

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

Re: Adding Constraints in Code

2015-09-14 Thread Dave
These are the constraints on the detail view just after it has been added to 
the StackView:

myDetailView.constraints: (
"”,

"”,

"”,

"”,

"”,

"”,

""
)

Which look ok me me?

Cheers
Dave

> On 14 Sep 2015, at 19:18, Jonathan Hull  wrote:
> 
> Oh yeah, it does on iOS, but not OS X.  Sorry about that.
> 
> On OS X, you need to layer back it and set the layer’s background color.
> 
> stackview.wantsLayer = YES
> stackview.layer.backgroundColor = [NSColor blueColor]
> 
> (Note: The above was written in mail, so it may take a little tweaking to 
> work)
> 
> Thanks,
> Jon
> 
>> On Sep 14, 2015, at 11:11 AM, Dave  wrote:
>> 
>> 
>>> On 14 Sep 2015, at 18:50, Jonathan Hull  wrote:
>>> 
>>> You shouldn’t have to add any constraints to the direct children of a 
>>> StackView (and in fact, you will most likely get an error if you try), 
>>> since the StackView will make its own constraints and manages them for you.
>>> 
>>> My guess is that the StackView is not resizing with the ScrollView.  You 
>>> can test this by temporarily removing the detail view (and associated 
>>> constraints) and setting the StackView’s background color to some bright 
>>> color.
>> 
>> Unfortunately NSStackView doesn’t seem to have a setBackgroundColor method. 
>> I set it on the ScrollView, that that of course moves when I resize the 
>> window.
>> 
>> These are the frame rects after adding the DetailView to the StackView.
>> 
>> ScrollView Frame: {{20, 54}, {760, 355}}
>> ClipView Frame: {{1, 1}, {743, 353}}
>> StackView Frame: {{0, 0}, {744, 16}} 
>> ???
>> 
>> I can add as many views as I like to the StackView and it’s Scrolls 
>> correctly vertically, I just can’t get the Detail View to expand out in H. 
>> Yes,
>> 
>>> Constraints with ScrollViews are notoriously tricky…
>> 
>> You’re not wrong there!
>> 
>> Incidentally, I took another look at InfoBarView and it doesn’t handle 
>> window re-sizing so it’s not much good in this case.
>> 
>> Thanks a lot.
>> Cheers
>> Dave
>> 
>> 
 On Sep 14, 2015, at 8:48 AM, Dave  wrote:
 
 
> 
> In fact, with NSStackView you should just be able to set the content 
> hugging priority and it’ll just work
> 
> myDetailView = [myDetailViewController getPrimaryView];
> [self.pValidationListStackView addView:myDetailView 
> inGravity:NSStackViewGravityTop]; // NOTE: Should this not be 
> GravityLeading as you’re using a horizontal stack view?
> [myDetailView setContentHuggingPriority:NSLayoutPriorityDefaultLow 
> forOrientation:NSLayoutConstraintOrientationHorizontal];
> 
> and that’s all you should need.
> 
> iain
 
 I tried that and it had no effect. When I resize the window the Scroll 
 View Resizes (and I assume the StackView?) but the Detail View stays the 
 same size - e.g. does not move with the right edge of the Scroll View.
 
 Cheers
 Dave
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
 
 This email sent to jh...@gbis.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/jhull%40gbis.com
>> 
>> This email sent to jh...@gbis.com
> 


___

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

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

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

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

Re: Identifying a specific Mac model

2015-09-14 Thread Marek Hrušovský
NSPipe *outputPipe = [NSPipe pipe];NSTask *task = [[NSTask alloc]
init];[task setLaunchPath:@"/usr/sbin/system_profiler"];[task
setArguments:@[@"SPHardwareDataType"]];[task
setStandardOutput:outputPipe];[task launch];[task
waitUntilExit];NSData *outputData = [[outputPipe fileHandleForReading]
readDataToEndOfFile];NSString *hardware = [[NSString alloc]
initWithData:outputData encoding:NSUTF8StringEncoding];


Mareks-MacBook-Pro:~ xhruso00$ /usr/sbin/system_profiler SPHardwareDataType

Hardware:


Hardware Overview:


  Model Name: MacBook Pro

  Model Identifier: MacBookPro6,2

  Processor Name: Intel Core i5

  Processor Speed: 2,4 GHz

  Number of Processors: 1

  Total Number of Cores: 2

  L2 Cache (per Core): 256 KB

  L3 Cache: 3 MB

  Memory: 8 GB

  Processor Interconnect Speed: 4,8 GT/s

  Boot ROM Version: MBP61.0057.B10

  SMC Version (system): 1.58f17

  Serial Number (system): hidden

  Hardware UUID: hidden

  Sudden Motion Sensor:

  State: Enabled

On Mon, Sep 14, 2015 at 10:17 AM, Robert Tillyard 
wrote:

> Hello, John,
>
> I use this to get the model number:
>
>
> + (NSString *)computerModel
> {
> char modelBuffer[256];
> size_t sz = sizeof(modelBuffer);
>
> if (0 == sysctlbyname("hw.model", modelBuffer, , NULL, 0)) {
> modelBuffer[sizeof(modelBuffer) - 1] = 0;
> return [NSString stringWithCString:modelBuffer
> encoding:[NSString defaultCStringEncoding]];
> }
>
> return nil;
> }
>
> Regards, Rob.
>
>
> > On 14 Sep 2015, at 01:09, John Daniel 
> wrote:
> >
> > Hello,
> > Does anyone know of an API or utility that will identify specific Mac
> models? The “Model Identifier” like “MacBook8,1” is not sufficient to
> uniquely describe a model. MacBook8,1 covers all colours of the new
> MacBook. I am trying to differentiate the silver, from the space grey, from
> the gold.
> >
> > My app has an animation where it cycles through various Macs like a slot
> machine, finally landing on the user’s specific machine. I used to just
> look at the “Model Identifier”. I could pretty easily identify the matching
> machine image from
> /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources.
> >
> > However, the images for the new retina MacBook are in a different
> location. I found where they live in an apparently randomly-named
> framework, but I still can’t connect a specific image with the user’s
> specific machine. There is a private API for the UIDevice class in iOS that
> provides similar information. Is there anything like this for the Mac?
> >
> > Thanks,
> >
> > John Daniel
> ___
>
> 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/xhruso00%40gmail.com
>
> This email sent to xhrus...@gmail.com
>
___

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

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

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

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

Re: Identifying a specific Mac model

2015-09-14 Thread Robert Tillyard
Hello, John,

I use this to get the model number:


+ (NSString *)computerModel
{
char modelBuffer[256];
size_t sz = sizeof(modelBuffer);

if (0 == sysctlbyname("hw.model", modelBuffer, , NULL, 0)) {
modelBuffer[sizeof(modelBuffer) - 1] = 0;
return [NSString stringWithCString:modelBuffer 
encoding:[NSString defaultCStringEncoding]];
}

return nil;
}

Regards, Rob.


> On 14 Sep 2015, at 01:09, John Daniel  wrote:
> 
> Hello,
> Does anyone know of an API or utility that will identify specific Mac models? 
> The “Model Identifier” like “MacBook8,1” is not sufficient to uniquely 
> describe a model. MacBook8,1 covers all colours of the new  MacBook. I am 
> trying to differentiate the silver, from the space grey, from the gold.
> 
> My app has an animation where it cycles through various Macs like a slot 
> machine, finally landing on the user’s specific machine. I used to just look 
> at the “Model Identifier”. I could pretty easily identify the matching 
> machine image from 
> /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources. 
> 
> However, the images for the new retina MacBook are in a different location. I 
> found where they live in an apparently randomly-named framework, but I still 
> can’t connect a specific image with the user’s specific machine. There is a 
> private API for the UIDevice class in iOS that provides similar information. 
> Is there anything like this for the Mac?
> 
> Thanks,
> 
> John Daniel
___

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

Adding Constraints in Code

2015-09-14 Thread Dave
Hi All,

I’m trying to add Constraints to a View in order to have it stretch to the left 
and right edges of the superview. This is slight complicated by it being in a 
ScrollView/Stack View Combo as so:


NSScrollViewSetup in NIB
NSFlippedClipView   Setup in NIB
NSStackView Setup in NIB
LTWDetailXView  (added dynamically in code).


The Detail View is smaller in Width than the  NSScrollView/NSStackView and I 
want it to stretch to fit it.

I tried adding the following constraints in code as follows:

myDetailView = [myDetailViewController getPrimaryView];
[self.pValidationListStackView addView:myDetailView 
inGravity:NSStackViewGravityTop];

myConstraintsViewDictionary = [[NSMutableDictionary alloc] init];
[myConstraintsViewDictionary setObject:self.pValidationListStackView 
forKey:@"StackView"];
[myConstraintsViewDictionary setObject:myDetailView forKey:@"DetailView"];

myConstraintsArray = [NSLayoutConstraint 
constraintsWithVisualFormat:@"H:[StackView]-(<=1)-[DetailView]" 
options:NSLayoutFormatAlignAllLeft metrics:nil 
views:myConstraintsViewDictionary];
[myDetailView addConstraints:myConstraintsArray];

myConstraintsArray = [NSLayoutConstraint 
constraintsWithVisualFormat:@"H:[StackView]-(<=1)-[DetailView]" 
options:NSLayoutFormatAlignAllRight metrics:nil 
views:myConstraintsViewDictionary];
[myDetailView addConstraints:myConstraintsArray];

But I get this Error Message:

Unable to parse constraint format: 
Options mask required views to be aligned on a horizontal edge, which is not 
allowed for layout that is also horizontal. 
H:[StackView]-(<=1)-[DetailView] 
^
I’m not sure what this means or if the above code is correct?

If anyone has any ideas on this I’d really love to hear them!

Thanks a lot for any help.
All the Best
Dave



___

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

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

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

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

Re: Identifying a specific Mac model

2015-09-14 Thread Marek Hrušovský
To get color/icon Manually map model identifier to icon name and then use
e.g

[[NSWorkspace sharedWorkspace] iconForFileType:@"com.apple.macbookair"];

http://stackoverflow.com/questions/32370037/is-there-a-way-of-getting-a-macs-icon-given-its-model-number/32373977#32373977

On Mon, Sep 14, 2015 at 11:17 AM, Marek Hrušovský 
wrote:

> NSPipe *outputPipe = [NSPipe pipe];NSTask *task = [[NSTask alloc] init];[task 
> setLaunchPath:@"/usr/sbin/system_profiler"];[task 
> setArguments:@[@"SPHardwareDataType"]];[task 
> setStandardOutput:outputPipe];[task launch];[task waitUntilExit];NSData 
> *outputData = [[outputPipe fileHandleForReading] 
> readDataToEndOfFile];NSString *hardware = [[NSString alloc] 
> initWithData:outputData encoding:NSUTF8StringEncoding];
>
>
> Mareks-MacBook-Pro:~ xhruso00$ /usr/sbin/system_profiler SPHardwareDataType
>
> Hardware:
>
>
> Hardware Overview:
>
>
>   Model Name: MacBook Pro
>
>   Model Identifier: MacBookPro6,2
>
>   Processor Name: Intel Core i5
>
>   Processor Speed: 2,4 GHz
>
>   Number of Processors: 1
>
>   Total Number of Cores: 2
>
>   L2 Cache (per Core): 256 KB
>
>   L3 Cache: 3 MB
>
>   Memory: 8 GB
>
>   Processor Interconnect Speed: 4,8 GT/s
>
>   Boot ROM Version: MBP61.0057.B10
>
>   SMC Version (system): 1.58f17
>
>   Serial Number (system): hidden
>
>   Hardware UUID: hidden
>
>   Sudden Motion Sensor:
>
>   State: Enabled
>
> On Mon, Sep 14, 2015 at 10:17 AM, Robert Tillyard 
> wrote:
>
>> Hello, John,
>>
>> I use this to get the model number:
>>
>>
>> + (NSString *)computerModel
>> {
>> char modelBuffer[256];
>> size_t sz = sizeof(modelBuffer);
>>
>> if (0 == sysctlbyname("hw.model", modelBuffer, , NULL, 0)) {
>> modelBuffer[sizeof(modelBuffer) - 1] = 0;
>> return [NSString stringWithCString:modelBuffer
>> encoding:[NSString defaultCStringEncoding]];
>> }
>>
>> return nil;
>> }
>>
>> Regards, Rob.
>>
>>
>> > On 14 Sep 2015, at 01:09, John Daniel 
>> wrote:
>> >
>> > Hello,
>> > Does anyone know of an API or utility that will identify specific Mac
>> models? The “Model Identifier” like “MacBook8,1” is not sufficient to
>> uniquely describe a model. MacBook8,1 covers all colours of the new
>> MacBook. I am trying to differentiate the silver, from the space grey, from
>> the gold.
>> >
>> > My app has an animation where it cycles through various Macs like a
>> slot machine, finally landing on the user’s specific machine. I used to
>> just look at the “Model Identifier”. I could pretty easily identify the
>> matching machine image from
>> /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources.
>> >
>> > However, the images for the new retina MacBook are in a different
>> location. I found where they live in an apparently randomly-named
>> framework, but I still can’t connect a specific image with the user’s
>> specific machine. There is a private API for the UIDevice class in iOS that
>> provides similar information. Is there anything like this for the Mac?
>> >
>> > Thanks,
>> >
>> > John Daniel
>> ___
>>
>> 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/xhruso00%40gmail.com
>>
>> This email sent to xhrus...@gmail.com
>>
>
>
___

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

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

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

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

Re: Identifying a specific Mac model

2015-09-14 Thread sqwarqDev
Sorry for top posting, but Robert and Marek seem to have missed the point of 
the OP’s request, to wit:

> The “Model Identifier” like “MacBook8,1” is not sufficient to uniquely 
> describe a model

Unsurprisingly John, I don’t know the answer either I’m afraid. ;-).


Best


Phil



> On 14 Sep 2015, at 16:17, Marek Hrušovský  wrote:
> 
> NSPipe *outputPipe = [NSPipe pipe];NSTask *task = [[NSTask alloc]
> init];[task setLaunchPath:@"/usr/sbin/system_profiler"];[task
> setArguments:@[@"SPHardwareDataType"]];[task
> setStandardOutput:outputPipe];[task launch];[task
> waitUntilExit];NSData *outputData = [[outputPipe fileHandleForReading]
> readDataToEndOfFile];NSString *hardware = [[NSString alloc]
> initWithData:outputData encoding:NSUTF8StringEncoding];
> 
> 
> Mareks-MacBook-Pro:~ xhruso00$ /usr/sbin/system_profiler SPHardwareDataType
> 
> Hardware:
> 
> 
>Hardware Overview:
> 
> 
>  Model Name: MacBook Pro
> 
>  Model Identifier: MacBookPro6,2
> 
>  Processor Name: Intel Core i5
> 
>  Processor Speed: 2,4 GHz
> 
>  Number of Processors: 1
> 
>  Total Number of Cores: 2
> 
>  L2 Cache (per Core): 256 KB
> 
>  L3 Cache: 3 MB
> 
>  Memory: 8 GB
> 
>  Processor Interconnect Speed: 4,8 GT/s
> 
>  Boot ROM Version: MBP61.0057.B10
> 
>  SMC Version (system): 1.58f17
> 
>  Serial Number (system): hidden
> 
>  Hardware UUID: hidden
> 
>  Sudden Motion Sensor:
> 
>  State: Enabled
> 
> On Mon, Sep 14, 2015 at 10:17 AM, Robert Tillyard 
> wrote:
> 
>> Hello, John,
>> 
>> I use this to get the model number:
>> 
>> 
>> + (NSString *)computerModel
>> {
>>char modelBuffer[256];
>>size_t sz = sizeof(modelBuffer);
>> 
>>if (0 == sysctlbyname("hw.model", modelBuffer, , NULL, 0)) {
>>modelBuffer[sizeof(modelBuffer) - 1] = 0;
>>return [NSString stringWithCString:modelBuffer
>> encoding:[NSString defaultCStringEncoding]];
>>}
>> 
>>return nil;
>> }
>> 
>> Regards, Rob.
>> 
>> 
>>> On 14 Sep 2015, at 01:09, John Daniel 
>> wrote:
>>> 
>>> Hello,
>>> Does anyone know of an API or utility that will identify specific Mac
>> models? The “Model Identifier” like “MacBook8,1” is not sufficient to
>> uniquely describe a model. MacBook8,1 covers all colours of the new
>> MacBook. I am trying to differentiate the silver, from the space grey, from
>> the gold.
>>> 
>>> My app has an animation where it cycles through various Macs like a slot
>> machine, finally landing on the user’s specific machine. I used to just
>> look at the “Model Identifier”. I could pretty easily identify the matching
>> machine image from
>> /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources.
>>> 
>>> However, the images for the new retina MacBook are in a different
>> location. I found where they live in an apparently randomly-named
>> framework, but I still can’t connect a specific image with the user’s
>> specific machine. There is a private API for the UIDevice class in iOS that
>> provides similar information. Is there anything like this for the Mac?
>>> 
>>> Thanks,
>>> 
>>> John Daniel
>> ___
>> 
>> 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/xhruso00%40gmail.com
>> 
>> This email sent to xhrus...@gmail.com
>> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/sqwarqdev%40icloud.com
> 
> This email sent to sqwarq...@icloud.com


___

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

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

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

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