Re: Binding to currently selected object in a list?

2009-10-09 Thread Ken Thomases

On Oct 9, 2009, at 5:08 PM, A B wrote:

Is there a way to bind an ivar to the currently selected object of a  
list which is being represented in an NSTableView via bindings?   
Unfortunately there does not seem to be a "selectedObject" key  
(though there is one for "selectedObjects").  Binding to the  
controller's "selection" doesn't really work as I'd expect and even  
if it did, I'd only be getting back a proxy object - which negates  
the purpose for which I want to use it, which is to call methods on  
the object.  I had put in a hack which observes changes in  
selection, gets the selectedObjects list, checks for a count > 0,  
grabs the first and stuffs it into the ivar, etc. but not only does  
that feel really hackish, but doesn't always work.


This would seem to be a pretty simple thing to want to do (i.e.  
present a list of objects, do things to/with the currently selected  
object) but I'm at somewhat of a loss to understand what I'm doing  
wrong.


There's something just like this for NSPopUpButton.  You bind its  
'content' (and possibly 'contentObjects') binding to an indexed  
collection property of the controller.  Then you bind its  
'selectedObject' binding to a to-one property of the controller.  When  
the pop-up is first set up, it displays the selected object as  
originally set on the controller's to-one property.  Then, as the user  
selects items from the pop-up, the newly selected object is passed to  
the setter for that to-one property.


Strangely, there's nothing quite like that for NSArrayController.

I think the best you can do is to bind the array controller's  
selectionIndexes binding to an attribute of your coordinating  
controller.  (For illustration purposes, I'll call this attribute  
property "selectedWidgetIndexes".)  Then that coordinating controller  
can have a "selectedWidget" to-one property which is set up to reflect  
the object which is selected in the array controller.


One way is to make the selectedWidget property computed-on-the-fly  
based on the selection indexes:


+(NSSet*)keyPathsForValuesAffectingSelectedWidget
{
return [NSSet setWithObject:@"selectedWidgetIndexes"];
}

-(Widget*)selectedWidget
{
if (![self.selectedWidgetIndexes count])
return nil;
	return [self.widgets objectAtIndex:[self.selectedWidgetIndexes  
firstIndex]];

}

In this scenario, you don't actually have an ivar backing the  
selectedWidget property.  It's completely based off of the  
selectedWidgetIndexes property and the "widgets" to-many property.   
(The widgets property is assumed to be the indexed collection property  
that the array controller is representing.  The selectedWidgetIndexes  
property can be a typical @synthesized copy property.)


Another approach is to implement the setter for selectedWidgetIndexes  
and use that to update the selectedWidget property directly.  In this  
case, selectedWidget isn't computed on the fly, but is actually held  
(cached) in an ivar:


-(void)setSelectedWidgetIndexes(NSIndexSet*)newSelectedWidgetIndexes
{
if (![selectedWidgetIndexes isEqual:newSelectedWidgetIndexes])
{
[selectedWidgetIndexes release];
selectedWidgetIndexes = [newSelectedWidgetIndexes copy];
if ([selectedWidgetIndexes count])
			self.selectedWidget = [self.widgets objectAtIndex: 
[selectedWidgetIndexes firstIndex]];

else
self.selectedWidget = nil;
}
}

You don't need +keyPathsForValuesAffectingSelectedWidget since you're  
going through the setter for the selectedWidget property.  The  
selectedWidget property can be a typical @synthesized retain property.


By the way, notice that all of this discussion is in terms of the  
array controller and the coordinating controller.  No mention of the  
table view because it's not directly relevant.  The MVC design pattern  
in action.  ;)


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: How to allocate and delegate; or how to keep GC and the static analyzer happy

2009-10-09 Thread Jens Alfke


On Oct 8, 2009, at 7:33 PM, Glen Low wrote:

1.	The code is not GC friendly as between the end of start and the  
beginning of finishWithSomething, there are no references to the  
object, so it may be collected.


There must be references to it; otherwise how would that object's  
methods get called later on? Either it's a delegate of another object  
(an NSURLConnection or NSTimer or whatever) or it starts a new thread  
to run one of its methods. Either way, there are references to the  
object that keep it alive.


2.	The static analyzer in Xcode 3.2 doesn't like the construction,  
thinking that the object is leaking from the start method.


I'm not sure what to do about that. Casting the result to (void) might  
help, to explicitly state that you don't want to use the result. (Does  
the static analyzer even work with GC? Stating that the object is  
"leaking" only makes sense in a ref-counted environment.)


—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: Instance variables: access directly vs. getter / setter

2009-10-09 Thread Jens Alfke


On Oct 9, 2009, at 2:30 AM, Graham Cox wrote:

In init and dealloc, it is usual & recommended to access the ivar  
directly - not because self isn't defined (it is), but because at  
those times you are usually only concerned with setting the ivar's  
initial value (possibly to an object), or releasing it, without side  
effects.


Specifically, calling a setter in an -init method can cause trouble if  
a subclass has overridden that setter. The base class's -init method  
calls the setter, which invokes a method in the subclass, which  
runs ... but the subclass's own initializer hasn't run yet. So if the  
overridden setter depends on something that was initialized in the  
subclass's initializer, things break.



On Oct 9, 2009, at 2:01 AM, Matthias Arndt wrote:

2.) ... are there significant performance issues or other reasons to  
prefer the direct reference to (or direct assignment of) instance  
variables? At least the code of the setters / getters might impact  
the performance, but I'd sacrifice it for the sake of a consistent  
code.


This is kind of a religious issue. An individual Obj-C message-send  
isn't noticeably expensive, although it's still something like ten  
times the cost of a C++ virtual function call. So in most cases, using  
accessors instead of instance variables won't cause a problem. But  
what worries me is that this is the type of thing that creates tiny  
slowdowns in multiple places all over the code, and those add up. It's  
"death by a thousand cuts". To some extent this will show up in  
profiling as time spent in objc_msgsend; but it has other overhead  
that isn't centralized and won't show up in a profile. If you access a  
variable directly, the compiler can optimize that at the machine-code  
level and make the code more efficient than if there's a function-call  
required.


In my code I tend to use direct access to instance variables of self,  
except when the accessors are expected to be override-able. But other  
people make different choices.


—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: Are these Apple or 3rd party classes?

2009-10-09 Thread Jens Alfke


On Oct 9, 2009, at 11:05 AM, Philip White wrote:

The crash report is actually from my own crash reporter, not from  
Apple's and it doesn't report what libraries are loaded. I slapped  
together my own reporter because few users think to send the info  
from Apple's crash reporter to the developer and just send it off to  
Apple. My reporter does specify the system version however: 10.6.1,  
in this case.


There are a couple of open-source crash-report libraries (like  
UKCrashReporter) that check on launch for a crash log file and send  
that to the developer. That file includes all the stuff that's sent to  
Apple, including the paths of the libraries.


The drawback is that the crash won't be reported until the next time  
the user launches the app; but I think this is a much cleaner solution  
than attempting to hack your own process to detect when it gets a  
fatal exception.


—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: How to ease the burden on the Garbage Collector?

2009-10-09 Thread Jens Alfke


On Oct 9, 2009, at 7:23 AM, Gabriel Zachmann wrote:


http://zach.in.tu-clausthal.de/tmp/malloc1.png
http://zach.in.tu-clausthal.de/tmp/malloc2.png
http://zach.in.tu-clausthal.de/tmp/malloc3.png


Those are showing all malloc operations. Most of those are not garbage- 
collected, so they don't affect GC time. (I'm not sure exactly what  
symbol to trace if you want to watch just GC allocations.)


Are you sure you aren't just seeing the GC thread sitting and  
waiting for something to do?

THat would mean that the GC thread does busy waiting, wouldn't it?



No, it's blocked on a semaphore. But it still shows up in samples or  
backtraces (in mach_message_trap, usually.)



Here are the top lines of the call tree that I see in Shark.
It seems to me that they all belong to the same thread, the GC thread.


Yup, that shows about 20% (of a core) being spent in GC.

—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: Hide an Item on Desktop

2009-10-09 Thread Jens Alfke


On Oct 9, 2009, at 10:37 AM, Maggie Zhang wrote:

What I want is to hide existing mounted volumes whose names I don't  
want to change.


Setting the HFS "invisible" bit is the way to go, then. I've done this  
before. You can do this from the command line:

SetFile -a V /Volumes/HideMe
Doing it programmatically requires using the HFS metadata APIs in  
.


I am not sure how well this will work with volumes that are not HFS- 
formatted, e.g. FAT-formatted flash-memory sticks. But it should work  
with regular disk images, which are HFS+.


—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: Document architecture - stop it from opening untitled documents?

2009-10-09 Thread aaron smith
ok. nevermind. I got it.

You have to implement a method from NSApplicationDelegate:

- (BOOL) applicationOpenUntitledFile:(NSApplication *) theApplication {
return true;
}

On Fri, Oct 9, 2009 at 6:52 PM, aaron smith
 wrote:
> Hey All, quick question.
>
> I'm trying to figure out how to stop untitled documents from opening
> when the application first runs. I've been looking on google, and
> tried some different combinations of method overrides on
> NSDocumentController. I figured out how to stop the untitled doc from
> opening, by overriding "- (id)makeUntitledDocumentOfType:(NSString
> *)typeName error:(NSError **)outError", but the problem is that it's
> required to give it an NSError, which is fine. But the the application
> automatically opens up an alert error.
>
> if anyone has a quick pointer in the right direction that would be awesome.
>
> Thanks.
>
___

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

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

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

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


Document architecture - stop it from opening untitled documents?

2009-10-09 Thread aaron smith
Hey All, quick question.

I'm trying to figure out how to stop untitled documents from opening
when the application first runs. I've been looking on google, and
tried some different combinations of method overrides on
NSDocumentController. I figured out how to stop the untitled doc from
opening, by overriding "- (id)makeUntitledDocumentOfType:(NSString
*)typeName error:(NSError **)outError", but the problem is that it's
required to give it an NSError, which is fine. But the the application
automatically opens up an alert error.

if anyone has a quick pointer in the right direction that would be awesome.

Thanks.
___

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

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

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

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


using QLPreviewPanel and supporting 10.5

2009-10-09 Thread Mitchell Livingston

Hello,

I want to support Quick Look in my application, but still support  
10.5. I'm using the 10.6 SDK and 10.5 deployment target. Launching on  
10.5 gives:


Dyld Error Message:
Symbol not found: _OBJC_CLASS_$_QLPreviewPanel
Referenced from: /Users/robertvehse/Desktop/Transmission.app/Contents/ 
MacOS/Transmission
xpected in: /System/Library/Frameworks/Quartz.framework/Versions/A/ 
Quartz


Obviously this is from using objects only available in 10.6. I won't  
be using the QL classes on 10.5. Is there a way around this?


Thanks,
Mitch
___

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: Hide an Item on Desktop

2009-10-09 Thread Paul M

This will be the POSIX spec, not an Apple one.
OSX has been POSIX compliant since Leopard, accoring to this page:
http://developer.apple.com/leopard/overview/osfoundations.html


paulm


On 10/10/2009, at 8:23 AM, Michael Domino wrote:


M Pulis wrote:


Unless you can absolutely prove that your file fits Apple specs for a
legitimately installed "dot" system file that is not the best practice
to make a non-system file invisible. Seek an alternative. There are 
temp

directories and other legit facilities.


Can someone point out the “Apple specs”? I searched through File System
Overview and Human Interface Guidelines and could not find any Apple 
spec

about this, except for “._” files.

--
Michael Domino
michael.dom...@identityfinder.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: Binding to values which aren't there

2009-10-09 Thread A B
 
On Friday, October 09, 2009, at 04:21PM, "mmalc Crawford"  
wrote:
>
>On Oct 9, 2009, at 3:17 PM, A B wrote:
>
>> I have a situation in which I would like a column in a table that is bound 
>> to an NSArrayController to display information that isn't actually in the 
>> objects being represented, but is instead the result of an operation that 
>> involves a bit of data in that row's object and a separate bit of data in 
>> another object.
>> 
>Just implement the standard table view data source method for that column 
>(don't establish a binding).
>

I had feared that that was going to be the answer.  It makes sense, and while I 
was really enjoying cutting out datasource code from my document controller, I 
can live with its return. :)  

Thanks...
___

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

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

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

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


Re: Binding to values which aren't there

2009-10-09 Thread mmalc Crawford

On Oct 9, 2009, at 3:17 PM, A B wrote:

> I have a situation in which I would like a column in a table that is bound to 
> an NSArrayController to display information that isn't actually in the 
> objects being represented, but is instead the result of an operation that 
> involves a bit of data in that row's object and a separate bit of data in 
> another object.
> 
Just implement the standard table view data source method for that column 
(don't establish a binding).

mmalc

___

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: Updating application info plist

2009-10-09 Thread Kyle Sluder
On Fri, Oct 9, 2009 at 4:05 PM, Rob Keniger  wrote:
> To do this, surely they must be rewriting the LSUIElement key in the app's 
> own Info.plist while the app is running, right? Or is there another way to do 
> this?

I don't know how LittleSnapper is implemented, but you can use
TransformProcessType to bring yourself from LSUIElement-ness into
Dock-icon-having, full blown app status.  I imagine LittleSnapper
checks user defaults at launch and calls this function if
necessary—this would be the only way to implement this feature for
non-admin users who can't write to the app bundle.
http://developer.apple.com/mac/library/documentation/Carbon/Reference/Process_Manager/Reference/reference.html#//apple_ref/c/func/TransformProcessType

(Also, don't forget about code signing.)

--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: Updating application info plist

2009-10-09 Thread Rob Keniger

On 10/10/2009, at 1:19 AM, Kyle Sluder wrote:

> Sorry, you cannot do this. Changing an app's Info.plist is not supported, 
> especially while the app is running.


I've noticed that some apps (LittleSnapper is the first example I can think 
of), have a "hide the app icon in the dock after relaunch" option. 

To do this, surely they must be rewriting the LSUIElement key in the app's own 
Info.plist while the app is running, right? Or is there another way to do this?

--
Rob Keniger



___

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 to values which aren't there

2009-10-09 Thread A B
I have a situation in which I would like a column in a table that is bound to 
an NSArrayController to display information that isn't actually in the objects 
being represented, but is instead the result of an operation that involves a 
bit of data in that row's object and a separate bit of data in another object.

A simplified example can be though of like this:  An instance of NSDocument has 
an array of People objects and each person object has an array of Note objects. 
 The UI is laid out such that there is a list of people in an NSTableView.  
Selecting a person in that list causes another list to be populated with the 
notes associated with that person.  Easy, right?  Well, actually yes - it is... 
up to a point.

The problem is that each Note object has a date in it that is used to determine 
the person's age at the time the note was composed. ) The person's birthday is 
stored in the Person object.)  For various reasons I'd rather not store the age 
value in the note record, but would rather derive it at view time.  My first 
thought was that a value transformer would do the trick, but unfortunately 
NSValueTransformers are global and not document-specific, so there's no ready 
way to have the transformer know what the currently selected person of the 
appropriate document might be.  Long-held habits regarding best practices 
regarding relational integrity are making me reluctant to stick a 
"parentPerson" ivar in each Note object, otherwise the solution would be 
simple: Just create another property which has code in the getter that calls 
back to the parent object (the structure of which would then have to be known 
to the Note object) for the birthday, does the necessary math and then returns 
the result.

So my question boils down to this: Is there a way I can intercept the 
tableview's call to the Note object for the faked-out "fauxValue" column so 
that I can do the math and return it from a place where scope is less of an 
issue?  Am I even thinking in the right direction here or have I over-thought 
it to the point where I'm now making it harder than it needs to be?
___

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 to currently selected object in a list?

2009-10-09 Thread A B
Is there a way to bind an ivar to the currently selected object of a list which 
is being represented in an NSTableView via bindings?  Unfortunately there does 
not seem to be a "selectedObject" key (though there is one for 
"selectedObjects").  Binding to the controller's "selection" doesn't really 
work as I'd expect and even if it did, I'd only be getting back a proxy object 
- which negates the purpose for which I want to use it, which is to call 
methods on the object.  I had put in a hack which observes changes in 
selection, gets the selectedObjects list, checks for a count > 0, grabs the 
first and stuffs it into the ivar, etc. but not only does that feel really 
hackish, but doesn't always work. 

This would seem to be a pretty simple thing to want to do (i.e. present a list 
of objects, do things to/with the currently selected object) but I'm at 
somewhat of a loss to understand what I'm doing wrong.   
___

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

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

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

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


Re: Detecting if application is running as Finder

2009-10-09 Thread Greg Guerin

Mike Joseph wrote:

I know that launchd pays special attention to the application it  
considers

to be Finder since it will restart it when it exits, etc.  So clearly
launchd knows the PID/PSN of "Finder".  Surely there's some way to  
ask for

it, but I can't figure out how.



Since launchd is controlled by launchctl, my first guess would be to  
read the man page for launchctl.


  -- 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: How to set checkbox state in TableView columnheader

2009-10-09 Thread Jerry Krinock


On 2009 Oct 09, at 08:24, Corbin Dunn wrote:


What you are doing will not work.

