Re: Using existing SQLite database with core data?

2008-04-07 Thread mmalc crawford


On Apr 6, 2008, at 11:58 PM, Quincey Morris wrote:


On Apr 6, 2008, at 22:44, mmalc crawford wrote:

The fact that Core Data is an object graph management and  
persistence framework does not in an of itself preclude it from  
reverse engineering an existing database.  EOF is also an "object  
graph management and persistence framework" but it is able to  
create a model by interrogating a database.  Core Data happens not  
to have that functionality.

[...]
Another way of saying this is that we have to regard Core Data as  
destroying (well, "masking" might be more accurate) the databaseness  
of the sqlite stores it uses, from the point of view of its client  
code.



I think the term you're looking for is "façade".


Simply using an existing database as the persistent store, if it  
were possible now, wouldn't put the databaseness back in. That  
specific point, I assume, is why Apple explicitly warns that "Core  
Data is not a RDBMS."




This is irrelevant.  The question is not whether Core Data could be  
"turned into a database"...



Anything is possible in a future incarnation of Core Data, but the  
OP did ask, "*Is* there a reasonable way to get core data to use an  
existing database...?" (my emphasis).


The OP asked, "Is* there a reasonable way to get core data to use an  
existing database", to which you gave as the reason for the answer  
"No", "Core Data is an object graph management system with a  
persistent store, not a database client or server" -- this is a non  
sequitur.


Core Data could still be "an object graph management system with a  
persistent store" whilst at the same time using an RDBMS as a back end  
(one of the supported persistent store types) and being able to  
interrogate the database to derive a model.  This is what EOF offers.


As Chris pointed out, if you would like a future version of Core Data  
to have this functionality, file an enhancement request at  -- I'd add, ideally providing a good business case to support the  
request.


mmalc

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Using existing SQLite database with core data?

2008-04-07 Thread Peter Zegelin
Thanks everyone - I'm quite new to this and naively assumed it might  
be doable. I can see now why it can't.


Peter

On 07/04/2008, at 12:09 PM, Peter Zegelin wrote:

I have an existing database application that uses sqlite but was not  
created using Core Data. Is there any reasonable way to get core  
data to use an existing database and 'reverse engineer' the entities  
and relationships to create its model?




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Using existing SQLite database with core data?

2008-04-07 Thread mmalc crawford


On Apr 7, 2008, at 12:31 AM, Peter Zegelin wrote:
Thanks everyone - I'm quite new to this and naively assumed it might  
be doable. I can see now why it can't.


To reiterate, there is no reason *in principle* why Core Data could  
not do this.  If it's something you would like to see, file an  
enhancement request.


mmalc

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Objective-C Instance Variable Names

2008-04-07 Thread Kyle Sluder
On Mon, Apr 7, 2008 at 2:37 AM, Todd Blanchard <[EMAIL PROTECTED]> wrote:
> Too late, I've been doing that since 1990 in C++.

Then I'm sure you're very familiar with the fragile base class
problem.  Just don't do it.  It's bad form because eventually it will
break.  And then you'll spend ages in the debugger trying to figure
out just who assigned to "your" ivar.

It's quite simply a different language.  Heck, you're *required* to do
it in C#.  ;-)

--Kyle Sluder
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Using existing SQLite database with core data?

2008-04-07 Thread Quincey Morris


On Apr 7, 2008, at 00:51, mmalc crawford wrote:

To reiterate, there is no reason *in principle* why Core Data could  
not do this.


Indeed, there's no reason in principle why Core Data could not be EOF.

Yet a core principle of Core Data is its abstraction of the model away  
from the structure of the various persistent store formats. I guess  
Apple could abandon that principle, but I fear that an awful lot of  
babies would get faulted out along with the bath water.


I agree with you that anyone who would like to have some kind of auto- 
modeling and auto-importing from an existing database should file an  
enhancement request.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Using existing SQLite database with core data?

2008-04-07 Thread mmalc crawford


On Apr 7, 2008, at 1:50 AM, Quincey Morris wrote:
To reiterate, there is no reason *in principle* why Core Data could  
not do this.


Indeed, there's no reason in principle why Core Data could not be EOF.
Yet a core principle of Core Data is its abstraction of the model  
away from the structure of the various persistent store formats. I  
guess Apple could abandon that principle, but I fear that an awful  
lot of babies would get faulted out along with the bath water.




It's not clear what principle would be abandoned here -- I don't see  
any reason for fear at all.

It could offer just the same level of abstraction as today.
EOF allowed you to use a text-based data file if you wanted (typically  
for testing purposes...).


mmalc

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTreeController KVO

2008-04-07 Thread Hamish Allan
On Mon, Apr 7, 2008 at 2:04 AM, Chris Suter <[EMAIL PROTECTED]> wrote:

>  Have you seen this:
> 

I had not (I'd only ever changed to-many relationships through the
controller before), but it now works a treat. Thank you!

Hamish
___

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

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

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

This email sent to [EMAIL PROTECTED]


Constraining a NSSlider to Certain Values

2008-04-07 Thread Peter Zegelin
I'm trying to constrain the value of an NSSlider (while it is being  
dragged) depending on the state of a modifier key and being totally  
new to Cocoa am getting nowhere really fast!  For a start, I don't  
seem to be able to find a way to test for a modifier key during the  
actual drag.


Can anyone help me here?

thanks!

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: Constraining a NSSlider to Certain Values

2008-04-07 Thread Allison Newman
I'm no expert, but you might want to look at mouseDownFlags in NSCell.  
Alternatively, you can recover the modifiers from the NSEvent given in 
mouseDown in your control.  Or, you could wait until someone that knows what 
they are actually talking about replies :-)

Alli
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Constraining a NSSlider to Certain Values

2008-04-07 Thread Jean-Daniel Dupas


Le 7 avr. 08 à 12:14, Peter Zegelin a écrit :
I'm trying to constrain the value of an NSSlider (while it is being  
dragged) depending on the state of a modifier key and being totally  
new to Cocoa am getting nowhere really fast!  For a start, I don't  
seem to be able to find a way to test for a modifier key during the  
actual drag.


Can anyone help me here?

thanks!

Peter


To get the current modifier state during an event, -[NSEvent  
modifierFlags];
And -[NSApplication currentEvent] or -[NSWindow currentEvent] to get  
the current event (if you do not already have it).


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Constraining a NSSlider to Certain Values

2008-04-07 Thread Peter Zegelin


On 07/04/2008, at 9:14 PM, Allison Newman wrote:

I'm no expert, but you might want to look at mouseDownFlags in  
NSCell.  Alternatively, you can recover the modifiers from the  
NSEvent given in mouseDown in your control.  Or, you could wait  
until someone that knows what they are actually talking about  
replies :-)


Alli


Problem with both of these is it only gives the flags when the mouse  
was first clicked - not during the drag itself.


regards,

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: Constraining a NSSlider to Certain Values

2008-04-07 Thread Peter Zegelin


On 07/04/2008, at 9:07 PM, Jean-Daniel Dupas wrote:



Le 7 avr. 08 à 12:14, Peter Zegelin a écrit :
I'm trying to constrain the value of an NSSlider (while it is being  
dragged) depending on the state of a modifier key and being totally  
new to Cocoa am getting nowhere really fast!  For a start, I don't  
seem to be able to find a way to test for a modifier key during the  
actual drag.


Can anyone help me here?

thanks!

Peter


To get the current modifier state during an event, -[NSEvent  
modifierFlags];
And -[NSApplication currentEvent] or -[NSWindow currentEvent] to get  
the current event (if you do not already have it).


OK but given, say, my own slidercell subclass, which event should I  
check in and how do I get a ref to the sliders window? I'm currently  
using 'continueTracking' which seems to be the right event to override:


- (BOOL)continueTracking:(NSPoint)lastPoint at:(NSPoint)currentPoint  
inView:(NSView *)controlView{

// how do I get the modifier keys here
//  and set the slider to some value if say the command key is pressed

else
// do the default thing
		return [super continueTracking:lastPoint at:currentPoint  
inView:controlView];


}

thanks for your 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: Constraining a NSSlider to Certain Values

2008-04-07 Thread Ron Fleckner


On 07/04/2008, at 10:10 PM, Peter Zegelin wrote:


On 07/04/2008, at 9:07 PM, Jean-Daniel Dupas wrote:



Le 7 avr. 08 à 12:14, Peter Zegelin a écrit :
I'm trying to constrain the value of an NSSlider (while it is  
being dragged) depending on the state of a modifier key and being  
totally new to Cocoa am getting nowhere really fast!  For a  
start, I don't seem to be able to find a way to test for a  
modifier key during the actual drag.


Can anyone help me here?

thanks!

Peter


To get the current modifier state during an event, -[NSEvent  
modifierFlags];
And -[NSApplication currentEvent] or -[NSWindow currentEvent] to  
get the current event (if you do not already have it).


OK but given, say, my own slidercell subclass, which event should I  
check in and how do I get a ref to the sliders window? I'm  
currently using 'continueTracking' which seems to be the right  
event to override:


- (BOOL)continueTracking:(NSPoint)lastPoint at:(NSPoint) 
currentPoint inView:(NSView *)controlView{

// how do I get the modifier keys here
	//  and set the slider to some value if say the command key is  
pressed


else
// do the default thing
		return [super continueTracking:lastPoint at:currentPoint  
inView:controlView];


}

thanks for your help,

Peter


Hi Peter,

this post on CocoaBuilder by Shaun Wexler and the rest of the thread  
will help you I think:



In my slider subclass I use both trackingRects (-mouseMoved:) and - 
mouseDown: to detect modifier keys.  Note the correct way to override  
-mouseDown: for sliders in the above post.  It's a little non-intuitive.


HTH,

Ron___

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

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

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

This email sent to [EMAIL PROTECTED]


Obj-C idioms for list based tasks

2008-04-07 Thread Paul Sargent
Coming from other object based languages I'm aware that each language can
have it's own idioms for common tasks. In particular coming from doing a lot
of python, I'm finding myself wanting to do a few things with NSArrays that
I would do quite easily with python lists.

Can anybody suggest a good way to:

1) Given an ordered set of objects, create a new non-mutable ordered set,
with all the duplicates removed?
2) Given an ordered set of objects, create a new non-mutable ordered set,
with each entry being the output of a method applied to each entry of the
original array (e.g. Python map())?

I can easily write 'for each' loops that do these and create mutable arrays,
and then return non-mutable copies, but I half expect that these are common
patterns, and there might be a nice, concise, way of writing them.

Are there any ObjC shortcuts when doing things like this? Am I best writing
a category on top of NSArray the encompass these (and other) patterns? I'd
like to retain ordering, so using NSSet for (1) seems counter productive.

Thanks

P.S. Alternatively, Is there a site like
http://aspn.activestate.com/ASPN/Cookbook/Python/ for Objective C?
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Constraining a NSSlider to Certain Values

2008-04-07 Thread Jean-Daniel Dupas


Le 7 avr. 08 à 14:10, Peter Zegelin a écrit :



On 07/04/2008, at 9:07 PM, Jean-Daniel Dupas wrote:



Le 7 avr. 08 à 12:14, Peter Zegelin a écrit :
I'm trying to constrain the value of an NSSlider (while it is  
being dragged) depending on the state of a modifier key and being  
totally new to Cocoa am getting nowhere really fast!  For a start,  
I don't seem to be able to find a way to test for a modifier key  
during the actual drag.


Can anyone help me here?

thanks!

Peter


To get the current modifier state during an event, -[NSEvent  
modifierFlags];
And -[NSApplication currentEvent] or -[NSWindow currentEvent] to  
get the current event (if you do not already have it).


