Re: 10.4 v. 10.5 SDK question

2008-10-18 Thread Steve Cronin

Ken;

Thanks for the quick and helpful response!

You seem to have assumed that you can only compile against the 10.4  
SDK by going back to Xcode 2.5 (and thus using an earlier compiler).


No I brought the application back to the 10.5 machine and have left it  
compiling against the 10.4 SDK for now.
Trying to decide whether to return to using the 10.5 SDK was the  
genesis of my question.


In general, your choice of SDK should be dictated by the latest  
features you want to use.  If you don't want to use any 10.5-or- 
later-only features, sticking with the 10.4 SDK is safest.
I want to deploy to 10.4 and have avoided using 10.5 features to keep  
the code base clean and simple.
My plan was to prove out the product idea using the widest possible  
audience (10.4) using the simplest most widely understood and sampled  
code - 10.4 only.
If successful, then version 2 would be a 10.5 only product developed  
using a by then more battle-tested 10.5.
Version 2 is also then a clean code base because it also avoids all  
the OS-version conditionals you mentioned.



Also, what do you mean the underlying code is cleaner?  ..
One caveat with simply using the 10.4 SDK, though -- the 10.5  
frameworks contain a number of bug fixes

That's what I meant.

...(bug fixes) which are only enabled for binaries linked against  
the 10.5 SDK.  This is both a good and bad thing.  It means your  
program works consistently on Tiger and Leopard, which makes testing  
easier.  But it might behave consistently incorrectly due to the  
bugs.  Check the various Leopard release notes for specifics.

I'm afraid I don't understand this comment.
What do you mean ..behave consistently incorrectly due to the bugs..?
Can you refer me to a specific item you might be thinking of here?

So in sum, I think what you are saying is:
Stick w/ 10.4 SDK as the safest path.
However there might be bug fixes which you could benefit from by using  
the 10.5 SDK.
To determine whether or not you actually do benefit from 10.5 means  
you have to learn more about it by reading the Release Notes.

Does that sound right?

So based on this reading of your comments and a few minutes with the  
XCode documentation I scan the AppKit Release Notes for Leopard and  
find the following:

NSCompoundPredicate

For applications linked on Mac OS X 10.5 Leopard or later,  
initializing an NSCompoundPredicate now copies the subpredicates array  
rather than retaining it. Applications linked on Mac OS X 10.4 Tiger  
continue to only retain the subpredicates array for binary  
compatibility.



Well this appears germane to my application as I do use compound  
predicates.
Judging by the scope the Release Notes and the speed with which I  
could locate even one germane issue I am convinced that my original  
instinct to use the 10.5 SDK because the code base is better IS correct.


But I am puzzled by your good and bad thing comment...

Thanks Again,
Steve



On Oct 18, 2008, at 12:18 AM, Steve Cronin wrote:

I have developed an application with XC 3.1 on a 10.5 Intel machine  
using the 10.5 SDK w/ a 10.4 deployment target.

(No GC for me!)

In testing I immediately ran into a few difficulties on a 10.4 PPC  
machine.
In the course of tracking down these issues I ended up installing  
XC 2.5 on this 10.4 PPC machine.
I actually compiled the application under the 10.4 SDK on this  
machine so I could run it in the debugger.
(I had to make surprisingly few changes to get this to happen -  
none that I am unhappy about)
Converting all .xib to .nib being one major aspect (and where I  
found the offending bug [filter predicate bindings...])
In fact, this exercise has left me with an increased confidence in  
the application's behavior in this environment.


So I've moved the modified project back to the 10.5 Intel where it  
happily compiles and runs still using the 10.4 SDK and .nibs.


So, given all that, am I correct in wanting to move the project  
back to the 10.5 SDK because the underlying code is cleaner and the  
compiler output is better?



Also, what do you mean the underlying code is cleaner?  You are  
linking against the frameworks dynamically.  You get the framework  
for the OS on which you're running.  Regardless of what SDK you link  
against at build time, you're still linking against the libraries of  
your runtime environment.


In general, your choice of SDK should be dictated by the latest  
features you want to use.  If you don't want to use any 10.5-or- 
later-only features, sticking with the 10.4 SDK is safest.  The  
reason is that the compiler will warn you if you accidentally slip  
up and make use of a newer feature.


If you want to make use of 10.5 features but still deploy to 10.4,  
you have to take extra care.  That's why it's not good to do so  
accidentally.  You need to conditionalize all uses of 10.5 features  
based on their availability at runtime (checking that symbols aren't  
NULL and using -respondsToSelector:) and provide 

Re: 10.4 v. 10.5 SDK question

2008-10-18 Thread Ken Thomases

On Oct 18, 2008, at 1:36 AM, Steve Cronin wrote:

...(bug fixes) which are only enabled for binaries linked against  
the 10.5 SDK.  This is both a good and bad thing.  It means your  
program works consistently on Tiger and Leopard, which makes  
testing easier.  But it might behave consistently incorrectly due  
to the bugs.  Check the various Leopard release notes for specifics.

I'm afraid I don't understand this comment.
What do you mean ..behave consistently incorrectly due to the  
bugs..?


I mean that, where there's a bug, an application linked against the  
10.4 SDK will continue to get the buggy behavior from the framework,  
even when running on Leopard.  Consistency.  Whatever workaround you  
have for the bug will continue to work correctly on Leopard.


If you link against the 10.5 SDK, then the application will get one  
kind of behavior when running on Tiger and get a different behavior  
when running on Leopard.  Inconsistency.  Any workaround for the Tiger  
bug may cause trouble when running on Leopard, but failure to work  
around the bug will cause trouble when running on Tiger.  You have to  
write your code with this in mind, and you have to test both  
possibilities.



Can you refer me to a specific item you might be thinking of here?


Well, any of the bugs fixes listed in the release notes which note  
that the new behavior only occurs for applications linked against  
10.5.  For example, in the AppKit release notes, see the item titled  
KeyValueObserving notifications for IBOutlets during Nib loading.   
Consider how easy it would be to unwittingly code an application that  
relies either on the old behavior which would break with the new  
behavior, or vice versa.




So in sum, I think what you are saying is:
Stick w/ 10.4 SDK as the safest path.
However there might be bug fixes which you could benefit from by  
using the 10.5 SDK.
To determine whether or not you actually do benefit from 10.5 means  
you have to learn more about it by reading the Release Notes.

Does that sound right?


Yup.


So based on this reading of your comments and a few minutes with the  
XCode documentation I scan the AppKit Release Notes for Leopard and  
find the following:
NSCompoundPredicateFor applications linked on Mac OS X 10.5  
Leopard or later, initializing an NSCompoundPredicate now copies  
the subpredicates array rather than retaining it. Applications  
linked on Mac OS X 10.4 Tiger continue to only retain the  
subpredicates array for binary compatibility.


