[Moderator] iPhone SDK still in effect

2008-07-28 Thread CocoaDev Admins

iPhone SDK
--

Until an announcement is made otherwise, developers should be aware  
that the iPhone SDK is still under non-disclosure (section 5.3 of the  
iPhone Development Agreement). It can't be discussed here, or anywhere  
publicly. This includes other mailing lists, forums, and also blogs.  
Violating the NDA will result in WWDR being notified of the breach.  
Further action is a their (and legal's) discretion.


The iPhone SDK situation is somewhat different than a Mac OS X  
release, in that a Mac OS X release includes a copy of the developer  
tools with the distribution. The iPhone OS 2.0 release on devices and  
as an upgrade does _not_ include the development tools. As a result,  
the SDK is not automatically considered public because the release has  
occurred.


Section 5.3 of the iPhone Development Agreement remains in force at  
this time, and will so remain until iPhone Developer Program members  
are specifically and personally notified by an authorized  
representative of Apple.



Xcode 3.1
-

iPhone SDK requires Xcode 3.1 so it contains it (because it won't work  
without it).


Xcode 3.1 is available indepently of the iPhone Developer Program and  
its nondisclosure agreement, so it's available as a download  
separately from the iPhone SDK,.


Whichever you choose, the Xcode build and installation is identical.  
But you still can't discuss the iPhone SDK.


Questions about Xcode and Interface Builder are best addressed to the [EMAIL PROTECTED] 
 mailing list.



SnowLeopard NDA
===

The SnowLeopard seed is under non-disclosure and can not be discussed  
here.


___

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: draw string with ellipsis

2008-07-28 Thread Vitaly Ovchinnikov
Thanks, exactly what I need.
Btw, is there any easy way to center this line vertically? Or I need
to measure it's height and offset it vertically myself?

On Mon, Jul 28, 2008 at 9:57 AM, chaitanya pandit
[EMAIL PROTECTED] wrote:
 Hi,
 Heres what u can do,

 NSString *stringToDraw; // the string to draw
 NSMutableDictionary *attrs = [NSMutableDictionary dictionaryWithCapacity:2];
 NSMutableParagraphStyle *ps = [[[NSMutableParagraphStyle alloc] init]
 autorelease];
 [ps setLineBreakMode:NSLineBreakByTruncatingTail];
 [attrs setObject:ps forKey:NSParagraphStyleAttributeName];
 [stringToDraw drawInRect:rect withAttributes:attrs];

 -Chaitanya

 On 28-Jul-08, at 1:47 AM, Vitaly Ovchinnikov wrote:

 Hello,

 What should I pass to -drawInRect's attributes to draw NSString as a
 single line with ellipsis at the end if it doesn't fit to the rect?
 Or point me to another method that can do that.

 Thank you.
 ___

 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/vitaly.ovchinnikov%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]


Re: Need help with predicate format

2008-07-28 Thread Graham Cox


On 28 Jul 2008, at 1:52 pm, Omar Qazi wrote:

To be honest, I don't know if this will work, since I don't know if  
containsObject is checking if the argument is a pointer to an object  
in the array, or if it is equal to the object, but it's better than  
nothing, I guess.



From the docs:

containsObject:
Returns a Boolean value that indicates whether a given object is  
present in the receiver.


- (BOOL)containsObject:(id)anObject

Parameters

anObject
An object.

Return Value
YES if anObject is present in the receiver, otherwise NO.

Discussion
This method determines whether anObject is present in the receiver by  
sending an isEqual: message to each of the receiver’s objects (and  
passing anObject as the parameter to each isEqual: message).


Availability
• Available in Mac OS X v10.0 and later.




cheers, 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: NSPopupButton and bindings to NSArrayController

2008-07-28 Thread Graham Cox

Err, how about - (BOOL)setSelectionIndex:(NSUInteger)index;

I'm not familiar with bindings and haven't used NSArrayController, but  
this was immediately obvious in the docs. So obvious, it suggests I've  
missed the point...


htha,

Graham





On 28 Jul 2008, at 1:43 pm, John Joyce wrote:

NSArrayController provides some nifty methods, selectNext: and  
selectPrevious:
but I need a select: that chooses a specific item from the array.  
Either by index or what have you.


___

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: NSPopupButton and bindings to NSArrayController

2008-07-28 Thread Graham Cox

Scratch that, I read on and realised you've already found it. D'oh!


G

On 28 Jul 2008, at 4:37 pm, Graham Cox wrote:


Err, how about - (BOOL)setSelectionIndex:(NSUInteger)index;

I'm not familiar with bindings and haven't used NSArrayController,  
but this was immediately obvious in the docs. So obvious, it  
suggests I've missed the point...


htha,

Graham





On 28 Jul 2008, at 1:43 pm, John Joyce wrote:

NSArrayController provides some nifty methods, selectNext: and  
selectPrevious:
but I need a select: that chooses a specific item from the array.  
Either by index or what have you.


___

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: NSGraphicsContext restore crashes my xtension

2008-07-28 Thread Ken Ferry
Graham's suggestion is also better because -[NSGraphicsContext
setCurrentContext:] just releases the context that was previously
current, as opposed to autoreleasing it.

So this has a bug:

NSGraphicsContext *originalContext = [NSGraphicsContext currentContext];
[NSGraphicsContext setCurrentContext:newContext]; // bad!
originalContext may get deallocated here

// do stuff

[NSGraphicsContext setCurrentContext:originalContext];

-Ken

On Sun, Jul 27, 2008 at 9:02 PM, Graham Cox [EMAIL PROTECTED] wrote:

 On 28 Jul 2008, at 11:05 am, Ken Tozier wrote:

 Saving/restoring the context with

 *oldContext = [NSGraphicsContext currentContext];

 [NSGraphicsContext setCurrentContext: oldContext];

 Did the trick. No more crashes.


 Since this is such a common thing to need to do, it's usually more
 convenient to just put:

 [NSGraphicContext saveGraphicsState];

 at the top of your code and

 [NSGraphicsContext restoreGraphicsState];

 at the bottom.



 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/kenferry%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]


Setting conditional breakpoint on Cocoa method?

2008-07-28 Thread Graham Cox
Once in a blue moon, I get a console message that a nil string was  
passed to [NSConcreteAttributedString initWithString:] I'd like to  
find out where this is coming from by setting a breakpoint there, but  
only for a nil string. Adding the breakpoint as a symbol to the  
symbolic breakpoints works, but I can't set the condition (e.g.  
aString == nil), since the parameter's name isn't available.


What can I do, since this method is called hundreds of times in the  
normal course of things, so just having an unconditional breakpoint  
isn't very useful. Can I specify a register somehow?


tia,

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: IB not recognizing class hierarchy

2008-07-28 Thread James Maxwell
Ah, I didn't try dragging the DKDrawingDocument.h file, just  
MyDocument.h.

I'll give that a shot.

Thanks, Graham.


On 27-Jul-08, at 5:36 PM, Graham Cox wrote:

Because DKDrawingDocument comes from a framework it's possible that  
IB can't find the definition. I'm not sure that's the problem, but  
you can usually fix it by dragging the DKDrawingDocument.h file into  
IB which is enough to get it to realise what's going on.


cheers, Graham


On 28 Jul 2008, at 10:03 am, James Maxwell wrote:

gr... I haven't come across this for a while - mainly because I  
haven't started a new project for a while - but IB is not  
recognizing the class inheritance of my MyDocument.
Specifically, I'm using GCDrawKit, which has an NSDocument subclass  
called DKDrawingDocument. If I make MyDocument a subclass of  
DKDrawingDocument, then IB loses its connection to window...  
well, it actually loses window entirely...
But if I switch MyDocument back to an NSDocument subclass, IB  
suddenly recognizes window again. What gives??? Why can't IB  
figure out that DKDrawingDocument is an NSDocument subclass?




___

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: Folder has limited permissions.

2008-07-28 Thread Jean-Daniel Dupas

You have to use create and write (-c -w)

authopen -c -w /etc/tolea.txt

And also to write some data by creating an other pipe and binding it  
to the task's standard input (and then using fileHandleForWriting).



Le 28 juil. 08 à 09:46, Macarov Anatoli a écrit :

This is my code, I would give you an example.In documentation on  
authopen command-w writes data in file, but I can't do it.



On 27 Jul 08, at 02:19, Macarov Anatoli wrote:

HI Andrew Farmer,
This is my cod:

NSString *command =@/usr/libexec/authopen ;
NSArray *args = [NSArray

arrayWithObjects:@-w,@/etc/

tolea.txt,nil];
NSTask *task = [[NSTask alloc] init];
NSPipe *newPipe = [NSPipe pipe];
NSFileHandle *readHandle = [newPipe fileHandleForReading];
NSData *inData;
NSString *tempString;
[task setLaunchPath:command];
[task setArguments:args];
[task setStandardOutput:newPipe];


[task setStandardError:newPipe];

[task launch];
inData = [readHandle readDataToEndOfFile];
tempString = [[NSString alloc] initWithData:inData
encoding:NSASCIIStringEncoding];
[task release];

I can't record data in the file. How to correctly do it?


Er... it might help if you tried to write some data to the file?
Copying and pasting other people's code will only get you so far if
you don't understand it.




 
Вы уже с Yahoo!?
Испытайте обновленную и улучшенную. Yahoo!  
Почту! http://ru.mail.yahoo.com

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org

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: Need help with predicate format

2008-07-28 Thread Fabian
Thanks. Maybe I should have made myself a little more clear. I don't
want to iterate over the array, but filter the array using a
NSPredicate.

I'm looking at the Predicate Programming Guide, which only gives basic
guidance, and the docs for NSExpression. It has several class methods
that sound right (expressionForEvaluatedObject:,
expressionForAggregate:,
expressionForSubquery:usingIteratorVariable:predicate:,
expressionForFunction:arguments:) but provides no examples how to use
them. Unfortunately Google has very little to say on this subject too.

To repeat the problem: I want to check the value of all keys in every
dictionary contained by an array and see if they match my search
string.

A workaround to compensate for my syntax ignorance would be to add a
new instance method to my custom class that simply return all the
values I want to check in a single array. Then I could query it with a
simple single-relationship predicate:

NSPredicate *predicate = [NSPredicate predicateWithFormat:@(%@ IN
values, searchString)];
NSArray filteredArray = [myArray filteredArrayUsingPredicate:predicate];

But somehow I believe there is a more direct way to do this, without
having to add a new helper method to my class? I'm perfectly happy
with a 10.5 only solution.

Thanks.


On Mon, Jul 28, 2008 at 8:30 AM, Graham Cox [EMAIL PROTECTED] wrote:

 On 28 Jul 2008, at 1:52 pm, Omar Qazi wrote:

 To be honest, I don't know if this will work, since I don't know if
 containsObject is checking if the argument is a pointer to an object in the
 array, or if it is equal to the object, but it's better than nothing, I
 guess.


 From the docs:

 containsObject:
 Returns a Boolean value that indicates whether a given object is present in
 the receiver.

 - (BOOL)containsObject:(id)anObject

 Parameters

 anObject
 An object.

 Return Value
 YES if anObject is present in the receiver, otherwise NO.

 Discussion
 This method determines whether anObject is present in the receiver by
 sending an isEqual: message to each of the receiver's objects (and passing
 anObject as the parameter to each isEqual: message).

 Availability
• Available in Mac OS X v10.0 and later.




 cheers, 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: Setting conditional breakpoint on Cocoa method?

2008-07-28 Thread Alex Heinz
There's probably a better way, but you could create an if statement  
containing a log message (or something) that has a breakpoint (e.g.:


if (aString == nil)
{
NSLog(@blah) -- Breakpoint here
}

)

Kinda stupid solution, though.

Alex

On Jul 28, 2008, at 12:02 AM, Graham Cox wrote:

Once in a blue moon, I get a console message that a nil string was  
passed to [NSConcreteAttributedString initWithString:] I'd like to  
find out where this is coming from by setting a breakpoint there,  
but only for a nil string. Adding the breakpoint as a symbol to the  
symbolic breakpoints works, but I can't set the condition (e.g.  
aString == nil), since the parameter's name isn't available.


What can I do, since this method is called hundreds of times in the  
normal course of things, so just having an unconditional breakpoint  
isn't very useful. Can I specify a register somehow?


tia,

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: NSGraphicsContext restore crashes my xtension

2008-07-28 Thread Ken Tozier


On Jul 28, 2008, at 2:42 AM, Ken Ferry wrote:


Graham's suggestion is also better because -[NSGraphicsContext
setCurrentContext:] just releases the context that was previously
current, as opposed to autoreleasing it.

So this has a bug:

NSGraphicsContext *originalContext = [NSGraphicsContext  
currentContext];

[NSGraphicsContext setCurrentContext:newContext]; // bad!
originalContext may get deallocated here

// do stuff

[NSGraphicsContext setCurrentContext:originalContext];



