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, &sz, NULL, 0)) { modelBuffer[sizeof(modelBuffer) - 1] = 0;

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] readD

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 NSFlippedClipVie

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 a

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 20

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 har

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 thos

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 jus

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 t

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 ScrollV

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

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 i

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 nece

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/

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”

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 Grav

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 y

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 differen

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 > t

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]; >> >>

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

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#//ap

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 oth

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 t

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. M

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 tha

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) Tha

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

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

[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

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

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 wrot

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 wou

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 overr

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 cus

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 ot

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

. Re: API to determine status of System Integrity Protection?

2015-09-14 Thread Stephane Madrau
2015-09-14 21:00 GMT+02:00 : > > 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 d