Re: NSURL fileURLWithPath doesn't produce a valid URL

2009-07-31 Thread Alexander Bokovikov


On 31.07.2009, at 11:51, Dave Keck wrote:


Check out CFURLCreateStringByAddingPercentEscapes(), and note that
CFURL is toll-free bridged with NSURL.


Just have tried it. No difference. I've used:

surl = CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,

   spath,

   NULL,

   NULL,

   kCFStringEncodingUTF8);
where spath was the source string with "+" signs. I've set NULL's, as  
it was described (at least as I've understood what was written) to  
escape any possible characters. Is "+" sign not considered by Apple,  
as a character, which requires escaping?


In my opinion, all codes since 0x20 to 0x2F require escaping. Am I  
incorrect?


Thanks.

___

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

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

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

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


How to set the name of open-with application for a specific file?

2009-07-31 Thread 慧 松本
I can retrieve the name of the app used to open a file at the given  
path by NSWorkspace getInfoForFile method below.


- (BOOL)getInfoForFile:(NSString *)fullPath application:(NSString  
**)appName type:(NSString **)type;


I want to change the name of the app used to open the file.
Does anybody know how to change the name of open-with application for  
a specific file?


Satoshi

___

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

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

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

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


Re: App Delegate in Document App

2009-07-31 Thread Michael Hoy

David,

You should be adding the AppDelegate object to the MainMenu.xib, which  
is loaded first and once, what you want. Otherwise a new delegate  
object is created and set with each document loaded.


~Michael

On Jul 28, 2009, at 1:46 PM, David Blanton wrote:

In MyDocument.xib I added an object and set its class to  
AppDelegate, a subclass of NSObject, in my project.  I connected the  
Application delegate outlet to this object.


I implemented

- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender  
{ return NO; }


in AppDelegate but it is never called.



Is this the correct manner to set the application delegate?

db


___

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

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

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

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


Re: NSURL fileURLWithPath doesn't produce a valid URL

2009-07-31 Thread Kyle Sluder
On Jul 31, 2009, at 12:34 AM, Alexander Bokovikov  
 wrote:



where spath was the source string with "+" signs.


You need to be providing a valid URL here. That's a string containing  
a URL, not a CFURLRef.


In my opinion, all codes since 0x20 to 0x2F require escaping. Am I  
incorrect?


There is no opinion involved here. According to RFC 2396, + needs  
escaping only within the querystring.


--Kyle Sluder



___

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

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

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

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


Re: How to set the name of open-with application for a specific file?

2009-07-31 Thread Kyle Sluder

On Jul 31, 2009, at 12:40 AM, 慧 松本  wrote:



I want to change the name of the app used to open the file.


You want to actually change the name of the application itself? Sorry,  
that's not yours to touch. The user might not even have the rights to  
make this modification (non-admin user, for example).


Or do you want to choose a different application to associate with the  
file?


--Kyle Sluder___

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

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

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

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


Re: NSURL fileURLWithPath doesn't produce a valid URL

2009-07-31 Thread Richard Frith-Macdonald


On 31 Jul 2009, at 08:34, Alexander Bokovikov wrote:



On 31.07.2009, at 11:51, Dave Keck wrote:


Check out CFURLCreateStringByAddingPercentEscapes(), and note that
CFURL is toll-free bridged with NSURL.


Just have tried it. No difference. I've used:

surl = CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,

   spath,

   NULL,

   NULL,

   kCFStringEncodingUTF8);
