NSTableColumn unbindable when NSSegmentedCell is used?

2008-10-28 Thread Mike Laurence
Hello,

I'm migrating a non-binding version of an NSTableView over to a binded
version. In the non-binding version (using a data source), one of my table
columns used a subclass of NSSegmentedCell, and I merely overrode
setObjectValue in order to capture the data and set the number of segments,
their labels, etc.

In the binded version, I have successfully converted all of the text field
cells - each NSTableColumn has a 'value' binding, which I set to
[controller.arrangedObjects.key], and I'm able to see all of my text data
just fine. However, the NSTableColumn containing my NSSegmentedCell subclass
mysteriously lacks a 'value' binding, and I'm unable to fathom how to set
the data inside of it.

Can anyone point me to the correct way to bind my arrangedObjects to those
NSSegmentedCells?

Thanks very much!

Regards,
Mike Laurence
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: inter-object communication

2008-10-28 Thread Charles Steinman
- Original Message 

> From: Albert Jordan <[EMAIL PROTECTED]>
> 
> What is the recommended way for Object B to inform Object A that it is  
> done processing a request for the following scenario?
> 
> Object A has a list of phone numbers to send SMS messages
> Object B implements sending an SMS message to a given phone number
I think a delegate is the usual Cocoa pattern for this kind of situation. You 
could have Object B send Object A an -objectB:didSendSMSMessage:toNumber: 
message or something along those lines.

Cheers,
Chuck



  
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: ASL & Unicode in Xcode's Console

2008-10-28 Thread Jason Coco


On Oct 29, 2008, at 00:29 , Adam R. Maxwell wrote:



On Oct 28, 2008, at 9:14 PM, Jason Coco wrote:



On Oct 28, 2008, at 16:53 , Sean McBride wrote:


On 10/28/08 4:03 PM, Jason Coco said:


Also, you should not be using non-ascii characters in string
literals :) hopefully you're just doing this to demonstrate the  
issue.

You should
be doing something like this:

char *hiragana_a = { 0xE3, 0x81, 0x82, 0x00 };
NSLog(@"%@", [NSString stringWithCString:a
encoding:NSUTF8StringEncoding]);


That is no longer necessary in 10.5 / Xcode 3.  You can use  
Unicode in

string literals in Objective-C.


Why do you say this? I thought that I may have missed something,  
but looking
back through all the documentation, all the warnings about only  
including 7-bit ASCII
characters in string literals still exist... even in the most  
recent updated documentation.


ISTR seeing this in the release notes somewhere, but can't find it  
now either.  Anyway, see


http://lists.apple.com/archives/Cocoa-dev/2008/Apr/msg01885.html


Well, I still can't find anything that says this other than somebody's  
statement on a mailing list... the three
most recently updated documents that apple put out dealing with  
strings all specifically say that string
literals (CFStringRef, NSConstantString and c style string constants)  
all must be 7-bit ascii encoded
or they may not work at all times, even if they appear to work for  
you. Since GCC itself is still struggling
with this, I'm just gonna go with those documents until I see them  
change or see something more
prominent come out from Apple. By the way, I also dug through the  
source for the gcc 4.0.1 compiler
that's used by default with Xcode 3.0 and there was nothing about this  
change in the apple change logs
or any of the other change logs or files that I could find. I didn't  
bother looking through the 4.2 stuff

since most people are probably not even using it yet :)



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: Problem with NSData to NSString to NSData

2008-10-28 Thread Rob Keniger

On 29/10/2008, at 2:43 PM, Joel Norvell wrote:


I have a file with some metadata prepended to a pdf.

I want to strip the metadata off and display the pdf.

I was trying to do this:

- (void) loadFromPath: (NSString *) path
{
 NSData *myData = [NSData dataWithContentsOfFile:path];

 NSString *myStr = [[NSString alloc] initWithData:pdfData
 encoding:NSASCIIStringEncoding];

 // I strip off the metadata here, leaving the pdfStr.

 // Nothing I've tried here has worked:
 NSData * myNewData = [pdfStr dataUsingEncoding: ???];

 // Display the pdf here...
}

How can I get this to work?



You can't treat a PDF file as a string, it isn't. You must use NSData  
methods to work with the raw bytes of the PDF to do the stripping of  
the metadata instead.


Then you would do something like:

PDFDocument* myPDF=[[PDFDocument alloc] initWithData:pdfData];

You can then display the PDFDocument in a PDFView.

--
Rob Keniger



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Problem with NSData to NSString to NSData

2008-10-28 Thread Aki Inoue

Joel,

The PDF is a binary data format. So, trying to decode with an ASCII  
encoding vonverter would result in data loss.

I recommend processing it as mere bytes without mapping to a string.

Aki from iPhone


On 2008/10/28, at 21:43, Joel Norvell <[EMAIL PROTECTED]> wrote:


Dear Cocoa-dev People,

I have a file with some metadata prepended to a pdf.

I want to strip the metadata off and display the pdf.

I was trying to do this:

- (void) loadFromPath: (NSString *) path
{
 NSData *myData = [NSData dataWithContentsOfFile:path];

 NSString *myStr = [[NSString alloc] initWithData:pdfData
 encoding:NSASCIIStringEncoding];

 // I strip off the metadata here, leaving the pdfStr.

 // Nothing I've tried here has worked:
 NSData * myNewData = [pdfStr dataUsingEncoding: ???];

 // Display the pdf here...
}

How can I get this to work?

Sincerely,

Joel Norvell





___

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

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

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

This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Problem with NSData to NSString to NSData

2008-10-28 Thread Joel Norvell
Dear Cocoa-dev People,

I have a file with some metadata prepended to a pdf.

I want to strip the metadata off and display the pdf.

I was trying to do this:

- (void) loadFromPath: (NSString *) path
{
  NSData *myData = [NSData dataWithContentsOfFile:path];

  NSString *myStr = [[NSString alloc] initWithData:pdfData 
  encoding:NSASCIIStringEncoding];

  // I strip off the metadata here, leaving the pdfStr.

  // Nothing I've tried here has worked:
  NSData * myNewData = [pdfStr dataUsingEncoding: ???];

  // Display the pdf here...
}

How can I get this to work?

Sincerely,

Joel Norvell




  
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: ASL & Unicode in Xcode's Console

2008-10-28 Thread Adam R. Maxwell


On Oct 28, 2008, at 9:14 PM, Jason Coco wrote:



On Oct 28, 2008, at 16:53 , Sean McBride wrote:


On 10/28/08 4:03 PM, Jason Coco said:


Also, you should not be using non-ascii characters in string
literals :) hopefully you're just doing this to demonstrate the  
issue.

You should
be doing something like this:

char *hiragana_a = { 0xE3, 0x81, 0x82, 0x00 };
NSLog(@"%@", [NSString stringWithCString:a
encoding:NSUTF8StringEncoding]);


That is no longer necessary in 10.5 / Xcode 3.  You can use Unicode  
in

string literals in Objective-C.


Why do you say this? I thought that I may have missed something, but  
looking
back through all the documentation, all the warnings about only  
including 7-bit ASCII
characters in string literals still exist... even in the most recent  
updated documentation.


ISTR seeing this in the release notes somewhere, but can't find it now  
either.  Anyway, see


http://lists.apple.com/archives/Cocoa-dev/2008/Apr/msg01885.html



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: inter-object communication

2008-10-28 Thread Jason Coco


On Oct 29, 2008, at 00:15 , Albert Jordan wrote:



What is the recommended way for Object B to inform Object A that it  
is done processing a request for the following scenario?


Object A has a list of phone numbers to send SMS messages
Object B implements sending an SMS message to a given phone number


I would personally use an NSOperationQueue and just have Object A add  
"send SMS to this number" operations to the queue. Results
could be handed back through any number of means, including an event  
queue or a simple mach port.


J

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

inter-object communication

2008-10-28 Thread Albert Jordan


What is the recommended way for Object B to inform Object A that it is  
done processing a request for the following scenario?


Object A has a list of phone numbers to send SMS messages
Object B implements sending an SMS message to a given phone number

Albert
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: ASL & Unicode in Xcode's Console

2008-10-28 Thread Jason Coco


On Oct 28, 2008, at 16:53 , Sean McBride wrote:


On 10/28/08 4:03 PM, Jason Coco said:


Also, you should not be using non-ascii characters in string
literals :) hopefully you're just doing this to demonstrate the  
issue.

You should
be doing something like this:

char *hiragana_a = { 0xE3, 0x81, 0x82, 0x00 };
NSLog(@"%@", [NSString stringWithCString:a
encoding:NSUTF8StringEncoding]);


That is no longer necessary in 10.5 / Xcode 3.  You can use Unicode in
string literals in Objective-C.


Why do you say this? I thought that I may have missed something, but  
looking
back through all the documentation, all the warnings about only  
including 7-bit ASCII
characters in string literals still exist... even in the most recent  
updated documentation.
The Objective-C 2.0 language guide says it explicitly. The String  
Programming Guide
for Cocoa states it explicitly. The CFString reference guide even  
states it explicitly
when using the CFSTR(...) macro. GCC has always maintained that while  
it may
work sometimes for standard C string literals in properly encoded  
source files, the

results of anything other than 7-bit string literals is still undefined.

Given that all of these documents have very recent updates... what  
makes you say
that one can use Unicode in string literals in Objective-C? I still  
assert that there's
really no reason to, and until the functionality is generally  
available and in wide
use, it's much safer to never assume that a string literal can be  
anything but
7-bit and to use resource files like string files to hold data that  
will be displayed

to the user.

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: Controller and NIB

2008-10-28 Thread John Joyce

Make sure you're spelling the method signature 100% correctly.
I myself have made a minor typo in a method (many times, who hasn't?)
and then spent the next 20 minutes or longer bashing my head looking  
for my mistake.


Spelling counts 100%
Capitalization ( my mistake has often been NIB instead of Nib )
always check the return type and argument type

If any of these are wrong, but syntax is correct, the compiler will  
compile and run without complaint.


make sure you've got 


-(void)awakeFromNib
{
// your code here, such as...
NSLog(@"awake from Nib");
}
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Message Forwarding Overhead / Performance

2008-10-28 Thread Michael Ash
On Tue, Oct 28, 2008 at 6:16 PM, Jerry Krinock <[EMAIL PROTECTED]> wrote:
> Roughly, the lesson is: Don't use message forwarding for "actual work".  I
> was just wondering if anyone had ever found otherwise.

I have to say that this is greatly overstating things. I've used
forwarding for all sorts of real work. What you don't want to do is
put it into a situation where it needs to execute hundreds of
thousands of times a second. But there are a lot of situations which
qualify as "actual work" for which that does not apply.

20us is slow when compared to a normal message send. It's
instantaneous when compared to, say, writing a file to disk. Whether
it's "too slow" depends entirely on what you need.

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: Open Window from Input Manager

2008-10-28 Thread Michael Ash
On Tue, Oct 28, 2008 at 4:59 PM, Daniel <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm working on a project for inserting special characters in text
> fields in all Cocoa apps by means of an Input Manager.
>
> After a given trigger/shortcut I have the need to open a window/panel,
> but I don't get it.
>
> I've tried to load a NIB file, but the Console reported
>
> -[NSWindowController loadWindow]: failed to load window nib file 'Chooser'
>
> Is there another way to do it right? I've basically the need to open a
> panel/window, change the keyboard focus from the textfield to the
> opened panel and then continue by closing the panel.

Hard to say if there's another way to do it when we don't know how
you're doing it now.

At a guess, you're telling Cocoa to look for "Chooser" in the main
bundle, but you are not the main bundle so this is the wrong place to
look.

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: Sage advice (NSView vs. CALayer)

2008-10-28 Thread Scott Anguish


On 28-Oct-08, at 10:05 PM, Alex Kac wrote:

That's a great one. So in a way if I'm creating a user inter-actable  
view, I could do my drawing in the layer, but handle all my user  
interaction in the view. Does that sounds about right? Again I  
haven't gotten that deep yet, but am working on a few things that I  
will be...


Not necessarily.

If you can't get the performance or features you need from views alone  
(drawing caching or certainly types of animations) use Layer-backed  
views
If you can't accomplish what you need with layer-backed views,  
consider using layers
if you're using layers, you'll always have to do the event handling in  
the view that hosts the root layer.


Basically, start at the view level, and then determine if you can't do  
what you want there, then did deeper



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Sage advice

2008-10-28 Thread Scott Anguish
The Animation Overview book has a chapter that contrasts the  
differences in the two approaches.


http://developer.apple.com/documentation/GraphicsImaging/Conceptual/Animation_Overview/ChooseAnimTech/chapter_5_section_1.html#/ 
/apple_ref/doc/uid/TP40004952-CH5-SW1



On 28-Oct-08, at 5:43 PM, Alex Kac wrote:

One question I have that maybe this list can help me understand. If  
you have views that are layer backed - why would one use any of the  
view methods instead of the layer methods? I have to admit in some  
ways I am somewhat perplexed why a CALayer doesn't replace the view  
itself completely. This is an area I have not yet had to delve into  
in the docs too much there, but what I have read it doesn't really  
explain much about the perceived dichotomy.


I would love an eye-opener description here :) And for me its a  
Leopard/iPhone only world if that makes a difference.


On Oct 28, 2008, at 4:35 PM, DKJ wrote:


When I was but a newbie,
I heard a wise man say,
"When using CALayers,
Put NSViews away."

Yet I set a CALayer,
Then added NSView;
Now many hours later,
I wail, "T'is true, t'is true!"


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Sage advice (NSView vs. CALayer)

2008-10-28 Thread Alex Kac
That's a great one. So in a way if I'm creating a user inter-actable  
view, I could do my drawing in the layer, but handle all my user  
interaction in the view. Does that sounds about right? Again I haven't  
gotten that deep yet, but am working on a few things that I will be...


On Oct 28, 2008, at 6:46 PM, John Pannell wrote:


Hi Alex-

One difference comes to mind, and is of substance for app design:

- NSView is a subclass of NSResponder, CALayer is not.

So views are happy to field click and keyboard events for you,  
participate in the responder chain, handle mouse drag/enter/exit,  
etc.  I believe a common design is to have the NSView be layer- 
backed and "host" your layer tree.  The layers are so fantastically  
lightweight they can do amazing drawing and animation, but part of  
the weight they lost was the ability to field events.  Use the host  
view to do this, then pass the location of the event to the root  
CALayer's hitTest: method to determine what was clicked on.


I'm sure there are many other differences that could be highlighted,  
but that one stands out for me!


John


Positive Spin Media
http://www.positivespinmedia.com

On Oct 28, 2008, at 3:43 PM, Alex Kac wrote:

One question I have that maybe this list can help me understand. If  
you have views that are layer backed - why would one use any of the  
view methods instead of the layer methods? I have to admit in some  
ways I am somewhat perplexed why a CALayer doesn't replace the view  
itself completely. This is an area I have not yet had to delve into  
in the docs too much there, but what I have read it doesn't really  
explain much about the perceived dichotomy.


