Re: Where to send different messages while RunLoop is running

2009-10-12 Thread Alastair Houghton

On 11 Oct 2009, at 21:45, John Love wrote:

I definitely do agree that polling is sporadic or unpredictable --  
and taking your clue about +distantFuture to heart, I changed it to  
+date to indicate now, or immediately -- and it now works even with - 
shouldExit sending other message IDs.  I just need to think where to  
send these other message IDs per your recommendation.


It isn't just that, as I said, polling wastes CPU time and power too.   
Without knowing *what* you're polling for, it's difficult to suggest  
an alternative, however.


I don't think I'd use +date (i.e. immediate return), though, since it  
seems unlikely that you need to poll that fast.  Unless whatever  
you're polling blocks, that'll result in a busy wait, which is a  
really bad idea.  For things that the user wants to see "immediately",  
I think I'd be inclined to poll at 0.1s or even 0.25s intervals, as  
that's going to be more than quick enough in practice.


Another alternative that you might consider is writing your own run  
loop source to trigger the run loop in your main thread.  That would  
avoid using the NSMachPort altogether, and you probably wouldn't need  
a run loop in your secondary thread (just a loop with a sleep() in it  
if you absolutely *must* poll something).


Kind regards,

Alastair.

--
http://alastairs-place.net



___

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

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

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

This email sent to arch...@mail-archive.com


Saving for iPhone - Can core data handle this?

2009-10-12 Thread Jon Hull
I have a game project for the iPhone which has a rather complicated  
object graph


There is a large graph of tiny immutable objects which represent the  
story (including different branches of the storyline).  This graph is  
large enough that I only want to keep the nodes that are actually  
being used in memory.  There is also a separate graph of game objects  
(characters, etc...) that change state over time and will need to be  
saved as part of a saved game.  These seem like they should be stored  
separately since one never changes and will be common for all players,  
while the other is different for each player.  I also want to be able  
to get a fresh copy of the changing objects for new games.


The final complication is that I have several proxies being used in an  
important way, and I don't think there is any NSProxy equivalent for  
NSManagedObject.  I guess I would just have to hope that  
NSManagedObject doesn't have any methods that the targets of the proxy  
override.


I have been reading the docs for Core Data, and have a rough idea on  
how I might accomplish all of this, but I wanted to see if someone had  
experience with this and could keep me from spending time going down  
the wrong path if it isn't going to work.


So, do you think core data can handle this?  What approach (roughly)  
should I use?


Thanks,
Jon
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Appropriate dealloc and finalize actions

2009-10-12 Thread Karolis Ramanauskas
Thanks, Kai, Greg, Jens,

> It's generally a bad idea to have two objects each retain the other. It
> produces a reference loop, which means neither object can be deallocated
> without manually releasing each side of the relationship.


As was stated in my original email these are all weak references:

@property (readwrite, assign) MyClass * connection;

I am not retaining the other object. In fact I couldn't really do it because
I'm pointing to the object of the SAME class.

MyClass 1 > MyClass 2
MyClass 2 > MyClass 1

If I made a property to retain the value it would automatically mean that I
get a retain cycle.

I guess I should tell you more about the model so you would get the picture.
I am modeling a network of physical processes, look at the representation:

http://i729.photobucket.com/albums/ww297/karolisr/example.png

As you can see each box has one or more little "inputs" and "outputs" in
fact these inputs and outputs are instances of one class (KROMPort). When I
drag a connection from output to an input, I set each "port's" connection
property to point to another "port". So Input points to Output and Output
points to Input. Only one-to-one relationships are allowed (one connection
per input/output). Essentially this is what I have:

KROMPort * input;

KROMPort * output;


output.connection = input;

input.connection = output;


So whenever either an input or output is deleted I have to nil the
connection of the object pointing to the soon to be deallocated object:


self.connection.connection = nil;


SELF here is either an input or an output.


Thanks, Kai, for pointing this out:


The good news is that GC has support for this: weak references. Simply
> declare the connection ivar as weak: __weak MyClass* connection. GC does the
> rest. No dealloc, no finalizer, no dangling pointer. And it’s even thread
> safe.


I never programmed for GC, so I should check then if GC is enabled in my
@interface and create a separate declaration looking like this then?:

"__weak KROMPort * connection"

Thanks all!
___

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

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

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

This email sent to arch...@mail-archive.com


TIFFRepresentation, different TIFF format under Snow Leopard

2009-10-12 Thread Peter C
I just stumble into a feature (or a bug ?), NSImage TIFFRepresentation  
produce RGB TIFF with a layer (when open under Photoshop). Previously  
it produce plain RGB TIFF under OS 10.5 and below. This cause some  
part of my programs interpret wrong RGB data, expecting 3 bytes  
instead of 4 bytes for a RGB pixel.  There is no mention in the  
documents about this "feature".


Is there a way to restore the previous behavior  of TIFFRepresentation ?


___

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

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

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

This email sent to arch...@mail-archive.com


Re: Appropriate dealloc and finalize actions

2009-10-12 Thread Roland King


On 12-Oct-2009, at 7:26 PM, Karolis Ramanauskas wrote:


Thanks, Kai, Greg, Jens,

It's generally a bad idea to have two objects each retain the  
other. It
produces a reference loop, which means neither object can be  
deallocated

without manually releasing each side of the relationship.



As was stated in my original email these are all weak references:

@property (readwrite, assign) MyClass * connection;

I am not retaining the other object. In fact I couldn't really do it  
because

I'm pointing to the object of the SAME class.


yes you could - nothing stops you in retain/release mode from  
retaining an object of the same class, or even yourself, multiple times.




MyClass 1 > MyClass 2
MyClass 2 > MyClass 1

If I made a property to retain the value it would automatically mean  
that I

get a retain cycle.


indeed you would one you would have to break.



So whenever either an input or output is deleted I have to nil the
connection of the object pointing to the soon to be deallocated  
object:



self.connection.connection = nil;



Yes that looks like it would work, you explicitly remove the pointer  
to yourself as you go away. That's fine. Of course it means you aren't  
managing the lifetimes of the objects between each other, their  
lifetimes are totally dependent on external factors, but if that's  
what you want, that's good.





Thanks, Kai, for pointing this out:


The good news is that GC has support for this: weak references. Simply
declare the connection ivar as weak: __weak MyClass* connection. GC  
does the
rest. No dealloc, no finalizer, no dangling pointer. And it’s even  
thread

safe.





No. Under GC you don't have this problem at all. You don't need weak  
references or anything else funky, it just works. MyClass1 pointing to  
MyClass2 and back with ordinary object references/assign properties  
does create a cycle yes, however GC can manage that perfectly well.  
Once there are no references to either MyClass1 or MyClass2 from the  
*ROOT* objects, even though they point to each other, they are subject  
to collection. GC is able to deal with these reference loops quite  
happily.


___

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

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

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

This email sent to arch...@mail-archive.com


Problem with OpenSSL header files

2009-10-12 Thread Rui Pacheco
Hi,
I'm using a library on my project that requires OpenSSL. I've linked to
libssl.dilyb and libcrypto.dilyb but when I try to compile my project, it
comes up with the error "  "_SSL_CTX_set_client_cert_cb", referenced from:
".

Some Googling shows that this means there's a discrepancy between the
OpenSSL headers and the OpenSSL libraries. When I added the libraries to my
project I noticed that there were several OpenSSL libraries - one with no
version, one on version 0.9 (which GCC can't find), one on 0.9.7 and one on
0.9.8. No matter which one I link to, I still get this error.

Where can I find these headers and how can I add them to my project?

-- 
Best regards,
Rui Pacheco
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Appropriate dealloc and finalize actions

2009-10-12 Thread Kai Brüning


On 12.10.2009, at 13:42, Roland King wrote:



On 12-Oct-2009, at 7:26 PM, Karolis Ramanauskas wrote:


Thanks, Kai, Greg, Jens,

It's generally a bad idea to have two objects each retain the  
other. It
produces a reference loop, which means neither object can be  
deallocated

without manually releasing each side of the relationship.



As was stated in my original email these are all weak references:

@property (readwrite, assign) MyClass * connection;

I am not retaining the other object. In fact I couldn't really do  
it because

I'm pointing to the object of the SAME class.


yes you could - nothing stops you in retain/release mode from  
retaining an object of the same class, or even yourself, multiple  
times.




MyClass 1 > MyClass 2
MyClass 2 > MyClass 1

If I made a property to retain the value it would automatically  
mean that I

get a retain cycle.


indeed you would one you would have to break.



So whenever either an input or output is deleted I have to nil the
connection of the object pointing to the soon to be deallocated  
object:



self.connection.connection = nil;



Yes that looks like it would work, you explicitly remove the pointer  
to yourself as you go away. That's fine. Of course it means you  
aren't managing the lifetimes of the objects between each other,  
their lifetimes are totally dependent on external factors, but if  
that's what you want, that's good.





Thanks, Kai, for pointing this out:


The good news is that GC has support for this: weak references.  
Simply
declare the connection ivar as weak: __weak MyClass* connection.  
GC does the
rest. No dealloc, no finalizer, no dangling pointer. And it’s even  
thread

safe.





No. Under GC you don't have this problem at all. You don't need weak  
references or anything else funky, it just works. MyClass1 pointing  
to MyClass2 and back with ordinary object references/assign  
properties does create a cycle yes, however GC can manage that  
perfectly well. Once there are no references to either MyClass1 or  
MyClass2 from the *ROOT* objects, even though they point to each  
other, they are subject to collection. GC is able to deal with these  
reference loops quite happily.


Of course you’re right, you do not need weak references under GC to  
break reference count cycles - these are a non-issue under GC. I made  
the implicit assumption (bad bad!) that these objects should not keep  
each other alive. This is what __weak is good for: it marks a  
reference which does not keep the target alive and is auto-niled when  
the target dies. Depends on what you need.


And there’s no need to conditionalize __weak in any way. It’s simply  
ignored under non-GC.


Best
Kai



___

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

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

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

This email sent to li...@kai-bruening.de


___

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

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

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

This email sent to arch...@mail-archive.com


Re: FBOs and CAOpenGLLayers... oh my!

2009-10-12 Thread Richard Somers

On Oct 9, 2009, at 3:04 PM, Richard Somers wrote:

Also for some reason the first context under some circumstances is  
not fully functional for me but the second one is.


My mistake. The first context is fully functional.

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 arch...@mail-archive.com


Re: Binding "hidden" attribute

2009-10-12 Thread Paul Bruneau
Yes, I have recently learned how to do this for my under development  
app.


Here is the IB part, pretty straightforward (File's Owner (a  
controller class) has a door object with a derived "fake" ivar called  
isMonumental:


<>




The tricky part in your case (and mine) is because your "ivar" is not  
an ivar but a derived value returned by a method, you need to tell the  
KVO system that. Here is my method:


+ (NSSet *)keyPathsForValuesAffectingIsMonumental;
{
return [NSSet setWithObjects:kTypeKey, nil];
}

In your case, you have more than one dependent key, which is fine, try  
this (10.5 and later--there's another way for pre 10.5):


+ (NSSet *)keyPathsForValuesAffectingSchemaIsHidden;
{
return [NSSet setWithObjects:@"query", @"source", nil];
}

So now if either of those keys changes, KVO will do something like  
notify everyone watching schemaIsHidden (what actually happens is  
beyond my knowledge). If you had a "real" BOOL ivar, it would Just  
Work without this extra stuff.


You can read all about it here:
https://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/KeyValueObserving/Concepts/DependentKeys.html 
#//apple_ref/doc/uid/20002179


Based on history, there is a good chance I messed something up in this  
answer, so I hope someone will correct me if necessary.


On Oct 11, 2009, at 8:34 PM, BareFeet wrote:


OK, let me put this another way:

Has anyone successfully bound the "hidden" attribute of an Interface  
object, so that it hides and shows when the ivar changes? If so, how?


Thanks,
Tom
BareFeet


From: BareFeet 
Date: 9 October 2009 12:18:38 AM AEDT
To: Cocoa Dev 
Subject: Binding hidden attribute

Hi all,

I'm trying to hide a tab view item according to the value returned  
an accessor in my model.


My accessor simply returns YES or NO, as per:

- (BOOL) schemaIsHidden {
	return ([type isEqualToString: @"query"] || [type isEqualToString:  
@"source"]);

}

In interface builder, in my document nib, I selected the view  
belonging to my "Schema" tab view item, set its "Hidden" attribute to:


Bind to: My Array Controller
Controller key:  selection
Model Key Path:  schemaIsHidden

It compiles OK, but when I run it, I get an error in the log:

Cannot create attributed string from object  of class NSNull

What does this mean?

Do I have the correct class (BOOL) returned by my accessor?

My other bindings to this same model and controller work fine.

Thanks,
Tom
BareFeet


___

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

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

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

This email sent to arch...@mail-archive.com

Re: Appropriate dealloc and finalize actions

2009-10-12 Thread Roland King


No. Under GC you don't have this problem at all. You don't need  
weak references or anything else funky, it just works. MyClass1  
pointing to MyClass2 and back with ordinary object references/ 
assign properties does create a cycle yes, however GC can manage  
that perfectly well. Once there are no references to either  
MyClass1 or MyClass2 from the *ROOT* objects, even though they  
point to each other, they are subject to collection. GC is able to  
deal with these reference loops quite happily.


Of course you’re right, you do not need weak references under GC to  
break reference count cycles - these are a non-issue under GC. I  
made the implicit assumption (bad bad!) that these objects should  
not keep each other alive. This is what __weak is good for: it marks  
a reference which does not keep the target alive and is auto-niled  
when the target dies. Depends on what you need.


And there’s no need to conditionalize __weak in any way. It’s simply  
ignored under non-GC.




Let me see if I can summarize this with an example so the original  
poster can decide exactly what fits his purpose, because there's still  
room for misunderstanding.


Assume we start with two objects, O1 and O2, each of which has one  
strong reference to it (if we're memory managed that means it has been  
retained once and not yet released, if GC, it's strongly reachable).  
Then let's say each of the following things happen and I'm going for  
the sake of example assume no other external factors alter the object  
lifetimes, try to keep it simple.


1. O1 and O2 are set to point to each other (each has its connection  
set to the other).
2. The strong reference to O1 is removed, so in memory managed mode  
it's released, or in GC mode it becomes otherwise non-root-reachable
3. sometime later the strong reference to O2 is removed in the same  
way as 2. above.


Here is what I believe happens in each of the cases

a) Memory Managed mode where 'connection' is a 'retain' property.
At 1., the reference counts of O1 and O2 are increased to 2.
At 2., O1's reference count drops to 1 and it is not released.
At 3., O2's reference count drops to 1 and it is not released.

Yes this is your retain cycle as the original poster had said.


b) Memory Managed mode where 'connection' is an 'assigned' property  
which does self.connection.connection = nil upon dealloc

At 1. the reference counts of O1 and O2 are unchanged
	At 2. O1's reference count drops to 0 and it's released, in doing so  
it nil's O2's connection pointer
	At 3. O2's reference count drops to 0 and it's released, its  
connection pointer was nil'ed earlier, so there's no dangling reference.


	This is what the original poster suggested and should work. Note that  
O2 can 'lose' O1 at any point, its lifetime depends on things entirely  
external to the ownership of O2, but there's no retain cycle and the  
reference nil in the dealloc stops one object from trying to use the  
other after that's happened.



c) GC mode, normal references (ie connection is an assigned ordinary  
property)

