Re: GC Basic questions

2009-10-19 Thread Quincey Morris

On Oct 19, 2009, at 23:35, Nick Rogers wrote:

Since the methods -release, -retain and -autorelease are no-ops with  
GC only enabled, How do I release everything associated with an ivar  
(pointer to a class) in AppController?

Currently I'm doing it by setting this pointer as nil. Is it ok?

Also when I follow certain steps, this pointer gets a lot of memory  
attached, down the line. which gets released (when I set it to nil)  
as per Obj-Alloc instrument.
But when following another certain steps, this memory doesn't get  
released (when setting this pointer nil), why? With GC only enabled  
this should get freed up.


You should read -- several times probably -- the documentation on the  
garbage collector:



http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/GarbageCollection/Introduction.html

That will tell you that you don't have to do anything to 'release'  
memory under GC -- memory is collected when there are no "live"  
references to it. So if your pointer is *the* reference that's keeping  
the memory alive (along with everything indirectly pointed to), then  
yes setting the pointer to nil should result in the whole shebang be  
collected -- at some later time that you don't directly control.


OTOH, if the ivar is in an instance which is itself unreferenced,  
setting the ivar to nil is unnecessary because it's no longer a live  
reference. A typical usage scenario of this is when the pointer to the  
instance is in a local (stack) variable of a method, and you return  
from the method. There's no need to nil anything in that case, because  
the return ends the lifetime of the instance, which the ends the  
lifetime of the object pointed to by the ivar, which ends ... etc.



___

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: CPU utilization in Snow Leopard

2009-10-19 Thread Graham Cox


On 20/10/2009, at 5:28 PM, Shashanka L wrote:


-(void)newThread
{
   NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];


//Some operations...


do  //Keeps thread alive till date
{
		[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode   
beforeDate:[NSDate dateWithTimeIntervalSinceNow: 0.1]];


} while (mShouldThreadAlive); //Waiting for other process to complete

  [pool release];

}



Mind you, having said what I just said, this is a bad approach anyway.  
You should not "keep a thread alive" until it gets some flag, that's  
just wasting CPU time doing nothing but spinning. Instead the thread  
should sleep until it has something to do. If you need to wait for  
another thread to finish, use a NSConditionLock to do it properly.  
Also, if this code is representative, you are spinning it after all  
the processing has finished, which is pointless. Just let it terminate  
if it has nothing more to do.


--Graham


___

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

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

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

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


Re: CPU utilization in Snow Leopard

2009-10-19 Thread Graham Cox


On 20/10/2009, at 5:28 PM, Shashanka L wrote:

Autoreleased object from [NSDate dateWithTimeIntervalSinceNow: 0.1]  
is not getting released and taking lots of memory.


Does any one came across this issue in snow leopard??

Or any solution?



Since there's no autorelease pool inside your do...while loop, of  
course it isn't going to get autoreleased then. Autorelease isn't  
magic, someone has to tell it when it can release - that's you. Put  
your pool inside the loop so it is created and destroyed each time.


--Graham


___

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

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

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

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


GC Basic questions

2009-10-19 Thread Nick Rogers

Hi,
Since the methods -release, -retain and -autorelease are no-ops with  
GC only enabled, How do I release everything associated with an ivar  
(pointer to a class) in AppController?

Currently I'm doing it by setting this pointer as nil. Is it ok?

Also when I follow certain steps, this pointer gets a lot of memory  
attached, down the line. which gets released (when I set it to nil) as  
per Obj-Alloc instrument.
But when following another certain steps, this memory doesn't get  
released (when setting this pointer nil), why? With GC only enabled  
this should get freed up.


Thanks,
Nick

___

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: CPU utilization in Snow Leopard

2009-10-19 Thread Shashanka L


Hello Joar Wingfors,

 I am performing some operation by detaching the thread and waiting  
for some process to complete. I am using runloop for waiting purpose.


NSDate instance taking lots of Memory when thread is alive (ie till  
mShouldThreadAlive set to YES). This can be seen only in snow leopard.


Below is the code snippet...

//New thread selector


-(void)newThread
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];


//Some operations...


do  //Keeps thread alive till date
{
		[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode  beforeDate: 
[NSDate dateWithTimeIntervalSinceNow: 0.1]];


} while (mShouldThreadAlive); //Waiting for other process to complete

   [pool release];

}

Autoreleased object from [NSDate dateWithTimeIntervalSinceNow: 0.1] is  
not getting released and taking lots of memory.


Does any one came across this issue in snow leopard??

Or any solution?

Please Help..




On 26-Sep-09, at 1:40 PM, Joar Wingfors wrote:



On 25 sep 2009, at 23.14, Shashanka L wrote:

I am working with Snow Leopard 10.6.1. And I have observed the  
difference in CPU usage (high compared to Leopard) for my  
application. I am using mainly the Quicktime, sqlite3 calls.


Also found some memory leaks in Foundation class methods.

Have anybody observed the above said issues with 10.6?



Hello Shashanka,

You're not really providing enough information for anyone to know if  
they've seen the same issues or not.


If you've found something that you think are bugs in Mac OS X,  
please file bug reports:




Many thanks,

j o a r





Thanks,
Shashank Lagvankar





---
Robosoft Technologies - Come home to Technology

Disclaimer: This email may contain confidential material. If you were not an 
intended recipient, please notify the sender and delete all copies. Emails to 
and from our network may be logged and monitored. This email and its 
attachments are scanned for virus by our scanners and are believed to be safe. 
However, no warranty is given that this email is free of malicious content or 
virus.
___

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: Getting a view's size?

2009-10-19 Thread Andrew Farmer

On 18 Oct 2009, at 22:45, patrick wrote:

Thank you! That was exactly the problem. :)


While we're at it, don't forget about NSStringFromRect(). No need to  
write format strings yourself when Apple's done it for you -- and  
written a parser to go with (NSRectFromString).

___

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: Dirty rects getting merged together makes for inefficient drawing

2009-10-19 Thread Andy Lee

On Oct 19, 2009, at 11:00 PM, Ben Haller wrote:
 Well, I'm curious about the coalesced update thing.  The only ref I  
find through Google is here:


http://developer.apple.com/mac/library/documentation/Performance/Conceptual/Drawing/Articles/CocoaDrawingTips.html

and I don't think that's what you're referring to.  AppKiDo (which I  
still love :->)


:)

doesn't find any APIs with "coalesce" in their name that are drawing- 
related.  Can you give me a pointer?


Odd, I got these as the first hits for "coalesced updates":






I'd try to elaborate, but I'd probably embarrass myself because I  
haven't actually looked closely at this.  I just remembered someone  
mentioning it once or twice upon a time.


--Andy

___

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: Dirty rects getting merged together makes for inefficient drawing

2009-10-19 Thread Ben Haller

On 19-Oct-09, at 10:40 PM, Andy Lee wrote:

Come to think of it, another experiment would have been to add  
logging to the cells used for the other table columns, to see if  
their drawing code was actually being called.


  Yeah, I did that.  See my previous post.  The upshot is that the  
table is correctly doing minimal redraws.


Sorry if I missed this, but is the string-drawing overhead  
noticeable to the user?  If so, and it's because you're redrawing  
very frequently, maybe you could throttle redrawing to, say, 2-4  
times per second.  There's something called coalesced updates that  
might help.


  I'll check it out.  I kinda want it to redraw a lot really really  
fast, though, because it looks cool.  ;->  I'm throttling my drawing  
to 60 frames per second at present, and then I'm trying to optimize  
the drawing code so that it takes as little time as possible, so that  
as much of each 1/60th second is left to calculate in as possible.   
Maybe I will make the tableView update every 1/30th of a second, and  
update everything else every 60th since it all draws faster.  :->


Does the table column's cell have to do much work to get the string  
it needs to draw (a gross example would be querying a database)?   
Maybe caching would help.


  Nope, all the time is in the string-drawing stuff inside AppKit.

I don't know how much overhead is in cell drawing, but maybe you  
could write your own cell class that doesn't, for example, check  
whether the string needs to be truncated.


  IIRC it wasn't stuff like that.  It was setting up the text storage  
and the typesetter, and then doing the actual drawing, I think.   
Nothing I could reasonably optimize, I think, without getting  
extremely dirty.


There's a section in the docs on optimizing drawing.  I must admit I  
haven't read it, but maybe it contains something that would help in  
your case?


  Read that.  Useful tips, and it did prompt me to put in checks for  
whether parts of my views are inside the dirty rects or not, and to  
make more of my views opaque.


Sorry for all the might's and maybe's --I'm hoping one of my stabs  
in the dark will help.


  Well, I'm curious about the coalesced update thing.  The only ref I  
find through Google is here:


http://developer.apple.com/mac/library/documentation/Performance/Conceptual/Drawing/Articles/CocoaDrawingTips.html

and I don't think that's what you're referring to.  AppKiDo (which I  
still love :->) doesn't find any APIs with "coalesce" in their name  
that are drawing-related.  Can you give me a pointer?


  Thanks!

Ben Haller
Stick Software


___

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


NSTableView weird behavior

2009-10-19 Thread Symadept
Hi,
I am implementing the functionality of the NSTableview in such a way that
once a cell is selected the background image shall be shown as some image,
HighlightedCell.png otherwise DefaultCell.png. If both the images are
solid(Opaque) coloured then there is no issue. If the DefaultCell.png
happens to be Transparent(Alpha <1.0) Coloured then the issue starts.

For your reference can refer the link,

http://www.4shared.com/file/142077560/af2d2a44/CustomTable.html

Regards
symadept
___

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: Dirty rects getting merged together makes for inefficient drawing

2009-10-19 Thread Andy Lee
Come to think of it, another experiment would have been to add logging  
to the cells used for the other table columns, to see if their drawing  
code was actually being called.q


Sorry if I missed this, but is the string-drawing overhead noticeable  
to the user?  If so, and it's because you're redrawing very  
frequently, maybe you could throttle redrawing to, say, 2-4 times per  
second.  There's something called coalesced updates that might help.


Does the table column's cell have to do much work to get the string it  
needs to draw (a gross example would be querying a database)?  Maybe  
caching would help.


I don't know how much overhead is in cell drawing, but maybe you could  
write your own cell class that doesn't, for example, check whether the  
string needs to be truncated.


There's a section in the docs on optimizing drawing.  I must admit I  
haven't read it, but maybe it contains something that would help in  
your case?


Sorry for all the might's and maybe's --I'm hoping one of my stabs in  
the dark will help.


--Andy

On Oct 19, 2009, at 9:02 PM, Ben Haller   
wrote:



On 19-Oct-09, at 6:53 PM, Andy Lee wrote:

On Monday, October 19, 2009, at 05:58PM, "Ben Haller" > wrote:

I think the problem is deeper (based upon what flashes under Quartz
Debug): I think the dirty rects are actually getting consolidated  
such
that NSTableView no longer has the information it needs to do  
minimal

drawing.


To test this theory, might it help to use a subclass of NSTableView  
whose drawRect: method prints the rectangle passed to it, and see  
what happens when your graph views do and do not do any drawing?   
And maybe the result of getRectsBeingDrawn:count: as well?


 Just did this.  The results are interesting.  Two points of note:

- my tableview does seem to be getting passed a nicely limited dirty  
rect, even though Quartz Debug flashes a much larger area.  So  
apparently flashes in Quartz Debug are only indicative of what  
Quartz is choosing to blit over to the screen, not what is actually  
getting updated.  If so, it would be useful to have a new checkbox  
in Quartz Debug that flashed only the areas actually getting marked  
as dirty, I think, so that one could check one's minimal-redraw  
correctness.  I logged 7317630 on this.


- there do seem to be some weirdnesses in the dirty rect  
accumulation code.  For example, when I call - 
getRectsBeingDrawn:count: and log the results, I typically see  
something like this:


count == 2
rects[0] == {{47, 12}, {45, 215}}
rects[1] == {{47, 0}, {45, 12}}

 So abutting rects of the same width are not getting merged  
together.  Oddly, the dividing line between these rects is not at a  
line boundary in my tableView; a bunch of lines get accumulated  
together into the tall rect, and then the topmost line gets split  
between the tall rect and the little rect.  I have no theory as to  
why this would be.


 As for NSTableView, it does appear to be doing minimal drawing.  So  
I guess all the string-drawing overhead I see in Sampler is just  
from the single column that is updating, which is unfortunate since  
it means I have no room for optimization.  I never imagined it would  
take so much time just to draw the one column I dirtied.


 So, sorry for the false alarm.  The main take-home point I get out  
of all this is that Quartz Debug flashes the areas being blitted  
over, which are not the same as the areas marked dirty or the areas  
requested to be redrawn!


Ben Haller
Stick Software


___

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 executing lpadmin from NSTask

2009-10-19 Thread Dave Keck
Strange; does this occur in a brand new new project, where the only
thing you do is this:

  [NSTask launchedTaskWithLaunchPath: @"/usr/sbin/lpadmin" arguments:
[NSArray array]];

And how about this:

  system("/usr/sbin/lpadmin");
___

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: Dirty rects getting merged together makes for inefficient drawing

2009-10-19 Thread Ben Haller

On 19-Oct-09, at 6:53 PM, Andy Lee wrote:

On Monday, October 19, 2009, at 05:58PM, "Ben Haller" > wrote:

 I think the problem is deeper (based upon what flashes under Quartz
Debug): I think the dirty rects are actually getting consolidated  
such

that NSTableView no longer has the information it needs to do minimal
drawing.


To test this theory, might it help to use a subclass of NSTableView  
whose drawRect: method prints the rectangle passed to it, and see  
what happens when your graph views do and do not do any drawing?   
And maybe the result of getRectsBeingDrawn:count: as well?


  Just did this.  The results are interesting.  Two points of note:

- my tableview does seem to be getting passed a nicely limited dirty  
rect, even though Quartz Debug flashes a much larger area.  So  
apparently flashes in Quartz Debug are only indicative of what Quartz  
is choosing to blit over to the screen, not what is actually getting  
updated.  If so, it would be useful to have a new checkbox in Quartz  
Debug that flashed only the areas actually getting marked as dirty, I  
think, so that one could check one's minimal-redraw correctness.  I  
logged 7317630 on this.


- there do seem to be some weirdnesses in the dirty rect accumulation  
code.  For example, when I call -getRectsBeingDrawn:count: and log the  
results, I typically see something like this:


count == 2
rects[0] == {{47, 12}, {45, 215}}
rects[1] == {{47, 0}, {45, 12}}

  So abutting rects of the same width are not getting merged  
together.  Oddly, the dividing line between these rects is not at a  
line boundary in my tableView; a bunch of lines get accumulated  
together into the tall rect, and then the topmost line gets split  
between the tall rect and the little rect.  I have no theory as to why  
this would be.


  As for NSTableView, it does appear to be doing minimal drawing.  So  
I guess all the string-drawing overhead I see in Sampler is just from  
the single column that is updating, which is unfortunate since it  
means I have no room for optimization.  I never imagined it would take  
so much time just to draw the one column I dirtied.


  So, sorry for the false alarm.  The main take-home point I get out  
of all this is that Quartz Debug flashes the areas being blitted over,  
which are not the same as the areas marked dirty or the areas  
requested to be redrawn!


Ben Haller
Stick Software

___

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


[Solved] Problem executing lpadmin from NSTask

2009-10-19 Thread Laurent Daudelin
Nevermind. I just realized I had a path set incorrectly for one of the argument 
to the NSTask. Was misled in thinking it was the launch path but it was that 
argument path that was wrong. Sorry for wasting bandwidth.




-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://nemesys.dyndns.org
Logiciels Nemesys Software  
laurent.daude...@gmail.com
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries

___

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 executing lpadmin from NSTask

2009-10-19 Thread Laurent Daudelin
Hello.

I'm trying to launch an NSTask to execute /usr/sbin/lpadmin but even though I 
can do so in the terminal, NSTask refuses to launch it. If I set the launch 
path to /usr/sbin/lpadmin, NSTask reports that /usr/sbin/lpadmin is a 
directory? If I set the current directory to /usr/sbin and the launch path to 
lpadmin, NSTask reports that the path is not accessible.

I checked and double-checked, /usr/sbin is a real path and lpadmin is there, 
not a symbolic link in any way. I don't have to authenticate to run it so I"m 
lost as to why NSTask can't seem to launch that executable.

Anybody has any idea?

Thanks in advance.




-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://nemesys.dyndns.org
Logiciels Nemesys Software  
laurent.daude...@gmail.com
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries

___

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: Dirty rects getting merged together makes for inefficient drawing

2009-10-19 Thread Graham Cox


On 20/10/2009, at 8:58 AM, Ben Haller wrote:

 I think the problem is deeper (based upon what flashes under Quartz  
Debug): I think the dirty rects are actually getting consolidated  
such that NSTableView no longer has the information it needs to do  
minimal drawing.  I could be mistaken about that, though, if the  
flashes in Quartz Debug show only the area that Quartz is choosing  
to blit over, and not necessarily the area that was considered dirty  
and redrawn. (i.e. if it brings over merged areas for efficiency,  
for some reason; but that seems unlikely...)



I think what you're observing is right. If you invalidate two disjoint  
rects in a view, while Quartz keeps track of those separate areas, its  
overall union is calculated and passed to any -drawRect: methods  
(intersected with that view's frame) that get called as a result. Many  
simple views will not bother to break that down. If the disjoint areas  
are far apart, that can be a considerable area. (As an aside, I think  
Cocoa does miss an efficiency trick there, because it could intersect  
each view's frame with the original dirty rect list for the window,  
then union the result to pass to -drawRect:, rather than with the  
union of that list as it appears to do - i.e. if it did intersect +  
union it would come up with smaller areas for each view than union +  
intersect, but there may be other factors such as backward  
compatibility and speed of calculating these rects to consider).


I suspect its likely that NSTableView is just taking its -drawRect:  
parameter as what it needs to update and doing that, rather than  
further examining the individual dirty rects. I think the ability to  
maintain and test the individual dirty rects was only added in 10.3 or  
so, possibly earlier, but certainly wasn't inherited from OpenStep.  
The flashes in Quartz Debug may also be representing areas that other  
parts of the view (the background, say) are responding to which is  
masking what NSTableView is updating. I'm not sure if QD has any way  
to separate out the two (it can't know how a specific view is  
responding to -drawRect:, whether it is further testing against the  
dirty rects) so it might not be showing you the true picture.


However, maybe you shouldn't get too hung up on this. If your own  
custom views do complex drawing, then using -needsToDrawRect: and/or - 
getRectsBeingDrawn:count: are well worth using and you can trust them  
to do the right thing, regardless of what QD shows is the update rect.  
There's nothing to lose by using these methods really, but equally  
there may be nothing to gain either. You might not be able to do much  
about NSTableView whatever it's doing internally. Does profiling  
indicate that drawing updates are too slow?


--Graham


___

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

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

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

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


Re: Dirty rects getting merged together makes for inefficient drawing

2009-10-19 Thread Ben Haller

On 19-Oct-09, at 5:58 PM, Greg Guerin wrote:


Ben Haller wrote:


1. Superview that does no drawing and is not opaque

A. Subview #1: a tableview that is opaque
B. Subview #2: a graph view that is opaque
C. Subview #3: another graph view that is opaque



Obvious experiment: set the superview to be opaque.


 Indeed.  Already tried it (right after posting), and it makes no  
difference.  I'd try rearranging the view hierarchy to test the  
effects of that, but that isn't trivial, because it is arranged  
programmatically, so I'm hoping someone has already explored this...
 More generally, I am interested in knowing how this mechanism works,  
beyond just fixing my immediate problem, so I hope somebody can  
comment on that more generally.  And whether there is any way to  
affect it, beyond my immediate case.  I find nothing in the docs about  
it.


Ben Haller
Stick Software

___

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: Dirty rects getting merged together makes for inefficient drawing

2009-10-19 Thread Andy Lee
On Monday, October 19, 2009, at 05:58PM, "Ben Haller" 
 wrote:
>On 19-Oct-09, at 5:27 PM, Dave Keck wrote:
>
>> Would NSView's -getRectsBeingDrawn:count: help?
>
>   Well, I'm already using it in my own code where appropriate.  (Or  
>actually I'm using -needsToDrawRect:).  But the problem is that a  
>whole bunch of NSTableView cells are getting drawn that never got  
>invalidated.  I would certainly hope that NSTableView is using one of  
>these minimal-drawing mechanisms, and I assume that it is.
>
>   I think the problem is deeper (based upon what flashes under Quartz  
>Debug): I think the dirty rects are actually getting consolidated such  
>that NSTableView no longer has the information it needs to do minimal  
>drawing.

To test this theory, might it help to use a subclass of NSTableView whose 
drawRect: method prints the rectangle passed to it, and see what happens when 
your graph views do and do not do any drawing?  And maybe the result of 
getRectsBeingDrawn:count: as well?

I'm curious too if you've tried Greg Guerin's suggestion.

--Andy


>  I could be mistaken about that, though, if the flashes in  
>Quartz Debug show only the area that Quartz is choosing to blit over,  
>and not necessarily the area that was considered dirty and redrawn.   
>(i.e. if it brings over merged areas for efficiency, for some reason;  
>but that seems unlikely...)
>
>Ben Haller
>Stick Software
>
>___
>
>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/aglee%40mac.com
>
>This email sent to ag...@mac.com
>
>
___

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

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

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

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


Re: Why does my font come out looking fuzzy?

2009-10-19 Thread Ben Haller
 Yes, it sounds like the suggestions I've gotten for modifying the  
antialiasing behavior would probably be helpful.  I have solved the  
problem by simply snapshotting the LCD digit images and writing a  
little control that displays a number using those snap images.  Seemed  
simpler, sadly.  Works great.  Thanks to the posters, though; CALayer  
and related concepts are quite new to me, so it is good to develop  
some mental context surrounding them!


Ben Haller
Stick Software


On 19-Oct-09, at 6:24 PM, Dalmazio Brisinda wrote:

Kyle's explanation #1 was spot on for my application. I had an  
NSSearchField in a custom window and view which was not displaying  
quite correctly. It looked as if it was not being anti-aliased.  
Going into Interface Builder, I noticed I had selected the "Wants  
core animation layer" switch for the control. Turning this off  
corrected the problem.


Best,
Dalmazio



On 2009-10-17, at 9:27 PM, cocoa-dev-requ...@lists.apple.com wrote:


You need to post a screenshot of what you're seeing.

I can think of two possibilities off the top of my head:
1) You're rendering text into a CALayer (especially a CATextLayer).
Without some tweaking, CALayer can't do subpixel antialiasing (aka  
LCD

antialiasing), because it doesn't have the existing backing store to
composite against.
2) You're overdrawing the text and are therefore ruining the
antialiasing, producing a distorted image.

Again, screenshot is pretty much mandatory here.

--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/bhcocoadev%40sticksoftware.com

This email sent to bhcocoa...@sticksoftware.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: Why does my font come out looking fuzzy?

2009-10-19 Thread Dalmazio Brisinda
Kyle's explanation #1 was spot on for my application. I had an  
NSSearchField in a custom window and view which was not displaying  
quite correctly. It looked as if it was not being anti-aliased. Going  
into Interface Builder, I noticed I had selected the "Wants core  
animation layer" switch for the control. Turning this off corrected  
the problem.


Best,
Dalmazio



On 2009-10-17, at 9:27 PM, cocoa-dev-requ...@lists.apple.com wrote:


You need to post a screenshot of what you're seeing.

I can think of two possibilities off the top of my head:
1) You're rendering text into a CALayer (especially a CATextLayer).
Without some tweaking, CALayer can't do subpixel antialiasing (aka LCD
antialiasing), because it doesn't have the existing backing store to
composite against.
2) You're overdrawing the text and are therefore ruining the
antialiasing, producing a distorted image.

Again, screenshot is pretty much mandatory here.

--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: Handle multiple screens & mouse

2009-10-19 Thread Gabriel Höhener

Hello together

I solved this problem, it was because I was mixing up coordinates. But 
with the origin and framesize information you can do it without any problem.


NOW I have another problem and I'm sure this is not that difficult for 
you guys - it's a beginner question.


I can do everything I want with the mouse programmatically (move, drag, 
double-click, etc...), but whenever I click programmatically on the 
window of my "mouse-moving" app itself, for example on a button or on a 
slider, the application "doesn't allow" to make any other mouse Events 
programmatically - it just stucks! When I take then my real optical 
mouse and make a left-click, the cursor moves around and it seems that 
all Events that my app wanted to perform right after the app stuck, are

then executed...

(If i click on another window from another application, for example 
safari, it works perfectly... )


Thank you in advance

Gabe



Jens Alfke schrieb:


On Oct 14, 2009, at 12:53 AM, Gabriel Höhener wrote:

The problem is not about the window but about the mouse. When i 
programmatically move the mouse around and cross the borders of my 
screens, it jumps to (0,0) on the mainscreen..


Don't move the mouse cursor around! That's just annoying. No good Mac 
software does this.


—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: Dirty rects getting merged together makes for inefficient drawing

2009-10-19 Thread Ben Haller

On 19-Oct-09, at 5:27 PM, Dave Keck wrote:


Would NSView's -getRectsBeingDrawn:count: help?


  Well, I'm already using it in my own code where appropriate.  (Or  
actually I'm using -needsToDrawRect:).  But the problem is that a  
whole bunch of NSTableView cells are getting drawn that never got  
invalidated.  I would certainly hope that NSTableView is using one of  
these minimal-drawing mechanisms, and I assume that it is.


  I think the problem is deeper (based upon what flashes under Quartz  
Debug): I think the dirty rects are actually getting consolidated such  
that NSTableView no longer has the information it needs to do minimal  
drawing.  I could be mistaken about that, though, if the flashes in  
Quartz Debug show only the area that Quartz is choosing to blit over,  
and not necessarily the area that was considered dirty and redrawn.   
(i.e. if it brings over merged areas for efficiency, for some reason;  
but that seems unlikely...)


Ben Haller
Stick Software

___

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: Dirty rects getting merged together makes for inefficient drawing

2009-10-19 Thread Greg Guerin

Ben Haller wrote:


1. Superview that does no drawing and is not opaque

A. Subview #1: a tableview that is opaque
B. Subview #2: a graph view that is opaque
C. Subview #3: another graph view that is opaque



Obvious experiment: set the superview to be opaque.

  -- GG

___

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: Dirty rects getting merged together makes for inefficient drawing

2009-10-19 Thread Dave Keck
Would NSView's -getRectsBeingDrawn:count: help?
___

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


Dirty rects getting merged together makes for inefficient drawing

2009-10-19 Thread Ben Haller
  Hi all.  I expected this to be an FAQ, but my searches have turned  
up nothing relevant, so here goes.


  I've got a window with a view hierarchy like this:

1. Superview that does no drawing and is not opaque

A. Subview #1: a tableview that is opaque
B. Subview #2: a graph view that is opaque
C. Subview #3: another graph view that is opaque

  The tableview is on top, the two graph are on the bottom, on the  
left and on the right respectively.  My app alternates calculating and  
drawing the results.  Typically, what needs to get drawn is *one*  
column of the tableview, plus both graphs.  I'm carefully calling  
setNeedsDisplayInRect: for only the bits that need to be drawn; I'm  
using [frameOfCellAtColumn:row:] to get the frame of the cells that  
need to be redrawn, and invalidating only them, for example.


  If I turn off all redrawing of the graphs, then Quartz Debug shows  
me that my invalidating in the tableview is minimal; only the column  
that needs to be drawn flashes.  If I turn off all redrawing of the  
tableview, QuartzDebug similarly shows that my invalidating in the  
graphs is minimal.  So taken separately, it's all good.  But when  
drawing of all the views is turned on, somebody is merging together  
the dirty rects and causing pretty much the entire content of the  
window to redraw.  This means that a ton of extra table cells are  
redrawing unnecessarily, and I see the overhead from this very clearly  
in Instruments/Sampler (text drawing is not fast!).


  So my question is: is there any way I can exert any control over  
the merging of dirty rects?  I thought maybe adding some vertical  
space between the tableview and the graph views would "disconnect"  
them and make the dirty rects get handled separately; but no dice;  
even adding 100 pixels of vertical space doesn't prevent the merge.   
Is the merging dependent upon the view hierarchy or opacity in some  
way?  Or are there CG calls somewhere in the bowels that I could use  
to change a "merge threshold" or something?


  I'm not sure whether this is a Cocoa or a CG question really, but  
since I'm using nothing but Cocoa calls at present, I figured I'd try  
this list first...


  Thanks!

Ben Haller
Stick Software

___

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: OSX have that is equivalent to WaitMessage() Win32 API

2009-10-19 Thread Warren Dodge

On Oct 18, 2009, at 9:43 PM, Mars999 wrote:

void CEngine::Start()
{
  m_lLastTick = SDL_GetTicks();
  m_bQuit = false;
  // Main loop: loop forever.
  while ( !m_bQuit )
  {
  // Handle mouse and keyboard input
  HandleInput();
  if ( m_bMinimized ) {
  // Release some system resources if the app. is minimized.
  WaitMessage(); // pause the application until focus in  
regained

  } else {
  // Do some thinking
  DoThink();
  // Render stuff
  DoRender();
  }
  }
  End();
}


The most likely place where you might write this kind of low-level  
code is in games. If that's what you're trying to do, I'd recommend  
checking out the iDevGames forum:

  http://www.idevgames.com/forum/

If you're writing a standard application, you'll need a more standard  
Mac approach as other people have suggested.


Warren

___

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: Disk burning virtual folder problem

2009-10-19 Thread David Cake

At 2:58 PM +1100 19/10/09, Graham Cox wrote:

On 19/10/2009, at 9:58 AM, David Cake wrote:


DRFolder *rootFolder = [DRFolder folderWithPath:[self burnDirPath]]



^^^ rootFolder


[rootFolder makeVirtual];

and then I try to add some other files to the contents of this directory
NSURL *source = @"/Volumes/AValidVolumeName"
NSFileManager *fileManager = [NSFileManager defaultManager];
NSArray *filesToAdd;
filesToAdd = [fileManager contentsOfDirectoryAtPath:[source path] error:nil];
NSEnumerator *enumerator = [filesToAdd objectEnumerator];
NSString *currentFile;
while (currentFile = [enumerator nextObject]) {
	[folder addChild:[DRFile fileWithPath:[[source path] 
stringByAppendingFormat: @"/%@", currentFile]]];

}


^^^ folder

Intentional? I don't see where 'folder' comes from. Shouldn't that 
be 'rootFolder'?


	Yes, sorry - clumsily pasted together code from two different 
methods, rootFolder is passed as folder to another method.

Regards
David
___

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: iPhone: UIDatePicker - setting the time?

2009-10-19 Thread Luke the Hiesterman

You're looking for the date property on UIDatePicker.

Luke

On Oct 19, 2009, at 10:01 AM, Eric E. Dolecki wrote:

I am trying to set a UIDatePicker (in Time mode) to a specific hour,  
minute
and am/pm. I assume that I need to create a NSDate object with said  
hr, min,
ampm & then apply it to my picker, but after some googling and  
checking APIs
I am not seeing a direct way of doing this. I have my hr and mins as  
int, my

ampm at the moment as a string.
I could play with views to keep my view with my picker "modal" - ie.  
it
disappears but never gets unloaded, but I don't feel that's a good  
way to

go.

Thanks,
Eric
___

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/luketheh%40apple.com

This email sent to luket...@apple.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


iPhone: UIDatePicker - setting the time?

2009-10-19 Thread Eric E. Dolecki
I am trying to set a UIDatePicker (in Time mode) to a specific hour, minute
and am/pm. I assume that I need to create a NSDate object with said hr, min,
ampm & then apply it to my picker, but after some googling and checking APIs
I am not seeing a direct way of doing this. I have my hr and mins as int, my
ampm at the moment as a string.
I could play with views to keep my view with my picker "modal" - ie. it
disappears but never gets unloaded, but I don't feel that's a good way to
go.

Thanks,
Eric
___

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 NSURLProtocol crashes when using Garbage Collection

2009-10-19 Thread Greg Parker

On Oct 19, 2009, at 2:16 AM, Keith Duncan wrote:
I wrote a simple NSURLProtocol subclass and started observing  
crashes in URL Loading code. I've extracted the crasher into a  
simple test project which loads an image from a URL with custom  
scheme which I handle every hundredth of a second.


When compiled with -fobjc-gc it reliably crashes; without it runs  
indefinitely however, there are leaked NSString instances allocated  
by NSURLConnection in +sendSynchronousRequest:… I've filed this as rdar://problem/7314551 
 for reference.


The test project can be found http://33software.com/files/CrashLoadingURL.zip 
 The bug is reproductable in the SpecialPictureProtocol sample code  
if compiled for garbage collection too.


Can anyone else verify this or point to a workaround?


Looks like a bug somewhere, and I don't see anything obviously wrong  
in your code.


At first I was suspicious because your -startLoading code calls other  
notifications like didReceiveResponse and didFinishLoading. Some  
clients can be confused about that; they aren't prepared for the  
connection to be torn down that early. The usual solution is to do the  
real work using performSelector:@selector(doRealWork) withObject:nil  
afterDelay:0.0, but I tried that and it still crashed.


At this point I expect there's a GC bug in the NSURLProtocol  
machinery, specifically the bridge between NSURLProtocol and  
CFURLProtocol. We'll look further in 7314551.



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


___

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: Neophyte Question: Connecting to nib objects

2009-10-19 Thread Kyle Sluder

On Oct 19, 2009, at 8:51 AM, Phil Hystad  wrote:

I am new to Cocoa and I am wondering how to do something that should  
be simple and obvious.  Given that I have an object defined in the  
nib (aka xib), for example, an object that responds to a given view,  
what is the correct way for my running application (if it is in some  
other state, not responding to an action) to obtain a pointer to  
that object.


Gah, terminology salad!

Defined in nib: you mean instantiated here. You've defined the class  
in code. It would also be helpful to know what this object does (or is  
intended to do).


Respond to view: a view is a thing in a window, it can't be responded  
to. It can send messages to other objects, sure, and there are a few  
different categories of such methods: delegate methods (I'm gonna  
resize now!), datatsource methods (What's the name of object #4?), and  
target/action methods (I've been clicked! You, do the thing I was told  
to make you do!) are the most common. In each case you need to wire an  
object up to an outlet on the view; for target/action, you also need  
to specify the selector that will be sent, so IB combines the two  
properties into one "sent action" pseudo-outlet.



Maybe a second question is "Do I ever need to do this?".


That would indeed be the question, and the answer is "no." If you are  
ever wanting to divine a pointer to an object from midair, you are  
doing something wrong. You might just need to create an outlet and  
hook up the other object to it, or your design might be flawed.


This question came about because I was experimenting with a sample  
program I am using to learn Cocoa and I wanted to change the state  
of the class that is defined in the nib.  I did not know how to get  
a pointer to that object.  It seems that it is serialized (un- 
archived?) when the nib is loaded.


So you have some code that loads a nib, and wants to interact with one  
of the objects that lives in the nib. Typically the object that does  
the nib loading is also configured as the File's Owner of the nib. So  
you would define an outlet on that class and hook up your interesting  
object to it in IB.


--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: Neophyte Question: Connecting to nib objects

2009-10-19 Thread Mark Ritchie

On 19-Oct-2009, at 8:51 AM, Phil Hystad wrote:
Given that I have an object defined in the nib (aka xib), for  
example, an object that responds to a given view, what is the  
correct way for my running application (if it is in some other  
state, not responding to an action) to obtain a pointer to that  
object.


The "File's Owner" is what you're after!

The docs are here:
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/LoadingResources/CocoaNibs/CocoaNibs.html#//apple_ref/doc/uid/1051i-CH4-SW15


Maybe a second question is "Do I ever need to do this?".

Yes, yes, yes and yes! ;-)

Some examples:
1) initialization of state so that objects from a nib file are in sync  
with your controller

2) state updates
3) enable/disable of optional UI components
4) dynamic changes to the UI which could not be foreseen before runtime.
etc, etc

Regards!
M.
___

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


Neophyte Question: Connecting to nib objects

2009-10-19 Thread Phil Hystad
I am new to Cocoa and I am wondering how to do something that should  
be simple and obvious.  Given that I have an object defined in the nib  
(aka xib), for example, an object that responds to a given view, what  
is the correct way for my running application (if it is in some other  
state, not responding to an action) to obtain a pointer to that object.


Maybe a second question is "Do I ever need to do this?".

This question came about because I was experimenting with a sample  
program I am using to learn Cocoa and I wanted to change the state of  
the class that is defined in the nib.  I did not know how to get a  
pointer to that object.  It seems that it is serialized (un-archived?)  
when the nib is loaded.


Thanks,
phil
phys...@mac.com

___

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

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

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

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


Re: Programming Style: Method Definition with or without a semicolon.

2009-10-19 Thread Uli Kusterer

On 18.10.2009, at 04:35, Ken Thomases wrote:

On Oct 17, 2009, at 2:24 AM, Uli Kusterer wrote:
What do project templates have to do with code completion? The  
comments don't mention how to customize code completion stubs  
either. Did I overlook something?


For controlling code completion, search for  
"XCCodeSenseFormattingOptions" on this page: http://developer.apple.com/mac/library/documentation/DeveloperTools/Reference/XcodeUserDefaultRef/100-Xcode_User_Defaults/UserDefaultRef.html



Ken,

 wow! Thank you! This is great! Here's a direct link to the section  
in question ("View Source" and decoding the anchor tag to the rescue):


http://developer.apple.com/mac/library/documentation/DeveloperTools/Reference/XcodeUserDefaultRef/100-Xcode_User_Defaults/UserDefaultRef.html#//apple_ref/doc/uid/TP40005535-CH3-SW40

And it looks like the following command line:

defaults write com.apple.Xcode XCCodeSenseFormattingOptions -dict-add  
PreExpressionsSpacing  "" InExpressionsSpacing " "  
InFunctionArgsSpacing " " PreMethodTypeSpacing "" PostColonSpacing " "  
BlockSeparator "\n"


makes the inserted code templates just the way I like them. Most non- 
Uli people will probably want to change the PreExpressionsSpacing and  
InExpressionsSpacing ;-)


Cheers,
-- 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: Recreating iPhone alarm Picker

2009-10-19 Thread Roland King
If I wanted to do something like this myself, not a date but some  
other rotating list of items, I would probably use a  
UIPickerViewDataSource to tell the UIPicker it has a vast number of  
rows and I'd start the picker index 1/2 way through that range. Then  
I'd return a title from pickerView:titleForRow:forComponent: modulus  
the number of things I actually have in the list.


eg I'd tell the picker I have 2 rows, start at row 1, if I had  
123 actual pieces of data I'd return value '0' for 9754, 9877, 1,  
10123, 10246 etc. You only need the 123 pieces of data, the rest is  
just mapping it onto a huge range.


Were I concerned it was really possible to run off the end I'd attempt  
to find a reasonable point (perhaps at selection) to reset the index  
back to a central value again.


In this case however .. the built-in date or time pickers are what you  
want.


On 19-Oct-2009, at 9:49 PM, Luke the Hiesterman wrote:

Just use a UIDatePicker on mode UIDatePickerModeTime or  
UIDatePickerModeDateAndTime and you should be all set.


Luke

On Oct 19, 2009, at 6:44 AM, Eric E. Dolecki wrote:

I have a fairly noob question in regards to recreating an alarm  
view using a

Picker control.
On the iPhone, the values for hours & minutes wrap around - and I was
wondering if this is accomplished by repeating values in an NSArray  
(so many
that you're not likely to scroll to them), or are they using  
another trick

to get the values to loop around in the control?

I am really just making my own alarm setting UI using the Picker.

Thanks,
Eric
___

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/luketheh%40apple.com

This email sent to luket...@apple.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/rols%40rols.org

This email sent to r...@rols.org


___

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

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

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

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


Re: Recreating iPhone alarm Picker

2009-10-19 Thread Eric E. Dolecki
Well, kick me in the junk - that's awesome and I can't believe I didn't see
that.
Thanks Luke,Eric

On Mon, Oct 19, 2009 at 9:49 AM, Luke the Hiesterman wrote:

> Just use a UIDatePicker on mode UIDatePickerModeTime or
> UIDatePickerModeDateAndTime and you should be all set.
>
> Luke
>
>
> On Oct 19, 2009, at 6:44 AM, Eric E. Dolecki wrote:
>
>  I have a fairly noob question in regards to recreating an alarm view using
>> a
>> Picker control.
>> On the iPhone, the values for hours & minutes wrap around - and I was
>> wondering if this is accomplished by repeating values in an NSArray (so
>> many
>> that you're not likely to scroll to them), or are they using another trick
>> to get the values to loop around in the control?
>>
>> I am really just making my own alarm setting UI using the Picker.
>>
>> Thanks,
>> Eric
>> ___
>>
>> 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/luketheh%40apple.com
>>
>> This email sent to luket...@apple.com
>>
>
>


-- 
http://ericd.net
Interactive design and development
___

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: Recreating iPhone alarm Picker

2009-10-19 Thread Luke the Hiesterman
Just use a UIDatePicker on mode UIDatePickerModeTime or  
UIDatePickerModeDateAndTime and you should be all set.


Luke

On Oct 19, 2009, at 6:44 AM, Eric E. Dolecki wrote:

I have a fairly noob question in regards to recreating an alarm view  
using a

Picker control.
On the iPhone, the values for hours & minutes wrap around - and I was
wondering if this is accomplished by repeating values in an NSArray  
(so many
that you're not likely to scroll to them), or are they using another  
trick

to get the values to loop around in the control?

I am really just making my own alarm setting UI using the Picker.

Thanks,
Eric
___

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/luketheh%40apple.com

This email sent to luket...@apple.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


Recreating iPhone alarm Picker

2009-10-19 Thread Eric E. Dolecki
I have a fairly noob question in regards to recreating an alarm view using a
Picker control.
On the iPhone, the values for hours & minutes wrap around - and I was
wondering if this is accomplished by repeating values in an NSArray (so many
that you're not likely to scroll to them), or are they using another trick
to get the values to loop around in the control?

I am really just making my own alarm setting UI using the Picker.

Thanks,
Eric
___

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: Curious about SSH --> actually about: Keychain --> (passive aggressive)

2009-10-19 Thread I. Savant

On Oct 19, 2009, at 8:32 AM, Stuart Malin wrote:

What you perceived as "passive aggressive" is... I.S.'s style,  
which, if you were a regular reader of the list, you'd be familiar  
with; a style that (I suspect) ameliorates his frustration and  
enables him to answer yet-once-again a query that should never have  
been posted, and do so with useful guidance, all in the hopes (I  
further suspect) that if others would read, the list would become a  
place of ever-more streamlined activity.


 Well said, but to be fair, he directly quoted Jens' comment (which  
included his desire to invest in SEO for his class). I believe I'm  
innocent there. :-D


  (Note: None of the following is aimed at the OP.)

  You are right that malformed (or even lazy) questions become  
tiresome to those who try to contribute to the list every day.  
Sometimes it's easy to laugh about it and come up with a witty way of  
pointing out laziness (in research or in framing the question) but  
other times impatience and annoyance get the better of many of us.  
We're human. Want a less annoyed response? Mind your manners: do your  
research and make an effort not to waste our time.


  It's also important to consider - and I bring this up because  
another poster said he felt it was condescending - the "how to ask  
smart questions" link is 100% on the money. Sure, it's irreverent but  
for some posters, I think the best thing for them is to be shamed into  
reconsidering how they approach a technical mailing list for help. It  
worked for me years ago - yes, shocker, I was new to using a list and  
didn't understand how wrong my approach was until someone gave me a  
stern talking-to, forcing me to consider it.


  So, while my own response made light of the stock "please search  
first" (ie, "intellectual laziness is considered rude among  
professional developers"), my annoyance was minor and levity was my  
main goal. I won't speak for Jens but when I saw his response, I  
didn't think his SEO comment was aimed at the OP, just that he  
lamented his own hard work wasn't found with a Google search with  
relevant keywords. Shame on him! ;-)


  And, finally: "Passive-aggressive" is something of which I've never  
been accused. "Blunt ***hole" however ... well, guilty as charged. ;-)


--
I.S.


___

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: Curious about SSH --> actually about: Keychain --> (passive aggressive)

2009-10-19 Thread Stuart Malin

On Oct 18, 2009, at 11:13 PM, Brent Smith wrote:


thanks for the help all.

Theres no need to be passive aggressive


What you perceived as "passive aggressive" is... I.S.'s style, which,  
if you were a regular reader of the list, you'd be familiar with; a  
style that (I suspect) ameliorates his frustration and enables him to  
answer yet-once-again a query that should never have been posted, and  
do so with useful guidance, all in the hopes (I further suspect) that  
if others would read, the list would become a place of ever-more  
streamlined activity.


There are many very smart and experienced programmers on this list who  
take much of their valuable time to answer posts. With so much good  
information flowing, a non-expert programmer can learn much by reading  
responses to other people's posts -- this is certainly the case for me.


Alas, it seems that many people don't read the list actively, and  
then, when they have a question, they post as if their circumstance  
are unique. Yet, most often such is not the case, the issue been dealt  
with before, or an answer is readily available.


There have been endless replies made to posters of suggesting that  
they first do a search, that the pose their problem informatively, and  
that they explain what they have tried (when it is a coding  
problem)... yet over and over people come to the list and ask  
malformed or trivial questions as if they have never seen any of this  
contextualizing guidance. The smart folks on the list can't keep  
answering such questions over and over - it is much too tedious (or so  
I suspect, as I am not one of them). Continuing to answer such  
questions directly encourages laziness, vitiates the quality of the  
list, and would drive expertise away, and so to counteract such, I.S.  
jumps in and short circuits such queries, counseling the poster to do  
a little bit of self-help work first.


Should one make a reasonable effort to answer a question or solve a  
problem, but still come up short, then one is welcome to post to the  
list, and preferably should do so cognizant of the guidance that has  
over-and-over been posted here about how to frame a query, so that the  
experienced can quickly determine if they are knowledgeable in the  
problem domain, zero in on the actual problem, and provide an  
actionable response, all in an expedient and time-effective manner.   
These folks can be quite compassionate: I have on more than one  
occasion asked a bumble-headed question -- after all, stupidity and  
blindness happen; but I do try and frame my questions well and explain  
what I've tried; when I do so, I receive patient and informative  
responses sans sarcasm.


The smart people here are here of their own volition and desire to  
help -- let's not abuse them.









___

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: unsleep the display programatically?

2009-10-19 Thread jon
that will work,   because that will remind them to change that  
preference,   thanks for doing that.


Jon.


On Oct 19, 2009, at 1:13 AM, Mark Ritchie wrote:

After a short time of no password being entered, the screen will go  
back to sleep


___

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: Binding Enabled property to NSArrayController selection

2009-10-19 Thread Stamenkovic Florijan


On Oct 19, 2009, at 07:59, Matthew Lindfield Seager wrote:


2009/10/19 Stamenkovic Florijan 

I think so... When binding the enabled state of a toolbar item you  
need to make sure that the item does not autovalidate. The  
"Autovalidates" checkbox can be found in the attributes panel of the  
inspector for a toolbar item. I am not sure if this is a bug or not,  
and it is NOT mentioned in the bindings reference for  
NSToolbarButton, so it's a bit tricky to figure out. Since usually  
bindings override the non-bound state I can see this as a bug, but  
my experience with Cocoa is not wide enough to judge... Anyone else?


 One little check box!!! Argh!

Thank you very much for your help!


Sure...

At the very least I should probably log a documentation request for  
the binding's reference (there's not much to the NSToolbarItem  
Bindings section but I read it several times to make sure I wasn't  
missing anything!).


Right... I was just thinking about this a bit. Unlike with most  
bindings, I guess it is possible to use both the standard  
autovalidation and the binding at the same time. As it seems that  
autovalidation is postponed until the next cycle of the run loop. So,  
if using autovalidation one could consider the current state of the  
item and add to that some custom validation logic. However, this is  
pure speculation.


I possibly should have cottoned on to the fact that every search I  
performed talked more about validation than bindings. If I didn't  
receive an answer I was going to delve into validation but I really  
don't have the time at this moment in time so I'm VERY grateful for  
your help!


Well, the toolbar programming documentation does not discuss this in  
it's validation part either. In fact, it does not even mention the  
"autovalidate" property of NSToolbarItem. So, even if this behavior is  
intended, it seems to be 100% undocumented. I will confirm this on  
Snow Leopard, as I didn't get around to it yet, and report it as a bug  
as well.


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: Binding Enabled property to NSArrayController selection

2009-10-19 Thread Matthew Lindfield Seager
2009/10/19 Stamenkovic Florijan 
>
>
> I think so... When binding the enabled state of a toolbar item you need to
> make sure that the item does not autovalidate. The "Autovalidates" checkbox
> can be found in the attributes panel of the inspector for a toolbar item. I
> am not sure if this is a bug or not, and it is NOT mentioned in the bindings
> reference for NSToolbarButton, so it's a bit tricky to figure out. Since
> usually bindings override the non-bound state I can see this as a bug, but
> my experience with Cocoa is not wide enough to judge... Anyone else?


 One little check box!!! Argh!

Thank you very much for your help! At the very least I should probably log a
documentation request for the binding's reference (there's not much to
the NSToolbarItem Bindings section but I read it several times to make sure
I wasn't missing anything!).

I possibly should have cottoned on to the fact that every search I performed
talked more about validation than bindings. If I didn't receive an answer I
was going to delve into validation but I really don't have the time at this
moment in time so I'm VERY grateful for your help!

Regards,
Matt
___

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: Binding Enabled property to NSArrayController selection

2009-10-19 Thread Stamenkovic Florijan

Hi Matthew,

On Oct 19, 2009, at 07:08, Matthew Lindfield Seager wrote:

As discussed previously on this list I am using the data source  
methods of
NSOutlineView to display the contents of two separate  
NSArrayControllers.
When an item is selected I use outlineViewSelectionDidChange: to  
manually
update the selection of the appropriate array controller and  
deselect all

items in the other array controller (i.e. I pass an empty index set to
setSelectionIndexes).

I would like a toolbar item to only be enabled when an item in the  
first

controller is selected so I tried binding it's Enabled property to
selectedobjec...@count and then canRemove. With either binding when  
the
selection changes I see the button flicker as though it is being  
disabled

and then reenabled but it never stays disabled.

I verified that empty selections are allowed. I am observing changes  
to the

outline view's selectionIndex and I can verify that even though
[[myArrayController selectedObjects] count] == 0, the item is not  
[staying?]

disabled. Using the "No Selection Placeholder" value doesn't make a
difference either.

Out of curiosity/desparation I even tried the inverse (enabling it  
when an

object from the other array controller is selected) and two different
complements (disabling it when an object from the other array  
controller is

selected AND disabling it when an abject from this controller is not
selected). No matter what I tried it would only flicker when I was  
expecting

it to stop being enabled. Am I missing something obvious?


I think so... When binding the enabled state of a toolbar item you  
need to make sure that the item does not autovalidate. The  
"Autovalidates" checkbox can be found in the attributes panel of the  
inspector for a toolbar item. I am not sure if this is a bug or not,  
and it is NOT mentioned in the bindings reference for NSToolbarButton,  
so it's a bit tricky to figure out. Since usually bindings override  
the non-bound state I can see this as a bug, but my experience with  
Cocoa is not wide enough to judge... Anyone else?



Regards,
Matt

P.S. The following two threads (from quite some time ago  
- is
Leopard REALLY that old?) seem to discuss something  
similar but

neither post was answered.
http://www.cocoabuilder.com/archive/message/cocoa/2007/1/6/176732
http://www.cocoabuilder.com/archive/message/cocoa/2007/12/28/195544

___

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: NSInvocationOperations and background Threads

2009-10-19 Thread John Love
Big thank you's to Ken Thomases, Nick Zitzmann and Quincey Morris  
(can't seem to find Quincey's email?)


Found my stupid mistake .. stupid because you guys individually  
mentioned it time and time again.  Namely, my -startBgThread begins in  
the main Thread.  So when I call -startOperation to add my Operation  
to the Queue (which starts up the background thread "sometime", and I  
really don't care when!), I should end -startBgThread.  Stop doing  
further stuff in the main Thread, right then-and-there.  Let the  
background Thread cancel the Operation if need-be, and if so, send a  
Notification back to the main Thread.


Anyway, my bad!

John

=

On Oct 18, 09, at 5:31 PM, Ken Thomases wrote:


On Oct 18, 2009, at 7:26 AM, John Love wrote:


Thanks for your prompt reply, I really appreciate it.


You're welcome.

I have revamped my code to have just one NSInvocationOperation  
whose selector contains the long for-loop.  [...] the long for-loop  
is within -doAllOperations.


OK, as far it goes.

It's my understanding from the docs and other Cocoa mailing list  
readers that when -addOperation: is called, a new background Thread  
is started up.


Well, you should stop trying to think about when exactly threads are  
started up (or how many there are, or how long they run, or exactly  
which one your operations run on, etc.).  All of that is  
implementation detail about which you shouldn't care.  The only  
important thing is that your (non-concurrent) operations will be run  
on some background thread that you are not responsible for setting  
up or managing.  (If you implement concurrent operations, you still  
aren't guaranteed anything about on which thread your -start method  
is invoked, but you take responsibility for the execution context  
after that.)



If that is true, then my long for-loop should be executing in the  
background Thread.  If I'm still on-track, then I have a problem in  
that I temporarily placed a NSLog() call within my -doCalculation,  
but nothing gets printed in my log.  So, for the moment I am lost.


Well, there's no way for me to provide additional insight without  
seeing your code.  If you suspect your code is blocked, you can  
sample your process (e.g. using Activity Monitor or the "sample"  
tool), which can show you where your threads are spending their  
time.  You can also put may more logging statements throughout your  
code to track its progress.  You can break into your program in the  
debugger and examine the various threads.  Etc.


Regards,
Ken



John Love
Touch the Future! Teach!



___

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


Binding Enabled property to NSArrayController selection

2009-10-19 Thread Matthew Lindfield Seager
As discussed previously on this list I am using the data source methods of
NSOutlineView to display the contents of two separate NSArrayControllers.
When an item is selected I use outlineViewSelectionDidChange: to manually
update the selection of the appropriate array controller and deselect all
items in the other array controller (i.e. I pass an empty index set to
setSelectionIndexes).

I would like a toolbar item to only be enabled when an item in the first
controller is selected so I tried binding it's Enabled property to
selectedobjec...@count and then canRemove. With either binding when the
selection changes I see the button flicker as though it is being disabled
and then reenabled but it never stays disabled.

I verified that empty selections are allowed. I am observing changes to the
outline view's selectionIndex and I can verify that even though
[[myArrayController selectedObjects] count] == 0, the item is not [staying?]
disabled. Using the "No Selection Placeholder" value doesn't make a
difference either.

Out of curiosity/desparation I even tried the inverse (enabling it when an
object from the other array controller is selected) and two different
complements (disabling it when an object from the other array controller is
selected AND disabling it when an abject from this controller is not
selected). No matter what I tried it would only flicker when I was expecting
it to stop being enabled. Am I missing something obvious?

Regards,
Matt

P.S. The following two threads (from quite some time ago - is
Leopard REALLY that old?) seem to discuss something similar but
neither post was answered.
http://www.cocoabuilder.com/archive/message/cocoa/2007/1/6/176732
http://www.cocoabuilder.com/archive/message/cocoa/2007/12/28/195544
___

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 NSURLProtocol crashes when using Garbage Collection

2009-10-19 Thread Keith Duncan
I wrote a simple NSURLProtocol subclass and started observing crashes  
in URL Loading code. I've extracted the crasher into a simple test  
project which loads an image from a URL with custom scheme which I  
handle every hundredth of a second.


When compiled with -fobjc-gc it reliably crashes; without it runs  
indefinitely however, there are leaked NSString instances allocated by  
NSURLConnection in +sendSynchronousRequest:… I've filed this as rdar://problem/7314551 
 for reference.


The test project can be found http://33software.com/files/CrashLoadingURL.zip 
 The bug is reproductable in the SpecialPictureProtocol sample code  
if compiled for garbage collection too.


Can anyone else verify this or point to a workaround?

Thanks,
Keith___

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: unsleep the display programatically?

2009-10-19 Thread Mark Ritchie

On 18-Oct-2009, at 6:36 PM, David LeBer wrote:

On 2009-10-18, at 9:30 PM, jon wrote:
Hi David,   that would not work,  because the display does need to  
sleep,  it would be working a long time,   and at nightbut  
needs to let people know that it is done.   i have an alarm go off,  
but people can know it has gone off  much better from a distance if  
suddenly the room is filled with light from the display waking up.

surely there is a method for this?  wouldn't there be?

I don't know, and haven't tried, but what happens if you call:
UpdateSystemActivity(UsrActivity);



I'm not sure if it's more correct to pass the OverallAct instead of  
UsrActivity since in this case there actually isn't any specific user  
activity  Does anyone know how the arguments are interpreted?


Given what you're trying to do, it would seem that UpdateSystemActivity 
() is going to do what you want however, I stand by what I said  
before, if the user has set their security settings to require a  
password then this call will cause the password screen to showup.   
After a short time of no password being entered, the screen will go  
back to sleep (At least it did for the test app that I wrote using  
10.6.1 to check this out).  That might be enough for you, I don't know.


Good luck with it!
M.
___

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