Re: Problem using NSView's scrollRect:by:

2017-01-25 Thread Quincey Morris
On Jan 25, 2017, at 22:59 , Tae Won Ha  wrote:
> 
> I've read the documentation, but I thought that to "just" copy a potion of 
> the NSView's content to somewhere else inside the view, you don't have to do 
> the second and third part. And I did not quite understand the second part in 
> the doc.: what does it mean to change the origin of the view? Why do I "have 
> to" do it? Does it mean that scrollRect:by: only works if the view is somehow 
> embedded in a container view which "acts" like an NSScrollView?

Your “draw” method draws a red rectangle at the view origin (by default, at the 
top left of the view or the bottom left, depending on whether the coordinate 
system is flipped). That means, it’s always going to be drawn in the same 
place, from the user’s point of view.

What you want, presumably, is for the red rectangle to appear to move up or 
down when the view is scrolled. To get that effect, you must either draw it at 
a different place — at different view coordinates — or move the view origin to 
where you want the rectangle to draw.

There’s yet something else going on here, because you should at least see some 
of the red rectangle get redrawn in a different part of the view. Since the 
view doesn’t appear to change at all, that suggests:

— something is setting “needsDisplay” for the entire view, which causes your 
draw method to redraw the original view, wiping out the effect of the scroll 
method

— you might be using the scroll method to copy in the wrong direction, so that 
your copied bits are somewhere outside the visible portion of the view

You’re going to have to experiment to narrow down what’s wrong.


___

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

Please do not post 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: Overriding the release mehod

2017-01-25 Thread Jonathan Hull
One of my favorite things about this list is that the standard response to a 
question is to ask about the underlying motivation.  It shows that they are 
prepared to think deeply about your problem and don’t want to just give you a 
cookie cutter answer.  One of the main signs of an intelligent person in my 
mind :-)

Thanks,
Jon

> On Jan 25, 2017, at 3:38 PM, Greg Parker  wrote:
> 
> What Are You Trying To Do™ is in fact precisely the correct response to your 
> question. Some overrides of -release need to call [super release]. Others do 
> not. It depends on … what they are trying to do.
> 
> Overriding release to unregister an observer is almost certainly a bad idea, 
> but yes, such an override ought to call [super release] if the object is 
> expected to be retained and released and deallocated normally. 
> 
> 
> -- 
> Greg Parker gpar...@apple.com  Runtime 
> Wrangler
> 
> 
>> On Jan 25, 2017, at 8:23 AM, Dave  wrote:
>> 
>> I hate it when people as that question! There are some memory leaks in a 3rd 
>> party package. It overrides release to unregister an observer but doesn’t 
>> call super. If I call super the leaks go away and all is well. I just want 
>> to know where is it documented really, I can’t find it searching the docs.
>> 
>> Cheers
>> Dave
>> 
>>> On 25 Jan 2017, at 15:55, Mike Abdullah  wrote:
>>> 
>>> You’re inevitably going to get asked this:
>>> Why on earth are you overriding release? It’s an incredibly niche thing to 
>>> do, and the answer probably depends a lot on why you’re overriding it.
>>> 
 On 25 Jan 2017, at 16:52, Dave  wrote:
 
 Hi,
 
 Does [suoer release] need to be called if you override this method? I’m 
 99.9% sure it does, but I can’t find it anywhere it actually says it 
 in black and white.
 
 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/jhull%40gbis.com
> 
> This email sent to jh...@gbis.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: Problem using NSView's scrollRect:by:

2017-01-25 Thread Quincey Morris
On Jan 25, 2017, at 14:13 , Tae Won Ha  wrote:
> 
> What I expected was that the red box at the bottom left corner gets
> 'copied' to the point (100, 100) when I invoke the triggerScroll action.
> However nothing happens. What am I doing wrong?

At the very least, you aren’t doing what the scroll(rect:by:)) method 
description tells you to do:

developer.apple.com/reference/appkit/nsview/1483497-scroll 


You also need to change the view’s origin to reflect the scroll, and you need 
to use one of the “needsDisplay” methods to indicate the area(s) invalidated by 
the scroll.

