Blessed helper (SMJobBless) Process Name?

2012-03-26 Thread Prime Coderama
I created a blessed helper and when I view it in Activity Monitor, it does not 
contain a Process Name.

Can somebody please refer me to the appropriate documentation as I can not find 
it.

Thanks,
Coderama
___

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


syslog with strings?

2012-03-23 Thread Prime Coderama
Trying to write out syslog entries containing strings but they don't register.

E.g.

// where person.name is an NSSTring
syslog(LOG_NOTICE, Some string %@, person.name);
___

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


NSFileOwnerAccountName will not assign to root

2012-03-20 Thread Prime Coderama
Does anyone know why the assignment of NSFileOwnerAccountName and 
NSFileGroupOwnerAccountName does not work? The directory created defaults to my 
account and the staff group.

NSFileManager *fileManager = [NSFileManager defaultManager];
NSMutableDictionary *attr = [NSMutableDictionary dictionary]; 
[attr setObject:@root forKey:NSFileOwnerAccountName];
[attr setObject:@wheel forKey:NSFileGroupOwnerAccountName]; 
[attr setObject:[NSNumber numberWithInt:0755] 
forKey:NSFilePosixPermissions];

[fileManager createDirectoryAtPath:dir withIntermediateDirectories:TRUE 
attributes:attr error:error];
___

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

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

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

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


Re: How to become root

2012-03-16 Thread Prime Coderama
Shouldn't the the SMJobBless example be used? Although I am still struggling to 
get this to work - even have an open Apple support issue.

On 16/03/2012, at 11:45 PM, Jean-Daniel Dupas wrote:

 
 Le 16 mars 2012 à 13:27, Gerriet M. Denkmann a écrit :
 
 
 On 16 Mar 2012, at 19:17, Jean-Daniel Dupas wrote:
 
 
 Le 16 mars 2012 à 12:33, Gerriet M. Denkmann a écrit :
 
 I have an app which needs to do (among other things) to call 
 task_for_pid() which seems to work only for root.
 
 The modern way to  do this is have a small companion tool which exchanges 
 info with my app via XPC. Correct?
 
 I am also thinking about sandboxing (just as a learning experience). Or is 
 root and sandboxing mutually exclusive?
 
 Then: how to make my companion tool run as root?
 Is there a sandboxing entitlement like: com.apple.security.rootAllowed?
 If not: what else to use?
 
 
 The short answer is don't expect to use task_for_pid with sandboxing. This 
 function is restricted for good reasons.
 
 Ok, so let's forget about sandboxing. Not very important - not aiming for 
 the Mac Store.
 
 What are you trying to do that require to get an other process mach port ? 
 Something like vmmap.
 
 So, I fear this is note the good list for such question. darwin-dev, will be 
 a better place.
 
 -- Jean-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/prime.coderama%40gmail.com
 
 This email sent to prime.coder...@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: No indentation when displaying an icon in an NSMenuItem

2012-03-08 Thread Prime Coderama
I should have been more specific with what I wanted. The icon was in fact a 
tickbox, and the solution was to use NSMenuItem's setSate with a value of 
NSOnState

On 07/03/2012, at 12:21 PM, Prime Coderama wrote:

 I am trying to add an icon to only one NSMenuItem item but it is indenting 
 the icon and text by 1 level.
 
 I tried to set the  to 0 but that doesn't work.
 
 An example of what I am trying to achieve can be seen in the Wireless status 
 bar menu where the tickbox is displayed against the current WiFi your 
 connected to e.g. http://cl.ly/2T362b2I0f1G1O3b3G3z
 
 Any tips are appreciated!

___

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


Problem with refreshing NSMenuItems

2012-03-08 Thread Prime Coderama
I have an NSMenu with the following static NSMenuItems

1. NSMenuItem Count of people (hidden)
2. NSMenuItem Separator (hidden)
3. NSMenuItem Separator
4. NSMenuItem Refresh List
5. NSMenuItem Separator
6. NSMenuItem Quit

I then dynamically add n-amount of NSMenuItems between (2) and (3). This works 
great.

The problem I am having, is when I hit Refresh, I am unsure on how to remove 
all of the dynamically added NSMenuItems from the NSMenu and add all of the new 
ones?

I am currently causing a mess using NSMenu:removeItemAtIndex.

Any suggestions?
___

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


Why are 2 Terminal windows opening with NSAppleScript?

2012-03-08 Thread Prime Coderama
If no Terminal app is open, the following code opens TWO Terminal windows. Why 
is it doing this? I only want one window to open.

If only one Terminal window is open, then the following code opens only ONE 
additional window.

NSAppleScript* terminal = [[NSAppleScript alloc] initWithSource:
   [NSString stringWithFormat:
@tell application \Terminal\\n
@activate\n
@do script \echo %@\\n
@tell the front window\n
@set title displays shell path to false\n
@set title displays custom title to true\n
@set custom title to \My session! %@\\n
@end tell\n
@end tell, name, name]];