You have to create an NSTableHeaderCell subclass. Even then, you may  
have to subclass NSTableHeaderView to get it to work like a button  
with a button in it (header's are essentially buttons).


Yes, I found that to be the case

Ah, I take back my congratulations Zhang.  When you said you had the  
button in there I assumed that you had done the hard parts.


Indeed, as Corbin implies, getting custom behavior in an table header  
ain't easy.  I'm attaching a couple of classes which I probably worked  
on for quite some time, to get similar behavior, a popup menu into a  
table header.




SSYPopUpTableHeaderCell.h
Description: Binary data





SSYPopUpTableHeaderCell.m
Description: Binary data





SSYTableHeaderView.h
Description: Binary data





SSYTableHeaderView.m
Description: Binary data





Possibly you can use the same design pattern.  Note the little tricks  
and fudges that were needed.  Also the comments contain references to  
others' work which I learned from.  Have fun!


___

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: Hide an Item on Desktop

2009-10-09 Thread Michael Domino
M Pulis wrote:

> Unless you can absolutely prove that your file fits Apple specs for a
> legitimately installed "dot" system file that is not the best practice
> to make a non-system file invisible. Seek an alternative. There are temp
> directories and other legit facilities.

Can someone point out the ³Apple specs²? I searched through File System
Overview and Human Interface Guidelines and could not find any Apple spec
about this, except for ³._² files.

-- 
Michael Domino
michael.dom...@identityfinder.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


Detecting if application is running as Finder

2009-10-09 Thread Mike Joseph
Hi folks,

I am writing an application the replaces the Finder (by writing to
com.apple.loginwindow/Finder).  That bit is working fine and my application
starts up normally as expected.  However, it would be very useful if I could
enable different behavior in my application depending on whether it is
started as Finder or just launched by the user.
Does anyone know of any mechanism for an application to detect if it is
running as Finder?

I know that launchd pays special attention to the application it considers
to be Finder since it will restart it when it exits, etc.  So clearly
launchd knows the PID/PSN of "Finder".  Surely there's some way to ask for
it, but I can't figure out how.

Thanks.

-MJ
___

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: Undo architecture advice needed

2009-10-09 Thread David Hirsch
Thanks.  For the second time on this list, I have forgotten that  
bindings work through setters/getters, rather than directly on the  
object's variables.

-Dave

On Oct 9, 2009, at 11:07 AM, Kai Brüning wrote:


Hello Dave,

undo/redo is a model operation and should be handled inside the  
model. That is, I wouldn’t pick your suggestions 1) or 2), because  
they both do not observe (in a general case, not KVO) the model to  
generate undo information.


If I understand you correctly, the phase objects are your model. If  
this is correct, the changes do go through your code: when they  
arrive at the phase object (typically in a setter). And this is the  
place to record the information needed for undoing the change.


Hope this makes any sense
Kai

On 9.10.2009, at 19:53, David Hirsch wrote:


Hello list-
	I have a document-based application.  Each document has a NSArray  
of phases.  Phases is an NSArrayController created in IB and bound  
to FIle's Owner.phases.  When a given phase is selected in the  
NSTableView (bound to phase controller), then its properties show  
up in a set of text fields, check boxes, color wells, popup menus,  
etc., through bindings similar to "Phases.selection.size".


	Here is my question:  what is the best way to implement undo/redo  
here?  I'd like to enable undo of changes to the settings (like  
size) that the user makes in the text fields, but they don't go  
through my code - they are just bound directly to the array.  (Note  
that I do understand that the field editor has its own undo that  
operates during text editing; that is not what I'm talking about.)   
Here are some potential avenues I'm considering:
	1) Make the document the delegate for all these fields.  Then I  
can get a controlTextDidChange: notification, figure out the  
current phase, get the object and the value, and post an undo.   
However, this requires me to implement a whole bunch of setters in  
my NSDocument subclass that duplicate setters in my phases class,  
which seems inelegant, to say the least.  Also, I don't see an  
obvious way to do something similar for, say checkboxes.
	2) Try to set up KVO (from my document subclass, I guess?) on the  
NSArrayController to watch for changes, and then register undo  
operations in the observing method.  I would have to be careful not  
to get into a loop when re-doing the undo operations, though, since  
I would observe any changes I made during undo.
	3) I'm sure there are other ways, but I'm not smart enough to  
think of them.


Thanks in advance,
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/lists%40kai-bruening.de

This email sent to li...@kai-bruening.de






Dave Hirsch
Associate Professor
Department of Geology
Western Washington University
persistent email: dhir...@mac.com
http://www.davehirsch.com
voice: (360) 389-3583
aim: dhir...@mac.com
vCard: http://almandine.geol.wwu.edu/~dave/personal/DaveHirsch.vcf




___

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: Undo architecture advice needed

2009-10-09 Thread Kai Brüning

Hello Dave,

undo/redo is a model operation and should be handled inside the model.  
That is, I wouldn’t pick your suggestions 1) or 2), because they both  
do not observe (in a general case, not KVO) the model to generate undo  
information.


If I understand you correctly, the phase objects are your model. If  
this is correct, the changes do go through your code: when they arrive  
at the phase object (typically in a setter). And this is the place to  
record the information needed for undoing the change.


Hope this makes any sense
Kai

On 9.10.2009, at 19:53, David Hirsch wrote:


Hello list-
	I have a document-based application.  Each document has a NSArray  
of phases.  Phases is an NSArrayController created in IB and bound  
to FIle's Owner.phases.  When a given phase is selected in the  
NSTableView (bound to phase controller), then its properties show up  
in a set of text fields, check boxes, color wells, popup menus,  
etc., through bindings similar to "Phases.selection.size".


	Here is my question:  what is the best way to implement undo/redo  
here?  I'd like to enable undo of changes to the settings (like  
size) that the user makes in the text fields, but they don't go  
through my code - they are just bound directly to the array.  (Note  
that I do understand that the field editor has its own undo that  
operates during text editing; that is not what I'm talking about.)   
Here are some potential avenues I'm considering:
	1) Make the document the delegate for all these fields.  Then I can  
get a controlTextDidChange: notification, figure out the current  
phase, get the object and the value, and post an undo.  However,  
this requires me to implement a whole bunch of setters in my  
NSDocument subclass that duplicate setters in my phases class, which  
seems inelegant, to say the least.  Also, I don't see an obvious way  
to do something similar for, say checkboxes.
	2) Try to set up KVO (from my document subclass, I guess?) on the  
NSArrayController to watch for changes, and then register undo  
operations in the observing method.  I would have to be careful not  
to get into a loop when re-doing the undo operations, though, since  
I would observe any changes I made during undo.
	3) I'm sure there are other ways, but I'm not smart enough to think  
of them.


Thanks in advance,
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/lists%40kai-bruening.de

This email sent to li...@kai-bruening.de


___

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: Are these Apple or 3rd party classes?

2009-10-09 Thread Philip White


On Oct 9, 2009, at 12:51 PM, David Duncan wrote:


On Oct 9, 2009, at 6:48 AM, Philip White wrote:

I don't really know a lot about the inner workings of the print  
system, but would anyone be able to tell me if this looks like it  
is third party stuff (printer drivers?) or Apple stuff?



The bottom of the crash report should tell you the full path to all  
libraries loaded, you can use that to determine where a particular  
library is. It would probably also be useful to know what version of  
Mac OS X this is occurring on.

--
David Duncan
Apple DTS Animation and Printing



The crash report is actually from my own crash reporter, not from  
Apple's and it doesn't report what libraries are loaded. I slapped  
together my own reporter because few users think to send the info from  
Apple's crash reporter to the developer and just send it off to Apple.  
My reporter does specify the system version however: 10.6.1, in this  
case.


Thank you for the reply,
  Philip White
___

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


Undo architecture advice needed

2009-10-09 Thread David Hirsch

Hello list-
	I have a document-based application.  Each document has a NSArray of  
phases.  Phases is an NSArrayController created in IB and bound to  
FIle's Owner.phases.  When a given phase is selected in the  
NSTableView (bound to phase controller), then its properties show up  
in a set of text fields, check boxes, color wells, popup menus, etc.,  
through bindings similar to "Phases.selection.size".


	Here is my question:  what is the best way to implement undo/redo  
here?  I'd like to enable undo of changes to the settings (like size)  
that the user makes in the text fields, but they don't go through my  
code - they are just bound directly to the array.  (Note that I do  
understand that the field editor has its own undo that operates during  
text editing; that is not what I'm talking about.)  Here are some  
potential avenues I'm considering:
	1) Make the document the delegate for all these fields.  Then I can  
get a controlTextDidChange: notification, figure out the current  
phase, get the object and the value, and post an undo.  However, this  
requires me to implement a whole bunch of setters in my NSDocument  
subclass that duplicate setters in my phases class, which seems  
inelegant, to say the least.  Also, I don't see an obvious way to do  
something similar for, say checkboxes.
	2) Try to set up KVO (from my document subclass, I guess?) on the  
NSArrayController to watch for changes, and then register undo  
operations in the observing method.  I would have to be careful not to  
get into a loop when re-doing the undo operations, though, since I  
would observe any changes I made during undo.
	3) I'm sure there are other ways, but I'm not smart enough to think  
of them.


Thanks in advance,
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: Hide an Item on Desktop

2009-10-09 Thread Maggie Zhang
Thanks Dave. I will give that a try.
MZ

On Fri, Oct 9, 2009 at 10:49 AM, Dave Carrigan  wrote:

>
> On Oct 9, 2009, at 10:37 AM, Maggie Zhang wrote:
>
>  What I want is to hide existing mounted volumes whose names I don't want
>> to
>> change. Say, I create 20 disk images and mount them all on the desktop but
>> I
>> want them to be selectively invisible from the Desktop and can still be
>> accessible (e.g. whose contents can be read or modified.)
>>
>
> If you use the nowbrowse option in either mount or hdiutil, it hides them
> from the finder. It also hides them from things such as open or save
> dialogs, but you can still access them with filesystem APIs.
>
> You have to plan to do this before the volume is mounted. To my knowledge,
> there is no way to do this after a volume has been mounted.
>
>
> --
> Dave Carrigan
> d...@rudedog.org
> Seattle, WA, USA
>
>
___

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: Are these Apple or 3rd party classes?

2009-10-09 Thread David Duncan

On Oct 9, 2009, at 6:48 AM, Philip White wrote:

I don't really know a lot about the inner workings of the print  
system, but would anyone be able to tell me if this looks like it is  
third party stuff (printer drivers?) or Apple stuff?



The bottom of the crash report should tell you the full path to all  
libraries loaded, you can use that to determine where a particular  
library is. It would probably also be useful to know what version of  
Mac OS X this is occurring on.

--
David Duncan
Apple DTS Animation and Printing

___

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: Hide an Item on Desktop

2009-10-09 Thread Dave Carrigan


On Oct 9, 2009, at 10:37 AM, Maggie Zhang wrote:

What I want is to hide existing mounted volumes whose names I don't  
want to
change. Say, I create 20 disk images and mount them all on the  
desktop but I
want them to be selectively invisible from the Desktop and can still  
be

accessible (e.g. whose contents can be read or modified.)


If you use the nowbrowse option in either mount or hdiutil, it hides  
them from the finder. It also hides them from things such as open or  
save dialogs, but you can still access them with filesystem APIs.


You have to plan to do this before the volume is mounted. To my  
knowledge, there is no way to do this after a volume has been mounted.


--
Dave Carrigan
d...@rudedog.org
Seattle, WA, USA

___

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: dealloc and finalize

2009-10-09 Thread Bill Bumgarner

On Oct 9, 2009, at 10:31 AM, Gabriel Zachmann wrote:

> If my screensaver must be able to run both in the reference-counted and in 
> the garbage collecting environment,
> should I then implement both the dealloc and the finalize method?

That is correct.

b.bum

___

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: dealloc and finalize

2009-10-09 Thread Nick Zitzmann


On Oct 9, 2009, at 11:31 AM, Gabriel Zachmann wrote:

If my screensaver must be able to run both in the reference-counted  
and in the garbage collecting environment,

should I then implement both the dealloc and the finalize method?


If you allocated objects in your class that you need to deallocate  
before going bye-bye, or you registered the class for notifications,  
then yes, you must implement a -dealloc method unless your code is GC- 
only. You only need to implement -finalize if you allocated memory  
outside the garbage collector (for example, using malloc()) and need  
to free it before the object goes away. Check the documentation for  
more information.


Nick Zitzmann


___

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: Hide an Item on Desktop

2009-10-09 Thread Maggie Zhang
Thanks all of you for your answers. I apologize for the unclear question in
the beginning. Let me try to explain it again.


What I want is to hide existing mounted volumes whose names I don't want to
change. Say, I create 20 disk images and mount them all on the desktop but I
want them to be selectively invisible from the Desktop and can still be
accessible (e.g. whose contents can be read or modified.) I also change the
permissions of the mounted items so that they are only accessible to the
owner or root. For example, I may want to copy a file to all of them at the
same time or delete a file from only one of them. In some cases, I don't
need or want to see them on the desktop at all. I wonder if there is a way
to hide those volumes without changing their names. Hopefully this makes the
question a bit more understandable.

MZ


On Fri, Oct 9, 2009 at 7:41 AM, Dave Camp  wrote:

> On Oct 9, 2009, at 6:50 AM, David Patrick Henderson wrote:
>
>  Depends on one's definition of "supported". One cannot rename a file or
>> folder in the Finder directly with a leading '.', or a ':'. Attempting to do
>> so will cause warning dialogs for all these cases (and perhaps of which I am
>> unaware). So one can certainly claim that the Finder does not support these
>> cases; however, the Finder will handle these files if created through some
>> other medium such as a terminal program.
>>
>
> It has nothing to do with the Finder "supporting" it. Obviously the Finder
> does not display files starting with dots because it was designed to do so.
> It purposefully hides files that the average user does not need to see.
>
> The Finder won't let you pre-pend a dot to the file because it purposefully
> does not show files that start with a dot. If it let you add the dot, the
> file would suddenly be hidden and a normal user (i.e. someone without
> Terminal knowledge) would have no way of getting it back. It's a safety
> feature.
>
> 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/maggiehaha%40gmail.com
>
> This email sent to maggieh...@gmail.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: Core-data binding to all entities

2009-10-09 Thread Martin Hewitson
In the end I was able to solve this by making an NSArrayController  
bound to all entities of the type Note, then set the Filter Predicate  
of that array controller depending on the switch state. So I have:


- (IBAction)allCategoriesSelected:(id)sender
{
[singleCategoryButton setState:0];
[allCategoriesButton setState:1];

[allNotesArrayController setFilterPredicate:nil];
}

- (IBAction)singleCategorySelected:(id)sender
{
[allCategoriesButton setState:0];
[singleCategoryButton setState:1];

NSTreeNode *node = [[treeController selectedNodes] firstObject];
	NSPredicate *pred = [NSPredicate predicateWithFormat:@"category.name  
== %@", [[node representedObject] valueForKey:@"name"]];

[allNotesArrayController setFilterPredicate:pred];
}

This works fine, though I wonder what happens in terms of performance  
if the number of Note entities gets very large.


Kind regards,

Martin


On Oct 2, 2009, at 4:37 PM, Stamenkovic Florijan wrote:


Martin,

I am actually working on an identical app (as far as your  
description goes), as a way of learning CoreData, but also to have  
something to organize my todos and reminders in...


I am dealing with the same problem you describe below, though I took  
a slightly different approach. I bind the contentSet to the selected  
Group's notes relationship, but when I unbind it I do not manually  
fetch all the notes like you do. Instead, my notesController is set  
to fetch them itself, so I just need to invoke the fetch method.  
However, for some reason the "canRemove" property of the notes  
controller turns to NO after I unbind the contentSet, so I also can  
not delete notes... What is weird is that this only happens after I  
have had the notesController bound over the groupsController during  
a run of the app. It seems that switching the content like this is  
not well supported, and tends to confuse the controller. In that  
sense I will change my code to perform filtering of notes based on  
the selection in the outline of groups, as opposed to using this  
approach.
There is another problem with this approach... For more info see a  
recent post of mine on the cocoa dev list titled: Dynamic  
NSArrayContent changing [was: NSTableColumn value binding]


If you like, we can exchange our apps offlist, it might be  
interesting to compare features etc.


Best regards,

F

-(void)setViewingAllNotes:(NSNumber*)newValue
{
// assign the new values
id oldValue = viewingAllNotes;
viewingAllNotes = [newValue copy];
[oldValue release];

// react appropriately

if([viewingAllNotes boolValue]){

		// cache and then remove the current selection of the groups  
controller
		lastSelectedGroupsIndexPaths = [[groupsController  
selectionIndexPaths] retain];

[groupsController setSelectionIndexPaths:nil];

// re-direct the bindings of the notesController
[notesController unbind:@"contentSet"];
[notesController fetch:self];

}else{

// re-direct the bindings of the notesController
[notesController bind:@"contentSet"
 toObject:groupsController
  withKeyPath:@"selection.items"
	  options:[NSDictionary dictionaryWithObject:[NSNumber  
numberWithBool:YES]


  
forKey:NSDeletesObjectsOnRemoveBindingsOption]];

		// restore and then release the last selection of the groups  
controller
		[groupsController  
setSelectionIndexPaths:lastSelectedGroupsIndexPaths];

[lastSelectedGroupsIndexPaths release];
lastSelectedGroupsIndexPaths = nil;
}
}


On Oct 02, 2009, at 02:39, Martin Hewitson wrote:


Dear list,

I have a simple core-data model with an entity 'Category' and an  
entity 'Note'. The 'Category' entity has a to-many relationship  
'notes' to entity type 'Note'.


The categories are displayed in an outline view via a tree  
controller. There is also a table which displays the contents of an  
array controller (NotesArrayController) - this is supposed to show  
a subset of the notes.


I have a switch on the UI which is meant to let the user choose  
whether to display all notes in the currently selected category, or  
all notes from all categories. So I want to modify the content of  
NotesArrayController depending on the state of the switch.


So far I tried doing this programatically with bindings using the  
two methods below (actually the switching mechanism is just two  
buttons).  This works as far as displaying the correct content to  
the user, but when it comes to deleting objects when in 'all  
categories' mode, it doesn't work p

dealloc and finalize

2009-10-09 Thread Gabriel Zachmann
If my screensaver must be able to run both in the reference-counted  
and in the garbage collecting environment,

should I then implement both the dealloc and the finalize method?

Regards,
Gabriel.




smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

Re: debugging cursors

2009-10-09 Thread David M. Cotter

yes i have been using remote debugging the whole time.

On Oct 9, 2009, at 10:00 AM, Sean McBride wrote:


On 10/7/09 5:50 PM, David M. Cotter said:

how do i tell the OS to stop setting my cursor to the beachball  
whilst

stopped in the debugger?  i'm debugging my cursor setting stuff and
that makes it impossible


Debugging such things is often easier with two machines.  This is  
dated,

but a good starting point:



___

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: debugging cursors

2009-10-09 Thread Sean McBride
On 10/7/09 5:50 PM, David M. Cotter said:

>how do i tell the OS to stop setting my cursor to the beachball whilst
>stopped in the debugger?  i'm debugging my cursor setting stuff and
>that makes it impossible

Debugging such things is often easier with two machines.  This is dated,
but a good starting point:


--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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

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

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


Re: Are these Apple or 3rd party classes? (printing error)

2009-10-09 Thread Philip White

Ok, I guess I wrote these lines too hastily:

On Oct 9, 2009, at 11:02 AM, Philip White wrote:

That is the last my code hears of it, below is the stack trace from  
that point to where the exception is thrown, it doesn't look like my  
printing view ever gets sent a -drawRect: or any other message.


Of course I don't know from the stack trace that my code isn't called  
again. It probably is, but the exception isn't generated from within  
my code. Sorry,


Philip
___

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


NSWindowCollectionBehaviorMoveToActiveSpace has failed me for the last time

2009-10-09 Thread Chilton Webb

Hi,

I'm trying to wrap my head around what I thought was a simple concept.  
I created a simple test app to test this.


The source to it can be found here...
http://www.conjurebunny.com/SpaceTest.zip

All it does is...
1) Sets the window collection behavior to  
NSWindowCollectionBehaviorMoveToActiveSpace

2) Creates a timer, and starts counting down.
3) Activates the window with orderFront:


To test this, load the project, and run it. Then Click the button, and  
switch to a different space.


I expected it to move the window onto that space when the timer  
reaches zero. Instead, the space switches.



According to the docs, "Making the window active does not cause a  
space switch; the window switches to the active space"
According to my simple demo, making the window active causes a space  
switch, and the window does not switch to the active space.



Am I reading that wrong???

Thank you!
-Chilton
___

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: Changing the edit behaviour of a cell

2009-10-09 Thread Corbin Dunn
> ..
> 
> What is the correct way to set up such behaviour?
> 


There's a demo for that.

http://developer.apple.com/mac/library/samplecode/AnimatedTableView/index.html

corbin


___

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

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

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

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


Re: Are these Apple or 3rd party classes? (printing error)

2009-10-09 Thread Philip White


On Oct 9, 2009, at 10:27 AM, Steve Christensen wrote:

A quick Google search came up with a reference to EPIJDataManager  
that somehow relates to Epson printers. I couldn't find any other  
info than that.




Oops, my Yahoo search came up with nothing. I guess there is a reason  
Google is more popular :-).


More on topic, I am wondering how I can determine where the problem  
lies. I kind of suspect the Epson software and here is why, my  
printing works like this:
One of my views receives a -print: message sent by the normal UI  
means. It creates an offscreen view with the formatted content and  
sends the print: message to it. That is the last my code hears of it,  
below is the stack trace from that point to where the exception is  
thrown, it doesn't look like my printing view ever gets sent a - 
drawRect: or any other message.



Thanks!

9   libobjc.A.dylib 0x94eb6f49  
objc_exception_throw + 56
10  EPIJDataManager_Core_L  0x0d21fa4d - 
[CERDMPCAttributeDataType(AccessorMethod)  
valueStringForKeyword:atIndex:] + 437
11  EPIJDataManager_Core_L  0x0d21f891 - 
[CERDMPCAttributeDataType(AccessorMethod) valueStringForKeyword:] + 49
12  EPIJDataManager_Core_L  0x0d226692 -[CERDMPCPPDFileType 
(PPDFileTypeMethod) defaultInkSet:] + 240
13  EPIJDataManager_Core_L  0x0d24a16c -[CERDMPCDataManager 
(AccessorMethod) inkSetNumber] + 122
14  EPIJDataManager_Core_L  0x0d23d421 -[CERDMPCDataManager 
(DataManagerSetupMethod) setupMachinePluginType] + 875
15  EPIJDataManager_Core_L  0x0d2385ec -[CERDMPCDataManager 
(DataManagerMethod) setPPDFileType:dataManagerSystem:] + 1226
16  EPIJDataManager_Core_L  0x0d298d30 - 
[CERDMPCPDEInitialize(PDEInitializeMethod)  
initializeDataManagerSystemWithPPDFileType:] + 908
17  EPIJDataManager_Core_L  0x0d29884b - 
[CERDMPCPDEInitialize(EventHandlerMethod) onOperation] + 819
18  EPIJDataManager_Core_L  0x0d27878f -[CERDMPCPDESystem 
(EventHandlerMethod) onDataManagerPDEInitialize:param:isReleaseData:]  
+ 795
19  EPIJDataManager_Core_L  0x0d2781d2 -[CERDMPCPDESystem 
(EventHandlerMethod) onDataManagerMessage:data:param:] + 294
20  EPIJDataManager_Core_L  0x0d201bca  
_Z28SendMessageToDataManagerCoremPvS_ + 254
21  EPIJDataManager_Core_L  0x0d20272c  
SendMessageToCoreDataManager + 710
22  EPIJDataManager 0x0cf75b12  
SendMessageToDataManager + 142
23  PDECPlugin010x0c8fe6c0 - 
[CERPEPIJDataManager(EPIJDataManagerMessageMethod) pDEInitialize] + 566
24  PDECPlugin010x0c8fe3b7 - 
[CERPEPIJDataManager(EventHandlerMethod) onInitialize:] + 577
25  PDECPlugin010x0c897f67 -[CERPPDEDataManager 
(EventHandlerMethod) onInitialize:] + 1219
26  PDECPlugin010x0c8fcb5f -[CERPCocoaPDESystem 
(SystemInitializeMethod) initializeSystem] + 675
27  PDECPlugin010x0c8fc5d1 -[CERPCocoaPDESystem 
(EventHandlerMethod) onCocoaPDEPDEPanelsForType:] + 419
28  PDECPlugin010x0c8fc22a -[CERPCocoaPDESystem 
(EventHandlerMethod) onSystemMessage:data:param:] + 300
29  PDECPlugin010x0c8ad408 + 
[CERPSystemInterface(SendSystemMessageMethod)  
sendMessageToSystem:data:param:] + 382
30  PDECPlugin010x0c8ad1d5 -[CERPPDEInterface 
(PDEPlugInOverrideMethod) PDEPanelsForType:withHostInfo:] + 393

31  PrintCocoaUI0x0c834583 0x0 + 209929603
32  PrintCocoaUI0x0c8335be 0x0 + 209925566
33  PrintCocoaUI0x0c831686 0x0 + 209917574
34  PrintCocoaUI0x0c84b01d  
_Z29CarbonPrintButtonEventHandlerP25OpaqueEventHandlerCallRefP14OpaqueEventRefPv 
 + 10444
35  PrintCocoaUI0x0c84a6ba  
_Z29CarbonPrintButtonEventHandlerP25OpaqueEventHandlerCallRefP14OpaqueEventRefPv 
 + 8041
36  AppKit  0x939c56fc - 
[NSWindowController _windowDidLoad] + 525
37  AppKit  0x939534f4 - 
[NSWindowController window] + 123
38  AppKit  0x93e39d98 -[NSPrintPanel  
runModalWithPrintInfo:] + 538
39  AppKit  0x93e382a0 - 
[NSConcretePrintOperation runOperation] + 312



___

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


Changing the edit behaviour of a cell

2009-10-09 Thread Tom Davie
I've been busy reading the documentation all day, and can't for the life of
me figure out how to change the editing behavior of an NSCell.
I have a cell, which I'd like to pop up a window over when the user attempts
to edit it (much like many websites do to present a date picker for
example).

I have tried overriding

**
*

- (void)editWithFrame:(NSRect)aRect inView:(NSView *)controlView
editor:(NSText *)textObj delegate:(id)anObject event:(NSEvent *)theEvent

- (void)selectWithFrame:(NSRect)aRect inView:(NSView *)controlView
editor:(NSText *)textObj delegate:(id)anObject start:(NSInteger)selStart
length:(NSInteger)selLength

and

- (void)endEditing:(NSText *)textObj


with only limited success.  selectWithFrame... appears to give me a slightly
bogus rectangle (about 50 pixels off to the upper left, after running it
through [controlView convertPointToBase:aRect.origin]), while
editWithFrame... and endEditing... never seem to be called.


What is the correct way to set up such behaviour?


Thanks


Bob

*
___

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

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

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

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


Re: Are these Apple or 3rd party classes?

2009-10-09 Thread Steve Christensen
A quick Google search came up with a reference to EPIJDataManager  
that somehow relates to Epson printers. I couldn't find any other  
info than that.



