Re: ObjC Question - labeled arguments

2008-05-22 Thread Peter Zegelin
OK - thanks everyone I think I understand now. Funnily enough a while  
after I posted I was thinking that that is why many methods are  
labeled 'doSomethingWith...' and I should rename the method to  
something like Graham suggested  
(resetRulerStyleWithNewStyle:newSize:newScale:textLocation)


Also I appreciate how labeled parameters would make everything much  
more readable - that's why I was trying to figure out how it worked  
and hence my question.



thanks again to all who responded,

Peter




On 22/05/2008, at 3:44 PM, Graham Cox wrote:



On 22 May 2008, at 2:48 pm, Peter Zegelin wrote:


New(ish) here.

After all the talk about the best way to learn Cocoa I thought I'd  
better brush up on my obj-c. I've been able to get an amazing  
distance without really understanding a lot as I am mainly using  
Cocoa as a gui around some C++ code and have been able to get a  
long way just by wiring things up in IB and reusing some example  
code. However when messaging an object with multiple parameters I  
have never been able to use labeled arguments - only unlabeled.  
However on a hunch I removed the first label and it worked.


Here is the method I was trying to call:

- (void)reset:(RulerStyle*)newStyle:(int)newSide:(int)textLoc: 
(double)newScale;


I have been calling it like so:

[horizontalRuler reset:style:1:1:1.0];

trying to use:

[horizontalRuler reset newStyle:style newSide:2 textLoc:1 newScale: 
1.0];


obviously didn't work, but if I remove the first label:



You haven't actually given your parameters a label. Your method  
signature above is: reset



if you wanted to call it reset:newSide:textLoc:, it would have been  
declared like this:


- (void) reset:(RulerStyle*) newStyle newSize:(int) newSide textLoc: 
(int) newScale;




Now, the point of all this syntax is readability - it should be  
obvious what a method does in broad terms from its name, and it  
should read reasonably naturally. That leads to somewhat verbose  
method names in some cases, but the little bit of extra typing now  
pays off a thousand-fold when you have to maintain the code. It also  
leads you away from errors like this one, because the second it  
doesn't read right, you might suspect you made a mistake. (For  
example, I can't tell if you intended your method to have three or  
four parameters - it's ambiguous).


So I'd respectfully suggest having a good think about how to make  
your method name be self-describing. Something like:


- (void) resetRulerStyleWithNewStyle:newSize:newScale:textLocation:

So when you see this used in code, you're not left guessing what all  
those numbers in the parameter list mean, as you are for most other  
languages. You *can* use unlabelled parameters, but I don't think  
anybody actually does, because it negates a genuine advantage of the  
Obj-C language.


Coming up with descriptive names that really work is hard, but it's  
well worth thinking about.


Also, use whitespace to separate things out - it costs nothing and  
makes code infinitely easier to read. One reason you might have  
fallen into the trap you did was because there are no spaces between  
the items in the parameter list; I think you're off by one somewhere  
half way along. I've looked at it several times and can't tell if  
you mean that textLoc is a separate parameter from newScale, or if  
newScale is just the variable used to pass textLoc. I can't tell,  
and presumably the compiler will have trouble as well.



hth,

G.


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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]


ObjC Question - labeled arguments

2008-05-22 Thread Johnny Lundy
You're correct - there is no first argument per se: it is part of the  
method selector, together they are called a keyword.


http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/chapter_3_section_3.html

A message with a single argument affixes a colon to the selector name  
and puts the argument right after the colon. This construct is called  
a keyword ; a keyword ends with a colon, and an argument follows the  
colon. Thus we could diagram a message expression with a single  
argument (and assignment) as the following:


If a message has multiple arguments, the selector has multiple  
keywords. A selector name includes all keywords, including colons,  
but does not include anything else, such as return type or parameter  
types. A message expression with multiple keywords (plus assignment)  
could be diagrammed as follows:






Well now I'm a bit confused as I just used the same paragraph to show
that it does. Too much C++ thinking I guess. I'm thinking the method
name is setWidth with two arguments, one unlabeled and the other
labeled with 'height'. Any suggestions where I should brush up on this
- apart from the manual I'm looking at already?

thanks!

Peter


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: ObjC Question - labeled arguments

2008-05-22 Thread Jens Alfke


On 21 May '08, at 10:51 PM, Roland King wrote:

What I don't understand is why adding labels to the 3 unlabelled  
arguments also works as the OP said does, his example was this


  [horizontalRuler reset:style *newSide*:2 *textLoc*:1 *newScale*: 
1.0];


surely the selector of the original is reset so how can you  
even call it successfully by adding labels to the parameters? Does  
Obj-C do something odd when you have unlabelled arguments and imply  
a labelled argument version from the variable names?


I don't believe this would actually work. There must have been  
something else going on. As you point out, reset and  
reset:newSide:textLoc:newScale: are two entirely different  
selectors, and there's nothing that would transform the first into the  
second. (Especially since that transformation would be ambiguous, if  
there are other methods on that class of the form reset:_:_:_.)


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: creating a resource fork and writing raw bytes to it

2008-05-22 Thread Jens Alfke


On 21 May '08, at 10:50 PM, Charles Srstka wrote:

What becomes the purpose of the Carbon File Manager, anyway? Cocoa's  
already got a file manager. And yet even after seven years, with all  
the new APIs, new language features, and new paradigms that have  
been added to Cocoa, its file manager still has absolutely no  
support for forks or anything non-path based.


It's not Cocoa's goal to provide Objective-C APIs to every single  
feature of the system, just to the most common ones that are used in  
applications. If you compare Files.h with NSFileManager, it's like  
night and day — the former is an enormous API (even if you filter out  
the old deprecated functions) that provides a lot of functionality  
that isn't present in the latter. And vital functionality too, for the  
OS as a whole, even if most apps don't need it.


Similarly for LaunchServices vs NSWorkspace, or Quartz vs  
NSGraphicsContext/NSBezierPath, or NSStream vs CFStream vs BSD  
sockets. In fact it's not really vs. They both exist, and you use  
whichever you need. Neither level is going away.


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Moving SplitView Divider Position

2008-05-22 Thread Jens Alfke


On 21 May '08, at 10:45 PM, Apparao Mulpuri wrote:


Is there any provision to change the NSSplitView divider position
programmatically(with out using mouse).


Yes, in 10.5:

- (void)setPosition:(CGFloat)position ofDividerAtIndex: 
(NSInteger)dividerIndex;


You can do it in 10.4, but you have to use the Accessibility API to  
adjust a property (sorry, I don't have any code handy that does this,  
but I'm sure it's been discussed here in the past.)


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: creating a resource fork and writing raw bytes to it

2008-05-22 Thread Charles Srstka

On May 22, 2008, at 1:40 AM, Jens Alfke wrote:



On 21 May '08, at 10:50 PM, Charles Srstka wrote:

What becomes the purpose of the Carbon File Manager, anyway?  
Cocoa's already got a file manager. And yet even after seven years,  
with all the new APIs, new language features, and new paradigms  
that have been added to Cocoa, its file manager still has  
absolutely no support for forks or anything non-path based.


It's not Cocoa's goal to provide Objective-C APIs to every single  
feature of the system, just to the most common ones that are used in  
applications. If you compare Files.h with NSFileManager, it's like  
night and day — the former is an enormous API (even if you filter  
out the old deprecated functions) that provides a lot of  
functionality that isn't present in the latter. And vital  
functionality too, for the OS as a whole, even if most apps don't  
need it.


Is it really vital functionality, though? Resource forks have been  
deprecated for some time now, and FSRefs, while useful and well-liked  
by many users, don't really seem to be on Apple's radar these days.  
FSRefs are also highly filesystem-dependent, and HFS+, the only file  
system (as far as I know) that currently fully supports them, is  
showing its age and ready to be replaced, possibly by a file system  
like ZFS that wasn't invented by Apple.


Charles___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: fundamental question: how do I call controller methods from other classes?

2008-05-22 Thread Jens Alfke


On 21 May '08, at 9:42 PM, Johnny Lundy wrote:

I still don't know how to call one class from another (the reason I  
always only have one class in my projects)


Yow! That's kind of a fundamental issue. Sort of like I still don't  
know how knights move, so I just leave them where they started. I  
don't mean that to make fun; but rather to stress that you should  
really take a look at the various example Cocoa apps in /Developer/ 
Examples and online, and study them to see how they do things. (The  
very simple ones may only have one class, but the larger ones have  
several.)


You're not going to be able to get beyond trivial apps without being  
able to coordinate multiple classes. Really. Almost any serious  
application has dozens or hundreds of custom classes in it.


If both objects are in the nib, make an outlet in one and wire it to  
the other.


If one object creates the other, remember that pointer in an instance  
variable.


If the created object needs to call back to the one that created it,  
the creator could pass itself as a parameter to the created object's  
init method, or call a setter afterwards; but often, if the created  
object is part of the data model, it shouldn't know or care who  
created it. Instead the controller object should observe notifications.


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: fundamental question: how do I call controller methods from other classes?

2008-05-22 Thread Graham Cox


On 22 May 2008, at 3:53 pm, Johnny Lundy wrote:


Oh, I have no problem invoking API methods that are built-in to Cocoa.

It's dealing with two of my own classes that I never understood.


OK, well alright, here's the secret: there is no difference!


I was referring to something like the following trivial setup:

Two custom classes in my project, MyClassA and MyClassB, each with  
its .h and .m files.


Assume MyClassB has an instance method - (id) solve:aFoo.

I want to send the solve: message to an instance of MyClassB from  
MyClassA.


Now IF MyClassB were instantiated, and IF its instance were  
myClassBInstance, I could write


id myBar = [myClassBInstance solve:myFoo];

From one of my instance methods in MyClassA's instance. (Which would  
have been somehow instantiated).


The problem: how to instantiate MyClassB so that it actually HAS a  
solve: method to send a message to.


I did this once in a project just to see if it would work: from  
inside an instance method of MyClassA:


MyClassB *myClassBInstance = [[MyClassB alloc] init];
id myBar = [myClassBInstance solve:myFoo];

And it worked, but it seemed like such a kludge that I just  
incorporated both classes together.


That's exactly right. Not sure why you think it's a kludge - possibly  
because in a trivial example case like this it seems pointless to have  
two separate objects when one will do perfectly. That doesn't mean  
your example is wrong, it just means the example doesn't give much  
insight as to *why* you'd do this. The example illustrates only the  
*how* and does so perfectly!


The advantage comes when your designs get more complex. Objects give  
you a clean separation of responsibilities. Why doesn't NSString deal  
with bezier paths? After all, it *could*, but it would be a crazy  
design, since sometimes you want one and not the other, and they don't  
seem related.


Deciding where to break responsibilities down into separate classes is  
an art, I have not seen too many text books going into that too much.  
The M-V-C paradigm is a shorthand guide to one useful approach to  
where certain responsibilities lie, but believe me, there are many  
fuzzy edges in between.


Besides, if you don't have IB to instantiate a class, how can you do  
it? If there is no instance of the class, where would you invoke the  
alloc/init messages from? From main()?


Well, it depends. But never main() - I never touch main in a Cocoa  
project.


I usually instantiate objects on a need to use basis. So if my class  
always needs certain objects, I might instantiate them in my init  
method (and thus get rid of them in my dealloc method). Or at any  
other time that I need something that another object can do for me.


Example, I have a custom view class. In my -drawRect method I'd like  
to draw a solid red box somewhat inside my bounds.


- (void)drawRect:(NSRect) updateRect
{
	// I want to draw a box inside my bounds. So get the bounds and inset  
it:


NSRect myRect = NSInsetRect([self bounds], 10, 10 );

	// I'd like it drawn in red. I can use the NSColor class to set that  
up:


	NSColor* red = [NSColor redColor];	// get an instance of NSColor I'm  
calling red...

[red set];  // ...and make it the current 
drawing colour

	// Hmm, I can't be bothered to work out how to fill the rect pixel by  
pixel in video memory, but I know another object that can do it

// for me, so let's just make one and give him the job:

	NSBezierPath* myPath = [NSBezierPath bezierPathWithRect:myRect];	//  
get a new bezier path instance based on my rect...

[myPath fill];  
// ...and make it fill itself

// OK, job done - and I barely got my hands dirty ;-)
}

Note that in this case the objects are instantiated by their class  
convenience methods, and autoreleased. But it would be equally valid  
to use alloc + init and then release them directly when you're done  
with them. Here we are using Cocoa's own objects, but if you had a  
class you made called 'MyColouredRectFiller' for example, you could  
make one of those, hand the job to it then throw it away afterwards.  
Why bother, when you can just write the code right here? Well, suppose  
you have another completely unrelated place where you want to draw a  
coloured rect. You can use a MyColouredRectFiller there too which  
you've already written and debugged for this case. So just use it.  
That's the real benefit of objects - reusing code that you already  
wrote and debugged once, so you can save time by not having to do it  
again. When objects get more complex this time saving is very, very  
significant. And when whole projects get more complex, it's about the  
only way that makes it even remotely manageable.


You might argue that this is just the same as having a 'fill rect'  
procedure that you can call from two places, and so it is. But once  

Re: ObjC Question - labeled arguments

2008-05-22 Thread Peter Zegelin

Um - hangs head in embarrassment.

It compiles but indeed it doesn't work (unrecognized selector ). After  
I got it to compile I thought Aha! not realizing the confusion my  
little question about labeled arguments would cause.


Sorry about that - I'm flabbergasted that I have got so far with so  
little understanding!!


Peter

Sorry also about the mail mixup :-(


On 22/05/2008, at 4:33 PM, Jens Alfke wrote:



On 21 May '08, at 10:51 PM, Roland King wrote:

What I don't understand is why adding labels to the 3 unlabelled  
arguments also works as the OP said does, his example was this


[horizontalRuler reset:style *newSide*:2 *textLoc*:1 *newScale*:1.0];

surely the selector of the original is reset so how can you  
even call it successfully by adding labels to the parameters? Does  
Obj-C do something odd when you have unlabelled arguments and imply  
a labelled argument version from the variable names?


I don't believe this would actually work. There must have been  
something else going on. As you point out, reset and  
reset:newSide:textLoc:newScale: are two entirely different  
selectors, and there's nothing that would transform the first into  
the second. (Especially since that transformation would be  
ambiguous, if there are other methods on that class of the form  
reset:_:_:_.)


—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/peter%40fracturedsoftware.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: creating a resource fork and writing raw bytes to it

2008-05-22 Thread Mike Fischer

Am 22.05.2008 um 07:50 schrieb Charles Srstka:


On May 22, 2008, at 12:09 AM, Mike Fischer wrote:

Anyway I remember reading somewhere that Apple warned about  
relying on ..namedfork/rsrc always working. I can't find the  
reference at the moment though.


That was WWDC 2006, in which the speaker for one of the sessions  
commented that the /rsrc hack was going to be removed from Leopard.  
It didn't say anything about ..namedfork, though - just /rsrc,  
which I don't think anyone really uses anymore. Of course, /rsrc  
still works in Leopard, so who knows.


Here is the reference I was thinking of, but I was wrong:
http://lists.apple.com/archives/filesystem-dev/2008/Feb/msg00017.html


Quinn [EMAIL PROTECTED] wrote on 02/20/2008 20:59:44 +:

[Talking about Tiger...]

Also, the kernel did not provide stream access to the resource fork.
You could get and set the resource fork via the extended attributes
API, but you could not open a file descriptor to the resource fork on
all file systems.  The foo/..namedfork/rsrc trick would work on
volumes that supported the resource fork natively, but would not work
on volumes that stored the resource fork in an AppleDouble file.

o In 10.5 we got rid of the File Manager's AppleDouble code.  File
Manager now (more-or-less) treats all volumes the same.  The
implementation of the native/AppleDouble abstraction layer is now
done entirely within the kernel.

This means that, when you access metadata via BSD APIs, you're
accessing through exactly the same API that File Manager uses.
Neat-o!  It also means that you can do the ..namedfork/rsrc trick
on all volumes [1].  For example:



So the situation actually got better and it seems that ..namedfork/ 
rsrc is now supported on all volume formats. Sorry about the confusion.



Mike
--
Mike Fischer Softwareentwicklung, EDV-Beratung
Schulung, Vertrieb
Note: I read this list in digest mode!
  Send me a private copy for faster responses.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: ANN: Step by step introduction to programming with Cocoa

2008-05-22 Thread Harry
There are also a couple of wiki-book projects on
Learning Cocoa.

Here are links:

http://en.wikibooks.org/wiki/Programming_Mac_OS_X_with_Cocoa_for_beginners


http://en.wikibooks.org/wiki/Programming:Cocoa



 Date: Wed, 21 May 2008 12:33:12 -0700 (PDT)
 From: Erik Buck [EMAIL PROTECTED]
 Subject: ANN: Step by step introduction to
programming with Cocoa
 To: cocoa-dev@lists.apple.com
 Message-ID:
[EMAIL PROTECTED]
 Content-Type: text/plain; charset=iso-8859-1

 I have started a guided introduction to Cocoa
programming at the  
 Cocoadev wiki site: http://www.cocoadev.com/

   The goal is to provide an sequence in which to
learn Cocoa and  
 links to the basic information.  My hope is that by
just stating a  
 step by step sequence of topics, users will be able
to navigate  
 through the huge number of concepts in an orderly
fashion.

  
http://www.cocoadev.com/index.pl?CocoaPrerequisites
   http://www.cocoadev.com/index.pl?CocoaStepOne
   http://www.cocoadev.com/index.pl?CocoaStepTwo

   This is a wiki, and it isn't even _my_ wiki.  By
all means,  
 contribute to the material.

This is a generous act on your part.
It is likely to require a lot of time and effort.
I will be glad to contribute as time allows and my
knowledge of the  
system increases.
It provides motivation for keeping a record of
difficulties  
encountered and resolved (and perhaps also ones that
have not been  
resolved?)

I suggested some time back (A documetation suggestion
19 May 2008  
13:31:30) but no one took me up on it,  the idea of
seeing if Apple  
would so to speak donate a copy of their
documentation so it could  
be used as the basis for a wiki.
That documentation is a tremendous resource, a basis
to which could  
be added examples, explanations etc., to make it more
generally  
accesible, illuminate the small things that
occasionally impede  
understanding.

Actually the idea was to include a text box at the end
of each  
section where people could post queries regarding that
section, e.g.   
questions about something they did not understand or
something which  
did not quite work as expected etc and which would
then cause an  
email containing that query to be sent to a discussion
list, e.g.  
like the present one, where people's replies would
then be included  
in the section the query came from. This would give
the thing the  
structure of an FAQ.
I would keep it all very simple and very basic so it
stays managable.
If useful it would acquire its own dynamic.

The idea has virtues
1. We discover exactly where the difficulties lie.
2. There is a build up of information concerning a
specific problem  
all in the same place.
3. People are encouraged to explore the documentation
4. The documentation becomes up to date, errors are
corrected etc.
5. There is little extra effort expended in providing
the answers  
than would be spent doing so on this list
6. The context of the question and the reply is that
much more clear
7. It could result in a pretty good piece of
documentation.


I thought i would just throw the idea into the ring
again

all the best
Julius

http://juliuspaintings.co.uk



  
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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]