Is there anything to discuss about why you “cannot use” NSScrollView? The 
existing functionality would make life a lot easier for 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Overriding the release mehod

2017-01-25 Thread Greg Parker
What Are You Trying To Do™ is in fact precisely the correct response to your 
question. Some overrides of -release need to call [super release]. Others do 
not. It depends on … what they are trying to do.

Overriding release to unregister an observer is almost certainly a bad idea, 
but yes, such an override ought to call [super release] if the object is 
expected to be retained and released and deallocated normally. 


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


> On Jan 25, 2017, at 8:23 AM, Dave  wrote:
> 
> I hate it when people as that question! There are some memory leaks in a 3rd 
> party package. It overrides release to unregister an observer but doesn’t 
> call super. If I call super the leaks go away and all is well. I just want to 
> know where is it documented really, I can’t find it searching the docs.
> 
> Cheers
> Dave
> 
>> On 25 Jan 2017, at 15:55, Mike Abdullah  wrote:
>> 
>> You’re inevitably going to get asked this:
>> Why on earth are you overriding release? It’s an incredibly niche thing to 
>> do, and the answer probably depends a lot on why you’re overriding it.
>> 
>>> On 25 Jan 2017, at 16:52, Dave  wrote:
>>> 
>>> Hi,
>>> 
>>> Does [suoer release] need to be called if you override this method? I’m 
>>> 99.9% sure it does, but I can’t find it anywhere it actually says it in 
>>> black and white.
>>> 
>>> 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

Problem using NSView's scrollRect:by:

2017-01-25 Thread Tae Won Ha
Hi guys.

I'm trying to implement a view that has scroll functionality by itself,
since I cannot use an NSScrollView. I think that NSView's scrollRect:by:
is probably the way to go, but how can I use it? I tried the following
(in a freshly created Xcode project):

AppDelegate.swift:

--- >8 ---
import Cocoa

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {

  @IBOutlet weak var window: NSWindow!

  fileprivate let testView = TestView(frame: CGRect(x: 0, y: 0, width:
400, height: 400))

  // This is invoked by a menu item created and linked in the xib file.
  @IBAction func triggerScroll(_: Any) {
self.testView.scroll(CGRect(x: 0, y: 0, width: 50, height: 50), by:
CGSize(width: 100, height: 100))
  }

  func applicationDidFinishLaunching(_: Notification) {
self.window.contentView?.addSubview(self.testView)
  }
}

class TestView: NSView {

  override func draw(_ dirtyRect: NSRect) {
NSColor.red.set()
NSRectFill(CGRect(x: 0, y: 0, width: 50, height: 50))
  }
}
--- 8< ---

What I expected was that the red box at the bottom left corner gets
'copied' to the point (100, 100) when I invoke the triggerScroll action.
However nothing happens. What am I doing wrong?

Thanks in advance and best,
Tae