OK but given, say, my own slidercell subclass, which event should I  
check in and how do I get a ref to the sliders window? I'm currently  
using 'continueTracking' which seems to be the right event to  
override:


You can get the ref window by using the -[NSView window] method. You  
can get the current event by using the NSApp global variable (NSEvent  
*event = [NSApp currentEvent];)

And see also the link in the Ron's message.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSVector, CGVector Additions

2008-04-07 Thread Stefan Hafeneger
Okay, I agree. So then just imagine the NS prefix is something else.  
Now please focus on the code not the naming conventions. ;-)


With best wishes, Stefan

Am 07.04.2008 um 06:08 schrieb Jens Alfke:


On 6 Apr '08, at 11:59 AM, Stefan Hafeneger wrote:


This is kind of a class Addition so the NS prefix should be okay.


Nope. No one gets to make new identifiers with the NS prefix except  
Apple (in fact, only the AppKit/Foundation team inside Apple.)

Doing otherwise defeats the purpose of having namespaces.
Pick your own two- or three-letter prefix, make sure no one else is  
using it, and use that instead.


—Jens


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: activate my application while dragging on other application window

2008-04-07 Thread Manfred Schwind

My application is primarily designed for maximum use of Monitor space.
For that, End user will divide the monitor space in to set of
different size grids. Based on his requirement, he will move
particular application window to a grid.


You should take a look at NSAccessibility.
I think it's possible to do what you want to do, but users of your app  
have to turn on "Enable access for assistive devices" in the  
"Universal Access" system preferences.


Regards,
Mani
--
http://www.mani.de
iVolume - Loudness adjustment for iTunes.
LittleSecrets - The encrypted notepad.


___

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

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

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

This email sent to [EMAIL PROTECTED]


How inspect pending performSelectorOnMainThread ?

2008-04-07 Thread Jacob Engstrand

Hi all,

In a separate thread I call:

[self performSelectorOnMainThread: @selector(broadcastMessage:)  
withObject: nil waitUntilDone: NO];


Now, is there a way for the main thread to inspect the queue of  
pending messages, their targets and arguments?
(I would like my unit test to verify that -broadcastMessage: has  
actually been sent to the main thread.)


Thanks,
jak



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Constraining a NSSlider to Certain Values

2008-04-07 Thread Peter Zegelin

On 07/04/2008, at 10:46 PM, Jean-Daniel Dupas wrote:



Le 7 avr. 08 à 14:10, Peter Zegelin a écrit :



On 07/04/2008, at 9:07 PM, Jean-Daniel Dupas wrote:



Le 7 avr. 08 à 12:14, Peter Zegelin a écrit :
I'm trying to constrain the value of an NSSlider (while it is  
being dragged) depending on the state of a modifier key and being  
totally new to Cocoa am getting nowhere really fast!  For a  
start, I don't seem to be able to find a way to test for a  
modifier key during the actual drag.


Can anyone help me here?

thanks!

Peter


To get the current modifier state during an event, -[NSEvent  
modifierFlags];
And -[NSApplication currentEvent] or -[NSWindow currentEvent] to  
get the current event (if you do not already have it).


OK but given, say, my own slidercell subclass, which event should I  
check in and how do I get a ref to the sliders window? I'm  
currently using 'continueTracking' which seems to be the right  
event to override:


You can get the ref window by using the -[NSView window] method. You  
can get the current event by using the NSApp global variable  
(NSEvent *event = [NSApp currentEvent];)

And see also the link in the Ron's message.



Ah thanks - thats what I was after I think.

However it looks like I am going to have to think about this some more  
because I've just noticed another problem. I now have the following in  
my NSSliderCell subclass:


- (BOOL)continueTracking:(NSPoint)lastPoint at:(NSPoint)currentPoint  
inView:(NSView *)controlView{


NSEvent *theEvent = [NSApp currentEvent];

if ([theEvent modifierFlags] & NSShiftKeyMask){
NSLog(@"shiftKey");
[self setFloatValue:0.0];
}

return YES;
}

which is more or less what I want. However now if I press the shiftkey  
without moving the mouse then of course I never get this message so  
the slider doesn't move to the new position until I move the mouse.  
Same when I stop pressing the shift key.  It looks like I need to have  
a timer set to run in mousedown, continuously check the status of the  
modifier keys and set the sliders modified position as needed. Thoughts?


regards,

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: Is this a bug in Cocoa 'isLike' ?

2008-04-07 Thread Matt Burnett
Sounds like a bug to me. I have the same issue on a MBP with 10.5.2.  
Although i suppose this could be 'working as intended' since the  
pattern formats for isLike: dont seem to be well documented.


On Apr 7, 2008, at 9:11 AM, Yvan BARTHÉLEMY wrote:

On my machine (quite recent 20 inches iMac x86), following (reduced)  
code seems to go in a infinite loop...
Checkpoint 2 is never reached. The number of 'x' characters is  
important.


Should I send it in reporter ?

#import 

int main (int argc, const char * argv[]) {
   NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

NSLog(@"Checkpoint 1");
[@"lxxlaxxl" isLike:@"*la"];
NSLog(@"Checkpoint 2");

   [pool drain];
   return 0;
}

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/matt.w.burnett%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Objective-C Instance Variable Names

2008-04-07 Thread Richard Somers


On Apr 5, 2008, at 7:17PM, Quincey Morris wrote:

The most common situation where I run into local/instance variable  
name conflicts is setter methods. If the property and the instance  
variable are both 'whatever', it makes sense to me to call the  
setter argument variable 'newWhatever', because that is in fact what  
it is.


This agrees with my experience. I have switched to simply using  
"newValue" for the setter argument variable. In other words I  
literally use "newValue" for the setter argument variable for all  
setter methods. Works well so far.


I also am training myself to pay attention to the color coding XCode 3  
provides to distinguish ivars from local vars.


Regards,
Richard

___

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

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

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

This email sent to [EMAIL PROTECTED]


Is this a bug in Cocoa 'isLike' ?

2008-04-07 Thread Yvan BARTHÉLEMY
On my machine (quite recent 20 inches iMac x86), following (reduced)  
code seems to go in a infinite loop...
Checkpoint 2 is never reached. The number of 'x' characters is  
important.


Should I send it in reporter ?

#import 

int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

NSLog(@"Checkpoint 1");
[@"lxxlaxxl" isLike:@"*la"];
NSLog(@"Checkpoint 2");

[pool drain];
return 0;
}

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Objective-C Instance Variable Names

2008-04-07 Thread Jens Alfke


On 7 Apr '08, at 1:45 AM, Kyle Sluder wrote:


Then I'm sure you're very familiar with the fragile base class
problem.  Just don't do it.


Ivar name conflicts don't have anything to do with the FBC problem,  
not in compiled languages. The FBC problem arises when the size of a  
superclass changes, which changes the offsets of the instance  
variables of subclasses, breaking already-compiled code in subclasses  
that accesses ivars by offset.


What this means is that, if your superclass adds an ivar, your code is  
broken and has to be recompiled. That's true regardless of what the  
superclass ivar is named. If it does happen to match your name, then  
when you recompile your code you'll get a compile error and can use  
the handy Refactor command to rename your ivar.


(In practice, Apple will never add ivars to their classes, for exactly  
that reason. That's why they all have a placeholder ivar named  
"_extra" or something like that — if needed, that can be used to point  
to an auxiliary struct.)


Now, the 64-bit runtime eliminates the FBC by looking up ivar offsets  
dynamically. But IIRC, it doesn't use the names of the ivars when  
doing so (it just looks up the total sizes of instance data of each  
superclass.) So again, name conflicts aren't an issue at runtime.



It's bad form because eventually it will
break.  And then you'll spend ages in the debugger trying to figure
out just who assigned to "your" ivar.


No, the breakage doesn't occur at runtime, rather at compile time. And  
it results in a simple compile error that's very easy to fix.


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Constraining a NSSlider to Certain Values

2008-04-07 Thread Jean-Daniel Dupas


Le 7 avr. 08 à 16:03, Peter Zegelin a écrit :


On 07/04/2008, at 10:46 PM, Jean-Daniel Dupas wrote:



Le 7 avr. 08 à 14:10, Peter Zegelin a écrit :



On 07/04/2008, at 9:07 PM, Jean-Daniel Dupas wrote:



Le 7 avr. 08 à 12:14, Peter Zegelin a écrit :
I'm trying to constrain the value of an NSSlider (while it is  
being dragged) depending on the state of a modifier key and  
being totally new to Cocoa am getting nowhere really fast!  For  
a start, I don't seem to be able to find a way to test for a  
modifier key during the actual drag.


Can anyone help me here?

thanks!

Peter


To get the current modifier state during an event, -[NSEvent  
modifierFlags];
And -[NSApplication currentEvent] or -[NSWindow currentEvent] to  
get the current event (if you do not already have it).


OK but given, say, my own slidercell subclass, which event should  
I check in and how do I get a ref to the sliders window? I'm  
currently using 'continueTracking' which seems to be the right  
event to override:


You can get the ref window by using the -[NSView window] method.  
You can get the current event by using the NSApp global variable  
(NSEvent *event = [NSApp currentEvent];)

And see also the link in the Ron's message.



Ah thanks - thats what I was after I think.

However it looks like I am going to have to think about this some  
more because I've just noticed another problem. I now have the  
following in my NSSliderCell subclass:


- (BOOL)continueTracking:(NSPoint)lastPoint at:(NSPoint)currentPoint  
inView:(NSView *)controlView{


NSEvent *theEvent = [NSApp currentEvent];

if ([theEvent modifierFlags] & NSShiftKeyMask){
NSLog(@"shiftKey");
[self setFloatValue:0.0];
}

return YES;
}

which is more or less what I want. However now if I press the  
shiftkey without moving the mouse then of course I never get this  
message so the slider doesn't move to the new position until I move  
the mouse. Same when I stop pressing the shift key.  It looks like I  
need to have a timer set to run in mousedown, continuously check the  
status of the modifier keys and set the sliders modified position as  
needed. Thoughts?


regards,

Peter


Using a timer will not help you, as currentEvent is not valid when a  
timer fired.
When the modifier stats change, the  -[NSResponder flagsChanged: 
(NSEvent *)theEvent]
is call on the first responder that should be your NSSlider in this  
case.


We had a discussion about catching flag changed event the last week (http://www.cocoabuilder.com/archive/message/cocoa/2008/4/1/202898 
)

Maybe you can find something that may help you in this topics.






___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Is this a bug in Cocoa 'isLike' ?

2008-04-07 Thread Jean-Daniel Dupas
If this is not a bug in Cocoa, so it's a bug in the documentation, so  
you can fill a bug report.


Le 7 avr. 08 à 16:26, Matt Burnett a écrit :

Sounds like a bug to me. I have the same issue on a MBP with 10.5.2.  
Although i suppose this could be 'working as intended' since the  
pattern formats for isLike: dont seem to be well documented.


On Apr 7, 2008, at 9:11 AM, Yvan BARTHÉLEMY wrote:

On my machine (quite recent 20 inches iMac x86), following  
(reduced) code seems to go in a infinite loop...
Checkpoint 2 is never reached. The number of 'x' characters is  
important.


Should I send it in reporter ?

#import 

int main (int argc, const char * argv[]) {
  NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

NSLog(@"Checkpoint 1");
[@"lxxlaxxl" isLike:@"*la"];
NSLog(@"Checkpoint 2");

  [pool drain];
  return 0;
}



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Obj-C idioms for list based tasks

2008-04-07 Thread Jens Alfke


On 7 Apr '08, at 5:33 AM, Paul Sargent wrote:


Can anybody suggest a good way to:

1) Given an ordered set of objects, create a new non-mutable ordered  
set,