Well this appears germane to my application as I do use compound  
predicates.
Judging by the scope the Release Notes and the speed with which I  
could locate even one germane issue I am convinced that my original  
instinct to use the 10.5 SDK because the code base is better IS  
correct.


But I am puzzled by your good and bad thing comment...


Well, consider this: if the bug fix were purely good, why would Apple  
maintain backward compatibility for apps which are linked against the  
10.4 SDK?


And remember, if you link against the 10.5 SDK but support deployment  
on 10.4, then you still have to cope with the case where  
NSCompoundPredicate merely retains rather than copying its  
subpredicates array, because that's what will happen when it's run on  
10.4.  So, your code has to be safe under both behaviors rather than  
just having one behavior to worry about.


Cheers,
Ken

___

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

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

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

This email sent to [EMAIL PROTECTED]


WIndow from external framework not working

2008-10-18 Thread Samir Patel
I have a simple external Cocoa framework I have built that loads and displays a 
single nib-based window from a nib file contained in the framework. I add the 
framework to a separate application. Everything works fine - the window loads 
and appears on screen and all the outlets are valid.

But when I try to click a button in the window, nothing happens, and none of my 
actions get sent. The application that the window is added to/created from also 
starts to exhibit weird behavior, becoming intermittently unresponsive and 
having other things in the app itself stop working.

What am I missing? Is there something I need to do to the window after creating 
it to make it interoperate correctly with the main application?

Thanks,

Samir.


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.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 [EMAIL PROTECTED]


Re: Delete myDriver.kext files from normal user.

2008-10-18 Thread Jacques Petit
It's a security flaw.  Assuming you had an error in your code that  
allowed that allowed the string to be exploited, the system call would  
allow a person to do anything in the computer, subject to the  
permissions your process has.


On 17-Oct-08, at 5:17 PM, Jonathon Kuo wrote:


On Oct 17, 2008, at 1:21 PM, Kyle Sluder wrote:

On Fri, Oct 17, 2008 at 8:51 AM, Sachin Kumar [EMAIL PROTECTED] 
 wrote:

I am using system(rm -r myDriver.kext) to delete the file.


Please, *don't do this*.  Pretend 'system' doesn't exist.  unlink(2)
does exactly what you're looking for.


Just curious why the recommendation against system()?


___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Screen not redrawing

2008-10-18 Thread Graham Cox


On 18 Oct 2008, at 2:50 pm, Russ wrote:

When I do this programmatically after creating the main window's  
NSView, it scarfs up the bounding box of the succeeding views, not  
sure why that is.



This is another common symptom of using 'rect' as the view's bounds.  
Are you *sure* 100% positively that you are ignoring this?



--Graham
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Screen not redrawing

2008-10-18 Thread Jean-Daniel Dupas

Le 18 oct. 08 à 05:50, Russ a écrit :


Check to make sure [window isFlushWindowDisabled] is NO and [window

isAutodisplay] is YES.

Yes, both OK.

Also, try dropping a standard control (e.g. a button) in and see if  
it

redraws to the pressed state when you press it.

When I do this programmatically after creating the main window's  
NSView, it scarfs up the bounding box of the succeeding views, not  
sure why that is.


NSButton *xtra = [[NSButton alloc]  
initWithFrame:NSMakeRect(0,0,100,20)];

[nuvu addSubview:xtra];


Try [NSWindow flushWindow] or flushWindowIfNeeded.


Had no effect. I think the window is already being flushed---  
drawRect is being called



Also note, from the NSView docs:
A view object can draw on-screen if it is not hidden, it is attached

to a view hierarchy in a window (NSWindow), and the window has a
corresponding window device. 

All 3 are confirmed OK (including isHiddenOrHasHiddenAncestor)

Still puzzled, but good set of questions.




My 2 cents. What is your window backing store type ? (What does  
[myWindow backingType] return).

Using something else than Buffered may cause serious redraw glitch.
It should never append in standard Cocoa App as most of the window are  
created in Inerface Builder which set buffered by default, but in your  
case, it look like all windows are created by your UI Toolkit.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Objective 2.0 properties

2008-10-18 Thread Jim Correia

On Oct 17, 2008, at 2:29 PM, Jim Correia wrote:

For object types, in a non-garbage collected application  
(traditional retain/release style memory management) you never want  
to use assign. It is the equivalent of hand writing an accessor that  
does a pointer assignment (with no additional memory management) -  
i.e. it is incorrect.


My previous advice that, for object type properties in a non-GC  
application, you never want to use assign, was an oversimplification  
and therefore incorrect. Let me correct that advice for the benefit of  
the archives.


For object types which are acting as attributes (i.e. name, color),  
assign is never what you want (and you'll end up violating the object  
ownership policy.) You'll want to use copy for objects which conform  
to NSCopying, retain for other types.


For object types which are acting as relationships, you usually want  
retain, but sometimes assign is appropriate here, if you want  or need  
a weak/non-retained reference. Examples of this are delegates,  
references to parents in a tree structure (to prevent retain cycles.)


The key point here is that using assign, in a non-GC app, for an  
object type, is a special case. (And you need to understand that the  
special case applies to you, and you are using assign for the right  
reasons.)


Jim
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: 10.4 v. 10.5 SDK question

2008-10-18 Thread Steve Cronin

Ken;

Once again, thanks for the exemplary response!
(You are a great resource for the Cocoa community!)

So...  while yes, the 10.5 SDK does have bug fixes, using it and  
deploying to 10.4 potentially bifurcates the product into different  
behaviors.
(It is really tough to determine where and when these differences  
might show up but the possibility exists -. maddening from a support  
perspective)


Since my goal was to deploy to 10.4 all along, by using the 10.4 SDK,  
the app will behave the same on both 10.4 and 10.5 (and 10.6) --  
simpler from a support perspective.
In some cases the behavior might be consistently wrong perhaps but any  
such incorrectness can be cured on both OSes by the same workaround -- 
 simpler development and testing


Simpler development, simpler code, simpler testing,  simpler support   
- yeah!


Thanks for helping me better understand and for keeping my life simple!
Steve

On Oct 18, 2008, at 2:19 AM, Ken Thomases wrote:


On Oct 18, 2008, at 1:36 AM, Steve Cronin wrote:

...(bug fixes) which are only enabled for binaries linked against  
the 10.5 SDK.  This is both a good and bad thing.  It means your  
program works consistently on Tiger and Leopard, which makes  
testing easier.  But it might behave consistently incorrectly due  
to the bugs.  Check the various Leopard release notes for specifics.