PS. Other possible solution seems to be to use a CGBitmapContext to draw
stuff into it and, when scrolling, to draw a clipped version of it at
the right location, but it seems to be a quite overkill (if the above
would 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/archive%40mail-archive.com

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


[off-topic] Re: Overriding the release mehod

2017-01-25 Thread Doug Hill

> On Jan 25, 2017, at 11:56 AM, Dave  wrote:
> 
> 
>> On 25 Jan 2017, at 19:37, Doug Hill  wrote:
>> 
>> 
>>> On Jan 25, 2017, at 11:23 AM, Dave >> > wrote:
>>> 
>>> I also tried searching “release method documentation” but nada!
>> 
>> I hear you about the search functionality of Apple's developer 
>> documentation. They definitely need a better search engine for documentation 
>> in both Xcode and the developer website as finding things can be iffy at 
>> best. They seem to suffer from what I call the 'Dictionary Problem.' You 
>> can't find the spelling of a word in a dictionary unless you already roughly 
>> know the spelling. Similarly,  you can't find anything in Apple's 
>> documentation unless you roughly know where it is.
>> 
>> A couple of recommendations:
>> 
>> 1. Use Google search to search developer.apple.com 
>> 
>> 
>> For example, searching for 'nsobject release' returns the protocol it's 
>> defined as the first result, the method documentation as the second.
>> 
>> 2. Feel free to encourage Apple to improve their search functionality
> 
> it used to work much better, then Apple “improved it” and now it is as it is. 
> One can only assume they changed it for good reason so why moan about it to 
> them. I’ve largely found it a complete waste of time, once Apple decide to 
> “improve” something then it is automatically better in their eyes and no 
> amount of logic or use (or lack of use) cases can change their minds. Just 
> look at XCode code in general…… They probably don’t have the resources to do 
> it properly any more as they are spending their money on teams of accountants 
> to research tax dodging….. 
> 
> All the Best
> Dave

This is starting to go off topic, and we want to avoid getting into personal 
attacks on this list but… I suspect if every developer complained to Apple 
about problems, things would probably change pretty quickly. Apple indeed has 
limited resources and has to devote them to maximum benefit. If developers are 
consistently having problems, telling Apple gets those problems higher priority.

Anyways, feel free to respond off-list.

Doug Hill



___

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

Please do not post 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: Overriding the release mehod

2017-01-25 Thread Dave

> On 25 Jan 2017, at 19:37, Doug Hill  wrote:
> 
> 
>> On Jan 25, 2017, at 11:23 AM, Dave > > wrote:
>> 
>> I also tried searching “release method documentation” but nada!
> 
> I hear you about the search functionality of Apple's developer documentation. 
> They definitely need a better search engine for documentation in both Xcode 
> and the developer website as finding things can be iffy at best. They seem to 
> suffer from what I call the 'Dictionary Problem.' You can't find the spelling 
> of a word in a dictionary unless you already roughly know the spelling. 
> Similarly,  you can't find anything in Apple's documentation unless you 
> roughly know where it is.
> 
> A couple of recommendations:
> 
> 1. Use Google search to search developer.apple.com 
> 
> 
> For example, searching for 'nsobject release' returns the protocol it's 
> defined as the first result, the method documentation as the second.
> 
> 2. Feel free to encourage Apple to improve their search functionality

it used to work much better, then Apple “improved it” and now it is as it is. 
One can only assume they changed it for good reason so why moan about it to 
them. I’ve largely found it a complete waste of time, once Apple decide to 
“improve” something then it is automatically better in their eyes and no amount 
of logic or use (or lack of use) cases can change their minds. Just look at 
XCode code in general…… They probably don’t have the resources to do it 
properly any more as they are spending their money on teams of accountants to 
research tax dodging….. 

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: Overriding the release mehod

2017-01-25 Thread Doug Hill

> On Jan 25, 2017, at 11:23 AM, Dave  wrote:
> 
> I also tried searching “release method documentation” but nada!

I hear you about the search functionality of Apple's developer documentation. 
They definitely need a better search engine for documentation in both Xcode and 
the developer website as finding things can be iffy at best. They seem to 
suffer from what I call the 'Dictionary Problem.' You can't find the spelling 
of a word in a dictionary unless you already roughly know the spelling. 
Similarly,  you can't find anything in Apple's documentation unless you roughly 
know where it is.

A couple of recommendations:

1. Use Google search to search developer.apple.com 

For example, searching for 'nsobject release' returns the protocol it's defined 
as the first result, the method documentation as the second.

2. Feel free to encourage Apple to improve their search functionality

Cheers!

Doug Hill
___

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

Please do not post 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: Overriding the release mehod

2017-01-25 Thread Dave
I also tried searching “release method documentation” but nada!


___

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

Please do not post 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: Overriding the release mehod

2017-01-25 Thread Dave
Cheers, I tried searching “release method definition” but that doesn’t bring it 
up - go figure!

All the Best
Dave

> On 25 Jan 2017, at 19:04, Doug Hill  wrote:
> 
> 
>> On Jan 25, 2017, at 10:59 AM, Dave > > wrote:
>> 
>> Hi,
>> 
>>> Look at Apple's Foundation NSObject protocol reference document for the 
>>> -release method. It includes this statement:
>> 
>> Could you point me to the URL I still can’t find it. Apple’s documentation 
>> is absolutely shocking! I’m looking at 
>> https://developer.apple.com/reference/objectivec/protocol?language=objc 
>>  
>> but no mention of release to be found?
>> 
>> All the Best
>> Dave
> 
> https://developer.apple.com/reference/objectivec/1418956-nsobject?language=objc
>  
> 
> 
> release - Decrements the receiver’s reference count.
> 
> Language - Objective-C
> 
> Declaration
> 
> - (oneway void)release;
> 
> Discussion
> 
> The receiver is sent a dealloc message when its reference count reaches 0.
> 
> You would only implement this method to define your own reference-counting 
> scheme. Such implementations should not invoke the inherited method; that is, 
> they should not include a release message to super.

___

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

Please do not post 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: Overriding the release mehod

2017-01-25 Thread Doug Hill

> On Jan 25, 2017, at 10:59 AM, Dave  wrote:
> 
> Hi,
> 
>> Look at Apple's Foundation NSObject protocol reference document for the 
>> -release method. It includes this statement:
> 
> Could you point me to the URL I still can’t find it. Apple’s documentation is 
> absolutely shocking! I’m looking at 
> https://developer.apple.com/reference/objectivec/protocol?language=objc but 
> no mention of release to be found?
> 
> All the Best
> Dave

https://developer.apple.com/reference/objectivec/1418956-nsobject?language=objc 


release - Decrements the receiver’s reference count.

Language - Objective-C

Declaration

- (oneway void)release;

Discussion

The receiver is sent a dealloc message when its reference count reaches 0.

You would only implement this method to define your own reference-counting 
scheme. Such implementations should not invoke the inherited method; that is, 
they should not include a release message to super.
___

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

Please do not post 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: Overriding the release mehod

2017-01-25 Thread Dave
Hi,

> Look at Apple's Foundation NSObject protocol reference document for the 
> -release method. It includes this statement:

Could you point me to the URL I still can’t find it. Apple’s documentation is 
absolutely shocking! I’m looking at 
https://developer.apple.com/reference/objectivec/protocol?language=objc but no 
mention of release to be found?

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: Overriding the release mehod

2017-01-25 Thread Dave
Hi,

Yes, I understand that, but really, I just wanted to know where it was written 
in black and white and I couldn’t find it by searching. I could have worked out 
where it was necessary to override release myself, I just wanted to know the 
effect of calling it and not calling it. Asking why I am doing it assumes that 
is it a) my code I am talking about, b) that I am intending to add it as new 
code, c) that I don’t know what I’m doing as I said I was 99.999% sure that 
it needed to be called in this case but wanted to see it in black and while.

