Authorization Services

2014-04-26 Thread Eric Smith
All,

New to Authorization, and it's got me a little turned around.  Can someone post 
a code snippet that shows how to us authorization services to run 'sudo chown' 
from within Cocoa?

Thanks in advance!

Eric
___

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

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

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

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

popup menus and toolbar buttons

2013-06-15 Thread Eric Smith
Anyone know how to attach a popup menu to a toolbar button, as with the 'run' 
button in Xcode?  I want to give users a choice of action via a popup menu if 
they hold down one of my toobar buttons.

Thanks in advance,
Eric
___

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

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

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

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

Re: getting a nsurl file size

2012-01-29 Thread Eric Smith
The getResource... method returns YES whether I pass @content-length or 
NSURLFileSize (I tried that one first).

Eric


On Jan 28, 2012, at 10:21 PM, Ken Thomases wrote:

 On Jan 28, 2012, at 11:53 PM, Eric Smith wrote:
 
 I'm trying to determine the size of a file on a server.  If I send the 
 following message to an NSURL named path, I get:
 
 [path getResourceValue:value forKey:@content-length error:error];
 
 value comes back nil.
 
 Two things:
 
 * Did the method return TRUE or FALSE?  If FALSE, what error did you get back?
 
 * The keys that are valid for that method are those listed in the NSURL 
 documentation.  They may bear no relation to HTTP response header fields.  
 So, I see no reason to believe that content-length is a valid key.  Have 
 you tried NSURLFileSizeKey?
 
 
 If I send:
 
 value = [path propertyForKey:@content-length];
 
 which is deprecated, I get the correct file size.
 
 That may be fluke.
 
 Regards,
 Ken
 

___

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

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

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

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


Re: getting a nsurl file size

2012-01-29 Thread Eric Smith
Charles,

Works like a charm.  Thank you!

Eric


On Jan 28, 2012, at 11:28 PM, Charles Srstka wrote:

 On Jan 29, 2012, at 12:21 AM, Ken Thomases wrote:
 
 * The keys that are valid for that method are those listed in the NSURL 
 documentation.  They may bear no relation to HTTP response header fields.  
 So, I see no reason to believe that content-length is a valid key.  Have 
 you tried NSURLFileSizeKey?
 
 
 If I send:
 
 value = [path propertyForKey:@content-length];
 
 which is deprecated, I get the correct file size.
 
 That may be fluke.
 
 NSURL’s now deprecated -propertyForKey: method existed long before any of 
 those NSURL*Key constants did, so it’s difficult to imagine what could have 
 been passed to it other than HTTP response header field names.
 
 At any rate, this should do what you want:
 
 NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:url];
 
 req.HTTPMethod = @HEAD;
 [req setValue:@ forHTTPHeaderField:@Accept-Encoding];
 
 void (^completionBlock)(NSURLResponse *resp, NSData *data, NSError *error) = 
 ^(NSURLResponse *resp, NSData *data, NSError *error) {
 if([resp isKindOfClass:[NSHTTPURLResponse class]]) {
 NSLog(@length is %@, [((NSHTTPURLResponse *)resp).allHeaderFields 
 objectForKey:@Content-Length]);
 }
 };
 
 [NSURLConnection sendAsynchronousRequest:req queue:[NSOperationQueue 
 mainQueue] completionHandler:completionBlock];
 
 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

getting a nsurl file size

2012-01-28 Thread Eric Smith
All,

I'm trying to determine the size of a file on a server.  If I send the 
following message to an NSURL named path, I get:

[path getResourceValue:value forKey:@content-length error:error];

value comes back nil.  If I send:

value = [path propertyForKey:@content-length];

which is deprecated, I get the correct file size.  What is the proper way to 
get a file size for a file specified with a web address?

Thanks,
Eric

___

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

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

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

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


controlling a camcorder

2012-01-18 Thread Eric Smith
All,

I'm trying to grab video from a Dazzle Hollywood or an ADVC-55.  Over both of 
these interfaces I can grab video by opening iMovie, selecting the interface 
and pressing play.  However, when I try to grab video with the 
QTCaptureDevice interface, I just get a blank screen (iSight and other 
streaming video inputs work... but not these frame grabbers).  It seems I need 
the equivalent of a play button in the QTKit API.  Anyone know how to do this?

Thanks,
Eric

___

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

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

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

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


drag and drop to the finder

2011-12-02 Thread Eric Smith
All,

I want to declare a drag type that the finder will recognize, but that can be 
used for other destinations as well, like mail.  Right now, my users have to do 
option+drag for dragging files to the finder, in which case I call [NSView 
dragPromisedFilesOfType:..], and if they want to drag to something like mail 
they just drag, in which case I call [pboard declareTypes:...].  I can't figure 
out how to declare a type that will cause the finder to request the data.  How 
the heck do I do this?  All the sample code I've seen either drags to some 
application, or drags to the finder.. they're not combined.