On Oct 9, 2009, at 6:48 AM, Philip White wrote:

A customer of one of my shareware programs has reported that my  
program frequently crashes when he tries to print. No one else has  
reported this kind of error. The stack trace he sends me includes  
the following lines: (this is just some of them)


20  EPIJDataManager_Core_L  0x0d201bca  
_Z28SendMessageToDataManagerCoremPvS_ + 254
21  EPIJDataManager_Core_L  0x0d20272c  
SendMessageToCoreDataManager + 710
22  EPIJDataManager 0x0cf75b12  
SendMessageToDataManager + 142
23  PDECPlugin010x0c8fe6c0 - 
[CERPEPIJDataManager(EPIJDataManagerMessageMethod) pDEInitialize] +  
566
24  PDECPlugin010x0c8fe3b7 - 
[CERPEPIJDataManager(EventHandlerMethod) onInitialize:] + 577


I don't really know a lot about the inner workings of the print  
system, but would anyone be able to tell me if this looks like it  
is third party stuff (printer drivers?) or Apple stuff?


He is running 10.6.1


___

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: Updating application info plist

2009-10-09 Thread Bill Bumgarner


On Oct 9, 2009, at 8:19 AM, Kyle Sluder wrote:

Sorry, you cannot do this. Changing an app's Info.plist is not  
supported, especially while the app is running.


As well, it is likely that the .app directory is installed in some  
place where the current user does not have write access or the app  
might be on a machine with multiple users and, thus, that single copy  
is run by multiple people.


All of this begs the question: "What are you really trying to do?"

b.bum
___

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: How to set checkbox state in TableView columnheader

2009-10-09 Thread Corbin Dunn

On Oct 8, 2009, at 1:23 AM, Zhang Li wrote:

> Hi All,
> 
> 
> 
> I want to place a checkbox on each NSTableView column header, when user click 
> on it, the checkbox can be set to checked/unchecked state accordingly.
> 
> 
> 
> I successfully put checkbox on NSTableView column header by using following 
> code, I can see the checkbox there, but don't know how to change its value to 
> on/off.
> 
> 
> 
> My code snippet is as below:
> 
> 
> 
> // Create CheckBox on Column Header
> NSButtonCell *cell = [[ NSButtonCell alloc] init];
> [cell setTitle:@"Checkbox"];
> [cell setButtonType:NSSwitchButton];
> [cell setBordered:YES];
> [cell setImagePosition:NSImageLeft];
> [aColumn setHeaderCell:cell]; 

What you are doing will not work. 

/* Gets and sets the headerCell associated with this NSTableColumn. 'cell' must 
be non nil, and should be a member of the NSTableHeaderCell class. The 
'headerCell' is a strong reference, and will be retained.
 */
- (void)setHeaderCell:(NSCell *)cell;
- (id)headerCell;

You have to create an NSTableHeaderCell subclass. Even then, you may have to 
subclass NSTableHeaderView to get it to work like a button with a button in it 
(header's are essentially buttons).

--corbin


___

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

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

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

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


Re: Updating application info plist

2009-10-09 Thread Kyle Sluder
On Oct 9, 2009, at 2:55 AM, Zephyroth Akash  
 wrote:


After the update of some resources I want to write the new version  
of these resources in the Info.plist.


Sorry, you cannot do this. Changing an app's Info.plist is not  
supported, especially while the app is running.


--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: Updating application info plist

2009-10-09 Thread Randall Meadows

On Oct 9, 2009, at 3:55 AM, Zephyroth Akash wrote:


I get the Info.plist of the app like this.
NSMutableDictionary *infoPlist = [[NSBundle mainbundle]  
infoDictionary];


After the update of some resources I want to write the new version  
of these resources in the Info.plist.


No problem.

But when the app execute : [infoPlist  
writeToFile:pathToInfoPlistOfTheApp atomically:YES];


Nothing happens even if I change the path to my desktop, the  
dictionary is not written.


Are there some limitations ?


There are limitations on what types of objects you can put in a  
dictionary such that it can be written out to a property list file.   
Specifically, only NSData, NSDate, NSNumber, NSString, NSArray, and/or  
NSDictionary objects.  Any other type of object in the dictionary will  
cause the write to fail.

___

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: Hide an Item on Desktop

2009-10-09 Thread Dave Camp

On Oct 9, 2009, at 6:50 AM, David Patrick Henderson wrote:

Depends on one's definition of "supported". One cannot rename a file  
or folder in the Finder directly with a leading '.', or a ':'.  
Attempting to do so will cause warning dialogs for all these cases  
(and perhaps of which I am unaware). So one can certainly claim that  
the Finder does not support these cases; however, the Finder will  
handle these files if created through some other medium such as a  
terminal program.


It has nothing to do with the Finder "supporting" it. Obviously the  
Finder does not display files starting with dots because it was  
designed to do so. It purposefully hides files that the average user  
does not need to see.


The Finder won't let you pre-pend a dot to the file because it  
purposefully does not show files that start with a dot. If it let you  
add the dot, the file would suddenly be hidden and a normal user (i.e.  
someone without Terminal knowledge) would have no way of getting it  
back. It's a safety feature.


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: Automatic language detection - a bug (again) or what. Snow Foundation NSSpellServer.

2009-10-09 Thread MacProjects

Just submitted in bug reporter.

Bug ID# 7290111

Problem Report Title: NSSpellServer: OSX 10.6. Error in automatic  
language detection.

Product: Mac OSX
Version/Build Number: 10B504
Classification: Serious Bug
Is It Reproducible?: Always

NSSpellServer: OSX 10.6. Error in automatic language detection for any  
3rd party spellcheck including OpenSpell


Summary:
After creating a new spelling checker (service) that’s available to  
any application and adding it to "Automatic by language" setup in  
System Preferences
1) NSSpellServer fails to use this spellchecker (registered language 
(s)) when "Automatic by language" spelling is used.
2) When spelling with "Automatic by language" option NSSpellServer  
calls only some of the necessary methods to the service.
3) Spellcheck is run only after user selects its registered language  
in an applications Spelling options, then user has to switch back for  
"Automatic by language".
4) Implementing –  
spellServer:checkString:offset:types:options:orthography:wordCount:  
invokes unexpected behaviour when right-clicking misspelled word.


Steps to Reproduce:
// Any custom spellcheck
1) Set in System Preferences : Language & Text spelling to "Automatic  
by language"

2) Write, build and install a new spellcheck under /Library/Servces
4) Login/out (update dynamic services) for the new service to register.
5) Set the newly registered language delivered by the spell check as  
one of the languages for "Automatic by language" in System  
Preferences : Language & Text setup list.
6) Open any application that makes use of NSSpellChecker, i.e.,  
TextEdit.

7) Write partly correct, partly incorrect text in the new language.
8) Try to spellcheck it. It fails to suggest words in intended language.
9) Look for spellcheck service in currently running processes. It  
isn't listed. But it should be run automatically as the registered  
language (service) is set in "Automatic by language" list in system  
preferences meaning OSX is providing user ability to check for custom  
languages/spellchecks that are added to "automatic" list.
10) Open up applications (TextEdit) Edit : Spelling and Grammar : Show  
Spelling and Grammar panel.

11) Select the newly registered language in languages list.
12) $ top or Activity Monitor reports that service is finally run.
13) Check text (write it partly correct, partly incorrect) in TextEdit  
for spelling issues.

14) Misspelled words are underlined.
15) Suggestions for partial world are shown correctly.
16) If spellcheck service (NSSpellServerDelegate) implements method
a) only –  
spellServer:findMisspelledWordInString:language:wordCount:countOnly:

• right-clicking misspelled word gives a list of possible corrections;
• Show Spelling and Grammar panel gives a list of possible corrections;
b) both –  
spellServer:findMisspelledWordInString:language:wordCount:countOnly:  
and –  
spellServer:checkString:offset:types:options:orthography:wordCount:

• right-clicking misspelled word gives a list of possible corrections;
• Show Spelling and Grammar panel gives a list of possible corrections;
c) only –  
spellServer:checkString:offset:types:options:orthography:wordCount:
• right-clicking misspelled word DOESN'T give a list of possible  
corrections;

• Show Spelling and Grammar panel gives a list of possible corrections;
17) Return to Show Spelling and Grammar panel and select  "Automatic  
by language" in languages list.
18) Try to check for multiple languages (including the new one) that  
are set in Language & Text "Automatic by language" list.
19) The words in the new language are underlined as incorrect, as if  
application (NSSpellServer) couldn't detect the right language.
20) Debugging/ logging the new spellcheck service shows that neither –  
spellServer:findMisspelledWordInString:language:wordCount:countOnly:  
or –  
spellServer:checkString:offset:types:options:orthography:wordCount:  
methods are called to NSSpellServer delegate at this point.
20) Right-click (or using Spelling and Grammar panel) for possible  
corrections for words (both - correct and incorrect ones, it doesn't  
matter as all are underlined) written in the new language.
21) The corrections that show up are supplied by the right spellcheck  
service - the new one
22) Debugging/ logging the new spellcheck service shows that –  
spellServer:suggestGuessesForWord:inLanguage: method IS called to  
NSSpellServer delegate at this point.
20) Press esc key for possible completions for words (both - correct  
and incorrect ones, it doesn't matter as all are underlined) written  
in the new language.
21) The completions that show up are supplied by the right spellcheck  
service - the new one
22) Debugging/ logging the new spellcheck service shows that –  
spellServer:suggestCompletionsForPartialWordRange:inString:language:  
method IS called to NSSpellServer delegate at this point.


