Re: Isolate NSTextView from NSColorWell

2010-06-23 Thread Bernard Knaepen
The NSTextView is indeed richtext and this is what I need. Do I need to 
subclass the NSColorWell or the NSTextView? I need to be able to change the 
color of the text as well...

Thanks,

Bernard.


On 23 Jun 2010, at 09:02, Scott Anguish wrote:

> is the NSTextView set as allowing rich text? if so, this is expected, and 
> you’d need to do some subclassing.
> 
> otherwise, just make sure the textview richtext support is off (assuming that 
> is consistent with your application’s needs)
> 
> 
> On Jun 23, 2010, at 2:49 AM, Bernard Knaepen wrote:
> 
>> Hi all,
>> 
>> I have a window created in IB containing a NSScrollView embedding a 
>> NSTextView. In the same window I have a NSColorWell which is supposed to 
>> store the color preference for a given object not related to the NSTextView.
>> 
>> I would like to be able to change the color of the NSColorWell without 
>> affecting the NSTextView at all. However, if I start to type in the text 
>> field and then click on the NSColorWell, I am able to change the color of 
>> the well but this also affects the color of the character that will be typed 
>> later on in the text field. In other words, the color panel changes the 
>> color of both the well and the text which is not what I want.
>> 
>> I spent a lot of time looking in the doc to isolate this NSColorWell from 
>> the NSTextView without finding a solution.
>> 
>> I would be grateful if someone could help me with this or point me to the 
>> relevant part of the documentation.
>> 
>> Thanks,
>> 
>> Bernard.
>> 
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post 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/scott%40cocoadoc.com
>> 
>> This email sent to sc...@cocoadoc.com
> 

___

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

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

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

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


Re: Problem with stopModalWithCode on a different thread

2010-06-23 Thread Jens Alfke

On Jun 22, 2010, at 7:49 PM, Bill Appleton wrote:

> i am pointing out that there is a giant, giant, giant difference between 
> plugins that impose themselves on the user and those that are invoked because 
> the user wants them.

Plugins don’t impose themselves, nor are they invoked by a user; they’re always 
invoked by content on a web page. The user might go to that web page 
specifically to use the plugin, or it might be a side effect, but the mechanism 
is the same regardless.

> all of the security stuff you are talking about is appropriate for the 
> former. all of this security stuff just makes users of the latter pissed off.

No, the ‘security stuff’ is appropriate regardless. If a bunch of people 
install your plugin, and if someone were to find a security hole in it that 
lets them do something nasty to your computer, then websites would inevitably 
pop up that invoked your plugin and exploited the bug.

Note that web plugins are more susceptible to attack than regular apps because, 
once installed, they can be invoked and run _automatically_ by web content, 
with absolutely no warning and no permission needed by the user. The user might 
not even know that it’s running. This makes web plugins probably the most 
potentially-dangerous type of software you can install.

> this is absolutely key. we have 10 K companies that desperately need a simple 
> way to install and use our player. this is mission critical for them.

Simplicity and convenience don’t usually go along with security, unfortunately. 
For example, ActiveX was a very simple and convenient way to extend the web 
experience (in MSIE on Windows at least), and it became a big part of why 
Windows had so many security problems.

—Jens___

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

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

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

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


Re: Incomplete rendering returned from glReadPixels

2010-06-23 Thread Ben Haller

On 22-Jun-10, at 12:28 PM, Michael Ash wrote:


On Tue, Jun 22, 2010 at 9:25 AM, Ben Haller
 wrote:
 It's a little weird because this method gets called sometimes on a  
view
that is not yet installed in a window, so I just make a window then  
and
there.  (This is run in a headless command-line app, I ought to  
mention.)
 And yes, I don't bother cleaning up the window and such; right  
after this
image writes out, the task exits, so cleanup doesn't matter.  Note  
that I am
sure the rendering is in fact complete; I see the window flash  
onscreen, and
it has everything in it.  (I can also run my app in a GUI mode, and  
all the

rendering looks right then.)


I don't have an answer to your question, but you might consider
switching to offline rendering for the command-line mode so that you
don't have to mess around with windows and such. You can use
-[NSOpenGLContext setOffScreen:width:height:rowbytes:] to point it
into your own pixel buffer, thus eliminating the need for glReadPixels
completely. Who knows, it might even fix your problem too


  This sounds like an excellent idea.  I'll check it out.  Thanks!

Ben Haller
McGill University


___

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

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

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

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


Re: Auto-hide the window

2010-06-23 Thread jonat...@mugginsoft.com


On 23 Jun 2010, at 04:03, Dong Linlan wrote:

> Hi there, I want to make my window make my window auto-hided and when the
> cursor move to the edge of the screen it will show. Just like the effect of
> QuickSilver's Shelf plugin. I google and found nothing useful. Should I run
> my app as an daemon and detect the global mouse event?

Have you checked out the QuickSilver source?

http://code.google.com/p/blacktree-alchemy/


Regards

Jonathan Mitchell

Developer
Mugginsoft LLP
http://www.mugginsoft.com

___

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

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

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

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


File descriptors not freed up without a -closeFile call

2010-06-23 Thread Ben Haller
  Hi all.  I'm using NSTask and NSPipe to launch lots of little processes, and 
I'm running out of file descriptors.  In my googling and archive searching, I 
found some info that led me to several approaches:

1. I ran ObjectAlloc and Leaks under Instruments and confirmed that I am not 
leaking pipes or file handles.  Nor is it an autorelease pool issue; the run 
loop is running freely as I start and stop tasks, so the pipes and file handles 
get dealloced properly.  All pipes and file handles made by my task code were 
listed by ObjectAlloc as "transitory".

2. I used "lsof -p  | grep -v " txt " | wc -l" to monitor the file 
descriptors used by my app, and observed that it went steadily upwards as tasks 
got started and stopped; the file descriptors were not being freed, even though 
the pipes were being freed correctly.

3. I added [[pipe fileHandleForWriting] closeFile] and [[pipe 
fileHandleForReading] closeFile] calls to close the files associated with the 
pipes when my tasks completed.  This change fixed the problem; I no longer run 
out of file descriptors.

  So I have a workaround for the problem, but I want to understand *why* it 
works.  Shouldn't NSPipe close its associated files when it deallocs?  Why 
should it be necessary to call -closeFile?  This behavior seems to be 
specifically contradicted by the documentation on NSPipe, which says (in 
-fileHandleForReading) "The descriptor represented by this object is deleted, 
and the object itself is automatically deallocated when the receiver is 
deallocated."  Well, when my NSPipes are deallocated, the file handles are 
indeed automatically deallocated (a funny way to put it), but the descriptor is 
*not* deleted.  Is this a bug?  More likely I'm misunderstanding something; can 
anybody clarify this for me?

  Thanks!

Ben Haller
McGill University

___

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

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

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

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


Re: File descriptors not freed up without a -closeFile call

2010-06-23 Thread Jean-Daniel Dupas

Le 23 juin 2010 à 12:14, Ben Haller a écrit :

>  Hi all.  I'm using NSTask and NSPipe to launch lots of little processes, and 
> I'm running out of file descriptors.  In my googling and archive searching, I 
> found some info that led me to several approaches:
> 
> 1. I ran ObjectAlloc and Leaks under Instruments and confirmed that I am not 
> leaking pipes or file handles.  Nor is it an autorelease pool issue; the run 
> loop is running freely as I start and stop tasks, so the pipes and file 
> handles get dealloced properly.  All pipes and file handles made by my task 
> code were listed by ObjectAlloc as "transitory".

Did you try to track your File descriptor problem using the File Activity probe 
instead of memory probes ? 


-- Jean-Daniel




___

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

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

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

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


Re: File descriptors not freed up without a -closeFile call

2010-06-23 Thread Uli Kusterer
Am Jun 23, 2010 um 12:14 PM schrieb Ben Haller:
>  So I have a workaround for the problem, but I want to understand *why* it 
> works.  Shouldn't NSPipe close its associated files when it deallocs?  Why 
> should it be necessary to call -closeFile?  This behavior seems to be 
> specifically contradicted by the documentation on NSPipe, which says (in 
> -fileHandleForReading) "The descriptor represented by this object is deleted, 
> and the object itself is automatically deallocated when the receiver is 
> deallocated."  Well, when my NSPipes are deallocated, the file handles are 
> indeed automatically deallocated (a funny way to put it), but the descriptor 
> is *not* deleted.  Is this a bug?  More likely I'm misunderstanding 
> something; can anybody clarify this for me?

