Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Jean-Daniel Dupas
Maybe an issue cause you use __weak reference which zeroed for some reason.
Can you try to use __unsafe_unretained instead and see what happen ?

> Le 5 févr. 2016 à 14:46, Dave  a écrit :
> 
> 
>> On 5 Feb 2016, at 13:34, Jean-Daniel Dupas  wrote:
>> 
>> And obviously, you also add - encodeWithCoder: and -initWithCoder: methods 
>> in your custom classes.
> 
> Yes, see my other thread, it decodes all the other fields but not the (weak) 
> back links get set to nil most of the time…….
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/mailing%40xenonium.com
> 
> This email sent to mail...@xenonium.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: WebViews and the Java Plugin

2016-02-05 Thread Sandor Szatmari
Thanks for the link Tamas.  I'll check it out and let you know if I have 
success.

Sandor Szatmari

> On Feb 5, 2016, at 08:08, Tamas Nagy  wrote:
> 
> Hi Sandor,
> 
> you might need to enable the Java plugin on 10.10: 
> https://developer.apple.com/library/mac/documentation/Cocoa/Reference/WebKit/Classes/WebPreferences_Class/index.html#//apple_ref/occ/instp/WebPreferences/javaEnabled
>  
> 
> 
> Best,
> Tamas
> 
>> On 05 Feb 2016, at 14:02, Sandor Szatmari  
>> wrote:
>> 
>> Has anyone had any success running Java applets in a WebView?  
>> 
>> We have an in house app that has successfully loaded and run Java applets up 
>> until SDK 10.6, but after that (tested up to 10.10) Java applets simply do 
>> not load.
>> 
>> I have created bare bones test apps with regular WebViews and WKWebView with 
>> no luck.  Can anyone point me in the right direction or give any advise on 
>> what I am missing?
>> 
>> Sandor Szatmari
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/tamas.lov.nagy%40gmail.com
>> 
>> This email sent to tamas.lov.n...@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:
> https://lists.apple.com/mailman/options/cocoa-dev/admin.szatmari.net%40gmail.com
> 
> This email sent to admin.szatmari@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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Archive/Unarchive Problem - Bug in MacOSX/Cocoa?

2016-02-05 Thread Keary Suska

> On Feb 5, 2016, at 8:45 AM, Dave  wrote:
> 
> Hi All,
> 
> I have written a Test App that demonstrates the problem, please let me know 
> if you’d like a copy.
> 
> I’m not sure if its a bug or not and if not a bug then how to make it work. 
> Everyone keeps telling me its possible but no one seems to know how to make 
> it work.
> 
> According to the (few) docs I found on it, its possible too, but again it 
> doesn’t actually tell you how to do it.
> 
> I’ll use up a DTS incident on this but they will take forever to respond and 
> I jwish I knew for certain whether this is *SUPPOSED* to work or not. It 
> doesn’t actually say in black and white one way or the other.

I would like to see a copy, as I am curious why it isn’t working. The issue 
isn’t that no-one knows how, it is that it is simply supposed to work. There 
shouldn’t be anything you need to do to encode a complex graph.

However, I can see that *decoding* the graph could be difficult. The decoding 
of any single object happens in the -initWithCoder: implementation of that 
object. One would think that until that method is exited, NSCoder cannot know 
that the object exists. Therefore If any of its child objects reference it, how 
can the coder know which object to use? I don’t know how, or if, 
NSKeyedUnarchiver handles this situation.

You may have to handle it yourself—i.e. do not encode “parent” properties and 
instead set the property value in the parents’ -initWithCoder:.

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Quincey Morris
On Feb 5, 2016, at 07:27 , Dave  wrote:
> 
> If you set it strong, then it creates a dupe of the object over and over 
> again, as I said in the other thread

a. If that’s the case, then your problem is nothing to do with the weak 
references. Something is causing those objects to be *either* archived as 
unique objects (copies) *or* copied after unarchiving. As others have 
repeatedly stated, object uniqueness *is* maintained through archiving and 
unarchiving, and if you’re following the idea that there’s something wrong with 
NSKeyedArchiver/NSKeyedUnarchiver, then you’re almost certainly barking up the 
wrong tree.

Your first task, therefore, is to find out whether copies of the object are 
being archived, or whether copies are being made after unarchiving.

(Here’s one scenario where it might happen on unarchiving: if some relevant 
property is marked ‘copy’. In that case, you need to ensure that in 
initWithCoder you store unarchived references into the instance variable, and 
not store them via the property. I doubt the real answer is that easy, but 
that’s the sort of thing to look for.)

b. There is no problem with archiving weak references. I’ve done it (for parent 
references in a hierarchical tree structure). Even though I don’t have the 
implementations of NSKeyedArchiver/NSKeyedUnarchiver, they have to work because 
they don’t *know* the objects being archived or unarchived are “weak”, because 
*objects* are not weak, only references to objects.

All the references to objects within NSKeyedArchiver/NSKeyedUnarchiver are 
strong. That’s why those classes have the idea of “conditional” objects, which 
is their mechanism for handling objects that are only weakly referenced in the 
part of an object graph that’s being archived and unarchived (and presumably 
strongly referenced only by transient references that don’t go into the 
archive).
___

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

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

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

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

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Alex Zavatone

On Feb 5, 2016, at 8:46 AM, Dave wrote:

> 
>> On 5 Feb 2016, at 13:34, Jean-Daniel Dupas  wrote:
>> 
>> And obviously, you also add - encodeWithCoder: and -initWithCoder: methods 
>> in your custom classes.
> 
> Yes, see my other thread, it decodes all the other fields but not the (weak) 
> back links get set to nil most of the time…….

