Re: Avoiding mutual retain cycles

2008-07-21 Thread Markus Spoettl

On Jul 21, 2008, at 11:20 PM, Quincey Morris wrote:
Call me a retro coward, but I absolutely dislike the idea of GC. I  
just don't see the point of it given the complicated implications  
it can have.


But I hope you do see the irony of that last statement, in the  
context of this thread.



I knew this would backfire when I wrote it. What I meant to say was  
that you give up a lot of control over the inner workings of your  
application with GC and I don't like that idea too much. Just don't.


Anyway, it's great to have choices, so everyone can use what they  
think suits them best.


Markus
--
__
Markus Spoettl



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Avoiding mutual retain cycles

2008-07-21 Thread Quincey Morris

On Jul 21, 2008, at 20:27, Markus Spoettl wrote:

Call me a retro coward, but I absolutely dislike the idea of GC. I  
just don't see the point of it given the complicated implications it  
can have.


But I hope you do see the irony of that last statement, in the context  
of this thread.


FWIW, I have nothing bad to say about writing non-gc apps, or about  
anyone who writes non-gc apps, except that you couldn't pay me to go  
back to doing it. :)



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: passing argument 1 of 'stringWithFormat:' makes pointer from integer without a cast [SOLVED]

2008-07-21 Thread Michael Swan

Aron & Ken,
Yes thank you both that has been driving me crazy mostly because I  
knew it was something stupid like that.


Thank you,
Mike Swan

"Change itself is not painful it is resistance to change that causes  
pain."

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: passing argument 1 of 'stringWithFormat:' makes pointer from integer without a cast

2008-07-21 Thread Ken Ferry
The parentheses are not correct in that position.