I'm afraid I don't understand this comment.
What do you mean ..behave consistently incorrectly due to the  
bugs..?


I mean that, where there's a bug, an application linked against the  
10.4 SDK will continue to get the buggy behavior from the framework,  
even when running on Leopard.  Consistency.  Whatever workaround you  
have for the bug will continue to work correctly on Leopard.


If you link against the 10.5 SDK, then the application will get one  
kind of behavior when running on Tiger and get a different behavior  
when running on Leopard.  Inconsistency.  Any workaround for the  
Tiger bug may cause trouble when running on Leopard, but failure to  
work around the bug will cause trouble when running on Tiger.  You  
have to write your code with this in mind, and you have to test both  
possibilities.



Can you refer me to a specific item you might be thinking of here?


Well, any of the bugs fixes listed in the release notes which note  
that the new behavior only occurs for applications linked against  
10.5.  For example, in the AppKit release notes, see the item titled  
KeyValueObserving notifications for IBOutlets during Nib loading.   
Consider how easy it would be to unwittingly code an application  
that relies either on the old behavior which would break with the  
new behavior, or vice versa.




So in sum, I think what you are saying is:
Stick w/ 10.4 SDK as the safest path.
However there might be bug fixes which you could benefit from by  
using the 10.5 SDK.
To determine whether or not you actually do benefit from 10.5 means  
you have to learn more about it by reading the Release Notes.

Does that sound right?


Yup.


So based on this reading of your comments and a few minutes with  
the XCode documentation I scan the AppKit Release Notes for Leopard  
and find the following:
NSCompoundPredicateFor applications linked on Mac OS X 10.5  
Leopard or later, initializing an NSCompoundPredicate now copies  
the subpredicates array rather than retaining it. Applications  
linked on Mac OS X 10.4 Tiger continue to only retain the  
subpredicates array for binary compatibility.


Well this appears germane to my application as I do use compound  
predicates.
Judging by the scope the Release Notes and the speed with which I  
could locate even one germane issue I am convinced that my original  
instinct to use the 10.5 SDK because the code base is better IS  
correct.


But I am puzzled by your good and bad thing comment...


Well, consider this: if the bug fix were purely good, why would  
Apple maintain backward compatibility for apps which are linked  
against the 10.4 SDK?


And remember, if you link against the 10.5 SDK but support  
deployment on 10.4, then you still have to cope with the case where  
NSCompoundPredicate merely retains rather than copying its  
subpredicates array, because that's what will happen when it's run  
on 10.4.  So, your code has to be safe under both behaviors rather  
than just having one behavior to worry about.


Cheers,
Ken



___

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

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

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

This email sent to [EMAIL PROTECTED]


What is A class which must be subclassed ?

2008-10-18 Thread Jerry Krinock
I have written a class which is missing important behaviors that must  
be provided by subclasses.  I create one like this:


+ (id)fooWithBar:(Bar*)bar_ {
// A Bar instance knows which subclass of Foo is appropriate for  
it.

// To find out, send it a -fooClass message.
id instance = [[[bar_ fooClass] alloc] init] ;
return [instance autorelease] ;
}

I'm trying to figure out what to call this.  I read in Cocoa Design  
Patterns [1] about Abstract Classes, but my Foo doesn't seem to be  
quite an Abstract Class, since you could create one if you wanted to.


Is there a design pattern that I should be following for this thing?   
Or maybe could/should I change it to ^be^ an Abstract Class?  Or maybe  
I should just leave it as is?  Whatever it is, it works fine for me.


Thanks,

Jerry

[1] http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaDesignPatterns/chapter_5_section_1.html#/ 
/apple_ref/doc/uid/TP40002974-CH6-SW6

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: What is A class which must be subclassed ?

2008-10-18 Thread Andrew Merenbach

On Oct 18, 2008, at 7:43 AM, Jerry Krinock wrote:

I have written a class which is missing important behaviors that  
must be provided by subclasses.  I create one like this:


+ (id)fooWithBar:(Bar*)bar_ {
   // A Bar instance knows which subclass of Foo is appropriate for  
it.

   // To find out, send it a -fooClass message. 
   id instance = [[[bar_ fooClass] alloc] init] ;
   return [instance autorelease] ;
}

I'm trying to figure out what to call this.  I read in Cocoa Design  
Patterns [1] about Abstract Classes, but my Foo doesn't seem to be  
quite an Abstract Class, since you could create one if you wanted to.


Is there a design pattern that I should be following for this  
thing?  Or maybe could/should I change it to ^be^ an Abstract  
Class?  Or maybe I should just leave it as is?  Whatever it is, it  
works fine for me.


Thanks,

Jerry

[1] http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaDesignPatterns/chapter_5_section_1.html#/ 
/apple_ref/doc/uid/TP40002974-CH6-SW6


Greetings, Jerry,

Might it be appropriate to use a @protocol here?

Cheers,
Andrew



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: What is A class which must be subclassed ?

2008-10-18 Thread Andy Lee
Foo might qualify as a class cluster, but personally I don't think it  
needs to conform to a named pattern.  It's nice when you can borrow  
from previously thought-out patterns, but not necessary.


Would it make sense to reorganize so the instantiation is done by the  
Bar class?


- (id)fooInstance
{
return self fooClass] alloc] init] autorelease];
}

Subclasses of Bar could do more complex instantiation of fooClass if  
necessary instead of always alloc/init.  Just a thought -- it may not  
jibe with the semantics of your application.


--Andy


On Oct 18, 2008, at 10:43 AM, Jerry Krinock wrote:

I have written a class which is missing important behaviors that  
must be provided by subclasses.  I create one like this:


+ (id)fooWithBar:(Bar*)bar_ {
   // A Bar instance knows which subclass of Foo is appropriate for  
it.

   // To find out, send it a -fooClass message. 
   id instance = [[[bar_ fooClass] alloc] init] ;
   return [instance autorelease] ;
}

I'm trying to figure out what to call this.  I read in Cocoa Design  
Patterns [1] about Abstract Classes, but my Foo doesn't seem to be  
quite an Abstract Class, since you could create one if you wanted to.


Is there a design pattern that I should be following for this  
thing?  Or maybe could/should I change it to ^be^ an Abstract  
Class?  Or maybe I should just leave it as is?  Whatever it is, it  
works fine for me.


Thanks,

Jerry

[1] http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaDesignPatterns/chapter_5_section_1.html#/ 
/apple_ref/doc/uid/TP40002974-CH6-SW6

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: table bindings, value transformer per row?