I would love an eye-opener description here :) And for me its a  
Leopard/iPhone only world if that makes a difference.


On Oct 28, 2008, at 4:35 PM, DKJ wrote:


When I was but a newbie,
I heard a wise man say,
"When using CALayers,
Put NSViews away."

Yet I set a CALayer,
Then added NSView;
Now many hours later,
I wail, "T'is true, t'is true!"
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/alex%40webis.net

This email sent to [EMAIL PROTECTED]


Alex Kac - President and Founder
Web Information Solutions, Inc.

"There will always be death and taxes; however, death doesn't get  
worse every year."

-- Anonymous




___

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

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

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

This email sent to [EMAIL PROTECTED]




Alex Kac - President and Founder
Web Information Solutions, Inc.

“Don't forget until too late that the business of life is not business  
but living.”

-- B.C. Forbes,




___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Message Forwarding Overhead / Performance

2008-10-28 Thread Graham Cox


On 29 Oct 2008, at 9:16 am, Jerry Krinock wrote:

Roughly, the lesson is: Don't use message forwarding for "actual  
work".



Depending on your definition of "actual work" of course ;-)

I use message forwarding to route target/action from UI such as menus  
down through a hierarchy of objects within DrawKit. For such purposes  
it's great, since I can implement IBActions at whatever level makes  
most sense and the context manages itself automatically. I'd call that  
"actual work". It may well be slow but no-one's ever going to notice  
since they already have to wait way longer for eye-candy such as menu  
flashing to run.


--Graham
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Message Forwarding Overhead / Performance

2008-10-28 Thread Jerry Krinock
Well, I couldn't resist.  I added a third test to my little test  
project, using the new forwardingTargetForSelector: which Michael and  
Peter had ferreted out of the Leopard Release Notes.


It is about 40x faster than the old NSInvocation-based message  
forwarding.  On the Early 2006 Core 2 Duo Mac Mini, typically a half  
microsecond per message compared with 20 microseconds.


Close to 40x less code too  :)

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: CALayer properties

2008-10-28 Thread DKJ

It just clicked... no need for replies!


On 28 Oct, 2008, at 16:44, DKJ wrote:


When I did this:

myLayer.frame.size.width = rootLayer.frame.size.width;

I got an "illegal lvalue" error. But when I do this:

CGRect r = help.frame;
r.size.width = rootLayer.frame.size.width;

the compiler says nothing. Why can I use layer.frame.size on the  
right of =, but not the left?

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/hatzicware%40shaw.ca

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: CALayer properties

2008-10-28 Thread Dimitri Bouniol
Properties allow you to "drill down" and set values to the sub-properties that 
are objects (id or NSObject subclasses) of its own properties. However, the 
property called "frame" is a CGRect, a struct. Structs have the same syntax as 
properties, however it is wrong to assume they are the same thing.
So while you could reference the variables of the struct through properties 
like myLayer.frame.size.width, it would be equivalent to [myLayer 
frame].size.width .
However, when you want to set a property to something, myLayer.frame.size.width 
= 5 is completely different. This statement would be equivalent to calling  
[[[myLayer frame] size] setWidth:5], which is a reference to an object, and its 
methods.
If you want to set a value to a struct, you must pass a new struct containing 
the changed value, like myLayer.frame = CGRectMake(...), which is equivalent to 
[myLayer setFrame:CGRectMake(...)].

So if you are dealing with objects (id or NSObject subclasses), chaining them 
is fine in both the cases of setting and getting. But if you are working with a 
CGRect (or CGSize, CGPoint, NSRect ...), you must be careful to pass a new 
struct if it is in a property.

Correct Examples:

myObject.anotherObject.yetAnotherObject = anObject; ([[myObject anotherObject] 
setYetAnotherObject:anObject];)
myObject.anotherObject.yetAnotherObject.anInt = 5; ([[[myObject anotherObject] 
yetAnotherObject] setAnInt:5];)
anObject = myObject.anotherObject.yetAnotherObject; (anObject = [[myObject 
anotherObject] yetAnotherObject];)
anInt = myObject.anotherObject.yetAnotherObject.anInt; (anInt = [[[myObject 
anotherObject] yetAnotherObject] anInt];)
myObject.anotherObject.aRect = anotherRect; ([[myObject anotherObject] 
setARect:anotherRect];)
aFloat = myObject.anotherObject.aRect.size.width; (aFloat = [[myObject 
anotherObject] aRect].size.width;)
aSize.width = 5;
aPoint.x = myObject.anotherObject.yetAnotherObject.aFloat; (aPoint.x = 
[[[myObject anotherObject] yetAnotherObject] aFloat];)

I hope this explains it :)

--
定魅刀利
Dimitri Bouniol
[EMAIL PROTECTED]
http://www.appkainime.com/

 
On Tuesday, October 28, 2008, at 04:44PM, "DKJ" <[EMAIL PROTECTED]> wrote:
>When I did this:
>
>   myLayer.frame.size.width = rootLayer.frame.size.width;
>
>I got an "illegal lvalue" error. But when I do this:
>
>   CGRect r = help.frame;
>   r.size.width = rootLayer.frame.size.width;
>
>the compiler says nothing. Why can I use layer.frame.size on the right  
>of =, but not the left?
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: CALayer properties

2008-10-28 Thread Charles Steinman
- Original Message 
> From: DKJ <[EMAIL PROTECTED]>
> 
> When I did this:
> 
> myLayer.frame.size.width = rootLayer.frame.size.width;
> 
> I got an "illegal lvalue" error. But when I do this:
> 
> CGRect r = help.frame;
> r.size.width = rootLayer.frame.size.width;
> 
> the compiler says nothing. Why can I use layer.frame.size on the right  
> of =, but not the left?


You can't assign to the return value of a function or method. I think the dot 
syntax is confusing you because it looks the same between structs and object 
properties even though it does completely different things. The (myLayer.frame) 
part calls [myLayer frame], which returns an NSRect value. At that point, you 
have an NSRect value sitting outside of any variable, so you can't assign to 
it. What you're doing is similar to writing this:

[[NSObject alloc] init] = [NSString stringWithString:@"Hello world"];

Does that make more sense?

Cheers,
Chuck


  
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Getting localized NSPredicateEditor

2008-10-28 Thread Markus Spoettl

On Oct 28, 2008, at 3:57 PM, Peter Ammon wrote:
Here's something that may help - there's a method on NSRuleEditor: - 
(NSData *)_generateFormattingDictionaryStringsFile.  It gives you a  
strings file (as UTF16 data) appropriate for that control - write  
the data to a .strings file and then you can start translating it.


That method should never be called in production code but it can be  
useful for generating the strings file.



Excellent, that saves a lot of error prone work - I have more than 180  
such sentences. Thanks again!


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: Message Forwarding Overhead / Performance

2008-10-28 Thread Jerry Krinock

On 2008 Oct, 28, at 16:10, Peter Ammon wrote:

If you don't want to store or pick apart the message, but only route  
it immediately to another object, you should use the  
forwardingTargetForSelector: method, which will be faster than  
forwardInvocation:.


forwardingTargetForSelector: is new to Leopard and is mentioned in  
the release notes at http://developer.apple.com/ReleaseNotes/Cocoa/Foundation.html


Thank you, Peter.  That looks like it might be just what I want.

Another lesson for today: Leopard is a year old but still need to  
scrape release notes for some documentation!



On 2008 Oct, 28, at 15:37, Bill Bumgarner wrote:


Oooh... trivial tests!  I like those!   Can you share the code?


Depends what the message size limit is on this list.  We're about to  
find out.  Pasted from two files but it should work...


#import 

@protocol SSYForwarder

@property (retain) id forwardee ;

/*!
 @brief   One of the four methods needed to support message forwarding
 @detail  This is invoked once each time an instance message is  
forwarded

*/
- (void)forwardInvocation:(NSInvocation *)invocation ;

/*!
 @brief   One of the four methods needed to support message forwarding
 @detail  This is invoked once each time an instance message is  
forwarded

*/
- (NSMethodSignature*)methodSignatureForSelector:(SEL)selector ;

/*!
 @brief   One of the four methods needed to support message forwarding
 @detail  This method is definitely needed if the selectors forwarded
 are menu actions, probably because the system is asks if
 respondsToSelector in order to enable/disable its menu item.
 It does not get invoked for "normal" forwarded instance messages.
 */
- (BOOL)respondsToSelector:(SEL)selector ;

/*!
 @brief   One of the four methods needed to support message forwarding
 @detail  This method does not get invoked for forwarded instance  
messages.

*/
+ (BOOL)instancesRespondToSelector:(SEL)selector ;

@end

@interface Forwardee : NSObject {
NSInteger forwardSum ;
}

@property (assign) NSInteger forwardSum ;
- (void)forwardlyAdd:(NSInteger)addend ;

@end

@implementation Forwardee

@synthesize forwardSum ;

- (void)forwardlyAdd:(NSInteger)addend {
forwardSum += addend ;
}

@end

@interface Forwarder : NSObject  {
NSInteger directSum ;
id forwardee ;
}

@property (assign) NSInteger directSum ;

@property (retain) id forwardee ;

@end



@implementation Forwarder

@synthesize directSum ;

@synthesize forwardee ;

- (void)directlyAdd:(NSInteger)addend {
directSum += addend ;
}


#pragma mark The Four Overrides Needed to Fully Support Message  
Forwarding


- (void)forwardInvocation:(NSInvocation *)invocation {
id forwardee_ = [self forwardee] ;

if ([forwardee_ respondsToSelector:[invocation selector]]) {
[invocation invokeWithTarget:forwardee_] ;
}
else {
[super forwardInvocation:invocation] ;
}
}

- (NSMethodSignature*)methodSignatureForSelector:(SEL)selector {
NSMethodSignature* signature =[super  
methodSignatureForSelector:selector] ;

if (!signature) {
id forwardee_ = [self forwardee] ;
signature = [forwardee_ methodSignatureForSelector:selector] ;
}
return signature;
}

- (BOOL)respondsToSelector:(SEL)selector {
if ( [super respondsToSelector:selector] ) {
return YES ;
}
else {
id forwardee_ = [self forwardee] ;
return [forwardee_ respondsToSelector:selector] ;
}
}

+ (BOOL)instancesRespondToSelector:(SEL)selector {
if ( [super instancesRespondToSelector:selector] ) {
return YES ;
}
else {
id forwardeeInstance = [[self alloc] init] ;
BOOL instanceResponds =  [forwardeeInstance  
respondsToSelector:selector] ;

[forwardeeInstance release] ;
return instanceResponds ;
}
}


#pragma mark Basic Infrastructure

- (void)dealloc {
[forwardee release] ; forwardee = nil ;

[super dealloc];
}

@end



/*!
 @brief   Demo sends a message to add integers, with and without
 message forwarding, and logs the difference in performance
 @detail  In a real application, the Forwarder and Forwardee will
 be two of your classes.
*/
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

Forwarder* forwarder = [[Forwarder alloc] init] ;
Forwardee* forwardee = [[Forwardee alloc] init] ;

[forwarder setForwardee:forwardee] ;

NSInteger messages = 1 ;
NSInteger i ;
NSDate* startDate ;

// Directly
startDate = [NSDate date] ;
for (i=0; iNSLog(@" directSum = %d.  elapsedTime = %0.3e", [forwarder  
directSum], elapsedTimeD) ;


// via Message Forwarding
startDate = [NSDate date] ;
for (i=0; iNSLog(@"forwardSum = %d.  elapsedTime = %0.3e", [forwarder  
forwardSum], elapsedTimeF) ;


NSLog(@"Avg penalty for 1 forwarded message = %0.3e secs",  
(elapsedTimeF - elapsedTimeD)/messages) ;


[forwarder release] ;
[forwardee release

Re: Sage advice (NSView vs. CALayer)

2008-10-28 Thread John Pannell

Hi Alex-

One difference comes to mind, and is of substance for app design:

- NSView is a subclass of NSResponder, CALayer is not.

So views are happy to field click and keyboard events for you,  
participate in the responder chain, handle mouse drag/enter/exit,  
etc.  I believe a common design is to have the NSView be layer-backed  
and "host" your layer tree.  The layers are so fantastically  
lightweight they can do amazing drawing and animation, but part of the  
weight they lost was the ability to field events.  Use the host view  
to do this, then pass the location of the event to the root CALayer's  
hitTest: method to determine what was clicked on.


I'm sure there are many other differences that could be highlighted,  
but that one stands out for me!


John


Positive Spin Media
http://www.positivespinmedia.com

On Oct 28, 2008, at 3:43 PM, Alex Kac wrote:

One question I have that maybe this list can help me understand. If  
you have views that are layer backed - why would one use any of the  
view methods instead of the layer methods? I have to admit in some  
ways I am somewhat perplexed why a CALayer doesn't replace the view  
itself completely. This is an area I have not yet had to delve into  
in the docs too much there, but what I have read it doesn't really  
explain much about the perceived dichotomy.


I would love an eye-opener description here :) And for me its a  
Leopard/iPhone only world if that makes a difference.


On Oct 28, 2008, at 4:35 PM, DKJ wrote:


When I was but a newbie,
I heard a wise man say,
"When using CALayers,
Put NSViews away."

Yet I set a CALayer,
Then added NSView;
Now many hours later,
I wail, "T'is true, t'is true!"
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/alex%40webis.net

This email sent to [EMAIL PROTECTED]


Alex Kac - President and Founder
Web Information Solutions, Inc.

"There will always be death and taxes; however, death doesn't get  
worse every year."

-- Anonymous




___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/john%40positivespinmedia.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]


CALayer properties

2008-10-28 Thread DKJ

When I did this:

myLayer.frame.size.width = rootLayer.frame.size.width;

I got an "illegal lvalue" error. But when I do this:

CGRect r = help.frame;
r.size.width = rootLayer.frame.size.width;

the compiler says nothing. Why can I use layer.frame.size on the right  
of =, but not the left?

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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 and array item observation

2008-10-28 Thread Ashley Clark
I've made a test project that exhibits this behavior if anyone cares  
to look and filed a bug rdar://6327051


http://idisk.mac.com/aclark78-Public/KVONotificationBug.zip


Ashley


On Oct 28, 2008, at 4:30 PM, Ashley Clark wrote:


On Oct 28, 2008, at 2:13 AM, Ashley Clark wrote:

I have a bid revision object that holds a to-many NSSet reference  
to a group of items that constitute a tree. Some of those items are  
roots and have a nil parent. In my bid revision object I've set up  
a rootItems method that uses a predicate to return a filtered set  
of the items with nil parents and uses  
keyPathsForValuesAffectingRootItems to be aware of changes to the  
items set as a whole and generate appropriate KVO notifications.


I have a problem though that when an item that's already in the  
set, but not a root, becomes a root by having its' parent set to  
nil. This does not cause KVO notifications to be sent out for the  
rootItems property because technically the items set as a whole has  
not changed.


I naïvely tried to add @"items.parent" to the keyPathsForValues...  
method which of course didn't work since you can't observe groups  
of properties in a set or array. Right now, I'm sending a  
willChange/didChange method pair after performing parent changes of  
subitems and after undo/redo events and it *seems* to be working  
fine. This seems grotesque though and sure to cause me problems  
later.


Is there any way to force a KVO update of a property besides a  
willChange/didChange method pair?

Is there a better way?


I've re-architected my design somewhat to work around the issue I  
described before and avoid issuing empty willChange/didChange pairs  
but I think I'm seeing a bug (in Apple's framework?) now that I'm  
not sure how to track.



