Re: iPhone NDA dropped

2008-10-02 Thread Christian Giordano
This is a great news! I hope is not because Apple got too scared of Android :D

chr



On Wed, Oct 1, 2008 at 4:45 PM, Marc Stibane <[EMAIL PROTECTED]> wrote:
> http://developer.apple.com/iphone/program/
>
> Will there be an iPhone list or can we post questions here?
>
>
> --
>
> In a world without walls and fences,
>   who needs windows and gates?
>
>
>
>
>
> ___
>
> 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/christian%40nuthinking.com
>
> This email sent to [EMAIL PROTECTED]
>
___

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]


Re: Drag and drop from NSCollectionView (bug?)

2008-10-02 Thread Matteo Manferdini
That's bad, I need also to call super mouseDown:, to manage selection of the
object (visually and into the controller bounded to core data). I also
worked a lot on this and it would be a pity to just drop it because I can't
use drag and drop (that is fundamental in my app). :(
The problem is that NSCollectionView also eats events directed to the custom
view I use inside of it (apart of mouseDown:, which it forwards).
Maybe I can manage selection via my custom view. I'll give it a try.
Thank you very much.
Bye.

Matteo Manferdini

2008/10/2 Graham Cox <[EMAIL PROTECTED]>

>
> On 2 Oct 2008, at 4:02 pm, Matteo Manferdini wrote:
>
>  I subclassed them both and implemented mouseDragged: method, but if i put
>> a breakpoint inside of both of them, I see it never gets called when I drag
>> the mouse. Other methods (like mouseDown:) work well, so I wonder why this
>> method isn't working.
>> Has anyone been able to make this work? Any clue? May be this a bug?
>>
>
>
> It's probably because NSCollectionView implements its own mouse tracking
> loop, which is all handled in mouseDown: It then flushes events when it
> finishes so that the view's -mouseDragged: and -mouseUp: methods are not
> called. This isn't all that unusual.
>
> If you override -mouseDown: to NOT call super, you should find that
> -mouseDragged: gets called. If it does, this confirms the presence of an
> internal tracking loop.
>
> It should be possible to graft on NSDraggingSource features using this
> information, though discriminating between the users intentions - dragging
> an item off versus dragging out a number of selected items in the view  -
> might be tricky.
>
>
> hth,  Graham
>
___

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]


Re: Cocoa Programming iPing exercise

2008-10-02 Thread Simon Wolf

On 1 Oct 2008, at 18:25, Shawn Protsman wrote:

I finally decided to take a dive into Objective-C with Xcode. I'm  
looking at the iPing example in Hillegass' latest book, Cocoa  
Programming. iPing works fine as coded in the book. Next, I decided  
to replace `ping` with a binary I wrote called `keyreq`. It is  
simply a C program and resides in /usr/local/bin.


[snip]

Here is the project code for the startStopPing method (the relevant  
part that I think I should change) of iPing:


task = [[NSTask alloc] init];
[task setLaunchPath:@"/sbin/ping"];
NSArray *args = [NSArray arrayWithObjects:@"-c10",
 [hostField stringValue], nil];
[task setArguments:args];

Perhaps stupidly, I thought I could just swap out setLaunchPath and  
then change NSArray:


task = [[NSTask alloc] init];
[task setLaunchPath:@"/usr/local/bin/keyreq"];
NSArray *args = [NSArray arrayWithObject:[hostField stringValue]];
[task setArguments:args];

'Build and Go' compiles clean but upon entering a number, like 1 in  
hostField, and then clicking 'Start' results in the 'Debugger  
Console' going to gdb. With the above modification, I can return  
setLaunchPath to /sbin/ping and the program works fine.


As a novice myself I can't immediately spot a problem with what you  
have done so it may be that the error is not in the code you have  
pasted into your message. If you add a breakpoint and step through you  
should be able to find out exactly where the code is failing which  
would make it easier to track down the problem.


I'd suggest adding a breakpoint to the line where you initialise the  
NSTask object and then step through your code until it errors and then  
post back here with more details.


Simon
___

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]


Re: Cocoa Programming iPing exercise

2008-10-02 Thread Stephen J. Butler
On Wed, Oct 1, 2008 at 12:25 PM, Shawn Protsman <[EMAIL PROTECTED]> wrote:
> 'Build and Go' compiles clean but upon entering a number, like 1 in
> hostField, and then clicking 'Start' results in the 'Debugger Console' going
> to gdb. With the above modification, I can return setLaunchPath to
> /sbin/ping and the program works fine.
>
> Me, a novice, is confused. Any pointers to documentation, examples, etc.
> would be helpful.

What's the stack trace when you enter the debugger?
___

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]


Re: Direct use of NSScroller?

2008-10-02 Thread chaitanya pandit

How about using a NSSlider?

On 02-Oct-08, at 7:43 AM, James Walker wrote:

Is it possible to use a scroller without a scroll view?  The first  
problem is that IB won't let me create an NSScroller that is not  
embedded in an NSScrollView.  I guess I could shrink down the  
NSScrollView so that you only see the one scroll bar.  Then the next  
problem would be how to set the current value.  I see the method  
setFloatValue:knobProportion:, which I guess would set the current  
value.  But this method is marked deprecated in 10.5, with no  
explanation of why it's deprecated or what one should do instead.


I suppose someone is sure to ask why I can't use NSScrollView.  I'm  
doing a kind of scrolling that isn't just shifting a view around.   
Some members are arranged in two rows, like so...


1  2  3
4  5  6

and when you scroll right, they change like this...

2  3  4
5  6  7

and so on.
--
 James W. Walker, Innoventive Software LLC
 
___

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/chaitanya%40expersis.com

This email sent to [EMAIL PROTECTED]


___

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]


Re: How to get AirPort Connection Status

2008-10-02 Thread Rashmi Vyshnavi
Thanks for the help..

On Fri, Sep 19, 2008 at 2:15 AM, Bob Clark <[EMAIL PROTECTED]> wrote:

> I found this page to be helpful:
>
> http://developer.apple.com/qa/qa2001/qa1133.html
>
> It's about the currently-logged in user, but the MyNotificationProc
> callback is called for a lot of changes, including IIRC the network
> connection transitions.
>
> In the callback function you can do something like this:
>
>NSArray* arr = (NSArray*)changedKeys;
>NSLog(@"changed keys %@", [arr description]);
>
> to sort of figure out what kinds of information you're getting.
>
> --Bob
>
>
> --
> Bob Clark
> Lead Software Development Engineer
> RealPlayer Mac/Unix
> RealNetworks, Inc.
>
>
>
> On Sep 17, 2008, at 9:50 PM, Rashmi Vyshnavi wrote:
>
>  I want to know when my computer connects/disconnects to WiFi/AirPort
>> network.
>> Is there a way to get the status of connection to a WiFi network. I tried
>> using System Configuration API,but I could not get the status. Here is the
>> snippet
>> --
>> static void MyNetworkConnectionCallBack(SCNetworkConnectionRef
>> connection,SCNetworkConnectionStatus stat,void *info)
>> {
>> printf("Call back called \n");
>> SCNetworkConnectionStatus status =
>> SCNetworkConnectionGetStatus(connection);
>> switch(status) {
>> case kSCNetworkConnectionInvalid:
>> printf("Connection invalid\n");
>> break;
>> case kSCNetworkConnectionDisconnected:
>> printf("Connection disconnected\n");
>> break;
>> case kSCNetworkConnectionConnecting:
>> printf("Connection connecting\n");
>> break;
>> case kSCNetworkConnectionConnected:
>> printf("Connection connected\n");
>> break;
>> case kSCNetworkConnectionDisconnecting:
>> printf("Connection disconnecting\n");
>> break;
>> }
>>
>> }
>>
>> int main (int argc, const char * argv[]) {
>> CFDictionaryRef userOptions;
>> bool scResult;
>> SCNetworkConnectionContext scncctx = {0, NULL, NULL, NULL, NULL};
>>
>> CFStringRef currentServiceId;
>>
>> scResult = SCNetworkConnectionCopyUserPreferences(NULL, ¤tServiceId,
>> &userOptions);
>>
>>
>> SCNetworkConnectionRef connection = nil;
>> connection = SCNetworkConnectionCreateWithServiceID (NULL,
>> currentServiceId,
>> MyNetworkConnectionCallBack, &scncctx );
>> SCNetworkConnectionStatus status =
>> SCNetworkConnectionGetStatus(connection);
>> if(status == kSCNetworkConnectionConnected)
>> printf("connected \n");
>> else
>>  printf("current status :%d\n", status);
>>
>>
>> SCNetworkConnectionScheduleWithRunLoop(connection,CFRunLoopGetCurrent(),kCFRunLoopDefaultMode);
>>
>>
>>
>> CFRunLoopRun();
>>
>> return 0;
>> }
>> --
>> Am able to get connection status if I connect to a modem, but it fails
>> when
>> connected
>> to a WiFi/AirPort network.
>>
>> Thanks,
>> Rashmi
>> ___
>>
>> 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/bobclark%40real.com
>>
>> This email sent to [EMAIL PROTECTED]
>>
>
>
>


-- 
Rashmi Vyshnavi
___

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]


Re: -[NSScanner scanUpToString:stopString:NULL] - 10.3.9 Crash, due Xcode 3.1?

2008-10-02 Thread Karan, Cem (Civ, ARL/CISD)
>Yes, I see what you mean there.  It looks suspicious without the rest  
>of the code.  Here is the entire method (without the logging)
>
>- (BOOL)scanUpToAndThenLeapOverString:(NSString*)stopString
>intoString:(NSString**)stringValue {
> [self scanUpToString:stopString intoString:stringValue] ;
> BOOL result = [self scanString:stopString intoString:NULL] ;
>
> return result ;
>}
>
>So you see I'm just passing that NSString** through in order to  
>provide this handy addition to NSScanner.  I've use this method "all  
>over the place" with no trouble.
>
>And in this particular case, my invocation passes NULL for the second  
>argument, and it logged as NULL (see original post), so I can't see  
>how that value could be a problem.

I'm coming into this late, but are you positive you never accidentally pass in 
NULL like so:?

[blah scanUpToAndThenLeapOverString:@"someString" intoString:NULL];

Try logging what comes in and see if you ever actually do pass in NULL.

- (BOOL)scanUpToAndThenLeapOverString:(NSString*)stopString
   intoString:(NSString**)stringValue {
if (stringValue == nil)
{
NSLog("stringValue cannot be NULL!");
return NO;
}

 [self scanUpToString:stopString intoString:stringValue] ;
BOOL result = [self scanString:stopString intoString:NULL] ;

 return result ;
}

Good luck,
Cem Karan
___

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]

Re: Cocoa Programming iPing exercise

2008-10-02 Thread Joe Keenan


On Oct 1, 2008, at 1:25 PM, Shawn Protsman wrote:



Here is the project code for the startStopPing method (the relevant  
part that I think I should change) of iPing:


task = [[NSTask alloc] init];
[task setLaunchPath:@"/sbin/ping"];
NSArray *args = [NSArray arrayWithObjects:@"-c10",
 [hostField stringValue], nil];
[task setArguments:args];

Perhaps stupidly, I thought I could just swap out setLaunchPath and  
then change NSArray:


task = [[NSTask alloc] init];
[task setLaunchPath:@"/usr/local/bin/keyreq"];
NSArray *args = [NSArray arrayWithObject:[hostField stringValue]];
[task setArguments:args];

'Build and Go' compiles clean but upon entering a number, like 1 in  
hostField, and then clicking 'Start' results in the 'Debugger  
Console' going to gdb. With the above modification, I can return  
setLaunchPath to /sbin/ping and the program works fine.


You forgot the nil argument at the end of the array.  Try:

	NSArray *args = [NSArray arrayWithObjects:[hostField stringValue],  
nil];


joe

___

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]


Re: Core Data: Copying and pasting chained entities (Renaud C?roce)

2008-10-02 Thread Renaud Céroce

Hi Daniel, thanks for answering,


I guess my question was unclear, so I'm going to sum it up: How do I (with
Core Data) implement Copying and pasting within my application ?

Your message made me realise that I assumed I had to use the system
Pasteboard. But as long as data remains within my application, I obviously
do not have to.
Now back to the solution you propose: it won't provide the expected
behaviour. Let me explain, and you shall understand what my question is all
about:

When the figure is copied, I can not put it in the managed object context.
Why ? Because the copied figure would be saved on disk. The application
must wait for the user to paste the figure before inserting it in the
managed object context. So it really ought to save the figure and the
associated entities somewhere else (in an other managed object context ?
Maybe).

>From what I read, without Core Data, copying is usually implemented using
NSArchiver. Each object (Figure, FillStyle, FillColor) implements the
encodeWithCoder: method,  so it can choose what properties matter, and copy
them to the archive. An interesting point is the relationships among the
objects are stored in the archive too, and every objects referenced by the
root object either directly or indirectly will have its encodeWithCoder:
method called. The NSArchiver's data is then put to the pasteboard.
Pasting is the same, the other way round: NSUnarchiver instantiates the
objets and calls their initWithCoder: method so they can set their
properties.