2008-10-18 Thread [EMAIL PROTECTED]

thanx for this.

i've been using the willDisplayCell: delegate method to swap 
formatters as necessary, but i'd never thought of using it to swap 
the cell's value! i will add this to my bag o' tricks for possible 
future use.


for my current situation, i removed the use of the value transformer 
from my binding, and bound the column to different data in my model 
and apply appropriate formatter's as necessary. note that going this 
way doesn't impact sorting.


thanx,
ken


At 6:26 PM -0700 10/17/08, Ron Lue-Sang wrote:

Nope. No way to swap out the valuetransformer of the binding per row.

You can use part of Keary's suggestion tho. Don't set a 
valuetransformer at all in the binding for the column. Use the 
willDisplayCell: delegate method to take the value out of the cell, 
apply your own value transformations based on the row or whatever, 
and then set the new value on the cell.


Unfortunately, this setup will defeat the sorting behaviour Cocoa 
Bindings gives you for free. Our automatic support for sorting, for 
this column, will be wrong. I'd only suggest doing this for a column 
that's not sortable/filterable. Otherwise, you should really just 
add accessors to your model objects if you can (or create wrappers 
for them if you have to) that give you the transformed properties.



--
RONZILLA



On Oct 16, 2008, at 4:59 PM, 
mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote:


i was asking about the value transformer that is specified for 
the binding. i am aware that it is quite easy to change formatters.


thanx anyway,
ken


At 5:49 PM -0600 10/16/08, Keary Suska wrote:

On Oct 15, 2008, at 7:35 PM, 
mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote:



i've got a bound table view. is it possible to use a different 
value transformer based on which row of the table is being 
displayed/edited? and if so, how?





Yes, you can. The formatter is a property of the cell, and not the 
column, per se. You need an object that is the tableview's 
delegate, then implement 
-tableView:willDisplayCell:forTableColumn:row:. NSCell has a 
-setFormatter: method for your convenience. I have used this 
successfully without error, but I haven't performance tested it. I 
don't suspect that it is much slower.



HTH,


Keary Suska

Esoteritech, Inc.

Demystifying technology for your home or business

___

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

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

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

This email sent to [EMAIL PROTECTED]


NSAlert?

2008-10-18 Thread Pierce Freeman
Hi everyone.

I have been attempting to create a NSAlert popup and get the result (so it
can run an if statement) for the last few hours, but I still can't get it to
work.  My current code is below, if anyone wants to have a look see... If
anyone could point me in the right direction, it would be much appreciated!


Sincerely,

Pierce F.


-- Code --

-(void)someFunction
{
NSAlert * askToContinue = [NSAlert alertWithMessageText:@Message
defaultButton:@Button 1
   aleternateButton:@Button 2
 otherButton:nil
informativeTextWithFormat:@Message to
User];


[askToContinue runModal];
}



- (void)alertEnded:(NSAlert *)alert
  code:(int)choice
   context:(void *)inContextOfItem
{
if (choice != NSAlertDefaultReturn)
{
// Do something
}

}



-- End Code --


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSAlert?

2008-10-18 Thread Jason Coco


On Oct 18, 2008, at 14:35 , Pierce Freeman wrote:


Hi everyone.

I have been attempting to create a NSAlert popup and get the result  
(so it
can run an if statement) for the last few hours, but I still can't  
get it to
work.  My current code is below, if anyone wants to have a look  
see... If
anyone could point me in the right direction, it would be much  
appreciated!


the runModal message blocks until the alert is cleared and then  
returns the code
directly. If you want the alert message to be async, you should send  
the beginSheetModalForWindow

message (see the NSAlert documentation...)

To make your code work, simply do something like this:

if( [askToContinue runModal] != NSAlertDefaultReturn ) {
// do something interesting...
}


Sincerely,

Pierce F.


-- Code --

-(void)someFunction
{
NSAlert * askToContinue = [NSAlert alertWithMessageText:@Message
defaultButton:@Button 1
   
aleternateButton:@Button 2

otherButton:nil
   informativeTextWithFormat:@Message to
User];


   [askToContinue runModal];
}



- (void)alertEnded:(NSAlert *)alert
 code:(int)choice
  context:(void *)inContextOfItem
{
   if (choice != NSAlertDefaultReturn)
   {
   // Do something
   }

}



-- End Code --


___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/jason.coco 
%40gmail.com


This email sent to [EMAIL PROTECTED]




smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: NSAlert?

2008-10-18 Thread Pierce Freeman
Thanks for your help.  However, Xcode gives me this warning when I build:

 NSAlert' may not respond to
'+alertWithMessageText:defaultButton:aleternateButton:otherButton:informativ
eTextWithFormat:'


Sincerely,

Pierce F.



On 10/18/08 12:26 PM, Jason Coco [EMAIL PROTECTED] wrote:

 
 On Oct 18, 2008, at 14:35 , Pierce Freeman wrote:
 
 Hi everyone.
 
 I have been attempting to create a NSAlert popup and get the result
 (so it
 can run an if statement) for the last few hours, but I still can't
 get it to
 work.  My current code is below, if anyone wants to have a look
 see... If
 anyone could point me in the right direction, it would be much
 appreciated!
 
 the runModal message blocks until the alert is cleared and then
 returns the code
 directly. If you want the alert message to be async, you should send
 the beginSheetModalForWindow
 message (see the NSAlert documentation...)
 
 To make your code work, simply do something like this:
 
 if( [askToContinue runModal] != NSAlertDefaultReturn ) {
 // do something interesting...
 }
 
 Sincerely,
 
 Pierce F.
 
 
 -- Code --
 
 -(void)someFunction
 {
 NSAlert * askToContinue = [NSAlert alertWithMessageText:@Message
 defaultButton:@Button 1
 
 aleternateButton:@Button 2
 otherButton:nil
informativeTextWithFormat:@Message to
 User];
 
 
[askToContinue runModal];
 }
 
 
 
 - (void)alertEnded:(NSAlert *)alert
  code:(int)choice
   context:(void *)inContextOfItem
 {
if (choice != NSAlertDefaultReturn)
{
// Do something
}
 
 }
 
 
 
 -- End Code --
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/jason.coco
 %40gmail.com
 
 This email sent to [EMAIL PROTECTED]
 


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSAlert?

2008-10-18 Thread Jason Coco


On Oct 18, 2008, at 15:43 , Pierce Freeman wrote:

Thanks for your help.  However, Xcode gives me this warning when I  
build:


NSAlert' may not respond to
'+ 
alertWithMessageText:defaultButton:aleternateButton:otherButton:informativ

eTextWithFormat:'