NSConnection does not close ports

2008-05-22 Thread Gerriet M. Denkmann
I have a server, which does create an NSConnection on some  
NSSocketPort and publishes this fact via Bonjour.
A client opens a connection, sends some messages via Distributed  
Objects, and closes it again.

This implies opening and closing a few file descriptors on sockets.

Works fine. Usually.

But sometimes some of these socket file descriptors get NOT closed,  
so they accumulate slowly and when the limit set in limit() is  
reached, the client blocks forever.


So there are a two bugs (hopefully not mine):
1. these file descriptors should get closed, and
2. the client should get an error message or an exception instead  
just blocking forever.
But as this is 10.4.11 there is no chance that these bugs (if not  
indeed mine) will ever get fixed.


Questions:
What stupidity on my side could be the reason of the sockets not  
being closed?
If someone is interested, I can show the details of the creation of  
the NSConnection.


When should these sockets get closed? I have (using lsof) observed  
that these sometimes disappear immediately after the conversation,  
sometimes linger on for some time - to be removed eventually; and  
sometimes linger on indefinitely.


How does the server notice when the client does:
[connectionToServer invalidate]; [connectionToServer release]; ?
I assume that the sockets used for the conversation should be closed  
at this point. Correct?


My current workaround:
for i in gettablesize() do
fstat(i);
if not S_IFSOCK then continue;
getsockname()
if port ≠ MyPort continue;
count++
endfor
if count  5 then close(oldest file descriptor)

Not very elegant; not even sure it will work - this bug is not really  
reproducible - only time will tell.

But maybe someone has a better idea.


Kind regards,

Gerriet.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: ObjC Question - labeled arguments

2008-05-22 Thread Bill Bumgarner

On May 21, 2008, at 11:20 PM, Johnny Lundy wrote:
You're correct - there is no first argument per se: it is part of  
the method selector, together they are called a keyword.


http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/chapter_3_section_3.html

A message with a single argument affixes a colon to the selector  
name and puts the argument right after the colon. This construct is  
called a keyword ; a keyword ends with a colon, and an argument  
follows the colon. Thus we could diagram a message expression with a  
single argument (and assignment) as the following:


If a message has multiple arguments, the selector has multiple  
keywords. A selector name includes all keywords, including  
colons, but does not include anything else, such as return type or  
parameter types. A message expression with multiple keywords (plus  
assignment) could be diagrammed as follows:


I should clarify my previous statement slightly in light of this  
particular conceptual document.


I said:

Objective-C does not have named arguments.  Nor does it have keyword  
arguments.


Quite specifically, Objective-C has no notion of the arguments  
arriving at the call site with any kind of labels applied to them.   
That is, the sub-parts of the method name -- of the selector -- are  
not optional, nor can the order be varied.


Named arguments and keyword arguments often carry the implication  
that the arguments to a method can vary at runtime;  can have default  
values, can be in a different order, can possibly have additional  
named arguments, etc...   This implication would further seem to be  
supported by the at-runtime method dispatch resolution featured within  
Objective-C.


Yet, this is exactly *not* how Objective-C works.   For all intents  
and purposes, an Objective-C method declaration is simply a C function  
that prepends two additional arguments;  self and _cmd.


That is, this

- (BOOL) doSomethingNeat:(NeatMode) aMode toThisThing: (Thing *) aThing;

 is equivalent to this function...

BOOL doSomethingNeatFunc(id self, SEL _cmd, NeatMode aMode, Thing  
*aThing);


... as far as the compiler type resolver is concerned.   The order,  
type and number of arguments is absolutely fixed (var-args being the  
one exception;  same rules apply as C).


This is quite distinctly different than the named or keyword arguments  
available in a language like Python:


def func(a, b, NeatMode=SuperNeat, Thing=DefaultThing):
pass

Where Thing (and NeatMode) might be omitted or might have different  
values when called.


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


Re: creating a resource fork and writing raw bytes to it

2008-05-22 Thread Mike Fischer

Am 22.05.2008 um 08:49 schrieb Charles Srstka:

Is it really vital functionality, though? Resource forks have been  
deprecated for some time now, and FSRefs, while useful and well- 
liked by many users, don't really seem to be on Apple's radar these  
days.


Certain parts of Apple have never had them on their radar,  
unfortunatly ;-) Still they have seen steady improvement and don't  
have that rotten smell that some other APIs seem to aquire as of late.




FSRefs are also highly filesystem-dependent,


They are? That's news to me. In what way?


and HFS+, the only file system (as far as I know) that currently  
fully supports them,


I think you might be confusing the API with features of the file  
system? Apple has done a fairly good job of simulating missing  
feature on file systems that make this necessary. FinderInfo and  
Resource Forks come to mind. They work fine on FAT, SMB, ISO9660, ...



is showing its age and ready to be replaced, possibly by a file  
system like ZFS that wasn't invented by Apple.


So? That's just another file system that might or might not support  
certain features natively. The API should protect you from these  
differences.


The only thing the File Manager API is missing is good support for  
POSIX functionality like symbolic  hard links and unlink(2).



Mike
--
Mike Fischer Softwareentwicklung, EDV-Beratung
Schulung, Vertrieb
Note: I read this list in digest mode!
  Send me a private copy for faster responses.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: connections and the nib lifecycle

2008-05-22 Thread Torsten Curdt


On May 22, 2008, at 05:27, Chris Hanson wrote:


On May 21, 2008, at 11:00 AM, Vijay Malhan wrote:

But the problem is still open for discussion. Is there any  
differences in sequence of events occurring while loading of Nib  
between Tiger and Leopard platforms?


There really should not be, at least not like this.


For some weird reason I can no longer reproduce it : 
( weird ...weird ...weird


 As I explained in my response to Torsten, just instantiating an  
NSWindowController does not cause it to load its nib; invoking - 
[NSWindowController window] causes that to happen as a side-effect.


I would thought initWithWindowNibName would.

Well, at least I learned now when the nib is getting loaded really.

cheers, guys
--
Torsten
___

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

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

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

This email sent to [EMAIL PROTECTED]


NSPasteboard Delegate

2008-05-22 Thread Adil Saleem
Hi, 

I am trying to set my object as delegate of
NSPasteBoard. I am calling from awakeFromNib

NSPasteboard *pb = [NSPasteboard generalPasteboard];
[pb setDelegate:self];


However, on running, it raises exception. There is
also a warning at compile time that says NSPasteboard
may not respond to method setDelegate.

Please tell me how can i set my own class as delegate
of NSPasteboard.

Thanx


  
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: docset for 10.4?

2008-05-22 Thread Torsten Curdt


On May 22, 2008, at 02:44, Scott Anguish wrote:



On May 21, 2008, at 8:03 PM, Shawn Erickson wrote:

On Wed, May 21, 2008 at 4:59 PM, Torsten Curdt [EMAIL PROTECTED]  
wrote:

Anyone know where to get the documentation docset for 10.4?


The current documentation set available online (or on your system if
updated via Xcode) attempts to make it clear what API
methods/functions/etc. are available in the various version of Mac OS
X.

Anyway what in particular are you attempting to understand?


I think you're expected to have 10.4 to have that docset.


Aha

As Shawn says, availability is in all the frameworks. but that  
doesn't help with conceptual differences.


Well, I just found it inconvenient when working on projects with the  
10.4 SDK.


I can't remember, but I'm not 100% that docsets were even supported  
as they are now in 10.4 (i.e. we may never have released the 10.4  
docs in the current docset format)


That's what I feared

cheers
--
Torsten
___

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

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

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

This email sent to [EMAIL PROTECTED]


PDFPage Creation query

2008-05-22 Thread Amrit Majumdar
Hi All,
I am playing around with the PDFKit.

I was planning to create a new PDFDocument, with my own PDF Page that I
generate after subclassing  PDFPage
Accordingly  I subclassed PDFPage and have over-riden the following
menthods.


- (id)initWithImage:(NSImage *)image;


Steps I followed to create a new PDFPage from the data in another PDFPage.


 NSData *myData = [[ pdfDoc pageAtIndex:0 ]dataRepresentation ];
 //retreiving data from pdfDoc, a pre existing PDF.



 NSImage *img = [[NSImage alloc]initWithData:myData];



 MyPDFPageClass *myPDFPage = [[ MyPDFPageClass alloc ]initWithImage:img];



 PDFDocumebnt  *myNewPDFDoc = [[PDFDocument alloc]init];



 [ myNewPDFDoc insertPage:myPDFpage atIndex: 0 ];


 [myPDFView setDocument:myNewPDFDoc];




The pdfDoc in the above code snippet was initialised to an Apple
Documentation PDF.

On the first page it has the title of the doc and an apple logo at the
bottom left hand side.

When the new page is displayed in the PDFView it displays a gray colored
page.

The Apple logo at the bottom of this new page is visible but it is very
faint.No other data present in the original page is visible in this new
page.



Why does this happen?

I am sure I have messed up somewherebut not sure where and how to
proceed to create a new PDFPage in a proper fashion.


How do I proceed?


Best Regards,

Amrit.
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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]


NSTextField does not lose focus

2008-05-22 Thread Torsten Curdt
I've got a NSTextField (on a NSTabView). I open the window. I click  
the text field and enter some text. Now I click on a button next to it.


The value has still not been committed and it still has the cursor.

Then I click outside of the text field (just somewhere in the view)  
and still the NSTextField does not lose it's focus.


What's going on? I looked through options in IB3. What do I need to  
read up on?


cheers
--
Torsten
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: PDFPage Creation query

2008-05-22 Thread Antonio Nunes

On May 22, 2008, at 10:20 AM, Amrit Majumdar wrote:

I was planning to create a new PDFDocument, with my own PDF Page  
that I

generate after subclassing  PDFPage
Accordingly  I subclassed PDFPage and have over-riden [initWithImage]
 [...]
MyPDFPageClass *myPDFPage = [[ MyPDFPageClass  
alloc ]initWithImage:img];



You did not post the code in the overriden initWithImage:, which is  
likely to be the crucial factor in the situation you describe. Having  
said that, I wonder why you would need to override initWithImage:. In  
the code you posted I see no need for that.


You also want to check out and read up on PDFDocument's pageClass  
method. From the header file's commentary:
// This is the class that will be allocated and initialized when  
page objects are created for the document.  The
// default implementation returns [PDFPage class] but if you want  
PDFDocument to use your own custom class you can
// subclass PDFDocument and implement this method to return your own  
custom class.  Your class should be a subclass of

// PDFPage (otherwise the behavior is undefined).


Further, you may have your reasons for wanting to create an image  
based PDF page from any PDF page source, but if you don't, your  
process can be much simpler:


Subclass PDFDocument, and override the pageClass method to return your  
custom PDFPage subclass.


- (Class) pageClass
{
	// Instruct PDFDocument to create MyPDFPageClass objects instead of  
the default PDFPage objects.

return [MyPDFPageClass class];
}


Then load PDF data into your PDFDocument's subclass:

[[MySubclassedPDFDocument alloc] initWithXXX:yyy];

... and the pages will already be of type MyPDFPageClass.

António

---
What you have inside you expresses itself through both your
choice of words and the level of energy you assign to them.
The more healed, whole and connected you feel inside,
the more healing your words will be.

--Rita Goswami
---


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Programmatically get treecontroller selection

2008-05-22 Thread Steven Hamilton

All sorted.

Turns out that in my obsession with bindings and coredata I forgot  
that to communicate with objects in a NIB you need to use Outlets.  
Doh! I've now setup outlets from my datasource to the controllers and  
can pull the selection and context out no problems.


Thanks for bearing with me, and apologies for being such a n00b.

(also, selectionIndexPaths binding is required in the NSOutlineView,  
no idea why either)







On Wed, May 21, 2008 at 10:00 PM, Steven Hamilton [EMAIL PROTECTED]  
wrote:
Fixed that error now. I had a rogue arraycontroller in the NIB file  
from a
previous predicate exercise. The nib is cleaned up and still no  
selection.
It appears that I'm unable to get anything other than NULL from any  
objects

instantiated in the NIB file. My appDelegate holds the code for the
manageObjectContext and my method in my datasource to get that also  
just

returns null. At the moment I'm puting this down to me not quite
understanding Obj-C enough to communicate with out custom objects.  
Going to

go read a book.

For completeness, here is my interface file. Do I have to declare NIB
objects in order to use them like I've done below? I think this is  
where I'm

falling down.

#import Cocoa/Cocoa.h
#import moolahcoredata_AppDelegate.h

@interface MLtableController : NSObject {
  NSOutlineView *MLoutlineView;
  NSTreeController *MLoutlineViewController;
  moolahcoredata_AppDelegate *MLappDelegate;
}

- (void) getSelectedAccount;

@end



On 22/05/2008, at 5:45 AM, Hamish Allan wrote:


I'd like to reiterate what Quincey noted:

BTW, I notice that the Cannot perform operation without a managed
object context error is logged *before* you log default. The
problem is not apparently anything to do with getting the  
selection in

the code you posted, since it happens before you do that.

You should try to find out what causes the Cannot perform...  
message

first and foremost -- perhaps by setting a breakpoint on NSLog()?

Hamish

On Wed, May 21, 2008 at 7:32 PM, Jonathan Dann  
[EMAIL PROTECTED] wrote:


- (void)getSelectedAccount{

NSString *accountName = @Bank;
NSLog(accountName);
accountName = [[MLoutlineViewController selection]
valueForKey:@name];
NSLog(accountName);

//get managedObjectContext in preparation for fetch code
moc = [MLappDelegate managedObjectContext];

}


At first glance, try NSTreeController's -selectedObjects and
-selectedNodes
methods rather than -selection. Also, in my experience I've not  
found is
necessary to bind the selectionIndexPath(s) to the outline view  
to get it

all to work, maybe unbind that as a quick test?

Jon
___

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

Please do not post admin requests or moderator comments to the  
list.

Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/hamish%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/hamish%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]


Core Data: How to encrypt a persistent store

2008-05-22 Thread Ruotger Skupin

Hi,

I have an application which uses Core Data and handles sensitive  
information. Is there an easy way to encrypt the on-disk persistent  
store provided I'm reasonably fluent in libCrypto and do not want to  
use an encrypted disk image?


Ruotger

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Cocoa et al as HCI usability problem

2008-05-22 Thread Robert Cerny

Well,
I just made new bugreport #5955452 to enhance docs sets with more  
sample code inside of method descriptions. I took NSEnumerator's  
nextObject method as a sample how to do it the right way..