with all the duplicates removed?
2) Given an ordered set of objects, create a new non-mutable ordered  
set,
with each entry being the output of a method applied to each entry  
of the

original array (e.g. Python map())?


No, there's nothing like that built-in, unfortunately.

Are there any ObjC shortcuts when doing things like this? Am I best  
writing
a category on top of NSArray the encompass these (and other)  
patterns? I'd
like to retain ordering, so using NSSet for (1) seems counter  
productive.


Category methods would be a clean way to do it; just put a prefix on  
your method names so they won't conflict with any methods Apple adds  
in the future.


The only nontrivial thing about implementing these is performance, and  
that's only an issue if you work on huge arrays.


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: How inspect pending performSelectorOnMainThread ?

2008-04-07 Thread Jens Alfke


On 7 Apr '08, at 6:24 AM, Jacob Engstrand wrote:


In a separate thread I call:
[self performSelectorOnMainThread: @selector(broadcastMessage:)  
withObject: nil waitUntilDone: NO];
Now, is there a way for the main thread to inspect the queue of  
pending messages, their targets and arguments?


Nope. That information is private to the runloop implementation.

(I would like my unit test to verify that -broadcastMessage: has  
actually been sent to the main thread.)


You can have a flag that the main thread sets in its - 
broadcastMessage: method, and the unit test checks afterwards.


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: How inspect pending performSelectorOnMainThread ?

2008-04-07 Thread Jean-Daniel Dupas


Le 7 avr. 08 à 16:49, Jens Alfke a écrit :


On 7 Apr '08, at 6:24 AM, Jacob Engstrand wrote:


In a separate thread I call:
[self performSelectorOnMainThread: @selector(broadcastMessage:)  
withObject: nil waitUntilDone: NO];
Now, is there a way for the main thread to inspect the queue of  
pending messages, their targets and arguments?


Nope. That information is private to the runloop implementation.

(I would like my unit test to verify that -broadcastMessage: has  
actually been sent to the main thread.)


You can have a flag that the main thread sets in its - 
broadcastMessage: method, and the unit test checks afterwards.


And if you do not want to modify your implementation to match a test  
case, you can use method_exchangeImplementations() (or class posing)  
in your test to catch the -broadcastMessage: call, set a flag (and  
then call the original implementation).


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Objective-C Instance Variable Names

2008-04-07 Thread glenn andreas


On Apr 7, 2008, at 9:39 AM, Jens Alfke wrote:



On 7 Apr '08, at 1:45 AM, Kyle Sluder wrote:


Then I'm sure you're very familiar with the fragile base class
problem.  Just don't do it.


Ivar name conflicts don't have anything to do with the FBC problem,  
not in compiled languages. The FBC problem arises when the size of a  
superclass changes, which changes the offsets of the instance  
variables of subclasses, breaking already-compiled code in  
subclasses that accesses ivars by offset.


What this means is that, if your superclass adds an ivar, your code  
is broken and has to be recompiled. That's true regardless of what  
the superclass ivar is named. If it does happen to match your name,  
then when you recompile your code you'll get a compile error and can  
use the handy Refactor command to rename your ivar.


(In practice, Apple will never add ivars to their classes, for  
exactly that reason. That's why they all have a placeholder ivar  
named "_extra" or something like that — if needed, that can be used  
to point to an auxiliary struct.)


Right, but by having dummy placeholders, they can later rename  
"_extra" to "_something", and if you have an ivar named "_something"  
there will be problems.  (For that matter, they could also change  
existing ivar names as well).


No, the breakage doesn't occur at runtime, rather at compile time.  
And it results in a simple compile error that's very easy to fix.


In the case of renaming _extra to _something, no.

For example, an OS update comes out where a framework has a change  
like this.  Customer upgrades the OS.  There is KVC based access to  
[obj setValue: newValue forKey: @"_something"] (either in your code,  
or in the updated framework - perhaps in NIB loading).  Suddenly there  
is a collision - KVC will change one of them, even though the hard- 
coded access methods will still be grabbing their own respective  
versions.


So while this isn't exactly the same FBC problem (ivar offsets change  
in already-compiled code) it is very much like it (ivar named access  
changes to a different offset in already compiled code).


Worse, you won't be able to get the compiler to tell you about this  
error until you get new headers with that change.  But if you are  
compiling against an SDK (which you probably are), you won't see that  
change (since you'll just get the earlier headers).  All you're left  
with is trying to track down why, for example, an outlet is nil after  
loading a NIB that works fine under the last OS version but fails  
under this one (and/or stranger problem than that).


And, of course, with ObjC 2.0, new ivars can be added, again that can  
conflict with your usage of leading underscores, increasing the chance  
that you'll see this sort of problem.


Avoiding this sort of hard to track down problems seems well worth the  
price of using something other than a leading underscore on your  
ivars...




Glenn Andreas  [EMAIL PROTECTED]
  wicked fun!
quadrium | flame : flame fractals & strange attractors : build,  
mutate, evolve, animate




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Objective-C Instance Variable Names

2008-04-07 Thread Jim Correia

On Apr 7, 2008, at 11:12 AM, glenn andreas wrote:

Right, but by having dummy placeholders, they can later rename  
"_extra" to "_something", and if you have an ivar named "_something"  
there will be problems.  (For that matter, they could also change  
existing ivar names as well).


No, the breakage doesn't occur at runtime, rather at compile time.  
And it results in a simple compile error that's very easy to fix.


In the case of renaming _extra to _something, no.

For example, an OS update comes out where a framework has a change  
like this.  Customer upgrades the OS.  There is KVC based access to  
[obj setValue: newValue forKey: @"_something"] (either in your code,  
or in the updated framework - perhaps in NIB loading).  Suddenly  
there is a collision - KVC will change one of them, even though the  
hard-coded access methods will still be grabbing their own  
respective versions.


There is already the possibility of KVC collisions regardless of how  
you name your iVars.


Consider...

NSBaseClass, and MyClass derived from it.

Targetting 10.4, MyClass has an iVar named mImportantProperty (using m  
prefix here only for argument's sake), and accessors - 
setImportantProperty:, -importantProperty.


10.5 comes along and NSBaseClass gets a private iVar named  
_importantProperty, and the framework code uses KVC to access this  
property (perhaps through the private accessors - 
_setImportantProperty:, -_importantProperty.)


My code has violated the don't use the _ prefix for your method names  
rule.


My code hasn't used the don't use the _ prefix on my iVar names rule/ 
suggestion/convention.


Yet, I still have the KVC conflict. (And yes, it will probably be a  
pain in the neck to track down.)


Jim
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Image Processing

2008-04-07 Thread Kenny Leung
If you ask an NSImage for its size, the DPI in the image is taken  
into account. You can ask for pixelsHigh and pixelsWide in order to  
get the number of pixels.


-Kenny


On Apr 6, 2008, at 1:40 PM, Lorenzo wrote:

Still working with image-processing...
I have a source image 1680 x 1050 with (just a case) 240 dpi.
I load it with

.


stuff deleted...
___

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

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

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

This email sent to [EMAIL PROTECTED]


[Meeting] Chicago CocoaHeads / Cawug - MacRuby

2008-04-07 Thread Bob Frank
The Chicago CocoaHeads / Chicago Cocoa and WebObjects User Group  
(CAWUG) is holding our next meeting Tuesday, April 8th, at 7:00 PM at  
the Apple Store on Michigan Ave.



Agenda:
- Introductions & Announcements
- Chuck Remes on MacRuby
- adjournment to O'Toole's

When:   
Tuesday, April 8th, 7:00 PM

Where:
Apple Store Michigan Avenue
679 North Michigan Ave. (at the corner of Huron & Michigan Ave.)
Chicago, IL 60611
		http://maps.yahoo.com/maps_result? 
ed=gYbE5Op_0Tokf_p7h61dwjbWtjC2r1YehzWw&csz=60611

http://tinyurl.com/26z5nb
(in case long URL gets cut)

- Chuck will be presenting on MacRuby Development

He has been doing a bunch of MacRuby development recently and will  
present an overview of MacRuby and discuss the positives and  
negatives of MacRuby development.



- O'Tooles

	We will continue the discussion at our local watering hold Timothy  
O'Toole's at 622 Fairbanks (2 blocks east of the store).



We also wish to thank the folks who run the theater space at the  
Apple store for letting us have our meetings there, and Jonathan  
'Wolf' Rentzsch for hosting the new and revived CAWUG web site.   
Thanks all.


Also, if you are working on a project and would like to talk about  
it  briefly / promote it, I think it would be fun for people to hear  
about  other people's projects.  Please email me off line and you can  
talk at  a future meeting or would like a book to review we would  
welcome that too.



Future meetings dates and tentative topics:  5/13/08, 7/8/08

NOTE: There will be no June Meeting due to WWDC.

April - Chuck Remes on MacRuby
May - Bob on WO development with Eclipse, part II


CAWUG Resources

Mail list: http://groups.google.com/group/cawug
Google Site: http://groups.google.com/group/cawug
Web Site: http://www.cawug.org/
RSS feed: http://www.cawug.org/rss.xml
	iCal: http://ical.mac.com/chicagobob/ Chicago-CocoaHeads-CAWUG (view  
on the web)
	iCal: webcal://ical.mac.com/chicagobob/Chicago-CocoaHeads-CAWUG.ics  
(subscribe to in iCal)


Cocoa Heads web site:
http://cocoaheads.org/us/ChicagoIllinois/index.html


Hope to see you at the meeting.

-Bob



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Obj-C idioms for list based tasks

2008-04-07 Thread William Turner


On Apr 7, 2008, at 5:33 AM, Paul Sargent wrote:


Can anybody suggest a good way to:

1) Given an ordered set of objects, create a new non-mutable ordered  
set,

with all the duplicates removed?


You could do this using the KVC set and array operators (http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/ArrayOperators.html 
):


NSArray *arr = [NSArray arrayWithObjects:@"A", @"A", @"B", @"B", @"C",  
nil];

NSArray *arr2 = [arr valueForKeyPath:@"@distinctUnionOfObjects.self"];

- Wil
___

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

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

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

This email sent to [EMAIL PROTECTED]


NSURLConnection status updates

2008-04-07 Thread Matt Burnett
I am using NSURLConnection to send large posts (>1MB) to a web server.  
How can i get the status/progress information for sending the request.  
I can get the progress for receiving the reply with  
connection:didReceiveResponse: and connection:didReceiveData:, but i  
dont seem to see anything for sending the request. Is there anyway to  
do this with out recreating the NSURLConnection class?

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Obj-C idioms for list based tasks

2008-04-07 Thread Jake Carter
You may also want to look in to NSPredicate and an arrays  
'filteredArrayUsingPredicate:' method.


http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSPredicate_Class/Reference/NSPredicate.html
http://theocacao.com/document.page/346
http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/predicates.html

:// Jake

On Apr 7, 2008, at 8:44 AM, William Turner wrote:



On Apr 7, 2008, at 5:33 AM, Paul Sargent wrote:


Can anybody suggest a good way to:

1) Given an ordered set of objects, create a new non-mutable  
ordered set,

with all the duplicates removed?


You could do this using the KVC set and array operators (http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/ArrayOperators.html 
):


NSArray *arr = [NSArray arrayWithObjects:@"A", @"A", @"B", @"B",  
@"C", nil];

NSArray *arr2 = [arr valueForKeyPath:@"@distinctUnionOfObjects.self"];

- Wil
___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Obj-C idioms for list based tasks

