Re: Leak when animating Core Animation Superlayer

2008-05-31 Thread Stéphane Droux
On Sat, May 31, 2008 at 11:14 PM, Brian Christensen <[EMAIL PROTECTED]>
wrote:

> On May 31, 2008, at 16:39, "Stéphane Droux" <[EMAIL PROTECTED]>
>
> > When I run the program in MallocDebug, the memory usage goes up every
> time the timer function is executed. If I change the animation to be on l2
> instead of l1, or if I create l2 as a sublayer of mainLayer, the memory
> usage remains constant. Am I doing something wrong ?
>
>
> An NSTimer is not really the appropriate way to do this. Have a look at
> CABasicAnimation, which you might use in the following manner (untested code
> written on an iPhone, so no guarantees):
>
> CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@
> "opacity"];
>
> [anim setFromValue:1.0];
> [anim setToValue:0.2];
> [anim setAutoreverses:YES];
> [anim setDuration:1.0];
>
> [l2 addAnimation:anim forKey:nil];
>
> I would recommend reviewing the Core Animation documentation for additional
> examples.
>
> /brian
>

Actually the animation in my example is only to reproduce the leak. I could
have made it to pick up any random number for opacity (or any other
property), in which case an autoreverse animation wouldn't work, but the
program would still leak.

The problem I have is that when I run several animations on a layer that is
not a leaf, I get a leak.
I tried implicit animations and explicit animations and they both leak.
The timer in my example is only to simulate several animations.

When I run the program in Mallocdebug, it seems that one of the threads used
by Core Animation to animate the layers doesn't release its memory.
So it looks like a bug in Core Animation. However, since animating non-leaf
layers is such a core feature of Core Animation, I guess there's something
missing in my code

Thanks
Stephane
___

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]


Looking for Philip Benjamin

2008-05-31 Thread christian hresko
I believe Philip is on this list... I have a question for you about
Cocoa and Logic Pro.  Please email me off list (I couldn't find your
contact info elsewhere).

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: Converting string to double: NSString or NSScanner

2008-05-31 Thread Markus Spoettl

On May 31, 2008, at 9:35 PM, Michael Vannorsdel wrote:
Basically NSString's floatValue and doubleValue methods only work  
when the numbers use the US style dot separator (as opposed to other  
locale separators such as a comma).  If your NSString might contain  
non-US separators (or other formatting differences) you'll have to  
use NSScanner to do a localized scan of the NSString to extract the  
correct number.  If you tried to use NSString's doubleValue on  
something like "12,34" you would get 12.000.



OK, thanks for confirming that. "US-style" is exactly what I need.

Regards
Markus
--
__
Markus Spoettl



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: CGContextSetRGBFillColor() off by one?

2008-05-31 Thread Ken Ferry
Thanks for the pointer. :-)

If the device colorspaces were just generic ones, my test program would work.

I heard back on my bug, though.  Indeed, the device spaces are no
longer device dependent.  The device RGB space at least at the moment
coincides with the colorspace of the main display.

(The urging in the docs is that you replace usage with a generic
space, not that device and generic spaces are the same.)

Anywho, just to close up, yes, you're seeing color transformation.
Fill with a color that's already in the destination colorspace to
avoid it.

-Ken

On Fri, May 30, 2008 at 5:15 PM, Michael Vannorsdel <[EMAIL PROTECTED]> wrote:
> This is from the CGColorSpaceCreateDeviceRGB docs:
>
> In Mac OS X v10.4 and later, this color space is no longer device-dependent
> and is replaced by the generic counterpart—kCGColorSpaceGenericRGB—described
> in "Color Space Names". If you use this function in Mac OS X v10.4 and
> later, colors are mapped to the generic color spaces. If you want to bypass
> color matching, use the color space of the destination context.
>
> So since 10.4 the device colorspaces are now just generic ones.
>
>
> On May 30, 2008, at 1:38 PM, Ken Ferry wrote:
>
>>> Well... I'm not sure that's true any more is it?  I mean, don't all the
>>> DeviceXXX colour spaces get mapped to the new "Generic" ones as of 10.4?
>>
>> I don't believe so, and that isn't what I see in testing.
>>
>> I filed a bug for this yesterday.  My understanding, which may be
>> flawed, is that using a 'device' colorspace is a pledge that you know
>> that your color components are already with respect to the colorspace
>> of the destination, so require no further color correction.
>
> ___
>
> 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]


Re: Converting string to double: NSString or NSScanner

2008-05-31 Thread Michael Vannorsdel
Basically NSString's floatValue and doubleValue methods only work when  
the numbers use the US style dot separator (as opposed to other locale  
separators such as a comma).  If your NSString might contain non-US  
separators (or other formatting differences) you'll have to use  
NSScanner to do a localized scan of the NSString to extract the  
correct number.  If you tried to use NSString's doubleValue on  
something like "12,34" you would get 12.000.



On May 31, 2008, at 10:22 PM, Markus Spoettl wrote:


Hello List,

 I'm having troubles deciphering the documentation. I have doubles  
stored in a text file which always use the dot "." as decimal  
separator. When converting the strings to doubles the conversion to  
be locale independent. The NSString:doubleValue documentation says:


> This method uses formatting information stored in the non- 
localized value;
> use an NSScanner object for localized scanning of numeric values  
from a string.


"Formatting information stored in the non-localized value" is really  
a little cryptic - what formatting information and where is the non- 
localized value stored. The part about NSScanner indicates that  
NSString:doubleValue is what I want, is it?


___

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

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

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

This email sent to [EMAIL PROTECTED]


Converting string to double: NSString or NSScanner

2008-05-31 Thread Markus Spoettl

Hello List,

  I'm having troubles deciphering the documentation. I have doubles  
stored in a text file which always use the dot "." as decimal  
separator. When converting the strings to doubles the conversion to be  
locale independent. The NSString:doubleValue documentation says:


> This method uses formatting information stored in the non-localized  
value;
> use an NSScanner object for localized scanning of numeric values  
from a string.


"Formatting information stored in the non-localized value" is really a  
little cryptic - what formatting information and where is the non- 
localized value stored. The part about NSScanner indicates that  
NSString:doubleValue is what I want, is it?


Regards
Markus
--
__
Markus Spoettl



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: email

2008-05-31 Thread Jens Alfke


On 31 May '08, at 6:19 PM, Chris Page wrote:

I'm seeing average times of one to two milliseconds per message  
(e.g., 7 seconds for a mailbox with 4,660 messages) on a 2.5GHz Quad  
G5.


When I run that, Script Editor and Mail both lock up for quite a while  
(and Script Editor's RPRVT grows to over 1GB!), but I don't see the  
log messages appear anywhere. I'm not familiar with the "log" command  
— where does it put the output?


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: ScriptingBridge to access Mail Messages?

2008-05-31 Thread Jens Alfke


On 31 May '08, at 2:07 PM, Thomas Wickl wrote:

Where can I find information what is possible with Mail.app and the  
Scripting Bridge? Is there a description or referenz about all  
scripting possibilities in Mail.app?


In the Script Editor appplication, choose "Open Dictionary..." from  
the File menu and select Mail from the list. It'll open a browser for  
all of Mail's scripting support.


If you're going to try to script Mail, it might be a good idea to  
learn some AppleScript first and try to do it in Script Editor. The  
turnaround time is faster, and the error messages will probably be  
more understandable.


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: RESTful API's - Easy way to interact?

2008-05-31 Thread Peter Burtis

On May 31, 2008, at 1:12 PM, Jens Alfke wrote:
I think there's a need for some additional API on NSURLConnection to  
provide finer-grained control over authentication. In particular,
(1) Ability to set credentials on the request before starting the  
connection

(2) Ability to disable the connection from looking in the Keychain



Thanks Jens, macnetworkprog isn't a list I read, but I'll dip my toe  
in over there for a good cause.  I agree that the above functionality  
would make all the difference in the world.


On May 30, 2008, at 10:16 PM, Jeremy wrote:

'Basic ' + Base64.encode(username + ':' + password)



Jeremy, if you do have a special case and need to set the  
authentication header instead of going with the built in functions,  
cocoa doesn't have any base 64 functionality built in that I know of,  
but there are many examples floating around the net of adding  
encodeBase64 methods in a category to either NSString or NSData.  Most  
use libcrypto (a Rubik's Cube of a C library!).  Dave Dribin's blog  
has one such example:


http://www.dribin.org/dave/blog/archives/2006/03/12/base64_cocoa/

-Pete
___

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

2008-05-31 Thread Chris Page

On May 28, 2008, at 08:02 AM, Jens Alfke wrote:

Importing messages from Mail via AppleScript may not be fast enough  
— my highly scientific estimate* is "a couple of messages" a second.  
Importing someone's entire mail archive would take a long time.



I just did a test and it's quite fast if you ask for all the messages  
at once:


tell application "Mail"
repeat with box in mailboxes
set n to count messages of box
log "Importing " & n & " messages from “" & (name of box) & "”"
set startTime to current date
get the source of every message of box
set elapsedTime to (current date) - startTime
log "Total: " & elapsedTime
if n is not 0 then
log "Average: " & elapsedTime / n
end if
end repeat
end tell

I'm seeing average times of one to two milliseconds per message (e.g.,  
7 seconds for a mailbox with 4,660 messages) on a 2.5GHz Quad G5.


Be sure not to run this with event result logging turned on in Script  
Editor, although even with event logging turned on that same mailbox  
only takes 30 seconds or just over 6 milliseconds per message.


--
Chris Page - AppleScripter

 The other, other AppleScript Chris

___

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: Loops in Objective C?

2008-05-31 Thread Chris Page

On May 26, 2008, at 12:20 PM, Nathan wrote:


while(z=1);


In addition to what others said, change that from assignment "=" to  
comparison "==".


-- Chris Page - Text Editor

An ASCII character walks into a bar.  Bartender asks, “What’ll you  
have?”  ASCII character says, “Give me a double.”  Bartender asks,  
“Having a bad day?”  ASCII character says, “Yeah, I have a parity  
error.”  Bartender says, “Hmmm. I thought you looked a bit off.”


___

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 do I use Sort Descriptor binding in IB on my array controller?

2008-05-31 Thread Rick Mann
I have an array controller in IB that is used by a popup menu in a  
table view column. I would like those menu items to be sorted. Is  
there a quick, mostly-IB way to configure that? The presence of a sort  
descriptor binding for the NSArrayController makes me think it should  
be pretty straightforward.


TIA,
--
Rick

___

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 an NSTableView

2008-05-31 Thread James W. Walker


On May 30, 2008, at 5:04 AM, Vijay Malhan wrote:


An Example:
mTable = member instance for your TableView
mData = member array which provides the data-objects.

Put the following code at a place where your table and data-source  
array is initialized. Like in awakeFromNib: method.


Here I'm sorting on key "name", Change it to whatever key you have  
in your data-object on which you want to do the sorting. You can do  
the same thing from IB as well, then you don't have to write the  
following code.



[mTable setSortDescriptors:[NSArray arrayWithObject:
[[[NSSortDescriptor alloc]initWithKey:@"name" ascending:YES
selector:@selector(caseInsensitiveCompare:) ]autorelease]]];

[mData sortUsingDescriptors:[mTable sortDescriptors]];


Now implement the following delegate for NSTableView:

- (void)tableView: (NSTableView *)aTableView
sortDescriptorsDidChange: (NSArray *)oldDescriptors
{
[mData sortUsingDescriptors: [aTableView sortDescriptors]];
[mTable reloadData];
}


Thanks!

I missed that delegate method, since it's not listed with NSTableView,  
but with NSTableDataSource.  Somehow it works, though it's a little  
hard to wrap my head around.  The sort key is used to extract a string  
from members of the data array,  and the selector is used to compare  
the strings, right?  And if I hadn't represented my table data as an  
NSMutableArray containing NSDictionary objects, I'd have more work to  
do.


On Fri, May 30, 2008 at 12:18 PM, James W. Walker <[EMAIL PROTECTED]>  
wrote:
Hi.  I'm a Cocoa newbie, and I'm trying to figure out how to enable  
sorting columns of my table, but the NSTableView guide doesn't say  
anything about it.  I see that NSTableView has a setSortDescriptors  
method, NSTableColumn has a setSortDescriptorPrototype method, and  
that IB shows a "sort key" attribute for a table column, but I'm not  
clear on how to use them.  Any hints or examples?

___

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: incorporating mail

2008-05-31 Thread Scott Anguish


On May 31, 2008, at 4:00 PM, Nathan wrote:

Is there a way to send an email from me to someone else  
programatically, and also to see how many unread emails you have?


the first part is asked here often. search the archives at www.cocoabuilder.com

if there is no API (and there isn't) you need to explore AppleScript.

___

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: KVO: I get called on change, but then can't get the object

2008-05-31 Thread Scott Anguish


On May 31, 2008, at 6:11 AM, Jonathan del Strother wrote:

On Sat, May 31, 2008 at 10:03 AM, Hamish Allan <[EMAIL PROTECTED]>  
wrote:
On Sat, May 31, 2008 at 8:48 AM, Rick Mann <[EMAIL PROTECTED]>  
wrote:


On May 31, 2008, at 00:32:30, j o a r wrote:


Search for "NSKeyValueObservingOptionNew" here:


Already using that:


Read it again:

"The change dictionary doesn't contain old and new values. This is  
not

your fault, it's due to a bug in the controller. This bug will not be
fixed in the forseeable future."

Can mmalc or anyone else give an explanation of why not?



I could've sworn that was fixed in Leopard, actually.   Anyone tried  
it?


swearing isn't appropriate here. :-)

and no, it hasn't been fixed.

___

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: KVO: I get called on change, but then can't get the object

2008-05-31 Thread Scott Anguish

array controllers are not fully KVO compliant.

they don't return change values.


On May 31, 2008, at 3:21 AM, Rick Mann wrote:

I registered to observe changes in the "number" column of my tree  
controller:


[mItemsController addObserver: self
forKeyPath: @"selection.number"
options: (NSKeyValueObservingOptionNew)
context: NULL];

My -observe: action gets called, but this line

	NSLog(@"Value changed %@: %@ (%@)", inKeyPath, inChange, [inObject  
selection]);



dumps this to the console:

Value changed selection.number: {
   kind = 1;
   new = ;
} (<_NSControllerObjectProxy: 0x177cb0>)

Note that "new" is null. I would expect it to be the value of the  
number.


Furthermore, this line:

NSLog(@"selection: %@", [inObject valueForKey: @"selection"]);

dumps:

selection: <_NSControllerObjectProxy: 0x177cb0>

But if I change it to @"selection.number", it throws the exception:

"[ valueForUndefinedKey:]: this class is  
not key value coding-compliant for the key selection.number."




From reading the docs:

"NSObjectController and its subclasses implement the selection  
method. This method returns a proxy object that represents the  
receiver’s current selection. The proxy is fully key-value-coding  
compliant.
When you request a key’s value from the selection proxy it returns  
the value, or a selection marker. Placeholder markers provide  
additional information about the selection. There are three  
placeholder markers defined in the NSPlaceholders informal protocol:"


It seems that I should be able to get the number from the selection,  
but instead I get the exception:


"[ valueForUndefinedKey:]: this class is  
not key value coding-compliant for the key selection.number."




I feel like I should be able to get the number. Elsewhere I read  
that I would get an array of numbers. What am I doing wrong?




TIA,




--
Rick

___

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/scott%40cocoadoc.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: Copying NSTextStorage

2008-05-31 Thread Gordon Apple
New attempt.  Instead of intercepting the "text" key in my shape
CopyWithZone, I tried the obvious thing of subclassing NSTextStorage, adding
the copying/mutablecopying protocols using the same copy technique of
creating a new object initialized with the original.  Even without the
protocols, this simply did not work. It wouldn't allow me to edit text at
all.  Without even trying to make a copy, apparently NSTextView will accept
nothing but the original NSTextStorage -- no subclasses allowed, even
without any overrides.

___

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: PDFDocuments and CGPDFDocuments

2008-05-31 Thread Kevin Ross

Whoops, I sent this yesterday but didn't hit reply-all...

Thanks Joel, I just took a look at the PDFAnnotationEditor example.   
It seems to be doing all of it's transformations in the PDFView  
subclass.  I'm not sure if I am able to do this since I would like to  
perform the impositions by working strictly with the data of the  
PDFDocument.


David's book is fantastic, I'm been using it plus a lot of inspiration  
to get to where I am now.  It has been essential on this journey.


In my naiveté, I had hoped that I could cast between the two with a  
smaller performance penalty than converting PDFDocument -> NSData ->  
CGPDFDocumentRef.  Needless to say, there has been no headway on that  
front.


I currently have an "Initilalizing..." document modal window activate  
when I'm initializing the CGPDFDocumentRef so it's not too bad, it  
would just be nice to avoid this behavior completely.


I realize that perhaps this question might be better suited for quartz- 
dev, thank you for your insight!


- Kevin

On May 29, 2008, at 8:52 PM, Joel Norvell wrote:


Kevin,

The PDFAnnotationEditor example program does a lot of this sort of  
thing; have

you looked at it?

Also, any operation you can perform on an NSView also applies to a  
PDFView;

plus you have the additional PDFView protocol.

Other pertinent resources would be Apple's quartz-dev list and David  
Gelphman's

beautiful book, Programming With Quartz.

HTH,
Joel





___

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/cocoa.beans%40sbcglobal.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: PDFDocuments and CGPDFDocuments

2008-05-31 Thread Kevin Ross
My ultimate goal is an application that is like a printer's PDF  
workflow, that will allow page manipulations like resizing /  
cropping / adding bleed information, and imposing multiple pages onto  
one with crop marks and the like.  After researching it seems like  
some of the functions (imposition with crop marks, page cropping/ 
scaling with/without preserving aspects, etc) are best suited for  
quartz, while the rest (page reordering/inserting, rotating, etc) have  
Cocoa APIs.   I'm not clear on how to accomplish the more advanced  
requirements without creating a CGPDFDocumentRef to draw into a custom  
quartz context.


If there is a more sane way to accomplish these tasks please let me  
know!:)


Thank you for your help!

- Kevin


On May 30, 2008, at 12:59 PM, John Calhoun wrote:


On May 29, 2008, at 6:50 PM, Kevin Ross wrote:
I think there has to be either a better way of doing this or a way  
to do it where I will not have to convert (PDFDocument *) to  
CGPDFDocumentRef every time I perform a transformation.


Joel was right. I think it would be easier for you to stay in PDF  
Kit (PDFView) and do your transforms there.


Since I don't know exactly what you are doing, I can't recommend  
specific advice.  If you explain what you think you need to do with  
CGPDFDocumentRef, I'll try to suggest a parallel way of doing it in  
PDF Kit.


John Calhoun—___

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/cocoa.beans%40sbcglobal.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: Possible Bug in NSFileManager -moveItemAtPath:toPath:error:

2008-05-31 Thread Jonathan Dann


On 31 May 2008, at 22:51, stephen joseph butler wrote:

On Sat, May 31, 2008 at 4:35 PM, Jonathan Dann <[EMAIL PROTECTED]>  
wrote:

On 31 May 2008, at 18:17, Jens Alfke wrote:

Try using the system call "rename". (Use "man 2 rename" to see the
documentation.)
Call -fileSystemRepresentation on your path strings to convert  
them to

appropriate C strings.


I'll have a look at that, would that break if my users have non-ascii
filenames?  I've only worked with NString, which handles Unicode
transparently.


As long as you use fileSystemRepresentation, it always does The Right
Thing w.r.t. Unicode encoding.


Awesome! Thanks for your help.

Jon

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: ScriptingBridge to access Mail Messages?

2008-05-31 Thread has


Thomas Wickl wrote:


first of all, I´m new to Cocoa and I need some Informations about the
possibilities in Cocoa to plan a new Project of mine.
I want to access all Messages of my Mail.app Account. So, there is no
API for Mail.app but I´ve read something about the ScriptingBridge and
found that SendMail Example. But is it possible to get a list of all  
E-

Mails in Mail with this Scriptingbridge?


SB can perform a subset of what's possible with AppleScript, so if you  
can do it in AppleScript then in theory you should be able to do it in  
SB as both AS and SB build on the same Apple Event Manager API.  
However, SB's design is such that some functionality is obfuscated  
almost to the point of incomprehensibility (e.g. the by-test reference  
form, aka 'whose clauses'), whilst some other things just plain break  
because the SB designers tried to be clever and make it work the way  
they think Apple event IPC should work instead of the way it actually  
does. (Alas, SB's two-steps-forward-one-step-back approach is pretty  
much par for the course for AppleScript's development over the years.)


Depending on exactly what it is you want to do, you might find it  
quicker and easier to read Mail's mailbox files directly. e.g. See:


http://lists.apple.com/archives/Cocoa-dev/2008/May/msg02912.html

I can't tell you if that's an officially sanctioned approach though,  
so caveat emptor and do your own research first.




Where can I find information what is possible with Mail.app and the
Scripting Bridge? Is there a description or referenz about all
scripting possibilities in Mail.app?



With a few rare exceptions (e.g. Adobe, Microsoft apps), Mac  
applications' scripting interfaces are notoriously underdocumented.  
You can start with the Mail's built in AppleScript dictionary, which  
provides a basic description of the API itself, although doesn't  
provide sufficient information to know how to use it. Beyond that,  
it's a case of learning how application scripting works in general  
(hint: it helps to realise that it's RPC+queries; if you mistake it  
for OOP as most folks do, beyond a certain point it'll confuse the  
heck out of you), and looking at existing code examples (99% of which  
are written in AppleScript, so I'm afraid you'll need to learn the  
language a bit even if you don't use it yourself), asking for  
assistance with specific problems (again, the AppleScript forums are  
your best bet for this), and good old trial and error experimentation  
(again, a scripting language will be quicker for this).


Matt Neuburg's 'AppleScript: The Definitive Guide' is probably a good  
place to start; the current (second) edition doesn't cover Leopard- 
specific developments, but given that neither the language nor the  
basic concepts behind application scripting don't evolve much from  
release to release, this isn't a big deal. (Also, Matt isn't shy about  
discussing its various flaws, which is both helpful and reassuring.)  
And here's a link to the AppleScript-users mailing list where a lot of  
the experienced Mail scripters can be found:


http://lists.apple.com/mailman/listinfo/applescript-users

Also, obligatory reference to my own contributions: the Python, Ruby  
and ObjC appscript bridges (essentially Scripting Bridge done right),  
ASDictionary (which exports nicely formatted application dictionaries  
in AppleScript and appscript syntax) and ASTranslate (which you can  
use to translate AppleScript commands to the equivalent appscript  
syntax - very handy when learning the latter). See my sig for links.


HTH

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

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Leak when animating Core Animation Superlayer

2008-05-31 Thread Brian Christensen

On May 31, 2008, at 16:39, "Stéphane Droux" <[EMAIL PROTECTED]>

> When I run the program in MallocDebug, the memory usage goes up  
every time the timer function is executed. If I change the animation  
to be on l2 instead of l1, or if I create l2 as a sublayer of  
mainLayer, the memory usage remains constant. Am I doing something  
wrong ?



An NSTimer is not really the appropriate way to do this. Have a look  
at CABasicAnimation, which you might use in the following manner  
(untested code written on an iPhone, so no guarantees):


CABasicAnimation *anim = [CABasicAnimation  
animationWithKeyPath:@"opacity"];


[anim setFromValue:1.0];
[anim setToValue:0.2];
[anim setAutoreverses:YES];
[anim setDuration:1.0];

[l2 addAnimation:anim forKey:nil];

I would recommend reviewing the Core Animation documentation for  
additional examples.


/brian

___

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: Possible Bug in NSFileManager -moveItemAtPath:toPath:error:

2008-05-31 Thread stephen joseph butler
On Sat, May 31, 2008 at 4:35 PM, Jonathan Dann <[EMAIL PROTECTED]> wrote:
> On 31 May 2008, at 18:17, Jens Alfke wrote:
>> Try using the system call "rename". (Use "man 2 rename" to see the
>> documentation.)
>> Call -fileSystemRepresentation on your path strings to convert them to
>> appropriate C strings.
>
> I'll have a look at that, would that break if my users have non-ascii
> filenames?  I've only worked with NString, which handles Unicode
> transparently.

As long as you use fileSystemRepresentation, it always does The Right
Thing w.r.t. Unicode encoding.
___

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: Opening column for edit after adding to tree controller?

2008-05-31 Thread Rick Mann


On May 31, 2008, at 13:31:10, I. Savant wrote:

 If you're targeting Leopard, you can force the tree controller to - 
fetch: (so it's updated) then I believe you can ask the outline view  
for its -rowForItem: ... if you're targeting Tiger, it's not as  
straightforward due to proxy objects.



I am targeting Leopard (for now, at least). However, -rowForItem:, and  
for that matter, -itemForRow: both return null, even if I fetch first.


--
Rick

___

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: Possible Bug in NSFileManager -moveItemAtPath:toPath:error:

2008-05-31 Thread Jonathan Dann


On 31 May 2008, at 18:17, Jens Alfke wrote:



On 31 May '08, at 9:27 AM, Jonathan Dann wrote:

Just a quick one.  I would expect renaming a file named HELLO.TXT  
to hello.txt (or another variant where the case of a few letters  
change) with -moveItemAtPath:toPath:error: to be allowed. As it is  
not (it generates an NSFileWriteUnknownError) is this a bug or just  
me?


That ought to work, even on HFS+. (It's not a no-op, because HFS+  
preserves the case of filenames, so getting the directory contents  
will return the name in its new case.)



If not, is there are more appropriate API for renaming files?


Try using the system call "rename". (Use "man 2 rename" to see the  
documentation.)
Call -fileSystemRepresentation on your path strings to convert them  
to appropriate C strings.


—Jens


I'll have a look at that, would that break if my users have non-ascii  
filenames?  I've only worked with NString, which handles Unicode  
transparently.


Thanks Jens,

Jon

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Possible Bug in NSFileManager -moveItemAtPath:toPath:error:

2008-05-31 Thread Jonathan Dann


On 31 May 2008, at 17:37, Torsten Curdt wrote:



On May 31, 2008, at 18:27, Jonathan Dann wrote:


Hi Guys,

Just a quick one.  I would expect renaming a file named HELLO.TXT  
to hello.txt (or another variant where the case of a few letters  
change) with -moveItemAtPath:toPath:error: to be allowed.  As it is  
not (it generates an NSFileWriteUnknownError) is this a bug or just  
me?  If not, is there are more appropriate API for renaming files?


Have you tried:

HELLO.TXT -> something
something -> hello.txt

Just a thought maybe it's related to the filesystem no being  
case-sensitive.


cheers
--
Torsten


Thanks Torsten that works, just feels like a hack as I have to use  
another method to generate a filename that isn't in the working  
directory.


Jon

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Finding the largest value in an NSTreeController?

2008-05-31 Thread Jonathan Dann


On 31 May 2008, at 21:43, Rick Mann wrote:


 Can category methods act as KVC properties?



Yep, the -flattenedObjects method I gave you asks the array of tree  
nodes valueForKey:@"descendants".  -descendants was the NSTreeNode  
method I posted.


Jon

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

ScriptingBridge to access Mail Messages?

2008-05-31 Thread Thomas Wickl

Hello,

first of all, I´m new to Cocoa and I need some Informations about the  
possibilities in Cocoa to plan a new Project of mine.
I want to access all Messages of my Mail.app Account. So, there is no  
API for Mail.app but I´ve read something about the ScriptingBridge and  
found that SendMail Example. But is it possible to get a list of all E- 
Mails in Mail with this Scriptingbridge?
Where can I find information what is possible with Mail.app and the  
Scripting Bridge? Is there a description or referenz about all  
scripting possibilities in Mail.app?


Thanx for your help

Thomas___

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]


Predicate expressions

2008-05-31 Thread Fabian
Hello,

I'm trying to figure out how to use NSExpressions in a predicate but
find the documentation a bit deficient.

Here is what I want to do: I have an array - array A - containing
objects with a "title" and "subtitle" property. I want to filter this
array so it only contains the objects in array B. The example below
demonstrates what I want to achieve, but lacks in precision. It only
checks the presence of the title and subtitle in array B, so the pair
could just as well belong to two different objects. I need to know
that both the title and subtitle of object X in array A matches the
title and subtitle of object Y in array B. Will a NSExpression let me
do this?

NSArray *arrayB = [self getObjects] ;

NSArray *titles = [arrayB arrayByApplyingSelector:@selector(title)];
NSArray *subtitles = [arrayB arrayByApplyingSelector:@selector(subtitle)];

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(title IN
%@) AND (subtitle IN %@)", titles, subtitles];
NSArray *result = [arrayA filteredArrayUsingPredicate:predicate];


Regards,
Fabian
___

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: Finding the largest value in an NSTreeController?

2008-05-31 Thread Rick Mann


On May 31, 2008, at 13:36:07, I. Savant wrote:

 In addition to Jonathan's comments, to be fair, you did ask, "... I  
don't know enough about CoreData to actually get at the objects  
without the tree controller."


 I was answering that. ;-)



Fair enough. Let me rephrase: feel like I ought to be able to say  
[treeController valueForKeyPath:  
@"[EMAIL PROTECTED]"], which I got closer to when I  
realized the word is "content", not "contents", but that seems to be  
an NSArray of only the top-level items. No built-in way to get an  
NSArray of all the items? I can use the other examples given to me to  
add to the NSTreeController category, I suppose, and accomplish the  
same thing. Can category methods act as KVC properties?


--
Rick

___

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]