My object hierarchy looks like this:

JTBidRevision maintains a set of JTBidItem objects that represent  
the top items of the tree.

These JTBidItem objects in turn reference a JTInventory object.
And these JTInventory objects each reference a set of  
JTInventoryDependency objects.


My JTBidItem class has a method that returns a coalesced ordered  
array of objects that it displays as children, some of them are the  
JTInventoryDependency objects referenced through its JTInventory  
object and others are direct JTBidItem descendants of the node.


The set of dependency objects returned also depends on the state of  
a variable in the parent JTBidRevision object. Depending on this  
variable some dependency objects will be or will not be part of the  
orderedChildren method result.



I've set up my set of keyPaths that affect the orderedChildren set  
and it appears to be working in the general case in that if I change  
the watched value in my JTBidRevision instance the appropriate  
notifications are sent and the tree reloads correctly the first time  
for all elements. If I then change that value a second time, one of  
my objects has its orderedChildren method invoked twice while  
another of the objects gets skipped and the display of the tree is  
not updated correctly from that point on.


The JTBidItem objects that are exhibiting this behavior both  
maintain a reference to the same JTInventory object.



My keyPathsForValues... method looks like this for my JTBidItem's  
orderedChildren:


+ (NSSet *)keyPathsForValuesAffectingOrderedChildren {
   return [NSSet setWithObjects:@"children",  
@"inventoryItem.dependentInventoryItems", @"owningRevision.piping",  
nil];

}


The owningRevision itself is a derived value also with this  
keyPathsForValues..., the owningRevision method walks up the tree to  
find the owning revision object.


+ (NSSet *)keyPathsForValuesAffectingOwningRevision {
   return [NSSet setWithObjects:@"parent", @"bidRevision", nil];
}


Everything else appears to be working fine and the problem only  
occurs when two or more bid item objects in my tree both reference  
the same JTInventory object. Ideas?


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Message Forwarding Overhead / Performance

2008-10-28 Thread Charles Steinman
- Original Message 
> From: Jerry Krinock <[EMAIL PROTECTED]>
> Roughly, the lesson is: Don't use message forwarding for "actual  
> work".  I was just wondering if anyone had ever found otherwise.


I don't think that's really fair. The lesson is not to use NSInvocation in 
extremely tight loops. For the bulk of most programs, the message forwarding 
overhead will be much less significant. Writing to disk is also relatively 
slow, but I've never heard anyone say it's not useful for "actual work."

Cheers,
Chuck


  
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Message Forwarding Overhead / Performance

2008-10-28 Thread Peter Ammon


On Oct 28, 2008, at 8:30 AM, Jerry Krinock wrote:

Although the documentation on message forwarding [1] explains that  
alot of stuff needs to happen, it does not say "Warning: Don't do  
this in performance-critical applications".  So I made a test tool  
which forwarded a simple message with one integer argument to a  
class which would add it to its 'sum', an instance variable.


Sending this message 10,000 times and comparing the difference in  
elapsed time with a similar task that sends a similar message  
directly, I found that the average overhead for forwarding one  
message on my Intel Core 2 Duo Mac Mini was about 20 microseconds.


That would be unacceptably slow for an iterated operation in a my  
application, and I decided to not use message forwarding in this  
particular case.


Has anyone ever seen better performance for message forwarding?

Jerry Krinock


Hi Jerry,

I take it you are using forwardInvocation:?  NSInvocation is  
heavyweight compared to a message send, as it needs to collect enough  
state to be able to reproduce the message and its arguments at any  
future date (and on any architecture, with DO).


If you don't want to store or pick apart the message, but only route  
it immediately to another object, you should use the  
forwardingTargetForSelector: method, which will be faster than  
forwardInvocation:.


forwardingTargetForSelector: is new to Leopard and is mentioned in the  
release notes at http://developer.apple.com/ReleaseNotes/Cocoa/Foundation.html


-Peter

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Controller and NIB

2008-10-28 Thread Shawn Erickson
On Tue, Oct 28, 2008 at 3:09 PM, J. Todd Slack
<[EMAIL PROTECTED]> wrote:

> What is a full proof way to have code executed when a NIB is loaded?

By loading it yourself, by implementing the supported delegate method
if NSApplication is the one loading it, by implementing windowDidLoad
in a subclassing NSWindowController, etc. It depends on who is loading
the NIB.

> When my MainMenu.nib displays its Window, I want to execute some code.

In this particular case look at the delegate methods of NSApplication.
In particular applicationDidFinishLaunching:.

-Shawn
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Getting localized NSPredicateEditor

2008-10-28 Thread Peter Ammon


On Oct 28, 2008, at 3:33 PM, Markus Spoettl wrote:


Hi Peter,


Let me know if you have any questions,


I do! I tried to localize the All/Any/None sentence for the German  
localization. When I do this I get an exception and the following  
console log:


10/28/08 3:20:54 PM myApp[43721] Error parsing localization!
 Key: %d %@
 Value: %1$d %2$@
 Error is: The maximum given order was 2, but nothing has order 1.


My guess is that you're using the same strings file for this and other  
uses. The %[...]@ syntax is unique to NSRuleEditor/NSPredicateEditor  
and so it needs its own strings file.  %d should never appear in one  
of these strings.


Here's something that may help - there's a method on NSRuleEditor: - 
(NSData *)_generateFormattingDictionaryStringsFile.  It gives you a  
strings file (as UTF16 data) appropriate for that control - write the  
data to a .strings file and then you can start translating it.


That method should never be called in production code but it can be  
useful for generating the strings file.



The localization part looks like this:

"%[Any]@ of the following are true" = "%[Eine]@ der folgenden  
Bedingungen treffen zu";
"%[All]@ of the following are true" = "%[Alle]@ der folgenden  
Bedingungen treffen zu";
"%[None]@ of the following are true" = "%[Keine]@ der folgenden  
Bedingungen treffen zu";


I've set the predicate editor's formattingStringsFilename in - 
awakeFromNib and implemented


- (NSDictionary *)ruleEditor:(NSPredicateEditor *)editor  
predicatePartsForCriterion:(id)criterion withDisplayValue:(id)value  
inRow:(NSInteger)row

{
   NSMutableDictionary *result = [NSMutableDictionary dictionary];
   if ([value isKindOfClass:[NSString class]]) {
   if ([value isEqual:@"Any"]) [result setObject:[NSNumber  
numberWithInt:NSOrPredicateType]  
forKey:NSRuleEditorPredicateCompoundType];
   else if ([value isEqual:@"All"]) [result setObject:[NSNumber  
numberWithInt:NSAndPredicateType]  
forKey:NSRuleEditorPredicateCompoundType];
   else if ([value isEqual:@"None"]) [result setObject:[NSNumber  
numberWithInt:NSNotPredicateType]  
forKey:NSRuleEditorPredicateCompoundType];

   }
   return result;
}

which never gets called (probably because it's a NSPredicateEditor  
and as such does not use delegate methods?).


Right, those delegate methods are not used for NSPredicateEditor.  All  
that's necessary for localization is to set the strings file.


-Peter
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Getting localized NSPredicateEditor

2008-10-28 Thread Markus Spoettl

Hi Peter,

On Oct 28, 2008, at 3:33 PM, Markus Spoettl wrote:

10/28/08 3:20:54 PM myApp[43721] Error parsing localization!
 Key: %d %@
 Value: %1$d %2$@
 Error is: The maximum given order was 2, but nothing has order 1.

The localization part looks like this:



Never mind the previous mail. I put the localization in its own file  
and it works. I had it in Localizable.strings with tons of other stuff  
in it and apparently the system does expect it to be on its own.


Time for some more experimenting, thanks very much for the quick help!

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: Message Forwarding Overhead / Performance

2008-10-28 Thread Bill Bumgarner

On Oct 28, 2008, at 3:16 PM, Jerry Krinock wrote:

On 2008 Oct, 28, at 9:09, Bill Bumgarner wrote:
That would not surprise me.   An absolute microseconds overhead  
isn't a terribly useful measure without knowing the total # of  
microseconds.  In general, measuring as a factor of speed -- 1.2x  
20x 200x is more widely applicable (tends to be more consistent  
across different CPUs, for example).


Well, since you asked. :))

Actually, I calculated this first but it seemed too ridiculous to  
publish.


Time to send message and
   do 10,000 integer additions
   ---
 Direct messaging 250 microseconds typical
 Message Forwarding30 microseconds typical
 "X" factor: 1200 X

Obviously this is because the "real work" was trivial.  But I  
concocted my test that way purposely. The result of "20 microseconds  
per message on a 2006 Mac Mini" gives me a measure which I can use  
to ^predict^ performance in this and future applications ^before^  
writing code.


Oooh... trivial tests!  I like those!   Can you share the code?

So... sure... message forwarding is slow.  But does it matter in  
your application?


Early in the design process you need to make some guesses based on  
experience.  Since I have an alternative to in this case, the  
decision is to use the alternative.


Roughly, the lesson is: Don't use message forwarding for "actual  
work".  I was just wondering if anyone had ever found otherwise.


I'd rephrase that for archival purposes:   Don't use message  
forwarding in tight loops or other repetitive use patterns.  It  
doesn't make sense to have to figure out who is really going to do the  
work on each pass through a loop when figuring out who is so terribly  
expensive.


b.bum



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Getting localized NSPredicateEditor

2008-10-28 Thread Markus Spoettl

Hi Peter,

On Oct 28, 2008, at 2:10 PM, Peter Ammon wrote:
Apple does not provide any translations of the operator names or  
criteria.  This is because NSPredicateEditor is designed to be  
localized with sentence granularity, not word by word.  Translating  
each word independently and piecing them together doesn't produce as  
good a localization.


For example, in Finder, you can search for "[Last modified date] is  
[within last] [5] [weeks]".  That whole sentence is what gets  
localized - it appears in a strings file in Finder's bundle - and  
there can be a separate localization for each possible sentence.