http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSEnumerator_Class/Reference/Reference.html#//apple_ref/doc/uid/2142-BCICDDHA 



Btw please keep this discussion going it's great.

Robert
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSPasteboard Delegate

2008-05-22 Thread Citizen
Can you copy and paste your awakeFromNib method and provide more  
detail about the exception raised?


On 22 May 2008, at 08:57, Adil Saleem wrote:


I am trying to set my object as delegate of
NSPasteBoard. I am calling from awakeFromNib

NSPasteboard *pb = [NSPasteboard generalPasteboard];
[pb setDelegate:self];


However, on running, it raises exception. There is
also a warning at compile time that says NSPasteboard
may not respond to method setDelegate.

Please tell me how can i set my own class as delegate
of NSPasteboard.


--
David Kennedy (http://www.zenopolis.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]


File integrity

2008-05-22 Thread slasktrattenator
Hi all,

is there a way to tell if my executable was launched by/attached to
some other process? Basically, I just want to kill myself as soon as I
sense those prying eyes, in order to make it just a little it harder
for the crackers.

TIA
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Core-Data Multithreading question about save

2008-05-22 Thread Dex Morgan


Il giorno 22/mag/08, alle ore 01:00, Hamish Allan ha scritto:


Do you really need to do this after every object inserted? Could you
do it in bulk?


Not necessarily.
I've tried to do this sequence:
- my second thread add objects into second context until the end  
saving each objectID in an array
- after all insertions was finished I call -save: on second context  
then I try to take the object from the main context using the objectID  
saved. However the object seems not updated (all attributes was empty)  
and I've noticed that saved objectID is temporany. I've also tried to  
save both second/first managedobject before doing these actions but  
the id still temporany.
What's I'm wrong? The ID still temporany until I save the second  
managed object but If I can do it I can also make my relationship, the  
overhead it's the same.
The doc says I can pass objects between contexts by the relative ID  
(but if the ID is temp what should I need to pass...?).



Do you really need to do the inserts on a separate thread? Could you
have your worker thread call
performSelectorOnMainThread:withObject:waitUntilDone: and have the
main thread perform the inserts at the end of each run loop iteration?


I need to work in a multithreading environment.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Core Data: How to encrypt a persistent store

2008-05-22 Thread Robert Cerny


On 22.5.2008, at 12:12, Ruotger Skupin wrote:


Hi,

I have an application which uses Core Data and handles sensitive  
information. Is there an easy way to encrypt the on-disk persistent  
store provided I'm reasonably fluent in libCrypto and do not want to  
use an encrypted disk image?


Ruotger

___


Hi,
I believe you need to subclass NSAtomicStore methods load: and save:

HTH
Robert
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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 does not lose focus

2008-05-22 Thread Torsten Curdt


On May 22, 2008, at 11:15, Torsten Curdt wrote:

I've got a NSTextField (on a NSTabView). I open the window. I click  
the text field and enter some text. Now I click on a button next to  
it.


The value has still not been committed and it still has the cursor.

Then I click outside of the text field (just somewhere in the view)  
and still the NSTextField does not lose it's focus.


What's going on? I looked through options in IB3. What do I need to  
read up on?


Got it ...I had to set the firstResponder to nil in the IBAction  
before I access the text field


[[self window] makeFirstResponder: nil];

cheers
--
Torsten
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: File integrity

2008-05-22 Thread Robert Cerny


On 22.5.2008, at 12:35, [EMAIL PROTECTED] wrote:


Hi all,

is there a way to tell if my executable was launched by/attached to
some other process? Basically, I just want to kill myself as soon as I
sense those prying eyes, in order to make it just a little it harder
for the crackers.

TIA


Check this: http://www.steike.com/code/debugging-itunes-with-gdb/

HTH
Robert
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSWindow in main nib.

2008-05-22 Thread Robert Cerny


On 22.5.2008, at 12:52, [EMAIL PROTECTED] wrote:


Hi,
I posted a qustion that about wndow zoom  button.Now i got the  
window by

setting all the intial positions.

Thanks



Sorry I have no idea what are you talking about. Could you please  
rephrase your question? Anyway, please don't cross post.


Robert
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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]


NSWindow in main nib.

2008-05-22 Thread vinitha
Hi,
I posted a qustion that about wndow zoom  button.Now i got the window by
setting all the intial positions.

Thanks

___

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

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

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

This email sent to [EMAIL PROTECTED]


probably OT: using encrypted disk images with NSTask and hdiutil

2008-05-22 Thread Ruotger Skupin

Hi,

To protect sensitive user data I attach an encrypted disk image and  
store the application data there.


I'm using hdiutil with the -passphrase option to create and attach  
encrypted disk images. This is deprecated and obviously not the  
correct way but quite frankly the man file for hdiutil is not very  
helpful:


 -certificate certificate_file
specify a secondary access certificate for the  
image being created.

 -pubkey PK1,PK2,...,PKn
specify a list of public key hashes in ASCII hex  
for the image being created.  The hash(s) will be used to locate a  
public key used to protect an encrypted image.


Is there any example code how to do this in Cocoa?

Ruotger









___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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 does not lose focus

2008-05-22 Thread Robert Cerny


On 22.5.2008, at 11:15, Torsten Curdt wrote:

I've got a NSTextField (on a NSTabView). I open the window. I click  
the text field and enter some text. Now I click on a button next to  
it.


The value has still not been committed and it still has the cursor.

Then I click outside of the text field (just somewhere in the view)  
and still the NSTextField does not lose it's focus.


What's going on? I looked through options in IB3. What do I need to  
read up on?


cheers
--
Torsten


Hey Torsten,
it's the way how GUI works on OSX. Hitting button doesn't steal focus  
from text field, nor clicking in window. You can test this behaviour  
without any code, just inside IB.


1. Start IB
2. Choose Cocoa Window template
3. Drag text field and button into window
4. HIt -R to start Simulator

HTH
Robert___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: File integrity

2008-05-22 Thread Keith Duncan
is there a way to tell if my executable was launched by/attached to  
some other process?


You can use ptrace(2) with the PT_DENY_ATTACH request to prevent  
anyone from attaching and will kill the process if it is already being  
traced.


See http://steike.com/code/debugging-itunes-with-gdb/

This has been worked around using a simple kernel extension, I don't  
know what the current state of it is but it may not be that reliable.



file integrity


You can also use codesign(1) which will alert the user if your binary  
has been tampered with since the signing. Note that it doesn't prevent  
the user from launching your application and the functions for  
determining the integrity of your executable aren't public.


Keith
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to handle bad certificate error in NSURLDownload?

2008-05-22 Thread parag vibhute
Following is code which I have implemented:

- (void)download:(WebDownload *)download didFailWithError:(NSError *)error
{
// release the connection
[download release];
// inform the user
//NSLog(@Download failed! Error - %@ %@,
//[error localizedDescription],
//[[error userInfo]
objectForKey:NSErrorFailingURLStringKey]);



NSURL *url = [[download request] URL];
NSString *path = [url absoluteString];
NSString *description = [error localizedDescription];
NSString *reason = [error localizedFailureReason];

int errorCode = [error code];

if ( (errorCode = NSURLErrorServerCertificateHasBadDate)  (errorCode
= NSURLErrorClientCertificateRejected) )
{
NSURL *failingURL = [[error userInfo] objectForKey:@
NSErrorFailingURLKey];
NSArray *badCerts = [[error userInfo] objectForKey:@
NSErrorPeerCertificateChainKey];

SecPolicySearchRef policySearch = NULL;

if (SecPolicySearchCreate(CSSM_CERT_X_509v3, CSSMOID_APPLE_TP_SSL,
NULL, policySearch) == noErr)
{
SecPolicyRef policy = NULL;
OSStatus status;

while ((status = SecPolicySearchCopyNext(policySearch, policy))
== noErr)
{
SecTrustRef trust = NULL;
if (SecTrustCreateWithCertificates((CFArrayRef)badCerts,
policy, trust) == noErr)
{
SFCertificateTrustPanel *panel =
[SFCertificateTrustPanel sharedCertificateTrustPanel];
NSString *host = [failingURL host];

[panel setDefaultButtonTitle:@Continue];
[panel setAlternateButtonTitle:@Cancel];

if ([panel
respondsToSelector:@selector(setInformativeText:)])
// this method is in Tiger but is undocumented
{
NSString *informativeText = [NSString
stringWithFormat:@Security certificate is invalid for host [EMAIL PROTECTED], 
host];
 [panel performSelector:@selector(setInformativeText:)
withObject:informativeText];
}

[panel setShowsHelp:YES];

NSString *sheetText;
sheetText = [NSString stringWithFormat:@Security
certificate is not valid. Alter trust settings below or click Cancel];
[panel beginSheetForWindow:OUpgradeWindow
   modalDelegate:self
 didEndSelector:@selector
(certificateTrustSheetDidEnd:returnCode:contextInfo:)
 contextInfo:[host retain] // didEndSelector
will release
   trust:trust
 message:sheetText];


CFRelease(trust);
trust = NULL;
   }

   CFRelease(policy);
   policy = NULL;
   } // end while

   CFRelease(policySearch);
   }
   }
   else // Handle other normal download errors
   {

   NSLog( @Download of '%@' failed with error:%d, [EMAIL PROTECTED], path,
errorCode, description );
}
}




- (void)certificateTrustSheetDidEnd:(NSWindow *)sheet
returnCode:(int)returnCode contextInfo:(void *)contextInfo
{
// we set the contextInfo tp the retained host name of the failing URL,
obtained
// from [[error userInfo] objectForKey:@NSErrorFailingURLKey].
// we'll need to release this before returning; done below
NSString *hostName = (NSString *)contextInfo;

// note to self: SecTrustGetResult() useful?

if (returnCode == NSOKButton)
{
// start this download again
[self startDownloadingURL];
}
else // user clicked Cancel
{
NSLog( @Disallowing invalid certificate for host:%@, hostName );
   }

   [hostName release];
}


When I run my application first time, it opened up sheet  then I changed
trust settings as Always trust  clicked on continue. Then  again after 2
min., same sheet opened up showing bad server certificate. This time I
checked that trust settings were changed one i.e. Always trust but then
why did my application give error bad server certificate?

Thanks for ur replies,
Parag



On Thu, May 22, 2008 at 12:14 AM, ainxow [EMAIL PROTECTED] wrote:

 On May 19, 2008, at 1:51 PM, Jens Alfke wrote:

  I would guess that the Security framework is requiring user confirmation
 to allow the app to bypass certificate checking.



 Well, no. NSURLRequest's setAllowsAnyHTTPSCertificate:forHost: does exactly
 that, immediately and without user confirmation.

 One may (should) choose to use get user permission first. Could be a
 homegrown dialog, asking Do you want to use a brute-force, unsupported
 private API to ignore this certificate and make this download work? Or it
 could be via Security framework and SFCertificateTrustPanel, showing the
 certificate and what's wrong with it to the user before they 

Re: Cocoa et al as HCI usability problem

2008-05-22 Thread Hamish Allan
On Thu, May 22, 2008 at 12:37 AM, Peter Duniho [EMAIL PROTECTED] wrote:

 It's true, the phrase riff-raff wasn't actually used.  But it's the
 essence of what was written.

 I'm not reading between the lines.  People are explicitly stating the
 opinions I've described.

I don't think you understand what explicit means. Nor did I even
make that statement implicitly.

You said in an earlier message: But frankly, I think you already have
to be a pretty hard-core Mac fan, and _really_ want to see your
software on the Mac, to be motivated to spend a lot of time with
Cocoa. I realise you think that's a bad thing. I happen to disagree
with you, and Graham has already replied with a very good explanation
of why.

I don't take it personally that you disagree with me. And I agree with
you about some aspects of the documentation. For example, more direct
links to code samples would be probably useful. But asking for the
documentation to be kept up to date is like asking for software to be
bug-free. Making this happen relies on people like you.

You say The last thing I wanted to do was spend a bunch of time
trying to remember what was so painful about it and submitting all of
that information to Apple. Yes, I agree it would have been better for
me to do that.  But I've got other things to do. And yet you expect
us to move directly to offering specific and constructive help with
specific problems.  If someone has failed to state their own concerns
or problems in a way that allows for this kind of specific,
constructive help, just ask questions that will elicit the kind of
details that would allow for that.

I think you may have mistaken this mailing list for a paid consultancy
hotline. When I ask a question on this list, I don't expect an answer.
If someone gives up their free time providing me with one, I am
grateful, *especially* if it refers me to documentation that answers
my question (as that indicates someone has given up their free time to
direct me to something I should probably have been able to find
myself, without bothering them).

If I don't think that my question is answered, I reply, explaining
*specifically* why not. I don't just state that I have already read
the conceptual guides -- I attempt to prove it. I don't want to be
treated with kid gloves. And I don't want Apple's documentation
bloated by such treatment.

 Just because _you_ think the answers are clearly answered in the available
 docs, that doesn't mean that they actually are, nor does it mean that you
 have any excuse for doing anything more than just referencing the docs.

I think you mean for doing nothing more. But again, if you want
people to be answerable to you, I recommend you spend more time
talking to paid consultants.

Hamish
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: File integrity

2008-05-22 Thread Jean-Daniel Dupas


Le 22 mai 08 à 12:57, Keith Duncan a écrit :

is there a way to tell if my executable was launched by/attached to  
some other process?


You can use ptrace(2) with the PT_DENY_ATTACH request to prevent  
anyone from attaching and will kill the process if it is already  
being traced.


See http://steike.com/code/debugging-itunes-with-gdb/

This has been worked around using a simple kernel extension, I don't  
know what the current state of it is but it may not be that reliable.



file integrity


You can also use codesign(1) which will alert the user if your  
binary has been tampered with since the signing. Note that it  
doesn't prevent the user from launching your application and the  
functions for determining the integrity of your executable aren't  
public.


Keith


There is absolutly no way to completly prevent an user to launch your  
application. If he really want, he can resign the app with is own  
signature. You can add a check, he can change your binaty to bypass it.
You can just do it a little harder, but as long as the user can do  
whatever he want with your executable, he can launch and decompile it.


Don't lose to much time to discourage hackers, it's barely always  
useless.




___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: File integrity

2008-05-22 Thread slasktrattenator
I know. I just want to discourage the baby crackers. Codesign looks
interesting. Ptrace seems to have been strengthened in Leopard, too.
At least I wasn't able to bypass it as easily as outlined by steike.
Always something :-)

Thanks!

On Thu, May 22, 2008 at 1:22 PM, Jean-Daniel Dupas
[EMAIL PROTECTED] wrote:

 Le 22 mai 08 à 12:57, Keith Duncan a écrit :

 is there a way to tell if my executable was launched by/attached to some
 other process?

 You can use ptrace(2) with the PT_DENY_ATTACH request to prevent anyone
 from attaching and will kill the process if it is already being traced.

 See http://steike.com/code/debugging-itunes-with-gdb/

 This has been worked around using a simple kernel extension, I don't know
 what the current state of it is but it may not be that reliable.

 file integrity

 You can also use codesign(1) which will alert the user if your binary has
 been tampered with since the signing. Note that it doesn't prevent the user
 from launching your application and the functions for determining the
 integrity of your executable aren't public.

 Keith

 There is absolutly no way to completly prevent an user to launch your
 application. If he really want, he can resign the app with is own signature.
 You can add a check, he can change your binaty to bypass it.
 You can just do it a little harder, but as long as the user can do whatever
 he want with your executable, he can launch and decompile it.

 Don't lose to much time to discourage hackers, it's barely always useless.




___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Cocoa et al as HCI usability problem

2008-05-22 Thread Jeff LaMarche


On May 21, 2008, at 9:58 PM, Andy Lee wrote:

There's already an inherent lower bound on the barrier to entry for  
Cocoa.  You have to understand certain fundamentals -- some  
conceptual, some procedural.  If you don't have those fundamentals,  
you'll never make Cocoa work.  There is also a set of people on this  
planet who are trying to grasp those fundamentals and are perfectly  
capable of doing so.  To argue that it's better for the platform if  
those people take a little longer to become proficient at Cocoa  
seems to me a bit odd.


I'm not entirely sure that's exactly what is being argued, but even if  
it is, weird opinions can be perfectly valid. Graham stated what he  
intended in his recent e-mail better than I can, so there's no point  
in me re-hashing it.


Suffice it to say, I think there is some merit to this weird idea  
that you should learn the culture and the conceptual underpinnings in  
addition to the syntax of the language and names of classes and  
methods if you want to succeed (and that takes time, no matter how  
good the documentation). If you come from a background where  
developers are allowed and encouraged to do things whatever way they  
see fit, that may seem weird, but I think in the long run, people  
are doing you a favor by telling you. The Mac market is different and  
has different expectations, and much of those expectations exist  
because developers (by and large) do read and understand the  
conceptual docs and conform to a set of conventions gleaned from them  
unless there's a compelling reason not to.