Maybe I'm just misunderstanding what saveGraphicsState does, behind  
the scenes, but I actually need to draw into the passed in  
CGPDFContext, not any sort of view/image/winbow context. Best I can  
figure, this requires a forced context switch, not just saving and  
restoring the graphics state of whatever context happens to be current.


I couldn't find any way to draw into a CGGraphicsContext with NSxxx  
drawing commands without first creating a new context from the  
CGContext and second manually setting this context to be the current  
one. Is there a better/cleaner way?



___

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: NSGraphicsContext restore crashes my xtension

2008-07-28 Thread Jean-Daniel Dupas


Le 28 juil. 08 à 10:17, Ken Tozier a écrit :



On Jul 28, 2008, at 2:42 AM, Ken Ferry wrote:


Graham's suggestion is also better because -[NSGraphicsContext
setCurrentContext:] just releases the context that was previously
current, as opposed to autoreleasing it.

So this has a bug:

NSGraphicsContext *originalContext = [NSGraphicsContext  
currentContext];

[NSGraphicsContext setCurrentContext:newContext]; // bad!
originalContext may get deallocated here

// do stuff

[NSGraphicsContext setCurrentContext:originalContext];



Maybe I'm just misunderstanding what saveGraphicsState does, behind  
the scenes, but I actually need to draw into the passed in  
CGPDFContext, not any sort of view/image/winbow context. Best I can  
figure, this requires a forced context switch, not just saving and  
restoring the graphics state of whatever context happens to be  
current.


I couldn't find any way to draw into a CGGraphicsContext with NSxxx  
drawing commands without first creating a new context from the  
CGContext and second manually setting this context to be the current  
one. Is there a better/cleaner way?





Quartz does not have current context concept. This is a Cocoa  
concept introduced by NSGraphicsContext. All Cocoa drawing methods are  
using the current NSGraphocsContext, so you have to set it to the  
appropriate value.
If you want to use Cocoa method to draw into a CGContext, you have to  
first create a NSGraphicsContext with it, and then setting this  
context as current.
save/restore state is used to save the context current state (line  
width, shadow, clipping, colors, ...), not to save the current context.


From the Cocoa Drawing Guide:

“To save the current graphics state, you use the saveGraphicsState  
method of NSGraphicsContext. This method essentially pushes a copy of  
the current state onto a stack, leaving you free to make changes to  
the current state. When you want to revert back to the previous state,  
you simply call therestoreGraphicsState method to pop the current  
graphics state (including all changes since the last save) off of the  
stack and restore the previous state.”



___

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: Setting conditional breakpoint on Cocoa method?

2008-07-28 Thread Jonathan del Strother
On Mon, Jul 28, 2008 at 8:02 AM, Graham Cox [EMAIL PROTECTED] wrote:
 Once in a blue moon, I get a console message that a nil string was passed to
 [NSConcreteAttributedString initWithString:] I'd like to find out where this
 is coming from by setting a breakpoint there, but only for a nil string.
 Adding the breakpoint as a symbol to the symbolic breakpoints works, but I
 can't set the condition (e.g. aString == nil), since the parameter's name
 isn't available.

 What can I do, since this method is called hundreds of times in the normal
 course of things, so just having an unconditional breakpoint isn't very
 useful. Can I specify a register somehow?


Take a look at the debugging magic page -
http://developer.apple.com/technotes/tn2004/tn2124.html
I believe you want *(int*)($ebp+16)
___

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: Need help with predicate format

2008-07-28 Thread Conrad Taylor
Hi, I would recommend taking a look at the following document.

http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/predicates.html
Good luck,

-Conrad

On Mon, Jul 28, 2008 at 1:02 AM, Fabian [EMAIL PROTECTED] wrote:

 Thanks. Maybe I should have made myself a little more clear. I don't
 want to iterate over the array, but filter the array using a
 NSPredicate.

 I'm looking at the Predicate Programming Guide, which only gives basic
 guidance, and the docs for NSExpression. It has several class methods
 that sound right (expressionForEvaluatedObject:,
 expressionForAggregate:,
 expressionForSubquery:usingIteratorVariable:predicate:,
 expressionForFunction:arguments:) but provides no examples how to use
 them. Unfortunately Google has very little to say on this subject too.

 To repeat the problem: I want to check the value of all keys in every
 dictionary contained by an array and see if they match my search
 string.

 A workaround to compensate for my syntax ignorance would be to add a
 new instance method to my custom class that simply return all the
 values I want to check in a single array. Then I could query it with a
 simple single-relationship predicate:

 NSPredicate *predicate = [NSPredicate predicateWithFormat:@(%@ IN
 values, searchString)];
 NSArray filteredArray = [myArray filteredArrayUsingPredicate:predicate];

 But somehow I believe there is a more direct way to do this, without
 having to add a new helper method to my class? I'm perfectly happy
 with a 10.5 only solution.

 Thanks.


 On Mon, Jul 28, 2008 at 8:30 AM, Graham Cox [EMAIL PROTECTED]
 wrote:
 
  On 28 Jul 2008, at 1:52 pm, Omar Qazi wrote:
 
  To be honest, I don't know if this will work, since I don't know if
  containsObject is checking if the argument is a pointer to an object in
 the
  array, or if it is equal to the object, but it's better than nothing, I
  guess.
 
 
  From the docs:
 
  containsObject:
  Returns a Boolean value that indicates whether a given object is present
 in
  the receiver.
 
  - (BOOL)containsObject:(id)anObject
 
  Parameters
 
  anObject
  An object.
 
  Return Value
  YES if anObject is present in the receiver, otherwise NO.
 
  Discussion
  This method determines whether anObject is present in the receiver by
  sending an isEqual: message to each of the receiver's objects (and
 passing
  anObject as the parameter to each isEqual: message).
 
  Availability
 • Available in Mac OS X v10.0 and later.
 
 
 
 
  cheers, 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/conradwt%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]


iCal like calendar interface in my application

2008-07-28 Thread Devraj Mukherjee
Hi all,

One of our projects needs an interface to schedule appointments. We
are thinking of an iCal like interface but realize that its a lot of
work to come up with something like it.

Are there any components we can use or are we able to incorproate iCal
itself in our application? Or is the best way to integrate an
application using the calendaring server?

Thanks a lot for any thoughts.

-- 
I never look back darling, it distracts from the now, Edna Mode (The
Incredibles)
___

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: Folder has limited permissions.

2008-07-28 Thread Macarov Anatoli
   Problem solved.
   Cod work:

    NSPipe *writePipe = [NSPipe pipe];
    NSFileHandle *writeHandle = [writePipe fileHandleForWriting];
    NSTask *task = [[NSTask alloc] init];
    NSString *command = @/usr/libexec/authopen;
    NSArray *args = [NSArray arrayWithObjects:@-w,@/etc/tolea.txt,nil];
    [task setLaunchPath:command];
    [task setArguments:args];
    [task setStandardInput: writePipe];
    [task launch];
    [writeHandle writeData:[NSData 
dataWithContentsOfFile:@/applications/tolea.k]];
    [writeHandle closeFile];
    [task release];

Thanks ALL...



  
Вы уже с Yahoo!? 
Испытайте обновленную и улучшенную. Yahoo! Почту! http://ru.mail.yahoo.com
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Need help with predicate format

2008-07-28 Thread Fabian
Thanks. As I said, I already read that but it doesn't give any
examples on how to format subqueries. Anyway, I ended up adding a
helper method to my subclass after all. It returns a single array of
keywords, which I can examine using a predicate with format (ANY
keywords contains[c] %@, searchString). It works fine. Perhaps even
faster than running a subquery, I dunno.

F.

On Mon, Jul 28, 2008 at 11:12 AM, Conrad Taylor [EMAIL PROTECTED] wrote:
 Hi, I would recommend taking a look at the following document.

 http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/predicates.html
 Good luck,

 -Conrad

 On Mon, Jul 28, 2008 at 1:02 AM, Fabian [EMAIL PROTECTED] wrote:

 Thanks. Maybe I should have made myself a little more clear. I don't
 want to iterate over the array, but filter the array using a
 NSPredicate.

 I'm looking at the Predicate Programming Guide, which only gives basic
 guidance, and the docs for NSExpression. It has several class methods
 that sound right (expressionForEvaluatedObject:,
 expressionForAggregate:,
 expressionForSubquery:usingIteratorVariable:predicate:,
 expressionForFunction:arguments:) but provides no examples how to use
 them. Unfortunately Google has very little to say on this subject too.

 To repeat the problem: I want to check the value of all keys in every
 dictionary contained by an array and see if they match my search
 string.

 A workaround to compensate for my syntax ignorance would be to add a
 new instance method to my custom class that simply return all the
 values I want to check in a single array. Then I could query it with a
 simple single-relationship predicate:

 NSPredicate *predicate = [NSPredicate predicateWithFormat:@(%@ IN
 values, searchString)];
 NSArray filteredArray = [myArray filteredArrayUsingPredicate:predicate];

 But somehow I believe there is a more direct way to do this, without
 having to add a new helper method to my class? I'm perfectly happy
 with a 10.5 only solution.

 Thanks.


 On Mon, Jul 28, 2008 at 8:30 AM, Graham Cox [EMAIL PROTECTED]
 wrote:
 
  On 28 Jul 2008, at 1:52 pm, Omar Qazi wrote:
 
  To be honest, I don't know if this will work, since I don't know if
  containsObject is checking if the argument is a pointer to an object in
 the
  array, or if it is equal to the object, but it's better than nothing, I
  guess.
 
 
  From the docs:
 
  containsObject:
  Returns a Boolean value that indicates whether a given object is present
 in
  the receiver.
 
  - (BOOL)containsObject:(id)anObject
 
  Parameters
 
  anObject
  An object.
 
  Return Value
  YES if anObject is present in the receiver, otherwise NO.
 
  Discussion
  This method determines whether anObject is present in the receiver by
  sending an isEqual: message to each of the receiver's objects (and
 passing
  anObject as the parameter to each isEqual: message).
 
  Availability
 • Available in Mac OS X v10.0 and later.
 
 
 
 
  cheers, 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/conradwt%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/slasktrattenator%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]


Re: NSPopupButton and bindings to NSArrayController

2008-07-28 Thread I. Savant
Well, I already checked that, it is Class, not Entity. I'm already  
aware that Entity is used with Core Data models.

Oh, well, I'll figure something out.
I always have a terrible time with NSPopupButton in any context.


  Sorry, it occurred to me that I'd forgotten to mention the other  
aspect. Are you by any chance using the NSArrayController's  
contentSet binding to supply its content?


--
I.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]


How to get the cursor animation effects - Clouds of smoke when deleting something

2008-07-28 Thread Oleg Krupnov
I assume that there is a system-wide set of predefined cursor
appearances and effects intended to be used by applications to mean
particular standard actions. Is this correct?

For example, when I drag something outside a view to get rid of it,
the cursor shows a vanishing cloud of smoke and plays a special sound.

Can I use this (and other) effects in my application and how do I do it?

Also, I'd like to use the copy cursor (the arrow with green circle
and a plus) outside the drag-and-drop process, e.g. manually set this
cursor in mouseDragged event. Is this possible and how do I do it?

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: How to get the cursor animation effects - Clouds of smoke when deleting something

2008-07-28 Thread Antonio Nunes

On 28 Jul 2008, at 12:33, Oleg Krupnov wrote:


For example, when I drag something outside a view to get rid of it,
the cursor shows a vanishing cloud of smoke and plays a special sound.


Have a look at NSShowAnimationEffect in the docs.

António

---
What you have inside you expresses itself through both your
choice of words and the level of energy you assign to them.
The more healed, whole and connected you feel inside,
the more healing your words will be.

--Rita Goswami
---


___

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: Setting conditional breakpoint on Cocoa method?

2008-07-28 Thread Graham Cox

Ah thanks, that's very helpful.

One thing that I'm a bit unsure about. If I enter a symbolic  
breakpoint, will it break on the first instruction of that method or  
further along? It matters because that doc states:


If you've stopped at the first instruction of a routine, the first  
parameter is at 4 bytes above the stack pointer, the second parameter  
is 8 bytes above the stack pointer, and so on. The GDB syntax is *(int  
*)($esp+4), *(int *)($esp+8), and so on.


If you've stopped elsewhere in the routine (after the frame has been  
created), the first parameter is at 8 bytes above the frame pointer,  
the second parameter is 12 bytes above the frame pointer, and so on.  
The GDB syntax is *(int *)($ebp+8), *(int *)($ebp+12), and so on.


Assuming the first case, wouldn't the offset be 12, not 16? (two  
implied parameters then the first visible one). The second case would  
be 16 of course - so I need to know where a symbolic breakpoint  
actually stops.




cheers, Graham





On 28 Jul 2008, at 6:47 pm, Jonathan del Strother wrote:


On Mon, Jul 28, 2008 at 8:02 AM, Graham Cox [EMAIL PROTECTED]  
wrote:
Once in a blue moon, I get a console message that a nil string was  
passed to
[NSConcreteAttributedString initWithString:] I'd like to find out  
where this
is coming from by setting a breakpoint there, but only for a nil  
string.
Adding the breakpoint as a symbol to the symbolic breakpoints  
works, but I
can't set the condition (e.g. aString == nil), since the  
parameter's name

isn't available.

What can I do, since this method is called hundreds of times in the  
normal
course of things, so just having an unconditional breakpoint isn't  
very

useful. Can I specify a register somehow?



Take a look at the debugging magic page -
http://developer.apple.com/technotes/tn2004/tn2124.html
I believe you want *(int*)($ebp+16)


___

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: Setting conditional breakpoint on Cocoa method?

2008-07-28 Thread Graham Cox
I need to break on a Cocoa method that I don't have the source to. If  
I had the source, I could just set a breakpoint by clicking in the  
margin in the usual way.


Thanks anyway,


Graham

On 28 Jul 2008, at 6:11 pm, Alex Heinz wrote:

There's probably a better way, but you could create an if statement  
containing a log message (or something) that has a breakpoint (e.g.:


if (aString == nil)
{
NSLog(@blah) -- Breakpoint here
}

)


___

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: NSTextView + other NSView in NSScrollView?

2008-07-28 Thread Jacob Bandes-Storch

On Jul 27, 2008, at 10:49 PM, Andy Lee wrote:


On Jul 27, 2008, at 11:31 PM, Jacob Bandes-Storch wrote:
I'm trying to create a Mail-style scroll view, with a view for  
information (like the view for message headers) above a text view  
for the content. I created two NSViews in Interface Builder,  
changed the class of the bottom one to NSTextView,


Is there some reason you didn't drag an NSTextView into the window  
in the first place?


Because the Text View that IB provides is embedded in a scroll view  
already and I can't add another view to it.



selected both, and clicked Layout  Embed Objects In  Scroll View.


Are you sure you didn't want a Split View rather than a Scroll View?

If you were trying to create a Mail-like layout, I would have  
expected your two views to be an NSTableView and an NSTextView, both  
embedded in a Split View.
No... what I want is like the bottom half of Mail's split view, with  
the view for the headers and the text view with the message content.


___

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: NSTextView + other NSView in NSScrollView?

2008-07-28 Thread Graham Cox



On 28 Jul 2008, at 11:59 pm, Jacob Bandes-Storch wrote:

Because the Text View that IB provides is embedded in a scroll view  
already and I can't add another view to it.


Choose Unembed Objects to get the unenclosed NSTextView after  
dragging the view to the window in IB.


No... what I want is like the bottom half of Mail's split view, with  
the view for the headers and the text view with the message content.



I suspect Mail just uses a single NSTextView and just arranges the  
header text using custom text attributes, etc. Maybe someone at Apple  
reading this would know for sure.




cheers, 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: NSTextView + other NSView in NSScrollView?

2008-07-28 Thread Andy Lee

On Jul 28, 2008, at 9:59 AM, Jacob Bandes-Storch wrote:

On Jul 27, 2008, at 10:49 PM, Andy Lee wrote:
If you were trying to create a Mail-like layout, I would have  
expected your two views to be an NSTableView and an NSTextView,  
both embedded in a Split View.
No... what I want is like the bottom half of Mail's split view, with  
the view for the headers and the text view with the message content.


Oh.

Maybe it would help if you first wrap your two views in an enclosing  
view, get that working (get the resizing and auto-growing right), and  
put that (single) view into an NSScrollView.


That seems to be Mail.app's approach.  I made a copy of Mail.app and  
looked at the nib file MessageViewerContents.nib.


--Andy


___

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]


Authenticate Password.

2008-07-28 Thread Macarov Anatoli
HI!!!
Cocoa, Obj-C.

With the help of this procedure I check whether the password has been entered 
correctly. But the code works only for the user with admins rights. How do I 
check the password being a standard user?

Cod:
-(BOOL) authenticatePassword:(NSString *)password :(NSString *)userName
{
AuthorizationRef authorization;
    OSStatus status,status1;
    AuthorizationFlags Flags;
    AuthorizationItem envItems[2];
return YES;
    envItems[0].name = kAuthorizationEnvironmentPassword;
    envItems[0].value = [password cStringUsingEncoding:NSUTF8StringEncoding];
    envItems[0].valueLength = strlen([password 
cStringUsingEncoding:NSUTF8StringEncoding]);
    envItems[0].flags = 0;

    envItems[1].name = kAuthorizationEnvironmentUsername;
    envItems[1].value = [userName cStringUsingEncoding:NSUTF8StringEncoding];
    envItems[1].valueLength = strlen([userName 
cStringUsingEncoding:NSUTF8StringEncoding]);
    envItems[1].flags = 0;

    AuthorizationItemSet env = { 2, envItems };

    status = AuthorizationCreate(NULL, env, kAuthorizationFlagDefaults, 
authorization);
    if (status != errAuthorizationSuccess) {
    NSLog(@AuthorizationCreate NOT Success);
        return NO;
    }else{
        NSLog(@AuthorizationCreate Success);
    }

    AuthorizationRights myRights = {2, envItems};
    AuthorizationEnvironment kEnvironment = { 2, envItems };

    Flags = kAuthorizationFlagDefaults | kAuthorizationFlagExtendRights;
    status1 = AuthorizationCopyRights (authorization,myRights, kEnvironment, 
Flags, NULL );
        
    if (status1 != errAuthorizationSuccess) {
        NSLog(@AuthorizationCopyRights NOT Success);
        return NO;
    }else{
        NSLog(@AuthorizationCopyRights Success);
        return YES;
    }
    return NO;
}




  
Вы уже с Yahoo!? 
Испытайте обновленную и улучшенную. Yahoo! Почту! http://ru.mail.yahoo.com
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTextView + other NSView in NSScrollView?

2008-07-28 Thread Andy Lee

On Jul 28, 2008, at 10:11 AM, Graham Cox wrote:
I suspect Mail just uses a single NSTextView and just arranges the  
header text using custom text attributes, etc. Maybe someone at  
Apple reading this would know for sure.


I guessed that too, but a look at the nib file in Mail.app indicates  
otherwise.  I wonder if it *used* to be a single NSTextView -- I seem  
to remember Command-A used to select the message *and* headers, though  
it doesn't now.


--Andy


___

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]


sorting two arrays

2008-07-28 Thread Jeff LaMarche

Hey all...

I've got two arrays that are related, so that object 0 in one array  
corresponds to object 0 in the other array. I'd like to implement a  
sort based on the values in one array, but to  reorder both array so  
that the order of the two arrays stays in sync and that object x in  
one array continues to correspond to the same thing as object x in the  
other array after the sort.


I've got a general idea of how to implement the sort, but since I know  
that there are a few places in the system where array pairs are used  
like this, I wanted to see if there was any out-of-the-box way of  
handling this scenario - I'd hate to reinvent the wheel if it's not  
necessary. Does anyone know if there is any easy way to do this?


TIA,
Jeff

___

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: NSTextView + other NSView in NSScrollView?

2008-07-28 Thread Andy Lee

On Jul 27, 2008, at 11:31 PM, Jacob Bandes-Storch wrote:
I'm trying to create a Mail-style scroll view, with a view for  
information (like the view for message headers) above a text view  
for the content. I created two NSViews in Interface Builder, changed  
the class of the bottom one to NSTextView,


Just one more thought: I think some people have mentioned unexpected  
resizing behavior because they didn't take into account the fact that  
NSTextView uses a flipped coordinate system.


--Andy

___

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: draw string with ellipsis

2008-07-28 Thread Uli Kusterer


On 28.07.2008, at 08:23, Vitaly Ovchinnikov wrote:


Thanks, exactly what I need.
Btw, is there any easy way to center this line vertically? Or I need
to measure it's height and offset it vertically myself?



 NSParagraphStyle -setAlignment: ?

Cheers,
-- Uli Kusterer
The Witnesses of TeachText are everywhere...
http://www.zathras.de





___

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: NSTextView + other NSView in NSScrollView?

2008-07-28 Thread Jacob Bandes-Storch

On Jul 28, 2008, at 7:48 AM, Andy Lee [EMAIL PROTECTED] wrote:


On Jul 27, 2008, at 11:31 PM, Jacob Bandes-Storch wrote:
I'm trying to create a Mail-style scroll view, with a view for  
information (like the view for message headers) above a text view  
for the content. I created two NSViews in Interface Builder,  
changed the class of the bottom one to NSTextView,


Just one more thought: I think some people have mentioned unexpected  
resizing behavior because they didn't take into account the fact  
that NSTextView uses a flipped coordinate system.
Yes, I was wondering about that. It seems like that's the issue I run  
into when trying to use an NSTextView that's not the documentView of  
the NSScrollView. What can I do to work around 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: draw string with ellipsis

2008-07-28 Thread Vitaly Ovchinnikov
This one aligns string horizontally, I need vertical alignment.
Well, OK, will measure it's height and center it myself.

On Mon, Jul 28, 2008 at 7:12 PM, Uli Kusterer
[EMAIL PROTECTED] wrote:

 On 28.07.2008, at 08:23, Vitaly Ovchinnikov wrote:

 Thanks, exactly what I need.
 Btw, is there any easy way to center this line vertically? Or I need
 to measure it's height and offset it vertically myself?


  NSParagraphStyle -setAlignment: ?

 Cheers,
 -- Uli Kusterer
 The Witnesses of TeachText are everywhere...
 http://www.zathras.de






___

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: Folder sharing attributes

2008-07-28 Thread Peter Alshuth

Thanks for the info.
I tried this code section but it doesn't work. The result of  
sharingFlags is always 0. Is there another way with DirServices to  
request the sharing attribute about a folder if this in not working  
under Leopard?

Peter


FSRef fileRef;
NSString *filePath = @/Users/Test/MyShare;
Boolean bDir;

if(filePath  FSPathMakeRef((const UInt8*) [filePath UTF8String],  
fileRef, bDir) == noErr)

{
FSCatalogInfoBitmap whichInfo = kFSCatInfoSharingFlags;
FSCatalogInfo   catalogInfo;

	OSStatus err = FSGetCatalogInfo(fileRef, whichInfo, catalogInfo,  
NULL, NULL, NULL );

if(err == noErr)
		NSLog(@Sharing is %@, (catalogInfo.sharingFlags   
kioFlAttribSharePointBit) ? @ON : @OFF);

}




On Jul 25, 2008, at 11:49 AM, Kyle Sluder wrote:

On Fri, Jul 25, 2008 at 11:27 AM, Peter Alshuth [EMAIL PROTECTED]  
wrote:
I was wondering how I can retrieve information about a particular  
folder if

this folder is shared or not.


Use FSGetCatalogInfo (part of CoreServices).  The FSCatalogInfo struct
has a sharingFlags field.

http://developer.apple.com/documentation/Carbon/Reference/File_Manager/Reference/reference.html#/ 
/apple_ref/c/func/FSGetCatalogInfo


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


[Newbie] Communication between two Views?

2008-07-28 Thread Thomas Wickl
Hello,

I have a question regarding to communication between two Views.
My tableview creates a view in which the user can enter a text. How do
I get the text from the View to my tableview?
The View is created in the following was in my tableview:

- (IBAction)addAction:(id)sender{
if (ncvController == nil)
{
self.ncvController = [[NewCourseViewController alloc]
  
initWithNibName:@NewCourseViewController bundle:nil];
}
[[self navigationController] pushViewController:ncvController 
animated:YES];
}

Can someone please give me an example?

Thank you so much

twickl
___

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]


Text Editor

2008-07-28 Thread mahaboob pa
Hi,
I'm new to cocoa. I'm developing an application that converts the text into
HTML and vice versa. I can convert text into HTML format but, I didn't get
the code to convert an HTML contents into text format. How can I do this ?
___

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: memory management

2008-07-28 Thread Scott Ribe
 Follow convention. No matter how well-documented it is, your successor
 will be much happier if it it's consistent with all other classes

Also, a year from now, you will presumably be *much* more accustomed to the
conventions, to the point that they're reflexive. You don't want old classes
tripping you up with unconventional behavior.

-- 
Scott Ribe
[EMAIL PROTECTED]
http://www.killerbytes.com/
(303) 722-0567 voice


___

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: NSTextView + other NSView in NSScrollView?

2008-07-28 Thread Andy Lee
I don't know offhand.  A quick search on CocoaBuilder for NSTextView  
flipped turns up this suggestion to flip the superview:


http://www.cocoabuilder.com/archive/message/cocoa/2004/6/20/110164

But I haven't read it closely.

--Andy

On Jul 28, 2008, at 11:09 AM, Jacob Bandes-Storch wrote:


On Jul 28, 2008, at 7:48 AM, Andy Lee [EMAIL PROTECTED] wrote:


On Jul 27, 2008, at 11:31 PM, Jacob Bandes-Storch wrote:
I'm trying to create a Mail-style scroll view, with a view for  
information (like the view for message headers) above a text view  
for the content. I created two NSViews in Interface Builder,  
changed the class of the bottom one to NSTextView,


Just one more thought: I think some people have mentioned  
unexpected resizing behavior because they didn't take into account  
the fact that NSTextView uses a flipped coordinate system.
Yes, I was wondering about that. It seems like that's the issue I  
run into when trying to use an NSTextView that's not the  
documentView of the NSScrollView. What can I do to work around 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]


Access to events in tight loop?

2008-07-28 Thread Scott Squires
If I handle a mouse event and am processing it in a time consuming  
method which includes display, what's the cleanest way to peek at events
during this time (to get updated mouse info,etc ) or to allow the run  
loop to continue enough to make another pass?

Is there a clean way to allow the main thread to update?

I know I could create another thread for the routine but with issues  
of events, drawing and handling mutable arrays  I thought I'd see if  
there was a simpler method I was overlooking.

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: [Newbie] Communication between two Views?

2008-07-28 Thread I. Savant
 I have a question regarding to communication between two Views.
 My tableview creates a view in which the user can enter a text. How do
 I get the text from the View to my tableview?
 The View is created in the following was in my tableview:

  Search the documentation for the Model View Controller or MVC
design pattern. The controller layer allows (requires?) controllers
to mediate between your model and view layers. Somewhere there needs
to be a controller that connect to your views and responds to your
editing events by getting the value from your view and doing something
with it.

  You *REALLY* need to understand this before you can do anything
useful with Cocoa. The entire framework is built on this concept and
if you don't understand it, you'll be fighting it the entire way.

--
I.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]


Inconsistent Socket Communications

2008-07-28 Thread Justin Giboney
I am trying to set up a client-server chat application for practice. I am
getting inconsistent communications. Meaning that it works some of time
and doesn't work some of the time during the same application run.

Any help will be greatly appreciated

Here are the projects:
www.justingiboney.com/code/DOChat.zip
www.justingiboney.com/code/DOChatServer.zip


___

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: Text Editor

2008-07-28 Thread Mike Abdullah

3 options:

* NSAttributedString
* Create a parser using NSScanner that strips out all non-text.
* WebKit, in particular the DOM API.

On 28 Jul 2008, at 12:10, mahaboob pa wrote:


Hi,
I'm new to cocoa. I'm developing an application that converts the  
text into
HTML and vice versa. I can convert text into HTML format but, I  
didn't get
the code to convert an HTML contents into text format. How can I do  
this ?

___

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/cocoadev%40mikeabdullah.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: Access to events in tight loop?

2008-07-28 Thread Glenn English
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Scott Squires wrote:

 If I handle a mouse event and am processing it in a time consuming
 method which includes display, what's the cleanest way to peek at events
 during this time (to get updated mouse info,etc ) or to allow the run
 loop to continue enough to make another pass?
 Is there a clean way to allow the main thread to update?
 
 I know I could create another thread for the routine but with issues of
 events, drawing and handling mutable arrays  I thought I'd see if there
 was a simpler method I was overlooking.

I'm very much looking forward to seeing a civilized solution to this.

I'm using a state machine that steps through a complex process one piece
per state, and sticking a 1ms timer (to pass control back to the run
loop) at the end of every case.

Seems to work, and the process I'm using it on is long, but things
change with every state and the timing is being judged by a mortal so
the gaps are pretty much invisible...

- --
Glenn English
[EMAIL PROTECTED]

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIjfDI04yQfZbbTLYRAin+AKCVwqJgQx4dtMFqC3bbrUoUNQJYnQCgiSEs
j729AMtAP5aOnp66ZVOZwvI=
=LA2g
-END PGP 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: Access to events in tight loop?

2008-07-28 Thread chaitanya pandit
What you can do is use the NSWindow's nextEventMatchingMask: method to  
determine the next event, here you can check for events that should  
discontinue your current processing.
So, say if u want to do some processing only while mouse down, and  
stop if there is a mouse up while you are doing it then u can do:


- (void)mouseDown:(NSEvent *)event
{
while ([event type] != NSLeftMouseUp )
{
// do processing
// get the new event
event = [[self window] nextEventMatchingMask:NSLeftMouseUpMask];
}
}

-Chaitanya
On 28-Jul-08, at 11:53 AM, Scott Squires wrote:

If I handle a mouse event and am processing it in a time consuming  
method which includes display, what's the cleanest way to peek at  
events
during this time (to get updated mouse info,etc ) or to allow the  
run loop to continue enough to make another pass?

Is there a clean way to allow the main thread to update?

I know I could create another thread for the routine but with issues  
of events, drawing and handling mutable arrays  I thought I'd see if  
there was a simpler method I was overlooking.

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/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: NSTableview Datasource and NSPopupbuttonCell

2008-07-28 Thread Matt Neuburg
On Thu, 24 Jul 2008 21:50:31 +1000, Steven Hamilton [EMAIL PROTECTED] said:
Hi Folks,

I have a NSTableview with a datasource consisting of an NSArray of
dictionaries. One column in my table has an NSPopupbuttonCell. The
content and contentValues are bound to a Core Data Account object. I
use a name property as my contentValue.

I'm having trouble changing the popup button. I know in my datasource
I get an index of the selected object and in my setObjectValue
datasource method I set the key in the dictionary with this new
NSNumber inValue. However, in operation when I change the popupbutton
it very quickly changes back to the first object in the list (index 0).

Clearly I'm missing something or have set something wrongly in IB.

How comes it that you are using both bindings and the
tableView:setObjectValue:... datasource method? It should be one or the
other; either use bindings or use the NSTableDataSource protocol. m.

-- 
matt neuburg, phd = [EMAIL PROTECTED], http://www.tidbits.com/matt/
A fool + a tool + an autorelease pool = cool!
One of the 2007 MacTech Top 25: http://tinyurl.com/2rh4pf
AppleScript: the Definitive Guide - Second Edition!
http://www.amazon.com/gp/product/0596102119



___

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: Creating a styles menu like the one in the ruler accessory view of NSLayoutManager...

2008-07-28 Thread Keith Blount
Hmm,

Looking into this some more, it seems that the user's favourite styles can be 
accessed like this:

NSDictionary *favStyles = [[NSUserDefaults standardUserDefaults] 
objectForKey:@NSFavoriteStyles];

Presumably this is what is used to generate the pop-up menu in 
NSLayoutManager's ruler accessory view.

However, given that I cannot find anything on this in the docs, I am guessing 
that this is undocumented and not recommended? Looking at the dictionary that 
this returns, it does seem that it would be fairly straightforward to grab the 
keys (which are the names of the styles) and then go through the inner 
dictionaries that contain the attributes and apply them to the text selection, 
but is there a more standard way of getting the styles information for use like 
this? (Again, I'm trying to create my own format bar rather than use the 
standard text view ruler accessory view.) My feeling is that this is probably 
not a recommended route given that I can find no documentation or information 
on it.

Thanks and all the best,
Keith

--- ORIGINAL MESSAGE ---

Hi,
I'm fairly sure that this isn't possible without hooking into private methods 
of NSLayoutManager, but it's worth asking on the off-chance...

In a standard rich textNSTextView, the ruler view has an accessory view 
provided by NSLayoutManager. This accessory view has several handy controls in 
it - a styles pop-up menu, a lists pop-up menu, an alignment segmented control 
and so forth. However, for my own app I'm overriding NSLayoutManager to get rid 
of this accessory view. Instead, I'm providing a Pages-like format bar; the 
reason for this is that, given that you can split the editor in my app and 
therefore have two text views visible, you can also have two accessory views 
visible which can take up more screen estate than necessary; having the same 
controls in one bar that affects both text views will take up less space and 
provide a less cluttered experience. Adding most of the controls to this format 
bar is straightforward - bold, italic, underline, foreground/background colour, 
alignment etc are all relatively easy. However, it seems that there is no way 
of grabbing a list of available styles
 in order to provide a styles menu like the one that appears in the standard 
accessory view (nor no way of grabbing the lists menu, for that matter). I can 
just create a button that calls -orderFrontStylesPanel: if necessary, but this 
will involve more steps for the user (having to go through the sheet to get to 
the menu), and I'd really just like to provide a list of styles like the one in 
the standard NSLayoutManager accessory view.

Is there any way of doing this? As I say, from surveying the docs and searching 
online, I don't think it's possible - I think these lists and how the menus are 
generated by NSLayoutManager's accessory view are all contained in private 
methods - but I'd love to discover I'm wrong.

Many thanks in advance and all the best,
Keith


  
___

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] Communication between two Views?

2008-07-28 Thread Wickl thomas

Hi,

and thank you for your answer. Yes, the understanding of the MVC- 
Problem seems to be my problem. I know how MVC works with one Model,  
one View and one Controller but I really don´t understnd how the  
controllers of different Views communicate with each other. And I  
really don´t find an Example in the documentation that I understand :(


Thanks

twickl

Am 28.07.2008 um 17:53 schrieb I. Savant:


I have a question regarding to communication between two Views.
My tableview creates a view in which the user can enter a text. How  
do

I get the text from the View to my tableview?
The View is created in the following was in my tableview:


 Search the documentation for the Model View Controller or MVC
design pattern. The controller layer allows (requires?) controllers
to mediate between your model and view layers. Somewhere there needs
to be a controller that connect to your views and responds to your
editing events by getting the value from your view and doing something
with it.

 You *REALLY* need to understand this before you can do anything
useful with Cocoa. The entire framework is built on this concept and
if you don't understand it, you'll be fighting it the entire way.

--
I.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: Getting process table info from within a Cocoa app

2008-07-28 Thread Sumner Trammell
Thanks guys. I thought I'd post my solution. The difference between my
solution and the examples on the net that I was able to find is that I
already know the pid -- I just want to see if that pid is still
running, if it's running as root, and if it has a certain name.

Although the Cocoa content is minimal, this might be useful for
someone who might otherwise end up using NSTask and NSPipe to look for
running processes, creating lots of overhead.

Studying sysctl(3), /usr/include/sys/proc.h, and
/usr/include/sys/sysctl.h, here's what I came up with:

#import sys/types.h
#import sys/sysctl.h
#import string.h
#import stdio.h
#define MAXCHARS 8
#define MIBSIZE 4
#define PIDFILE /var/run/some_VPN_pppd.pid

- (BOOL)isVPNRunning {

char line[MAXCHARS];
FILE *fp;

if ((fp = fopen (PIDFILE, r)) == NULL) {
//pid file does not exist; vpn is not running
//NSLog (@vpn is not running 1);
return NO;
} else {
if ((fgets (line, MAXCHARS, fp)) == NULL) {
//pid file exists but is weirdly empty or otherwise 
unreadable;
presume vpn is not running
fclose (fp);
//NSLog (@vpn is not running 2);
return NO;
} else {
fclose (fp);
int pid = atoi (line);

//got the pid from the pid file
//get the process table info for that pid

int mib[MIBSIZE];   
struct kinfo_proc kp;
size_t len = sizeof(kp);

mib[0]=CTL_KERN;
mib[1]=KERN_PROC;
mib[2]=KERN_PROC_PID;
mib[3]=pid;

if (sysctl(mib, MIBSIZE, kp, len, NULL, 0) == -1) {
//there was a problem getting the process info; 
presume vpn is not running
//NSLog (@vpn is not running 3);
return NO;
} else {
if (len  0) {
//there is a running process with that 
pid
//is the process owned by root?
if (kp.kp_eproc.e_pcred.p_svuid == 0) {

//process is owned by root
//is that process named pppd?
if (!strcmp(pppd, 
kp.kp_proc.p_comm)) {
//VPN IS RUNNING
//NSLog (@vpn is 
running with pid = %d, uid = %d, process name
= %s, pid, kp.kp_eproc.e_pcred.p_svuid, kp.kp_proc.p_comm);
return YES; 

} else {
//process is owned by 
root but is not pppd; vpn is not running
//NSLog (@vpn is not 
running 4);
return NO;
}
} else {
//process is not owned by root; 
vpn is not running
//NSLog (@vpn is not running 
5);
return NO;
}

} else {
//there was some weird error in sysctl; 
presume vpn is not running
//NSLog (@vpn is not running 6);
return NO;
}
}
}
}
}   


On Sat, Jul 26, 2008 at 8:44 PM, Ken Thomases [EMAIL PROTECTED] wrote:

 On Jul 26, 2008, at 12:58 AM, Sumner Trammell wrote:

 Hi. A daemon process is running independently of my Cocoa app.  Given a pid
 file of the daemon process in a known location, say /var/run/somedaemon.pid,
 I would like my Cocoa app to read that file and check the process table to
 see if the daemon is actually running. If the daemon IS running, I want my
 Cocoa app to change its Dock icon.
 Is there a canonical Cocoa way of doing this?

 You can adapt the techniques described in this tech 

Re: NSTimer and a problem with document-based apps

2008-07-28 Thread Sumner Trammell
Thanks guys. Using class methods was a brilliant idea. Solidified my
understanding of when I might want to use them, and when I might want
to use @synchronized as well.


-s

On Sat, Jul 26, 2008 at 7:30 PM, Todd Heberlein [EMAIL PROTECTED] wrote:
 - (id)init {
 ...
 timer = [NSTimer scheduledTimerWithTimeInterval:10.0
 ...
 }

 ...

 That new instance of course calls init, and suddenly I have two NSTimers
 running when I only wanted one timer for the whole app.

 I think you want to make your timer a global variable and then initialize it
 within a call to a +load or +initialize method for one of your classes. See
 the following link:

 http://developer.apple.com/documentation/DeveloperTools/gcc-3.3/gcc/Executing-code-before-main.html

 Todd


___

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]


How would you tell WebKit to keep all JavaScript popup windows on top/in front?

2008-07-28 Thread Sumner Trammell
Hi, I've used WebKit to write a small Single-Site Browser that takes
you straight to a special section of the company intranet. It works
great, but there is one particular link on the page that creates a
popup window using JavaScript.  I want this popup to always stay on
top. In other words, I don't want the main window to ever hide the
popup. I'm not sure how to do this.  How would you tell WebKit to keep
all popup windows on top/in front?

Thanks,
-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: DO Chat Example

2008-07-28 Thread Lukhnos D. Liu

On Jul 26, 2008, at 3:38 AM, Justin Giboney wrote:
It works so far... well mostly. It isn't very consistent. I don't  
have a
lot of experience with ports, and I was hoping that someone could  
look at
it and see if they can find out why some messages go through while  
others

don't.
Here are the projects:
www.justingiboney.com/code/DOChat.zip
www.justingiboney.com/code/DOChatServer.zip


Might be better if you tell more about in which way your code behaves  
inconsistently, it's easier to pinpoint the problem. :)


Also, passing client-side objects to server might not be a good idea,  
especially if you are keeping them on the server side and intend to  
use them later (immediate callbacks are generally ok in my  
experiences). You might want to make your client a server itself too,  
and let the server talk to the client via another DO.


d.

___

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]


Storing values in dictionary with their address as the key

2008-07-28 Thread Carter R. Harrison

Hey Everybody,

If I wanted to store an object in a dictionary and set its key as the  
object's memory address - how would I go about doing this?


Right now I'm doing this:

int i;
for (i = 0 ; i   10 ; i++)
{
NSObject *myObject = [[NSObject alloc] init];
[dictionary setValue:myObject forKey:[NSString stringWithFormat:@%x,  
myObject]];

}

The above does seem to work, but the memory address that I get always  
seems to be the same.


Any ideas?
___

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] Communication between two Views?

2008-07-28 Thread I. Savant
 and thank you for your answer. Yes, the understanding of the MVC-Problem
 seems to be my problem. I know how MVC works with one Model, one View and
 one Controller but I really don´t understnd how the controllers of different
 Views communicate with each other. And I really don´t find an Example in the
 documentation that I understand :(

  There's nothing like a good book ... lots of them mentioned in this
list's archives.

--
I.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: Storing values in dictionary with their address as the key

2008-07-28 Thread Dave Carrigan


On Jul 28, 2008, at 11:13 AM, Carter R. Harrison wrote:

If I wanted to store an object in a dictionary and set its key as  
the object's memory address - how would I go about doing this?


I'm racking my brains trying to think of a good reason to do this and  
am drawing a blank. I can, however, think of myriad bad reasons.



Right now I'm doing this:

int i;
for (i = 0 ; i   10 ; i++)
{
NSObject *myObject = [[NSObject alloc] init];
[dictionary setValue:myObject forKey:[NSString  
stringWithFormat:@%x, myObject]];

}

The above does seem to work, but the memory address that I get  
always seems to be the same.


myObject is a variable (of type pointer) that is allocated on the  
stack. Its address is always going to be the same inside that tight  
loop, since the stack pointer isn't changing.


--
Dave Carrigan
[EMAIL PROTECTED]
Seattle, WA, USA



PGP.sig
Description: This is a digitally signed message part
___

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: Storing values in dictionary with their address as the key

2008-07-28 Thread I. Savant
 If I wanted to store an object in a dictionary and set its key as the
 object's memory address - how would I go about doing this?

 I'm racking my brains trying to think of a good reason to do this and am
 drawing a blank. I can, however, think of myriad bad reasons.

  Agreed - I can't help but wonder about class clusters but I can't
think of a direct reason why this would be a 'problem area'. It's just
the first thing that popped into my head. :-)

--
I.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: DO Chat Example

2008-07-28 Thread Justin Giboney
My original intention was to make the client serve a DO also. The problem
I was having, was how to have the server know who is out there.

Now that I think about it, I could have the Server keep a list of the
registered names of the clients. Would that be a better option?

As far as the inconsistent nature of the program:
I start up the server on one machine. I also set up a client on that
machine and another one. During the process of sending messages back and
forth. Some get sent, and others do not.

Thanks

 On Jul 26, 2008, at 3:38 AM, Justin Giboney wrote:
 It works so far... well mostly. It isn't very consistent. I don't
 have a
 lot of experience with ports, and I was hoping that someone could
 look at
 it and see if they can find out why some messages go through while
 others
 don't.
 Here are the projects:
 www.justingiboney.com/code/DOChat.zip
 www.justingiboney.com/code/DOChatServer.zip

 Might be better if you tell more about in which way your code behaves
 inconsistently, it's easier to pinpoint the problem. :)

 Also, passing client-side objects to server might not be a good idea,
 especially if you are keeping them on the server side and intend to
 use them later (immediate callbacks are generally ok in my
 experiences). You might want to make your client a server itself too,
 and let the server talk to the client via another DO.

 d.




___

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] Communication between two Views?

2008-07-28 Thread I. Savant
 I know how MVC works with one Model, one View and
 one Controller but I really don´t understnd how the controllers of different
 Views communicate with each other.

 Through the model. The controllers of different views do not generally
 communicate directly.

That's a pretty general blanket statement that is most certainly
not always the case.

  Consider (as a very basic example) a master/detail view (without the
use of Bindings, especially). Sure there're plenty of reasons I can
think of to have multiple controllers (one for the master list and one
for the detail view), but   for every reason I can think of to
separate the controllers in this scenario, I can think of one that
strongly suggests keeping them as one.

  The thing is, in this scenario they'd still need to talk *somehow*
(to track the master selection for determining what to show in the
detail view) and the model is *most definitely not* the place to track
selection in the master view. That is between the view(s) and the
controller(s).

--
I.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: Converting Windows RC to NIBs (was Re: Creating and App menu from Scratch)

2008-07-28 Thread Jonathan Hess


On Jul 16, 2008, at 3:38 AM, Uli Kusterer wrote:


On 14.07.2008, at 14:53, Bill Royds wrote:
Are there any good tools for porting Application menus and forms  
from other windowing systems (such as MS Windows or X or even  
Carbon) to Cocoa nibs? I have a number of applications that I would  
like to port, but redesigning  the form or menu layout completely  
seems to be rather pointless. I am quite willing to rewrite all the  
code that interacts with the forms or menus, but I am not a graphic  
designer so form layout is better left to experts who have already  
done it.
All I really want is a tool that will put objects without any  
connections or code on a form or menu by parsing a MS .RC file, for  
example


Being able to do this would lead to an large increase in the number  
of Macintosh applications available.



I'm not aware of an existing tool, though I've said in other similar  
threads (some on Carbon-Dev) that it should be possible to write  
code that does this, as long as the source format is known. Xcode 3  
has the XML-based XIB format. You could create a few simple test  
files, see what XML it generates for the various objects, see how  
the sizes of these objects differ from their Windows counterparts*,  
and then write code that reads the RC files and outputs the text  
needed for an XIB.


Rather than attempting to write out a XIB file*, it would be far  
better to write an IBPlugin, that adds a menu item to the main menu,  
and then uses API from InterfaceBuilderKit.framework's IBDocument  
class to construct an Interface Builder document from a RC file. This  
abstracts you away from XIB files.


*XIB files are readable, and you can make sense of them. The structure  
of the XML isn't too complicated.  However, the contents described by  
the XML structure are complicated. They're generated using a custom  
NSCoder. The XML is the output of the various NSCoding implementations  
that were used to create the file, and they're private to the classes  
that implemented them.


The IBPlugin route is the way to go -
Jon Hess





(Ignore the huge blob of binary data at the bottom of the XIB,  
that's just a binary, runnable version of the stuff above it)


*) Note that that is actually the hard part -- control sizes may  
differ so substantially, that it may be impossible to do a 1-on-1  
translation of your UI automatically without making it look  
horrible. You may need a graphics designer with a good eye for  
layout to determine how these rects correspond. IMHO, most times  
you'll have to manually fix up things anyway, so you might as well  
go and recreate the UI and let IB's snap-to-guidelines do the job of  
initial layout.


Cheers,
-- Uli Kusterer
The Witnesses of TeachText are everywhere...
http://www.zathras.de





___

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/jhess%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: Storing values in dictionary with their address as the key

2008-07-28 Thread David Wilson
On Mon, Jul 28, 2008 at 2:13 PM, Carter R. Harrison
[EMAIL PROTECTED] wrote:
 Hey Everybody,

 If I wanted to store an object in a dictionary and set its key as the
 object's memory address - how would I go about doing this?

 Right now I'm doing this:

 int i;
 for (i = 0 ; i   10 ; i++)
 {
 NSObject *myObject = [[NSObject alloc] init];
 [dictionary setValue:myObject forKey:[NSString stringWithFormat:@%x,
 myObject]];
 }


Use:

int i;
for (i=0;i10;i++)
{
NSObject *myObject = [[NSObject alloc] init];
NSValue *val = [NSValue valueWithPointer:myObject];
[dictionary setValue:myObject forKey:val];
}

Or [NSNumber numberWithInt:(int)myObject] instead of the NSValue.

-- 
- David T. Wilson
[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: Storing values in dictionary with their address as the key

2008-07-28 Thread Quincey Morris

On Jul 28, 2008, at 11:13, Carter R. Harrison wrote:

If I wanted to store an object in a dictionary and set its key as  
the object's memory address - how would I go about doing this?


The usual way would be to use the result of +[NSValue  
valueWithNonretainedObject:] as a dictionary key.



___

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: Event-Driven XML Parsing and Entity References

2008-07-28 Thread Carter R. Harrison


On Jul 27, 2008, at 5:13 PM, Nathan Kinsinger wrote:



On Jul 27, 2008, at 12:52 PM, Carter R. Harrison wrote:

There's been some discussion on this topic previously, but I  
haven't been able to find the solution that I'm looking for.  I'm  
using the event-driven XML parser (CFXMLParser).  Apparently it  
does not support the replacement of entity references (amp, lt,  
gt, etc..).

So assume I'm trying to parse the following XML tag:

titlePlanes, Trains, amp Automobiles/title

When the parser enters the title node, it calls the  
createStructure callback function three times.  Each time it has  
the following data within the node that is passed in:


Call #1: Planes, Trains, 
Call #2: amp
Call #3:  Automobiles

A similar thing happens in the addChild callback function.

I understand that I need to do manual replacement of the amp with  
a  in this case, but I still don't understand how I'm supposed  
to maintain the state in between the three calls to createStructure  
and addChild so that I can successfully concatenate all three text  
segments together to form the original string (which is what I want  
to store).  I hope this makes sense - it's terribly frustrating.


As always, thanks in advance.


I haven't used CFXMLParser, but generally in event xml parsing you  
keep adding to the string until the end of the element. Parsers may  
break the element up into several parts and give them to you one at  
a time.


Ya, I finally got fed up with the Core Foundation parser and switched  
to the Cocoa Event Driven parser.  The cocoa parser works like you  
have just mentioned, but after going through all the Docs on the Core  
Foundation parser it appears to be different.  I don't know why I  
didn't go with Cocoa in the first place.  As soon as I decided to use  
the cocoa parser I had everything working perfectly within 3 minutes!   
Thanks for the help.





In this case in either your addChild or createStructure functions  
you would add the new parsed string to the child nodes existing  
string.


You may find more people with experience using CFXMLParser on the  
Carbon dev list:

http://lists.apple.com/mailman/listinfo/carbon-dev

That said, this is the Cocoa dev list, have you looked at NSXMLParser?
http://developer.apple.com/documentation/Cocoa/Conceptual/XMLParsing/XMLParsing.html

--Nathan




___

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: Storing values in dictionary with their address as the key

2008-07-28 Thread Jonathan Hess


On Jul 28, 2008, at 11:44 AM, I. Savant wrote:

If I wanted to store an object in a dictionary and set its key as  
the

object's memory address - how would I go about doing this?


I'm racking my brains trying to think of a good reason to do this  
and am

drawing a blank. I can, however, think of myriad bad reasons.


A good reason would be that you care about identity equality and not  
value equality. You care that the key is the exact same instance, not  
that it is an equivalent instance. (== vs isEqual:) Another reason  
would be that the keys might not implement NSCopying, which  
NSDictionary requires.


Jon Hess





 Agreed - I can't help but wonder about class clusters but I can't
think of a direct reason why this would be a 'problem area'. It's just
the first thing that popped into my head. :-)

--
I.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/jhess%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: Storing values in dictionary with their address as the key

2008-07-28 Thread Carter R. Harrison


On Jul 28, 2008, at 3:24 PM, David Wilson wrote:


On Mon, Jul 28, 2008 at 2:13 PM, Carter R. Harrison
[EMAIL PROTECTED] wrote:

Hey Everybody,

If I wanted to store an object in a dictionary and set its key as the
object's memory address - how would I go about doing this?

Right now I'm doing this:

int i;
for (i = 0 ; i   10 ; i++)
{
NSObject *myObject = [[NSObject alloc] init];
[dictionary setValue:myObject forKey:[NSString  
stringWithFormat:@%x,

myObject]];
}



Use:

int i;
for (i=0;i10;i++)
{
NSObject *myObject = [[NSObject alloc] init];
NSValue *val = [NSValue valueWithPointer:myObject];
[dictionary setValue:myObject forKey:val];
}

Or [NSNumber numberWithInt:(int)myObject] instead of the NSValue.



Interesting.. thanks for the solution.  Naturally almost immediately  
after I sent my original question to the list I figured out what was  
wrong with my solution.  The issue was with the format string..  
Instead of a %x, I needed a %qx.  The %qx displays a 64 bit address  
whereas the %x displays a 32 bit address.  When you give %x, only the  
least significant 32 bits are printed and those happen to always be  
the same (at least in my case).




--
- David T. Wilson
[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: Storing values in dictionary with their address as the key

2008-07-28 Thread Andy Lee

On Jul 28, 2008, at 2:31 PM, Dave Carrigan wrote:

On Jul 28, 2008, at 11:13 AM, Carter R. Harrison wrote:

If I wanted to store an object in a dictionary and set its key as  
the object's memory address - how would I go about doing this?


I'm racking my brains trying to think of a good reason to do this  
and am drawing a blank. I can, however, think of myriad bad reasons.


Count me as another mystified person -- can you say what you're trying  
to do?  I'm thinking maybe some kind of serialization or maybe object  
caching, but nothing makes sense.  It sounds like what you want is a  
set of objects rather than a dictionary.  If you have an address you  
can just dereference the address -- you don't need to look it up in a  
dictionary.


Or are you just messing around with dictionaries in general to see how  
they work?


[dictionary setValue:myObject forKey:[NSString  
stringWithFormat:@%x, myObject]];

}

The above does seem to work, but the memory address that I get  
always seems to be the same.


myObject is a variable (of type pointer) that is allocated on the  
stack. Its address is always going to be the same inside that tight  
loop, since the stack pointer isn't changing.


In other words, you don't want the  in front of myObject, which is  
giving you the address of a pointer variable rather than the value of  
the pointer.


As others have already pointed out as I typed this, you can use an  
NSValue instead of an NSString.  But again, I can't think of a good  
reason to do this.


--Andy


___

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: Storing values in dictionary with their address as the key

2008-07-28 Thread Charles Srstka

On Jul 28, 2008, at 2:29 PM, Jonathan Hess wrote:

A good reason would be that you care about identity equality and not  
value equality. You care that the key is the exact same instance,  
not that it is an equivalent instance. (== vs isEqual:) Another  
reason would be that the keys might not implement NSCopying, which  
NSDictionary requires.


But couldn't you just do that with an NSArray instead of an  
NSDictionary, using -indexOfObjectIdenticalTo: and such?


Charles
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Storing values in dictionary with their address as the key

2008-07-28 Thread Andy Lee

On Jul 28, 2008, at 3:29 PM, Jonathan Hess wrote:

On Jul 28, 2008, at 11:44 AM, I. Savant wrote:

If I wanted to store an object in a dictionary and set its key as  
the

object's memory address - how would I go about doing this?


I'm racking my brains trying to think of a good reason to do this  
and am

drawing a blank. I can, however, think of myriad bad reasons.


A good reason would be that you care about identity equality and not  
value equality. You care that the key is the exact same instance,  
not that it is an equivalent instance. (== vs isEqual:)


Ah, good point -- that would rule out my NSSet idea.

--Andy

Another reason would be that the keys might not implement NSCopying,  
which NSDictionary requires.


Jon Hess





Agreed - I can't help but wonder about class clusters but I can't
think of a direct reason why this would be a 'problem area'. It's  
just

the first thing that popped into my head. :-)

--
I.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/jhess%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/aglee%40mac.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]


Shameless Ottawa (Canada) Cocoaheads plug

2008-07-28 Thread Greg Robertson
This is a shameless plug for a new Ottawa (Canada) Cocoa Heads group

Now that Canada finally has the iPhone, if there are any Ottawa
(Canada) area iPhone Developers who might want to get together to talk
about iPhone, Touch or Cocoa there is a new Google group.

Philippe Guitard who some of you might know from CocoaCast has created
a new Google Group for iPhone Developers and Cocoa Heads here:
http://groups.google.com/group/ococoa

Even if you are not from Ottawa but are curious what all the
complaining about Rogers is about feel free to join.

Hopefully this does not start a flame war. I promise not to post so
shamelessly again.

Thanks

Greg
___

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: Access to events in tight loop?

2008-07-28 Thread Scott Anguish
do you have to use the tight loop approach?  The view documentation  
discusses the pros and cons of this approach and other options.


http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaViewsGuide/SubclassingNSView/chapter_6_section_4.html#/ 
/apple_ref/doc/uid/TP40002978-CH7-SW27



On 28-Jul-08, at 11:53 AM, Scott Squires wrote:

If I handle a mouse event and am processing it in a time consuming  
method which includes display, what's the cleanest way to peek at  
events
during this time (to get updated mouse info,etc ) or to allow the  
run loop to continue enough to make another pass?

Is there a clean way to allow the main thread to update?

I know I could create another thread for the routine but with issues  
of events, drawing and handling mutable arrays  I thought I'd see if  
there was a simpler method I was overlooking.

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: Storing values in dictionary with their address as the key

2008-07-28 Thread Quincey Morris

On Jul 28, 2008, at 12:34, Andy Lee wrote:


On Jul 28, 2008, at 2:31 PM, Dave Carrigan wrote:

On Jul 28, 2008, at 11:13 AM, Carter R. Harrison wrote:

If I wanted to store an object in a dictionary and set its key as  
the object's memory address - how would I go about doing this?


I'm racking my brains trying to think of a good reason to do this  
and am drawing a blank. I can, however, think of myriad bad reasons.


Count me as another mystified person -- can you say what you're  
trying to do?  I'm thinking maybe some kind of serialization or  
maybe object caching, but nothing makes sense.  It sounds like what  
you want is a set of objects rather than a dictionary.  If you have  
an address you can just dereference the address -- you don't need to  
look it up in a dictionary.


I've used this technique when replacing objects in an object graph  
with different objects. There may be multiple references an old  
object in the graph, and there may be multiple paths through the graph  
to each reference. When walking the graph, you just use [dict  
objectForKey: [NSValue valueWithNonretainedObject: oldObject]] to find  
out if you've already generated a replacement for the old object yet,  
and use [dict setObject: newObject forKey: [NSValue  
valueWithNonretainedObject: oldObject] to remember the replacement if  
you haven't.



___

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: Storing values in dictionary with their address as the key

2008-07-28 Thread David Duncan

On Jul 28, 2008, at 12:32 PM, Carter R. Harrison wrote:

The issue was with the format string.. Instead of a %x, I needed a  
%qx.  The %qx displays a 64 bit address whereas the %x displays a 32  
bit address.  When you give %x, only the least significant 32 bits  
are printed and those happen to always be the same (at least in my  
case).



If you use %p it will do the right thing with 32-bit vs 64-bit  
pointers. However as others have said, you should pass myObject not  
myObject if you really want to use NSString keys (instead of NSValue  
keys).

--
David Duncan
Apple DTS Animation and Printing
[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]


NSTableView dragging to the finder - NSDragOperation

2008-07-28 Thread Don Messerli
I have a subclass of NSTableView in which I'm implementing drag and drop to the 
finder.  Everything is basically working.  However, when my class gets the call 
draggedImage:endedAt:operation:, operation is NSDragOperationGeneric (for a 
copy or move) or NSDragOperationDelete (for a delete).  I'm expecting to get 
NSDragOperationCopy, NSDragOperationMove or NSDragOperationDelete depending on 
the modified keys and where the user dragged the image.

I am using NSFilesPromisePboardType for the pasteboard as the files are remote.

Here are some code snippets to answer some possible queries in advance...

- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal 
{
if (isLocal) return NSDragOperationNone;
else return NSDragOperationCopy | NSDragOperationMove | 
NSDragOperationDelete;
}

- (BOOL)ignoreModifierKeysWhileDragging 
{
return NO;
}


Don



  
___

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]


How to specify a relative path to a (pdf)-document in a (pdf)-document

2008-07-28 Thread Dirk Hollstein

Dear list members,

I am writing to you to ask for some help on specifying a path to a  
document, which I could not find by searching the web and the list.



What I want to achieve is this:

- Having a couple of hyperlinks in a PDF-document, that opens other  
PDF-documents on a CD-ROM by clicking on it.


I found this website, where this kind of relative links are described  
for OpenOffice:

http://www.oooninja.com/2008/02/create-relative-links-in-pdfs.html

I know that in Acrobat you can specify a link to  a document in  
relation to the document you put the link into, which is what I want  
to achieve. I this a specialty? I do not want to use Acrobat or  
OpenOffice to add the links, because I would have to add thousands of  
links by hand.


Instead I can use Cocoa and some text editor to finish formating and  
finally print to pdf using Quartz Context or Adobe Acrobat.



How I tried to tackle the problem:

- I did create an rtf-file with a hyperlink to a file programatically  
and opened the file in e.g. MS Word and converted it to PDF using  
Adobe Acrobat.
- I created an NSAttributed string and set a fileURL to the document  
using NSURL's fileURLwithPath: method and saved it to an rtf document,  
using NSData's dataFromRange: documentAtttributes method. This works,  
but the path is absolute, so there is no way of putting it onto a CD- 
ROM.
Using baseURL does not seem to give me the option of specifying a file  
url, as well as somehow counteracts on reaching my aim: a baseURL is  
again an absolute path, which I will not find on a CD-ROM mounted on  
Windows or Linux-boxes or on Macs.


So my question is how to reach my aim using a new approach?


Any help is very much appreciated,
thank you in advance.

Regards,
dirk







___

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]


Drawing Graphs in Cocoa

2008-07-28 Thread Taylor Barstow

Hi,

I'm working on an application where I need to draw graphs in Cocoa.   
I'm not talking about data plotting, I'm talking about creating  
visualizations for directed, acyclic graphs in the computer science /  
discrete math sense (where a graph is a collection of nodes and  
edges).


Does anyone know of any abstractions on top of the low level Cocoa  
drawing APIs that support this?  If not, is anyone interested in  
working with me on a mini project to create an open source library to  
do this?  I would be able to lead the project, and I'd be looking to  
get it started in the next few weeks.


The basic elements of the API would be:

- a simple way to represent a graph in memory, and perhaps in  
persisted form (may already exist)

- a NSView subclass to draw the graph

I want the end programmer to be able to pass custom context  
information along with each graph node, and I want to make good use of  
delegates when writing the view so the end programmer can use that  
context information to customize the outcome (I'm thinking of things  
like colors, size of nodes, text labels, etc).  I also want to  
abstract some aspects of user interaction with the graph, such as  
observing clicks on nodes and edges.


As I said above, right now I am only interested in directed, acyclic  
graphs.  However, for the long term, I see other needs arising in the  
community, so I expect the API to evolve over time.


Thanks,
Taylor
___

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: Storing values in dictionary with their address as the key

2008-07-28 Thread Andy Lee

On Jul 28, 2008, at 3:40 PM, Charles Srstka wrote:

On Jul 28, 2008, at 2:29 PM, Jonathan Hess wrote:

A good reason would be that you care about identity equality and  
not value equality. You care that the key is the exact same  
instance, not that it is an equivalent instance. (== vs isEqual:)  
Another reason would be that the keys might not implement  
NSCopying, which NSDictionary requires.


But couldn't you just do that with an NSArray instead of an  
NSDictionary, using -indexOfObjectIdenticalTo: and such?


Yes, but then lookups would be O(n) instead of O(1).  But only the OP  
can tell if that would be premature optimization.