alternateButton is spelled wrong ;)

J

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: NSAlert?

2008-10-18 Thread Pierce Freeman
Wow, I am completely out of it today. ;)


Thanks for your help,

Pierce F.


On 10/18/08 12:46 PM, Jason Coco [EMAIL PROTECTED] wrote:

 
 On Oct 18, 2008, at 15:43 , Pierce Freeman wrote:
 
 Thanks for your help.  However, Xcode gives me this warning when I
 build:
 
 NSAlert' may not respond to
 '+ 
 alertWithMessageText:defaultButton:aleternateButton:otherButton:informativ
 eTextWithFormat:'
 
 alternateButton is spelled wrong ;)
 
 J


___

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

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

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

This email sent to [EMAIL PROTECTED]


Passing Variables to AppleScript

2008-10-18 Thread Pierce Freeman
Hi everyone.

I am attempting to create a little application that will take an application
name from the user, and then close it for them.  I am attempting do this by
getting the string in Cocoa, then passing this to AppleScript... But I don't
know if Cocoa can pass variables to AppleScript.  I imagine that there must
be some way, as this would be very useful, but if so there is not a lot of
documentation for it (at least using the phrases that I'm using).


Thanks for any help,

Pierce F.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Resize an image view

2008-10-18 Thread Benjamin Dobson

Hi again,

I need to change the size of an NSImageView – specifically, the width.  
After trying the only thing I knew (setFrame:display:) and having that  
fail, I ask: what do I need to do?___


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

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

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

This email sent to [EMAIL PROTECTED]


Re: Resize an image view

2008-10-18 Thread Graham Cox


On 19 Oct 2008, at 9:03 am, Benjamin Dobson wrote:


Hi again,

I need to change the size of an NSImageView – specifically, the  
width. After trying the only thing I knew (setFrame:display:) and  
having that fail, I ask: what do I need to do?


-setFrame:display: is a NSWindow method. -setFrame: is the NSView  
method.



As three or four seconds looking at the docs would have told you.

hth,

Graham___

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

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

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

This email sent to [EMAIL PROTECTED]


Designing reports in Cocoa apps

2008-10-18 Thread Devraj Mukherjee
Hi All,

Wondering if any one has ideas on writing reporting features for Cocoa apps?

We are desinging a billing system and have the need for developing
summary reports (printable).

Thanks.

-- 
I never look back darling, it distracts from the now, Edna Mode (The
Incredibles)
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Designing reports in Cocoa apps

2008-10-18 Thread Kyle Sluder
On Sat, Oct 18, 2008 at 7:23 PM, Devraj Mukherjee [EMAIL PROTECTED] wrote:
 Wondering if any one has ideas on writing reporting features for Cocoa apps?

Well, only you can determine how to collect the data you need for the report.

Once you've done that, some developers use a WebView.  This has a few
advantages; you don't have to write the drawing code yourself, and you
can reuse any layouts you may use for web-based reporting.  On the
downside, it involves dragging WebKit into your app and dealing with
the DOM.  This method is also usually unusable for any sort of
charting or other non-traditional reporting.

Others go the traditional route and write a custom NSView that they
print.  You have to draw it yourself, but this gives you far more
control -- particularly useful when you want to know about the paper
size and orientation, or other variables specific to printing.  You'll
get better results this way, but you'll probably put a lot more effort
into it.

HTH,
--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 [EMAIL PROTECTED]


Re: Passing Variables to AppleScript

2008-10-18 Thread Kyle Sluder
On Sat, Oct 18, 2008 at 4:05 PM, Pierce Freeman
[EMAIL PROTECTED] wrote:
 I am attempting to create a little application that will take an application
 name from the user, and then close it for them.  I am attempting do this by
 getting the string in Cocoa, then passing this to AppleScript... But I don't
 know if Cocoa can pass variables to AppleScript.  I imagine that there must
 be some way, as this would be very useful, but if so there is not a lot of
 documentation for it (at least using the phrases that I'm using).

Expect has to jump in here at any moment touting the virtues of AppScript.  g

What you're actually looking to do is send a Quit Apple Event to the
user's selected application.  This is what the Quit item on an
application's Dock tile does, as does hitting Cmd-Q on the Cmd-Tab
switcher.  AppleScript is a human-readable syntax for creating Apple
Event descriptors.  Apple Events is an IPC protocol, and AppleScript
allows end-users to take advantage of it.

So forget about AppleScript for now.  As far as Apple Events is
concerned, to send one to another app, you construct an Apple Event
descriptor.  If you want to go the standard route, you can find the
documentation here:
http://developer.apple.com/documentation/AppleScript/Conceptual/AppleEvents/intro_aepg/chapter_1_section_1.html

Mike Ash has kindly built a nice library called AEVTBuilder that makes
constructing Apple Events far more intuitive.  You can find more info
about it here: http://www.cocoadev.com/index.pl?AEVTBuilder

Good luck!
--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 [EMAIL PROTECTED]


Re: WIndow from external framework not working

2008-10-18 Thread Michael Ash
On Fri, Oct 17, 2008 at 5:07 PM, Samir Patel [EMAIL PROTECTED] wrote:
 I have a simple external Cocoa framework I have built that loads and displays 
 a single nib-based window from a nib file contained in the framework. I add 
 the framework to a separate application. Everything works fine - the window 
 loads and appears on screen and all the outlets are valid.

 But when I try to click a button in the window, nothing happens, and none of 
 my actions get sent. The application that the window is added to/created from 
 also starts to exhibit weird behavior, becoming intermittently unresponsive 
 and having other things in the app itself stop working.

 What am I missing? Is there something I need to do to the window after 
 creating it to make it interoperate correctly with the main application?

First, forget about from external framework. Code cannot know what
is calling it*. Code that works in an application will also work in a
framework. It is possible that you're directing Cocoa to look for
resources in the wrong place (the resources are in the framework but
you implicitly told it to search the application, for example), but
that's not quite the same.

Your symptoms sound a lot like what happens when there's an uncaught
exception. All sorts of stuff gets screwed up if you throw an
exception through code that doesn't expect it, which can leave the
framework in an inconsistent state. Does anything show up in your run
log or debugger log?

* Technically it is possible to find out whether a method or function
was called from application or framework code, and even which
framework. But it's unorthodox and evil, and rare to the point that
I've never even heard of anyone besides myself doing it.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: 10.4 v. 10.5 SDK question

2008-10-18 Thread Michael Ash
On Sat, Oct 18, 2008 at 9:55 AM, Steve Cronin [EMAIL PROTECTED] wrote:
 Since my goal was to deploy to 10.4 all along, by using the 10.4 SDK, the
 app will behave the same on both 10.4 and 10.5 (and 10.6) -- simpler from a
 support perspective.
 In some cases the behavior might be consistently wrong perhaps but any such
 incorrectness can be cured on both OSes by the same workaround -- simpler
 development and testing

Perhaps I'm mistaken, but you seem to be putting far more weight
behind this than it deserves.

Code built using the 10.4 SDK can still break on the 10.5 SDK for all
sorts of reasons, including but not limited to:

- Not all bug fixes get the special casing described. Ones which Apple
thinks have a significant installed base of workarounds do, if those
workarounds would break on a fix.

- New bugs are frequently introduced. Since these are almost by
definition not known inside of Apple when they are created, they have
no OS version special casing.

- Details change without either being a new bug or a bug fix. Code
which relies on bad assumptions will work before but not after.

- The SDKs themselves can have bugs which prevent your app from
working when it otherwise should.

Please understand, I'm not saying that your decision is the wrong one.
Quite the contrary, it makes some good sense. But you can't simply
link against the 10.4 SDK and assume that your application will work
consistently and correctly on all future OS versions, although Apple
does try to make it that way to some extent.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: What is A class which must be subclassed ?

2008-10-18 Thread Michael Ash
On Sat, Oct 18, 2008 at 10:43 AM, Jerry Krinock [EMAIL PROTECTED] wrote:
 I have written a class which is missing important behaviors that must be
 provided by subclasses.  I create one like this:

 + (id)fooWithBar:(Bar*)bar_ {
// A Bar instance knows which subclass of Foo is appropriate for it.
// To find out, send it a -fooClass message.
id instance = [[[bar_ fooClass] alloc] init] ;
return [instance autorelease] ;
 }

 I'm trying to figure out what to call this.  I read in Cocoa Design
 Patterns [1] about Abstract Classes, but my Foo doesn't seem to be quite an
 Abstract Class, since you could create one if you wanted to.

The question is not *can* you create one (because in ObjC you can
*always* create an instance of any class), the question is does it
make *sense* to create one. If the answer is yes, then the behavior
it's missing can't be *that* important. If the answer is no, then it's
an abstract class.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Application quits when clicking Ok button is NSBeginCriticalAlertSheet in Tiger OS

2008-10-18 Thread Lance Kwan
Application
quits when clicking Ok button is NSBeginCriticalAlertSheet in Tiger
OS
 
I
am in a admin account when testing the issue.  Please see ISSUE 1 and ISSUE 2
 
ISSUE
1:
Ive
created a User Interface to add a print queue using lpadmin.  In my User 
Interface,
 i set my authorization not as admin.
before  my lpa
dmin
was called, an authentication dialog asking for user name and password
appears
which is expected since i set my authorization to 0. When i click
Cancel in the authentication dialog, i raised my 
 NSBeginCriticalAlertSheet stating queue
not added. When clicking OK button from my  NSBeginCriticalAlertSheet, my 
application
quits.
 
here
is the crash log:
 
Exception:  EXC_BAD_ACCESS (0x0001)
Codes:  KERN_INVALID_ADDRESS (0x0001) at
0x00633000
 
Thread
0 Crashed:
0   com.apple.Foundation   0x92bdfdc0
_NSAddExceptionHandlerForLock + 332
1   com.apple.AppKit0x937caec4
-[NSViewHierarchyLock lockForReadingWithExceptionHandler:] + 368
2   com.apple.AppKit0x937d02a0
-[NSView displayIfNeeded] + 80
3   com.apple.AppKit0x93856f34
-[NSControl mouseDown:] + 184
4   com.apple.AppKit0x937f8890
-[NSWindow sendEvent:] + 4616
5   com.apple.AppKit0x937a18d4
-[NSApplication sendEvent:] + 4172
6   com.apple.AppKit0x93798d10
-[NSApplication run] + 508
7   com.apple.AppKit0x9388987c
NSApplicationMain + 452
 
 
ISSUE
2:
Ive
created a User Interface to add a print queue using lpadmin.  In my User 
Interface,
 i set my authorization not as admin. before my
lpadmin was called, an authentication dialog asking for user name and password
appears
which is expected since i set my authorization to 0. When i click
Ok in the authentication dialog without inputting the correct
username and password, i raised my NSBeginCriticalAlertSheet stating
queue not added. When clicking OK button from my  
NSBeginCriticalAlertSheet, my application
quits.
 
here
is the crash log:
Exception:  EXC_BAD_ACCESS (0x0001)
Codes:  KERN_PROTECTION_FAILURE (0x0002) at
0x004f5000
(null
Unknown
thread crashed with PPC Thread State 64:
  srr0: 0x92bbc180 srr1:
0xd030vrsave: 0x
cr: 0x42000222  xer: 0x2004   lr: 0x92bbc180  
ctr: 0x900017a0
r0: 0x92bbc180   r1: 0xf01017d0   r2: 0x54485244   
r3: 0x
r4: 0x   r5: 0x000d   r6: 0xfff7   
r7: 0x0003
r8: 0x63303000   r9: 0xf01015f5  r10: 0x0001  
r11: 0xa00061ec
   r12: 0x900017a0  r13: 0x  r14: 0x  
r15: 0x
   r16: 0x  r17: 0x  r18: 0x  
r19: 0x
   r20: 0x  r21: 0x  r22: 0x  
r23: 0x
   r24: 0x  r25: 0x0002  r26: 0xa37cd830  
r27: 0x0035e590
   r28: 0x003835a0  r29: 0x0035c8d0  r30: 0x003a8220  
r31: 0x92beb2dc
 
 
 
here
are my snippet codes:
 
 
-(BOOL) createQueue : (AuthorizationRef)
authRef
{
  //launch authentication dialog. 
  
}
 
 
 
- (void)errorSheet:(NSNotification*)aNotification
{
//raise error dialog
NSBeginCriticalAlertSheet(@failed, button1, button2, button3,
nil,self,nil, @selector  
(sheetDidEnd:returnCode:contextInfo:),nil,@queue not added);
}
 
-(void)sheetDidEnd:(NSWindow
*)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
{
//recover error from errorSheet
[[NSNotificationCenter defaultCenter]
postNotification:[NSNotification
notificationWithName:@recoverfromfail object:niluserInfo:
[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber
numberWithBool:(returnCode==NSAlertDefaultReturn)?YES:NO],@recover,nil]]];

}
 
 
 
+ (BOOL)runAsAdmin
{
  OSStatus
status;
  AuthorizationRef
authorizationRef;
  AuthorizationItem
right = { com.mycompany.myapplication.command1, 0, NULL, 0 };
  
  AuthorizationRights
rightSet = { 0, right };/*---
intentionally set to 0 so that i will prompt an   authenticaion
dialog---*/
 
  AuthorizationFlags
flags = kAuthorizationFlagExtendRights |
   kAuthorizationFlagInteractionAllowed;
 
  /*
Create a new AuthorizationRef object, but pass in NULL for the
  AuthorizationRights
set so the AuthorizationRef can be used in future calls. */
 
  status
= AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment,
  kAuthorizationFlagDefaults, authorizationRef);

  if
(status == errAuthorizationSuccess)
  {
 /* Now we can use the AuthorizationRef to
deterimine if the user is
 allowed to 

Updating a Static Text and Slider From High Priority Thread While Resizing a Window

2008-10-18 Thread Peter Zegelin

Hi,

Still fairly new to Cocoa here.

I have a high priority thread that that for the moment just calls back  
as often as possible to a method that updates a static text object  
with the current time. A slider is also updated to a new value. Its a  
bit like a stop watch with a position indicator. This all works well  
until I resize a window or invoke a menu when the whole thing just  
grinds to a halt. If I call std::cout with the value the debugger  
shows a continuous stream of data so I know the thread is still being  
called as often as possible but the text and slider aren't updating.  
Is there any way to get these items to update under these  
circumstances?  I tried calling [label setNeedsDisplay] but that just  
caused a crash.



thanks!

Peter Zegelin
___

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

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

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

This email sent to [EMAIL PROTECTED]


Application quit in NSBeginAlertSheet

2008-10-18 Thread Lance Kwan
I am in a admin account when testing the issue.  
Ive created a User Interface to add a print queue using lpadmin.  In my User 
Interface,
i set my authorization not as admin. before  my lpa
dmin was called, an authentication dialog asking for user name and password
appears which is expected since i set my authorization to 0. When i click 
Cancel in the authentication dialog, i raised my
NSBeginCriticalAlertSheet stating queue not added. When clicking OK button 
from my  NSBeginCriticalAlertSheet, my application quits.

here is the crash log:

Exception:  EXC_BAD_ACCESS (0x0001)
Codes:  KERN_INVALID_ADDRESS (0x0001) at 0x00633000

Thread 0 Crashed:
0  com.apple.Foundation  0x92bdfdc0 _NSAddExceptionHandlerForLock + 332
1  com.apple.AppKit0x937caec4 -[NSViewHierarchyLock 
lockForReadingWithExceptionHandler:] + 368
2  com.apple.AppKit0x937d02a0 -[NSView displayIfNeeded] + 80
3  com.apple.AppKit0x93856f34 -[NSControl mouseDown:] + 184
4  com.apple.AppKit0x937f8890 -[NSWindow sendEvent:] + 4616
5  com.apple.AppKit0x937a18d4 -[NSApplication sendEvent:] + 
4172
6  com.apple.AppKit0x93798d10 -[NSApplication run] + 508
7  com.apple.AppKit0x9388987c NSApplicationMain + 452

here are my snippet codes:
-(BOOL) createQueue : (AuthorizationRef) authRef
{
  //launch authentication dialog.

}
- (void)errorSheet:(NSNotification*)aNotification
{
//raise error dialog
NSBeginCriticalAlertSheet(@failed, button1, button2, button3, 
nil,self,nil, @selector (sheetDidEnd:returnCode:contextInfo:),nil,@queue not 
added);
}

-(void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode 
contextInfo:(void *)contextInfo
{
//recover error from errorSheet
[[NSNotificationCenter defaultCenter] postNotification:[NSNotification 
notificationWithName:@recoverfromfail object:nil userInfo:
[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber 
numberWithBool:(returnCode==NSAlertDefaultReturn)?YES:NO],@recover,nil]]];
}


+ (BOOL)runAsAdmin
{
  AuthorizationRights rightSet = { 0, right 
};/*--- intentionally set to 0 so that i will 
prompt an  authenticaion 
dialog---*/

}

Static AuthorizationRef authRef = NULL;
+(AuthorizationRef)authRef
{
return authRef;
}


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.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 [EMAIL PROTECTED]


Re: Updating a Static Text and Slider From High Priority Thread While Resizing a Window

2008-10-18 Thread Andrew Merenbach

On Oct 18, 2008, at 4:23 AM, Peter Zegelin wrote:


Hi,

Still fairly new to Cocoa here.

I have a high priority thread that that for the moment just calls  
back as often as possible to a method that updates a static text  
object with the current time. A slider is also updated to a new  
value. Its a bit like a stop watch with a position indicator. This  
all works well until I resize a window or invoke a menu when the  
whole thing just grinds to a halt. If I call std::cout with the  
value the debugger shows a continuous stream of data so I know the  
thread is still being called as often as possible but the text and  
slider aren't updating. Is there any way to get these items to  
update under these circumstances?  I tried calling [label  
setNeedsDisplay] but that just caused a crash.



thanks!

Peter Zegelin


Hi, Peter,

Is it possible that your GUI objects are being updated from the  
secondary thread?  You'll need to use -performSelectorOnMainThread: to  
channel updates from the high-priority thread to the main thread,  
since only the main thread is allowed to touch the graphical AppKit  
classes (which are generally not threadsafe, with the possible  
exception of NSProgressIndicators).  Hopefully this solves your issue!


Cheers,
Andrew



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Updating a Static Text and Slider From High Priority Thread While Resizing a Window

2008-10-18 Thread Andrew Merenbach


On Oct 18, 2008, at 7:27 PM, Andrew Merenbach wrote:


On Oct 18, 2008, at 4:23 AM, Peter Zegelin wrote:


Hi,

Still fairly new to Cocoa here.

I have a high priority thread that that for the moment just calls  
back as often as possible to a method that updates a static text  
object with the current time. A slider is also updated to a new  
value. Its a bit like a stop watch with a position indicator. This  
all works well until I resize a window or invoke a menu when the  
whole thing just grinds to a halt. If I call std::cout with the  
value the debugger shows a continuous stream of data so I know the  
thread is still being called as often as possible but the text and  
slider aren't updating. Is there any way to get these items to  
update under these circumstances?  I tried calling [label  
setNeedsDisplay] but that just caused a crash.



thanks!

Peter Zegelin


Hi, Peter,

Is it possible that your GUI objects are being updated from the  
secondary thread?  You'll need to use -performSelectorOnMainThread:  
to channel updates from the high-priority thread to the main thread,  
since only the main thread is allowed to touch the graphical AppKit  
classes (which are generally not threadsafe, with the possible  
exception of NSProgressIndicators).  Hopefully this solves your issue!


Cheers,
Andrew



Erm, sorry to respond to myself, but I was lazy -- just for clarity,  
the full methods available are (from the docs):


	- (void)performSelectorOnMainThread:(SEL)aSelector withObject:(id)arg  
waitUntilDone:(BOOL)wait;
	- (void)performSelectorOnMainThread:(SEL)aSelector withObject:(id)arg  
waitUntilDone:(BOOL)wait modes:(NSArray *)array;


-- Andrew

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Views, frames, and bounds

2008-10-18 Thread DKJ
I am unable to understand the relation between the frame and the  
bounds of an NSView. I've read the documentation in the View  
Programming Guide, and also played around with them myself in a  
practice project. In the latter, I tried drawing their rectangles in  
different colours, but couldn't get both to display. So I'm still at a  
loss. Can someone point me towards other documentation that might get  
through the fog?


dkj
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Object is not reachable from this managed object context

2008-10-18 Thread Lakshmi Vyasarajan
It looks to me like you are sharing one MOC between two threads  
(the web service update worker thread and the main thread). You need  
two MOC's.  Write from the worker thread to the worker thread's MOC,  
then tell the main thread to refresh.


I do have two MOC's. Would be kinda weird to get  Object is not  
reachable from this managed object context error if I had only one  
MOC. I am actually rewriting the sync portion of the app to do the  
save on the main thread following the strong discouragement from the  
docs and this forum regarding background saves.




But, would be nice to know what causes the not reachable  error.
*
Original message:


I am developing an application that imports / synchronizes data from a  
web service .   I have a worker thread performing the poll / sync  
routine. After I do the sync I refresh the main thread by calling  
mergeChangesFromContextDidSaveNotification.


I get an exception with reason [Object is not reachable from this  
managed object context].  In the following code, saveComplete is the  
handler for NSManagedObjectContextDidSaveNotification.


-(void)saveComplete:(NSNotification *)notification{
	[self performSelectorOnMainThread:@selector(saveOnMain:)  
withObject:notification waitUntilDone:YES];

}

-(void)saveOnMain:(NSNotification *)notification{
NSLog(@Refreshing main thread);
	NSManagedObjectContext * appContext = [[NSApp delegate]  
managedObjectContext];

[appContext lock];
@try{
		[appContext  
mergeChangesFromContextDidSaveNotification:notification];		

[EMAIL PROTECTED](NSException * exception){

NSLog([exception reason]);
@throw;
[EMAIL PROTECTED]
[appContext unlock];
}


NSLog(@Refresh suceeded);
}

I could not find any references to this error leading me to believe  
that I am doing something completely wrong  and I have no clue what it  
is.


On Oct 16, 2008, at 21:13, Hal Mueller wrote:

It looks to me like you are sharing one MOC between two threads (the  
web service update worker thread and the main thread). You need two  
MOC's.  Write from the worker thread to the worker thread's MOC,  
then tell the main thread to refresh.


Hal



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: What is A class which must be subclassed ?

2008-10-18 Thread Jerry Krinock

Thanks for the replies.

Regarding making it a protocol, I don't want to do that because Foo is  
really a class which implements many methods that are common to its  
subclasses.


On 2008 Oct, 18, at 8:53, Andy Lee wrote:

Would it make sense to reorganize so the instantiation is done by  
the Bar class?


Well, actually Foo keeps a weak reference to Bar anyhow.  So, no, not  
really.


On 2008 Oct, 18, at 18:16, Michael Ash wrote:

The question is ... does it make *sense* to create [an instance of  
the base class Foo].


The answer is no.


If the answer is no, then it's an abstract class.


Is my answer a  ^sufficient^ condition so that I can state in my  
documentation that Foo is an abstract class ?


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTextfield in tableColumn changing color slow

2008-10-18 Thread Steven Hamilton


On 16/10/2008, at 11:59 PM, Corbin Dunn wrote:


Hi Steven,

On Oct 16, 2008, at 2:03 AM, Steven Hamilton wrote:


Hi Folks,
I have a core data bound tableColumn that displays a currency  
balance. My NSManagedObject is a custom class that calculates the  
balance from a @sum of related transactions and returns the  
balance. The binding then displays this balance in the tableColumn.  
So far so good. This works fast.


I've implemented the delegate method below to query the NSTextfield  
value and change the color to red if it's less than 0. However,  
when I implement this and scroll the table its slow and jerky.  
Clearly I'm going about this the wrong way. How is it best to  
change the color based on the value of the cell?


- (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell  
forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row;


This is a good way to do it. Do you have a sample to show the slow  
down?


And/or what does your code do in this method?


Hmm, it appears its not this method slowing things down. It's my  
balance method I've added to my account NSManagedobject subclass. The  
balance method fetches all related transactions and tallies them up. I  
think I need to work on some optimisation here or keep a static  
balance that is updated when transactions change.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Views, frames, and bounds

2008-10-18 Thread Jamie Hardt

On Oct 18, 2008, at 8:04 PM, DKJ wrote:

I am unable to understand the relation between the frame and the  
bounds of an NSView. I've read the documentation in the View  
Programming Guide, and also played around with them myself in a  
practice project. In the latter, I tried drawing their rectangles in  
different colours, but couldn't get both to display. So I'm still at  
a loss. Can someone point me towards other documentation that might  
get through the fog?



Do make sure you've read this: http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaViewsGuide/Coordinates/chapter_3_section_3.html#/ 
/apple_ref/doc/uid/TP40002978-CH10-SW9


The -frame and -bounds are two properties of an NSView, both  
rectangles.  The frame is the the position of the view within its  
superview, thus, if you add a subview B to a view A and make it's  
rect {0,0,100,100}, it'll be a 100x100 box in the lower-left corner of  
A.  The bounds give the visible rectangle of the NSView in its own  
coordinate system; by default it has an origin of (0,0) and the same  
dimensions as the frame you gave when you initialized it, but it can  
be modified later.  Thus, the bounds of view B can be {0,0,200,100}  
and this would cause the content of view B to be scrunched 2x from  
left to right.


When you give drawing commands in drawRect, all coordinates you give  
are with regard to the *bounds* of the view.  SO, if you took the  
hypothetical view B above and stroked from (0,0) to (100,0), the  
line would only go halfway across the view (50 pixels), as its   
bounds.size.width are 2x of its frame.size.width.


Hope this helps.  Post your code, as you might have the rects all  
right but may be doing something else incorrectly.



Jamie Hardt
The Sound Department
http://www.soundepartment.com/
http://www.imdb.com/name/nm0362504/

___

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

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

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

This email sent to [EMAIL PROTECTED]