I don't have a problem with people disagreeing with this opinion, by  
the way, but I DO think it's important to state that this particular  
opinion doesn't and shouldn't imply that people who are struggling are  
unwelcome.


Jeff
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSPasteboard Delegate

2008-05-22 Thread Graham Cox

NSPasteboard indeed does not implement a setDelegate: method.

The object you pass as owner in -declareTypes:owner: can act as the  
pasteboard's delegate in the case of when you promise (but do not  
actually provide) data when writing your data types to the pasteboard.


What are you trying to do? Seems to me that attempting to become a  
permanent delegate of the general pasteboard in an awakeFromNib  
method is a very weird thing to do.


Have you read this?:

file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/Conceptual/CopyandPaste/Articles/pbImplementing.html 
#//apple_ref/doc/uid/TP40004255-SW2


In particular the section on Lazy Writing. This is about the only  
time that the delegation pattern is used by NSPasteboard.



hth,

G.











On 22 May 2008, at 5:57 pm, Adil Saleem wrote:


Hi,

I am trying to set my object as delegate of
NSPasteBoard. I am calling from awakeFromNib

NSPasteboard *pb = [NSPasteboard generalPasteboard];
[pb setDelegate:self];


However, on running, it raises exception. There is
also a warning at compile time that says NSPasteboard
may not respond to method setDelegate.

Please tell me how can i set my own class as delegate
of NSPasteboard.

Thanx



___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/graham.cox%40bigpond.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: ObjC Question - labeled arguments

2008-05-22 Thread Andy Lee

On May 22, 2008, at 1:49 AM, Bill Bumgarner wrote:
I don't believe there are any such methods left in the supported  
Cocoa API.


There are at least five.  An API/Contains search for :: in the Xcode  
documentation window turns up:


+[CAMediaTimingFunction functionWithControlPoints]
-[CAMediaTimingFunction initWithControlPoints]
+[CIImage imageWithImageProvider:size::format:colorSpace:options:]
-[CIImage initWithImageProvider:size::format:colorSpace:options:]
-[CIImageProvider provideImageData:bytesPerRow:origin::size::userInfo:]

I thought the last three were typos in the docs, and actually  
submitted feedback on two of them using the link at the bottom of the  
page.  But then on closer inspection I saw they actually were using  
non-empty method-name-fragments for some arguments and not others.   
Yikes!


--Andy

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSPasteboard Delegate

2008-05-22 Thread Adil Saleem

Let me be more precise this time. I haven't used
pasteboards before. I think i asked wrong question. 

Actually i want my application to be notified whenever
there is a new text copied/cutted. So that i can paste
it in my application. So please guide me how that can
be achieved? (with or without delegates. whatever
works)

Thank you for your patience.









--- Graham Cox [EMAIL PROTECTED] wrote:

 NSPasteboard indeed does not implement a
 setDelegate: method.
 
 The object you pass as owner in
 -declareTypes:owner: can act as the  
 pasteboard's delegate in the case of when you
 promise (but do not  
 actually provide) data when writing your data types
 to the pasteboard.
 
 What are you trying to do? Seems to me that
 attempting to become a  
 permanent delegate of the general pasteboard in an
 awakeFromNib  
 method is a very weird thing to do.
 
 Have you read this?:
 

file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/Conceptual/CopyandPaste/Articles/pbImplementing.html
 
 #//apple_ref/doc/uid/TP40004255-SW2
 
 In particular the section on Lazy Writing. This is
 about the only  
 time that the delegation pattern is used by
 NSPasteboard.
 
 
 hth,
 
 G.
 
 
 
 
 
 
 
 
 
 
 
 On 22 May 2008, at 5:57 pm, Adil Saleem wrote:
 
  Hi,
 
  I am trying to set my object as delegate of
  NSPasteBoard. I am calling from awakeFromNib
 
  NSPasteboard *pb = [NSPasteboard
 generalPasteboard];
  [pb setDelegate:self];
 
 
  However, on running, it raises exception. There is
  also a warning at compile time that says
 NSPasteboard
  may not respond to method setDelegate.
 
  Please tell me how can i set my own class as
 delegate
  of NSPasteboard.
 
  Thanx
 
 
 
  ___
 
  Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
  Please do not post admin requests or moderator
 comments to the list.
  Contact the moderators at
 cocoa-dev-admins(at)lists.apple.com
 
  Help/Unsubscribe/Update your Subscription:
 

http://lists.apple.com/mailman/options/cocoa-dev/graham.cox%40bigpond.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]


NSTExtView

2008-05-22 Thread vinitha
i've set the bold menu item by setting the action addFontTrait in 
fontmanager.Now it is working i can give the data's as bold italic etc in
textView.

I tried to convert it to HTML form by using the code.
  NSString * aTitle = @Sample;
  NSArray*excluded = [NSArray arrayWithObjects:  
@doctype,@p,@meta,@xml,@span,  nil];
  NSDictionary*attr = [NSDictionary dictionaryWithObjectsAndKeys:
  NSHTMLTextDocumentType,
NSDocumentTypeDocumentAttribute,
  aTitle, NSTitleDocumentAttribute,excluded,
NSExcludedElementsDocumentAttribute,
  [NSNumber numberWithInt: NSASCIIStringEncoding],
  NSCharacterEncodingDocumentAttribute,nil];
  NSData*tData = [str dataFromRange: NSMakeRange(0, [str length])
documentAttributes: attr error: nil];


It giving html code, but it doesn;t giving B,I,U and colour tags
corresponding to the texts in textview.

Another qustion is how can i display this html code in my textview,I've tried

 NSDictionary ** dict = attr;
  NSData*tData = [str dataFromRange: NSMakeRange(0, [str length])
documentAttributes: attr error: nil];
NSAttributedString *attrString = [[NSAttributedString 
alloc]initWithHTML:
tData
 documentAttributes: dict];
   [[htmlView textStorage] setAttributedString: attrString];

But it also displays the same string not html code.


More speccific
 My first question is how can i get underlinetext or italictext to
uunerlinetext/u  or i italictext /i etc...

SEcond question is How can write html code to textView?if NSData gives
html code.
I've found another prooblem in my application,I clicked on the zoom button
of the window in interface builder3.0,Now i couldn;t open that window and
couldn't load at run time.Expecting reply.

thanks

___

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

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

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

This email sent to [EMAIL PROTECTED]


NSTextField will not become editable in a borderless window

2008-05-22 Thread Peter Burtis
When I add an NSTextField to a borderless window, nothing I do will  
make it editable.  Specifically, running the code below, the text  
field just won't work.  (I've tried it with all backing types, BTW.)


NSWindow *window = [[NSWindow alloc]  
initWithContentRect:NSMakeRect(300,300,300,300)  
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered  
defer:NO];

NSTextField *field = [[NSTextField alloc] init];
[field setEditable:YES];
[window setContentView:field];
[window makeKeyAndOrderFront:self];

But change the styleMask to NSTitledWindowMask and it works as expected.

What am I missing?  Is it impossible to do this for some reason?  On  
the subject of NSBorderlessWindowMask, the docs give the rather opaque  
guidance, Useful only for display or caching purposes,  as if a  
window was useful for anything other than display.  Is there some  
other, better way to create a completely custom window?


I'm running 10.5.2, if that matters.

Thanks,
Peter Burtis
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSPasteboard Delegate

2008-05-22 Thread Robert Cerny

Hi,
I don't think it's possible to be notified about pasteboard change.  
Depending on your needs I believe a polling should be the right way to  
go.


HTH
Robert


On 22.5.2008, at 14:08, Adil Saleem wrote:



Let me be more precise this time. I haven't used
pasteboards before. I think i asked wrong question.

Actually i want my application to be notified whenever
there is a new text copied/cutted. So that i can paste
it in my application. So please guide me how that can
be achieved? (with or without delegates. whatever
works)

Thank you for your patience.









--- Graham Cox [EMAIL PROTECTED] wrote:


NSPasteboard indeed does not implement a
setDelegate: method.

The object you pass as owner in
-declareTypes:owner: can act as the
pasteboard's delegate in the case of when you
promise (but do not
actually provide) data when writing your data types
to the pasteboard.

What are you trying to do? Seems to me that
attempting to become a
permanent delegate of the general pasteboard in an
awakeFromNib
method is a very weird thing to do.

Have you read this?:



file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/Conceptual/CopyandPaste/Articles/pbImplementing.html


#//apple_ref/doc/uid/TP40004255-SW2

In particular the section on Lazy Writing. This is
about the only
time that the delegation pattern is used by
NSPasteboard.


hth,

G.











On 22 May 2008, at 5:57 pm, Adil Saleem wrote:


Hi,

I am trying to set my object as delegate of
NSPasteBoard. I am calling from awakeFromNib

NSPasteboard *pb = [NSPasteboard

generalPasteboard];

[pb setDelegate:self];


However, on running, it raises exception. There is
also a warning at compile time that says

NSPasteboard

may not respond to method setDelegate.

Please tell me how can i set my own class as

delegate

of NSPasteboard.

Thanx



___

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

Please do not post admin requests or moderator

comments to the list.

Contact the moderators at

cocoa-dev-admins(at)lists.apple.com


Help/Unsubscribe/Update your Subscription:




http://lists.apple.com/mailman/options/cocoa-dev/graham.cox%40bigpond.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/robertcerny%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: NSPasteboard Delegate

2008-05-22 Thread Matt Gough
Maybe you could set up a timer to run once every second or so that  
checks the pasteboard's changeCount. Not sure there is an explicit  
notification of changes.


Matt
On 22 May 2008, at 14:08, Adil Saleem wrote:


Actually i want my application to be notified whenever
there is a new text copied/cutted. So that i can paste
it in my application. So please guide me how that can
be achieved? (with or without delegates. whatever
works)

Thank you for your patience.



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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 will not become editable in a borderless window

2008-05-22 Thread Robert Cerny

You need to subclass NSTextField.

http://www.cocoadev.com/index.pl?BorderlessWindow

HTH
Robert


On 22.5.2008, at 14:13, Peter Burtis wrote:

When I add an NSTextField to a borderless window, nothing I do will  
make it editable.  Specifically, running the code below, the text  
field just won't work.  (I've tried it with all backing types, BTW.)


NSWindow *window = [[NSWindow alloc]  
initWithContentRect:NSMakeRect(300,300,300,300)  
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered  
defer:NO];

NSTextField *field = [[NSTextField alloc] init];
[field setEditable:YES];
[window setContentView:field];
[window makeKeyAndOrderFront:self];

But change the styleMask to NSTitledWindowMask and it works as  
expected.


What am I missing?  Is it impossible to do this for some reason?  On  
the subject of NSBorderlessWindowMask, the docs give the rather  
opaque guidance, Useful only for display or caching purposes,  as  
if a window was useful for anything other than display.  Is there  
some other, better way to create a completely custom window?


I'm running 10.5.2, if that matters.

Thanks,
Peter Burtis
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/robertcerny%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: NSPasteboard Delegate

2008-05-22 Thread Graham Cox

Well, Paste doesn't work like this.

You don't get notified when there's something new to paste. Instead,  
the user tries to perform the paste, at which point you can check if  
the pasteboard contains anything you can use. You can also perform  
this check when validating the paste menu item so that Paste is  
disabled (greyed out) when there's nothing to paste.


Much cleaner this way, since you are then driven by the user's actual  
needs instead of keeping track of all sorts of potential state  
information just in case.


Do read this:

file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/Conceptual/CopyandPaste/Articles/pbFundamentals.html


(by the way, does pasting the file URL here actually work? I assume  
everyone will have the same Xcode installation... is there a way to  
get the URL of the equivalent online site from the Xcode documentation  
browser?)



G.



On 22 May 2008, at 10:08 pm, Adil Saleem wrote:



Let me be more precise this time. I haven't used
pasteboards before. I think i asked wrong question.

Actually i want my application to be notified whenever
there is a new text copied/cutted. So that i can paste
it in my application. So please guide me how that can
be achieved? (with or without delegates. whatever
works)

Thank you for your patience.









--- Graham Cox [EMAIL PROTECTED] wrote:


NSPasteboard indeed does not implement a
setDelegate: method.

The object you pass as owner in
-declareTypes:owner: can act as the
pasteboard's delegate in the case of when you
promise (but do not
actually provide) data when writing your data types
to the pasteboard.

What are you trying to do? Seems to me that
attempting to become a
permanent delegate of the general pasteboard in an
awakeFromNib
method is a very weird thing to do.

Have you read this?:



file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/Conceptual/CopyandPaste/Articles/pbImplementing.html


#//apple_ref/doc/uid/TP40004255-SW2

In particular the section on Lazy Writing. This is
about the only
time that the delegation pattern is used by
NSPasteboard.


hth,

G.











On 22 May 2008, at 5:57 pm, Adil Saleem wrote:


Hi,

I am trying to set my object as delegate of
NSPasteBoard. I am calling from awakeFromNib

NSPasteboard *pb = [NSPasteboard

generalPasteboard];

[pb setDelegate:self];


However, on running, it raises exception. There is
also a warning at compile time that says

NSPasteboard

may not respond to method setDelegate.

Please tell me how can i set my own class as

delegate

of NSPasteboard.

Thanx



___

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

Please do not post admin requests or moderator

comments to the list.

Contact the moderators at

cocoa-dev-admins(at)lists.apple.com


Help/Unsubscribe/Update your Subscription:




http://lists.apple.com/mailman/options/cocoa-dev/graham.cox%40bigpond.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: Core-Data Multithreading question about save

2008-05-22 Thread Hamish Allan
On Thu, May 22, 2008 at 11:37 AM, Dex Morgan [EMAIL PROTECTED] wrote:

 What's I'm wrong? The ID still temporany until I save the second managed
 object but If I can do it I can also make my relationship, the overhead it's
 the same.

Surely the overhead is less when you do many rather than one at a time?

 I need to work in a multithreading environment.

I'm not suggesting you stop using a secondary thread; I'm just
suggesting you perform the *insert* on the main thread.

Hamish
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: ObjC Question - labeled arguments

2008-05-22 Thread glenn andreas


On May 22, 2008, at 12:49 AM, Bill Bumgarner wrote:


On May 21, 2008, at 10:38 PM, Andrew Farmer wrote:
Interesting - I wasn't aware that unlabeled arguments existed  
(primarily because they're not used in Cocoa). I'd stay away from  
them, as they're strictly less clear than named arguments, and will  
probably confuse other programmers just as they did me.


In the predecessor to Cocoa, NeXTSTEP, there were a handful of  
methods that were named with bare arguments.


Many examples can be found here:


http://www.cilinder.be/docs/next/NeXTStep/3.3/nd/GeneralRef/02_ApplicationKit/Classes/Matrix.htmld/index.html

Like:
c2D.gif makeCellAt:(int)row :(int)col

It was, for the very reasons you describe, eliminated in the move to  
OpenStep and, finally, Cocoa.   I don't believe there are any such  
methods left in the supported Cocoa API.


b.bum



WebKit DOM methods were ugly like that (only worse, since there are  
far more than just one bare argument), though they are at least now  
marked as deprecated in 10.5 (but technically still supported).


I remember when they were introduced at a WWDC session, you could just  
see the audience getting nauseous.  It's funny how after using Cocoa  
for a while, Cocoa abuse like that seems to be like fingernails on a  
chalkboard.





Glenn Andreas  [EMAIL PROTECTED]
 http://www.gandreas.com/ wicked fun!
m.o.t.e.s. | minute object twisted environment simulation



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSPasteboard Delegate

2008-05-22 Thread matt . gough


On 22 May 2008, at 14:18, Graham Cox wrote:


Do read this:

file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/Conceptual/CopyandPaste/Articles/pbFundamentals.html


(by the way, does pasting the file URL here actually work? I assume  
everyone will have the same Xcode installation... is there a way to  
get the URL of the equivalent online site from the Xcode  
documentation browser?)


Sort of, when I click it it does the equivalent of Reveal in Finder on  
the relevant file; it doesn't go directly to Safari.


To get the equivalent online url, you can replace:

file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/

with:
http://developer.apple.com/

so the above becomes:
http://developer.apple.com/documentation/Cocoa/Conceptual/CopyandPaste/Articles/pbFundamentals.html

Matt
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTextField will not become editable in a borderless window

2008-05-22 Thread Graham Cox
Peter, I've run into something similar and I think it has to do with  
the window server not making a window active (i.e. main and key) if it  
has the borderless attribute. The workaround I ended up using was to  
override a private undocumented NSWindow method which controls use to  
query the active state of the window, to always return YES.


Unfortunately I've dug through a mountain of code but can't find where  
I used it. Someone else may remember this trick and help me out... of  
course, it's not a great solution but it works from 10.3 through 10.5  
so far...


G.






On 22 May 2008, at 10:13 pm, Peter Burtis wrote:

When I add an NSTextField to a borderless window, nothing I do will  
make it editable.  Specifically, running the code below, the text  
field just won't work.  (I've tried it with all backing types, BTW.)