2008-04-07 Thread John Stiles
Cocoa doesn't have ordered sets. It has arrays (NSArray), unordered sets 
(NSSet), and unordered key-value tables (NSDictionary). Any of these can 
optionally be mutable. NSCountedSet also allows for the equivalent of a 
"multiset," but for some reason there is no NSCountedDictionary, for the 
equivalent of a multimap. In general the Cocoa collection classes aren't 
as regular as I would have liked, and don't include all the variants 
that an expatriate from C++ or higher-level languages might expect.


So to sort of answer your questions, you probably want:
   NSSet setWithArray:, or maybe NSSet setWithObjects:count:
   NSSet makeObjectsPerformSelector:withObject:



Paul Sargent wrote:

Coming from other object based languages I'm aware that each language can
have it's own idioms for common tasks. In particular coming from doing a lot
of python, I'm finding myself wanting to do a few things with NSArrays that
I would do quite easily with python lists.

Can anybody suggest a good way to:

1) Given an ordered set of objects, create a new non-mutable ordered set,
with all the duplicates removed?
2) Given an ordered set of objects, create a new non-mutable ordered set,
with each entry being the output of a method applied to each entry of the
original array (e.g. Python map())?

I can easily write 'for each' loops that do these and create mutable arrays,
and then return non-mutable copies, but I half expect that these are common
patterns, and there might be a nice, concise, way of writing them.

Are there any ObjC shortcuts when doing things like this? Am I best writing
a category on top of NSArray the encompass these (and other) patterns? I'd
like to retain ordering, so using NSSet for (1) seems counter productive.

Thanks

P.S. Alternatively, Is there a site like
http://aspn.activestate.com/ASPN/Cookbook/Python/ for Objective C?
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/jstiles%40blizzard.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: Saving AttributedString with Attachments to RTFD

2008-04-07 Thread Douglas Davidson
As others have noted, RTFD is a packaged file format, consisting of a  
directory in the file system containing the underlying RTF and any  
attachments.  There are therefore two representations of RTFD:  first,  
the on-disk format, and second, a serialized format used on the  
pasteboard.  There are therefore two methods for obtaining RTF from an  
attributed string, -RTFDFromRange:documentAttributes: (for the  
pasteboard representation, expressed as an NSData), and - 
RTFDFileWrapperFromRange:documentAttributes: (for the on-disk  
representation, expressed as an NSFileWrapper).  These two methods are  
conveniences, specialized to the case of RTFD, for the more general  
methods -dataFromRange:documentAttributes:error: and - 
fileWrapperFromRange:documentAttributes:error:.


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]


IB outlets and NSCollectionViews

2008-04-07 Thread Torsten Curdt
Hm ...I was trying to bind a button inside a NSCollectionViewItem view  
to an action in my AppController. This obviously does not work.


Of course the view is only a prototype that gets cloned per item in  
the collection but I was expecting to just get the instance passed on  
the call.


So how would I need to do something like this?

cheers
--
Torsten
___

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

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

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

This email sent to [EMAIL PROTECTED]


Open-source NSToolbar?

2008-04-07 Thread John Stiles
I'm looking for an open-source NSToolbar-like toolbar implementation... 
do any exist? I haven't found any yet.


I want to check it out and see how some things are done... I don't 
really need a ton of features outside the standard toolbar stuff, it's 
more for learning/research to see what can be done. I just have a few 
ideas and want to see how hard they'd be without diving in head-first :)


___

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

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

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

This email sent to [EMAIL PROTECTED]


Newbie question

2008-04-07 Thread john darnell
Hello all:

For those of you who do not like answering elementary questions, you
might want to give this message a pass.

I am making my first foray into writing Cocoa applications, and I have
created a very simple class.  The header file looks like this:

   /* Chooser */

   #import 

   @interface Chooser : NSObject
   {
   }

   - (NSString) *ChooseString:(int) IntVal;  //  If I comment out this
line, the error and first warning goes away
   @end


And the implementation file looks like this:


   @implementation Chooser
   /*  Commented out for debugging purposes 
   - (NSString) *ChooseString:(int) IntVal;
   {
   }
   */
   - (id) init 
   {
  self = [super init];
  if (self != nil) 
  {
 NSString * ListOfStrings = @"A stitch in time saves nine/No use
crying over spilt milk/A bird in the hand is worth two in the bush/Never
put of to tomorrow what can be done today/Do not judge a man until you
have walked a mile in his shoes";
 NSArray *StringList = [ListOfStrings
componentsSeparatedByString:@"/"];

  }
  return self;
   }

   @end

I am getting the following error/warning messages:

   error: parse error before '*' token
   warning: '@end' must appear in an @implementation context
   warning: unused variable 'StringList'

I am using "Learning Cocoa with Objective-C, 2nd Edition" as my
tutorial.  Looking at the examples provided by the author does not help
me figure out what I am doing wrong.  It is probably something very
simple, but being new to the language, I cannot yet see it.  I have two
questions:

1.)  If this is not the best place to ask such learning questions, can
you please point me to a better forum/mailing list?

2.)  Can anyone see what I am doing wrong?

TIA!

R, 
John A.M. Darnell 
Team Leader 
Walsworth Publishing Company 
Brookfield, MO 
John may also be reached at [EMAIL PROTECTED] 
  
Trivia Question:  In SciFi Channel's hit series, FARSCAPE, who played
the voice of Pilot?


___

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

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

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-source NSToolbar?

2008-04-07 Thread Daniel Jalkut

Cocotron is a great place to look for things like this:

http://cocotron.googlecode.com/svn/trunk/AppKit/NSToolbar.subproj/

Don't know how well developed the NSToolbar is, but in general they  
have a lot of cool stuff ported.


Daniel

On Apr 7, 2008, at 12:47 PM, John Stiles wrote:
I'm looking for an open-source NSToolbar-like toolbar  
implementation... do any exist? I haven't found any yet.


I want to check it out and see how some things are done... I don't  
really need a ton of features outside the standard toolbar stuff,  
it's more for learning/research to see what can be done. I just have  
a few ideas and want to see how hard they'd be without diving in  
head-first :)


___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/jalkut%40red-sweater.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: Open-source NSToolbar?

2008-04-07 Thread Jens Alfke


On 7 Apr '08, at 9:47 AM, John Stiles wrote:

I'm looking for an open-source NSToolbar-like toolbar  
implementation... do any exist? I haven't found any yet.


I'm not aware of any. My hunch is that it'd be a pain to re-implement  
with all of the features users expect from standard toolbars.


Panic infamously ended up re-implementing toolbars in their app Coda,  
simply because they couldn't get rid of an extra pixel of spacing that  
NSToolbar put in, which they felt made their toolbar look unbalanced.  
But I don't think they've released the source code to that!


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Newbie question

2008-04-07 Thread Michael Vannorsdel

Change the function declarations/definitions to

- (NSString*)ChooseString:(int) IntVal (the * goes inside the  
parenthesis)



On Apr 7, 2008, at 10:45 AM, john darnell wrote:


Hello all:

For those of you who do not like answering elementary questions, you
might want to give this message a pass.

I am making my first foray into writing Cocoa applications, and I have
created a very simple class.  The header file looks like this:

  /* Chooser */

  #import 

  @interface Chooser : NSObject
  {
  }

  - (NSString) *ChooseString:(int) IntVal;  //  If I comment out this
line, the error and first warning goes away
  @end


And the implementation file looks like this:


  @implementation Chooser
  /*  Commented out for debugging purposes
  - (NSString) *ChooseString:(int) IntVal;
  {
  }
  */
  - (id) init
  {
 self = [super init];
 if (self != nil)
 {
NSString * ListOfStrings = @"A stitch in time saves nine/No  
use
crying over spilt milk/A bird in the hand is worth two in the bush/ 
Never

put of to tomorrow what can be done today/Do not judge a man until you
have walked a mile in his shoes";
NSArray *StringList = [ListOfStrings
componentsSeparatedByString:@"/"];

 }
 return self;
  }

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

This email sent to [EMAIL PROTECTED]


Re: Newbie question

2008-04-07 Thread I. Savant
On Mon, Apr 7, 2008 at 1:05 PM, Michael Vannorsdel <[EMAIL PROTECTED]> wrote:
> Change the function declarations/definitions to
>
>  - (NSString*)ChooseString:(int) IntVal (the * goes inside the parenthesis)

  More to the point, the method "Returns an NSString pointer", or "NSString *".

http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Introduction/chapter_1_section_1.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: Newbie question

2008-04-07 Thread Jean-Daniel Dupas

Recheck the method declaration syntax in your book.

It's

- (NSString *)myMethodName:(type)arg;
and not
- (NSString ) *myMethodName:(type)arg;

the '*' in "NSString *" is part of the type.


Le 7 avr. 08 à 18:45, john darnell a écrit :


Hello all:

For those of you who do not like answering elementary questions, you
might want to give this message a pass.

I am making my first foray into writing Cocoa applications, and I have
created a very simple class.  The header file looks like this:

  /* Chooser */

  #import 

  @interface Chooser : NSObject
  {
  }

  - (NSString) *ChooseString:(int) IntVal;  //  If I comment out this
line, the error and first warning goes away
  @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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Newbie question

2008-04-07 Thread Hamish Allan
On Mon, Apr 7, 2008 at 6:05 PM, Michael Vannorsdel <[EMAIL PROTECTED]> wrote:

> Change the function declarations/definitions to
>
>  - (NSString*)ChooseString:(int) IntVal (the * goes inside the parenthesis)

Additionally, it's good practice to start method names and variables
with lowercase letters; something like "ChooseString" or "IntVal"
looks like a class name to a seasoned Cocoa programmer.

- (NSString *)chooseString:(int)intVal

Hamish
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Newbie question

2008-04-07 Thread Johannes Huning

Try   - (NSString *)ChooseString:(int) IntVal;
Always put your return type into the brackets.

On Apr 7, 2008, at 6:45 PM, john darnell wrote:

  - (NSString) *ChooseString:(int) IntVal;


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Newbie question

2008-04-07 Thread Douglas Davidson


On Apr 7, 2008, at 10:28 AM, Hamish Allan wrote:

On Mon, Apr 7, 2008 at 6:05 PM, Michael Vannorsdel  
<[EMAIL PROTECTED]> wrote:



Change the function declarations/definitions to

- (NSString*)ChooseString:(int) IntVal (the * goes inside the  
parenthesis)


Additionally, it's good practice to start method names and variables
with lowercase letters; something like "ChooseString" or "IntVal"
looks like a class name to a seasoned Cocoa programmer.

- (NSString *)chooseString:(int)intVal


An excellent suggestion; and even better would be to give the method a  
name that describes what it takes and returns.  A name like - 
chooseString: does not suggest a method that returns a value; for such  
a method we might pick a name like -stringAtIndex: or - 
chosenStringAtIndex: instead.  This might seem like a trivial point,  
and perhaps it is, but a great deal of the consistency and  
predictability of the Cocoa interfaces comes from API conventions, of  
which naming patterns are no small part.  Learn these patterns, and  
you will be better able to predict what methods a Cocoa class is  
likely to have, and remember what they do, just from their names.


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: ImageIO key properties

2008-04-07 Thread David Duncan

On Apr 6, 2008, at 11:22 PM, Mirko Viviani wrote:

for an application targeted for 10.4 I need to access the value of  
some key properties defined
for 10.5 in CGImageProperties.h, like  
kCGImagePropertyExifAuxDictionary.


Is there a legal way to do this?



Assuming you have your project set properly, standard weak-linking  
policies should apply. See the Frameworks Programming Guide on  
Frameworks and Weak Linking at 