All the Best
Dave

> On 25 Jan 2017, at 16:57, Greg Weston  wrote:
> 
> Dave wrote:
> 
>> I hate it when people ask [why are you doing X]!
> 
> Decades of experience seeing such questions make us think that when someone 
> is asking how to do something extraordinary there's about 99% chance they 
> don't actually need to do it and are making things harder for themselves. 
> Sometimes the best answer to "How do I do X?" is "You don't. Do Y instead." 
> If someone is trying to give the best answer they may need to know what the 
> asker is really trying to accomplish.
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post 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/dave%40looktowindward.com
> 
> This email sent to d...@looktowindward.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: Overriding the release mehod

2017-01-25 Thread Dave

> On 25 Jan 2017, at 16:48, Bill Cheeseman  wrote:
> 
> 
>> On Jan 25, 2017, at 11:23 AM, Dave > > wrote:
>> 
>> I hate it when people as that question! There are some memory leaks in a 3rd 
>> party package. It overrides release to unregister an observer but doesn’t 
>> call super. If I call super the leaks go away and all is well. I just want 
>> to know where is it documented really, I can’t find it searching the docs.
> 
> 
> Look at Apple's Foundation NSObject protocol reference document for the 
> -release method. It includes this statement:
> 
> "You would only implement this method to define your own reference-counting 
> scheme. Such implementations should not invoke the inherited method; that is, 
> they should not include a release message to super."
> 
> My framework does NOT define its own reference-counting scheme, within the 
> meaning of that quotation. Instead, my framework overrides -release for the 
> SOLE PURPOSE of unregistering an observer the last time a standard -release 
> is called on the given object -- that is, when the separately maintained 
> weakRetainCount reaches the specified value. In all other respects, my 
> framework relies on the -release method to do what it always does.
> 
> Therefore, it IS in fact necessary to include [super release] at the end of 
> the override.

Ok, I was looking in NSObject! 

Yes, I thought so, it occurred to me that I’ve seen instances where singletons 
override release so the (one) version of the object never gets release which is 
what I assume that document means by "your own reference-counting scheme”. I 
never implement singletons that way, preferring to use a factory class that 
allows N of each object to be created and just set N to 1.

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: Overriding the release mehod

2017-01-25 Thread Greg Weston
Dave wrote:

> I hate it when people ask [why are you doing X]!

Decades of experience seeing such questions make us think that when someone is 
asking how to do something extraordinary there's about 99% chance they don't 
actually need to do it and are making things harder for themselves. Sometimes 
the best answer to "How do I do X?" is "You don't. Do Y instead." If someone is 
trying to give the best answer they may need to know what the asker is really 
trying to accomplish.
___

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

Please do not post 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: Overriding the release mehod

2017-01-25 Thread Bill Cheeseman

> On Jan 25, 2017, at 11:23 AM, Dave  wrote:
> 
> I hate it when people as that question! There are some memory leaks in a 3rd 
> party package. It overrides release to unregister an observer but doesn’t 
> call super. If I call super the leaks go away and all is well. I just want to 
> know where is it documented really, I can’t find it searching the docs.


Look at Apple's Foundation NSObject protocol reference document for the 
-release method. It includes this statement:

"You would only implement this method to define your own reference-counting 
scheme. Such implementations should not invoke the inherited method; that is, 
they should not include a release message to super."

My framework does NOT define its own reference-counting scheme, within the 
meaning of that quotation. Instead, my framework overrides -release for the 
SOLE PURPOSE of unregistering an observer the last time a standard -release is 
called on the given object -- that is, when the separately maintained 
weakRetainCount reaches the specified value. In all other respects, my 
framework relies on the -release method to do what it always does.

Therefore, it IS in fact necessary to include [super release] at the end of the 
override.

-- 

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

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

Re: Overriding the release mehod

2017-01-25 Thread Dave
I hate it when people as that question! There are some memory leaks in a 3rd 
party package. It overrides release to unregister an observer but doesn’t call 
super. If I call super the leaks go away and all is well. I just want to know 
where is it documented really, I can’t find it searching the docs.

Cheers
Dave

> On 25 Jan 2017, at 15:55, Mike Abdullah  wrote:
> 
> You’re inevitably going to get asked this:
> Why on earth are you overriding release? It’s an incredibly niche thing to 
> do, and the answer probably depends a lot on why you’re overriding it.
> 
>> On 25 Jan 2017, at 16:52, Dave  wrote:
>> 
>> Hi,
>> 
>> Does [suoer release] need to be called if you override this method? I’m 
>> 99.9% sure it does, but I can’t find it anywhere it actually says it in 
>> black and white.
>> 
>> 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/mabdullah%40karelia.com
>> 
>> This email sent to mabdul...@karelia.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: Overriding the release mehod

2017-01-25 Thread Bill Cheeseman
Dave is working with a framework I wrote, which makes use of OmniGroup's "weak 
retain" concept from many years ago. See Ken Case's writeup at 
https://github.com/jnozzi/cocoadev.com/blob/888a4ffa2ab233762728d5e2f23c18a83feb3a6e/markdown/WeakReferences.md
 


There are more modern ways to do this now, but my framework has to work with 
older versions of macOS.

In my framework, the "weak retain" stuff is used in the context of an 
accessibility API observer that watches for the destruction of an accessibility 
API user interface element. This is a context where circular retain counts must 
be dealt with.

Bill

> On Jan 25, 2017, at 10:55 AM, Mike Abdullah  > wrote:
> 
> You’re inevitably going to get asked this:
> Why on earth are you overriding release? It’s an incredibly niche thing to 
> do, and the answer probably depends a lot on why you’re overriding it.

-- 

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

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

Re: Overriding the release mehod