NSWindow *window = [[NSWindow alloc]  
initWithContentRect:NSMakeRect(300,300,300,300)  
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered  
defer:NO];

NSTextField *field = [[NSTextField alloc] init];
[field setEditable:YES];
[window setContentView:field];
[window makeKeyAndOrderFront:self];

But change the styleMask to NSTitledWindowMask and it works as  
expected.


What am I missing?  Is it impossible to do this for some reason?  On  
the subject of NSBorderlessWindowMask, the docs give the rather  
opaque guidance, Useful only for display or caching purposes,  as  
if a window was useful for anything other than display.  Is there  
some other, better way to create a completely custom window?


I'm running 10.5.2, if that matters.

Thanks,
Peter Burtis
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/graham.cox%40bigpond.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: NSTextField will not become editable in a borderless window

2008-05-22 Thread Graham Cox

Found it just after I posted:

- (BOOL) _hasActiveControls
{
return YES;
}


Also, while this works to show an active *appearance* for buttons, pop- 
ups and so on, I've never tried it with text fields. It's a quick  
thing to try though. It would be useful for Apple to provide a  
properly supported way to do this, to allow pop-up controls though  
perhaps the new view-in-a-menu-item mechanism will do that now.



hth,

G.


On 22 May 2008, at 10:40 pm, Graham Cox wrote:

Peter, I've run into something similar and I think it has to do with  
the window server not making a window active (i.e. main and key) if  
it has the borderless attribute. The workaround I ended up using was  
to override a private undocumented NSWindow method which controls  
use to query the active state of the window, to always return YES.


Unfortunately I've dug through a mountain of code but can't find  
where I used it. Someone else may remember this trick and help me  
out... of course, it's not a great solution but it works from 10.3  
through 10.5 so far...


G.






On 22 May 2008, at 10:13 pm, Peter Burtis wrote:

When I add an NSTextField to a borderless window, nothing I do will  
make it editable.  Specifically, running the code below, the text  
field just won't work.  (I've tried it with all backing types, BTW.)


NSWindow *window = [[NSWindow alloc]  
initWithContentRect:NSMakeRect(300,300,300,300)  
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered  
defer:NO];

NSTextField *field = [[NSTextField alloc] init];
[field setEditable:YES];
[window setContentView:field];
[window makeKeyAndOrderFront:self];

But change the styleMask to NSTitledWindowMask and it works as  
expected.


What am I missing?  Is it impossible to do this for some reason?   
On the subject of NSBorderlessWindowMask, the docs give the rather  
opaque guidance, Useful only for display or caching purposes,  as  
if a window was useful for anything other than display.  Is there  
some other, better way to create a completely custom window?


I'm running 10.5.2, if that matters.

Thanks,
Peter Burtis
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/graham.cox%40bigpond.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/graham.cox%40bigpond.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: NSTextField will not become editable in a borderless window

2008-05-22 Thread Graham Cox

Me again ;-)

It just occurred to me - have you tried the following overrides in  
NSWindow?:


- (BOOL) canBecomeKeyWindow { return YES; }
- (BOOL) acceptsFirstResponder { return YES; }
- (BOOL) becomeFirstResponder { return YES; }
- (BOOL) resignFirstResponder { return YES; }
Borderless windows are set up to return NO in these cases by default,  
so these overrides are necessary to force it back into the land of the  
living. If the text field now works, but shows the inactive  
appearance, THEN try the active hack.


G.




On 22 May 2008, at 10:47 pm, Graham Cox wrote:


Found it just after I posted:

- (BOOL) _hasActiveControls
{
return YES;
}


Also, while this works to show an active *appearance* for buttons,  
pop-ups and so on, I've never tried it with text fields. It's a  
quick thing to try though. It would be useful for Apple to provide a  
properly supported way to do this, to allow pop-up controls though  
perhaps the new view-in-a-menu-item mechanism will do that now.



hth,

G.


On 22 May 2008, at 10:40 pm, Graham Cox wrote:

Peter, I've run into something similar and I think it has to do  
with the window server not making a window active (i.e. main and  
key) if it has the borderless attribute. The workaround I ended up  
using was to override a private undocumented NSWindow method which  
controls use to query the active state of the window, to always  
return YES.


Unfortunately I've dug through a mountain of code but can't find  
where I used it. Someone else may remember this trick and help me  
out... of course, it's not a great solution but it works from 10.3  
through 10.5 so far...


G.






On 22 May 2008, at 10:13 pm, Peter Burtis wrote:

When I add an NSTextField to a borderless window, nothing I do  
will make it editable.  Specifically, running the code below, the  
text field just won't work.  (I've tried it with all backing  
types, BTW.)


NSWindow *window = [[NSWindow alloc]  
initWithContentRect:NSMakeRect(300,300,300,300)  
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered  
defer:NO];

NSTextField *field = [[NSTextField alloc] init];
[field setEditable:YES];
[window setContentView:field];
[window makeKeyAndOrderFront:self];

But change the styleMask to NSTitledWindowMask and it works as  
expected.


What am I missing?  Is it impossible to do this for some reason?   
On the subject of NSBorderlessWindowMask, the docs give the rather  
opaque guidance, Useful only for display or caching purposes,   
as if a window was useful for anything other than display.  Is  
there some other, better way to create a completely custom window?


I'm running 10.5.2, if that matters.

Thanks,
Peter Burtis
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/graham.cox%40bigpond.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/graham.cox%40bigpond.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/graham.cox%40bigpond.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]


Displaying NSAttributedStrings in an NSTableView with non-uniform row height

2008-05-22 Thread Christian Moen
cocoa-dev,

I'd like to display textual information in varying fonts and sizes in
NSTableColumns using an NSAttributedString, but I'm having problems
getting my NSTableView to display the information using varying row
height.

My data source implements numberOfRowsInTableView: and
tableView:objectValueForTableColumn:row: and the latter returns
NSAttributeStrings for the columns and they render fine, but the
height is uniform across rows clipping the NSAttributedString.

In order to get the row height correctly, I understand I need to
implement tableView:heightOfRow:.  How can I find out how high my row
needs to be?  I know I can call size on an NSAttributedString, but the
height returned doesn't take line breakage introduced by the
NSTableColumn into account.  (My NSTableColumns use NSTextFieldCell
cells and Line Breaks in Interface Builder is set as Character
Wrap.)

Advice on how to deal with the above is mostly appreciated.  The
complexity of this has me thinking I'm missing something important and
that I'm off down the wrong track.

Many thanks,


Christian
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSPasteboard Delegate

2008-05-22 Thread Graham Cox

Great, thanks - I'll do that in future.

G.


On 22 May 2008, at 10:31 pm, [EMAIL PROTECTED] wrote:


To get the equivalent online url, you can replace:

file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/

with:
http://developer.apple.com/

so the above becomes:
http://developer.apple.com/documentation/Cocoa/Conceptual/CopyandPaste/Articles/pbFundamentals.html

Matt


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSConnection does not close ports

2008-05-22 Thread Adam R. Maxwell


On May 22, 2008, at 12:13 AM, Gerriet M. Denkmann wrote:

I have a server, which does create an NSConnection on some  
NSSocketPort and publishes this fact via Bonjour.
A client opens a connection, sends some messages via Distributed  
Objects, and closes it again.

This implies opening and closing a few file descriptors on sockets.

Works fine. Usually.

But sometimes some of these socket file descriptors get NOT closed,  
so they accumulate slowly and when the limit set in limit() is  
reached, the client blocks forever.


The only way I've been able to get CFMachPorts properly cleaned up  
from NSConnection is to do


[[connection sendPort] invalidate];
[[connection receivePort] invalidate];
[connection invalidate];

otherwise they appear to stick around forever (until you run out of  
mach ports).  Have you tried something like this with NSSocketPort?


--
adam
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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 will not become editable in a borderless window

2008-05-22 Thread Peter Burtis
Thanks Robert and Graham.  FWIW, the one that finally did the trick  
was overriding canBecomeKeyWindow to return YES, which makes a lot of  
sense in hindsight.  For whatever strange reason, nothing else  
suggested worked.  (This is all happening on a CoreAnimation layer,  
BTW, which may well be throwing a few extra curveballs into the mix.)


Now, overriding canBecomeKeyWindow seems to be wreaking havoc with my  
mouseEntered and mouseExited code, and the focus ring isn't drawing  
anywhere near properly, but those are other bugs for other nights- 
turned-mornings. :)


Thanks again for the help,
Peter

Graham Cox:

Me again ;-)

It just occurred to me - have you tried the following overrides in  
NSWindow?:


- (BOOL) canBecomeKeyWindow { return YES; }
- (BOOL) acceptsFirstResponder { return YES; }
- (BOOL) becomeFirstResponder { return YES; }
- (BOOL) resignFirstResponder { return YES; }
Borderless windows are set up to return NO in these cases by  
default, so these overrides are necessary to force it back into the  
land of the living. If the text field now works, but shows the  
inactive appearance, THEN try the active hack.


G.




On 22 May 2008, at 10:47 pm, Graham Cox wrote:


Found it just after I posted:

- (BOOL) _hasActiveControls
{
return YES;
}


Also, while this works to show an active *appearance* for buttons,  
pop-ups and so on, I've never tried it with text fields. It's a  
quick thing to try though. It would be useful for Apple to provide  
a properly supported way to do this, to allow pop-up controls  
though perhaps the new view-in-a-menu-item mechanism will do that  
now.



hth,

G.


On 22 May 2008, at 10:40 pm, Graham Cox wrote:

Peter, I've run into something similar and I think it has to do  
with the window server not making a window active (i.e. main and  
key) if it has the borderless attribute. The workaround I ended up  
using was to override a private undocumented NSWindow method which  
controls use to query the active state of the window, to always  
return YES.


Unfortunately I've dug through a mountain of code but can't find  
where I used it. Someone else may remember this trick and help me  
out... of course, it's not a great solution but it works from 10.3  
through 10.5 so far...


G.






On 22 May 2008, at 10:13 pm, Peter Burtis wrote:

When I add an NSTextField to a borderless window, nothing I do  
will make it editable.  Specifically, running the code below, the  
text field just won't work.  (I've tried it with all backing  
types, BTW.)


NSWindow *window = [[NSWindow alloc]  
initWithContentRect:NSMakeRect(300,300,300,300)  
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered  
defer:NO];

NSTextField *field = [[NSTextField alloc] init];
[field setEditable:YES];
[window setContentView:field];
[window makeKeyAndOrderFront:self];

But change the styleMask to NSTitledWindowMask and it works as  
expected.


What am I missing?  Is it impossible to do this for some reason?   
On the subject of NSBorderlessWindowMask, the docs give the  
rather opaque guidance, Useful only for display or caching  
purposes,  as if a window was useful for anything other than  
display.  Is there some other, better way to create a completely  
custom window?


I'm running 10.5.2, if that matters.

Thanks,
Peter Burtis
___

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

Please do not post admin requests or moderator comments to the  
list.

Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/graham.cox%40bigpond.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/graham.cox%40bigpond.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/graham.cox%40bigpond.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: creating a resource fork and writing raw bytes to it

2008-05-22 Thread Shawn Erickson


On May 21, 2008, at 11:49 PM, Charles Srstka wrote:

FSRefs are also highly filesystem-dependent, and HFS+, the only file  
system (as far as I know) that currently fully supports them, is  
showing its age and ready to be replaced, possibly by a file system  
like ZFS that wasn't invented by Apple.


I think you are confusing FSSpec and FSRef.

http://developer.apple.com/documentation/Carbon/Reference/File_Manager/Reference/reference.html#//apple_ref/doc/c_ref/FSRef 



FSRefs are opaque structures that support referencing files/ 
directories on any file system supported by Mac OS X. They are well  
supported in CoreFoundation, LaunchServices, etc.


http://developer.apple.com/technotes/tn2002/tn2078.html

FSRef are meant for use while your process is running (don't attempt  
to persist them).


Also most of the FS functions that take FSRef are capable of  
supporting the file systems support by Mac OS X.


-Shawn
___

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

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

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

This email sent to [EMAIL PROTECTED]


PMSessionEndDocumentNoDialog error code -43

2008-05-22 Thread Torsten Curdt

Anyone an idea what error code -43 could be?

PMSessionEndDocumentNoDialog documentation points me to

http://developer.apple.com/documentation/GraphicsImaging/Reference/CorePrintRef/Reference/reference.html#/ 
/apple_ref/doc/uid/TP40005775-CH5g-RCM0127


But that does not list that error code.

This was reported on a developer seed (9D32). It seems to work fine on  
10.5.2(9C7010)


cheers
--
Torsten
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: ANN: Step by step introduction to programming with Cocoa

2008-05-22 Thread Julius Guzy


On 22 May 2008, at 1:43, Shawn Erickson wrote:


On Wed, May 21, 2008 at 5:38 PM, Julius Guzy
[EMAIL PROTECTED] wrote:

I suggested some time back (A documetation suggestion 19 May 2008  
13:31:30)
but no one took me up on it,  the idea of seeing if Apple would so  
to speak
donate a copy of their documentation so it could be used as the  
basis for

a wiki.


I fear something like that since it will get out of date with Apple's
doc set and then lead to confusion and misinformation.


That is true unless steps are taken to integrate things in some way.



I think better solution would be for Apple to provide a wiki like way
for external parties to comment / expand on Apple's own documentation
pages (out-of-line as you suggest if I am reading you correctly).
Yes that would be the ideal I think, i.e. if they maintained control  
over the implementation etc.

Julius

http://juliuspaintings.co.uk



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Trying to understand -- please help...

2008-05-22 Thread Caleb Strockbine

On May 21, 2008, at 2:39 PM, Johnny Lundy [EMAIL PROTECTED] wrote:


Here's why the OP was not aware of the behavior of an NSArray class
method:
Here's the verbatim documentation for +arrayWithObjects:


[...deleted...]


See? Not a word about autoreleasing anything, or having to retain the
returned array. Nada.


You don't have to retain the returned array. You can just create it,  
use it,
and then forget about it. You DO have to retain the returned array  
*if* you
want to keep a reference to it, but that's true of *any* object you  
create
with a convenience constructor, or indeed any object that you didn't  
create

yourself using alloc, new, or copy.

I agree that there's some room for confusion if the documentation for
NSArray is the first thing you read about Cocoa, and then you try to  
jump

in and start coding. However, the basics of retain counts and object
ownership are explained in the first article of the first guide  
listed under

Cocoa Fundamentals. That would be Memory Management Programming
Guide for Cocoa-Object Ownership and Disposal. It's explained again,
with examples, in the second article, Practical Memory Management.

It's clear from the OP's post that he's still just beginning to learn  
about

Cocoa. For example, it seems that he's trying to initialize an array and
then add some objects to it in his code, and he doesn't understand
that instances of NSArray can't be changed after they're created.  
Although
folks here corrected his code by removing the [[NSArray alloc] init]  
line
and adding a retain, it might have been a greater service to him to  
change
the first line to [[NSMutableArray alloc] init] and changed the  
subsequent

line to call -addObject: rather than +arrayWithObjects.

In any case, the important point here is not that the documentation for
NSArray or memory management is lacking, but that it appears that the
OP hasn't yet read either the most fundamental documents or even the
NSArray reference page.



Seriously, read that assuming you wanted to try out the NSArray class
and tell me how it accomplishes its purpose of documenting what it is
intended to document. It doesn't. And this pattern is repeated over
and over in just about every one of the Class References.


The NSArray documentation describes NSArray quite completely in the
context of a Cocoa environment, which is to say that it follows the  
rules

that every other class does, and it documents any particulars that you
might need to know (e.g. NSArray retains the objects it contains for
the life of the array). I'm sure that there are ways that the docs could
be improved, but IMO, adding don't forget to retain the returned
object to the description for every method in every class in Cocoa that
returns an object would not be an improvement.

regards,

Caleb Strockbine
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: ANN: Step by step introduction to programming with Cocoa

2008-05-22 Thread Julius Guzy


On 22 May 2008, at 1:52, Jack Repenning wrote:



On May 21, 2008, at 5:38 PM, Julius Guzy wrote:

Actually the idea was to include a text box at the end of each  
section where people could post queries regarding that section,  
e.g.  questions about something they did not understand or  
something which did not quite work as expected etc and which would  
then cause an email containing that query to be sent to a  
discussion list, e.g. like the present one, where people's replies  
would then be included in the section the query came from. This  
would give the thing the structure of an FAQ.

I would keep it all very simple and very basic so it stays managable.
If useful it would acquire its own dynamic.