Leak when animating Core Animation Superlayer

2008-05-31 Thread Stéphane Droux
Hi,

I'm currently writing an app that creates a complex hierarchy of CALayers.
Everytime I animate one of the layers, I get a memory leak.
In order to investigate the issue, I created a simple Cocoa project in which
I only added a CustomView and the following code for this view :

@implementation CustomView

- (void) awakeFromNib
{
CALayer *mainLayer = [[CALayer layer] retain];
[self setLayer:mainLayer];
[self setWantsLayer:YES];

// create a dummy sublayer to mainLayer
l1 = [CALayer layer];  // l1 is defined as a CALayer * in the header
file
l1.frame = CGRectMake(0.0, 0.0, 80.0, 30.0);
[mainLayer addSublayer:l1];

// create a dummy sublayer to l1
l2 = [CATextLayer layer]; // l2 is defined as a CATextLayer * in the
header file
l2.frame = CGRectMake(10.0, 10.0, 60.0, 20.0);
l2.string = @"test";
[l1 addSublayer:l2];

// trigger a repeating layer animation
[NSTimer scheduledTimerWithTimeInterval:0.4 target:self
selector:@selector(fromTimer:) userInfo:nil repeats:YES];
}

- (void) fromTimer: (NSTimer *) t
{
if (l1.opacity == 1.0)
l1.opacity = 0.2;
else
l1.opacity = 1.0;
}

@end


When I run the program in MallocDebug, the memory usage goes up every time
the timer function is executed.
If I change the animation to be on l2 instead of l1, or if I create l2 as a
sublayer of mainLayer, the memory usage remains constant.
Am I doing something wrong ?

Thanks
Stephane
___

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: Finding the largest value in an NSTreeController?

2008-05-31 Thread I. Savant
Wow, really? No way to just get at all the items in the tree  
controller with some key path, then use @max? It seems that this  
would be possible with an NSArray:


  In addition to Jonathan's comments, to be fair, you did ask, "... I  
don't know enough about CoreData to actually get at the objects  
without the tree controller."


  I was answering that. ;-)

--
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: Opening column for edit after adding to tree controller?

2008-05-31 Thread Rick Mann


On May 31, 2008, at 13:31:10, I. Savant wrote:


That's one way, so long as you force a fetch first.



So, I'm not really sure what fetch does. In my case, I either a new  
document or one that was opened, and the instances are all loaded and  
managed by the tree controller, and the UI is in sync. As the user  
creates new instances, the UI seems to work just fine. What would - 
fetch: do in this case? Seems like there's nothing for it to do.


TIA,
--
Rick

___

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: Opening column for edit after adding to tree controller?

2008-05-31 Thread Jonathan Dann