At 1. O1 and O2 now have mutual strong references to each other
	At 2. O1 loses one strong reference however because O2 is still  
strongly reachable, and O1 is strongly reachable from O2, O1 is *not*  
subject to reclaimation here. They both continue to hang around.
	At 3. O2 loses its strong reference. O1 and O2 *still* strongly  
reference each other however, because they no longer have a path from  
a root object, they are now subject to being reclaimed.


	This is what I assumed (and true I have also made an assumption) is  
the most likely useful case. Unlike in b) where each object could lose  
its connected object at any point, in c) as long as *one* of the  
objects is strongly reachable, its reference to its partner keeps its  
partner object alive, however when *neither* of them are strongly  
reachable from root objects, the fact they refer to each other only,  
is not enough to keep them alive. This is where GC wins.



d) GC mode, _weak references between O1 and O2
At 1. O1 and O2 have weak references to each other
	At 2. O1 is now not strongly reachable from the root and, because the  
reference to O1 from O2 is weak, that does not make a strong reference  
path and O1 *may* now be collected at any point. Doesn't have to be,  
the GC can take it anytime it likes.
	At 2. O2 is also now not strongly reachable and it is also subject to  
reclaimation. At some point after this O1 and O2 will be collected.


	d) is the closest GC analogue to b), it's very much like it. The  
objects don't affect each other's lifetimes at all, and when one  
object is collected the reference from the other object is nil'ed as  
it was in b). The only difference really is that in b) (the way I set  
this example up), O1 *will* be dealloc'ed at stage 2., the point it's  
released, in d) it may or may not be dealloced there, or som

Illegal attempt to establish a relationship 'xyz' between objects in different contexts

2009-10-12 Thread Alex Reynolds
I am using the CoreDataBooks sample application as a basis for pulling  
data into a secondary managed object context in the background, and  
then merging that data into the primary managed object context.


The data I am pulling in is a Book entity with a to-one relationship  
with an Owner entity (called "owner"). The Owner entity has a to-many  
relationship with the Book (called "books").


My data is an XML document of the form:


alexpreynolds
123456


Book One
Book Two
... 
Book N


Book One through Book N are associated with one Owner ("alexpreynolds,  
123456").


I am parsing this into an Owner instance and an NSMutableSet made up  
of Book instances.


When I attempt to save the first time, it saves fine and the merged  
data shows up in the table view.


On the second save, however, when the XML content contains a new book,  
it doesn't work.


Here's what happens:

I then attempt to load in an XML document that contains a new Book not  
already in the primary managed object context. The new Book is using  
the same Owner as that which is associated with the other Books.


I have routines that pick out this unique Owner managed object (which  
I already have in my primary managed object context) and the unique  
Book that is *not* found in the primary MOC.


From this, I create a new Book object in the secondary MOC, and I set  
its "owner" relationship to point to the unique Owner I found in the  
primary MOC.


When I save, I get the following error:

*** Terminating app due to uncaught exception  
'NSInvalidArgumentException', reason: 'Illegal attempt to establish a  
relationship 'owner' between objects in different contexts (source =  
 (entity: Book; id: 0x7802ae0 > ; data: {

creationDate = 2009-10-12 06:01:53 -0700;
name = nil;
nameInitial = nil;
operations = (
);
owner = nil;
type = 0;
}) , destination =  (entity: Owner; id: 0x3a56f80 > ; data: {

books = "";
displayName = alexpreynolds;
ownerID = 123456;
}))'

How do I create the new Book entity in the secondary MOC, so that I  
can still associate it with a pre-existing Owner in the primary MOC?


Thanks for any advice.

Regards,
Alex
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Appropriate dealloc and finalize actions

2009-10-12 Thread Karolis Ramanauskas
Thanks to everyone! Reading all this I realized that there is a little more
to GC than I know... or should I say a lot more. at this point I'm unable to
choose exactly what may be the best solution. I will have to read
documentation and interpret that information through the prism of my
application. Again, thanks for the time you take to consider my problem,
this is a great list. Hope I can reciprocate more than I do.
Karolis
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Illegal attempt to establish a relationship 'xyz' between objects in different contexts

2009-10-12 Thread Alexander Spohr


Am 12.10.2009 um 15:27 schrieb Alex Reynolds:

How do I create the new Book entity in the secondary MOC, so that I  
can still associate it with a pre-existing Owner in the primary MOC?


You can’t.

Drag a local instance of the owner into you second MOC and connect to  
that copy.


atze

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Binding "hidden" attribute

2009-10-12 Thread BareFeet

On 12/10/2009, at 11:57 PM, Paul Bruneau wrote:

Yes, I have recently learned how to do this for my under development  
app.


The tricky part in your case (and mine) is because your "ivar" is  
not an ivar but a derived value returned by a method, you need to  
tell the KVO system that. Here is my method:



+ (NSSet *)keyPathsForValuesAffectingSchemaIsHidden;
{
   return [NSSet setWithObjects:@"query", @"source", nil];
}


Ooh, that looks complex, but worth noting, thanks.

I realise now tat your answer makes sense as a requirement if the  
"type" in model object changes, otherwise there's nothing to trigger  
the re-evaluation of the schemaIsHidden ivar. But in my situation, the  
type is set when the object is created and never changes for that  
object. So I don't actually need to handle KVO to that degree.


After further investigation, it seems that my approach works for my  
situation, in so far as the schemaIsHidden value (returned by an  
accessor method or stored in an ivar) is correct for the object's  
type. The problem appears to be that the tab view item is not hiding  
as I hoped it would. I'll repost this as a different question.


Thank you greatly for your response. It helped me realise my faulty  
assumptions and better identify the problems.


Thanks,
Tom
BareFeet

___

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

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

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

This email sent to arch...@mail-archive.com


Core Data with OpenGL

2009-10-12 Thread Richard Somers

Consider an application using Core Data and OpenGL.

Normally a model object (MVC) has no knowledge of views or controllers  
but in this case it must draw itself. When the draw method is called  
by the view or controller the appropriate OpenGL context is current.  
So far so good. The problem however is with OpenGL resources needed to  
support drawing.


When a model object is added to the managed object context, specific  
OpenGL resources need to be created. When a model object is removed  
from the managed object context, OpenGL resources need to be cleaned up.


A seemingly straight forward solution would be to do the OpenGL  
initialization and cleanup work in the awakeFromInsert,  
awakeFromFetch, and didTurnIntoFault methods of NSManagedObject. The  
problem is however, the OpenGL context is not current when these  
methods are called. These methods are called by the Core Data  
framework which has no knowledge of the OpenGL context.


Any suggestions or comments?

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 arch...@mail-archive.com


Hiding tab view items

2009-10-12 Thread BareFeet

Hi all,

I have a hierarchical list of objects, like the typical iTunes or  
XCode left pane. When the user selects a node in this hierarchy, I  
display detail of that node in the pane on the right. This right pane  
is divided into tab view items. Only some of the tab view items are  
relevant to each type of node, so I'd like to hide the tab view items  
that are not relevant. How can I do this?


In interface builder, I can't see any "hidden" property of tab view  
item. There is a "hidden" property for the sub-view of a tab view  
item, but this doesn't hide the tab view item itself, so is misleading  
to the user (ie they can click on it, only to see a blank view).


I tried using a segmented control, instead, using bindings to link it  
to the tab view (now tabless). But segmented control cells also seem  
to lack a "hidden" property.


Any ideas?

Thanks,
Tom
BareFeet

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Hiding tab view items

2009-10-12 Thread Volker in Lists

Hi,

there a different roots to success

a) roll your own Tabs instead of Segmented cell in combination with a  
tabless NSTabView

b) Add/remove tab items on demand

Both are fairly easy to achieve with some pitfalls like view retains  
and such. I am using the b) route for something similar and am  
swapping in and out views in a splitview pane on account of user  
choices. I also used route a) for an intelligent  inspector without  
problems.


Cheers,
Volker

Am 12.10.2009 um 16:53 schrieb BareFeet:


Hi all,

I have a hierarchical list of objects, like the typical iTunes or  
XCode left pane. When the user selects a node in this hierarchy, I  
display detail of that node in the pane on the right. This right  
pane is divided into tab view items. Only some of the tab view items  
are relevant to each type of node, so I'd like to hide the tab view  
items that are not relevant. How can I do this?


In interface builder, I can't see any "hidden" property of tab view  
item. There is a "hidden" property for the sub-view of a tab view  
item, but this doesn't hide the tab view item itself, so is  
misleading to the user (ie they can click on it, only to see a blank  
view).


I tried using a segmented control, instead, using bindings to link  
it to the tab view (now tabless). But segmented control cells also  
seem to lack a "hidden" property.


Any ideas?

Thanks,
Tom
BareFeet

___

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

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

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

This email sent to volker_li...@ecoobs.de


___

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

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

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

This email sent to arch...@mail-archive.com


Re: TIFFRepresentation, different TIFF format under Snow Leopard

2009-10-12 Thread Ken Ferry
On Mon, Oct 12, 2009 at 4:36 AM, Peter C  wrote:

> I just stumble into a feature (or a bug ?), NSImage TIFFRepresentation
> produce RGB TIFF with a layer (when open under Photoshop). Previously it
> produce plain RGB TIFF under OS 10.5 and below. This cause some part of my
> programs interpret wrong RGB data, expecting 3 bytes instead of 4 bytes for
> a RGB pixel.  There is no mention in the documents about this "feature".
>
> Is there a way to restore the previous behavior  of TIFFRepresentation ?


You can look at CGImageDestination to get more options, but I don't think
there's anything that provides control at that level.

In many cases there _must_ be data munging between the in memory pixel
format and the on-disk file format.  The precise munging is not defined on
either input or output.

That is, don't make pixel format assumptions.  The AppKit release
notesdiscuss
how to avoid making pixel format assumptions in the section
"NSBitmapImageRep: CoreGraphics impedence matching and performance notes".

-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 arch...@mail-archive.com


Re: drawing in uiview

2009-10-12 Thread Randall Meadows

On Oct 10, 2009, at 11:41 AM, Jos Timanta Tarigan wrote:

i got a very basic question on iphone development. so i add an  
uiview via IB and try to update it by making my own interface called  
updateInterface(). in the update interface i put this code:


Why would you do that instead of using the UIView method intended to  
do drawing, -drawRect:?


Subclass UIView, and put the following code into it.


CGRect frame = [polyView frame];
NSArray*polypath = [[selfclass]pointsForPolygonInRect:frame  
numberOfSides:[myPolynumberOfSides]];

CGContextRefmyContext = UIGraphicsGetCurrentContext();
int i = 0;
CGContextSetRGBStrokeColor(myContext, 0, 0, 1, 1);
for (NSValue* value in polypath) {
CGPoint point = [value CGPointValue];
if (i == 0) {
CGContextMoveToPoint(myContext, point.x, point.y);
i++;
}
else {
CGContextAddLineToPoint(myContext, point.x, point.y);
}
}
CGContextClosePath(myContext);
im trying to draw a polygon here built by lines from one point to  
antoher. the "pointsForPolygonInRect" is working properly but my  
UIview(polyView) isnt showing anything. i dont really understand  
what happened up there, i just googled it around working for a  
proper method. im very new to cocoa-dev so please do a more human  
language ;)