There's an example of a NSRuleEditor localized into Spanish at http://homepage.mac.com/gershwin/NibBasedSpotlightSearcher.zip 
 (NSPredicateEditor's localization is identical).  Also see  
NSNavRuleEditor.strings inside AppKit.framework/*.lproj for how the  
search in the Open panel gets localized.


OK, thanks very much! That's very interesting, I would have never  
figured that out from the documentation, and it appears my googling  
skills are very bad.


Of course, you can localize each word independently if you prefer,  
with the usual mechanism - set the title of each menu item in each  
popup to the translation you want.


In my case it might even work but I'd love to give this mechanism a  
try but...



Let me know if you have any questions,


I do! I tried to localize the All/Any/None sentence for the German  
localization. When I do this I get an exception and the following  
console log:


10/28/08 3:20:54 PM myApp[43721] Error parsing localization!
  Key: %d %@
  Value: %1$d %2$@
  Error is: The maximum given order was 2, but nothing has order 1.

The localization part looks like this:

"%[Any]@ of the following are true" = "%[Eine]@ der folgenden  
Bedingungen treffen zu";
"%[All]@ of the following are true" = "%[Alle]@ der folgenden  
Bedingungen treffen zu";
"%[None]@ of the following are true" = "%[Keine]@ der folgenden  
Bedingungen treffen zu";


I've set the predicate editor's formattingStringsFilename in - 
awakeFromNib and implemented


- (NSDictionary *)ruleEditor:(NSPredicateEditor *)editor  
predicatePartsForCriterion:(id)criterion withDisplayValue:(id)value  
inRow:(NSInteger)row

{
NSMutableDictionary *result = [NSMutableDictionary dictionary];
if ([value isKindOfClass:[NSString class]]) {
if ([value isEqual:@"Any"]) [result setObject:[NSNumber  
numberWithInt:NSOrPredicateType]  
forKey:NSRuleEditorPredicateCompoundType];
else if ([value isEqual:@"All"]) [result setObject:[NSNumber  
numberWithInt:NSAndPredicateType]  
forKey:NSRuleEditorPredicateCompoundType];
else if ([value isEqual:@"None"]) [result setObject:[NSNumber  
numberWithInt:NSNotPredicateType]  
forKey:NSRuleEditorPredicateCompoundType];

}
return result;
}

which never gets called (probably because it's a NSPredicateEditor and  
as such does not use delegate methods?). Any idea what I'm doing wrong?


Thanks very much for your help!

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: NSPredicateEditor error

2008-10-28 Thread Chris Idou

Yes, I thought I had an NSButton, but it turned out I'd wrongly put in a 
NSPopupButton.


--- On Tue, 10/28/08, Peter Ammon <[EMAIL PROTECTED]> wrote:

> From: Peter Ammon <[EMAIL PROTECTED]>
> Subject: Re: NSPredicateEditor error
> To: [EMAIL PROTECTED]
> Cc: cocoa-dev@lists.apple.com
> Date: Tuesday, October 28, 2008, 11:41 AM
> On Oct 27, 2008, at 10:07 PM, Chris Idou wrote:
> 
> >
> > I'm getting the following error:
> >
> > In , different
> number of items (3)  
> > than predicate template views (4) for template
>  > 0x12487e0: [move:] [] NSStringAttributeType>
> >
> >> From experimenting, the only difference between
> the  
> >> NSPredicateEditorRowTemplate that is failing and
> my other ones that  
> >> work fine, is that this one has a NSButton in its
> list of views.
> >
> > Has anyone else seen this before, and have any
> insight?
> 
> One reason for this message (which could be a lot clearer)
> is that  
> templateViews contains a NSPopUpButtonwith no items.   
> NSPredicateEditor doesn't support empty popup buttons
> yet.  Does that  
> help?
> 
> -Peter


  
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Controller and NIB

2008-10-28 Thread Graham Cox


On 29 Oct 2008, at 9:09 am, J. Todd Slack wrote:


What is a full proof way to have code executed when a NIB is loaded?

When my MainMenu.nib displays its Window, I want to execute some code.



If you have an object in the nib, its -awakeFromNib method will be  
called. The object can be an instance of any class, say 'MyObject'.  
However you do have to put that object in the nib - just having it in  
your code won't do anything because there's nothing instantiating it.  
You can drag a generic object into your nib in IB and then use the  
properties inspector to set its class to whatever you want, e.g.  
'MyObject'.


Another way if you only need some code to run when the app is launched  
is to implement an application delegate and override the - 
applicationDidFinishLaunching: method.


hth,

Graham
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Message Forwarding Overhead / Performance

2008-10-28 Thread Jerry Krinock


On 2008 Oct, 28, at 9:09, Bill Bumgarner wrote:

That would not surprise me.   An absolute microseconds overhead  
isn't a terribly useful measure without knowing the total # of  
microseconds.  In general, measuring as a factor of speed -- 1.2x  
20x 200x is more widely applicable (tends to be more consistent  
across different CPUs, for example).


Well, since you asked. :))

Actually, I calculated this first but it seemed too ridiculous to  
publish.


 Time to send message and
do 10,000 integer additions
---
  Direct messaging 250 microseconds typical
  Message Forwarding30 microseconds typical
  "X" factor: 1200 X

Obviously this is because the "real work" was trivial.  But I  
concocted my test that way purposely.  The result of "20 microseconds  
per message on a 2006 Mac Mini" gives me a measure which I can use to  
^predict^ performance in this and future applications ^before^ writing  
code.


So... sure... message forwarding is slow.  But does it matter in  
your application?


Early in the design process you need to make some guesses based on  
experience.  Since I have an alternative to in this case, the decision  
is to use the alternative.


Roughly, the lesson is: Don't use message forwarding for "actual  
work".  I was just wondering if anyone had ever found otherwise.


Thanks again, Bill.
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Controller and NIB

2008-10-28 Thread Nick Zitzmann


On Oct 28, 2008, at 4:09 PM, J. Todd Slack wrote:


What is a full proof way to have code executed when a NIB is loaded?


There aren't any notifications for loading nibs other than - 
awakeFromNib.



When my MainMenu.nib displays its Window, I want to execute some code.



You could do a one-time registry for the window's  
NSWindowDidBecomeKeyNotification.


Nick Zitzmann


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Controller and NIB

2008-10-28 Thread J. Todd Slack

Hi Nick,


On Oct 28, 2008, at 3:09 PM, J. Todd Slack wrote:


I have a controller.m and it has an awakeFromNib method.

I have a NIB that is loaded on startup (specified in info.plist)

I have code that is not getting called in awakeFromNib when the Nib  
is loaded.


What am I forgetting to setup?


-awakeFromNib is only called when an object is instantiated by a  
nib, and the nib is loaded. Are you sure the object is being  
correctly instantiated?


What is a full proof way to have code executed when a NIB is loaded?

When my MainMenu.nib displays its Window, I want to execute some code.

-Jason

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Getting available free disk space on disk image

2008-10-28 Thread Paul Archibald

Oooops. It looks like I lied.

Actually, I am using
	[[[myFileManager fileSystemAttributesAtPath:[mountedDiskImagePath  
stringByDeletingLastPathComponent]

...]

I think it was because sometimes the path included a filename. I am  
going to change it to use the full path. I never noticed this problem  
until I tried to copy to the root level of a disk, which is not the  
normal way this app would be used. Isn't that what QA is for?


(5 minutes later)

That works, I think. I will need to test it some more before I am  
certain.

On Oct 28, 2008, at 2:17 PM, Clark Cox wrote:


On Tue, Oct 28, 2008 at 2:15 PM, Paul Archibald <[EMAIL PROTECTED]> wrote:

This is pretty obscure, I think.

My app makes files which can be quite large. It also allows the  
user to
distribute copies of those files to various locations. So, to test  
this I
have tried creating and mounting a disk image which I tried making  
a copy

to.

The problem is that it seems I cannot check the actual available  
space on
that mounted disk image. What I get instead is the available space  
on the

disk where the image lives.

I am using [[myFileManager  
fileSystemAttributesAtPath:mountedDiskImagePath]

   objectForKey:NSFileSystemFreeSize];


Is mountedDiskImagePath the path to the disk image itself, or to the
place at which the image is mounted?


--
Clark S. Cox III
[EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: performSelectorOnMainThread and exceptions

2008-10-28 Thread [EMAIL PROTECTED]

At 6:51 PM -0500 10/27/08, Ken Thomases wrote:

On Oct 27, 2008, at 4:05 PM, [EMAIL PROTECTED] wrote:

if i call -[anObject performSelectorOnMainThread:aSelector 
withObject:nil waitUntilDone:NO] and then later throw an exception 
(of my own), which i catch, the deferred execution of aSelector 
never happens. note that the performSelectonOnMainThread, and the 
throw and catch are all in the same run of the run loop and are all 
in the main thread.


is this a bug (seems like it to me) or proper/expected behavior. if 
i didn't catch the exception, i could understand this, but as i 
said, i am catching it. if this is proper behavior, can anyone 
offer me an explanation as to why?


Sounds like a bug to me.  File it with Apple .

Out of curiosity, since you're only trying to defer a message and 
everything's on the main thread, does it still happen with [anObject 
performSelector:aSelector withObject:nil afterDelay:0]?


for the archives.

so i built a very simple test application in preparation to filing a 
bug report and to try  [anObject performSelector:aSelector 
withObject:nil afterDelay:0]. and lo and behold, my "deferred" method 
was executed using either deferred variants!


so i revisited the issue in my app, and sure enough it is now working 
as i expected, ie, the deferred method is invoked, even when an 
exception is thrown. musta been "brain freeze" the first time around! 
:-(


ken



Regards,
Ken


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Controller and NIB

2008-10-28 Thread Nick Zitzmann


On Oct 28, 2008, at 3:09 PM, J. Todd Slack wrote:


I have a controller.m and it has an awakeFromNib method.

I have a NIB that is loaded on startup (specified in info.plist)

I have code that is not getting called in awakeFromNib when the Nib  
is loaded.


What am I forgetting to setup?



-awakeFromNib is only called when an object is instantiated by a nib,  
and the nib is loaded. Are you sure the object is being correctly  
instantiated?


Nick Zitzmann


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Sage advice

2008-10-28 Thread Alex Kac
One question I have that maybe this list can help me understand. If  
you have views that are layer backed - why would one use any of the  
view methods instead of the layer methods? I have to admit in some  
ways I am somewhat perplexed why a CALayer doesn't replace the view  
itself completely. This is an area I have not yet had to delve into in  
the docs too much there, but what I have read it doesn't really  
explain much about the perceived dichotomy.


I would love an eye-opener description here :) And for me its a  
Leopard/iPhone only world if that makes a difference.


On Oct 28, 2008, at 4:35 PM, DKJ wrote:


When I was but a newbie,
I heard a wise man say,
"When using CALayers,
Put NSViews away."

Yet I set a CALayer,
Then added NSView;
Now many hours later,
I wail, "T'is true, t'is true!"
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/alex%40webis.net

This email sent to [EMAIL PROTECTED]


Alex Kac - President and Founder
Web Information Solutions, Inc.

"There will always be death and taxes; however, death doesn't get  
worse every year."

-- Anonymous




___

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

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

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

This email sent to [EMAIL PROTECTED]


Sage advice

2008-10-28 Thread DKJ

When I was but a newbie,
I heard a wise man say,
"When using CALayers,
Put NSViews away."

Yet I set a CALayer,
Then added NSView;
Now many hours later,
I wail, "T'is true, t'is true!"
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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 and array item observation

2008-10-28 Thread Ashley Clark

On Oct 28, 2008, at 2:13 AM, Ashley Clark wrote:

I have a bid revision object that holds a to-many NSSet reference to  
a group of items that constitute a tree. Some of those items are  
roots and have a nil parent. In my bid revision object I've set up a  
rootItems method that uses a predicate to return a filtered set of  
the items with nil parents and uses  
keyPathsForValuesAffectingRootItems to be aware of changes to the  
items set as a whole and generate appropriate KVO notifications.


I have a problem though that when an item that's already in the set,  
but not a root, becomes a root by having its' parent set to nil.  
This does not cause KVO notifications to be sent out for the  
rootItems property because technically the items set as a whole has  
not changed.


I naïvely tried to add @"items.parent" to the keyPathsForValues...  
method which of course didn't work since you can't observe groups of  
properties in a set or array. Right now, I'm sending a willChange/ 
didChange method pair after performing parent changes of subitems  
and after undo/redo events and it *seems* to be working fine. This  
seems grotesque though and sure to cause me problems later.


Is there any way to force a KVO update of a property besides a  
willChange/didChange method pair?

Is there a better way?


I've re-architected my design somewhat to work around the issue I  
described before and avoid issuing empty willChange/didChange pairs  
but I think I'm seeing a bug (in Apple's framework?) now that I'm not  
sure how to track.



My object hierarchy looks like this:

JTBidRevision maintains a set of JTBidItem objects that represent the  
top items of the tree.

These JTBidItem objects in turn reference a JTInventory object.
And these JTInventory objects each reference a set of  
JTInventoryDependency objects.


My JTBidItem class has a method that returns a coalesced ordered array  
of objects that it displays as children, some of them are the  
JTInventoryDependency objects referenced through its JTInventory  
object and others are direct JTBidItem descendants of the node.


The set of dependency objects returned also depends on the state of a  
variable in the parent JTBidRevision object. Depending on this  
variable some dependency objects will be or will not be part of the  
orderedChildren method result.



I've set up my set of keyPaths that affect the orderedChildren set and  
it appears to be working in the general case in that if I change the  
watched value in my JTBidRevision instance the appropriate  
notifications are sent and the tree reloads correctly the first time  
for all elements. If I then change that value a second time, one of my  
objects has its orderedChildren method invoked twice while another of  
the objects gets skipped and the display of the tree is not updated  
correctly from that point on.


The JTBidItem objects that are exhibiting this behavior both maintain  
a reference to the same JTInventory object.



My keyPathsForValues... method looks like this for my JTBidItem's  
orderedChildren:


+ (NSSet *)keyPathsForValuesAffectingOrderedChildren {
return [NSSet setWithObjects:@"children",  
@"inventoryItem.dependentInventoryItems", @"owningRevision.piping",  
nil];

}


The owningRevision itself is a derived value also with this  
keyPathsForValues..., the owningRevision method walks up the tree to  
find the owning revision object.


+ (NSSet *)keyPathsForValuesAffectingOwningRevision {
return [NSSet setWithObjects:@"parent", @"bidRevision", nil];
}


Everything else appears to be working fine and the problem only occurs  
when two or more bid item objects in my tree both reference the same  
JTInventory object. Ideas?



Ashley

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Getting a file's icon

2008-10-28 Thread Dave DeLong

NSWorkspace has:

- (NSImage *)iconForFile:(NSString *)fullPath

HTH,

Dave

On Oct 28, 2008, at 3:20 PM, Jean-Nicolas Jolivet wrote:

I was wondering how I can get an "NSImage" from a file's icon  
(assuming I have that file's path)...

___

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

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

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

This email sent to [EMAIL PROTECTED]


Getting a file's icon

2008-10-28 Thread Jean-Nicolas Jolivet
I was wondering how I can get an "NSImage" from a file's icon (assuming 
I have that file's path)...


I've read about FileWrapper's icon method ([fileWrapper icon]) which 
returns exactly what I need, but I'm not really familiar with file 
wrappers and from what I understand from the Class documentation, a file 
wrapper actually  holds the file's content in dynamic memory... does 
this mean it can be a problem if I open a bunch of big files? Do I 
really need to hold the file's content in memory if all I need is its icon?



Jean-Nicolas Jolivet
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Getting available free disk space on disk image

2008-10-28 Thread Clark Cox
On Tue, Oct 28, 2008 at 2:15 PM, Paul Archibald <[EMAIL PROTECTED]> wrote:
> This is pretty obscure, I think.
>
> My app makes files which can be quite large. It also allows the user to
> distribute copies of those files to various locations. So, to test this I
> have tried creating and mounting a disk image which I tried making a copy
> to.
>
> The problem is that it seems I cannot check the actual available space on
> that mounted disk image. What I get instead is the available space on the
> disk where the image lives.
>
> I am using [[myFileManager fileSystemAttributesAtPath:mountedDiskImagePath]
>objectForKey:NSFileSystemFreeSize];

Is mountedDiskImagePath the path to the disk image itself, or to the
place at which the image is mounted?


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

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

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

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

This email sent to [EMAIL PROTECTED]


Getting available free disk space on disk image

2008-10-28 Thread Paul Archibald

This is pretty obscure, I think.

My app makes files which can be quite large. It also allows the user  
to distribute copies of those files to various locations. So, to test  
this I have tried creating and mounting a disk image which I tried  
making a copy to.


The problem is that it seems I cannot check the actual available  
space on that mounted disk image. What I get instead is the available  
space on the disk where the image lives.


I am using [[myFileManager  
fileSystemAttributesAtPath:mountedDiskImagePath]

objectForKey:NSFileSystemFreeSize];

Does anyone know if it is possible to get the free space on a mounted  
disk image?

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Getting localized NSPredicateEditor

2008-10-28 Thread Peter Ammon


On Oct 28, 2008, at 1:12 PM, Markus Spoettl wrote:


Hello List,

 is there a way to make NSPredicateEditor play nice with localized  
versions of an application, meaning that it's rule operators and  
criteria are translated to the language the rest of the application  
is using?


Right now it appears that NSPredicateEditor uses English operator  
names (and compound criteria descriptions), regardless of which  
language is used.


Regards
Markus



Hi Markus,

Apple does not provide any translations of the operator names or  
criteria.  This is because NSPredicateEditor is designed to be  
localized with sentence granularity, not word by word.  Translating  
each word independently and piecing them together doesn't produce as  
good a localization.


For example, in Finder, you can search for "[Last modified date] is  
[within last] [5] [weeks]".  That whole sentence is what gets  
localized - it appears in a strings file in Finder's bundle - and  
there can be a separate localization for each possible sentence.


There's an example of a NSRuleEditor localized into Spanish at http://homepage.mac.com/gershwin/NibBasedSpotlightSearcher.zip 
 (NSPredicateEditor's localization is identical).  Also see  
NSNavRuleEditor.strings inside AppKit.framework/*.lproj for how the  
search in the Open panel gets localized.


Of course, you can localize each word independently if you prefer,  
with the usual mechanism - set the title of each menu item in each  
popup to the translation you want.


Let me know if you have any questions,
-Peter

___

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

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

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

This email sent to [EMAIL PROTECTED]


Controller and NIB

2008-10-28 Thread J. Todd Slack

Hi All,

I have a controller.m and it has an awakeFromNib method.

I have a NIB that is loaded on startup (specified in info.plist)

I have code that is not getting called in awakeFromNib when the Nib is  
loaded.


What am I forgetting to setup? I need to run some code after the nib  
has loaded.


-Jason
___

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

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

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

This email sent to [EMAIL PROTECTED]


Open Window from Input Manager

2008-10-28 Thread Daniel
Hi,

I'm working on a project for inserting special characters in text
fields in all Cocoa apps by means of an Input Manager.

After a given trigger/shortcut I have the need to open a window/panel,
but I don't get it.

I've tried to load a NIB file, but the Console reported

-[NSWindowController loadWindow]: failed to load window nib file 'Chooser'

Is there another way to do it right? I've basically the need to open a
panel/window, change the keyboard focus from the textfield to the
opened panel and then continue by closing the panel.

Best regards,
Daniel 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: ASL & Unicode in Xcode's Console

2008-10-28 Thread Sean McBride
On 10/28/08 4:03 PM, Jason Coco said:

>Also, you should not be using non-ascii characters in string
>literals :) hopefully you're just doing this to demonstrate the issue.
>You should
>be doing something like this:
>
>char *hiragana_a = { 0xE3, 0x81, 0x82, 0x00 };
>NSLog(@"%@", [NSString stringWithCString:a
>encoding:NSUTF8StringEncoding]);

That is no longer necessary in 10.5 / Xcode 3.  You can use Unicode in
string literals in Objective-C.

--

Sean McBride, B. Eng [EMAIL PROTECTED]
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTableView right clicked row

2008-10-28 Thread Corbin Dunn
Note that the documentation is slightly wrong, as it is also valid  
when the menu pops up.


Please see the "DragNDropOutlineView" demo app which shows how to  
properly create a dynamic contextual menu.


..corbin


On Oct 28, 2008, at 1:34 PM, chaitanya pandit wrote:

Thanks Randall, funny that my subject says "...clicked row" and i  
missed clickedRow :-)


On 29-Oct-08, at 1:51 AM, Randall Meadows wrote:


On Oct 28, 2008, at 2:11 PM, chaitanya pandit wrote:


Hi list,
I have a NSTableView, and i display a menu when the user right  
clicks a row, this menu allows the user to delete that item.

My problem is, how do i get the row which was right clicked?

Consider this: currently the row#1 is selected and the user right  
clicks row#3 the row#3's cell will have a blue border,
now in the right click's menu's action method if i call [tableview  
selectedRow]; it'll return "1" where as what i want is "3"


How do i identify the row that was right clicked?


clickedRow
Returns the index of the row the user clicked to trigger an action  
message.


- (NSInteger)clickedRow

Return Value
The index of the row the user clicked to trigger an action message.  
Returns –1 if the user clicked in an area of the table view not  
occupied by table rows.


Discussion
The return value of this method is meaningful only in the target’s  
implementation of the action or double-action method.


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




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTableView right clicked row

2008-10-28 Thread chaitanya pandit
Thanks Randall, funny that my subject says "...clicked row" and i  
missed clickedRow :-)


On 29-Oct-08, at 1:51 AM, Randall Meadows wrote:


On Oct 28, 2008, at 2:11 PM, chaitanya pandit wrote:


Hi list,
I have a NSTableView, and i display a menu when the user right  
clicks a row, this menu allows the user to delete that item.

My problem is, how do i get the row which was right clicked?

Consider this: currently the row#1 is selected and the user right  
clicks row#3 the row#3's cell will have a blue border,
now in the right click's menu's action method if i call [tableview  
selectedRow]; it'll return "1" where as what i want is "3"


How do i identify the row that was right clicked?


clickedRow
Returns the index of the row the user clicked to trigger an action  
message.


- (NSInteger)clickedRow

Return Value
The index of the row the user clicked to trigger an action message.  
Returns –1 if the user clicked in an area of the table view not  
occupied by table rows.


Discussion
The return value of this method is meaningful only in the target’s  
implementation of the action or double-action method.


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



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTableView right clicked row

2008-10-28 Thread Randall Meadows

On Oct 28, 2008, at 2:11 PM, chaitanya pandit wrote:


Hi list,
I have a NSTableView, and i display a menu when the user right  
clicks a row, this menu allows the user to delete that item.

My problem is, how do i get the row which was right clicked?

Consider this: currently the row#1 is selected and the user right  
clicks row#3 the row#3's cell will have a blue border,
now in the right click's menu's action method if i call [tableview  
selectedRow]; it'll return "1" where as what i want is "3"


How do i identify the row that was right clicked?


clickedRow
Returns the index of the row the user clicked to trigger an action  
message.


- (NSInteger)clickedRow

Return Value
The index of the row the user clicked to trigger an action message.  
Returns –1 if the user clicked in an area of the table view not  
occupied by table rows.


Discussion
The return value of this method is meaningful only in the target’s  
implementation of the action or double-action method.


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

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Binding question

2008-10-28 Thread Quincey Morris

On Oct 28, 2008, at 12:58, Quincey Morris wrote:


return [NSSet set withObject: @"filePath"];


Er, I meant:


return [NSSet setWithObject: @"filePath"];


Also, I think it's worth adding that it's also not bad practice to  
have properties that are not KVO-compliant (that is, properties that  
don't generate the proper KVO notifications when their value changes).  
If you're not going to observe them (e.g. aren't going to bind  
anything to them), there's no need to write code to make them  
observable.



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: ASL & Unicode in Xcode's Console

2008-10-28 Thread Karl Moskowski


On 28-Oct-08, at 4:03 PM, Jason Coco wrote:



This is a known issue... you can see where the mangling happens in  
the source code online when writing to stderr... the characters
are properly encoded when sent to syslog and will show up correctly  
in asl queries and the console application, as you saw. I output
japanese to logs a lot and have never really had a problem, except  
that during debugging I have to use console in those cases and
not rely on general output. There are a number of bug reports on the  
issue, but I doubt it's a very high priority since it write the log

to the database correctly.

If you absolutely need this functionality, it's actually encoding it  
in some visual encoding form (you can see more about the form

in the source code) so you could, in theory, handle it if you had to.

Also, you should not be using non-ascii characters in string  
literals :) hopefully you're just doing this to demonstrate the  
issue. You should

be doing something like this:

char *hiragana_a = { 0xE3, 0x81, 0x82, 0x00 };
NSLog(@"%@", [NSString stringWithCString:a  
encoding:NSUTF8StringEncoding]);

asl_log(client, NULL, ASL_LEVEL_ERR, a);



Thanks, Jason.

Yeah, it was just for demo purposes. In actuality, the messages will  
be constructed, e.g., from file names.


Anyway, I've filed a bug (#6326169), in case anyone wants to jump on  
the bandwagon.



Karl Moskowski <[EMAIL PROTECTED]>
Voodoo Ergonomics Inc. 



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: Binding question

2008-10-28 Thread Jean-Nicolas Jolivet
Well, I think that pretty much answers all my questions! Thanks a lot 
for the detailed explanation!  I understand the KVC/KVO principle much 
better now! :)


Jean-Nicolas Jolivet

Quincey Morris wrote:

On Oct 28, 2008, at 12:30, Jean-Nicolas Jolivet wrote:

One more thing, you mentioned the term "KVO Compliance"... I 
understand that this means to send the proper notifications when a 
change to my property has been made...


But: would it be considered bad practice if my file class does have a 
property that is used just for displaying purpose (For example, by 
combining other properties (fileName, extension, size) into a nicely 
formatted string) to display in a tableView... by bad practice I 
mean: I know that this property is only used for display purpose and 
will never be edited... but will be modified when other properties 
(filePath etc..) have been modified?


No, it's not bad practice to have a "derived" property for display 
purposes. That's basically what -[NSObject description] is, for 
example, and that's a *really* important property.


Would it mean that this property is not "KVO compliant" and if so, is 
it a problem? Assuming I know it should never be "observed" (i.e. it 
will never be modified directly, only by modifying other properties)...


Not sure what this means. "Observed" doesn't mean modifiable. It means 
some other object is watching for change notifications. In particular, 
if you bind something to your derived property (which is what you're 
doing in your table view), the property gets observed by the binding, 
and so must be KVO compliant.


basically from your post I understand that.. technically, it's not a 
problem to do it like that, but... would it be considered bad 
practice since the property is not KVO compliant? and if so, is it 
even possible to make it KVO compliant?


There's at least 2 ways. If you have a setter for "filePath", you can 
do this:


- (void) setFilePath: (NSString*) newValue {
[self willChangeValueForKey: @"fileName"];
filePath = newValue; // plus retain/release code too, if you 
aren't using garbage collection

[self didChangeValueForKey: @"fileName"];
}

Or you can have it happen automatically:

@implementation File
+ (NSSet*) keyPathsForValuesAffectingFileName {
return [NSSet set withObject: @"filePath"];
}
...

(The latter is the Leopard way. For Tiger, you use 
'setKeys:triggerChangeNotificationsForDependentKey:' instead.)



___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/silvertab%40videotron.ca

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]


Getting localized NSPredicateEditor

2008-10-28 Thread Markus Spoettl

Hello List,

  is there a way to make NSPredicateEditor play nice with localized  
versions of an application, meaning that it's rule operators and  
criteria are translated to the language the rest of the application is  
using?


Right now it appears that NSPredicateEditor uses English operator  
names (and compound criteria descriptions), regardless of which  
language is used.


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]

NSTableView right clicked row

2008-10-28 Thread chaitanya pandit

Hi list,
I have a NSTableView, and i display a menu when the user right clicks  
a row, this menu allows the user to delete that item.

My problem is, how do i get the row which was right clicked?

Consider this: currently the row#1 is selected and the user right  
clicks row#3 the row#3's cell will have a blue border,
now in the right click's menu's action method if i call [tableview  
selectedRow]; it'll return "1" where as what i want is "3"


How do i identify the row that was right clicked?

Thanks
Chaitanya

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: ASL & Unicode in Xcode's Console

2008-10-28 Thread Jason Coco


On Oct 28, 2008, at 14:01 , Karl Moskowski wrote:

I've been experimenting with replacing my app's logging with Apple  
System Logger. When it comes to multi-byte characters, every thing  
looks OK in Console.app. However, Xcode's console shows things  
incorrectly. It probably won't come up often, but I'm wondering if  
it's fixable.


For example, this bit of code:
NSLog(@"あ");
	aslclient client = asl_open(NULL, NULL, ASL_OPT_STDERR); // add  
STDERR's fd to the connection's set of fds so things show up in  
Xcode's console

asl_log(client, NULL, ASL_LEVEL_ERR, "あ");
asl_close(client);

Results in this output in Xcode:
2008-10-28 13:49:19.767 ASL[3484:10b] あ
Tue Oct 28 13:49:19 iMac.local ASL[3484] : \M-c\M^A\M^B

The call to NSLog displays correctly, but asl_log doesn't.


This is a known issue... you can see where the mangling happens in the  
source code online when writing to stderr... the characters
are properly encoded when sent to syslog and will show up correctly in  
asl queries and the console application, as you saw. I output
japanese to logs a lot and have never really had a problem, except  
that during debugging I have to use console in those cases and
not rely on general output. There are a number of bug reports on the  
issue, but I doubt it's a very high priority since it write the log

to the database correctly.

If you absolutely need this functionality, it's actually encoding it  
in some visual encoding form (you can see more about the form

in the source code) so you could, in theory, handle it if you had to.

Also, you should not be using non-ascii characters in string  
literals :) hopefully you're just doing this to demonstrate the issue.  
You should

be doing something like this:

char *hiragana_a = { 0xE3, 0x81, 0x82, 0x00 };
NSLog(@"%@", [NSString stringWithCString:a  
encoding:NSUTF8StringEncoding]);

asl_log(client, NULL, ASL_LEVEL_ERR, a);

:) J

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Binding question

2008-10-28 Thread Quincey Morris

On Oct 28, 2008, at 12:30, Jean-Nicolas Jolivet wrote:

One more thing, you mentioned the term "KVO Compliance"... I  
understand that this means to send the proper notifications when a  
change to my property has been made...


But: would it be considered bad practice if my file class does have  
a property that is used just for displaying purpose (For example, by  
combining other properties (fileName, extension, size) into a nicely  
formatted string) to display in a tableView... by bad practice I  
mean: I know that this property is only used for display purpose and  
will never be edited... but will be modified when other properties  
(filePath etc..) have been modified?


No, it's not bad practice to have a "derived" property for display  
purposes. That's basically what -[NSObject description] is, for  
example, and that's a *really* important property.


Would it mean that this property is not "KVO compliant" and if so,  
is it a problem? Assuming I know it should never be "observed" (i.e.  
it will never be modified directly, only by modifying other  
properties)...


Not sure what this means. "Observed" doesn't mean modifiable. It means  
some other object is watching for change notifications. In particular,  
if you bind something to your derived property (which is what you're  
doing in your table view), the property gets observed by the binding,  
and so must be KVO compliant.


basically from your post I understand that.. technically, it's not a  
problem to do it like that, but... would it be considered bad  
practice since the property is not KVO compliant? and if so, is it  
even possible to make it KVO compliant?


There's at least 2 ways. If you have a setter for "filePath", you can  
do this:


- (void) setFilePath: (NSString*) newValue {
[self willChangeValueForKey: @"fileName"];
		filePath = newValue; // plus retain/release code too, if you aren't  
using garbage collection

[self didChangeValueForKey: @"fileName"];
}

Or you can have it happen automatically:

@implementation File
+ (NSSet*) keyPathsForValuesAffectingFileName {
return [NSSet set withObject: @"filePath"];
}
...

(The latter is the Leopard way. For Tiger, you use  
'setKeys:triggerChangeNotificationsForDependentKey:' instead.)



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Code signing validation

2008-10-28 Thread Jean-Daniel Dupas
You may fill a feature request to ask Apple to publish this API that  
is part of the Security Framework:


http://www.opensource.apple.com/darwinsource/10.5.5/libsecurity_codesigning-33803/lib/SecStaticCode.h



Le 28 oct. 08 à 10:36, [EMAIL PROTECTED] a écrit :


Hello list

Having implemented code signing for my app I wanted to be able to do  
a quick visual check that things were as they should be.
I used the following to display a code signing validation  message  
in the app About window for both the application bundle and a couple  
of auxiliary executables.


Has anyone else done anything similar, or hopefully, better?
It would probably be a good idea to also check the signing identity.


#import 

typedef enum {
CodesignUnrecognised = -2,
CodesignError = -1,
CodesignOkay = 0,
CodesignFail = 1,
CodesignInvalidArgs = 2,
CodesignFailedRequirement = 3,
} CodesignResult;

@interface MGSCodeSigning : NSObject {
NSString *_resultString;
}

@property (copy) NSString *resultString;

- (CodesignResult)validateExecutable;
- (CodesignResult)validatePath:(NSString *)path;
- (CodesignResult)validateApplication;

@end

#import "MGSCodeSigning.h"
#include 

@implementation MGSCodeSigning

@synthesize resultString = _resultString;

/*

validate executable

*/
- (CodesignResult)validateExecutable
{
   Dl_info info;
int errDlAddr = dladdr( (const void *)__func__, &info );
   if(errDlAddr == 0) {
return CodesignError;
   }
char *exec_path = (char *)(info.dli_fname);

	NSString *path = [NSString stringWithCString:exec_path  
encoding:NSUTF8StringEncoding];

return [self validatePath:path];
}
/*

validate this application

*/
- (CodesignResult)validateApplication
{
return [self validatePath:[[NSBundle mainBundle] bundlePath]];
}
/*

validate path

*/
- (CodesignResult)validatePath:(NSString *)path
{
self.resultString = nil;
int status = CodesignError;

@try {
		NSArray *arguments = [NSArray arrayWithObjects: @"--verify",  
path,  nil];

NSTask *task = [[NSTask alloc] init];

[task setArguments:arguments];
[task setLaunchPath:@"/usr/bin/codesign"];
[task setStandardOutput:[NSFileHandle 
fileHandleWithNullDevice]];   
[task setStandardError:[NSFileHandle 
fileHandleWithNullDevice]];
[task launch];
[task waitUntilExit];
status = [task terminationStatus];

switch (status) {
case CodesignOkay:
self.resultString = NSLocalizedString(@"Valid", @"Codesign  
okay.");

break;

case CodesignFail:
self.resultString = NSLocalizedString(@"Invalid", @"Codesign  
failed.");

break;

case CodesignInvalidArgs:
self.resultString = NSLocalizedString(@"Invalid arguments",  
@"Codesign invalid arguments");

break;

case CodesignFailedRequirement:
self.resultString = NSLocalizedString(@"Failed requirement",  
@"Codesign failed requirement.");

break;

default:
self.resultString = NSLocalizedString(@"Unrecognised response",  
@"Codesign unrecognised response.");

status = CodesignUnrecognised;
break;

}

if (status != CodesignOkay) {
NSLog(@"codesign failure: %@", self.resultString);
}


[EMAIL PROTECTED] (NSException *e) {
NSLog(@"Exception launching codesign: %@", [e reason]);
return CodesignError;
}

return status;
}

@end





___

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

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

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

This email sent to [EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Binding question

2008-10-28 Thread Jean-Nicolas Jolivet
Mmmm seems like value transformer would be another way to do it! I will 
definitely look into both methods! Since my property is in fact only 
used for display purposes, I guess it would make sense to use a 
transformer to display it...


Jean-Nicolas Jolivet

David Duncan wrote:

On Oct 28, 2008, at 12:19 AM, Jean-Nicolas Jolivet wrote:

Now, assuming I want to bind an array of those File objects to a 
Table View, however, what I would like to display in the table's 
column is not the complete path of the file, but just the file name 
(that I get with [filePath lastPathComponent])


What would be the best way to achieve that?  Basically: I want to 
bind my column to a property that doesn't really exist (i.e. only 
part of the filePath property)...



You can use a custom value transformer. You would implement 
+transformedValueClass to return an [NSString class] and 
-transformedValue: to return the lastPathComponent of the passed in 
string. Set the transformer for the binding and you should be set.


There are a few samples that you can reach from the Xcode docs 
demonstrating this (just look up NSValueTransformer).

--
David Duncan
Apple DTS Animation and Printing




___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Binding question

2008-10-28 Thread Jean-Nicolas Jolivet

Thanks a lot, this was extremely helpful!

One more thing, you mentioned the term "KVO Compliance"... I understand 
that this means to send the proper notifications when a change to my 
property has been made...


But: would it be considered bad practice if my file class does have a 
property that is used just for displaying purpose (For example, by 
combining other properties (fileName, extension, size) into a nicely 
formatted string) to display in a tableView... by bad practice I mean: I 
know that this property is only used for display purpose and will never 
be edited... but will be modified when other properties (filePath etc..) 
have been modified?


Would it mean that this property is not "KVO compliant" and if so, is it 
a problem? Assuming I know it should never be "observed" (i.e. it will 
never be modified directly, only by modifying other properties)... 
basically from your post I understand that.. technically, it's not a 
problem to do it like that, but... would it be considered bad practice 
since the property is not KVO compliant? and if so, is it even possible 
to make it KVO compliant?


Jean-Nicolas Jolivet

Quincey Morris wrote:

On Oct 28, 2008, at 00:19, Jean-Nicolas Jolivet wrote:

Is it ok to bind my column to a property that is, in fact, not a 
property but just a method that returns a string... or should I 
create an actual instance variable "NSString *fileName" with a 
regular getter and setter?


A property *is* just a method (or, if readwrite, a pair of methods -- 
the getter and the setter). The instance variable, if there is one, is 
"merely" an implementation detail within the class. Some properties 
don't use an instance variable (NSString's lastPathComponent property 
almost certainly doesn't, for example). Some properties (like your 
"fileName") use an instance variable, but compute a value from it.


Furthermore, assuming that your File class has both filePath and 
fileName properties, then your fileName implementation:


return [filePath lastPathComponent];

might alternatively be:

return [self.filePath lastPathComponent];

If you get the difference, you're home free, conceptually. (The 2nd 
one extracts the file name from your filePath property, without any 
assumption about how the property is implemented. The 1st one uses a 
convenient instance variable that happens to contain the information 
you want. Either approach is fine in this case, but in more 
complicated cases, it's important to distinguish between the value of 
the property and the value of some variable.)


Finally, you also need to pay attention to KVO compliance. Assuming 
your filePath property is compliant (meaning that changes to it 
produce the proper KVO notifications), your fileName property isn't 
(unless the filePath never changes in a File object after it is 
initialized, in which case the question is moot).


HTH
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/silvertab%40videotron.ca

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: NSPredicateEditor error

2008-10-28 Thread Peter Ammon


On Oct 27, 2008, at 10:07 PM, Chris Idou wrote:



I'm getting the following error:

In , different number of items (3)  
than predicate template views (4) for template 0x12487e0: [move:] [] NSStringAttributeType>


From experimenting, the only difference between the  
NSPredicateEditorRowTemplate that is failing and my other ones that  
work fine, is that this one has a NSButton in its list of views.


Has anyone else seen this before, and have any insight?


One reason for this message (which could be a lot clearer) is that  
templateViews contains a NSPopUpButtonwith no items.   
NSPredicateEditor doesn't support empty popup buttons yet.  Does that  
help?


-Peter

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Binding question

2008-10-28 Thread Quincey Morris

On Oct 28, 2008, at 00:19, Jean-Nicolas Jolivet wrote:

Is it ok to bind my column to a property that is, in fact, not a  
property but just a method that returns a string... or should I  
create an actual instance variable "NSString *fileName" with a  
regular getter and setter?


A property *is* just a method (or, if readwrite, a pair of methods --  
the getter and the setter). The instance variable, if there is one, is  
"merely" an implementation detail within the class. Some properties  
don't use an instance variable (NSString's lastPathComponent property  
almost certainly doesn't, for example). Some properties (like your  
"fileName") use an instance variable, but compute a value from it.


Furthermore, assuming that your File class has both filePath and  
fileName properties, then your fileName implementation:


return [filePath lastPathComponent];

might alternatively be:

return [self.filePath lastPathComponent];

If you get the difference, you're home free, conceptually. (The 2nd  
one extracts the file name from your filePath property, without any  
assumption about how the property is implemented. The 1st one uses a  
convenient instance variable that happens to contain the information  
you want. Either approach is fine in this case, but in more  
complicated cases, it's important to distinguish between the value of  
the property and the value of some variable.)