Probably the simplest solution would be if there was something built- 
in like Java's IdentitySet.


--Andy


___

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: Storing values in dictionary with their address as the key

2008-07-28 Thread Andy Lee

On Jul 28, 2008, at 3:56 PM, Quincey Morris wrote:

On Jul 28, 2008, at 12:34, Andy Lee wrote:
Count me as another mystified person -- can you say what you're  
trying to do?  I'm thinking maybe some kind of serialization or  
maybe object caching, but nothing makes sense.  It sounds like what  
you want is a set of objects rather than a dictionary.  If you have  
an address you can just dereference the address -- you don't need  
to look it up in a dictionary.


I've used this technique when replacing objects in an object graph  
with different objects. There may be multiple references an old  
object in the graph, and there may be multiple paths through the  
graph to each reference. When walking the graph, you just use [dict  
objectForKey: [NSValue valueWithNonretainedObject: oldObject]] to  
find out if you've already generated a replacement for the old  
object yet, and use [dict setObject: newObject forKey: [NSValue  
valueWithNonretainedObject: oldObject] to remember the replacement  
if you haven't.


Neat.  Thanks, I'm much less mystified now.

--Andy


___

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: draw string with ellipsis

2008-07-28 Thread Uli Kusterer

On 28.07.2008, at 17:22, Vitaly Ovchinnikov wrote:

This one aligns string horizontally, I need vertical alignment.
Well, OK, will measure it's height and center it myself.



 Oh, sorry. Wasn't quite awake when I wrote that, apparently. Yeah, I  
think vertical is up to you.


Cheers,
-- Uli Kusterer
The Witnesses of TeachText are everywhere...
http://www.zathras.de





___

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: Storing values in dictionary with their address as the key

2008-07-28 Thread Carter R. Harrison


On Jul 28, 2008, at 3:24 PM, David Wilson wrote:


On Mon, Jul 28, 2008 at 2:13 PM, Carter R. Harrison
[EMAIL PROTECTED] wrote:

Hey Everybody,

If I wanted to store an object in a dictionary and set its key as the
object's memory address - how would I go about doing this?

Right now I'm doing this:

int i;
for (i = 0 ; i   10 ; i++)
{
NSObject *myObject = [[NSObject alloc] init];
[dictionary setValue:myObject forKey:[NSString  
stringWithFormat:@%x,

myObject]];
}



Use:

int i;
for (i=0;i10;i++)
{
NSObject *myObject = [[NSObject alloc] init];
NSValue *val = [NSValue valueWithPointer:myObject];
[dictionary setValue:myObject forKey:val];
}

Or [NSNumber numberWithInt:(int)myObject] instead of the NSValue.



Actually now that I'm looking at this more closely, NSDictionary is  
expecting an NSString for the key when inserting a value.  Your  
example uses an NSValue for the key - the compiler is throwing a  
warning for this one..




--
- David T. Wilson
[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: Storing values in dictionary with their address as the key

2008-07-28 Thread Michael Ash
On Mon, Jul 28, 2008 at 3:29 PM, Jonathan Hess [EMAIL PROTECTED] wrote:

 On Jul 28, 2008, at 11:44 AM, I. Savant wrote:

 If I wanted to store an object in a dictionary and set its key as the
 object's memory address - how would I go about doing this?

 I'm racking my brains trying to think of a good reason to do this and am
 drawing a blank. I can, however, think of myriad bad reasons.

 A good reason would be that you care about identity equality and not value
 equality. You care that the key is the exact same instance, not that it is
 an equivalent instance. (== vs isEqual:) Another reason would be that the
 keys might not implement NSCopying, which NSDictionary requires.

If NSDictionary and NSSet are too restrictive in terms of how they
manage your objects, use NSMapTable and NSHashTable. On 10.5 they have
a nice object-oriented interface but they still allow the use of
custom callbacks. For example, the
NSPointerFunctionsObjectPointerPersonality constant will cause objects
to be correctly retained and released but will use object identity
rather than equality. NSPointerFunctions can be used to customize it
further.

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: Predicate Binding Format/case sensitive question ...

2008-07-28 Thread Fabian
Easy. entry contains[c] $value, or [cd] for case- and diacritic-insensitive.

F.

On Mon, Jul 28, 2008 at 10:32 PM, vince [EMAIL PROTECTED] wrote:
 Thanks,
 I've added a search field to my database using bindings. Works fine.

 How do I alter the following Predicate Format binding syntax ...   entry
 contains $value  ...  so that text search inputs are NOT case sensitive?

 thanks again,

 v.
 ___

 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/slasktrattenator%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]


Bizarre Xcode Behaviour

2008-07-28 Thread Patrick Walker
I've been working on an item and it worked all fine and dandy.   
Knowing things would soon go awry, I took a snapshot.


I did a build after making an addition of another NSTextField label.   
Suddenly, each time the program was built or launched, I would get this:


2008-07-28 18:15:31.039 Server[6718:10b] *** -[NSApplication  
isDescendantOf:]: unrecognized selector sent to instance 0x112580
2008-07-28 18:15:31.053 Server[6718:10b] An uncaught exception was  
raised
2008-07-28 18:15:31.057 Server[6718:10b] *** -[NSApplication  
isDescendantOf:]: unrecognized selector sent to instance 0x112580
2008-07-28 18:15:31.062 Server[6718:10b] *** Terminating app due to  
uncaught exception 'NSInvalidArgumentException', reason: '*** - 
[NSApplication isDescendantOf:]: unrecognized selector sent to  
instance 0x112580'

2008-07-28 18:15:31.066 Server[6718:10b] Stack: (

Even when going back to a previous snapshot, this happens all over  
again.  I don't even know where to begin, actually.


Latest version of Xcode on PPC.  I also get a popup NSCFString error  
anytime the cursor passes @end in any file.


Anyone have suggestions how I can salvage 14 hours of work back?

___

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: Authenticate Password.

2008-07-28 Thread Shawn Erickson
On Mon, Jul 28, 2008 at 7:24 AM, Macarov Anatoli
[EMAIL PROTECTED] wrote:

 With the help of this procedure I check whether the password has been entered 
 correctly. But the code works only for the user with admins rights. How do I 
 check the password being a standard user?

You should never ask the user for their user password. Why are you doing this?

-Shawn
___

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: Bizarre Xcode Behaviour

2008-07-28 Thread Nick Zitzmann


On Jul 28, 2008, at 3:19 PM, Patrick Walker wrote:

2008-07-28 18:15:31.062 Server[6718:10b] *** Terminating app due to  
uncaught exception 'NSInvalidArgumentException', reason: '*** - 
[NSApplication isDescendantOf:]: unrecognized selector sent to  
instance 0x112580'



That doesn't look like an Xcode problem to me. Have you tried breaking  
on objc_exception_throw?


Nick Zitzmann
http://www.chronosnet.com/

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Storing values in dictionary with their address as the key

2008-07-28 Thread Charles Steinman
--- On Mon, 7/28/08, Carter R. Harrison [EMAIL PROTECTED] wrote:

 Actually now that I'm looking at this more closely,
 NSDictionary is  
 expecting an NSString for the key when inserting a value. 
 Your  
 example uses an NSValue for the key - the compiler is
 throwing a  
 warning for this one..

That's because setValue:forKey: is a KVC method. The NSDictionary method, which 
accepts any object (though it may prefer strings -- I don't know), is 
setObject:forKey.

Cheers,
Chuck


  
___

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] Communication between two Views?

2008-07-28 Thread Hamish Allan
On Mon, Jul 28, 2008 at 8:12 PM, I. Savant [EMAIL PROTECTED] wrote:

 On Mon, Jul 28, 2008 at 8:01 PM, Hamish Allan [EMAIL PROTECTED] wrote:

 On Mon, Jul 28, 2008 at 5:51 PM, Wickl thomas [EMAIL PROTECTED] wrote:

 I know how MVC works with one Model, one View and
 one Controller but I really don´t understnd how the controllers of different
 Views communicate with each other.

 Through the model. The controllers of different views do not generally
 communicate directly.

 That's a pretty general blanket statement that is most certainly
 not always the case.

 Consider (as a very basic example) a master/detail view (without the
 use of Bindings, especially). Sure there're plenty of reasons I can
 think of to have multiple controllers (one for the master list and one
 for the detail view), but for every reason I can think of to
 separate the controllers in this scenario, I can think of one that
 strongly suggests keeping them as one.

I agree, so I'm not sure why you're using this as a counter-example to
what I said!

I also said generally, with just such an exception being
master-detail views complex enough to require separate controllers :)
I guess there are plenty of those around, though...

Hamish

P.S. Trimming attribution when you quote me makes it complicated for
people reading Cocoa-dev to follow, as my posts to the list are
moderated and do not appear straight away.
___

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: Distributed Objects connection went invalid while waiting for a reply

2008-07-28 Thread Hamish Allan
For anyone searching the archives for connection went invalid while
waiting for a reply:

I never found out why this message was appearing, but I found a workaround.

Instead of calling [client callbackWithArgument:arg], call [client
performSelector:@selector(callbackWithArgument:) withObject:arg
afterDelay:0.0]

I don't know why this should make a difference!

Hamish

On Wed, Jul 9, 2008 at 1:11 AM, Hamish Allan [EMAIL PROTECTED] wrote:

 I'm seeing connection went invalid while waiting for a reply in a DO
 callback. The client passes self in a call to the server; some time
 later, the server calls a method on that client (proxy), the program
 hangs for a second or so, the connection went invalid connection
 appears, but the method call is successful anyway, so it would appear
 that the DO machinery is re-connecting everything okay.

 According to the debugger, the message appears as a result of an
 uncaught NSException from -[NSConnection sendInvocation:internal:],
 called from -[NSDistantObject forwardInvocation].

 Server and client are both properly retained.

 There seem to be a lot of messages of late on Apple's forums about
 problems with iSync (10.5.4) and even Interface Builder (10.5.3,
 IB3.1beta6) in which this message is reported. Is it perhaps a bug in
 recent versions of the OS rather than in my code?

 Hamish

 P.S. This question has been asked before, but the OP didn't get an
 answer (http://www.cocoabuilder.com/archive/message/cocoa/2006/12/29/176458)

___

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: Repositioning a content view w/in a window

2008-07-28 Thread R.L. Grigg


On Jul 26, 2008, at 3:15 AM, Michael Ash wrote:


On Fri, Jul 25, 2008 at 11:08 PM, Henry McGilton (Starbase)
[EMAIL PROTECTED] wrote:

On Jul 25, 2008, at 6:50 PM, Michael Ash wrote:


In fact I would go so far as to say that if you ever use
-setContentView:, you are very probably doing it wrong. It is, for  
the

most part, not a very useful call, and you can accomplish the same
thing more naturally, easily, and flexibly by adding the view as a
subview to the content view instead.


Well, I would not go quite that far, although I agree with you
in principle for normal everyday stuff.I have some applications
which create bare windows --- no borders, controls, resizers,
shadows, and so on.The view that replaces the default window
content view does all the drawing.I don't see any value in
having a content view whose only purpose in life is to act as
a container for my drawing view.


Might come a day that you want two views in there, or you want to move
that one view around, and suddenly the value appears. Since it's no
harder to do things the right way, why not?


Okay, I'm a little bit confused. What is the right way?

I create a NSWindow and then I'm displaying a NSMatrix in that window.  
Now I need to move the NSMatrix around in the NSWindow.


Is something like this a decent Cocoa approach:

// create the window
myWindow = [[NSWindow alloc] initWithContentRect: ... ];
// insert the existing matrix as it's content view
[myWindow setContentView:myMatrix];
// alter the position of the matrix
NSPoint newPoint = ...
[myMatrix setFrameOrigin:newPoint];
[myWindow display];

Thx!
Russ

___

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]


NSTreeController rearrangeObjects doesn't always trigger sorting

2008-07-28 Thread Jonathan Fewtrell
I know that similar issues have been raised in the past, but I haven't  
been able to find a clear solution.


I have a Core Data app with an NSOutlineView controlled by an entity- 
mode NSTreeController bound to the managed object context. The  
NSTreeController has sort descriptors based on certain attributes of  
the model object.


Sorting does take place when the frameworks seem to think fit (for  
example when a document is opened), but if I call -rearrangeObjects to  
force a sort programmatically nothing happens. Actually, if I tick  
'Uses Lazy Fetching' in the controller's IB attributes, the view will  
sort the first level of nodes, but not the deeper levels.


Sorting was working fine in earlier versions of the OS. I'm now in  
10.5.4 and I'm not certain which version introduced this problem.


Any suggestions? I am conscious of the slightly strange wording of the  
documentation of this method, which is much less clear cut than that  
of the NSArrayController equivalent. It almost suggests that the  
method will only work in subclasses. If so, I don't understand why.

___

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: Repositioning a content view w/in a window

2008-07-28 Thread Erik Buck

Is something like this a decent Cocoa approach:

// create the window
myWindow = [[NSWindow alloc] initWithContentRect: ... ];
// insert the existing matrix as it's content view
[myWindow setContentView:myMatrix];
// alter the position of the matrix
NSPoint newPoint = ...
[myMatrix setFrameOrigin:newPoint];
[myWindow display];


No.

You want

// create the window
myWindow = [[NSWindow alloc] initWithContentRect: ... ];
// insert the existing matrix as it's content view

//* See here!
[[myWindow contentView] addSubview:myMatrix];

// alter the position of the matrix
NSPoint newPoint = ...
[myMatrix setFrameOrigin:newPoint];
[myWindow display];

A window's content view always fills the whole content area.   
Therefore, moving it around makes no sense.


___

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] Communication between two Views?