--
David Duncan
Apple DTS Animation and Printing
[EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Obj-C idioms for list based tasks

2008-04-07 Thread Erik Buck
This is a prime use for Higher Order messaging: 
http://www.metaobject.com/papers/Higher_Order_Messaging_OOPSLA_2005.pdf
 http://www.cocoadev.com/index.pl?HigherOrderMessaging
http://www.oreilly.com/pub/a/mac/2004/07/16/hom.html
 
HOM takes this

// which of these employee objects earn more than 1000 Euros.
int i;
id salariedEmployees = [NSMutableArray array];
for (i = 0 ; i < [employees count] ; i++ )
{ 
   id employee = [employees objectAtIndex: i ];
   if ( [employee hasSalary: 1000] ) 
   { 
  [salariedEmployees addObject: employee];
   }
}

and turns it into this

salaried=[[employees select] hasSalary: 1000] ;

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Southern California Coders? (Cocoaheads carpool)

2008-04-07 Thread Brad Willoughby
To follow up, a few of us from San Diego chatted offline and have
decided to meet around 5:30pm this Wednesday at Vinaka Cafe (
http://www.yelp.com/biz/vinaka-cafe-carlsbad ) so we can carpool up to
Cocoaheads in Lake Forest.  Contact me offline if you'd like to hitch
a ride or be a driver.

Cheers,
Brad
___

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

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

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

This email sent to [EMAIL PROTECTED]


RE: Newbie question

2008-04-07 Thread john darnell
Thanks to all of you who answered my question.  I had seven answers
within an hour of posting, and it shows me that this bunch is willing to
help, even with simple questions (I groaned when I read the first
message, and realized how *obvious* the syntax error was).  

I'll try not to abuse this list in the future.

R,
John

___

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

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

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

This email sent to [EMAIL PROTECTED]


[OT] Dallas Cocoa Meetup?

2008-04-07 Thread Patrick Burleson
I was wondering how many on this list might interested in a Cocoa type
meetup in the Dallas/Fort Worth area?

I've very new to Cocoa and I think it would be great to get some
people together to learn from each other and to see what others are
working on. Maybe even get a full fledged CocoaHeads chapter setup.

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]


Re: Newbie question

2008-04-07 Thread Johannes Huning
There're also 2 articles concerning "cocoa style" available on  
CocoaDevCentral: http://cocoadevcentral.com/articles/82.php


On Apr 7, 2008, at 7:40 PM, Douglas Davidson wrote:


On Apr 7, 2008, at 10:28 AM, Hamish Allan wrote:

On Mon, Apr 7, 2008 at 6:05 PM, Michael Vannorsdel <[EMAIL PROTECTED] 
> wrote:



Change the function declarations/definitions to

- (NSString*)ChooseString:(int) IntVal (the * goes inside the  
parenthesis)


Additionally, it's good practice to start method names and variables
with lowercase letters; something like "ChooseString" or "IntVal"
looks like a class name to a seasoned Cocoa programmer.

- (NSString *)chooseString:(int)intVal


An excellent suggestion; and even better would be to give the method  
a name that describes what it takes and returns.  A name like - 
chooseString: does not suggest a method that returns a value; for  
such a method we might pick a name like -stringAtIndex: or - 
chosenStringAtIndex: instead.  This might seem like a trivial point,  
and perhaps it is, but a great deal of the consistency and  
predictability of the Cocoa interfaces comes from API conventions,  
of which naming patterns are no small part.  Learn these patterns,  
and you will be better able to predict what methods a Cocoa class is  
likely to have, and remember what they do, just from their names.


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/john%40quobor.de

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: NSViewController's representedObject and NSArrayController's selection don't mix?

2008-04-07 Thread Jacob Lukas
In diagnosing this problem, I tried to use the  
NSKeyValueObservingOptionPrior when observing NSArrayController's  
selection, but I never got a  
observeValueForKeyPath:ofObject:change:context: where the change  
dictionary contained an NSKeyValueChangeNotificationIsPriorKey entry.  
This leads me to believe that the issue is being caused by the  
selection proxy object's target is getting changed before I (or KVO)  
get any notification of the change.


I've worked around this issue by setting the NSViewController's  
representedObject to nil in the table delegate method  
tableView:shouldSelectRow: and set it back to -[NSArrayController  
selection] in tableViewSelectionDidChange:. This works, but flashes to  
blank before changing to the new value. I tried NSDisableScreenUpdates/ 
NSEnableScreenUpdates, which reduced the flash length, but didn't  
remove it. Is there a better way to do what I'm trying to do?


Thank you,
Jacob Lukas


On Apr 6, 2008, at 22:52, Jacob Lukas wrote:

I have a table of Core Data objects and a set of inspector views.  
Depending on the Class(es) of the selection in the table view, the  
set of inspector views changes.


I managed the inspector views with NSViewControllers. The fields in  
the inspector view are bound to the view controller's  
representedObject -- ex. representedObject.radius. This works, but  
when I add a deeper path to the mix (ex.  
representedObject.material.refractionIndex), I get the following  
message in the console when the selection changes:


2008-04-06 22:35:40.095 RayT[14429:10b] Cannot remove an observer  
 for the key path  
"material.refractionIndex" from <_NSControllerObjectProxy  
0x114329b30>, most likely because the value for the key "material"  
has changed without an appropriate KVO notification being sent.  
Check the KVO-compliance of the _NSControllerObjectProxy class.


The first selection works, but each selection change after that  
trigger this message.


Since the applicable inspector views change, I set their  
representedObject just before adding them to the screen:


[controllers  
makeObjectsPerformSelector:@selector(setRepresentedObject:)  
withObject:[configController selection]];


Where controllers is the list of inspector views and  
configController is the array controller. If I precede this by first  
setting the representedObject to nil, I get the message every other  
selection event, rather than every event.


Can anyone help shed some light on this situation?

Thank you,
Jacob Lukas

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Newbie question

2008-04-07 Thread Michael Watson
I'd like to add that since you were confused by the error you were  
given, you might want to pick up a book on C, which will explain  
pointers and function declarations/definitions to you. Objective-C is  
a thin superset of C, so the rules that apply to ANSI C apply to Obj-C  
as well.


Get a copy of The C Programming Language, 2nd Edition and thank  
yourself later:






--
m-s

On 07 Apr, 2008, at 14:10, john darnell wrote:

Thanks to all of you who answered my question.  I had seven answers
within an hour of posting, and it shows me that this bunch is  
willing to

help, even with simple questions (I groaned when I read the first
message, and realized how *obvious* the syntax error was).

I'll try not to abuse this list in the future.

R,
John

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/mikey-san 
%40bungie.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: Using existing SQLite database with core data?

2008-04-07 Thread Chris Hanson

On Apr 7, 2008, at 1:50 AM, Quincey Morris wrote:

On Apr 7, 2008, at 00:51, mmalc crawford wrote:
To reiterate, there is no reason *in principle* why Core Data could  
not do this.


Indeed, there's no reason in principle why Core Data could not be EOF.

Yet a core principle of Core Data is its abstraction of the model  
away from the structure of the various persistent store formats.


Core Data already offers the ability for developers to use an  
arbitrary schema for a persistent store:  You can subclass  
NSAtomicStore and use it to implement any schema you like for your  
persistent stores, with the constraint that you will get atomic load/ 
save semantics instead of transactional load/save semantics.


This does not in itself let you use an arbitrary database schema with  
an SQLite persistent store.  But it does demonstrate that doing so  
would not be an abandonment of any principles that you seem to have  
inferred.


  -- Chris

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: ImageIO key properties

2008-04-07 Thread Mirko Viviani

On 07/apr/08, at 19:43, David Duncan wrote:

for an application targeted for 10.4 I need to access the value of  
some key properties defined
for 10.5 in CGImageProperties.h, like  
kCGImagePropertyExifAuxDictionary.


Assuming you have your project set properly, standard weak-linking  
policies should apply. See the Frameworks Programming Guide on  
Frameworks and Weak Linking at 


I didn't remember this flag. Anyway since I'm having some undefined  
symbols I did a small test with 10.5 sdk (xcode 3.0)



#import 
#import "ApplicationServices/ApplicationServices.h"


int main(int argc, char *argv[])
{
CFStringRef dictName[] = {
kCGImagePropertyExifAuxDictionary,
kCGImagePropertyDNGDictionary,
};

printf("%p", dictName);

return 0;
}


Ld /tmp/pippo/build/pippo.build/Release/pippo.build/Objects-normal/ 
i386/pippo normal i386

cd /tmp/pippo
/Developer/usr/bin/gcc-4.0 -o /tmp/pippo/build/pippo.build/ 
Release/pippo.build/Objects-normal/i386/pippo -L/tmp/pippo/build/ 
Release -F/tmp/pippo/build/Release -filelist /tmp/pippo/build/ 
pippo.build/Release/pippo.build/Objects-normal/i386/pippo.LinkFileList  
-arch i386 -mmacosx-version-min=10.5 -weak_framework  
ApplicationServices -weak_framework Cocoa -isysroot /Developer/SDKs/ 
MacOSX10.5.sdk

Undefined symbols:
  "_kCGImagePropertyDNGDictionary", referenced from:
  _kCGImagePropertyDNGDictionary$non_lazy_ptr in main.o
ld: symbol(s) not found
collect2: ld returned 1 exit status


I've tried linking with -framework and -weak_framework with the same  
results.
kCGImagePropertyDNGDictionary and others properties declared in  
CGImageProperties.h are not defined in the framework.

Is it a bug or am I missing something?

Thank you.

--
Ciao,
Mirko
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: ImageIO key properties

2008-04-07 Thread David Duncan

On Apr 7, 2008, at 12:46 PM, Mirko Viviani wrote:

I've tried linking with -framework and -weak_framework with the same  
results.
kCGImagePropertyDNGDictionary and others properties declared in  
CGImageProperties.h are not defined in the framework.

Is it a bug or am I missing something?



You shouldn't need to specify the actual link parameters, just set the  
SDK (to 10.5) and the deployment target (to 10.4) and Xcode should  
figure everything out for you.


That said, this does look suspicious since the framework didn't  
declare kCGImagePropertyDNGDictionary until 10.5 but there is no  
availability macro attached to it. You should file a bug.

--
David Duncan
Apple DTS Animation and Printing
[EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


NSCoder Night (Re: [OT] Dallas Cocoa Meetup?)

2008-04-07 Thread Chris Hanson

On Apr 7, 2008, at 11:36 AM, Patrick Burleson wrote:

I was wondering how many on this list might interested in a Cocoa type
meetup in the Dallas/Fort Worth area?

I've very new to Cocoa and I think it would be great to get some
people together to learn from each other and to see what others are
working on. Maybe even get a full fledged CocoaHeads chapter setup.


There's an NSCoder Night get-together in Frisco, TX that meets on  
Tuesdays.  See the NSCoder Night web site   
for details.


For those who don't know, NSCoder Night is an informal WEEKLY get- 
together of Cocoa developers, just for hacking and hanging out.  The  
canonical day & time are Tuesday at 7:00 PM.  If you want to start a  
group in your area, all you need to do is find a cafe or other  
location with free wireless, and let me know -- I'll add it to the  
weekly announcement blog post.


NSCoder Night has no agenda, no speakers, and no preparation  
required.  All you need to do is show up with a laptop and hang out  
with other people hacking on your Cocoa projects.


  -- Chris

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Scaling a window background image quickly

2008-04-07 Thread Mike R. Manzano
Do you know if SVG in a webkit view performs faster than a PDF in an  
NSImageView?


Mike
On Apr 6, 2008, at 3:38 PM, glenn andreas wrote:

If only there were some sort of Scalable Vector Graphics format that  
were available, oh, yeah, there is - SVG is available via WebKit on  
Leopard, not to mention a number of editors that include SVG support  
(including the open source InkScape)...


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Objective-C Instance Variable Names

2008-04-07 Thread Ricky Sharp


On Apr 7, 2008, at 10:26 AM, Jim Correia wrote:

There is already the possibility of KVC collisions regardless of how  
you name your iVars.


Consider...

NSBaseClass, and MyClass derived from it.

Targetting 10.4, MyClass has an iVar named mImportantProperty (using  
m prefix here only for argument's sake), and accessors - 
setImportantProperty:, -importantProperty.


10.5 comes along and NSBaseClass gets a private iVar named  
_importantProperty, and the framework code uses KVC to access this  
property (perhaps through the private accessors - 
_setImportantProperty:, -_importantProperty.)


My code has violated the don't use the _ prefix for your method  
names rule.


My code hasn't used the don't use the _ prefix on my iVar names rule/ 
suggestion/convention.


Yet, I still have the KVC conflict. (And yes, it will probably be a  
pain in the neck to track down.)



I got burned by this a few years back.  It was extremely difficult to  
track down and I even filed a DTS incident for help with it.  The main  
reason it was difficult was that it was in the implementation of a  
custom control's method:


- (int)currentValue
{
return [[self cell] currentValue];
}

Compiler didn't generate any issues.  currentValue did exist on my  
corresponding cell's API, but when Tiger was upon us, currentValue was  
also a method of NSAnimation I believe.  Add onto this the fact that  
[self cell] returns an id, and at runtime, currentValue was sent, but  
to what the runtime thought was an NSAnimation instance.  This really  
trashed memory, but only with my control's instance.  Very strange  
runtime behavior followed.



Since then, I do the following to never ever collide.  Some may call  
it overkill, but it gives me total piece of mind:


- all ivars suffixed with _II

- all methods, including accessors include _II prior to first argument  
(e.g. color_II, setColor_II:, getColor_II:atRow:atColumn:


- all custom bindings suffixed with _II

- all keys prefixed with II (e.g. for use with dictionaries, NSCoding  
protocol)



This was all done in addition to stuff I was already doing previously:  
prefix of II for all class names, structs, enums.


___
Ricky A. Sharp mailto:[EMAIL PROTECTED]
Instant Interactive(tm)   http://www.instantinteractive.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: [OT] Dallas Cocoa Meetup?

2008-04-07 Thread elliott . harris

Hey Patrick,

I was going to start a chapter up earlier in the year, but things got  
busy, and I'll be in California all summer. I'm certainly interested  
in it when I get back in the Fall, and possibly even gauging interest  
before then.


Cheers,
Elliott
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [OT] Dallas Cocoa Meetup?

2008-04-07 Thread Waqar Malik
I would be interested in a group closer to Fort Worth (Grapevine,  
Southlake, Keller).


--Waqar
On Apr 7, 2008, at 1:36 PM, Patrick Burleson wrote:

I was wondering how many on this list might interested in a Cocoa type
meetup in the Dallas/Fort Worth area?

I've very new to Cocoa and I think it would be great to get some
people together to learn from each other and to see what others are
working on. Maybe even get a full fledged CocoaHeads chapter setup.

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]


[MEET]: Los Angeles CocoaHeads Thursday April 10th 7:30pm

2008-04-07 Thread Rob Ross

Howdy LA CocoaHeads!

Ricardo Silva will be giving us a presentation on Quartz Composer.


We meet on Thursday at the offices of E! Entertainment at 7:30pm.

Our meeting location is

5750 Wilshire Blvd
Los Angeles, CA 90036.

Here's a google map of the location:

http://www.google.com/maps?f=q&hl=en&q=5750+Wilshire+Blvd,+Los+Angeles 
+CA+90036&ie=UTF8&z=15&om=1&iwloc=addr


Free street parking is available. I'd suggest trying Masselin Ave,  
which is one block East of Courtyard Place.


We meet near the lobby of the West building at 5750 Wilshire Blvd, on  
the West side of Courtyard Place. There are picknick tables in front  
of the lobby and we'll gather there starting at 7:20pm. From there we  
go inside and up to conference room 3A at around 7:45pm .


If you arrive late, please ask the building security personnel in the  
lobby to direct you to the E! Security office, and they will be able  
to contact the group in conference room 3A and send someone down to  
meet you.


If you have any questions, please email Rob Ross at rross at  
eentertainmentdotcom




Rob Ross, Lead Software Engineer
E! Networks

---
"Beware of he who would deny you access to information, for in his  
heart he dreams himself your master." -- Commissioner Pravin Lal


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Using existing SQLite database with core data?

2008-04-07 Thread Quincey Morris


On Apr 7, 2008, at 12:10, Chris Hanson wrote:


On Apr 7, 2008, at 1:50 AM, Quincey Morris wrote:
Yet a core principle of Core Data is its abstraction of the model  
away from the structure of the various persistent store formats.


Core Data already offers the ability for developers to use an  
arbitrary schema for a persistent store:  You can subclass  
NSAtomicStore and use it to implement any schema you like for your  
persistent stores, with the constraint that you will get atomic load/ 
save semantics instead of transactional load/save semantics.


This does not in itself let you use an arbitrary database schema  
with an SQLite persistent store.  But it does demonstrate that doing  
so would not be an abandonment of any principles that you seem to  
have inferred.



I think we are talking about different things. I am not, and never  
was, talking about file formats, although I admit that the sentence  
you quoted fails to make this clear.


The question is this:

What administrative information -- that is, what data and data  
structures apart from the actual modeled data, and apart from the  
administrative information that is present in all sqlite databases  
anyway -- does Core Data in general require its sqlite persistent  
stores to store?


1. If the answer is literally "none", then it would appear that Core  
Data could already use an existing sqlite store as its persistent  
store, merely by writing a suitable model description for it, because  
everything it needs would be in the database already.


2. If the answer is "some", then where would that administrative  
information come from, if you were able to hand Core Data an existing  
sqlite database? You could (a) do without its being stored, or (b)  
create it and add it to the existing database, or (c) refuse to use  
the database.


It appears (based on the comments earlier in this thread) that the  
answer for EOF is either 1 or 2a.


It appears (based on past discussions on the list, which of course  
could have been simply wrong) that the current answer for Core Data is  
neither 1 nor 2a.


2b doesn't really count, since it's not really using an existing  
database if it reconstructs the database with a different set of data  
structures.


That leaves 2c, doesn't it?

If you're saying, as an expert on Core Data, that Core Data could  
reasonably changed so that the answer would be 2a, without affecting  
its internal functionality or performance so greatly that Core Data  
would need to be significantly re-architected, then I would ask: what  
is that administrative information *for*, if it is so little  
disruptive to be without it?


___

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

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

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

This email sent to [EMAIL PROTECTED]


Binding NSTableColumn to NSArrayController programatically.

2008-04-07 Thread Martin Linklater
Hi - I'm having trouble binding my table column to a key in my  
NSArrayController.


My NSArrayController is set to control an array of NSMutableDictionary  
objects. This array controller has its contentsArray bound to the  
'actualArray' (NSMutableArray) of my class object. When I set the  
binding for the table column like so:


[column bind:NSValueBinding toObject:contentsCTRL withKeyPath:@"myKey"  
options:nil];


I get the following error through output:

2008-04-07 22:28:14.058 EvePDA[6319:813] [0x103e450> valueForUndefinedKey:]: this class is not key value coding- 
compliant for the key myKey.


Yet when I perform the following method on my array objects I get the  
correct result:


[obj valueForKey:@"myKey'];

And if I set the binding manually in IB, with default options, it  
works fine.


I've looked online for solutions to this problem but nothing seems to  
tell me why the binding is not working. The closest match I can find  
for someone else suffering from this problem is here:


http://www.cocoabuilder.com/archive/message/cocoa/2006/8/21/169899

And that says the answer is what I'm already doing...

Can anyone tell me where I'm going wrong ?

Thanks
___

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

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

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

This email sent to [EMAIL PROTECTED]


NSConnection registerName

2008-04-07 Thread SD
I have a deamon application that starts up and registers itself using 
a pre-defined name. (NSConnection registerName: name]



I have another application that is started and it looks for the 
connection with [NSConnection 
rootProxyForConnectionWithRegisteredName: name host:nil].


This all works correctly if the processes are all launched with Xcode 
or the command line.


If I launch the deamon via command line using my regular user and 
then I launch the application using the Security.framework 
authentication, the application does not find the connection and 
starts a second deamon.


Does anyone know what is going on here and how to fix it so that the 
connection is registered for the whole system (not per user as it 
appears).


Thanx in advance.
SD.
--
==
SD

WARNING: Programming may be habit forming.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTreeController / CoreData still broken in 10.5?

2008-04-07 Thread Adam Gerson
However, I am using CoreData with my TreeController bound to a Managed
Object Context. Can I still supply a contentArray in this situation?

Adam


On Sun, Apr 6, 2008 at 9:36 AM, Jonathan Dann <[EMAIL PROTECTED]> wrote:
> Hi Adam,
>
> I've just finished a blog post on this, it's not about using it with core
> data, but it may help you out.
>
> http://jonathandann.wordpress.com/2008/04/06/using-nstreecontroller/
>
> Hope its useful
>
> Jon
>
>  Jonathan P Dann: Trainee Medical Physicist - Homepage - Flickr
>  contact | [EMAIL PROTECTED] - 07515-352-490 | skype - jonathandann
>
___

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

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

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

This email sent to [EMAIL PROTECTED]


[SOLVED] Re: NSViewController's representedObject and NSArrayController's selection don't mix?

2008-04-07 Thread Jacob Lukas
The problem ended up being that the object returned by - 
[NSArrayController selection] is a private proxy object, which  
dynamically proxies the current selection of the array controller.  
This means that the views were trying to stop observing the current  
selection's relationships, rather than the previous selection's  
relationships.


Since I wanted the NSMultipleValuesMaker behavior provided by the  
private proxy, I ended up solving this problem by implementing a proxy  
object that proxies to an array. I then gave the selectedObjects to  
this proxy object, and set the proxy as my view controller's  
representedObject each time the selection changes. This works  
beautifully.


If anyone wants the source for my proxy class, I'd be happy to provide  
it (free for all use).


Thank you,
Jacob Lukas

On Apr 6, 2008, at 22:52, Jacob Lukas wrote:

I have a table of Core Data objects and a set of inspector views.  
Depending on the Class(es) of the selection in the table view, the  
set of inspector views changes.


I managed the inspector views with NSViewControllers. The fields in  
the inspector view are bound to the view controller's  
representedObject -- ex. representedObject.radius. This works, but  
when I add a deeper path to the mix (ex.  
representedObject.material.refractionIndex), I get the following  
message in the console when the selection changes:


2008-04-06 22:35:40.095 RayT[14429:10b] Cannot remove an observer  
 for the key path  
"material.refractionIndex" from <_NSControllerObjectProxy  
0x114329b30>, most likely because the value for the key "material"  
has changed without an appropriate KVO notification being sent.  
Check the KVO-compliance of the _NSControllerObjectProxy class.


The first selection works, but each selection change after that  
trigger this message.


Since the applicable inspector views change, I set their  
representedObject just before adding them to the screen:


[controllers  
makeObjectsPerformSelector:@selector(setRepresentedObject:)  
withObject:[configController selection]];


Where controllers is the list of inspector views and  
configController is the array controller. If I precede this by first  
setting the representedObject to nil, I get the message every other  
selection event, rather than every event.


Can anyone help shed some light on this situation?

Thank you,
Jacob Lukas

___

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

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

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

This email sent to [EMAIL PROTECTED]


Continunous NSSegmentedControl?

2008-04-07 Thread Randall Meadows
I have an NSSegmentedControl on which I've enabled the "continuous"  
setting (via IB).  However, it doesn't send out continuous messages  
while I'm continually pressing one of the segments; it only fires  
(once) upon mouseUp.


I can find no documentation that says that NSSegmentedControl  
*DOESN'T* implement the continuous property.


Bug?  Or did someone deem that this particular subclass of NSControl  
doesn't do "continuous" and forgot to tell the documentation folks?

___

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

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

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

This email sent to [EMAIL PROTECTED]


printing PDF issues

2008-04-07 Thread Victor Bovio

Hi,

I have a document-based Cocoa application, in which I display quartz  
routines directly to the context of my NSView.
Following the documentation I added this methods to enable printing in  
my application:



on NSDocument:

- (void)printDocumentWithSettings:(NSDictionary *)printSettings  
showPrintPanel:(BOOL)showPrintPanel
delegate:(id)delegate didPrintSelector: 
(SEL)didPrintSelector contextInfo:(void *)contextInfo

{
NSView *view = [self myDocumentView];
NSPrintInfo *printInfo = [NSPrintInfo sharedPrintInfo];
NSPrintOperation *printOp = [NSPrintOperation  
printOperationWithView:view printInfo:printInfo];

[printOp setShowPanels:showPrintPanel];
[self runModalPrintOperation:printOp delegate:delegate
  didRunSelector:didPrintSelector  
contextInfo:contextInfo];

}


on NSView:

- (void)drawRect:(NSRect)rect
{
NSGraphicsContext *nsctx = [NSGraphicsContext currentContext];
CGContextRef context = (CGContextRef)[nsctx graphicsPort];
// draw quartz routines to the context
}

- (BOOL)knowsPageRange:(NSRangePointer)aRange
{
aRange->location = 1;
aRange->length = 1;
return YES;
}

- (NSRect)rectForPage:(NSInteger)pageNumber
{
return NSMakeRect(0, 0, 8.5*72, 11*72);
}


It works and I can print, but I have two problems:

1) the preview image that is displayed in the print panel does not  
show correctly the contents of my view, it looks like it was blured (a  
lot)


2) if I select a different page size and/or orientation in the page  
setup panel, it is ignored when I print.



Any ideas what I'm missing ??

Thanks.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Constraining a NSSlider to Certain Values

2008-04-07 Thread Peter Zegelin


On 08/04/2008, at 12:41 AM, Jean-Daniel Dupas wrote:



Le 7 avr. 08 à 16:03, Peter Zegelin a écrit :

On 07/04/2008, at 10:46 PM, Jean-Daniel Dupas wrote:



Le 7 avr. 08 à 14:10, Peter Zegelin a écrit :



On 07/04/2008, at 9:07 PM, Jean-Daniel Dupas wrote:



Le 7 avr. 08 à 12:14, Peter Zegelin a écrit :
I'm trying to constrain the value of an NSSlider (while it is  
being dragged) depending on the state of a modifier key and  
being totally new to Cocoa am getting nowhere really fast!  For  
a start, I don't seem to be able to find a way to test for a  
modifier key during the actual drag.


Can anyone help me here?

thanks!

Peter


To get the current modifier state during an event, -[NSEvent  
modifierFlags];
And -[NSApplication currentEvent] or -[NSWindow currentEvent] to  
get the current event (if you do not already have it).


OK but given, say, my own slidercell subclass, which event should  
I check in and how do I get a ref to the sliders window? I'm  
currently using 'continueTracking' which seems to be the right  
event to override:


You can get the ref window by using the -[NSView window] method.  
You can get the current event by using the NSApp global variable  
(NSEvent *event = [NSApp currentEvent];)

And see also the link in the Ron's message.



Ah thanks - thats what I was after I think.

However it looks like I am going to have to think about this some  
more because I've just noticed another problem. I now have the  
following in my NSSliderCell subclass:


- (BOOL)continueTracking:(NSPoint)lastPoint at: 
(NSPoint)currentPoint inView:(NSView *)controlView{


NSEvent *theEvent = [NSApp currentEvent];

if ([theEvent modifierFlags] & NSShiftKeyMask){
NSLog(@"shiftKey");
[self setFloatValue:0.0];
}

return YES;
}

which is more or less what I want. However now if I press the  
shiftkey without moving the mouse then of course I never get this  
message so the slider doesn't move to the new position until I move  
the mouse. Same when I stop pressing the shift key.  It looks like  
I need to have a timer set to run in mousedown, continuously check  
the status of the modifier keys and set the sliders modified  
position as needed. Thoughts?


regards,

Peter


Using a timer will not help you, as currentEvent is not valid when a  
timer fired.
When the modifier stats change, the  -[NSResponder flagsChanged: 
(NSEvent *)theEvent]
is call on the first responder that should be your NSSlider in this  
case.


We had a discussion about catching flag changed event the last week (http://www.cocoabuilder.com/archive/message/cocoa/2008/4/1/202898 
)

Maybe you can find something that may help you in this topics.




Yes - the timer also appears to block while dragging the slider - at  
least judging by the lack of calls to NSLog from the timer - while the  
mouse is down. Unfortunately the flagsChanged event also only fires  
after the mouseup - not during the drag. A bit frustrating seeing this  
is my first couple of days with Cocoa, but at least I'm learning quite  
a bit! It looks increasingly like the best way will be to just  
override the tracking completely and handle it myself using the  
mousedragged event. I've actually done a few experiments and this  
seems to work fine and I get the modifier keys just like any view  
(flagsChanged works in this case).


Thanks for everyones 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]