Apple does solicit feedback at the bottom of every page, for example

  http://developer.apple.com/documentation/Cocoa/Reference/ 
Foundation/Protocols/NSCopying_Protocol/Reference/Reference.html#// 
apple_ref/occ/intfm/NSCopying/copyWithZone:


(that is, http://tinyurl.com/67r3nm)


Used it once or twice but not always in positive fasion since at  
height of my frustrations I would sometimes type in something like  
but where is the XXX or whatever it was I trying to find


You must mean something different. Perhaps a public discussion  
area, sort of like MySQL does?  For example,


  http://dev.mysql.com/doc/refman/4.1/en/select.html

Yes that is very much the sort of thing I had in mind.
Boy though does a page like that grow!
Lots of information! Looks good and useful to me. Wonder what it is  
like to use?


Julius

http://juliuspaintings.co.uk


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: A documetation suggestion (was Re: Cocoa et al as HCI usability problem)

2008-05-22 Thread Julius Guzy


On 22 May 2008, at 4:55, David Casseres wrote:


That's a really good idea, your wiki-that's-more-than-a-wiki.

You're in charge!

8^{)


Ha Ha

But just as a matter of interest, how would one set about talking to  
apple about such a thing?
I would guess one would need first to demonstrate some kind of a  
consensus

and then thrash out a suitable format and mechanism within the group?

Julius


On May 19, 2008, at 5:31 AM, Julius Guzy wrote:


Well I never thought I would cause this much discussion.
I have tried but do not have the time needed to reply to all.
I might still but work must take precedence.

There have been a number of people who suggested I give specific  
instances of documentation failure.

I agree it would be useful but I am not going to.
The process would require far more analysis than I can afford at  
present.
Let me see however if I can summarise some of the discussion and  
finish with a suggestion.


The current documentation works for some people and not for others.
Those who find it adequate tend to be those who know how to  
program the machine.
Those who find it less than adequate are those learning how to  
program the machine.
Most of those learning how to use the machine already have  
considerable experience in programming in a wide variety of  
languages and on a wide range of platforms.
Most of those learning to use the machine have put quite a bit of  
time and effort into doing so.

This list contains a lot of people happy to share their expertiese.
There is a need to identify particular difficulties with the  
documentation etc.


Ok to cut to the chase.
There exists a very large body of documentation belonging to Apple  
and which ultimately we all need to be acquainted with if we are  
to get the most out of the machine.

This documentation is a resource that could be built on.

I wonder if Apple would be prepared to provide a copy of its  
documentation that could be turned into some kind of a wiki?


There already exists a cocoa wiki but it suffers from the fact  
that the scope of the problem is far too large  even for a  
dedicated band of people to tackle in their spare time without  
this additional resource.
Starting with a ready made body of information would have a  
greater chance of success.


When I say some kind of wiki I do not actually mean a wiki.
That it seems to me, would be a huge undertaking.

What I have in mind is more of an FAQ approach.
For instance take a page documenting something like NSString or  
NSArray .
Then for each of the sub-headings/sections whatever there would be  
provided a means for entering questions and providing answers to  
those questions.
Tthe entry of a question would cause an email to be sent to a list  
which specialises in programming problems or to a list created  
specifically for this pupose and similarily for the answers.
When people see the email they can if they wish go to the  
documentation and provide an answer.

When people see an answer they can comment upon it, extend it etc.

I would keep it all very simple and very basic so it stays managable.
If useful it would acquire its own dynamic.

I think the advantages of such an approach might be considerable.
1. We discover exactly where the difficulties lie.
2. We provide ready answers to those difficulties.
3. People are encouraged to explore the documentation
4. The documentation becomes up to date, errors are corrected etc.
5. There is little extra effort expended in providing the answers  
than would be spent doing so on this list

6. The context of the question and the reply is that much more clear
7. There is a build up of information concerning a specific  
problem all in the same place.

8. It builds a self help community.
9. It could result in a pretty good piece of documentation.

It is just a thought
must rush

Julius

http://juliuspaintings.co.uk



___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/casseres%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: Core Data: How to encrypt a persistent store

2008-05-22 Thread Jens Alfke


On 22 May '08, at 3:12 AM, Ruotger Skupin wrote:

I have an application which uses Core Data and handles sensitive  
information. Is there an easy way to encrypt the on-disk persistent  
store provided I'm reasonably fluent in libCrypto and do not want to  
use an encrypted disk image?


With the sqlite store I think you'd be limited to encrypting the  
contents of individual column values (with the side effect that you'd  
no longer be able to query or sort on those values.) If there's some  
individual property you want to encrypt, like the contents of a  
message, then you could make the persistent property be  
encryptedContents and declare a transient contents property that  
does the en/decryption based on the persistent value.


I've used sqlite a fair bit and I don't remember seeing any hooks that  
would let you intercept the raw file reads and writes it makes, which  
is what would be required to encrypt the entire database.


With the XML store you could probably override some methods (as the  
previous reply points out) to encrypt the entire file as it's being  
read or written.


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

CoreData Statement Still Active (CoreData Multithreading)

2008-05-22 Thread Dex Morgan


Il giorno 22/mag/08, alle ore 14:25, Hamish Allan ha scritto:

Surely the overhead is less when you do many rather than one at a  
time?


Ok I'll try.
Did you know something about this error:
*** Terminating app due to uncaught exception  
'NSInternalInconsistencyException', reason: 'statement is still active'


I've used [tryLock] and [unlock] before executeFetchRequest in my app  
but sometimes it appears.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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]


Newbie query re default buttons

2008-05-22 Thread Michael McLaughlin
As a Cocoa newbie (after years of Carbon), I am working my way through the
3rd edition of Hillegass' book.  I finished his SpeakLine example then
thought I'd challenge myself by making the Speak button the default button
-- but failed.

I coded the following

*** AppController.h

@interface AppController : NSObject {
IBOutlet NSTextField *textField;
NSSpeechSynthesizer *speechSynth;

IBOutlet NSView *windView;  -- content view, added
IBOutlet NSButton *speakButton; -- added
}

- (IBAction)sayIt:(id)sender;
- (IBAction)stopIt:(id)sender;
@end

*** added to AppController.m

- (void)awakeFromNib {
[[speakButton window] setDefaultButtonCell:[speakButton cell]];

// debugging   
NSButtonCell *def = nil;
def = [[speakButton window] defaultButtonCell];
}

I made the connections in IB to both windView and speakButton and they look
OK (compared to those in Apple's BackgroundExporter sample code.  I tried
using the content view as well as the button itself to get the window.
Neither works.  My button is not blue or pulsing and the Return key does
nothing.  The def variable *does* get the correct result (judging by self
variables).  Using windView to get the window does not help.

Calling
[speakButton setKeyEquivalent:@\r];
did not work either.

Even though my code and the BackgroundExporter seem the same to me, I am
obviously missing something.

Any tips, from anyone?

TIA.

-- 
Mike McLaughlin

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSTExtView

2008-05-22 Thread Jens Alfke


On 22 May '08, at 3:02 AM, [EMAIL PROTECTED] wrote:

 NSData*tData = [str dataFromRange: NSMakeRange(0, [str  
length])

documentAttributes: attr error: nil];

It giving html code, but it doesn;t giving B,I,U and colour tags
corresponding to the texts in textview.


You didn't show where 'str' comes from. Could you add that line?
Also, did you try passing in a value for 'error' to see if any error/ 
warning messages are returned?


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: probably OT: using encrypted disk images with NSTask and hdiutil

2008-05-22 Thread Jens Alfke


On 22 May '08, at 3:32 AM, Ruotger Skupin wrote:

To protect sensitive user data I attach an encrypted disk image and  
store the application data there.


Interesting. FYI, if the data is fairly small you can store it  
directly in a Keychain item(s), but for large amounts of data a disk  
image is a good idea.



-certificate certificate_file
   specify a secondary access certificate for the  
image being created.

-pubkey PK1,PK2,...,PKn
   specify a list of public key hashes in ASCII hex  
for the image being created.  The hash(s) will be used to locate a  
public key used to protect an encrypted image.

Is there any example code how to do this in Cocoa?


I don't know, as I haven't used hdiutil. None of the relevant  
technologies have Cocoa APIs, so if there are examples they're most  
likely C code, but you could use them in a Cocoa app.


To work with certificates or public keys you'll need to use the  
Keychain or CDSA (or openssl) APIs. I've found the 3rd party open- 
source Keychain.framework (keychain.sourceforge.net) invaluable for  
working with those, as it offers a lot of high-level Cocoa wrappers.


Furher discussion should probably go to either the filesystem-dev or  
apple-cdsa mailing lists. (The latter, despite its cryptic name,  
covers crypto and security APIs.)


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Newbie query re default buttons

2008-05-22 Thread Robert Cerny

Hi,
could you simply add the default flag in IB?

1. select the button
2. Hit -1 to bring up Inspector pane
3. Click the dark grey rectangle next to Key Equiv.
4. Hit Enter

HTH
Robert

On 22.5.2008, at 16:51, Michael McLaughlin wrote:

As a Cocoa newbie (after years of Carbon), I am working my way  
through the

3rd edition of Hillegass' book.  I finished his SpeakLine example then
thought I'd challenge myself by making the Speak button the default  
button

-- but failed.

I coded the following

*** AppController.h

@interface AppController : NSObject {
   IBOutlet NSTextField *textField;
   NSSpeechSynthesizer *speechSynth;

   IBOutlet NSView *windView;  -- content view, added
   IBOutlet NSButton *speakButton; -- added
}

- (IBAction)sayIt:(id)sender;
- (IBAction)stopIt:(id)sender;
@end

*** added to AppController.m

- (void)awakeFromNib {
   [[speakButton window] setDefaultButtonCell:[speakButton cell]];

   // debugging
   NSButtonCell *def = nil;
   def = [[speakButton window] defaultButtonCell];
}

I made the connections in IB to both windView and speakButton and  
they look
OK (compared to those in Apple's BackgroundExporter sample code.  I  
tried

using the content view as well as the button itself to get the window.
Neither works.  My button is not blue or pulsing and the Return key  
does
nothing.  The def variable *does* get the correct result (judging by  
self

variables).  Using windView to get the window does not help.

Calling
[speakButton setKeyEquivalent:@\r];
did not work either.

Even though my code and the BackgroundExporter seem the same to me,  
I am

obviously missing something.

Any tips, from anyone?

TIA.

--
Mike McLaughlin

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/robertcerny%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: A documetation suggestion (was Re: Cocoa et al as HCI usability problem)

2008-05-22 Thread Jonathan Hendry
Perhaps a better way of doing this would be a web or WebKit app with  
two panes. One that shows the Apple docs at Apple's site, and the  
other pane points to a page at a non-Apple wiki site that corresponds  
to the currently displayed Apple site.


That would ensure that the Apple content stays up to date, while  
allowing unlimited wiki commenting.


- Jon

On May 22, 2008, at 10:39 AM, Julius Guzy wrote:



On 22 May 2008, at 4:55, David Casseres wrote:


That's a really good idea, your wiki-that's-more-than-a-wiki.

You're in charge!

8^{)


Ha Ha

But just as a matter of interest, how would one set about talking  
to apple about such a thing?
I would guess one would need first to demonstrate some kind of a  
consensus

and then thrash out a suitable format and mechanism within the group?

Julius


On May 19, 2008, at 5:31 AM, Julius Guzy wrote:


Well I never thought I would cause this much discussion.
I have tried but do not have the time needed to reply to all.
I might still but work must take precedence.

There have been a number of people who suggested I give specific  
instances of documentation failure.

I agree it would be useful but I am not going to.
The process would require far more analysis than I can afford at  
present.
Let me see however if I can summarise some of the discussion and  
finish with a suggestion.


The current documentation works for some people and not for others.
Those who find it adequate tend to be those who know how to  
program the machine.
Those who find it less than adequate are those learning how to  
program the machine.
Most of those learning how to use the machine already have  
considerable experience in programming in a wide variety of  
languages and on a wide range of platforms.
Most of those learning to use the machine have put quite a bit of  
time and effort into doing so.

This list contains a lot of people happy to share their expertiese.
There is a need to identify particular difficulties with the  
documentation etc.


Ok to cut to the chase.
There exists a very large body of documentation belonging to  
Apple and which ultimately we all need to be acquainted with if  
we are to get the most out of the machine.

This documentation is a resource that could be built on.

I wonder if Apple would be prepared to provide a copy of its  
documentation that could be turned into some kind of a wiki?


There already exists a cocoa wiki but it suffers from the fact  
that the scope of the problem is far too large  even for a  
dedicated band of people to tackle in their spare time without  
this additional resource.
Starting with a ready made body of information would have a  
greater chance of success.


When I say some kind of wiki I do not actually mean a wiki.
That it seems to me, would be a huge undertaking.

What I have in mind is more of an FAQ approach.
For instance take a page documenting something like NSString or  
NSArray .
Then for each of the sub-headings/sections whatever there would  
be provided a means for entering questions and providing answers  
to those questions.
Tthe entry of a question would cause an email to be sent to a  
list which specialises in programming problems or to a list  
created specifically for this pupose and similarily for the answers.
When people see the email they can if they wish go to the  
documentation and provide an answer.

When people see an answer they can comment upon it, extend it etc.

I would keep it all very simple and very basic so it stays  
managable.

If useful it would acquire its own dynamic.

I think the advantages of such an approach might be considerable.
1. We discover exactly where the difficulties lie.
2. We provide ready answers to those difficulties.
3. People are encouraged to explore the documentation
4. The documentation becomes up to date, errors are corrected etc.
5. There is little extra effort expended in providing the answers  
than would be spent doing so on this list

6. The context of the question and the reply is that much more clear
7. There is a build up of information concerning a specific  
problem all in the same place.

8. It builds a self help community.
9. It could result in a pretty good piece of documentation.

It is just a thought
must rush

Julius

http://juliuspaintings.co.uk



___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/casseres%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:

Re: Newbie query re default buttons

2008-05-22 Thread Robert Cerny

Just FYI,
[myButton setKeyEquivalent:@\r]; is the correct way to set button to  
Default. Are you sure that speakButton is not nil?


Robert
On 22.5.2008, at 16:51, Michael McLaughlin wrote:

As a Cocoa newbie (after years of Carbon), I am working my way  
through the

3rd edition of Hillegass' book.  I finished his SpeakLine example then
thought I'd challenge myself by making the Speak button the default  
button

-- but failed.

I coded the following

*** AppController.h

@interface AppController : NSObject {
   IBOutlet NSTextField *textField;
   NSSpeechSynthesizer *speechSynth;

   IBOutlet NSView *windView;  -- content view, added
   IBOutlet NSButton *speakButton; -- added
}

- (IBAction)sayIt:(id)sender;
- (IBAction)stopIt:(id)sender;
@end

*** added to AppController.m

- (void)awakeFromNib {
   [[speakButton window] setDefaultButtonCell:[speakButton cell]];

   // debugging
   NSButtonCell *def = nil;
   def = [[speakButton window] defaultButtonCell];
}

I made the connections in IB to both windView and speakButton and  
they look
OK (compared to those in Apple's BackgroundExporter sample code.  I  
tried

using the content view as well as the button itself to get the window.
Neither works.  My button is not blue or pulsing and the Return key  
does
nothing.  The def variable *does* get the correct result (judging by  
self

variables).  Using windView to get the window does not help.

Calling
[speakButton setKeyEquivalent:@\r];
did not work either.

Even though my code and the BackgroundExporter seem the same to me,  
I am

obviously missing something.

Any tips, from anyone?

TIA.

--
Mike McLaughlin

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/robertcerny%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: File Manager and FSRefs [was: creating a resource fork and writing raw bytes to it]

2008-05-22 Thread Jens Alfke


On 21 May '08, at 11:49 PM, Charles Srstka wrote:

Is it really vital functionality, though? Resource forks have been  
deprecated for some time now, and FSRefs, while useful and well- 
liked by many users, don't really seem to be on Apple's radar these  
days.


There's a ton of other functionality in Files.h besides those. Scroll  
through it sometime. The first thing that comes to my mind is the  
directory iteration functions, which are (a) the most efficient way to  
list directories, and (b) return a lot more information than  
NSFileManager (and I think even more than stat.) There's also  
PBCatSearch, hands-down the fastest way to find a file on an HFS or  
AFP volume.


FSRefs are also highly filesystem-dependent, and HFS+, the only file  
system (as far as I know) that currently fully supports them, is  
showing its age and ready to be replaced, possibly by a file system  
like ZFS that wasn't invented by Apple.


FSRefs work on any filesystem, but they work better on ones that have  
stable file IDs that can be used instead of paths. I'm pretty sure ZFS  
would fulfill that requirement.


Anyway, this discussion is probably better suited to filesystem-dev at  
this point (guess this is my morning for redirecting threads to other  
lists...)


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: PMSessionEndDocumentNoDialog error code -43

2008-05-22 Thread Jens Alfke


On 22 May '08, at 7:15 AM, Torsten Curdt wrote:


Anyone an idea what error code -43 could be?


fnfErr (file not found). I still know that one by heart :)

Look in MacErrors.h, the central listing of Carbon error codes. In  
general, any time you get an error from any API that's a negative  
number (down to -5 or so), it's probably in there.


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Fighting NSCollectionView for first Responder

2008-05-22 Thread Daniel Vollmer

Hi all,

I have an NSCollectionView in whose item-views I want to do some event  
handling (validateMenuItem: to enable / disable the events that  
currently make sense and a bit of keyboard / mouse input), but I'd  
also like the NSCollectionView to handle the selection of items.
So I pass the mouseDown event to [super mouseDown] so that it  
eventually reaches the NSCollectionView so it can handle updating the  
selection. This makes the item-view lose firstResponder and my event  
handling ambitions are foiled. Now, I make the item-view  
firstResponder again in its setSelected setter (which is bound to  
the representedItem.selected property, so it gets called after the  
NSCollectionView handles the selection).
Unfortunately, if I add a new item to the NSCollectionView (via its  
NSArrayController), I once again lose first responder* and I have no  
idea how to regain it, so my event handling / keyboard shortcuts work  
properly again...


* backtrace for who causes my item-view to lose firstResponder:
#1  0x95f9a355 in -[NSWindow makeFirstResponder:] ()
#2  0x964e4625 in _NSDiscardEditingForView ()
#3  0x9657ea69 in -[NSCollectionView _contentChanged:regenerate:] ()
#4  0x9657b2c5 in -[NSCollectionView setContent:] ()
#5  0x965651b2 in -[NSCollectionViewBinder _updateContent] ()
#6  0x96565260 in -[NSCollectionViewBinder  
_observeValueForKeyPath:ofObject:context:] ()

#7  0x93b9358e in NSKVONotify ()
#8  0x93b23e45 in -[NSObject(NSKeyValueObservingPrivate)  
_notifyObserversForKeyPath:change:] ()

