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

Re: Sorting an NSTableView bound to an NSArrayController.

2012-06-29 Thread Robert Tillyard
Thank you, Willeke,

That worked brilliantly.

Regards, Rob.

On 29 Jun 2012, at 22:15, Willeke wrote:

> 
> Op 28 jun 2012, om 17:44 heeft Robert Tillyard het volgende geschreven:
> 
>> 
>> I now I need to put a key and sort descriptor in IB but don't know what code 
>> I have to add to the Entity ot WindowController to handle it.
> 
> 
> You can create a category of NSString and implement your own compare method. 
> In IB you set the selector of the table column to this method.
> 
> Willeke
> ___
> 
> 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/rob2%40atvetsystems.com
> 
> This email sent to r...@atvetsystems.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


Sorting an NSTableView bound to an NSArrayController.

2012-06-28 Thread Robert Tillyard
Hello,

I'm writing an application that handles results for a running club.

I have an NSTableView that has columns bound to a CoreData Entity such as 
Entries.arrangedObjects.position, position is an NSString that contains numbers 
such as @"1" and @"2" or @"" but the position can also be @"DNF" (Did not 
finish).

I have a method in the WindowController that sorts the 'Entry' objects and 
handles these cases correctly returning an NSArray using:

   [array sortUsingComparator:^(id obj1, id obj2)
  {
  NSComparisonResult r;

  r = 

  return (r);
  }];

How can I get my table view to work so that when the user clicks in the Pos. 
column I can do my custom sort? at present it is doing an ASCII sort so I get 
1, 10, 100, then 2, 20, 200 etc...

I now I need to put a key and sort descriptor in IB but don't know what code I 
have to add to the Entity ot WindowController to handle it.


Thanks, regards, Rob.

___

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: NSTextField Tab Order. (Fixed)

2012-06-13 Thread Robert Tillyard

On 13 Jun 2012, at 22:50, Quincey Morris wrote:

> On Jun 13, 2012, at 14:15 , Robert Tillyard wrote:
> 
>> Window is created from a XIB using:
>> 
>> - (id)initWithManagedObjectContext:(NSManagedObjectContext *)inMoc
>> {
>>   if ((self = [super initWithWindowNibName:@"RunnersWindow" owner:self]))
>>  [self setManagedObjectContext:inMoc];
>> 
>>   return (self);
>> }
>> 
>> - (void)windowDidLoad
>> {
>>   [window setAutorecalculatesKeyViewLoop:NO];
>>   NSLog (@"windowDidLoad: Window = %@\n", window);
>> }
> 
>> I'd still like to fix my window == NULL problem
> 
> 
> You're referring to a "window" instance variable that NSWindowController does 
> not define, so I assume you defined it yourself. If so, that's a mistake. 
> You're supposed to refer to the "window" property -- self.window.
> 
> In IB, when you connect what looks alike a "window" outlet, you're actually 
> connecting the NSWindowController's private "_window" ivar (or perhaps, these 
> days, it's connecting the "window" property, I don't know). That means your 
> separately-defined "window" ivar won't get connected and will always contain 
> nil. You should get rid of this ivar from your subclass.
> 
> The other difficulty you're running into is that by design the window is not 
> created immediately when you create a window controller. (You say of your 
> code, above, that it creates a window from a XIB. It doesn't. It only creates 
> a window controller.)
> 
> Instead, the window is created the first time something refers to the window 
> controller's "window" property (e.g. 'self.window' if it's referred to from 
> within the window controller itself). At that point, the NIB is instantiated, 
> the window created, and 'windowDidLoad' is invoked.

Thanks to Ken, Dennis and Quincey.

I had an instance variable IBOutlet NSWindow *window in the header file that 
was shadowing the property.

Everything is working now.

Thanks everyone for taking the time to help.

Regards, Rob.

___

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: NSTextField Tab Order.

2012-06-13 Thread Robert Tillyard
Hello, Ken,

Thank you for your reply.

On 13 Jun 2012, at 10:47, Ken Thomases wrote:

> On Jun 13, 2012, at 3:40 AM, Robert Tillyard wrote:
> 
>> mind you despite window being hooked up in IB window == NULL
> 
> You need to figure this out first.  It's indicative of a deeper problem.

I've checked again and it's still NULL.

> Are you referring to the window property of a custom subclass of 
> NSWindowController?  Is this window controller being instantiated in code?  
> If so, what initializer is called?  How is that initializer implemented?  In 
> particular, I'm looking to make sure that -initWithWindowNibName: was called, 
> or, if -initWithWindowNibName:owner: was called instead that the window 
> controller passed itself as the owner (making use of that method redundant).

Window is created from a XIB using:

- (id)initWithManagedObjectContext:(NSManagedObjectContext *)inMoc
{
   if ((self = [super initWithWindowNibName:@"RunnersWindow" owner:self]))
  [self setManagedObjectContext:inMoc];
  
   return (self);
}

- (void)windowDidLoad
{
   [window setAutorecalculatesKeyViewLoop:NO];
   NSLog (@"windowDidLoad: Window = %@\n", window);
}


> In the NIB, did you set the class of File's Owner to be your window 
> controller class?  Was it File's Owner's window outlet that you hooked up?  A 
> common mistake is to actually instantiate the window controller in the NIB 
> and therefore have two window controllers.  That won't work right, obviously.

In the XIB Files Owner is set to my WindowController sub-class.

The Files Owner's window outlet says it's linked to window but I have in the 
past had problem in a different project where I had two awakeFromNibs called, I 
don't know how that happened but it seems that something I did in that project 
caused two instances of my window controller to be created.

How would I know if I've instantiated the window controller in my NIB? would I 
see two windowDidLoad messages?

> At what point did you attempt to use the window outlet?  If it was before 
> -awakeFromNib or -windowDidLoad, it would be too early.  A common mistake is 
> to attempt to reference the window during the initializer.
> 

I use the window outlet in windowDidLoad and in the method called by the 
NSControlTextDidEndEditingNotification notifications.