Ahhh.

It would seem that the reference is being lost when the archiving happens.

Would something that is the opposite of strongify/weakify work here?  Sort of a 
strongify a weak reference when it comes to archiving and archive the strong 
reference?

That almost sounds crazy enough to work.

> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
> 
> This email sent to z...@mac.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Dave
> 
> Would something that is the opposite of strongify/weakify work here?  Sort of 
> a strongify a weak reference when it comes to archiving and archive the 
> strong reference?

Sort of a Quantum reference! 

> That almost sounds crazy enough to work.

So do Quantum computers!





___

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

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

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

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

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Dave

> On 5 Feb 2016, at 15:07, Jean-Daniel Dupas  wrote:
> 
> Maybe an issue cause you use __weak reference which zeroed for some reason.
> Can you try to use __unsafe_unretained instead and see what happen ?

If you look on my other thread, you will see that I have tried this, if I use 
“assign” or _unsafe_unretained it crashes when unarchiving that object.

If you set it strong, then it creates a dupe of the object over and over again, 
as I said in the other thread, when I changed things a bit and, I get one level 
where the parent is referenced (e.g. root to first level child) and the rest 
nil……

Cheers
Dave


___

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

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

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

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

Re: Archive/Unarchive Problem - Bug in MacOSX/Cocoa?

2016-02-05 Thread Dave
Hi All,

I have written a Test App that demonstrates the problem, please let me know if 
you’d like a copy.

I’m not sure if its a bug or not and if not a bug then how to make it work. 
Everyone keeps telling me its possible but no one seems to know how to make it 
work.

According to the (few) docs I found on it, its possible too, but again it 
doesn’t actually tell you how to do it.

I’ll use up a DTS incident on this but they will take forever to respond and I 
jwish I knew for certain whether this is *SUPPOSED* to work or not. It doesn’t 
actually say in black and white one way or the other.

All the Best
Dave


___

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

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

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

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

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Dave
Hi Alex,

Found it! Well, Jean-Daniel did - Thanks again!

I was barking up the wrong tree thinking it was the back links that were the 
problem. Using weak caused them to (correctly as it turned out) be set to nil 
when the node it reference is released. The problem was in the initWithCoder 
method, I was using:

self.pNetworkNodeChildArray = [[NSMutableArray alloc] initWithArray:myArray 
copyItems:YES];

and that should be - copyItems:NO

I’m not sure where I got the YES from, I think it was from a very simple 
example I found online. Anyway if you set it to NO, it works as expected.

Worth checking if you have this too when you shouldn’t. 

AFAIK, there are no working examples of using a back link like this, if anyone 
wants to post my sample code to their web-site they are welcome to it, just 
drop me a line.

All the Best
Dave

> On 5 Feb 2016, at 16:37, Alex Zavatone  wrote:
> 
> 
> On Feb 5, 2016, at 8:46 AM, Dave wrote:
> 
>> 
>>> On 5 Feb 2016, at 13:34, Jean-Daniel Dupas  wrote:
>>> 
>>> And obviously, you also add - encodeWithCoder: and -initWithCoder: methods 
>>> in your custom classes.
>> 
>> Yes, see my other thread, it decodes all the other fields but not the (weak) 
>> back links get set to nil most of the time…….
> 
> Ahhh.
> 
> It would seem that the reference is being lost when the archiving happens.
> 
> Would something that is the opposite of strongify/weakify work here?  Sort of 
> a strongify a weak reference when it comes to archiving and archive the 
> strong reference?
> 
> That almost sounds crazy enough to work.
> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
>> 
>> This email sent to z...@mac.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Dave

> On 5 Feb 2016, at 17:04, Quincey Morris  
> wrote:
> 
> On Feb 5, 2016, at 07:27 , Dave  > wrote:
>> 
>> If you set it strong, then it creates a dupe of the object over and over 
>> again, as I said in the other thread
> 
> a. If that’s the case, then your problem is nothing to do with the weak 
> references. Something is causing those objects to be *either* archived as 
> unique objects (copies) *or* copied after unarchiving. As others have 
> repeatedly stated, object uniqueness *is* maintained through archiving and 
> unarchiving, and if you’re following the idea that there’s something wrong 
> with NSKeyedArchiver/NSKeyedUnarchiver, then you’re almost certainly barking 
> up the wrong tree.

Yes, I didn’t really think it was a problem with 
NSKeyedArchiver/NSKeyedUnarchiver, but I thought there was something more I had 
to do to make it work……. 

Found it now and, your were right, I was using copyItems:YES in the 
initWithCoder which caused new Child Objects to be generated, thus causing the 
weakly referenced back pointers to be zero’ed…..


Thanks for the explanation, I haven’t found anything that states it as 
plainly…..

All the Best
Dave

___

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

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

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

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

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Alex Zavatone
Sure.  That would be nice.

I also recall some classes for archiving and dearchiving that use introspection 
that automatically handle the proper action in one line of code.

For simple cases with straightforward collection classes, this is a really 
really really nice approach and frees us from having to write special case code 
for each property.

Something like automaticInitWithCoder and automaticEncodeWithCoder.

It would be nice if the default operations were able to use Objective-C's 
introspection to achieve this, but well, they don't.

If anyone knows of these more automatic initers and encoders, I'd sure like a 
pointer to them.

Thanks and happy you got it working, Dave.

Alex Zavatone



On Feb 5, 2016, at 12:00 PM, Dave wrote:

> Hi Alex,
> 
> Found it! Well, Jean-Daniel did - Thanks again!
> 
> I was barking up the wrong tree thinking it was the back links that were the 
> problem. Using weak caused them to (correctly as it turned out) be set to nil 
> when the node it reference is released. The problem was in the initWithCoder 
> method, I was using:
> 
> self.pNetworkNodeChildArray = [[NSMutableArray alloc] initWithArray:myArray 
> copyItems:YES];
> 
> and that should be - copyItems:NO
> 
> I’m not sure where I got the YES from, I think it was from a very simple 
> example I found online. Anyway if you set it to NO, it works as expected.
> 
> Worth checking if you have this too when you shouldn’t. 
> 
> AFAIK, there are no working examples of using a back link like this, if 
> anyone wants to post my sample code to their web-site they are welcome to it, 
> just drop me a line.
> 
> All the Best
> Dave
> 
>> On 5 Feb 2016, at 16:37, Alex Zavatone  wrote:
>> 
>> 
>> On Feb 5, 2016, at 8:46 AM, Dave wrote:
>> 
>>> 
 On 5 Feb 2016, at 13:34, Jean-Daniel Dupas  wrote:
 
 And obviously, you also add - encodeWithCoder: and -initWithCoder: methods 
 in your custom classes.
>>> 
>>> Yes, see my other thread, it decodes all the other fields but not the 
>>> (weak) back links get set to nil most of the time…….
>> 
>> Ahhh.
>> 
>> It would seem that the reference is being lost when the archiving happens.
>> 
>> Would something that is the opposite of strongify/weakify work here?  Sort 
>> of a strongify a weak reference when it comes to archiving and archive the 
>> strong reference?
>> 
>> That almost sounds crazy enough to work.
>> 
>>> ___
>>> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>> 
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>> 
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
>>> 
>>> This email sent to z...@mac.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:
> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
> 
> This email sent to z...@mac.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Archive/Unarchive Problem - Bug in MacOSX/Cocoa?

2016-02-05 Thread Dave

> On 5 Feb 2016, at 16:10, Keary Suska  wrote:
> 
> 
>> On Feb 5, 2016, at 8:45 AM, Dave  wrote:
>> 
>> Hi All,
>> 
>> I have written a Test App that demonstrates the problem, please let me know 
>> if you’d like a copy.
>> 
>> I’m not sure if its a bug or not and if not a bug then how to make it work. 
>> Everyone keeps telling me its possible but no one seems to know how to make 
>> it work.
>> 
>> According to the (few) docs I found on it, its possible too, but again it 
>> doesn’t actually tell you how to do it.
>> 
>> I’ll use up a DTS incident on this but they will take forever to respond and 
>> I jwish I knew for certain whether this is *SUPPOSED* to work or not. It 
>> doesn’t actually say in black and white one way or the other.
> 
> I would like to see a copy, as I am curious why it isn’t working. The issue 
> isn’t that no-one knows how, it is that it is simply supposed to work. There 
> shouldn’t be anything you need to do to encode a complex graph.
> 
> However, I can see that *decoding* the graph could be difficult. The decoding 
> of any single object happens in the -initWithCoder: implementation of that 
> object. One would think that until that method is exited, NSCoder cannot know 
> that the object exists. Therefore If any of its child objects reference it, 
> how can the coder know which object to use? I don’t know how, or if, 
> NSKeyedUnarchiver handles this situation.

It works now. It handles it by doing at least two passes. The first pass it 
creates a dictionary of all “Unique” Objects, and then on the second pass 
substitutes references to keys in the dictionary…….

> You may have to handle it yourself—i.e. do not encode “parent” properties and 
> instead set the property value in the parents’ -initWithCoder:.

I knew it would handle it, I just thought there was some magic you had to 
somehow provide, but this “magic” is provided by the Archiver/Unarchiver *if* 
you don’t inadvertently break the self-referential nature of the original 
network.

All the Best
Dave


___

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

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

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

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

mmap quiet failure - all reads are 0x00

2016-02-05 Thread Trygve Inda
I have image data that is stored in a 150mb file which I use mmap to read.

The image data is pulled into a NSBitmapImageRep pixel by pixel and
eventually shows on the screen. Only a subset of the pixel in the mmap file
are pulled into a single NSBitmapImageRep.

A few customers (and I have seen it happen here a couple times too) are
reporting that sometimes the image just turns solid black.

It seems like no matter what is in the mmap file, when I read from it I get
0x00 for every byte and no error or exception is generated. I can't
reproduce it as it is very random. Quitting and relaunching solves it.

Any ideas?

Trygve



___

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

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

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

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

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Alex Zavatone

On Feb 5, 2016, at 12:01 PM, Dave wrote:

>> 
>> Would something that is the opposite of strongify/weakify work here?  Sort 
>> of a strongify a weak reference when it comes to archiving and archive the 
>> strong reference?
> 
> Sort of a Quantum reference! 
> 
>> That almost sounds crazy enough to work.
> 
> So do Quantum computers!

Next thing you know, this so called "Internet" thing will take off and people 
will be walking around with "iPhones" in their pockets.

That'll be the day.



___

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

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

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

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

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Graham Cox

> On 6 Feb 2016, at 4:00 AM, Dave  wrote:
> 
> self.pNetworkNodeChildArray = [[NSMutableArray alloc] initWithArray:myArray 
> copyItems:YES];


This is one reason why sometimes having explicit ivars for key parts of an 
object will save you many hours of trouble.

If you had e.g:

@synthesize pNetworkChildArray = mChildArray; // mChildArray is an ivar 
NSMutableArray*