The problem is, I don't know how to determine to which row that  
newly-added object corresponds in the table view. Is there any way?  
I suppose it's the current-selected row, since it's set up to select  
on add. Is there a more elegant way to find out, though (i.e., what  
if adding didn't change the selection).


How does one find the row in the table view corresponding to any  
given instance?




Add this to your category on NSTreeController. It calls the - 
flattendedNodes method I gave you earlier.  You can then get the tree  
node for the whatever you added to the tree and call NSOutlineView's - 
rowForItem:


- (NSTreeNode *)treeNodeForObject:(id)object;
{   
NSTreeNode *treeNode = nil;
for (NSTreeNode *node in [self flattenedNodes]) {
if ([node representedObject] == object) {
treeNode = node;
break;
}
}
return treeNode;
}

For those searching the archives, the previous code examples are in  
this thread:


http://lists.apple.com/archives/cocoa-dev//2008/May/msg03138.html

Jon

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Opening column for edit after adding to tree controller?

2008-05-31 Thread I. Savant
The problem is, I don't know how to determine to which row that  
newly-added object corresponds in the table view.


  If you're targeting Leopard, you can force the tree controller to - 
fetch: (so it's updated) then I believe you can ask the outline view  
for its -rowForItem: ... if you're targeting Tiger, it's not as  
straightforward due to proxy objects.


I suppose it's the current-selected row, since it's set up to select  
on add.


 That's one way, so long as you force a fetch first.

--
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: Finding the largest value in an NSTreeController?

2008-05-31 Thread Jonathan Dann


On 31 May 2008, at 19:47, Rick Mann wrote:



Jonathan, thank you for the excellent example on working with the  
containers. That will certainly be useful.




You're welcome, but I apologise, I forgot the -rootNodes method that  
one of the tree controller methods I sent you calls! This method  
returns the top-level objects in the tree (NSTreeController.h assures  
me that -arrangedObjects responds to -childNodes, this differs from  
what the docs say).


// NSTreeController_Extensions
- (NSArray *)rootNodes;
{
return [[self arrangedObjects] childNodes];
}

now it'll work!.


On May 31, 2008, at 12:05:58, I. Savant wrote:


1 - Create a fetch request for your desired entity.
2 - Create a sort descriptor for the key whose max value you're  
interested in.

3 - Set the fetch request's sort descriptor to the above.
4 - Create any predicates needed for filtration (ie, whatever you  
may or may not have used in the tree controller).

5 - Set the fetch request's predicate to the above if any.
6 - Execute the fetch request and get the last (or first) object of  
the results (checking for errors, minding the set-versus-array  
gotchas, etc.).



Wow, really? No way to just get at all the items in the tree  
controller with some key path, then use @max?


Think of this this way, only the tree controller knows which objects  
it has in it.  The context and the model objects are ignorant of  
this.  The entity you fetch is that you set in IB for the tree  
controller, so that is *kind of* asking the context, "get me the nodes  
in the tree controller", but not exactly as the tree controller itself  
may have a predicate that causes it to fetch only some of those types  
of entities.  The fetch request (if you set the same predicate as the  
you have for the tree controller) will get you your NSSet of objects,  
then you can do whatever you want with the objects.


HTH,

Jon

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Opening column for edit after adding to tree controller?

2008-05-31 Thread Rick Mann


On May 31, 2008, at 07:34:30, I. Savant wrote:

 NSTableView and NSOutlineView have a method - 
editColumn:row:withEvent:select: ... Make sure your tree controller  
has fetched and rearranged its objects (and if your view is an  
outline view, the corresponding "item" for your new instance is  
fully expanded), then call the -editColumn:row:withEvent:select:  
method.



In this situation, I've got an existing tree controller (and  
associated view) in some state. The user has chosen to add a new item,  
so my document's -addItem: method has been called. Currently, it's  
implemented like this:


http://pastie.caboo.se/private/x7ln7slfzqyltdx7onj0eq

- (IBAction)
addItem: (id) inSender
{
	NSManagedObject* entity = [NSEntityDescription  
insertNewObjectForEntityForName: @"Item"


inManagedObjectContext: [self managedObjectContext]];

NSArray* curSelection = [mItemsController selectedObjects];

if ([curSelection count] > 0)
{
Item* curItem = [curSelection objectAtIndex: 0];
Destination* curDest = [curItem valueForKey: @"destination"];
[entity setValue: curDest forKey: @"destination"];
}

[mItemsController addObject: entity];
}

The problem is, I don't know how to determine to which row that newly- 
added object corresponds in the table view. Is there any way? I  
suppose it's the current-selected row, since it's set up to select on  
add. Is there a more elegant way to find out, though (i.e., what if  
adding didn't change the selection).


How does one find the row in the table view corresponding to any given  
instance?


TIA,
--
Rick

___

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: Finding the largest value in an NSTreeController?

2008-05-31 Thread Rick Mann


On May 31, 2008, at 12:05:58, I. Savant wrote:


1 - Create a fetch request for your desired entity.
2 - Create a sort descriptor for the key whose max value you're  
interested in.

3 - Set the fetch request's sort descriptor to the above.
4 - Create any predicates needed for filtration (ie, whatever you  
may or may not have used in the tree controller).

5 - Set the fetch request's predicate to the above if any.
6 - Execute the fetch request and get the last (or first) object of  
the results (checking for errors, minding the set-versus-array  
gotchas, etc.).



Wow, really? No way to just get at all the items in the tree  
controller with some key path, then use @max? It seems that this would  
be possible with an NSArray:


http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/ArrayOperators.html#/ 
/apple_ref/doc/uid/20002176


TIA,

--
Rick

___

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]


incorporating mail

2008-05-31 Thread Nathan
Is there a way to send an email from me to someone else  
programatically, and also to see how many unread emails you have?

___

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: Finding the largest value in an NSTreeController?

2008-05-31 Thread I. Savant
Well, I would have thought so, but I don't know enough about  
CoreData to actually get at the objects without the tree controller.  
I would've thought I could do that just off the tree controller,  
using @max, too.


1 - Create a fetch request for your desired entity.
2 - Create a sort descriptor for the key whose max value you're  
interested in.

3 - Set the fetch request's sort descriptor to the above.
4 - Create any predicates needed for filtration (ie, whatever you may  
or may not have used in the tree controller).

5 - Set the fetch request's predicate to the above if any.
6 - Execute the fetch request and get the last (or first) object of  
the results (checking for errors, minding the set-versus-array  
gotchas, etc.).


--
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: Displaying current time using NSCalenderDAte

2008-05-31 Thread mmalc crawford


On May 31, 2008, at 4:22 AM, haresh vavdiya wrote:

 I have successfully get current time but now i want to to  
digital
clock but for that i need to have current minute and hours, so how  
can i get

this?
I found some method of NSCalenderDate which give us hours and
minutes i can't get current time and date it display 2001 jan 1

Use of NSCalendarDate strongly discouraged. It is not deprecated yet,  
however it may be in the next major OS release after Mac OS X v10.5.  
For calendrical calculations, you should use suitable combinations of  
NSCalendar, NSDate, andNSDateComponents, as described in Calendars in  
Dates and Times Programming Topics for Cocoa .


mmalc

___

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: Finding the largest value in an NSTreeController?

2008-05-31 Thread Rick Mann


Jonathan, thank you for the excellent example on working with the  
containers. That will certainly be useful.


On May 31, 2008, at 02:57:36, Jonathan Dann wrote:

If you're using Core Data, can't you fetch all your managed objects  
and determine the one with the max vaule?



Well, I would have thought so, but I don't know enough about CoreData  
to actually get at the objects without the tree controller. I would've  
thought I could do that just off the tree controller, using @max, too.


--
Rick

___

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: Saving NSTextField value

2008-05-31 Thread Jens Alfke


On 31 May '08, at 11:14 AM, vince wrote:

What's the best way to maintain the value of the textField using  
Bindings?


I've never worked with user defaults using bindings, but it's really  
easy to do programmatically:


To store:

[[NSUserDefaults standardUserDefaults] setObject: [textfield  
stringValue] forKey: @"MyDefault"];


To retrieve:

[textfield setObjectValue: [[NSUserDefaults standardUserDefaults]  
objectForKey: @"MyDefault"]];


(The reason for using -setObjectValue: in the second line is that,  
unlike -setStringValue:, it doesn't barf if the value is nil.)


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Saving NSTextField value

2008-05-31 Thread vince
I have a current date and time method that returns a result in an
NSTextField.

-(IBAction)returnCurrentDateAndTime:(id)sender


{


 NSCalendarDate *current;

current = [NSCalendarDate calendarDate];

  [mDateReceiver setObjectValue:current];

 }


I need the date to remain static indefinitely [after quitting] until the
user reactivates the sender.


What's the best way to maintain the value of the textField using Bindings?


I've tried this and it's not working for me:


NSUserDefaultsController *defaultsController = [NSUserDefaultsController
sharedUserDefaultsController];

 [defaultsController save:[mDateReceiver objectValue]];



Bindings:


Shared User Defaults Controller


Controller Key: values


Model Key Path: save


thanks.


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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Weird NSInvocationOperation init behavior

2008-05-31 Thread Markus Spoettl

On May 31, 2008, at 1:19 AM, Michael Vannorsdel wrote:

If you method is something like:

- (void)func1

then you should use @selector(func1) without the colon.



Indeed. Thank you.

Regards
Markus
--
__
Markus Spoettl



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: runloops and NSURLConnection

2008-05-31 Thread Jean-Daniel Dupas


Le 31 mai 08 à 19:14, Torsten Curdt a écrit :


On May 31, 2008, at 18:55, Jens Alfke wrote:

On 31 May '08, at 8:07 AM, Torsten Curdt wrote:

I think you want to schedule the connection for the  
NSModalPanelRunLoopMode runloop mode.  This is the mode that is  
used for modal windows.


You mean with scheduleInRunLoop:forMode: ? ...but that's only  
available since 10.5


I don't know of a good alternative that's 10.4-compatible, short of  
running the NSURLConnection on a background thread with its own  
runloop.


OK ..so at least it was a real shortcoming and not me fighting the  
framework again.


What about my current solution with the run loop? Does it smell  
really bad ...or is the workaround OK as well?


But have you considered _not_ using a modal panel? IMHO, modal  
panels are a "UI smell", to coin a phrase. Does it really need to  
be impossible for the user to interact in any other way with the  
app while that panel is open? Usually a sheet will suffice, and  
sheets don't use a special runloop mode, so that would solve your  
problem.


Indeed - modal is smelly  ...and I have considered non-modal. It  
would make my life easier. But since I have just integrated your  
exception handling into the FeedbackReporter framework ...wouldn't  
you expect the dialog that pops up in case of an uncaught exception  
to be modal?


cheers
--
Torsten


If you handle the modal session yourself, it's easy to let the  
connection do some processing while the modal window is open:
Replace -[NSApp runModalForWindow:[self window]] by this and it should  
do the trick.


/* Create a modal session, and in each loop,
we process the default runloop event sources (url download,  
network connections, etc.) */
NSModalSession session = [NSApp beginModalSessionForWindow:[self  
window]];

for (;;) {
  if ((result = [NSApp runModalSession:session]) !=  
NSRunContinuesResponse)

break;
  /* Note: Do not use a 0 timeout, else this loop will never  
block and will consume a lots of CPU.
   In fact, the Cocoa UI event port is scheduled in the default  
runloop, so each Cocoa event will wakeup the runloop. */

  [[NSRunLoop currentRunLoop] runUntilDate:[NSDate distantFuture]];
}
[NSApp endModalSession:session];


___

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: runloops and NSURLConnection

2008-05-31 Thread Jens Alfke


On 31 May '08, at 10:14 AM, Torsten Curdt wrote:

Indeed - modal is smelly  ...and I have considered non-modal. It  
would make my life easier. But since I have just integrated your  
exception handling into the FeedbackReporter framework ...wouldn't  
you expect the dialog that pops up in case of an uncaught exception  
to be modal?


I don't think it should be modal. When it comes up as a modal panel,  
it's forcing the user to decide between (a) filling out a bug report  
right now, or (b) continuing with his work. Most people would choose  
(b), and by dismissing the panel the information in it is lost.


If you make it modeless, then the user can move the exception-alert  
window aside for the time being, finish the task at hand, and then  
report the bug a minute later.


I only made it a modal alert in my sample code modal because it's  
easier to call NSAlert than to make a new nib. :)


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Defaulting new entity fields to be same as current selection?

2008-05-31 Thread Rick Mann


On May 31, 2008, at 07:30:16, I. Savant wrote:


Can I get at that from within -awakeFromInsert?


 Yes, through some incredible acrobatics, you probably could, but  
then that would be like walking right up to the MVC design pattern  
and b**ch-slapping it right in the face. ;-)


Yes, of course.


Must I create my own -add?


 Yes. The best place to put this custom -add: action is up to you  
and your design (as long as it's in a controller), but  
NSObjectController (such as NSArrayController or NSTreeController)  
in charge of the Foo instances, I'd do it this way:



That's the approach I ended up taking. To save time (I need to  
actually use this little app starting today), I did it all in my  
document subclass.


Thanks for confirming I did it "right!"

--
Rick

___

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: KVO: I get called on change, but then can't get the object

2008-05-31 Thread Rick Mann


On May 31, 2008, at 03:11:51, Jonathan del Strother wrote:

I could've sworn that was fixed in Leopard, actually.   Anyone tried  
it?



I have ;-)

--
Rick

___

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: KVO: I get called on change, but then can't get the object

2008-05-31 Thread Hamish Allan
On Sat, May 31, 2008 at 11:11 AM, Jonathan del Strother
<[EMAIL PROTECTED]> wrote:
> On Sat, May 31, 2008 at 10:03 AM, Hamish Allan <[EMAIL PROTECTED]> wrote:
>> On Sat, May 31, 2008 at 8:48 AM, Rick Mann <[EMAIL PROTECTED]> wrote:
>>> On May 31, 2008, at 00:32:30, j o a r wrote:
>>>
 Search for "NSKeyValueObservingOptionNew" here:
>>>
>>> Already using that:
>>
>> Read it again:
>>
>> "The change dictionary doesn't contain old and new values. This is not
>> your fault, it's due to a bug in the controller. This bug will not be
>> fixed in the forseeable future."
>>
>> Can mmalc or anyone else give an explanation of why not?
>
> I could've sworn that was fixed in Leopard, actually.   Anyone tried it?

I have -- it isn't fixed.