Thanks in advance,
Eric

___

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

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

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

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


Re: QCRenderer.... how do you do that?: solved

2010-04-11 Thread Eric Smith
All,

I had tried to create this attached to an OpenGLContext, but apparently didn't 
do it right.  I found the answer at: http://developer.casgrain.com/?p=4

Problem solved.

Eric

On Apr 10, 2010, at 6:56 PM, Eric Smith wrote:

 I'm trying to use a Quartz Composer filter in a cocoa app.  I've published 
 inputs and outputs: one image input, one image output.  I can successfully 
 set the input image, but when I try to get the output image, I get 0x0 no 
 error messages, just a null pointer.
 
 Here's my code:
 
 QCComposition* myComp = [QCComposition 
 compositionWithFile:@/Users/esmith/Desktop/Simple.qtz];
 QCRenderer* myRenderer = [[QCRenderer alloc] initWithComposition:myComp 
 colorSpace:CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB)];
 
 NSBitmapImageRep* theRep = [[[NSBitmapImageRep alloc] 
 initWithCIImage:[ciImageRep CIImage]] autorelease];
   
 BOOL isSet = [myRenderer setValue:theRep forInputKey:@InputImage];
 NSBitmapImageRep* theOutput = [myRenderer valueForOutputKey:@OutputImage 
 ofType:@Image];
 
 Am I missing a step where I tell the renderer to render?  (PS, I've tried 
 renderattime:0, but it doesn't help).
 
 Ideas?
 
 Thanks,
 Eric
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/eric_h_smith%40mac.com
 
 This email sent to eric_h_sm...@mac.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


QCRenderer.... how do you do that?

2010-04-10 Thread Eric Smith
I'm trying to use a Quartz Composer filter in a cocoa app.  I've published 
inputs and outputs: one image input, one image output.  I can successfully set 
the input image, but when I try to get the output image, I get 0x0 no error 
messages, just a null pointer.

Here's my code:

QCComposition* myComp = [QCComposition 
compositionWithFile:@/Users/esmith/Desktop/Simple.qtz];
QCRenderer* myRenderer = [[QCRenderer alloc] initWithComposition:myComp 
colorSpace:CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB)];

NSBitmapImageRep* theRep = [[[NSBitmapImageRep alloc] 
initWithCIImage:[ciImageRep CIImage]] autorelease];

BOOL isSet = [myRenderer setValue:theRep forInputKey:@InputImage];
NSBitmapImageRep* theOutput = [myRenderer valueForOutputKey:@OutputImage 
ofType:@Image];