Now, I am nearly sure that I cannot use the NSArchiver/NSUnarchiver with
NSManagedObjects, because NSArchiver/NSUnarchiver know nothing about Core
Data relationships and because NSUnarchiver won't know how to insert an
object in the managed object context.
However, a similar mechanism must exist, because Core Data stores and
fetches entities.

So once again: how do you implement copy and paste with Core Data ? It is a
common operation; I was very surprised not to find any article on the
subject.


Renaud Pradenc
--
ceroce.com



On Wed, 01 Oct 2008 10:44:51 -0400, Daniel Child <[EMAIL PROTECTED]> wrote:
> I'm not sure if I understand your question, but if FillStyle and  
> FillColor are entities, why not simply create corresponding managed  
> objects and set their values, making sure that all of the relations  
> (between color and style, and between style and figure) are  
> established. They will then be automatically stored in the persistent  
> store like any other managed object. As far as I can tell, there is no  
> need to use archiving unless you want to prepare in a special format  
> for another application.
> 

___

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]


Re: Cocoa Programming iPing exercise

2008-10-02 Thread Sherm Pendley
On Thu, Oct 2, 2008 at 9:20 AM, Joe Keenan <[EMAIL PROTECTED]> wrote:

>
> On Oct 1, 2008, at 1:25 PM, Shawn Protsman wrote:
>
> NSArray *args = [NSArray arrayWithObject:[hostField stringValue]];
>>
>
> You forgot the nil argument at the end of the array.


-arrayWithObject: doesn't need one.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
___

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]


Re: Cocoa Programming iPing exercise

2008-10-02 Thread Joe Keenan


On Oct 2, 2008, at 10:01 AM, Sherm Pendley wrote:

On Thu, Oct 2, 2008 at 9:20 AM, Joe Keenan <[EMAIL PROTECTED]>  
wrote:


On Oct 1, 2008, at 1:25 PM, Shawn Protsman wrote:

   NSArray *args = [NSArray arrayWithObject:[hostField  
stringValue]];


You forgot the nil argument at the end of the array.

-arrayWithObject: doesn't need one.


Oops.  Good point.  Hmm.

Shawn - are you absolutely SURE that reqkey is in /usr/local/bin?  On  
your command line example, you don't specify the path.


Another thing to look at is if keyreq requires some environment  
variable that's present in your command line setup, but not in the  
NSTask environement.


joe

___

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]


Re: Cocoa Programming iPing exercise

2008-10-02 Thread Jack Carbaugh
could it be that [hostField stringValue] is not an object ? isn't  
"stringValue" just a value ?



On Oct 2, 2008, at Thu-10 /02 /08-10:06 AM, Joe Keenan wrote:



On Oct 2, 2008, at 10:01 AM, Sherm Pendley wrote:

On Thu, Oct 2, 2008 at 9:20 AM, Joe Keenan <[EMAIL PROTECTED]>  
wrote:


On Oct 1, 2008, at 1:25 PM, Shawn Protsman wrote:

  NSArray *args = [NSArray arrayWithObject:[hostField  
stringValue]];


You forgot the nil argument at the end of the array.

-arrayWithObject: doesn't need one.


Oops.  Good point.  Hmm.

Shawn - are you absolutely SURE that reqkey is in /usr/local/bin?   
On your command line example, you don't specify the path.


Another thing to look at is if keyreq requires some environment  
variable that's present in your command line setup, but not in the  
NSTask environement.


joe

___

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/intrntmn%40aol.com

This email sent to [EMAIL PROTECTED]


___

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]


Re: Direct use of NSScroller?

2008-10-02 Thread Michael Ash
On Wed, Oct 1, 2008 at 10:13 PM, James Walker <[EMAIL PROTECTED]> wrote:
> Is it possible to use a scroller without a scroll view?  The first problem
> is that IB won't let me create an NSScroller that is not embedded in an
> NSScrollView.  I guess I could shrink down the NSScrollView so that you only
> see the one scroll bar.  Then the next problem would be how to set the
> current value.  I see the method setFloatValue:knobProportion:, which I
> guess would set the current value.  But this method is marked deprecated in
> 10.5, with no explanation of why it's deprecated or what one should do
> instead.
>
> I suppose someone is sure to ask why I can't use NSScrollView.  I'm doing a
> kind of scrolling that isn't just shifting a view around.  Some members are
> arranged in two rows, like so...
>
> 1  2  3
> 4  5  6
>
> and when you scroll right, they change like this...
>
> 2  3  4
> 5  6  7
>
> and so on.

Pardon my intrusiveness, but this sounds like a terrible UI. It's
highly nonstandard and nobody will expect it to behave this way. Why
can't you do things the normal way such that you start off with:

A  B  C
Z  Y  X

And when you scroll to the right you get:

B  C  D
Y  X  W

This has the dual advantage of allowing you to use NSScrollView and
not confusing your users.

Mike
___

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]


Re: Cocoa Programming iPing exercise

2008-10-02 Thread j o a r


On Oct 2, 2008, at 8:12 AM, Jack Carbaugh wrote:

could it be that [hostField stringValue] is not an object ? isn't  
"stringValue" just a value ?



That doesn't seem likely. In all likelihood the "hostField" variable  
points to a NSTextField, in which case "stringValue" returns an  
instance of NSString.


j o a r


___

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]


Moving file to trash on afp volume

2008-10-02 Thread Laurent Cerveau

Hi

I'd like to programmatically mov to trash a file from an afp mounted  
volume. I have been using NSWorkspace with   
NSWorkspaceRecycleOperation but it fails (tag returned is -1).

Is there a way to get a more exact description of the error?

I tried to move to FSPathMoveObjectToTrashSync and it returns an error  
-120 (directory not found). I look on the mounted volume and .Trash  
seems not to be here. By itself not a real problem but is there a way  
to trigger NSWorkspace or the FileManager to display a dialog like in  
Finder saying "the file will be deleted immediately and other thing"


Thanks

laurent



___

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]


Re: Direct use of NSScroller?

2008-10-02 Thread douglas welton


On Oct 2, 2008, at 11:13 AM, Michael Ash wrote:

On Wed, Oct 1, 2008 at 10:13 PM, James Walker  
<[EMAIL PROTECTED]> wrote:
Is it possible to use a scroller without a scroll view?  The first  
problem
is that IB won't let me create an NSScroller that is not embedded  
in an
NSScrollView.  I guess I could shrink down the NSScrollView so that  
you only
see the one scroll bar.  Then the next problem would be how to set  
the
current value.  I see the method setFloatValue:knobProportion:,  
which I
guess would set the current value.  But this method is marked  
deprecated in
10.5, with no explanation of why it's deprecated or what one should  
do

instead.

I suppose someone is sure to ask why I can't use NSScrollView.  I'm  
doing a
kind of scrolling that isn't just shifting a view around.  Some  
members are

arranged in two rows, like so...

1  2  3
4  5  6

and when you scroll right, they change like this...

2  3  4
5  6  7

and so on.


Pardon my intrusiveness, but this sounds like a terrible UI. It's
highly nonstandard and nobody will expect it to behave this way. Why
can't you do things the normal way such that you start off with:

A  B  C
Z  Y  X

And when you scroll to the right you get:

B  C  D
Y  X  W

This has the dual advantage of allowing you to use NSScrollView and
not confusing your users.

Mike


Mike,

I will have to strongly disagree with you that  James' problem is a  
"terrible UI".


NSScrollViews are best used when you have a rectangular viewport into  
a rectangular view of relatively-densely-packed objects that have a  
static relationship with one another.


However, I would wager that "static" relationships amongst items being  
modeled for a display is not the norm.  Coverflow is a good example of  
this. When you move the scrollbar in the iTunes Coverflow view, the  
relationship of the objects being displayed changes... just like in  
James' example.  IMHO, Coverflow is just a clever visual modeling of  
an all-too-typical real world object.


I don't know what James has in mind for his UI, but I'll leave it up  
to him to make a value judgement about whether his UI is appropriate  
for his user.  I'm sure we've all given him food for thought.


regards,

douglas


___

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]


getting username of authenticated volume

2008-10-02 Thread Mark McCray
Hey there,Is there a way to figure out what username was used to log on to a
mounted volume by knowing the volume name?
Thanks,
mark
___

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]


Re: Direct use of NSScroller?

2008-10-02 Thread James W. Walker


On Oct 2, 2008, at 8:13 AM, Michael Ash wrote:

On Wed, Oct 1, 2008 at 10:13 PM, James Walker  
<[EMAIL PROTECTED]> wrote:
I suppose someone is sure to ask why I can't use NSScrollView.  I'm  
doing a
kind of scrolling that isn't just shifting a view around.  Some  
members are

arranged in two rows, like so...

1  2  3
4  5  6

and when you scroll right, they change like this...

2  3  4
5  6  7

and so on.


Pardon my intrusiveness, but this sounds like a terrible UI. It's
highly nonstandard and nobody will expect it to behave this way. Why
can't you do things the normal way such that you start off with:

A  B  C
Z  Y  X

And when you scroll to the right you get:

B  C  D
Y  X  W

This has the dual advantage of allowing you to use NSScrollView and
not confusing your users.




These items are in a linear order, and it wouldn't be very useful to  
see two disjoint subsequences of them.  Anyway, it's a cross-platform  
product, and the interface isn't really my decision.




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

This email sent to [EMAIL PROTECTED]

Re: Direct use of NSScroller?

2008-10-02 Thread James W. Walker


On Oct 1, 2008, at 8:53 PM, Clark Cox wrote:

On Wed, Oct 1, 2008 at 7:13 PM, James Walker  
<[EMAIL PROTECTED]> wrote:
Is it possible to use a scroller without a scroll view?  The first  
problem
is that IB won't let me create an NSScroller that is not embedded  
in an

NSScrollView.


Just instantiate a generic NSView, and set its class to NSScroller.


I guess I could shrink down the NSScrollView so that you only
see the one scroll bar.  Then the next problem would be how to set  
the
current value.  I see the method setFloatValue:knobProportion:,  
which I
guess would set the current value.  But this method is marked  
deprecated in
10.5, with no explanation of why it's deprecated or what one should  
do

instead.


It's probably deprecated because it conflates two attributes of the
scroller that are only peripherally related (i.e. the size of the
scroll thumb, and its location). Use -setKnobProportion: and
-setDouleValue: instead.



Thanks.  I guess I had looked at the 10.4 SDK version of NSScroller.h,  
which doesn't have -setKnobProportion:.

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

This email sent to [EMAIL PROTECTED]

Re: getting username of authenticated volume

2008-10-02 Thread Stéphane Sudre


On Oct 2, 2008, at 6:30 PM, Mark McCray wrote:

Hey there,Is there a way to figure out what username was used to log  
on to a

mounted volume by knowing the volume name


Yes.

With statfs:

uid_t   f_owner;/* user that mounted the file system */

you then just need to transform the uid to a username.


___

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]


WebView security level?

2008-10-02 Thread David Springer
Folks,
Disclaimer: I have no idea what I am talking about.

I have been asked to increase the "security level" of our WebView-based
browser windows.  I guess that on a pc/IE, you can somehow set the security
level to prevent things like injection attacks and stuff like that?  Again,
I have no idea what this is.  Is it possible to to something similar using
WebView on Cocoa?  Am I even making any sense?  I looked over the security
docs here
http://developer.apple.com/referencelibrary/GettingStarted/GS_Security/index.html,
but I am just more confused.  Anyone have words of wisdom on this?

Thanks!
- Dave.S
___

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]


Re: Newbie: Strange problem with NSTableView, check boxes and Core Data

2008-10-02 Thread Jonathan Oddie


On Sep 29, 2008, at 5:36 PM, Corbin Dunn wrote:



On Sep 29, 2008, at 10:55 AM, Jonathan Oddie wrote:


Hi all,
I'm new on this list -- teaching myself Cocoa programming by  
writing a small utility as a Core Data document-based application.  
Mostly I have everything working well, but there is one strange bug  
I can't isolate where a check box in a table view sometimes fails  
to draw itself properly. This happens maybe one time out of ten.  
Details:
- I have a Core Data entity with properties "Name" (a string) and  
"Enabled" (a bool). Both are non-optional and have default values  
"New" and YES, respectively.
- In my document NIB file I have an array controller set to manage  
that entity. It is set to "prepare content" and "editable".
- also in the NIB, a table view with two columns: one of  
checkboxes, bound to the "Enabled" property through the array  
controller, and one of text fields bound to the "Name"
- an IBAction method, linked to a "new" button, which creates a new  
instance of the entity with the NSEntityDescription  
insertNewObjectForEntityForName:inManagedObjectContext: method