http://www.cocoabuilder.com/archive/message/cocoa/2008/4/17/204421

Hamish
___

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]


Graphing With Google Charts API

2008-05-31 Thread Jamie Phelps
I am writing an application that could seriously benefit from a good  
graphing API. Of course, the simplest solution to this would be if  
Apple opened up GraphKit for Cocoa developers. Sadly, that seems not  
to be in the near future, so I'm looking at alternatives.


While there are some graphing frameworks out there, most of them seem  
incomplete and/or without a great deal of ongoing development. So, my  
thought was that Google's relatively new Charts API would be a great  
way to plug this hole for the time being. Simple URL calls return PNG  
images that could then be cached.


Other than the obvious need for an internet connection, can anyone see  
any reason this can't work as a viable solution to the graphing  
problem in Cocoa?


For reference, here is Google's Charts API page: 
http://code.google.com/apis/chart/

Jamie
___

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: Alert Sheets hard wired in Interface Builder

2008-05-31 Thread Jens Alfke


On 31 May '08, at 9:40 AM, John Love wrote:


2008-05-31 12:33:55.434 Calculate Medical[1926:10b] *** -[NSAlert
endErrorSheet:code:info:]: unrecognized selector sent to instance  
0x16ed20


That's an exception being thrown. There's no such (public) Cocoa  
method -endErrorSheet:code:info:, so is this a method you defined, or  
are passing as a selector? It doesn't appear in the code you posted,  
but is it elsewhere in your app?


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Possible Bug in NSFileManager -moveItemAtPath:toPath:error:

2008-05-31 Thread Jens Alfke


On 31 May '08, at 9:27 AM, Jonathan Dann wrote:

Just a quick one.  I would expect renaming a file named HELLO.TXT to  
hello.txt (or another variant where the case of a few letters  
change) with -moveItemAtPath:toPath:error: to be allowed. As it is  
not (it generates an NSFileWriteUnknownError) is this a bug or just  
me?


That ought to work, even on HFS+. (It's not a no-op, because HFS+  
preserves the case of filenames, so getting the directory contents  
will return the name in its new case.)



If not, is there are more appropriate API for renaming files?


Try using the system call "rename". (Use "man 2 rename" to see the  
documentation.)
Call -fileSystemRepresentation on your path strings to convert them to  
appropriate C strings.


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: runloops and NSURLConnection

2008-05-31 Thread Torsten Curdt

On May 31, 2008, at 18:55, Jens Alfke wrote:

On 31 May '08, at 8:07 AM, Torsten Curdt wrote:

I think you want to schedule the connection for the  
NSModalPanelRunLoopMode runloop mode.  This is the mode that is  
used for modal windows.


You mean with scheduleInRunLoop:forMode: ? ...but that's only  
available since 10.5


I don't know of a good alternative that's 10.4-compatible, short of  
running the NSURLConnection on a background thread with its own  
runloop.


OK ..so at least it was a real shortcoming and not me fighting the  
framework again.


What about my current solution with the run loop? Does it smell really  
bad ...or is the workaround OK as well?


But have you considered _not_ using a modal panel? IMHO, modal  
panels are a "UI smell", to coin a phrase. Does it really need to be  
impossible for the user to interact in any other way with the app  
while that panel is open? Usually a sheet will suffice, and sheets  
don't use a special runloop mode, so that would solve your problem.


Indeed - modal is smelly  ...and I have considered non-modal. It would  
make my life easier. But since I have just integrated your exception  
handling into the FeedbackReporter framework ...wouldn't you expect  
the dialog that pops up in case of an uncaught exception to be modal?


cheers
--
Torsten
___

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: RESTful API's - Easy way to interact?

2008-05-31 Thread Jens Alfke


On 31 May '08, at 9:31 AM, Peter Burtis wrote:

Question: Is there a way to set the credentials before you initiate  
the request?  Or a way to force the request to use credentials even  
if the site doesn't return an Authentication Required response? I  
can't find one.


IIRC, there isn't one. I seem to remember this coming up in hallway  
discussions once or twice (my office used to be next door to the  
CFNetwork team.)


A) Some REST APIs never return the Authentication Required header,  
they just fail, or return different data, without credentials  
included, and then the callback never gets called.


That sounds like incorrect behavior for the server, especially if it  
returns the wrong error code or omits the header. But that doesn't  
help you if you don't control the server...


B) IIRC, if an item for the site/realm you're authenticating exists  
in the keychain, it is always used and your class never hears about  
or has any say in authentication at all.  There have been times when  
using the name/password set by the user in Safari has not been  
appropriate for my use.


True. I don't know of a way around this.

C) When there is a password set in the keychain, and it's wrong for  
whatever reason, NSURLConnection behaves strangely for me.  The  
connection:didReceiveAuthenticationChallenge: doesn't get called at  
all, and I just get a loop of requests to access the keychain which  
seemingly never ends.


This doesn't ring a bell with me. If you have a reproducible case, you  
should file a bug report.


D) If you set your credentials as  
NSURLCredentialPersistenceForSession, then you're stuck with only  
using one set of credentials for each authentication realm.  There  
have been plenty of times when I've needed to use different  
credentials in the same realm.  (Handling multiple user accounts  
from one app, mostly.)  Or am I misunderstanding the word session in  
this context?


I definitely remember hallway conversations about this, because it's  
caused trouble for PubSub in a few cases. Mac.com happens to be one of  
the domains that where you can hit this — they use one realm for the  
entire site, regardless of username, so if you happen to have  
credentials for two .mac accounts in your Keychain, CFNetwork can  
sometimes choose the wrong one, causing the request to fail.


You should bring this up on the macnetworkprog mailing list — the  
implementation of this stuff is in CFNetwork, and I don't think any of  
the CFNetwork engineers read this list, because many of them aren't  
Cocoa programmers.


I think there's a need for some additional API on NSURLConnection to  
provide finer-grained control over authentication. In particular,
(1) Ability to set credentials on the request before starting the  
connection

(2) Ability to disable the connection from looking in the Keychain

—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Alert Sheets hard wired in Interface Builder

2008-05-31 Thread Keary Suska
5/31/08 10:40 AM, also sprach [EMAIL PROTECTED]:

> - (void) endCalculateSheet:(NSWindow*)theSheet code:(int)returnCode
> info:(void*)contextInfo {
> if (returnCode == NSAlertDefaultReturn) { // "Good Bye!"
> 
> NSLog(@"Default Button clicked"); // does not log this entry
> 
> }
> 
> [theSheet close];
> }

If you didn't create the sheet with
+alertWithMessageText:defaultButton:alternateButton:otherButton:informativeT
extWithFormat:, then you would not get that constant. Read the NSAlert API
reference, especially -addButtonWithTitle:

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


___

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: runloops and NSURLConnection

2008-05-31 Thread Michael Vannorsdel
I saw you using that in your included code so I thought you were ok  
with it.  For Tiger I can only suggest using secondary thread  
processing as the cleanest approach.  Or you can reconsider using a  
modal window.



On May 31, 2008, at 9:07 AM, Torsten Curdt wrote:

You mean with scheduleInRunLoop:forMode: ? ...but that's only  
available since 10.5


___

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: runloops and NSURLConnection

2008-05-31 Thread Jens Alfke


On 31 May '08, at 8:07 AM, Torsten Curdt wrote:

I think you want to schedule the connection for the  
NSModalPanelRunLoopMode runloop mode.  This is the mode that is  
used for modal windows.


You mean with scheduleInRunLoop:forMode: ? ...but that's only  
available since 10.5


I don't know of a good alternative that's 10.4-compatible, short of  
running the NSURLConnection on a background thread with its own runloop.


But have you considered _not_ using a modal panel? IMHO, modal panels  
are a "UI smell", to coin a phrase. Does it really need to be  
impossible for the user to interact in any other way with the app  
while that panel is open? Usually a sheet will suffice, and sheets  
don't use a special runloop mode, so that would solve your problem.


—Jens



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Alert Sheets hard wired in Interface Builder

2008-05-31 Thread John Love
More NSLog data:


2008-05-31 12:33:51.001 Calculate Medical[1926:10b] NSWindow does not
support utility styleMask 0x10
2008-05-31 12:33:51.023 Calculate Medical[1926:10b] NSWindow does not
support utility styleMask 0x10

2008-05-31 12:33:55.434 Calculate Medical[1926:10b] *** -[NSAlert
endErrorSheet:code:info:]: unrecognized selector sent to instance 0x16ed20
2008-05-31 12:33:55.438 Calculate Medical[1926:10b] *** -[NSAlert
endErrorSheet:code:info:]: unrecognized selector sent to instance 0x16ed20


I put back:

didEndSelector:@selector(endCalculateSheet:code:info:) into:

[calculateSheet beginSheetModalForWindow:docWindow modalDelegate:nil
  didEndSelector:@selector(endCalculateSheet:code:info:)
  contextInfo:docWindow];

and here's the selector method:

- (void) endCalculateSheet:(NSWindow*)theSheet code:(int)returnCode
info:(void*)contextInfo {
if (returnCode == NSAlertDefaultReturn) { // "Good Bye!"

NSLog(@"Default Button clicked"); // does not log this entry

}

[theSheet close];
}

John Love
___

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: Possible Bug in NSFileManager -moveItemAtPath:toPath:error:

2008-05-31 Thread Torsten Curdt


On May 31, 2008, at 18:27, Jonathan Dann wrote:


Hi Guys,

Just a quick one.  I would expect renaming a file named HELLO.TXT to  
hello.txt (or another variant where the case of a few letters  
change) with -moveItemAtPath:toPath:error: to be allowed.  As it is  
not (it generates an NSFileWriteUnknownError) is this a bug or just  
me?  If not, is there are more appropriate API for renaming files?


Have you tried:

HELLO.TXT -> something
something -> hello.txt

Just a thought maybe it's related to the filesystem no being case- 
sensitive.


cheers
--
Torsten
___

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: RESTful API's - Easy way to interact?

2008-05-31 Thread Peter Burtis
Question: Is there a way to set the credentials before you initiate  
the request?  Or a way to force the request to use credentials even if  
the site doesn't return an Authentication Required response? I can't  
find one.


And because of this I've ended up rolling my own Authentication scheme  
for REST calls as Jeremy describes more than once.  Here are the  
issues that have made me do it:


A) Some REST APIs never return the Authentication Required header,  
they just fail, or return different data, without credentials  
included, and then the callback never gets called.


B) IIRC, if an item for the site/realm you're authenticating exists in  
the keychain, it is always used and your class never hears about or  
has any say in authentication at all.  There have been times when  
using the name/password set by the user in Safari has not been  
appropriate for my use.


C) When there is a password set in the keychain, and it's wrong for  
whatever reason, NSURLConnection behaves strangely for me.  The  
connection:didReceiveAuthenticationChallenge: doesn't get called at  
all, and I just get a loop of requests to access the keychain which  
seemingly never ends.


D) If you set your credentials as  
NSURLCredentialPersistenceForSession, then you're stuck with only  
using one set of credentials for each authentication realm.  There  
have been plenty of times when I've needed to use different  
credentials in the same realm.  (Handling multiple user accounts from  
one app, mostly.)  Or am I misunderstanding the word session in this  
context?


E) If, on the other hand, you set credentials as  
NSURLCredentialPersistenceNone, my understanding of it is that every  
request you send ends up actually generating two HTTP requests and,  
assuming the remote site doesn't allow keep-alive connections, two  
connections--one to discover that authentication is necessary, and  
another with the correct credentials.  Depending on the frequency of  
requests, that's a lot of overhead.


I just end up setting the header before the request goes out, which  
seems easy enough.  Is there a preferred way of handling this?


-Pete

On May 31, 2008, at 11:04 AM, Jeremy wrote:

Jens,