Apparent bug with button hotkeys that use shift

2008-04-07 Thread John Stiles
I am trying to add some hotkeys to buttons in my app, and I've hit a 
weird snag. Specifically, the shift modifier flag appears to be ignored 
for anything other than alphanumeric keys—i.e. I can't make a button 
that corresponds to "cmd+F1" and a second button that corresponds to 
"cmd+shift+F1". Instead, what happens is that when I press either cmd+F1 
or cmd+shift+F1, the cmd+F1 button gets a simulated click in it—twice. 
Bizarre.


Interface Builder seems to disallow the shift modifier on a button 
hotkey for non-alphanumeric keys as well, which might be an implicit 
acknowledgment of the bug or perhaps a related oversight.


Is this a known bug, hopefully with a known workaround (other than 
"don't do that")?


I could kludge around the issue in a variety of ways, but so far I can't 
think of any kludges that will keep working if/when Apple actually fixes 
the bug, and I'd like to avoid revisiting the issue once 10.6 comes out :)


(My app allows the user to set hotkeys for some commands to whatever 
they want—I never would have guessed the amount of hoops I'd end up 
jumping through to make it happen...!)

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Problems with Split Views?

2008-04-07 Thread Ben Einstein
For the most part, anything you want to do with NSSplitView you can do  
with RBSplitView (or others) and vice versa. Where RBSplitView really  
excels is its ease of implementation. Even though NSSplitView in 10.5  
is significantly better, I still find that RBSlitView has the upper  
hand in terms of time-to-deployment. If you need specifics, just  
compare the documentation of RBSplitView and NSSplitView.