Finally, you also need to pay attention to KVO compliance. Assuming  
your filePath property is compliant (meaning that changes to it  
produce the proper KVO notifications), your fileName property isn't  
(unless the filePath never changes in a File object after it is  
initialized, in which case the question is moot).


HTH
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Binding question

2008-10-28 Thread David Duncan

On Oct 28, 2008, at 12:19 AM, Jean-Nicolas Jolivet wrote:

Now, assuming I want to bind an array of those File objects to a  
Table View, however, what I would like to display in the table's  
column is not the complete path of the file, but just the file name  
(that I get with [filePath lastPathComponent])


What would be the best way to achieve that?  Basically: I want to  
bind my column to a property that doesn't really exist (i.e. only  
part of the filePath property)...



You can use a custom value transformer. You would implement  
+transformedValueClass to return an [NSString class] and - 
transformedValue: to return the lastPathComponent of the passed in  
string. Set the transformer for the binding and you should be set.


There are a few samples that you can reach from the Xcode docs  
demonstrating this (just look up NSValueTransformer).

--
David Duncan
Apple DTS Animation and Printing

___

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

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

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

This email sent to [EMAIL PROTECTED]


Binding question

2008-10-28 Thread Jean-Nicolas Jolivet
I'm reading about binding and KVC/KVO... and I have a question for which 
I can't seem to find an answer... I'll use a simple example, it'll be 
easier to explain that way...