your -initWithCoder: method could then do something simple like:

mChildArray = [[aDecoder decodeObjectForKey:@“children”] mutableCopy];

This will avoid all of the issues you’ve had and also give you better 
performance, because it’s not invoking a setter method, nor allocating an 
unneeded intermediate copy of the array. For large object graphs, (>10,000 
nodes say) bypassing a property setter can end up shaving minutes off the time 
to decode an archive. - initWithCoder: is an init method, it should be creating 
the initial state of the object, incuding allocating its ivars. So you don’t 
have to either a) allocate the ivars then copy the decoded array into them, nor 
b) worry about a leak caused by simply assigning a mutable copy of a decoded 
array to the ivar. Another benefit of this is that you could declare your 
pNetworkChildArray property read-only and non-mutable in the public interface, 
which would catch external abuses of the network - usually only the internals 
of the tree itself have any business mutating this.

n.b. if you’d have shown your code rather than a long verbal description of 
what you were doing, the problem would have been instantly obvious. For 
comparison, here’s the -initWithCoder: method I have in a general purpose tree 
node class. It has never given the slightest trouble:

#pragma mark - NSCoding

- (instancetype) initWithCoder:(NSCoder*) aDecoder
{
self = [super init];
if( self )
{
mChildNodes = [[aDecoder decodeObjectForKey:@"Node_children"] 
mutableCopy];
mParentNode = [aDecoder decodeObjectForKey:@"Node_parent"];
mRepresentedObject = [[aDecoder 
decodeObjectForKey:@"Node_payload"] retain];
}

return self;
}




___

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

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

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

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

Re: Protocol extensions returning self

2016-02-05 Thread Jan E. Schotsman


On Feb 4, 2016, at 4:56 PM, Charles Jenkins wrote:

Supposedly in a protocol, “Self” is the class implementing the  
protocol. So it seems to me that extension methods should be able to  
have a return type of Self so they can return self, and thus have  
the extension method behave the same as it would as if it were  
defined in the class adopting the protocol.


I am not sure if this solves your particular problem, but in general  
you must do this


protocol MyProtocol
{
typealias Element
}

extension MyProtocol where Element == Self
{

// use Element instead of Self
}

At least I have found this to work better in my use cases.

Jan E.
___

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

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

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

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

WebViews and the Java Plugin

2016-02-05 Thread Sandor Szatmari
Has anyone had any success running Java applets in a WebView?  

We have an in house app that has successfully loaded and run Java applets up 
until SDK 10.6, but after that (tested up to 10.10) Java applets simply do not 
load.

I have created bare bones test apps with regular WebViews and WKWebView with no 
luck.  Can anyone point me in the right direction or give any advise on what I 
am missing?

Sandor Szatmari
___

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

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

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

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

Re: WebViews and the Java Plugin

2016-02-05 Thread Tamas Nagy
Hi Sandor,

you might need to enable the Java plugin on 10.10: 
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/WebKit/Classes/WebPreferences_Class/index.html#//apple_ref/occ/instp/WebPreferences/javaEnabled
 


Best,
Tamas

> On 05 Feb 2016, at 14:02, Sandor Szatmari  
> wrote:
> 
> Has anyone had any success running Java applets in a WebView?  
> 
> We have an in house app that has successfully loaded and run Java applets up 
> until SDK 10.6, but after that (tested up to 10.10) Java applets simply do 
> not load.
> 
> I have created bare bones test apps with regular WebViews and WKWebView with 
> no luck.  Can anyone point me in the right direction or give any advise on 
> what I am missing?
> 
> Sandor Szatmari
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/tamas.lov.nagy%40gmail.com
> 
> This email sent to tamas.lov.n...@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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Dave
Hi,

I’m having problems with Back Links when Archiving/Unarchiving an Object. I 
found the text below at:

https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Archiving/Articles/archives.html


Root Object

An object graph is not necessarily a simple tree structure. Two objects can 
contain references to each other, for example, creating a cycle. If a coder 
follows every link and blindly encodes each object it encounters, this circular 
reference will generate an infinite loop in the coder. Also, a single object 
can be referenced by several other objects. The coder must be able to recognize 
and handle multiple and circular references so that it does not encode more 
than one copy of each object, but still regenerate all the references when 
decoding.
To solve this problem, NSCoder introduces the concept of a root object. The 
root object is the starting point of an object graph. To encode an object 
graph, you invoke the NSCoder method encodeRootObject:, passing in the first 
object to encode. Every object encoded within the context of this invocation is 
tracked. If the coder is asked to encode an object more than once, the coder 
encodes a reference to the first encoding instead of encoding the object again.

NSCoder does not implement support for root objects; NSCoder’s implementation 
of encodeRootObject: simply encodes the object by invoking encodeObject:. It is 
the responsibility of its concrete subclasses to keep track of multiple 
references to objects, thus preserving the structure of any object graphs.

The last paragraph seems pertinent to my problem, so do I need to do something 
special for “weak”, back links in order to “keep track of multiple references 
to objects”? If so could some please tell me how to do this? I’m really 
struggling to get something out the door and was advised to use the Keyed 
Archiver/Unarchiver as it would be the simplest implementation……

Is this any other documentation or sample code available? There are plenty of 
trivial examples out there, no nothing I can find that works for weak back 
links, although according to all the Apple Blurb I can find, it is possible, 
they just don’t tell you how to do it that I can find!

Thanks in Advance for Any Help
All the Best
Dave

___

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

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

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

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

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Jean-Daniel Dupas
That is your need, not your problem. 