I continue to use Rainer's implementation every time I need a split  
view.


Hope that helps,
Ben

On Apr 6, 2008, at 10:21 PM, Peter Zegelin wrote:

I am quite new to Cocoa and have been experimenting with split views  
in Interface Builder. It's basically 3 vertical splits with each end  
view also split in half horizontally. It seems to do more or less  
what I want. However looking around for example projects I get the  
impression that the split views are somehow buggy and I'm better off  
using a third party split view such as RBSplitView. Can someone  
explain what sort of problems - if any - I'm likely to encounter  
using the regular split view?


What I need is to have 3 vertical splits with each end view also  
split (horizontally). These end views should not resize as the  
window is resized - just the center view. I know in IB you don't  
seem to be able to prevent a split from resizing when its parent is  
resized (or am I wrong here?) but I presume that wouldn't be a  
problem with some code.


Thanks!

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/beinstein%40comcast.net

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How do I embed a font in an app?

2008-04-07 Thread Brad Peterson
Hi,

Just embed it as a resource, and then use the code
below to load it for use. You can just reference it by
name from then on (well, as long as your app is
running) as you would any other font. (Where
"kDefaultFontFile" is the name of your TTF file. Ex:
@"MyFont.TTF")

HTH!

B


NSString *fontPath = NSBundle mainBundle]
resourcePath] stringByAppendingPathComponent:@"Fonts"]
stringByAppendingPathComponent: kDefaultFontFile];
NSData *fontData = [NSData dataWithContentsOfFile:
fontPath]; 

ATSFontContainerRef container;
OSStatus err = ATSFontActivateFromMemory([fontData
bytes], [fontData length],
   kATSFontContextLocal,
   kATSFontFormatUnspecified,
   NULL,
   kATSOptionFlagsDefault,
   &container );
   
   if( err != noErr )
   NSLog(@"failed to load font into memory");
   
   ATSFontRef fontRefs[100];
   ItemCount  fontCount;
   err = ATSFontFindFromContainer(
   container,
   kATSOptionFlagsDefault,
   100,
   fontRefs,
   &fontCount );
   
if( err != noErr || fontCount < 1 ){
   NSLog(@"font could not be loaded.");
}
else{

NSString *fontName;
err = ATSFontGetPostScriptName(
   fontRefs[0],
   
kATSOptionFlagsDefault,
   (CFStringRef*)( 
&fontName ) ); 
   
NSLog(@"font %@ loaded", fontName);
}




  

You rock. That's why Blockbuster's offering you one month of Blockbuster Total 
Access, No Cost.  
http://tc.deals.yahoo.com/tc/blockbuster/text5.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: Apparent bug with button hotkeys that use shift

2008-04-07 Thread John Stiles
For any curious Apple engineers, I've just filed this issue as 
rdar://5848023 and attached a test app (four lines of code).



John Stiles wrote:
I am trying to add some hotkeys to buttons in my app, and I've hit a 
weird snag. Specifically, the shift modifier flag appears to be 
ignored for anything other than alphanumeric keys—i.e. I can't make a 
button that corresponds to "cmd+F1" and a second button that 
corresponds to "cmd+shift+F1". Instead, what happens is that when I 
press either cmd+F1 or cmd+shift+F1, the cmd+F1 button gets a 
simulated click in it—twice. Bizarre.


Interface Builder seems to disallow the shift modifier on a button 
hotkey for non-alphanumeric keys as well, which might be an implicit 
acknowledgment of the bug or perhaps a related oversight.


Is this a known bug, hopefully with a known workaround (other than 
"don't do that")?


I could kludge around the issue in a variety of ways, but so far I 
can't think of any kludges that will keep working if/when Apple 
actually fixes the bug, and I'd like to avoid revisiting the issue 
once 10.6 comes out :)


(My app allows the user to set hotkeys for some commands to whatever 
they want—I never would have guessed the amount of hoops I'd end up 
jumping through to make it happen...!)

___

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

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

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

This email sent to [EMAIL PROTECTED]


fileHFSCreatorCode & fileAttributesAtPath:traverseLink on app bundles

2008-04-07 Thread Mike
I need to get the creator code of my app's bundle without diving into 
the bundle and reading the plist directly.


My code looks like this:

OSType creator = 0;
NSDictionary *itemDictionary = nil;

itemDictionary = [ defaultFileManager 
fileAttributesAtPath:enumeratedItem traverseLink:NO ];


if( itemDictionary  )
{

creator = [ itemDictionary fileHFSCreatorCode ];

if( creator == kMyAppSignature )
{
// Do some stuff
}
}

The problem is, fileHFSCreatorCode on the returned attributes dictionary 
always returns 0 or an empty OSType. Is there some other method I need 
to use to get the creator of bundled apps instead of files?


I know the path at enumeratedItem is correct because I use it for other 
things in the same routine, which all work.