2017-01-25 Thread Mike Abdullah
You’re inevitably going to get asked this:
Why on earth are you overriding release? It’s an incredibly niche thing to do, 
and the answer probably depends a lot on why you’re overriding it.

> On 25 Jan 2017, at 16:52, Dave  wrote:
> 
> Hi,
> 
> Does [suoer release] need to be called if you override this method? I’m 
> 99.9% sure it does, but I can’t find it anywhere it actually says it in 
> black and white.
> 
> 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/mabdullah%40karelia.com
> 
> This email sent to mabdul...@karelia.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

Overriding the release mehod

2017-01-25 Thread Dave
Hi,

Does [suoer release] need to be called if you override this method? I’m 
99.9% sure it does, but I can’t find it anywhere it actually says it in 
black and white.

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: PDF to Word ( docx) Conversion

2017-01-25 Thread Peter Hudson
Interesting insight. 
Thanks Charles. 


> On 25 Jan 2017, at 12:39, Charles Jenkins  wrote:
> 
> Just my two cents, but I find .RTF way more arcane than .DOCX, and I don’t 
> think Apple’s exporters for .RTF and .DOC produce high-quality documents. If 
> users are only going to read the documents you produce—they will not be 
> edited or reformatted in any way—then Apple-generated .RTFD (which can 
> include graphics) is probably okay. But if you’re producing something 
> intended to be edited or formatted for publishing, you should seriously 
> consider .DOCX, because with it you can easily define and export powerful 
> styles. I mean, you could also create high-quality .DOC files, but you’d have 
> to use an external package to do it, not the functions Apple provides.
> 
>> On Tue, Jan 24, 2017 at 3:58 PM, Peter Hudson  wrote:
>> Hi Jens
>> 
>> I wondered about RTF - but I've built everything into a view and I can't see 
>> a method on NSView to produce rtf.
>> I've done it previously with, I think, an NSText.
>> 
>> Peter
>> 
>> > On 24 Jan 2017, at 20:27, Jens Alfke  wrote:
>> >
>> >
>> >> On Jan 24, 2017, at 11:54 AM, Peter Hudson  wrote:
>> >>
>> >> But the bottom line is, I think, to get a Word doc that really behaves 
>> >> like a
>> >> Word doc ( in word ) I need to export straight to docx format.
>> >
>> > Have you tried exporting to RTF? It’s a simple text-based markup format, 
>> > and imports well into Word. (In fact Microsoft invented RTF back in the 
>> > ‘80s as an interchange format for Word.)
>> >
>> > —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/cejwork%40gmail.com
>> 
>> This email sent to cejw...@gmail.com
> 
> 
> 
> -- 
> 
> 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: PDF to Word ( docx) Conversion

2017-01-25 Thread Charles Jenkins
Just my two cents, but I find .RTF way more arcane than .DOCX, and I don’t
think Apple’s exporters for .RTF and .DOC produce high-quality documents.
If users are only going to read the documents you produce—they will not be
edited or reformatted in any way—then Apple-generated .RTFD (which can
include graphics) is probably okay. But if you’re producing something
intended to be edited or formatted for publishing, you should seriously
consider .DOCX, because with it you can easily define and export powerful
styles. I mean, you could also create high-quality .DOC files, but you’d
have to use an external package to do it, not the functions Apple provides.

On Tue, Jan 24, 2017 at 3:58 PM, Peter Hudson  wrote:

> Hi Jens
>
> I wondered about RTF - but I've built everything into a view and I can't
> see a method on NSView to produce rtf.
> I've done it previously with, I think, an NSText.
>
> Peter
>
> > On 24 Jan 2017, at 20:27, Jens Alfke  wrote:
> >
> >
> >> On Jan 24, 2017, at 11:54 AM, Peter Hudson  wrote:
> >>
> >> But the bottom line is, I think, to get a Word doc that really behaves
> like a
> >> Word doc ( in word ) I need to export straight to docx format.
> >
> > Have you tried exporting to RTF? It’s a simple text-based markup format,
> and imports well into Word. (In fact Microsoft invented RTF back in the
> ‘80s as an interchange format for Word.)
> >
> > —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/cejwork%40gmail.com
>
> This email sent to cejw...@gmail.com
>



-- 

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

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