To archive an object graph (cyclic or not), you just do [NSKeyedArchiver 
archiveRootObject:graph toFile:@"myfile"];



> Le 5 févr. 2016 à 14:28, Dave  a écrit :
> 
> Hi,
> 
> See my other thread on this list which explains it fully  - 
> "Archive/Unarchive Problem/Question?”.
> 
> Basically I need to save/restore a Network of Custom Objects…..
> 
> All the Best
> Dave
> 
>> On 5 Feb 2016, at 13:18, Jean-Daniel Dupas  wrote:
>> 
>> You don’t tell use what is your problem. You can perfectly encode any 
>> structure using Keyed archivers (whether there is cycles and backlinks).
>> 
>>> Le 5 févr. 2016 à 14:13, Dave  a écrit :
>>> 
>>> Hi,
>>> 
>>> I’m having problems with Back Links when Archiving/Unarchiving an Object. I 
>>> found the text below at:
>>> 
>>> https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Archiving/Articles/archives.html
>>> 
>>> 
>>> Root Object
>>> 
>>> An object graph is not necessarily a simple tree structure. Two objects can 
>>> contain references to each other, for example, creating a cycle. If a coder 
>>> follows every link and blindly encodes each object it encounters, this 
>>> circular reference will generate an infinite loop in the coder. Also, a 
>>> single object can be referenced by several other objects. The coder must be 
>>> able to recognize and handle multiple and circular references so that it 
>>> does not encode more than one copy of each object, but still regenerate all 
>>> the references when decoding.
>>> To solve this problem, NSCoder introduces the concept of a root object. The 
>>> root object is the starting point of an object graph. To encode an object 
>>> graph, you invoke the NSCoder method encodeRootObject:, passing in the 
>>> first object to encode. Every object encoded within the context of this 
>>> invocation is tracked. If the coder is asked to encode an object more than 
>>> once, the coder encodes a reference to the first encoding instead of 
>>> encoding the object again.
>>> 
>>> NSCoder does not implement support for root objects; NSCoder’s 
>>> implementation of encodeRootObject: simply encodes the object by invoking 
>>> encodeObject:. It is the responsibility of its concrete subclasses to keep 
>>> track of multiple references to objects, thus preserving the structure of 
>>> any object graphs.
>>> 
>>> The last paragraph seems pertinent to my problem, so do I need to do 
>>> something special for “weak”, back links in order to “keep track of 
>>> multiple references to objects”? If so could some please tell me how to do 
>>> this? I’m really struggling to get something out the door and was advised 
>>> to use the Keyed Archiver/Unarchiver as it would be the simplest 
>>> implementation……
>>> 
>>> Is this any other documentation or sample code available? There are plenty 
>>> of trivial examples out there, no nothing I can find that works for weak 
>>> back links, although according to all the Apple Blurb I can find, it is 
>>> possible, they just don’t tell you how to do it that I can find!
>>> 
>>> Thanks in Advance for Any Help
>>> All the Best
>>> Dave
>>> 
>>> ___
>>> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>> 
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>> 
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/cocoa-dev/mailing%40xenonium.com
>>> 
>>> This email sent to mail...@xenonium.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:
> https://lists.apple.com/mailman/options/cocoa-dev/mailing%40xenonium.com
> 
> This email sent to mail...@xenonium.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Jean-Daniel Dupas
And obviously, you also add - encodeWithCoder: and -initWithCoder: methods in 
your custom classes.

> Le 5 févr. 2016 à 14:33, Jean-Daniel Dupas  a écrit :
> 
> That is your need, not your problem. 
> 
> To archive an object graph (cyclic or not), you just do [NSKeyedArchiver 
> archiveRootObject:graph toFile:@"myfile"];
> 
> 
> 
>> Le 5 févr. 2016 à 14:28, Dave  a écrit :
>> 
>> Hi,
>> 
>> See my other thread on this list which explains it fully  - 
>> "Archive/Unarchive Problem/Question?”.
>> 
>> Basically I need to save/restore a Network of Custom Objects…..
>> 
>> All the Best
>> Dave
>> 
>>> On 5 Feb 2016, at 13:18, Jean-Daniel Dupas  wrote:
>>> 
>>> You don’t tell use what is your problem. You can perfectly encode any 
>>> structure using Keyed archivers (whether there is cycles and backlinks).
>>> 
 Le 5 févr. 2016 à 14:13, Dave  a écrit :
 
 Hi,
 
 I’m having problems with Back Links when Archiving/Unarchiving an Object. 
 I found the text below at:
 
 https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Archiving/Articles/archives.html
 
 
 Root Object
 
 An object graph is not necessarily a simple tree structure. Two objects 
 can contain references to each other, for example, creating a cycle. If a 
 coder follows every link and blindly encodes each object it encounters, 
 this circular reference will generate an infinite loop in the coder. Also, 
 a single object can be referenced by several other objects. The coder must 
 be able to recognize and handle multiple and circular references so that 
 it does not encode more than one copy of each object, but still regenerate 
 all the references when decoding.
 To solve this problem, NSCoder introduces the concept of a root object. 
 The root object is the starting point of an object graph. To encode an 
 object graph, you invoke the NSCoder method encodeRootObject:, passing in 
 the first object to encode. Every object encoded within the context of 
 this invocation is tracked. If the coder is asked to encode an object more 
 than once, the coder encodes a reference to the first encoding instead of 
 encoding the object again.
 
 NSCoder does not implement support for root objects; NSCoder’s 
 implementation of encodeRootObject: simply encodes the object by invoking 
 encodeObject:. It is the responsibility of its concrete subclasses to keep 
 track of multiple references to objects, thus preserving the structure of 
 any object graphs.
 
 The last paragraph seems pertinent to my problem, so do I need to do 
 something special for “weak”, back links in order to “keep track of 
 multiple references to objects”? If so could some please tell me how to do 
 this? I’m really struggling to get something out the door and was advised 
 to use the Keyed Archiver/Unarchiver as it would be the simplest 
 implementation……
 
 Is this any other documentation or sample code available? There are plenty 
 of trivial examples out there, no nothing I can find that works for weak 
 back links, although according to all the Apple Blurb I can find, it is 
 possible, they just don’t tell you how to do it that I can find!
 
 Thanks in Advance for Any Help
 All the Best
 Dave
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/mailing%40xenonium.com
 
 This email sent to mail...@xenonium.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:
>> https://lists.apple.com/mailman/options/cocoa-dev/mailing%40xenonium.com
>> 
>> This email sent to mail...@xenonium.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Dave
Hi,

> On 5 Feb 2016, at 13:37, Alex Zavatone  wrote:
> 
> The first question is, “Do you have any circular references?”

See my other thread for answer to that, but no, its a network with a Root 
Object and Child Objects, similar to a NSViewController/NSView Hierarchy.

So, no there are no circular references. Each Node has a Child Array and a 
Parent (weak) Back Link.

So:

ObjectX.ChildArray[n].parent == ObjectX //In terms of Pointers.

All the Best
Dave

___

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

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

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

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

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Jean-Daniel Dupas
You don’t tell use what is your problem. You can perfectly encode any structure 
using Keyed archivers (whether there is cycles and backlinks).

> Le 5 févr. 2016 à 14:13, Dave  a écrit :
> 
> Hi,
> 
> I’m having problems with Back Links when Archiving/Unarchiving an Object. I 
> found the text below at:
> 
> https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Archiving/Articles/archives.html
> 
> 
> Root Object
> 
> An object graph is not necessarily a simple tree structure. Two objects can 
> contain references to each other, for example, creating a cycle. If a coder 
> follows every link and blindly encodes each object it encounters, this 
> circular reference will generate an infinite loop in the coder. Also, a 
> single object can be referenced by several other objects. The coder must be 
> able to recognize and handle multiple and circular references so that it does 
> not encode more than one copy of each object, but still regenerate all the 
> references when decoding.
> To solve this problem, NSCoder introduces the concept of a root object. The 
> root object is the starting point of an object graph. To encode an object 
> graph, you invoke the NSCoder method encodeRootObject:, passing in the first 
> object to encode. Every object encoded within the context of this invocation 
> is tracked. If the coder is asked to encode an object more than once, the 
> coder encodes a reference to the first encoding instead of encoding the 
> object again.
> 
> NSCoder does not implement support for root objects; NSCoder’s implementation 
> of encodeRootObject: simply encodes the object by invoking encodeObject:. It 
> is the responsibility of its concrete subclasses to keep track of multiple 
> references to objects, thus preserving the structure of any object graphs.
> 
> The last paragraph seems pertinent to my problem, so do I need to do 
> something special for “weak”, back links in order to “keep track of multiple 
> references to objects”? If so could some please tell me how to do this? I’m 
> really struggling to get something out the door and was advised to use the 
> Keyed Archiver/Unarchiver as it would be the simplest implementation……
> 
> Is this any other documentation or sample code available? There are plenty of 
> trivial examples out there, no nothing I can find that works for weak back 
> links, although according to all the Apple Blurb I can find, it is possible, 
> they just don’t tell you how to do it that I can find!
> 
> Thanks in Advance for Any Help
> All the Best
> Dave
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/mailing%40xenonium.com
> 
> This email sent to mail...@xenonium.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Dave
Hi,

See my other thread on this list which explains it fully  - "Archive/Unarchive 
Problem/Question?”.

Basically I need to save/restore a Network of Custom Objects…..

All the Best
Dave

> On 5 Feb 2016, at 13:18, Jean-Daniel Dupas  wrote:
> 
> You don’t tell use what is your problem. You can perfectly encode any 
> structure using Keyed archivers (whether there is cycles and backlinks).
> 
>> Le 5 févr. 2016 à 14:13, Dave  a écrit :
>> 
>> Hi,
>> 
>> I’m having problems with Back Links when Archiving/Unarchiving an Object. I 
>> found the text below at:
>> 
>> https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Archiving/Articles/archives.html
>> 
>> 
>> Root Object
>> 
>> An object graph is not necessarily a simple tree structure. Two objects can 
>> contain references to each other, for example, creating a cycle. If a coder 
>> follows every link and blindly encodes each object it encounters, this 
>> circular reference will generate an infinite loop in the coder. Also, a 
>> single object can be referenced by several other objects. The coder must be 
>> able to recognize and handle multiple and circular references so that it 
>> does not encode more than one copy of each object, but still regenerate all 
>> the references when decoding.
>> To solve this problem, NSCoder introduces the concept of a root object. The 
>> root object is the starting point of an object graph. To encode an object 
>> graph, you invoke the NSCoder method encodeRootObject:, passing in the first 
>> object to encode. Every object encoded within the context of this invocation 
>> is tracked. If the coder is asked to encode an object more than once, the 
>> coder encodes a reference to the first encoding instead of encoding the 
>> object again.
>> 
>> NSCoder does not implement support for root objects; NSCoder’s 
>> implementation of encodeRootObject: simply encodes the object by invoking 
>> encodeObject:. It is the responsibility of its concrete subclasses to keep 
>> track of multiple references to objects, thus preserving the structure of 
>> any object graphs.
>> 
>> The last paragraph seems pertinent to my problem, so do I need to do 
>> something special for “weak”, back links in order to “keep track of multiple 
>> references to objects”? If so could some please tell me how to do this? I’m 
>> really struggling to get something out the door and was advised to use the 
>> Keyed Archiver/Unarchiver as it would be the simplest implementation……
>> 
>> Is this any other documentation or sample code available? There are plenty 
>> of trivial examples out there, no nothing I can find that works for weak 
>> back links, although according to all the Apple Blurb I can find, it is 
>> possible, they just don’t tell you how to do it that I can find!
>> 
>> Thanks in Advance for Any Help
>> All the Best
>> Dave
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/mailing%40xenonium.com
>> 
>> This email sent to mail...@xenonium.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Alex Zavatone
The first question is, “Do you have any circular references?”