Thanks for that bit. And I am a native english speaker. It was late  
when I typed that. :D But Thanks for NSURLConnection suggestion and  
will look into it.


Jeremy

"I have often felt that programming is an art form, whose real value  
can only be appreciated by another versed in the same arcane art;  
there are lovely gems and brilliant coups hidden from human view and  
admiration, sometimes forever, by the very nature of the process.  
You can learn a lot about an individual just by reading through his  
code, even in hexadecimal." - Unknown


On May 31, 2008, at 2:50 AM, Jens Alfke wrote:



On 30 May '08, at 7:16 PM, Jeremy wrote:

Now, I need to figure out how to use set GET, but I think that is  
working. The problem and it is crashing is because it is being  
encoded by every other method.


What? That sentence was incomprehensible. Apologies if you're not a  
native English speaker, but if we can't understand your  
descriptions we can't help you...



Here is an example in "pseudo code":
'Basic ' + Base64.encode(username + ':' + password)


Don't try to roll your own authentication code. NSURLConnection  
already supports authentication, including digest mode and Keychain  
integration. Read the documentation on the delegate methods,  
including the authentication-related ones.


—Jens


___

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/pete 
%40glossysheep.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]


Possible Bug in NSFileManager -moveItemAtPath:toPath:error:

2008-05-31 Thread Jonathan Dann

Hi Guys,

Just a quick one.  I would expect renaming a file named HELLO.TXT to  
hello.txt (or another variant where the case of a few letters change)  
with -moveItemAtPath:toPath:error: to be allowed.  As it is not (it  
generates an NSFileWriteUnknownError) is this a bug or just me?  If  
not, is there are more appropriate API for renaming files?


Thanks,

Jon

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

USB drive

2008-05-31 Thread Толя Макаров
HI.
Obj-C, Cocoa.
1) How to mount USB drive from folder /dev/ by means of API?
FSMountServerVolumeSync, FSMountLocalVolumeSync, other method. Utilits
are not used. Please example.
2) Why USB drive is not mounted when the screensaver is on?


  
Вы уже с 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: Alert Sheets hard wired in Interface Builder

2008-05-31 Thread John Love
On Fri, May 30, 2008 at 3:33 PM, John Love
<[EMAIL PROTECTED]<[EMAIL PROTECTED]>>
wrote:

> Here's some code snippets that I'm having problems with .. the code is
> sorta working in that an alert *window* appears, but not as a drop-down
> sheet as I think the following calls for: (and even when erroneously a
> window, it is behind the main document window)
>
> Two controllers .. FileController and SheetController ..
>
> 1) FileController.h contains
>IBOutlet SheetController *theSheet;  .. and ..  NSWindow
> *itsWindow; (FileController's itsWindow gets set within MyDocument.m which
> passes its IBOutlet NSWindow *documentWindow to a method of
> FileController)   As a result, MyDocument's documentWindow becomes
> FileController's itsWindow
>
> 2) FileController.m contains
>[theSheet showCalculateSheet:itsWindow];
>
> 3) SheetController.h contains
>- (void) showCalculateSheet:(NSWindow*)docWindow;
>
> 4) SheetController.m contains
>
> - (void) showCalculateSheet:(NSWindow*)docWindow {
> NSAlert *calculateSheet = [[[NSAlert alloc] init] autorelease];
>
> [calculateSheet addButtonWithTitle:@"Continue"];
> [calculateSheet addButtonWithTitle:@"Stop and save"];
> [calculateSheet addButtonWithTitle:@"Stop and don't save"];
> [calculateSheet setMessageText:@"You have not finished calculating
> your Spreadsheet.\n"
> "Do you wish to continue
> calculating?"];
> [calculateSheet setAlertStyle:NSWarningAlertStyle];
>
> [calculateSheet beginSheetModalForWindow:docWindow modalDelegate:nil
>   didEndSelector:nil   //
> @selector(endCalculateSheet:code:info:)
>   contextInfo:nil];
> }
>
> // *if* I use a real selector method, and not nil, I cannot dismiss the
> alert
>
> - (void) endCalculateSheet:(NSWindow*)theSheet code:(int)returnCode
> info:(void*)contextInfo {
>
> if (returnCode == NSAlertDefaultReturn)  { // "Continue"
>
> } else if (returnCode == NSAlertOtherReturn) { // "Stop and save"
>
> } else if (returnCode == NSAlertAlternateReturn) { // "Stop and don't
> save"
>
> }
>
> [theSheet orderOut:self];
>
> }
>
> Thanks for everything in advance ..
>
> John Love
>
>
>
Jens wrote:

My guess is that docWindow is nil. Set a breakpoint and check.

But follow-ups should go to the list.

John wrote back

if (docWindow != nil)   NSLog(@"passed window is not nil");

produced the log string.


Touch the Future! Teach!!
___

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: runloops and NSURLConnection

2008-05-31 Thread Torsten Curdt

On May 31, 2008, at 16:09, Michael Vannorsdel wrote:

I think you want to schedule the connection for the  
NSModalPanelRunLoopMode runloop mode.  This is the mode that is used  
for modal windows.


You mean with scheduleInRunLoop:forMode: ? ...but that's only  
available since 10.5


cheers
--
Torsten
___

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: RESTful API's - Easy way to interact?

2008-05-31 Thread Jeremy

Jens,

Thanks for that bit. And I am a native english speaker. It was late  
when I typed that. :D But Thanks for NSURLConnection suggestion and  
will look into it.


Jeremy

"I have often felt that programming is an art form, whose real value  
can only be appreciated by another versed in the same arcane art;  
there are lovely gems and brilliant coups hidden from human view and  
admiration, sometimes forever, by the very nature of the process. You  
can learn a lot about an individual just by reading through his code,  
even in hexadecimal." - Unknown


On May 31, 2008, at 2:50 AM, Jens Alfke wrote:



On 30 May '08, at 7:16 PM, Jeremy wrote:

Now, I need to figure out how to use set GET, but I think that is  
working. The problem and it is crashing is because it is being  
encoded by every other method.


What? That sentence was incomprehensible. Apologies if you're not a  
native English speaker, but if we can't understand your descriptions  
we can't help you...



Here is an example in "pseudo code":
'Basic ' + Base64.encode(username + ':' + password)


Don't try to roll your own authentication code. NSURLConnection  
already supports authentication, including digest mode and Keychain  
integration. Read the documentation on the delegate methods,  
including the authentication-related ones.


—Jens


___

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: Opening column for edit after adding to tree controller?

2008-05-31 Thread I. Savant

On May 31, 2008, at 4:27 AM, Rick Mann wrote:

After adding a new entity to my tree controller, how can I  
programmatically open the first column (a text cell)


  Again, this is confusing - "entity" is not the same as "instance".  
Also, I assume by 'column' you mean that of a table view or outline  
view.


for editing and select the contents, so that it's easy to create a  
new entity and start editing the values?


  NSTableView and NSOutlineView have a method - 
editColumn:row:withEvent:select: ... Make sure your tree controller  
has fetched and rearranged its objects (and if your view is an outline  
view, the corresponding "item" for your new instance is fully  
expanded), then call the -editColumn:row:withEvent:select: method.


--
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: Defaulting new entity fields to be same as current selection?

2008-05-31 Thread I. Savant

On May 31, 2008, at 3:51 AM, Rick Mann wrote:

I've got an NSTreeController and associated view. I use - 
awakeFromInsert to set default values for the entities created as a  
result of calling -add.


  That's a good place to do that ...

I'd like for one of the fields to take on the same value as the  
currently-selected entity.


  Okay, that's controller-layer-level logic and perfectly reasonable  
(ie, any serious app using Bindings is likely to need to do that at  
some point). Point of order, though - "selected instance", not  
"selected entity". The distinction is important though the mistake is  
easily interpreted in this context.



Can I get at that from within -awakeFromInsert?


  Yes, through some incredible acrobatics, you probably could, but  
then that would be like walking right up to the MVC design pattern and  
b**ch-slapping it right in the face. ;-)


  The model layer is *not* where this belongs. Why should some  
instance of your Foo entity care about whether some other instance is  
selected in some random controller? That kind of logic belongs in the  
controller layer. A controller is in the best position to know what's  
selected and what should happen when a new instance of Foo is created.



Must I create my own -add?


  Yes. The best place to put this custom -add: action is up to you  