#9  0x95e9e15e in -[NSController _notifyObserversForKeyPath:change:] ()
#10 0x95e9e05f in -[NSController didChangeValueForKey:] ()
#11 0x960b9e88 in -[NSArrayController  
didChangeValuesForArrangedKeys:objectKeys:indexKeys:] ()
#12 0x960b in -[NSArrayController  
_insertObject:atArrangedObjectIndex:objectHandler:] ()
#13 0x960b96e2 in -[NSArrayController  
insertObject:atArrangedObjectIndex:] ()

#14 0x960b9406 in -[NSArrayController addObject:] ()

The new firstResponder after the above incident is my main window. :(

Any insight? Or is there a different way of handling things?


Thanks,
Daniel.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Displaying NSAttributedStrings in an NSTableView with non-uniform row height

2008-05-22 Thread Jens Alfke


On 22 May '08, at 5:53 AM, Christian Moen wrote:


In order to get the row height correctly, I understand I need to
implement tableView:heightOfRow:.  How can I find out how high my row
needs to be?  I know I can call size on an NSAttributedString, but the
height returned doesn't take line breakage introduced by the
NSTableColumn into account.


Try using
- (NSRect)boundingRectWithSize:(NSSize)size options: 
(NSStringDrawingOptions)options;

which lets you specify a width.

Make sure you cache the results of this, as it's a pretty expensive  
call. For example, keep an array that caches the height of every row,  
and invalidate the array if a column changes width, or an individual  
item if the row's text changes.


—Jens



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Trying to understand -- please help...

2008-05-22 Thread Greg Titus


On May 21, 2008, at 12:37 PM, Johnny Lundy wrote:


This is just one example of that little tidbit that is always left  
out of these references by Apple. It seems to be the .O. for some  
reason. The tidbit isn't some extraneous bell or whistle; it's  
always something fundamental.


They can't take 2 lines instead of 1 to document the behavior of a  
class method?


A lot of people have already mentioned that the memory management  
semantics for these methods are the same everywhere and are described  
in the conceptual documentation. I'd like to answer the obvious follow  
up question: even if it is described in the concept docs, how would it  
hurt to repeat it in the NSArray class method references? It is just  
one more line...


The reason is that the location of the information says something very  
important about its specificity or generality.


Let me use the class hierarchy as a comparison point: An NSView has  
bounds and a frame and subviews. Those things are described in the  
NSView documentation. An NSScrollView also has bounds and a frame and  
subviews, but those aren't described in the NSScrollView  
documentation. Why? Because if you just looked at the NSScrollView  
docs and saw them there you could be left with the mistaken impression  
that bounds/frame/subviews are specific to scroll views. If those  
things were there it might make it easier to learn how to set the  
frame rectangle of a scroll view when you specifically needed to use a  
scroll view, but you would miss the very important lesson that _all_  
views work this way. It would, in fact, take a long time and a lot of  
use of various types of views to realize that - hey - these all work  
the same way in important respects. Worse, until you did finally  
figure that out, you'd be trying to use different views in different  
ad hoc ways instead of realizing that they all shared common  
functionality and ways of interacting with each other.


Re-describing all the superclass functionality in the subclass might  
seem like it puts all the information in one place if you are using  
the subclass, but it loses all sense of the overall design. Of what  
parts are specific to the class you are looking at and what parts are  
more general. And that sense of the overall design is a vastly more  
important thing to learn than the specific use of any one class.


This might seem obvious in the case of views because it is a type of  
abstraction that is very common in lots of languages. Now let's return  
to the memory management semantics: exactly like a subclass and  
superclass relationship, we don't want to re-describe the memory  
management semantics in each class reference because then you'd never  
learn that there are overarching rules to the design, which is a much  
more important thing to learn than what specifically happens with any  
one particular method. I think people new to Cocoa get into trouble  
with this specific topic because in most C-like languages, the most  
complicated thing about any API is the memory management semantics.  
Different libraries do very different things. Pass in your own  
buffers, have to free returned buffers, have to use some library- 
specific free()-like return-the-memory APIs, et cetera. The memory  
management style tends to be quite inconsistent and needs to be  
documented everywhere because different API calls can have different  
requirements. That this is _not_ the case in Cocoa is extremely  
important.


Hope this helps,
- Greg


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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 rights.

2008-05-22 Thread Eugen Belyakov
I want to create updater for my application. The problem is that application
can be update not by the user, that installed it. And updater application
won't be able to overwrite files. Is it possible to increase rights of my
application through authentification (like in Finder when performing
operations with files of other users)?
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: ImageCapture API versions

2008-05-22 Thread Thomas Engelmeier


On 21.05.2008, at 22:39, Rick Mann wrote:



On May 20, 2008, at 12:28:22, A.M. wrote:

Which camera is this? Image Capture has no native API for remote  
control


Actually, PTP has an specified command (getProperty / setProperty) and  
IIRC Image Capture SDK for 10.4 had a functional equivalent.


Unfortunately
- ImageCapture grabs the few default properties it knows about at  
device connect time and caches them
- Leopard IIRC deprecated the get/setProperty equivalents so one has  
to resort to PTP pass-through
- Last !least Canon (in contrary to Nikon) uses custom commands to  
access most properties.


  you could potentially use PTP pass-through if you have the camera  
protocol docs or reverse-engineered protocol info.


The protocol will definitely be PTP, so one has to reverse engineer  
only the transfered data. While it's trivial for most tasks, I  
couldn't get it to work yet for live video from my D300.


 I had hoped it would do better than what you're describing.

Actually, it _is_ better. You really should try the (10.4) Image  
Capture SDK samples. Just don't waste your time trying to manipulate  
shutter speed / aperture etc. with it.
My comments above regard _full_ control of a DSLR, like the 80  
internal settings of a Nikon D80 or 100+ of a D300 DSLR


Regards,
Tom_E

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Cocoa et al as HCI usability problem

2008-05-22 Thread Andy Lee

On May 22, 2008, at 7:46 AM, Jeff LaMarche wrote:

On May 21, 2008, at 9:58 PM, Andy Lee wrote:

There's already an inherent lower bound on the barrier to entry for  
Cocoa.  You have to understand certain fundamentals -- some  
conceptual, some procedural.  If you don't have those fundamentals,  
you'll never make Cocoa work.  There is also a set of people on  
this planet who are trying to grasp those fundamentals and are  
perfectly capable of doing so.  To argue that it's better for the  
platform if those people take a little longer to become proficient  
at Cocoa seems to me a bit odd.


I'm not entirely sure that's exactly what is being argued, but even  
if it is, weird opinions can be perfectly valid. Graham stated  
what he intended in his recent e-mail better than I can, so there's  
no point in me re-hashing it.


Suffice it to say, I think there is some merit to this weird idea  
that you should learn the culture and the conceptual underpinnings  
in addition to the syntax of the language and names of classes and  
methods if you want to succeed


I agree with this last sentence and I didn't mean to call this idea  
weird.


I think we have a disconnect as to what you meant by lowering the  
barriers -- hence my reference to that particular phrase.



(and that takes time, no matter how good the documentation).


That's right.  Improving documentation, publishing third-party books,  
offering courses, etc. can only lower the barriers so far.  The only  
way to lower them any further would be to radically change the  
frameworks and APIs themselves, and I don't think anybody was asking  
for that.  The vast majority of this thread, if not all of it, has  
been about people struggling to understand the frameworks as they are.


If these people need to RTFM, that's one thing.  But if there are  
barriers we can lower, *short* of dumbing down and idiot-proofing the  
frameworks and APIs themselves, I think it's good for the platform to  
do so.


The Mac market is different and has different expectations, and much  
of those expectations exist because developers (by and large) do  
read and understand the conceptual docs and conform to a set of  
conventions gleaned from them unless there's a compelling reason not  
to.


Many of those expectations existed before there was Cocoa, before  
there was NextStep, at a time when the conceptual barriers to entry  
were much lower.  I would guess that a lot of credit goes to the  
existence and adoption of the HIG, at least as much as the API  
documentation.  Most of this thread, if not all, has NOT been about  
people failing to read the HIG.


The people who don't read the conceptual docs or understand them (yet)  
are not going to flood the market with crappy Mac software, because  
their apps aren't going to work.  If there's a threat at all, it's  
from the people who know how to write Cocoa apps, but not write *good*  
Cocoa apps.  I don't think the answer to that is barriers; I hold out  
hope that the expectations of the market would weed out the crappy  
stuff.  But as you say, it's okay to disagree.


--Andy

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Multi-storage Core Data

2008-05-22 Thread Rob Napier

On May 17, 2008, at 3:54 PM, Jim Correia wrote:


On May 17, 2008, at 3:00 PM, Keary Suska wrote:


on 5/17/08 10:27 AM, [EMAIL PROTECTED] purportedly said:

I'm trying to build a Core Data app for which some data is user- 
provided and
some data is shipped with the program. Consider a travel itinerary  
program
for instance where the user has a trip from airport A to airport  
B. If the
program includes data about the airports themselves, that  
shouldn't be
stored in the same storage as the user's flight numbers. One is  
document

based and the other is shared across documents.

I understand the basic idea of using Fetched Properties and how to  
create
them. What I'm not clear on is how to define a fetched property in  
one store
against objects in another store, or how to tie multiple stores  
together
into a context. Is there a good explanation or sample code for  
this kind of

setup?


I don't believe there is any support for this, at least not  
automatically.
You would have to provide glue code for any interactions between  
Managed

Object Contexts (MOCs), since each MOC is married to one storage.


This is not quite correct.

A MOC is associated with a persistent store coordinator. A PSC can  
have multiple stores associated with it.


What you do not get for free is cross-store relationships.


Which is how I understood it, and I'm willing to write some glue here.  
But do you have any pointers on how to get started with that? I  
haven't been able to figure out with a multi-store PSC, how to direct  
some objects to one store and others to another. Examples of using  
fetched properties to create cross-store relationships are also seems  
pretty thin in the main docs. Are there any good references on Core  
Data beyond the fairly straight-forward Department app?


It looks like there have been many CD improvements in Leopard  
(transformable attributes being the one that really jumps out to me).  
It looks like it may be time for me to re-read all the docs and try  
again with the new 10.5 features.


-Rob
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Application rights.

2008-05-22 Thread j o a r


On May 22, 2008, at 8:43 AM, Eugen Belyakov wrote:

I want to create updater for my application. The problem is that  
application
can be update not by the user, that installed it. And updater  
application
won't be able to overwrite files. Is it possible to increase rights  
of my

application through authentification (like in Finder when performing
operations with files of other users)?



I would advice against trying to write your own installer / updater.  
This is very difficult to get right, even if you are an expert Mac OS  
X developer. It's not just a technical problem, you would also have to  
know about the guidelines for where files should be installed on Mac  
OS X, how users expect installers to work on Mac OS X, et.c.


I would suggest that you look at one of the existing updaters, like  
Sparkle:


http://sparkle.andymatuschak.org/

Or to Apple's installer:

	http://developer.apple.com/documentation/DeveloperTools/Conceptual/PackageMakerUserGuide 

	http://developer.apple.com/documentation/DeveloperTools/Conceptual/SoftwareDistribution 



j o a r


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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 an id?

2008-05-22 Thread j o a r


On May 22, 2008, at 10:05 AM, john darnell wrote:


The question is, what does the code want me returning as an id?

I tried to do a search in Cocoa Help on id and as you might imagine, I
got lots and lots of hits, none of which looked anywhere near what I
wanted for an explanation of what id is.  So what is the framework
expecting me to return?



It expects you to return an object that will be used by the cells in  
your table view to display their respective value.


The type of object to return would depend on the cell type used for  
that particular column-row intersection. A string if you're using a  
text cell, an image if you're using an image cell, and so on.


The reason for using id here is to allow you to use any type of  
object value as the source of data for your cell to display.


j o a r


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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 an id?

2008-05-22 Thread Sherm Pendley
On Thu, May 22, 2008 at 1:05 PM, john darnell [EMAIL PROTECTED]
wrote:

The question is, what does the code want me returning as an id?


Any object.

The next obvious question is, of course, why not declare the method as
returning an NSObject* - and the answer to that one is that, simply put, not
all Cocoa objects descend from NSObject.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.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 [EMAIL PROTECTED]


Re: What is an id?

2008-05-22 Thread Andrew Merenbach

Hi, John,

There have been discussions on this list in the past, some of which  
might (or might not!) be helpful.  Some, IIRC, lapsed into debate as  
to whether the id concept (a) was a bad idea, (b) was useless, (c)  
was confusing, or (d) made things difficult.  Basically, id isn't  
exactly a type -- just a typedef.  In objc.h:


typedef struct objc_class *Class;
typedef struct objc_object {
Class isa;
} *id;

So it's basically a typedef for an Objective-C object.  It's *not*,  
however, equivalent entirely to, say using NSObject *, since if  
NSObject doesn't implement a method, you'll get a warning.  For  
instance:


id del = [NSApp delegate];
[del myAction];

is not the same as:

NSObject *del = [NSApp delegate];
[del myAction];

As long (IIRC) as you #import your application delegate's header (in  
this example) into the .m file that contains the first two lines of  
above code, the compiler will say, well, there's a method of this  
name -- perhaps this id refers to it.  I won't throw a warning!  With  
the NSObject version, however, you'll absolutely get a warning.  Also,  
I believe that the id typedef can also point to objects that are *not*  
descendants of NSObject, which may or may not be of relevance to you,  
but is a good point, IMHO.


There are other advantages, IIRC, and possibly some disadvantage, but  
I can't think of them off the top of my head.


Hope this helps!

Cheers,
Andrew

On May 22, 2008, at 10:05 AM, john darnell wrote:

Okay, this is a really basic question, but I need some help figuring  
out

what the code wants.

In the documentation for NSTableView, I am told that I must  
implement as

part of a datasource the following function:

- (id) tableView:(NSTableView *) aTableView
objectValueForTableColumn: (NSTableColumn *) aTableColumn
  row: (int) row
{
  /*  some code here */
  return id;
}

The question is, what does the code want me returning as an id?

I tried to do a search in Cocoa Help on id and as you might imagine, I
got lots and lots of hits, none of which looked anywhere near what I
wanted for an explanation of what id is.  So what is the framework
expecting me to return?

R,
John A.M. Darnell
Team Leader
Walsworth Publishing Company
Brookfield, MO
John may also be reached at [EMAIL PROTECTED]

Trivia Question:  In SciFi Channel's hit series, FARSCAPE, who played
the voice of Pilot?
Answer:  The voice of Pilot was played by Lani Tupu, the same actor  
who

played the villain-turned-refugee, Crais.

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/andrew.merenbach%40ucla.edu

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: Cocoa et al as HCI usability problem