On Feb 5, 2016, at 8:13 AM, Dave  wrote:

> Hi,
> 
> I’m having problems with Back Links when Archiving/Unarchiving an Object. I 
> found the text below at:
> 
> https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Archiving/Articles/archives.html
> 
> 
> Root Object
> 
> An object graph is not necessarily a simple tree structure. Two objects can 
> contain references to each other, for example, creating a cycle. If a coder 
> follows every link and blindly encodes each object it encounters, this 
> circular reference will generate an infinite loop in the coder. Also, a 
> single object can be referenced by several other objects. The coder must be 
> able to recognize and handle multiple and circular references so that it does 
> not encode more than one copy of each object, but still regenerate all the 
> references when decoding.
> To solve this problem, NSCoder introduces the concept of a root object. The 
> root object is the starting point of an object graph. To encode an object 
> graph, you invoke the NSCoder method encodeRootObject:, passing in the first 
> object to encode. Every object encoded within the context of this invocation 
> is tracked. If the coder is asked to encode an object more than once, the 
> coder encodes a reference to the first encoding instead of encoding the 
> object again.
> 
> NSCoder does not implement support for root objects; NSCoder’s implementation 
> of encodeRootObject: simply encodes the object by invoking encodeObject:. It 
> is the responsibility of its concrete subclasses to keep track of multiple 
> references to objects, thus preserving the structure of any object graphs.
> 
> The last paragraph seems pertinent to my problem, so do I need to do 
> something special for “weak”, back links in order to “keep track of multiple 
> references to objects”? If so could some please tell me how to do this? I’m 
> really struggling to get something out the door and was advised to use the 
> Keyed Archiver/Unarchiver as it would be the simplest implementation……
> 
> Is this any other documentation or sample code available? There are plenty of 
> trivial examples out there, no nothing I can find that works for weak back 
> links, although according to all the Apple Blurb I can find, it is possible, 
> they just don’t tell you how to do it that I can find!
> 
> Thanks in Advance for Any Help
> All the Best
> Dave
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
> 
> This email sent to z...@mac.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Archive/Unarchive Problem - Bug in MacOSX/Cocoa?

2016-02-05 Thread Dave
Hi,

I hoped that someone might have had some ideas on why back links are not 
working when Archiving/Unarchiving objects. I’ve searched for documentation and 
sample code that shows using a back-link like this but can’t find anything that 
says categorically that it should work and nothing that says it won’t work, 
and, according to Jens it *should* work.

So, is this a Bug in Mac OS X/Cocoa?

Before I started doing this, I asked on this list for the best way to 
save/restore a network like this and was told to use the Apple Keyed 
Archiver/Unarchiver, well now I’ve done that and it doesn’t work and I have no 
chance of debugging it because I don’t have the source code. I can’t help 
thinking I’d have been better off writing my own methods but its too late for 
that now…...

I’m wondering if the problem is something to do with the way in which I’ve laid 
the Object out, basically I’ve got an outer “Container" Class called 
LTWNetwork, I archive an instance of the LTWNetwork Class, LTW Network contains 
a number of properties, three of which are to do with the hierarchical network 
of LTWNetworkNode Objects as so:

NSMutableArray*  pNetworkArray; //Contains an 
Hierarchical Array of LTWNetworkNodes
NSMutableDictionary* pNetworkDict   
//Contains a Hierarchical Dict of LTWNetworkNodes

NSMutableDictionary* pNetworkFlatDict   
/Contains Flat Dictionary of Key-LongID/LTWNetworkNodes

LTWNetworkNode has linkage (among other) properties:

LTWNetworkNode*  pNetworkParentNode //Reference to 
Parent
NSMutableArray*  pNetworkChildArray //References to 
Children
NSMutableDictionary* pNetworkChildDict  
//References to Children

The important thing to remember is that a LTWNetworkNode in the above 
collections is only present *once*, e.g. all three collections refer to the 
SAME objective-C object.

I changed the  pNetworkParentNode back to “weak”.

Inside pNetworkArray and pNetworkDict is just one object that is referenced by 
both. This is the root object, as a test I made this a separate property inside 
my LTWNetwork (Root) Class added the necessary code to 
initWithCode/encodeObject/copyWithZone and tried it again, this time, instead 
of ALL of the parents being nil, MOST of them are. It looks like the first 
level of the Hierarchy has the correct parent, but deeper than that, the Parent 
is nil.

Here is the log:

Self Test Network: Level: 1 
Parent Address  : 0x198095f50
Parent LongID   : NT3312
Parent IndexPath: 000
 