You might also want to actually *draw* the path; see "Painting Paths" > (you set the stroke color, but then don't actually stroke the path).


___

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

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

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

This email sent to arch...@mail-archive.com


Re: Appropriate dealloc and finalize actions

2009-10-12 Thread Jens Alfke


On Oct 12, 2009, at 4:26 AM, Karolis Ramanauskas wrote:

As you can see each box has one or more little "inputs" and  
"outputs" in
fact these inputs and outputs are instances of one class (KROMPort).  
When I
drag a connection from output to an input, I set each "port's"  
connection
property to point to another "port". So Input points to Output and  
Output
points to Input. Only one-to-one relationships are allowed (one  
connection

per input/output).


It's best not to do this kind of cleanup in dealloc/finalize. Instead,  
have an explicit method like -disconnect that's called to remove the  
object from the graph. That way you're in direct control of removing  
objects. And yes, when [foo disconnect] is called it will need to tell  
its connected object to clear the connection to itself.


—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 arch...@mail-archive.com


Re: TIFFRepresentation, different TIFF format under Snow Leopard

2009-10-12 Thread Sandy McGuffog
Actually, that occurred under 10.5 as well - what happens is that some  
operations, it would seem those involving Core Image, cause the  
internal representation to go to RGBA. Which is fine, but there  
doesn't seem to be a way to write a plain RGB format TIFF. I had to  
incorporate a third-party TIFF module to do that, as RGBA TIFF files  
aren't very compatible with anything other than Apple.


Sandy


On Oct 12, 2009, at 5:07 PM, Ken Ferry wrote:

On Mon, Oct 12, 2009 at 4:36 AM, Peter C   
wrote:


I just stumble into a feature (or a bug ?), NSImage  
TIFFRepresentation
produce RGB TIFF with a layer (when open under Photoshop).  
Previously it
produce plain RGB TIFF under OS 10.5 and below. This cause some  
part of my
programs interpret wrong RGB data, expecting 3 bytes instead of 4  
bytes for
a RGB pixel.  There is no mention in the documents about this  
"feature".


Is there a way to restore the previous behavior  of  
TIFFRepresentation ?



You can look at CGImageDestination to get more options, but I don't  
think

there's anything that provides control at that level.

In many cases there _must_ be data munging between the in memory pixel
format and the on-disk file format.  The precise munging is not  
defined on

either input or output.

That is, don't make pixel format assumptions.  The AppKit release
notesdiscuss

how to avoid making pixel format assumptions in the section
"NSBitmapImageRep: CoreGraphics impedence matching and performance  
notes".


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

This email sent to mcguff...@gmail.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 arch...@mail-archive.com


NSZombieEnabled giving rise to new bug

2009-10-12 Thread Nick Rogers

Hi,
I order to track a bug which made an outline view hang the GUI, I set  
NSZombieEnabled with value YES in the app's environment variable.
Now even before I could get to the point of GUI hangs the following is  
reported in console:


2009-10-12 20:28:53.651 My Program[33987:6263] *** -[CFArray count]:  
message sent to deallocated instance 0x1149a9310

[Switching to process 33987]
[Switching to process 33987]
sharedlibrary apply-load-rules all
2009-10-12 20:29:03.917 My Program[33987:6263] *** NSInvocation:  
warning: object 0x1149a9310 of class '_NSZombie_CFArray' does not  
implement methodSignatureForSelector: -- trouble ahead
2009-10-12 20:29:03.918 My Program[33987:6263] *** NSInvocation:  
warning: object 0x1149a9310 of class '_NSZombie_CFArray' does not  
implement doesNotRecognizeSelector: -- abort

kill
quit

The code is so complex and its also hard to reach the point where I'm  
doing the wrong -[CFArray count].
Is it possible to some how to get it automatically stop at [CFArray  
count] OR is it possible to set a breakpoint at all [CFArray count] in  
Xcode or in .gdbinit.


Any other suggestions are also welcome.

Wishes,
Nick

___

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

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

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

This email sent to arch...@mail-archive.com


Re: NSZombieEnabled giving rise to new bug

2009-10-12 Thread Dave Keck
> Is it possible to some how to get it automatically stop at [CFArray count]
> OR is it possible to set a breakpoint at all [CFArray count] in Xcode or in

Break on objc_exception_throw.
___

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

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

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

This email sent to arch...@mail-archive.com


Re: NSZombieEnabled giving rise to new bug

2009-10-12 Thread Bill Bumgarner


On Oct 12, 2009, at 8:50 AM, Nick Rogers wrote:

2009-10-12 20:28:53.651 My Program[33987:6263] *** -[CFArray count]:  
message sent to deallocated instance 0x1149a9310

[Switching to process 33987]
[Switching to process 33987]
sharedlibrary apply-load-rules all
2009-10-12 20:29:03.917 My Program[33987:6263] *** NSInvocation:  
warning: object 0x1149a9310 of class '_NSZombie_CFArray' does not  
implement methodSignatureForSelector: -- trouble ahead
2009-10-12 20:29:03.918 My Program[33987:6263] *** NSInvocation:  
warning: object 0x1149a9310 of class '_NSZombie_CFArray' does not  
implement doesNotRecognizeSelector: -- abort

kill
quit

The code is so complex and its also hard to reach the point where  
I'm doing the wrong -[CFArray count].
Is it possible to some how to get it automatically stop at [CFArray  
count] OR is it possible to set a breakpoint at all [CFArray count]  
in Xcode or in .gdbinit.


That won't necessarily help you.  By the time the -count message is  
sent the damage was done long ago.  Zombies help by giving you the  
address of the object that went bad earlier.  What you need to examine  
are all of the retain/release events that occurred at that address  
prior.


To do this, you can use the ObjectAlloc Instrument in Instruments.   
Turn on Zombie tracking and then have a look at the zombie object's  
address in the instrument.


There are cases, though, where Instruments won't work for this.  In  
that case, set the MallocStackLoggingNoCompact environment variable to  
1 and then run your application.  When you find the 'message sent to  
deallocated instance' address, use 'malloc_history PID ADDR' at the  
command line to see a history of all events at that address.  Or, in  
gdb, 'info malloc ADDR'.


b.bum

___

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

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

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

This email sent to arch...@mail-archive.com


Bindings Driving Me CRAZY. :'(

2009-10-12 Thread Gustavo Pizano

Ok this is what I have:

1. InvoiceGenViewController.m -> Controller for the InvoiceGenView.xib
2. UserListViewController.m -> Controller for the UserListView.xib
3. InvoiceEditionViewController.m -> Controller for the  
InvoiceEditionView.xib


InvoiceGenView.xib, has a slipt view and InvoiceGenViewController has  
2 IBOutlets NSView one for the each view of the split view and also  
has an instance of UserListViewController and  
InvoiceEditionViewController, so when loading the nib, I create those  
controllers with their respective nib files. So far so good.


The UserListView has an IBOutlet NSArrayController with a connection  
in IB to a NSArrayController instance called "Users Array". In IB for  
the UserListView.xib, I bind the NSManagedObjectContext  to the  
Files's Owners managedObjectContext, which Im getting form the  
ApplicationDelegate. And I placed a NSTableView with the column  
binding to  "Users Array" ; controller key :: arrangedObject   ; Model  
Key Path: completeName.
So when the whole window with all  this views loads I can see in  
the ;left side a list of Users, displaying the concatenated name.


Anyway, its working till this point. The problem is that when I select  
an item form the NSTableView(which is in the UserListView), I want to  
display its details in the other view which is controlled by  
InvoiceEditionViewController and it's in another .xib. NO SUCCESS! :(


I have  tried passing the instance of the NSArrayController from  
UserListViewController to InvoiceEditionViewController (IBOutlet also)  
and connecting it to an Instance of NSArrayController in the  
InvoiceEditionViewController.xib (called "Ref Users List"). Then  
setting the fields bindings to:

Bind : "Ref Users List"
Controller key : selection
Model Key Path:  firstName  etc for the rest of fields.

How to solve this situation.

I have checked some examples, but somehow they are confusing me more  
than helping me.. :( :( .


thanks in advance, I'll really appreciate any help.

Gustavo Pizano



___

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

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

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

This email sent to arch...@mail-archive.com


Re: Core Animation and Run Loops

2009-10-12 Thread Oleg Krupnov
Well, I have found it to be even more weird. On Leopard, the Core
Animation animation sometimes can run simultaneously with the blocking
NSAnimation. In fact, I have done something to my app, don't know
what, and now CA runs in parallel with the blocking NSAnimation
causing the latter to jitter. I wonder how I revert my app to the
previous state? :(

I have created a brand new test app and I've found that one can make
CA run in parallel with the blocking NSAnimation by doing one of the
following:

1) setting duration of implicit animations using[CATransaction
setValue:[NSNumber numberWithFloat:xxx]
forKey:kCATransactionAnimationDuration];
2) creating another view with wantscoreanimation = yes that is nested
in or overlaps the view animated by the blocking animation

How can this be explained? Because I'd like to take control over this
idiosyncrasy.

Thanks

On Fri, Oct 2, 2009 at 8:47 AM, Scott Anguish  wrote:
>
> On Sep 28, 2009, at 3:12 AM, Kyle Sluder wrote:
>
>>> Do you mean I should avoid using blocking animations and only use
>>> non-blocking? Never tried to use animator proxies, only NSAnimation
>>> directly, so I don't know if the proxies are blocking or non-blocking.
>>
>> The animator proxies are related to Core Animation, not NSAnimation.
>
> Well, sort of related to Core Animation. Not at all related to NSAnimation
> though.
>
> They use the same timing class, and some of the same ideas. But you don’t
> have to have layer-backing on to use the vast majority of types you can
> animate with proxies (with SL that may be entirely a thing of the past since
> integer and NSColor can both be animated directly now)
>
> Transitions as I recall being an exception.
>
>
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Core Data with OpenGL

2009-10-12 Thread Kyle Sluder
On Mon, Oct 12, 2009 at 7:47 AM, Richard Somers
 wrote:
> Any suggestions or comments?

This is typically where the controller layer would come in.  A
controller-layer object would know of the GL context and of the
insertion/removal of objects in the MOC, and create resources
accordingly.

--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 arch...@mail-archive.com


Re: Core Data with OpenGL

2009-10-12 Thread Richard Somers
Rob, your comment got me thinking and I did some checking. I am  
drawing to a CAOpenGLLayer which has two OpenGL contexts, one public  
and one private. The frameworks switch at times to the private one  
(outside of the normal drawing cycle). This private one is where some  
of my OpenGL commands are going during the core data part of the  
application. Still not sure of what to do however.


When a view draws, you are guaranteed that the context will be current  
and ready for drawing. But outside of that there is no guarantee that  
the correct context will remain current.


I could do the required OpenGL setup for the model object during the  
first draw call. But how would I do the OpenGL cleanup when the model  
object is removed from the managed object context? The only message  
sent to the model object is didTurnIntoFault which knows nothing about  
the context.


Richard

On Oct 12, 2009, at 10:05 AM, Rob Barris wrote:


since there are CGL calls to set and get the current GL context - it
seems this would be easy to solve (assuming you know which context you
actually want to target at these times)

On Mon, Oct 12, 2009 at 7:34 AM, Richard Somers  wrote:


Consider an application using Core Data and OpenGL.

Normally a model object (MVC) has no knowledge of views or  
controllers but
in this case it must draw itself. When the draw method is called by  
the view
or controller the appropriate OpenGL context is current. So far so  
good. The

problem however is with OpenGL resources needed to support drawing.

When a model object is added to the managed object context,  
specific OpenGL

resources need to be created. When a model object is removed from the
managed object context, OpenGL resources need to be cleaned up.

A seemingly straight forward solution would be to do the OpenGL
initialization and cleanup work in the awakeFromInsert,  
awakeFromFetch, and
didTurnIntoFault methods of NSManagedObject. The problem is  
however, the
OpenGL context is not current when these methods are called. These  
methods
are called by the Core Data framework which has no knowledge of the  
OpenGL

context.

Any suggestions or comments?


___

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

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

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

This email sent to arch...@mail-archive.com


Re: Problem with OpenSSL header files

2009-10-12 Thread jonat...@mugginsoft.com


On 12 Oct 2009, at 13:09, Rui Pacheco wrote:


Hi,
I'm using a library on my project that requires OpenSSL. I've linked  
to
libssl.dilyb and libcrypto.dilyb but when I try to compile my  
project, it
comes up with the error "  "_SSL_CTX_set_client_cert_cb", referenced  
from:

".

Some Googling shows that this means there's a discrepancy between the
OpenSSL headers and the OpenSSL libraries. When I added the  
libraries to my
project I noticed that there were several OpenSSL libraries - one  
with no
version, one on version 0.9 (which GCC can't find), one on 0.9.7 and  
one on

0.9.8. No matter which one I link to, I still get this error.


You might have more luck with this on the Xcode list.
Also you need to provide more info on your build settings,  
particularly your Base SDK and Deployment target settings.


There are some issues cross developing with OpenSSL.
http://www.cocoabuilder.com/archive/message/cocoa/2009/8/28/243749
http://www.cocoabuilder.com/archive/message/xcode/2009/9/19/30769


Where can I find these headers and how can I add them to my project?

--
Best regards,
Rui Pacheco
___

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

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

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

This email sent to jonat...@mugginsoft.com


Jonathan Mitchell

Developer
http://www.mugginsoft.com





___

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

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

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

This email sent to arch...@mail-archive.com


Re: Bindings Driving Me CRAZY. :'(

2009-10-12 Thread Keary Suska


On Oct 12, 2009, at 11:52 AM, Gustavo Pizano wrote:


Ok this is what I have:

1. InvoiceGenViewController.m -> Controller for the InvoiceGenView.xib
2. UserListViewController.m -> Controller for the UserListView.xib
3. InvoiceEditionViewController.m -> Controller for the  
InvoiceEditionView.xib


InvoiceGenView.xib, has a slipt view and InvoiceGenViewController  
has 2 IBOutlets NSView one for the each view of the split view and  
also has an instance of UserListViewController and  
InvoiceEditionViewController, so when loading the nib, I create  
those controllers with their respective nib files. So far so good.


The UserListView has an IBOutlet NSArrayController with a connection  
in IB to a NSArrayController instance called "Users Array". In IB  
for the UserListView.xib, I bind the NSManagedObjectContext  to the  
Files's Owners managedObjectContext, which Im getting form the  
ApplicationDelegate. And I placed a NSTableView with the column  
binding to  "Users Array" ; controller key :: arrangedObject   ;  
Model Key Path: completeName.
So when the whole window with all  this views loads I can see in  
the ;left side a list of Users, displaying the concatenated name.


Anyway, its working till this point. The problem is that when I  
select an item form the NSTableView(which is in the UserListView), I  
want to display its details in the other view which is controlled by  
InvoiceEditionViewController and it's in another .xib. NO SUCCESS! :(


I have  tried passing the instance of the NSArrayController from  
UserListViewController to InvoiceEditionViewController (IBOutlet  
also) and connecting it to an Instance of NSArrayController in the  
InvoiceEditionViewController.xib (called "Ref Users List"). Then  
setting the fields bindings to:

Bind : "Ref Users List"
Controller key : selection
Model Key Path:  firstName  etc for the rest of fields.


This doesn't appear sensible, and you may have a number of problems.  
First, make sure that InvoiceEditionViewController is being  
instantiated properly. Second, simply have a reference to  
UserListViewController in InvoiceEditionViewController, which can be  
an outlet if InvoiceEditionViewController can be sensibly instantiated  
via xib, or set by other means. I recommend then to have an  
NSObjectController in InvoiceEditionViewController.xib whose content  
is bound to UserListViewController.NSArrayController.selection (using  
correct ivar/property names, of course).


HTH,

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

___

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

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

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

This email sent to arch...@mail-archive.com


Re: TIFFRepresentation, different TIFF format under Snow Leopard

2009-10-12 Thread Sander Stoks
I have a related question.  The various image file formats have their  
own options and settings (compression levels, color space,  
interlacing, etc.); is there a generic way to access these from within  
my application?


For those who still remember BeOS (where the grass was green and the  
girls were pretty), there was a concept called "Translators" (which  
BeOS, in turn, borrowed from the Amiga).  Each Translator was  
basically an Image I/O codec, but you could also query them for a  
"configuration view" which you could simply show in your own  
application.  That way, the app doesn't have to know the ins and outs  
of all the file formats.


Does something like this exist on MacOS or do I have to create these  
settings views myself?


Regards,
Sander


Actually, that occurred under 10.5 as well - what happens is that some
operations, it would seem those involving Core Image, cause the
internal representation to go to RGBA. Which is fine, but there
doesn't seem to be a way to write a plain RGB format TIFF. I had to
incorporate a third-party TIFF module to do that, as RGBA TIFF files
aren't very compatible with anything other than Apple.

Sandy


On Oct 12, 2009, at 5:07 PM, Ken Ferry wrote:


On Mon, Oct 12, 2009 at 4:36 AM, Peter C 
wrote:


I just stumble into a feature (or a bug ?), NSImage
TIFFRepresentation
produce RGB TIFF with a layer (when open under Photoshop).
Previously it
produce plain RGB TIFF under OS 10.5 and below. This cause some
part of my
programs interpret wrong RGB data, expecting 3 bytes instead of 4
bytes for
a RGB pixel.  There is no mention in the documents about this
"feature".

Is there a way to restore the previous behavior  of
TIFFRepresentation ?



You can look at CGImageDestination to get more options, but I don't
think
there's anything that provides control at that level.

In many cases there _must_ be data munging between the in memory  
pixel

format and the on-disk file format.  The precise munging is not
defined on
either input or output.

That is, don't make pixel format assumptions.  The AppKit release
notes

Re: Core Data with OpenGL

2009-10-12 Thread Richard Somers

On Oct 12, 2009, at 12:04 PM, Kyle Sluder wrote:

This is typically where the controller layer would come in. A  
controller-layer object would know of the GL context and of the  
insertion/removal of objects in the MOC, and create resources  
accordingly.


I think I can perhaps see light at the end of the tunnel. My model  
objects are controlled by a NSObjectController or NSArrayController  
instance. So I would subclass these and add the required code to setup  
and teardown the required OpenGL resources. Still the draw method is  
in the managed object model class and it needs to know about the  
OpenGL resource objects created in the controller. Hum ... still  
thinking.


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 arch...@mail-archive.com


More Core Data Questions

2009-10-12 Thread Jon Hull
Ok, let me ask some more specific questions and see if that gets a  
response...  Feel free to respond if you only know the answer to 1 or  
2 of these.


1) Can I count on a to-many relationship keeping the order of the  
managedObjects it points to?  The order is very important in this  
case, and I need a way to ensure that the order does not change when  
the object is saved and reloaded.


2) Does core data require a run-loop to work? All of the work takes  
place in a background thread, and that is the only thread which would  
be accessing these objects (the main thread doesn't see them, it  
passes arrays of NSStrings or NSNumbers to the main thread and blocks  
until it receives a response string/number), but there is no run loop  
on the background thread.  It just executes and then goes away once it  
is done.  The reason I want core data is that there are several  
thousand objects to be processed in this thread, and I only want to  
keep the ones in memory that need to be in memory at any given  
moment.  Also, different objects may be accessed depending on the  
value of previous objects or the responses mentioned above.


3) What is the best way of connecting objects from different stores?   
I am considering giving them UUIDs and then storing that as a  
reference.  Then setting a transient property based on that in - 
awakeFromFetch.  Alternatively, I could store it as a fetched  
property, but I want it to be a 1:1 correspondence.