AFAIR, NSPipe autoreleases its NSFileHandles), which means even if you give up 
all your references to the pipe, it won't automatically close everything until 
the current autorelease pool gets popped. While closeFile doesn't get rid of 
the objects, it forces the file handle to be closed, which is why it solves 
your immediate problem.

If you're running your own loop where you create and tear down lots of pipes, 
it might help to just create your own autorelease pool inside the loop on each 
iteration.

-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."



___

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

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

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

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


Re: File descriptors not freed up without a -closeFile call

2010-06-23 Thread Jean-Daniel Dupas

Le 23 juin 2010 à 12:14, Ben Haller a écrit :

> 
>  So I have a workaround for the problem, but I want to understand *why* it 
> works.  Shouldn't NSPipe close its associated files when it deallocs?  Why 
> should it be necessary to call -closeFile?  This behavior seems to be 
> specifically contradicted by the documentation on NSPipe, which says (in 
> -fileHandleForReading) "The descriptor represented by this object is deleted, 
> and the object itself is automatically deallocated when the receiver is 
> deallocated."  Well, when my NSPipes are deallocated, the file handles are 
> indeed automatically deallocated (a funny way to put it), but the descriptor 
> is *not* deleted.  Is this a bug?  More likely I'm misunderstanding 
> something; can anybody clarify this for me?


In fact, this is not contradicted by the documentation:

See the  "Resource Management" section in "Memory Management programming guide"

http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmObjectOwnership.html#//apple_ref/doc/uid/2043-SW6

«You should typically not manage scarce resources such as file descriptors, 
network connections, and buffers/caches in a dealloc method. In particular, you 
should not design classes such that you are assuming that dealloc will be 
invoked when you think it will be invoked. Invocation of dealloc might be 
delayed or sidestepped, either because of a bug or because of application 
tear-down.

Instead, if you have a class whose instances manage scarce resources, you 
should design your application such that you know when you no longer need the 
resources and can then tell the instance to “clean up” at that point. You would 
typically then release the instance and dealloc would follow, but you will not 
suffer additional problems if it does not.»


-- Jean-Daniel




___

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

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

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

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


Re: File descriptors not freed up without a -closeFile call

2010-06-23 Thread Ben Haller

On 23-Jun-10, at 6:34 AM, Jean-Daniel Dupas wrote:


Le 23 juin 2010 à 12:14, Ben Haller a écrit :

So I have a workaround for the problem, but I want to understand  
*why* it works.  Shouldn't NSPipe close its associated files when  
it deallocs?  Why should it be necessary to call -closeFile?  This  
behavior seems to be specifically contradicted by the documentation  
on NSPipe, which says (in -fileHandleForReading) "The descriptor  
represented by this object is deleted, and the object itself is  
automatically deallocated when the receiver is deallocated."  Well,  
when my NSPipes are deallocated, the file handles are indeed  
automatically deallocated (a funny way to put it), but the  
descriptor is *not* deleted.  Is this a bug?  More likely I'm  
misunderstanding something; can anybody clarify this for me?


In fact, this is not contradicted by the documentation:

See the  "Resource Management" section in "Memory Management  
programming guide"


http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmObjectOwnership.html#/ 
/apple_ref/doc/uid/2043-SW6


«You should typically not manage scarce resources such as file  
descriptors, network connections, and buffers/caches in a dealloc  
method. In particular, you should not design classes such that you  
are assuming that dealloc will be invoked when you think it will be  
invoked. Invocation of dealloc might be delayed or sidestepped,  
either because of a bug or because of application tear-down.


Instead, if you have a class whose instances manage scarce  
resources, you should design your application such that you know  
when you no longer need the resources and can then tell the instance  
to “clean up” at that point. You would typically then release the  
instance and dealloc would follow, but you will not suffer  
additional problems if it does not.»


  That's all well and good, but in point of fact dealloc *is* being  
called on the NSFileHandle, and yet the file descriptor is not being  
released.  I agree that calling -closeFile explicitly when I know I'm  
done with it is probably good programming practice for the reasons  
above; but it should not be *necessary*, given that the file handles  
are in fact being dealloced in a timely manner.


Ben Haller
McGill University

___

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

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

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

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


Re: File descriptors not freed up without a -closeFile call

2010-06-23 Thread Ben Haller

On 23-Jun-10, at 6:22 AM, Uli Kusterer wrote:


Am Jun 23, 2010 um 12:14 PM schrieb Ben Haller:
So I have a workaround for the problem, but I want to understand  
*why* it works.  Shouldn't NSPipe close its associated files when  
it deallocs?  Why should it be necessary to call -closeFile?  This  
behavior seems to be specifically contradicted by the documentation  
on NSPipe, which says (in -fileHandleForReading) "The descriptor  
represented by this object is deleted, and the object itself is  
automatically deallocated when the receiver is deallocated."  Well,  
when my NSPipes are deallocated, the file handles are indeed  
automatically deallocated (a funny way to put it), but the  
descriptor is *not* deleted.  Is this a bug?  More likely I'm  
misunderstanding something; can anybody clarify this for me?


AFAIR, NSPipe autoreleases its NSFileHandles), which means even if  
you give up all your references to the pipe, it won't automatically  
close everything until the current autorelease pool gets popped.  
While closeFile doesn't get rid of the objects, it forces the file  
handle to be closed, which is why it solves your immediate problem.


If you're running your own loop where you create and tear down lots  
of pipes, it might help to just create your own autorelease pool  
inside the loop on each iteration.


  Yes; this is not an autorelease pool problem, however, as I  
described in my original post.  The run loop is running freely, and  
the pipes and file handles are in fact getting dealloced; I have  
confirmed this explicitly in Instruments.  And yet, the file  
descriptors don't get deleted unless I explicitly call -closeFile.   
That's the mystery (or is it a bug?).


Ben Haller
McGill University


___

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

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

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

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


Custom views in navigationbar (iOS 3.2)

2010-06-23 Thread Christian Ziegler
Hi guys,

I'm having a hard time with the navigation bar. What I'm trying to do is adding 
a custom breadcrumbs navigation to the bar. I coded two classes, a subclass of 
UIButton for the breadcrumbs segments and a sublcass of UIView for the whole 
bar. The bar has a home segment which represents the rootViewController of the 
navigationController and you can add additional segments when you push new 
viewControllers on to the navigationController's stack. 
When I put the bar in the leftBarButtonItem it displays the home segment and it 
also adds segments when I push new view controllers. So far so good, but if I 
click on on of the segments to pop to the respective view controller the action 
method does not get called unless its the home segment (which is the first 
button in the custom view). The home segment works fine but all other segments 
are being ignored.
As a workaround I tried putting the bar in the titleView. Another problem 
occured. On the rootViewController it correctly displays the home segment, but 
when I push a new viewController the updated (with an additional segment) bar 
fades in and then it disappears leaving me with an empty navigationbar. Same 
thing happens when I push another viewController. Funnily enough, if I do not 
set the titleview of the second viewcontroller's navigationItem but I still set 
it on the third, the titleview does not disappear on the third viewController, 
although I'm doing exactly the same.

Anyone got an idea? 

One more question on the side: Are the width of the left/rightBarButtonItem and 
titleView limited?

Cheers,
Chris
___

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

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

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

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


Re: File descriptors not freed up without a -closeFile call

2010-06-23 Thread Jean-Daniel Dupas

Le 23 juin 2010 à 12:47, Ben Haller a écrit :

> On 23-Jun-10, at 6:22 AM, Uli Kusterer wrote:
> 
>> Am Jun 23, 2010 um 12:14 PM schrieb Ben Haller:
>>> So I have a workaround for the problem, but I want to understand *why* it 
>>> works.  Shouldn't NSPipe close its associated files when it deallocs?  Why 
>>> should it be necessary to call -closeFile?  This behavior seems to be 
>>> specifically contradicted by the documentation on NSPipe, which says (in 
>>> -fileHandleForReading) "The descriptor represented by this object is 
>>> deleted, and the object itself is automatically deallocated when the 
>>> receiver is deallocated."  Well, when my NSPipes are deallocated, the file 
>>> handles are indeed automatically deallocated (a funny way to put it), but 
>>> the descriptor is *not* deleted.  Is this a bug?  More likely I'm 
>>> misunderstanding something; can anybody clarify this for me?
>> 
>> AFAIR, NSPipe autoreleases its NSFileHandles), which means even if you give 
>> up all your references to the pipe, it won't automatically close everything 
>> until the current autorelease pool gets popped. While closeFile doesn't get 
>> rid of the objects, it forces the file handle to be closed, which is why it 
>> solves your immediate problem.
>> 
>> If you're running your own loop where you create and tear down lots of 
>> pipes, it might help to just create your own autorelease pool inside the 
>> loop on each iteration.
> 
>  Yes; this is not an autorelease pool problem, however, as I described in my 
> original post.  The run loop is running freely, and the pipes and file 
> handles are in fact getting dealloced; I have confirmed this explicitly in 
> Instruments.  And yet, the file descriptors don't get deleted unless I 
> explicitly call -closeFile.  That's the mystery (or is it a bug?).
> 

I just ran the following simple program in Instrument with "File Activity" 
probe, and I get exactly the expected result:
Opened file descriptors raise up to ~1000 (2 by pipes), and fall to ~0 in each 
drain call.

#import 

int main (int argc, const char * argv[]) {
  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
  
  for (NSUInteger idx = 0; idx < 1; idx++) {
NSPipe *pipe = [NSPipe pipe];
[pipe fileHandleForReading];
if (0 == (idx % 500)) {
  [pool drain];
  pool = [[NSAutoreleasePool alloc] init];
} 
  }
  [pool drain];
  return 0;
}


-- Jean-Daniel




___

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

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

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

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


Re: File descriptors not freed up without a -closeFile call

2010-06-23 Thread jonat...@mugginsoft.com









On 23 Jun 2010, at 11:47, Ben Haller wrote:

> On 23-Jun-10, at 6:22 AM, Uli Kusterer wrote:
> 
>> Am Jun 23, 2010 um 12:14 PM schrieb Ben Haller:
>>> So I have a workaround for the problem, but I want to understand *why* it 
>>> works.  Shouldn't NSPipe close its associated files when it deallocs?  Why 
>>> should it be necessary to call -closeFile?  This behavior seems to be 
>>> specifically contradicted by the documentation on NSPipe, which says (in 
>>> -fileHandleForReading) "The descriptor represented by this object is 
>>> deleted, and the object itself is automatically deallocated when the 
>>> receiver is deallocated."  Well, when my NSPipes are deallocated, the file 
>>> handles are indeed automatically deallocated (a funny way to put it), but 
>>> the descriptor is *not* deleted.  Is this a bug?  More likely I'm 
>>> misunderstanding something; can anybody clarify this for me?
>> 
>> AFAIR, NSPipe autoreleases its NSFileHandles), which means even if you give 
>> up all your references to the pipe, it won't automatically close everything 
>> until the current autorelease pool gets popped. While closeFile doesn't get 
>> rid of the objects, it forces the file handle to be closed, which is why it 
>> solves your immediate problem.
>> 
>> If you're running your own loop where you create and tear down lots of 
>> pipes, it might help to just create your own autorelease pool inside the 
>> loop on each iteration.
> 
>  Yes; this is not an autorelease pool problem, however, as I described in my 
> original post.  The run loop is running freely, and the pipes and file 
> handles are in fact getting dealloced; I have confirmed this explicitly in 
> Instruments.  And yet, the file descriptors don't get deleted unless I 
> explicitly call -closeFile.  That's the mystery (or is it a bug?).
> 
To me it seems pretty explicit in the NSPipe docs

http://developer.apple.com/mac/library/documentation/cocoa/reference/foundation/Classes/NSPipe_Class/Reference/Reference.html#//apple_ref/occ/instm/NSPipe/fileHandleForWriting

fileHandleForReading

You use the returned file handle to read from the pipe using NSFileHandle's 
read methods—availableData,readDataToEndOfFile, and readDataOfLength:.
You don’t need to send closeFile to this object or explicitly release the 
object after you have finished using it.

fileHandleForWriting

You use the returned file handle to write to the pipe using NSFileHandle's 
writeData: method. When you are finished writing data to this object, send it a 
closeFile message to delete the descriptor. Deleting the descriptor causes the 
reading process to receive an end-of-data signal (an empty NSData object).

So you can dispense with closeFile on the read handle.

Regards

Jonathan Mitchell

Developer
Mugginsoft LLP
http://www.mugginsoft.com
> Ben Haller
> McGill University
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/jonathan%40mugginsoft.com
> 
> This email sent to jonat...@mugginsoft.com

___

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

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

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

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


Re: File descriptors not freed up without a -closeFile call

2010-06-23 Thread Ben Haller

On 23-Jun-10, at 6:59 AM, jonat...@mugginsoft.com wrote:


On 23 Jun 2010, at 11:47, Ben Haller wrote:


On 23-Jun-10, at 6:22 AM, Uli Kusterer wrote:


Am Jun 23, 2010 um 12:14 PM schrieb Ben Haller:
So I have a workaround for the problem, but I want to understand  
*why* it works.  Shouldn't NSPipe close its associated files when  
it deallocs?  Why should it be necessary to call -closeFile?   
This behavior seems to be specifically contradicted by the  
documentation on NSPipe, which says (in -fileHandleForReading)  
"The descriptor represented by this object is deleted, and the  
object itself is automatically deallocated when the receiver is  
deallocated."  Well, when my NSPipes are deallocated, the file  
handles are indeed automatically deallocated (a funny way to put  
it), but the descriptor is *not* deleted.  Is this a bug?  More  
likely I'm misunderstanding something; can anybody clarify this  
for me?


AFAIR, NSPipe autoreleases its NSFileHandles), which means even if  
you give up all your references to the pipe, it won't  
automatically close everything until the current autorelease pool  
gets popped. While closeFile doesn't get rid of the objects, it  
forces the file handle to be closed, which is why it solves your  
immediate problem.


If you're running your own loop where you create and tear down  
lots of pipes, it might help to just create your own autorelease  
pool inside the loop on each iteration.


Yes; this is not an autorelease pool problem, however, as I  
described in my original post.  The run loop is running freely, and  
the pipes and file handles are in fact getting dealloced; I have  
confirmed this explicitly in Instruments.  And yet, the file  
descriptors don't get deleted unless I explicitly call -closeFile.   
That's the mystery (or is it a bug?).



To me it seems pretty explicit in the NSPipe docs

http://developer.apple.com/mac/library/documentation/cocoa/reference/foundation/Classes/NSPipe_Class/Reference/Reference.html#/ 
/apple_ref/occ/instm/NSPipe/fileHandleForWriting


fileHandleForReading

You use the returned file handle to read from the pipe using  
NSFileHandle's read methods—availableData,readDataToEndOfFile, and  
readDataOfLength:.
You don’t need to send closeFile to this object or explicitly  
release the object after you have finished using it.


fileHandleForWriting

You use the returned file handle to write to the pipe using  
NSFileHandle's writeData: method. When you are finished writing data  
to this object, send it a closeFile message to delete the  
descriptor. Deleting the descriptor causes the reading process to  
receive an end-of-data signal (an empty NSData object).


So you can dispense with closeFile on the read handle.


  Ah, interesting.  I missed that in the docs.  It still seems bad to  
me that the file handle will actually dealloc without closing its  
associated file descriptor, but perhaps you are right that that is the  
documented behavior.  I'll just stop worrying about it and move on,  
then.  Thanks!


Ben Haller
McGill University

___

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

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

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

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


Re: File descriptors not freed up without a -closeFile call

2010-06-23 Thread Dave Keck
>  Ah, interesting.  I missed that in the docs.  It still seems bad to me that
> the file handle will actually dealloc without closing its associated file
> descriptor, but perhaps you are right that that is the documented behavior.
>  I'll just stop worrying about it and move on, then.  Thanks!

NSPipe and its NSFileHandles work as you expect: when the read/write
file handles created via NSPipe are deallocated, the underlying
descriptors are closed. Along with Jean-Daniel Dupas, I created a
simple test case and it behaves as expected. (I've also been using
NSPipe/NSFileHandle extensively for years and have never come across
anything like you described.)

I'd be interested in seeing a test case showing the incorrect behavior.
___

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

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

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

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


Re: Using Field Editor correctly in custom NSCell

2010-06-23 Thread Alastair Houghton
On 23 Jun 2010, at 02:56, Graham Cox wrote:

> For example, it seems that the cell should override 
> -setUpFieldEditorAttributes: but what should this method actually do? In the 
> cell code I have, this method has been commented out, and the field editor 
> "set up" is being done in -editWithFrame:inView:editor:delegate:event: (and 
> the same set up is repeated in the -selectWithFrame:... method). Clearly this 
> is wrong since it doesn't work. However, if I uncomment the 
> -setUpFieldEditorAttributes: method, it's no better - at first the text is 
> the right size but reverts to the bigger font when I type, and at the end of 
> editing the field editor doesn't go away as it should, so the label is just 
> overdrawn with a blank white box.

Just OTOH, it sounds like the field editor's delegate may be pointing to the 
wrong place (it should point at the NSControl), or that the control isn't 
implementing the NSText delegate methods as expected (you can see in the 
NSTextField docs what they're supposed to do).  Also, the changing font thing 
sounds like perhaps the typing attributes aren't set on the field editor.

Kind regards,

Alastair.

--
http://alastairs-place.net



___

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

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

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

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


Re: File descriptors not freed up without a -closeFile call

2010-06-23 Thread Alastair Houghton
On 23 Jun 2010, at 11:14, Ben Haller wrote:

> 3. I added [[pipe fileHandleForWriting] closeFile] and [[pipe 
> fileHandleForReading] closeFile] calls to close the files associated with the 
> pipes when my tasks completed.  This change fixed the problem; I no longer 
> run out of file descriptors.

Are you making the classic NSTask mistake of doing [pipe fileHandleForReading] 
or [pipe fileHandleForWriting] and then using that with -setStandardOutput: or 
-setStandardInput:?

NSTask is odd in this respect, in that you're supposed to just pass the 
*NSPipe*, not a file handle derived from it.  If you do the latter, IIRC (from 
the last time I did this, which was ages ago) it may indeed leak file 
descriptors.

You only need an NSFileHandle where your process is going to actually read or 
write; they aren't used for passing pipe handles to subprocesses.

Kind regards,

Alastair.

--
http://alastairs-place.net



___

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

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

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

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


Re: Custom views in navigationbar (iOS 3.2)

2010-06-23 Thread glenn andreas

On Jun 23, 2010, at 5:51 AM, Christian Ziegler wrote:

> Hi guys,
> 
> I'm having a hard time with the navigation bar. What I'm trying to do is 
> adding a custom breadcrumbs navigation to the bar. I coded two classes, a 
> subclass of UIButton for the breadcrumbs segments and a sublcass of UIView 
> for the whole bar. The bar has a home segment which represents the 
> rootViewController of the navigationController and you can add additional 
> segments when you push new viewControllers on to the navigationController's 
> stack. 

You do realize that the HIG explicitly says to not do that?   From 


Using a multi-segment back button causes several problems:

• The extended width of a multi-segment back button does not leave room 
for the title of the current screen.
• There is no way to indicate the selected state of an individual 
segment.
• The more segments there are, the smaller the hit region for each one, 
which makes it difficult for users to tap a specific one.
• Choosing which levels to display as users navigate deeper in the 
hierarchy is problematic.
If you think users might get lost without a multi-segment back button that 
displays a type of breadcrumb path, it probably means that users must go too 
deeply into the information hierarchy to find what they need. To address this, 
you should flatten your information hierarchy.




So once you spend hours and hours coding and getting this working perfectly, it 
will probably end up being rejected by the AppStore approval process.


Glenn Andreas  gandr...@gandreas.com 
The most merciful thing in the world ... is the inability of the human mind to 
correlate all its contents - HPL

___

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

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

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

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


Re: Problem with stopModalWithCode on a different thread

2010-06-23 Thread Bill Appleton
> Plugins don’t impose themselves, nor are they invoked by a user; they’re
always invoked by content on a web page. The user might go to that web page
specifically to use the plugin, or it might be a side effect, but the
mechanism is the same regardless.

there is a big difference between navigating through an enterprise class
single sign-on gateway to invoke a subscription application and going to CNN
and seeing the dancing mortgage guy. did you really want to "invoke" the
dancing mortgage guy?

> Note that web plugins are more susceptible to attack than regular apps
because, once installed, they can be invoked and run _automatically_ by web
content, with absolutely no warning and no permission needed by the user.

not with the DreamFactory Player. the users sees the app come down, who
wrote it, where its coming from, and they can cancel it. any questions? just
go check the security log maintained by the player that tells everything the
developers app has been doing. this ruins the attack vector. QuickTime is
almost like this as it is used today.

> This makes web plugins probably the most potentially-dangerous type of
software you can install

this comment also sounds like the pot calling the kettle black. consider all
the different flavors of web browsers X all their different versions over
time X all the different operating systems X all the hardware differences.
That is petrabytes of source code running on the client written by dudes
from all over the world that you don't even know. its all software.



On Wed, Jun 23, 2010 at 12:19 AM, Jens Alfke  wrote:

>
> On Jun 22, 2010, at 7:49 PM, Bill Appleton wrote:
>
> > i am pointing out that there is a giant, giant, giant difference between
> plugins that impose themselves on the user and those that are invoked
> because the user wants them.
>
> Plugins don’t impose themselves, nor are they invoked by a user; they’re
> always invoked by content on a web page. The user might go to that web page
> specifically to use the plugin, or it might be a side effect, but the
> mechanism is the same regardless.
>
> > all of the security stuff you are talking about is appropriate for the
> former. all of this security stuff just makes users of the latter pissed
> off.
>
> No, the ‘security stuff’ is appropriate regardless. If a bunch of people
> install your plugin, and if someone were to find a security hole in it that
> lets them do something nasty to your computer, then websites would
> inevitably pop up that invoked your plugin and exploited the bug.
>
> Note that web plugins are more susceptible to attack than regular apps
> because, once installed, they can be invoked and run _automatically_ by web
> content, with absolutely no warning and no permission needed by the user.
> The user might not even know that it’s running. This makes web plugins
> probably the most potentially-dangerous type of software you can install.
>
> > this is absolutely key. we have 10 K companies that desperately need a
> simple way to install and use our player. this is mission critical for them.
>
> Simplicity and convenience don’t usually go along with security,
> unfortunately. For example, ActiveX was a very simple and convenient way to
> extend the web experience (in MSIE on Windows at least), and it became a big
> part of why Windows had so many security problems.
>
> —Jens
___

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

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

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

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


Re: Problem with stopModalWithCode on a different thread

2010-06-23 Thread John Joyce

On Jun 23, 2010, at 9:16 AM, Bill Appleton wrote:

>> Plugins don’t impose themselves, nor are they invoked by a user; they’re
> always invoked by content on a web page. The user might go to that web page
> specifically to use the plugin, or it might be a side effect, but the
> mechanism is the same regardless.
> 
> there is a big difference between navigating through an enterprise class
> single sign-on gateway to invoke a subscription application and going to CNN
> and seeing the dancing mortgage guy. did you really want to "invoke" the
> dancing mortgage guy?
> 
>> Note that web plugins are more susceptible to attack than regular apps
> because, once installed, they can be invoked and run _automatically_ by web
> content, with absolutely no warning and no permission needed by the user.
> 
> not with the DreamFactory Player. the users sees the app come down, who
> wrote it, where its coming from, and they can cancel it. any questions? just
> go check the security log maintained by the player that tells everything the
> developers app has been doing. this ruins the attack vector. QuickTime is
> almost like this as it is used today.
> 
>> This makes web plugins probably the most potentially-dangerous type of
> software you can install
> 
> this comment also sounds like the pot calling the kettle black. consider all
> the different flavors of web browsers X all their different versions over
> time X all the different operating systems X all the hardware differences.
> That is petrabytes of source code running on the client written by dudes
> from all over the world that you don't even know. its all software.
> 
> 
> 
> On Wed, Jun 23, 2010 at 12:19 AM, Jens Alfke  wrote:
> 
>> 
>> On Jun 22, 2010, at 7:49 PM, Bill Appleton wrote:
>> 
>>> i am pointing out that there is a giant, giant, giant difference between
>> plugins that impose themselves on the user and those that are invoked
>> because the user wants them.
>> 
>> Plugins don’t impose themselves, nor are they invoked by a user; they’re
>> always invoked by content on a web page. The user might go to that web page
>> specifically to use the plugin, or it might be a side effect, but the
>> mechanism is the same regardless.
>> 
>>> all of the security stuff you are talking about is appropriate for the
>> former. all of this security stuff just makes users of the latter pissed
>> off.
>> 
>> No, the ‘security stuff’ is appropriate regardless. If a bunch of people
>> install your plugin, and if someone were to find a security hole in it that
>> lets them do something nasty to your computer, then websites would
>> inevitably pop up that invoked your plugin and exploited the bug.
>> 
>> Note that web plugins are more susceptible to attack than regular apps
>> because, once installed, they can be invoked and run _automatically_ by web
>> content, with absolutely no warning and no permission needed by the user.
>> The user might not even know that it’s running. This makes web plugins
>> probably the most potentially-dangerous type of software you can install.
>> 
>>> this is absolutely key. we have 10 K companies that desperately need a
>> simple way to install and use our player. this is mission critical for them.
>> 
>> Simplicity and convenience don’t usually go along with security,
>> unfortunately. For example, ActiveX was a very simple and convenient way to
>> extend the web experience (in MSIE on Windows at least), and it became a big
>> part of why Windows had so many security problems.
>> 
>> —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/jjoyce%40apple.com
> 
> This email sent to jjo...@apple.com
Is this thread still on topic for Cocoa-Dev or should it go offline or to the 
webkit world...?___

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

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

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

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


IBPlugin with Core Animated button.

2010-06-23 Thread Alexander Zvyagin
Hi, All!

I'm try to making Core Animated button encapsulated to Interface Builder Plugin.

>From inside, this button is NSControl created as layer-backed NSView and 
>filled with CALayers.

All images of button states are draw by CALayers using mouseEvents (not by a 
simple drawRect): this are also critical to use Core Animations to render 
transitions between button states (pressed, hovered, etc).

But this control can't be binded from inside IB graphically because it hasn't 
the cell object.

Setting the +cellClass is not helpfull - NSControl needs the -setCell to be 
bindable from Interface Builder with mouse.
And if I add the NSCell or NSActionCell, it will corrupt the clicking 
behaviour: button is pressed by never unpressed back.

Q1: what is the right way to add a cell to the layer-backed controls (drawing 
itself via CALayers instead of simple drawRect provided by NSCells) ?
(or how to use NSCell with Core Animation to draw something instead of drawRect 
?)

Q2: Interface Builder can't select the target verison of Mac OS X in a moment 
of NiB files creating from templates.
This break a compatibility with older versions of Mac OS X. Is the way to 
create NiB Plugin templates targeting for 10.5 as example but using 10.6 as 
development platform?

Alex.
___

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

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

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

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


Problem with NavigationControllers in TabBar Options

2010-06-23 Thread John Duff
I wrote a little blog post awhile back about putting
NavigationControllers into a TabBarController and everything worked
fine for what I was doing. Someone has expanded on what I did in the
blog post a little bit and created a TabBarController with more than 5
NavigationControllers in it so the last one turns into a 'more' button
with a list of views to select from. The problem is that when you
select a view from the 'more' controller the item doesn't get selected
before switching the view, making it look inconsistent with the way
the rest of the tableviews behave.

I've got a project up on GitHub you can checkout to see the issue
(http://github.com/jduff/nav_controller_example). It's pretty subtle
but when you click on the items in the more list they should highlight
before navigating. When you change them from NavigationControllers to
simple ViewControllers everything works fine.

If it helps here is the link to the blog post with the tutorial and
comments 
http://jduff.github.com/2010/03/09/throwing-a-uinavigationcontroller-uitabbarcontroller-and-uisearchbar-together/
Thanks in advance for the help,

-John
___

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

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

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

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


force rendering of views off screen

2010-06-23 Thread Martin Glaß
hello everyone.

i'm totally new to the mac platform but already feel comfortable with the
cocoa frameworks.
i am developing an ipad app which offers a full screen UIScrollView which
itself has several subviews, representing the pages the user can flip
through.
problem is: every subview renders a pdf page and does so on-demand, lazy,
when it slides into view.
i would like the subview right and left from the currently visible view
being pre-rendered (like facebook's app does in galleries) so that the user
doesn't see all the CATiledLayers be fading in.

i experimented with -setNeedsDisplay and -setNeedsLayout but have had no
success.

is there something someone can point me to?
been crawling through the docs and google for over a week now...

thanks in advance,
martin
___

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

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

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

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


changes to NSView's frame in its window

2010-06-23 Thread Alexander Cohen
Hello,

I have a view in an NSScrollView's document view that has a small child window 
attached to it, meaning the window follows that view wherever it goes. But when 
i scroll the scrollview, not much changes for that view. So i'm wondering if 
there is anyway to get changes to a views "global" frame. If i'm missing 
something obvious, please do tell.

thx

AC___

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

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

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

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


Re: iOS4: UDP sockets in the background

2010-06-23 Thread Gerd Knops

On Jun 22, 2010, at 10:28 PM, Angelica Grace Tanchico wrote:

> 
> Hello,
> 
> Can the new iOS 4 maintain UDP socket connection in the background? Or is it 
> only TCP?

I have been doing that without a problem since early iOS 3, so no reason to 
expect it would stop working in iOS4.

Gerd

___

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

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

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

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


Re: changes to NSView's frame in its window

2010-06-23 Thread Kyle Sluder
On Wed, Jun 23, 2010 at 10:33 AM, Alexander Cohen  wrote:
> I have a view in an NSScrollView's document view that has a small child 
> window attached to it, meaning the window follows that view wherever it goes. 
> But when i scroll the scrollview, not much changes for that view. So i'm 
> wondering if there is anyway to get changes to a views "global" frame. If i'm 
> missing something obvious, please do tell.

Scroll views (actually, clip views) work by moving their bounds
coordinate system. When AppKit draws the view hierarchy, it applies a
transform to the current graphics context that is based on the bounds
coordinate system of the view being drawn; this is how you can draw at
(0,0) in your -drawRect: and have it appear at the right point in the
superview. Likewise, as AppKit finishes drawing a view, it pops these
transforms off the stack.

By the time your overlay window draws, it's in another window
entirely, so it has an entirely different transform stack—notably one
lacking the transform the clip view has applied prior to your document
view being drawn.

Your child window or the content view thereof is going to need to
listen for bounds-change notifications from the clip view and set its
own bounds coordinate system to match.
___

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

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

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

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


Re: changes to NSView's frame in its window

2010-06-23 Thread John Joyce

On Jun 23, 2010, at 1:28 PM, Kyle Sluder wrote:

> On Wed, Jun 23, 2010 at 10:33 AM, Alexander Cohen  
> wrote:
>> I have a view in an NSScrollView's document view that has a small child 
>> window attached to it, meaning the window follows that view wherever it 
>> goes. But when i scroll the scrollview, not much changes for that view. So 
>> i'm wondering if there is anyway to get changes to a views "global" frame. 
>> If i'm missing something obvious, please do tell.
> 
> Scroll views (actually, clip views) work by moving their bounds
> coordinate system. When AppKit draws the view hierarchy, it applies a
> transform to the current graphics context that is based on the bounds
> coordinate system of the view being drawn; this is how you can draw at
> (0,0) in your -drawRect: and have it appear at the right point in the
> superview. Likewise, as AppKit finishes drawing a view, it pops these
> transforms off the stack.
> 
> By the time your overlay window draws, it's in another window
> entirely, so it has an entirely different transform stack—notably one
> lacking the transform the clip view has applied prior to your document
> view being drawn.
> 
> Your child window or the content view thereof is going to need to
> listen for bounds-change notifications from the clip view and set its
> own bounds coordinate system to match.
> ___

Depending on your needs, you may also want to consider subclassing 
NSViewController or NSWindowController to handle things.

___

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

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

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

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


-enclosingScrollView returns nil when receiver is a descendant of the clip view

2010-06-23 Thread Kyle Sluder
Hi list,

We recently noticed that -enclosingScrollView will only return an
ancestor scroll view if the receiver is a descendant of the scroll
view's document view. This is a problem for us, since we put our field
editors and other accessory views in a subview of the scroll view's
clip view that isn't the document view, because the document view is a
custom layer-hosting view.

To describe it a bit more visually, here's a diagram of our view hierarchy:

Scroll View
|- Clip View
  |- Accessory view
  |- Document view

Calling -enclosingScrollView on the accessory view returns nil. I
believe that it should return the scroll view.

One of the workarounds we're mulling over is to replace NSView's
implementation of -enclosingScrollView to return the scroll view if
the receiver is a descendant of the clip view. This makes sense to me,
because I can't see a situation in which one would call
-enclosingScrollView without the intent of obtaining "the scroll view
that is responsible for scrolling me around." But since we don't have
the source to AppKit, we can't be sure that AppKit doesn't rely on
this behavior.

I've submitted rdar://problem/8119868 to this effect, but I was
wondering if anyone had any additional comments.

Thanks,
--Kyle Sluder
___

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

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

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

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


Re: iOS4: UDP sockets in the background

2010-06-23 Thread Fritz Anderson

On 23 Jun 2010, at 1:15 PM, Gerd Knops wrote:

> On Jun 22, 2010, at 10:28 PM, Angelica Grace Tanchico wrote:
...
> 
>> Can the new iOS 4 maintain UDP socket connection in the background? Or is it 
>> only TCP?
> 
> I have been doing that without a problem since early iOS 3, so no reason to 
> expect it would stop working in iOS4.

You've been networking in a background application since iOS 3?

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


Re: force rendering of views off screen

2010-06-23 Thread Matt Neuburg
On Wed, 23 Jun 2010 14:27:43 +0200, Martin Gla? 
said:
>i am developing an ipad app which offers a full screen UIScrollView which
>itself has several subviews, representing the pages the user can flip
>through.
>problem is: every subview renders a pdf page and does so on-demand, lazy,
>when it slides into view.
>i would like the subview right and left from the currently visible view
>being pre-rendered (like facebook's app does in galleries) so that the user
>doesn't see all the CATiledLayers be fading in.

This might not be any help, because I might not be understanding the problem
correctly. But...

I have an app where the user scrolls between hundreds of "pages" in a paged
scroll view, but only three of them are ever drawn at any one moment: the
one the user is looking at, and the ones to the right and left of that.
Every time the user scrolls by a page, I rip out all others and put in the
new left or right as needed.

Thus I don't understand why you don't just let "lazy" mean what I mean above
- i.e., "render it when it is the subview right or left from the currently
visible view" rather than waiting until "it slides into view". It isn't
"offscreen" if it's being drawn into the scroll view's content.

Also, although I have not checked this, the ScrollViewSuite example might be
useful here.

m.

-- 
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings



___

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

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

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

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


Re: -enclosingScrollView returns nil when receiver is a descendant of the clip view

2010-06-23 Thread jonat...@mugginsoft.com

On 23 Jun 2010, at 19:50, Kyle Sluder wrote:
> 
> To describe it a bit more visually, here's a diagram of our view hierarchy:
> 
> Scroll View
> |- Clip View
>  |- Accessory view
>  |- Document view
> 
> Calling -enclosingScrollView on the accessory view returns nil. I
> believe that it should return the scroll view.
> 
> One of the workarounds we're mulling over is to replace NSView's
> implementation of -enclosingScrollView to return the scroll view if
> the receiver is a descendant of the clip view. This makes sense to me,
> because I can't see a situation in which one would call
> -enclosingScrollView without the intent of obtaining "the scroll view
> that is responsible for scrolling me around." But since we don't have
> the source to AppKit, we can't be sure that AppKit doesn't rely on
> this behavior.
> 
Perhaps:

Define a -scrollViewSibling property/outlet on the accessory view and point it 
to the document view.

The NSView -enclosingScrollView override can check for a response to 
scrollViewSibling and 
conditionally send  -enclosingScrollView to it.
 
That way you are only overriding the -enclosingScrollView behaviour for views 
whose response is considered defective.

Regards

Jonathan Mitchell

Developer
Mugginsoft LLP
http://www.mugginsoft.com

___

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

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

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

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


Re: iOS4: UDP sockets in the background

2010-06-23 Thread Gerd Knops

On Jun 23, 2010, at 2:05 PM, Fritz Anderson wrote:

> 
> On 23 Jun 2010, at 1:15 PM, Gerd Knops wrote:
> 
>> On Jun 22, 2010, at 10:28 PM, Angelica Grace Tanchico wrote:
> ...
>> 
>>> Can the new iOS 4 maintain UDP socket connection in the background? Or is 
>>> it only TCP?
>> 
>> I have been doing that without a problem since early iOS 3, so no reason to 
>> expect it would stop working in iOS4.
> 
> You've been networking in a background application since iOS 3?
> 
Sorry, I misunderstood the question. No, not in a background application, 
rather in a background thread of the active application. Apologies all around.

Gerd


___

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

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

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

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


Re: changes to NSView's frame in its window

2010-06-23 Thread Michael Ash
On Wed, Jun 23, 2010 at 1:33 PM, Alexander Cohen  wrote:
> Hello,
>
> I have a view in an NSScrollView's document view that has a small child 
> window attached to it, meaning the window follows that view wherever it goes. 
> But when i scroll the scrollview, not much changes for that view. So i'm 
> wondering if there is anyway to get changes to a views "global" frame. If i'm 
> missing something obvious, please do tell.

This is not exactly what it's intended for, but if you override
-resetCursorRects, it'll be called any time your view moves within its
window.

Mike
___

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

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

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

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


Re: Memory management on returning nil in init

2010-06-23 Thread davelist

On Jun 21, 2010, at 2:44 PM, Scott Anguish wrote:

> The old style
> 
>> if (self = [super init])
> 
> will cause a warnings with certain settings now and in the future.
> 

Does this also apply to code such as:

if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])

should it be:

self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self)

and any other initializers?

Thanks,
Dave



___

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

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

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

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


Re: Memory management on returning nil in init

2010-06-23 Thread Jens Alfke

On Jun 23, 2010, at 12:47 PM, davel...@mac.com wrote:

>if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])

Yes. Any expression of the form

if(A = B)

i.e. an assignment directly inside an if, will result in a warning that this 
looks confusingly like a comparison.

—Jens___

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

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

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

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


Re: Memory management on returning nil in init

2010-06-23 Thread Charles Srstka
On Jun 23, 2010, at 3:00 PM, Jens Alfke wrote:

> Yes. Any expression of the form
> 
>   if(A = B)
> 
> i.e. an assignment directly inside an if, will result in a warning that this 
> looks confusingly like a comparison.

If you prefer the if(A = B) syntax, though, this can be worked around by using 
double parentheses, i.e.

if((A = B))

Charles___

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

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

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

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


Re: iOS4: CFReadStream and background operation

2010-06-23 Thread John Michael Zorko

Jens,

>> 2. However, CFReadStreams created _while_ the app was in the background 
>> often (though not always) _don't_ call their callbacks _until_ the app is 
>> brought in the foreground, then all of a sudden the callback happens.
> 
> I think foreground/background is a red herring — that has almost no effect on 
> the behavior of the app.

> What I _have_ seen is bugs in my code that result in incoming activity (like 
> network I/O) not waking up the runloop, so the event doesn’t get delivered … 
> until some other event comes in and causes the runloop to wake up. This is a 
> lot likelier to happen when the app is in the background, because when it’s 
> active there are user events (even the mouse entering/exiting views) that 
> keep the runloop going pretty often.

Thanks for the reply and the info :-) I still think it has to do with 
foreground / background, because i've narrowed it down to CFReadStreamRead() 
hanging (as if there were no bytes to read) even though the read stream 
callback got the kCFStreamEventHasBytesAvailable event _and_ 
CFReadStreamHasBytesAvailable() returns TRUE (I wanted to make bloody sure).  
The section of code is _literally_ this (from my CFReadStream callback):

} else if (eventType == kCFStreamEventHasBytesAvailable) {
//
// Read the bytes from the stream
//

BOOL reallyReallyHasBytes = 
CFReadStreamHasBytesAvailable(stream);

NSLOG(@"really really has bytes: %s", reallyReallyHasBytes ? 
"yes" : "no");

UInt8 bytes[kAQBufSize];
CFIndex length = CFReadStreamRead(stream, bytes, kAQBufSize);

NSLOG(@"recvd %i bytes", length);

Output:

2010-06-23 13:10:23.299 AudioPress[933:a61f] Thread 94518032: 
AudioEngineShoutcast 3959968: really really has bytes: yes

(and no more output ... it's hung on the CFReadStreamRead)

... and this code _works_ when in the foreground, but when in the background, 
the CFReadStreamRead() often (though not always) hangs. This is already after 
the run loop dispatched the event, so AFAIK the code isn't losing events. The 
documentation for CFReadStream clearly says that if at least one byte is 
available, CFReadStreamRead() won't block ... yet here it is, blocking (the 
"recvd bytes" message is never logged and the thread is hung until I put the 
app in the foreground again). This is using the GM seed of iOS4 on my 3GS. I 
don't know where else to look or what else to think, other than maybe 
CFReadStreamRead() isn't guaranteed to work while the app is backgrounded and 
that I should maybe drop back to the BSD send() / recv() calls and hope they do 
/ are? Is there something else I should be looking for that could cause this?

Regards,

John

___

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

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

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

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


Re: changes to NSView's frame in its window

2010-06-23 Thread Alexander Cohen
Wow, nice to know. Probably not a good idea to count on it though, right?

AC

On Jun 23, 2010, at 3:38 PM, Michael Ash wrote:

> On Wed, Jun 23, 2010 at 1:33 PM, Alexander Cohen  
> wrote:
>> Hello,
>> 
>> I have a view in an NSScrollView's document view that has a small child 
>> window attached to it, meaning the window follows that view wherever it 
>> goes. But when i scroll the scrollview, not much changes for that view. So 
>> i'm wondering if there is anyway to get changes to a views "global" frame. 
>> If i'm missing something obvious, please do tell.
> 
> This is not exactly what it's intended for, but if you override
> -resetCursorRects, it'll be called any time your view moves within its
> window.
> 
> 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/alex%40toomuchspace.com
> 
> This email sent to a...@toomuchspace.com

___

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

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

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

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


Re: iOS4: CFReadStream and background operation

2010-06-23 Thread John Michael Zorko

Jens,

>> 2. However, CFReadStreams created _while_ the app was in the background 
>> often (though not always) _don't_ call their callbacks _until_ the app is 
>> brought in the foreground, then all of a sudden the callback happens.
> 
> I think foreground/background is a red herring — that has almost no effect on 
> the behavior of the app.

I think I know what the problem is -- my app is being suspended. Even though I 
have the "audio" key added to the plist file, there is this sentence (best 
imagined as narrated by an ominous, deep voice with a thick reverb) from the 
iPhone Application Programming Guide:

"However, if this key is not present when the application moves to the 
background, or if your application stops playing audio while in the background, 
your application is suspended."

I think what is happening is that if iOS4 catches my app not playing audio in 
the background (like if it calls AudioQueueStop() even if it's going to call 
AudioQueueStart() later), it suspends it.

Regards,

John


___

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

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

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

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


NSTimeZone abbreviations

2010-06-23 Thread August Hahn
On iOS 3.2 or less the behavior of NSTimeZone's abbreviationForDate was to give 
back a 'normal' abbreviation, i.e. PST for Pacific time. In 4.0 for the US I 
still get PST, but for outside North America it gives back GMT+/-XX:XX. In 
France it was showing CEST, now I get GMT+02:00. Not very user-friendly! Can I 
get the old behavior back? And can anyone explain why this change was made?

August
___

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

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

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

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


Re: NSTimeZone abbreviations

2010-06-23 Thread Rick Mann
I've reported this bug, and sent Apple sample code to reproduce it. It's an 
awful change, and I hope just an oversight that gets fixed in the next iOS 4 
update.

On Jun 23, 2010, at 15:51:31, August Hahn wrote:

> On iOS 3.2 or less the behavior of NSTimeZone's abbreviationForDate was to 
> give back a 'normal' abbreviation, i.e. PST for Pacific time. In 4.0 for the 
> US I still get PST, but for outside North America it gives back GMT+/-XX:XX. 
> In France it was showing CEST, now I get GMT+02:00. Not very user-friendly! 
> Can I get the old behavior back? And can anyone explain why this change was 
> made?
> 
> August
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post 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/rmann%40latencyzero.com
> 
> This email sent to rm...@latencyzero.com

___

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

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

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

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


NSOpenPanel won't allow selecting aliases

2010-06-23 Thread Seth Willits
Apparently I've never noticed that in my open panels, I can't select aliases. 
Say for instance that on my Desktop there is an alias to deeply nested folder. 
In the open panel, when it lists the Desktop folder's contents, the alias is 
disabled so I can't double-click on it to drill into that folder's contents.

What's the correct setting to enable that? I can't seem to find anything.


NSOpenPanel * panel = [NSOpenPanel openPanel];
[panel setDelegate:self];
[panel setResolvesAliases:YES];
[panel setCanChooseFiles:YES];
[panel setCanChooseDirectories:NO];
[panel beginSheetForDirectory:nil file:nil types:nil
modalForWindow:window
modalDelegate:self
didEndSelector:@selector(..)
contextInfo:nil];


Thanks,

--
Seth Willits



___

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

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

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

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


Re: NSTimeZone abbreviations

2010-06-23 Thread David Rowland
And I reported it.

On Jun 23, 2010, at 4:52 PM, Rick Mann wrote:

> I've reported this bug, and sent Apple sample code to reproduce it. It's an 
> awful change, and I hope just an oversight that gets fixed in the next iOS 4 
> update.
> 
> On Jun 23, 2010, at 15:51:31, August Hahn wrote:
> 
>> On iOS 3.2 or less the behavior of NSTimeZone's abbreviationForDate was to 
>> give back a 'normal' abbreviation, i.e. PST for Pacific time. In 4.0 for the 
>> US I still get PST, but for outside North America it gives back GMT+/-XX:XX. 
>> In France it was showing CEST, now I get GMT+02:00. Not very user-friendly! 
>> Can I get the old behavior back? And can anyone explain why this change was 
>> made?
>> 
>> August
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post 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/rmann%40latencyzero.com
>> 
>> This email sent to rm...@latencyzero.com
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/rowlandd%40sbcglobal.net
> 
> This email sent to rowla...@sbcglobal.net

___

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

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

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

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


Not sure what's wrong with this code to using NSUserDefaults...

2010-06-23 Thread Patrick William Walker
... beyond me but here it is.

NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];