---
// OpenSpell.service
23) Download a dic and aff file for some hunspell dictionary
24) P

Re: How to ease the burden on the Garbage Collector?

2009-10-09 Thread Gabriel Zachmann
It seems that about 20% of the time is spent in the Garbage  
Collector thread!


Which is a bit surprising to me, since I don't allocate a large  
number of objects (I think) -- just a small number of large objects  
(the images).


The collector only chews CPU when there are lots of allocation  
events (and, hopefully, deallocation events) that are causing the  
collector to believe it needs to do work.   Or when something is  
triggering the collector manually really often.


Have a look at ObjectAlloc & ObjectGraph in Instruments.   That  
should give you an idea if there are lots and lots of allocation  
events occurring and, if so, what they are.  From there, it is a  
matter of minimizing the number of allocations occurring.




If I understand the output of Instruments/ObjectAlloc correctly, it  
says there have been about 300,000 allocations withing about 1.5  
minutes.

Is that very much?

It also says that most of the allocations are CFStrings and small  
memory blocks (surprise surprise ;-) ), but looking at the instances  
it seems to me that I don't have much control over those.
(For instance, about half of the CFString's occur in the library  
CFNetwork in the functions initializeTLDMachine() and  
MemoryCookies::inflateFromData().)


Since I couldn't find a way to export the statistics in ASCII, I have  
made 3 screenshots, which you can see here:

http://zach.in.tu-clausthal.de/tmp/malloc1.png
http://zach.in.tu-clausthal.de/tmp/malloc2.png
http://zach.in.tu-clausthal.de/tmp/malloc3.png


For your information, here is an outline of my main loop (executed in  
ScreenSaverView's -animateOneFrame):


  get a new filename from a list of filenames
  CGImageSourceRef sourceRef = CGImageSourceCreateWithURL(..)
  check a few things in the sourceRef, such as image size
  CGImageRef imageRef = CGImageSourceCreateImageAtIndex(sourceRef, 0,  
NULL)
  [NSTimer scheduledTimerWithTimeInterval: 2.3 target: self selector:  
@selector(doGarbageCollection:) userInfo: nil repeats: NO];

  create new layer with contents = imageRef
  create a new animation and attach it to the new layer
  [CATransaction begin];
  [CATransaction setValue: [NSNumber numberWithFloat:  
fading_duration] forKey: kCATransactionAnimationDuration  ];

  [mainLayer_ replaceSublayer: currentLayer_ with: newlayer];
  currentLayer_ = newlayer;
  [CATransaction commit];

This gets executed every 5 seconds.

And here is what doGarbageCollection does:

- (void) doGarbageCollection: (NSTimer *) theTimer
{
if ( [NSGarbageCollector defaultCollector] )
[[NSGarbageCollector defaultCollector]  
collectExhaustively];// seems to work better than  
collectIfNeeded

}


I have tried omitting doGarbageCollection: , but then the  
screensaver's memory footprint grows until the memory is full, and  
then the animation stops for a second or 2 (you can see the memroy  
being freed in ActivityMonitor).


The judder I am concerned with seems to occur especially during image  
loading.


Again, the same code, when executed in the reference-counted  
environment (10.5) runs very smoothly, no judder whatsoever, not even  
during loading of an image.




Are you sure you aren't just seeing the GC thread sitting and  
waiting for something to do?


THat would mean that the GC thread does busy waiting, wouldn't it?

What are the "hot" methods/functions you see related to the GC  
thread? (many folks misread what Shark is telling them...)




Here are the top lines of the call tree that I see in Shark.
It seems to me that they all belong to the same thread, the GC thread.
So, one of the hot methods is  
Auto::MemoryScanner::scan_for_unmarked_blocks, isn't it?


0.0%31.7%   libSystem.B.dylib   start_wqthread
0.0%31.7%   libSystem.B.dylib_pthread_wqthread
0.0%31.7%   libSystem.B.dylib _dispatch_worker_thread2
0.0%20.4%   libSystem.B.dylib  _dispatch_queue_invoke
0.0%20.4%   libSystem.B.dylib   _dispatch_queue_drain
0.0%20.4%   libSystem.B.dylib
_dispatch_call_block_and_release
0.0%20.4%   libauto.dylib auto_collection_work(Auto::Zone*)
	0.0%	20.4%	libauto.dylib	   auto_collect_internal(Auto::Zone*,  
unsigned int)
	0.0%	20.3%	libauto.dylib	Auto::Zone::collect(bool, void*,  
unsigned long long*)

0.0%18.5%   libauto.dylibAuto::MemoryScanner::scan()
	0.6%	17.1%	libauto.dylib	   
Auto::MemoryScanner::scan_pending_until_done()
	0.6%	15.0%	libauto.dylib	
Auto::MemoryScanner::scan_for_unmarked_blocks(Auto::Subzone*, unsigned  
long, void*)
	0.4%	7.3%	libauto.dylib	 
Auto::MemoryScanner::scan_object_range(Auto::Range&,  
Auto::WriteBarrier*)
	3.2%	4.7%	libauto.dylib	  
Auto::MemoryScanner::scan_range(Auto::Range const&, Auto::WriteBarrier*)
	1.4%	1.4%	libauto.dylib	   
Auto::MemoryScanner::set_pending(void*)
	0.1%	0.1%	libauto.d

Re: How to set checkbox state in TableView columnheader

2009-10-09 Thread Jerry Krinock
Try to send your button cell a -drawWithFrame:inView: message after  
setting its state.


___

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: Hide an Item on Desktop

2009-10-09 Thread David Patrick Henderson


On 09 Oct 2009, at 03:44, I. Savant wrote:


On Oct 8, 2009, at 9:18 PM, M Pulis wrote:


Please do not advise this hack. It is not supported by the Finder.


 Wrong.


Depends on one's definition of "supported". One cannot rename a file  
or folder in the Finder directly with a leading '.', or a ':'.  
Attempting to do so will cause warning dialogs for all these cases  
(and perhaps of which I am unaware). So one can certainly claim that  
the Finder does not support these cases; however, the Finder will  
handle these files if created through some other medium such as a  
terminal program. In the case of a leading '.', Finder does not show  
such files to the user. In the case of a ':', Finder displays it as a  
'/' or it does at least in Snow Leopard (I'm fairly certain that in  
earlier versions of Mac OS X that even the '/' was a forbidden  
character in file/folder names in the Finder).


Dave
--
"There are two ways of constructing a software design: One way is to  
make it so simple that there are obviously no deficiencies, and the  
other way is to make it so complicated that there are no obvious  
deficiencies. The first method is far more difficult." -- C. A. R.  
"Tony" Hoare


___

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


Are these Apple or 3rd party classes?

2009-10-09 Thread Philip White

Hello,

	A customer of one of my shareware programs has reported that my  
program frequently crashes when he tries to print. No one else has  
reported this kind of error. The stack trace he sends me includes the  
following lines: (this is just some of them)


20  EPIJDataManager_Core_L  0x0d201bca  
_Z28SendMessageToDataManagerCoremPvS_ + 254
21  EPIJDataManager_Core_L  0x0d20272c  
SendMessageToCoreDataManager + 710
22  EPIJDataManager 0x0cf75b12  
SendMessageToDataManager + 142
23  PDECPlugin010x0c8fe6c0 - 
[CERPEPIJDataManager(EPIJDataManagerMessageMethod) pDEInitialize] + 566
24  PDECPlugin010x0c8fe3b7 - 
[CERPEPIJDataManager(EventHandlerMethod) onInitialize:] + 577


I don't really know a lot about the inner workings of the print  
system, but would anyone be able to tell me if this looks like it is  
third party stuff (printer drivers?) or Apple stuff?


He is running 10.6.1

Thanks,
  Philip
___

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: Instance variables: access directly vs. getter / setter

2009-10-09 Thread Matthias Arndt

Am 09.10.2009 um 13:32 schrieb Graham Cox :

In the first case, interested observers using KVO to track changes  
to  will get automatically notified, and any subclasses that  
have overridden -setIvar: or -ivar also get called as they should.


Got it :-)

As always your feedback is simply priceless. Thank you so much, Matthias
___

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: Instance variables: access directly vs. getter / setter

2009-10-09 Thread Graham Cox


On 09/10/2009, at 10:14 PM, Matthias Arndt wrote:


   [self setIvar:[self ivar] + 1];

instead of

   iVar++;

looks a bit confusing to me.