4) Is there a better way to get this lazy loading?  My main goal is to  
keep only those objects from this large (>1000) object graph in memory  
that are needed (since the iPhone has limited memory).  Basically, I  
want the behavior of the old resource manager from the olden days  
(that is I can act as if my full object graph is in memory, but only  
those that are needed actually are... and they are fetched just in  
time). My options seem to be the following:

• Use core data in a rather complex way
	• Roll my own SQL with a single table that stores blobs by that  
identifier (see above) and then returns a freeze dried object from the  
blob.
	• Store each object as a small file in a folder and use the  
identifier in the filename
	• Something with proxies that go grab it just in time (combined with  
SQL or the files above)

• Something I haven't thought of...

Any help is greatly appreciated!

Thanks,
Jon___

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

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

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

This email sent to arch...@mail-archive.com


Re: Bindings Driving Me CRAZY. :'(

2009-10-12 Thread Gustavo Pizano

Keary Hello:



This doesn't appear sensible, and you may have a number of problems.  
First, make sure that InvoiceEditionViewController is being  
instantiated

this is what Im doing: in the awakeFromNib

if(_userListController == nil){
		_userListController = [[UserListViewController alloc]  
initWithNibName:@"UserListView" bundle:nil];

}
if(_invoiceController == nil){
		_invoiceController = [[InvoiceEditionViewController alloc]  
initWithNibName:@"InvoiceEditionView" bundle:nil];

}
[_myUserListView addSubview:[_userListController view]];
[_myContentView addSubview:[_invoiceController view]];  
[_invoiceController setUserController:_userListController];


properly. Second, simply have a reference to UserListViewController  
in InvoiceEditionViewController, which can be an outlet if


ok done I have now there this :  IBOutlet UserListViewController *  
userController;



InvoiceEditionViewController can be sensibly instantiated via xib,  
or set by other means. I recommend then to have an  
NSObjectController in InvoiceEditionViewController.xib whose content  
is bound to UserListViewController.NSArrayController.selection  
(using correct ivar/property names, of course).
Ok I tried but when wan tto bind the labels to show the details I bind  
it to the NSObjectControlled I just configured, and the controller key  
goes to selection, which its not good, so whe I run I see its NO  
Selection. label.


I did instead was to place an NSArrayController (users) in IB and bind  
the contents to   
userController._userListArrayController.arrangedObjects.
then the labels I bind the values to users, and the controller key to  
selection and the path to the attributes of the entity.


And it works 50%, I can see the values., but when I select another  
user, the values dosn't change, it's seems its getting only the 1st  
value of the array.


: (

Tanks tough .. any other ideas I will very welcome them.

Gustavo




HTH,

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




___

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

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

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

This email sent to arch...@mail-archive.com


Re: More Core Data Questions

2009-10-12 Thread I. Savant

On Oct 12, 2009, at 3:31 PM, Jon Hull wrote:

1) Can I count on a to-many relationship keeping the order of the  
managedObjects it points to?  The order is very important in this  
case, and I need a way to ensure that the order does not change when  
the object is saved and reloaded.


  No. This is stated in the documentation and has come up on this  
list many times. You'll want to add a property to keep track of the  
desired order.




2) Does core data require a run-loop to work?


  I'm not quite sure how to answer that, specifically ...

All of the work takes place in a background thread, and that is the  
only thread which would be accessing these objects


  ... so I'll answer this (what you appear to be asking).  
Multithreading with Core Data gets its own section in the  
documentation - each thread needs its own context. Read the  
documentation.



3) What is the best way of connecting objects from different  
stores?  I am considering giving them UUIDs and then storing that as  
a reference.  Then setting a transient property based on that in - 
awakeFromFetch.  Alternatively, I could store it as a fetched  
property, but I want it to be a 1:1 correspondence.


  If the objects are already saved to a store, they already have a  
stable, unique ID. This is also covered in the documentation and in  
the list archives.



4) Is there a better way to get this lazy loading?  My main goal is  
to keep only those objects from this large (>1000) object graph in  
memory that are needed (since the iPhone has limited memory).


  You're going to need to be specific about the relevant parts of  
your data model fora "best approach" suggestion. General guidelines  
are in the docs.


  You can always have a separate entity for the large data (to act as  
a BLOB). IE, an "Image" entity that holds lots of metadata, possibly a  
small thumbnail, and a reference to an instance of "ImageData" that  
holds the actual data.



• Use core data in a rather complex way


  What complex way?

	• Roll my own SQL with a single table that stores blobs by that  
identifier (see above) and then returns a freeze dried object from  
the blob.


  Not possible (or at least remotely sane) with a Core Data created  
store. Don't edit the store. Its implementation details (ie, the  
schema) are private and subject to change. This is a Bad Idea.



	• Store each object as a small file in a folder and use the  
identifier in the filename


  Also possible if you don't want the data inside the store. You can  
create (and archive) an FSRef for more robust "locate-the-moved-file- 
between-sessions" behavior.



	• Something with proxies that go grab it just in time (combined  
with SQL or the files above)


  I'm not sure what this means.



• Something I haven't thought of...

  You were on the right track with the idea of a BLOB if you don't  
mind saving the BLOB in the store. The alternative - which you also  
guessed - is to save a reference to an external file. The choice is  
yours: neither is better than the other in the general case.




Any help is greatly appreciated!


  You can help yourself better than anybody else by (re-)reading the  
Core Data Programming Guide. It contains answers to pretty much  
everything you've asked here. Very specific answers.


--
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 arch...@mail-archive.com


Saving for iPhone - Can core data handle this?

2009-10-12 Thread Ben Trumbull

Jon,

Your question is a bit amorphous.  Can Core Data do something like  
this ?  Sure.  May it require adjusting things to fit into its  
architecture ?  Possibly.



I have a game project for the iPhone which has a rather complicated
object graph


Well, it would probably only take a few minutes to mock something up  
in the model editor in Xcode.  That would help make your question more  
concrete.



There is a large graph of tiny immutable objects which represent the
story (including different branches of the storyline).


How tiny is tiny ?  People have widely different ideas about "tiny"  
and "huge" and the difficulties of various problems.



This graph is
large enough that I only want to keep the nodes that are actually
being used in memory.


100 objects ?  1,000 ?  100,000,000 ?  The largest db in a deployed  
iPhone app using Core Data that I know of is about 450,000 rows.  (FDA  
warning: results not typical)



There is also a separate graph of game objects
(characters, etc...) that change state over time and will need to be
saved as part of a saved game.  These seem like they should be stored
separately since one never changes and will be common for all players,
while the other is different for each player.  I also want to be able
to get a fresh copy of the changing objects for new games.


Is this for local or remote data ?


The final complication is that I have several proxies being used in an
important way, and I don't think there is any NSProxy equivalent for
NSManagedObject.  I guess I would just have to hope that
NSManagedObject doesn't have any methods that the targets of the proxy
override.


Uhm...  Why ?  I don't think NSManagedObject will be happy with  
NSProxy and vice versa.  I'd recommend against this.  If you need to  
use NSProxy for something else, then I'd recommend adding an observer  
to the NSManagedObjectContext and proxying your custom observer.  Or,  
you can use composition to create your own object that has an  
NSManagedObject || NSManagedObjectID ivar and then proxy that.



I have been reading the docs for Core Data, and have a rough idea on
how I might accomplish all of this, but I wanted to see if someone had
experience with this and could keep me from spending time going down
the wrong path if it isn't going to work.

So, do you think core data can handle this?  What approach (roughly)
should I use?


- Ben

___

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

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

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

This email sent to arch...@mail-archive.com


re: Core Data with OpenGL

2009-10-12 Thread Ben Trumbull

Consider an application using Core Data and OpenGL.

Normally a model object (MVC) has no knowledge of views or controllers


for good reasons.


but in this case it must draw itself.


No, it doesn't must do anything.  Views draw themselves, model objects  
are state, and controllers are intermediaries.  Notifications and  
delegation are common alternatives to binding model objects directly  
into the UI.


What problem are you trying to solve by knowingly violating the MVC  
design patterns ?



When the draw method is called
by the view or controller the appropriate OpenGL context is current.
So far so good. The problem however is with OpenGL resources needed to
support drawing.

When a model object is added to the managed object context, specific
OpenGL resources need to be created. When a model object is removed
from the managed object context, OpenGL resources need to be cleaned  
up.


It sounds like you're trying to create a tight 1:1 binding between  
your model objects and controller objects to avoid actually writing a  
controller layer.



A seemingly straight forward solution would be to do the OpenGL
initialization and cleanup work in the awakeFromInsert,
awakeFromFetch, and didTurnIntoFault methods of NSManagedObject. The
problem is however, the OpenGL context is not current when these
methods are called. These methods are called by the Core Data
framework which has no knowledge of the OpenGL context.


What you're proposing is the equivalent of saying that because you  
allocated an object, or freed an object, it should allocate and free  
OpenGL resources.  This is like NSObject -init and -dealloc calling  
into OpenGL.  It's even weirder than that here, because you're not  
even talking about new objects being inserted or old objects being  
deleted.  You want to create OpenGL resources for whatever random  
subset of objects that happens to be pulled into memory.


This is hard, because you're going in the wrong direction.

Put a stake in the ground, that your model objects will never ever  
call directly into OpenGL.  Adjust your design accordingly, and go  
from there.


- Ben

Also, tying expensive resources to the lifespan of objects is  
generally a bad pattern.


___

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

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

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

This email sent to arch...@mail-archive.com


Re: Creating NSMatrix of NSImageCells

2009-10-12 Thread PCWiz
I ended up using an NSCollectionView, which was much easier to  
implement.


Thanks for the advice!

On 2009-10-11, at 4:58 PM, Graham Cox wrote:



On 12/10/2009, at 7:20 AM, PCWiz wrote:

I need to create an NSMatrix with NSImageCells bound to an array  
controller. So the content of the NSMatrix is bound to an NSArray  
(so there are as many NSImageCells in the matrix as there are  
objects in the array), then the image path of the NSImageCells are  
bound to a key called "iconPath" in the Array Controller.


And then when an image cell is clicked in the matrix, I need it to  
perform an action. I know how to use bindings, and I have a concept  
like this working in an NSTableView, but I have never used NSMatrix  
before, so are there any good resources or sample code that would  
help me get started with this?



Depending on how many images you anticipate needing to handle, you  
might be better off looking at IKImageBrowserView, which loads  
images lazily and on a second thread so it doesn't kill your UI  
response while it's populating itself. It's slightly more  
complicated to use than NSMatrix initially but chances are you'll  
probably want to end up making the Matrix approach also load its  
images lazily and possibly on another thread, which will be much  
more complicated than the already built-in solution of  
IKImageBrowserView.


I'm not aware of any sample code specifically for NSMatrix and I've  
never used it with bindings, but I have used it to create an array  
of images - actually image-bearing buttons in my case - and it was  
straightforward, even including lazy loading of the images (I did  
that using a custom image button cell that fetches the image when it  
is asked to draw the first time, so buttons that never actually  
appear don't waste time loading images that are never displayed).  
What parts of the NSMatrix class reference documentation are you  
having trouble with?


--Graham




___

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

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

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

This email sent to arch...@mail-archive.com


Re: More Core Data Questions

2009-10-12 Thread Jon Hull


On Oct 12, 2009, at 12:46 PM, I. Savant wrote:

On Oct 12, 2009, at 3:31 PM, Jon Hull wrote:
1) Can I count on a to-many relationship keeping the order of the  
managedObjects it points to?  The order is very important in this  
case, and I need a way to ensure that the order does not change  
when the object is saved and reloaded.
 No. This is stated in the documentation and has come up on this  
list many times. You'll want to add a property to keep track of the  
desired order.

I must have missed this.  Thank you.



2) Does core data require a run-loop to work?

 I'm not quite sure how to answer that, specifically ...
All of the work takes place in a background thread, and that is the  
only thread which would be accessing these objects
 ... so I'll answer this (what you appear to be asking).  
Multithreading with Core Data gets its own section in the  
documentation - each thread needs its own context. Read the  
documentation.
I have spent the last 48 hours (re)reading core data docs.  My head is  
swimming in docs.  The short answer is yes, I understand to give each  
thread it's own context, but I don't know if it will break without a  
run loop.



3) What is the best way of connecting objects from different  
stores?  I am considering giving them UUIDs and then storing that  
as a reference.  Then setting a transient property based on that in  
-awakeFromFetch.  Alternatively, I could store it as a fetched  
property, but I want it to be a 1:1 correspondence.
 If the objects are already saved to a store, they already have a  
stable, unique ID. This is also covered in the documentation and in  
the list archives.
Yes, although I also read a warning about using these cross-stores  
somewhere, so I was thinking of rolling my own.  The core data UUID  
would probably also be temporary with the way I am currently creating  
my objects (because I wouldn't have saved yet), so I would need  
something persistent.



4) Is there a better way to get this lazy loading?  My main goal is  
to keep only those objects from this large (>1000) object graph in  
memory that are needed (since the iPhone has limited memory).
 You're going to need to be specific about the relevant parts of  
your data model fora "best approach" suggestion. General guidelines  
are in the docs.
Yes, well it is fairly complex... but it looks like core data is not a  
good fit since a basic requirement is that I need it to store nested  
arrays of immutable objects and keep the order (I also need to allow  
those objects to be inserted at multiple points in the array).  The  
immutability and the possibility of multiple entries make an order  
property unworkable.



You can always have a separate entity for the large data (to act as  
a BLOB). IE, an "Image" entity that holds lots of metadata, possibly  
a small thumbnail, and a reference to an instance of "ImageData"  
that holds the actual data.

Yes, I did this in the last core data app I wrote.



• Use core data in a rather complex way

 What complex way?

Multiple stores + some way of keeping ordered arrays


	• Roll my own SQL with a single table that stores blobs by that  
identifier (see above) and then returns a freeze dried object from  
the blob.
 Not possible (or at least remotely sane) with a Core Data created  
store. Don't edit the store. Its implementation details (ie, the  
schema) are private and subject to change. This is a Bad Idea.

Oh no... I mean instead of core data


	• Store each object as a small file in a folder and use the  
identifier in the filename
 Also possible if you don't want the data inside the store. You can  
create (and archive) an FSRef for more robust "locate-the-moved-file- 
between-sessions" behavior.

again instead of core data, but useful to know.


	• Something with proxies that go grab it just in time (combined  
with SQL or the files above)

 I'm not sure what this means.
I could use a proxy to implement lazy loading (from a file or out of  
SQL)




• Something I haven't thought of...
 You were on the right track with the idea of a BLOB if you don't  