- This is a garbage-collected project.

The new document is created with no instances of the entity. When  
clicking the "new" button, 9 times out of 10 everything seems fine.  
When it goes wrong, either the checkbox for the newly inserted  
entity doesn't draw at all, or it lacks the checkmark or the  
highlight or some other visual element. There is a console message  
like:
2008-09-29 11:32:56.955 IU Organ Utility v2[12568:10b] *** - 
[CIFilterClassDescription _feImage]: unrecognized selector sent to  
instance 0x10d32a0
2008-09-29 11:32:56.956 IU Organ Utility v2[12568:10b] Exception  
*** -[CIFilterClassDescription _feImage]: unrecognized selector  
sent to instance 0x10d32a0


Sometimes the class is _NSCFNumber or CIFilterShape instead of  
CIFilterClassDescription. Sometimes there's no message, but the app  
crashes with an EXC_BAD_ACCESS; and sometimes there's instead a  
message about free() which says something about a reference count  
underrun (sorry, I've been trying to repeat it while writing this  
and haven't managed to).


Anyone have any ideas?


Add a breakpoint on objc_exception_throw, and debug that app. Get a  
backtrace for when the exception is thrown. That may help you. See:


 
http://www.corbinstreehouse.com/blog/index.php/2008/08/your-most-important-breakpoint-in-cocoa/

corbin




Thanks for the advice Corbin. Below is a long backtrace, but I am not  
sure it sheds much light on the problem. I will keep working at it but  
since I am moving house this week I may not get much done for a while...

Jonathan

#0  0x90187e17 in objc_exception_throw
#1  0x9433434a in -[NSObject doesNotRecognizeSelector:]
#2  0x9433294c in ___forwarding___
#3  0x94332a12 in __forwarding_prep_0___
#4  0x95bdfa8c in -[CISampler _initWithImage:optionsList:]
#5  0x95bdf888 in -[CISampler initWithImage:options:]
#6  0x95bdf811 in -[CISampler initWithImage:]
#7  0x95bdf727 in +[CISampler samplerWithImage:]
#8  0x95c9f638 in -[CIFullButton outputImage]
#9  0x91663e3a in -[NSObject(NSKeyValueCoding) valueForKey:]
#10 0x95bdd530 in -[CIFilter valueForKey:]
#11 0x95d984c1 in -[CIUIBundle1 buttonResultForResolutionData:]
#12	0x95d962f1 in -[CIUIBundleBase  
renderResolutionData:toBitmap:width:height:bytesPerRow:]

#13 0x95d92f83 in -[CIUIBundleBase dataForResolutionData:]
#14 0x95d93a5e in -[CIUIBundleBase dataForPPI:]
#15 0x95d8f516 in QSICreateElement
#16 0x90c0b6b4 in CUIElement::Load
#17 0x90bf53e3 in CUIRenderer::Draw1Piece
#18 0x90bf7851 in CUIRenderer::Draw
#19 0x94da43d2 in -[NSCoreUIImageRep draw]
#20	0x94da430b in -[NSCoreUIImageRep  
_drawFromRect:toRect:operation:alpha:compositing:flipped:ignoreContext:]

#21 0x94d9fd43 in -[NSImage drawInRect:fromRect:operation:fraction:]
#22	0x951e50de in -[NSImage  
_drawMappingAlignmentRectToRect:withState:backgroundStyle:operation:fraction:flip 
:]

#23 0x94da2fc7 in -[NSButtonCell drawImage:withFrame:inView:]
#24	0x95112d97 in -[NSButtonCell  
_configureAndDrawImageWithRect:cellFrame:controlView:]

#25 0x94d96c20 in -[NSButtonCell drawInteriorWithFrame:inView:]
#26	0x94ddff19 in -[NSTableView  
_drawContentsAtRow:column:withCellFrame:]

#27 0x94ddf37a in -[NSTableView drawRow:clipRect:]
#28 0x94d847f4 in -[NSTableView drawRowIndexes:clipRect:]
#29 0x94d832d8 in -[NSTableView drawRect:]
#30 0x94e13864 in -[NSView _drawRect:clip:]
#31	0x94e1235b in -[NSView  
_recursiveDisplayAllDirtyWithLockFocus:visRect:]
#32	0x94e126f2 in -[NSView  
_recursiveDisplayAllDirtyWithLockFocus:visRect:]
#33	0x94e10cb1 in -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:]
#34	0x94e11b0b in -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:]
#35	0x94e11b0b in -[NSView  

Re: Cocoa Programming iPing exercise

2008-10-02 Thread Jamie Pinkham

whoops.. should reply to all.. sorry Joe.

anyway, i asked, and this may be a silly inquiry, but have you checked  
the execute permissions of the executable?


On Oct 2, 2008, at 10:06 AM, Joe Keenan wrote:



On Oct 2, 2008, at 10:01 AM, Sherm Pendley wrote:

On Thu, Oct 2, 2008 at 9:20 AM, Joe Keenan <[EMAIL PROTECTED]>  
wrote:


On Oct 1, 2008, at 1:25 PM, Shawn Protsman wrote:

  NSArray *args = [NSArray arrayWithObject:[hostField  
stringValue]];


You forgot the nil argument at the end of the array.

-arrayWithObject: doesn't need one.


Oops.  Good point.  Hmm.

Shawn - are you absolutely SURE that reqkey is in /usr/local/bin?   
On your command line example, you don't specify the path.


Another thing to look at is if keyreq requires some environment  
variable that's present in your command line setup, but not in the  
NSTask environement.


joe

___

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/jamie.pinkham%40verizon.net

This email sent to [EMAIL PROTECTED]


___

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]


Re: Threads + Garbage Collection = Crash?

2008-10-02 Thread Bill Bumgarner

On Oct 1, 2008, at 5:35 AM, Oleg Krupnov wrote:

In my application, I create a (single) background thread, for creating
thumbnail images. I use NSRunLoop and - [NSObject
performSelector:onThread:withObject:waitUntilDone:] to communicate
between the main and the background threads.

I am experiencing weird random crashes with the following log:

IconView(49550,0xb0103000) malloc: free_garbage: garbage ptr =
0x1239260, has non-zero refcount = 1
IconView(49550,0xb0103000) malloc: *** free() called with 0x1bdcf6b0
with refcount 0
IconView(49550,0xb0103000) malloc: *** auto malloc[49550]: agc error
for object 0x1bdcf6b0: Deallocating a non-block


Turn on malloc_history (see the malloc man page) and then grab a  
history of all allocation events at address 0x1bdcf6b0.  Most likely  
(in your case, not all cases), whatever object was last at 0x1bdcf6b0  
is the one that is being freed early.



My application relies heavily on garbage collection (the gc required
mode), so I never call malloc/free explicitly. I don't create
NSAutoreleasePool in the background thread's main method.


To verify:

- you are creating the thread via NSThread?

- you are running a Run Loop in said thread?

That should be sufficient to make the collector aware of the thread.   
If you were spinning up a pthread and doing your own cross-thread  
communication via the pthread synchronization primitives, then you  
would need to call [NSThread currentThread] from that thread to make  
the collector aware of the thread.



I set breakpoint on malloc_printf and I see the following stack trace:
malloc_printf
autocollect_internal
autocollection_thread
_pthread_start
thread_start.

I have noticed that these crashes occur more often when the workload
is high - i.e. there are many sequential requests to the background
thread.


Likely, simply a catalyst to failure.  Under high load, there will be  
more objects created and destroyed.   As such, the collector will be  
busier.   As well, whatever race condition is causing the issue -- and  
it is a race condition, given the intermittent nature of the crasher  
-- is more likely to happen when more stuff is happening in your app,  
especially stuff that causes variation in thread scheduling.



Also, I have located a piece of code in the main thread such that when
I comment it out, the crash disappears, although the code fragment has
absolutely nothing to do with the background thread. It actually fills
a round rect with a gradient fill, in the main thread. Funny enough,
when the rect is square, not round, the bug also disappears.


Aha!  When you are filling that rect, you are likely causing the main  
thread's stack to go fairly deep as the thread passes through the  
rendering machinery.   And a round rect likely goes deeper than a  
square rect because of the extra math involved.


How is that significant?

It most likely indicates that the object being reaped too early by the  
collector is only being kept alive by the main thread's stack and,  
then, only inadvertently.


So:

- are you passing references to hunks of memory on the stack between  
threads?


- are you using NSInvocation?  It doesn't correctly retain its  
arguments under GC.  You'll want to keep references to arguments in  
some other container.


- are you storing pointers into malloc()'d memory or other places  
where the collector might not see them?  If so, either don't or use  
CFRetain/CFRelease on the pointers that land outside of the  
collector's zone.


b.bum




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

This email sent to [EMAIL PROTECTED]

Re: Threads + Garbage Collection = Crash?

2008-10-02 Thread Bill Bumgarner

On Oct 1, 2008, at 9:17 AM, Ashley Clark wrote:
As for your crashes I think I can offer some advice. If you're not  
doing

any mallocs then most likely you're passing objects back to your main
thread through some shared space, possibly via contextInfo:


Yes -- this can be a problem.   If the contextInfo of an object is a  
stored in a (void *) instance variable, then the collector will not  
scan that iVar and will not that field as a reference to the object.


You can use CFRetain/CFRelease to prevent collection when a reference  
to the object is stored into an unscanned location.



I've seen in my own GC programs using threads that occasionally the
collector (usually during high object usage) will collect objects  
that are
in transit unless you CFRetain them in your thread before sending  
and then
CFRelease them in the other thread once you've assigned them to a gc- 
ed

storage variable.


This should only happen if the object is only referenced by unscanned  
memory.  If there are references on any thread's stack, then the  
collector shouldn't touch the object (assuming the thread is  
registered with the collector).  If you have a reproducible case where  
you think the object should not be collected, but is, please file a  
bug and send me the #.


b.bum




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

This email sent to [EMAIL PROTECTED]

Re: Newbie: Strange problem with NSTableView, check boxes and Core Data

2008-10-02 Thread Corbin Dunn




Thanks for the advice Corbin. Below is a long backtrace, but I am  
not sure it sheds much light on the problem. I will keep working at  
it but since I am moving house this week I may not get much done for  
a while...

Jonathan



This is an interesting backtrace. What image do you have set on the  
NSButtonCell in the tableView? Is it one of the predefined apple ones?  
If so, which one?


It is possible this is a bug in the framework.

corbin




#0  0x90187e17 in objc_exception_throw
#1  0x9433434a in -[NSObject doesNotRecognizeSelector:]
#2  0x9433294c in ___forwarding___
#3  0x94332a12 in __forwarding_prep_0___
#4  0x95bdfa8c in -[CISampler _initWithImage:optionsList:]
#5  0x95bdf888 in -[CISampler initWithImage:options:]
#6  0x95bdf811 in -[CISampler initWithImage:]
#7  0x95bdf727 in +[CISampler samplerWithImage:]
#8  0x95c9f638 in -[CIFullButton outputImage]
#9  0x91663e3a in -[NSObject(NSKeyValueCoding) valueForKey:]
#10 0x95bdd530 in -[CIFilter valueForKey:]
#11 0x95d984c1 in -[CIUIBundle1 buttonResultForResolutionData:]
#12	0x95d962f1 in -[CIUIBundleBase  
renderResolutionData:toBitmap:width:height:bytesPerRow:]

#13 0x95d92f83 in -[CIUIBundleBase dataForResolutionData:]
#14 0x95d93a5e in -[CIUIBundleBase dataForPPI:]
#15 0x95d8f516 in QSICreateElement
#16 0x90c0b6b4 in CUIElement::Load
#17 0x90bf53e3 in CUIRenderer::Draw1Piece
#18 0x90bf7851 in CUIRenderer::Draw
#19 0x94da43d2 in -[NSCoreUIImageRep draw]
#20	0x94da430b in -[NSCoreUIImageRep  
_drawFromRect:toRect:operation:alpha:compositing:flipped:ignoreContext 
:]

#21 0x94d9fd43 in -[NSImage drawInRect:fromRect:operation:fraction:]
#22	0x951e50de in -[NSImage  
_drawMappingAlignmentRectToRect:withState:backgroundStyle:operation:fraction:flip 
:]

#23 0x94da2fc7 in -[NSButtonCell drawImage:withFrame:inView:]
#24	0x95112d97 in -[NSButtonCell  
_configureAndDrawImageWithRect:cellFrame:controlView:]

#25 0x94d96c20 in -[NSButtonCell drawInteriorWithFrame:inView:]
#26	0x94ddff19 in -[NSTableView  
_drawContentsAtRow:column:withCellFrame:]