2008-07-28 Thread I. Savant

On Jul 28, 2008, at 5:26 PM, Hamish Allan wrote:


I agree, so I'm not sure why you're using this as a counter-example to
what I said!


  I'm confused.

  The OP said, ... I really don´t understnd how the controllers of  
different Views communicate with each other. To which you replied,  
Through the model. This part of your statement - on its own - is  
patently incorrect.


  You then went on to say, The controllers of different views do not  
generally communicate directly. This isn't even generally true. It  
is completely and totally a matter of design choice, but a controller  
that doesn't talk to others just because they connect to different  
views does not, on its own, make much sense.


  Most of the core controllers of my own applications talk to one- 
another, usually though some central controller or via direct  
channels, whichever makes the most sense. Most other open-source  
projects I've seen do the same.


  So ... with all that in mind, how am I misunderstanding your  
position?


--
I.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: Repositioning a content view w/in a window

2008-07-28 Thread R.L. Grigg

On Jul 28, 2008, at 3:54 PM, Erik Buck wrote:


Is something like this a decent Cocoa approach:

   // create the window
   myWindow = [[NSWindow alloc] initWithContentRect: ... ];
   // insert the existing matrix as it's content view
   [myWindow setContentView:myMatrix];
   // alter the position of the matrix
   NSPoint newPoint = ...
   [myMatrix setFrameOrigin:newPoint];
   [myWindow display];


No.

You want

   // create the window
   myWindow = [[NSWindow alloc] initWithContentRect: ... ];
   // insert the existing matrix as it's content view

   //* See here!
   [[myWindow contentView] addSubview:myMatrix];

   // alter the position of the matrix
   NSPoint newPoint = ...
   [myMatrix setFrameOrigin:newPoint];
   [myWindow display];

A window's content view always fills the whole content area.   
Therefore, moving it around makes no sense.


Gotcha! Thats the nuance I wasnt picking up on, that the NSWindow has  
its default content view, and I just need to add my subview to _it_.  
Most excellent!


Thx!
Russ

___

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: Setting conditional breakpoint on Cocoa method?

2008-07-28 Thread Ken Thomases

On Jul 28, 2008, at 7:30 AM, Graham Cox wrote:

One thing that I'm a bit unsure about. If I enter a symbolic  
breakpoint, will it break on the first instruction of that method  
or further along?


The breakpoint is after the local frame has been set up:

$ gdb /Applications/TextEdit.app/Contents/MacOS/TextEdit
[...]
(gdb) run
Starting program: /Applications/TextEdit.app/Contents/MacOS/TextEdit
[...]
^C
Program received signal SIGINT, Interrupt.
0x90009cd7 in mach_msg_trap ()
(gdb) break -[NSConcreteAttributedString initWithString:]
Breakpoint 1 at 0x927fb612
(gdb) info break
Num Type   Disp Enb AddressWhat
1   breakpoint keep y   0x927fb612 -[NSConcreteAttributedString  
initWithString:]+5


Notice the +5 in the breakpoint description.  If you were to hit  
that breakpoint and disassemble the current function, you'd see it's  
past the point where the old frame pointer is pushed and the current  
stack pointer is copied to be the new frame pointer.


Cheers,
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: Efficient Updating of Thousands of NSManagedObject Relationships

2008-07-28 Thread Kenny Carruthers
Even building up an array of managedobjects and then passing that to  
the set returned from mutableSetValueForKey results in extremely long  
updates. For example, I just tried moving 1300 songs to a playlist and  
while it took almost no time to fetch each song from the managed  
context and build up the array, the following call took over a minute  
to execute:


[[destinationList mutableSetValueForKey:@songs]  
addObjectsFromArray:songs];


When it completed the data was correct, but I have to imagine there's  
a much faster way to do this.


As always, thanks for any help.

Sincerely,
Kenny

On Jul 28, 2008, at 1:35 PM, I. Savant wrote:


for (song in songs)
NSManagedObject *song = ... (Fetch some from proper context)
song.playlist = destinationList
end


 You could always ask the playlist for its
-mutableSetValueForKey:@songs ... then call -addObjects: and pass in
your songs array.

--
I.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: sorting two arrays

2008-07-28 Thread William Squires
  The most logical is to make a class that has - as properties - the  
two pieces of data being sorted, then put these in an NSArray (or  
NSMutableArray as appropriate to your situation), and then sort that  
instead. Not only will it sort both pieces of data together, but it's  
a lot easier to extend if you need more data sorted along with the  
key array.


So if array1 is an array of 'int', and array2 is an array of  
'NSString *', then you would make a class like:


@interface sortableData : NSObject

{
int sortKey;
NSString *data;
}

// useful methods here...
@end

then - in your .m file - implement a sort method that takes an  
'NSArray *' pointing to the array filled with references to  
sortableData objects. Now, when you sort it, all the other data (the  
NSStrings) come along for the ride for free.
  The other way to do it is - when you do a swap() on one array's  
elements i and j, you swap the elements i and j of (all) the other  
array(s) related to the key value array (the one you're directly  
sorting on.)
  Finally, put the data into a database with an SQL front-end, and  
do the sort that way.

  That said, I hope you get it working. :)

On Jul 28, 2008, at 10:08 AM, Jeff LaMarche wrote:


Hey all...

I've got two arrays that are related, so that object 0 in one array  
corresponds to object 0 in the other array. I'd like to implement a  
sort based on the values in one array, but to  reorder both array  
so that the order of the two arrays stays in sync and that object x  
in one array continues to correspond to the same thing as object x  
in the other array after the sort.


I've got a general idea of how to implement the sort, but since I  
know that there are a few places in the system where array pairs  
are used like this, I wanted to see if there was any out-of-the-box  
way of handling this scenario - I'd hate to reinvent the wheel if  
it's not necessary. Does anyone know if there is any easy way to do  
this?


TIA,
Jeff

___

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/wsquires% 
40satx.rr.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: [OT] How do you pronounce .xib?

2008-07-28 Thread William Squires
Can we kill this silly thread before I send a 'kill -9' to your ecks- 
eye-bee :)


On Jul 28, 2008, at 3:26 PM, Andreas Wittenstein wrote:


Eleven B

- Andreas
___
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list  ([EMAIL PROTECTED])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xcode-users/wsquires% 
40satx.rr.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: Setting conditional breakpoint on Cocoa method? [SOLVED]

2008-07-28 Thread Graham Cox
Thanks Ken and Jonathan - with your help I got the debugger to reveal  
the source of the bug and fixed it. (And learned a useful new weapon  
in the process).


cheers, Graham


On 29 Jul 2008, at 9:38 am, Ken Thomases wrote:


On Jul 28, 2008, at 7:30 AM, Graham Cox wrote:

One thing that I'm a bit unsure about. If I enter a symbolic  
breakpoint, will it break on the first instruction of that method  
or further along?


The breakpoint is after the local frame has been set up:

$ gdb /Applications/TextEdit.app/Contents/MacOS/TextEdit
[...]
(gdb) run
Starting program: /Applications/TextEdit.app/Contents/MacOS/TextEdit
[...]
^C
Program received signal SIGINT, Interrupt.
0x90009cd7 in mach_msg_trap ()
(gdb) break -[NSConcreteAttributedString initWithString:]
Breakpoint 1 at 0x927fb612
(gdb) info break
Num Type   Disp Enb AddressWhat
1   breakpoint keep y   0x927fb612 -[NSConcreteAttributedString  
initWithString:]+5


Notice the +5 in the breakpoint description.  If you were to hit  
that breakpoint and disassemble the current function, you'd see it's  
past the point where the old frame pointer is pushed and the current  
stack pointer is copied to be the new frame pointer.


Cheers,
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: sorting two arrays

2008-07-28 Thread Graham Cox

Jeff,

This has a bit of a whiff about it. Two arrays of the same objects is  
not unusual, but forcing them always into the same order is - surely  
that's just a data duplication? If the arrays are meant to be  
identical, why not just use one array? What is different?


If array B contains array A + some extra objects (which after sorting  
will always be pushed to the end of the array), maybe a better pattern  
would be to keep just these additional objects in array B and just  
tack them on to the end of array A when a complete list is requested.  
Then your problem reduces to how do I sort an array? which Cocoa  
gives you. A bit more of an overview of what you're actually trying to  
do would help.


cheers, Graham



On 29 Jul 2008, at 1:08 am, Jeff LaMarche wrote:


Hey all...

I've got two arrays that are related, so that object 0 in one array  
corresponds to object 0 in the other array. I'd like to implement a  
sort based on the values in one array, but to  reorder both array so  
that the order of the two arrays stays in sync and that object x in  
one array continues to correspond to the same thing as object x in  
the other array after the sort.


I've got a general idea of how to implement the sort, but since I  
know that there are a few places in the system where array pairs are  
used like this, I wanted to see if there was any out-of-the-box way  
of handling this scenario - I'd hate to reinvent the wheel if it's  
not necessary. Does anyone know if there is any easy way to do this?


TIA,
Jeff

___

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/graham.cox%40bigpond.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: sorting two arrays

2008-07-28 Thread Randall Meadows

On Jul 28, 2008, at 6:58 PM, Graham Cox wrote:

This has a bit of a whiff about it. Two arrays of the same objects  
is not unusual, but forcing them always into the same order is -  
surely that's just a data duplication? If the arrays are meant to be  
identical, why not just use one array? What is different?


He didn't say they were the same objects in both arrays, only that the  
corresponding objects in each array were somehow related.



On 29 Jul 2008, at 1:08 am, Jeff LaMarche wrote:


I've got two arrays that are related, so that object 0 in one array  
corresponds to object 0 in the other array. I'd like to implement a  
sort based on the values in one array, but to  reorder both array  
so that the order of the two arrays stays in sync and that object x  
in one array continues to correspond to the same thing as object x  
in the other array after the sort.


I've got a general idea of how to implement the sort, but since I  
know that there are a few places in the system where array pairs  
are used like this, I wanted to see if there was any out-of-the-box  
way of handling this scenario - I'd hate to reinvent the wheel if  
it's not necessary. Does anyone know if there is any easy way to do  
this?




A better understanding of how these arrays are used might help us  
provide the best solution for you.


For instance, do you always access the 2nd array after finding  
something in the 1st array?  I.e., is it always a one-way street (A- 
B), or is it also bi-directional (A-B).  If the former, perhaps  
instead of 2 arrays, you could keep the one array A sorted, then use a  
dictionary to keep the value that would otherwise go in array B, keyed  
off the values in the array, instead of trying to keep 2 arrays in sync.

___

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: sorting two arrays

2008-07-28 Thread Graham Cox
Ah, OK, didn't quite grok that. If they are related, could object A  
have a reference to object B? If so, just sorting one array then gives  
you the other objects sorted in the same order without having to sort  
array B (or even have one).


Graham


On 29 Jul 2008, at 11:08 am, Randall Meadows wrote:

He didn't say they were the same objects in both arrays, only that  
the corresponding objects in each array were somehow related.


___

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: sorting two arrays

2008-07-28 Thread Michael Ash
On Mon, Jul 28, 2008 at 9:17 PM, Graham Cox [EMAIL PROTECTED] wrote:
 Ah, OK, didn't quite grok that. If they are related, could object A have a
 reference to object B? If so, just sorting one array then gives you the
 other objects sorted in the same order without having to sort array B (or
 even have one).

Or, as a really simple/dumb technique, store one array of dictionaries
with two key/value pairs. As an added bonus, using valueForKey: on the
array makes it very easy to extract arrays of the actual objects.

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: What is the maximum NSURL length?

2008-07-28 Thread Gregory Weston

Philip Dow wrote:


Hello, quick question. What is the maximum length of an utf-8 string
that NSURL can handle when using +[NSURL urlWithString:]. I understand
that Safari can deal with tens of thousands of characters in the url
field. Would somebody be able to offer a more specific number?


Should be whatever the limit is on a NSString. (Not counting the  
possibilities inherent in relative URLs.) Any smaller limits would  
really be imposed by the *client* of the NSURL object. A given server  
may not be able to cope with a URL that's too long for example.

___

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]


  1   2   >