mind saving the BLOB in the store. The alternative - which you also  
guessed - is to save a reference to an external file. The choice is  
yours: neither is better than the other in the general case.
Thank you.  I might consider something like this instead of rolling my  
own SQL.




Any help is greatly appreciated!
 You can help yourself better than anybody else by (re-)reading the  
Core Data Programming Guide. It contains answers to pretty much  
everything you've asked here. Very specific answers.
Yes, I have been living those docs for a couple of days now.  It now  
looks like core data is not a good match for my particular problem.   
Thanks for your help.


Thanks,
Jon___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators a

Re: CoreData Bug? (SQLite vs XML) + isolated reproducible case

2009-10-12 Thread Ben Trumbull
Thanks for the test project.  However, reviewing and fixing all  
compiler warnings is likely to make development a significantly less  
frustrating experience.  We've taken to fixing (nearly) all compiler  
warnings, even ones we know are harmless, so we can easily find the  
new ones that likely aren't.  A lot of people like -Werror for exactly  
this reason, but that's a bit too draconian for my taste.



CoreDataBug_DataModel.xcdatamodel:SmartFolder.sources: warning:  
SmartFolder.sources -- to-many relationship does not have an inverse:   
this is an advanced setting (no object can be in multiple destinations  
for a specific relationship)


- Ben

___

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

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

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

This email sent to arch...@mail-archive.com


Issue with NSView setFrame

2009-10-12 Thread PCWiz
I have an NSCollectionView full of NSViews containing NSImageViews.  
Basically looks like a NSMatrix of NSImageCells. I've subclassed the  
NSCollectionView's prototype NSView and added methods to add a  
"magnification" sort of effect when a user hovers on an item:


- (void)mouseEntered:(NSEvent *)theEvent
{
	[[self animator] setFrame:NSMakeRect([self frame].origin.x, [self  
frame].origin.y, [self frame].size.width * 1.3, [self  
frame].size.height * 1.3)];

}

- (void)mouseExited:(NSEvent *)theEvent
{
	[[self animator] setFrame:NSMakeRect([self frame].origin.x, [self  
frame].origin.y, [self frame].size.width / 1.3, [self  
frame].size.height / 1.3)];

}

This works for the most part, if I hover over the items slowly. As  
soon as I start zipping my mouse around fast, the views become all  
disoriented. Here's a video I took of the problem:


http://twitvid.com/6426F

I'm not sure what I'm doing wrong here. Also, how do I make it so that  
the frame size increases from the center of the view outwards. Like  
right now it looks like its magnifying from the left to the right. I'm  
sure theres something I need to do with the origin, but I'm not sure.


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 arch...@mail-archive.com


Re: CoreData Bug? (SQLite vs XML) + isolated reproducible case

2009-10-12 Thread Milen Dzhumerov
Adding an inverse does solve the problem (maybe I missed mentioning  
it). The reasons why I thought it was a CD bug are the following:
- I don't think it's obvious from the docs that the SQLite store can't  
cope with relationships that have no inverses (I was told by Danny  
Greg that having an inverse was rule  #1).
- The code works fine with the XML / Atomic store (maybe I should be  
treating that as a coincidence instead of the other way around).
- I can't remember exactly but I'm not quite sure the "this is an  
advanced setting (no object can be in multiple destinations for a  
specific relationship)" part appeared when I compiled under Leopard  
with Xcode 3.1 (there's a high possibility that I might be wrong, I  
don't Leopard around anymore to test).


Maybe I should start treating warnings as errors. In any case, thanks  
a lot to everyone who took a look at the issue, especially Ben.


M

On 12 Oct 2009, at 21:33, Ben Trumbull wrote:

Thanks for the test project.  However, reviewing and fixing all  
compiler warnings is likely to make development a significantly less  
frustrating experience.  We've taken to fixing (nearly) all compiler  
warnings, even ones we know are harmless, so we can easily find the  
new ones that likely aren't.  A lot of people like -Werror for  
exactly this reason, but that's a bit too draconian for my taste.



CoreDataBug_DataModel.xcdatamodel:SmartFolder.sources: warning:  
SmartFolder.sources -- to-many relationship does not have an inverse:


- Ben



___

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

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

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

This email sent to arch...@mail-archive.com


Re: Core Data with OpenGL

2009-10-12 Thread Richard Somers

On Oct 12, 2009, at 1:17 PM, Rob Barris wrote:

Within a single thread of execution, if you are about to do some GL  
drawing and you are unsure of the current context, you should set  
it, and it will stay set.


If I knew what it was I could set it. My model object knows nothing of  
the glContext. Also I do not think storing the context in the model is  
appropriate. That would seem to violate the MVC design pattern.  
(Although having the draw method in the model class is technically a  
violation of MVC but one that seems to be generally accepted and  
necessary.)


I think Kyle Sluder's remarks of putting the OpenGL resource creation  
and disposal stuff in the controller-layer might be the way to go. I  
am currently using off the shelf NSObjectController and  
NSArrayController classes to add and remove model objects from the  
managed object context. I could subclass these and put the OpenGL  
resource code in there.


My model object code looks something like this.

@interface ModelObject : NSManagedObject
{
 // OpenGL resource objects needed to draw the model object
 ...
}

@end

@implementation ModelObject

- (void)awakeFromInsert
{
 [super awakeFromInsert];
 [self prepareOpenGL];
}

- (void)awakeFromFetch
{
 [super awakeFromFetch];
 [self prepareOpenGL];
}

- (void)didTurnIntoFault
{
 [self cleanupOpenGL];
 [super didTurnIntoFault];
}

- (void)prepareOpenGL { ... }

- (void)cleanupOpenGL { ... }

- (void)draw // current glContext set by the caller
{
 // Draw to OpenGL context.
 ...
}

@end

Thanks for your help and comments.

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 arch...@mail-archive.com


Re: Problem with OpenSSL header files

2009-10-12 Thread Rui Pacheco
Turns out my problem was that I was linking to the original file. I created
a simlink to the .dylib file provided by the manufacturer, removed the
reference to the .a file I was including manually and everything seems to
work.
Still needs a lot of testing, but its getting somewhere.

2009/10/12 jonat...@mugginsoft.com 

>
> On 12 Oct 2009, at 13:09, Rui Pacheco wrote:
>
>  Hi,
>> I'm using a library on my project that requires OpenSSL. I've linked to
>> libssl.dilyb and libcrypto.dilyb but when I try to compile my project, it
>> comes up with the error "  "_SSL_CTX_set_client_cert_cb", referenced from:
>> ".
>>
>> Some Googling shows that this means there's a discrepancy between the
>> OpenSSL headers and the OpenSSL libraries. When I added the libraries to
>> my
>> project I noticed that there were several OpenSSL libraries - one with no
>> version, one on version 0.9 (which GCC can't find), one on 0.9.7 and one
>> on
>> 0.9.8. No matter which one I link to, I still get this error.
>>
>>  You might have more luck with this on the Xcode list.
> Also you need to provide more info on your build settings, particularly
> your Base SDK and Deployment target settings.
>
> There are some issues cross developing with OpenSSL.
> http://www.cocoabuilder.com/archive/message/cocoa/2009/8/28/243749
> http://www.cocoabuilder.com/archive/message/xcode/2009/9/19/30769
>
>  Where can I find these headers and how can I add them to my project?
>>
>> --
>> Best regards,
>> Rui Pacheco
>> ___
>>
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/jonathan%40mugginsoft.com
>>
>> This email sent to jonat...@mugginsoft.com
>>
>
> Jonathan Mitchell
>
> Developer
> http://www.mugginsoft.com
>
>
>
>
>
>


-- 
Best regards,
Rui Pacheco
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Screensaver won't run on 10.6 even after porting to 64-bit

2009-10-12 Thread Greg Parker

On Oct 11, 2009, at 7:46 PM, Ben Haller wrote:
 Besides that, I just needed to change a few retains and releases  
around, because I was mixing CF calls and Cocoa calls in an  
inconsistent way in a few places.  And that was it; as far as I can  
tell, it now runs nicely on all the target platforms.  I almost  
decided that I needed to use an NSPointerArray for something in the  
GC-supported case, in which case perhaps I would have had to #ifdef;  
but it turned out that a mutable CFArray with null callbacks was  
sufficient.


Be careful. Any CF container with null callbacks is extremely  
dangerous in GC. It's easy to create a situation where the container  
or a reader of the container gets a pointer to an object that the GC  
has thrown away.



--
Greg Parker gpar...@apple.com Runtime Wrangler


___

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

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

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

This email sent to arch...@mail-archive.com


[Q] How to populate custom button of QuickTime media control?

2009-10-12 Thread JongAm Park

Hello,

I would like to add number of audio tracks menu item under "custom  
button" on QuickTime media control.
What I mean by saying "custom button" is the triangle button which is  
at the right most side if you open a QuickTime movie  using Web browser.


I'm currently using QTKit and found some old sample code,  
QTCustomButton.c/h. But I don't know how to know if the custom button  
is clicked.
Also, I would like to know if there is a way to do it with Cocoa.  
QTKit or MovieController don't seem to support the custom button  
directly.


Also, QuickTime X doesn't seem to have the custom button.
if it doesn't have one, is there any other alternative way?

Thank you.
JongAm Park

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Core Data with OpenGL

2009-10-12 Thread I. Savant

On Oct 12, 2009, at 4:27 PM, Ben Trumbull wrote:


but in this case it must draw itself.


No, it doesn't must do anything.  Views draw themselves, model  
objects are state, and controllers are intermediaries.

...
What problem are you trying to solve by knowingly violating the MVC  
design patterns ?


  Hmmm ... must draw itself? No, from a pure MVC approach, I agree  
with you 100% that not only does it not "must" but it "shouldn't".


  However, it's only fair to point out theSketch example - the  
quintessential example for drawing applications. The STKGraphic class  
has draw...InView: methods.


  For a drawing app, I can see why it might be considered a cleaner  
design, despite "knowingly violating the MVC design patterns". A  
"Shape" knows how - and where - to draw itself - just give it a view.  
I think it's mostly a matter of personal taste and methodology but it  
certainly isn't "wrong", which I suppose is why it's now one of the  
few examples left in the developer examples folder in Snow Leopard.


  In theory this violates MVC, but in practice this design approach  
is much easier to understand and maintain (in my opinion, anyway) for  
a drawing application like Sketch.


  This isn't meant to contradict your overall advice, but I do think  
an application's architecture doesn't have to *rigidly* adhere to any  
one design pattern to be "good".


--
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 arch...@mail-archive.com


Thread Safety - A Theoretical Question

2009-10-12 Thread André Berg

Hi,

I am designing my first real class and I am wondering about thread 
safety. I have read the Cocoa Fundamentals and also the Threading 
Programming Guide but there was one question forming in my head which I 
couldn't quite find an answer for. I guess it is something that class 
designers deal differently with.


My class internally doesn't use any threads at all (well apart from an 
NSTask ivar and readInBackgroundAndNotify). The only scenario I can 
think of that would be dangerous is if in the calling code (the code 
from the user of my class) there are two threads which could 
simultaneously access the same instance of my class.


In that case is it my responsibility to guard all access to my class' 
thread unsafe ivars (like mutable objects for example) or is it the 
responsibility of the user of my class to guard all access to my class' 
instances in his code?


With regards to this, should I care about thread safety at all? If you 
are designing a class, even without any concurrency in it at all, where 
do you decide to worry about thread safety in code outside your reach?


I know this is a somewhat loaded question, but I do appreciate any 
pointers and one-liners.

Thanks a lot for reading!

Cheers,

André
___

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

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

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

This email sent to arch...@mail-archive.com


Re: More Core Data Questions

2009-10-12 Thread I. Savant

On Oct 12, 2009, at 4:32 PM, Jon Hull wrote:

I have spent the last 48 hours (re)reading core data docs.  My head  
is swimming in docs.


  Understandable. It's a complicated technology (especially when you  
consider its interaction with Bindings).



The short answer is yes, I understand to give each thread it's own  
context, but I don't know if it will break without a run loop.


  Maybe I'm being dense - a distinct possibility - but I don't get  
what you mean by this. It might be good to start a separate (mailing  
list) thread with a detailed explanation of what you intend to do.



Yes, although I also read a warning about using these cross-stores  
somewhere, so I was thinking of rolling my own.


  If I encountered the same warning, I honestly can't remember it. :-)


The core data UUID would probably also be temporary with the way I  
am currently creating my objects (because I wouldn't have saved  
yet), so I would need something persistent.


  I don't think adding a UUID hurts anything, honestly, so if it  
simplifies things for you, go for it.



Yes, well it is fairly complex... but it looks like core data is not  
a good fit since a basic requirement is that I need it to store  
nested arrays of immutable objects and keep the order (I also need  
to allow those objects to be inserted at multiple points in the  
array).  The immutability and the possibility of multiple entries  
make an order property unworkable.


  Possibly, but you might be pleasantly surprised (not a knowing  
hint, just an honest possibility :-)). If you can, try to explain your  
needs. Someone might just have a good suggestion (or solid reasons why  
not).


--
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 arch...@mail-archive.com


re: More Core Data Questions

2009-10-12 Thread Ben Trumbull

Ok, let me ask some more specific questions and see if that gets a
response...  Feel free to respond if you only know the answer to 1 or
2 of these.

1) Can I count on a to-many relationship keeping the order of the
managedObjects it points to?  The order is very important in this
case, and I need a way to ensure that the order does not change when
the object is saved and reloaded.


No.  You'll have to model order as an attribute yourself.


2) Does core data require a run-loop to work?


No.


3) What is the best way of connecting objects from different stores?
I am considering giving them UUIDs and then storing that as a
reference.  Then setting a transient property based on that in -
awakeFromFetch.  Alternatively, I could store it as a fetched
property, but I want it to be a 1:1 correspondence.


That's fine, although you can just use the URI representation of the  
destination object instead of creating your own separate UUID.  You  
might look at /Developer/Examples/CoreData/iClass



4) Is there a better way to get this lazy loading?


What was the first way ?


 My main goal is to
keep only those objects from this large (>1000) object graph in memory
that are needed (since the iPhone has limited memory).


You may find the NSFetchedResultsController useful, as well as the  
options on NSFetchRequest like -setFetchBatchSize:  They are very  
aggressive about memory optimizations.



Basically, I
want the behavior of the old resource manager from the olden days
(that is I can act as if my full object graph is in memory, but only
those that are needed actually are... and they are fetched just in
time).


Core Data always does that.  That's the default with its SQLite  
persistent store.


Are you making this more complicated than it needs to be for  
performance issues you have yet to measure ?  I wouldn't add multiple  
stores to work around a performance issue before actually trying it.


- Ben

___

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

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

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

This email sent to arch...@mail-archive.com


NSTextView, showDefinition..., and _NSShowDefinitionByHotKey on Snow Leopard

2009-10-12 Thread Steve Shepard
Hi All,

I'm looking for suggestions for debugging an issue I'm seeing with the
Control-Command-D "Lookup in Dictionary" shortcut in NSTextView on
Snow Leopard (10.6.1) .

The Problem:

When I execute the shortcut on Snow Leopard in a subclass of
NSTextView that is part of a paged layout configuration (similar to
Text Edit), the result is that the dictionary overlay pops up over a
word other than the selected word with the definition for that word
(that is, the WRONG WORD). Often, but not always, the dictionary
overlay pops up over the last word in the container. This is not
problem on Leopard or Tiger.