where spath was the source string with "+" signs. I've set NULL's,  
as it was described (at least as I've understood what was written)  
to escape any possible characters. Is "+" sign not considered by  
Apple, as a character, which requires escaping?


In my opinion, all codes since 0x20 to 0x2F require escaping. Am I  
incorrect?


The '+' sign doesn't require escaping to create a valid URL

eg. 'file:///tmp/x+y' is a perfectly valid URL.

Why do you think that's not a valid URL?  If you look at RFC1738 you  
will see it explicitly says that a '+' is allowed.


I suspect what you are actually looking for is a mechanism to encode a  
string for use as a field name or field value in a form encoded as the  
query string of a URL.  If thats the case, you need to encode the '+'  
'=' and '&' characters yourself.

___

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

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

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

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


Re: How to set the name of open-with application for a specific file?

2009-07-31 Thread MATSUMOTO Satoshi

Kyle Sluder, thank you for your response.

I want to choose a different application to associate with the file.

Satoshi

On 2009/07/31, at 16:53, Kyle Sluder wrote:

On Jul 31, 2009, at 12:40 AM, 慧 松本   
wrote:




I want to change the name of the app used to open the file.


You want to actually change the name of the application itself?  
Sorry, that's not yours to touch. The user might not even have the  
rights to make this modification (non-admin user, for example).


Or do you want to choose a different application to associate with  
the file?


--Kyle Sluder


-
Satoshi Matsumoto 
816-5 Odake, Odawara, Kanagawa, Japan 256-0802



___

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

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

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

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


Re: Diagramming (a bit OT)

2009-07-31 Thread WT

Hi Loukas,

there was an almost identical thread here a couple of months ago, with  
several responses. You might want to search the list archives and see  
if there are suggestions there that you might like.


Wagner

On Jul 31, 2009, at 5:19 AM, Loukas Kalenderidis wrote:


Hey guys,

Sorry, this is a bit off topic for this list, but I'm mostly  
interested in responses from Cocoa people so please bear with me.


What do you use for technical diagramming for everything in the  
software development realm? I use OmniGraffle, but most of my work  
is pretty informal because I (regrettably now) avoided most of the  
boring-looking UML/etc courses at uni. Does anybody have some good  
resources for learning how this stuff is supposed to be done formally?


Does anybody know what tool/templates/etc Apple might use for the  
diagrams in their technical documentation?


e.g. 
http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Art/token_generation.jpg

Thanks,
Loukas

___

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

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

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

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


Re: NSURL fileURLWithPath doesn't produce a valid URL

2009-07-31 Thread Alexander Bokovikov


On 31.07.2009, at 14:02, Richard Frith-Macdonald wrote:


Why do you think that's not a valid URL?


It's because another code (Flash plugin) doesn't want to work if I  
provide a path (as a part of URL), containing "+"  characters. At  
least I don't see other reasons, why the same function work for path  
with my home directory, and doesn't work with path, provided by  
_CS_DARWIN_USER_DIR.


 If you look at RFC1738 you will see it explicitly says that a '+'  
is allowed.


Say it to Macromedia... or to Adobe?... Though I work with Flash  
directly (not by WebKit), so maybe the error is within my code, I  
leave such chance. Nevertheless, even in that case the error is just  
in the need of URL encoding, as I believe.


I suspect what you are actually looking for is a mechanism to encode  
a string for use as a field name or field value in a form encoded as  
the query string of a URL.  If thats the case, you need to encode  
the '+' '=' and '&' characters yourself.


I was just about that. I've created a simple function, encoding  
necessary characters - blanks, pluses, etc., but I just would like to  
know if there is a standard way to do it by API usage. But you say -  
"do it yourself". Therefore I believe, the question is closed. Isn't it?


Thanks.

___

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

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

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

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


Re: NSURL fileURLWithPath doesn't produce a valid URL

2009-07-31 Thread Dave Keck
I'm confused:

NSLog(@"%@", CFURLCreateStringByAddingPercentEscapes(nil,
CFSTR("http://www.example.com?a+b & c = d"), nil, CFSTR("+=&"),
kCFStringEncodingUTF8));

That doesn't do what you want?
___

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

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

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

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


Re: Diagramming (a bit OT)

2009-07-31 Thread Loukas Kalenderidis

Thanks guys.

On 31/07/2009, at 6:07 PM, WT wrote:


Hi Loukas,

there was an almost identical thread here a couple of months ago,  
with several responses. You might want to search the list archives  
and see if there are suggestions there that you might like.


Wagner

On Jul 31, 2009, at 5:19 AM, Loukas Kalenderidis wrote:


Hey guys,

Sorry, this is a bit off topic for this list, but I'm mostly  
interested in responses from Cocoa people so please bear with me.


What do you use for technical diagramming for everything in the  
software development realm? I use OmniGraffle, but most of my work  
is pretty informal because I (regrettably now) avoided most of the  
boring-looking UML/etc courses at uni. Does anybody have some good  
resources for learning how this stuff is supposed to be done  
formally?


Does anybody know what tool/templates/etc Apple might use for the  
diagrams in their technical documentation?


e.g. 
http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Art/token_generation.jpg

Thanks,
Loukas


___

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

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

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

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


Re: NSURL fileURLWithPath doesn't produce a valid URL

2009-07-31 Thread Alexander Bokovikov


On 31.07.2009, at 14:57, Dave Keck wrote:


I'm confused:

NSLog(@"%@", CFURLCreateStringByAddingPercentEscapes(nil,
CFSTR("http://www.example.com?a+b & c = d"), nil, CFSTR("+=&"),
kCFStringEncodingUTF8));

That doesn't do what you want?


I've misunderstood. It was said "do it yourself" in the previous  
answer, but not "use CFURLCreateStringByAddingPercentEscapes with the  
necessary characters, included into the fourth argument", so I thought  
this function doesn't do what I need. Of course, I was not too careful  
when I read its description, where it was said, that fourth argument  
is just for my case.


Thanks.

___

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

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

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

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


Re: NSString and regular expressions

2009-07-31 Thread Alastair Houghton

On 31 Jul 2009, at 01:04, BareFeet wrote:

The documentation notes: "Warning: Apple does not officially support  
linking to the libicucore.dylib library." In reality, how worried  
should I be about this?


I wouldn't lose much sleep over it, to be honest, as long as you stick  
to ICU's C API (as opposed to the C++ part).


As far as I understood, the original reason for not providing the  
headers was that the C++ ABI was not stable and so a program linked  
against ICU on one version of Mac OS X might not work on a subsequent  
version (assuming it went and used the C++ API).  I don't know why the  
headers still aren't shipped with OS X...



I guess I can deal with that.

Has anyone discovered any other issues (or had successes) dealing  
with ICU syntax in RegexKitLite and RegexKitLite in general?


ICU's regexp engine is pretty complete, though it doesn't have:

1. Named capture groups; e.g. in Python you can do

  (?P[a-zA-Z0-9]*)

and you can then retrieve the capture by name rather than by index.   
This is a very useful feature as it lets you alter your regexp without  
having to renumber everything.


You can also do backrefs to named capture groups (in Python) using e.g.

  (?P=myGroup)

Again, this makes it easier to change your regexp without breaking  
everything.


2. Conditional expressions, e.g.

  (?(myGroup)then-part|else-part)

The above would match the text "then-part" *if* a group named  
"myGroup" had already matched, otherwise it would match "else-part".   
You can also use a number rather than a name to identify the match  
group, and lookahead/lookbehind expressions are supported in there also.


I wrote and submitted a patch some time ago to add these features to  
ICU.  I don't know why but it doesn't seem to have made it back to the  
main source tree.  If anyone is interested in these extras, they're  
here (though that patch was generated against ICU 3.6):


  http://alastairs-place.net/2006/09/icu-regular-exp/

There are open tickets in the ICU bug tracker (#2907 and #5312) that  
refer to these.


Kind regards,

Alastair.

--
http://alastairs-place.net



___

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

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

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

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


Re: NSString and regular expressions

2009-07-31 Thread Alastair Houghton

On 31 Jul 2009, at 01:18, Charles Srstka wrote:

ICU is an open-source project, so if you're concerned about the  
Apple-supplied one disappearing, you can just go download the latest  
sources, compile it yourself, and then either link it statically or  
include the dylib inside your bundle.


http://site.icu-project.org/


This is all true, but it is worth pointing out that ICU includes a  
data file that contains (amongst other things) time zone data, Unicode  
data, localisation information and other stuff.


The issue there is that *occasionally* the data file needs updating.   
For instance when some politician decides that now would be a good  
time to change the time zone rules for the United States (as happened  
recently).  Or when the Unicode specification is revised or bugs are  
found in the CLDR data.  If you have multiple copies of ICU, each one  
will need updating separately... and because the ICU data file is  
version specific to some extent, you can't necessarily share the data.


You can avoid this, for the most part, by using Core Foundation or  
Cocoa where possible, since that will use the system's copy of the  
data which will at least result in consistent behaviour.  But if you  
use ICU directly, or rely on something that does, and you choose to  
bundle ICU with your application, you should be aware of this issue.


Kind regards,

Alastair.

--
http://alastairs-place.net



___

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

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

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

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


ASL issue

2009-07-31 Thread Santosh Sinha

Hello List,


i am using Mac OS 10.5.7 and i am writing the error data in the asl  
log file, but after three day my data is automatically flushed from my  
system its possible.




Thanks
santosh



___

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

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

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

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


[OT] Re: ASL issue

2009-07-31 Thread Alastair Houghton

On 31 Jul 2009, at 13:01, Santosh Sinha wrote:

i am using Mac OS 10.5.7 and i am writing the error data in the asl  
log file, but after three day my data is automatically flushed from  
my system its possible.


This isn't Cocoa related, hence is off-topic and should be asked  
somewhere else.


There are other lists where you could ask this question; Apple hosts  
these lists:


  

and Omni Group hosts these ones:

  

(Omni's macosx-dev is a good place to ask general questions if you're  
unsure where to go with something.)


Kind regards,

Alastair.

--
http://alastairs-place.net



___

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

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

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

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


Problem in copying files to the system clipboard

2009-07-31 Thread Deepa

Hi,

I am developing an desktop application in which I want to copy the  
multiple image files to the system clipboard. When I try to paste it  
in the Finder, the image files should be pasted.
This is the behavior similar to Finder Copy-Paste. (I want to copy the  
file paths which when pasted, actual file is pasted; Not file paths in  
text/string format).


I tried using NSFilenamesPboardType, NSFIleContentsPboardType. But  
system clipboard doesn't accept it.


The code using NSFilenamesPboardType:

NSPasteboard *pasteboard =[NSPasteboard pasteboardWithName:  
NSGeneralPboard];
[pasteboard  declareTypes:[NSArray  
arrayWithObjects:NSFilenamesPboardType,nil] owner:nil];
[pasteboard setPropertyList: filePaths forType:  
NSFilenamesPboardType];		// filePaths is array of files paths of images


When I tried to access propertyList from the pasteboard within the  
application, I could get the array of file paths. But, it doesn't add  
anything to the system clipboard. So, I am not able to copy the files  
to the other applications.

(I don't want to use Drag and Drop to support inter-app copy-paste).

Could anyone help me out to solve this problem.

Thanks in advance.

Thanks and Regards,
Deepa
de...@robosoftin.com


---
Robosoft Technologies - Come home to Technology

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

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

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

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

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


Re: How to set the name of open-with application for a specific file?

2009-07-31 Thread Jerry Krinock


On 2009 Jul 31, at 01:02, MATSUMOTO Satoshi wrote:


I want to choose a different application to associate with the file.


Off-topic but, oh well, you wouldn't have known

Activate Finder.  Select a subject document file.  In main menu click  
File > Get Info.  In the Info Window which appears, click "Open  
with..." and if desired click the "Change All" button.


The system's Launch Services database is sometimes kind of stubborn,  
though.  If you've changed any of the UTI information in the app's  
Info.plist, you may have to rebuild and relaunch the subject  
application a couple times before the new setting starts working.  If  
all else fails, delete the old application and restart.  As a last  
resort, rebuild the Launch Services database, but you're going to lose  
all your personal settings for other apps.  In Leopard, use this  
Terminal command:


System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/ 
LaunchServices.framework/Versions/A/Support/lsregister -kill -r - 
domain local -domain system -domain user

___

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

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

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

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


Re: How to set the name of open-with application for a specific file?

2009-07-31 Thread MATSUMOTO Satoshi

Dear Jerry Krinock,

On 2009/07/31, at 21:43, Jerry Krinock wrote:
Activate Finder.  Select a subject document file.  In main menu  
click File > Get Info.  In the Info Window which appears, click  
"Open with..." and if desired click the "Change All" button.


Thank you for your kind advice. :-)
I want to do this programmatically.

Satoshi
-
Satoshi Matsumoto 
816-5 Odake, Odawara, Kanagawa, Japan 256-0802



___

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

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

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

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


Re: NSString and regular expressions

2009-07-31 Thread Jean-Daniel Dupas


Le 31 juil. 09 à 11:30, Alastair Houghton a écrit :


On 31 Jul 2009, at 01:04, BareFeet wrote:

The documentation notes: "Warning: Apple does not officially  
support linking to the libicucore.dylib library." In reality, how  
worried should I be about this?


I wouldn't lose much sleep over it, to be honest, as long as you  
stick to ICU's C API (as opposed to the C++ part).


As far as I understood, the original reason for not providing the  
headers was that the C++ ABI was not stable and so a program linked  
against ICU on one version of Mac OS X might not work on a  
subsequent version (assuming it went and used the C++ API).


This is also true for the C API. From the ICU user guide:
ICU Binary Compatibility: Using ICU as an Operating System Level Library

ICU4C may be configured for use as a system library in an environment  
where applications that are built with one version of ICU must  
continue to run without change with later versions of the ICU shared  
library.


Here are the requirements for enabling binary compatibility for ICU4C:

Applications must use only APIs that are marked as stable.

Applications must use only plain C APIs, never C++.

ICU must be built with function renaming disabled.

Applications must be built using an ICU that was configured for binary  
compatibility.


Use ICU version 3.0 or later.




___

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

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

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

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


Re: NSString and regular expressions

2009-07-31 Thread Alastair Houghton

On 31 Jul 2009, at 15:30, Jean-Daniel Dupas wrote:


Le 31 juil. 09 à 11:30, Alastair Houghton a écrit :

As far as I understood, the original reason for not providing the  
headers was that the C++ ABI was not stable and so a program linked  
against ICU on one version of Mac OS X might not work on a  
subsequent version (assuming it went and used the C++ API).


This is also true for the C API.


Well not quite.  The C *API* might be non-binary-compatible if you  
built ICU the wrong way, and some sections of it are certainly marked  
as stable/unstable.  But I was specifically talking about the Mac OS X  
C++ *ABI*, which IIRC was still in flux when this question first  
appeared.


Anyway, we're in danger of drifting off topic here.

Kind regards,

Alastair.

--
http://alastairs-place.net



___

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

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

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

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


Re: NSString and regular expressions

2009-07-31 Thread John Engelhart
On Thu, Jul 30, 2009 at 8:04 PM, BareFeet wrote:

> Hi John and all,
>
>  You might want to look at AGRegex which is very compact (one class) and
>>> which uses PCRE:
>>>
>>> http://colloquy.info/project/browser/trunk/Frameworks/AGRegex
>>>
>>>
>> Of note, Colloquy appears to have switched to RegexKitLite itself:
>>
>> http://svn.colloquy.info/project/changeset/4301
>
>
Just to be clear, I'm the author of RegexKitLite (and RegexKit.framework).
 I just like to be up front about that so you can apply whatever amount of
bias filtering you want to any claims or statements I make.


> 
>
> I did notice that log entry, but thought it was never acted upon (ie they
> are still using AGRegex).


I can't say I did any kind of exhaustive check, but I was under the
impression that they had definitely switched over.  I even got a bug report
from them.


>
> RegexKitLite looks promising. It claims to only require you to add the .h
> and .m file to your project and link to the libicucore.dylib library.
>
> The documentation notes: "Warning: Apple does not officially support
> linking to the libicucore.dylib library." In reality, how worried should I
> be about this? I am amazed that Cocoa doesn't provide regex itself. Surely
> Apple must provide or recommend something to do the job.


wrt/ to linking to libicucore.dylib, that's kind of a grey area.  I try to
be as up front as possible about that fact in the documentation.  What
follows is my opinion and carries no official weight.  So far as I know it's
an accurate representation of the facts, and I've tried to keep it
objective:

The shared library that causes the controversy is /usr/lib/libicucore.dylib.
 I've searched the documentation and I could find nothing that explicitly
forbids linking against it, or anything else in /usr/lib.  If one subscribes
to the common unix traditions, the /usr/lib directory is generally
considered "fair game" for linking against- it is one of the common
locations for a systems publicly available shared libraries.  By placing a
library in /usr/lib, one implicitly declares it "publicly available".

The next stumbling block is the need for headers.  A default install of Mac
OS X does not include the ICU headers one would normally need to make use of
the ICU library.  However, the ICU project is an open source project, so one
can (easily?) assemble a suitable set of headers if one is so inclined.  Not
only that, but Apple provides a tar ball of their branch of ICU that is used
to build the binaries that are present on every Mac OS X system.
 Furthermore, that tar balls make file includes a target to install the ICU
headers on your system.  Although a bit convoluted to actually get, Apple
does publicly provide the headers for the ICU library.  See
http://www.opensource.apple.com/tarballs/ICU/ for the tar balls.

After that, the next criteria is whether or not the API is documented.  It's
safe to say that the ICU API is documented, although not by Apple.  Apple
actually refers to the ICU documentation in certain parts of its official
documentation (NSPredicate wrt/ regular expressions and the MATCHES
operator).

So, it comes down to a matter of opinion and a judgement call.  Considering
how easy it is to create a location in the file system that makes it clear
that the shared libraries within are private, I'm of the opinion that the
/usr/lib/libicucore.dylib file is definitely in the public category.  Even
private frameworks have their own slice in
/System/Library/PrivateFrameworks, which makes it pretty clear that the
contents within are off-limits.  Even within public frameworks their is the
PrivateHeaders folder for non-public API information.

Up next is whether or not the lack of headers makes the library "private".
 If this was a proprietary library, I'd probably lean towards "makes it
private".  However, it's a publicly available open-source project, so it
becomes a little more grey.  The fact that Apple publicly provides
everything needed to build an exact copy of the version of ICU that's
shipped with system, and the ability to install the headers makes it really
grey.  Personally, I'm inclined to say that it's in the "not private"
category.  I think it's fair to say that the "undocumented API" clause
doesn't apply.

Finally, I'm not aware of any official decrees that explicitly make
/usr/lib/libicucore.dylib a "private API".  What advice that has come from
Apple has been extremely ambiguous, usually with a caveat along the lines of
"this may not be officially supported".

>From a purely pragmatic perspective, it makes a lot of sense for Apple to
provide the headers and make it an "Official, Public API".  First and
foremost is consistency for applications- it removes the need for every
developer to duplicate the work that's already been done, and fill their
.app/ distribution with yet another copy of a (rather large) shared library.
 Another big plus is that from a security point of vie

Re: NSMutableDictionary Poitners

2009-07-31 Thread DerNalia

thanks guys, this helps ^_^

On Jul 31, 2009, at 12:07 AM, Clark Cox wrote:

On Thu, Jul 30, 2009 at 10:06 PM, Clark Cox  
wrote:
On Thu, Jul 30, 2009 at 10:18 AM,  
DerNalia wrote:

If I do something like:
varName = [dictionaryName objectForKey:@"keyName"];

does that return a copy of what is in the dictionary?


No.


or a pointer?



That should have been:


All objects are passed as pointers

This method follows the normal Cocoa memory management rules. The  
object did

not come from an alloc..., copy... or new... method, and you didn't
retain it yourself, so you do not own a reference to it. If you want
it to stick around longer than the dictionary itself, it's up to you
to either make a copy


--
Clark S. Cox III
clarkc...@gmail.com





--
Clark S. Cox III
clarkc...@gmail.com


___

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

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

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

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


Exception-like behavior in save panel used for file choose

2009-07-31 Thread Barry Press
I've written a small app that, from a preferences panel, uses a  
"Choose" button to open a save panel that's used to select the name of  
the file to which the app will log periodic data. That is, the  
preferences panel launches via this code:



//   
showPreferencesPanel

- (IBAction)showPreferencesPanel: (id)sender
{
SettingsDialog *settingsMgr;

settingsMgr = [[SettingsDialog alloc] init];
[settingsMgr showSettingsPanel:self];
}


and from within the code for the settingsMgr, a button push invokes  
this code to get the file name:



//  
pushChooseButton 

- (IBAction)pushChooseButton:(id)sender
{
// get pathname
// break into components
// if pathname is a file
// drop last one, make path from it

NSSavePanel *save = [NSSavePanel savePanel];
	[save setAllowedFileTypes:[[NSArray alloc] initWithObjects:@"log",  
@"txt", nil]];

[save setAllowsOtherFileTypes:YES];
[save setRequiredFileType:@"log"];
	[save setMessage:@"Pick the file to which log messages will be  
appended.\nFiles with the .log file type will open in console by  
default."];

[save setNameFieldLabel:@"Log To:"];
[save setPrompt:@"Choose"];
[save setDelegate:self];
[save setTitle:@"Log"];

	NSString *sFile = [textLogPath stringValue];; // 
stringByStandardizingPath;

NSString *sFileWithoutLast = [sFile stringByDeletingLastPathComponent];
	NSString *sFileOnly = [sFile substringFromIndex:[sFileWithoutLast  
length]+1];
	//NSLog(@"\nsFile: %...@\nwithout last:%...@\nlast: %@", sFile,  
sFileWithoutLast, sFileOnly );


	int result = [save runModalForDirectory:sFileWithoutLast  
file:sFileOnly];

if (result == NSOKButton){
NSString *selectedFile = [[save filename] 
stringByStandardizingPath];
[textLogPath setStringValue:selectedFile];
}
}

This latter code works properly so long as the file that will be the  
target of the append -- the target of the save panel -- does not  
exist. In that event, the runModal comes back and I can extract the  
name. If the file *does* exist, however, then a panel comes up that  
asks if it's ok to replace the file, and if I agree to replace, not  
only the choose panel closes, so does my settings panel - I'm dumped  
all the way back to the app that invoked showPreferencePane.


I looked at the methods being fired, and nothing much interesting  
comes up. I see


panel:directoryDidChange:
panel:userEnteredFilename:confirmed:
panel:isValidFilename:

and by then the windows are all closed. Any ideas on why the panel  
closes around me?


(Side note: anyone who wants to critique my code for splitting a file  
name off a path, please let her rip!)


Thanks

Barry Press

















___

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

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

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

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


Converting colors to CGFloat

2009-07-31 Thread Matthias Schmidt

Hello,

how do I convert color values from longint or UInt16 as they were used  
with the carbon API to CGFloat used with NSColor?


thanks
Matthias
___

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

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

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

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


Re: How to tell other controller that orientationDidChange

2009-07-31 Thread Fritz Anderson

On 30 Jul 2009, at 4:08 PM, Agha Khan wrote:

I do see orientationDidChange in my AppDelegate but how can we  
receive same notification to other controllers.


You should say what OS, and what version, you are talking about.

I typed "orientation" into a search field and immediately found - 
[UIViewController didRotateFromInterfaceOrientation:].


I'll be more tactful about this than I feel like being: Please  
consider whether it's appropriate to ask a mailing list of many  
thousands a question you could have answered with a few seconds' effort.


— F

___

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

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

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

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


Re: Exception-like behavior in save panel used for file choose

2009-07-31 Thread Steve Christensen
You could very well be taking an exception. Given this possibility,  
why haven't you tried wrapping your code in -pushChooseButton: in a  
@try/@catch block and either just dumping out the exception (if any)  
and/or putting a breakpoint in the @catch to see what the state of  
the world is? If you set a breakpoint on -[NSException raise], you  
can break when the exception actually happens.



On Jul 30, 2009, at 11:04 PM, Barry Press wrote:

I've written a small app that, from a preferences panel, uses a  
"Choose" button to open a save panel that's used to select the name  
of the file to which the app will log periodic data. That is, the  
preferences panel launches via this code:


[...snip...]

This latter code works properly so long as the file that will be  
the target of the append -- the target of the save panel -- does  
not exist. In that event, the runModal comes back and I can extract  
the name. If the file *does* exist, however, then a panel comes up  
that asks if it's ok to replace the file, and if I agree to  
replace, not only the choose panel closes, so does my settings  
panel - I'm dumped all the way back to the app that invoked  
showPreferencePane.


I looked at the methods being fired, and nothing much interesting  
comes up. I see


panel:directoryDidChange:
panel:userEnteredFilename:confirmed:
panel:isValidFilename:

and by then the windows are all closed. Any ideas on why the panel  
closes around me?

___

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

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

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

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


Re: Converting colors to CGFloat

2009-07-31 Thread Steve Christensen

On Jul 31, 2009, at 2:31 AM, Matthias Schmidt wrote:

how do I convert color values from longint or UInt16 as they were  
used with the carbon API to CGFloat used with NSColor?


I assume you're talking about something like QuickDraw's RGBColor,  
where color components range from 0 to 65535? You could do something  
like this:


NSColor* NSColorFromQuickDrawRGBColor(const RGBColor* color)
{
return [NSColor colorWithCalibratedRed:((CGFloat)color->red /  
65535.0)
 green:((CGFloat)color->green /  
65535.0)
  blue:((CGFloat)color->blue /  
65535.0)

 alpha:1.0];
}

___

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

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

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

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


Re: Converting colors to CGFloat

2009-07-31 Thread Jesper Storm Bache
Given that QD is not color managed, I would expect that you should use  
[NSColor colorWithDeviceRed..] rather than the calibrated variation.
(I must admit that I find the documentation regarding calibrated and  
device rather thin in various NSColor references).


Jesper

On Jul 31, 2009, at 8:44 AM, Steve Christensen wrote:


On Jul 31, 2009, at 2:31 AM, Matthias Schmidt wrote:


how do I convert color values from longint or UInt16 as they were
used with the carbon API to CGFloat used with NSColor?


I assume you're talking about something like QuickDraw's RGBColor,
where color components range from 0 to 65535? You could do something
like this:

NSColor* NSColorFromQuickDrawRGBColor(const RGBColor* color)
{
return [NSColor colorWithCalibratedRed:((CGFloat)color->red /
65535.0)
 green:((CGFloat)color->green /
65535.0)
  blue:((CGFloat)color->blue /
65535.0)
 alpha:1.0];
}

___

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

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

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

This email sent to jsba...@adobe.com


___

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

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

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

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


Re: Exception-like behavior in save panel used for file choose

2009-07-31 Thread Kyle Sluder

On Jul 31, 2009, at 8:38 AM, Steve Christensen  wrote:
If you set a breakpoint on -[NSException raise], you can break when  
the exception actually happens.


On Leopard you want to break on obj_exceptionThrow instead.

--Kyle Sluder



___

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

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

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

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


Re: Exception-like behavior in save panel used for file choose

2009-07-31 Thread Greg Titus


On Jul 31, 2009, at 9:23 AM, Kyle Sluder wrote:

On Jul 31, 2009, at 8:38 AM, Steve Christensen   
wrote:
If you set a breakpoint on -[NSException raise], you can break when  
the exception actually happens.


On Leopard you want to break on obj_exceptionThrow instead.


Typo there... it's objc_exception_throw().


___

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

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

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

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


Application Preferences - a general question

2009-07-31 Thread Alexander Bokovikov

Hi, All,

Hope this is not an offtopic here...

I'm quite new in Mac world, and one of essential differences from  
Windows, which I've noticed, is how Preferences changes are applied.  
Unlike to usual Windows GUI, preferences are applied instantly on Mac,  
i.e. just as user changes a value. There is no "Cancel" button  
resetting values to the state, which they had at the moment, when  
Preferences panel was opened. Though there is "Restore Defaults"  
button, but it does just what it says - it restores so called "factory  
defaults", which are not the same, as previously saved values.


I'm reading "Cocoa Programming" by Aaron Hillegass, now, and he  
describes just the same Preferences functionality, as above.


Am I missing something? Or is this the general user interface building  
strategy for Cocoa applications or for Mac OS? Is it assumed that user  
will never wish to return to previously saved values?


Thanks.
___

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

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

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

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


Re: Exception-like behavior in save panel used for file choose

2009-07-31 Thread Quincey Morris

On Jul 30, 2009, at 23:04, Barry Press wrote:

	NSString *sFile = [textLogPath stringValue];; // 
stringByStandardizingPath;
	NSString *sFileWithoutLast = [sFile  
stringByDeletingLastPathComponent];
	NSString *sFileOnly = [sFile substringFromIndex:[sFileWithoutLast  
length]+1];

...


This latter code works properly so long as the file that will be the  
target of the append -- the target of the save panel -- does not  
exist. In that event, the runModal comes back and I can extract the  
name. If the file *does* exist, however, then a panel comes up that  
asks if it's ok to replace the file, and if I agree to replace, not  
only the choose panel closes, so does my settings panel - I'm dumped  
all the way back to the app that invoked showPreferencePane.



...

Any ideas on why the panel closes around me?

(Side note: anyone who wants to critique my code for splitting a  
file name off a path, please let her rip!)


As others have suggested, this is one of those "almost always"  
situations: When you see a mysterious gross transfer of control in a  
Cocoa application, it's almost always because an exception occurred,  
and there'll be an error message in the console log. So, yes, you can  
break on objc_exception_throw, but the first step is always to  
actually check the console log.


You didn't say whether your app uses garbage collection or retain/ 
release. If the latter, you need to review memory management, because  
you're not retaining (and therefore don't own) any of the strings  
here. If your save panel delegate uses any of the strings created  
before the "runModal", it's possible they're getting deallocated too  
early.


I don't really want to critique your code, but it does make me wonder:

-- Why are you using NSSavePanel for (apparently) getting an existing  
file to append to?


-- Why are you using "[sFile substringFromIndex ...]" to get the last  
path component, when "[sFile lastPathComponent]" would seem to be the  
logical choice?


-- Why are you invoking *both* setAllowedFileTypes: *and*  
setRequiredFileType:, with different parameters, when they're  
documented to be alternatives to each other?



___

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

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

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

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


Re: Application Preferences - a general question

2009-07-31 Thread Alex Kac
Typically I think a Mac user expects to be able to return to a  
previously saved value by using Undo.


On Jul 31, 2009, at 11:54 AM, Alexander Bokovikov wrote:


Hi, All,

Hope this is not an offtopic here...

I'm quite new in Mac world, and one of essential differences from  
Windows, which I've noticed, is how Preferences changes are applied.  
Unlike to usual Windows GUI, preferences are applied instantly on  
Mac, i.e. just as user changes a value. There is no "Cancel" button  
resetting values to the state, which they had at the moment, when  
Preferences panel was opened. Though there is "Restore Defaults"  
button, but it does just what it says - it restores so called  
"factory defaults", which are not the same, as previously saved  
values.


I'm reading "Cocoa Programming" by Aaron Hillegass, now, and he  
describes just the same Preferences functionality, as above.


Am I missing something? Or is this the general user interface  
building strategy for Cocoa applications or for Mac OS? Is it  
assumed that user will never wish to return to previously saved  
values?


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/alex%40webis.net

This email sent to a...@webis.net


Alex Kac - President and Founder
Web Information Solutions, Inc.

"I am not young enough to know everything."
--Oscar Wilde




___

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

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

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

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


Re: Application Preferences - a general question

2009-07-31 Thread Daniel DeCovnick
Correct in practice, although the principle is more that preferences  
shouldn't be that onerous to change back to how they were. The lack of  
needing to click "Apply" helps here too: since each change is  
reflected instantly, if something goes horribly wrong, the user knows  
EXACTLY what made it go horribly wrong. Feel free to implement the  
Windows way (just keep an NSMutableDictionary in your app delegate  
that updates whenever the preferences window is opened, and syncs back  
to the user defaults when cancel is clicked) if your preferences are  
extensive enough or changes to them destructive enough that you need it.


-Daniel


On Jul 31, 2009, at 9:54 AM, Alexander Bokovikov wrote:


Hi, All,

Hope this is not an offtopic here...

I'm quite new in Mac world, and one of essential differences from  
Windows, which I've noticed, is how Preferences changes are applied.  
Unlike to usual Windows GUI, preferences are applied instantly on  
Mac, i.e. just as user changes a value. There is no "Cancel" button  
resetting values to the state, which they had at the moment, when  
Preferences panel was opened. Though there is "Restore Defaults"  
button, but it does just what it says - it restores so called  
"factory defaults", which are not the same, as previously saved  
values.


I'm reading "Cocoa Programming" by Aaron Hillegass, now, and he  
describes just the same Preferences functionality, as above.


Am I missing something? Or is this the general user interface  
building strategy for Cocoa applications or for Mac OS? Is it  
assumed that user will never wish to return to previously saved  
values?


Thanks.


___

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

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

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

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


Re: Fun (or not) with NSArrayControllers and CoreData.

2009-07-31 Thread Daniel DeCovnick


Try this:

-- Add an "allDescendantJobs" Core Data to-many relationship to the  
Folder entity in your Core Data model. Set its delete rule to Nullify.


-- Add a "rootFolder" Core Data to-one relationship to the Job  
entity, and make it the inverse of "allDescendantJobs". Set its  
delete rule to Nullify.


-- Whenever you add a Job object to a Folder, also set the  
rootFolder property:


	addedJob.rootFolder = [parentFolder ... find its root folder  
recursively or whatever ...]; // this is KVO compliant for both ends  
of the relationship


-- Bind a NSArrayController in entity mode to the  
"allDescendantJobs" property of  whatever represents the selection  
in the Folders outline view.


-- Bind the Jobs table view to this array controller.

Now it should work. The only problem is going to be that the user  
interface may update for *each* Job object that's added/removed,  
which is less than optimal if you're updating a lot of them. And  
you're keeping an extra pair of relationships in the persistent  
store. If you need to avoid either of those things, you're going to  
have to work harder.




Thanks for the help so far, I think I'm about 90% there; there's still  
something wrong with a binding somewhere. If I unbind the Content Set  
of the JobArrayController (so I see all Jobs) adding some extra table  
columns showing the Folder name and root Folder name, adding and  
removing Jobs works fine (the data shows up in the table, and the  
Folder and root Folder name are correct) using the following methods  
(on my window controller):




-(IBAction)newJob:(id)sender
{
id folder = [self currentFolder];
	CCCEJob *newJob = [NSEntityDescription  
insertNewObjectForEntityForName:@"CCCEJob" inManagedObjectContext: 
[self managedObjectContext]];

[folder addJobsObject:newJob];
newJob.rootFolder = [newJob getRootFolder];
}
-(id)currentFolder
{
if ([[folderTreeController selectedObjects] count]!= 0)
{
return [[folderTreeController selectedObjects] objectAtIndex:0];
}
else return nil;
}

and on Job:

-(id)getRootFolder
{
id cursor = [self folder];
while ([cursor parent])
{
cursor = [cursor parent];
}
return cursor;
}

But if I have the Content Set of JobsArrayController bound to  
FolderTreeController with Controller Key: selection and Model Key  
Path: allDescendantsJobs, nothing shows up in the table. I've double  
and triple-checked the model to make sure the inverse relationships  
are set properly.


Thanks again for the help.

-Daniel
___

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

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

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

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


Re: Fun (or not) with NSArrayControllers and CoreData.

2009-07-31 Thread Quincey Morris

On Jul 31, 2009, at 10:33, Daniel DeCovnick wrote:

If I unbind the Content Set of the JobArrayController (so I see all  
Jobs) adding some extra table columns showing the Folder name and  
root Folder name, adding and removing Jobs works fine (the data  
shows up in the table, and the Folder and root Folder name are  
correct) using the following methods (on my window controller):




-(IBAction)newJob:(id)sender
{
id folder = [self currentFolder];
	CCCEJob *newJob = [NSEntityDescription  
insertNewObjectForEntityForName:@"CCCEJob" inManagedObjectContext: 
[self managedObjectContext]];

[folder addJobsObject:newJob];
newJob.rootFolder = [newJob getRootFolder];
}
-(id)currentFolder
{
if ([[folderTreeController selectedObjects] count]!= 0)
{
return [[folderTreeController selectedObjects] objectAtIndex:0];
}
else return nil;
}

and on Job:

-(id)getRootFolder
{
id cursor = [self folder];
while ([cursor parent])
{
cursor = [cursor parent];
}
return cursor;
}

But if I have the Content Set of JobsArrayController bound to  
FolderTreeController with Controller Key: selection and Model Key  
Path: allDescendantsJobs, nothing shows up in the table. I've double  
and triple-checked the model to make sure the inverse relationships  
are set properly.




What is selected in FolderTreeController's outline view? Your code  
above implies that you select a non-root folder prior to adding a new  
job (to the non-root folder). The "allDescendantsJobs" relationship  
only has something in it for a root folder. Are you selecting a root  
folder and seeing no jobs?



___

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

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

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

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


Re: local statics, GC, and strong references

2009-07-31 Thread Quincey Morris

On Jul 31, 2009, at 10:30, Sean McBride wrote:


Is there anything wrong with the below, in a GC app?

- (void)drawRect:(NSRect)inRect
{
// Create the colour only once.
 static NSColor* colour = nil;
 if (!colour)
 {
  colour = [NSColor colorWith...];
 }

[colour set];

 // Do drawing
}

Are there special rules or gotchas with local statics like 'colour'
above?  Is 'colour' always safe to use where I try to send it the  
'set'

message?  Could it be already-collected/lack strong references to keep
it alive?


That pattern has always worked for me in 10.5. The static variable is  
a strong reference.



___

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

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

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

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


Re: Stumped by EXEC_BAD_ACCESS

2009-07-31 Thread Greg Parker

On Jul 30, 2009, at 1:37 PM, David Blanton wrote:

When I quit my application it ends as expected.

When I close the last window I get the EXEC_BAD_ACCESS message.

Following Greg Parker's 2006 post at CocoaBuilder  I get the  
following which according to that post respondsToSelector:" is being  
called on a nil object.  As you can see the object_GetClassName()   
which should tell the call the method is being called on also breaks.


Current language:  auto; currently objective-c++
Program received signal:  “EXC_BAD_ACCESS”.
(gdb) x/s $ecx
0x93c83164 <__FUNCTION__.12370+617988>:"respondsToSelector:"
(gdb) x/8x $esp
0xbfffe758: 0x006ec390  0x90a8283b  0x09d818f0  0x93c83164
0xbfffe768: 0x93c24788  0x94063734  0x09d86750  0xa0078b40
(gdb) p (char *)object_getClassName(0x93c83164)

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x7073657a
0x93be3058 in _class_getName ()


Your diagnosis of 'respondsToSelector:' looks correct. But then you  
call object_getClassName() on the selector's address, which doesn't  
make any sense. That invalid address is the ASCII text 'resp'+8.


Your bad object is 0x09d818f0. Most likely it has already been  
deallocated which then causes this crash. (If it has been deallocated,  
then its isa pointer will no longer be valid, so object_getClassName()  
will still fail.)  Use NSZombie and MallocStackLogging to track down  
the bad object and its memory management history.


So you crashed in objc_msgSend:
http://sealiesoftware.com/blog/archive/2008/09/22/objc_explain_So_you_crashed_in_objc_msgSend.html


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


___

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

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

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

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


Re: Application Preferences - a general question

2009-07-31 Thread Alexander Bokovikov


On 31.07.2009, at 23:09, Daniel DeCovnick wrote:

Correct in practice, although the principle is more that preferences  
shouldn't be that onerous to change back to how they were. The lack  
of needing to click "Apply" helps here too: since each change is  
reflected instantly, if something goes horribly wrong, the user  
knows EXACTLY what made it go horribly wrong. Feel free to implement  
the Windows way (just keep an NSMutableDictionary in your app  
delegate that updates whenever the preferences window is opened, and  
syncs back to the user defaults when cancel is clicked) if your  
preferences are extensive enough or changes to them destructive  
enough that you need it.


OK, understood it. I just would like to know what is the usual  
approach here. I believe I know it now.


Thanks.

___

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

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

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

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


How to change focus ring color?

2009-07-31 Thread Alexander Bokovikov

Hi, All,

I can't find how I could change the focus ring color, for example, of  
NSPathControl. The IB only lets me disable it. Is the color defined by  
the color scheme hardly?


Thanks.
___

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

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

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

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


NSTabView Tutorial

2009-07-31 Thread Thomas Wetmore
I'm looking for a simple NSTabView tutorial. I've found references to  
the MultipleNIBTabView tutorial but I can't find it in the current  
Xcode Examples area or at the Developer site. Anyone know where it is  
located, or whether there is another tutorial around?


Thanks,

Tom Wetmore
___

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

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

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

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


Re: How to change focus ring color?

2009-07-31 Thread Kyle Sluder
On Fri, Jul 31, 2009 at 12:07 PM, Alexander
Bokovikov wrote:
> I can't find how I could change the focus ring color, for example, of
> NSPathControl. The IB only lets me disable it. Is the color defined by the
> color scheme hardly?

Focus rings are drawn in the user's specified selection color.

--Kyle Sluder
___

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

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

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

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


Re: Exception-like behavior in save panel used for file choose

2009-07-31 Thread Kyle Sluder
On Fri, Jul 31, 2009 at 9:26 AM, Greg Titus wrote:
> Typo there... it's objc_exception_throw().

Oops.  Thanks Greg.

*grumbles about mixed underscore vs. camel -case conventions*

--Kyle Sluder
___

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

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

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

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


Re: Fun (or not) with NSArrayControllers and CoreData.

2009-07-31 Thread Daniel DeCovnick


On Jul 31, 2009, at 11:01 AM, Quincey Morris wrote:


On Jul 31, 2009, at 10:33, Daniel DeCovnick wrote:

What is selected in FolderTreeController's outline view? Your code  
above implies that you select a non-root folder prior to adding a  
new job (to the non-root folder). The "allDescendantsJobs"  
relationship only has something in it for a root folder. Are you  
selecting a root folder and seeing no jobs?


I'm selecting root folders, non-root folders, or leaf folders, and  
seeing no jobs in any of those cases. If I select a particular folder  
(of any depth in the tree), create a new Job, quit, unbind the content  
set, and build and run the program, the Job I created but couldn't see  
is present, with it's folder and rootFolder set correctly.


Additionally, the following code only prints the name of the the  
current folder:


id adj = [folder allDescendantsJobs];
NSLog(@"Current Folder: %...@.\n",[folder name]);
for (id i in adj)
{
NSLog(@"Job: %...@\n", [i name]);
}

BUT,
id kids = [folder children];
NSLog(@"Current Folder: %...@.\n",[folder name]);
for (id i in kids)
{
NSLog(@"Child: %...@\n", [i name]);
}
Prints out all the folder's children just fine. Weirder,
id jobs = [folder jobs];
NSLog(@"Current Folder: %...@.\n",[folder name]);
for (id i in jobs)
{
NSLog(@"Job: %...@\n", [i name]);
}
Works as expected as well, printing out only the current folder's  
jobs. All of these were placed at the top of newJob: from my previous  
message. I've double-checked the model for typos or unselected  
inverses, and it all checks out. Are there issues with multiple  
relationships between the same entities?


-Daniel
___

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

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

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

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


Re: Hyperlinks in NSAttributedString?

2009-07-31 Thread James Walker

Rick Mann wrote:

I may have found what I needed here:

http://developer.apple.com/qa/qa2006/qa1487.html


That QA omits the possibility of using NSCursorAttributeName to make the 
cursor change when you mouse over the link.  However, to do that you 
need NSTextView, not NSTextField.


--
  James W. Walker, Innoventive Software LLC
  
___

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

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

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

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


Re: Fun (or not) with NSArrayControllers and CoreData.

2009-07-31 Thread Quincey Morris

On Jul 31, 2009, at 10:33, Daniel DeCovnick wrote:


-(IBAction)newJob:(id)sender
{
id folder = [self currentFolder];
	CCCEJob *newJob = [NSEntityDescription  
insertNewObjectForEntityForName:@"CCCEJob" inManagedObjectContext: 
[self managedObjectContext]];

[folder addJobsObject:newJob];
newJob.rootFolder = [newJob getRootFolder];
}


Perhaps I was wrong about the inverse relationship getting set KVO- 
compliantly. Instead of:


newJob.rootFolder = [newJob getRootFolder];

you could try:

[[newJob getRootFolder] addAllDescendantsJobsObject: newJob];

(after adding @dynamic addAllDescendantsJobsObject or whatever), or,  
equivalently:


	[[[newJob getRootFolder] mutableSetValueForKey:  
@"allDescendantsJobs"] addObject: newJob];


___

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

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

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

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


Re: NSTabView Tutorial

2009-07-31 Thread Andy Lee
How about the examples linked to in the documentation?



(See "Related sample code".)  I don't know anything about them, but thought you 
might have overlooked them since you didn't mention them.

I think it was an excellent idea for Apple to add these links in the docs.

--Andy

On Friday, July 31, 2009, at 03:20PM, "Thomas Wetmore"  wrote:
>I'm looking for a simple NSTabView tutorial. I've found references to  
>the MultipleNIBTabView tutorial but I can't find it in the current  
>Xcode Examples area or at the Developer site. Anyone know where it is  
>located, or whether there is another tutorial around?
>
>Thanks,
>
>Tom Wetmore
>___
>
>Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
>Please do not post admin requests or moderator comments to the list.
>Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
>Help/Unsubscribe/Update your Subscription:
>http://lists.apple.com/mailman/options/cocoa-dev/aglee%40mac.com
>
>This email sent to ag...@mac.com
>
>
___

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

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

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

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


Re: How to change focus ring color?

2009-07-31 Thread Joel Norvell

Alexander,

If you're drawing the focus ring yourself, you can change its color by setting 
it in the NSGraphicsContext that's active while it's being drawn.

I draw NSView/NSControl focus rings by hand in one of my apps. I've posted the 
code that does this, below.  I'm not changing the color of the focus ring, but 
easily could by setting some color other than keyboardFocusIndicatorColor.

My approach is fairly heavy-handed.  I'm not suggesting that you adopt it, just 
that it's possible.

You didn't say what objects you are drawing, so I should add this caveat:  I'm 
not sure what variations, if any, would be induced by generalizing my approach 
to NSCell objects.

Sincerely,
Joel


- (void)drawRect:(NSRect)rect 
{
[super drawRect:rect];

if ([self focus])
{
[self drawFocusRing];

[NSGraphicsContext saveGraphicsState];

NSRect whiteOutRect = NSInsetRect([self bounds], 2, 2);
[self whiteOutInterior:whiteOutRect];

[NSGraphicsContext restoreGraphicsState];
}
}


- (void) drawFocusRing
{
if ([self focus])
{
[NSGraphicsContext saveGraphicsState];

[self whiteOutFocusRegion:[self bounds]]; // whiteOutFocusRegion

[[NSColor keyboardFocusIndicatorColor] set];

NSSetFocusRingStyle(NSFocusRingOnly);
[[NSBezierPath bezierPathWithRect:[self bounds]] fill];

[NSGraphicsContext restoreGraphicsState];
[self setFocusRingDrawn:YES];
}
}



  
___

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

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

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

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


Re: Fun (or not) with NSArrayControllers and CoreData.

2009-07-31 Thread Daniel DeCovnick


On Jul 31, 2009, at 2:26 PM, Quincey Morris wrote:


On Jul 31, 2009, at 10:33, Daniel DeCovnick wrote:


-(IBAction)newJob:(id)sender
{
id folder = [self currentFolder];
	CCCEJob *newJob = [NSEntityDescription  
insertNewObjectForEntityForName:@"CCCEJob" inManagedObjectContext: 
[self managedObjectContext]];

[folder addJobsObject:newJob];
newJob.rootFolder = [newJob getRootFolder];
}


Perhaps I was wrong about the inverse relationship getting set KVO- 
compliantly. Instead of:


newJob.rootFolder = [newJob getRootFolder];

you could try:

[[newJob getRootFolder] addAllDescendantsJobsObject: newJob];

That worked! The result was wrong, but making the rootFolder  
relationship into rootFolders and making it to-many, changing  
getRootFolder to -(NSArray *)allContainingFolders, and sending  
everything in that the addAllDescendantsJobsObject: message worked  
perfectly. Still, it's slightly disconcerting that setting the  
property doesn't set the inverse relationship. How are you supposed to  
change it later?


On a mostly unrelated note, is the only way to suppress the "no '- 
addJobsObject:'/'-addAllDescendantsJobsObject:' method found" warnings  
to create the Folder custom subclass and paste the Core Data method  
declarations in? That approach seems like overkill since I have  
nothing to customize in it.


Anyways, thanks muchly, onto the next part of the application!

-Daniel 
___


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

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

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

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


Re: NSTabView Tutorial

2009-07-31 Thread Boyd Collier
A couple of years ago, I made a copy of MultipleNibTabView to play  
around with in learning how to use tab views.  I still have this  
(slightly modified) copy but couldn't find the original version from  
Apple on my computer.  However, if you'd like a copy of the version  
that I have, I'd be happy to send it to you.


Boyd




On Jul 31, 2009, at 12:20 PM, Thomas Wetmore wrote:

I'm looking for a simple NSTabView tutorial. I've found references  
to the MultipleNIBTabView tutorial but I can't find it in the  
current Xcode Examples area or at the Developer site. Anyone know  
where it is located, or whether there is another tutorial around?


Thanks,

Tom Wetmore
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/bcollier%40sunstroke.sdsu.edu

This email sent to bcoll...@sunstroke.sdsu.edu



___

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

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

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

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


What is going on with CALayer

2009-07-31 Thread Agha Khan

HI:
This is very strange problem.
This code works fine with OS 2.2 but does not work with OS 3.x
Can someone point me why it failed?
Your help will be very much appreciated.
Best regards
-Agha




But why?

// NumberLayer.h
#import 
#import 

@interface NumberLayer: CALayer
{
}
@end

and now NumberLayer.m file

#import "NumberLayer.h"

@implementation NumberLayer
@end

".objc_class_name_CALayer", referenced from:
".objc_class_name_NumberLayer in NumberLayer.o
symble(s) not found
collect2: Id returned 1 exit status

Build failed (1 error)




___

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

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

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

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


Re: What is going on with CALayer

2009-07-31 Thread Luke the Hiesterman

Did you include QuartzCore in your project's linked frameworks?

Luke

On Jul 31, 2009, at 3:18 PM, Agha Khan wrote:


HI:
This is very strange problem.
This code works fine with OS 2.2 but does not work with OS 3.x
Can someone point me why it failed?
Your help will be very much appreciated.
Best regards
-Agha




But why?

// NumberLayer.h
#import 
#import 

@interface NumberLayer: CALayer
{
}
@end

and now NumberLayer.m file

#import "NumberLayer.h"

@implementation NumberLayer
@end

".objc_class_name_CALayer", referenced from:
".objc_class_name_NumberLayer in NumberLayer.o
symble(s) not found
collect2: Id returned 1 exit status

Build failed (1 error)




___

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

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

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

This email sent to luket...@apple.com


___

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

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

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

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


Re: What is going on with CALayer

2009-07-31 Thread Nick Zitzmann


On Jul 31, 2009, at 4:18 PM, Agha Khan wrote:


This code works fine with OS 2.2 but does not work with OS 3.x
Can someone point me why it failed?

[...]

".objc_class_name_CALayer", referenced from:
".objc_class_name_NumberLayer in NumberLayer.o
symble(s) not found
collect2: Id returned 1 exit status


Did you remember to link your application to the QuartzCore framework?

Nick Zitzmann


___

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

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

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

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


Re: What is going on with CALayer

2009-07-31 Thread Agha Khan

You made me happy man. :-)

Best regards
Agha Khan
On Jul 31, 2009, at 3:18 PM, Luke the Hiesterman wrote:


Did you include QuartzCore in your project's linked frameworks?

Luke

On Jul 31, 2009, at 3:18 PM, Agha Khan wrote:


HI:
This is very strange problem.
This code works fine with OS 2.2 but does not work with OS 3.x
Can someone point me why it failed?
Your help will be very much appreciated.
Best regards
-Agha




But why?

// NumberLayer.h
#import 
#import 

@interface NumberLayer: CALayer
{
}
@end

and now NumberLayer.m file

#import "NumberLayer.h"

@implementation NumberLayer
@end

".objc_class_name_CALayer", referenced from:
".objc_class_name_NumberLayer in NumberLayer.o
symble(s) not found
collect2: Id returned 1 exit status

Build failed (1 error)




___

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

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

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

This email sent to luket...@apple.com




___

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

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

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

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


[MEET] August CocoaHeads Mac Developer Meetings

2009-07-31 Thread Stephen Zyszkiewicz

Greetings,

CocoaHeads is an international Mac programmer's group. Meetings are  
free and open to the public. We specialize in Cocoa, but everything  
Mac programming related is welcome.


Upcoming meetings:
Australia
Sydney- Thursday, August 6, 2009 18:30.

Canada
Ottawa/Gatineau- Thursday, August 13, 2009 19:00.
Victoria- Thursday, August 6, 2009 19:00.

Denmark
Copenhagen- Tuesday, August 11, 2009 19:00.

Germany
Hamburg- Wednesday, August 5, 2009 19:00.
Munich- Thursday, August 13, 2009 20:00.

Sweden
Malmö- Tuesday, August 11, 2009.
Stockholm- Monday, August 3, 2009 19:00.

Switzerland
Zürich- Thursday, August 13, 2009 19:00.

United States
Ann Arbor- Thursday, August 13, 2009 19:00.
Boulder- Tuesday, August 11, 2009 19:00.
Colorado Springs- Thursday, August 13, 2009 19:00.
Columbia- Tuesday, August 11, 2009 19:00.
Columbus- Tuesday, August 11, 2009 19:00.
Dallas- Thursday, August 13, 2009 19:00.
Denver- Tuesday, August 11, 2009 19:00.
Des Moines- Thursday, August 13, 2009 18:00.
Detroit- Thursday, August 14, 2008 20:00.
Fayetteville- Thursday, August 13, 2009 18:00.
Indianapolis- Tuesday, August 11, 2009 19:00.
Lake Forest- Wednesday, August 12, 2009 19:00.
Minneapolis- Thursday, August 13, 2009 18:00.
Nashville- Thursday, August 13, 2009 19:00.
New York- Thursday, August 13, 2009 18:00.
Philadelphia- Thursday, August 13, 2009 19:00.
Pittsburgh- Thursday, August 13, 2009 19:30.
St. Louis- Saturday, August 29, 2009 14:00.
Upper Connecticut River Valley- Thursday, August 13, 2009 19:00.

United Kingdom
Swindon- Monday, August 3, 2009 20:00.


Some chapters may have yet to post their meeting for next month.  
Meeting times may change. Locations and more information here:

http://cocoaheads.org

Also be sure to check for an NSCoder Night in your area:
http://nscodernight.com/


Steve
Silicon Valley CocoaHeads
___

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

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

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

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


incorrect checksum for freed object

2009-07-31 Thread kvic...@pobox.com
(i'm not sure if this is the right list for this question or not, as 
i am developing a cocoa application using IOKit. if this isn't the 
right list, could someone please tell me the right list. thanx.)


i'm just starting on developing a core data document base app that 
talks to a usb device. sometimes, but not always, i'm getting crashes 
when i'm either releasing my IOUSBDeviceInterface300 or my 
IOUSBInterfaceInterface300. the error i get on the console is:


malloc: *** error for object 0x102662970: incorrect checksum for 
freed object - object was probably modified after being freed.

*** set a breakpoint in malloc_error_break to debug

and i have set that breakpoint. the stack trace at the time is:

#0  0x83d7aa51 in malloc_error_break
#1  0x83d75ad0 in szone_error
#2  0x83cb5571 in tiny_free_list_add_ptr
#3  0x83cb28cf in szone_free
#4  0x025876ba in IOUSBDeviceClass::~IOUSBDeviceClass
#5  0x02586f0d in IOUSBIUnknown::release
#6	0x1f1a in -[BaseUSBInterface releaseResources] at 
BaseUSBInterface.mm:154


in response to:
err = (*(self.interface))->Release( self.interface);
or
err = (*(self.device))->Release( self.device);

where interface and device are declared as follows:
	@property ( assign, nonatomic)	IOUSBDeviceInterface300** 
device;
	@property ( assign, nonatomic)	IOUSBInterfaceInterface300** 
interface;
and synthesized. i am running in 64 bit mode and have NOT declared my 
own iVars for these.


these errors don't happen every time and i've yet to be able to 
determine a pattern that causes them. i realize that this is some 
sort of memory corruption problem, but i'm at a loss as to how to 
find it. i do have NSZombieEnabled set to YES and CFZombieLevel set 
to 3.


can anyone one offer suggestions as to how to find this problem.

thanx,
ken
___

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

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

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

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


Re: Fun (or not) with NSArrayControllers and CoreData.

2009-07-31 Thread Quincey Morris

On Jul 31, 2009, at 15:11, Daniel DeCovnick wrote:

That worked! The result was wrong, but making the rootFolder  
relationship into rootFolders and making it to-many, changing  
getRootFolder to -(NSArray *)allContainingFolders, and sending  
everything in that the addAllDescendantsJobsObject: message worked  
perfectly.


Good news. :)

Still, it's slightly disconcerting that setting the property doesn't  
set the inverse relationship. How are you supposed to change it later?


I believe it *was* setting the inverse correctly, just not KVO- 
compliantly. That is, your data model was correct, but the user  
interface was out-of-date.


On a mostly unrelated note, is the only way to suppress the "no '- 
addJobsObject:'/'-addAllDescendantsJobsObject:' method found"  
warnings to create the Folder custom subclass and paste the Core  
Data method declarations in? That approach seems like overkill since  
I have nothing to customize in it.


I forgot, you can't use @dynamic because these aren't properties. What  
you can do is put the method declarations in a category of your  
subclass, and just not implement the category. See Xcodes's Design -->  
Data Model --> Copy Obj-C 2.0 Method Declarations to Clipboard as a  
way of avoiding re-inventing this for yourself. (But delete any  
#ifdef'd stuff it gives you -- that's only if you're actually re- 
implementing the methods.)



___

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

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

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

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


Re: incorrect checksum for freed object

2009-07-31 Thread Nick Zitzmann


On Jul 31, 2009, at 4:39 PM, kvic...@pobox.com wrote:

these errors don't happen every time and i've yet to be able to  
determine a pattern that causes them. i realize that this is some  
sort of memory corruption problem, but i'm at a loss as to how to  
find it. i do have NSZombieEnabled set to YES and CFZombieLevel set  
to 3.


can anyone one offer suggestions as to how to find this problem.


Turn on Guard Malloc, which will force your app to crash if something  
writes into freed memory. Be ready to do something else while it's  
running, though, because Guard Malloc makes your app run super slow,  
especially if it uses a lot of RAM.


Nick Zitzmann


___

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

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

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

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


Re: incorrect checksum for freed object

2009-07-31 Thread kvic...@pobox.com

At 5:01 PM -0600 7/31/09, Nick Zitzmann wrote:

On Jul 31, 2009, at 4:39 PM, kvic...@pobox.com wrote:

these errors don't happen every time and i've yet to be able to 
determine a pattern that causes them. i realize that this is some 
sort of memory corruption problem, but i'm at a loss as to how to 
find it. i do have NSZombieEnabled set to YES and CFZombieLevel set 
to 3.


can anyone one offer suggestions as to how to find this problem.


Turn on Guard Malloc, which will force your app to crash if 
something writes into freed memory. Be ready to do something else 
while it's running, though, because Guard Malloc makes your app run 
super slow, especially if it uses a lot of RAM.


Nick Zitzmann



thanx nick,
my app is still in the early stages, and thus small enough that 
turning on guard malloc isn't that bad. of course now that its turned 
on, i no longer get the crashes! i guess i'll run in this mode for a 
while.


thanx,
ken
___

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

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

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

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


Ye Olde AEIdleProcPtr

2009-07-31 Thread Eric Long
Hi,

In days of yore, when sending an AppleEvent with AESend, you could use an AE
idleProc to allow for cancelling the event if you had reason to bail. The
parameters also pass you an EventRecord and you are expected to handle
window update events.

Now, I have a Cocoa app that has to send an AppleEvent with no timeout
specified.  It should only bail if the event fails or the user cancels.
Apart from using an AE idle proc, I can't see how to make this happen.

All of my relevant AE occurs on the same subthread.  That thread is blocked
waiting for AESend to return with a reply.

I assume the idle proc is called on the main thread.  I have no idea what to
do with the EventRecord, if I should do anything that concerns Cocoa.

In my Cocoa app, can I use this idle proc and just ignore the EventRecord?
I don't see a Cocoa API that would allow me to pass the event to it.  Is
this even relevant without Carbon windows?

Maybe there is a better way to go at this.  Can someone de-fuzz things here
from me? 


Eric


___

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

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

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

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


The mystery of the missing inverse relationship (was: Re: Fun (or not) with NSArrayControllers and CoreData.)

2009-07-31 Thread Daniel DeCovnick


On Jul 31, 2009, at 3:41 PM, Quincey Morris wrote:


Still, it's slightly disconcerting that setting the property  
doesn't set the inverse relationship. How are you supposed to  
change it later?


I believe it *was* setting the inverse correctly, just not KVO- 
compliantly. That is, your data model was correct, but the user  
interface was out-of-date.




I don't think that's it, since even if I restarted the app after  
adding jobs, I couldn't see anything in the table, whereas if I didn't  
bind the content set of the jobs array controller at all, they showed  
up correctly. Meh, I'll just follow this pattern in the future and  
avoid setting from the one side of a one-to-many relationship.


On a mostly unrelated note, is the only way to suppress the "no '- 
addJobsObject:'/'-addAllDescendantsJobsObject:' method found"  
warnings to create the Folder custom subclass and paste the Core  
Data method declarations in? That approach seems like overkill  
since I have nothing to customize in it.


I forgot, you can't use @dynamic because these aren't properties.  
What you can do is put the method declarations in a category of your  
subclass, and just not implement the category. See Xcodes's Design -- 
> Data Model --> Copy Obj-C 2.0 Method Declarations to Clipboard as  
a way of avoiding re-inventing this for yourself. (But delete any  
#ifdef'd stuff it gives you -- that's only if you're actually re- 
implementing the methods.)


I can put these in any included .h file, right? I don't have a custom  
subclass of Folder at all at the moment. 
___


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

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

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

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


Re: Comparing NSImages

2009-07-31 Thread John C. Randolph


I wrote a sample project to find the difference image between to given  
images several years ago.  You can find that code here:


http://developer.apple.com/samplecode/Image_Difference/index.html

These days, I'd do this kind thing in a Quartz Composer view.

-jcr
___

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

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

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

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


Re: incorrect checksum for freed object

2009-07-31 Thread Shawn Erickson
On Fri, Jul 31, 2009 at 3:39 PM, kvic...@pobox.com wrote:

> where interface and device are declared as follows:
>       �...@property ( assign, nonatomic)  IOUSBDeviceInterface300** device;
>       �...@property ( assign, nonatomic)  IOUSBInterfaceInterface300**
> interface;

Why are you use a pointer to a pointer (**) in above? I ask because
doing so seems a little strange and hence leads me to think you may
have a misunderstanding of pointers, etc. in some of the API you are
calling.

-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 arch...@mail-archive.com


Core Data App With Auxiliary Panel

2009-07-31 Thread Richard Somers
I am having problems binding an auxiliary panel with the document's  
managed object context. The panel is in nib separate from the document  
nib. My code looks like this.


@interface AuxPanelController : NSWindowController
{
@private
NSManagedObjectContext *managedObjectContext;
}

@implementation AuxPanelController

- (id)init
{
if (![super initWithWindowNibName:@"AuxPanel"])
return nil;
return self;
}

- (NSManagedObjectContext *)managedObjectContext
{
return [[self document] managedObjectContext];
}

In the AuxPanel.xib the array controller's managed object context is  
bound to the File's Owner managedObjectContext model key path. The  
File's Owner object is the AuxPanelController.


In the running application the auxiliary panel displays properly but  
an error message is produced: "Cannot perform operation without a  
managed object context".


Any suggestions?

Richard

___

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

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

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

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


How do I delete NSCollectionView item on right click?

2009-07-31 Thread Austin Grigg
I've got an NSCollectionView with the prototype view subclassed and  
I'm overriding menuForEvent.  I'm creating a menu that has Edit/Delete  
and when the user clicks Delete I want to remove that collection view  
item.  Where would you put the selector for the Delete menu item, and  
how would you know when it gets called what collection view item to  
delete?


Thanks,
Austin
___

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

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

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

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


Re: Core Data App With Auxiliary Panel

2009-07-31 Thread Kyle Sluder
On Jul 31, 2009, at 8:03 PM, Richard Somers  
 wrote:



@interface AuxPanelController : NSWindowController
{
@private
   NSManagedObjectContext *managedObjectContext;
}

@implementation AuxPanelController

- (id)init
{
   if (![super initWithWindowNibName:@"AuxPanel"])


Unrelated note: you need to assign self = [super initWithWindowName: 
…].



- (NSManagedObjectContext *)managedObjectContext
{
   return [[self document] managedObjectContext];


If you're doing this why do you have an ivar?

In the running application the auxiliary panel displays properly but  
an error message is produced: "Cannot perform operation without a  
managed object context".


Because you have a managedObjectContext ivar, you never change its  
value so it defaults to nil, and +[NSObject(NSKeyValueCoding)  
accessInstanceVariablesDirectly] returns YES, -[AuxPanelController  
objectForKey:@"managedObjectContext"] will always return nil. Ditch  
the ivar.


--Kyle Sluder



___

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

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

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

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


IPhone Textview question

2009-07-31 Thread Development
I'm working on an app and it is fairly large. well... maybe not it's  
about 1.1 megs. I save as much memory as I can but I think its not  
enough. When typing in text fields and text views I get this strange  
lag in the keys. Do any of you happen to know what might cause this?  
I've turned off auto correction thinking that might be part of the  
problem but it does not seem to help too much. What can I be doing  
wrong that coul cause this kind of lag? On one of my testers phones he  
says he cant use the app it slows down so much but on my ipod I cannot  
reproduce.




April.
___

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

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

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

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


Re: How to set the name of open-with application for a specific file?

2009-07-31 Thread Jerry Krinock


On 2009 Jul 31, at 06:00, MATSUMOTO Satoshi wrote:


I want to do this programmatically.


I don't know if there are API to do this programatically or not.   
Search Xcode documentation for functions that "Start With"  "LS".


___

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

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

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

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


Re: Core Data App With Auxiliary Panel

2009-07-31 Thread Richard Somers

On Jul 31, 2009, at 9:33 PM, Kyle Sluder wrote:

Unrelated note: you need to assign self = [super initWithWindowName: 
…].



My code here came out of Hillegass Third Edition Chapter 12. I will  
need to think about this.


Because you have a managedObjectContext ivar, you never change its  
value so it defaults to nil, and +[NSObject(NSKeyValueCoding)  
accessInstanceVariablesDirectly] returns YES, -[AuxPanelController  
objectForKey:@"managedObjectContext"] will always return nil. Ditch  
the ivar.


Yes I see your point. Ditched the ivar but still get "Cannot perform  
operation without a managed object context" error. Must be some other  
reason why the binding is not working.


Richard

___

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

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

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

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


Re: IPhone Textview question

2009-07-31 Thread Luke Hiesterman
I'd make sure your tester is using at least os 3.0. I seem to recall  
slow typing issues in 2.x


Luke

Sent from my iPhone.

On Jul 31, 2009, at 9:20 PM, Development   
wrote:


I'm working on an app and it is fairly large. well... maybe not it's  
about 1.1 megs. I save as much memory as I can but I think its not  
enough. When typing in text fields and text views I get this strange  
lag in the keys. Do any of you happen to know what might cause this?  
I've turned off auto correction thinking that might be part of the  
problem but it does not seem to help too much. What can I be doing  
wrong that coul cause this kind of lag? On one of my testers phones  
he says he cant use the app it slows down so much but on my ipod I  
cannot reproduce.




April.
___

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

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

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

This email sent to luket...@apple.com

___

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

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

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

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


Re: The mystery of the missing inverse relationship (was: Re: Fun (or not) with NSArrayControllers and CoreData.)

2009-07-31 Thread Quincey Morris

On Jul 31, 2009, at 17:19, Daniel DeCovnick wrote:

I can put these in any included .h file, right? I don't have a  
custom subclass of Folder at all at the moment.


I meant as a category of Folder -- which is a "custom subclass" of  
NSManagedObject in Core Data terminology. So, Folder.h (or whatever  
it's called) was the place I had in mind.



___

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

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

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

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


Re: Core Data App With Auxiliary Panel

2009-07-31 Thread Kyle Sluder
On Jul 31, 2009, at 9:58 PM, Richard Somers  
 wrote:


My code here came out of Hillegass Third Edition Chapter 12. I will  
need to think about this.


Doesn't matter; you must be prepared for super's initializer to return  
a different object (with the possible exception of -[NSObject init],  
but why tempt fate?).


Yes I see your point. Ditched the ivar but still get "Cannot perform  
operation without a managed object context" error. Must be some  
other reason why the binding is not working.


Is the panel set to display at launch? If so, it will be shown during  
nib awaking (inside -[NSWindowController initWithNibNamed:]), before  
anyone calls -[AuxWindowController setDocument:]. Ensure that the  
panel's Display at Launch checkbox is unchecked.



--Kyle Sluder



___

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

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

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

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


Re: How to change focus ring color?

2009-07-31 Thread Alexander Bokovikov


On 01.08.2009, at 4:42, Joel Norvell wrote:

You didn't say what objects you are drawing, so I should add this  
caveat:  I'm not sure what variations, if any, would be induced by  
generalizing my approach to NSCell objects.


OK, maybe I provided not so clear problem description. I have  
_standard_ NSPathControl. It's style is set to PopUp. And I see a  
light blue rounded rectangle around the control. I'm not sure exactly,  
if it's a focus ring, because this border does not disappear, if I'm  
selecting (by mouse) other controls on the same panel. At least this  
border disappears if choose "none" in IB properties inspector for the  
Focus Ring.


My question was exactly "can I subclass NSPathControl to override this  
border drawing procedure to change the color of the border? If yes,  
then what method should I override?"


I'm not so skilled yet in controls inner structure yet, so I don't  
know if there is a special procedure, drawing the border, or it's  
drawn within the same method, which draws the control itself.


It looks like your code really draws "focus" ring, related to keyboard  
focus. But I'm not sure, if it's what I need for my case. Please  
advise if you can.


Another related problem is that checkbox has the same light-blue  
background in the checked state. And I don't see what property could  
change it. I'd like to change it to some grayscale value.


Thanks.

___

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

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

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

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


Re: Core Data App With Auxiliary Panel

2009-07-31 Thread Kyle Sluder



Because you have a managedObjectContext ivar, you never change its  
value so it defaults to nil, and +[NSObject(NSKeyValueCoding)  
accessInstanceVariablesDirectly] returns YES, -[AuxPanelController  
objectForKey:@"managedObjectContext"] will always return nil. Ditch  
the ivar.


Need to correct myself here. Instance variable access is a last  
resort, performed only when there is no KVC-compliant accessor for the  
requested key.


Sorry for th misinformation.

--Kyle Sluder



___

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

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

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

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


Re: How do I delete NSCollectionView item on right click?

2009-07-31 Thread Graham Cox


On 01/08/2009, at 1:11 PM, Austin Grigg wrote:

I've got an NSCollectionView with the prototype view subclassed and  
I'm overriding menuForEvent.  I'm creating a menu that has Edit/ 
Delete and when the user clicks Delete I want to remove that  
collection view item.  Where would you put the selector for the  
Delete menu item, and how would you know when it gets called what  
collection view item to delete?



By "selector" I assume you mean e.g. a -delete: IBAction method. That  
would go in the controller that is handling the view. To ensure it  
gets called, you simply ctrl-drag a connection from the menu item to  
the controller and choose this method. Verify it gets called using  
NSLog or the debugger.


To actually implement the delete, you'd use the view's - 
selectionIndexes to find out what items to delete, remove them from  
your data model and call the view's -setContent: with the modified  
array from your model, and also remove the selection using - 
setSelectionIndexes: with an empty set. You might need to call - 
setNeedsdisplay:YES on the view to make it show the change.


--Graham


___

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

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

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

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


Re: How do I delete NSCollectionView item on right click?

2009-07-31 Thread Graham Cox


On 01/08/2009, at 4:12 PM, Graham Cox wrote:

I've got an NSCollectionView with the prototype view subclassed and  
I'm overriding menuForEvent.  I'm creating a menu that has Edit/ 
Delete and when the user clicks Delete I want to remove that  
collection view item.  Where would you put the selector for the  
Delete menu item, and how would you know when it gets called what  
collection view item to delete?



By "selector" I assume you mean e.g. a -delete: IBAction method.  
That would go in the controller that is handling the view. To ensure  
it gets called, you simply ctrl-drag a connection from the menu item  
to the controller and choose this method. Verify it gets called  
using NSLog or the debugger.



Forgot to mention - if you are setting up the menu programmatically,  
you need to set the target of the menu item to the controller and the  
action method selector to the -delete: IBAction (it doesn't strictly  
need to be an IBAction in this case, but personally I find that  
declaring it as such is useful for managing the code and converting it  
to an IB-based solution later).


If your menu is simple and not dynamic - i.e. it never changes  
according to the state of the item it's attached to - you might find  
it easier to set it up in IB rather than overriding -menuForEvent: -  
just create a menu object and connect it to the 'menu' outlet of the  
view.


--Graham


___

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

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

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

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


Re: Core Data App With Auxiliary Panel

2009-07-31 Thread Quincey Morris

On Jul 31, 2009, at 20:03, Richard Somers wrote:

I am having problems binding an auxiliary panel with the document's  
managed object context. The panel is in nib separate from the  
document nib. My code looks like this.


@interface AuxPanelController : NSWindowController
{
@private
   NSManagedObjectContext *managedObjectContext;
}

@implementation AuxPanelController

- (id)init
{
   if (![super initWithWindowNibName:@"AuxPanel"])
   return nil;
   return self;
}

- (NSManagedObjectContext *)managedObjectContext
{
   return [[self document] managedObjectContext];
}

In the AuxPanel.xib the array controller's managed object context is  
bound to the File's Owner managedObjectContext model key path. The  
File's Owner object is the AuxPanelController.


In the running application the auxiliary panel displays properly but  
an error message is produced: "Cannot perform operation without a  
managed object context".


You haven't said what you mean by an "auxiliary panel".

If you mean it's a sheet on the document window, then its window  
controller's "document" property will be nil. You should pass the  
document as a parameter to the AuxPanelController's initializer instead.


If you mean it's a freestanding window (whether NSWindow or NSPanel),  
the answer is the same: pass the document because there's no other way.


If you mean it's a secondary document window, then you need to add it  
to the document's list of window controllers. That would need to be  
done by whatever creates is -- typically the window controller of the  
main document window. After that's done, AuxPanelController can refer  
to [self document] and get the document.


Or, in all 3 cases, just pass the managed object context to the  
AuxPanelController initializer, and stash it in your otherwise unused  
instance variable.


___

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

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

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

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


Surprise: -[NSInvocation retainArguments] also Autoreleases them

2009-07-31 Thread Jerry Krinock

The document for -[NSInvocation retainArguments] tells me:
"If the receiver hasn’t already done so, retains the target and all  
object arguments of the receiver and copies all of its C-string  
arguments. ...  Newly created NSInvocations don’t retain or copy their  
arguments, nor do they retain their targets or copy C strings. You  
should instruct an NSInvocation to retain its arguments if you intend  
to cache it, since the arguments may otherwise be released before the  
NSInvocation is invoked."


So I decided to -retainArguments, and presumed that this meant I was  
supposed to release the target and arguments when I was done with  
them.  But I thought it was odd that the documentation did not say so  
explicitly, so I did a little experiment, and learned that - 
retainArguments also adds them to the autorelease pool!  Presumably (I  
hope) this happens when and in the thread where the invocation is  
invoked.


The code and results are below.  Whether -retainArguments is commented  
out or not, the target (Target) and the argument (StringWrapper) both  
get deallocced just the same.  If -retainArguments is commented out,  
the final NSLog() does cause a crash, but that is expected since in  
this case the target and argument have not been placed in the  
autorelease pool by the action of -retainArguments.


If anyone sees anything wrong with my explanation, please reply.  I'm  
using NSInvocation alot.



-- CONSOLE OUTPUT  --

2009-07-31 23:08:56.848 Test[48825:10b] retainCounts:  target=1   
stringWrapper=1
2009-07-31 23:08:56.854 Test[48825:10b] retainCounts:  target=2   
stringWrapper=2

2009-07-31 23:08:56.860 Test[48825:10b] Hello
2009-07-31 23:08:56.861 Test[48825:10b] retainCounts:  target=2   
stringWrapper=2
2009-07-31 23:08:56.862 Test[48825:10b] retainCounts:  target=1   
stringWrapper=1

2009-07-31 23:08:56.864 Test[48825:10b] dealloccing Target
2009-07-31 23:08:56.871 Test[48825:10b] dealloccing MyString

-- CODE --

#import 

@interface StringWrapper :NSObject{
NSString* string ;
}

@property (retain) NSString* string ;
- (id) initWithString:(NSString*)string ;

@end

@implementation StringWrapper

@synthesize string ;
- (id) initWithString:(NSString*)string_ {
self = [super init];
if (self != nil) {
[self setString:string_] ;
}
return self;
}

- (void)dealloc {
NSLog(@"dealloccing MyString") ;
[string release] ;
[super dealloc] ;
}

@end


@interface Target : NSObject {

}

- (void)logThis:(StringWrapper*)what ;

@end

@implementation Target

- (void)logThis:(StringWrapper*)what {
NSLog([what string]) ;
}

- (void)dealloc {
NSLog(@"dealloccing Target") ;
[super dealloc] ;
}

@end


int main (int argc, const char * argv[]) {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init] ;

Target* target = [[Target alloc] init] ;
SEL selector = @selector(logThis:) ;
NSMethodSignature* methSig = [target  
methodSignatureForSelector:selector] ;


NSInvocation* invoc = [NSInvocation  
invocationWithMethodSignature:methSig] ;

[invoc setTarget:target] ;
[invoc setSelector:selector] ;
StringWrapper* stringWrapper = [[StringWrapper alloc]  
initWithString:@"Hello"] ;

[invoc setArgument:&stringWrapper
   atIndex:2] ;

NSLog(@"retainCounts:  target=%d  stringWrapper=%d",
  [target retainCount],
  [stringWrapper retainCount]) ;

// Here's the retainArguments which may be commented out:
[invoc retainArguments] ;
NSLog(@"retainCounts:  target=%d  stringWrapper=%d",
  [target retainCount],
  [stringWrapper retainCount]) ;

[invoc invoke] ;
NSLog(@"retainCounts:  target=%d  stringWrapper=%d",
  [target retainCount],
  [stringWrapper retainCount]) ;

[target release] ;
[stringWrapper release] ;

NSLog(@"retainCounts:  target=%d  stringWrapper=%d",
  [target retainCount],
  [stringWrapper retainCount]) ;

[pool release] ;
}

___

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

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

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

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