You're using the C comma operator
(http://www.eskimo.com/~scs/cclass/int/sx4db.html) and passing one
argument to stringWithFormat:, which is the count of the array.  That
isn't a pointer.

-Ken

On Mon, Jul 21, 2008 at 9:23 PM, Michael Swan <[EMAIL PROTECTED]> wrote:
> So I have done the standard Google search and clean all targets but neither
> has helped. I have the following two lines of code:
>
>NSLog(@"array count = %i",[array count]); // This works just
> fine
>NSString *string = [NSString stringWithFormat:(@"array count
> = %i", [array count])]; // This gives the warning "passing argument 1 of
> 'stringWithFormat:' makes pointer from integer without a cast"
>
>
> Has something happened to NSString to mess it up or am I just missing
> something really obvious here?
>
> Thanks,
> Mike Swan
>
> "Change itself is not painful it is resistance to change that causes pain."
>
>
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/kenferry%40gmail.com
>
> This email sent to [EMAIL PROTECTED]
>
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: passing argument 1 of 'stringWithFormat:' makes pointer from integer without a cast

2008-07-21 Thread Aron Nopanen
I think the parens around the argument to stringWithFormat: are  
causing the compiler to interpret the comma as a C comma operator,  
which means the result of the first expression (your format string) is  
ignored, and the result of the second expression ([array count]) is  
treated as the result of the parenthesized expression.


In other words, remove the parens.

On 22/07/2008, at 4:23 PM, Michael Swan wrote:

So I have done the standard Google search and clean all targets but  
neither has helped. I have the following two lines of code:


NSLog(@"array count = %i",[array count]); // This works just 
fine
		NSString *string = [NSString stringWithFormat:(@"array count =  
%i", [array count])]; // This gives the warning "passing argument 1  
of 'stringWithFormat:' makes pointer from integer without a cast"



Has something happened to NSString to mess it up or am I just  
missing something really obvious here?


Thanks,
Mike Swan

"Change itself is not painful it is resistance to change that causes  
pain."




___

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

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

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

This email sent to [EMAIL PROTECTED]




smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

passing argument 1 of 'stringWithFormat:' makes pointer from integer without a cast

2008-07-21 Thread Michael Swan
So I have done the standard Google search and clean all targets but  
neither has helped. I have the following two lines of code:


NSLog(@"array count = %i",[array count]); // This works just 
fine
		NSString *string = [NSString stringWithFormat:(@"array count = %i",  
[array count])]; // This gives the warning "passing argument 1 of  
'stringWithFormat:' makes pointer from integer without a cast"



Has something happened to NSString to mess it up or am I just missing  
something really obvious here?


Thanks,
Mike Swan

"Change itself is not painful it is resistance to change that causes  
pain."




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Avoiding mutual retain cycles

2008-07-21 Thread Marcel Weiher


On Jul 21, 2008, at 13:03 , Philippe Mougin wrote:

Le 21 juil. 08 à 20:50, Markus Spoettl a écrit :


I'm wondering if there is a general rule or mechanism that suggests  
what to do in such a case. For instance, how are delegates  
implemented in AppKit, are they retained? If so, when are they  
released. It can't be in -dealloc, otherwise everything would lock  
itself out of deallocation?


In the general case, there is no rule or mechanism to deal with  
retain cycles other than implementing something equivalent to a  
garbage collector. In some situations, however, the specific  
semantics and life-cycle of the objects you are dealing with allow  
implementing more simpler, ad hoc solutions (e.g., ownership  
management in the view hierarchy). Still, this requires notable  
housekeeping efforts and is often error prone. If you are in a  
situation where you can make use of Cocoa's garbage collector, you  
should go for it. It will free you from a bunch of low-level memory  
management tasks, including having to care about cyclic references.


http://portal.acm.org/citation.cfm?id=1035292.1028982

"Tracing and reference counting are uniformly viewed as being  
fundamentally different approaches to garbage collection that possess  
very distinct performance properties. We have implemented high- 
performance collectors of both types, and in the process observed that  
the more we optimized them, the more similarly they behaved - that  
they seem to share some deep structure.
We present a formulation of the two algorithms that shows that they  
are in fact duals of each other. Intuitively, the difference is that  
tracing operates on live objects, or "matter", while reference  
counting operates on dead objects, or "anti-matter". For every  
operation performed by the tracing collector, there is a precisely  
corresponding anti-operation performed by the reference counting  
collector.


Using this framework, we show that all high-performance collectors  
(for example, deferred reference counting and generational collection)  
are in fact hybrids of tracing and reference counting. We develop a  
uniform cost-model for the collectors to quantify the trade-offs that  
result from choosing different hybridizations of tracing and reference  
counting. This allows the correct scheme to be selected based on  
system performance requirements and the expected properties of the  
target application."



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Avoiding mutual retain cycles

2008-07-21 Thread Markus Spoettl

On Jul 21, 2008, at 7:49 PM, Andreas Mayer wrote:
I don't know why you'd think the collection view might own the  
item's view. You set the view for the view item, so the hierarchy  
seems to be quite clear. (The collection view *might* retain the  
view too. That's an implementation detail.)


Well that's exactly what is important here, isn't it.

How would you get a retain cycle here? You just hold on to the  
collection view. Everything else should not be your responsibility.


Unless you have to have access to the collection view or the view's  
item controller.


If you set something, it's usually retained. Exceptions from this  
norm should certainly be documented - like it is with delegates.



That basically answers the original question I had, but things can get  
complicated and details become important.


Regards
Markus
--
__
Markus Spoettl



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Avoiding mutual retain cycles

2008-07-21 Thread Michael Ash
On Mon, Jul 21, 2008 at 11:24 PM, Markus Spoettl
<[EMAIL PROTECTED]> wrote:
> On Jul 21, 2008, at 7:23 PM, Michael Ash wrote:
>>
>> Without investigating things more deeply, just from the basic stuff I
>> know about the classes in question, I'd assume that the
>> NSCollectionView owns the NSCollectionViewItems and the views, and the
>> NSCollectionViewItems would also own the views. Where is the retain
>> cycle?
>
>
> Well there is none in the default setup, of course. But here's a non
> far-fetched example to easily create one.
>
> If you're implementing a custom NSView that for some reason has to have
> access to the NSCollectionViewItem or NSCollectionView it belongs to, the
> only proper way to do so (in the collection view world) is by accessing the
> NSCollectionViewItem which has a -collectionView method that returns the
> collection view.
>
> So you need a way back and this you do with a pointer to the
> NSCollectionViewItem in a suitable place. As you don't know the ownership
> circumstances of NSCollectionViewItem and its view the safest thing to do is
> to retain the NSCollectionViewItem in the view. There's the retain cycle,
> because - as it turns out - the NSCollectionViewItem seems to retain the
> view.
>
> The point of all this is not that it's avoided easily - which it is. The
> point is that you can't know the circumstances unless it's documented and
> the original question was how AppKit does avoid things like that.

I guess I misunderstood, I thought you meant that there was already a
cycle there, or at least that it appeared to have one.

I agree that it's not necessarily immediately obvious. But if you
think about it, it should become clear. The NSCollectionViewItem has
to stick around somehow, so that things can access its
representedObject, use it as a target for controls, etc. Therefore
something in there has to be hanging onto it already, which means you
don't have to (and probably shouldn't, because you might make a cycle,
as you've seen). So it does require some thought, but I believe the
necessary information is there if you dig.

> Now that I read more on retain cycles it's clear there is no ingenious Cocoa
> solution to this problem, just plain old defensive programming techniques -
> which is what I was wondering about.

Well, clearly defined ownership helps a lot, but you're right, there's
no special sauce to fix it.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


linking NSArrayController and Undo manager

2008-07-21 Thread Todd Heberlein
Is there a way to link a controller (e.g., the NSArrayController) to  
my NSDocument's NSUndoManager without having to add a bunch of code to  
my NSDocument subclass?


For example, in Hillegass's book, the first example of RaiseMan (Chap  
8) has a nice clean design that lets the NSArrayController manage all  
interactions between the table view and the NSArray model.


But when adding the undo/redo capability (Chap 9) you have to add a  
lot of code to MyDocument to intercept and register with the  
NSUndoManager all insertion/deletion and edits to the model. This  
seems inelegant.


It would be nice to register MyDocument's NSUndoManager with the  
NSArrayController so that the NSArrayController can handle all the  
undo and redos.


Is it possible to do this?

Thanks,

Todd



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Avoiding mutual retain cycles

2008-07-21 Thread Andreas Mayer


Am 21.07.2008 um 22:02 Uhr schrieb Markus Spoettl:

For example NSCollectionView, NSCollectionViewItem and its view. One  
may or may not suspect the NSCollectionViewItem owns the  
corresponding view. It may as well not own it and instead the  
NSCollectionView owns both.


I don't know why you'd think the collection view might own the item's  
view. You set the view for the view item, so the hierarchy seems to be  
quite clear. (The collection view *might* retain the view too. That's  
an implementation detail.)


Of course once you run into a retain cycle problem with this and no  
NSCollectionViewItem ever gets released because of it (like I did)  
you quickly learn why and who owns the view.


How would you get a retain cycle here? You just hold on to the  
collection view. Everything else should not be your responsibility.


I have to point out that I did not actually use those classes yet.  
(Instead I built something similar myself for 10.4. compatibility.) So  
I might be wrong here; I'd be surprised though.


The point is, unless this is documented explicitly the ownership  
relations are not clear all the time.


If you set something, it's usually retained. Exceptions from this norm  
should certainly be documented - like it is with delegates.



Andreas
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Avoiding mutual retain cycles

2008-07-21 Thread Markus Spoettl

On Jul 21, 2008, at 1:03 PM, Philippe Mougin wrote:
In the general case, there is no rule or mechanism to deal with  
retain cycles other than implementing something equivalent to a  
garbage collector. In some situations, however, the specific  
semantics and life-cycle of the objects you are dealing with allow  
implementing more simpler, ad hoc solutions (e.g., ownership  
management in the view hierarchy). Still, this requires notable  
housekeeping efforts and is often error prone. If you are in a  
situation where you can make use of Cocoa's garbage collector, you  
should go for it. It will free you from a bunch of low-level memory  
management tasks, including having to care about cyclic references.



Call me a retro coward, but I absolutely dislike the idea of GC. I  
just don't see the point of it given the complicated implications it  
can have.


Anyway, thanks for your suggestion.

Regards
Markus
--
__
Markus Spoettl



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Crash drawing shadows

2008-07-21 Thread Ken Ferry
Sounds like it's probably a bug! If not, and you can make a test app
that shows the crash, then you'll probably get the bug back with an
explanation as to what you're doing wrong.

-Ken

On Mon, Jul 21, 2008 at 7:59 PM, Graham Cox <[EMAIL PROTECTED]> wrote:
> Having restarted and trying it again, it now crashes with EXC_BAD_ACCESS
> with the same stack trace. I guess something was not running right.
>
> Graham
>
>>> What was the specific kind of crash (e.g. EXC_BAD_ACCESS)?
>>>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/kenferry%40gmail.com
>
> This email sent to [EMAIL PROTECTED]
>
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Avoiding mutual retain cycles

2008-07-21 Thread Markus Spoettl

On Jul 21, 2008, at 7:23 PM, Michael Ash wrote:

Without investigating things more deeply, just from the basic stuff I
know about the classes in question, I'd assume that the
NSCollectionView owns the NSCollectionViewItems and the views, and the
NSCollectionViewItems would also own the views. Where is the retain
cycle?



Well there is none in the default setup, of course. But here's a non  
far-fetched example to easily create one.


If you're implementing a custom NSView that for some reason has to  
have access to the NSCollectionViewItem or NSCollectionView it belongs  
to, the only proper way to do so (in the collection view world) is by  
accessing the NSCollectionViewItem which has a -collectionView method  
that returns the collection view.


So you need a way back and this you do with a pointer to the  
NSCollectionViewItem in a suitable place. As you don't know the  
ownership circumstances of NSCollectionViewItem and its view the  
safest thing to do is to retain the NSCollectionViewItem in the view.  
There's the retain cycle, because - as it turns out - the  
NSCollectionViewItem seems to retain the view.


The point of all this is not that it's avoided easily - which it is.  
The point is that you can't know the circumstances unless it's  
documented and the original question was how AppKit does avoid things  
like that.


Now that I read more on retain cycles it's clear there is no ingenious  
Cocoa solution to this problem, just plain old defensive programming  
techniques - which is what I was wondering about.


Regards
Markus
--
__
Markus Spoettl



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Breakpoints for CG* functions

2008-07-21 Thread Ken Ferry
Try CGPostError.

The other suggestions are good too.

-Ken

On Mon, Jul 21, 2008 at 2:54 PM, Sean McBride <[EMAIL PROTECTED]> wrote:
> On 7/21/08 9:44 PM, Moray Taylor said:
>
>>Hi there,
>>
>>I'm getting a lot of errors like
>>
>>: CGContextMoveToPoint: invalid context
>>
>>but my usual [NSException raise] breakpoint isn't doing the job
>
> Expected I'd say: CoreGraphics/Quartz is not Cocoa.
>
>> I've
>>tried setting a breakpoint on CGPostError() too, but nothing seems to work.
>>
>>Am I setting the breakpoint correctly? They seem to be OK.
>>
>>(gdb) maint info breakpoints
>>Num Type   Disp Enb AddressWhat
>>1   breakpoint keep y   0x966eec66 <-[NSException raise]+6>
>>2   breakpoint keep y CGPostError()
>>
>>Thanks for any tips
>
> Maybe try breaking on 'printf' or 'write' even.  In any case, since this
> is not a Cocoa question, try the Quartz list. :)
>
> --
> 
> Sean McBride, B. Eng [EMAIL PROTECTED]
> Rogue Researchwww.rogue-research.com
> Mac Software Developer  Montréal, Québec, Canada
>
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/kenferry%40gmail.com
>
> This email sent to [EMAIL PROTECTED]
>
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Crash drawing shadows

2008-07-21 Thread Graham Cox
Having restarted and trying it again, it now crashes with  
EXC_BAD_ACCESS with the same stack trace. I guess something was not  
running right.


Graham


What was the specific kind of crash (e.g. EXC_BAD_ACCESS)?


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to receive my own crash reports?

2008-07-21 Thread Andreas Mayer


Am 21.07.2008 um 23:25 Uhr schrieb Torsten Curdt:


But there is also

http://vafer.org/gitweb/FeedbackReporter.git


Could you please include the source with the download?


Sure. No worries. Or is including the download URL enough?


Of course. Thank you!


Andreas
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Crash drawing shadows

2008-07-21 Thread Graham Cox
I say crash, it doesn't actually say what caused gdb to trigger, but  
it's the same stack trace every time. If I run under the debugger  
initially, it crashes as usual, but things enter a very strange state  
where the entire machine becomes very unresponsive and slow, the fans  
ramp up to maximum - though Activity Monitor only shows my app using  
about 3% CPU. If I don't launch it with gdb, gdb cuts in when this  
occurs, shows this stack trace with no other explanation, but I don't  
experience the machine slowdown. More like a hang than a crash then,  
but it's not an infinite loop as gdb is stopped, not waiting for me to  
pause it.


I'm not sure what's going on. I can work around the problem by not  
drawing shadows when I hit-test and that "fixes" it (and I can live  
without shadows not being hit-testable), but if there is a bug in the  
bowels of Quartz I expect someone might like to know about it.


Graham

On 22 Jul 2008, at 12:33 pm, Ken Thomases wrote:


On Jul 21, 2008, at 9:01 PM, Graham Cox wrote:


Stack trace:

#0  0x940101fc in sseCGSFill8by1
#1  0x93d89107 in ripl_CreateMask
#2  0x93d8d47f in RIPLayerSymmetricConvolve
#3  0x93d8dc0b in RIPLayerGaussianBlur
#4  0x93da795a in rips_s_BltShape
#5  0x93d74939 in ripc_Render
#6  0x93d7d7c4 in ripc_DrawPath
#7  0x94057a67 in CGContextDrawPath
#8  0x940a5726 in CGContextStrokePath
#9	0x95678b99 in -[NSBezierPath(NSBezierPathDevicePrimitives)  
_doUserPathWithOp:inContext:]

#10 0x95678cb2 in -[NSBezierPath stroke]


What was the specific kind of crash (e.g. EXC_BAD_ACCESS)?

It's possible there's a byte-alignment issue, which would produce a  
different exception than a buffer overrun.


Cheers,
Ken


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Did I reinvent the wheel?

2008-07-21 Thread Colin Cornaby
I've written a very similar framework for MySQL, and am gearing up to  
write one for Postgresql, so here's my opinion...


(Apologies if one of these has already been addressed, or you've  
already looked at adding the feature...)


• Write a table controller class. You can instantiate them in IB which  
lets you quickly build database access apps without using any code...  
the next point is related to this...
• Write support for selecting using NSPredicate. Again, this goes hand  
in hand with bindings. The bindings system provides nice predicate  
support using NSPredicate, in addition to this being the Cocoa  
standard for selecting objects from groups. It won't quite be as  
powerful as a select statement, but it still works very nicely. You  
can even do joins if you do things right.
• Use KVO for accessing columns. Override valueForKey: and implement  
your accessor there. Also override setValue:forKey:. Again, this will  
make bindings happy.


Basically... bindings, bindings, bindings. :)

It will make your projects easier to manage, although it will require  
a little bit more code in your framework.


Also one more key for bindings is that you have to enforce single  
instances for each row, but it looks like you do that already.


On May 9, 2008, at 11:10 AM, Western Botanicals wrote:


I would like your opinions about the following framework.

http://www.justingiboney.com/code

I am an IS major, not a CS major, so I don't know what it is like  
for probably most of you. You probably have a much better grasp on  
application development than I do.


What I have been taught, is to use a framework like the one above,  
only I was taught in Java. I wanted to apply what I have learned, so  
I created these classes (one of which I have already put out to the  
list).


Does this framework already exist in cocoa (did I reinvent the wheel)?
Is this a framework that is used (or likely to be used) in the real  
world?


Thanks,

Justin Giboney




___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/colin.cornaby%40mac.com

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Crash drawing shadows

2008-07-21 Thread Ken Thomases

On Jul 21, 2008, at 9:01 PM, Graham Cox wrote:


Stack trace:

#0  0x940101fc in sseCGSFill8by1
#1  0x93d89107 in ripl_CreateMask
#2  0x93d8d47f in RIPLayerSymmetricConvolve
#3  0x93d8dc0b in RIPLayerGaussianBlur
#4  0x93da795a in rips_s_BltShape
#5  0x93d74939 in ripc_Render
#6  0x93d7d7c4 in ripc_DrawPath
#7  0x94057a67 in CGContextDrawPath
#8  0x940a5726 in CGContextStrokePath
#9	0x95678b99 in -[NSBezierPath(NSBezierPathDevicePrimitives)  
_doUserPathWithOp:inContext:]

#10 0x95678cb2 in -[NSBezierPath stroke]


What was the specific kind of crash (e.g. EXC_BAD_ACCESS)?

It's possible there's a byte-alignment issue, which would produce a  
different exception than a buffer overrun.


Cheers,
Ken
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Avoiding mutual retain cycles

2008-07-21 Thread Michael Ash
On Mon, Jul 21, 2008 at 4:02 PM, Markus Spoettl
<[EMAIL PROTECTED]> wrote:
>>> But there are still cases where it is unknown which of the objects is
>>> going to be released first
>>
>> Care to name one?
>
> For example NSCollectionView, NSCollectionViewItem and its view. One may or
> may not suspect the NSCollectionViewItem owns the corresponding view. It may
> as well not own it and instead the NSCollectionView owns both. Of course
> once you run into a retain cycle problem with this and no
> NSCollectionViewItem ever gets released because of it (like I did) you
> quickly learn why and who owns the view.

Without investigating things more deeply, just from the basic stuff I
know about the classes in question, I'd assume that the
NSCollectionView owns the NSCollectionViewItems and the views, and the
NSCollectionViewItems would also own the views. Where is the retain
cycle?

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Crash drawing shadows

2008-07-21 Thread Graham Cox
I think I've run into a bug in the low-level shadow drawing code in  
Quartz. Can anyone confirm?


This happens pretty repeatably when I have a shadow set for a path  
(stroke or fill, doesn't matter) and the destination context is just a  
1x1 bitmap image. This crops up as part of my hit-testing code - I  
draw the "hit point" to the 1x1 context which only has an alpha  
channel, and then test to see if it was set or not. For testing a  
single point, a very small area is transformed and drawn to the 1x1  
image, so there is a substantial scale factor being applied (in fact  
about 1x). I'm wondering if the low-level shadow rendering code is  
somehow running into an unexpected situation with those sorts of  
figures? Or maybe it's because my destination "bitmap" is just one  
byte and the low-level code isn't bounds checking it? (I'm guessing  
that 'sseCGSFill8by1' fills an 8x1 bitmap, so could it be falling off  
the edge of the 1x1?)


For simply drawing to the screen, the shadow gets drawn correctly  
using exactly the same drawing code - the only difference is the  
destination context and the transform applied. Without a shadow, this  
hit-testing technique also works fine.


Stack trace:

#0  0x940101fc in sseCGSFill8by1
#1  0x93d89107 in ripl_CreateMask
#2  0x93d8d47f in RIPLayerSymmetricConvolve
#3  0x93d8dc0b in RIPLayerGaussianBlur
#4  0x93da795a in rips_s_BltShape
#5  0x93d74939 in ripc_Render
#6  0x93d7d7c4 in ripc_DrawPath
#7  0x94057a67 in CGContextDrawPath
#8  0x940a5726 in CGContextStrokePath
#9	0x95678b99 in -[NSBezierPath(NSBezierPathDevicePrimitives)  
_doUserPathWithOp:inContext:]