Maybe confusing, but the two are not necessarily equivalent. In the  
second case, you are merely incrementing the ivar. No-one else would  
know anything about it - you'd have to take further steps to notify  
others of the change, including any potential subclasses of your  
class. Sometimes you might want that, but I would suggest that 99% of  
the time, you do not.


In the first case, interested observers using KVO to track changes to  
 will get automatically notified, and any subclasses that have  
overridden -setIvar: or -ivar also get called as they should.


--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: Instance variables: access directly vs. getter / setter

2009-10-09 Thread Matthias Arndt

Am 09.10.2009 um 11:30 schrieb Graham Cox:

In init and dealloc, it is usual & recommended to access the ivar  
directly - not because self isn't defined (it is), but because at  
those times you are usually only concerned with setting the ivar's  
initial value (possibly to an object), or releasing it, without side  
effects.


Graham,

thanks a lot for clarifying and I stand corrected in concerns of the  
"self" definition: Don't know what crossed my mind, how should "init"  
return the "self"-pointer without it being defined. So I'll change my  
code to use accessors, although


[self setIvar:[self ivar] + 1];

instead of

iVar++;

looks a bit confusing to me. I read that

self.iVar++;

is also supported, but I just don't like the dot-syntax. At least not  
yet ...


Thanks again, Matthias
___

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: Updating application info plist

2009-10-09 Thread Mike Abdullah


On 9 Oct 2009, at 10:55, Zephyroth Akash wrote:


Hi,

I'm facing a weird issue.

I get the Info.plist of the app like this.
NSMutableDictionary *infoPlist = [[NSBundle mainbundle]  
infoDictionary];


Warning lights should be going off here. -infoDictionary is defined as  
returning an NSDictionary so there is no guarantee it will be mutable.  
At the very least do:


NSMutableDictionary *infoPlist = [[[NSBundle mainBundle]  
infoDictionary] mutableCopy];


But considering the documentation of -infoDictionary, I'd say this  
isn't a particularly good idea anyhow. As the docs say:


"The NSBundle class may add extra keys to this dictionary for its own  
use."


Instead, I think you're better off loading the plist manually yourself.



After the update of some resources I want to write the new version  
of these resources in the Info.plist.


No problem.


But when the app execute : [infoPlist  
writeToFile:pathToInfoPlistOfTheApp atomically:YES];


Nothing happens even if I change the path to my desktop, the  
dictionary is not written.


Are there some limitations ?
Can I write the Info.plist while the application is running ?

Zephyroth
___

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/cocoadev%40mikeabdullah.net

This email sent to cocoa...@mikeabdullah.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: How to set checkbox state in TableView columnheader

2009-10-09 Thread Zhang Li



Maybe you should update the NSTableView ?


I did, but no luck.

What's more, the creation of the checkbox and set its state to on are inside 
awakeFromNib, updating NSTableView looks like not necessary.


BTW, when I click left mouse button on the checkbox, I can see tick appear 
inside the checkbox, but once I release the mouse button, the tick 
disappears, and the checkbox remains unchecked.


Thanks for your attention.
Echo 



___

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: Hide an Item on Desktop

2009-10-09 Thread I. Savant

On Oct 9, 2009, at 2:00 AM, M Pulis wrote:

Following trends, it is easy to imagine a future Desktop becoming an  
increasingly protected space. One thing I have learned in 25 years  
is never underestimate Apple's ability to change and force our world  
to recompile. 10.6 just killed off an entire CPU line. Wait for OS  
10.7 my friend, the Finder, she is nice now, yes?  :-)


  (sigh) I believe Kyle was right. You're just making things up.

  As others have told you, dot-files being hidden is a convention  
that's been around for many, many years. Apple continues to find new  
uses for it with every release (.fseventsd, .Spotlight- 
V100, .Trashes ...), and many of the tools installed as part of the  
BSD subsystem use it as well (.ssh/)


--
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: Hide an Item on Desktop

2009-10-09 Thread I. Savant

On Oct 8, 2009, at 9:18 PM, M Pulis wrote:


Please do not advise this hack. It is not supported by the Finder.


  Wrong.

--
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


Updating application info plist

2009-10-09 Thread Zephyroth Akash

Hi,

I'm facing a weird issue.

I get the Info.plist of the app like this.
NSMutableDictionary *infoPlist = [[NSBundle mainbundle] infoDictionary];

After the update of some resources I want to write the new version of  
these resources in the Info.plist.


No problem.


But when the app execute : [infoPlist  
writeToFile:pathToInfoPlistOfTheApp atomically:YES];


Nothing happens even if I change the path to my desktop, the  
dictionary is not written.


Are there some limitations ?
Can I write the Info.plist while the application is running ?

Zephyroth
___

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: Instance variables: access directly vs. getter / setter

2009-10-09 Thread Graham Cox


On 09/10/2009, at 8:01 PM, Matthias Arndt wrote:

While restructuring some old classes I'm uncertain about the  
preferred way to access instance variables within their own instance:


I tend to defines all these variables as properties and use their  
implicit getters / setters, but ...


1. ) ... in the designated initializer I have to access the instance  
variables directly, because at this moment "self" is not yet  
defined, is it?


2.) ... are there significant performance issues or other reasons to  
prefer the direct reference to (or direct assignment of) instance  
variables? At least the code of the setters / getters might impact  
the performance, but I'd sacrifice it for the sake of a consistent  
code.


Any comments / suggestions?



Properties and ivars are distinct things, though very often a property  
is implemented in terms of an ivar.


In init and dealloc, it is usual & recommended to access the ivar  
directly - not because self isn't defined (it is), but because at  
those times you are usually only concerned with setting the ivar's  
initial value (possibly to an object), or releasing it, without side  
effects.


At all other times, including when accessing from within the instance  
itself, you should usually use the getters/setters unless you have an  
explicit and clear reason not to. Using the getters and setters allows  
KVO to work as it should, and for deliberate side effects implemented  
both by the class and any subclasses to work normally. It is only if  
you definitely don't want these effects to operate that you should  
access the ivar directly (and in those cases, it makes for more  
readable code to have additional accessors that explain what they do,  
e.g. -setSomePropertyWithoutNotifying:)


There is a minor performance penalty in accessing your ivars through  
the accessors, but in general this is not something to be concerned  
about unless profiling shows it's a problem. The code will be more  
readable, and also allows a subclass to override an accessor to  
supplement or replace functionality correctly - if the base class  
bypasses the accessors very often subclasses will not work as might be  
expected. (Though on that score it would be nice if Objective-C  
supported the notion of private methods, though you can achieve  
something of the same effect using a (Private) category, which I'd  
also recommend).


--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


Instance variables: access directly vs. getter / setter

2009-10-09 Thread Matthias Arndt
While restructuring some old classes I'm uncertain about the preferred  
way to access instance variables within their own instance:


I tend to defines all these variables as properties and use their  
implicit getters / setters, but ...


1. ) ... in the designated initializer I have to access the instance  
variables directly, because at this moment "self" is not yet defined,  
is it?


2.) ... are there significant performance issues or other reasons to  
prefer the direct reference to (or direct assignment of) instance  
variables? At least the code of the setters / getters might impact the  
performance, but I'd sacrifice it for the sake of a consistent code.


Any comments / suggestions?

Matthias
___

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: How to set checkbox state in TableView columnheader

2009-10-09 Thread Zhang Li
NSButtonCell inherits from NSActionCell and NSCell.  (See 2nd line of 
the NSButtonCell documentation).  Click the links.  Now, try -[NSCell 
setState:], which will probably work, and -[NSActionCell 
setObjectValue:], which might work.


I called [cell setObjectValue:[NSNumber numberWithInt:1]] before [cell 
release], the checkbox still shows unchecked.
But when I clicked table column, from debug output of below, both 
buttonStateBefore & buttonStateAfter are 1, that means checkbox is already 
set to on state, then why the checkbox picture doesn't reflect the state 
change?


- (void)tableView: (NSTableView *)tableView 
didClickTableColumn:(NSTableColumn *)tableColumn

{
NSLog(@"buttonStateBefore:%@", [[tableColumn headerCell] objectValue]);
[[tableColumn headerCell] setObjectValue:[NSNumber numberWithInt:1]];
NSLog(@"buttonStateAfter:%@", [[tableColumn headerCell] objectValue]);
}

Thanks,
Zhang Li 



___

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: How to set checkbox state in TableView columnheader

2009-10-09 Thread Zhang Li


- Original Message - 
From: "Jerry Krinock" 

To: "Cocoa Developers" 
Sent: Friday, October 09, 2009 11:20 AM
Subject: Re: How to set checkbox state in TableView columnheader




Congratulations, it looks like you got the hard parts!

NSButtonCell inherits from NSActionCell and NSCell.  (See 2nd line of  the 
NSButtonCell documentation).  Click the links.  Now, try -[NSCell 
setState:], which will probably work, and -[NSActionCell 
setObjectValue:], which might work.




Hi, Jerry,
Thanks for your advice.
I tried [cell setState:NSOnState] & [cell setObjectValue:[NSNumber 
numberWithInt:1]], but still checkbox is in off state.


Echo 



___

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