Am I missing a step where I tell the renderer to render?  (PS, I've tried 
renderattime:0, but it doesn't help).

Ideas?

Thanks,
Eric

___

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

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

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

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


problem with distributed objects

2010-02-15 Thread Eric Smith
OK, I'm back.

I have some distributed object code that used to work just great (back in the 
Tiger days, I think), and now does not.  I see the error: [NSPortCoder 
sendBeforeTime:sendReplyPort:] timed out, when I try to get the rootProxy from 
a connection.  I see this mentioned here and there on various mailing lists, 
but haven't seen any solution. 

I need to provide a DO across a network.  The simple code Apple provides in the 
DO programming guide does work on a single machine:

vend it
/* Assume serverObject has a valid value of an object to be vended. */
NSConnection *theConnection;
 
theConnection = [NSConnection defaultConnection];
[theConnection setRootObject:serverObject];
if ([theConnection registerName:@server] == NO) {
/* Handle error. */
}

get it
id theProxy;
theProxy = [[NSConnection
rootProxyForConnectionWithRegisteredName:@server
host:nil] retain];
[theProxy setProtocolForProxy:@protocol(ServerProtocol)];



But if one initializes the connection with an NSSocketPort, which is required 
if one wants to talk beyond a single machine, the registerName message fails.  
So, I whip out the code that used to work.  The few relevant parts listed below:

vend it:

conduitPort = [[NSSocketPort alloc] init];
myConduit = [[ServerConduit alloc] init];
conduitConnection = [[NSConnection alloc] initWithReceivePort:conduitPort 
sendPort:nil];
[conduitConnection setRootObject:myConduit];

get it:
- (void)netServiceDidResolveAddress:(NSNetService *)netService{
struct sockaddr *address;

NSConnection* theConnection;
NSSocketPort* thePort;
NSSocketPort* socket;
printf(\resolved address\n);
socket = [[NSSocketPort alloc] init];
if([[netService addresses] count]  0){
address = (struct sockaddr *)[[[netService addresses] 
objectAtIndex:0] bytes];
thePort = [[NSSocketPort alloc] 
initRemoteWithProtocolFamily:address-sa_family socketType:SOCK_STREAM 
protocol:0 address:[[netService  addresses] 
objectAtIndex:0]];
theConnection = [[NSConnection alloc] initWithReceivePort:nil 
sendPort:thePort];
[thePort release];
id theProxy = [theConnection rootProxy];
}else{
NSLog(@Could not find an address for the service.);
}
}


When I call rootProxy, I get the time out error.  Does anyone have a 
dirt-simple sample app I can look at that vends, and gets, a DO over a network 
on 10.5 or later?!  

Thanks for the help,
Eric

___

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

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

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

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


problems with distributed objects

2010-02-14 Thread Eric Smith
OK... I've got what must be a trivial problem.  I'm running two applications on 
the same computer (intel iMac).  I'm just cutting and pasting code from the 
XCode help pages, describing how to vend and obtain a distributed object.  Code 
is below:

Application #1:

myConduit = [[ServerConduit alloc] init];
conduitConnection = [[NSConnection new] autorelease];
[conduitConnection setRootObject:myConduit];
if ([conduitConnection registerName:@rvserver] == NO) {
/* Handle error. */
printf(\nno\n);
}


Application #2:

id theProxy;
BOOL valid;
NSConnection* theConnection = [NSConnection 
connectionWithRegisteredName:@rvserver host:nil];
theProxy = [theConnection rootProxy];


All lines of App1 execute with no error, and there are no nil returned values.

App2 gets a valid connection, but hangs when getting the rootProxy.  It's so 
simple that it defies debugging!  Can anyone help?

Regards,
Eric

___

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

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

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

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


Re: problems with distributed objects

2010-02-14 Thread Eric Smith
OK... never mind, everyone.  When I saw my own post, I recognized the 
autorelease as the problem.

Eric

On Feb 14, 2010, at 7:48 PM, Eric Smith wrote:

 OK... I've got what must be a trivial problem.  I'm running two applications 
 on the same computer (intel iMac).  I'm just cutting and pasting code from 
 the XCode help pages, describing how to vend and obtain a distributed object. 
  Code is below:
 
 Application #1:
 
   myConduit = [[ServerConduit alloc] init];
   conduitConnection = [[NSConnection new] autorelease];
   [conduitConnection setRootObject:myConduit];
   if ([conduitConnection registerName:@rvserver] == NO) {
   /* Handle error. */
   printf(\nno\n);
   }
 
 
 Application #2:
 
   id theProxy;
   BOOL valid;
   NSConnection* theConnection = [NSConnection 
 connectionWithRegisteredName:@rvserver host:nil];
   theProxy = [theConnection rootProxy];
 
 
 All lines of App1 execute with no error, and there are no nil returned values.
 
 App2 gets a valid connection, but hangs when getting the rootProxy.  It's so 
 simple that it defies debugging!  Can anyone help?
 
 Regards,
 Eric
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/eric_h_smith%40mac.com
 
 This email sent to eric_h_sm...@mac.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


NSAffineTransform

2010-01-09 Thread Eric Smith
I have the following code:

CIFilter* vertFlipFilter   = [CIFilter filterWithName: @CIAffineTransform];
NSAffineTransform* vertFlipTransform = [NSAffineTransform transform];
CIImage* theImage = [[CIImage alloc] initWithCGImage:imageOne];
[vertFlipTransform translateXBy:100. yBy:1000];
[vertFlipFilter setDefaults];
[vertFlipFilter setValue:theImage forKey:@inputImage];
[vertFlipFilter setValue:vertFlipTransform forKey:@inputTransform];
[theImage release];
theImage = [[vertFlipFilter valueForKey:@outputImage] retain];


Which produces an output image that's identical to the input image... i.e. not 
translated.  If I replace the translateXBy:... with rotate or scale, it works 
just great.  Can someone tell me what's different about the translate transform?

Thanks,
Eric

___

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

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

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

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


dragging images to the finder

2009-01-11 Thread Eric Smith

All,

I'm trying to get drag-and-drop to work, using the finder as a  
destination.  I can drag my files into mail using NSTIFFPboardType.   
My draggingSourceOperationMaskForLocal returns NSDragOperationEvery.   
But, when I drag my file onto a finder window, I get no icon at all...  
no little green plus indicating a copy.  My pasteboard:  
provideDataForType: is never called by the finder.  How the heck to I  
get the finder to accept a drop??


Thanks,
Eric

___

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

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

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

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