#10 0x95678cb2 in -[NSBezierPath stroke]



cheers, Graham
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: set posterImage in QTKit?

2008-07-21 Thread douglas welton

Vince,

use the -setAtrribute:forKey: method with the  
QTMoviePosterTimeAttribute key and a value that is the current frames  
QTTime


later,

douglas

On Jul 21, 2008, at 6:55 PM, vince wrote:


Thanks ,
Is there a Cocoa method to set and save the current frame of a QT  
Movie as

the poster frame?

-v.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Read/Write to info.plist's LSEnvironment

2008-07-21 Thread Colin Cornaby
iPhone apps are signed (so are some Mac OS X apps). Modifying a signed  
app's Info.plist can cause things to go haywire. On the iPhone, it can  
cause the app to not work at all.


Don't modify your own info.plist. It's the Apple recommended way.

On Jul 21, 2008, at 10:32 AM, Lee, Frederick wrote:


Point well taken.
I'm going with key chain.
BTW: this is for an iPhone environment.
I'm hesitant to mention iPhone via NDA; so tried to be as generic as
possible.
Thanks for the needed insight.

Ric.



-Original Message-
From: Jens Alfke [mailto:[EMAIL PROTECTED]
Sent: Monday, July 21, 2008 12:22 PM
To: Lee, Frederick
Cc: [EMAIL PROTECTED]; cocoa-dev@lists.apple.com
Subject: Re: Read/Write to info.plist's LSEnvironment


On 21 Jul '08, at 10:09 AM, Lee, Frederick wrote:


I was thinking of keeping the User ID and other simple < 2KB of
identifiers within the bundle.  I found the LSEnvironment option and
it 'appears' to be what I'm after.


What if there are multiple users on the machine? Then they'll all be
forced to use the same user ID. Even worse: in many enterprise
environments, applications are stored on a central file server that
only network admins can modify. With your scheme, not only would users
not be able to set their own user ID, but they wouldn't even have
write access.

In general you should *never* modify the contents of your app bundle
at runtime. (The only exception would be for apps that can software-
update themselves, as with the Sparkle framework.) Any modifiable data
should go in user defaults, or in the user's Library/Application
Suppport/ directory. Data to be shared between users should go in /
Library/Application Support/.

Also, *never* store passwords in regular files! Especially not files
that can be read by other users! The Keychain is a secure place to
store passwords and you should use it for that.


But FWIW... using XML based LSEnvironment had appeared to more...
modular.


Modular how? (And user defaults are based on property lists just as
the Info.plist is, though it really doesn't matter to the developer.)

-Jens
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/colin.cornaby%40mac.com

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: StopWatch Application Help

2008-07-21 Thread Scott Ribe
> Additionally, add [timer invalidate] to your -windowWillClose or -
> dealloc method to make sure the timer is stopped and removed from the
> run loop.

Well, in that case he'd better add timer=nil to stopWatch ;-)

-- 
Scott Ribe
[EMAIL PROTECTED]
http://www.killerbytes.com/
(303) 722-0567 voice


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: how to prevent baseline shift when using NSSuperscriptAttributeName on a NSTextView's NSAttributedString ?

2008-07-21 Thread Andrew Farmer

On 20 Jul 08, at 21:27, Rua Haszard Morris wrote:
I am using NSSuperscriptAttributeName to make part of a string  
displayed in an NSTextView label display as superscript (to show "to  
the power of 2"). I may also use a smaller font attribute to make  
the "2" char smaller.


My problem is that thebaseline of the text drawn in the NSTextView  
is moved down (presumably to accommodate the superscript 2) and the  
label now looks wrong as the text doesn't line up with the other  
edits and labels on the line in the dialog.


Is there a correct, standard way to keep the baseline fixed when  
using an NSAttributedString in a NSTextView used as a label?


Devious solution: use the ² character (U+00B2, SUPERSCRIPT TWO). There  
are characters in Unicode for superscript and subscript 0-9.___


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

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

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

This email sent to [EMAIL PROTECTED]


Re: setFirstResponder to NSTextField fails 1st time, works next

2008-07-21 Thread Moses Hall
SOLVED: I'm posting this for the sake of the archives, in case anyone  
else has this problem.


I found that making the window the first responder before making the  
text field first responder solves the problem. Apparently the window  
is *not* first responder the first time the user selects the search  
tab, but it *is* subsequently. This change causes the makeKeyWindow  
call to succeed in all cases.


-(void)tabView:(NSTabView*)tv didSelectTabViewItem:(NSTabViewItem*)item
{
  if ([[item identifier] isEqual:@"Search"])
  {
[_window makeFirstResponder:_window];
[_window makeKeyWindow];
[_window makeFirstResponder:_searchText];
  }
}

Cheers,
-- Moses


Here's a problem I'm having under Tiger, developing an LSUIElement
application (Input Method server -- it's the UI for IPA Palette
[www.blugs.com/IPA]). I have an NSTabView, one of whose panes has a
search field which is an NSTextField subclass (note that the same
problem occurs if I use an NSTextField). I want to make this field
the first responder when the "Search" tab is chosen. Oddly, it does
not become first responder the first time the pane is selected. It
does not become key, and does not accept text (unless clicked on). If
I move to a different tab and come back, then I get the desired
result: the focus ring is there and I can type into the field.



Here is my tab switch delegate method:
-(void)tabView:(NSTabView*)tv didSelectTabViewItem:(NSTabViewItem*) 
item

{
  NSLog(@"first responder WAS %@", [_window firstResponder]);
  if ([[item identifier] isEqual:@"Search"])
  {
[_window makeKeyWindow];
[_window makeFirstResponder:_searchText];
  }

___

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

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

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

This email sent to [EMAIL PROTECTED]


NSTextView overdraw bug in Leopard?

2008-07-21 Thread Martin Wierschin

Hi everyone,

We've had a report or two from users where text will incorrectly draw  
in an area it's not supposed to. Basically a line fragment (or part  
of one) from the prior NSTextContainer will draw over text in the  
current container. The odd part is that both line fragments are the  
last ones in each of their respective containers. In other words, the  
glyphs for the fragments are separated from each other by quite a bit  
of content.


It looks like this (hopefully the PNG comes through):



Picture 1.png
Description: application/applefile
<>


Admittedly we have heavily customized the text layout system, but in  
the end it's just a series of non-overlapping text views. It could be  
our drawing code, which I've include below, but it hasn't given us  
problems before Leopard. We aren't using noncontiguous layout, but  
even so adding calls to ensureLayoutForTextContainer in drawRect  
doesn't fix the problem.


Has anyone else seen this before? Unfortunately we've been unable to  
reproduce the problem ourselves. We didn't receive any reports until  
after Leopard was released. Searching around the web there appear to  
be other Leopard related redraw issues, but I haven't seen anything  
about the Cocoa text system specifically.


Thanks for any help,

~Martin

PS: Our NSTextView subclass handles drawing like this:

- (void) drawRect:(NSRect)rect
{
if( rect.size.height <= 0 ) return;
NSLayoutManager* lm = [self layoutManager];
NSTextContainer* tc = [self textContainer];

NSPoint origin = [self textContainerOrigin];
	NSRange glyphRng = (nil == tc) ? NSZeroRange : [lm  
glyphRangeForBoundingRect:rect inTextContainer:tc];


// background
[self drawViewBackgroundInRect:rect];
	if( 0 != glyphRng.length ) [lm drawBackgroundForGlyphRange:glyphRng  
inTextContainer:tc atPoint:origin];
	[lm drawSelectionForGlyphRange:glyphRng inTextContainer:tc  
atPoint:origin];


// text
if( 0 != glyphRng.length ) {
		[NSBezierPath clipRect:rect]; // in case the glyphs being drawn are  
not entirely in the redraw rect

[lm drawGlyphsForGlyphRange:glyphRng atPoint:origin];
}
}

- (void) drawViewBackgroundInRect:(NSRect)rect
{
if( [self drawsBackground] ) {
[[self backgroundColor] set];
[NSBezierPath fillRect:rect];
}
}___

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

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

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

This email sent to [EMAIL PROTECTED]

set posterImage in QTKit?

2008-07-21 Thread vince
Thanks ,
Is there a Cocoa method to set and save the current frame of a QT Movie as
the poster frame?

-v.
___

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

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

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

This email sent to [EMAIL PROTECTED]


NSBaselineOffsetAttributeName support in NSTextField - bug? Re: how to prevent baseline shift when using NSSuperscriptAttributeName on a NSTextView's NSAttributedString ?

2008-07-21 Thread Rua Haszard Morris

Update:

If I set the superscript attribute for the exponent, and set a  
negative value (any negative value), the baseline is appropriate (i.e.  
lines up with surrounding controls).


The strange thing is that there only seem to be 3 baseline positions  
supported by NSTextField; any positive value, 0, and any negative value.


Is this correct behaviour? The documentation for  
NSBaselineOffsetAttribute name states that:


"The baseline offset attribute is a literal distance, in pixels, by  
which the characters should be shifted above the baseline (for  
positive offsets) or below (for negative offsets)."
http://developer.apple.com/documentation/Cocoa/Conceptual/AttributedStrings/Articles/standardAttributes.html#/ 
/apple_ref/doc/uid/TP40004903


I like the fact that I can specify a negative number and it appears to  
correctly account for my superscript exponent, but I'm concerned that  
the value may actually be used in future, and/or there is some  
complicated interaction between the attributes. Is there documentation  
on NSTextField's support for attributed strings that explains why this  
is happening? Or should I report this as a bug?


Can anyone shed any light on why this is happening?

thanks
Rua HM.

On Jul 21, 2008, at 4:27 PM, Rua Haszard Morris wrote:

I am using NSSuperscriptAttributeName to make part of a string  
displayed in an NSTextView label display as superscript (to show "to  
the power of 2"). I may also use a smaller font attribute to make  
the "2" char smaller.


My problem is that thebaseline of the text drawn in the NSTextView  
is moved down (presumably to accommodate the superscript 2) and the  
label now looks wrong as the text doesn't line up with the other  
edits and labels on the line in the dialog.


Is there a correct, standard way to keep the baseline fixed when  
using an NSAttributedString in a NSTextView used as a label?


I've tried using a multi-line NSTextView, but this makes no  
difference. There is the possibility of tweaking the  
NSBaselineAttribute, or even the position of the NSTextView, but  
both approaches seem hacky or overkill (i.e. I'd need to correctly  
determine the baseline offset by querying the font superscript  
offset? and converting to pixels?)


thanks
Rua HM.
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/r.haszardmorris%40adinstruments.com

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Weak link usage? @property?

2008-07-21 Thread Shawn Erickson
On Mon, Jul 21, 2008 at 3:07 PM, Scott Squires <[EMAIL PROTECTED]> wrote:
> So what's the correct form of weak linking to avoid retain cycles?
>
> If I have an instance variable in my child of it's parent:
>
> @interface MyChild  blah blah...
> {
>
>MyParentClass * myParent;
> }
> @property (nonatomic) MyParentClass * myParent;
>
> Provides this warning.
>
> warning: no 'assign', 'retain', or 'copy' attribute is specified - 'assign'
> is assumed
> warning: 'assign' attribute (default) not appropriate for non-gc object
> property 'myParent'
>
> Do I need to avoid any @property settings for any weak linked objects and
> just deal with directly in my methods?

assign - just assigns (pointer copy)
retain - assign and retains
copy - assigns a copy of the object



Assign in a non-GC world is a weak reference. If you specifically
state you want assignment you wont get a compiler warning.

-Shawn
___

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

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

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

This email sent to [EMAIL PROTECTED]


Weak link usage? @property?

2008-07-21 Thread Scott Squires

So what's the correct form of weak linking to avoid retain cycles?

If I have an instance variable in my child of it's parent:



@interface MyChild  blah blah...
{

MyParentClass * myParent;
}
@property (nonatomic) MyParentClass * myParent;

Provides this warning.

warning: no 'assign', 'retain', or 'copy' attribute is specified -  
'assign' is assumed
warning: 'assign' attribute (default) not appropriate for non-gc  
object property 'myParent'


Do I need to avoid any @property settings for any weak linked objects  
and just deal with directly in my methods?


Other question on @property  retaining

@property (nonatomic, retain) MyClass *myClass;

-(void)holderOfMyClass:(MyClass *)myClassObject;
{

[self setMyClass: myClassObject];   // this retains
 self.myClass = myClassObject;  // this retains
	myClass = myClassObject;		// this does not retain?   Seems like it  
doesn't from my tests


}



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Breakpoints for CG* functions

2008-07-21 Thread Sean McBride
On 7/21/08 9:44 PM, Moray Taylor said:

>Hi there,
>
>I'm getting a lot of errors like
>
>: CGContextMoveToPoint: invalid context
>
>but my usual [NSException raise] breakpoint isn't doing the job

Expected I'd say: CoreGraphics/Quartz is not Cocoa.

> I've
>tried setting a breakpoint on CGPostError() too, but nothing seems to work.
>
>Am I setting the breakpoint correctly? They seem to be OK.
>
>(gdb) maint info breakpoints
>Num Type   Disp Enb AddressWhat
>1   breakpoint keep y   0x966eec66 <-[NSException raise]+6>
>2   breakpoint keep y CGPostError()
>
>Thanks for any tips

Maybe try breaking on 'printf' or 'write' even.  In any case, since this
is not a Cocoa question, try the Quartz list. :)

--

Sean McBride, B. Eng [EMAIL PROTECTED]
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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

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

This email sent to [EMAIL PROTECTED]


Breakpoints for CG* functions

2008-07-21 Thread Moray Taylor
Hi there,

I'm getting a lot of errors like

: CGContextMoveToPoint: invalid context

but my usual [NSException raise] breakpoint isn't doing the job, I've tried 
setting a breakpoint on CGPostError() too, but nothing seems to work.

Am I setting the breakpoint correctly? They seem to be OK.

(gdb) maint info breakpoints
Num Type   Disp Enb AddressWhat
1   breakpoint keep y   0x966eec66 <-[NSException raise]+6>
2   breakpoint keep y CGPostError()

Thanks for any tips

MT


  __
Not happy with your email address?.
Get the one you really want - millions of new email addresses available now at 
Yahoo! http://uk.docs.yahoo.com/ymail/new.html
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: A data display question

2008-07-21 Thread Ronnie B
Seems like I overlooked some properties in Inspector.  Thanks for the hint.

On Mon, Jul 21, 2008 at 5:13 PM, Randall Meadows <[EMAIL PROTECTED]>
wrote:

> On Jul 21, 2008, at 2:51 PM, Ronnie B wrote:
>
>  What would be recommended to do in order to display a tabular data w/o it
>> being editable or sortable.  I would like to have something like the Table
>> View.
>>
>
> What's wrong with using NSTableView?
>
>
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to receive my own crash reports?

2008-07-21 Thread Torsten Curdt

On Jul 21, 2008, at 18:07, Andreas Mayer wrote:


Am 21.07.2008 um 14:49 Uhr schrieb Torsten Curdt:


http://vafer.org/projects/feedbackreporter/

Feedback welcome :)


I don't have git installed and I don't plan to change that to look  
at just one project.


I heard rumors there are also other projects using git ;-)

But there is also

 http://vafer.org/gitweb/FeedbackReporter.git


Could you please include the source with the download?


Sure. No worries. Or is including the download URL enough?

cheers
--
Torsten
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Avoiding mutual retain cycles

2008-07-21 Thread Philippe Mougin


Le 21 juil. 08 à 20:50, Markus Spoettl a écrit :


[...]

I'm wondering if there is a general rule or mechanism that suggests  
what to do in such a case. For instance, how are delegates  
implemented in AppKit, are they retained? If so, when are they  
released. It can't be in -dealloc, otherwise everything would lock  
itself out of deallocation?


Thoughts?


In the general case, there is no rule or mechanism to deal with retain  
cycles other than implementing something equivalent to a garbage  
collector. In some situations, however, the specific semantics and  
life-cycle of the objects you are dealing with allow implementing more  
simpler, ad hoc solutions (e.g., ownership management in the view  
hierarchy). Still, this requires notable housekeeping efforts and is  
often error prone. If you are in a situation where you can make use of  
Cocoa's garbage collector, you should go for it. It will free you from  
a bunch of low-level memory management tasks, including having to care  
about cyclic references.


Philippe Mougin
http://www.fscript.org
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: A data display question

2008-07-21 Thread Randall Meadows

On Jul 21, 2008, at 2:51 PM, Ronnie B wrote:

What would be recommended to do in order to display a tabular data w/ 
o it
being editable or sortable.  I would like to have something like the  
Table

View.


What's wrong with using NSTableView?

___

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

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

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

This email sent to [EMAIL PROTECTED]


[NSString stringWithContentsOfURL:...], threads, and 10.5.4, xcode 3.1

2008-07-21 Thread [EMAIL PROTECTED]
i have been using +[NSString stringWithContentsOfURL:encoding:error:] 
in my app to obtain stock quotes from yahoo. i issue this in one (or 
more) threads to get values for one (or more) stocks. i'm not quite 
sure when this stopped working successfully, but it is definitely not 
working reliably on 10.5.4 with xcode 3.1 and with NO garbage 
collection.


by not reliably i mean that i will quite frequently (but not always) 
get the following message on the console:


*** -[CFURL _cfurl]: message sent to deallocated instance 0x290180d0

and the relevant stack trace is:

#0  0x95ae3907 in ___forwarding___
#1  0x95ae3a12 in __forwarding_prep_0___
#2  0x95ab5d42 in CFURLCopyPath
#3  0x92350d4e in createNotificationName
#4  0x9235113c in __PrivateCookieStorageDeallocate
#5  0x95a66788 in _CFRelease
#6  0x923510d6 in __CFHTTPCookieStorageDeallocate
#7  0x95a66788 in _CFRelease
#8  0x92306c2d in _CFURLRequestDeallocate
#9  0x95a66788 in _CFRelease
#10 0x9230ac1b in __CFCachedURLResponse::SetRequest
#11 0x9230ab0e in AddCacheTask
#12 0x92308603 in __CFURLCache::CopyResponseForRequest
#13 0x92307b38 in _CFURLConnectionSendCallbacks
#14 0x92307573 in muxerSourcePerform
#15 0x95a64615 in CFRunLoopRunSpecific
#16 0x95a64cf8 in CFRunLoopRunInMode
#17 0x9232ab42 in CFURLConnectionSendSynchronousRequest
#18	0x952ac80b in +[NSURLConnection 
sendSynchronousRequest:returningResponse:error:]

#19 0x9537afab in -[NSString initWithContentsOfURL:encoding:error:]
#20 0x9537a51f in +[NSString stringWithContentsOfURL:encoding:error:]
#21	0x00147f00 in +[StockSupport_Yahoo(PrivateUtilities) 
historicStockValue:asOfDate:error:] at StockSupport_Yahoo.mm:296


and the relevant snippet of my code is:

NSURL* lookupURL = [[NSURL alloc] initWithString: urlLookupString];
NSError* lookupError = nil;
	NSString* csvString = [NSString stringWithContentsOfURL: 
lookupURL encoding: NSUTF8StringEncoding error: &lookupError];

...
[lookupURL release];


i've worked around it for the time being by actually calling 
+[NSString stringWithContentsOfURL:encoding:error:] from my main 
thread, but not only does this slow down the app (since requests are 
now sequential), but it also prevents the user from aborting the 
requests (since the main/ui thread is now busy).


can anyone explain the above error? can anyone indicate whether or 
not +[NSString stringWithContentsOfURL...] is thread safe? (i was 
under the impression that the foundation classes NSString, NSURL, and 
NSData were all thread safe, and as i said above, this used to work.)


thanx for any help/answers/advice/etc.

thanx,
ken

ps. it would take a fairly significant restructuring to use 
asynchronous NSURLConnection requests, so i'd like to avoid that if 
possible... especially since i had thought i had solved this problem 
by performing the requests in threads.

___

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

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

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

This email sent to [EMAIL PROTECTED]


A data display question

2008-07-21 Thread Ronnie B
What would be recommended to do in order to display a tabular data w/o it
being editable or sortable.  I would like to have something like the Table
View.
Thanks.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Growl, NSTimer, and Launching Application help!

2008-07-21 Thread Jens Alfke


On 21 Jul '08, at 12:07 PM, Eric Lee wrote:

I've fully implemented growl, but how can you implement growl so  
that you can disable and enable growl by unchecking/checking a  
checkbox because too many small windows appearing might get a little  
annoying.


Use NSUserDefaults to store a boolean preference. Check that pref  
before putting up a Growl notification. Have a preference panel with a  
checkbox that's bound to that setting in the user defaults controller.


The stopwatch application launches from January 1st, 2001, because I  
implemented
-timeIntervalSinceReferenceDate, because -timeIntervalSinceDate, and  
-timeIntervalSinceNow, wouldn't work. I don't know how to change the  
application so that it WILL work with those two. Basically, how do I  
change my code so that when I start the timer, it'll start from 0,  
and then go up?


If you want to know how many seconds have elapsed since it started,  
then call [NSDate date] when you start, store that value in an  
instance variable like _date, and then call - [_date  
timeIntervalSinceNow]. (The "-" is needed otherwise you get a negative  
number.)


For some reason, when I quit the application, and then click on the  
icon on the dock, it won't open another window. How do you fix this?


Did you _quit_ the app, or did you just close its window? Closing the  
window won't quit the app unless you implement the right application  
delegate method (something like terminatesWhenLastWindowClosed), or  
alternately call [NSApp terminate] when notified that the window's  
been closed.


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Avoiding mutual retain cycles

2008-07-21 Thread Markus Spoettl

On Jul 21, 2008, at 12:28 PM, Ken Thomases wrote:
Actually, it is not against the guidelines, it is in keeping with  
them.


See here: http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Concepts/ObjectOwnership.html#/ 
/apple_ref/doc/uid/2043-1000698


That explicitly discusses retain cycles and the use of weak  
references to break them.



Thanks for the link.

Regards
Markus
--
__
Markus Spoettl



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Avoiding mutual retain cycles

2008-07-21 Thread Markus Spoettl

On Jul 21, 2008, at 12:21 PM, Andreas Mayer wrote:
I'm wondering if there is a general rule or mechanism that suggests  
what to do in such a case.


About retain cycles:

http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Concepts/ObjectOwnership.html

"The solution to the problem of retain cycles is that the “parent”  
object should retain its “children,” but that the children should  
not retain their parents."


For instance, how are delegates implemented in AppKit, are they  
retained?


http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CommunicatingWithObjects/chapter_6_section_4.html

"Delegating objects do not (and should not) retain their delegates."


Thanks for those links.

But there are still cases where it is unknown which of the objects  
is going to be released first


Care to name one?


For example NSCollectionView, NSCollectionViewItem and its view. One  
may or may not suspect the NSCollectionViewItem owns the corresponding  
view. It may as well not own it and instead the NSCollectionView owns  
both. Of course once you run into a retain cycle problem with this and  
no NSCollectionViewItem ever gets released because of it (like I did)  
you quickly learn why and who owns the view.


The point is, unless this is documented explicitly the ownership  
relations are not clear all the time.


I generally do not find it difficult to decide which object needs to  
own which. In case you can't decide, maybe neither should and you  
are better off adding a third object that handles both.



Agreed, if it's in your own power and you know what your structure  
looks like it's simple.


Regards
Markus
--
__
Markus Spoettl

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Redrawing CALayer subclass when super layer is scaled

2008-07-21 Thread David Duncan


On Jul 20, 2008, at 4:04 PM, Rick Mann wrote:

David, I checked my code again, and realized I was setting the bias  
to 1 (I thought I saw that in a sample). I don't really understand  
how the numbers are interpreted, but when I set it higher (4, and  
then 10), my layers started getting redrawn.



Its all powers of 2. Levels of detail is how many of them you have,  
starting at 1. So if you set levelsOfDetail to 3, then you have 1,  
1/2, 1/4. If you set it to 7 you add 1/8, 1/16. This effectively means  
you have smaller representations of your data.


levelsOfDetailBias biases levelsOfDetail so that you can scale up as  
well as down. So if we go back to levelsOfDetail set to 3, but set  
levelsOfDetailBias to 1, then you get instead 2, 1, 1/2. If you set it  
to 2, then you get 4, 2, 1. Setting this value greater than  
levelsOfDetail-1 is may work (haven't tried it) but doesn't really  
give you anything.


 Effectively together you get the powers of 2 from  
2^(levelsOfDetailBias) to 2^(levelsOfDetailBias-levelsOfDetail+1) for  
your representations.


I'm not even sure I see a way to do that by writing my own animators  
& renderers (I can't figure out how to subclass CARenderer, anyway).


You wouldn't want to subclass CARenderer anyway, I can't imagine  
anything useful that you could get out of doing so.

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



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Avoiding mutual retain cycles

2008-07-21 Thread Ken Thomases

On Jul 21, 2008, at 1:50 PM, Markus Spoettl wrote:

By changing the reference from B to A to a weak reference which  
doesn't retain and release A, the problem goes away. However,  
generally speaking this is dangerous road to go  (and against  
memory management guidelines)


Actually, it is not against the guidelines, it is in keeping with them.

See here: http://developer.apple.com/documentation/Cocoa/Conceptual/ 
MemoryMgmt/Concepts/ObjectOwnership.html#//apple_ref/doc/uid/ 
2043-1000698


That explicitly discusses retain cycles and the use of weak  
references to break them.



For instance, how are delegates implemented in AppKit, are they  
retained?


There are not retained by virtue of being assigned as a delegate.   
They are retained by whatever code made the decision to assign them  
as the delegate.  If that code later decides to release the object,  
it must also unset it as a delegate first.


Cheers,
Ken

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Growl, NSTimer, and Launching Application help!

2008-07-21 Thread Shawn Erickson
On Mon, Jul 21, 2008 at 12:07 PM, Eric Lee <[EMAIL PROTECTED]> wrote:

> Problem 1:
>
> I've fully implemented growl, but how can you implement growl so that you
> can disable and enable growl by unchecking/checking a checkbox because too
> many small windows appearing might get a little annoying.

Ask the growl folks. Anyways what exactly are you using growl for?

> Problem 2:
>
> The stopwatch application launches from January 1st, 2001, because I
> implemented
> -timeIntervalSinceReferenceDate, because -timeIntervalSinceDate, and
> -timeIntervalSinceNow, wouldn't work. I don't know how to change the
> application so that it WILL work with those two. Basically, how do I change
> my code so that when I start the timer, it'll start from 0, and then go up?

Can you explain what exactly you had problems with? What do you mean
"start from 0"?

> Problem 3:
>
> For some reason, when I quit the application, and then click on the icon on
> the dock, it won't open another window. How do you fix this?

What, if any, code opens the desired window?

-Shawn
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Avoiding mutual retain cycles

2008-07-21 Thread Andreas Mayer


Am 21.07.2008 um 20:50 Uhr schrieb Markus Spoettl:

I'm wondering if there is a general rule or mechanism that suggests  
what to do in such a case.


About retain cycles:

http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Concepts/ObjectOwnership.html

"The solution to the problem of retain cycles is that the “parent”  
object should retain its “children,” but that the children should not  
retain their parents."


For instance, how are delegates implemented in AppKit, are they  
retained?


http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CommunicatingWithObjects/chapter_6_section_4.html

"Delegating objects do not (and should not) retain their delegates."

But there are still cases where it is unknown which of the objects  
is going to be released first


Care to name one?

I generally do not find it difficult to decide which object needs to  
own which. In case you can't decide, maybe neither should and you are  
better off adding a third object that handles both.



Andreas___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Design question, which controller class to use

2008-07-21 Thread Ken Thomases

On Jul 20, 2008, at 10:24 PM, Jens Alfke wrote:


On 20 Jul '08, at 8:05 PM, James W. Walker wrote:

Since there is a window (which has a title that depends on the  
data) I thought I should use a subclass of NSWindowController.  On  
the other hand, there is an array being displayed in a table, and  
I gather that's easier to set up using bindings if I use an  
NSArrayController.  Any suggestions or references?


Those are two very different types of controllers, and you should  
probably use both.


Just to add to that: Apple's terminology for these different types  
are "coordinating controller" and "mediating controller".  You should  
do a full-text documentation search for those terms and read the  
discussion you find there.  It will help you understand the concepts.


Cheers,
Ken

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Handling key equivalents in a controller class?

2008-07-21 Thread Matt Neuburg
On Sat, 19 Jul 2008 12:34:45 -0700, Jens Alfke <[EMAIL PROTECTED]> said:
>
>On 19 Jul '08, at 8:52 AM, Matt Neuburg wrote:
>
>> Try it and see. Let's say we want to catch Esc directed to the
>> window as a
>> whole (to exit full screen mode, if I recall your example). So what
>> I would
>> do is to insert an NSResponder instance behind the window in the
>> chain and
>> implement keyDown:.
>
>I had already tried implementing keyDown: in my controller object,
>which is the window's delegate, to no avail. But that class is just a
>direct subclass of NSObject, not NSResponder or NSWindowController. I
>tried changing its superclass to NSResponder, but that didn't help.
>
>Looks like I need to read up on the conceptual docs about the
>responder chain, to figure out how to make my object the window's next
>responder. (I've never manipulated the chain directly before.)

Well, as Solon used to say, "You learn something new every day, even if you
don't want to!" A good place to start might be here:

http://developer.apple.com/documentation/Cocoa/Conceptual/EventOverview/Hand
lingKeyEvents/chapter_6_section_3.html

As for inserting your own objects into the responder chain, this is a
technique I've discussed here many times, most recently just last week:

http://www.cocoabuilder.com/archive/message/cocoa/2008/7/14/212862

I used to do quite a bit of NSWindow subclassing (and if you look on the
archives you'll find me arguing for it in those days), but these days I lean
much more towards inserting singleton NSResponders into the responder chain.
If I want to modify the keyboard behavior of a particular view in a window,
such as a table view, I insert the NSResponder behind it. If I want to
modify the keyboard behavior related to a window as a whole, I insert the
NSResponder behind the window. m.

-- 
matt neuburg, phd = [EMAIL PROTECTED], 
A fool + a tool + an autorelease pool = cool!
One of the 2007 MacTech Top 25: 
AppleScript: the Definitive Guide - Second Edition!




___

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

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

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

This email sent to [EMAIL PROTECTED]


Growl, NSTimer, and Launching Application help!

2008-07-21 Thread Eric Lee
I've written a stopwatch application so that I can get to know  
NSTimer, NSAlert, how to implement growl, etc.


Problem 1:

I've fully implemented growl, but how can you implement growl so that  
you can disable and enable growl by unchecking/checking a checkbox  
because too many small windows appearing might get a little annoying.


Problem 2:

The stopwatch application launches from January 1st, 2001, because I  
implemented
-timeIntervalSinceReferenceDate, because -timeIntervalSinceDate, and - 
timeIntervalSinceNow, wouldn't work. I don't know how to change the  
application so that it WILL work with those two. Basically, how do I  
change my code so that when I start the timer, it'll start from 0, and  
then go up?


Problem 3:

For some reason, when I quit the application, and then click on the  
icon on the dock, it won't open another window. How do you fix this?



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Newbie CALayer Questions

2008-07-21 Thread David Duncan

On Jul 21, 2008, at 9:49 AM, Scott Anguish wrote:


On 21-Jul-08, at 10:48 AM, Bob Barnes wrote:

 I hadn't considered that but I cut and pasted it directly from the  
documentation.


- (void)drawInContext(CGContextRef)ctx {
  NSLog(@"drawInContext called");
}


that should be

- (void)drawInContext:(CGContextRef)ctx



Also keep in mind that if you are using a delegate, you implement:

-(void)drawLayer:(CALayer*)layer inContext:(CGContextRef)ctx

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



___

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

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

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

This email sent to [EMAIL PROTECTED]


Avoiding mutual retain cycles

2008-07-21 Thread Markus Spoettl

Hi List,

  in the course of debugging a -dealloc in a data structure that is  
part of an NSDocument app, I've discovered that my document and all  
it's data never gets deallocated. After some extensive digging I  
nailed the problem down to mutual retain cycles (not sure this is the  
right term). I actually had a number of those, it always followed this  
scheme:


An object A was retained by an object B which was owned by A. A  
releases B in its -dealloc, B releases A in its -dealloc. Since  
neither retain count would ever go to zero, neither dealloc would ever  
be called and everything would just stay there forever.


By changing the reference from B to A to a weak reference which  
doesn't retain and release A, the problem goes away. However,  
generally speaking this is dangerous road to go  (and against memory  
management guidelines) because now it's no longer guaranteed that A  
still exists if B is using it. Sure, there could be measures  
implemented that help with that (like A notifying B that it's going  
away) but that would mean a lot of additional housekeeping.


Defining who owns who (owners get a strong reference to owned) also  
helps, because it's then guaranteed that A will be there for as long  
as B exists, thus a strong reference is not needed. But there are  
still cases where it is unknown which of the objects is going to be  
released first (because it's hidden in the inner workings of AppKit  
for example).


I'm wondering if there is a general rule or mechanism that suggests  
what to do in such a case. For instance, how are delegates implemented  
in AppKit, are they retained? If so, when are they released. It can't  
be in -dealloc, otherwise everything would lock itself out of  
deallocation?


Thoughts?

Markus
--
__
Markus Spoettl



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Unarchiving a plugin custom control

2008-07-21 Thread Fritz Anderson

On 20 Jul 2008, at 9:05 PM, Anders Lassen wrote:


I am working on a custom control, which has a few simple properties.

The object is a subclass of NSBox, and is therefore initialized with  
initWithCoder.


When the object is created for the first time and nothing has been  
saved to the archive, all properties are set to zero values.


My problem is that I would like to bypass the decoding when the  
achive is "empty", and assign other default values (than zero).


I wonder whether this is possible?


I assume you have a class for some sort of controller object (whether  
an NSDocument, or NSWindowController, or just an NSObject subclass of  
your own) that serves as the "owner" of the NIB in question.


Make sure that owner object has an IBOutlet that points to your NSBox- 
subclass object. In Interface Builder, hook the box object to that  
outlet in File's Owner. (You will have to set File's Owner's class, so  
IB will know the outlet exists.)


When the NIB is loaded, the loading system will send -awakeFromNib to  
the owner object. All your connections will have been set up then, and  
because you've hooked your custom view to an outlet of your owner  
object, you have direct access to it. You can then initialize your  
view according to the content of the document.


— F


___

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

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

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

This email sent to [EMAIL PROTECTED]


RE: Read/Write to info.plist's LSEnvironment

2008-07-21 Thread Lee, Frederick
Point well taken.
I'm going with key chain.
BTW: this is for an iPhone environment.
I'm hesitant to mention iPhone via NDA; so tried to be as generic as
possible.
Thanks for the needed insight.

Ric.



-Original Message-
From: Jens Alfke [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 21, 2008 12:22 PM
To: Lee, Frederick
Cc: [EMAIL PROTECTED]; cocoa-dev@lists.apple.com
Subject: Re: Read/Write to info.plist's LSEnvironment


On 21 Jul '08, at 10:09 AM, Lee, Frederick wrote:

> I was thinking of keeping the User ID and other simple < 2KB of  
> identifiers within the bundle.  I found the LSEnvironment option and  
> it 'appears' to be what I'm after.

What if there are multiple users on the machine? Then they'll all be  
forced to use the same user ID. Even worse: in many enterprise  
environments, applications are stored on a central file server that  
only network admins can modify. With your scheme, not only would users  
not be able to set their own user ID, but they wouldn't even have  
write access.

In general you should *never* modify the contents of your app bundle  
at runtime. (The only exception would be for apps that can software- 
update themselves, as with the Sparkle framework.) Any modifiable data  
should go in user defaults, or in the user's Library/Application  
Suppport/ directory. Data to be shared between users should go in / 
Library/Application Support/.

Also, *never* store passwords in regular files! Especially not files  
that can be read by other users! The Keychain is a secure place to  
store passwords and you should use it for that.

> But FWIW... using XML based LSEnvironment had appeared to more...  
> modular.

Modular how? (And user defaults are based on property lists just as  
the Info.plist is, though it really doesn't matter to the developer.)

-Jens
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Read/Write to info.plist's LSEnvironment

2008-07-21 Thread Jens Alfke


On 21 Jul '08, at 10:09 AM, Lee, Frederick wrote:

I was thinking of keeping the User ID and other simple < 2KB of  
identifiers within the bundle.  I found the LSEnvironment option and  
it 'appears' to be what I'm after.


What if there are multiple users on the machine? Then they'll all be  
forced to use the same user ID. Even worse: in many enterprise  
environments, applications are stored on a central file server that  
only network admins can modify. With your scheme, not only would users  
not be able to set their own user ID, but they wouldn't even have  
write access.


In general you should *never* modify the contents of your app bundle  
at runtime. (The only exception would be for apps that can software- 
update themselves, as with the Sparkle framework.) Any modifiable data  
should go in user defaults, or in the user's Library/Application  
Suppport/ directory. Data to be shared between users should go in / 
Library/Application Support/.


Also, *never* store passwords in regular files! Especially not files  
that can be read by other users! The Keychain is a secure place to  
store passwords and you should use it for that.


But FWIW... using XML based LSEnvironment had appeared to more...  
modular.


Modular how? (And user defaults are based on property lists just as  
the Info.plist is, though it really doesn't matter to the developer.)


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Read/Write to info.plist's LSEnvironment

2008-07-21 Thread Finlay Dobbie
On Mon, Jul 21, 2008 at 5:50 PM, Lee, Frederick
<[EMAIL PROTECTED]> wrote:
> Simple need: to store NSString values (UserName, PW) in a Dictionary
> format within my application's .plist.
>
> I've read Apple's Cocoa literature and found that .plist's LSEnvironment
> is the way to go.
>
> Using the .plist editor to add LSEnvironment dictionary and member keys
> is straight forward.
>
> But I'm having trouble figuring out how to programmatically
> update/retrieve these values.

You cannot guarantee that the user of your application will have write
access to your bundle. Why are you trying to store them within your
application rather than using, for example, NSUserDefaults? It doesn't
sound like LSEnvironment is what you want at all.

 -- Finlay
___

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

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

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

This email sent to [EMAIL PROTECTED]


RE: Read/Write to info.plist's LSEnvironment

2008-07-21 Thread Lee, Frederick
I was thinking of keeping the User ID and other simple < 2KB of
identifiers
within the bundle.  I found the LSEnvironment option and it 'appears' to
be what
I'm after.

But I'm open to others' suggestions (based on their experiences) and
shall
dutifully follow the more logical route.

For one thing, working with NSUserDefaults is the more intuitive
approach from
my experience.

But FWIW... using XML based LSEnvironment had appeared to more...
modular.
However, the CF-support for LSEnvironment is more cumbersome for me.

Ric.

-Original Message-
From: Finlay Dobbie [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 21, 2008 11:56 AM
To: Lee, Frederick
Cc: cocoa-dev@lists.apple.com
Subject: Re: Read/Write to info.plist's LSEnvironment

On Mon, Jul 21, 2008 at 5:50 PM, Lee, Frederick
<[EMAIL PROTECTED]> wrote:
> Simple need: to store NSString values (UserName, PW) in a Dictionary
> format within my application's .plist.
>
> I've read Apple's Cocoa literature and found that .plist's
LSEnvironment
> is the way to go.
>
> Using the .plist editor to add LSEnvironment dictionary and member
keys
> is straight forward.
>
> But I'm having trouble figuring out how to programmatically
> update/retrieve these values.

You cannot guarantee that the user of your application will have write
access to your bundle. Why are you trying to store them within your
application rather than using, for example, NSUserDefaults? It doesn't
sound like LSEnvironment is what you want at all.

 -- Finlay
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Handling key equivalents in a controller class?

2008-07-21 Thread Nathan Vander Wilt

Jens –

I've been wanting to do similar key handling in my controller class  
(rather than view classes), so I'm glad I'm not the only one not fully  
grokking the responder chain. I got some helpful responses to my more  
specific question, but without loss of generality. Especially: http://www.cocoabuilder.com/archive/message/cocoa/2008/7/9/212381


My takeaway from that experience was that if I need custom event  
responding, I need my own NSResponder inserted somewhere in the chain.  
It makes sense, but coming from the other direction ("I want to handle  
some events in my controller") it's tempting to look for another way  
that doesn't seem to exist.


hth,
-natevw


On Jul 19, 2008, at 12:34 PM, Jens Alfke wrote:


On 19 Jul '08, at 8:52 AM, Matt Neuburg wrote:

Try it and see. Let's say we want to catch Esc directed to the  
window as a
whole (to exit full screen mode, if I recall your example). So what  
I would
do is to insert an NSResponder instance behind the window in the  
chain and

implement keyDown:.


I had already tried implementing keyDown: in my controller object,  
which is the window's delegate, to no avail. But that class is just  
a direct subclass of NSObject, not NSResponder or  
NSWindowController. I tried changing its superclass to NSResponder,  
but that didn't help.


Looks like I need to read up on the conceptual docs about the  
responder chain, to figure out how to make my object the window's  
next responder. (I've never manipulated the chain directly before.)



When an event arrives (arrives! It got here by being
handed up thru all the views and the window, which therefore  
clearly didn't
handle it), we look to see if it's for us - i.e., is it Esc or not.  
If it
is, we tell the window to do what it's supposed to do, and the  
event is not
handed any further up the responder chain. If not, we pass the  
event to
super and the event is handed on up the responder chain in the  
usual way,


That makes sense. I had been thinking that event handlers would need  
a boolean return value to indicate whether or not they handled the  
event, but I'd overlooked the behavior of calling super to pass the  
event up. Thanks!


—Jens___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: WebKit, programmatic form input, form submits

2008-07-21 Thread Diop Mercer
Thanks guys, I'll take a look.

-m

On Sun, Jul 20, 2008 at 6:54 PM, Jens Alfke <[EMAIL PROTECTED]> wrote:
>
> On 20 Jul '08, at 9:39 AM, Diop Mercer wrote:
>
>> Hi, I've been playing with WebKit, and I've written a Cocoa app that
>> brings up a site in a WebView. That was easy, but now I'd like to go
>> to a site with a form and have the Cocoa app fill in the form fields
>> and submit the form.  Can anyone point me to documentation on how to
>> programmatically fill in web forms using WebKit? And also how to
>> programmatically click buttons?
>
> Read "Using the Document Object Model From Objective-C" in the "WebKit
> Objective-C Programming Guide".
>
> file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/Conceptual/DisplayWebContent/Tasks/DOMObjCBindings.html
>
> —Jens
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Being notified of changes to a file

2008-07-21 Thread Finlay Dobbie
On Mon, Jul 21, 2008 at 8:56 AM, Yann Disser <[EMAIL PROTECTED]> wrote:
> What I am trying to figure out, is how to respond right away to every single
> line that is written on stdout without waiting for the process to be
> finished.

There are many examples of this. See
 for one
of them. You need to get an NSPipe, create a corresponding
NSFileHandle and use -readInBackgroundAndNotify.

 -- Finlay
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: webDAV (lite) framework?

2008-07-21 Thread Finlay Dobbie
On Mon, Jul 21, 2008 at 3:37 PM, William Bates
<[EMAIL PROTECTED]> wrote:
> Is there an objective-C webDAV framework around? I've been rolling my own (I
> only need some basic functionality) but can't image it hasn't been done
> already...

ConnectionKit has basic functionality for WebDAV. And HTTP, FTP, SFTP,
.Mac and Amazon S3...

http://opensource.utr-software.com/connection/

 -- Finlay
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Design question, which controller class to use

2008-07-21 Thread Hamish Allan
On Mon, Jul 21, 2008 at 4:05 AM, James W. Walker <[EMAIL PROTECTED]> wrote:

> I have these windows, each of which has a table displaying data from an
> array of dictionaries.  The data is never stored on disk, so I don't think
> of these windows as "documents".

In addition to what Jens said: If the user can create new ones and
they are largely unrelated to one another, you may yet find it easier
to use most of the NSDocument machinery but disable the persistence
stuff. If there are a fixed number and/or they are interrelated, it
may be easier to use NSWindowController directly.

Hamish
___

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

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

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

This email sent to [EMAIL PROTECTED]


Read/Write to info.plist's LSEnvironment

2008-07-21 Thread Lee, Frederick
Simple need: to store NSString values (UserName, PW) in a Dictionary
format within my application's .plist.

I've read Apple's Cocoa literature and found that .plist's LSEnvironment
is the way to go.

 

 

Using the .plist editor to add LSEnvironment dictionary and member keys
is straight forward.

 

But I'm having trouble figuring out how to programmatically
update/retrieve these values.

 

>From what I've read, I need to use Core Foundation utilities (prefer
NS).

 

So, I guess I need to:

1)   create a CF path to the .plist within my application bundle.

2)  Then I need to access this .plist: CFPreferenceCopyAppValue().

3)  Then I do a CFPreferencesSetValue?

 

My .plist has the following:

LSEnvironment = {

   RequesterID = " ";

  Password = " ";

};

...

I just want to set/get these two members of LSEnvironment.

 

Regards,

Ric.

 

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Newbie CALayer Questions

2008-07-21 Thread Scott Anguish


On 21-Jul-08, at 10:48 AM, Bob Barnes wrote:



  I hadn't considered that but I cut and pasted it directly from the  
documentation.


- (void)drawInContext(CGContextRef)ctx {
   NSLog(@"drawInContext called");
}


that should be

- (void)drawInContext:(CGContextRef)ctx


(copied and pasted from the reference doc)


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to receive my own crash reports?

2008-07-21 Thread Andreas Mayer


Am 21.07.2008 um 14:49 Uhr schrieb Torsten Curdt:


http://vafer.org/projects/feedbackreporter/

Feedback welcome :)


I don't have git installed and I don't plan to change that to look at  
just one project.


Could you please include the source with the download?


Andreas
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: webDAV (lite) framework?

2008-07-21 Thread Matt Long
It has a lot of compiler warnings when you build it under Leopard, but  
the Connection Kit: http://opensource.utr-software.com/connection/

says it does support WebDAV.

-Matt


On Jul 21, 2008, at 9:59 AM, Abernathy, Joshua wrote:


Goliath (http://www.webdav.org/goliath/) is an open source WebDAV
client. It's pretty sucky but it might give you a start. It uses  
DAVLib

(http://www.webdav.org/goliath/davlib.html) which is really old but
again, might give you a start.

J

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
] On Behalf Of Jens Alfke
Sent: Monday, July 21, 2008 11:55 AM
To: Tony Becker
Cc: cocoa-dev@lists.apple.com
Subject: Re: webDAV (lite) framework?


On 21 Jul '08, at 7:49 AM, Tony Becker wrote:


If you're Leopard only, you can look at Calendar Store:


http://developer.apple.com/documentation/AppleApplications/Conceptual/Ca
lendarStoreProgGuide/Introduction/Introduction.html

He asked about WebDAV, not CalDAV (which is a calendar-specific
protocol that happens to use WebDAV as its transport.)

I don't know of any public Obj-C framework for WebDAV, unfortunately.

-Jens
___



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Being notified of changes to a file

2008-07-21 Thread Dmitri Goutnik

On Jul 20, 2008, at 8:37 PM, Yann Disser wrote:


Hi everyone.

I am trying to execute a ruby script from within a Cocoa  
application. I want to use NSTask (any better ideas?).


My scripts outputs its progress by printing single lines on standard  
out containing percentages (e.g. "15%"). How can I update my  
application continuously depending on that progress? (for progress  
bars and other output)


Thank you a lot,
Yann


Take a look at AMShellWrapper (http://www.harmless.de/cocoa-code.php).

Another problem is that by default stdout is buffered, so you'll need  
to turn that off in your Ruby code to get line-by-line output  
(STDOUT.sync = true).


- Dmitri

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: setting image for person in address book

2008-07-21 Thread Jens Alfke


On 20 Jul '08, at 9:09 PM, Vijay Kanse wrote:


I am getting the Image set for the Person.
I was Missing to write [NSURL URLWithString@"url path"].


But it's easier just to use -initWithContentsOfFile:, as you were  
originally doing. Your mistake was that the string contained a file:  
URL, not a simple filesystem path.


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: NSURLConnection - bypass Keychain dialog?

2008-07-21 Thread Jens Alfke


On 21 Jul '08, at 8:48 AM, William Bates wrote:

I'm writing an app that automates lots of little uploads to a  
server. My NSURLConnection delegate is all set to handle  
authorization requests - it knows the passwords - but 99% of the  
time it does not get reached, but rather the Keychain Access dialog  
comes up "App Name wants access to your keychain..." which just  
scares and confuses the people who have to use this thing.


But that's the correct behavior. Using the keychain is easier and more  
secure than prompting the user for a password. Most Mac apps that  
access passwords work this way.


If the user grants the app access, the alert won't come up again. I'm  
not sure why your users would get scared or confused, but it sounds  
like you need to educate them a bit about this common system feature.


—Jens



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

RE: webDAV (lite) framework?

2008-07-21 Thread Abernathy, Joshua
Goliath (http://www.webdav.org/goliath/) is an open source WebDAV
client. It's pretty sucky but it might give you a start. It uses DAVLib
(http://www.webdav.org/goliath/davlib.html) which is really old but
again, might give you a start.

J

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
] On Behalf Of Jens Alfke
Sent: Monday, July 21, 2008 11:55 AM
To: Tony Becker
Cc: cocoa-dev@lists.apple.com
Subject: Re: webDAV (lite) framework?


On 21 Jul '08, at 7:49 AM, Tony Becker wrote:

> If you're Leopard only, you can look at Calendar Store:
>
http://developer.apple.com/documentation/AppleApplications/Conceptual/Ca
lendarStoreProgGuide/Introduction/Introduction.html

He asked about WebDAV, not CalDAV (which is a calendar-specific  
protocol that happens to use WebDAV as its transport.)

I don't know of any public Obj-C framework for WebDAV, unfortunately.

-Jens
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: webDAV (lite) framework?

2008-07-21 Thread Jens Alfke


On 21 Jul '08, at 7:49 AM, Tony Becker wrote:


If you're Leopard only, you can look at Calendar Store:
http://developer.apple.com/documentation/AppleApplications/Conceptual/CalendarStoreProgGuide/Introduction/Introduction.html


He asked about WebDAV, not CalDAV (which is a calendar-specific  
protocol that happens to use WebDAV as its transport.)


I don't know of any public Obj-C framework for WebDAV, unfortunately.

—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

NSURLConnection - bypass Keychain dialog?

2008-07-21 Thread William Bates
I'm writing an app that automates lots of little uploads to a server.  
My NSURLConnection delegate is all set to handle authorization  
requests - it knows the passwords - but 99% of the time it does not  
get reached, but rather the Keychain Access dialog comes up "App Name  
wants access to your keychain..." which just scares and confuses the  
people who have to use this thing.

 Any thoughts? Perhaps I have to pre-empt keychain access?
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Being notified of changes to a file

2008-07-21 Thread Vitaly Ovchinnikov
I don't think that you can capture stdout. You need to create a pipe
and redirect your script's output there. And then read from that pipe,
parse and update your progress indicator. A good starting point is
here:
http://www.cocoadev.com/index.pl?NSPipe

On Mon, Jul 21, 2008 at 11:56 AM, Yann Disser <[EMAIL PROTECTED]> wrote:
> Thanks for your reply.
>
> Hmm, the subject is rather ill chosen. (I started to write the mail and then
> looked a little more into NSPipe before finishing it) My script actually
> writes to stdout.
>
> What I am trying to figure out, is how to respond right away to every single
> line that is written on stdout without waiting for the process to be
> finished.
>
> Perhaps I got something wrong...
>
> Thanks,
> Yann
>
> On 21. Jul 2008, at 0:38, Jens Alfke wrote:
>
>>
>> On 20 Jul '08, at 9:37 AM, Yann Disser wrote:
>>
>>> I am trying to execute a ruby script from within a Cocoa application. I
>>> want to use NSTask (any better ideas?).
>>
>> You can use the Ruby C API to run Ruby inside your process, but that's
>> definitely more work.
>>
>>> My scripts outputs its progress by printing single lines on standard out
>>> containing percentages (e.g. "15%"). How can I update my application
>>> continuously depending on that progress? (for progress bars and other
>>> output)
>>
>> Your subject implies you're writing to a file; don't do that. The Ruby
>> script should write to stdout, and you app should hook up an NSPipe to the
>> NSTask to read its output directly. (This can be a bit tricky, but there's
>> Apple sample code that shows how to do it.)
>>
>> —Jens
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/vitaly.ovchinnikov%40gmail.com
>
> This email sent to [EMAIL PROTECTED]
>
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to get a table column header with an image instead of text?

2008-07-21 Thread Corbin Dunn


On Jul 20, 2008, at 12:48 PM, Marc Respass wrote:



On Jul 20, 2008, at 2:05 PM, Adam R. Maxwell wrote:



On Jul 20, 2008, at 10:57 AM, Jean-Daniel Dupas wrote:



Le 20 juil. 08 à 19:54, Marc Respass a écrit :


Hi again,

I hate answering my own question but I did figure it out. I sub- 
classed NSTableHeaderCell then created an instance using  
initImageCell. Then it occurred to me that it seemed a bit silly.  
If I can init an image cell, maybe I can just set the cell. So,  
create an outlet to the column (or find it somehow) and in  
awakeFromNib,


NSImage *image = [NSImage imageNamed:@"CellImage"];
[[theColumn headerCell] setImage:image];

Now to figure out how to prevent the sort indicator from  
displaying :).


Subclass NSTableColumneHeaderCell and override

- (void)drawSortIndicatorWithFrame:(NSRect)cellFrame inView: 
(NSView*)controlView ascending:(BOOL)ascending priority: 
(NSInteger)priority


I'd try -[NSTableView setIndicatorImage:inTableColumn:] passing nil  
for the indicator image first.


Thank you both.

[[indicatorColumn tableView] setIndicatorImage:nil  
inTableColumn:indicatorColumn];


still displays the image. I imagine it uses the default (clearing  
your potential custom image) if you pass nil. However, it seems like  
a hack but the column is narrow. If it is resized to fit the image  
in the column header, then the indicator image does not show. In  
fact, I can simply set the column to not be resizable and invoke  
sizeToFit which sizes it perfectly.


I don't recommend that approach; it is taking advantage of the fact  
that there isn't enough room to show both.


The proper way to hide the sort indicator is to make sure you don't  
have a sortDescriptorPrototype set (sort key/ selector in IB) and turn  
column selection off.


corbin___

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

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

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

This email sent to [EMAIL PROTECTED]


Creating multiple popup window

2008-07-21 Thread Idan Katalan

Hi,

I want to create a window that can have multiple instances which every instance 
displays different data.
Something like little pop-up windows in the bottom right corner of a window.

I managed to create a single window that has a view and a controller with 
interface builder.
and I already created a class in Xcode and directed the class attribute to my 
type of window.

I've also managed to display an empty window.

What I can't figure out is how to put a view and a controller in the empty 
window.

Regards,
Idan







This footnote confirms that this email message has been scanned by
PineApp Mail-SeCure for the presence of malicious code, vandals & computer 
viruses.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: webDAV (lite) framework?

2008-07-21 Thread Tony Becker

If you're Leopard only, you can look at Calendar Store:

http://developer.apple.com/documentation/AppleApplications/Conceptual/CalendarStoreProgGuide/Introduction/Introduction.html

On Jul 21, 2008, at 10:37 AM, William Bates wrote:

Is there an objective-C webDAV framework around? I've been rolling  
my own (I only need some basic functionality) but can't image it  
hasn't been done already...

___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Newbie CALayer Questions

2008-07-21 Thread Bob Barnes


On Jul 20, 2008, at 10:43 PM, Scott Anguish wrote:

that shouldn't be an issue if he's explicitly calling the 
setNeedsDisplay


is the method signature correct on your implementation of 
drawInContext:?




On 21-Jul-08, at 12:22 AM, Brian Christensen wrote:


On Jul 20, 2008, at 20:00, Bob Barnes wrote:

 I have some questions related to CALayer drawing. I want to be able 
to display images, text, 2D graphics or a PDF page. I'm able to 
display an image by directly setting the contents property using a 
CGImageRef or subclassing CALayer, overriding display and sending 
setNeedsDisplay, but nothing I do seems to trigger the call to 
drawInContext. I've tried using a delegate for the CALayer and  
subclassing CALayer, but drawInContext never gets called. Is there 
something fundamental that I'm missing?


Is the needsDisplayOnBoundsChange property set to YES on your layer?






   I hadn't considered that but I cut and pasted it directly from the 
documentation.


- (void)drawInContext(CGContextRef)ctx {
NSLog(@"drawInContext called");
}

Bob

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Newbie CALayer Questions

2008-07-21 Thread Bob Barnes


On Jul 20, 2008, at 9:22 PM, Brian Christensen wrote:


On Jul 20, 2008, at 20:00, Bob Barnes wrote:

  I have some questions related to CALayer drawing. I want to be able 
to display images, text, 2D graphics or a PDF page. I'm able to 
display an image by directly setting the contents property using a 
CGImageRef or subclassing CALayer, overriding display and sending 
setNeedsDisplay, but nothing I do seems to trigger the call to 
drawInContext. I've tried using a delegate for the CALayer and  
subclassing CALayer, but drawInContext never gets called. Is there 
something fundamental that I'm missing?


Is the needsDisplayOnBoundsChange property set to YES on your layer?

/brian




   I was under the impression that it didn't matter, but yes, I've 
tried that as well.


Bob

___

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

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

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

This email sent to [EMAIL PROTECTED]


webDAV (lite) framework?

2008-07-21 Thread William Bates
Is there an objective-C webDAV framework around? I've been rolling my  
own (I only need some basic functionality) but can't image it hasn't  
been done already...

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Being notified of changes to a file

2008-07-21 Thread Michael Ash
On Mon, Jul 21, 2008 at 3:56 AM, Yann Disser <[EMAIL PROTECTED]> wrote:
> Thanks for your reply.
>
> Hmm, the subject is rather ill chosen. (I started to write the mail and then
> looked a little more into NSPipe before finishing it) My script actually
> writes to stdout.
>
> What I am trying to figure out, is how to respond right away to every single
> line that is written on stdout without waiting for the process to be
> finished.

If the problem is that you get big chunks all at once instead of line
by line, then the problem is in your ruby program, not your Cocoa
program. You need to flush stdout after you write each line, otherwise
the system will buffer the output for better performance, which will
lead to chunking. There is nothing special to do on the Cocoa side
besides sign up for notifications or block on -availableData in a
thread. But you won't get chunks smaller than what the other side is
writing.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to receive my own crash reports?

2008-07-21 Thread Torsten Curdt


http://vafer.org/projects/feedbackreporter/

Feedback welcome :)

cheers
--
Torsten

On Jul 21, 2008, at 14:38, Vitaly Ovchinnikov wrote:


Hello,

Apple's CrashReporter sends crash reports to Apple only and there is
no way for me to receive them too.
ILCrashReporter from http://www.infinite-loop.dk doesn't know that in
Leopard crash reports files named differently than in Tiger and it
reads old reports instead of new ones.

What I want is a small framework that I will attach to my project and
that will send crash report by HTTP to my web-site, SMTP is not a good
idea, because of spam-filters.
Do you know something alike?

Thank you.
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/tcurdt%40vafer.org

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


How to receive my own crash reports?

2008-07-21 Thread Vitaly Ovchinnikov
Hello,

Apple's CrashReporter sends crash reports to Apple only and there is
no way for me to receive them too.
ILCrashReporter from http://www.infinite-loop.dk doesn't know that in
Leopard crash reports files named differently than in Tiger and it
reads old reports instead of new ones.

What I want is a small framework that I will attach to my project and
that will send crash report by HTTP to my web-site, SMTP is not a good
idea, because of spam-filters.
Do you know something alike?

Thank you.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Being notified of changes to a file

2008-07-21 Thread Yann Disser

Thanks for your reply.

Hmm, the subject is rather ill chosen. (I started to write the mail  
and then looked a little more into NSPipe before finishing it) My  
script actually writes to stdout.


What I am trying to figure out, is how to respond right away to every  
single line that is written on stdout without waiting for the process  
to be finished.


Perhaps I got something wrong...

Thanks,
Yann

On 21. Jul 2008, at 0:38, Jens Alfke wrote:



On 20 Jul '08, at 9:37 AM, Yann Disser wrote:

I am trying to execute a ruby script from within a Cocoa  
application. I want to use NSTask (any better ideas?).


You can use the Ruby C API to run Ruby inside your process, but  
that's definitely more work.


My scripts outputs its progress by printing single lines on  
standard out containing percentages (e.g. "15%"). How can I update  
my application continuously depending on that progress? (for  
progress bars and other output)


Your subject implies you're writing to a file; don't do that. The  
Ruby script should write to stdout, and you app should hook up an  
NSPipe to the NSTask to read its output directly. (This can be a bit  
tricky, but there's Apple sample code that shows how to do it.)


—Jens


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSWindowController getting over-released by NSDocument?

2008-07-21 Thread Markus Spoettl

On Jul 20, 2008, at 11:53 PM, Markus Spoettl wrote:
 I'm having some problems with memory management of a window  
controller in a standard NSDocument based application. The problem  
is that my window controller gets released through an autorelease  
pool after the document has been deallocated (and released it in the  
process).



Please ignore this, it's not the window controller that is being  
release, I was fooled by the debugger break I had in dealloc.


Sorry for wasting your time.

Regards
Markus
--
__
Markus Spoettl



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]