What I've Tried:

I've tried selecting the same word, right-clicking, and selecting
"Lookup in Dictionary." This works as expected: the dictionary overlay
pops up in the right place with the correct word selected. Note: the
default operation for this menu item is to open the dictionary
application (NSDefinitionPresentationTypeDictionaryApplication). To
cause it to pop up the dictionary overlay
(NSDefinitionPresentationTypeOverlay), open Preferences window in the
Dictionary application and select the "Contextual menu: Opens
Dictionary panel" radio button.

It looks like the "Lookup in Dictionary" context menu target calls the
new showDefinitionForAttributedString:range:options:baselineOriginProvider:
call. However, the Control-Command-D key equivalent seems to bypass
this API and call the private _NSShowDefinitionByHotKey function
instead.

I haven't yet discovered the API point(s) in NSTextView that
_NSShowDefinitionByHotKey calls back into. I've tried overriding (and
setting breakpoints on):

* the rangeFor... methods
* the rangesFor... methods
* the 10.6 
showDefinitionForAttributedString:range:options:baselineOriginProvider:
* the 10.6 showDefinitionForAttributedString:atPoint: method
* the private _lookUpDefiniteRangeInDictionaryFromMenu: and
_lookUpIndefiniteRangeInDictionaryFromMenu: methods
* the private showDefinitionByHotKey method.

No luck.

I am NOT able to reproduce this in Text Edit and believe that this is
my bug, but am scratching my head at this point.

Anyone have suggestions. Aki?

BTW, I can work around this by overriding performKeyEquivalent and
calling showDefinitionForAttributedString:range:options:baselineOriginProvider:

-Steve
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Issue with NSView setFrame

2009-10-12 Thread Dave Keck
> I'm not sure what I'm doing wrong here. Also, how do I make it so that the
> frame size increases from the center of the view outwards. Like right now it
> looks like its magnifying from the left to the right. I'm sure theres
> something I need to do with the origin, but I'm not sure.

I'd imagine your mouseExited: isn't being called due to the mouse
being moved too quickly. Your best bet is to restrict your view to
only one magnified grid element at a time. Whenever the mouse moves
over a grid element, reset the previous moused-over view's frame to
the non-magnified value. A good debugging tactic in this situation
would have been putting an NSLog(@"mouse{Entered|Exited}: %p", self);
in your mouseEntered: and mouseExited:. As you moused around your
view, you would've seen something like this:

Moving slow:
  mouseEntered: 0xAA
  mouseExited: 0xAA
  mouseEntered: 0xBB
  mouseExited: 0xBB

Moving fast:
  mouseEntered: 0xAA
  mouseExited: 0xBB
  mouseEntered: 0xCC
  mouseExited: 0xBB

(Notice the distinct pairs in the first example, and sporadic results
in the second.)

As far as centering the magnified view: if it's original size is (100,
100) and it's positioned at (50, 50), and it's new size is (130, 130),
then it's new centered position is (35, 35). I'll leave the rest to
you. ;)
___

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

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

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

This email sent to arch...@mail-archive.com


Re: TIFFRepresentation, different TIFF format under Snow Leopard

2009-10-12 Thread Paul M

On 13/10/2009, at 4:39 AM, Sandy McGuffog wrote:

Actually, that occurred under 10.5 as well - what happens is that some  
operations, it would seem those involving Core Image, cause the  
internal representation to go to RGBA. Which is fine, but there  
doesn't seem to be a way to write a plain RGB format TIFF. I had to  
incorporate a third-party TIFF module to do that, as RGBA TIFF files  
aren't very compatible with anything other than Apple.


Sandy



I think what you mean to say is "RGBA TIFF files aren't very compatible  
with

crappy software".

A tiff file has tags in the header identifying the number of colour  
planes

and their arangement within the file. Any half decent tiff importer will
simply skip the alpha channel, if it has no use for it, and only read  
the RGB

data.



On Oct 12, 2009, at 5:07 PM, Ken Ferry wrote:

On Mon, Oct 12, 2009 at 4:36 AM, Peter C   
wrote:


I just stumble into a feature (or a bug ?), NSImage  
TIFFRepresentation
produce RGB TIFF with a layer (when open under Photoshop).  
Previously it
produce plain RGB TIFF under OS 10.5 and below. This cause some part  
of my
programs interpret wrong RGB data, expecting 3 bytes instead of 4  
bytes for
a RGB pixel.  There is no mention in the documents about this  
"feature".


Is there a way to restore the previous behavior  of  
TIFFRepresentation ?


There's 2 ways to solve your problem.
1) Use Cocoa APIs to specify 3-plane RGB image output (I'm sorry I have  
no

further information here).
2) Throw away your crappy tiff readers and get something better.


paulm


You can look at CGImageDestination to get more options, but I don't  
think

there's anything that provides control at that level.

In many cases there _must_ be data munging between the in memory pixel
format and the on-disk file format.  The precise munging is not  
defined on

either input or output.

That is, don't make pixel format assumptions.  The AppKit release
notesdiscuss

how to avoid making pixel format assumptions in the section
"NSBitmapImageRep: CoreGraphics impedence matching and performance  
notes".


-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 arch...@mail-archive.com


Re: Core Data with OpenGL

2009-10-12 Thread Richard Somers

On Oct 12, 2009, at 2:27 PM, Ben Trumbull wrote:

It sounds like you're trying to create a tight 1:1 binding between  
your model objects and controller objects to avoid actually writing  
a controller layer.


That may be the case. I am currently using an off the shelf  
NSObjectController and NSArrayController.


This is hard, because you're going in the wrong direction. Put a  
stake in the ground, that your model objects will never ever call  
directly into OpenGL.


I have a collection of model objects in a core data store. I enumerate  
all the objects in the store one by one and draw them. It seems only  
natural to have the draw method in the model object class. (There are  
several examples of sample code from Apple and others where the draw  
method is implemented in the model object.)


So you are saying that I should abandon this and put the draw method  
somewhere else like in a controller. Perhaps you could fill the  
picture in a little more for me. So far I have yet to find any sample  
code that is a document based core data application that uses OpenGL.


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 arch...@mail-archive.com


Creating Vcards on iPhone

2009-10-12 Thread Pierce Freeman
Hi Everyone:

On the Mac, there is this function to create Vcards:
initWithVCardRepresentation:.  However, I have not heard of a method that
replicates this behavior on the iPhone.  As the built-in Address Book app
can do it, I assume there must be a way that isn't too complex.  Is there
some framework or otherwise that will allow me to create Vcards on the
iPhone?

Thanks for any help!


___

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

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

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

This email sent to arch...@mail-archive.com


Re: Thread Safety - A Theoretical Question

2009-10-12 Thread Nick Zitzmann


On Oct 12, 2009, at 2:47 PM, André Berg wrote:

In that case is it my responsibility to guard all access to my  
class' thread unsafe ivars (like mutable objects for example) or is  
it the responsibility of the user of my class to guard all access to  
my class' instances in his code?


It depends on whether your class can change states between methods or  
not, with the exception of the main get/set method. Usually, internal  
locking makes the most sense - unless, for example, you're designing  
an array, and want to create a count accessor, and the array could be  
accessed from several threads at once, in which case you'd need to  
lock it externally or else you'd end up with a possibly inaccurate  
count variable.


See NSCache vs. NSMutableDictionary for a good example of this.  
NSCache is locked internally, but there's no way to get the state of  
the class (for example, the key-value count) other than the object for  
a given key. NSMutableDictionary isn't locked internally, but there is  
a way to get a count, enumerator, etc. so it's your responsibility to  
lock it when necessary.



With regards to this, should I care about thread safety at all?


Yes. It pays to plan ahead for what could happen, because the  
alternative is to be stuck with a dumb design decision that can't be  
easily taken back later.


Nick Zitzmann


___

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

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

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

This email sent to arch...@mail-archive.com


Re: Issue with NSView setFrame

2009-10-12 Thread Jesper Storm Bache
Maybe the fact that your view is growing while you move your mouse  
(and under your mouse) is causing AppKit to become confused about  
whether or not the mouse is inside or outside the view.
What about managing your animations from a mouse-move message on the  
NSCollectionView?

Jesper

On Oct 12, 2009, at 1:42 PM, PCWiz wrote:

> I have an NSCollectionView full of NSViews containing NSImageViews.
> Basically looks like a NSMatrix of NSImageCells. I've subclassed the
> NSCollectionView's prototype NSView and added methods to add a
> "magnification" sort of effect when a user hovers on an item:
>
> - (void)mouseEntered:(NSEvent *)theEvent
> {
>   [[self animator] setFrame:NSMakeRect([self frame].origin.x, [self
> frame].origin.y, [self frame].size.width * 1.3, [self
> frame].size.height * 1.3)];
> }
>
> - (void)mouseExited:(NSEvent *)theEvent
> {
>   [[self animator] setFrame:NSMakeRect([self frame].origin.x, [self
> frame].origin.y, [self frame].size.width / 1.3, [self
> frame].size.height / 1.3)];
> }
>
> This works for the most part, if I hover over the items slowly. As
> soon as I start zipping my mouse around fast, the views become all
> disoriented. Here's a video I took of the problem:
>
> http://twitvid.com/6426F
>
> I'm not sure what I'm doing wrong here. Also, how do I make it so that
> the frame size increases from the center of the view outwards. Like
> right now it looks like its magnifying from the left to the right. I'm
> sure theres something I need to do with the origin, but I'm not sure.
>
> 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/jsbache%40adobe.com
>
> This email sent to jsba...@adobe.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 arch...@mail-archive.com


Re: Thread Safety - A Theoretical Question

2009-10-12 Thread Peter Duniho

On Oct 12, 2009, at 1:47 PM, André Berg wrote:

[...] My class internally doesn't use any threads at all (well apart  
from an NSTask ivar and readInBackgroundAndNotify). The only  
scenario I can think of that would be dangerous is if in the calling  
code (the code from the user of my class) there are two threads  
which could simultaneously access the same instance of my class.


In that case is it my responsibility to guard all access to my  
class' thread unsafe ivars (like mutable objects for example) or is  
it the responsibility of the user of my class to guard all access to  
my class' instances in his code?


With regards to this, should I care about thread safety at all? If  
you are designing a class, even without any concurrency in it at  
all, where do you decide to worry about thread safety in code  
outside your reach?


IMHO, it is perfectly legitimate for you to not do any work toward  
making your class thread-safe.  In fact, you'll see that philosophy  
all throughout Cocoa, as well as any number of other mainstream  
programming libraries and frameworks.


If you have a class that is specifically intended to be used in a  
multi-thread environment, or which while perhaps not specifically  
about threading, still is most useful when used in a multi-thread  
environment, then IMHO thread-safety is an important consideration.


But if you have a class that is equally useful when used in a single  
thread as it is if used in a multi-thread scenario, and especially if  
you expect client code to more often be single-threaded, then it is  
IMHO better for you to leave the thread-safety to the client of your  
class (which might still be your own code, for that matter...just  
somewhere outside your class).


Oh, and by the way, IMHO it also doesn't much matter whether your  
class uses threads internally or not.  You may well find it  
advantageous to use threads internally, but if this isn't exposed to  
the client of your class at all, I don't see how that would suggests  
that the external API of your class should have to be thread-safe.


In the end, to me it comes down to how often someone's going to have  
to implement thread-safety to use your class.  If that's going to come  
up a lot, then you might as well go to the trouble to implement thread- 
safety in your class (and make sure you do it right).  If it's not  
going to come up a lot, keep your class simpler and leave out the  
thread safety.  Thread-safety has an implementation cost and a run- 
time cost, and so should be borne only where it's cost-effective to do  
so.


Pete___

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

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

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

This email sent to arch...@mail-archive.com


Re: Thread Safety - A Theoretical Question

2009-10-12 Thread Greg Parker

On Oct 12, 2009, at 1:47 PM, André Berg wrote:
I am designing my first real class and I am wondering about thread  
safety. I have read the Cocoa Fundamentals and also the Threading  
Programming Guide but there was one question forming in my head  
which I couldn't quite find an answer for. I guess it is something  
that class designers deal differently with.


My class internally doesn't use any threads at all (well apart from  
an NSTask ivar and readInBackgroundAndNotify). The only scenario I  
can think of that would be dangerous is if in the calling code (the  
code from the user of my class) there are two threads which could  
simultaneously access the same instance of my class.


In that case is it my responsibility to guard all access to my  
class' thread unsafe ivars (like mutable objects for example) or is  
it the responsibility of the user of my class to guard all access to  
my class' instances in his code?


With regards to this, should I care about thread safety at all? If  
you are designing a class, even without any concurrency in it at  
all, where do you decide to worry about thread safety in code  
outside your reach?


There are many different patterns of thread-safety and -unsafety, with  
varying performance, implementation difficulty, and restrictions on  
clients. If you're writing code that you expect other people and other  
code to use, you should always think about thread safety. Of course  
that thought may only go as far as deciding and documenting that the  
code is thread-unsafe and client beware. But it really is the thought  
that counts here.


Some examples, in rough order of increasing multithreaded-ness from  
the client's perspective. You'll probably want to pick one of these  
patterns, document the choice, and design and implement around that  
choice.


* Thread-unsafe / main thread only. Many AppKit classes work this way.  
The implementer did nothing to make threads work. The client may only  
use it from the main thread.


* One thread per instance. Much of Core Data works this way. A  
particular instance may only be used from a single thread, but other  
threads may simultaneously use other instances. The implementer made  
sure that any global variables or shared data was thread-safe inside  
the implementation, but per-instance data was not made thread-safe.


* One lock per instance. Mutable containers often work this way. A  
particular instance may be used on multiple threads, but only if all  
uses of that instance are protected by a single mutex. Other instances  
may be protected by other mutexes.


* Multiple readers, single writer. Mutable containers often work this  
way. A particular instance may be used without mutation on multiple  
threads simultaneously without synchronization, but any mutation must  
be mutually exclusive with other mutations and all non-mutators. (I.e.  
you can have multiple threads calling -objectAtIndex: on an  
NSMutableArray, but -objectAtIndex: and -setObject:atIndex: on  
different threads need to be protected from each other.)


* Immutable. NSValue and immutable containers work this way. A  
particular instance can be used on multiple threads simultaneously,  
and since it can't be modified there's no need to add synchronization  
to protect mutations. This is a special case of multiple reader /  
single writer with zero writers.


* Anything goes. Any method may be called from any thread at any time,  
and the implementation will make it work. Usually this is hard to  
implement, hurts performance, and greatly restricts the API design.



--
Greg Parker gpar...@apple.com Runtime Wrangler


___

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

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

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

This email sent to arch...@mail-archive.com


Re: Issue with NSView setFrame

2009-10-12 Thread PCWiz
Thank you, that helps a lot. How would I get a reference to the  
previous NSView object?


On 2009-10-12, at 3:22 PM, Dave Keck wrote:

I'm not sure what I'm doing wrong here. Also, how do I make it so  
that the
frame size increases from the center of the view outwards. Like  
right now it

looks like its magnifying from the left to the right. I'm sure theres
something I need to do with the origin, but I'm not sure.