and your design (as long as it's in a controller), but  
NSObjectController (such as NSArrayController or NSTreeController) in  
charge of the Foo instances, I'd do it this way:


1 - Place your user-level action (what's fired as a result of a button  
or menu action when the user wants to add a Foo) in some primary  
controller. This would be your app controller if it's a "Cocoa  
Application" or your [persistent] document controller if it's a "Cocoa  
[Core Data] Document-Based Application". If it's a top-level user  
interface action, a good design (IMO) is to have all user actions  
funnel through one controller for clarity (to the developer).


2 - In a custom NSTreeController subclass specifically suited to all  
the "library management" of your Foo instances, create a custom - 
addFooWithNameOfSelectedFoo method (also gives clarity) that is called  
by your user-level -add: action. This method simply asks "self" for  
the currently selected Foo instance, then creates and modifies the new  
Foo instance to taste. This Foo-centric NSTreeController contains all  
the logic for dealing with your Foo objects, such as - 
allFoosBelongingToBar: or -removeFoosOlderThanDate: or -fooWithID:  
etc. In this way, it's now your "Foo Library Manager" and when it  
comes to Foos, it knows best.


--
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: Changing button title based on single or multiple selection?

2008-05-31 Thread I. Savant


I have a button "Print Label". I would like it to say "Print Labels"  
when more than one label is selected in the Tree Controller view. Is  
it possible to do this with Alt. Titles and bindings in IB? Or must  
I write code?


  Since Stephen's value transformer reply answers your question from  
the technical how-to standpoint, I'll take the usability side.


  This is probably not the best direction. Your UI should communicate  
that the "Print" button (the verb) applies to the "Labels" (the noun).  
"Print" directly applies to the selected "Label" or "Labels" and the  
button should not change simply because the selection is plural, nor  
should it have the noun in its title.


  If your label list and print buttons are mixed in visually with  
other elements of the interface, making it unclear what "print" means  
in that context (because there are several things that can be  
"print"ed that are printed differently in the same general area),  
"You're [probably] doing it wrong.™" in terms of UI design.


  Just my humble Idiot Opinion. Do with it what you will.

--
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: runloops and NSURLConnection

2008-05-31 Thread Michael Vannorsdel
I think you want to schedule the connection for the  
NSModalPanelRunLoopMode runloop mode.  This is the mode that is used  
for modal windows.



On May 31, 2008, at 7:28 AM, Torsten Curdt wrote:


A bit puzzled ...seems like I need some advise here.

From a NSWindowController I create a modal dialog

 [NSApp runModalForWindow:[self window]];

On a button click I am trying to use NSURLConnection to do retrieve  
information in a asynchronous fashion


 connection = [[NSURLConnection alloc] initWithRequest:request  
delegate:self];


Unfortunately this only works when I afterwards enter this runloop

   NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
   while(!terminated) {
   if (![[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode  
beforeDate:[NSDate dateWithTimeIntervalSinceNow:10]]) {

   break;
   }
   [pool release];
   pool = [[NSAutoreleasePool alloc] init];
   }
   [pool release];

(the connectionDidFinishLoading:/connection:didFailWithError:  
terminates the above loop)


Now I am a bit surprised. Shouldn't runModalForWindow: do pretty  
much the same thing? The documentation states


"By default, for the connection to work correctly the calling  
thread’s run loop must be operating in the default run loop mode.  
See scheduleInRunLoop:forMode: to change the runloop and mode."


But I am a bit lost what to do with that information. I would assume  
that


scheduleInRunLoop:[NSRunLoop currentRunLoop]  
forMode:NSDefaultRunLoopMode


is the default anyway. Nevertheless I am targeting 10.4 and this is  
only available since 10.5.


I found this response from Fraser

http://lists.apple.com/archives/aperture-dev/2008/Feb/msg00036.html

...but I would like to understand the "why". Do I really have to  
spawn another thread for this? Or is it OK to process the run loop  
like shown above? I have the feeling I am somehow fighting the  
framework again here.


Comments?

cheers
--
Torsten___

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/mikevann%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: Displaying current time using NSCalenderDAte

2008-05-31 Thread Andreas Mayer


Am 31.05.2008 um 13:22 Uhr schrieb haresh vavdiya:


NSCalendarDate *currentTime = [[NSCalendarDate alloc]
initWithTimeIntervalSinceReferenceDate:00];


Since you specified a time interval of zero (one '0' is enough; it's  
just an integer), this will give you 1 January 2001, as stated by the  
documentation for -initWithTimeIntervalSinceReferenceDate:.


To get the current date you use

NSCalendarDate *currentDate = [NSCalendarDate calendarDate];


 int minuteInc = (minute>=0 ? minute-[currentTime
minuteOfHour] : 0);
 int hourInc = (hour>=0 ? hour-[currentTime  
hourOfDay] :

0);
 [self incrementHour: hourInc andMinute:minuteInc];
 [self time];


I have no idea what you are trying to do here ...


Andreas
___

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]


runloops and NSURLConnection

2008-05-31 Thread Torsten Curdt

A bit puzzled ...seems like I need some advise here.

From a NSWindowController I create a modal dialog

  [NSApp runModalForWindow:[self window]];

On a button click I am trying to use NSURLConnection to do retrieve  
information in a asynchronous fashion


  connection = [[NSURLConnection alloc] initWithRequest:request  
delegate:self];


Unfortunately this only works when I afterwards enter this runloop

NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
while(!terminated) {
if (![[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode  
beforeDate:[NSDate dateWithTimeIntervalSinceNow:10]]) {

break;
}
[pool release];
pool = [[NSAutoreleasePool alloc] init];
}
[pool release];

(the connectionDidFinishLoading:/connection:didFailWithError:  
terminates the above loop)


Now I am a bit surprised. Shouldn't runModalForWindow: do pretty much  
the same thing? The documentation states


"By default, for the connection to work correctly the calling thread’s  
run loop must be operating in the default run loop mode. See  
scheduleInRunLoop:forMode: to change the runloop and mode."


But I am a bit lost what to do with that information. I would assume  
that


 scheduleInRunLoop:[NSRunLoop currentRunLoop]  
forMode:NSDefaultRunLoopMode


is the default anyway. Nevertheless I am targeting 10.4 and this is  
only available since 10.5.


I found this response from Fraser

http://lists.apple.com/archives/aperture-dev/2008/Feb/msg00036.html

...but I would like to understand the "why". Do I really have to spawn  
another thread for this? Or is it OK to process the run loop like  
shown above? I have the feeling I am somehow fighting the framework  
again here.


Comments?

cheers
--
Torsten___

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]


Displaying current time using NSCalenderDAte

2008-05-31 Thread haresh vavdiya
Hi Friends,

  I have successfully get current time but now i want to to digital
clock but for that i need to have current minute and hours, so how can i get
this?

 I found some method of NSCalenderDate which give us hours and
minutes i can't get current time and date it display 2001 jan 1

  my code is

  NSCalendarDate *currentTime = [[NSCalendarDate alloc]
initWithTimeIntervalSinceReferenceDate:00];
  int minuteInc = (minute>=0 ? minute-[currentTime
minuteOfHour] : 0);
  int hourInc = (hour>=0 ? hour-[currentTime hourOfDay] :
0);
  [self incrementHour: hourInc andMinute:minuteInc];
  [self time];



for current time and date we have to gice one arguments intead of 00 so
that we can get curretn time but i have tried many digit but i can't proper
output,
if anyone knoe please guide me
___

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: KVO: I get called on change, but then can't get the object

2008-05-31 Thread Jonathan del Strother
On Sat, May 31, 2008 at 10:03 AM, Hamish Allan <[EMAIL PROTECTED]> wrote:
> On Sat, May 31, 2008 at 8:48 AM, Rick Mann <[EMAIL PROTECTED]> wrote:
>>
>> On May 31, 2008, at 00:32:30, j o a r wrote:
>>
>>> Search for "NSKeyValueObservingOptionNew" here:
>>
>> Already using that:
>
> Read it again:
>
> "The change dictionary doesn't contain old and new values. This is not
> your fault, it's due to a bug in the controller. This bug will not be
> fixed in the forseeable future."
>
> Can mmalc or anyone else give an explanation of why not?
>

I could've sworn that was fixed in Leopard, actually.   Anyone tried it?
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Finding the largest value in an NSTreeController?

2008-05-31 Thread Jonathan Dann
To get all the nodes in the tree I do a depth-first search (10.5  
only). Add the first method in an NSTreeNode category  and the second  
to a category on NSTreeController.


// NSTreeNode_Extensions
- (NSArray *)descendants;
{
NSMutableArray *array = [NSMutableArray array];
for (NSTreeNode *item in [self childNodes]) {
[array addObject:item];
if (![item isLeaf])
[array addObjectsFromArray:[item descendants]];
}
return [[array copy] autorelease];
}

// NSTreeController_Extensions
- (NSArray *)flattenedNodes;
{
NSMutableArray *array = [NSMutableArray array];
for (NSTreeNode *node in [self rootNodes]) {
[array addObject:node];
if (![[node valueForKey:[self leafKeyPath]] boolValue])
[array addObjectsFromArray:[node 
valueForKey:@"descendants"]];
}
return [[array copy] autorelease];  
}

You then have an NSArray with all of the NSTreeNodes and can just call  
[treeNodesArray valueForKey:@"representedObject"] to get you model  
objects, and then can do whatever you like.  If you're using Core  
Data, can't you fetch all your managed objects and determine the one  
with the max vaule?


Jon

On 31 May 2008, at 10:35, Rick Mann wrote:

I'd like to find the largest integer value of one of my entity  
fields, stored in an NSTreeController. Is this possible? I'm trying  
to use "@max", but getting back null on every variant:


	NSNumber* maxVal = [mItemsController valueForKeyPath:  
@"@max.number"];


I also tried with "arrangedOBjects".

I can't even figure out how to manually iterate the objects. Is  
there a way?


TIA,
--
Rick

___

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/j.p.dann%40gmail.com

This email sent to [EMAIL PROTECTED]




smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Finding the largest value in an NSTreeController?

2008-05-31 Thread Rick Mann
I'd like to find the largest integer value of one of my entity fields,  
stored in an NSTreeController. Is this possible? I'm trying to use  
"@max", but getting back null on every variant:


NSNumber* maxVal = [mItemsController valueForKeyPath: @"@max.number"];

I also tried with "arrangedOBjects".

I can't even figure out how to manually iterate the objects. Is there  
a way?


TIA,
--
Rick

___

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: KVO: I get called on change, but then can't get the object

2008-05-31 Thread Hamish Allan
On Sat, May 31, 2008 at 8:48 AM, Rick Mann <[EMAIL PROTECTED]> wrote:
>
> On May 31, 2008, at 00:32:30, j o a r wrote:
>
>> Search for "NSKeyValueObservingOptionNew" here:
>
> Already using that:

Read it again:

"The change dictionary doesn't contain old and new values. This is not
your fault, it's due to a bug in the controller. This bug will not be
fixed in the forseeable future."

Can mmalc or anyone else give an explanation of why not?

Hamish
___

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: Problem in continuing display time

2008-05-31 Thread Nathan Kinsinger


On May 31, 2008, at 2:01 AM, haresh vavdiya wrote:


Hi Friends,

   I have got current system time but it is not refreshed  
automatically
means whenever i run the application it will give me cuurent time  
but then
after i have to again refresh my application then it display current  
time.

But i want to do it display time like digital clock.

So what should i do?

Please guide me.

Haresh.


There is a sample cocoa project at /Developer/Examples/AppKit/ 
ClockControl that may give you some insight into what you need to do.


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


Opening column for edit after adding to tree controller?

2008-05-31 Thread Rick Mann
After adding a new entity to my tree controller, how can I  
programmatically open the first column (a text cell) for editing and  
select the contents, so that it's easy to create a new entity and  
start editing the values?


TIA,
--
Rick

___

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: Weird NSInvocationOperation init behavior

2008-05-31 Thread Michael Vannorsdel

If you method is something like:

- (void)func1

then you should use @selector(func1) without the colon.


On May 31, 2008, at 2:06 AM, Markus Spoettl wrote:


 NSInvocationOperation *theOp = [[NSInvocationOperation alloc]
  initWithTarget:self
selector:@selector(func1:)
  object:nil];


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Problem in continuing display time

2008-05-31 Thread Mike Abdullah
Keeping the clock display updated is not Cocoa's responsibility; it is  
yours. I would personally suggest that after each update of the  
display you set a timer for when the next update is due.


On 31 May 2008, at 09:01, haresh vavdiya wrote:


Hi Friends,

   I have got current system time but it is not refreshed  
automatically
means whenever i run the application it will give me cuurent time  
but then
after i have to again refresh my application then it display current  
time.

But i want to do it display time like digital clock.

So what should i do?

Please guide me.

Haresh.
___

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: warning: 'NSEntityDescription' may not respond to

2008-05-31 Thread Chris Hanson

On May 30, 2008, at 11:16 AM, Fritz Anderson wrote:


On 30 May 2008, at 4:17 AM, Steven Hamilton wrote:

Also, any warnings or errors I get in xcode appear twice in the  
bubbles. Anyone know why that is?


By default, new Xcode projects are set to the "Release"  
configuration (because all software is ready to release when you  
begin coding it. That's sarcasm.).


There's a pop-up labeled "default configuration" in the Configurations  
tab of the project info window.  As I'm sure you know, this sets the  
configuration used when building your project via xcodebuild without  
any configuration specified, e.g. when you just cd to a directory  
containing an Xcode project and type "xcodebuild" in Terminal.


If it does not also set the configuration users saw when they first  
opened a project, one might argue that it's broken, because that's  
what users who don't use xcodebuild from the command line may  
interpret "default" to mean.


In that configuration, Xcode compiles and links the application  
twice, once for Intel and once for PowerPC. Two compilations, same  
error, two reports of the error.


Keep in mind as well that the Release configuration is not "special" -  
it just has the appropriate build settings to build two-way Universal.


One place where this is actually really useful is when building four- 
way Universal.  You may get different errors and warnings when  
building for PowerPC 32-bit than when building for Intel 64-bit; for  
one thing, the latter has differently-sized "int" and "long" types.   
Similarly, if you're building for PowerPC with a deployment target of  
10.3, but for Intel with a deployment target of 10.4, you will get  
deprecation warnings for the latter architecture that don't apply to  
the former.


 -- Chris

___

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: super respondsToSelector

2008-05-31 Thread Michael Ash
On Sat, May 31, 2008 at 3:43 PM, j o a r <[EMAIL PROTECTED]> wrote:
>
> On May 31, 2008, at 12:23 AM, Michael Ash wrote:
>
>> Assume the following class hierarchy:
>>
>> A <- B <- C <- D <- E
>>
>> In the implementation of B, you write [self superclass]. Now your
>> method executes with self set to an instance of E. What do you get?
>
>
> I would propose that you should re-examine your design if you find that to
> be a problem in practice:
>
>

As has been noted, this is a common problem in AppKit code. It happens
any time you subclass a subclass of NSView and implement
-awakeFromNib. If you then subclass that subclass (something which
doesn't smell to me even a little bit) then the naive solution breaks
badly.

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]


Weird NSInvocationOperation init behavior

2008-05-31 Thread Markus Spoettl

Hello List,

  I just came across a strange thing with initializing an  
NSInvocationOperation object that I wanted to share and see if this is  
a bug in either the docs or the framework:


I had this

NSInvocationOperation *theOp = [[NSInvocationOperation alloc]
   initWithTarget:self
 selector:@selector(func1:)
   object:nil];

func1 is a parameter-less method of self. The docs state that  
selector: can either have 0 or 1 parameters, in case of 0 object has  
to be nil. That's the case. However, the initialization always failed  
and theOp was nil when after the call. I had a feeling something  
wasn't right and tried this:


NSInvocationOperation *theOp = [[NSInvocationOperation alloc]
   initWithTarget:self
 selector:@selector(func2:)
   object:anObject];

func2 had 1 parameter (type id). Voila, it worked.

The question is, was this my fault?

Regards
Markus
--
__
Markus Spoettl



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: super respondsToSelector

2008-05-31 Thread Ken Thomases

On May 31, 2008, at 2:43 AM, j o a r wrote:


On May 31, 2008, at 12:23 AM, Michael Ash wrote:


Assume the following class hierarchy:

A <- B <- C <- D <- E

In the implementation of B, you write [self superclass]. Now your
method executes with self set to an instance of E. What do you get?



I would propose that you should re-examine your design if you find  
that to be a problem in practice:





Using [self superclass] is wrong.  The hierarchy with five levels may  
or may not be a problem, but [self superclass] is still wrong even in  
a hierarchy with 3 levels (even if "A" is NSObject, as is typical).


If your class may be subclassed, then [[self superclass]  
instancesRespondToSelector:aSelector] may blow up in your face.


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


Problem in continuing display time

2008-05-31 Thread haresh vavdiya
Hi Friends,

I have got current system time but it is not refreshed automatically
means whenever i run the application it will give me cuurent time but then
after i have to again refresh my application then it display current time.
But i want to do it display time like digital clock.

 So what should i do?

Please guide me.

Haresh.
___

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]


Defaulting new entity fields to be same as current selection?

2008-05-31 Thread Rick Mann
I've got an NSTreeController and associated view. I use - 
awakeFromInsert to set default values for the entities created as a  
result of calling -add. I'd like for one of the fields to take on the  
same value as the currently-selected entity. Can I get at that from  
within -awakeFromInsert? Must I create my own -add?


TIA,
--
Rick

___

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: KVO: I get called on change, but then can't get the object

2008-05-31 Thread Rick Mann


On May 31, 2008, at 00:32:30, j o a r wrote:


Search for "NSKeyValueObservingOptionNew" here:



Already using that:

[mItemsController addObserver: self
forKeyPath: @"selection.number"
options: (NSKeyValueObservingOptionNew)
context: NULL];


What happens if you call "-valueForKeyPath:" instead of "- 
valueForKey:"?


Argh! That works. I'm so used to the Java version that doesn't  
distinguish between a key and a path. Thanks!


--
Rick

___

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: super respondsToSelector

2008-05-31 Thread j o a r


On May 31, 2008, at 12:23 AM, Michael Ash wrote:


Assume the following class hierarchy:

A <- B <- C <- D <- E

In the implementation of B, you write [self superclass]. Now your
method executes with self set to an instance of E. What do you get?



I would propose that you should re-examine your design if you find  
that to be a problem in practice:




j o a r


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: KVO: I get called on change, but then can't get the object

2008-05-31 Thread j o a r


On May 31, 2008, at 12:21 AM, Rick Mann wrote:

I registered to observe changes in the "number" column of my tree  
controller:


[mItemsController addObserver: self
forKeyPath: @"selection.number"
options: (NSKeyValueObservingOptionNew)
context: NULL];

My -observe: action gets called, but this line

	NSLog(@"Value changed %@: %@ (%@)", inKeyPath, inChange, [inObject  
selection]);


dumps this to the console:

Value changed selection.number: {
   kind = 1;
   new = ;
} (<_NSControllerObjectProxy: 0x177cb0>)

Note that "new" is null. I would expect it to be the value of the  
number.



Search for "NSKeyValueObservingOptionNew" here:





Furthermore, this line:

NSLog(@"selection: %@", [inObject valueForKey: @"selection"]);

dumps:

selection: <_NSControllerObjectProxy: 0x177cb0>

But if I change it to @"selection.number", it throws the exception:

"[ valueForUndefinedKey:]: this class is  
not key value coding-compliant for the key selection.number."



What happens if you call "-valueForKeyPath:" instead of "-valueForKey:"?

j o a r


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: 10.5.3 Release Notes?

2008-05-31 Thread Georg Tuparev


On May 29, 2008, at 5:01 PM, Jens Alfke wrote:



On 29 May '08, at 7:48 AM, Sean McBride wrote:


If it was a show-stopper you filed a bug right?  All you need to do
therefore is email [EMAIL PROTECTED] and ask if bug #x is fixed in
10.5.3.  Presto.


In theory that will work. In practice, it's a waste of time for  
everyone to file duplicate bug reports of problems (like this one)  
that are already well-known and have been acknowledged many times on  
this list by developers and Apple engineers.


The underlying problem is that there's no way for a 3rd party  
developer to find the Radar bug number of a problem without filing  
their own duplicate of it and waiting for it to come back marked as  
a dup.


I can also imagine some scalability problems with Apple developer  
support having to manually answer every developer email asking about  
a bug-fix...


—Jens___



Jens,

My experience that goes back to the NeXT days tells me that it is not  
waste of time to file a bug report, even if you are absolutely sure it  
will be marked as a duplicate. First it will help Apple engineers to  
prioritize. And second, you can follow when the bug is fixed.


My rule is simple - if I find a bug that bytes me (or incorrect  
documentation) I am reporting it as if I was the first person in the  
Universe to discover it.


cheers

Georg Tuparev
Tuparev Technologies
Klipper 13
1186 VR Amstelveen
The Netherlands

___

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: super respondsToSelector

2008-05-31 Thread Michael Ash
On Sat, May 31, 2008 at 3:16 PM, j o a r <[EMAIL PROTECTED]> wrote:
>
> On May 31, 2008, at 12:10 AM, Michael Ash wrote:
>
>> If you're adventurous and foolish you can extract your superclass
>> without needing to hard-code any class names:
>>
>> #import 
>> ...
>> Class superclass = ((struct objc_super *)super)->class;
>>
>> But this is probably a poor idea to use in practice
>
>
> Why not simply:
>
>[[self superclass] instancesRespondToSelector:...]
>
> ?

Assume the following class hierarchy:

A <- B <- C <- D <- E

In the implementation of B, you write [self superclass]. Now your
method executes with self set to an instance of E. What do you get?

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]