> 
>> I've tried hooking up the nextKeyView in IB but that doesn't help. I've also 
>> used [window setAutorecalculatesKeyViewLoop:NO]; in windowDidLoad (and in IB 
>> it's un-ticked) which doesn't help either
> 
> Did you set the initialFirstResponder outlet of the window to point to the 
> first key view in your loop?  According to the docs for -[NSWindow 
> recalculateKeyViewLoop], it is called "when [the window] is first loaded, ... 
> automatically if your window does not have a key view loop already 
> established".  I suspect that means if initialFirstResponder is not set.  So, 
> I suspect that failing to set that means that the method will blow away your 
> configuration of nextKeyView connections.

Okay, here I can see I screwed that up. I had no initialFirstResponder, now 
I've set it the tab order works perfectly.

I'd still like to fix my window == NULL problem as I would like to make the 
enter key move to the next field and skip fields if some earlier information 
means that future fields are not required.

> Regards,
> Ken

Thanks, again for taking the time to help. 

Regards, Rob.
___

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


NSTextField Tab Order.

2012-06-13 Thread Robert Tillyard
Hello, All,

I have a window with a number of NSTextFields in two columns. The natural flow 
of information would be to fill in one column then the other but the tab order 
goes left to right then down.

I've tried hooking up the nextKeyView in IB but that doesn't help. I've also 
used [window setAutorecalculatesKeyViewLoop:NO]; in windowDidLoad (and in IB 
it's un-ticked) which doesn't help either - mind you despite window being 
hooked up in IB window == NULL but the notifications below are being called and 
they don't work either.

Now I'm trying a notification system

For each NSTextField I use this in windowDidLoad:

   [[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector 
(controlTextDidEndEditing:)

name:NSControlTextDidEndEditingNotification
  object:titleField];



Then:

- (void)controlTextDidEndEditing:(NSNotification *)notification
{
NSTextField *f = [notification object];

   if (f == titleField)
  {
  [titleField resignFirstResponder];
  [window setInitialFirstResponder:forenameField];
  }
   else if (f == forenameField)
  [forenameField resignFirstResponder];
  [window setInitialFirstResponder:surnameField];
  ...


but this isn't working either.

I'm sure there must be an easier way to do this, would anyone know what it is?

Regards, Rob.
___

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: [iPhone] Sample code for live camera stream?

2012-05-25 Thread Robert Tillyard
On 25 May 2012, at 16:28, Fritz Anderson wrote:

> I know I'm replying to a two-and-a-half-year-old thread, but I'm curious…
> 
> On 15 Dec 2009, at 5:14 PM, Luke the Hiesterman wrote:
> 
>> On Dec 15, 2009, at 3:11 PM, Gabriel Zachmann wrote:
>> 
>>> According to this
>>> http://www.tuaw.com/2009/12/14/app-store-approved-app-brings-video-recording-to-iphone-3g-and-1/
>>> they use the non-documented UIGetScreenImage().
>>> 
>>> I'd love to use that if it's the only way -- if only somebody could provide 
>>> me with some simple sample code how to use it .
>> 
>> while (youWantImages)
>> {
>>  CGImageRef image = UIGetScreenImage();
>>  //process image here
>>  CGImageRelease(image); //even though this is a Get function, it returns 
>> a retained image.
>> }
>> 
>> Luke
> 
> As far as I can tell, UIGetScreenImage() remains unpublished. What's the 
> status? Will it still get past review?
> 
>   — F

The e-mail below would suggest no:

Regards, Rob.


>> Thank you for submitting XXX App Store.
>> 
>> XXX cannot be posted to the App Store because it is using private or 
>> undocumented APIs:
>> 
>> Private Symbol References
>> UIGetScreenImage
>> As you know, as outlined in the iPhone Developer Program License Agreement 
>> section 3.3.1, the use of non-public APIs is not permitted. Before your 
>> application can be reviewed by the App Review Team, please resolve this 
>> issue and upload a new binary to iTunes Connect.
>> 
>> Sincerely,
>> 
>> iPhone Developer Program
>> 

___

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: WWDC

2012-04-25 Thread Robert Tillyard
Although I'd love to go to WWDC being based in the UK makes it expensive and 
difficult but I don't feel that I miss out too much as I can watch the sessions 
which really helps me learn new stuff.

Regards, Rob.

On 25 Apr 2012, at 20:11, Thomas Davie wrote:

> Do you have a bug number that I could reference?
> 
> I'd probably like to file one asking them to do *several* WWDCs around the 
> world – the cost to people in the bay area is already pretty high ($1.6k ish 
> per attendee), but to someone in the UK, the cost is more like $4k per 
> attendee.  Plus of course doing several would kill the second stone of having 
> more spaces available!
> 
> Bob
> if (*ra4 != 0xffc78948) { return false; }


___

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

Core Image Capture: ICScanner and brightness/contrast adjustments.

2011-10-05 Thread Robert Tillyard
Hello,

I'm struggling to find documentation on using ICScanner apart from the Scanner 
Browser example which was really great and helped a lot but the images that are 
scanned are too light.

In some scanner apps the user can set the brightness/contrast then scan to get 
a better image.

Do I need to pass some values to the ICScanner to do this? Again can't find any 
documentation on this or anything useful from the ICScanner.h, ICDevice.h or 
ICScannerFunctionalUnit.h headers.

I need to support 10.6 so I don't want to dump all of the code and use another 
framework unless I really have to.

Thanks, regards, Rob.___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Scanning images

2011-08-09 Thread Robert Tillyard
Hello, Eric,

I thought that the machines I'm running it on were a range of 10.5 and 10.6 but 
it looks like I'm probably mistaken there. Sorry.

Regards, Rob.

On 9 Aug 2011, at 16:54, Eric Matecki wrote:

> Hi Robert,
> 
> I just downloaded it, but the Build (and Runtime) Requirements are Mac OS X 
> 10.6 or later.
> 
> I still tried to compile it, and ImageCaptureCore.Framework doesn't exists on 
> 10.5.8
> 
> How did you get it to work on 10.5 ?
> 
> Thanks.
> 
> Robert Tillyard wrote:
>> Hello, Eric,
>> Take a look at the Scanner Bowser example code, I'm using that on 10.5 and 
>> 10.6 I assume it will work on PPC.
>> Regards, Rob.
>> On 9 Aug 2011, at 16:14, Eric Matecki wrote:
>>> Hello,
>>> 
>>> I need to scan images into my app.
>>> Which technology should I use, it has to work from 10.5.x upwards, PPC and 
>>> Intel, 32 and 64 bits.
>>> 
>>> I know only of ICA.
>>> Is there something "better" (ICA dates back to 10.2) ?
>>> 
>>> Thanks.
>>> 
>>> -- 
>>> Keep intel OUTSIDE my Mac !
>>> Hiii !!! I can see Intel chips creeping around my G5 !
>>> 
>>> Eric M.
> 
> 
> -- 
> Keep intel OUTSIDE my Mac !
> Hiii !!! I can see Intel chips creeping around my G5 !
> 
> Eric M.
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Instantly delete a directory without recursion?

2010-10-04 Thread Robert Tillyard
Hello, Oleg,

If you're worried about the time this would take and you need an instant 
results you could rename the folder (which is virtually instantaneous) then 
remove the renamed folder and it's contents in a background thread.

Regards, Rob.

On 4 Oct 2010, at 09:03, Oleg Krupnov wrote:

> Hi,
> 
> Is there a way to delete a directory instantly and completely without
> first deleting all its subdirectories and files recursively?
> 
> Thanks.
> 
> Oleg.
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Programming Style: Method Definition with or without a semicolon.

2009-10-15 Thread Robert Tillyard
I keep meaning to file an enhancement request for the space before  
()'s, I have to go back and manually change every occurrence and then  
add spaces after the commas in the function arguments.


I also prefer

- (void)foo
{
}

over

- (void)foo {
}

Regards, Rob.

On 16 Oct 2009, at 02:30, Roland King wrote:

I'm ploughing it with you, I hate it too and spend 30 seconds every  
time I let XCode stub out a function for me moving the brace onto  
the correct line,  
andputtingspacesbackbetweenparanetheses,bracketsandarguments so I  
have a hope in hell of reading the code later.


I came across that trailing ';' thing the other day purely by  
accident and couldn't believe my code actually worked.


I think I'll take this over to XCode and ask about it.


___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Getting the Generic Hard Disk Icon?

2009-03-27 Thread Robert Tillyard

Hello, Dave,

There might be a better way but I've been using:

NSImage *icon = [[NSWorkspace sharedWorkspace] iconForFile:@"/"];

You will need to know the UNIX path of the disk first.

Regards, Rob.

On 27 Mar 2009, at 10:58, Dave wrote:


Hi All,

Where can I get the Icon for the standard Internal Hard Disk Icon?  
I've looked in /System/Library/CoreServices/CoreTypes.bundle/ 
Contents/Resources and found a lot of icon's there, but not one for  
the hard disk. I just want the Icon the Finder displays for the  
internal hard drive.


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:
http://lists.apple.com/mailman/options/cocoa-dev/rob2%40atvetsystems.com

This email sent to r...@atvetsystems.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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: In receiver application, getting file passed in from NSWorkspace openFile:withApplication:

2008-03-17 Thread Robert Tillyard
If you're looking fot the equivalent of argc/argv you might be looking  
for...


NSProcessInfo *procInfo = [NSProcessInfo processInfo];
NSArray *args = [procInfo arguments];


Regards, Rob.

On 17 Mar 2008, at 16:56, Ryan Chapman wrote:


Hi all,


I have an application that uses NSWorkspace  
openFile:withApplication: to launch another application:



[[NSWorkspace sharedWorkspace] openFile:@"/tmp/test.mp3"
withApplication:@"/Applications/ 
MaxPostProcessing.app"]



In MaxPostProcessing.app, how can I determine the file that was the  
parameter passed to openFile:  ??



I've tried using the arguments (argv) passed into main(), but only  
see "-psn_0_188462" as argv[1].
I also tried NSNotificationCenter, but am not seeing any output from  
my observer method obsMethod:(id)aNotification



Can someone point me in the right direction?


Thanks alot!


-Ryan


___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]