#27 0x94ddf37a in -[NSTableView drawRow:clipRect:]
#28 0x94d847f4 in -[NSTableView drawRowIndexes:clipRect:]
#29 0x94d832d8 in -[NSTableView drawRect:]
#30 0x94e13864 in -[NSView _drawRect:clip:]
#31	0x94e1235b in -[NSView  
_recursiveDisplayAllDirtyWithLockFocus:visRect:]
#32	0x94e126f2 in -[NSView  
_recursiveDisplayAllDirtyWithLockFocus:visRect:]
#33	0x94e10cb1 in -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:]
#34	0x94e11b0b in -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:]
#35	0x94e11b0b in -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:]
#36	0x94e11b0b in -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:]
#37	0x94e11b0b in -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:]
#38	0x94e11b0b in -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:]
#39	0x94e105f3 in -[NSThemeFrame  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:]
#40	0x94e0d117 in -[NSView  
_displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:]

#41 0x94d4db77 in -[NSView displayIfNeeded]
#42 0x94d4d725 in -[NSWindow displayIfNeeded]
#43 0x94d4d548 in _handleWindowNeedsDisplay
#44 0x942b19c2 in __CFRunLoopDoObservers
#45 0x942b2d1c in CFRunLoopRunSpecific
#46 0x942b3cf8 in CFRunLoopRunInMode
#47 0x911fb480 in RunCurrentEventLoopInMode
#48 0x911fb1d2 in ReceiveNextEventCommon
#49 0x911fb10d in BlockUntilNextEventMatchingListInMode
#50 0x94d4b3ed in _DPSNextEvent
#51	0x94d4aca0 in -[NSApplication  
nextEventMatchingMask:untilDate:inMode:dequeue:]

#52 0x94d43cdb in -[NSApplication run]
#53 0x94d10f14 in NSApplicationMain
#54 0x4123 in main at main.m:13

___

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/corbind%40apple.com

This email sent to [EMAIL PROTECTED]


___

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]


Re: WebView security level?

2008-10-02 Thread Nick Zitzmann


On Oct 2, 2008, at 10:58 AM, David Springer wrote:

I have been asked to increase the "security level" of our WebView- 
based
browser windows.  I guess that on a pc/IE, you can somehow set the  
security
level to prevent things like injection attacks and stuff like that?   
Again,
I have no idea what this is.  Is it possible to to something similar  
using

WebView on Cocoa?



WebView has no concept of security levels, although there are some  
security settings that are managed separately, such as Java,  
JavaScript, cookies, etc.


Nick Zitzmann


___

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]


Conditional mouseDownCanMoveWindow for NSView?

2008-10-02 Thread Daniel Weber
I have a single nsview that draws the main content area for my application
and a bottom statusbar. This was done instead of using two different views
so the user can move objects from the statusbar to the main content area,
all with core animation effects. The view is not opaque. The problem I'm
having, though, is that I want the user to be able to drag the window when
the mouse is down on the statusbar, but not the main content area. In other
words, if the mousedown is within the statusbar's rectangle I want to return
YES for mouseDownCanMoveWindow. But if the mousedown is within the main
content area rectangle, I want to return NO. I have already tried setting a
flag in the mouseDown method and then returning that
in mouseDownCanMoveWindow. But it doesn't work. I guess mouseDown is not
called before mouseDownCanMoveWindow. Anyway, does anyone have any other
suggestions for this?
The only other thing I can think to do is setting a flag on mouseEnter and
mouseExit of the statusbar rectangle, but that doesn't seem particularly
elegant.

Thanks,
Dan
___

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]


Re: Threads + Garbage Collection = Crash?

2008-10-02 Thread Ashley Clark

On Oct 2, 2008, at 12:28 PM, Bill Bumgarner wrote:


On Oct 1, 2008, at 9:17 AM, Ashley Clark wrote:
As for your crashes I think I can offer some advice. If you're not  
doing

any mallocs then most likely you're passing objects back to your main
thread through some shared space, possibly via contextInfo:


Yes -- this can be a problem.   If the contextInfo of an object is a  
stored in a (void *) instance variable, then the collector will not  
scan that iVar and will not that field as a reference to the object.


You can use CFRetain/CFRelease to prevent collection when a  
reference to the object is stored into an unscanned location.



I've seen in my own GC programs using threads that occasionally the
collector (usually during high object usage) will collect objects  
that are
in transit unless you CFRetain them in your thread before sending  
and then
CFRelease them in the other thread once you've assigned them to a  
gc-ed

storage variable.


This should only happen if the object is only referenced by  
unscanned memory.  If there are references on any thread's stack,  
then the collector shouldn't touch the object (assuming the thread  
is registered with the collector).  If you have a reproducible case  
where you think the object should not be collected, but is, please  
file a bug and send me the #.


Looking at your other email to the list about this I think my issue  
was that I was passing the objects to a delegate method using an  
NSInvocation object and then in that delegate method sending them on  
to the main thread through a contextInfo memory reference.


Like Oleg, I only saw the crash during periods of high activity on my  
second thread where a lot of objects were being created and destroyed.  
I was able to work around the problem by issuing a CFRetain in my  
delegate and then sending a CFRelease to it once I had it stored in  
scanned memory in the main thread.


If I read your message correctly though I should also be CFRetain'ing  
and CFRelease'ing the objects I'm sending with my NSInvocation object  
as well? Does this only apply when invoking the invocation on the main  
thread from a secondary thread, or is it general practice?


Ashley
___

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]


Re: Moving file to trash on afp volume

2008-10-02 Thread Peter Ammon

On Oct 2, 2008, at 8:41 AM, Laurent Cerveau wrote:


Hi

I'd like to programmatically mov to trash a file from an afp mounted  
volume. I have been using NSWorkspace with   
NSWorkspaceRecycleOperation but it fails (tag returned is -1).

Is there a way to get a more exact description of the error?

I tried to move to FSPathMoveObjectToTrashSync and it returns an  
error -120 (directory not found). I look on the mounted volume  
and .Trash seems not to be here. By itself not a real problem but is  
there a way to trigger NSWorkspace or the FileManager to display a  
dialog like in Finder saying "the file will be deleted immediately  
and other thing"


No, the frameworks don't have this feature.  You might consider using  
scripting to ask the Finder to move the file to the trash.


-Peter

___

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]


Re: WebView security level?

2008-10-02 Thread Jamie Hardt
WebViews don't have a "security level" in the sense of IE; if the  
client (your app) wishes to apply certain security measures, it can do  
so by using setting the WebPreferences object of the web view to allow/ 
disallow javascript, java, allow/disallow plugins (all or nothing),  
and the client can also use a WebPolicy delegate to do things like  
conditional loading, etc.


Many of the WebPreferences attributes for the WebView can be set in  
Interface Builder as well.  If your users are having a particular  
problem with the web views not doing something with Java/Javascript/ 
Plugins, make sure these are checked ON first. 	


On Oct 2, 2008, at 9:58 AM, David Springer wrote:


Folks,
Disclaimer: I have no idea what I am talking about.

I have been asked to increase the "security level" of our WebView- 
based
browser windows.  I guess that on a pc/IE, you can somehow set the  
security
level to prevent things like injection attacks and stuff like that?   
Again,
I have no idea what this is.  Is it possible to to something similar  
using
WebView on Cocoa?  Am I even making any sense?  I looked over the  
security

docs here
http://developer.apple.com/referencelibrary/GettingStarted/GS_Security/index.html 
,

but I am just more confused.  Anyone have words of wisdom on this?

Thanks!
- Dave.S
___

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/jamiehardt 
%40gmail.com


This email sent to [EMAIL PROTECTED]


___

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]


Code Data: Re-inserting deleted objects

2008-10-02 Thread chaitanya pandit

Hi List,
What is the best way to re-insert a deleted object back in to the  
managed object context?

At present i'm trying to this:

if ([objectToReinstate validateForInsert:&error])
 [[self managedObjectContext] insertObject:objectToReinstate];

But i am having problems with objects having relationships, suppose i  
have entities A,B and C having relationships as: A<--->B<--->C
All the relationships are mandatory (i.e the optional flag is  
unchecked) also the delete rule for A--->B and B--->C is  Cascade .


Now suppose i delete A, due to the cascade rule B and C will also get  
deleted. Now if i want to reinsert all of them in to the MOC, i kinda  
have a deadlock situation


If i do this:
if ([A validateForInsert:&error])
 [[self managedObjectContext] A];

It will not work because to reinsert A needs a valid relationship with  
B which in this case will be nil.

i cannot re insert B either because i haven't inserted A and so on.

One more thing, if i directly insert the object without checking it  
for validation and then call [A isInserted] it returns NO if i do it  
in the same loop, if i do it later, it returns YES, is there anything  
special i need to do so that the isInserted flag would be updated?


I' appreciate any help.
thanks,
Chaitanya


___

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]


Newb: KATI Sample Code - What's This Called?

2008-10-02 Thread Brad Gibbs
I'm working through the XSViewController example project from KATIDev  
and I came across this line:


	[(ColorView*)[self view] setBackgroundColor:[[NSColor greenColor]  
colorWithAlphaComponent:.5]];


and realized I don't understand (ColorView*).  It looks like it's  
declaring a pointer to an object, but it's followed by a method.   
Could somebody tell me the name of the function (ColorView*) is  
performing so I can look it up and figure it out?


Thanks.

Brad
___

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]


Re: Newb: KATI Sample Code - What's This Called?

2008-10-02 Thread Bill Bumgarner

On Oct 2, 2008, at 2:43 PM, Brad Gibbs wrote:
I'm working through the XSViewController example project from  
KATIDev and I came across this line:


	[(ColorView*)[self view] setBackgroundColor:[[NSColor greenColor]  
colorWithAlphaComponent:.5]];


and realized I don't understand (ColorView*).  It looks like it's  
declaring a pointer to an object, but it's followed by a method.   
Could somebody tell me the name of the function (ColorView*) is  
performing so I can look it up and figure it out?


There is no function.

It is declaring that the result of the [self view] sub-expression  
should be treated as a pointer to a ColorView by the compiler.


Nothing more, nothing less.

It is just a typecast to likely suppress a compiler warning because  
whoever defined -view likely defined it as returning a reference to an  
NSView, which does not respond to -setBackgroundColor:


b.bum



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

This email sent to [EMAIL PROTECTED]

Re: Newb: KATI Sample Code - What's This Called?

2008-10-02 Thread Randall Meadows

On Oct 2, 2008, at 3:43 PM, Brad Gibbs wrote:

I'm working through the XSViewController example project from  
KATIDev and I came across this line:


	[(ColorView*)[self view] setBackgroundColor:[[NSColor greenColor]  
colorWithAlphaComponent:.5]];


and realized I don't understand (ColorView*).  It looks like it's  
declaring a pointer to an object, but it's followed by a method.   
Could somebody tell me the name of the function (ColorView*) is  
performing so I can look it up and figure it out?


That is casting the object returned from [self view] to a type of  
"pointer to a ColorView object", that is, an instance of a ColorView.   
Most likely, this is done to quiet a compiler warning about an object  
(in this case, whatever [self view] is returning, not responding to - 
setBackgroundColor:.

___

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]


Re: Conditional mouseDownCanMoveWindow for NSView?

2008-10-02 Thread Rainer Brockerhoff
At 12:03 -0700 02/10/08, [EMAIL PROTECTED] wrote:
>From: "Daniel Weber" <[EMAIL PROTECTED]>
>Date: Thu, 2 Oct 2008 11:15:40 -0700
>Message-ID: <[EMAIL PROTECTED]>
>
>I have a single nsview that draws the main content area for my application
>and a bottom statusbar. This was done instead of using two different views
>so the user can move objects from the statusbar to the main content area,
>all with core animation effects. The view is not opaque. The problem I'm
>having, though, is that I want the user to be able to drag the window when
>the mouse is down on the statusbar, but not the main content area. In other
>words, if the mousedown is within the statusbar's rectangle I want to return
>YES for mouseDownCanMoveWindow. But if the mousedown is within the main
>content area rectangle, I want to return NO. I have already tried setting a
>flag in the mouseDown method and then returning that
>in mouseDownCanMoveWindow. But it doesn't work. I guess mouseDown is not
>called before mouseDownCanMoveWindow. Anyway, does anyone have any other
>suggestions for this?

I had that very same problem in RBSplitView. The only solution I found is to 
always return NO in mouseDownCanMoveWindow, then move the window "manually" 
inside mouseDown like this:

- (void)mouseDown:(NSEvent*)theEvent {
NSWindow* window = [self window];
NSPoint where = [theEvent locationInWindow];
if (...test for your rect here...) {
where =  [window convertBaseToScreen:where];
NSPoint origin = [window frame].origin;
// Now we loop handling mouse events until we get a mouse up event.
while ((theEvent = [NSApp 
nextEventMatchingMask:NSLeftMouseDownMask|NSLeftMouseDraggedMask|NSLeftMouseUpMask
 untilDate:[NSDate distantFuture] inMode:NSEventTrackingRunLoopMode 
dequeue:YES])&&([theEvent type]!=NSLeftMouseUp)) {
// Set up a local autorelease pool for the loop to prevent buildup of temporary 
objects.
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] 
init];
NSPoint now = [window convertBaseToScreen:[theEvent 
locationInWindow]];
origin.x += now.x-where.x;
origin.y += now.y-where.y;
// Move the window by the mouse displacement since the last event.
[window setFrameOrigin:origin];
where = now;
[pool release];
}
}
}

-- 
Rainer Brockerhoff  <[EMAIL PROTECTED]>
Belo Horizonte, Brazil
"In the affairs of others even fools are wise
 In their own business even sages err."
Weblog: http://www.brockerhoff.net/bb/viewtopic.php
___

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]


Re: Direct use of NSScroller?

2008-10-02 Thread Clark Cox
On Thu, Oct 2, 2008 at 2:10 AM, chaitanya pandit <[EMAIL PROTECTED]> wrote:
> How about using a NSSlider?

NSSlider is the wrong control for this job. A slider is for adjusting
a single numerical value, not for scrolling through a list of data.

>
> On 02-Oct-08, at 7:43 AM, James Walker wrote:
>
>> Is it possible to use a scroller without a scroll view?  The first problem
>> is that IB won't let me create an NSScroller that is not embedded in an
>> NSScrollView.  I guess I could shrink down the NSScrollView so that you only
>> see the one scroll bar.  Then the next problem would be how to set the
>> current value.  I see the method setFloatValue:knobProportion:, which I
>> guess would set the current value.  But this method is marked deprecated in
>> 10.5, with no explanation of why it's deprecated or what one should do
>> instead.


-- 
Clark S. Cox III
[EMAIL PROTECTED]
___

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]


Re: Re-inserting deleted objects

2008-10-02 Thread chaitanya pandit


On 03-Oct-08, at 3:23 AM, Harry Jordan wrote:

If deleting the objects was the last action that you did, you could  
simply call -undo on the managedObjectContext. There may well be  
reasons why this wouldn't be appropriate, but it's worth a look.


Actually thats the first thing that came to my mind, but other objects  
might get added after the deletion so i can't use Undo

Harry


___

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]


Re: Threads + Garbage Collection = Crash?

2008-10-02 Thread Bill Bumgarner

On Oct 2, 2008, at 11:46 AM, Ashley Clark wrote:
Looking at your other email to the list about this I think my issue  
was that I was passing the objects to a delegate method using an  
NSInvocation object and then in that delegate method sending them on  
to the main thread through a contextInfo memory reference.


Like Oleg, I only saw the crash during periods of high activity on  
my second thread where a lot of objects were being created and  
destroyed. I was able to work around the problem by issuing a  
CFRetain in my delegate and then sending a CFRelease to it once I  
had it stored in scanned memory in the main thread.


If I read your message correctly though I should also be  
CFRetain'ing and CFRelease'ing the objects I'm sending with my  
NSInvocation object as well? Does this only apply when invoking the  
invocation on the main thread from a secondary thread, or is it  
general practice?


Well...  the conditions under which the objects might be collected out  
from under the NSInvocation are not entirely straightforward.


The most defensive approach is to CFRetain() and CFRelease() the  
objects on the way in/out of the NSInvocation.


Obviously, if the arguments are otherwise rooted, they won't be  
collected.  Thus, there are a myriad of possible other ways to ensure  
that the objects stick around.


b.bum

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

This email sent to [EMAIL PROTECTED]

Re: Direct use of NSScroller?

2008-10-02 Thread chaitanya pandit


On 02-Oct-08, at 10:09 PM, James W. Walker wrote:



On Oct 1, 2008, at 8:53 PM, Clark Cox wrote:

On Wed, Oct 1, 2008 at 7:13 PM, James Walker  
<[EMAIL PROTECTED]> wrote:
Is it possible to use a scroller without a scroll view?  The first  
problem
is that IB won't let me create an NSScroller that is not embedded  
in an

NSScrollView.


Just instantiate a generic NSView, and set its class to NSScroller.


I guess I could shrink down the NSScrollView so that you only
see the one scroll bar.  Then the next problem would be how to set  
the
current value.  I see the method setFloatValue:knobProportion:,  
which I
guess would set the current value.  But this method is marked  
deprecated in
10.5, with no explanation of why it's deprecated or what one  
should do

instead.


It's probably deprecated because it conflates two attributes of the
scroller that are only peripherally related (i.e. the size of the
scroll thumb, and its location). Use -setKnobProportion: and
-setDouleValue: instead.


@interface NSScroller(NSDeprecated)
/* A method that was deprecated in Mac OS 10.5. To maintain binary  
compatibility, AppKit will continue to invoke overrides of this  
method. Code that targets Mac OS 10.5 and later should use - 
setDoubleValue: and -setKnobProportion: instead, and eliminate any  
overrides of -setFloatValue:knobProportion:. Code that needs to remain  
compatible with Mac OS 10.4 and earlier should continue to use - 
setFloatValue:knobProportion:.

*/
- (void)setFloatValue:(float)aFloat knobProportion:(CGFloat)proportion;
@end

Thanks.  I guess I had looked at the 10.4 SDK version of  
NSScroller.h, which doesn't have - 
setKnobProportion:.___


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/chaitanya%40expersis.com

This email sent to [EMAIL PROTECTED]


___

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]


Re: -[NSScanner scanUpToString:stopString:NULL] - 10.3.9 Crash, due Xcode 3.1?

2008-10-02 Thread Jerry Krinock


On 2008 Oct, 02, at 4:54, Karan, Cem (Civ, ARL/CISD) wrote:

I'm coming into this late, but are you positive you never  
accidentally pass in NULL like so:?


[blah scanUpToAndThenLeapOverString:@"someString" intoString:NULL];


Well, Cem actually I am passing it NULL, which then gets passed as the  
second argument to -[NSScanner scanUpToString:intoString], but  
according to the documentation NULL is OK there, and I've been doing  
it for years.


News Flash: I've reproduced the problem in a small demo app.  Looks  
like the same bug in 10.3 that I found back in March (CLANG!!), but  
the inexplicably magic workaround which I applied back then has  
stopped working.


Will post resolution when it's done.

Thanks for your thoughts,

Jerry
___

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]


Re: Play Playlist in iTunes

2008-10-02 Thread has

Mr. Gecko wrote:


Ok I now read everything in the programming guide for Scripting Bridge
and it is really cool, Now I can't seem to find out how to play a
playlist from a name id or anything.



If you know how to write an application command in AppleScript, e.g.:

tell application "iTunes" to play playlist "Top 25 Most Played"

you can use the appscript project's very handy ASTranslate tool [1] to  
convert it to equivalent objc-appscript syntax:


// To create glue:  osaglue  -o ITGlue  -p IT  iTunes

ITApplication *itunes = [ITApplication applicationWithName: @"iTunes"];

ITReference *ref = [[itunes playlists] byName: @"Top 25 Most Played"];

id result = [[ref play] send];

which you can clean up as needed for use in your own code.

ASTranslate doesn't do Scripting Bridge syntax, but that's because SB  
is mince (and inadequately documented mince at that). Obviously I'd  
recommend using appscript over SB as appscript's better technology in  
pretty much every way that counts (more powerful, more mature,  
significantly better application compatibility, also supports Panther  
and Tiger, equal or better performance, better documentation, better  
tool support, doesn't manage to obfuscate and confuse Apple event IPC  
even worse than AppleScript does). SB's only noticeable advantage is  
that it's installed as standard in OS X (10.5+) whereas you'll need to  
build and bundle appscript yourself in any products you release (a  
fairly trivial task, and appscript's license is very liberal). But you  
pays your money, etc.


HTH

has

[1] http://appscript.sourceforge.net/tools.html
--
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net

___

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]


Re: Play Playlist in iTunes

2008-10-02 Thread has

Michael Ash wrote:

On Wed, Oct 1, 2008 at 10:16 PM, Mr. Gecko <[EMAIL PROTECTED]>  
wrote:

I think I would just use this AppleScript call
[[[NSAppleScript alloc] initWithSource:[NSString  
stringWithFormat:@"tell

application \"iTunes\" to play playlist \"[EMAIL PROTECTED]"", [self 
replace:@"\""
with:@"\\\"" source:[sender title executeAndReturnError:nil];
Works fast enough for me and it would work with " because I use my  
replace

function to make it \".


You'll also want to replace \ with \\ (make sure you do this *before*
you replace " with \") and *possibly* some others as well, I'm not
completely familiar with exactly what AppleScript allows in strings.
You may also have problems with non-ASCII characters, as AppleScript
is notoriously Unicode-unsavvy.


AppleScript 2.0 in Leopard is fully Unicode; older versions could  
handle Unicode strings, but the source code itself used your system's  
primary encoding (e.g. MacRoman, MacJapanese; a classic Mac OS  
throwback).


That said, code generation is fundamentally evil (unless you're in  
Lisp, where it's completely normal). If you need to parameterise an  
AppleScript, define an AppleScript handler that'll receive your values  
as parameters, then pack your ObjC values into NSAppleEventDescriptors  
and pack those into an event descriptor that calls your handler via - 
[NSAppleScript executeAppleEvent:error:]. You can probably find some  
examples online if you rummage around, e.g. there's one in appscript's  
subversion repository that uses objc-appscript's AEMCodecs class to do  
ObjC<->AEDesc conversions (it's rather more powerful than OS X's  
anaemic NSAppleEventDescriptor class).




Last time I had to do something like this (although it was
considerably more complex), I built a library to make it easy to build
raw Apple Events to mimic AppleScript without the mess that comes with
actually using AppleScript itself. If you want to check it out, you
can find more information about it here:

http://www.cocoadev.com/index.pl?AEVTBuilder



Neat. FWIW, objc-appscript lets you build and send events using  
straight ObjC method calls in both human-readable and raw four-char- 
code forms, e.g.:


- using human-readable syntax:  

// tell application "TextEdit" to word 1 of document 1

// To generate glue: osaglue -o TEGlue -p TE TextEdit
#import "TEGlue/TEGlue.h"

	TEApplication *textedit = [TEApplication applicationWithName:  
@"TextEdit"];

TEReference *ref = textedit documents] at: 1] words] at: 1];
NSError *error;
id result = [ref getItemWithError: &error];


- using raw four-char codes

// tell application "TextEdit" to «class cwor» 1 of «class docu» 1

#import "Appscript/Appscript.h"

	AEMApplication *textedit = [[AEMApplication alloc] initWithName:  
@"TextEdit"];
	AEMQuery *ref = AEMApp elements: 'docu'] at: 1] elements: 'cwor']  
at: 1];

AEMEvent *evt = [textedit eventWithEventClass: 'core' eventID: 'getd'];
[evt setParameter: ref forKeyword: ''];
NSError *error;
id result = [evt sendWithError: &error];
[textedit release];

has
--
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net

___

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]


TableView click and return key actions

2008-10-02 Thread Mr. Gecko
Hello I am making a simple table view in a window that pops up when  
someone presses a key and I am needing to have keyboard and click  
control with it. When someone clicks a row  and when someone presses  
return I want it to call my code which will close that window and do  
something with that row selected.


How can I do that?
___

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]


Re: Play Playlist in iTunes

2008-10-02 Thread Mr. Gecko

I think I'll stick with AppleScript
On Oct 2, 2008, at 5:35 PM, has wrote:


Michael Ash wrote:

On Wed, Oct 1, 2008 at 10:16 PM, Mr. Gecko <[EMAIL PROTECTED]>  
wrote:

I think I would just use this AppleScript call
[[[NSAppleScript alloc] initWithSource:[NSString  
stringWithFormat:@"tell

application \"iTunes\" to play playlist \"[EMAIL PROTECTED]"", [self 
replace:@"\""
with:@"\\\"" source:[sender title executeAndReturnError:nil];
Works fast enough for me and it would work with " because I use my  
replace

function to make it \".


You'll also want to replace \ with \\ (make sure you do this *before*
you replace " with \") and *possibly* some others as well, I'm not
completely familiar with exactly what AppleScript allows in strings.
You may also have problems with non-ASCII characters, as AppleScript
is notoriously Unicode-unsavvy.


AppleScript 2.0 in Leopard is fully Unicode; older versions could  
handle Unicode strings, but the source code itself used your  
system's primary encoding (e.g. MacRoman, MacJapanese; a classic Mac  
OS throwback).


That said, code generation is fundamentally evil (unless you're in  
Lisp, where it's completely normal). If you need to parameterise an  
AppleScript, define an AppleScript handler that'll receive your  
values as parameters, then pack your ObjC values into  
NSAppleEventDescriptors and pack those into an event descriptor that  
calls your handler via -[NSAppleScript executeAppleEvent:error:].  
You can probably find some examples online if you rummage around,  
e.g. there's one in appscript's subversion repository that uses objc- 
appscript's AEMCodecs class to do ObjC<->AEDesc conversions (it's  
rather more powerful than OS X's anaemic NSAppleEventDescriptor  
class).




Last time I had to do something like this (although it was
considerably more complex), I built a library to make it easy to  
build
raw Apple Events to mimic AppleScript without the mess that comes  
with

actually using AppleScript itself. If you want to check it out, you
can find more information about it here:

http://www.cocoadev.com/index.pl?AEVTBuilder



Neat. FWIW, objc-appscript lets you build and send events using  
straight ObjC method calls in both human-readable and raw four-char- 
code forms, e.g.:


- using human-readable syntax:  

// tell application "TextEdit" to word 1 of document 1

// To generate glue: osaglue -o TEGlue -p TE TextEdit
#import "TEGlue/TEGlue.h"

	TEApplication *textedit = [TEApplication applicationWithName:  
@"TextEdit"];

TEReference *ref = textedit documents] at: 1] words] at: 1];
NSError *error;
id result = [ref getItemWithError: &error];