Let's say I have a simple class called "File"... my File class has a 
property called filePath which is an NSString representing the path of 
that file...


Now, assuming I want to bind an array of those File objects to a Table 
View, however, what I would like to display in the table's column is not 
the complete path of the file, but just the file name (that I get with 
[filePath lastPathComponent])


What would be the best way to achieve that?  Basically: I want to bind 
my column to a property that doesn't really exist (i.e. only part of the 
filePath property)...


I did create a method called "- NSString *fileName" which only does this:
return [filePath lastPathComponent];

It seems to work if I bind my table's column to the 
"arrangedObjects.fileName"  model key but I am wondering if it is a good 
idea to do it like this? Basically the "fileName" method "acts" as if it 
was the getter of a "fileName" property, but that property doesn't 
really exist...it just returns a part of my filePath property...


It's a bit harder to explain than I thought it would be but to sum it 
up: Is it ok to bind my column to a property that is, in fact, not a 
property but just a method that returns a string... or should I create 
an actual instance variable "NSString *fileName" with a regular getter 
and setter? It seems like there are a lot of cases where the data I 
want to show in my TableView is not an actual property of my class but a 
formatted or modified version of it.. Also, keep in mind that the table 
column is NOT editable so I don't really need a setter...


Any help/suggestions would be appreciated! If I'm unclear let me know 
I'll try to explain it better!


Jean-Nicolas Jolivet
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Why "self"? (Was: Newbie: Referencing Objects)

2008-10-28 Thread Siavash
Coming from a Flex/Flash background I will have to say that there is  
BIG differences between ActionScript 2.0 and 3.0. AS 3.0 is a powerful  
OOP language and AS 2.0 is not. That being said, the same object  
oriented principles do apply in ActionScript 3.0 the same as Obj-C and  
the Cocoa Framework. I would say a good tutorial/book on MVC structure  
would clear up some things. Also obj-c is not as forgiving as  
ActionScript syntax wise.  I could see the difficulty coming from  
Flash IDE into Cocoa. I think the transition is a little easier for a  
Flex Developer. Many mx.controls.* UI classes are similar to Cocoa UI  
classes except instead of listening for events you have targets,  
selectors, and delegates.

--

Siavash Ghamaty


On Oct 27, 2008, at 8:40 PM, Graham Cox wrote:



On 28 Oct 2008, at 2:30 pm, john fogg wrote:


I come from coding in Actionscript (Flash) and there things are
apparently quite different.



FWIW, I tried to do some coding in Actionscript a few years ago  
after being immersed in C++ for many years and then Objective-C/ 
Cocoa for a few years. To say that it was an exercise in utter  
frustration is an understatement. As a programmer in these "real"  
languages I found AS to be really mickey-mouse.


Others' opinions will no doubt vary but I suspect that if you know  
AS well, moving to what I call a real language is going to mean  
unlearning a huge heap of rubbish. Sorry, just my opinion.


--Graham
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/coldsweat%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]


[moderator] Re: Can we ask iPhone questions yet? - YES

2008-10-28 Thread Scott Anguish
Please, take this discussion off-list. Either to cocoa-dev-admins, or  
to private email.


Discussing this here isn't going to solve the problem, and it isn't  
helping with the signal to noise ratio.


I'll post new guidelines for the list just as soon as I have them.

scott
[moderator]


On 28-Oct-08, at 1:45 PM, dreamcat7 wrote:


Hello!

I posted a number questions to this discussion list. They were all  
questions about programming in the Cocoa environment. Sometimes my  
questions have been ignored / not replied to, however this is mostly  
because of my own poor writing skills rather than anything most  
siniister. There have been only a couple of occasions where my email  
was widtheld from the mailinglist - and in those cases it was  
because I had mistakenly sent my message from the wrong email account.


___

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

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

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

This email sent to [EMAIL PROTECTED]


ASL & Unicode in Xcode's Console

2008-10-28 Thread Karl Moskowski
I've been experimenting with replacing my app's logging with Apple  
System Logger. When it comes to multi-byte characters, every thing  
looks OK in Console.app. However, Xcode's console shows things  
incorrectly. It probably won't come up often, but I'm wondering if  
it's fixable.


For example, this bit of code:
NSLog(@"あ");
	aslclient client = asl_open(NULL, NULL, ASL_OPT_STDERR); // add  
STDERR's fd to the connection's set of fds so things show up in  
Xcode's console

asl_log(client, NULL, ASL_LEVEL_ERR, "あ");
asl_close(client);

Results in this output in Xcode:
2008-10-28 13:49:19.767 ASL[3484:10b] あ
Tue Oct 28 13:49:19 iMac.local ASL[3484] : \M-c\M^A\M^B

The call to NSLog displays correctly, but asl_log doesn't.

(In case it doesn't survive email, the character in quotes is Hiragana  
Letter A, from Leopard's Character Palette > East Asian Scripts >  
Hiragana > first character.)



Karl Moskowski <[EMAIL PROTECTED]>
Voodoo Ergonomics Inc. 



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: Can we ask iPhone questions yet?

2008-10-28 Thread Scott Anguish

I've asked for clarification.

In the meantime, this type of feedback should be sent to cocoa-dev- 
admins rather than to the list at large



On 28-Oct-08, at 10:42 AM, Nicko van Someren wrote:


On 28 Oct 2008, at 10:51, Colin Barrett wrote:

On Tue, Oct 28, 2008 at 1:27 AM, Torsten Curdt <[EMAIL PROTECTED]>  
wrote:

IMO that does not really answer the question :)


You are legally able to yes, assuming you have accepted the new NDA.

However, as I understand it, your post would be off topic,


Really?  This list is called cocoa-dev, not cocoa-but-only-non-touch- 
cocoa-dev.


Seriously, the similarities between Cocoa and Cocoa Touch are much  
greater than the differences.  While there are many components which  
behave differently in the UIxxx form to the equivalent NSxxx form,  
the underlying structure is essentially the same.  Most discussions  
regarding the Foundation components are going to be relevant to both  
platforms, as are discussions of CoreAnimation.  Many of the UIView  
subclasses look different on screen but there is substantial overlap  
of both their functionality and their methods and even if Cocoa  
Touch were specifically excluded from this list (which as far as I  
can tell it currently is not) discussion of the differences would  
surely be of relevance to this list.


As such I don't see any reason whatsoever why people should not post  
questions about about Cocoa Touch on this list. That said, perhaps  
the moderators who were so quick to pounce on all who previously  
raised the topic could now just as swiftly give us some clear  
guidance.


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Code signing validation

2008-10-28 Thread Conor

> even a removed localisation would then be fatal

Just a clarification: removing a localization does not affect the  
signature (http://atomic-bird.com/blog/2007/11/leopard-code-signing-questions-and-answers 
).


Regards,
Conor
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Can we ask iPhone questions yet? - YES

2008-10-28 Thread dreamcat7

Hello!

I posted a number questions to this discussion list. They were all  
questions about programming in the Cocoa environment. Sometimes my  
questions have been ignored / not replied to, however this is mostly  
because of my own poor writing skills rather than anything most  
siniister. There have been only a couple of occasions where my email  
was widtheld from the mailinglist - and in those cases it was because  
I had mistakenly sent my message from the wrong email account.


I would say that in the absence of any input from the moderator, its  
best to look at the TC, which is Apple's official position on the  
matter. "we like to keep things simple" is stated pretty prominently  
in the TC, as short and straightforward as it is.


http://lists.apple.com/tc.html

The penalty for posting a message which contravenes the TC (at most)  
is that your message will be widtheld / deleted. There is a caveat in  
the TC which says that the list moderator has the final say. However  
in the absence / failure of the person who is the list moderator it  
simply falls down to you (the poster). Mailing lists are (by the  
majority part) supposed to be self - moderating and its a feature of  
list etiquette to take onboard the general consensus.


If the moderator at a later time (after your post) decides to  
widthdraw your message because it contravenes the policy - that is  
part of their function. You simply need to be aware that when you post  
a message to this list - it may be widthdrawn. Only because cocoa-dev  
mailing list has grown to be such a large mailinglist - the Moderators  
(Scot included) created special "list guidelines". There is no web  
page stating the guidelines, however they simply state - comply with  
the Apple iphone NDA.


If you follow the NDA and respect the conditions of the contract on  
those intellectual property which you refer to in your message then  
your message cannot be held against you in a legal action.


So what are you all still complaining about ? You should all be  
celebrating your american so called "free speech" by asking many  
hundreds of whimsical questions about iphone development. Surely you  
must be allowed exercise your own statutes / legal rights [or those of  
the country in which the list is served] ?


And by the way it should be irrelevant whether Apple chooses to regard  
you as an iPhone developer or active iPhone developer. As long as you  
are an individual that has agreed to the terms of the Apple  
contractual agreement, and Apple has chosen to provide those  
intellectual property materials **to you**. Then you are free to  
discuss those materials (to which you must discuss only the version of  
those materials which was marked as "released" by Apple).


This last point is important to understand if you who work for a  
company which is in partnership with Apple.
You should also understand that the Apple mailing-list moderator is  
not a member of the Apple Legal department, and taking a legal action  
against you is unlikely to fall into their remit. Their function is  
simply to exercise due judgement and remove those messages from users  
which contravene the mailing list TC. Here it is again


http://lists.apple.com/tc.html


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Turning off Auto Complete feature for NSTextField

2008-10-28 Thread Douglas Davidson


On Oct 28, 2008, at 10:37 AM, Adil Saleem wrote:

Thank you, implementing the delegate method and returning nothing  
from it worked.


By the way, this is pretty basic stuff. I think there should have  
been a line or two about it in the NSTextField documentation.


Feel free to file a bug against the documentation if you feel it is  
lacking.  However, you should be aware in general that you always need  
to look at the documentation for an object's superclasses as well as  
for the class itself--this particular delegate method is documented  
with NSControl--and that you should look at the headers as well as the  
reference documentation.


Douglas Davidson

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Turning off Auto Complete feature for NSTextField

2008-10-28 Thread Adil Saleem
Thank you, implementing the delegate method and returning nothing from it 
worked. 

By the way, this is pretty basic stuff. I think there should have been a line 
or two about it in the NSTextField documentation.

Thank you.


--- On Tue, 10/28/08, John Joyce <[EMAIL PROTECTED]> wrote:
From: John Joyce <[EMAIL PROTECTED]>
Subject: Re:  Turning off Auto Complete feature for NSTextField
To: cocoa-dev@lists.apple.com
Date: Tuesday, October 28, 2008, 7:40 AM

On Oct 28, 2008, at 8:42 AM, [EMAIL PROTECTED] wrote:

>  Turning off Auto Complete feature for NSTextField
> To: cocoa-dev@lists.apple.com
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=us-ascii
>
> Hi,
>
> I am encountering a small problem. I am using a simple NSTextField  
> in my application. This textfield is editable. When user starts  
> entering some text, the auto complete is by default ON, so on  
> pressing escape key a list of suggestions is displayed. I don't want  
> this feature. How can i turn off the auto complete feature for  
> NSTextField. I couldn't find any option in Interface Builder or the  
> documentation of NSTextField.
>
> Thanx
Are you sure you're using NSTextField and not NSTextView?

The behavior is part of NSTextView and the two are a bit different.
You'll need to override some methods, so you'll want to subclass.
You might be surprised how often the completion is available in apps.

NSTextField does not appear to have the same methods.

  Oddly, both do have the Delegate method  
control:textView:completions:forPartialWordRange:indexOfSelectedItem:

This is pretty simple to take over.
You just hijack it by giving it nothing!
An empty array. Of course this will still give you the system alert  
sound if esc is pressed to autocomplete.
The normal set of completions will come from Dictionary.app so they  
will be locale-dependent.
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/adilsaleem01%40yahoo.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: Message Forwarding Overhead / Performance

2008-10-28 Thread Michael Ash
On Tue, Oct 28, 2008 at 11:30 AM, Jerry Krinock <[EMAIL PROTECTED]> wrote:
> Although the documentation on message forwarding [1] explains that alot of
> stuff needs to happen, it does not say "Warning: Don't do this in
> performance-critical applications".

Such a warning would be foolish, since that isn't true in the general
case. There are plenty of operations which take *vastly* longer than
message forwarding which don't come with that warning either.

>  So I made a test tool which forwarded a
> simple message with one integer argument to a class which would add it to
> its 'sum', an instance variable.
>
> Sending this message 10,000 times and comparing the difference in elapsed
> time with a similar task that sends a similar message directly, I found that
> the average overhead for forwarding one message on my Intel Core 2 Duo Mac
> Mini was about 20 microseconds.
>
> That would be unacceptably slow for an iterated operation in a my
> application, and I decided to not use message forwarding in this particular
> case.
>
> Has anyone ever seen better performance for message forwarding?

If 20us is too long for you (is it really? do you need to do this more
than 50,000 times per second?) and you can require 10.5 and you just
need strict forwarding of the identical message to another object (as
opposed to intercepting the message and doing more clever processing),
then the -forwardingTargetForSelector: method is likely to give you
considerably better performance.

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: Code signing validation

2008-10-28 Thread [EMAIL PROTECTED]
I am aware of the -o kill flag but I am not sure that killing my code  
stone dead is what I require in this case.

Any resource change, even a removed localisation would then be fatal.
For me a string representation of the code signing is more of a sanity  
check.


I just pass the "-o kill" flags to codesign. That way if the app has  
been tampered with it won't launch. Make sure you are using Xcode  
3.1 or later so the codesigning is done after the stripping.


Dave


Jonathan Mitchell

Central Conscious Unit
http://www.mugginsoft.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: Finding files before app loads

2008-10-28 Thread I. Savant
On Tue, Oct 28, 2008 at 12:09 PM, Glover,David
<[EMAIL PROTECTED]> wrote:

> I am now using [NSFileManager defaultManager], and all is working well
> (noob!) :o)

  There are a lot of objects like this that follow the singleton
design pattern. Always consult the documentation when using an
unfamiliar class. The class methods section of any given class's API
reference will make it obvious if it's intended to be treated as a
singleton.

--
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: filtering a tableView from a pulldown

2008-10-28 Thread I. Savant
> The pulldown is bound as follows:
> content: arrangedObjects[PurchaseOrder Array Controller(NSArray Controller)]
> content values: Purchase ORder Array Controller
> arrangedObjects.orderReference

  These bindings seem fine. How about selection? One of the popup's
selection bindings should be bound to the PurchaseOrder Array
Controller's selection.

> The Table view has 6 columns, one of which is the Purchase Order number (as
> displayed in the pulldown)

  This seems wrong. If your table is intended to display the "line
items" belonging to the order, why have the order number on each line
item? In any case, you need a *separate* controller to reflect the
line items of the selected order. Create an array controller and set
it up so that it holds your "line item" objects. We'll call it your
"Line Item Array Controller". Its contents should be bound to
PurchaseOrder Array Controller's selection.lineItems (or whatever the
key path is to your order's line items).

  Your table view's columns should each be bound to the Line Item
Array Controller's arrangedObjects.property (where "property" refers
to individual properties such as "item number", "description",
"quantity", etc.).

  This way, the PurchaseOrder Array Controller lists and maintains
selection of purchase orders, where the Line Item Array Controller
lists the line items for the selected purchase order.

  Spend as much time as you can manage reading over the documentation
I sent you previously. If there are things you don't understand, post
your questions back to the list for clarification.

--
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: Subview display problem

2008-10-28 Thread DKJ

On 28 Oct, 2008, at 08:55, DKJ wrote:
Maybe I should just make my help info into a PDF file, and display  
that on a CATextLayer.




Oops, it's the contents property of a CALayer I was thinking of here.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Message Forwarding Overhead / Performance

2008-10-28 Thread Bill Bumgarner

On Oct 28, 2008, at 8:30 AM, Jerry Krinock wrote:
Although the documentation on message forwarding [1] explains that  
alot of stuff needs to happen, it does not say "Warning: Don't do  
this in performance-critical applications".  So I made a test tool  
which forwarded a simple message with one integer argument to a  
class which would add it to its 'sum', an instance variable.


Sending this message 10,000 times and comparing the difference in  
elapsed time with a similar task that sends a similar message  
directly, I found that the average overhead for forwarding one  
message on my Intel Core 2 Duo Mac Mini was about 20 microseconds.


That would be unacceptably slow for an iterated operation in a my  
application, and I decided to not use message forwarding in this  
particular case.


That would not surprise me.   An absolute microseconds overhead isn't  
a terribly useful measure without knowing the total # of  
microseconds.  In general, measuring as a factor of speed -- 1.2x 20x  
200x is more widely applicable (tends to be more consistent across  
different CPUs, for example).


It is highly atypical to employ a design pattern that involves message  
forwarding in the midst of a tight loop.   While your test case does  
test the absolute overhead, it doesn't test what is typically found in  
the real world.


How many times does your iterated operation actually iterate?   Human  
perception generally has a response granularity somewhere around about  
120-160 msecs.  Your users being above average, let's call it  
100msecs.  Slight apples and oranges here;  "response time" is  
literally "time to respond" and we are really considering "perception  
of how long something took".  Same ballpark and we are going on the  
highly optimistic side.


Given 20 microseconds overhead, your loop would have to iterate 5000  
times to incur a delay that the user might perceive.


And that, of course, assumes that 20 microseconds of overhead even  
matters in your loop.  If your actual operation is, say, 50  
microseconds then -- sure -- that 33% overhead will add up.   At 500  
microseconds, you are looking 4% overhead for that one operation and,  
quite likely, a fraction of percentage of total CPU time.


So... sure... message forwarding is slow.  But does it matter in your  
application?


b.bum

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

RE: Finding files before app loads

2008-10-28 Thread Glover,David
I am now using [NSFileManager defaultManager], and all is working well
(noob!) :o)

-Original Message-
From: I. Savant [mailto:[EMAIL PROTECTED] 
Sent: 28 October 2008 15:49
To: Glover,David
Cc: Cocoa Development
Subject: Re: Finding files before app loads

On Tue, Oct 28, 2008 at 11:44 AM, Glover,David
<[EMAIL PROTECTED]> wrote:
> Sorry, I've found a problem creating an NSFileManager instance, but
this
> is resolved and the file checks are now working :o)

  Just as an aside, are you using +[NSFileManager defaultManager]? You
shouldn't have to create an instance yourself.

--
I.S.

Promethean Limited is a company registered in England and Wales with company 
number 1308938 and VAT number GB 572 2599 18
__

Promethean Ltd and or associated and or subsidiary companies :

The views expressed in this communication may not necessarily be 
the views held by Promethean Ltd and or associated and or subsidiary companies.

This e-mail is for the exclusive use of the addressee(s). Unauthorised 
disclosure, copying or distribution is prohibited.

This e-mail message has been swept for the presence of computer viruses.

Promethean Ltd and or associated and or subsidiary companies accepts no 
liability for any loss resulting from this email transmission.

Promethean, Promethean House, Lower Philips Road, Blackburn, Lancashire, BB1 
5TH, UK. Please update your records accordingly. Thank you!



*
This email has been checked by the e-Sweeper Service
*

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Documentation of NSArchiver streamtyped format

2008-10-28 Thread Michael Ash
On Mon, Oct 27, 2008 at 2:25 PM, Gregor Jasny <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm looking for documentation of the binary format that is written by
> NSArchiver. The file utility tells me that it's called
> "NeXT/Apple typedstream data, little endian, version 4, system 1000".

I'm not aware that Apple has documented either NSArchiver or
NSKeyedArchiver's format anywhere.

GNUStep can read at least NSKeyedArchiver, and possibly NSArchiver, as
it is able to decode some Apple nibs. I don't know if they've
documented the formats anywhere or if they've just written code for
it, but in either case that's where I'd start looking.

As a last note, I'm not sure why you want this information, but I'd
discourage you from writing something that relies on decoding Apple's
formats if at all possible. Since Apple hasn't documented them any
third-party reverse engineering is going to be error-prone. If you
can, use a different interchange format that you know can be decoded
reliably.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Security - Write to protected directory

2008-10-28 Thread Michael Ash
On Mon, Oct 27, 2008 at 5:43 PM, Michael Nickerson <[EMAIL PROTECTED]> wrote:
>
> On Oct 27, 2008, at 12:52 AM, Michael Ash wrote:
>
>> On Mon, Oct 27, 2008 at 12:07 AM, Michael Nickerson
>> <[EMAIL PROTECTED]> wrote:
>>>
>>> You can always set things up to ignore child processes:
>>> signal( SIGCHLD, SIG_IGN );
>>
>> It's bad to rely on this sort of global state, though. What if some
>> other bit of code relies on having a handler for this signal? (Of
>> course it is relying on this sort of global state too in that case,
>> but it takes two to screw things up)
>>
>
> Libraries and frameworks shouldn't be setting or relying on signals.  It is,
> as you say, a global state.  So really, if you haven't specifically set it
> in your app, you should be fine and if you have you should already know
> about it.

True enough, but it limits the usefulness because you can't safely use
it in a framework or plugin.