[terminal executeAndReturnError:nil];
___

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


Dynamic NSMenuItems with default param

2012-03-08 Thread Prime Coderama
I am dynamically building menu's based on an array and there is a sub-menu is 
linked to an IBAction which opens a folder in Finder. The folder it opens is 
based on a property of the object in my initial array.

Is there a way of linked the NSMenuItem action to the IBAction and passing in 
this directory variable as I am dynamically creating this array?

OR should I be going into the IBAction and resolving the directory by 
referencing the NSMenuItem with against array?

I was thinking something along the lines of this:
person = [[Person alloc] init];
// person is assigned
subMenu = [[NSMenu alloc] init];
[subMenu addItemWithTitle:@Open folder 
action:@selector(openDirectory:person.directory) keyEquivalent:@];
___

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: Dynamic NSMenuItems with default param

2012-03-08 Thread Prime Coderama
Figured it out:
 NSMenuItem *menuItem;
 menuItem = [subMenu addItemWithTitle:@Open folder 
 action:@selector(openDirectory:person.directory) keyEquivalent:@];
 [menuItem setRepresentedObject:person];

On 08/03/2012, at 6:56 PM, Prime Coderama wrote:

 I am dynamically building menu's based on an array and there is a sub-menu is 
 linked to an IBAction which opens a folder in Finder. The folder it opens is 
 based on a property of the object in my initial array.
 
 Is there a way of linked the NSMenuItem action to the IBAction and passing in 
 this directory variable as I am dynamically creating this array?
 
 OR should I be going into the IBAction and resolving the directory by 
 referencing the NSMenuItem with against array?
 
 I was thinking something along the lines of this:
 person = [[Person alloc] init];
 // person is assigned
 subMenu = [[NSMenu alloc] init];
 [subMenu addItemWithTitle:@Open folder 
 action:@selector(openDirectory:person.directory) keyEquivalent:@];

___

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


String Constants the solution

2012-03-08 Thread Prime Coderama
I have references to 'ground' and 'air' in multiple files. It is usually used 
in this context, but not always.
   if ([transport.type isEqualToString:@ground]) {
 // do something for automobiles
   }
   else if ([transport.type isEqualToString:@air]) {
 // do something else for planes
   }
   else {
 // we don't care
   }

Should I be using string constants to represent 'ground' and 'air' so if I ever 
change their literal, I just update it in one place? e.g.
   NSString * const TransportGround = @ground;
   NSString * const TransportAir = @air;

I then decide I want to rename 'ground' to be 'wheels', then I would only 
update the above string constant.
___

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


No indentation when displaying an icon in an NSMenuItem

2012-03-07 Thread Prime Coderama
I am trying to add an icon to only one NSMenuItem item but it is indenting the 
icon and text by 1 level.

I tried to set the setIndentationLevel to 0 but that doesn't work.

An example of what I am trying to achieve can be seen in the Wireless status 
bar menu where the tickbox is displayed against the current WiFi your connected 
to e.g. http://cl.ly/2T362b2I0f1G1O3b3G3z

Any tips are appreciated!
___

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


Finding object array index when iterating through array

2012-03-06 Thread Prime Coderama
I have an array and I am iterating through it using this technique:

 for (id object in array) {
 // do something with object
 }

Is there  way to obtain the object's current array index position or do I have 
to add a counter?

Thanks in advance.
___

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


Running SMJobBless causes kSMErrorDomainFramework error

2012-03-03 Thread Prime Coderama
I am trying to install a helper tool via SMJobBless and it is returning this 
error:

System Preferences[22312:903] Bless Error: Error Domain=kSMErrorDomainFramework 
Code=5 UserInfo=0x2005790e0 The operation couldn’t be completed. 
(kSMErrorDomainFramework error 5 - The tool at the specified path is not 
valid.)

Any ideas on how to troubleshoot this?

This is a PrefPane project using xcode version 4 Build 4A304a
___

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

SMJobBless Copy Files subpath for PrefPane projects?

2012-03-03 Thread Prime Coderama
Does anyone know the correct Subpath to use for the Build Phases of the Target 
application of a PrefPane project?

e.g. in an Applications project, the subpath is 
Contents/Library/LaunchServices 
___

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


SMJobBless error: kSMErrorDomainFramework error 5 - The tool at the specified path is not valid

2012-03-03 Thread Prime Coderama
I writing a PreferencePane project and created a helper tool to perform actions 
that required an elevated privilege.

When I run my Preference Pane, I am getting this error:
 System Preferences[22312:903] Bless Error: Error 
 Domain=kSMErrorDomainFramework Code=5 UserInfo=0x2005790e0 The operation 
 couldn’t be completed. (kSMErrorDomainFramework error 5 - The tool at the 
 specified path is not valid.)

Any ideas on what this error means, how to debug it, what to check?
___

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