- using raw four-char codes

// tell application "TextEdit" to «class cwor» 1 of «class docu» 1

#import "Appscript/Appscript.h"

	AEMApplication *textedit = [[AEMApplication alloc] initWithName:  
@"TextEdit"];
	AEMQuery *ref = AEMApp elements: 'docu'] at: 1] elements:  
'cwor'] at: 1];
	AEMEvent *evt = [textedit eventWithEventClass: 'core' eventID:  
'getd'];

[evt setParameter: ref forKeyword: ''];
NSError *error;
id result = [evt sendWithError: &error];
[textedit release];

has
--
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net



___

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]


Re: Play Playlist in iTunes

2008-10-02 Thread Kyle Sluder
On Thu, Oct 2, 2008 at 6:45 PM, Mr. Gecko <[EMAIL PROTECTED]> wrote:
> I think I'll stick with AppleScript

If you do, you're dependent on the AppleScript parser, which is an
awfully hefty dependency when you know precisely what Apple Events you
want to send.  Your software quality will be much improved by not
using AppleScript from your code -- its human-readable syntax is meant
to be a convenience to users, not progammers.

--Kyle Sluder
___

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]


Re: TableView click and return key actions

2008-10-02 Thread Kyle Sluder
On Thu, Oct 2, 2008 at 6:40 PM, Mr. Gecko <[EMAIL PROTECTED]> wrote:
> Hello I am making a simple table view in a window that pops up when someone
> presses a key and I am needing to have keyboard and click control with it.
> When someone clicks a row  and when someone presses return I want it to call
> my code which will close that window and do something with that row
> selected.
>
> How can I do that?

You can read the documentation on event handling.
http://developer.apple.com/documentation/Cocoa/Conceptual/EventOverview/Introduction/chapter_1_section_1.html

--Kyle Sluder
___

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]


Re: Newbie: Strange problem with NSTableView, check boxes and Core Data

2008-10-02 Thread Jonathan Oddie


On Oct 2, 2008, at 11:55 AM, Corbin Dunn wrote:





Thanks for the advice Corbin. Below is a long backtrace, but I am  
not sure it sheds much light on the problem. I will keep working at  
it but since I am moving house this week I may not get much done  
for a while...

Jonathan



This is an interesting backtrace. What image do you have set on the  
NSButtonCell in the tableView? Is it one of the predefined apple  
ones? If so, which one?


It is possible this is a bug in the framework.



Hi Corbin,
The button cell is just the predefined check box cell from Interface  
Builder, which I dragged into the table column to replace the default  
text field cell -- I don't think I've even changed any attributes of it.
Is this a strange design, to have a column of check boxes adjacent to  
a column of text fields? It seemed like the simplest way to make it  
work with bindings (binding the "value" of the check box column to the  
boolean attribute arrangedObjects.Enabled of the array controller).


Jonathan






corbin




#0  0x90187e17 in objc_exception_throw
#1  0x9433434a in -[NSObject doesNotRecognizeSelector:]
#2  0x9433294c in ___forwarding___
#3  0x94332a12 in __forwarding_prep_0___
#4  0x95bdfa8c in -[CISampler _initWithImage:optionsList:]
#5  0x95bdf888 in -[CISampler initWithImage:options:]
#6  0x95bdf811 in -[CISampler initWithImage:]
#7  0x95bdf727 in +[CISampler samplerWithImage:]
#8  0x95c9f638 in -[CIFullButton outputImage]
#9  0x91663e3a in -[NSObject(NSKeyValueCoding) valueForKey:]
#10 0x95bdd530 in -[CIFilter valueForKey:]
#11 0x95d984c1 in -[CIUIBundle1 buttonResultForResolutionData:]
#12	0x95d962f1 in -[CIUIBundleBase  
renderResolutionData:toBitmap:width:height:bytesPerRow:]

#13 0x95d92f83 in -[CIUIBundleBase dataForResolutionData:]
#14 0x95d93a5e in -[CIUIBundleBase dataForPPI:]
#15 0x95d8f516 in QSICreateElement
#16 0x90c0b6b4 in CUIElement::Load
#17 0x90bf53e3 in CUIRenderer::Draw1Piece
#18 0x90bf7851 in CUIRenderer::Draw
#19 0x94da43d2 in -[NSCoreUIImageRep draw]
#20	0x94da430b in -[NSCoreUIImageRep  
_drawFromRect:toRect:operation:alpha:compositing:flipped:ignoreContext 
:]

#21 0x94d9fd43 in -[NSImage drawInRect:fromRect:operation:fraction:]
#22	0x951e50de in -[NSImage  
_drawMappingAlignmentRectToRect:withState:backgroundStyle:operation:fraction:flip 
:]

#23 0x94da2fc7 in -[NSButtonCell drawImage:withFrame:inView:]
#24	0x95112d97 in -[NSButtonCell  
_configureAndDrawImageWithRect:cellFrame:controlView:]

#25 0x94d96c20 in -[NSButtonCell drawInteriorWithFrame:inView:]
#26	0x94ddff19 in -[NSTableView  
_drawContentsAtRow:column:withCellFrame:]

#27 0x94ddf37a in -[NSTableView drawRow:clipRect:]
#28 0x94d847f4 in -[NSTableView drawRowIndexes:clipRect:]
#29 0x94d832d8 in -[NSTableView drawRect:]
#30 0x94e13864 in -[NSView _drawRect:clip:]
#31	0x94e1235b in -[NSView  
_recursiveDisplayAllDirtyWithLockFocus:visRect:]
#32	0x94e126f2 in -[NSView  
_recursiveDisplayAllDirtyWithLockFocus:visRect:]
#33	0x94e10cb1 in -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:]
#34	0x94e11b0b in -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:]
#35	0x94e11b0b in -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:]
#36	0x94e11b0b in -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:]
#37	0x94e11b0b in -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:]
#38	0x94e11b0b in -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:]
#39	0x94e105f3 in -[NSThemeFrame  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:]
#40	0x94e0d117 in -[NSView  
_displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:]

#41 0x94d4db77 in -[NSView displayIfNeeded]
#42 0x94d4d725 in -[NSWindow displayIfNeeded]
#43 0x94d4d548 in _handleWindowNeedsDisplay
#44 0x942b19c2 in __CFRunLoopDoObservers
#45 0x942b2d1c in CFRunLoopRunSpecific
#46 0x942b3cf8 in CFRunLoopRunInMode
#47 0x911fb480 in RunCurrentEventLoopInMode
#48 0x911fb1d2 in ReceiveNextEventCommon
#49 0x911fb10d in BlockUntilNextEventMatchingListInMode
#50 0x94d4b3ed in _DPSNextEvent
#51	0x94d4aca0 in -[NSApplication  
nextEventMatchingMask:untilDate:inMode:dequeue:]

#52 0x94d43cdb in -[NSApplication run]
#53 0x94d10f14 in NSApplicationMain
#54 0x4123 in main at main.m:13

___

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 Subscri

Security - Write to protected directory

2008-10-02 Thread Kelly Graus

Hello,

I have an application that needs to be able to write to a protected  
directory (either Library/Application Support/ or Applications/  
depending on the case).  I've separated out all writing operations to  
a separate application, which currently is run using NSTask.


I've read the "Performing Privileged Operations With Authorization  
Services" documentation, which seems to mostly be about allowing an  
application to define custom privileged operations.  The closest thing  
to my case is when it talks about Installers and says to use the  
AuthorizationExecuteWithPrivileges function.  However, I've read in  
several places that this function is "mostly" decremented (whatever  
that means) and probably shouldn't be used.  Also, I need the ability  
to wait for the separate application to finish, which is provided by  
NSTask but doesn't seem to be available with  
AuthorizationExecuteWithPrivileges.


I've also read about using a setuid tool, which would allow me to run  
any application as root, but I've also read that it causes problems  
with drag-and-drop uninstalls, since the setuid tool would be owned by  
root.


So my questions are:

Is the only way to allow a user to write to a protected location use  
the AuthorizationExecuteWithPrivileges function?
If so, is there a way to tell when the application has quit, and get  
the exit code?
If not, how would I go about getting sufficient privileges to write to  
protected locations?
Does using a setuid tool mess up the ability for a user to delete an  
application, assuming the setuid tool is imbedded in an application's  
bundle?


Thanks for any help!

Kelly
___

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]


Synchronous application launch

2008-10-02 Thread Ray Ruvinskiy
I'm having difficulty synchronously launching an application, as  
documented at the bottom of http://developer.apple.com/documentation/Carbon/Conceptual/LaunchServicesConcepts/LSCConcepts/chapter_2_section_6.html 
. I've attempted using both -[NSWorkspace  
launchAppWithBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifier 
:] and LSOpenApplication, without specifying NSWorkspaceLaunchAsync or  
kLSLaunchAsync, respectively (specifically, passing 0 for the flags).


The application launched is a Cocoa application, and I trap it in gdb  
by starting gdb with the "--waitfor " switch. I have  
verified that control does not return to the caller before  
NSApplicationMain is called by placing a breakpoint in the called  
application. However, control is returned after that point and before  
I reach awakeFromNib and applicationWillFinishLaunching. If I place a  
breakpoint in awakeFromNib, the dock icon continues bouncing, but  
LSOpenApplication has already returned. This seems to contradict the  
documentation, which seems to imply that the fact that the dock icon  
is bouncing should mean that the application has not finished  
launching and that therefore LSOpenApplication should continue blocking.


Is this behaviour expected, is this a bug, or am I simply doing  
something wrong? I am using Mac OS X 10.5.4 on a Core 2 Duo Mac Mini.


Thanks,

Ray

___

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]


Core Data undo grouping

2008-10-02 Thread Peter Sagerson
I'm using CoreData for some internal state management that sometimes  
requires an undo boundary in a specific place. In other words, I need  
something along these lines to work:



NSManagedObject *object = [self getObjectFromSomewhere];
NSManagedObjectContext *context = [object managedObjectContext];

[object setValue:@"1" forKey:@"attr"];
[self forceUndoBoundaryInContext:context];
[object setValue:@"2" forKey:@"attr"];
[context undo];

STAssertEqualObjects([object valueForKey:@"attr"], @"1", @"");


Based on the documentation, it seems clear that all I have to do to  
accomplish this is call processPendingChanges:



- (void)forceUndoBoundaryInContext:(NSManagedObjectContext *)context
{
[context processPendingChanges];
}


But this does not work. I installed notification handlers for  
NSUndoManagerDidOpenUndoGroupNotification and  
NSUndoManagerWillCloseUndoGroupNotification and I can see that the  
group is not closed until I call undo. As a workaround, I've found  
that I can fiddle with the context's undo manager directly:



- (void)forceUndoBoundaryInContext:(NSManagedObjectContext *)context
{
[context processPendingChanges];

[[context undoManager] endUndoGrouping];
[[context undoManager] beginUndoGrouping];
}


This works, but it seems kind of sneaky and underhanded and I'm not  
entirely comfortable with it. Is there a better way to do this? Does  
anyone else find this behavior inconsistent with the documentation for  
processPendingChanges?


Thanks
___

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]


Re: Security - Write to protected directory

2008-10-02 Thread Nick Zitzmann


On Oct 2, 2008, at 1:30 PM, Kelly Graus wrote:

Is the only way to allow a user to write to a protected location use  
the AuthorizationExecuteWithPrivileges function?


Yes. AEWP() is most certainly not deprecated.

If so, is there a way to tell when the application has quit, and get  
the exit code?


Yes. (Hint: Look at the man page for the wait() function.)

Does using a setuid tool mess up the ability for a user to delete an  
application, assuming the setuid tool is imbedded in an  
application's bundle?



Tools that are set to run setuid root tend to be security holes  
waiting to happen, unless they have an extremely good reason for  
running as setuid root, and they've been time-tested, such as the ps  
tool.


Nick Zitzmann