I'd imagine your mouseExited: isn't being called due to the mouse
being moved too quickly. Your best bet is to restrict your view to
only one magnified grid element at a time. Whenever the mouse moves
over a grid element, reset the previous moused-over view's frame to
the non-magnified value. A good debugging tactic in this situation
would have been putting an NSLog(@"mouse{Entered|Exited}: %p", self);
in your mouseEntered: and mouseExited:. As you moused around your
view, you would've seen something like this:

Moving slow:
 mouseEntered: 0xAA
 mouseExited: 0xAA
 mouseEntered: 0xBB
 mouseExited: 0xBB

Moving fast:
 mouseEntered: 0xAA
 mouseExited: 0xBB
 mouseEntered: 0xCC
 mouseExited: 0xBB

(Notice the distinct pairs in the first example, and sporadic results
in the second.)

As far as centering the magnified view: if it's original size is (100,
100) and it's positioned at (50, 50), and it's new size is (130, 130),
then it's new centered position is (35, 35). I'll leave the rest to
you. ;)


___

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

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

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

This email sent to arch...@mail-archive.com


Re: Thread Safety - A Theoretical Question

2009-10-12 Thread Dave Keck
> In that case is it my responsibility to guard all access to my class' thread
> unsafe ivars (like mutable objects for example) or is it the responsibility
> of the user of my class to guard all access to my class' instances in his
> code?

When dealing with Cocoa, the rule is that all classes must be assumed
usable from the main thread only, unless they explicitly allow
otherwise. In my own code, I adopted this rule too; if a class is
thread-safe, I document it as such. If not, I may or may not mention
it; if not, then it's assumed that that class must be used from the
main thread only.

I recommend adopting this rule too, and only making classes thread
safe if it makes sense. While making every class you ever write
thread-safe might be a good intellectual exercise, it's hard and time
consuming, and I doubt there's many of us who do it.

> With regards to this, should I care about thread safety at all? If you are
> designing a class, even without any concurrency in it at all, where do you
> decide to worry about thread safety in code outside your reach?

You should never not care about thread safety! :) Of course that
doesn't mean every method you write should be thread safe. Rather, you
should make a conscious decision of whether a class is going to be
thread-safe, write it as such, and document that fact in the header or
elsewhere. If a user chooses to ignore it and use that class from 5
different threads, then the bug's in their code, not yours.
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Issue with NSView setFrame

2009-10-12 Thread Dave Keck
> Thank you, that helps a lot. How would I get a reference to the previous
> NSView object?

On your mouseEntered, send a message to some controlling object - let's call
it MyViewController:

 - (void)mouseEntered:(NSEvent *)theEvent
 {
 [myViewController mouseDidEnterView: self];
 }

 - (void)mouseExited:(NSEvent *)theEvent
 {
 [myViewController mouseDidEnterView: nil];
 }

... and in MyViewController's mouseDidEnterView:

 - (void)mouseDidEnterView: (NSView *)newMouseOverView
 {
 if (mouseOverView)
 {
 [[mouseOverView animator] setFrame: oldMouseOverViewFrame];
 }

 mouseOverView = newMouseOverView;

 if (mouseOverView)
 {
 oldMouseOverViewFrame = [mouseOverView frame];
 [[mouseOverView animator] setFrame: magnifiedFrame];
 }
 }

Untested, etc.
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Thread Safety - A Theoretical Question

2009-10-12 Thread Greg Guerin

André Berg wrote:

I am designing my first real class and I am wondering about thread  
safety.



Thoughts on reading the above:

What do you mean by "real class"?  Are the other classes you've  
designed merely sham classes?  Toy classes?  Mock classes?


What other classes have you designed?  And implemented?

In what circumstances is this real class going to be used?  Are you  
designing it for your own use or for others?



My class internally doesn't use any threads at all (well apart from  
an NSTask ivar and readInBackgroundAndNotify).



Thoughts on reading the above:

You're using readInBackgroundAndNotify, which implies a run-loop for  
correct operation, IIRC.  Is that fact documented for your class?   
Will the class work properly in a run-loop in a non-main thread?


What is the NSTask doing?  Is the use of NSTask apparent to users of  
the class?  Is it necessary for users to know this (other than the  
dependence on run-loop necessitated by readInBackgroundAndNotify)?



And I agree with the other comments: thread safety depends on what  
the class does, and how it's intended to be used.  There isn't one  
universal answer.


  -- GG


___

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

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

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

This email sent to arch...@mail-archive.com


[UTI] Anyway to retrieve the UTI of a file without having to use a FSRef?

2009-10-12 Thread Iceberg-Dev
From what I've found in the documentation, the UTI type of a file  
can be retrieved using the LaunchServices APIs. This requires to  
provide a FSRef.


Wouldn't there be an API I didn't see in Foundation that lets you  
obtain the type without having to convert, at least, a NSURL to a FSRef?


I'm mainly interested in finding the type of a text file (txt, html,  
rtfd, rtf) from its path.


Mac OS X 10.5.

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Issue with NSView setFrame

2009-10-12 Thread PCWiz

That worked brilliantly!! Thank you very much.

On 2009-10-12, at 3:59 PM, Dave Keck wrote:


 - (void)mouseDidEnterView: (NSView *)newMouseOverView
 {
 if (mouseOverView)
 {
 [[mouseOverView animator] setFrame: oldMouseOverViewFrame];
 }

 mouseOverView = newMouseOverView;

 if (mouseOverView)
 {
 oldMouseOverViewFrame = [mouseOverView frame];
 [[mouseOverView animator] setFrame: magnifiedFrame];
 }
 }



___

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

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

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

This email sent to arch...@mail-archive.com


Re: [UTI] Anyway to retrieve the UTI of a file without having to use a FSRef?

2009-10-12 Thread Jim Correia
On Mon, Oct 12, 2009 at 6:36 PM, Iceberg-Dev  wrote:

> From what I've found in the documentation, the UTI type of a file can be 
> retrieved using the
> LaunchServices APIs. This requires to provide a FSRef.
>
> Wouldn't there be an API I didn't see in Foundation that lets you obtain the 
> type without having to
> convert, at least, a NSURL to a FSRef?

See, on NSWorkspace:

- (NSString *)typeOfFile:(NSString *)absoluteFilePath error:(NSError
**)outError;

- 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 arch...@mail-archive.com


Re: Thread Safety - A Theoretical Question

2009-10-12 Thread Jens Alfke


On Oct 12, 2009, at 2:47 PM, Dave Keck wrote:


I recommend adopting this rule too, and only making classes thread
safe if it makes sense.


+1


While making every class you ever write
thread-safe might be a good intellectual exercise, it's hard and time
consuming, and I doubt there's many of us who do it.


I'll go farther: thread-safety is nearly impossible, largely because  
it can't be modularized. Most classes can't be made thread-safe on  
their own, because behaviors can arise from interactions between  
classes. The situations get pretty pathological.


I almost never code for thread-safety. In the few situations where I  
have code running on background threads (like using NSOperations) I  
make sure that the background thread doesn't use any of the same  
objects as the main thread, except for a few immutable ones like  
NSString. This kind of message-passing model is gaining a lot of  
traction lately.


—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 arch...@mail-archive.com


Re: [UTI] Anyway to retrieve the UTI of a file without having to use a FSRef?

2009-10-12 Thread Jens Alfke


On Oct 12, 2009, at 3:36 PM, Iceberg-Dev wrote:

Wouldn't there be an API I didn't see in Foundation that lets you  
obtain the type without having to convert, at least, a NSURL to a  
FSRef?


In 10.5 there were a bunch of mismatches between APIs like this, that  
required clients to convert between paths, URLs and FSRefs. This got  
cleaned up a lot in 10.6 because it introduces performance overhead.  
So it's likely that there's a CFURL-based version of this API in 10.6.


—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 arch...@mail-archive.com


Custom bitmap representation

2009-10-12 Thread Kelvin Chung
I have this "nonstandard" image format which I want to convert into a  
more "standard" image format (say, PNG).  I'm having difficulty on how  
to use NSImageRep to do so.  This "nonstandard" format can be  
converted into a bitmap, so I thought that using NSBitmapImageRep can  
do just that.  However, since I have no experience in this area, I  
need some guidance on how to do so.  So, any general ideas?

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Bindings Driving Me CRAZY. :'(

2009-10-12 Thread Keary Suska

On Oct 12, 2009, at 1:33 PM, Gustavo Pizano wrote:


Keary Hello:



This doesn't appear sensible, and you may have a number of  
problems. First, make sure that InvoiceEditionViewController is  
being instantiated

this is what Im doing: in the awakeFromNib

if(_userListController == nil){
		_userListController = [[UserListViewController alloc]  
initWithNibName:@"UserListView" bundle:nil];

}
if(_invoiceController == nil){
		_invoiceController = [[InvoiceEditionViewController alloc]  
initWithNibName:@"InvoiceEditionView" bundle:nil];

}
[_myUserListView addSubview:[_userListController view]];
[_myContentView addSubview:[_invoiceController view]];  
[_invoiceController setUserController:_userListController];


You mentioned having an outlet from the UserListViewController to the  
InvoiceEditionViewController--this can only be accomplished in the  
InvoiceEditionViewController is in the UserListViewController's nib,  
in which case you are instantiating two different  
InvoiceEditionViewControllers and hence experiencing problems.


If the InvoiceEditionViewController is *not* in the  
UserListViewController nib, the above should work fine, except still  
consider the NSObjectController but with the correct key path.


properly. Second, simply have a reference to UserListViewController  
in InvoiceEditionViewController, which can be an outlet if


ok done I have now there this :  IBOutlet UserListViewController *  
userController;


This is only useful if the InvoiceEditionViewController is  
instantiated in the UserListViewController nib, If it is, then chances  
are that the InvoiceEditionViewController is not being instantiated  
correctly unless you have overridden -init or -initWithCoder:,  
depending on the super class.


InvoiceEditionViewController can be sensibly instantiated via xib,  
or set by other means. I recommend then to have an  
NSObjectController in InvoiceEditionViewController.xib whose  
content is bound to  
UserListViewController.NSArrayController.selection (using correct  
ivar/property names, of course).
Ok I tried but when wan tto bind the labels to show the details I  
bind it to the NSObjectControlled I just configured, and the  
controller key goes to selection, which its not good, so whe I run I  
see its NO Selection. label.


No, "selection" is the correct controller key for data access. It is  
confusing for an object controller as there will only be one selection  
(or none), but that is how it works.


I did instead was to place an NSArrayController (users) in IB and  
bind the contents to   
userController._userListArrayController.arrangedObjects.
then the labels I bind the values to users, and the controller key  
to selection and the path to the attributes of the entity.


And it works 50%, I can see the values., but when I select another  
user, the values dosn't change, it's seems its getting only the 1st  
value of the array.


Of course. You are creating a whole different array controller that  
has its own selection semantics. Bindings are automatic but not magic.  
Scrap the array controller approach. It won't work. Do an  
NSObjectController instead.


Google "binding across nibs" (you may need to try a few variations on  
the preposition for best results) and you will find numerous  
discussion and techniques.


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

___

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

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

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

This email sent to arch...@mail-archive.com


Re: More Core Data Questions

2009-10-12 Thread Richard Somers

On Oct 12, 2009, at 1:31 PM, Jon Hull wrote:

3) What is the best way of connecting objects from different  
stores?  I am considering giving them UUIDs and then storing that as  
a reference.  Then setting a transient property based on that in - 
awakeFromFetch.  Alternatively, I could store it as a fetched  
property, but I want it to be a 1:1 correspondence.



This might help.

"Let's merge managed object models!" by Chris Hanson

http://chanson.livejournal.com/187540.html

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 arch...@mail-archive.com


Re: More Core Data Questions

2009-10-12 Thread Jon Hull
Yes, well it is fairly complex... but it looks like core data is  
not a good fit since a basic requirement is that I need it to store  
nested arrays of immutable objects and keep the order (I also need  
to allow those objects to be inserted at multiple points in the  
array).  The immutability and the possibility of multiple entries  
make an order property unworkable.


 Possibly, but you might be pleasantly surprised (not a knowing  
hint, just an honest possibility :-)). If you can, try to explain  
your needs. Someone might just have a good suggestion (or solid  
reasons why not).


The project is a game engine which has 2 graphs.  The first is a tree  
of events that represent the story.  Each "event" in the story is an  
immutable object, and there is a special event which represents a  
series of events to run in order and one which represents branches  
that the player has to choose from.  All of these are immutable, and  
the main goal is to avoid loading the whole graph which will consist  
of 10k-50k events.  This graph will be the same for every player.


The second graph represents in-game objects (characters, locations,  
items, etc...) and stores any state for the story.  These should be  
saved off to a separate file, and will be different for each player/ 
saved game.  I also use proxies as context switches to objects in this  
graph.  A concrete example is the current location, which is a proxy  
that pretends to be a location, and forwards all the messages it  
receives to the location object where the player is currently  
located.  This allows events which reference locations/players/etc  
that change depending on state to remain immutable.


The event graph is traversed from a background thread which basically  
runs through events in order until it needs a user response.  I have a  
controller set up which communicates with the main thread, and the  
background thread blocks until the controller gets a valid response,  
at which point it starts unwinding again until it needs another  
response or reaches the end.  There is no run loop for this thread.


All of this works fantastically for the game, but now I have reached  
the point where I can no longer put off save & load.  When I started  
the project Core Data was not yet available on the iPhone, so the  
design did not take it into account.  I was thinking that core data  
might be able to help me save & load these graphs, but now I am not so  
sure.  My new plan is as follows:


Create a manager singleton for events which returns an event object  
for a given id, and then modify the special events mentioned above to  
hold an event's id instead of actual event objects, and then call off  
to the manager with the id whenever they need to run an event.  Inside  
the manager I would either call off to a small sql database with blobs  
holding freeze-dried (keyedArchiving) objects & an id column, or save  
each event as a file with the id in the filename.  I would also have a  
cache in the manager to avoid reallocating objects unnecessarily.  I  
would prefer to have something like core data do this lazy loading for  
me, but it may not work in this case.


For the objects that store state, I will just archive them into a save  
file.


Thoughts?  Does this sound like a reasonable approach, or will core  
data actually work for me?


Thanks,
Jon

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Thread Safety - A Theoretical Question

2009-10-12 Thread André Berg
Huge thanks to everyone. Your time is valuable and I appreciate it that 
you are spending it on helping me.


A lot of high quality, very useful answers.

I have decided to try and work towards the following pattern (in Mr. 
Parker's nice words):


"One thread per instance. Much of Core Data works this way. A particular 
instance may only be used from a single thread, but other threads may 
simultaneously use other instances. The implementer made sure that any 
global variables or shared data was thread-safe inside the 
implementation, but per-instance data was not made thread-safe."


I will now try to answer Mr. Guerin's questions (to the best of my 
knowledge):


"What do you mean by "real class"?  Are the other classes you've 
designed merely sham classes?  Toy classes?  Mock classes?

What other classes have you designed?  And implemented?"

I guess with "real" I meant the first class I am designing on my own, 
without outside help (help in the form of collegue, a book, a tutorial 
or a workshop etc.).
It certainly feels "real" that way to me. While my class may not be 
valuable to fulltime professionals, like you all are, I was still able 
to use it very nicely to see how the following is done:


- memory management topics like using retain/release and using garbage 
collection

- implement delegation
- conform to various protocols, like NSCoding or NSCopying
- write extensive header documentation and use doxygen to make a docset 
out of it

- write unit tests
- use DTrace and Instruments to gain a better picture with use of custom 
probes and dtrace scripts

- use the ObjectGraph, ObjectAlloc and Leaks instruments
- others... (I don't want to bore you :))

I have been working on this for the past few weeks on my sparetime... 
time which includes reading all the different companion guides on 
various subjects.
On a side note I find the Apple documentation to be excellent. I may not 
understand it all fully but that's why I am doing this.
I guess you won't get far as a Cocoa dev if you haven't been facing a 
lot of the decisions that go into designing a class. You will never get 
far in programming without doing, in general.


"In what circumstances is this real class going to be used?  Are you 
designing it for your own use or for others? "


Currently for my own use but I may open source it. My plan is to extend 
an Open Source application with a plugin and use the class there. If all 
goes well and it proves useful I will host it somewhere.


"You're using readInBackgroundAndNotify, which implies a run-loop for 
correct operation, IIRC.  Is that fact documented for your class?  Will 
the class work properly in a run-loop in a non-main thread?"


From my own research on NSTask (a lot has been written) "Yes" to the 
first two questions. As I am just now tackling the threading issues I 
can't answer the last question with full certainty yet (it should work 
but I'd rather test).


"What is the NSTask doing?  Is the use of NSTask apparent to users of 
the class?" 

At the heart my class is mainly a decorator to NSTask and this fact is 
mirrored in the documentation, so I would say so, yes.


"Is it necessary for users to know this (other than the dependence on 
run-loop necessitated by readInBackgroundAndNotify)?"


From my point of view, it shouldn't be necessary to go into much more 
of the internals than mentioning the run-loop dependance.



Again, thanks alot everyone for your input.

Cheers,

André
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Screensaver won't run on 10.6 even after porting to 64-bit

2009-10-12 Thread Charles Srstka

On Oct 11, 2009, at 9:46 PM, Ben Haller wrote:

Most of the bugs I had to fix were related to either using "long"  
instead of "int", or needing a -finalize method.


You should actually probably be using NSInteger instead of either of  
those these days.


There's actually a ConvertCocoa64 script found in /Developer/Extras/ 
64BitConversion that will scan your files for other things that could  
bite you in the transition to 64-bit. You should probably give it a  
spin, to make sure you're all up to date.


This page contains some handy information, too:

http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Cocoa64BitGuide/ConvertingExistingApp/ConvertingExistingApp.html

Charles
___

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

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

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

This email sent to arch...@mail-archive.com


UIViewController Receive Shake Event?

2009-10-12 Thread Anthony Smith
Is it possible to have the UIViewController receive shake events in  
the 3.x API? I saw that UIViewController subclasses UIResponder so I  
thought I'd ask. I wrote some code but wasn't able to make it work.  
Thought there might be some quirk. Currently I'm implementing a  
solution by subclassing UIView.


Anthony

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 arch...@mail-archive.com

How to iterate over all objects stored with NSCoder

2009-10-12 Thread Michael Robinson

Hi list,

I stupidly lost the source code to a program I wrote a long time ago, 
and now have enough spare time to re-write it.


The program stored data with NSCoder.

The re-written program needs to be able to read the same data.

As I lost the source code, I would like to know if there is a way to 
dump all keys/values from NSCoder so I can use it to help me with my 
arduous rewrite.


Is it possible to do this?

How?

I'll keep trying, was hoping someone would be able to give me a 
definitive answer.


Thanks list,

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 arch...@mail-archive.com


Re: More Core Data Questions

2009-10-12 Thread Ben Trumbull




The project is a game engine which has 2 graphs.  The first is a tree
of events that represent the story.  Each "event" in the story is an
immutable object, and there is a special event which represents a
series of events to run in order and one which represents branches
that the player has to choose from.  All of these are immutable, and
the main goal is to avoid loading the whole graph which will consist
of 10k-50k events.  This graph will be the same for every player.


Okay.  If you build this immutable store on your dev machine and  
include it in your project resources, you should see excellent  
performance.  Creating a store this size on the device would take a  
while.  Just don't go crazy with to-many relationships or database  
normalization (for this many objects, on a phone).


Of course, you don't want to search across all the events all the  
time.  You'll want some criteria (NSPredicate) to evaluate just the  
subset of relevant elements.



I also use proxies as context switches to objects in this
graph.  A concrete example is the current location, which is a proxy
that pretends to be a location, and forwards all the messages it
receives to the location object where the player is currently
located.  This allows events which reference locations/players/etc
that change depending on state to remain immutable.


You don't need proxies or NSProxy for this.  You can just use a  
delegate.  Off the cuff, I might consider implementing a protocol on  
your immutable objects for methods like "currentLocation" and  
"currentPlayer" which vector through a semi-global context object not  
unlike the app delegate.  Then you can use keypaths to naturally write currentPlayer.name 
 and so forth.  NSProxy is unnecessarily heavy weight for simple  
delegation.  They use memory too, ja know.  And the semi-global  
context allows you to avoid making all your objects larger.  You might  
even model the "current state" as a formal entity.  That buys you  
change tracking, undo, multi-writer conflict resolutions and the  
ability to easily persistent and search for it.  It also allows other  
managed objects to work with it naturally.



The event graph is traversed from a background thread which basically
runs through events in order until it needs a user response.


Surely most of the events are not relevant most of the time, no ?  By  
location, if nothing else like pre-requisiste events.  If you can keep  
a cookie into the player's choices tree, then you can do an indexed  
query on eligible events and only evaluate those in memory.



 I have a
controller set up which communicates with the main thread, and the
background thread blocks until the controller gets a valid response,
at which point it starts unwinding again until it needs another
response or reaches the end.  There is no run loop for this thread.


sure.  don't forget an autorelease pool.


All of this works fantastically for the game, but now I have reached
the point where I can no longer put off save & load.  When I started
the project Core Data was not yet available on the iPhone, so the
design did not take it into account.  I was thinking that core data
might be able to help me save & load these graphs, but now I am not so
sure.  My new plan is as follows:

Create a manager singleton for events which returns an event object
for a given id, and then modify the special events mentioned above to
hold an event's id instead of actual event objects,


You could do that.  Probably easier to just use an  
NSManagedObjectContext and the delegate I mentioned above.


and then call off  to the manager with the id whenever they need to  
run an event.  Inside

the manager I would either call off to a small sql database with blobs
holding freeze-dried (keyedArchiving) objects & an id column,


not a great plan.  No searching into blobs, no partially loading or  
saving the larger freeze dried objects.


Also, you could do that trivially with Core Data and just be done.


or save each event as a file with the id in the filename.


Each event file would have to be > 8K before this even begins its  
distant journey to approach making any sense at all from a performance  
perspective.


I would also have a  cache in the manager to avoid reallocating  
objects unnecessarily.


I wouldn't worry about caching just yet.  Bigger fish.

I  would prefer to have something like core data do this lazy  
loading for

me, but it may not work in this case.

For the objects that store state, I will just archive them into a save
file.


still no lazy loading or incremental saving.


Thoughts?  Does this sound like a reasonable approach,


Not really, no.  Maybe you need to do something quick & very dirty for  
deadlines.  c'est la vi



or will core data actually work for me?


It's not clear to me why you think it wouldn't.So far, all I get  
is that you haven't used Core Data before and don't know it.  Which,  
btw, is a perfectly valid issue to be having as you 

Multiple relationships between two entities

2009-10-12 Thread Rob Keniger
I'm just getting started with Core Data so go easy on me.

I am moving my existing app across to Core Data and I'm having trouble with a 
few concepts.

At present (pre-Core Data) my app has a model object ("Item") which is used as 
the node object in an NSTreeController.

This model object has multiple ivars of another custom object ("Link") like so:

@interface Item : NSObject
{
Link* normalLink;
Link* alternateLink;
}
@end

I'm trying to replicate this in my Core Data model. I have set up two entities, 
Item and Link. I have created two relationships in the Item entity, 
"normalLink" and "alternateLink", both pointing to the Link entity.

Basically, I want each of these relationships to point to an instance of the 
Link entity.

However, now I have a problem. My Link entity has one relationship ("item") 
which should be the inverse relationship, but that's not possible because I can 
only have one inverse relationship.

I think I'm getting mixed up here, how should this actually be modelled?

--
Rob Keniger



___

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

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

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

This email sent to arch...@mail-archive.com


Re: Multiple relationships between two entities

2009-10-12 Thread Kiran Kumar S
Create a Link Entity by adding another property linkType which decides  
the normal or alternate link.

In Item entity make to-many- relationShip for relationship link



Thanks
Kiran

On 13-Oct-09, at 11:34 AM, Rob Keniger wrote:


I'm just getting started with Core Data so go easy on me.

I am moving my existing app across to Core Data and I'm having  
trouble with a few concepts.


At present (pre-Core Data) my app has a model object ("Item") which  
is used as the node object in an NSTreeController.


This model object has multiple ivars of another custom object  
("Link") like so:


@interface Item : NSObject
{
Link* normalLink;
Link* alternateLink;
}
@end

I'm trying to replicate this in my Core Data model. I have set up  
two entities, Item and Link. I have created two relationships in the  
Item entity, "normalLink" and "alternateLink", both pointing to the  
Link entity.


Basically, I want each of these relationships to point to an  
instance of the Link entity.


However, now I have a problem. My Link entity has one relationship  
("item") which should be the inverse relationship, but that's not  
possible because I can only have one inverse relationship.


I think I'm getting mixed up here, how should this actually be  
modelled?


--
Rob Keniger



___

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

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

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

This email sent to kirankuma...@prithvisolutions.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 arch...@mail-archive.com


Re: TIFFRepresentation, different TIFF format under Snow Leopard

2009-10-12 Thread Sandy McGuffog

Well, that I think depends on your definition of "crappy software". :)

The practical issue for me is that that Adobe Lightroom (at least on  
the PC) won't read an RGBA TIFF file, and if one of Adobe's premier  
packages won't read the file, then the current Apple implementation of  
the TIFF writer is, practically speaking, useless to me.


Sandy


On Oct 12, 2009, at 11:24 PM, Paul M wrote:


On 13/10/2009, at 4:39 AM, Sandy McGuffog wrote:

Actually, that occurred under 10.5 as well - what happens is that  
some operations, it would seem those involving Core Image, cause  
the internal representation to go to RGBA. Which is fine, but there  
doesn't seem to be a way to write a plain RGB format TIFF. I had to  
incorporate a third-party TIFF module to do that, as RGBA TIFF  
files aren't very compatible with anything other than Apple.


Sandy



I think what you mean to say is "RGBA TIFF files aren't very  
compatible with

crappy software".

A tiff file has tags in the header identifying the number of colour  
planes
and their arangement within the file. Any half decent tiff importer  
will
simply skip the alpha channel, if it has no use for it, and only  
read the RGB

data.



On Oct 12, 2009, at 5:07 PM, Ken Ferry wrote:

On Mon, Oct 12, 2009 at 4:36 AM, Peter C   
wrote:


I just stumble into a feature (or a bug ?), NSImage  
TIFFRepresentation
produce RGB TIFF with a layer (when open under Photoshop).  
Previously it
produce plain RGB TIFF under OS 10.5 and below. This cause some  
part of my
programs interpret wrong RGB data, expecting 3 bytes instead of 4  
bytes for
a RGB pixel.  There is no mention in the documents about this  
"feature".


Is there a way to restore the previous behavior  of  
TIFFRepresentation ?


There's 2 ways to solve your problem.
1) Use Cocoa APIs to specify 3-plane RGB image output (I'm sorry I  
have no

further information here).
2) Throw away your crappy tiff readers and get something better.


paulm


You can look at CGImageDestination to get more options, but I  
don't think

there's anything that provides control at that level.

In many cases there _must_ be data munging between the in memory  
pixel
format and the on-disk file format.  The precise munging is not  
defined on

either input or output.

That is, don't make pixel format assumptions.  The AppKit release
notesdiscuss

how to avoid making pixel format assumptions in the section
"NSBitmapImageRep: CoreGraphics impedence matching and performance  
notes".


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

This email sent to mcguff...@gmail.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 arch...@mail-archive.com


Re: Multiple relationships between two entities

2009-10-12 Thread Matthew Lindfield Seager
Inverse of what?

So Item A has link 1 as it's normal link and link 2 as it's alternate
link but then what if link 2 is also the normal link for item B.

My guess is you'll need 2 inverse relationships!

Matt

On Tuesday, October 13, 2009, Rob Keniger  wrote:
> I'm just getting started with Core Data so go easy on me.
>
> I am moving my existing app across to Core Data and I'm having trouble with a 
> few concepts.
>
> At present (pre-Core Data) my app has a model object ("Item") which is used 
> as the node object in an NSTreeController.
>
> This model object has multiple ivars of another custom object ("Link") like 
> so:
>
> @interface Item : NSObject
> {
>         Link* normalLink;
>         Link* alternateLink;
> }
> @end
>
> I'm trying to replicate this in my Core Data model. I have set up two 
> entities, Item and Link. I have created two relationships in the Item entity, 
> "normalLink" and "alternateLink", both pointing to the Link entity.
>
> Basically, I want each of these relationships to point to an instance of the 
> Link entity.
>
> However, now I have a problem. My Link entity has one relationship ("item") 
> which should be the inverse relationship, but that's not possible because I 
> can only have one inverse relationship.
>
> I think I'm getting mixed up here, how should this actually be modelled?
>
> --
> Rob Keniger
>
>
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/matthew%40sagacity.com.au
>
> This email sent to matt...@sagacity.com.au
>

-- 


Safe, comfortable and satisfied? Consider supporting some people who aren't!
I'm riding 100 kilometres to raise funds for refugees!
http://my.e2rm.com/personalPage.aspx?registrationID=750445
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Multiple relationships between two entities

2009-10-12 Thread Rob Keniger

On 13/10/2009, at 4:29 PM, Matthew Lindfield Seager wrote:

> Inverse of what?
> 
> So Item A has link 1 as it's normal link and link 2 as it's alternate
> link but then what if link 2 is also the normal link for item B.

This won't ever actually happen, the link objects aren't shared between items. 
I'm only worried about the inverse relationship because Core Data really, 
really doesn't like one-way relationships.

Kiran Kumar's suggestion of storing the link type in the Link entity and then 
setting up a "links" relationship in the Item object will probably work just 
fine for me I think.

--
Rob Keniger



___

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

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

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

This email sent to arch...@mail-archive.com


NSXML and XQuery

2009-10-12 Thread Kelvin Chung
I'm not sure if this is the right place to ask (is there someplace  
more relevant?), but I'm having trouble processing XQuery using the  
NSXML classes.


Whereas I can get the correct results in something like Saxon, I'm  
having trouble doing so in NSXML: for example, it seems that NSXML  
doesn't support fn:doc() or declaring and calling local functions (ie.  
declare function ... in the prolog).


I'm wondering if this is intentional or just a limitation of the NSXML  
implementation of XQuery, and what other limitations there are.

___

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

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

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

This email sent to arch...@mail-archive.com