[prefs setObject: @"120" forKey: @"Length"];

[prefs synchronize];


When the program is run in the iPhone simulator (v3.2, not using 4.0 yet), it 
just dies.  Nothing on the console log so I set a breakpoint and got a 
backtrace.  It's pointing to the setObject: method call and it's generating an 
access exception.  If I comment out the setObject portion, it runs fine.  It's 
driving me nuts considering I've confirmed this is nothing out of the oridinary 
when looking at code provided by others on the web.  It's driving me absolutely 
bonkers.  Even setting it to setInteger: 120 does the same failure.

Any suggestions?

Thanks
Will


___

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

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

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

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


Restoring a NSTreeController selection

2010-06-23 Thread Markus Spoettl
Hi List,

  I have a NSOutlineView bound to a NSTreeController that delivers my model 
objects. That NSTreeController sorts the model objects through sort 
descriptors. What I would like to do is save the current selection and restore 
it at a later time.

Saving is easy, I get the -selectedObjects from the tree controller, extract my 
model objects and store a unique key that allows me to identify the objects 
when I look them up later. 

Restoring proves to be tricky - for me anyway. I can locate my model objects 
properly and build an index path for each one I want to select. However, the 
index paths the tree controller seems to expect is the one AFTER applying the 
sort order. 

My model is not sorted in the same way the tree controller's representation is. 
The only I can find out the correct (for selection) index paths is to sort my 
model like the tree controller does and find the index paths after that. That's 
terribly inelegant and potentially expensive. I think the tree controller 
should either accept -selectionIndexPaths the way I see them in my model OR let 
me see the ordered collection of how my model ended up being represented.

I'm pretty sure I'm overlooking something so I'm hoping someone can give me a 
hint on how to do that in a more elegant fashion. Thanks in advance!

Regards
Markus

PS: I can't store the index paths for the selection and restore those because 
the model may change between save and restore and so the index paths would no 
longer be the same.
--
__
Markus Spoettl

___

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

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

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

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


checking if an app installed

2010-06-23 Thread Angelo Chen
Hi,
Is there a way to check if a certain application is installed? say if iMovie is 
installed? thanks,
Angelo



___

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

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

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

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


Re: checking if an app installed

2010-06-23 Thread Stephen J. Butler
On Wed, Jun 23, 2010 at 7:48 PM, Angelo Chen  wrote:
> Hi,
> Is there a way to check if a certain application is installed? say if iMovie 
> is installed? thanks,

Three ways:

-[NSWorkspace absolutePathForAppBundleWithIdentifier:] (10.3)
-[NSWorkspace fullPathForApplication:] (10.0)
-[NSWorkspace URLForApplicationWithBundleIdentifier:] (10.6)
___

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

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

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

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


How to debug: "Save partially failed: Error saving the persistent store."

2010-06-23 Thread Gideon King
I am encountering this issue when trying to save my atomic store. The 
backtraces don't seem to give anything useful to locate the issue. 

Any suggestions as to how to find the cause of this?


Thanks

Gideon___

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

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

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

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


Re: checking if an app installed

2010-06-23 Thread Angelo Chen
Hi,
Thanks for the fast reply, this works very well, now I'd like to check if 
certain plugin for Quicktime got installed too, is there a similar service? i 
tried following and it returns nil:
NSURL * bURL = [[NSWorkspace sharedWorkspace] 
URLForApplicationWithBundleIdentifier:@"com.apple.AppleIntermediateCodec"];
Thanks.
--- 2010年6月24日 星期四,Stephen J. Butler  寫道﹕

寄件人: Stephen J. Butler 
主題: Re: checking if an app installed
收件人: "Angelo Chen" 
副本(CC): Cocoa-dev@lists.apple.com
日期: 2010年6月24日,星期四,上午8:55

On Wed, Jun 23, 2010 at 7:48 PM, Angelo Chen  wrote:
> Hi,
> Is there a way to check if a certain application is installed? say if iMovie 
> is installed? thanks,

Three ways:

-[NSWorkspace absolutePathForAppBundleWithIdentifier:] (10.3)
-[NSWorkspace fullPathForApplication:] (10.0)
-[NSWorkspace URLForApplicationWithBundleIdentifier:] (10.6)




___

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

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

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

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


LightTable Sample CoreAnimation Code

2010-06-23 Thread Alexander Heinz
Hello all,

I've been attempting to make sense of Apple's "LightTable" sample code for Core 
Animation, and I'm completely lost. Specifically, a couple of calls appear to 
be assigning an NSImage to the contents of a CALayer, which, as I previously 
understood, (and according to the documentation) should be impossible.

Specifically, the "LTView" class contains the following, in its 
-insertSlides:atIndexes: method:

NSImage *image = [[NSImage alloc] initWithData:[slide 
valueForKey:kLTViewSlidePropertyPhoto]];
(snip)
LTMaskLayer *slideLayer = [LTMaskLayer layer];
slideLayer.photo = image;

Jumping over to the "LTMaskLayer" class, (keeping in mind that _visiblePhoto is 
a plain-vanilla CALayer ivar) we have:

- (void)setPhoto:(id)newContents
{
_visiblePhoto.contents = newContents;
}

Am I crazy? Aren't these calls assigning an NSImage to a CALayer's contents?

For reference, documentation for CALayer -setContents: reads:

A layer can set this property to a CGImageRef to display the image as its 
contents.

Can anyone explain what this code is doing?

Thanks in advance,
- Alex___

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

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

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

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


Re: LightTable Sample CoreAnimation Code

2010-06-23 Thread Kyle Sluder
On Wed, Jun 23, 2010 at 7:09 PM, Alexander Heinz
 wrote:
> I've been attempting to make sense of Apple's "LightTable" sample code for 
> Core Animation, and I'm completely lost. Specifically, a couple of calls 
> appear to be assigning an NSImage to the contents of a CALayer, which, as I 
> previously understood, (and according to the documentation) should be 
> impossible.

See the section "NSImage: CALayer accepts NSImage as contents" in the
10.6 AppKit release notes:
http://developer.apple.com/mac/library/releasenotes/cocoa/appkit.html

--Kyle Sluder
___

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

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

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

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


Re: Memory management on returning nil in init

2010-06-23 Thread Scott Anguish
Yes, that works as well. The reason we’ve advocated the longer form is that it 
is clearer what is happening to those who are not as intimate with the quirks 
like this. 

I also recall reading (but don’t quote me on this) that the longer form 
generates less instructions. I can’t recall where though.

In documentation you won’t see (( for the above reason (clearer) and because it 
was likely we’d get typo reports. 


On Jun 23, 2010, at 4:27 PM, Charles Srstka wrote:

> On Jun 23, 2010, at 3:00 PM, Jens Alfke wrote:
> 
>> Yes. Any expression of the form
>> 
>>  if(A = B)
>> 
>> i.e. an assignment directly inside an if, will result in a warning that this 
>> looks confusingly like a comparison.
> 
> If you prefer the if(A = B) syntax, though, this can be worked around by 
> using double parentheses, i.e.
> 
> if((A = B))
> 
> Charles

___

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

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

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

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


Re: Memory management on returning nil in init

2010-06-23 Thread Bill Appleton
i type lots of stuff all the way out

its easier to debug

and the compilers are very good at optimizing that sort of thing

there is a big balance between efficiency, size, speed, clarity, etc

its usually clarity that is in short supply




On Wed, Jun 23, 2010 at 7:42 PM, Scott Anguish  wrote:

> Yes, that works as well. The reason we’ve advocated the longer form is that
> it is clearer what is happening to those who are not as intimate with the
> quirks like this.
>
> I also recall reading (but don’t quote me on this) that the longer form
> generates less instructions. I can’t recall where though.
>
> In documentation you won’t see (( for the above reason (clearer) and
> because it was likely we’d get typo reports.
>
>
> On Jun 23, 2010, at 4:27 PM, Charles Srstka wrote:
>
> > On Jun 23, 2010, at 3:00 PM, Jens Alfke wrote:
> >
> >> Yes. Any expression of the form
> >>
> >>  if(A = B)
> >>
> >> i.e. an assignment directly inside an if, will result in a warning that
> this looks confusingly like a comparison.
> >
> > If you prefer the if(A = B) syntax, though, this can be worked around by
> using double parentheses, i.e.
> >
> > if((A = B))
> >
> > Charles
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> http://lists.apple.com/mailman/options/cocoa-dev/billappleton%40dreamfactory.com
>
> This email sent to billapple...@dreamfactory.com
>
___

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

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

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

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


Finder open / close notifications

2010-06-23 Thread dev . digest

Hello,

I'm trying to receive a notification when a file is opened basically  
like the main Recent Items menu.  I'd like to poll a directory and  
monitor file operations for certain file types.  Specifically open /  
close operations ... just looking for suggestions, I've dabbled with  
Uli UKKQueue but don't seem to receive open / close notifications.   
Was wondering is there a way to register for the finders  
notifications? possibly something new in 10.6?


any suggestions would be greatly appreciated.
___

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

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

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

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


iPhone TabBarController and NavigationController with Core Data

2010-06-23 Thread Sandro Noël
Greetings.

I've been at this for a week trying to figure things out and I'm getting 
nowhere.
This is my first iPhone application so please be gentle.

ok, 
I created the application from the tab bar application template, and checked 
core data stack support.
created the model and imported startup data.

Second I added navigation controllers to the Tab bar as seen in an example I've 
found on the internet or the apple documentation.
I've connected all the nib files and the application works nicely when built 
and run in the simulator.

The time has come to populate the table views and i'm completely confused on 
how to go about it.

the layout,

MainWindow.xib:
Tab bar contorller
Navigation controller
View controller (loads SearchView)
(other navigation controllers)...


SearchView.xib:
TableViewController (custom controller defined)
TableView
SearchBar

now, inside the tableViewController i have a fetchResultController configured, 
but this guy needs a managedObjectContext which is in my Application delegate
I've seen examples where the tableview exposes a property to set the local 
managedObjectContext but all the way back to the applicationDelegate
is a place where no events happen where i can set the property on that specific 
TableViewcontroller.

I'm sorry if i don't explain this correctly, i'm so lost i don't even know 
where to look now.
looking at the examples (unless i've missed it) it seems i'm trying to so 
something extraordinary.
or so easy there is no need for an example ( then i'm really off track ).

Can someone please give me a pointer on how to get my managedObjectCOntect to 
my tableViewControllers?

best regards.
Sandro.
___

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

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

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

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


Re: Finder open / close notifications

2010-06-23 Thread Ken Thomases
On Jun 23, 2010, at 6:00 PM, dev.dig...@verostudios.com wrote:

> I'm trying to receive a notification when a file is opened basically like the 
> main Recent Items menu.  I'd like to poll a directory and monitor file 
> operations for certain file types.  Specifically open / close operations ... 
> just looking for suggestions, I've dabbled with Uli UKKQueue but don't seem 
> to receive open / close notifications.  Was wondering is there a way to 
> register for the finders notifications? possibly something new in 10.6?

I don't believe the Finder is emitting notifications, as such.  It's just 
passing the file to Launch Services (possibly via NSWorkspace), just like any 
other app would to open a document.

If you really just want to monitor the Recent Items menu, you can look into the 
LSSharedFileList API and the LSSharedFileListAddObserver() function.  See the 
header at 
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/LSSharedFileList.h.

Regards,
Ken

___

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

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

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

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


Re: checking if an app installed

2010-06-23 Thread Jens Alfke

On Jun 23, 2010, at 6:38 PM, Angelo Chen wrote:

> Thanks for the fast reply, this works very well, now I'd like to check if 
> certain plugin for Quicktime got installed too, is there a similar service? i 
> tried following and it returns nil:
> NSURL * bURL = [[NSWorkspace sharedWorkspace] 
> URLForApplicationWithBundleIdentifier:@"com.apple.AppleIntermediateCodec"];

That’s not an application. I think you’ll need to use QuickTime APIs to check 
for the presence of particular plugins. (And this is not the right list for 
those APIs.)

—Jens___

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

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

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

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


CCCrypt()

2010-06-23 Thread Richard Hood
does anyone know in which library the CCCrypt() routine is defined?  
I've linked against libcrypto.dylib where it's defined in the header  
and libSystem.dylib where the man page says it is but I'm still  
getting undefined symbol errors on link.




Richard Hood
 rhood2...@mac.com ___
Apple Macintosh Software Development
Mac OS X, Cocoa, Carbon, Driver & Kernel Expertise
http://homepage.mac.com/rhood2796



___

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

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

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

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