___

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]


Re: TableView click and return key actions

2008-10-02 Thread Corbin Dunn

Hi Mr. Gecko,

For clicking (and just clicking), do your code in the -action. For  
return, override -keyDown: and look for the appropriate code.


corbin

On Oct 2, 2008, at 3:40 PM, Mr. Gecko wrote:

Hello I am making a simple table view in a window that pops up when  
someone presses a key and I am needing to have keyboard and click  
control with it. When someone clicks a row  and when someone presses  
return I want it to call my code which will close that window and do  
something with that row selected.


How can I do that?
___

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/corbind%40apple.com

This email sent to [EMAIL PROTECTED]


___

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]


Re: Security - Write to protected directory

2008-10-02 Thread Bill Bumgarner

On Oct 2, 2008, at 12:30 PM, Kelly Graus wrote:
Is the only way to allow a user to write to a protected location use  
the AuthorizationExecuteWithPrivileges function?
If so, is there a way to tell when the application has quit, and get  
the exit code?
If not, how would I go about getting sufficient privileges to write  
to protected locations?
Does using a setuid tool mess up the ability for a user to delete an  
application, assuming the setuid tool is imbedded in an  
application's bundle?


Thanks for any help!


See Nick's response... it was helpful.

However -- I have a question:

What are you trying to do and what do you hope to gain by protecting  
the data in this fashion?


Specifically, going down this path means that any non-admin user will  
not be able to use whatever functionality in your application requires  
authorization   is that intended?


b.bum

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

This email sent to [EMAIL PROTECTED]

Re: Play Playlist in iTunes

2008-10-02 Thread Mr. Gecko

I know but I can't find out the AppleEvent for Play Playlist.
Is there some sort of a program that will parse the AppleScript and  
make an cocoa AppleEvent code.


On Oct 2, 2008, at 6:09 PM, Kyle Sluder wrote:


On Thu, Oct 2, 2008 at 6:45 PM, Mr. Gecko <[EMAIL PROTECTED]> wrote:

I think I'll stick with AppleScript


If you do, you're dependent on the AppleScript parser, which is an
awfully hefty dependency when you know precisely what Apple Events you
want to send.  Your software quality will be much improved by not
using AppleScript from your code -- its human-readable syntax is meant
to be a convenience to users, not progammers.

--Kyle Sluder


___

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]


Re: TableView click and return key actions

2008-10-02 Thread Mr. Gecko

That worked perfectly.

Thanks,
Mr. Gecko

On Oct 2, 2008, at 8:00 PM, Corbin Dunn wrote:


Hi Mr. Gecko,

For clicking (and just clicking), do your code in the -action. For  
return, override -keyDown: and look for the appropriate code.


corbin

On Oct 2, 2008, at 3:40 PM, Mr. Gecko wrote:

Hello I am making a simple table view in a window that pops up when  
someone presses a key and I am needing to have keyboard and click  
control with it. When someone clicks a row  and when someone  
presses return I want it to call my code which will close that  
window and do something with that row selected.


How can I do that?
___

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/corbind%40apple.com

This email sent to [EMAIL PROTECTED]




___

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]


Re: Direct use of NSScroller?

2008-10-02 Thread Michael Ash
On Thu, Oct 2, 2008 at 12:34 PM, James W. Walker <[EMAIL PROTECTED]> wrote:
>
> On Oct 2, 2008, at 8:13 AM, Michael Ash wrote:
>
>> On Wed, Oct 1, 2008 at 10:13 PM, James Walker <[EMAIL PROTECTED]>
>> wrote:
>>>
>>> I suppose someone is sure to ask why I can't use NSScrollView.  I'm doing
>>> a
>>> kind of scrolling that isn't just shifting a view around.  Some members
>>> are
>>> arranged in two rows, like so...
>>>
>>> 1  2  3
>>> 4  5  6
>>>
>>> and when you scroll right, they change like this...
>>>
>>> 2  3  4
>>> 5  6  7
>>>
>>> and so on.
>>
>> Pardon my intrusiveness, but this sounds like a terrible UI. It's
>> highly nonstandard and nobody will expect it to behave this way. Why
>> can't you do things the normal way such that you start off with:
>>
>> A  B  C
>> Z  Y  X
>>
>> And when you scroll to the right you get:
>>
>> B  C  D
>> Y  X  W
>>
>> This has the dual advantage of allowing you to use NSScrollView and
>> not confusing your users.
>
>
>
> These items are in a linear order, and it wouldn't be very useful to see two
> disjoint subsequences of them.

Well, that was just for illustrative purposes. You could do something like this:

1  3  5
2  4  6

Or do:

1  2  3
4  5  6

And scroll vertically. Or use a single-row list. Lots of possibilities.

>  Anyway, it's a cross-platform product, and
> the interface isn't really my decision.

I understand that you're probably not in a position to change things
and you have to work within the constraints you have. I know how that
goes! But I want to point out that this is a big reason why
"cross-platform product" nearly always implies "terrible GUI". Just
because an interface works on one platform doesn't mean it ought to be
duplicated on another.

Mike
___

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]


Re: -[NSScanner scanUpToString:stopString:NULL] - 10.3.9 Crash, due Xcode 3.1?

2008-10-02 Thread Michael Ash
On Thu, Oct 2, 2008 at 6:24 PM, Jerry Krinock <[EMAIL PROTECTED]> wrote:
> Well, Cem actually I am passing it NULL, which then gets passed as the
> second argument to -[NSScanner scanUpToString:intoString], but according to
> the documentation NULL is OK there, and I've been doing it for years.

Indeed, that should be fine. And if it weren't, you'd almost certainly
be seeing some other problem, not this particular crash.

> News Flash: I've reproduced the problem in a small demo app.  Looks like the
> same bug in 10.3 that I found back in March (CLANG!!), but the inexplicably
> magic workaround which I applied back then has stopped working.

What's the bug, and what's the magic workaround? Also, how much code
is required to reproduce the bug, and is it small enough to post? I'm
curious as to what you've found.

Mike
___

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]


re: Core Data undo grouping

2008-10-02 Thread Ben Trumbull

Peter,


I'm using CoreData for some internal state management that sometimes
requires an undo boundary in a specific place. In other words, I need
something along these lines to work:


NSManagedObject *object = [self getObjectFromSomewhere];
NSManagedObjectContext *context = [object managedObjectContext];

[object setValue:@"1" forKey:@"attr"];
[self forceUndoBoundaryInContext:context];
[object setValue:@"2" forKey:@"attr"];


This is a little odd.  If this is in the UI thread, it will be  
confusing to the user in the typical scenarios.  Are you sure you  
don't want to create a nested undo group ?



Based on the documentation, it seems clear that all I have to do to
accomplish this is call processPendingChanges:


No, Core Data works with NSUndoManager.  -processPendingChanges simply  
ensures that all the coalesced work Core Data might be deferring gets  
put into the current undo grouping.  It may register new actions with  
the undo manager, but does not end current grouping.


Fiddling with the undo groupings themselves should be done with  
NSUndoManager API.


- Ben



___

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]


Re: Play Playlist in iTunes

2008-10-02 Thread Michael Ash
On Thu, Oct 2, 2008 at 6:35 PM, has <[EMAIL PROTECTED]> wrote:
> Michael Ash wrote:
>
>> On Wed, Oct 1, 2008 at 10:16 PM, Mr. Gecko <[EMAIL PROTECTED]> wrote:
>>>
>>> I think I would just use this AppleScript call
>>> [[[NSAppleScript alloc] initWithSource:[NSString stringWithFormat:@"tell
>>> application \"iTunes\" to play playlist \"[EMAIL PROTECTED]"", [self 
>>> replace:@"\""
>>> with:@"\\\"" source:[sender title executeAndReturnError:nil];
>>> Works fast enough for me and it would work with " because I use my
>>> replace
>>> function to make it \".
>>
>> You'll also want to replace \ with \\ (make sure you do this *before*
>> you replace " with \") and *possibly* some others as well, I'm not
>> completely familiar with exactly what AppleScript allows in strings.
>> You may also have problems with non-ASCII characters, as AppleScript
>> is notoriously Unicode-unsavvy.
>
> AppleScript 2.0 in Leopard is fully Unicode; older versions could handle
> Unicode strings, but the source code itself used your system's primary
> encoding (e.g. MacRoman, MacJapanese; a classic Mac OS throwback).

Good to know!

> That said, code generation is fundamentally evil (unless you're in Lisp,
> where it's completely normal). If you need to parameterise an AppleScript,
> define an AppleScript handler that'll receive your values as parameters,
> then pack your ObjC values into NSAppleEventDescriptors and pack those into
> an event descriptor that calls your handler via -[NSAppleScript
> executeAppleEvent:error:]. You can probably find some examples online if you
> rummage around, e.g. there's one in appscript's subversion repository that
> uses objc-appscript's AEMCodecs class to do ObjC<->AEDesc conversions (it's
> rather more powerful than OS X's anaemic NSAppleEventDescriptor class).

A good point, I should have thought of that. (I think I mentioned this
in another message to this list quite recently, in fact, but it
slipped my mind for this one.) I advocate against using AppleScript at
all, but if you need to use parameterized scripts then this is
definitely the way to do it.

>> Last time I had to do something like this (although it was
>> considerably more complex), I built a library to make it easy to build
>> raw Apple Events to mimic AppleScript without the mess that comes with
>> actually using AppleScript itself. If you want to check it out, you
>> can find more information about it here:
>>
>> http://www.cocoadev.com/index.pl?AEVTBuilder
>
>
> Neat. FWIW, objc-appscript lets you build and send events using straight
> ObjC method calls in both human-readable and raw four-char-code forms, e.g.:
>
> - using human-readable syntax:
>
>// tell application "TextEdit" to word 1 of document 1
>
>// To generate glue: osaglue -o TEGlue -p TE TextEdit
>#import "TEGlue/TEGlue.h"
>
>TEApplication *textedit = [TEApplication applicationWithName:
> @"TextEdit"];
>TEReference *ref = textedit documents] at: 1] words] at: 1];
>NSError *error;
>id result = [ref getItemWithError: &error];
>
>
> - using raw four-char codes
>
>// tell application "TextEdit" to «class cwor» 1 of «class docu» 1
>
>#import "Appscript/Appscript.h"
>
>AEMApplication *textedit = [[AEMApplication alloc] initWithName:
> @"TextEdit"];
>AEMQuery *ref = AEMApp elements: 'docu'] at: 1] elements: 'cwor']
> at: 1];
>AEMEvent *evt = [textedit eventWithEventClass: 'core' eventID:
> 'getd'];
>[evt setParameter: ref forKeyword: ''];
>NSError *error;
>id result = [evt sendWithError: &error];
>[textedit release];

That is nice, and is probably a better way to go for something like
this. The advantages of AEVTBuilder would be:

- Smaller code (I assume). Under 300 lines, and really just a really
weird wrapper around NSAppleEventDescriptor.

- Syntax looks a lot like the debugging prints you get when you set
the magic environment variables. This is the main reason I made it.
Since I have a very poor understanding of Apple Events, I wanted to be
able to apply rote copying as much as possible, and this let me do it.

- Not that anybody cares anymore, but AEVTBuilder should work back to 10.2.

The much greater functionality provided by objc-appscript presumably
makes it a better choice for many tasks.

Mike
___

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]

Re: Play Playlist in iTunes

2008-10-02 Thread Michael Ash
On Thu, Oct 2, 2008 at 9:52 PM, Mr. Gecko <[EMAIL PROTECTED]> wrote:
> I know but I can't find out the AppleEvent for Play Playlist.
> Is there some sort of a program that will parse the AppleScript and make an
> cocoa AppleEvent code.

Not quite, but you can get pretty close. Go to the section titled "An
Example" on this page:

http://www.cocoadev.com/index.pl?AEVTBuilder

It shows how to make Script Editor dump the Apple Events it's sending,
and then how to translate this into code. This example obviously shows
how to translate into AEVTBuilder code (a very direct translation due
to how AEVTBuilder is structured) but this could be pretty easily used
to generate code for other libraries, or even raw
NSAppleEventDescriptors, without great difficulty.

Mike
___

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]


Re: Security - Write to protected directory

2008-10-02 Thread Jason Coco


On Oct 2, 2008, at 21:20 , Bill Bumgarner wrote:


On Oct 2, 2008, at 12:30 PM, Kelly Graus wrote:
Is the only way to allow a user to write to a protected location  
use the AuthorizationExecuteWithPrivileges function?
If so, is there a way to tell when the application has quit, and  
get the exit code?
If not, how would I go about getting sufficient privileges to write  
to protected locations?
Does using a setuid tool mess up the ability for a user to delete  
an application, assuming the setuid tool is imbedded in an  
application's bundle?


Thanks for any help!


See Nick's response... it was helpful.

However -- I have a question:

What are you trying to do and what do you hope to gain by protecting  
the data in this fashion?


Specifically, going down this path means that any non-admin user  
will not be able to use whatever functionality in your application  
requires authorization   is that intended?


If you do need administrators to write to privileged areas sometimes,  
you should look at the /sbin/libexec/authopen tool which is designed  
for that.


However, I believe the default for both those directories is admin +w  
anyway.


J

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

This email sent to [EMAIL PROTECTED]

Re: Security - Write to protected directory

2008-10-02 Thread Bill Bumgarner

On Oct 2, 2008, at 8:20 PM, Jason Coco wrote:

On Oct 2, 2008, at 21:20 , Bill Bumgarner wrote:

On Oct 2, 2008, at 12:30 PM, Kelly Graus wrote:
Is the only way to allow a user to write to a protected location  
use the AuthorizationExecuteWithPrivileges function?
If so, is there a way to tell when the application has quit, and  
get the exit code?
If not, how would I go about getting sufficient privileges to  
write to protected locations?
Does using a setuid tool mess up the ability for a user to delete  
an application, assuming the setuid tool is imbedded in an  
application's bundle?


Thanks for any help!


See Nick's response... it was helpful.

However -- I have a question:

What are you trying to do and what do you hope to gain by  
protecting the data in this fashion?


Specifically, going down this path means that any non-admin user  
will not be able to use whatever functionality in your application  
requires authorization   is that intended?


If you do need administrators to write to privileged areas  
sometimes, you should look at the /sbin/libexec/authopen tool which  
is designed for that.


However, I believe the default for both those directories is admin  
+w anyway.


Which will still leave non-admin users out of luck in using the OP's  
application.


The user account I use all the time is a non-admin account.   Primary  
use admin accounts open up a series of security holes that are easily  
avoided.


Does using a setuid tool mess up the ability for a user to delete an  
application, assuming the setuid tool is imbedded in an  
application's bundle?


If the tool is setuid root, then -- yes -- the user won't be able to  
deleted the application without administrative rights.


But... don't do that.  A setuid root tool is even worse than going  
through AuthorizationExecuteWithPrivileges().  It is huge security  
hole in that any user with read access can cause a process to run as  
root, thus eliminating the authentication hurdle of  
AuthorizationExecuteWithPrivileges().


So... again... why does the OP's app need to write anything with  
authorization privileges (and where)?


b.bum

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

This email sent to [EMAIL PROTECTED]

Re: Newb: KATI Sample Code - What's This Called?

2008-10-02 Thread Ken Ferry
On Thu, Oct 2, 2008 at 2:50 PM, Randall Meadows <[EMAIL PROTECTED]> wrote:
> On Oct 2, 2008, at 3:43 PM, Brad Gibbs wrote:
>
>> I'm working through the XSViewController example project from KATIDev and
>> I came across this line:
>>
>>[(ColorView*)[self view] setBackgroundColor:[[NSColor greenColor]
>> colorWithAlphaComponent:.5]];
>>
>> and realized I don't understand (ColorView*).  It looks like it's
>> declaring a pointer to an object, but it's followed by a method.  Could
>> somebody tell me the name of the function (ColorView*) is performing so I
>> can look it up and figure it out?
>
> That is casting the object returned from [self view] to a type of "pointer
> to a ColorView object", that is, an instance of a ColorView.  Most likely,
> this is done to quiet a compiler warning about an object (in this case,
> whatever [self view] is returning, not responding to -setBackgroundColor:.

Parentheses do at least completely different in C.  Three is just what
I can think of right now.
(1) Function invocation.
(2) Grouping.
(3) Casting.

Why does this code spew the odd sounding error message " called object
'argc' is not a function" when you try to compile it?

int main(int argc)
{
int argCount = argc
NULL;
return 0;
}

Because I forgot the semicolon after argc, and NULL expands to ((void
*)0).  Those parentheses are intended for grouping, but to the
compiler it looks the same as

int argCount = argc((void*)0);

and it looks like I was trying to make a function call.

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

This email sent to [EMAIL PROTECTED]


Re: Security - Write to protected directory

2008-10-02 Thread Kelly Graus

Hi Bill,

Thanks for the response!

This is the intended functionality.  We are allowing a user to install  
system-wide content to our application.  We also have the ability for  
users to install content for a single user with admin privileges.


Kelly

On Oct 2, 2008, at 7:20 PM, Bill Bumgarner wrote:


On Oct 2, 2008, at 12:30 PM, Kelly Graus wrote:
Is the only way to allow a user to write to a protected location  
use the AuthorizationExecuteWithPrivileges function?
If so, is there a way to tell when the application has quit, and  
get the exit code?
If not, how would I go about getting sufficient privileges to write  
to protected locations?
Does using a setuid tool mess up the ability for a user to delete  
an application, assuming the setuid tool is imbedded in an  
application's bundle?


Thanks for any help!


See Nick's response... it was helpful.

However -- I have a question:

What are you trying to do and what do you hope to gain by protecting  
the data in this fashion?


Specifically, going down this path means that any non-admin user  
will not be able to use whatever functionality in your application  
requires authorization   is that intended?


b.bum


___

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]


Re: Security - Write to protected directory

2008-10-02 Thread Andrew Merenbach

Greetings, Kelly!

For this particular purpose, would it be possible to use a package  
(.pkg) installer?  You can allow the user to choose between  
destinations, and such installers handle the authorization for you.   
If you intend to allow the content to be installed for the application  
from *within* said application, you could have the program download  
(if necessary) the package installer in the background, then simply  
launch it -- the user would go through the install process, the  
installer would terminate, and you'd be set.  This saves you from  
having to write your own installer code, is more secure (IMHO), and  
may also be more future-proof.  I quite clearly may have overlooked  
something, but this was the first thing that occurred to me.


I hope that this might help, at least a little!

Cheers,
Andrew

On Oct 2, 2008, at 9:30 PM, Kelly Graus wrote:


Hi Bill,

Thanks for the response!

This is the intended functionality.  We are allowing a user to  
install system-wide content to our application.  We also have the  
ability for users to install content for a single user with admin  
privileges.


Kelly

On Oct 2, 2008, at 7:20 PM, Bill Bumgarner wrote:


On Oct 2, 2008, at 12:30 PM, Kelly Graus wrote:
Is the only way to allow a user to write to a protected location  
use the AuthorizationExecuteWithPrivileges function?
If so, is there a way to tell when the application has quit, and  
get the exit code?
If not, how would I go about getting sufficient privileges to  
write to protected locations?
Does using a setuid tool mess up the ability for a user to delete  
an application, assuming the setuid tool is imbedded in an  
application's bundle?


Thanks for any help!


See Nick's response... it was helpful.

However -- I have a question:

What are you trying to do and what do you hope to gain by  
protecting the data in this fashion?


Specifically, going down this path means that any non-admin user  
will not be able to use whatever functionality in your application  
requires authorization   is that intended?


b.bum


___

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/andrew.merenbach%40ucla.edu

This email sent to [EMAIL PROTECTED]




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

This email sent to [EMAIL PROTECTED]

Re: Play Playlist in iTunes

2008-10-02 Thread Mr. Gecko
No I won't be able to use EyeTunes I looked, I had to add some of my  
own functions into it to make it do what I wanted with volumes. so I  
may add the play playlist function to it when I find out how I can do  
it with AppleEvent.

___

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]


Re: Security - Write to protected directory

2008-10-02 Thread Kelly Graus


On Oct 2, 2008, at 6:23 PM, Nick Zitzmann wrote:



On Oct 2, 2008, at 1:30 PM, Kelly Graus wrote:

Is the only way to allow a user to write to a protected location  
use the AuthorizationExecuteWithPrivileges function?


Yes. AEWP() is most certainly not deprecated.


Ok, I will look into using that.




If so, is there a way to tell when the application has quit, and  
get the exit code?


Yes. (Hint: Look at the man page for the wait() function.)


I looked at the wait function, I just couldn't figure out how to get  
the pid of the started application.  Is there a way to get the pid  
without cooperation of the started application (ie, some sort of IPC  
between the two applications).  I'm very new coding for OS X (and Unix  
based systems in general), so any details would be very appreciated!





Does using a setuid tool mess up the ability for a user to delete  
an application, assuming the setuid tool is imbedded in an  
application's bundle?



Tools that are set to run setuid root tend to be security holes  
waiting to happen, unless they have an extremely good reason for  
running as setuid root, and they've been time-tested, such as the ps  
tool.


Yeah, I was hoping it wouldn't come to using setuid.

Thanks for your help!

Kelly
___

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]


Complicated set of dynamic nested views

2008-10-02 Thread Ken Tozier

Hi

I need to create an interface with collapsible views (much like those  
in InterfaceBuilder's "inspector" palette) and am having a hard time  
figuring out what exactly to use as the base in IB 3.0. In older  
versions of IB, there was a "panel" view which allowed for this stuff,  
but that appears to be gone in 3.0. What should I use? And how can I  
create a generic collapsible view widget?


I made a bunch of custom view classes for an earlier version of my app  
but it required writing over 70 individual custom views and eventually  
the complicated interactions between all these parts got away from me.  
I couldn't get the refreshing right in response to window resizing so  
I thought I'd take a crack at creating these custom views in IB.


I badly need a generic collapsible view that can contain any number of  
other views (again much like IB 3.0 Inspector palette)


Any links to example projects or tips greatly appreciated.

Thanks for any help
___

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]


Re: Security - Write to protected directory

2008-10-02 Thread Bill Bumgarner

On Oct 2, 2008, at 9:30 PM, Kelly Graus wrote:

Hi Bill,

Thanks for the response!

This is the intended functionality.  We are allowing a user to  
install system-wide content to our application.  We also have the  
ability for users to install content for a single user with admin  
privileges.


Ah... OK.  That makes sense and is a reasonable use case (i.e. what  
bug the heck out of users all the time :).


It is also a problem that has been addressed a number of times.

As someone mentioned, can you use an installer package?   pkgs can  
require authentication.


As well, the previously mentioned authopen could be used to write  
files with authorization.


This:

http://developer.apple.com/documentation/Security/Conceptual/SecureCodingGuide/Articles/AccessControl.html

And this:

http://developer.apple.com/documentation/Security/Conceptual/authorization_concepts/02authconcepts/chapter_2_section_8.html

Seem to be a good starting point.

However, this document seems to potentially address your needs:

http://developer.apple.com/documentation/Security/Conceptual/authorization_concepts/03authtasks/chapter_3_section_4.html#/ 
/apple_ref/doc/uid/TP3995-CH206-TPXREF33


b.bum



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

This email sent to [EMAIL PROTECTED]

Re: Complicated set of dynamic nested views

2008-10-02 Thread Rob Keniger


On 03/10/2008, at 2:52 PM, Ken Tozier wrote:


Hi

I need to create an interface with collapsible views (much like  
those in InterfaceBuilder's "inspector" palette) and am having a  
hard time figuring out what exactly to use as the base in IB 3.0. In  
older versions of IB, there was a "panel" view which allowed for  
this stuff, but that appears to be gone in 3.0. What should I use?  
And how can I create a generic collapsible view widget?


I made a bunch of custom view classes for an earlier version of my  
app but it required writing over 70 individual custom views and  
eventually the complicated interactions between all these parts got  
away from me. I couldn't get the refreshing right in response to  
window resizing so I thought I'd take a crack at creating these  
custom views in IB.


I badly need a generic collapsible view that can contain any number  
of other views (again much like IB 3.0 Inspector palette)


Any links to example projects or tips greatly appreciated.



I've implemented something like this myself and it's definitely more  
complicated than it should be. I found the best sample code is the  
CollapsibleBox class in the Reducer sample:


http://developer.apple.com/samplecode/Reducer/

--
Rob Keniger



___

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]


Re: Play Playlist in iTunes

2008-10-02 Thread Mr. Gecko
Thanks for that, All i'll have to do now is find out how it puts  
together the AppleEvent and than I can add it to EyeTunes as an  
function.

___

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]


Re: Newb: KATI Sample Code - What's This Called?

2008-10-02 Thread Rob Keniger


On 03/10/2008, at 7:43 AM, Brad Gibbs wrote:

and realized I don't understand (ColorView*).  It looks like it's  
declaring a pointer to an object, but it's followed by a method.   
Could somebody tell me the name of the function (ColorView*) is  
performing so I can look it up and figure it out?



As others have pointed out, this is C type casting. Here's a couple of  
references:


http://en.wikipedia.org/wiki/Cast_(computer_science)

http://docs.hp.com/en/B3901-90007/ch05s05.html

If this is confusing you, you probably need to do some introductory  
tutorials on basic C syntax. I highly recommend Stephen Kochan's book  
"Programming in Objective-C" which has an excellent section on the  
parts of C that are relevant to Objective-C, as well as being IMO the  
best Objective-C language book out there.


--
Rob Keniger

___

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]