>>> That way, if the children aren't specifically reaped they don't stay
>>> around
>>> as zombies.  Do note that the wait functions *do* still work if you set
>>> that
>>> up, so this isn't going to mess anything up elsewhere that is reaping a
>>> child.
>>
>> How does that work, exactly? The whole purpose of the zombie is to
>> store the end state of the dead process so that wait() can pick it up.
>> If wait() still works, then what stores that end state if not a zombie
>> process? More to the point, if wait() still works, that implies that
>> *something*, *somewhere* is storing that end state. And if you never
>> call wait() but you continue to create children, that storage will
>> grow without limit, and this is bad. So it seems to me that either no,
>> wait() doesn't really work in this scenario, or in fact you still get
>> zombies or something like them. Am I missing something?
>>
>
> Sorry, my fault for replying late at night.  The wait functions will still
> block for the duration of the child process, but you do lose the state
> information about it.  So if you're relying on state information I suppose
> you would consider that broken, but if all you're using wait for is to wait
> until the child process has terminated, then it still works as intended.

Thanks for clarifying. Unfortunately this would then have the
potential to break other code, in frameworks or plugins, which relies
on wait() to return state information, so it seems like a dangerous
thing to use.

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: filtering a tableView from a pulldown

2008-10-28 Thread Amy Heavey

I can't work out what the controllers and key paths should be.

The pulldown is bound as follows:

content: arrangedObjects[PurchaseOrder Array Controller(NSArray  
Controller)]
content values: Purchase ORder Array Controller  
arrangedObjects.orderReference


The Table view has 6 columns, one of which is the Purchase Order  
number (as displayed in the pulldown)

that column is bound as:

content: arrangedObjects[PurchaseOrder Array Controller 13(NSArray  
Controller)]

content values: arrangedObjects.orderReference

does that help at all?

I created the master/details interface by alt-dragging from the data  
model. In the model there are purchaseORderItems that have the  
following attributes/relationships:


Attributes
qty
vendorsku

Relationships
product
purchaseOrder
shipment

The tableview shows all the purchaseOrderItems, and I want to filter  
it by the order reference in the pulldown above the tableview.



Many Thanks

Amy


On 28 Oct 2008, at 14:36, I. Savant wrote:

I have a pulldown button, and a tableview. They both seem to be  
displaying
the correct data, but I'd like to filter the content of the  
tableview based
on the selection in the pulldown button. I've tried all manner of  
binding

combinations but it doesn't seem to work.


  This is difficult to answer because you left out all the critical
details (controller names, key paths, etc.). All that is left is to
point you to the documentation:

Cocoa Bindings Programming Topics - Creating a Master-Detail Interface
http://developer.apple.com/documentation/Cocoa/Conceptual/ 
CocoaBindings/Tasks/masterdetail.html


--
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: Turning off Auto Complete feature for NSTextField

2008-10-28 Thread Douglas Davidson


On Oct 28, 2008, at 5:59 AM, Adil Saleem wrote:

I am encountering a small problem. I am using a simple NSTextField  
in my application. This textfield is editable. When user starts  
entering some text, the auto complete is by default ON, so on  
pressing escape key a list of suggestions is displayed. I don't want  
this feature. How can i turn off the auto complete feature for  
NSTextField. I couldn't find any option in Interface Builder or the  
documentation of NSTextField.


This is not autocompletion; this is completion upon user request, and  
we provide many APIs to control it.  The simplest would be to use the  
NSControl delegate method - 
control:textView:completions:forPartialWordRange:indexOfSelectedItem:  
if you are using an NSTextField, or the NSTextView delegate method - 
textView:completions:forPartialWordRange:indexOfSelectedItem: if you  
are using an NSTextView.  The proposed array of completions is passed  
in, and the delegate can modify this list and return it, or return nil  
to suppress completion.  The index of the initially selected  
completion can also optionally be set.


Douglas Davidson

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Subview display problem

2008-10-28 Thread DKJ

On 28 Oct, 2008, at 08:31, I. Savant wrote:

I'd turn off
all layers and make sure it's working normally without them.




Alas, after having the Help button method hide theView's CALayer,  
there's still no sign of my NSTextView subclass.


Maybe I should just make my help info into a PDF file, and display  
that on a CATextLayer. (I think PDF is one of the formats that can be  
used.)


I do recall someone saying a few days ago that CALayers and NSViews  
shouldn't be mixed: one or the other should be used exclusively.


Thanks very much for taking the time to look at this.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Finding files before app loads

2008-10-28 Thread I. Savant
On Tue, Oct 28, 2008 at 11:44 AM, Glover,David
<[EMAIL PROTECTED]> wrote:
> Sorry, I've found a problem creating an NSFileManager instance, but this
> is resolved and the file checks are now working :o)

  Just as an aside, are you using +[NSFileManager defaultManager]? You
shouldn't have to create an instance yourself.

--
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: Can we ask iPhone questions yet?

2008-10-28 Thread I. Savant
On Tue, Oct 28, 2008 at 11:30 AM, Nicko van Someren <[EMAIL PROTECTED]> wrote:

> ... I still think it would be useful to have a clear indication from our 
> shadowy overlords.

  Agreed, though keep in mind that *our* shadowy overlords have their
*own*, even *more* shadowy overlords called "Apple Legal" (or
"Denizens of Hell", whichever you prefer). As our favorite overlord
(Scott) has alluded to before, he's only given information to pass
along to the list. This is why it's not only useless to complain to
the list (or fight the moderator), but actively detrimental because it
amounts to a bunch of noise with no payoff.

  I think that is probably the biggest source of rudeness you've
detected in most of the responses here ... it's simple frustration.
The 'complaining-here-doesn't-help-so-knock-it-off-already' sentiment
born of one-too-many threads about the same helpless subject.

  In any case, I'm now doing no better than adding noise, so that's
the last I'll respond on-list. I'm happy to continue the debate
off-list if you'd like. That invitation goes for anybody, but keep in
mind that there is no animosity from my side, so the invitation is
conditional upon civility. :-)

--
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 files before app loads

2008-10-28 Thread Glover,David
Sorry, I've found a problem creating an NSFileManager instance, but this
is resolved and the file checks are now working :o)

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
om] On Behalf Of Glover,David
Sent: 28 October 2008 15:34
To: Cocoa Development
Subject: Finding files before app loads

Hi there,

 

I need to locate certain files and set the state of some objects in my
nib accordingly before the app is visible to the user.

 

I'm using fileExistsAtPath to look for the files when the awakeFromNib
method is invoked.  The files are definitely present, but
fileExistsAtPath always returns false on each search - please could
someone advise where I might be going wrong? 

 

Kind Regards

 

Dave

 


Promethean Limited is a company registered in England and Wales with
company number 1308938 and VAT number GB 572 2599 18
__

Promethean Ltd and or associated and or subsidiary companies :

The views expressed in this communication may not necessarily be 
the views held by Promethean Ltd and or associated and or subsidiary
companies.

This e-mail is for the exclusive use of the addressee(s). Unauthorised 
disclosure, copying or distribution is prohibited.

This e-mail message has been swept for the presence of computer viruses.

Promethean Ltd and or associated and or subsidiary companies accepts no
liability for any loss resulting from this email transmission.

Promethean, Promethean House, Lower Philips Road, Blackburn, Lancashire,
BB1 5TH, UK. Please update your records accordingly. Thank you!



*
This email has been checked by the e-Sweeper Service
*

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/david.glover%40promethe
anworld.com

This email sent to [EMAIL PROTECTED]


*
This email has been checked by the e-Sweeper Service
*

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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 files before app loads

2008-10-28 Thread Glover,David
Hi there,

 

I need to locate certain files and set the state of some objects in my
nib accordingly before the app is visible to the user.

 

I'm using fileExistsAtPath to look for the files when the awakeFromNib
method is invoked.  The files are definitely present, but
fileExistsAtPath always returns false on each search - please could
someone advise where I might be going wrong? 

 

Kind Regards

 

Dave

 


Promethean Limited is a company registered in England and Wales with company 
number 1308938 and VAT number GB 572 2599 18
__

Promethean Ltd and or associated and or subsidiary companies :

The views expressed in this communication may not necessarily be 
the views held by Promethean Ltd and or associated and or subsidiary companies.

This e-mail is for the exclusive use of the addressee(s). Unauthorised 
disclosure, copying or distribution is prohibited.

This e-mail message has been swept for the presence of computer viruses.

Promethean Ltd and or associated and or subsidiary companies accepts no 
liability for any loss resulting from this email transmission.

Promethean, Promethean House, Lower Philips Road, Blackburn, Lancashire, BB1 
5TH, UK. Please update your records accordingly. Thank you!



*
This email has been checked by the e-Sweeper Service
*

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Code signing validation

2008-10-28 Thread David Riggle
I just pass the "-o kill" flags to codesign. That way if the app has  
been tampered with it won't launch. Make sure you are using Xcode 3.1  
or later so the codesigning is done after the stripping.


Dave
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Subview display problem

2008-10-28 Thread I. Savant
On Tue, Oct 28, 2008 at 11:27 AM, DKJ <[EMAIL PROTECTED]> wrote:

> I should have made clear in my first post that the animation layers of
> theView are CALayer objects. Maybe I'll try hiding those.

  Yes, that changes things a bit. :-) I'm not convinced, though, that
you have the view geometry & drawing basics quite right. I'd turn off
all layers and make sure it's working normally without them. At least
then you know in which of the two significantly-different areas the
problem is hiding (view geometry/drawing or layers/animation).

  If it's the latter, I'm afraid I have to defer to others as I've
still only tested the water temperature with a single toe, so to speak
... I haven't taken the plunge into this area.

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


Message Forwarding Overhead / Performance

2008-10-28 Thread Jerry Krinock
Although the documentation on message forwarding [1] explains that  
alot of stuff needs to happen, it does not say "Warning: Don't do this  
in performance-critical applications".  So I made a test tool which  
forwarded a simple message with one integer argument to a class which  
would add it to its 'sum', an instance variable.


Sending this message 10,000 times and comparing the difference in  
elapsed time with a similar task that sends a similar message  
directly, I found that the average overhead for forwarding one message  
on my Intel Core 2 Duo Mac Mini was about 20 microseconds.


That would be unacceptably slow for an iterated operation in a my  
application, and I decided to not use message forwarding in this  
particular case.


Has anyone ever seen better performance for message forwarding?

Jerry Krinock

[1] 
http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_13_section_5.html
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Can we ask iPhone questions yet?

2008-10-28 Thread Nicko van Someren

On 28 Oct 2008, at 15:18, I. Savant wrote:

On Tue, Oct 28, 2008 at 11:13 AM, Nicko van Someren  
<[EMAIL PROTECTED]> wrote:


I saw Scott's message about taking complaints to dev relations, and  
his
comment about things being 'off topic' but my reading of those  
messages
(linked below) is that they clearly referred to the people calling  
this list

a joke because it was moderated by Apple; they say nothing about the
relevance of this list to Cocoa Touch.  In fact there are only 3  
messages
from the moderators since the new NDA terms were released and none  
of them

addressed this issue directly.


 A fair point. My last opinion (and they *are* opinions, nothing more
- I am not a moderator and I'm not trying to be one): I think the
intention was made pretty clear. My interpretation is that anything
iPhone-specific goes to the afore-mentioned forum. Anything that is
Cocoa-in-general is fine here, as usual. Cocoa Touch is Cocoa with
some iPhone-specific additions. Again, it's those iPhone-specific
things that Apple wants to keep "on the inside".


Without wanting to stray into meta-discussions about discussions, many  
people have (with varying degrees of rudeness) already pointed out  
that (a) forums and mailing lists are very different and serve  
different audiences and (b) this mailing list already is "on the  
inside" since it is a moderated list.  I think most readers would like  
to see this list as an all-inclusive Cocoa list, Touch or no Touch,  
and I don't see any reason why it should not be inclusive according to  
posted the rules, but I still think it would be useful to have a clear  
indication from our shadowy overlords.


Cheers,
Nicko

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Subview display problem

2008-10-28 Thread DKJ

On 28 Oct, 2008, at 08:14, I. Savant wrote:

Do away with the animation logic for now. See if it
behaves as expected by setting the frames directly (without calls to
the view's -animator).


The subview appears for an instant, with its origin is in the centre  
of the superview, filling the upper-right quadrant.


It's also showing behind the CALayer objects, which I don't want either.

I thought of using a CATextLayer instead, and setting the zPosition  
accordingly. But then I don't have anything like the text formatting  
capabilities of an NSTextView. (MyView is a subclass of NSTextView.)


I should have made clear in my first post that the animation layers of  
theView are CALayer objects. Maybe I'll try hiding those.

___

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

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

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

This email sent to [EMAIL PROTECTED]


NSTableView context dependent row colors

2008-10-28 Thread Robert Mullen
I am working on an application that uses NSTableViews for data  
display. The individual rows need to have context dependent coloring.  
I have this working reasonably well by using  
NSTableView:tableView:willDisplayCell:forTableColumn:row: to inspect  
the cells I need and then set the background color. I have some  
concerns about this as it seems like a "chatty" way of doing things  
although so far I have loaded several thousand rows and see no adverse  
effects. I also have problems with cells that don't handle background  
color well like checkbox cells. I can work around that but it is not  
ideal. In addition to all this, I really want to use a gradient for  
the row color as it fits the overall UI much better. I have seen  
tutorials for doing the selected row this way and have copped them  
into my code but not completely successfully. Right now if I use a  
gradient image (not ideal but one step at a time as I am a Cocoa noob)  
and do drawRect using rectOfRow:(int)row with  
operation:NSCompositeSourceOver I get drawing anomalies. It works  
somewhat once I scroll the NSTableView but the initial drawing  
operation is over the top of the text. If I scroll the text appears  
once it is scrolled back into view (seemingly a problem with using the  
willDisplayCell delegate.)


All that as leadup, my question is whether I am barking up the wrong  
tree with what I am doing. Is  
NSTableView:tableView:willDisplayCell:forTableColumn:row: the correct  
place to be doing this sort of thing? If not, where would one go about  
setting the row color? Does anyone have good tutorials for dealing  
with UI issues at this level? Most of the rest of the Objective-C/ 
Cocoa world seems relatively straightforward but the more intricate  
control manipulations are still escaping me.


tx.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Subview display problem

2008-10-28 Thread Patrick Mau

Hi DKJ,

On 28.10.2008, at 14:23, DKJ wrote:

I'm having no luck getting a subview to display. In the awakeFromNib  
of the controller I have this:


helpView = [[MyView alloc] init];
[helpView setFrameOrigin:RectCentre( [theView frame] )];
[helpView setFrameSize:NSZeroSize];
[theView addSubview:helpView];



You are adding the subview to 'theView', but I cannot see how you  
initialized it.
Can you check wether 'autoresizesSubviews' for 'theView' returns YES  
or NO?


Maybe your sub-views are resized based on the 'theView' setting for  
'autoresizeMask' and

this disturbs the animation.

Check the NSView documentation for 'setAutoresizeSubViews' and  
'autoresizeMask'.


I'm just guessing though.

Best regards,
Patrick
___

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

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

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

This email sent to [EMAIL PROTECTED]


  1   2   >