Re: Cocoa-dev Digest, Vol 3, Issue 1136
Re: Cocoa-dev Digest, Vol 3, Issue 1136
- Subject: Re: Cocoa-dev Digest, Vol 3, Issue 1136
- From: Rob Campanaro <email@hidden>
- Date: Wed, 13 Sep 2006 14:03:30 -0400
- Thread-topic: Cocoa-dev Digest, Vol 3, Issue 1136
On 9/11/06 3:01 PM, "email@hidden"
<email@hidden> wrote:
> Send Cocoa-dev mailing list submissions to
> email@hidden
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.apple.com/mailman/listinfo/cocoa-dev
> or, via email, send a message with subject or body 'help' to
> email@hidden
>
> You can reach the person managing the list at
> email@hidden
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Cocoa-dev digest..."
>
>
> Today's Topics:
>
> 1. Re: Accept target when not first responder (Daniel Jalkut)
> 2. Re: "make positive" function (Shawn Erickson)
> 3. Re: "make positive" function (John Stiles)
> 4. Re: Unit testing core data (Chris Hanson)
> 5. Re: "make positive" function (Dado Colussi)
> 6. NSEditorRegistration - editor argument? (Jim Correia)
> 7. Re: Re: "make positive" function (Shawn Erickson)
> 8. Re: Re: clicking through (Michael Ash)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 11 Sep 2006 14:28:44 -0400
> From: Daniel Jalkut <email@hidden>
> Subject: Re: Accept target when not first responder
> To: Fredrik Olsson <email@hidden>
> Cc: Cocoa-dev <email@hidden>
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
>
> The view hierarchy ensures that key events only get delivered to
> responders in the responder chain. So you'll have to have some
> responder under your control (like a parent view or the window, or
> the application delegate) take responsibility for "catching" these
> key events and forwarding them artificially to your view.
>
> Daniel
>
> On Sep 11, 2006, at 4:22 AM, Fredrik Olsson wrote:
>
>> I have a subclass of NSOutlineView that I want to always accepts a
>> key equivalent, even when the outline view is not in focus.
>>
>>
>> I have tried settings it as the windows nextResponder, but that
>> does not help. And I would like to avoid using the window delegate
>> as proxy, only forwarding to the outline view.
>>
>>
>> My subclass is a helper view that manages file attachments, in my
>> document based application. I want the view to be as self contained
>> as possible, basically just using a root path, and xml tree for
>> reading it's content.
>>
>> Many document types can have this view, and I would like the attach
>> files, save attachments, and remove attachments menu items to hook
>> up themselves with as little redundant (copy and paste) code for
>> each document type as possible.
>>
>>
>> // Fredrik Olsson
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Cocoa-dev mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>> sweater.com
>>
>> This email sent to email@hidden
>
>
>
> ------------------------------
>
> Message: 2
> Date: Mon, 11 Sep 2006 11:34:23 -0700
> From: "Shawn Erickson" <email@hidden>
> Subject: Re: "make positive" function
> To: "Mike Abdullah" <email@hidden>
> Cc: email@hidden
> Message-ID:
> <email@hidden>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> On 9/11/06, Mike Abdullah <email@hidden> wrote:
>> I'm not a C expert, so apologies for this one:
>>
>> Basically, I want to take a double and get its closest positive
>> integer. I haven't been able to find anything that does what I want
>> (I have a feeling it might be a modulus?).
>>
>> Anyway, it seems to me I have 3 options:
>>
>> 1. There is an existing, simple function in C - if so can someone
>> tell me what it is ? :)
>
> man abs
> man round
> man ceil
> man floor
>
> ...or am I misunderstanding what you are asking for?
>
> -Shawn
>
>
> ------------------------------
>
> Message: 3
> Date: Mon, 11 Sep 2006 11:37:08 -0700
> From: John Stiles <email@hidden>
> Subject: Re: "make positive" function
> To: Mike Abdullah <email@hidden>
> Cc: email@hidden
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
>
> #include <math.h>
>
> void myFn()
> {
> //...
> double positiveValue = floor( abs(value) + 0.5f );
> }
>
> Modulus isn't what you want. Modulus in C doesn't even make things
> positive (which bugs me, but there is a workaround).
> I don't see that sqrt(x*x) will work; it will become positive but not
> integral. And it's waaaaay more work :)
>
>
> On Sep 11, 2006, at 11:28 AM, Mike Abdullah wrote:
>
>> I'm not a C expert, so apologies for this one:
>>
>> Basically, I want to take a double and get its closest positive
>> integer. I haven't been able to find anything that does what I
>> want (I have a feeling it might be a modulus?).
>>
>> Anyway, it seems to me I have 3 options:
>>
>> 1. There is an existing, simple function in C - if so can someone
>> tell me what it is ? :)
>>
>> 2. Do the incredibly clunky, square variable, find square root
>>
>> 3. Write my own function.
>>
>> Mike.
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Cocoa-dev mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>> 40blizzard.com
>>
>> This email sent to email@hidden
>
>
>
> ------------------------------
>
> Message: 4
> Date: Mon, 11 Sep 2006 11:39:49 -0700
> From: Chris Hanson <email@hidden>
> Subject: Re: Unit testing core data
> To: Julio Bianco <email@hidden>
> Cc: email@hidden
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
>
> On Sep 11, 2006, at 8:55 AM, Julio Bianco wrote:
>> I'm trying to perform some unit test over my application, but I
>> don't know how to test a core data model, I needed to test it at
>> the beginning, when I create a manager object model, when I start a
>> model, and when I perform a fetch, but I cannot find any
>> information on how to do it. I'm using the ocunit that provide me
>> xcode, and I follow some samples of how to create a test case set,
>> but I don't know how to continue.
>> If anybody can lead me on how to continue, I'll be thankful
>
> What exactly is it that you'd like to test? It's not clear to me
> from the above. Are you trying to do test-driven development of your
> data model, or are you trying to test that your managed object
> classes behave as you expect?
>
> I've written some entries on my blog about some ways to go about
> writing Core Data tests, as well as tests for Cocoa user interfaces
> and for declarative, connection-oriented functionality in general.
> Here are some links:
>
> Unit testing and Core Data
> http://chanson.livejournal.com/115621.html
>
> Trust, but verify.
> http://chanson.livejournal.com/118380.html
>
> Unit testing Cocoa user interfaces: Target-Action
> http://chanson.livejournal.com/148204.html
>
> Cocoa is very amenable to unit testing and test-driven development.
> You just need to determine the right way to approach it for what it
> is that you want to test.
>
> -- Chris
>
>
>
>
>
> ------------------------------
>
> Message: 5
> Date: Mon, 11 Sep 2006 20:43:02 +0200
> From: Dado Colussi <email@hidden>
> Subject: Re: "make positive" function
> To: Mike Abdullah <email@hidden>
> Cc: email@hidden
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
>
> On Sep 11, 2006, at 20:28, Mike Abdullah wrote:
>
>> Basically, I want to take a double and get its closest positive
>> integer. I haven't been able to find anything that does what I
>> want (I have a feeling it might be a modulus?).
>
>
> Would this do?
>
> long int
> closest_positive_integer(double x)
> {
> if (x < 1.0) {
> return 1L; // Smallest positive integer
> } else {
> return lrint(x);
> }
> }
>
>
>
>
>
>
>
> ------------------------------
>
> Message: 6
> Date: Mon, 11 Sep 2006 14:47:53 -0400
> From: Jim Correia <email@hidden>
> Subject: NSEditorRegistration - editor argument?
> To: Cocoa-dev dev <email@hidden>
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
>
> Is there anything one can assume about the "editor" passed to the
> methods in the NSEditorRegistration informal protocol?
>
> @interface NSObject (NSEditorRegistration)
> - (void)objectDidBeginEditing:(id)editor;
> - (void)objectDidEndEditing:(id)editor;
> @end
>
> Are they guaranteed to implement the methods in the NSEditor informal
> protocol?
>
> Anything else?
>
> Thanks,
> Jim
>
>
>
> ------------------------------
>
> Message: 7
> Date: Mon, 11 Sep 2006 11:48:38 -0700
> From: "Shawn Erickson" <email@hidden>
> Subject: Re: Re: "make positive" function
> To: "John Stiles" <email@hidden>
> Cc: email@hidden
> Message-ID:
> <email@hidden>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> On 9/11/06, John Stiles <email@hidden> wrote:
>> #include <math.h>
>>
>> void myFn()
>> {
>> //...
>> double positiveValue = floor( abs(value) + 0.5f );
>> }
>
> Likely meant fabs(value) in the above and not fully understanding what
> the OP wants... use of round may be more correct (not clear if he
> wants the closest greater than integer or just the closest integer).
>
> Also not clear if he wants an integer (int) at the end of this or
> not... which he can get from casting of course.
>
> -Shawn
>
>
> ------------------------------
>
> Message: 8
> Date: Mon, 11 Sep 2006 14:56:44 -0400
> From: "Michael Ash" <email@hidden>
> Subject: Re: Re: clicking through
> To: email@hidden
> Message-ID:
> <email@hidden>
> Content-Type: text/plain; charset=UTF-8; format=flowed
>
> On 9/11/06, Mailing list subscriptions <email@hidden> wrote:
>> El 11/09/2006, a las 18:29, Michael Ash escribió:
>>
>>>> Suggested course of action: file a bug report against the
>>>> documentation.
>>>
>>> Why? As far as I can tell, the documentation is *correct*. Overlapping
>>> views are supported in Cocoa, subject to the limitations outlined in
>>> the documentation. The documentation isn't what I'm worried about. My
>>> point is that everyone says "Cocoa doesn't support overlapping views",
>>> but neither the documentation nor the implementation seem to actually
>>> support this position.
>>
>> Scott Anguish is a respected author ("Cocoa Programming", http://
>> www.cocoaprogramming.net/), was one (and maybe still is) one of the
>> key people behind Stepwise (http://stepwise.com/), has been a Mac
>> developer for the last 22 years, and a NeXT developer since 1992.
>> Most importantly of all, he works for Apple as a Senior Technical
>> Writer in their Cocoa & Xcode Tools group (bio: http://
>> conferences.oreillynet.com/cs/macosx2004/view/e_spkr/1322).
>
> Thank you, but I already know who he is.
>
>> He just
>> quoted a section from Apple's documentation that says:
>>
>> "Cocoa does not enforce clipping among sibling views or guarantee
>> correct invalidation and drawing behavior when sibling views overlap.
>> If you want a view to be drawn in front of another view, you should
>> make the front view a subview (or descendant) of the rear view."
>
> And you'll notice that I quoted that exact same section in my own
> e-mail as well.
>
>> Without getting bogged down in the semantics of the word, "should",
>> this seems clear enough to me; NSView was not designed to support
>> overlapping views, other than the subview-superview case. Just
>> because it's possible to hack around this doesn't mean that it's
>> "supported".
>
> And there we differ. If something is not supported, it should say so.
> If the docs say that something is supported but you shouldn't do it,
> then in my mind it is supported, no matter how famous the guy is
> that's saying it's not.
>
>> As I said in my last email, if you think it's the documentation is
>> not clear enough then file a bug report against the documentation.
>
> And again, I think the documentation is perfectly clear. I just don't
> see where it supports the conclusion that everyone draws.
>
>> Trying to prove that you're right on this list won't help.
>
> It certainly might help. There are several possible helpful outcomes
> to this discussion:
>
> 1) Somebody shows me a place in the docs where it really does state
> that this is actually unsupported. I realize I've been wrong, and
> write better code because of it.
>
> 2) At some point it is decided that this really is unsupported but the
> documentation is unclear. The docs get fixed and this discussion is
> archived for anyone who has similar questions.
>
> 3) It somehow turns out that I'm right and it's supported with
> caveats, in which case more people know this than before.
>
> I'm not trying to "prove I'm right", I'm just trying to get a clear
> answer on an issue that I believe to be adequately documented, but in
> which the common wisdom is directly contrary. If this process involves
> contradicting people who have written famous books and have more
> experience than I do, then so be it.
>
> Mike
>
> ------------------------------
>
> _______________________________________________
> Cocoa-dev mailing list
> email@hidden
> http://lists.apple.com/mailman/listinfo/cocoa-dev
>
> End of Cocoa-dev Digest, Vol 3, Issue 1136
> ******************************************
--
Rob Campanaro
265 Thia Court
Coatesville, PA 19320
610-350-9968
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden