Re: CFBundleIconFile: heiß or hot?

2008-08-28 Thread Michael Nickerson


On Aug 28, 2008, at 2:15 AM, Gerriet M. Denkmann wrote:



//  this always works, regardless of name:
- (IBAction)ImageNameD: sender;
{
NSBundle *mainBundle = [ NSBundle mainBundle ];
NSDictionary *infoDictionary = [ mainBundle infoDictionary ];
	NSString *iconFile = [ infoDictionary objectForKey:  
@"CFBundleIconFile" ];	

NSImage *image = [ NSImage imageNamed: iconFile ];
[ imageView setImage: image ];
}



You can make that shorter, by removing the infoDictionary ivar and  
changing the iconFile one to [mainBundle  
objectForInfoDictionaryKey:@"CFBundleIconFile"].


Could someone please show me, where the valid values for  
CFBundleIconFile are documented?

Tiger 10.4.11.



Property List Key Reference:




--
Darkshadow
(aka Michael Nickerson)
http://www.nightproductions.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: Design Question: Bindings & Custom Views

2008-08-28 Thread Oleg Krupnov
> Parts of your first question remind me of a situation that I had. Erik Buck 
> gave me some great advice and part of it was the following:

> If you are worried about adding drawing code to a "Model" object, add the 
> drawing code in a category of * and maintain the category 
> implementation in the "View" subsystem.

> *I changed the words he used here because he used the name of my specific 
> class and I wanted to make it more readable in the general case.

> This will let you put a category into every view that you want to so that 
> your model objects get handled correctly for each view.

This may be indeed a good idea to use categories for this purpose. Is
it what everybody is using?

I have only one problem with this approach: As I mentioned before, I
need to add custom-view specific instance variables (states) to the
model object's category. The Objective-C categories do not allow
adding instance variables, only methods

I am considering to create a dictionary owned by the custom view,
containing state objects keyed by model object unique ID. This is a
kind of surrogate of subclassing the model objects inside the custom
view. I am not sure this is a good idea though. Are there other
approaches?
___

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

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

2008-08-28 Thread Negm-Awad Amin


Am Do,28.08.2008 um 10:15 schrieb Oleg Krupnov:

Parts of your first question remind me of a situation that I had.  
Erik Buck gave me some great advice and part of it was the following:


If you are worried about adding drawing code to a "Model" object,  
add the drawing code in a category of * and  
maintain the category implementation in the "View" subsystem.


*I changed the words he used here because he used the name of my  
specific class and I wanted to make it more readable in the general  
case.


This will let you put a category into every view that you want to  
so that your model objects get handled correctly for each view.


This may be indeed a good idea to use categories for this purpose. Is
it what everybody is using?

I have only one problem with this approach: As I mentioned before, I
need to add custom-view specific instance variables (states) to the
model object's category. The Objective-C categories do not allow
adding instance variables, only methods

I am considering to create a dictionary owned by the custom view,
containing state objects keyed by model object unique ID. This is a
kind of surrogate of subclassing the model objects inside the custom
view. I am not sure this is a good idea though. Are there other
approaches?
If I understood you correct, you think, that you fear a voilation of  
the MVC pattern. Correct?


Think about some points:
- sometimes the shape or something like this is a true part of the  
model. Think about predefined shapes and so on. So there is nothing  
wrong in storing that informtion in the model.
- Can you isolate the "shape-part" (model) from the drawing part  
(obviously depending on view states)?


Just an example: I had a graphic application that drawed some inserted  
shapes. The shape itself is a part of the model, the color of the  
shape, too. But when the user selects a shape (symbol), the color  
should change. So the drawing of the shape depends on a view property.  
I think, this is the core of your problem.


I solved it by returning only bezier paths and colors from the model.  
So the shape itself (model) is still a part of the model, but the  
drawing (depending on the view) is done inside the view. (Simply by  
stroking the paths.)


Cheers,
Amin



___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/negm-awad%40cocoading.de

This email sent to [EMAIL PROTECTED]


Amin Negm-Awad
[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]


NSURLConnection and JavaScript

2008-08-28 Thread dexter morgan
Hello guys,
I'm using NSURLConnection to download a web page. Unfortunatly some
particular pages detects JavaScript compatibility so the result data
is something like "you cannot see this page because you have not js
enabled".
Is there any way to workaround this "problem"?
Thank you so much
___

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

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


[MEET] Aachen CocoaHeads TODAY (August 28, 2008)

2008-08-28 Thread Stefan Hafeneger

Hi everyone,

Aachen CocoaHeads is today (August 28, 2008) at 7PM.

Talk: Stefan Hafeneger, "Developing multi-touch Applications for Mac  
OS X"


Bring along your iPhone or iPod touch and your Mac to participate in  
the workshop.


Please visit http://www.cocoaheads.de/ for location information.

See you there!

Stefan


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: Design Question: Bindings & Custom Views

2008-08-28 Thread Oleg Krupnov
Yes, you are correct. I am looking not to break MVC and also get the
correct implementation of binding in a custom view

> Just an example: I had a graphic application that drawed some inserted
> shapes. The shape itself is a part of the model, the color of the shape,
> too. But when the user selects a shape (symbol), the color should change. So
> the drawing of the shape depends on a view property. I think, this is the
> core of your problem.

Selection may not be a good example, because it is a "global" property
of the view, among all objects in the view, whereas I am talking about
states *per each" object in the view. Such state properties become
particularly indispensable for drawing, because drawRect message is
called "asynchronously", i.e. in the next event loop, not in direct
response to the binding's KVO message. The other case is when I need,
for performance reasons, to associate some view-specific cached data
with an object in the view, to avoid recreating it each time I need
the data to respond to the binding's KVO message.

In other words, I need a way to associate additional
custom-view-specific properties with model object, without adding them
as transitive properties to the model. What is the best way to do
this? Or maybe your point is that this is a bad idea at all and such
problem should not arise, and I need to include everything in the
model? What is the standard workaround suggested in Cocoa?

> I solved it by returning only bezier paths and colors from the model. So the
> shape itself (model) is still a part of the model, but the drawing
> (depending on the view) is done inside the view. (Simply by stroking the
> paths.)

It is not completely clear how this would help me to resolve the above
problem. It is not a problem for me to store the bezier paths and
colors in the model. But what about some volatile custom-view-specific
states that have nothing to do with the model?



The other completely different design I am also considering is to
create and bind a "subview" object for each model object. By "subview"
I mean just a subclass of NSObject that is bound to its model
counterpart. It could work like this: The custom NSView observes its
NSTreeController and when a new child model object is created, the
custom NSView creates the corresponding subview object (All subview
objects are owned by the custom NSView) and binds it to the model
object programmatically. When the model object is changed or removed,
its subview counterpart responds correspondingly. In this manner I
could hold all the view-specific states and cache data in the subview
object. What do you think?




On Thu, Aug 28, 2008 at 11:35 AM, Negm-Awad Amin <[EMAIL PROTECTED]> wrote:
>
> Am Do,28.08.2008 um 10:15 schrieb Oleg Krupnov:
>
>>> Parts of your first question remind me of a situation that I had. Erik
>>> Buck gave me some great advice and part of it was the following:
>>
>>> If you are worried about adding drawing code to a "Model" object, add the
>>> drawing code in a category of * and maintain the category
>>> implementation in the "View" subsystem.
>>
>>> *I changed the words he used here because he used the name of my specific
>>> class and I wanted to make it more readable in the general case.
>>
>>> This will let you put a category into every view that you want to so that
>>> your model objects get handled correctly for each view.
>>
>> This may be indeed a good idea to use categories for this purpose. Is
>> it what everybody is using?
>>
>> I have only one problem with this approach: As I mentioned before, I
>> need to add custom-view specific instance variables (states) to the
>> model object's category. The Objective-C categories do not allow
>> adding instance variables, only methods
>>
>> I am considering to create a dictionary owned by the custom view,
>> containing state objects keyed by model object unique ID. This is a
>> kind of surrogate of subclassing the model objects inside the custom
>> view. I am not sure this is a good idea though. Are there other
>> approaches?
>
> If I understood you correct, you think, that you fear a voilation of the MVC
> pattern. Correct?
>
> Think about some points:
> - sometimes the shape or something like this is a true part of the model.
> Think about predefined shapes and so on. So there is nothing wrong in
> storing that informtion in the model.
> - Can you isolate the "shape-part" (model) from the drawing part (obviously
> depending on view states)?
>
> Just an example: I had a graphic application that drawed some inserted
> shapes. The shape itself is a part of the model, the color of the shape,
> too. But when the user selects a shape (symbol), the color should change. So
> the drawing of the shape depends on a view property. I think, this is the
> core of your problem.
>
> I solved it by returning only bezier paths and colors from the model. So the
> shape itself (model) is still a part of the model, but the drawing
> (depending on the view) is done inside the v

Re: NSURLConnection and JavaScript

2008-08-28 Thread Andrew Farmer

On 28 Aug 08, at 01:38, dexter morgan wrote:

I'm using NSURLConnection to download a web page. Unfortunatly some
particular pages detects JavaScript compatibility so the result data
is something like "you cannot see this page because you have not js
enabled".
Is there any way to workaround this "problem"?


Two possibilities:

1. The page you are downloading really does say that (in a   
tag, perhaps), so you'll need to either run the script or emulate it  
to get the content you're looking for.


2. The server is doing user-agent sniffing and sending this message to  
clients which have an agent that it doesn't recognize. (This is evil.)  
You can construct a NSMutableURLRequest with a custom user-agent  
header to counter this.

___

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

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

2008-08-28 Thread Negm-Awad Amin

Okay, I  – hopefully – understand you now:
You have a view with some (model) objects displayed.
There is another view (potentially or really?) that can display these  
objects, too
The additional attributes are specific for each displayed object and  
each view?

Correct? (There is a german phrase: "The hope dies last")

So you have an n-to-m relationship between between objects and views.  
And you have additional attributes for each of these relationship  
"instances". ( … for every concrete relationship.)


Yes, IMHO it is a good idea to "personalize" (bad translation, I do  
not know a better one) this relationship and represent it with  
instances of a special class.


I did something similiar (if I understood you correct) inside the  
model layer (this does not really matter here)  in a lawfirm  
application. I had the problem, that I had an n-to-m relationship  
between files and clients. On each "instance" of the relationship I  
needed some additional attributes. (Something like the state of the  
client related to this file.) I broke the n-to-m relationship and  
modelled a new entity FileClient that holds the additional attributes.


Of course this was easier to me, because it happens solely inside the  
model layer. I did not have to register and handle observations. But I  
think, that it is the same approach in the core.


Maybe this helps …

Cheers,
Amin


Am Do,28.08.2008 um 11:06 schrieb Oleg Krupnov:


Yes, you are correct. I am looking not to break MVC and also get the
correct implementation of binding in a custom view

Just an example: I had a graphic application that drawed some  
inserted
shapes. The shape itself is a part of the model, the color of the  
shape,
too. But when the user selects a shape (symbol), the color should  
change. So
the drawing of the shape depends on a view property. I think, this  
is the

core of your problem.


Selection may not be a good example, because it is a "global" property
of the view, among all objects in the view, whereas I am talking about
states *per each" object in the view. Such state properties become
particularly indispensable for drawing, because drawRect message is
called "asynchronously", i.e. in the next event loop, not in direct
response to the binding's KVO message. The other case is when I need,
for performance reasons, to associate some view-specific cached data
with an object in the view, to avoid recreating it each time I need
the data to respond to the binding's KVO message.

In other words, I need a way to associate additional
custom-view-specific properties with model object, without adding them
as transitive properties to the model. What is the best way to do
this? Or maybe your point is that this is a bad idea at all and such
problem should not arise, and I need to include everything in the
model? What is the standard workaround suggested in Cocoa?

I solved it by returning only bezier paths and colors from the  
model. So the

shape itself (model) is still a part of the model, but the drawing
(depending on the view) is done inside the view. (Simply by  
stroking the

paths.)


It is not completely clear how this would help me to resolve the above
problem. It is not a problem for me to store the bezier paths and
colors in the model. But what about some volatile custom-view-specific
states that have nothing to do with the model?



The other completely different design I am also considering is to
create and bind a "subview" object for each model object. By "subview"
I mean just a subclass of NSObject that is bound to its model
counterpart. It could work like this: The custom NSView observes its
NSTreeController and when a new child model object is created, the
custom NSView creates the corresponding subview object (All subview
objects are owned by the custom NSView) and binds it to the model
object programmatically. When the model object is changed or removed,
its subview counterpart responds correspondingly. In this manner I
could hold all the view-specific states and cache data in the subview
object. What do you think?




On Thu, Aug 28, 2008 at 11:35 AM, Negm-Awad Amin <[EMAIL PROTECTED] 
> wrote:


Am Do,28.08.2008 um 10:15 schrieb Oleg Krupnov:

Parts of your first question remind me of a situation that I had.  
Erik

Buck gave me some great advice and part of it was the following:


If you are worried about adding drawing code to a "Model" object,  
add the
drawing code in a category of * and maintain  
the category

implementation in the "View" subsystem.


*I changed the words he used here because he used the name of my  
specific

class and I wanted to make it more readable in the general case.


This will let you put a category into every view that you want to  
so that

your model objects get handled correctly for each view.


This may be indeed a good idea to use categories for this purpose.  
Is

it what everybody is using?

I have only one problem with this approach: As I mentioned before, I
need to add custom-v

Re: Design Question: Bindings & Custom Views

2008-08-28 Thread Cathy Shive


On Aug 28, 2008, at 11:06 AM, Oleg Krupnov wrote:


In other words, I need a way to associate additional
custom-view-specific properties with model object, without adding them
as transitive properties to the model. What is the best way to do
this? Or maybe your point is that this is a bad idea at all and such
problem should not arise, and I need to include everything in the
model? What is the standard workaround suggested in Cocoa?


Hi Oleg,

I think there are times when it's appropriate to have wrapper objects  
- that are view related - for your model objects.  In an image  
browser, it's likely that there is a "thumbnail" object that draws  
"image" objects.


So maybe  your custom view creates "thumbnails" for the shapes it  
needs to draw and keeps the view-related properties and states in  
those objects - instead of adding them to the shape objects  
themselves?  It's a little crude - but from what I can understand  
about your problem - it could be a place for you to start separating  
the model and view in your design.



HTH,
Cathy











___

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

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


Creating Interface

2008-08-28 Thread Christian Giordano
Hi guys, I would like to create an Interface which will be eventually
implemented by some classes. I am a bit confused here, in objective-c
the .h files are basically already interfaces. Ok, but how could a .m
file implements more than one? I couldn't find any document explaining
how to implements multiple interfaces. In my ignorance I created a
normal .h file MyInterface.h and after importing it in my implementing
class header, I express it with the syntax that I've seen already:

@interface MyClass : NSObject  {
}

The problem is that I get a compiler error on the interface
declaration line saying: "cannot find protocol declaration for
'MyInterface'".

Does someone have any link or tips that might help me?


Thanks, chr
___

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

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

2008-08-28 Thread Matthias Schonder

You may read this:

http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_7_section_6.html#/ 
/apple_ref/doc/uid/TP30001163-CH15-TPXREF148



On 28.08.2008, at 12:14, Christian Giordano wrote:


Hi guys, I would like to create an Interface which will be eventually
implemented by some classes. I am a bit confused here, in objective-c
the .h files are basically already interfaces. Ok, but how could a .m
file implements more than one? I couldn't find any document explaining
how to implements multiple interfaces. In my ignorance I created a
normal .h file MyInterface.h and after importing it in my implementing
class header, I express it with the syntax that I've seen already:

@interface MyClass : NSObject  {
}

The problem is that I get a compiler error on the interface
declaration line saying: "cannot find protocol declaration for
'MyInterface'".

Does someone have any link or tips that might help me?


Thanks, chr
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/mschonder%40aycan.de

This email sent to [EMAIL PROTECTED]



--

Mit freundlichen Gruessen
Best regards

.Matthias Schonder
.aycan Digitalsysteme GmbH
.Innere Aumuehlstrasse 5
.97076 Wuerzburg  .  Germany
.+49.(0)9 31.270 40 9.0  .  phone
.+49.(0)9 31.270 40 9.1  .  fax
.mailto:[EMAIL PROTECTED]
.http://www.aycan.de

.Sitz der Gesellschaft: Wuerzburg
.eingetragen beim Amtsgericht Wuerzburg
.HRB 6043
.Geschaeftsfuehrung:
.Dipl.-Ing. Stephan Popp
.Dipl.-Ing. Matthias Broenner


___

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

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

2008-08-28 Thread Oleg Krupnov
> I think there are times when it's appropriate to have wrapper objects - that
> are view related - for your model objects.  In an image browser, it's likely
> that there is a "thumbnail" object that draws "image" objects.

Yeah, maybe "view-related wrapper objects for model objects" is the right term.

In your image browser example, this problem sounds as follows: where
to store the cached thumbnail images, to avoid re-creating them anew
in each drawRect call? Also, if a thumbnail is in process of dragging
inside the custom view, where to save the flag that the thumbnail
should be highlighted, the next time we draw it in drawRect?

I thought this kind of problem should be well-known and commonplace
among Cocoa developers...

> So maybe  your custom view creates "thumbnails" for the shapes it needs to
> draw and keeps the view-related properties and states in those objects -
> instead of adding them to the shape objects themselves?  It's a little crude
> - but from what I can understand about your problem - it could be a place
> for you to start separating the model and view in your design.

I am not sure I understood this phrase. Why is it crude? Anyway, I am
looking to solve the problem in the standard way, not reinvent
anything.


On Thu, Aug 28, 2008 at 1:03 PM, Cathy Shive <[EMAIL PROTECTED]> wrote:
>
> On Aug 28, 2008, at 11:06 AM, Oleg Krupnov wrote:
>
>> In other words, I need a way to associate additional
>> custom-view-specific properties with model object, without adding them
>> as transitive properties to the model. What is the best way to do
>> this? Or maybe your point is that this is a bad idea at all and such
>> problem should not arise, and I need to include everything in the
>> model? What is the standard workaround suggested in Cocoa?
>
> Hi Oleg,
>
>

>
> HTH,
> Cathy
>
>
>
>
>
>
>
>
>
>
>
>
___

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

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


Quitting all active applications

2008-08-28 Thread Phil Faber

Is there a simple way to quit all running applications?

Basically I want to achieve the same result as the first stage of  
hitting 'shut down' (closing all applications) without actually  
shutting down the system.


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]


Re: Quitting all active applications

2008-08-28 Thread Rob Keniger


On 28/08/2008, at 8:36 PM, Phil Faber wrote:


Is there a simple way to quit all running applications?

Basically I want to achieve the same result as the first stage of  
hitting 'shut down' (closing all applications) without actually  
shutting down the system.



You could get the launched applications by using [[NSWorkspace  
sharedWorkspace] launchedApplications] and then send each of them a  
Quit Apple Event.


But why would you want to do this? It is possibly one of the most  
annoying things you could do to someone's machine and you would want  
to have a very, very good reason for it.


--
Rob Keniger



___

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

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

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

This email sent to [EMAIL PROTECTED]


[meeting] Swindon, UK: upcoming cocoaheads

2008-08-28 Thread graham . lee
Hi all,

September's CocoaHeads Swindon will be at the Glue Pot pub, at 20:00 BST 
on Monday 1st September.  As ever, the website for more information is:
http://cocoaheads.org/uk/Swindon/index.html

See (some of) you there!

Graham.



-- 
Graham Lee
Senior Macintosh Software Engineer, Sophos

Tel: 01235 540266 (Direct)
Web: http://www.sophos.com
Sophos - Security and Control

Sophos Plc, The Pentagon, Abingdon Science Park, Abingdon,
OX14 3YP, United Kingdom.

Company Reg No 2096520. VAT Reg No GB 348 3873 20.

___

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

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

2008-08-28 Thread Christian Giordano
Protocols seems definitely the way to go and seems to work, I'm only
getting some warnings. Basically what I did, I pass the instance
implementing the protocol with this syntax:

- (void) addListener:(id  *) listener

and I get "invalid receiver type 'id *'

Funny enough after I get another warning. I basically want to add the
listener to a NSMutableArray with this syntax:

[listeners addObject:listener]

and I get "passing arguments 1 of 'addObject:' from incompatible pointer type.

I am new to Objective-C so I thought in my ignorance, maybe id
 defines already a pointer and removing the "*" doesn't
gives those errors but where I was checking for the conformity with:

if ( ! [listener conformsToProtocol:@protocol(MyProtocol)]  ) {

I get "'-conformsToProtocol:' not found in protocol(s)"

Any idea?


Thanks, chr

On Thu, Aug 28, 2008 at 11:21 AM, Matthias Schonder <[EMAIL PROTECTED]> wrote:
> You may read this:
>
> http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_7_section_6.html#//apple_ref/doc/uid/TP30001163-CH15-TPXREF148
>
>
> On 28.08.2008, at 12:14, Christian Giordano wrote:
>
>> Hi guys, I would like to create an Interface which will be eventually
>> implemented by some classes. I am a bit confused here, in objective-c
>> the .h files are basically already interfaces. Ok, but how could a .m
>> file implements more than one? I couldn't find any document explaining
>> how to implements multiple interfaces. In my ignorance I created a
>> normal .h file MyInterface.h and after importing it in my implementing
>> class header, I express it with the syntax that I've seen already:
>>
>> @interface MyClass : NSObject  {
>> }
>>
>> The problem is that I get a compiler error on the interface
>> declaration line saying: "cannot find protocol declaration for
>> 'MyInterface'".
>>
>> Does someone have any link or tips that might help me?
>>
>>
>> Thanks, chr
>> ___
>>
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/mschonder%40aycan.de
>>
>> This email sent to [EMAIL PROTECTED]
>>
>
> --
>
> Mit freundlichen Gruessen
> Best regards
>
> .Matthias Schonder
> .aycan Digitalsysteme GmbH
> .Innere Aumuehlstrasse 5
> .97076 Wuerzburg  .  Germany
> .+49.(0)9 31.270 40 9.0  .  phone
> .+49.(0)9 31.270 40 9.1  .  fax
> .mailto:[EMAIL PROTECTED]
> .http://www.aycan.de
>
> .Sitz der Gesellschaft: Wuerzburg
> .eingetragen beim Amtsgericht Wuerzburg
> .HRB 6043
> .Geschaeftsfuehrung:
> .Dipl.-Ing. Stephan Popp
> .Dipl.-Ing. Matthias Broenner
>
>
>
___

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

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

2008-08-28 Thread Phil
On Thu, Aug 28, 2008 at 10:36 PM, Phil Faber <[EMAIL PROTECTED]> wrote:
> Is there a simple way to quit all running applications?
>
> Basically I want to achieve the same result as the first stage of hitting
> 'shut down' (closing all applications) without actually shutting down the
> system.
>

What do you mean by "all running applications"? There are GUI
applications, background daemons owned by the user, applications of
other users, system processes, etc.

Also, what do you mean by "quit"? Do you want to force quit them, or
tell them to gracefully quit? (During the shutdown process,
applications have the opportunity to cancel the event). And depending
on the type of application, the preferred way of getting them to quit
changes.

What are you trying to achieve here?

I would suggest reading Apple's documentation of the shutdown process at:


Phil
___

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

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

2008-08-28 Thread Graham Cox


On 28 Aug 2008, at 6:15 pm, Oleg Krupnov wrote:


I have only one problem with this approach: As I mentioned before, I
need to add custom-view specific instance variables (states) to the
model object's category. The Objective-C categories do not allow
adding instance variables, only methods

I am considering to create a dictionary owned by the custom view,
containing state objects keyed by model object unique ID. This is a
kind of surrogate of subclassing the model objects inside the custom
view. I am not sure this is a good idea though. Are there other
approaches?



This doesn't sound, er... sound.

What "custom-view specific variables" are you talking about? If there  
really are variables that are part of the view's state, then they  
should be part of the view. If they are part of the model's state they  
should be part of the model. Or perhaps they are really neither and  
should in fact be part of a controller that mediates between one and  
the other. I've not come across the need to do what you're apparently  
leaning towards when using a conventional MVC approach.


Maybe a bit more context regarding your particular needs would help.

cheers, Graham
___

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

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

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

This email sent to [EMAIL PROTECTED]


NSMutableDictionary, NSNumber and more memory management

2008-08-28 Thread Memo Akten
Hi All, I have a few questions regarding using NSMutableDictionary,  
NSNumbers, and more memory management.


I have a mutable dictionary, which I would like to store a bunch of  
values, which my app will modify and save and load as a plist. This is  
inside a QCPlugIn and it seems the autorelease pool is released after  
every frame (i had an earlier post regarding this) so can't rely on  
using convenience methods across frames unless I retain them


this is my init/dealloc code:
INIT:
myDict = [[NSMutableDictionary alloc] init];
[myDict setObject:[NSNumber numberWithUnsignedInteger:0] forKey:KEY1];
[myDict setObject:[NSNumber numberWithUnsignedInteger:0] forKey:KEY2];
[myDict setObject:[NSNumber numberWithUnsignedInteger:0] forKey:KEY3];
[myDict setObject:[NSNumber numberWithUnsignedInteger:0] forKey:KEY4];
[myDict setObject:[NSNumber numberWithUnsignedInteger:0] forKey:KEY5];

DEALLOC:
[myDict release];


q1:
Is this all correct? When you setObject, the docs say that the object  
receives a retain, so that means its safe (and correct) for me to do  
the above? Do I need to release the NSNumbers in dealloc? or does the  
NSMutableDictionary release them? I think its the latter but just  
wanted to double check.


q2:
this is my updating code:
- (void) updateValue:(NSString*)key {
id oldValue = [myDict objectForKey:key];
	id newValue = [NSNumber numberWithUnsignedInteger:([oldValue  
unsignedIntegerValue] + 1)];

[myDict setObject:newValue forKey:key];
[oldValue release]; // do I need to release this?
}

I 'm not very experienced with ObjC, but I"m loving it so far... but  
this seems a bit overkill - destroy and recreate a new NSNumber and re- 
add it to the dictionary - but I couldn't get it to work any other  
way. Performance isn't really an issue as this will be called at most  
a couple times a second, usually a lot more infrequently - but is this  
the best way to do it? I thought of having a bunch of int variables,  
and update them, and reconstruct the NSDictionary every time one of  
them changes, but that seemed a bit overkill too..


cheers,
___

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

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

2008-08-28 Thread Graham Cox


On 28 Aug 2008, at 8:26 pm, Oleg Krupnov wrote:


In your image browser example, this problem sounds as follows: where
to store the cached thumbnail images, to avoid re-creating them anew
in each drawRect call? Also, if a thumbnail is in process of dragging
inside the custom view, where to save the flag that the thumbnail
should be highlighted, the next time we draw it in drawRect?

I thought this kind of problem should be well-known and commonplace
among Cocoa developers...



BTW, for some reason my feed from the list was delayed by several  
hours and only just came "unstuck", so it seems you've had some  
response on this already I didn't know about. In which case my first  
response probably isn't all that useful.


Regarding the above though, if this is similar to your situation -  
what's really wrong with model objects caching a thumbnail? Being a  
slave to MVC is going to lead to suboptimal solutions just as ignoring  
MVC altogether is going to be. The cached thumbnail has to be stored  
somewhere, right? Where, doesn't really matter. So if a model object  
has a -thumbnail method that returns the thumbnail when you need it,  
what's wrong with that? The thumbnail doesn't need to end up  
permanently stored by the model when archived, just created lazily  
when required. If the model object is the best object to make and  
cache that thumbnail (i.e. it has all the state information to hand to  
do so) why not let it? A view that displays the thumbnail can then  
just request it directly from the object in question instead of going  
round the houses to generate a thumbnail simply to avoid the model  
object getting its hands dirty. Some may feel differently but I don't  
see that this violates MVC in any significant way and it's much simpler.


An example from my DrawKit project - a style object is part of the  
model in that it represents a number of combined graphical properties  
of a drawn object. But a UI that deals in styles will often want a  
small thumbnail or icon to preview the style to the user. So my style  
objects handle that as well - they implement an -image method.  
Internally they also create it lazily and cache it for efficiency, but  
none of that really impacts the integrity of the model in any way. If  
it makes things feel better, you could put these methods into a  
category (I don't in this case). For the cache I use a statically  
declared dictionary within the -image method so that a) I don't need  
ivars in my style objects to store it and b) the static variable is  
independent and invisible to anything other than that specific method.  
(If this is what you were alluding to originally then I may have  
misunderstood - this seems a reasonable approach to me and works a  
treat). What I definitely don't do however is pass a view reference to  
the model object at any point - the -image method returns an image of  
that model object but it makes no assumptions about its use nor  
tailors its image generation according to the type of view. If you  
need to parameterise what a method like this does, do it in the  
abstract and let the caller/client decide what parameters to pass for  
its needs.


Regarding selection of objects, that isn't part of the model state per  
se. You probably want to avoid having a "is selected" flag in your  
model object. However, it's often useful to let an object decide for  
itself what graphical form a selection highlight should take. So why  
not simply pass the "is selected" flag as a parameter to its draw  
method? When your view's -drawRect: is called, something is going to  
have to iterate over the objects and draw them. At that point you can  
determine if an object is selected or not and pass the flag as  
appropriate. The easiest way to handle selection that I've found is  
just to maintain a set of the the objects that are selected. To select  
an object, add it to this set. Then when drawing you can test for  
membership of this set and pass the flag to the draw method of the  
object. This is the way I did it in DrawKit and haven't discovered any  
obvious downside to it. It also fits in with bindings since you  
already have a list of "the selection" at your disposal at all times.  
The "owner" of the selection set could be the view but more likely  
it's part of a controller - depends really on whether you conceptually  
think of the selection as pertaining to just one view or to be the  
same across several. However, by passing the "selected" flag to the  
object when you draw it, you can do it either way without tying  
yourself down.


Any help?

Graham


___

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

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

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

This email sent 

Re: NSMutableDictionary, NSNumber and more memory management

2008-08-28 Thread Joshua Pennington

On Aug 28, 2008, at 6:46 AM, Memo Akten <[EMAIL PROTECTED]> wrote:

q1:
Is this all correct? When you setObject, the docs say that the  
object receives a retain, so that means its safe (and correct) for  
me to do the above? Do I need to release the NSNumbers in dealloc?  
or does the NSMutableDictionary release them? I think its the latter  
but just wanted to double check.


numberWithUnsignedInteger: returns an object which you do not have  
ownership over and as a result, you are not responsible for releasing  
it. NSDictionary will retain it when setValue:forKey: is messaged.



q2:
this is my updating code:
- (void) updateValue:(NSString*)key {
   id oldValue = [myDict objectForKey:key];
   id newValue = [NSNumber numberWithUnsignedInteger:([oldValue  
unsignedIntegerValue] + 1)];

   [myDict setObject:newValue forKey:key];
   [oldValue release];// do I need to release this?


objectForKey: returns an object over which you do not have ownership  
and as a result you do not have to release it after. When you call  
setValue:forKey: it retains newValue and releases it's reference to  
the original key.


Cheers,
Joshua
Sent from my iPhone
___

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

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

2008-08-28 Thread Cathy Shive


On Aug 28, 2008, at 12:26 PM, Oleg Krupnov wrote:

I think there are times when it's appropriate to have wrapper  
objects - that
are view related - for your model objects.  In an image browser,  
it's likely

that there is a "thumbnail" object that draws "image" objects.


Yeah, maybe "view-related wrapper objects for model objects" is the  
right term.


In your image browser example, this problem sounds as follows: where
to store the cached thumbnail images, to avoid re-creating them anew
in each drawRect call? Also, if a thumbnail is in process of dragging
inside the custom view, where to save the flag that the thumbnail
should be highlighted, the next time we draw it in drawRect?



You can go about this several ways.  the "crude" way ;)  is to have a  
thumbnail for each image that needs to be drawn and have the thumbnail  
cache a bitmap (maybe two or three different sized bitmaps for  
different zoom levels) for each image.  So the thumbnail just creates  
them once and then keeps them around as long as the image is on the  
screen for quick drawing.


A less crude way is to implement some type of caching system - so, if  
the images are drawn in several views at the same time, all the views  
can share a centralized cache of bitmaps.


As far as the view keeping states like which objects need to be  
highlighted, the view can set a "isHighlighted" flag in a thumbnail  
when it is selected, so the thumbnail can draw itself differently, or  
the view can keep track of the selected image indexes and draw  
selection highlights itself.


If you look at the design of NSTableView, it keeps track of which row  
indexes are selected and draws each highlight right before it draws  
the "cells".  If you are customizing the NSCell drawing in a table  
view, the cell object can check if it "isHighlighted" and adjust its  
drawing based on that.  The return value of "isHighlighted" is  
something that the view determines for the cell.




I thought this kind of problem should be well-known and commonplace
among Cocoa developers...



I think this is more of a general interface widget design problem than  
a Cocoa problem.  Cocoa developers get this kind of GUI behavior out  
of the box - NSTableView, IKImageBrowser, etc., so it won't come up  
unless you're doing something very custom - as I'm guessing you are.   
Looking at the API for these classes can certainly lead you in the  
right direction for designing your own custom views, if you're looking  
for the "Cocoa" way to do it.


Also, I have to ask, but is it possible for you to use a pre-made  
object like an NSOutlineView for your UI?



So maybe  your custom view creates "thumbnails" for the shapes it  
needs to
draw and keeps the view-related properties and states in those  
objects -
instead of adding them to the shape objects themselves?  It's a  
little crude
- but from what I can understand about your problem - it could be a  
place

for you to start separating the model and view in your design.


I am not sure I understood this phrase. Why is it crude? Anyway, I am
looking to solve the problem in the standard way, not reinvent
anything.



The reason I say it's crude is because what I'm suggesting to you is  
to have your view make a separate "thumbnail" object for each model  
object you need to draw.  You can use this object to cache things and  
to keep track of states of each individual object for the view.  It  
will work well as a way to keep the view related properties out of  
your model.  This wrapper class will also make the needs of your view  
very clear.  Eventually, you can evolve the design of your view so  
that it can handle all of the states, positioning, hit tests, caching,  
etc. itself, maybe eliminating the need for a wrapper thumbnail class  
altogether.


I usually start with the most simple, or crude (maybe that was the  
wrong word ;)) solution and evolve the design from there.


Again, there is no standard Cocoa way to design a custom view like  
this - but taking a look at how some of the comparable Cocoa GUI  
widgets are implemented can give you some good hints.  I've learned  
tons from NSTableView - it's a very flexible design and can be used to  
display any model object you can throw at it.  Look at how NSTableView  
and the IKImageBrowser use delegate and data source designs and how  
they work with "cells" - their "thumbnails" - to draw.


If you can use one of these widgets instead of implementing your own  
with very similar behaviors, that would be the best solution - but I  
certainly understand that there are types of interactions that are  
very custom and then you need to roll your own - but even in this case  
you can use NSTableView or IKImageBrowser for inspiration.


http://developer.apple.com/documentation/GraphicsImaging/Reference/IKImageBrowserView/IKImageBrowserView_Reference.html#/ 
/apple_ref/occ/cl/IKImageBrowserView

http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/C

Re: [meeting] Swindon, UK: upcoming cocoaheads

2008-08-28 Thread Graham Cox


On 28 Aug 2008, at 9:24 pm, [EMAIL PROTECTED] wrote:

September's CocoaHeads Swindon will be at the Glue Pot pub, at 20:00  
BST
on Monday 1st September.  As ever, the website for more information  
is:

http://cocoaheads.org/uk/Swindon/index.html



Now that's a coincidence... I just saw the Glue Pot pub on TV here in  
Australia about half an hour ago! It was shown on "Buildings that  
shaped Britain", an excellent series about architecture. The Glue Pot,  
apparently, is where the carriage-builders of the GWR would go,  
slightly lower-class than The Cricketers across the road which the  
loco-builders frequented, but both built by the company for its  
workers. I doubt if even Brunel could have envisaged the sort of  
engineering that gets discussed at a Cocoaheads meeting 150 years  
later...


cheers, Graham
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSMutableDictionary, NSNumber and more memory management

2008-08-28 Thread Memo Akten
Thanks Joshua, that clears up the memory stuff... i think i finally  
get it now: unless you explicitly alloc or retain, you never need to  
release...

cheers,
memo.


On 28 Aug 2008, at 13:12, Joshua Pennington wrote:


On Aug 28, 2008, at 6:46 AM, Memo Akten <[EMAIL PROTECTED]> wrote:

q1:
Is this all correct? When you setObject, the docs say that the  
object receives a retain, so that means its safe (and correct) for  
me to do the above? Do I need to release the NSNumbers in dealloc?  
or does the NSMutableDictionary release them? I think its the  
latter but just wanted to double check.


numberWithUnsignedInteger: returns an object which you do not have  
ownership over and as a result, you are not responsible for  
releasing it. NSDictionary will retain it when setValue:forKey: is  
messaged.



q2:
this is my updating code:
- (void) updateValue:(NSString*)key {
  id oldValue = [myDict objectForKey:key];
  id newValue = [NSNumber numberWithUnsignedInteger:([oldValue  
unsignedIntegerValue] + 1)];

  [myDict setObject:newValue forKey:key];
  [oldValue release];// do I need to release this?


objectForKey: returns an object over which you do not have ownership  
and as a result you do not have to release it after. When you call  
setValue:forKey: it retains newValue and releases it's reference to  
the original key.


Cheers,
Joshua
Sent from my iPhone


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSMutableDictionary, NSNumber and more memory management

2008-08-28 Thread Joshua Pennington
The safest thing to do is to check the documentation for a method and  
see what it says about object ownership. A good rule of thumb is,  
however, when a convenience method returns an object, you do not have  
ownership over it. If you need it to persist, you should retain it (at  
which point you now have ownership and should release it whenever you  
are finished).


When in doubt, check the memory management guide:




Cheers,
Joshua

On Aug 28, 2008, at 7:28 AM, Memo Akten wrote:

Thanks Joshua, that clears up the memory stuff... i think i finally  
get it now: unless you explicitly alloc or retain, you never need to  
release...


On 28 Aug 2008, at 13:12, Joshua Pennington wrote:


On Aug 28, 2008, at 6:46 AM, Memo Akten <[EMAIL PROTECTED]> wrote:

q1:
Is this all correct? When you setObject, the docs say that the  
object receives a retain, so that means its safe (and correct) for  
me to do the above? Do I need to release the NSNumbers in dealloc?  
or does the NSMutableDictionary release them? I think its the  
latter but just wanted to double check.


numberWithUnsignedInteger: returns an object which you do not have  
ownership over and as a result, you are not responsible for  
releasing it. NSDictionary will retain it when setValue:forKey: is  
messaged.



q2:
this is my updating code:
- (void) updateValue:(NSString*)key {
 id oldValue = [myDict objectForKey:key];
 id newValue = [NSNumber numberWithUnsignedInteger:([oldValue  
unsignedIntegerValue] + 1)];

 [myDict setObject:newValue forKey:key];
 [oldValue release];// do I need to release this?


objectForKey: returns an object over which you do not have  
ownership and as a result you do not have to release it after. When  
you call setValue:forKey: it retains newValue and releases it's  
reference to the original key.


___

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

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

2008-08-28 Thread Gerriet M. Denkmann


On 28 Aug 2008, at 14:37, Michael Nickerson wrote:



On Aug 28, 2008, at 2:15 AM, Gerriet M. Denkmann wrote:



//  this always works, regardless of name:
- (IBAction)ImageNameD: sender;
{
NSBundle *mainBundle = [ NSBundle mainBundle ];
NSDictionary *infoDictionary = [ mainBundle infoDictionary ];
	NSString *iconFile = [ infoDictionary objectForKey:  
@"CFBundleIconFile" ];	

NSImage *image = [ NSImage imageNamed: iconFile ];
[ imageView setImage: image ];
}



You can make that shorter, by removing the infoDictionary ivar and  
changing the iconFile one to [mainBundle  
objectForInfoDictionaryKey:@"CFBundleIconFile"].

Yes, thank you. Have changed this.



Could someone please show me, where the valid values for  
CFBundleIconFile are documented?

Tiger 10.4.11.



Property List Key Reference:



This  document says:

"CFBundleIconFile
This key identifies the file containing the icon for the bundle. The  
filename you specify does not need to include the.icns extension,  
although it may. The Finder looks for the icon file in the Resources  
directory of the bundle.


If your bundle uses a custom icon, you must specify this property. If  
you do not specify this property, the Finder (and other applications)  
display your bundle with a default icon."


Does not say anything like: "Do not use 'heiß' or any other German  
words".




And, to answer the question of Jean-Daniel Dupas:

-[NSApp applicationIconImage] does return the correct picture,  
regardless whether it is called "heiß" or "hot".


But, another problem: when I run my app with CFBundleIconFile =  
"heiß" the picture in the dock is just the default app icon.


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: Creating Interface

2008-08-28 Thread Jean-Daniel Dupas

Le 28 août 08 à 13:24, Christian Giordano a écrit :


Protocols seems definitely the way to go and seems to work, I'm only
getting some warnings. Basically what I did, I pass the instance
implementing the protocol with this syntax:

- (void) addListener:(id  *) listener

and I get "invalid receiver type 'id *'

Funny enough after I get another warning. I basically want to add the
listener to a NSMutableArray with this syntax:

[listeners addObject:listener]

and I get "passing arguments 1 of 'addObject:' from incompatible  
pointer type.


I am new to Objective-C so I thought in my ignorance, maybe id
 defines already a pointer and removing the "*" doesn't
gives those errors but where I was checking for the conformity with:

`
Removing the "*" is what you need, but that's not  that is  
a pointer, but "id".





if ( ! [listener conformsToProtocol:@protocol(MyProtocol)]  ) {

I get "'-conformsToProtocol:' not found in protocol(s)"

Any idea?



When you use the id syntaxt, the compiler assume your object  
only implements the method declared in your protocol.
If you want to use some other function, you have to use an object type  
that declare thoses functions, for example in your case, NSObject.


- (void) addListener:(NSObject  *) listener

there is a nice article that explains it better here:

http://unixjunkie.blogspot.com/2008/03/id-vs-nsobject-vs-id.html


___

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

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

2008-08-28 Thread graham . lee
Grahaam Cox wrote on 2008-08-28 13:11:47:

> 
> Regarding the above though, if this is similar to your situation - 
> what's really wrong with model objects caching a thumbnail? Being a 
> slave to MVC is going to lead to suboptimal solutions just as ignoring 
> MVC altogether is going to be. The cached thumbnail has to be stored 
> somewhere, right? Where, doesn't really matter. So if a model object 
> has a -thumbnail method that returns the thumbnail when you need it, 
> what's wrong with that? The thumbnail doesn't need to end up 
> permanently stored by the model when archived, just created lazily 
> when required. If the model object is the best object to make and 
> cache that thumbnail (i.e. it has all the state information to hand to 
> do so) why not let it? A view that displays the thumbnail can then 
> just request it directly from the object in question instead of going 
> round the houses to generate a thumbnail simply to avoid the model 
> object getting its hands dirty. Some may feel differently but I don't 
> see that this violates MVC in any significant way and it's much simpler.

Your model objects could be re-used somewhere that AppKit isn't available 
or where it's unnecessary and perhaps even inappropriate to keep NSImages 
around; your command-line interface to the model probably won't need them, 
for instance.  As such, following the Decorator pattern by having an 
object which does "appkit-can-draw-this" and has-a model object promotes 
re-use of the model.  It also keeps all of your AppKit code in the view, 
so when you need an 
"other-ui-framework-which-I-will-not-specify-can-draw-this" object, you 
don't have to go hunting around for all that drawing code.

As others have pointed out if you don't need extra ivars, or don't mind 
jumping through a hoop to get them, you can add a category to the model 
class which is decorating via ObjC magic.  It still lets you separate the 
UI code into the view package, but also means you directly use the model 
class.  An example of that approach is 
NSAttributedString(AppKitAdditions).

Cheers,
Graham.



-- 
Graham Lee
Senior Macintosh Software Engineer, Sophos

Tel: 01235 540266 (Direct)
Web: http://www.sophos.com
Sophos - Security and Control

Sophos Plc, The Pentagon, Abingdon Science Park, Abingdon,
OX14 3YP, United Kingdom.

Company Reg No 2096520. VAT Reg No GB 348 3873 20.

___

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

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

2008-08-28 Thread Oleg Krupnov
Thanks, that mostly answers my question, finally. And the short answer
is "No" :). There is no standard Cocoa way of doing this and it's up
to me how to implement it. I just wanted to make sure I was not
reinventing the wheel.

You are correct in suspecting me in a kind of MVC purism (typical for
a newbie :). Indeed, I used to understand the MVC pattern that the
model should be strictly separated from the views and inherently
assume a one-to-many relationship between the model and the views. It
means that the model should not include properties and messages that
are view-specific, because the number and kind of views is a black box
for the model. The model might have a message for creating thumbnails,
but it should not include a thumbnail ivar, because there can be two
views of the same model, each requiring thumbnails of different kind.
By adding ivars and messages that every view in the world might need
will result in what is called "fat interface" for the model. The
encapsulation becomes poor and unnecessary dependancies are
introduced. It may work well at the beginning for it seems simple, but
it may fire back and require refactoring as the program grows more
complex.

Your solution with the static dictionary looks similar to what I had
in mind, except that I intended this dictionary to be owned by the
custom NSView and not be static(I don't need different shapes to share
the same thumbnails, each one is unique). By keying in the model
objects pointers or their unique IDs, I could retrieve view-specific
data from the dictionary. I could even wrap that data together with
the messages for drawing and hit testing, so that I don't even have to
use categories on model objects. Perhaps I will stick to this
solution.

Thanks!



On Thu, Aug 28, 2008 at 3:11 PM, Graham Cox <[EMAIL PROTECTED]> wrote:
>
> On 28 Aug 2008, at 8:26 pm, Oleg Krupnov wrote:
>
>> In your image browser example, this problem sounds as follows: where
>> to store the cached thumbnail images, to avoid re-creating them anew
>> in each drawRect call? Also, if a thumbnail is in process of dragging
>> inside the custom view, where to save the flag that the thumbnail
>> should be highlighted, the next time we draw it in drawRect?
>>
>> I thought this kind of problem should be well-known and commonplace
>> among Cocoa developers...
>
>
> BTW, for some reason my feed from the list was delayed by several hours and
> only just came "unstuck", so it seems you've had some response on this
> already I didn't know about. In which case my first response probably isn't
> all that useful.
>
> Regarding the above though, if this is similar to your situation - what's
> really wrong with model objects caching a thumbnail? Being a slave to MVC is
> going to lead to suboptimal solutions just as ignoring MVC altogether is
> going to be. The cached thumbnail has to be stored somewhere, right? Where,
> doesn't really matter. So if a model object has a -thumbnail method that
> returns the thumbnail when you need it, what's wrong with that? The
> thumbnail doesn't need to end up permanently stored by the model when
> archived, just created lazily when required. If the model object is the best
> object to make and cache that thumbnail (i.e. it has all the state
> information to hand to do so) why not let it? A view that displays the
> thumbnail can then just request it directly from the object in question
> instead of going round the houses to generate a thumbnail simply to avoid
> the model object getting its hands dirty. Some may feel differently but I
> don't see that this violates MVC in any significant way and it's much
> simpler.
>
> An example from my DrawKit project - a style object is part of the model in
> that it represents a number of combined graphical properties of a drawn
> object. But a UI that deals in styles will often want a small thumbnail or
> icon to preview the style to the user. So my style objects handle that as
> well - they implement an -image method. Internally they also create it
> lazily and cache it for efficiency, but none of that really impacts the
> integrity of the model in any way. If it makes things feel better, you could
> put these methods into a category (I don't in this case). For the cache I
> use a statically declared dictionary within the -image method so that a) I
> don't need ivars in my style objects to store it and b) the static variable
> is independent and invisible to anything other than that specific method.
> (If this is what you were alluding to originally then I may have
> misunderstood - this seems a reasonable approach to me and works a treat).
> What I definitely don't do however is pass a view reference to the model
> object at any point - the -image method returns an image of that model
> object but it makes no assumptions about its use nor tailors its image
> generation according to the type of view. If you need to parameterise what a
> method like this does, do it in the abstract and let the caller/client

Re: Creating Interface

2008-08-28 Thread Phil
On Fri, Aug 29, 2008 at 12:32 AM, Jean-Daniel Dupas
<[EMAIL PROTECTED]> wrote:
> When you use the id syntaxt, the compiler assume your object only
> implements the method declared in your protocol.
> If you want to use some other function, you have to use an object type that
> declare thoses functions, for example in your case, NSObject.
>

However, NSObject is both a class and a protocol. Although most
classes inherit from NSObject, this is not always the case (for
example, using DO, where objects inherit from the NSProxy root class).

It's preferrable if your protocol incorporates the NSObject protocol
as well, which enforces all implementors to also conform to the
NSObject protocol (and you take an id)---because you don't
actually care if you have an NSObject subclass, just that whatever
you've got behaves like an NSObject.

Phil
___

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

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


Seeking UI designer

2008-08-28 Thread Benjamin D. Rister
Decimus Software is looking for a user interface designer to work with  
in designing future versions of our software.


Responsibilities:
* Work closely with Ben brainstorming and hashing out user interface  
designs for future products

* Produce mockups and specifications of design ideas
* Oversee usability testing with end users
* Adopt primary responsibility for our applications being attractive  
and a delight to use

* Contribute to website design updates

Requirements:
* Experience in UI design on a shipped product, be it commercial,  
shareware, or open source.  A great portfolio from new designers may  
be acceptable in some cases, but practical, real-world experience is  
strongly encouraged.
* Familiarity with tenets of good user interface design, and the  
official and unofficial standards for modern Mac apps.
* Skilled in graphic design tools such as Illustrator, Photoshop, and  
the ilk.
* Absolutely must be reliable and self-motivating, particularly if  
remote.


Plusses:
* Experience *implementing* UIs in Cocoa.
* Location in or around Portland, ME / Boston, MA a strong bonus.

This is an ongoing contractual relationship.  Actual workload will  
vary dramatically with product cycles, and as such compensation is  
likely to be on an hourly basis.  Profit sharing may be an option in  
some circumstances, depending on qualifications, personal investment,  
our ongoing experience together, and general awesomeness level.


Please send resume/any pertinent showcases to admin at decimus.net.   
***Be careful to not email the list by accident!***  Additionally, I  
will be at C4[2] and would love to meet with anybody there.


Best,
br

--
Benjamin D. Rister
President
Decimus Software, Inc.

http://www.decimus.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: Quitting all active applications

2008-08-28 Thread Marcus


28 aug 2008 kl. 12.36 skrev Phil Faber:


Is there a simple way to quit all running applications?

Basically I want to achieve the same result as the first stage of  
hitting 'shut down' (closing all applications) without actually  
shutting down the system.


Take a look at the NSWorkspace class. The launchedApplications: method  
will give you an array of running applications including their process  
id. A simple solution would be to use NSTask to invoke the kill  
command on each of them. Just remember to remove you application from  
the array or it will be killed as well.


By the way, in what situation do you want to kill all running  
applications?


Marcus




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: global key bindings

2008-08-28 Thread David Reitter

On 28 Aug 2008, at 00:27, Eric Schlegel wrote:



Menus contained in NSStatusItems (and displayed on the right side of  
the menubar) don't currently respond to command keys at all. This is  
already reported in Radar.


Thanks, I'll stop looking then.
FWIW, the binding does work once the menu is shown.  Also, Adium  
somehow manages to pull it off, too.


Can you give me a pointer on how to implement global key bindings?   
(Again, the app has no menu / Dock icon and would want to receive the  
event without having focus.  I need something like Hot Keys in Carbon.)


- David

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: CoreData, SQLite and GUID

2008-08-28 Thread Amy Heavey
My biggest problem is I don't have access to the source code for the  
application that creates and uses the sqlite database.


I think I'll have to look at creating my own application,

Ideally, I need a solution that enables me to share data between  
machines (so I was thinking of a server/client type solution) but it  
also needs to run when not connected to the internet/server.


I'm a bit stuck at the moment on how to store the data for two  
situations,


Thanks,

Many Thanks

Amy Heavey


On Aug 27, 2008, at 6:30 PM, mmalc crawford wrote:



On Aug 27, 2008, at 9:33 AM, Michael Ash wrote:

On Wed, Aug 27, 2008 at 5:30 AM, Amy Heavey  
<[EMAIL PROTECTED]> wrote:

I use an application that I believe is written using CoreData. It is
currently quite tedious to enter data into this application, and  
the data I
need entering is already in a mysql database anyway. I'd like to  
be able to
insert this data directly into the SQLite database the  
application uses.


Nothing prevents you from programmatically manipulating your CoreData
store. CoreData is not a GUI-only technology. Get your data into some
format that your CoreData app can read, and write some code to blast
it into your store. This is much more foolproof, and probably easier,
than trying to manipulate the SQLite database directly.

To take that a step further, in principle there shouldn't be any  
need to create an intermediate format -- you should be able to  
write a utility (with or without a GUI) that reads the data from  
the MySQL database using its native library and create and store  
managed objects directly.  See   
for hints as to how to do this efficiently.


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/amy% 
40willowtreecrafts.co.uk


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 Interface

2008-08-28 Thread Roland King
I tried that before, making my protocol inherit from the NSObject  
Protocol and it sort of worked, but not quite.


 In my case I was using KVO and wanted to call  
addObserver:forKeyPath:options:context:, something I'm very used to  
NSObject just doing. However that's not part of the NSObject protocol,  
it's part of the NSKeyValueObserving protocol so I thought, ok let me  
inherit from that too, only to find that it's informal, there is no  
defined .h file which has that so you can't do NSKeyValueObserving>. I supposed I could have formalized it and just  
written a protocol definition for it, but I didn't.


Instead I decided that what I really wanted was something which was an  
NSObject with all the formal and informal protocols that implies, so I  
just started using exactly that


-(void) foo:(NSObject*)theThingToDoItWith

and that worked just fine.

I don't quite understand why protocols like NSKeyValueObserving aren't  
formalized and in a .h file somewhere so you could just use them in  
the same way you can the NSObject protocol. They're documented, why  
not just write the .h file. There's probably a very good reason for it  
which has totally escaped me.




On Aug 28, 2008, at 9:03 PM, Phil wrote:


On Fri, Aug 29, 2008 at 12:32 AM, Jean-Daniel Dupas
<[EMAIL PROTECTED]> wrote:
When you use the id syntaxt, the compiler assume your  
object only

implements the method declared in your protocol.
If you want to use some other function, you have to use an object  
type that

declare thoses functions, for example in your case, NSObject.



However, NSObject is both a class and a protocol. Although most
classes inherit from NSObject, this is not always the case (for
example, using DO, where objects inherit from the NSProxy root class).

It's preferrable if your protocol incorporates the NSObject protocol
as well, which enforces all implementors to also conform to the
NSObject protocol (and you take an id)---because you don't
actually care if you have an NSObject subclass, just that whatever
you've got behaves like an NSObject.

Phil
___

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

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

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

This email sent to [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 Entity object

2008-08-28 Thread R T
Yes, I set up a master/detail view and IB automatically set up the add button...

Enabled:(threeAttributesEntityArrayController.selection) which is described 
as a multiple-value binding that determines if the NSButton is enabled in the 
user interface.

You wrote: "...master-detail view going on, where you can choose which entity 
you want to work with on the main window, and then play with its properties on 
a sheet..." How does this work?

Thanks
Rick Tschudin

PS  What I am tryin to do is get an attribute of an entity to appear in 2 
separate tableview displays
1. in a document window
2. in a Panel of the document window.
I want to make changes in the Panel and have the changes appear in the document 
window when the panel is closed?



--- On Tue, 8/26/08, Kyle Sluder <[EMAIL PROTECTED]> wrote:

> From: Kyle Sluder <[EMAIL PROTECTED]>
> Subject: Re: Core Data Entity object
> To: [EMAIL PROTECTED]
> Cc: "Cocoa-dev List" 
> Date: Tuesday, August 26, 2008, 5:55 AM
> On Tue, Aug 26, 2008 at 8:43 AM, R T
> <[EMAIL PROTECTED]> wrote:
> > Actually, there is a choice in the IB Library, under
> 'Objects & Controllers" in "Core
> Data" called "Core Data Entity" which is used
> to assist development of model-driven interface using Cocoa
> Bindings. The entity is a NSManagedObject with 3 attributes,
> 2 floats & 1 binary data. It has a parent entity and I
> want an attribute to appear in both. Both  are in
> MyDocument.xcdatamodel. The Parent opens correctly on the
> MyDocument.xib. This entity with the 3 attributes opens in
> the Panel that opens from MyDocument Window, but the add
> & remove buttons are not highlighted. Any Ideas?
> 
> Ah.  That's doesn't create an entity, as I'm
> sure you already knew,
> but rather it creates a boilerplate interface for an
> entity.
> 
> How are the controls on the sheet bound?  This is the
> really important
> point.  It sounds like you have some sort of master-detail
> view going
> on, where you can choose which entity you want to work with
> on the
> main window, and then play with its properties on a sheet?
> 
> --Kyle Sluder


  
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CFBundleIconFile: heiß or hot?

2008-08-28 Thread Jean-Daniel Dupas


Le 28 août 08 à 08:15, Gerriet M. Denkmann a écrit :



//	this shows the application default icon if CFBundleIconFile =  
"heiß"

//  works ok for CFBundleIconFile = "hot"

- (IBAction)iconForFileN: sender;
{
NSBundle *mainBundle = [ NSBundle mainBundle ];
NSString *bundlePath = [ mainBundle bundlePath ];
	NSImage *image = [ [ NSWorkspace sharedWorkspace ] iconForFile:  
bundlePath ];

[ imageView setImage: image ];
}


//  this always works, regardless of name:
- (IBAction)ImageNameD: sender;
{
NSBundle *mainBundle = [ NSBundle mainBundle ];
NSDictionary *infoDictionary = [ mainBundle infoDictionary ];
	NSString *iconFile = [ infoDictionary objectForKey:  
@"CFBundleIconFile" ];	

NSImage *image = [ NSImage imageNamed: iconFile ];
[ imageView setImage: image ];
}

Could someone please show me, where the valid values for  
CFBundleIconFile are documented?

Tiger 10.4.11.

Guessing around (name must be American?), (must NOT be German?),  
(may contain only three characters?), (only one vowel allowed?) is  
not really satisfying.



Kind regards,

Gerriet.


What does -[NSApp applicationIconImage] return ?


___

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

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

2008-08-28 Thread Sherm Pendley
On Thu, Aug 28, 2008 at 9:56 AM, Roland King <[EMAIL PROTECTED]> wrote:

> I tried that before, making my protocol inherit from the NSObject Protocol
> and it sort of worked, but not quite.


Protocols aren't inherited. You can inherit an implementation of the
NSObject protocol, by writing a subclass of the NSObject class, but that's a
very different animal.

I don't quite understand why protocols like NSKeyValueObserving aren't
> formalized and in a .h file somewhere so you could just use them in the same
> way you can the NSObject protocol. They're documented, why not just write
> the .h file. There's probably a very good reason for it which has totally
> escaped me.


Conforming to a protocol is an all-or-nothing affair - you have to implement
*all* of the protocol's methods. The informal protocols I'm aware of tend to
have one or more optional methods.

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: Creating Interface

2008-08-28 Thread Roland King


On Aug 28, 2008, at 10:15 PM, Sherm Pendley wrote:


On Thu, Aug 28, 2008 at 9:56 AM, Roland King <[EMAIL PROTECTED]> wrote:
I tried that before, making my protocol inherit from the NSObject  
Protocol and it sort of worked, but not quite.


Protocols aren't inherited. You can inherit an implementation of the  
NSObject protocol, by writing a subclass of the NSObject class, but  
that's a very different animal.


let me use Apple's terminology instead of my own sloppy one, you can  
'incorporate' other protocols into your own, so my first shot was


@protocol Foo 

but that fails addObserver:... if you use (id) as addObserver:..  
isn't part of NSObject so what I wanted was


@protocol Foo 

but NSKeyValueObserving  isn't really defined so you can't do that




I don't quite understand why protocols like NSKeyValueObserving  
aren't formalized and in a .h file somewhere so you could just use  
them in the same way you can the NSObject protocol. They're  
documented, why not just write the .h file. There's probably a very  
good reason for it which has totally escaped me.


Conforming to a protocol is an all-or-nothing affair - you have to  
implement *all* of the protocol's methods. The informal protocols  
I'm aware of tend to have one or more optional methods.




You can have @optional Protocol methods (is that new, that may be new,  
I'm really not sure). Of course if the protocols ended up all optional  
then indeed that would rather defeat the purpose of the whole thing.  
That's a very good point though. I'm still more used to interfaces in  
other languages which really are all-or-nothing.



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: mark added object in NSArrayController as "dirty"?

2008-08-28 Thread Keary Suska
8/27/08 6:46 PM, also sprach [EMAIL PROTECTED]:

> I've got a simple detail view backed by an NSArrayController. The view views
> the NSArrayController's selection. The NSArrayController manages an array of
> dictionaries, all very simple.
> 
> I've implemented validateValue:... and it's being called when I want it to
> be (thanks to "validates immediately"), except on this one occasion:
> 
> The user can create a new object - the button calls add:, and I've
> overridden newObject:. However, this new object is deliberately invalid;
> some fields are blank, but the user must fill them in before leaving and
> moving to another selection. That's the intention, anyway. The problem is
> that that is not happening; the user can press the selectPrevious: button
> without doing any editing, and no validation takes place. Obviously that's
> because the user didn't do any editing!
> 
> How can I fool the system into thinking the user has done some editing in
> every field, so that when the user leaves this selection for another, every
> field will be validated? m.

AFAIK, you can't. And, AFAIK, simply entering a field is enough to trigger
editing, so if you set the first blank field as as first responder,
validation should be called on end editing. But just for that field,
unfortunately.

My understanding is that validation is done on a per-field basis by the
field editor--i.e. There is no "edited" flag. Since there is just one field
editor etc. You get the idea.

The only solution I have found is intercepting all actions that would move
away from the displayed "record", and manually call validation.

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


___

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

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

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

This email sent to [EMAIL PROTECTED]


Semi-transparent offscreen CALayer

2008-08-28 Thread Shaun Larkin
I'm trying to animate a semi-transparent CALayer (opacity 0.8) by sliding it in 
from offscreen but it only seems to exist is it's opaque:YES is set, 
essentially negating any transparent effects. I've look through the 
documentation but haven't found a solution. I had assumed that when the calayer 
appears in context it would would be rendered.

here is the code ::


// the transparent calayer is a subclass called Menu.m

-(void)drawInContext:(CGContextRef)ctx {
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGContextClearRect(ctx, rect);
CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB();
CGFloat col[4] = {0,0,0,0.5};
CGColorRef colr = CGColorCreate(space, col);
CGColorSpaceRelease(space);
CGContextSetFillColorWithColor(ctx, colr);
CGColorRelease(colr);
CGContextFillRect(ctx, [self frame]);
}


//in the layer hosting view , this on work if the menu's opaque property is set 
to YES


CABasicAnimation * b = [CABasicAnimation 
animationWithKeyPath:@"position.y"];
b.duration = 0.4f;
b.fromValue = [NSNumber numberWithFloat:menu.frame.origin.y];
b.toValue = [NSNumber numberWithFloat:360.0];
b.timingFunction  = [CAMediaTimingFunction 
functionWithName:kCAMediaTimingFunctionEaseOut];   
b.removedOnCompletion = NO;
b.fillMode = kCAFillModeForwards;
[menu addAnimation:b forKey:@"slideIn"];


thanks in advance!


_

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/shaunlarkincocoa%40yahoo.ca

This email sent to [EMAIL PROTECTED]



  __
Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your 
favourite sites. Download it now at
http://ca.toolbar.yahoo.com.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CFBundleIconFile: heiß or hot?

2008-08-28 Thread Shawn Erickson
On Thu, Aug 28, 2008 at 5:38 AM, Gerriet M. Denkmann
<[EMAIL PROTECTED]> wrote:

> But, another problem: when I run my app with CFBundleIconFile = "heiß" the
> picture in the dock is just the default app icon.

What encoding is being used for your Info.plist?

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


Re: File Extensions Problem

2008-08-28 Thread Ingvar Nedrebo

Adil,

I use NSWorkspace and UTI types to do this, as in the code below. Look  
at the UTI hierarchy and replace "public.movie" in the code with  
whichever type covers the files you're interested in.



-(NSArray *)mediaFilesInFolder:(NSString *)folderPath
{
NSMutableArray * files = [NSMutableArray array];
NSWorkspace * ws = [NSWorkspace sharedWorkspace];
NSArray * paths = [[NSFileManager defaultManager]
   contentsOfDirectoryAtPath:folderPath
   error:NULL];

for (NSString * fn in paths)
{
NSString * absPath = [folderPath  
stringByAppendingPathComponent:fn];

NSString * type = [ws typeOfFile:absPath error:nil];

if ([ws type:type conformsToType:@"public.movie"])
{
[files addObject:absPath];
}
}
return files;
}



Ingvar


On Aug 22, 2008, at 07:29, Adil Saleem wrote:


Hi,

I want to display in a tableview, list of all media files (audio,  
video files) present in a certain directory.


Currently what i am doing is that i am getting the file names in an  
NSMutableArray using NSFileManager function directoryContentsAtPath


I get the list, but the problem is that it get all the files. I want  
only those files that have a certain extension (for example mp4,  
mp3). How can i do that.


Thanx in advance


___

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

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

2008-08-28 Thread Shaun Larkin
Solution found, I wasn't setting the bounds properly.



- Original Message 
From: Shaun Larkin <[EMAIL PROTECTED]>
To: cocoa-dev 
Sent: Thursday, August 28, 2008 10:16:03 AM
Subject: Semi-transparent offscreen CALayer

I'm trying to animate a semi-transparent CALayer (opacity 0.8) by sliding it in 
from offscreen but it only seems to exist is it's opaque:YES is set, 
essentially negating any transparent effects. I've look through the 
documentation but haven't found a solution. I had assumed that when the calayer 
appears in context it would would be rendered.

here is the code ::


// the transparent calayer is a subclass called Menu.m

-(void)drawInContext:(CGContextRef)ctx {
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGContextClearRect(ctx, rect);
CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB();
CGFloat col[4] = {0,0,0,0.5};
CGColorRef colr = CGColorCreate(space, col);
CGColorSpaceRelease(space);
CGContextSetFillColorWithColor(ctx, colr);
CGColorRelease(colr);
CGContextFillRect(ctx, [self frame]);
}


//in the layer hosting view , this on work if the menu's opaque property is set 
to YES


CABasicAnimation * b = [CABasicAnimation 
animationWithKeyPath:@"position.y"];
b.duration = 0.4f;
b.fromValue = [NSNumber numberWithFloat:menu.frame.origin.y];
b.toValue = [NSNumber numberWithFloat:360.0];
b.timingFunction  = [CAMediaTimingFunction 
functionWithName:kCAMediaTimingFunctionEaseOut];  
b.removedOnCompletion = NO;
b.fillMode = kCAFillModeForwards;
[menu addAnimation:b forKey:@"slideIn"];


thanks in advance!


_

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/shaunlarkincocoa%40yahoo.ca

This email sent to [EMAIL PROTECTED]



  __
Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your 
favourite sites. Download it now at
http://ca.toolbar.yahoo.com.
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/shaunlarkincocoa%40yahoo.ca

This email sent to [EMAIL PROTECTED]



  __
Connect with friends from any web browser - no download required. Try the new 
Yahoo! Canada Messenger for the Web BETA at 
http://ca.messenger.yahoo.com/webmessengerpromo.php
___

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

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

2008-08-28 Thread Michael Ash
On Wed, Aug 27, 2008 at 10:01 PM, Gerriet M. Denkmann
<[EMAIL PROTECTED]> wrote:
> Yesterday I did some nice recursive programming - the only problem was: I
> did not intend to do so.
> As a consequence, there was no defined end to the recursion, which made it
> essentially infinite.
>
> Well, memory - specifially stack space - is not infinite, so eventually I
> got an EXEC_BAD_ADDR or something like it.
>
> The real problem: while happily recursing away, the virtual memory exceeded
> all bounds of propriety, the swap files grew beyond all reasonable limits
> and the whole computer became (almost) unusable.
> I could not kill the runaway app from Xcodes Stop button - I had to wait
> until the aforementioned exception did take place.
> At which point gdb was started and offered to load some 50 000 stack frames,
> politely giving me the option to decline.
>
> Is there some way (environment variable?) to limit the stack size to
> something smaller, so that the exception (probably from stack corruption)
> would show off earlier?

The stack is not so big as that.

What probably caused the system slowdown was all the temporary objects
you were allocating (I assume) and which never went away, on account
of you never getting to the point of releasing any autorelease pools.

Your stack is only a few (dozen?) megabytes at most, so using all of
it shouldn't cause the symptoms you describe. But if each stack
creates a bunch of autoreleased temporary objects, they will all stick
around until you crash because the system is waiting for you to return
before it destroys them.

Unfortunately Mac OS X tends to behave badly in the face of this sort
of extreme memory pressure, and I'm not sure how to make it work any
better. If you happen to have two computers running, it can be useful
to get in the habit of keeping an ssh session open to your development
machine. Often a runaway process such as this which makes the GUI
unusable doesn't affect the command line nearly so much, so you can go
in and do a quick 'killall Whateverapp' to get back to normality.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Get current amount of available RAM

2008-08-28 Thread Michael Ash
On Thu, Aug 28, 2008 at 12:44 AM, Alex Kac <[EMAIL PROTECTED]> wrote:
> Right - but that doesn't work for my situation. I need actual free available
> physical RAM. Like when you use top and it shows you:
> PhysMem: 1173M wired, 5340M active, 2658M inactive, 9175M used, 1065M free.

This "free" value is essentially useless. Mac OS X will use all
available RAM for things like hard disk caches. While it's true that
if you have 1GB "free" that you have a bunch of physical RAM sitting
around not being useful, the converse is not true. It's quite common
to have a system with a lot of conceptually free resources showing
only 15MB of "free" RAM, because much of the rest has been dedicated
to caching files and other such things. If you base a decision on that
number, you'll hit the "low resources" path in a lot of cases where it
is unwarranted.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CFBundleIconFile: heiß or hot?

2008-08-28 Thread Shawn Erickson
On Thu, Aug 28, 2008 at 8:32 AM, Jean-Daniel Dupas
<[EMAIL PROTECTED]> wrote:

> Probably the good one, as the Cocoa framework managed to retreive the icon
> properly.  (the About Box display the icon propertly)

Well my thinking was it could be that some frameworks have broader
support for encodings then others so I was curious on what encoding
was being used.

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


Re: CoreData, SQLite and GUID

2008-08-28 Thread Michael Ash
On Wed, Aug 27, 2008 at 1:30 PM, mmalc crawford <[EMAIL PROTECTED]> wrote:
>
> On Aug 27, 2008, at 9:33 AM, Michael Ash wrote:
>
>> On Wed, Aug 27, 2008 at 5:30 AM, Amy Heavey <[EMAIL PROTECTED]>
>> wrote:
>>>
>>> I use an application that I believe is written using CoreData. It is
>>> currently quite tedious to enter data into this application, and the data
>>> I
>>> need entering is already in a mysql database anyway. I'd like to be able
>>> to
>>> insert this data directly into the SQLite database the application uses.
>>
>> Nothing prevents you from programmatically manipulating your CoreData
>> store. CoreData is not a GUI-only technology. Get your data into some
>> format that your CoreData app can read, and write some code to blast
>> it into your store. This is much more foolproof, and probably easier,
>> than trying to manipulate the SQLite database directly.
>>
> To take that a step further, in principle there shouldn't be any need to
> create an intermediate format -- you should be able to write a utility (with
> or without a GUI) that reads the data from the MySQL database using its
> native library and create and store managed objects directly.  See
> 
> for hints as to how to do this efficiently.

True enough. I was thinking of an intermediate format as being the
simpler approach, as I would personally be more comfortable doing that
(having never used MySQL from ObjC but being reasonably familiar with
using it from the more traditional languages). But you're exactly
right that you could do it all in a single program instead.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CFBundleIconFile: heiß or hot?

2008-08-28 Thread Jean-Daniel Dupas

I did test with an UTF-8 one (the default encoding).


Le 28 août 08 à 17:44, Shawn Erickson a écrit :


On Thu, Aug 28, 2008 at 8:32 AM, Jean-Daniel Dupas
<[EMAIL PROTECTED]> wrote:

Probably the good one, as the Cocoa framework managed to retreive  
the icon

properly.  (the About Box display the icon propertly)


Well my thinking was it could be that some frameworks have broader
support for encodings then others so I was curious on what encoding
was being used.

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


Re: File Extensions Problem

2008-08-28 Thread Michael Ash
On Wed, Aug 27, 2008 at 6:59 PM, R.L. Grigg
<[EMAIL PROTECTED]> wrote:
> Hmm, I guess the wrinkle in this particular case is if the "contract" doesnt
> specify something that the programmer assumes to be safe to do (like
> enumerating backwards), how can you know how to implement your end? I guess
> there are times when the underlying implementation details can/must
> influence your highlevel design?

When at all possible, your code should only be influenced by
underlying implementation details in the realm of performance, not
correctness.

This business of copying the array is a good example. It's fine to
write code that depends on the array no longer being copied, so long
as it still performs acceptably (although potentially worse) if the
array is copied.

There are a lot of cases where you have to make assumptions about
which technique is fastest, and this in turn depends on how those
techniques are implemented at a low level. But so long as your code
merely becomes slower when the assumptions change, but still
functions, this is generally not a problem.

In the case of enumerating backwards, the documentation says a lot
about how you should never mutate collections that you're enumerating
and nothing about it being safe to mutate while enumerating backwards.
The conclusion there should be obvious.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Quitting all active applications

2008-08-28 Thread Phil Faber
Yes I agree it could be most annoying in the majority of cases to quit  
other people's apps!


All I'm trying to achieve is a tiny app that only quits open apps and  
then quits itself; the purpose being when I want to release as much  
memory and disc space as possible before I run another memory /  
processor intensive app.  I could just quit each one individually but  
I guess I'm lazy!


I'm not suggesting anything more sinister!

Thanks to you & everyone for the advice.

Phil




On 28 Aug 2008, at 12:12, Rob Keniger wrote:


On 28/08/2008, at 8:36 PM, Phil Faber wrote:


Is there a simple way to quit all running applications?

Basically I want to achieve the same result as the first stage of  
hitting 'shut down' (closing all applications) without actually  
shutting down the system.



You could get the launched applications by using [[NSWorkspace  
sharedWorkspace] launchedApplications] and then send each of them a  
Quit Apple Event.


But why would you want to do this? It is possibly one of the most  
annoying things you could do to someone's machine and you would want  
to have a very, very good reason for it.


--
Rob Keniger


___

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

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

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

This email sent to [EMAIL PROTECTED]


ODBCKit problems with MySQL DB

2008-08-28 Thread matt
I am having a problem with the ODBCKit, and a MySQL database.

I really like the design and usage of the ODBCKit, and it is quite easy to use. 
 

There is however quite a serious problem that I cannot get around.  When a 
recordset is returned, I can only see one record.  Attempting to move to 
another record (moveNext) sets the isEOF property, and there is no data 
available.  

ODBCRecordset *rs = [odbcConnection open:@"select * from Stuff"];
rs.moveFirst;
while(!rs.isEOF)
  {
  [popup addItemWithTitle:[[rs fieldByName:@"Name"] asString]];
  [rs moveNext];
  }

I ran across a bug report of the same issue from last year, and a response that 
this has only been tested with the ActualTechnologies ODBC driver.  I have used 
both the MySQL connect driver, as well as the Actualtechnologies drivers with 
the same exact result.

Has anyone got past this, and how did you do it?  I would like to use the 
ODBCKit, however because of deadlines, may be forced to abandon completely.  
Are there any other Cocoa ODBC alternatives?

Thanks in advance for any and all help.
Matt  
 





Sent via the WebMail system at youney.com


 
   
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CFBundleIconFile: heiß or hot?

2008-08-28 Thread Gerriet M. Denkmann


On 28 Aug 2008, at 22:10, Shawn Erickson wrote:


On Thu, Aug 28, 2008 at 5:38 AM, Gerriet M. Denkmann
<[EMAIL PROTECTED]> wrote:

But, another problem: when I run my app with CFBundleIconFile =  
"heiß" the

picture in the dock is just the default app icon.


What encoding is being used for your Info.plist?


It starts with:


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]


NSProgressIndicator not responding to calls outside of AppController class

2008-08-28 Thread Martin Stoufer
I am developing an app that is utilizing some legacy C code that I have 
massaged into Objective-C classes. In one of them, I am trying to drive 
an NSProgressIndicator view as defined by the NIB for the project. There 
is a core processing loop that originally spit out multiple '.' to 
stdout as it ran. Now I want to capture a count of these and update the 
indicator.


The class has the proper IBOutlet defined in its header file and IB 
correctly sees this class (via a new Object I created in IB) and the 
IBOutlet I defined for it. I hooked it up properly and now when the code 
in the C class runs, the calls to


[myProgressIndicator setDoubleValue:progress] aren't being displayed in 
the App.


Is there something fundamentally wrong I'm doing here? Can there be only 
one Controller class in a Cocoa app?


The app is rather evolved however all the IBOutlets/IBActions to this 
point have been restricted to the AppController class. I have a sneaking 
suspicion that the Object I created in IB should actually be
an Object Controller instead and bind values directly to the UI 
components I want to drive.




--
* Martin C. Stoufer  *
* ISS/IT *
* Lawrence Berkeley National Lab *
* 510-486-5306   *
* MS 937-700 *



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: Quitting all active applications

2008-08-28 Thread Martin Stoufer
A small app that utilized an NSTask object whose system command would be 
'killall -u  -m '.


Where the regex would probably exclude processes that did not include 
'login' or anything 'launchd'. This would keep the reaper from killing 
your loginwindow process as well!




Phil Faber wrote:
Yes I agree it could be most annoying in the majority of cases to quit 
other people's apps!


All I'm trying to achieve is a tiny app that only quits open apps and 
then quits itself; the purpose being when I want to release as much 
memory and disc space as possible before I run another memory / 
processor intensive app.  I could just quit each one individually but 
I guess I'm lazy!


I'm not suggesting anything more sinister!

Thanks to you & everyone for the advice.

Phil




On 28 Aug 2008, at 12:12, Rob Keniger wrote:


On 28/08/2008, at 8:36 PM, Phil Faber wrote:


Is there a simple way to quit all running applications?

Basically I want to achieve the same result as the first stage of 
hitting 'shut down' (closing all applications) without actually 
shutting down the system.



You could get the launched applications by using [[NSWorkspace 
sharedWorkspace] launchedApplications] and then send each of them a 
Quit Apple Event.


But why would you want to do this? It is possibly one of the most 
annoying things you could do to someone's machine and you would want 
to have a very, very good reason for it.


--
Rob Keniger


___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/mcstoufer%40lbl.gov

This email sent to [EMAIL PROTECTED]


--
* Martin C. Stoufer  *
* ISS/IT *
* Lawrence Berkeley National Lab *
* 510-486-5306   *
* MS 937-700 *



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: Core Animation : are text attributes animatable ?

2008-08-28 Thread Rodolfo Niborski
CATransform3D transform = CATransform3DMakeScale(factor, factor,  
factor);

[mainLayer setTransform:transform];
[mainLayer setOpacity:0.0];

The layer instead gets *scaled* by the factor you specify.



I tried this, and it works fine as far as smooth animation is  
concerned. The problem though is that font size isn't scaling only.   
If you take a sufficiently large initial font size, the scaled letters  
will look non-pixellated, but for certains scaling factors, they will  
look definitely strange...

___

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

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

2008-08-28 Thread Martin Stoufer

Matt,
   I have run across this with the JDBC plugin talking to an Oracle DB. 
I found that if only one record was returned, this logic bombed in the 
exact same manner, the workaround was to set the curRecord pointer to 
the last and read backwards if the record count ==1. Otherwise you just 
read records as you have coded. You should verify that the rs begins at 
the "0" record. Your while condition should be the return value of [rs 
moveNext].



matt wrote:

I am having a problem with the ODBCKit, and a MySQL database.

I really like the design and usage of the ODBCKit, and it is quite easy to use.  

There is however quite a serious problem that I cannot get around.  When a recordset is returned, I can only see one record.  Attempting to move to another record (moveNext) sets the isEOF property, and there is no data available.  


ODBCRecordset *rs = [odbcConnection open:@"select * from Stuff"];
rs.moveFirst;
while(!rs.isEOF)
  {
  [popup addItemWithTitle:[[rs fieldByName:@"Name"] asString]];
  [rs moveNext];
  }

I ran across a bug report of the same issue from last year, and a response that 
this has only been tested with the ActualTechnologies ODBC driver.  I have used 
both the MySQL connect driver, as well as the Actualtechnologies drivers with 
the same exact result.

Has anyone got past this, and how did you do it?  I would like to use the 
ODBCKit, however because of deadlines, may be forced to abandon completely.  
Are there any other Cocoa ODBC alternatives?

Thanks in advance for any and all help.
Matt  
 






Sent via the WebMail system at youney.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/mcstoufer%40lbl.gov

This email sent to [EMAIL PROTECTED]
  


--
* Martin C. Stoufer  *
* ISS/IT *
* Lawrence Berkeley National Lab *
* 510-486-5306   *
* MS 937-700 *



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: NSProgressIndicator not responding to calls outside of AppController class

2008-08-28 Thread Randall Meadows

On Aug 28, 2008, at 10:37 AM, Martin Stoufer wrote:

I am developing an app that is utilizing some legacy C code that I  
have massaged into Objective-C classes. In one of them, I am trying  
to drive an NSProgressIndicator view as defined by the NIB for the  
project. There is a core processing loop that originally spit out  
multiple '.' to stdout as it ran. Now I want to capture a count of  
these and update the indicator.


The class has the proper IBOutlet defined in its header file and IB  
correctly sees this class (via a new Object I created in IB) and the  
IBOutlet I defined for it. I hooked it up properly and now when the  
code in the C class runs, the calls to


[myProgressIndicator setDoubleValue:progress] aren't being displayed  
in the App.


Are you doing all this in a single loop (e.g., inside the main event  
loop)?  If so, you aren't giving the main event loop itself time to  
service the GUI updates.  You can add in a call to  
[myProgressIndicator display], but even better would be to break out  
this inner loop and put it in a thread (giving the main loop a chance  
to execute alongside your loop, and therefore take care of the screen  
updates).  See NSThread  
+detachNewThreadSelector:toTarget:withObject:.  This will require some  
refactoring...

___

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

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

2008-08-28 Thread Randall Meadows

On Aug 28, 2008, at 10:46 AM, Martin Stoufer wrote:

A small app that utilized an NSTask object whose system command  
would be 'killall -u  -m '.


And that would be a great way to lose data, if any of the applications  
getting killed had unsaved documents.


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: mark added object in NSArrayController as "dirty"?

2008-08-28 Thread Matt Neuburg
On Thu, 28 Aug 2008 08:47:10 -0600, Keary Suska <[EMAIL PROTECTED]>
said:
>8/27/08 6:46 PM, also sprach [EMAIL PROTECTED]:
>
>> I've got a simple detail view backed by an NSArrayController. The view views
>> the NSArrayController's selection. The NSArrayController manages an array of
>> dictionaries, all very simple.
>> 
>> I've implemented validateValue:... and it's being called when I want it to
>> be (thanks to "validates immediately"), except on this one occasion:
>> 
>> The user can create a new object - the button calls add:, and I've
>> overridden newObject:. However, this new object is deliberately invalid;
>> some fields are blank, but the user must fill them in before leaving and
>> moving to another selection. That's the intention, anyway. The problem is
>> that that is not happening; the user can press the selectPrevious: button
>> without doing any editing, and no validation takes place. Obviously that's
>> because the user didn't do any editing!
>> 
>> How can I fool the system into thinking the user has done some editing in
>> every field, so that when the user leaves this selection for another, every
>> field will be validated? m.
>
>AFAIK, you can't. And, AFAIK, simply entering a field is enough to trigger
>editing, so if you set the first blank field as as first responder,
>validation should be called on end editing. But just for that field,
>unfortunately.

Thanks (and your answer was extremely useful and confirmed my own further
experiments), but the problem is that I'm not even getting that. That would
be a reduced version of what I'd like to do, i.e. it would help me if I
could just fool the system into thinking that the user has edited any field
at all. Being *in* a field is not enough to do this; you have to *change*
the field. But I need to do this in a way that makes the system think the
*user* changed the field...

m.

-- 
matt neuburg, phd = [EMAIL PROTECTED], 
A fool + a tool + an autorelease pool = cool!
One of the 2007 MacTech Top 25: 
AppleScript: the Definitive Guide - Second Edition!




___

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

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

2008-08-28 Thread Martin Stoufer
Actually no, since the default kill signal is TERM, apps will be allowed 
to prompt to save if necessary. This assumes the app is handling that 
signal properly. We could send KILL or ABRT and that would just end the 
processes w/o any save options.


Randall Meadows wrote:

On Aug 28, 2008, at 10:46 AM, Martin Stoufer wrote:

A small app that utilized an NSTask object whose system command would 
be 'killall -u  -m '.


And that would be a great way to lose data, if any of the applications 
getting killed had unsaved documents.




--
* Martin C. Stoufer  *
* ISS/IT *
* Lawrence Berkeley National Lab *
* 510-486-5306   *
* MS 937-700 *



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: NSProgressIndicator not responding to calls outside of AppController class

2008-08-28 Thread Martin Stoufer
I totally forgot about the 'display' call. I will try that as a first 
pass. As for refactoring, that IS the long term solution to the problem, 
but the legacy code is like a pool of mud when it comes to moving it 
around. I will need a shot of courage before I dive into that.


Randall Meadows wrote:

On Aug 28, 2008, at 10:37 AM, Martin Stoufer wrote:

I am developing an app that is utilizing some legacy C code that I 
have massaged into Objective-C classes. In one of them, I am trying 
to drive an NSProgressIndicator view as defined by the NIB for the 
project. There is a core processing loop that originally spit out 
multiple '.' to stdout as it ran. Now I want to capture a count of 
these and update the indicator.


The class has the proper IBOutlet defined in its header file and IB 
correctly sees this class (via a new Object I created in IB) and the 
IBOutlet I defined for it. I hooked it up properly and now when the 
code in the C class runs, the calls to


[myProgressIndicator setDoubleValue:progress] aren't being displayed 
in the App.


Are you doing all this in a single loop (e.g., inside the main event 
loop)?  If so, you aren't giving the main event loop itself time to 
service the GUI updates.  You can add in a call to 
[myProgressIndicator display], but even better would be to break out 
this inner loop and put it in a thread (giving the main loop a chance 
to execute alongside your loop, and therefore take care of the screen 
updates).  See NSThread 
+detachNewThreadSelector:toTarget:withObject:.  This will require some 
refactoring...


--
* Martin C. Stoufer  *
* ISS/IT *
* Lawrence Berkeley National Lab *
* 510-486-5306   *
* MS 937-700 *



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: Quitting all active applications

2008-08-28 Thread Clark Cox
GUI applications do not generally handle SIGTERM (or any other signals
for that matter). Killing GUI applications is a Bad Thing™ :)

Randal is correct, this will lose your saved data in any currently
open applications.

On Thu, Aug 28, 2008 at 10:39 AM, Martin Stoufer <[EMAIL PROTECTED]> wrote:
> Actually no, since the default kill signal is TERM, apps will be allowed to
> prompt to save if necessary. This assumes the app is handling that signal
> properly. We could send KILL or ABRT and that would just end the processes
> w/o any save options.
>
> Randall Meadows wrote:
>>
>> On Aug 28, 2008, at 10:46 AM, Martin Stoufer wrote:
>>
>>> A small app that utilized an NSTask object whose system command would be
>>> 'killall -u  -m '.
>>
>> And that would be a great way to lose data, if any of the applications
>> getting killed had unsaved documents.
>>
>
> --
> * Martin C. Stoufer  *
> * ISS/IT *
> * Lawrence Berkeley National Lab *
> * 510-486-5306   *
> * MS 937-700 *
>
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/clarkcox3%40gmail.com
>
> This email sent to [EMAIL PROTECTED]
>



-- 
Clark S. Cox III
[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: Quitting all active applications

2008-08-28 Thread Jean-Daniel Dupas


Cocoa Application expects a Quit AppleEvent, not a sigterm.
SIGTERM will kill the app and it will not have any chance to save the  
edited document. Try with TextEdit if you don't belive it ;-)



Actually no, since the default kill signal is TERM, apps will be  
allowed to prompt to save if necessary. This assumes the app is  
handling that signal properly. We could send KILL or ABRT and that  
would just end the processes w/o any save options.


Randall Meadows wrote:

On Aug 28, 2008, at 10:46 AM, Martin Stoufer wrote:

A small app that utilized an NSTask object whose system command  
would be 'killall -u  -m '.


And that would be a great way to lose data, if any of the  
applications getting killed had unsaved documents.




--
* Martin C. Stoufer  *
* ISS/IT *
* Lawrence Berkeley National Lab *
* 510-486-5306   *
* MS 937-700 *

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org

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: Quitting all active applications

2008-08-28 Thread Randall Meadows

On Aug 28, 2008, at 11:39 AM, Martin Stoufer wrote:

Actually no, since the default kill signal is TERM, apps will be  
allowed to prompt to save if necessary. This assumes the app is  
handling that signal properly. We could send KILL or ABRT and that  
would just end the processes w/o any save options.


Well, then there must be a lot of apps out there that don't handle it  
properly.  TextEdit, Pages, Word, Omnigraffle all failed to prompt me  
to save dirty documents when I used killall on them.


Granted, that's a small data sample, but I'd be right (and rightly)  
pissed at anyone that decided that all those other programs were  
written wrong, and decided to use killall anyway.


On a Mac system, this is simply NOT the right way to do this.
___

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

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

2008-08-28 Thread matt
Matt,
I have run across this with the JDBC plugin talking to an Oracle DB.
I found that if only one record was returned, this logic bombed in the
exact same manner, the workaround was to set the curRecord pointer to
the last and read backwards if the record count ==1. Otherwise you just
read records as you have coded. You should verify that the rs begins at
the "0" record. Your while condition should be the return value of [rs
moveNext].

Martin,
The problem is that many records should be returned by this query, however I 
can only read the first one.  The column count is correct, as is the data, 
however only one row is returned.  The data is in the Db, and queries using 
other s/w work fine, just not the ODBCKit.
Thanks,
Matt
 





Sent via the WebMail system at youney.com


 
   
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Quitting all active applications

2008-08-28 Thread Martin Stoufer
I had always naively assumed that all the some *Framework underneath an 
app was setting up signal handlers for you with default behaviours. If 
this isn't the case, then yes any killall approach will cause loss of data.


Now I'm interested into finding out why this isn't the case.


Clark Cox wrote:

GUI applications do not generally handle SIGTERM (or any other signals
for that matter). Killing GUI applications is a Bad Thing™ :)

Randal is correct, this will lose your saved data in any currently
open applications.

On Thu, Aug 28, 2008 at 10:39 AM, Martin Stoufer <[EMAIL PROTECTED]> wrote:
  

Actually no, since the default kill signal is TERM, apps will be allowed to
prompt to save if necessary. This assumes the app is handling that signal
properly. We could send KILL or ABRT and that would just end the processes
w/o any save options.

Randall Meadows wrote:


On Aug 28, 2008, at 10:46 AM, Martin Stoufer wrote:

  

A small app that utilized an NSTask object whose system command would be
'killall -u  -m '.


And that would be a great way to lose data, if any of the applications
getting killed had unsaved documents.

  

--
* Martin C. Stoufer  *
* ISS/IT *
* Lawrence Berkeley National Lab *
* 510-486-5306   *
* MS 937-700 *


___

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

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

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

This email sent to [EMAIL PROTECTED]






  


--
* Martin C. Stoufer  *
* ISS/IT *
* Lawrence Berkeley National Lab *
* 510-486-5306   *
* MS 937-700 *




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: ODBCKit problems with MySQL DB

2008-08-28 Thread Martin Stoufer
So we know there are multiple rows in the db that satisfy your query. 
Can you verify that multiple rows do show up in the rs object? I find 
that the call to rs.moveFirst is a bit redundant and the loop condition 
being [rs moveNext]. This assumes that this call does return a BOOL if 
successful.


I recall that in my old Python days working with MySQL, I had to 
explicitly set a 'read all' bit on the record set so all records would 
be read from the result stream before I iterated through them. I don't 
know if this translates into this context.


matt wrote:

Matt,
I have run across this with the JDBC plugin talking to an Oracle DB.
I found that if only one record was returned, this logic bombed in the
exact same manner, the workaround was to set the curRecord pointer to
the last and read backwards if the record count ==1. Otherwise you just
read records as you have coded. You should verify that the rs begins at
the "0" record. Your while condition should be the return value of [rs
moveNext].

Martin,
The problem is that many records should be returned by this query, however I 
can only read the first one.  The column count is correct, as is the data, 
however only one row is returned.  The data is in the Db, and queries using 
other s/w work fine, just not the ODBCKit.
Thanks,
Matt
 






Sent via the WebMail system at youney.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/mcstoufer%40lbl.gov

This email sent to [EMAIL PROTECTED]
  


--
* Martin C. Stoufer  *
* ISS/IT *
* Lawrence Berkeley National Lab *
* 510-486-5306   *
* MS 937-700 *



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: ODBCKit problems with MySQL DB

2008-08-28 Thread Jonathan Monroe



On Aug 28, 2008, at 12:19 PM, [EMAIL PROTECTED] wrote:


I am having a problem with the ODBCKit, and a MySQL database.

I really like the design and usage of the ODBCKit, and it is quite  
easy to use.


There is however quite a serious problem that I cannot get around.   
When a recordset is returned, I can only see one record.  Attempting  
to move to another record (moveNext) sets the isEOF property, and  
there is no data available.


ODBCRecordset *rs = [odbcConnection open:@"select * from Stuff"];
rs.moveFirst;
while(!rs.isEOF)
 {
 [popup addItemWithTitle:[[rs fieldByName:@"Name"] asString]];
 [rs moveNext];
 }

I ran across a bug report of the same issue from last year, and a  
response that this has only been tested with the ActualTechnologies  
ODBC driver.  I have used both the MySQL connect driver, as well as  
the Actualtechnologies drivers with the same exact result.


Not all drivers support scrollable cursors, which means that  
rs.moveFirst (and moveLast and movePrevious) would not be supported.   
Your best best is to assume forward-only cursors, and only use  
rs.moveNext.


You do not need to call rs.moveFirst after executing a query - the  
cursor is placed at the first row by default.


Jonathan Monroe
Actual Technologies - ODBC for Mac OS X
http://www.actualtechnologies.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]


#import, #include, pre-compiled headers

2008-08-28 Thread J. Todd Slack

HI All,

Question on #import, #include and pre-compiled headers.

I have a bunch of classes that import the same #imports (like QTKit,  
Quicktime, Cocoa, Foundation, etc, etc)


Is there a way that I can just #import them once and not have to for  
each class?


Is that a pre-compiled header?

Wouldn't not importing them each class make my app smaller in size and  
use less memory?


Thanks,

-Jason


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSProgressIndicator not responding to calls outside of AppController class

2008-08-28 Thread Martin Stoufer
The display bit did the trick and with all the computing going on, the 
updating is still responsive. Thanks to Randall for the tips.


Martin Stoufer wrote:
I totally forgot about the 'display' call. I will try that as a first 
pass. As for refactoring, that IS the long term solution to the 
problem, but the legacy code is like a pool of mud when it comes to 
moving it around. I will need a shot of courage before I dive into that.


Randall Meadows wrote:

On Aug 28, 2008, at 10:37 AM, Martin Stoufer wrote:

I am developing an app that is utilizing some legacy C code that I 
have massaged into Objective-C classes. In one of them, I am trying 
to drive an NSProgressIndicator view as defined by the NIB for the 
project. There is a core processing loop that originally spit out 
multiple '.' to stdout as it ran. Now I want to capture a count of 
these and update the indicator.


The class has the proper IBOutlet defined in its header file and IB 
correctly sees this class (via a new Object I created in IB) and the 
IBOutlet I defined for it. I hooked it up properly and now when the 
code in the C class runs, the calls to


[myProgressIndicator setDoubleValue:progress] aren't being displayed 
in the App.


Are you doing all this in a single loop (e.g., inside the main event 
loop)?  If so, you aren't giving the main event loop itself time to 
service the GUI updates.  You can add in a call to 
[myProgressIndicator display], but even better would be to break out 
this inner loop and put it in a thread (giving the main loop a chance 
to execute alongside your loop, and therefore take care of the screen 
updates).  See NSThread 
+detachNewThreadSelector:toTarget:withObject:.  This will require 
some refactoring...




___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/mcstoufer%40lbl.gov

This email sent to [EMAIL PROTECTED]


--
* Martin C. Stoufer  *
* ISS/IT *
* Lawrence Berkeley National Lab *
* 510-486-5306   *
* MS 937-700 *



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: File Extensions Problem

2008-08-28 Thread Ken Thomases

On Aug 27, 2008, at 5:59 PM, R.L. Grigg wrote:

Hmm, I guess the wrinkle in this particular case is if the  
"contract" doesnt specify something that the programmer assumes to  
be safe to do (like enumerating backwards), how can you know how to  
implement your end?


Enumerating NSArrays backwards is safe and supported by the  
framework.  The earlier discussion had to do with mutating a  
collection while enumerating, which is explicitly stated to be  
unsafe.  Somebody (I forget who) claimed that mutating was "safe"  
while enumerating backwards, but they were wrong.  In this case,  
their wrongness was not based on things left unsaid in the contract,  
but on violating things explicitly laid out in the contract.


Cheers,
Ken
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: #import, #include, pre-compiled headers

2008-08-28 Thread J. Todd Slack


Hi Jon,

Thanks, the Headers and Performance section was helpful.

-Jason

On Aug 28, 2008, at 11:27 AM, Jonathan Hohle wrote:

#import and #include do not copy the contents of the other files  
into the file which contains them, rather it tells the compiler that  
it is referencing definitions from that file. It does not increase  
the size of your program to #import or #include a header file more  
than once across many files.


http://developer.apple.com/documentation/MacOSX/Conceptual/BPFrameworks/Tasks/IncludingFrameworks.html
http://gcc.gnu.org/onlinedocs/cpp/Include-Operation.html#Include-Operation

Jon
<><

On Thu, Aug 28, 2008 at 11:18 AM, J. Todd Slack <[EMAIL PROTECTED] 
> wrote:

HI All,

Question on #import, #include and pre-compiled headers.

I have a bunch of classes that import the same #imports (like QTKit,  
Quicktime, Cocoa, Foundation, etc, etc)


Is there a way that I can just #import them once and not have to for  
each class?


Is that a pre-compiled header?

Wouldn't not importing them each class make my app smaller in size  
and use less memory?


Thanks,

-Jason


___

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

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

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

This email sent to [EMAIL PROTECTED]



--
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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Convert unicode string into ascii

2008-08-28 Thread Davide Scheriani

hello guys,

is a way to convert an unicode string into a simple a-z>0-9 string
and replace the other wierd chars into a "." (full stop)?

im doing a small hex reader, so maybe this could help you.
___

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

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

2008-08-28 Thread matt

-- Original Message --
From: Jonathan Monroe <[EMAIL PROTECTED]>
Date:  Thu, 28 Aug 2008 12:59:44 -0500



On Aug 28, 2008, at 12:19 PM, [EMAIL PROTECTED] wrote:

> I am having a problem with the ODBCKit, and a MySQL database.
>
> I really like the design and usage of the ODBCKit, and it is quite  
> easy to use.
>
> There is however quite a serious problem that I cannot get around.   
> When a recordset is returned, I can only see one record.  Attempting  
> to move to another record (moveNext) sets the isEOF property, and  
> there is no data available.
>
> ODBCRecordset *rs = [odbcConnection open:@"select * from Stuff"];
> rs.moveFirst;
> while(!rs.isEOF)
>  {
>  [popup addItemWithTitle:[[rs fieldByName:@"Name"] asString]];
>  [rs moveNext];
>  }
>
> I ran across a bug report of the same issue from last year, and a  
> response that this has only been tested with the ActualTechnologies  
> ODBC driver.  I have used both the MySQL connect driver, as well as  
> the Actualtechnologies drivers with the same exact result.

Not all drivers support scrollable cursors, which means that  
rs.moveFirst (and moveLast and movePrevious) would not be supported.   
Your best best is to assume forward-only cursors, and only use  
rs.moveNext.

You do not need to call rs.moveFirst after executing a query - the  
cursor is placed at the first row by default.

Jonathan Monroe
Actual Technologies - ODBC for Mac OS X
http://www.actualtechnologies.com


Jonathan, Martin,
Thanks for the advice, however I still can only see the first record in the 
recordset.  I am very frustrated at this point.  I see that this support 
request for last year has not been resolve, and it appears to be the same 
problem:
http://sourceforge.net/tracker/index.php?func=detail&aid=1681056&group_id=177561&atid=881727

I was thinking that what I am trying to do was quite common (MySQL DB using 
ODBC), and hoping I could leverage what someone else has already learned.

I would really like to get this working using ODBC rather than being limited to 
a particular DB, even if ODBCKit doesn't work and/or is no longer supported.

Again, thanks,
Matt 





Sent via the WebMail system at youney.com


 
   
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: global key bindings

2008-08-28 Thread Eric Schlegel


On Aug 28, 2008, at 5:21 AM, David Reitter wrote:

Can you give me a pointer on how to implement global key bindings?   
(Again, the app has no menu / Dock icon and would want to receive  
the event without having focus.  I need something like Hot Keys in  
Carbon.)


Use the hot key API in Carbon. That's the only API for global hotkeys  
at the moment.


-eric

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Convert unicode string into ascii

2008-08-28 Thread Martin Stoufer

The simplest way I've accomplished this is:

[[NSString alloc] initWithCString:(const char *)nullTerminatedCString 
encoding:(NSStringEncoding)encoding];


Where encoding is :NSUTF8StringEncoding

You will then have to replace the "unknown" char with a "." with the 
NSString method:


stringByReplacingOccurrencesOfString:withString:



Davide Scheriani wrote:

hello guys,

is a way to convert an unicode string into a simple a-z>0-9 string
and replace the other wierd chars into a "." (full stop)?

im doing a small hex reader, so maybe this could help you.
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/mcstoufer%40lbl.gov

This email sent to [EMAIL PROTECTED]


--
* Martin C. Stoufer  *
* ISS/IT *
* Lawrence Berkeley National Lab *
* 510-486-5306   *
* MS 937-700 *



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: Convert unicode string into ascii

2008-08-28 Thread Wade Tregaskis

is a way to convert an unicode string into a simple a-z>0-9 string
and replace the other wierd chars into a "." (full stop)?

im doing a small hex reader, so maybe this could help you.


CFDataRef CFStringCreateExternalRepresentation (
   CFAllocatorRef alloc,
   CFStringRef theString,
   CFStringEncoding encoding,
   UInt8 lossByte
);
-- OR --
CFIndex CFStringGetBytes (
   CFStringRef theString,
   CFRange range,
   CFStringEncoding encoding,
   UInt8 lossByte,
   Boolean isExternalRepresentation,
   UInt8 *buffer,
   CFIndex maxBufLen,
   CFIndex *usedBufLen
);

Pass kCFStringEncodingASCII as the desired encoding, '.' as your loss  
byte.  That won't limit you to purely alphanumerics - it allows  
spaces, punctuation, etc.  But it may be exactly what you want - it's  
not clear from your original post.


Depending on how you then need to use the result, you may prefer one  
or the other.  In either case it's easy enough to convert back to a  
CFString if that's what you ultimately need.


Wade
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: mark added object in NSArrayController as "dirty"?

2008-08-28 Thread Keary Suska
8/28/08 11:37 AM, also sprach [EMAIL PROTECTED]:

>> AFAIK, you can't. And, AFAIK, simply entering a field is enough to trigger
>> editing, so if you set the first blank field as as first responder,
>> validation should be called on end editing. But just for that field,
>> unfortunately.
> 
> Thanks (and your answer was extremely useful and confirmed my own further
> experiments), but the problem is that I'm not even getting that. That would
> be a reduced version of what I'd like to do, i.e. it would help me if I
> could just fool the system into thinking that the user has edited any field
> at all. Being *in* a field is not enough to do this; you have to *change*
> the field. But I need to do this in a way that makes the system think the
> *user* changed the field...

Have you tried:

  id object = [textField objectValue];
  [textField setObjectValue:object];

?

I have used this technique to re-trigger formatting

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: global key bindings

2008-08-28 Thread Jean-Daniel Dupas


Le 28 août 08 à 14:21, David Reitter a écrit :


On 28 Aug 2008, at 00:27, Eric Schlegel wrote:



Menus contained in NSStatusItems (and displayed on the right side  
of the menubar) don't currently respond to command keys at all.  
This is already reported in Radar.


Thanks, I'll stop looking then.
FWIW, the binding does work once the menu is shown.  Also, Adium  
somehow manages to pull it off, too.


Can you give me a pointer on how to implement global key bindings?   
(Again, the app has no menu / Dock icon and would want to receive  
the event without having focus.  I need something like Hot Keys in  
Carbon.)


So use Carbon Hot Keys.

http://developer.apple.com/samplecode/FunkyOverlayWindow/listing7.html


___

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

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

2008-08-28 Thread Ricky Sharp
Just to point this out, the sequence of ASCII may not be useful at all  
if the file is say Unicode. The actual bytes making up each char could  
be "ASCII" values themselves.


Sent from my iPhone

On Aug 28, 2008, at 1:53 PM, Martin Stoufer <[EMAIL PROTECTED]> wrote:


The simplest way I've accomplished this is:

[[NSString alloc] initWithCString:(const char  
*)nullTerminatedCString encoding:(NSStringEncoding)encoding];


Where encoding is :NSUTF8StringEncoding

You will then have to replace the "unknown" char with a "." with the  
NSString method:


stringByReplacingOccurrencesOfString:withString:



Davide Scheriani wrote:

hello guys,

is a way to convert an unicode string into a simple a-z>0-9 string
and replace the other wierd chars into a "." (full stop)?

im doing a small hex reader, so maybe this could help you.
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/mcstoufer%40lbl.gov

This email sent to [EMAIL PROTECTED]


--
* Martin C. Stoufer  *
* ISS/IT *
* Lawrence Berkeley National Lab *
* 510-486-5306   *
* MS 937-700 *

___

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

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

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


NSXMLNode and NSXMLElement issue

2008-08-28 Thread Andrew R. Kinnie

Greetings:

I am attempting to programmatically create an html (rather, xhtml)  
document using NSXMLDocument, NSXMLElement, etc.


I am able to create the document and it works, but I am not sure how  
to create text which is not inside a paragraph or another tag which  
can be a node.


e.g.

contents
some random text


or

some header text
some random text

 . . . . 
etc.



It seems when programmatically creating a node, the node has a name,  
which is the tag (e.g. h3 above) but how do you do this without tags?   
The text itself, unwrapped by tags would be the node, but I have no  
idea how to programmatically do this.  I created node with an empty  
name, but then the open tag actually is displayed in safari.  I tried  
a nil name, in which case the entire tag and it's contents is ignored.


Another (and more directly relevant) example is bread crumbs:

 -  - etc.

I was able to otherwise create text using div tags, but if I try divs  
here (i.e. wrap the "-" in a div) I get:



-


Any insight or ideas?  What am I missing?

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]


[Meet] LA CocoaHeads tonight, 8/28 7:30pm

2008-08-28 Thread Rob Ross

Hey LA CocoaHeads.

Just a quick reminder that tonight we have our first study group  
meeting for the Aaron Hillegass book "Cocoa Programming for Mac OS X,  
3rd Edition".


http://search.barnesandnoble.com/Cocoa-Programming-for-Mac-OS-X/Aaron- 
Hillegass/e/9780321503619/?itm=1


We'll be covering chapters 1-3. Please jot down any question you come  
up with during your reading.


We meet at the offices of E! Entertainment at 7:30pm.

Our meeting location is

5750 Wilshire Blvd
Los Angeles, CA 90036.

Here's a google map of the location:

http://www.google.com/maps?f=q&hl=en&q=5750+Wilshire+Blvd,+Los+Angeles 
+CA+90036&ie=UTF8&z=15&om=1&iwloc=addr


Free street parking is available. I'd suggest trying Masselin Ave,  
which is one block East of Courtyard Place.


We meet near the lobby of the West building at 5750 Wilshire Blvd, on  
the West side of Courtyard Place. There are picknick tables in front  
of the lobby and we'll gather there starting at 7:20pm. From there we  
go inside and up to conference room 3A at around 7:45pm .


If you arrive late, please ask the building security personnel in the  
lobby to direct you to the E! Security office, and they will be able  
to contact the group in conference room 3A and send someone down to  
meet you.



Rob Ross, Lead Software Engineer
E! Networks

---
"Beware of he who would deny you access to information, for in his  
heart he dreams himself your master." -- Commissioner Pravin Lal


___

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

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

2008-08-28 Thread Shawn Erickson
On Thu, Aug 28, 2008 at 9:37 AM, Phil Faber <[EMAIL PROTECTED]> wrote:

> All I'm trying to achieve is a tiny app that only quits open apps and then
> quits itself; the purpose being when I want to release as much memory and
> disc space as possible before I run another memory / processor intensive
> app.  I could just quit each one individually but I guess I'm lazy!

No need for a compiled application. You should be able to write this
in a small AppleScript that you can just double click. Just ask the
list of apps to quit.

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


Re: Creating Interface

2008-08-28 Thread Chris Hanson

On Aug 28, 2008, at 7:32 AM, Roland King wrote:

I don't quite understand why protocols like NSKeyValueObserving  
aren't formalized and in a .h file somewhere so you could just use  
them in the same way you can the NSObject protocol. They're  
documented, why not just write the .h file. There's probably a  
very good reason for it which has totally escaped me.


Conforming to a protocol is an all-or-nothing affair - you have to  
implement *all* of the protocol's methods. The informal protocols  
I'm aware of tend to have one or more optional methods.




You can have @optional Protocol methods (is that new, that may be  
new, I'm really not sure).


It's new in Objective-C 2.0 in Leopard.

Prior to that, protocols were always all-or-nothing, just as  
interfaces are in Java and C#.  (Java actually acknowledges deriving  
its concept of interfaces from Objective-C protocols; C# is a Java  
derivative.)  That's why they weren't used for things like delegates  
and data sources where only a subset of methods need to be implemented  
to be functional.


  -- Chris

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSXMLNode and NSXMLElement issue

2008-08-28 Thread Nate Weaver
You need to use NSXMLNode itself, and not NSXMLElement (since text  
nodes aren't elements). [NSXMLNode textWithStringValue:someString] or - 
[[NSXMLNode alloc] initWithKind:NSXMLTextKind], followed by - 
setStringValue:. Then just addChild: or insertChild:atIndex: with your  
new text node as normal.


HTH

On Aug 28, 2008, at 2:11 PM, Andrew R. Kinnie wrote:


Greetings:

I am attempting to programmatically create an html (rather, xhtml)  
document using NSXMLDocument, NSXMLElement, etc.


I am able to create the document and it works, but I am not sure how  
to create text which is not inside a paragraph or another tag which  
can be a node.


e.g.

contents
some random text


or

some header text
some random text

 . . . . 
etc.



It seems when programmatically creating a node, the node has a name,  
which is the tag (e.g. h3 above) but how do you do this without  
tags?  The text itself, unwrapped by tags would be the node, but I  
have no idea how to programmatically do this.  I created node with  
an empty name, but then the open tag actually is displayed in  
safari.  I tried a nil name, in which case the entire tag and it's  
contents is ignored.


Another (and more directly relevant) example is bread crumbs:

 -  - etc.

I was able to otherwise create text using div tags, but if I try  
divs here (i.e. wrap the "-" in a div) I get:



-


Any insight or ideas?  What am I missing?

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: Quitting all active applications

2008-08-28 Thread Michael Watson
Even if this is the case, if you send a kill signal to a GUI Cocoa  
application, that application's app delegate will not receive - 
applicationWillTerminate:. If the application has any important  
cleanup/shut down code to run, it won't happen.


I'd go with "don't kill GUI apps unless they're malfunctioning" here.


--
m-s

On 28 Aug, 2008, at 13:47, Randall Meadows wrote:


On Aug 28, 2008, at 11:39 AM, Martin Stoufer wrote:

Actually no, since the default kill signal is TERM, apps will be  
allowed to prompt to save if necessary. This assumes the app is  
handling that signal properly. We could send KILL or ABRT and that  
would just end the processes w/o any save options.


Well, then there must be a lot of apps out there that don't handle  
it properly.  TextEdit, Pages, Word, Omnigraffle all failed to  
prompt me to save dirty documents when I used killall on them.


Granted, that's a small data sample, but I'd be right (and rightly)  
pissed at anyone that decided that all those other programs were  
written wrong, and decided to use killall anyway.


On a Mac system, this is simply NOT the right way to do this.
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/mikey-san 
%40bungie.org


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: [Moderator] Re: iphone SDK questions

2008-08-28 Thread Bob Sabiston


On Aug 27, 2008, at 8:30 PM, CocoaDev Admins wrote:

I've been given explicit instructions to enforce the non-disclosure  
agreement when moderating this list. So that's what I do.


The admins in the discussions groups should be following the same  
rules, and I've passed along the information.


um...thanks?




scott
[moderator]

On 27-Aug-08, at 7:30 PM, Bob Sabiston wrote:

What's the deal with the iphone SDK talk?  Ask a question here and  
you get shut down.  But talk is all over the discussion groups on  
Apple's own site.  For example,


http://discussions.apple.com/thread.jspa?threadID=1443702&tstart=180

So why is this list any different?


___

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

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

2008-08-28 Thread Eric Gorr


On Aug 28, 2008, at 4:04 PM, Bob Sabiston wrote:



On Aug 27, 2008, at 8:30 PM, CocoaDev Admins wrote:

I've been given explicit instructions to enforce the non-disclosure  
agreement when moderating this list. So that's what I do.


The admins in the discussions groups should be following the same  
rules, and I've passed along the information.


um...thanks?


Yes. Thanks!

As I understand it, there are patent issues involved here. If Apple  
didn't enforce the NDA, it would mean real trouble and the potential  
loss of billions of dollars. It seems insane, but it the way things  
are. Quite frankly, if the moderators in the discussion groups aren't  
enforcing the NDA, they should be replaced immediately.


Hopefully, Apple will be able to deal with these things soon and put  
an end to the unfortunately necessary NDA.


___

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

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


[Moderator] Re: iphone SDK questions

2008-08-28 Thread Scott Anguish
thanks for you comments and understanding, but please direct them off- 
list rather than to cocoa-dev.


scott
[moderator[
___

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

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

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

This email sent to [EMAIL PROTECTED]


What is the preferred aynchronous data load using a common protocol like HTTP?

2008-08-28 Thread Lee, Frederick
Greetings:

I need to continuously receive data (textual, xml format) from a
server asynchronously, in the background to the ignorance of the
end-user.

That is, to be able to retrieve a stream of xml data (loading/processing
variables) onto the front-end until the user chooses to exit.

 

I'm looking for the simplest & most-efficient method to pull this off.

 

Should I use NSURLConnection, using delegation; or  NSFileHandle/NSTask
- perhaps within NSOperation?

 

This is for the latest Leopard OS: OS 10.5+.

 

Regards,

Ric.

___

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

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

2008-08-28 Thread Robert Claeson


On 28 Aug 2008, at 22:15, Eric Gorr wrote:


On Aug 28, 2008, at 4:04 PM, Bob Sabiston wrote:



On Aug 27, 2008, at 8:30 PM, CocoaDev Admins wrote:

I've been given explicit instructions to enforce the non- 
disclosure agreement when moderating this list. So that's what I do.


The admins in the discussions groups should be following the same  
rules, and I've passed along the information.


um...thanks?


Yes. Thanks!

As I understand it, there are patent issues involved here. If Apple  
didn't enforce the NDA, it would mean real trouble and the potential  
loss of billions of dollars. It seems insane, but it the way things  
are. Quite frankly, if the moderators in the discussion groups  
aren't enforcing the NDA, they should be replaced immediately.


But an NDA can surely only be enforced for those who has signed it,  
which basically is those who has downloaded the SDK. So people who has  
not yet downloaded the SDK should be able to speak freely about the  
SDK (only that it wouldn't make much sense for them to do so).


Robert



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]

Undocumented Leopard support for overlapping sibling views

2008-08-28 Thread Nathan Vander Wilt
According to two list postings (http://lists.apple.com/archives/cocoa-dev/2007/Nov/msg01760.html 
, http://lists.apple.com/archives/cocoa-dev/2007/Nov/msg01764.html)  
both by Apple employees, overlapping sibling subviews are fully  
supported in Leopard (and presumably beyond).


However, the official documentation (http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaViewsGuide/WorkingWithAViewHierarchy/chapter_5_section_5.html 
) still says:
"Cocoa does not enforce clipping among sibling views or guarantee  
correct invalidation and drawing behavior when sibling views overlap.  
If you want a view to be drawn in front of another view, you should  
make the front view a subview (or descendant) of the rear view."


And Interface Builder 3.1 on the one hand has options like "Layout >  
Send to Front" that change the ordering of subviews, yet on the other  
still warns about "Illegal geometry" when a view overlaps one of its  
siblings even when the deployment target is set to 10.5.



I can't find anything in the documentation (or even release notes)  
that describes that/how overlapping views are supported. Why isn't  
this documented? Can we rely on overlapping sibling views working now  
and in the future? Are there any caveats we should be aware of?


thanks,
-natevw

___

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

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


programatically quit a program

2008-08-28 Thread Wayne Shao
Hi

What is the correct way to quit a cocoa app?  I could use C exit() but that
would loose the chance to invoke the right callbacks for clean up.
What is the call that would be equivalent to user explicitly selecting the
Quit from the menu.

I only found this

[[NSApplication sharedApplication] teminate:??];

But the  terminate function takes an id for sender. What shall I use?


Thanks,
-- 
Wayne Shao
___

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

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

2008-08-28 Thread Andrew Farmer

On 28 Aug 08, at 12:08, Ricky Sharp wrote:
Just to point this out, the sequence of ASCII may not be useful at  
all if the file is say Unicode. The actual bytes making up each char  
could be "ASCII" values themselves.


Unicode is a character set, not an encoding. I'm not sure about UTF-16  
or other stranger encodings, but I do know that any UTF-8 character  
below 0x80 corresponds directly to a single ASCII character. This is a  
design feature of the encoding.

___

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

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

2008-08-28 Thread Robert Claeson


On 28 Aug 2008, at 22:38, Wayne Shao wrote:

What is the correct way to quit a cocoa app?  I could use C exit()  
but that

would loose the chance to invoke the right callbacks for clean up.
What is the call that would be equivalent to user explicitly  
selecting the

Quit from the menu.

I only found this

[[NSApplication sharedApplication] teminate:??];

But the  terminate function takes an id for sender. What shall I use?


[[NSApplication sharedApplication] terminate:self]; works great. This  
is what I tend to use in smallish applications that don't need to do  
much else than simply terminate when asked to do so, and also  
terminate when the user closes the last window:


- (IBAction)terminate:(id)sender {
[[NSApplication sharedApplication] terminate:self];
}

- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication  
*)theApplication {

return YES;
}

- (id)init {
self = [super init];
if (self != nil) {
[[NSApplication sharedApplication] setDelegate:self];
}
return self;
}




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: Undocumented Leopard support for overlapping sibling views

2008-08-28 Thread j o a r


On Aug 28, 2008, at 1:28 PM, Nathan Vander Wilt wrote:

According to two list postings (http://lists.apple.com/archives/cocoa-dev/2007/Nov/msg01760.html,http://lists.apple.com/archives/cocoa-dev/2007/Nov/msg01764.html 
) both by Apple employees, overlapping sibling subviews are fully  
supported in Leopard (and presumably beyond).


However, the official documentation (http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaViewsGuide/WorkingWithAViewHierarchy/chapter_5_section_5.html 
) still says:
"Cocoa does not enforce clipping among sibling views or guarantee  
correct invalidation and drawing behavior when sibling views  
overlap. If you want a view to be drawn in front of another view,  
you should make the front view a subview (or descendant) of the rear  
view."


And Interface Builder 3.1 on the one hand has options like "Layout >  
Send to Front" that change the ordering of subviews, yet on the  
other still warns about "Illegal geometry" when a view overlaps one  
of its siblings even when the deployment target is set to 10.5.



I can't find anything in the documentation (or even release notes)  
that describes that/how overlapping views are supported. Why isn't  
this documented? Can we rely on overlapping sibling views working  
now and in the future? Are there any caveats we should be aware of?



Hello,

Please file a couple of bug reports on this:



Thanks!

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: Undocumented Leopard support for overlapping sibling views

2008-08-28 Thread Ricky Sharp


On Aug 28, 2008, at 3:28 PM, Nathan Vander Wilt wrote:

According to two list postings (http://lists.apple.com/archives/cocoa-dev/2007/Nov/msg01760.html 
, http://lists.apple.com/archives/cocoa-dev/2007/Nov/msg01764.html)  
both by Apple employees, overlapping sibling subviews are fully  
supported in Leopard (and presumably beyond).


However, the official documentation (http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaViewsGuide/WorkingWithAViewHierarchy/chapter_5_section_5.html 
) still says:
"Cocoa does not enforce clipping among sibling views or guarantee  
correct invalidation and drawing behavior when sibling views  
overlap. If you want a view to be drawn in front of another view,  
you should make the front view a subview (or descendant) of the rear  
view."


And Interface Builder 3.1 on the one hand has options like "Layout >  
Send to Front" that change the ordering of subviews, yet on the  
other still warns about "Illegal geometry" when a view overlaps one  
of its siblings even when the deployment target is set to 10.5.



I can't find anything in the documentation (or even release notes)  
that describes that/how overlapping views are supported. Why isn't  
this documented? Can we rely on overlapping sibling views working  
now and in the future? Are there any caveats we should be aware of?


I believe that Apple relaxed the rules to allow CoreAnimation layers  
to work correctly.  Whether or non a non-layered UI fully supports  
overlapping sibling views, I do not know.


I just tried a test in IB.  Warnings show up on overlapping views  
whether or not views are marked as needing a CA layer.  I believe that  
is a bug.



For the apps I'm writing, I do not yet use layers.  For all views, I  
never overlap them (using the subview approach instead).


Once I introduce layers, I will allow those particular views to  
overlap.  The rest of the UI will continue to not overlap.


One final thing to consider is that you may also suffer some  
performance hits when things overlap; especially for custom views  
where you do all the drawing.  If your drawRect, e.g., always draws  
everything regardless of what is actually dirty, you would then redraw  
that whole thing if an overlapped view is marked dirty.  Even if they  
only overlap by a single pixel/point.


___
Ricky A. Sharp mailto:[EMAIL PROTECTED]
Instant Interactive(tm)   http://www.instantinteractive.com



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: programatically quit a program

2008-08-28 Thread Andrew Farmer

On 28 Aug 08, at 13:38, Wayne Shao wrote:
What is the correct way to quit a cocoa app?  I could use C exit()  
but that

would loose the chance to invoke the right callbacks for clean up.
What is the call that would be equivalent to user explicitly  
selecting the

Quit from the menu.

I only found this

[[NSApplication sharedApplication] teminate:??];

But the  terminate function takes an id for sender. What shall I use?


"self" or "nil" are both perfectly acceptable.
___

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

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

2008-08-28 Thread Ken Thomases

On Aug 28, 2008, at 3:38 PM, Wayne Shao wrote:

What is the correct way to quit a cocoa app?  I could use C exit()  
but that

would loose the chance to invoke the right callbacks for clean up.
What is the call that would be equivalent to user explicitly  
selecting the

Quit from the menu.

I only found this

[[NSApplication sharedApplication] teminate:??];


You left the 'r' out of "terminate".  :)


But the  terminate function takes an id for sender. What shall I use?


In this case, you're the sender so you can pass "self".  Or, if  
you're within an action method (IBAction) you can forward the sender  
that was passed to you.


In truth, I don't believe the -[NSApplication terminate:] method  
makes any use of its sender parameter.  It's only declared that way  
to match the signature of an action method.


Cheers,
Ken
___

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

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

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

This email sent to [EMAIL PROTECTED]


  1   2   >