KVO: I get called on change, but then can't get the object

2008-05-31 Thread Rick Mann
I registered to observe changes in the "number" column of my tree  
controller:


[mItemsController addObserver: self
forKeyPath: @"selection.number"
options: (NSKeyValueObservingOptionNew)
context: NULL];

My -observe: action gets called, but this line

	NSLog(@"Value changed %@: %@ (%@)", inKeyPath, inChange, [inObject  
selection]);



dumps this to the console:

Value changed selection.number: {
kind = 1;
new = ;
} (<_NSControllerObjectProxy: 0x177cb0>)

Note that "new" is null. I would expect it to be the value of the  
number.


Furthermore, this line:

NSLog(@"selection: %@", [inObject valueForKey: @"selection"]);

dumps:

selection: <_NSControllerObjectProxy: 0x177cb0>

But if I change it to @"selection.number", it throws the exception:

"[ valueForUndefinedKey:]: this class is  
not key value coding-compliant for the key selection.number."




From reading the docs:

"NSObjectController and its subclasses implement the selection method.  
This method returns a proxy object that represents the receiver’s  
current selection. The proxy is fully key-value-coding compliant.
When you request a key’s value from the selection proxy it returns the  
value, or a selection marker. Placeholder markers provide additional  
information about the selection. There are three placeholder markers  
defined in the NSPlaceholders informal protocol:"


It seems that I should be able to get the number from the selection,  
but instead I get the exception:


"[ valueForUndefinedKey:]: this class is  
not key value coding-compliant for the key selection.number."




I feel like I should be able to get the number. Elsewhere I read that  
I would get an array of numbers. What am I doing wrong?




TIA,




--
Rick

___

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: super respondsToSelector

2008-05-31 Thread j o a r


On May 31, 2008, at 12:10 AM, Michael Ash wrote:


If you're adventurous and foolish you can extract your superclass
without needing to hard-code any class names:

#import 
...
Class superclass = ((struct objc_super *)super)->class;

But this is probably a poor idea to use in practice



Why not simply:

[[self superclass] instancesRespondToSelector:...]

?

j o a r


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: super respondsToSelector

2008-05-31 Thread Michael Ash
On Sat, May 31, 2008 at 2:52 PM, Ken Thomases <[EMAIL PROTECTED]> wrote:
> To do what you want, you can use [MySuperClass
> instancesRespondToSelector:aSelector].  Note, you have to name the specific
> class you want to check.  You can't use [self superclass]  because that's
> dynamic -- the result from that may actually be deeper in the class
> hierarchy than the code you're writing.

Just as a minor nit, it's probably better to write [[MyClass
superclass] instancesRespondToSelector:...]. This variant will survive
if you re-target your superclass and forget to change what it depends
on. Both variants will still fail if you subject your code to
copypasta without sufficient vetting.

If you're adventurous and foolish you can extract your superclass
without needing to hard-code any class names:

#import 
...
Class superclass = ((struct objc_super *)super)->class;

But this is probably a poor idea to use in practice

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: super respondsToSelector

2008-05-31 Thread Ken Thomases

Responding to myself:

On May 31, 2008, at 1:52 AM, Ken Thomases wrote:
To do what you want, you can use [MySuperClass  
instancesRespondToSelector:aSelector].  Note, you have to name the  
specific class you want to check.  You can't use [self superclass]   
because that's dynamic -- the result from that may actually be  
deeper in the class hierarchy than the code you're writing.


I was reminded by some googling that a better thing to do, rather  
than naming your superclass explicitly ("MySuperClass" in my example)  
is to name your own class explicitly and use the +superclass method  
to find the superclass:


[[MyClass superclass] instancesRespondToSelector:aSelector]

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: super respondsToSelector

2008-05-31 Thread Jens Alfke


On 30 May '08, at 11:55 PM, Bill Bumgarner wrote:


On May 30, 2008, at 11:43 PM, Jens Alfke wrote:
If you actually want to ask a question of your class's superclass,  
you have to do so directly:

[[[self class] superclass] instancesRespondToSelector: aSelector]


Well... yeah... you *can* do that.

But *don't do that*.   (And I know Jens knows better -- I'm just  
pointing something out).


Any code that relies upon *skipping* super's implementation of  
something to get something done is just asking for trouble.


No, that's not what it's for. There are situations where you implement  
a method, and you want to call the superclass implementation ... but  
only if there _is_ one, since otherwise that would raise an exception.


This comes about with those @$&% "informal protocols" that pollute the  
namespace of NSObject. So for example, let's say I subclass  
NSFoobarControl and implement -awakeFromNib. Now, should I call [super  
awakeFromNib] first? If NSFoobarControl implements that method, then  
yes I'd damn better do so, otherwise I screw up the superclass's  
state. But if it doesn't, that super call will raise an exception.


One solution is to put in the 'super' call, and then try running your  
code. If that call blows up, take it out. That's really brittle,  
though, since who knows if NSFoobarControl will change in 10.6 to have  
an -awakeFromNib method? If it does, suddenly my app might crash on  
10.6, and that might be really hard to track down.


The only reasonable solution seems to be to do exactly what I said —  
check whether the superclass implements the method before calling it.


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]