Thanks,

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: Constraining a NSSlider to Certain Values

2008-04-07 Thread Peter Zegelin


I have managed to get my slider working the way I want it to by  
overriding mousedown and mousedragged, however there is still one  
small detail. I cant see how to make the slider knob show its 'pushed'  
image while the slider is being dragged. Does anyone know how to do  
this?


thanks!

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: fileHFSCreatorCode & fileAttributesAtPath:traverseLink on app bundles

2008-04-07 Thread Ken Thomases

On Apr 7, 2008, at 10:11 PM, Mike wrote:
I need to get the creator code of my app's bundle without diving  
into the bundle and reading the plist directly.


[... snip ...]

The problem is, fileHFSCreatorCode on the returned attributes  
dictionary always returns 0 or an empty OSType. Is there some other  
method I need to use to get the creator of bundled apps instead of  
files?


I think the problem is that fileAttributesAtPath:... operates at a  
low level.  It's actually providing the attributes of the application  
bundle's directory, and directories don't have creator codes.


However, you need not dive into the bundle and read the plist  
directly -- you can let the framework do that for you.  It would be  
something like:


	[[[NSBundle bundleWithPath:enumeratedItem] infoDictionary]  
objectForKey:@"CFBundleSignature"]



I haven't tested, but it might also be that the LSCopyItemAttribute  
function with the kLSItemFileCreator attribute name would return the  
creator code for an application when passed the FSRef for the bundle.


Cheers,
Ken
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Problems with Split Views?

2008-04-07 Thread Peter Zegelin
Yes it does - thanks!  RBSplitView works great and actually  
experimented with it before playing around with the regular NSSplitView.


Peter


On 08/04/2008, at 10:35 AM, Ben Einstein wrote:

For the most part, anything you want to do with NSSplitView you can  
do with RBSplitView (or others) and vice versa. Where RBSplitView  
really excels is its ease of implementation. Even though NSSplitView  
in 10.5 is significantly better, I still find that RBSlitView has  
the upper hand in terms of time-to-deployment. If you need  
specifics, just compare the documentation of RBSplitView and  
NSSplitView.


I continue to use Rainer's implementation every time I need a split  
view.


Hope that helps,
Ben

On Apr 6, 2008, at 10:21 PM, Peter Zegelin wrote:

I am quite new to Cocoa and have been experimenting with split  
views in Interface Builder. It's basically 3 vertical splits with  
each end view also split in half horizontally. It seems to do more  
or less what I want. However looking around for example projects I  
get the impression that the split views are somehow buggy and I'm  
better off using a third party split view such as RBSplitView. Can  
someone explain what sort of problems - if any - I'm likely to  
encounter using the regular split view?


What I need is to have 3 vertical splits with each end view also  
split (horizontally). These end views should not resize as the  
window is resized - just the center view. I know in IB you don't  
seem to be able to prevent a split from resizing when its parent is  
resized (or am I wrong here?) but I presume that wouldn't be a  
problem with some code.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: fileHFSCreatorCode & fileAttributesAtPath:traverseLink on app bundles

2008-04-07 Thread Mike
In that case, how do I get the fullpath to the item from the iterator? 
There doesn't seem to be any key in the info dictionary for the current 
item's fullpath.


Thanks,

Mike

Ken Thomases wrote:

On Apr 7, 2008, at 10:11 PM, Mike wrote:
I need to get the creator code of my app's bundle without diving into 
the bundle and reading the plist directly.


[... snip ...]

The problem is, fileHFSCreatorCode on the returned attributes 
dictionary always returns 0 or an empty OSType. Is there some other 
method I need to use to get the creator of bundled apps instead of files?


I think the problem is that fileAttributesAtPath:... operates at a low 
level.  It's actually providing the attributes of the application 
bundle's directory, and directories don't have creator codes.


However, you need not dive into the bundle and read the plist directly 
-- you can let the framework do that for you.  It would be something like:


[[[NSBundle bundleWithPath:enumeratedItem] infoDictionary] 
objectForKey:@"CFBundleSignature"]



I haven't tested, but it might also be that the LSCopyItemAttribute 
function with the kLSItemFileCreator attribute name would return the 
creator code for an application when passed the FSRef for the bundle.


Cheers,
Ken


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [OT] Dallas Cocoa Meetup?

2008-04-07 Thread Dennis J. Hagner

Hey, count me in. I'm in Irving.

Dennis J. Hagner


--

Date: Mon, 7 Apr 2008 15:49:26 -0500
From: Waqar Malik <[EMAIL PROTECTED]>
Subject: Re: [OT] Dallas Cocoa Meetup?
To: Patrick Burleson <[EMAIL PROTECTED]>
Cc: cocoa-dev@lists.apple.com
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes

I would be interested in a group closer to Fort Worth (Grapevine,
Southlake, Keller).

--Waqar
On Apr 7, 2008, at 1:36 PM, Patrick Burleson wrote:
I was wondering how many on this list might interested in a Cocoa  
type

meetup in the Dallas/Fort Worth area?

I've very new to Cocoa and I think it would be great to get some
people together to learn from each other and to see what others are
working on. Maybe even get a full fledged CocoaHeads chapter setup.

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]


Re: fileHFSCreatorCode & fileAttributesAtPath:traverseLink on app bundles

2008-04-07 Thread Ken Thomases

On Apr 7, 2008, at 10:49 PM, Mike wrote:
In that case, how do I get the fullpath to the item from the  
iterator? There doesn't seem to be any key in the info dictionary  
for the current item's fullpath.


Huh?  You mean the enumeratedItem from your original code snippet?   
You never indicated where you got that from.  I assumed it was  
already a full path.  That's how your code snippet used it.


If you're instead getting a relative path from an  
NSDirectoryEnumerator, you should combine that relative path with the  
original directory path that you passed to -[NSFileManager  
enumeratorAtPath:].  The documentation for that method shows you how  
to do that with stringByAppendingPathComponent:.


If you really are using NSDirectoryEnumerator to scan a large  
hierarchy for applications, be sure to use an inner auto-release pool  
to clean up intermediate objects as you go.  Also, once you detect  
that a path corresponds to a bundle (+[NSBundle bundleWithPath:]  
returns non-nil), use -[NSDirectoryEnumerator skipDescendents] to  
avoid enumerating the contents of the bundle -- unless you're really  
interested in applications buried inside of other applications, it  
will just be wasted time.


-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: NSURLConnection status updates

2008-04-07 Thread Jens Alfke


On 7 Apr '08, at 8:35 AM, Matt Burnett wrote:

I am using NSURLConnection to send large posts (>1MB) to a web  
server. How can i get the status/progress information for sending  
the request.


Set the request body to a custom stream implementation, and your  
stream will get called as the connection reads the data out of it to  
send over the socket.


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: NSConnection registerName

2008-04-07 Thread Jens Alfke


On 7 Apr '08, at 3:32 PM, SD wrote:

If I launch the deamon via command line using my regular user and  
then I launch the application using the Security.framework  
authentication, the application does not find the connection and  
starts a second deamon.


Sounds like the app and daemon are running in different contexts — the  
daemon as you and the app as root. A process with root privileges  
won't find a port registered by a regular user, for security reasons.  
(Root code can't trust user code.)


Don't you want it the other way around — the daemon running as root  
and the app as user? I think that direction works. (Though I'm not an  
expert on Mach or Unix privileges. Have you read through the long tech- 
note on daemons and agents?)


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: How do I embed a font in an app?

2008-04-07 Thread Jens Alfke


On 7 Apr '08, at 5:52 PM, Brad Peterson wrote:

Just embed it as a resource, and then use the code below to load it  
for use.


This seems less efficient (and more complicated) than either of the  
two earlier solutions. Loading the font into memory first means it  
takes up heap space, which is private and has to be allocated out of  
swap, rather than allowing the file to be memory-mapped. Better just  
to point ATS at the file. And you can't get much simpler than just  
pointing your Info.plist at a directory full of fonts.


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: fileHFSCreatorCode & fileAttributesAtPath:traverseLink on app bundles

2008-04-07 Thread Jens Alfke


On 7 Apr '08, at 8:11 PM, Mike wrote:

I need to get the creator code of my app's bundle without diving  
into the bundle and reading the plist directly.


You're mixing up HFS creator codes with bundle identifiers, I think.

HFS creator codes are attributes of document files that identify what  
app created them. They're 4-character codes like 'ttxt'. They're not  
used much anymore in OS X, partly because most filesystems don't  
support them. (Even if your app defines one, you won't find any files  
inside the bundle with that creator code. It's stored as a key in the  
Info.plist.)


Bundle identifiers look like "com.mycompany.MyApp" and are used to  
identify applications in OS X. To get your app's bundle identifier,  
use the NSBundle snippet someone already posted.


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

NSUndoManager grouping somewhat broken?

2008-04-07 Thread Graham Cox

I am getting funny results using grouping in NSUndoManager.

If I begin a group on mouse down, and end the group on mouse up, even  
if I do nothing in between, it seems to record an undo task, with the  
plain name "Undo" in the menu, dirtying the document. The "task" is  
null - it doesn't actually undo anything.


When I go to close a document with its undo manager in this state, it  
hangs indefinitely before putting up the save changes dialog. (I get  
nothing i the log or GDB to indicate why it's hanging, but the dialog  
doesn't appear).


Surely it's incorrect for NSUndoManager to treat an empty group as a  
real undo task?


Working around this is proving to be extremely troublesome - for  
example I've tried subclassing NSUndoManager and overriding  
beginUndoGrouping, and for grouping beyond level zero, I defer the  
group opening until a task is actually received. Likewise,  
endUndoGrouping doesn't close the group if it was never really opened.  
Problem is, I can't get this to work - the docs are unclear about  
whether these exact methods are called by the standard event/run loop  
grouping (they appear not to be), and frankly the workings of undo  
groups seem to be shrouded in mystery.


The other workaround is to try and predict which operations between  
mouse down and mouse up really will make an undo task, and try and  
open a group "just in time" to receive them. Naturally given the  
hundreds of possible tasks that the mouse can create, this is a really  
difficult approach in and of itself.


Can someone confirm that undo groups are broken in this way, or if  
they are not broken, explain what the hell the logic is here?


Better still, has anyone written an NSUndoManager subclass that fixes  
this?



--
S.O.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]


alBufferData, void * data

2008-04-07 Thread David Harper
hello!

I'm trying to figure out how to use openAL without alut (as alut is no longer 
included in the openAL framework).  The roadblock I am facing is that 
alBufferData requires a pointer to a sound's bitmap data.

NSSound doesn't seem to have the appropriate method.  Any suggestions?

Please let me know if this question would be better directed to a different 
mailing list.

Thanks in advance,
- Dave H.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: alBufferData, void * data

2008-04-07 Thread Jens Alfke


On 7 Apr '08, at 11:20 PM, David Harper wrote:

I'm trying to figure out how to use openAL without alut (as alut is  
no longer included in the openAL framework).  The roadblock I am  
facing is that alBufferData requires a pointer to a sound's bitmap  
data.


By 'bitmap' do you mean the decompressed audio samples? You'll have to  
use CoreAudio to convert the sound into those. But if openAL can work  
with encoded sound formats like AIFF or MP3, you should be able to  
just read the file into memory using something like [NSData  
dataWithContentsOfFile:].



NSSound doesn't seem to have the appropriate method.  Any suggestions?


NSSound is ultra high-level and doesn't support anything beyond simple  
playback.


The best API to use to read the samples would probably be ExtAudioFile  
(in the AudioToolbox framework).


Please let me know if this question would be better directed to a  
different mailing list.


The CoreAudio-API mailing list (on this same listserv) is the most  
appropriate place for audio discussions.


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]