2008-05-22 Thread Andy Lee

On May 22, 2008, at 12:17 PM, Sherm Pendley wrote:

On Thu, May 22, 2008 at 12:02 PM, Andy Lee [EMAIL PROTECTED] wrote:

The vast majority of this thread, if not all of it, has been about  
people struggling to understand the frameworks as they are.


We're talking subjective impressions here, so there's no wrong or  
right to it, but that's not what I'm getting from this thread.


It looks to me like people are struggling to understand the  
frameworks in terms of platforms with which they're already familiar.


That may be, but that is different from demanding that Apple lower  
the barriers by changing Cocoa itself to resemble those platforms.  I  
keep harping on that phrase because it is specifically what I was  
responding to in Jeff's post, and to some extent Graham's.


I believe that if they were truly trying to understand the  
frameworks *as they are*, rather than as minor variations of themes  
also found in Java, C++, .NET, etc., they'd be having far less  
trouble with it.


This, I believe, is where the docs fail. There is plenty of  
introductory material, but no real emphasis is put on the point that  
programmers from other platforms really, really do need that  
material - so those folks tend to skip it, believing that Cocoa is  
as similar to Java, C++, or .NET as those are to one another. In  
fact, it's very different, and the docs are weak on emphasizing that  
fact.


I suspect we violently agree on the major substantive issues, if not  
always on tone and on some of the side issues.  Thanks for this and  
your previous reply, which also made sense.


--Andy

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: What is an id?

2008-05-22 Thread Andrew Merenbach

Not that I want to respond to myself, but I want to correct:

You'll get a warning if an action call is not implemented by NSObject.

Sorry for the confusion!

Also, I want to state that I do feel that id is a very useful thing,  
despite how my first paragraph below makes it sound.  But that's just  
my own opinion.


Cheers,
Andrew

On May 22, 2008, at 10:16 AM, Andrew Merenbach wrote:


Hi, John,

There have been discussions on this list in the past, some of which  
might (or might not!) be helpful.  Some, IIRC, lapsed into debate as  
to whether the id concept (a) was a bad idea, (b) was useless, (c)  
was confusing, or (d) made things difficult.  Basically, id isn't  
exactly a type -- just a typedef.  In objc.h:


typedef struct objc_class *Class;
typedef struct objc_object {
   Class isa;
} *id;

So it's basically a typedef for an Objective-C object.  It's *not*,  
however, equivalent entirely to, say using NSObject *, since if  
NSObject doesn't implement a method, you'll get a warning.  For  
instance:


id del = [NSApp delegate];
[del myAction];

is not the same as:

NSObject *del = [NSApp delegate];
[del myAction];

As long (IIRC) as you #import your application delegate's header (in  
this example) into the .m file that contains the first two lines of  
above code, the compiler will say, well, there's a method of this  
name -- perhaps this id refers to it.  I won't throw a warning!   
With the NSObject version, however, you'll absolutely get a  
warning.  Also, I believe that the id typedef can also point to  
objects that are *not* descendants of NSObject, which may or may not  
be of relevance to you, but is a good point, IMHO.


There are other advantages, IIRC, and possibly some disadvantage,  
but I can't think of them off the top of my head.


Hope this helps!

Cheers,
Andrew

On May 22, 2008, at 10:05 AM, john darnell wrote:

Okay, this is a really basic question, but I need some help  
figuring out

what the code wants.

In the documentation for NSTableView, I am told that I must  
implement as

part of a datasource the following function:

- (id) tableView:(NSTableView *) aTableView
objectValueForTableColumn: (NSTableColumn *) aTableColumn
 row: (int) row
{
 /*  some code here */
 return id;
}

The question is, what does the code want me returning as an id?

I tried to do a search in Cocoa Help on id and as you might  
imagine, I

got lots and lots of hits, none of which looked anywhere near what I
wanted for an explanation of what id is.  So what is the framework
expecting me to return?

R,
John A.M. Darnell
Team Leader
Walsworth Publishing Company
Brookfield, MO
John may also be reached at [EMAIL PROTECTED]

Trivia Question:  In SciFi Channel's hit series, FARSCAPE, who played
the voice of Pilot?
Answer:  The voice of Pilot was played by Lani Tupu, the same actor  
who

played the villain-turned-refugee, Crais.

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/andrew.merenbach%40ucla.edu

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/andrew.merenbach%40ucla.edu

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: What is an id?

2008-05-22 Thread Jens Alfke


On 22 May '08, at 10:11 AM, j o a r wrote:

It expects you to return an object that will be used by the cells in  
your table view to display their respective value.


To be specific, the value you return is passed to the cell's - 
setObjectValue: method. So you should return a value that's  
appropriate for the type of cell in that column — for a text column  
that would be an NSString or NSAttributedString, for an image column  
an NSImage, for a checkbox or slider an NSNumber...


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Cocoa et al as HCI usability problem

2008-05-22 Thread Hamish Allan
On Thu, May 22, 2008 at 5:02 PM, Andy Lee [EMAIL PROTECTED] wrote:

 I think we have a disconnect as to what you meant by lowering the barriers
 -- hence my reference to that particular phrase.

I'd like to point out that the barrier to which my post referred to
was that of *commitment* to the Cocoa design philosophy, and the
specific side-effect I didn't mind was gentle growth of the platform:

On Mon, May 19, 2008 at 9:04 PM, Hamish Allan [EMAIL PROTECTED] wrote:

 On Mon, May 19, 2008 at 6:03 AM, Peter Duniho [EMAIL PROTECTED] wrote:

 And as long as you guys keep insisting that there's nothing wrong with the
 environment, and that people just need to get used to it and then they'll
 love it, you're not going to get the kind of developer excitement needed to
 ensure the kind of developer support required to get the Mac really into the
 mainstream.  At a minimum, market growth is going to happen a LOT more
 slowly than it could otherwise.

 I don't see that as a particularly bad thing. I don't want to see my
 platform of choice suddenly awash with apps written by people who
 don't want to take the time to understand the whole picture. I'm
 pretty sure such apps would be less likely to conform to the HIG, and
 less likely to have been properly profiled for performance.

I guess the documentation could arguably be made better by continually
repeating the mantra that the conceptual documents need to be read and
understood; but, isn't that what this mailing list is for? ;)

Hamish
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Cocoa et al as HCI usability problem

2008-05-22 Thread Andy Lee

On May 22, 2008, at 12:39 PM, Jeff LaMarche wrote:

On May 22, 2008, at 12:02 PM, Andy Lee wrote:
Most of this thread, if not all, has NOT been about people failing  
to read the HIG.


I did not mention the HIG on purpose. Although I suggest reading it,  
consistency goes far beyond conforming your UI to the HIG. Working  
with Cocoa rather than trying to force it to use design patterns and  
philosophies from other languages and platforms will very often, as  
a side effect, make your application non-standard in subtle but  
potentially frustrating ways for your user. Of course, until you  
have the big picture, it's hard to see how that could be true but,  
trust me, it is.


Maybe.  Can you give some examples?

--Andy

___

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

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

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

This email sent to [EMAIL PROTECTED]


NSString vs NSPathStore2

2008-05-22 Thread andrew

Hi, 

I am then trying to populate an NSTableView with a filename obtained from a
NSOpenPanel. The problem is that NSOpenPanel seems to return a NSPathStore2
and not an NSString, which seems to be causing problems. Is there are a way
to convert NSPathStore2 to an NSString? 

Thanks,
Andrew 

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Newbie query re default buttons

2008-05-22 Thread Michael McLaughlin
Robert Cerny wrote:

Just FYI,
[myButton setKeyEquivalent:@\r]; is the correct way to set button to
Default. Are you sure that speakButton is not nil?

The button is OK.

I found that I could get the button to work by entering the Return key
equivalent in IB, stubbing out awakeFromNib.  However, the *appearance* of
the button is still non-default.

Also, Hillegass instructs to set up the FirstResponder of the window to
point to the textField.  I had done that earlier and thought that it might
be interefing so I eliminated it along with the entire textField in IB, then
made a new textField without messing with FirstResponder.  I found that the
textField behaves just as though the FirstResponder still existed (perhaps
this is a new default behavior with a single textField).  The button
appearance was not fixed.

So, right now, the button works as though it were the default (thanks to the
IB key equivalent field) but it does not *look* like a default button.  I
searched again for some difference in what I did vs. what the
BackgroundExporter code looks like and cannot find any real differences.
Moreover, the debugger behaves as though all it well -- no errors, no nil
outlets.

BTW, all of this is with Xcode 3.0 and OS 10.5.2.

On 22.5.2008, at 16:51, Michael McLaughlin wrote:

 As a Cocoa newbie (after years of Carbon), I am working my way
 through the
 3rd edition of Hillegass' book.  I finished his SpeakLine example then
 thought I'd challenge myself by making the Speak button the default
 button
 -- but failed.

 I coded the following

 *** AppController.h

 @interface AppController : NSObject {
IBOutlet NSTextField *textField;
NSSpeechSynthesizer *speechSynth;

IBOutlet NSView *windView;  -- content view, added
IBOutlet NSButton *speakButton; -- added
 }

 - (IBAction)sayIt:(id)sender;
 - (IBAction)stopIt:(id)sender;
 @end

 *** added to AppController.m

 - (void)awakeFromNib {
[[speakButton window] setDefaultButtonCell:[speakButton cell]];

// debugging
NSButtonCell *def = nil;
def = [[speakButton window] defaultButtonCell];
 }

 I made the connections in IB to both windView and speakButton and
 they look
 OK (compared to those in Apple's BackgroundExporter sample code.  I
 tried
 using the content view as well as the button itself to get the window.
 Neither works.  My button is not blue or pulsing and the Return key
 does
 nothing.  The def variable *does* get the correct result (judging by
 self
 variables).  Using windView to get the window does not help.

-- 
Mike McLaughlin

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: A directory site for open-source Cocoa components?

2008-05-22 Thread Bill Garrison


On May 22, 2008, at 12:29 PM, Jens Alfke wrote:

There are quite a lot of open source Cocoa components these days —  
everything from small utility classes, to new controls, to entire  
frameworks — but no easy way to find them all. I keep running into  
various people's websites that list a handful of components, some of  
them extremely useful, and I'm sure there are more I haven't seen.


I don't know of any website that acts as a directory of these. If  
there really isn't one, maybe we should create one. It wouldn't  
necessarily need to be the whole ___Forge deal, with source  
hosting and bug tracking and all, though that wouldn't hurt; the  
main thing is just to provide a way to register these projects and  
their descriptions, and then search the directory.


Anyone interested? (Or know of an existing site that I've overlooked?)


http://www.cocoatraces.com  is a new one to me.

I usually look at http://www.cocoadev.com/index.pl?ObjectLibrary, or  
query Google.


Bill___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSString vs NSPathStore2

2008-05-22 Thread j o a r


On May 22, 2008, at 10:38 AM, [EMAIL PROTECTED] wrote:

I am then trying to populate an NSTableView with a filename obtained  
from a
NSOpenPanel. The problem is that NSOpenPanel seems to return a  
NSPathStore2
and not an NSString, which seems to be causing problems. Is there  
are a way

to convert NSPathStore2 to an NSString?



How do you determine that this is a problem? What is the problem?

j o a r


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSString vs NSPathStore2

2008-05-22 Thread David Duncan

On May 22, 2008, at 10:38 AM, [EMAIL PROTECTED] wrote:

I am then trying to populate an NSTableView with a filename obtained  
from a
NSOpenPanel. The problem is that NSOpenPanel seems to return a  
NSPathStore2
and not an NSString, which seems to be causing problems. Is there  
are a way

to convert NSPathStore2 to an NSString?



NSPathStore2 is not documented anywhere and the documentation for  
NSOpenPanel doesn't reference it. I would recommend reading the  
documentation again, as if your asking your question based on the  
output of -description on the objects returned, then you may be  
needlessly concerning yourself with an implementation detail :)

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



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: What is an id?

2008-05-22 Thread mmalc crawford


On May 22, 2008, at 10:05 AM, john darnell wrote:


I tried to do a search in Cocoa Help on id and as you might imagine, I
got lots and lots of hits, none of which looked anywhere near what I
wanted for an explanation of what id is.

http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/chapter_3_section_3.html#//apple_ref/doc/uid/TP40002974-CH4-DontLinkElementID_74 



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


Re: Newbie query re default buttons

2008-05-22 Thread Robert Cerny

Hi,
could you send me your project off list? I will check it and let you  
know what's wrong. (If I find it of course)


Robert

On 22.5.2008, at 19:39, Michael McLaughlin wrote:


Robert Cerny wrote:



Just FYI,
[myButton setKeyEquivalent:@\r]; is the correct way to set button  
to

Default. Are you sure that speakButton is not nil?


The button is OK.

I found that I could get the button to work by entering the Return key
equivalent in IB, stubbing out awakeFromNib.  However, the  
*appearance* of

the button is still non-default.

Also, Hillegass instructs to set up the FirstResponder of the window  
to
point to the textField.  I had done that earlier and thought that it  
might
be interefing so I eliminated it along with the entire textField in  
IB, then
made a new textField without messing with FirstResponder.  I found  
that the
textField behaves just as though the FirstResponder still existed  
(perhaps

this is a new default behavior with a single textField).  The button
appearance was not fixed.

So, right now, the button works as though it were the default  
(thanks to the
IB key equivalent field) but it does not *look* like a default  
button.  I

searched again for some difference in what I did vs. what the
BackgroundExporter code looks like and cannot find any real  
differences.
Moreover, the debugger behaves as though all it well -- no errors,  
no nil

outlets.

BTW, all of this is with Xcode 3.0 and OS 10.5.2.

On 22.5.2008, at 16:51, Michael McLaughlin wrote:


As a Cocoa newbie (after years of Carbon), I am working my way
through the
3rd edition of Hillegass' book.  I finished his SpeakLine example  
then

thought I'd challenge myself by making the Speak button the default
button
-- but failed.

I coded the following

*** AppController.h

@interface AppController : NSObject {
  IBOutlet NSTextField *textField;
  NSSpeechSynthesizer *speechSynth;

  IBOutlet NSView *windView;  -- content view, added
  IBOutlet NSButton *speakButton; -- added
}

- (IBAction)sayIt:(id)sender;
- (IBAction)stopIt:(id)sender;
@end

*** added to AppController.m

- (void)awakeFromNib {
  [[speakButton window] setDefaultButtonCell:[speakButton cell]];

  // debugging
  NSButtonCell *def = nil;
  def = [[speakButton window] defaultButtonCell];
}

I made the connections in IB to both windView and speakButton and
they look
OK (compared to those in Apple's BackgroundExporter sample code.  I
tried
using the content view as well as the button itself to get the  
window.

Neither works.  My button is not blue or pulsing and the Return key
does
nothing.  The def variable *does* get the correct result (judging by
self
variables).  Using windView to get the window does not help.


--
Mike McLaughlin



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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 an id?

2008-05-22 Thread Scott Ribe
 ...for a text column
 that would be an NSString or NSAttributedString,

Also, NSNumber or NSDate.

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


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: What is an id?

2008-05-22 Thread Dave DeLong
This is slightly off topic, but it took me forever to figure out what
ivar meant, because that's my middle name and I don't pronounce it
eye-var, I pronounce it ee-var, which borked up the meaning in my
mind.

For future reference, ivar (beyond being my middle name) is short
for Instance Variable.

Dave

On Thu, May 22, 2008 at 11:05 AM, john darnell
[EMAIL PROTECTED] wrote:
 I tried to do a search in Cocoa Help on id and as you might imagine, I
 got lots and lots of hits, none of which looked anywhere near what I
 wanted for an explanation of what id is.
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Application rights.

2008-05-22 Thread Jerry Krinock


On 2008 May, 22, at 9:46, Sherm Pendley wrote:


On Thu, May 22, 2008 at 12:08 PM, Joseph Kelly [EMAIL PROTECTED] wrote:


Also a question: does anyone know of a Cocoa/obj-C wrapper around
auth-framework? It might be a useful sort of project/tool ;-)


I don't know what is meant by auth-framework, but...


Apple provides an Objective-C interface. It lacks an
AuthorizationExecuteWithPrivileges() method, but I think that Apple  
omitted

that deliberately.


Yes, I believe the idea is that you need to make a tool as in  
BetterAuthorizationSample to do that.  I did make what I consider to  
be a more Cocoa version of the demo in BetterAuthorizationSample  
last month.  The project includes a Cocoa framework which you can use  
in your app to access your tool, which is I believe about as close as  
you can come to having a Cocoa/obj-C wrapper.


No known bugs.  Needs more testing, but since I guess nothing is never  
done, what the hell, here you go...


http://www.sheepsystems.com/sourceCode/authTasksCocoa.html

Note: The HeaderDoc documentation in there covers only the framework.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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]


  1   2   >