Child Address: 0x19f449f50
Child Parent:  0x198095f50
Child LongID : NT3312/JY45
Child Address: 0x19f467f50
Child Parent:  0x198095f50
Child LongID : NT3312/JY688
 
-
Self Test Network: Level: 2 - Child Array
Parent Address  : 0x19f449f50
Parent LongID   : NT3312/JY45
Parent IndexPath: 000.000
 
Child Address: 0x19a076f50
Child Parent:  0x0
Child LongID : NT3312/JY45/TT327
selfTestNetwork - Error Child/Parent Mismatch - Error Count: 1
myLevelNumber: 2
Parent: NT3312/JY45
Child : NT3312/JY45/TT327
—

Does anyone have any idea how to solve this? I can’t believe its this difficult 
to save a self-referential archive and I can’t think what I could be doing 
wrong or how to begin to debug it. 

All the Best
Dave







___

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

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

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

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

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Dave

> On 5 Feb 2016, at 13:34, Jean-Daniel Dupas  wrote:
> 
> And obviously, you also add - encodeWithCoder: and -initWithCoder: methods in 
> your custom classes.

Yes, see my other thread, it decodes all the other fields but not the (weak) 
back links get set to nil most of the time…….
___

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

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

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

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

Re: mmap quiet failure - all reads are 0x00

2016-02-05 Thread Michael David Crawford
Perhaps it is a bug unrelated to mmap, that screws up some of your
state, then later it causes the mmap to fail.

Or perhaps the mmap succeeds, but the bytes your are reading are
coming from some other place.

There are many debugging techniques, such as using assertions, guard
malloc etc.  But don't just focus narrowly on the mmap itself.
Michael David Crawford, Baritone
mdcrawf...@gmail.com

  One Must Not Trifle With Wizards For It Makes Us Soggy And Hard To Light.


On Fri, Feb 5, 2016 at 4:36 PM, Jens Alfke  wrote:
>
>> On Feb 5, 2016, at 10:09 AM, Trygve Inda  wrote:
>>
>> It seems like no matter what is in the mmap file, when I read from it I get
>> 0x00 for every byte and no error or exception is generated. I can't
>> reproduce it as it is very random. Quitting and relaunching solves it.
>
> That sounds strange to me. I’m not an expert at mmap, but my understanding is 
> that if a page fault can’t be satisfied the memory access will fail with a 
> signal. You might ask on the darwin-userlevel list since this is really a 
> Unix-level question.
>
> —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:
> https://lists.apple.com/mailman/options/cocoa-dev/mdcrawford%40gmail.com
>
> This email sent to mdcrawf...@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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: mmap quiet failure - all reads are 0x00

2016-02-05 Thread Jens Alfke

> On Feb 5, 2016, at 10:09 AM, Trygve Inda  wrote:
> 
> It seems like no matter what is in the mmap file, when I read from it I get
> 0x00 for every byte and no error or exception is generated. I can't
> reproduce it as it is very random. Quitting and relaunching solves it.

That sounds strange to me. I’m not an expert at mmap, but my understanding is 
that if a page fault can’t be satisfied the memory access will fail with a 
signal. You might ask on the darwin-userlevel list since this is really a 
Unix-level question.

—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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Jens Alfke

> On Feb 5, 2016, at 9:00 AM, Dave  wrote:
> 
> self.pNetworkNodeChildArray = [[NSMutableArray alloc] initWithArray:myArray 
> copyItems:YES];
> 
> and that should be - copyItems:NO

Or just myArray.mutableCopy …

—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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: WebViews and the Java Plugin

2016-02-05 Thread Jens Alfke

> On Feb 5, 2016, at 5:02 AM, Sandor Szatmari  
> wrote:
> 
> Has anyone had any success running Java applets in a WebView?  

FYI, Java applets are being deprecated and developers are urged to stop using 
them:

"With modern browser vendors working to restrict and reduce plugin support in 
their products, developers of applications that rely on the Java browser plugin 
need to consider alternative options such as migrating from Java Applets (which 
rely on a browser plugin) to the plugin-free Java Web Start technology.
"Oracle plans to deprecate the Java browser plugin in JDK 9. This technology 
will be removed from the Oracle JDK and JRE in a future Java SE release."
— 
https://blogs.oracle.com/java-platform-group/entry/moving_to_a_plugin_free

—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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: WebViews and the Java Plugin

2016-02-05 Thread Sandor Szatmari
Jens, Thanks for the perspective here.  

On Feb 5, 2016, at 7:32 PM, Jens Alfke  wrote:

> 
>> On Feb 5, 2016, at 5:02 AM, Sandor Szatmari  
>> wrote:
>> 
>> Has anyone had any success running Java applets in a WebView?  
> 
> FYI, Java applets are being deprecated and developers are urged to stop using 
> them:

Keep in mind we are not developing or shipping applets.  We simply need to 
support loading applets in an in house app while third parties continue to only 
supply authorization and connectivity by means of applets.  I really wish we 
didn't have to support this functionality.

> 
> "With modern browser vendors working to restrict and reduce plugin support in 
> their products, developers of applications that rely on the Java browser 
> plugin need to consider alternative options such as migrating from Java 
> Applets (which rely on a browser plugin) to the plugin-free Java Web Start 
> technology.
> "Oracle plans to deprecate the Java browser plugin in JDK 9. This technology 
> will be removed from the Oracle JDK and JRE in a future Java SE release."
>   — 
> https://blogs.oracle.com/java-platform-group/entry/moving_to_a_plugin_free
> 
> —Jens

Do you have any ideas about what needs to be done to enable loading java 
applets in a WebView?

Sandor
___

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

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

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

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