Re: Getting warning when saving merged MOC

2010-01-05 Thread Rob Keniger

On 05/01/2010, at 5:35 PM, Rick Mann wrote:

> Am I doing something wrong, or failing to take some step to avoid this 
> confusion? There may be legitimate changes in MOC A that need to be saved, 
> but the merged changes should already be in the store.


When doing things like this that you don't want the undo manager to pick up on, 
you just need to disable undo while you perform the operation, making sure you 
flush changes before re-enabling it:

[moc processPendingChanges];
[[moc undoManager] disableUndoRegistration];

//do some stuff that alters the moc

[moc processPendingChanges];
[[moc undoManager] enableUndoRegistration];

--
Rob Keniger



___

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

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

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

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


Re: Getting warning when saving merged MOC

2010-01-05 Thread Rick Mann

On Jan 5, 2010, at 00:07:55, Rob Keniger wrote:

> 
> On 05/01/2010, at 5:35 PM, Rick Mann wrote:
> 
>> Am I doing something wrong, or failing to take some step to avoid this 
>> confusion? There may be legitimate changes in MOC A that need to be saved, 
>> but the merged changes should already be in the store.
> 
> 
> When doing things like this that you don't want the undo manager to pick up 
> on, you just need to disable undo while you perform the operation, making 
> sure you flush changes before re-enabling it:
> 
> [moc processPendingChanges];
> [[moc undoManager] disableUndoRegistration];
> 
> //do some stuff that alters the moc
> 
> [moc processPendingChanges];
> [[moc undoManager] enableUndoRegistration];

Well, bracketing the merge call with that prevents the first MOC from showing 
as dirty, but if I make a subsequent change to it, and then try to save, I 
still get that warning that another app has modified the data, and those 
changes will be lost if I continue.

___

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

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

2010-01-05 Thread Jeremy Pereira

On 5 Jan 2010, at 05:09, Eric E. Dolecki wrote:

> 
> - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName
> namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
> attributes:(NSDictionary *)attributeDict {
> 
> NSLog(@"didStartElement");
> 
> //not sure how to handle namespaces in obj-c
> 
> if( [elementName isEqualToString:@"yweather:condition"]){
> 
> NSString *thisOwner = [attributeDict objectForKey:@"text"];
> 
> NSLog(@"%@", thisOwner);
> 
> }
> 
> }
> 
> 

I'm fairly sure that, if you are processing namespaces, elementName will not 
have the prefix when it comes in.  Instead, the parser will maintain a mapping 
between the namespace URI and the prefix.  You need to test that the passed in 
namespaceURI matches the URI you are interested in and the elementName is the 
element name you are interested in.

qName will contain the prefix, but if you use that to do the test, you'll have 
to track how the prefixes are currently mapped (there's a delegate method to 
help you with that), parse out the prefix and look up its namespace. The reason 
is that for any given element you can't guarantee that the condition element 
will always be prefixed by "yweather", it depends on the previous xmlns 
mapping, nor can you guarantee that the yweather prefix always refers to the 
namespace for Yahoo weather XML, nor can you even guarantee there will even be 
a prefix e.g.

http://yahoo.weather.namespace";>

is perfectly acceptable.

> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/adc%40jeremyp.net
> 
> This email sent to a...@jeremyp.net


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___

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

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

2010-01-05 Thread Eric E. Dolecki
Immediately after the [parser parse] I check it:

if( [parser parseError]){
NSLog(@"parse error");
}

This always fires - but I think that the XML is valid. My delegate methods
aren't firing at all - so I don't think it's a namespace issue. Does the
code seem okay?

If I dump the stringReply into a UIWebView it renders it fine. I just want
to pull out current conditions and get the image (gif) to display in a
UIImageView...



On Tue, Jan 5, 2010 at 6:38 AM, Jeremy Pereira  wrote:

>
> On 5 Jan 2010, at 05:09, Eric E. Dolecki wrote:
>
> >
> > - (void)parser:(NSXMLParser *)parser didStartElement:(NSString
> *)elementName
> > namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
> > attributes:(NSDictionary *)attributeDict {
> >
> > NSLog(@"didStartElement");
> >
> > //not sure how to handle namespaces in obj-c
> >
> > if( [elementName isEqualToString:@"yweather:condition"]){
> >
> > NSString *thisOwner = [attributeDict objectForKey:@"text"];
> >
> > NSLog(@"%@", thisOwner);
> >
> > }
> >
> > }
> >
> >
>
> I'm fairly sure that, if you are processing namespaces, elementName will
> not have the prefix when it comes in.  Instead, the parser will maintain a
> mapping between the namespace URI and the prefix.  You need to test that the
> passed in namespaceURI matches the URI you are interested in and the
> elementName is the element name you are interested in.
>
> qName will contain the prefix, but if you use that to do the test, you'll
> have to track how the prefixes are currently mapped (there's a delegate
> method to help you with that), parse out the prefix and look up its
> namespace. The reason is that for any given element you can't guarantee that
> the condition element will always be prefixed by "yweather", it depends on
> the previous xmlns mapping, nor can you guarantee that the yweather prefix
> always refers to the namespace for Yahoo weather XML, nor can you even
> guarantee there will even be a prefix e.g.
>
> http://yahoo.weather.namespace";>
>
> is perfectly acceptable.
>
> > ___
> >
> > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> >
> > Please do not post admin requests or moderator comments to the list.
> > Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> >
> > Help/Unsubscribe/Update your Subscription:
> > http://lists.apple.com/mailman/options/cocoa-dev/adc%40jeremyp.net
> >
> > This email sent to a...@jeremyp.net
>
>
> __
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> __
>



-- 
http://ericd.net
Interactive design and development
___

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

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

2010-01-05 Thread Quincey Morris
On Jan 4, 2010, at 23:35, Rick Mann wrote:

> I'm slowly but surely getting the hang of using multiple MOCs. I'm 
> successfully creating objects in MOC B and merging those changes into the 
> existing MOC A, and seeing the UI bound to MOC A update to reflect the 
> changes.
> 
> The problem I'm seeing now is that MOC A then becomes dirty, and wants to be 
> saved. If I save it, I get a warning that "This document’s file has been 
> changed by another application since you opened or saved it. The changes made 
> by the other application will be lost if you save. Save anyway?"
> 
> The thing that's a bit wonky here is that these changes are already saved in 
> the store, because that's how the MOCs got merged in the first place (the 
> dirty flag is being set by my call to 
> -mergeChangesFromContextDidSaveNotification:). There's definitely no other 
> app involved.
> 
> The changes in MOC B consist of all new objects, and a relationship between 
> an old object and a new one. This is a to-many relationship, that is, the old 
> Group entity picks up another Part entity.
> 
> Am I doing something wrong, or failing to take some step to avoid this 
> confusion? There may be legitimate changes in MOC A that need to be saved, 
> but the merged changes should already be in the store.

Are you using NSPersistentDocument? In that case, the Core Data 'save:' is 
integrated into the document save mechanism, and additionally calling 'save:' 
yourself is going to mess up the document state in precisely the way you 
described above.

That said, the problem is just that the modification date of the opened 
document file has changed since it was originally opened (because of the Core 
Data 'save:' call), but there's nothing really wrong. It's supposed to be 
possible to call -[NSDocument setModificationDate:] to update the document's 
internal state, and the warning should no longer appear. (However, whenever 
this comes up on the list, the OP usually seems to come back to report "it 
doesn't work". Finding the right place to put this call seems to be a 
challenge.)

Even if you can cause the warning to be suppressed, also consider what you are 
actually doing, which is destroying the standard/expected document metaphor. 
Once you call 'save:' outside of the context of a document save, you can no 
longer revert the document, or close it without saving changes (in the sense of 
leaving the original untouched), and Save As... won't have the usual semantics. 
There may well be undo-related issues as well.

The very fact that you need to call 'save:' yourself is a strong indication 
that a document architecture isn't really a good fit with your functional 
requirements. I understand that the standard document behavior is very 
convenient and compelling, but the marriage of NSDocument and CoreData is 
uneasy at the best of times.


___

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

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

2010-01-05 Thread Eric E. Dolecki
I take that back - I was adding a header to the returned XML which already
had one. If I don't do that, I don't get a parsing error, but I don't get
any delegate methods fired after the parse is called. Do I need to assign a
delegate someplace else besides the [parser setDelegate:self] ?


On Tue, Jan 5, 2010 at 8:26 AM, Eric E. Dolecki  wrote:

> Immediately after the [parser parse] I check it:
>
> if( [parser parseError]){
> NSLog(@"parse error");
> }
>
> This always fires - but I think that the XML is valid. My delegate methods
> aren't firing at all - so I don't think it's a namespace issue. Does the
> code seem okay?
>
> If I dump the stringReply into a UIWebView it renders it fine. I just want
> to pull out current conditions and get the image (gif) to display in a
> UIImageView...
>
>
>
> On Tue, Jan 5, 2010 at 6:38 AM, Jeremy Pereira  wrote:
>
>>
>> On 5 Jan 2010, at 05:09, Eric E. Dolecki wrote:
>>
>> >
>> > - (void)parser:(NSXMLParser *)parser didStartElement:(NSString
>> *)elementName
>> > namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
>> > attributes:(NSDictionary *)attributeDict {
>> >
>> > NSLog(@"didStartElement");
>> >
>> > //not sure how to handle namespaces in obj-c
>> >
>> > if( [elementName isEqualToString:@"yweather:condition"]){
>> >
>> > NSString *thisOwner = [attributeDict objectForKey:@"text"];
>> >
>> > NSLog(@"%@", thisOwner);
>> >
>> > }
>> >
>> > }
>> >
>> >
>>
>> I'm fairly sure that, if you are processing namespaces, elementName will
>> not have the prefix when it comes in.  Instead, the parser will maintain a
>> mapping between the namespace URI and the prefix.  You need to test that the
>> passed in namespaceURI matches the URI you are interested in and the
>> elementName is the element name you are interested in.
>>
>> qName will contain the prefix, but if you use that to do the test, you'll
>> have to track how the prefixes are currently mapped (there's a delegate
>> method to help you with that), parse out the prefix and look up its
>> namespace. The reason is that for any given element you can't guarantee that
>> the condition element will always be prefixed by "yweather", it depends on
>> the previous xmlns mapping, nor can you guarantee that the yweather prefix
>> always refers to the namespace for Yahoo weather XML, nor can you even
>> guarantee there will even be a prefix e.g.
>>
>> http://yahoo.weather.namespace";>
>>
>> is perfectly acceptable.
>>
>> > ___
>> >
>> > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> >
>> > Please do not post admin requests or moderator comments to the list.
>> > Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> >
>> > Help/Unsubscribe/Update your Subscription:
>> > http://lists.apple.com/mailman/options/cocoa-dev/adc%40jeremyp.net
>> >
>> > This email sent to a...@jeremyp.net
>>
>>
>> __
>> This email has been scanned by the MessageLabs Email Security System.
>> For more information please visit http://www.messagelabs.com/email
>> __
>>
>
>
>
> --
> http://ericd.net
> Interactive design and development
>



-- 
http://ericd.net
Interactive design and development
___

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

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

2010-01-05 Thread Sander Stoks
> I don't think Quartz's text renderer uses hinting in the normal sense;
> this is part of why text looks different on Mac than on Windows. (Subpixel
> anti-aliasing largely removes the need for hinting, and makes the hints
> actually mess up the shape of the glyphs.)

I know, that's why I was so surprised.

> I'm not sure why you're getting this result. Are you just applying a
> rotation transform to the NSGraphicsContext and then drawing the NSString?
> Have you tried using the lower-level CG APIs instead (it shouldn't make a
> difference, but you never know.)

AFAIK, it's always Quartz doing the actual drawing.  I wanted to use Cocoa
here (in my otherwise Quartz-only drawing code) because the Quartz stuff
is a little low-level for my needs.  Things like ligature-substitution
happen above Quartz.

I indeed just apply an NSAffineTransform to the current context.

I think I'll have to do what PCWiz suggested, and draw into an offscreen
bitmap context.  Problem is, I want my app to support PDF-output as well,
in which case I probably want to output the "real" rotated text (and leave
it up to the PDF renderer to do its job right).  Rendering to bitmap also
means I'm introducing "resolution" in a so far purely vector-oriented app.
 Hrmm.

An alternative would be to extract the actual Beziers, apply the transform
to those, and do my own anti-aliased Bezier drawing (like AntiGrain) but
that sounds like a lot of work...

Thanks for your suggestions,
Sander

___

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

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

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

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


Using AppleEvents to copy and past text from any application

2010-01-05 Thread Jesse Grosjean
I'm developing a small open source app called QuickCursor.

- http://www.hogbaysoftware.com/products/quickcursor/
- http://github.com/jessegrosjean/quickcursor

The idea is to replace the input manage based "edit in" features with
a generic program that provides the same feature, but using public
API's instead of input manage hacks.

Right now QuickCursor works through the accessibility api to
read/write text from the target app. This works well for many apps
(ones that expose their text as a single writable string attribute to
the accessibility api), but not all apps do that. And as a result
QuickCursor doesn't work everywhere. And so I'm looking for an
alternative idea. The accessibility api also has a problem that it
seems to mess up the undo stack in some programs.

Someone suggested that I use AppleEvents to automate select
all/copy/paste out of and then back into the target app. That would
seem to be a greate approach, but I'm not sure how to do it. Is there
anyone on this list who would be willing to help? Via the
accessibility API I can get/set the current process and the current
focused element. But then I need help sending an apple event to select
all, and copy the text. And on the return trip I need help pasting in
new text.

Thanks,
Jesse
___

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

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

2010-01-05 Thread Jean-Daniel Dupas

Le 5 janv. 2010 à 16:44, Sander Stoks a écrit :

>> I don't think Quartz's text renderer uses hinting in the normal sense;
>> this is part of why text looks different on Mac than on Windows. (Subpixel
>> anti-aliasing largely removes the need for hinting, and makes the hints
>> actually mess up the shape of the glyphs.)
> 
> I know, that's why I was so surprised.
> 
>> I'm not sure why you're getting this result. Are you just applying a
>> rotation transform to the NSGraphicsContext and then drawing the NSString?
>> Have you tried using the lower-level CG APIs instead (it shouldn't make a
>> difference, but you never know.)
> 
> AFAIK, it's always Quartz doing the actual drawing.  I wanted to use Cocoa
> here (in my otherwise Quartz-only drawing code) because the Quartz stuff
> is a little low-level for my needs.  Things like ligature-substitution
> happen above Quartz.
> 

You may also try to use something between Quartz and Cocoa, that is CoreText.

AFAIK it also supports advanced typographic features and will let you place the 
text wherever you want.


-- Jean-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: Using AppleEvents to copy and past text from any application

2010-01-05 Thread Jean-Daniel Dupas

Le 5 janv. 2010 à 16:46, Jesse Grosjean a écrit :

> I'm developing a small open source app called QuickCursor.
> 
> - http://www.hogbaysoftware.com/products/quickcursor/
> - http://github.com/jessegrosjean/quickcursor
> 
> The idea is to replace the input manage based "edit in" features with
> a generic program that provides the same feature, but using public
> API's instead of input manage hacks.
> 
> Right now QuickCursor works through the accessibility api to
> read/write text from the target app. This works well for many apps
> (ones that expose their text as a single writable string attribute to
> the accessibility api), but not all apps do that. And as a result
> QuickCursor doesn't work everywhere. And so I'm looking for an
> alternative idea. The accessibility api also has a problem that it
> seems to mess up the undo stack in some programs.
> 
> Someone suggested that I use AppleEvents to automate select
> all/copy/paste out of and then back into the target app. That would
> seem to be a greate approach, but I'm not sure how to do it. Is there
> anyone on this list who would be willing to help?

I'm not sure this is the way to go. 
You will encounter the same issue than with Accessibility API. The target 
application has to support it. 
In fact, I'm pretty sure there is far less app with scriptability enabled than 
app with accessibility available.

-- Jean-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: Using AppleEvents to copy and past text from any application

2010-01-05 Thread Jesse Grosjean
I know most apps don't support AppleScript directly, but I thought
there was some way to automatically script the menu items of most
apps.

But wait... I bet I can already call those menu items through the
accessibility API anyway! So I guess I probably don't need
AppleEvents. Thanks for your response, made me think just a bit
furthur I can probably work through this solution myself now.

Jesse

On Tue, Jan 5, 2010 at 11:02 AM, Jean-Daniel Dupas
 wrote:
>
> Le 5 janv. 2010 à 16:46, Jesse Grosjean a écrit :
>
> I'm developing a small open source app called QuickCursor.
>
> - http://www.hogbaysoftware.com/products/quickcursor/
> - http://github.com/jessegrosjean/quickcursor
>
> The idea is to replace the input manage based "edit in" features with
> a generic program that provides the same feature, but using public
> API's instead of input manage hacks.
>
> Right now QuickCursor works through the accessibility api to
> read/write text from the target app. This works well for many apps
> (ones that expose their text as a single writable string attribute to
> the accessibility api), but not all apps do that. And as a result
> QuickCursor doesn't work everywhere. And so I'm looking for an
> alternative idea. The accessibility api also has a problem that it
> seems to mess up the undo stack in some programs.
>
> Someone suggested that I use AppleEvents to automate select
> all/copy/paste out of and then back into the target app. That would
> seem to be a greate approach, but I'm not sure how to do it. Is there
> anyone on this list who would be willing to help?
>
> I'm not sure this is the way to go.
> You will encounter the same issue than with Accessibility API. The target
> application has to support it.
> In fact, I'm pretty sure there is far less app with scriptability enabled
> than app with accessibility available.
> -- Jean-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


How to enforce a single NSDocument ... or should I do something else?

2010-01-05 Thread Martin Stanley
I have a Core-Date application that uses the Cocoa Document architecture 
(NSPersistentDocument) and would like to ensure that the user only can have 1 
document open at a time. Think of this application as similar to Mail.app or 
Addressbook.app, etc. except that I would like the user to be able to open 
different persistent stores at will, just not simultaneously.

(As an aside, the reason for this is because my document has many related 
windows and I think it would be confusing for the user. It would not be obvious 
which auxiliary window relates  to which document. I may fix this in the future 
by using the concept of Inspectors, but at this point I'm not sure if this is 
the correct model.)

I searched extensively and came up with the recommendation that I subclass 
NSDocumentController and override:
- (id)openDocumentWithContentsOfURL:display:error:
This was recommended over simply trapping the open menu item(s).


This seemed very promising until I ran into a stumbling block. In 
openDocumentWithContentsOfURL:display:error: I check to see if there is an 
already open document and if so call:  
canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo:
with an appropriate delegate and selector. The problem is that this returns 
immediately, even in the case when the document is dirty and it presents a 
modal dialog to the user. Because of this, the 2nd document is opened before I 
have a chance to deal with the first one.

All of this is making me wonder if I'm taking the wrong approach. 

Should I figure out a way to prevent the 2nd document from opening before the 
first one is either saved or abandoned: (override 
canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo: in my 
NSPersistentDocument subclass)? This feels like the solution is getting uglier 
by the minute.

Or is there a much easier way to accomplish what I want to do? Or should I be 
looking at a entirely different approach for my application?

Thanks,
Martin

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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 enforce a single NSDocument ... or should I do something else?

2010-01-05 Thread Mike Abdullah
Override -openDocumentWithContentsOfURL:

1. If you've already got a document open, send -canCloseDocument… to the open 
document, supplying the callback info

2. Either:
A) Return nil and an NSUserCancelled error.
B) Return the existing document.

3. When you get the callback from -canCloseDocument… call super's 
implementation of -openDocumentWithContentsOfURL:

On 5 Jan 2010, at 16:45, Martin Stanley wrote:

> I have a Core-Date application that uses the Cocoa Document architecture 
> (NSPersistentDocument) and would like to ensure that the user only can have 1 
> document open at a time. Think of this application as similar to Mail.app or 
> Addressbook.app, etc. except that I would like the user to be able to open 
> different persistent stores at will, just not simultaneously.
> 
> (As an aside, the reason for this is because my document has many related 
> windows and I think it would be confusing for the user. It would not be 
> obvious which auxiliary window relates  to which document. I may fix this in 
> the future by using the concept of Inspectors, but at this point I'm not sure 
> if this is the correct model.)
> 
> I searched extensively and came up with the recommendation that I subclass 
> NSDocumentController and override:
>   - (id)openDocumentWithContentsOfURL:display:error:
> This was recommended over simply trapping the open menu item(s).
> 
> 
> This seemed very promising until I ran into a stumbling block. In 
> openDocumentWithContentsOfURL:display:error: I check to see if there is an 
> already open document and if so call:
>   canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo:
> with an appropriate delegate and selector. The problem is that this returns 
> immediately, even in the case when the document is dirty and it presents a 
> modal dialog to the user. Because of this, the 2nd document is opened before 
> I have a chance to deal with the first one.
> 
> All of this is making me wonder if I'm taking the wrong approach. 
> 
> Should I figure out a way to prevent the 2nd document from opening before the 
> first one is either saved or abandoned: (override 
> canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo: in my 
> NSPersistentDocument subclass)? This feels like the solution is getting 
> uglier by the minute.
> 
> Or is there a much easier way to accomplish what I want to do? Or should I be 
> looking at a entirely different approach for my application?
> 
> Thanks,
> Martin
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
> 
> This email sent to cocoa...@mikeabdullah.net

___

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

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

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

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


Re: Turn off font hinting?

2010-01-05 Thread Alastair Houghton
On 4 Jan 2010, at 21:47, Sander Stoks wrote:

> I wrote some code to draw an NSString rotated by an arbitrary angle, which 
> can be manipulated interactively.  The results are surprisingly bad (compared 
> to how good font rendering is in general on the Mac).  Most notably, the 
> character positions "jump around" in whole pixel increments while I'm 
> rotating the text.  Usually, this is caused by hinting which tries to place 
> vertical and horizontal lines at integer pixels.  Does anyone know of a way 
> to switch this off (temporarily) for a given context?

How are you drawing your NSString?  Are you using NSLayoutManager?  If so, try 
sending your layout manager the -setUsesScreenFonts: message with the argument 
NO and see if that fixes the 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


New Tablet

2010-01-05 Thread Gordon Apple
I realize that we are not going to get any answers here at this time.  My
question is whether developer info will be forthcoming simultaneously with
the announcement expected later this month (according to today's WSJ
article).  It would be nice to know if this is a full MacOS/Cocoa or an
extended iPhone OS device.  (When can I place my developer order? :-)


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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 enforce a single NSDocument ... or should I do something else?

2010-01-05 Thread Martin Stanley
Thanks for the very quick response! 

I don't quite understand step 2:  how do I decide what to return from 
-openDocumentWithContentsOfURL:  if the callback hasn't been called yet and 
therefore I don't know if the user cancelled the close of the first document?

I think the basic problem for me is that  -canCloseDocument… does not block.

Martin


On 2010-01-05, at 12:10 PM, Mike Abdullah wrote:

> Override -openDocumentWithContentsOfURL:
> 
> 1. If you've already got a document open, send -canCloseDocument… to the open 
> document, supplying the callback info
> 
> 2. Either:
>   A) Return nil and an NSUserCancelled error.
>   B) Return the existing document.
> 
> 3. When you get the callback from -canCloseDocument… call super's 
> implementation of -openDocumentWithContentsOfURL:
> 
> On 5 Jan 2010, at 16:45, Martin Stanley wrote:
> 
>> I have a Core-Date application that uses the Cocoa Document architecture 
>> (NSPersistentDocument) and would like to ensure that the user only can have 
>> 1 document open at a time. Think of this application as similar to Mail.app 
>> or Addressbook.app, etc. except that I would like the user to be able to 
>> open different persistent stores at will, just not simultaneously.
>> 
>> (As an aside, the reason for this is because my document has many related 
>> windows and I think it would be confusing for the user. It would not be 
>> obvious which auxiliary window relates  to which document. I may fix this in 
>> the future by using the concept of Inspectors, but at this point I'm not 
>> sure if this is the correct model.)
>> 
>> I searched extensively and came up with the recommendation that I subclass 
>> NSDocumentController and override:
>>  - (id)openDocumentWithContentsOfURL:display:error:
>> This was recommended over simply trapping the open menu item(s).
>> 
>> 
>> This seemed very promising until I ran into a stumbling block. In 
>> openDocumentWithContentsOfURL:display:error: I check to see if there is an 
>> already open document and if so call:   
>>  canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo:
>> with an appropriate delegate and selector. The problem is that this returns 
>> immediately, even in the case when the document is dirty and it presents a 
>> modal dialog to the user. Because of this, the 2nd document is opened before 
>> I have a chance to deal with the first one.
>> 
>> All of this is making me wonder if I'm taking the wrong approach. 
>> 
>> Should I figure out a way to prevent the 2nd document from opening before 
>> the first one is either saved or abandoned: (override 
>> canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo: in my 
>> NSPersistentDocument subclass)? This feels like the solution is getting 
>> uglier by the minute.
>> 
>> Or is there a much easier way to accomplish what I want to do? Or should I 
>> be looking at a entirely different approach for my application?
>> 
>> Thanks,
>> Martin
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
>> 
>> This email sent to cocoa...@mikeabdullah.net
> 

___

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

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

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

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


Re: New Tablet

2010-01-05 Thread Shawn Erickson
On Tue, Jan 5, 2010 at 9:33 AM, Gordon Apple  wrote:
> I realize that we are not going to get any answers here at this time.  My
> question is whether developer info will be forthcoming simultaneously with
> the announcement expected later this month (according to today's WSJ
> article).  It would be nice to know if this is a full MacOS/Cocoa or an
> extended iPhone OS device.  (When can I place my developer order? :-)

We will have to wait until Apple announces the product (assuming one
exists) and their 3rd party development plans for it. Idle speculation
isn't on topic for this list.

-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


Re: Getting warning when saving merged MOC

2010-01-05 Thread Rick Mann

On Jan 5, 2010, at 05:30:59, Quincey Morris wrote:

> On Jan 4, 2010, at 23:35, Rick Mann wrote:
> 
>> I'm slowly but surely getting the hang of using multiple MOCs. I'm 
>> successfully creating objects in MOC B and merging those changes into the 
>> existing MOC A, and seeing the UI bound to MOC A update to reflect the 
>> changes.
>> 
>> The problem I'm seeing now is that MOC A then becomes dirty, and wants to be 
>> saved. If I save it, I get a warning that "This document’s file has been 
>> changed by another application since you opened or saved it. The changes 
>> made by the other application will be lost if you save. Save anyway?"
>> 
>> The thing that's a bit wonky here is that these changes are already saved in 
>> the store, because that's how the MOCs got merged in the first place (the 
>> dirty flag is being set by my call to 
>> -mergeChangesFromContextDidSaveNotification:). There's definitely no other 
>> app involved.
>> 
>> The changes in MOC B consist of all new objects, and a relationship between 
>> an old object and a new one. This is a to-many relationship, that is, the 
>> old Group entity picks up another Part entity.
>> 
>> Am I doing something wrong, or failing to take some step to avoid this 
>> confusion? There may be legitimate changes in MOC A that need to be saved, 
>> but the merged changes should already be in the store.
> 
> Are you using NSPersistentDocument? In that case, the Core Data 'save:' is 
> integrated into the document save mechanism, and additionally calling 'save:' 
> yourself is going to mess up the document state in precisely the way you 
> described above.
> 
> That said, the problem is just that the modification date of the opened 
> document file has changed since it was originally opened (because of the Core 
> Data 'save:' call), but there's nothing really wrong. It's supposed to be 
> possible to call -[NSDocument setModificationDate:] to update the document's 
> internal state, and the warning should no longer appear. (However, whenever 
> this comes up on the list, the OP usually seems to come back to report "it 
> doesn't work". Finding the right place to put this call seems to be a 
> challenge.)
> 
> Even if you can cause the warning to be suppressed, also consider what you 
> are actually doing, which is destroying the standard/expected document 
> metaphor. Once you call 'save:' outside of the context of a document save, 
> you can no longer revert the document, or close it without saving changes (in 
> the sense of leaving the original untouched), and Save As... won't have the 
> usual semantics. There may well be undo-related issues as well.
> 
> The very fact that you need to call 'save:' yourself is a strong indication 
> that a document architecture isn't really a good fit with your functional 
> requirements. I understand that the standard document behavior is very 
> convenient and compelling, but the marriage of NSDocument and CoreData is 
> uneasy at the best of times.

I grant that I'm using NSPersistentDocument in a nonstandard way. I have a 
Library of Parts (and a Group hierarchy). This Library is managed by a 
LibraryDoc which inherits from NSPersistentDocument, and I consider this use to 
be "standard." When the user creates a new Part, I instantiate a PartDoc (also 
subclassing NSPersistentDocument), and set its MOC to be a new one instantiated 
using the NSPersistentStoreCoordinator of the LibraryDoc. I consider this 
document to be "non-standard," and I override and manage the saving a little 
more directly: instead of presenting the user with a standard put file dialog, 
instead I show them a custom dialog for naming the part, and call -save: on the 
MOC. The LibraryDoc listens for the notification of the MOC save, and calls 
merge: to update it's MOC's state. All of this works as one would expect.

From what I've learned of Core Data, this is intended use (of Core Data, 
perhaps not of NSPersDoc in my PartDoc class). It's when I make changes to the 
LibraryDoc's MOC and try to save that I run into this problem. Perhaps it will 
be enough to update the mod date; I'll try that tonight.

I'm not sure what you mean by "the marriage of NSDocument and CoreData." Did 
you mean to say "NSPersistentDocument?" If so, this statement seems to suggest 
Apple's implementation is just buggy. Clearly, Apple intends the two to be used 
together.

cheers,
Rick


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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 binding search field predicate to derived core data property

2010-01-05 Thread Martin Hewitson
Dear list,

I have a core-data entity which has a derived read only property declared as 
below.

I then have a search field on the UI with a predicate bound to the array 
controller for the entity with the predicate format being:

"contentString contains $value"

When I run this the app crashes and I get the following back-trace from gdb:

Program received signal:  “EXC_BAD_ACCESS”.
sharedlibrary apply-load-rules all
(gdb) bt
#0  0x7fff8665611c in objc_msgSend ()
#1  0x7fff86add30a in -[NSInPredicateOperator 
performPrimitiveOperationUsingObject:andObject:] ()
#2  0x7fff86a4055d in -[NSComparisonPredicate 
evaluateWithObject:substitutionVariables:] ()
#3  0x7fff86a403a2 in _filterObjectsUsingPredicate ()
#4  0x7fff86a7853a in -[NSMutableArray(NSPredicateSupport) 
filterUsingPredicate:] ()
#5  0x7fff817ce4b9 in -[NSArrayController _filterObjects:] ()
#6  0x7fff817bf07f in -[NSArrayController 
_arrangeObjectsWithSelectedObjects:avoidsEmptySelection:operationsMask:useBasis:]
 ()
#7  0x7fff817c718d in -[NSArrayController setFilterPredicate:] ()
#8  0x7fff86a1a429 in -[NSObject(NSKeyValueCoding) setValue:forKey:] ()
#9  0x7fff86a78f2e in -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] ()
#10 0x7fff817d37ad in -[NSBinder 
_setValue:forKeyPath:ofObject:mode:validateImmediately:raisesForNotApplicableKeys:error:]
 ()
#11 0x7fff817d3665 in -[NSBinder setValue:forBinding:error:] ()
#12 0x7fff81bd50e4 in -[NSViewStateBinder 
_setValue:forBinding:errorFallbackMessage:] ()
#13 0x7fff81ab5867 in -[NSSearchFieldBinder performAction:] ()
#14 0x7fff817eaf37 in -[_NSBindingAdaptor 
_objectDidTriggerAction:bindingAdaptor:] ()
#15 0x7fff8175efda in -[NSControl sendAction:to:] ()
#16 0x7fff81ab6080 in -[NSSearchFieldCell(NSSearchFieldCell_Local) 
_sendPartialString] ()
#17 0x7fff86a60a39 in __NSFireTimer ()
#18 0x7fff83e2aa58 in __CFRunLoopRun ()
#19 0x7fff83e28c2f in CFRunLoopRunSpecific ()
#20 0x7fff87207a4e in RunCurrentEventLoopInMode ()
#21 0x7fff872077b1 in ReceiveNextEventCommon ()
#22 0x7fff8720770c in BlockUntilNextEventMatchingListInMode ()
#23 0x7fff8160a1f2 in _DPSNextEvent ()
#24 0x7fff81609b41 in -[NSApplication 
nextEventMatchingMask:untilDate:inMode:dequeue:] ()
#25 0x7fff815cf747 in -[NSApplication run] ()
#26 0x7fff815c8468 in NSApplicationMain ()

Can anyone see what I'm doing wrong (assuming it's my fault, and not a bug) ? 
Alternatively, anyone got a good idea how to debug this?

Best wishes,

Martin

@property (readonly) NSString* contentString;

- (NSString*)contentString
{
NSData *data = [self valueForKey:@"content"];
if (!data || [data length] == 0)
return @"";

NSAttributedString *attStr = [[NSAttributedString alloc] 
initWithRTFD:data


 documentAttributes:nil];
if (!attStr)
return @"";

NSString *contentStr = [attStr string];
[attStr release];

return contentStr;  
}

+ (NSSet *)keyPathsForValuesAffectingContentString
{
return [NSSet setWithObject:@"content"];
}


Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer 
Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: martin.hewit...@aei.mpg.de
WWW: http://www.aei.mpg.de/~hewitson






___

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

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

2010-01-05 Thread John Michael Zorko

Hello, all ...

After [re-]reading the Apple documentation, i'm still not clear as to what 
@optional really does in a @protocol. I thought that declaring certain messages 
as @optional would make the app not crash if a certain message didn't have an 
implementation in a class that adopts the protocol, however i'm finding that 
this isn't the case:

2010-01-05 10:40:58.698 VoxityNowPlaying[14413:207] *** Terminating app due to 
uncaught exception 'NSInvalidArgumentException', reason: '*** 
-[VoxityNowPlayingViewController playerURLFinished:]: unrecognized selector 
sent to instance 0x39138f0'

... yet my protocol is defined thusly:

@protocol VoxityPlayerDelegate 

@optional

- (void)playerURLFinished:(NSURL *)url;

.
.
.

@end

Do I need to wrap code that sends messages to delegates with 
-respondsToSelector? If so, what is the point of @optional in the protocol?

Regards,

John


___

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

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

2010-01-05 Thread Dave DeLong
@optional is a compile-time directive.  It means that objects that conform to 
your protocol don't *have* to implement the method when the code is compiled.  
However, it has nothing to do with runtime-verification.  That is up to you (so 
yes, you should be using respondsToSelector:).

If you didn't have the @optional directive, the call to respondsToSelector: 
would be unnecessary.

Dave

On Jan 5, 2010, at 11:53 AM, John Michael Zorko wrote:

> 
> Hello, all ...
> 
> After [re-]reading the Apple documentation, i'm still not clear as to what 
> @optional really does in a @protocol. I thought that declaring certain 
> messages as @optional would make the app not crash if a certain message 
> didn't have an implementation in a class that adopts the protocol, however 
> i'm finding that this isn't the case:
> 
> 2010-01-05 10:40:58.698 VoxityNowPlaying[14413:207] *** Terminating app due 
> to uncaught exception 'NSInvalidArgumentException', reason: '*** 
> -[VoxityNowPlayingViewController playerURLFinished:]: unrecognized selector 
> sent to instance 0x39138f0'
> 
> ... yet my protocol is defined thusly:
> 
> @protocol VoxityPlayerDelegate 
> 
> @optional
> 
> - (void)playerURLFinished:(NSURL *)url;
> 
> .
> .
> .
> 
> @end
> 
> Do I need to wrap code that sends messages to delegates with 
> -respondsToSelector? If so, what is the point of @optional in the protocol?
> 
> Regards,
> 
> John


smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

Re: How to enforce a single NSDocument ... or should I do something else?

2010-01-05 Thread Mike Abdullah

On 5 Jan 2010, at 17:34, Martin Stanley wrote:

> Thanks for the very quick response! 
> 
> I don't quite understand step 2:  how do I decide what to return from 
> -openDocumentWithContentsOfURL:  if the callback hasn't been called yet and 
> therefore I don't know if the user cancelled the close of the first document?

I mean to say that either approach should work. But I haven't tried them, so 
keep your options open.
> 
> I think the basic problem for me is that  -canCloseDocument… does not block.

Well it can't block, because the sheet needs to be interacted with.
> 
> Martin
> 
> 
> On 2010-01-05, at 12:10 PM, Mike Abdullah wrote:
> 
>> Override -openDocumentWithContentsOfURL:
>> 
>> 1. If you've already got a document open, send -canCloseDocument… to the 
>> open document, supplying the callback info
>> 
>> 2. Either:
>>  A) Return nil and an NSUserCancelled error.
>>  B) Return the existing document.
>> 
>> 3. When you get the callback from -canCloseDocument… call super's 
>> implementation of -openDocumentWithContentsOfURL:
>> 
>> On 5 Jan 2010, at 16:45, Martin Stanley wrote:
>> 
>>> I have a Core-Date application that uses the Cocoa Document architecture 
>>> (NSPersistentDocument) and would like to ensure that the user only can have 
>>> 1 document open at a time. Think of this application as similar to Mail.app 
>>> or Addressbook.app, etc. except that I would like the user to be able to 
>>> open different persistent stores at will, just not simultaneously.
>>> 
>>> (As an aside, the reason for this is because my document has many related 
>>> windows and I think it would be confusing for the user. It would not be 
>>> obvious which auxiliary window relates  to which document. I may fix this 
>>> in the future by using the concept of Inspectors, but at this point I'm not 
>>> sure if this is the correct model.)
>>> 
>>> I searched extensively and came up with the recommendation that I subclass 
>>> NSDocumentController and override:
>>> - (id)openDocumentWithContentsOfURL:display:error:
>>> This was recommended over simply trapping the open menu item(s).
>>> 
>>> 
>>> This seemed very promising until I ran into a stumbling block. In 
>>> openDocumentWithContentsOfURL:display:error: I check to see if there is an 
>>> already open document and if so call:  
>>> canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo:
>>> with an appropriate delegate and selector. The problem is that this returns 
>>> immediately, even in the case when the document is dirty and it presents a 
>>> modal dialog to the user. Because of this, the 2nd document is opened 
>>> before I have a chance to deal with the first one.
>>> 
>>> All of this is making me wonder if I'm taking the wrong approach. 
>>> 
>>> Should I figure out a way to prevent the 2nd document from opening before 
>>> the first one is either saved or abandoned: (override 
>>> canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo: in my 
>>> NSPersistentDocument subclass)? This feels like the solution is getting 
>>> uglier by the minute.
>>> 
>>> Or is there a much easier way to accomplish what I want to do? Or should I 
>>> be looking at a entirely different approach for my application?
>>> 
>>> Thanks,
>>> Martin
>>> 
>>> ___
>>> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>> 
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>> 
>>> Help/Unsubscribe/Update your Subscription:
>>> http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
>>> 
>>> This email sent to cocoa...@mikeabdullah.net
>> 
> 

___

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

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

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

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


Re: iPhone: @protocol and @optional

2010-01-05 Thread Christian Ziegler
Bah Dave was faster :).

John,

you can see it this way: With the @optional directive you tell the compiler not 
to complain if those methods are missing in your class implementing the 
protocol, still the class which invokes those optional methods has to ensure 
that those are implemented.

Cheers,
Chris
 
On Tuesday, January 05, 2010, at 07:58PM, "Dave DeLong"  
wrote:
>@optional is a compile-time directive.  It means that objects that conform to 
>your protocol don't *have* to implement the method when the code is compiled.  
>However, it has nothing to do with runtime-verification.  That is up to you 
>(so yes, you should be using respondsToSelector:).
>
>If you didn't have the @optional directive, the call to respondsToSelector: 
>would be unnecessary.
>
>Dave
>
>On Jan 5, 2010, at 11:53 AM, John Michael Zorko wrote:
>
>> 
>> Hello, all ...
>> 
>> After [re-]reading the Apple documentation, i'm still not clear as to what 
>> @optional really does in a @protocol. I thought that declaring certain 
>> messages as @optional would make the app not crash if a certain message 
>> didn't have an implementation in a class that adopts the protocol, however 
>> i'm finding that this isn't the case:
>> 
>> 2010-01-05 10:40:58.698 VoxityNowPlaying[14413:207] *** Terminating app due 
>> to uncaught exception 'NSInvalidArgumentException', reason: '*** 
>> -[VoxityNowPlayingViewController playerURLFinished:]: unrecognized selector 
>> sent to instance 0x39138f0'
>> 
>> ... yet my protocol is defined thusly:
>> 
>> @protocol VoxityPlayerDelegate 
>> 
>> @optional
>> 
>> - (void)playerURLFinished:(NSURL *)url;
>> 
>> .
>> .
>> .
>> 
>> @end
>> 
>> Do I need to wrap code that sends messages to delegates with 
>> -respondsToSelector? If so, what is the point of @optional in the protocol?
>> 
>> Regards,
>> 
>> John
>
>___
>
>Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
>Please do not post admin requests or moderator comments to the list.
>Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
>Help/Unsubscribe/Update your Subscription:
>http://lists.apple.com/mailman/options/cocoa-dev/chris.ziegler%40me.com
>
>This email sent to chris.zieg...@me.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: iPhone: @protocol and @optional

2010-01-05 Thread Mike Abdullah
Protocols cannot decide or change behaviour of an object. Instead, it is up to 
the object in question to adopt the protocol appropriately. Declaring methods 
as @optional just means that you have a choice whether to implement or not. 
Anyone wanting to call the method should first check if its implemented with 
-respondsToSelector:

On 5 Jan 2010, at 18:53, John Michael Zorko wrote:

> 
> Hello, all ...
> 
> After [re-]reading the Apple documentation, i'm still not clear as to what 
> @optional really does in a @protocol. I thought that declaring certain 
> messages as @optional would make the app not crash if a certain message 
> didn't have an implementation in a class that adopts the protocol, however 
> i'm finding that this isn't the case:
> 
> 2010-01-05 10:40:58.698 VoxityNowPlaying[14413:207] *** Terminating app due 
> to uncaught exception 'NSInvalidArgumentException', reason: '*** 
> -[VoxityNowPlayingViewController playerURLFinished:]: unrecognized selector 
> sent to instance 0x39138f0'
> 
> ... yet my protocol is defined thusly:
> 
> @protocol VoxityPlayerDelegate 
> 
> @optional
> 
> - (void)playerURLFinished:(NSURL *)url;
> 
> .
> .
> .
> 
> @end
> 
> Do I need to wrap code that sends messages to delegates with 
> -respondsToSelector? If so, what is the point of @optional in the protocol?
> 
> Regards,
> 
> John
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
> 
> This email sent to cocoa...@mikeabdullah.net

___

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

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

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

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


Re: iPhone: @protocol and @optional

2010-01-05 Thread John Michael Zorko

Mike et al,

OK, I get it -- @optional in a @protocol is kind of like #pragma warning: 
in (MS) C++ in that it just tells the compiler to not generate specific 
warnings, in this case warnings about a class that doesn't fully implement the 
protocol. I thought it would automatically call -respondsToSelector, but I 
understand that that's runtime behavior, and the protocol doesn't alter what 
the object does in the runtime. Thanks, all!

Regards,

John, who loves it when he learns something and can verify it himself) :-)

On Jan 5, 2010, at 11:06 AM, Mike Abdullah wrote:

> Protocols cannot decide or change behaviour of an object. Instead, it is up 
> to the object in question to adopt the protocol appropriately. Declaring 
> methods as @optional just means that you have a choice whether to implement 
> or not. Anyone wanting to call the method should first check if its 
> implemented with -respondsToSelector:

___

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

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

2010-01-05 Thread Chris Ridd

On 4 Jan 2010, at 13:50, Quincey Morris wrote:

> On Jan 4, 2010, at 02:26, Brian Bruinewoud wrote:
> 
>> What's the best way to get an NSDate object for 'today' such that the time 
>> is 00:00:00 (or any other constant).
>> I not interested in the time, I only care about the year-month-day, but I do 
>> need the the hours-minutes-seconds to be the same on all dates so that I can 
>> compare the dates.
>> 
>> Currently I do this:
>> 
>>   NSDateFormatter *dateFmter = [[NSDateFormatter alloc] init];
>>   [dateFmter setTimeStyle:NSDateFormatterNoStyle];
>>   [dateFmter setDateStyle:NSDateFormatterMediumStyle];
>> 
>>   NSString dateText = [ dateFmter stringFromDate: self.now ]; // !! !! I 
>> need dateText anyway
>> 
>>   self.now = [ dateFmter dateFromString: dateText ]; // !! truncate time to 
>> 00:00:00
>> 
>> But this seems ugly, cumbersome and inefficient.
>> 
>> The other option might be to use NSDate, NSCalendar and NSDateComponents, 
>> but that seems to be even more ugly and cumbersome and probably more 
>> inefficient.
> 
> NSDate is *not* a good choice for these sorts of comparisons, because it's 
> always a date and a time, and it's not as simple as it seems. Consider this 
> (unlikely) example:

However Core Data models "dates" using NSDate. If you needed to model dates 
without times in Core Data (and be able to sort/filter on them) what would you 
do?

Cheers,

Chris
___

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

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

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

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


Re: NSDate without time portion

2010-01-05 Thread David Duncan
On Jan 5, 2010, at 11:23 AM, Chris Ridd wrote:

> However Core Data models "dates" using NSDate. If you needed to model dates 
> without times in Core Data (and be able to sort/filter on them) what would 
> you do?


The typical approach is to normalize your dates to a specific time before 
storing them.
--
David Duncan
Apple DTS Animation and Printing

___

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

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

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

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


Re: NSDate without time portion

2010-01-05 Thread Robert Claeson

On 5 Jan 2010, at 19:23, Chris Ridd wrote:

> 
> On 4 Jan 2010, at 13:50, Quincey Morris wrote:
> 
>> On Jan 4, 2010, at 02:26, Brian Bruinewoud wrote:
>> 
>>> What's the best way to get an NSDate object for 'today' such that the time 
>>> is 00:00:00 (or any other constant).
>>> I not interested in the time, I only care about the year-month-day, but I 
>>> do need the the hours-minutes-seconds to be the same on all dates so that I 
>>> can compare the dates.
>>> 
>>> Currently I do this:
>>> 
>>>  NSDateFormatter *dateFmter = [[NSDateFormatter alloc] init];
>>>  [dateFmter setTimeStyle:NSDateFormatterNoStyle];
>>>  [dateFmter setDateStyle:NSDateFormatterMediumStyle];
>>> 
>>>  NSString dateText = [ dateFmter stringFromDate: self.now ]; // !! !! I 
>>> need dateText anyway
>>> 
>>>  self.now = [ dateFmter dateFromString: dateText ]; // !! truncate time to 
>>> 00:00:00
>>> 
>>> But this seems ugly, cumbersome and inefficient.
>>> 
>>> The other option might be to use NSDate, NSCalendar and NSDateComponents, 
>>> but that seems to be even more ugly and cumbersome and probably more 
>>> inefficient.
>> 
>> NSDate is *not* a good choice for these sorts of comparisons, because it's 
>> always a date and a time, and it's not as simple as it seems. Consider this 
>> (unlikely) example:
> 
> However Core Data models "dates" using NSDate. If you needed to model dates 
> without times in Core Data (and be able to sort/filter on them) what would 
> you do?

By formatting the dates as MMDD and keeping them in strings you can use 
simple string comparison to sort, compare and filter. They are also very easy 
to format for display purposes. If you want to go standard then use the ISO 
8601 date format. It's -MM-DD. See 
http://www.iso.org/iso/date_and_time_format



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

Re: Using AppleEvents to copy and past text from any application

2010-01-05 Thread Nick Paulson
If you have a solution to this, please report back.  I am interested in what 
you come up with.

--Nick Paulson
On Jan 5, 2010, at 11:10 AM, Jesse Grosjean wrote:

> I know most apps don't support AppleScript directly, but I thought
> there was some way to automatically script the menu items of most
> apps.
> 
> But wait... I bet I can already call those menu items through the
> accessibility API anyway! So I guess I probably don't need
> AppleEvents. Thanks for your response, made me think just a bit
> furthur I can probably work through this solution myself now.
> 
> Jesse
> 
> On Tue, Jan 5, 2010 at 11:02 AM, Jean-Daniel Dupas
>  wrote:
>> 
>> Le 5 janv. 2010 à 16:46, Jesse Grosjean a écrit :
>> 
>> I'm developing a small open source app called QuickCursor.
>> 
>> - http://www.hogbaysoftware.com/products/quickcursor/
>> - http://github.com/jessegrosjean/quickcursor
>> 
>> The idea is to replace the input manage based "edit in" features with
>> a generic program that provides the same feature, but using public
>> API's instead of input manage hacks.
>> 
>> Right now QuickCursor works through the accessibility api to
>> read/write text from the target app. This works well for many apps
>> (ones that expose their text as a single writable string attribute to
>> the accessibility api), but not all apps do that. And as a result
>> QuickCursor doesn't work everywhere. And so I'm looking for an
>> alternative idea. The accessibility api also has a problem that it
>> seems to mess up the undo stack in some programs.
>> 
>> Someone suggested that I use AppleEvents to automate select
>> all/copy/paste out of and then back into the target app. That would
>> seem to be a greate approach, but I'm not sure how to do it. Is there
>> anyone on this list who would be willing to help?
>> 
>> I'm not sure this is the way to go.
>> You will encounter the same issue than with Accessibility API. The target
>> application has to support it.
>> In fact, I'm pretty sure there is far less app with scriptability enabled
>> than app with accessibility available.
>> -- Jean-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/cocoa%40nickpaulson.com
> 
> This email sent to co...@nickpaulson.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: NSDate without time portion

2010-01-05 Thread Nick Zitzmann

On Jan 5, 2010, at 12:23 PM, Chris Ridd wrote:

> However Core Data models "dates" using NSDate. If you needed to model dates 
> without times in Core Data (and be able to sort/filter on them) what would 
> you do?

Normalize the time component of the date. One idea is to use 12 PM GMT as a 
constant time, since then the date will be the same date everywhere in the 
world - except in New Zealand, Fiji, Kiribati, Samoa, & other states in the 
GMT+12/13 neighborhood, so you'll have to translate for them. iCal does this 
when synchronizing calendar dates.

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: NSDate without time portion

2010-01-05 Thread Karolis Ramanauskas
>
> By formatting the dates as MMDD and keeping them in strings you can use
> simple string comparison to sort, compare and filter. They are also very
> easy to format for display purposes. If you want to go standard then use the
> ISO 8601 date format. It's -MM-DD. See
> http://www.iso.org/iso/date_and_time_format
>

Great, but do not forget, in this case, to store time zone information too,
perhaps in a separate string. Time offset won't do because it may change for
the same time zone depending on daylight savings time. If I store date as a
string, I also store the associated time zone's "name" property. NSDate is
more than a plain date. It has time zone info embedded. Just try printing
the same date object on daylight savings time date and not, and you will see
the date object automatically adjusts the time. So, hypothetically if you
stored 2009-12-31 as a string. Then created NSDate object from that string.
It may later be interpreted as 2009-12-31 00:00:00 or, let's say 2009-12-30
23:00:00 or 2009-12-31 05:00:00, if the time zone of your user computer
changes. Think, what if you user saves an appointment at 12:00:00 in New
York and you store it as a string with no time zone info? In Chicago, that
appointment will appear at 12:00:00 also even though it is really happening
at 11:00:00.

Peace.
___

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

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

2010-01-05 Thread Quincey Morris
On Jan 5, 2010, at 10:39, Rick Mann wrote:

> I grant that I'm using NSPersistentDocument in a nonstandard way. I have a 
> Library of Parts (and a Group hierarchy). This Library is managed by a 
> LibraryDoc which inherits from NSPersistentDocument, and I consider this use 
> to be "standard." When the user creates a new Part, I instantiate a PartDoc 
> (also subclassing NSPersistentDocument), and set its MOC to be a new one 
> instantiated using the NSPersistentStoreCoordinator of the LibraryDoc. I 
> consider this document to be "non-standard," and I override and manage the 
> saving a little more directly: instead of presenting the user with a standard 
> put file dialog, instead I show them a custom dialog for naming the part, and 
> call -save: on the MOC. The LibraryDoc listens for the notification of the 
> MOC save, and calls merge: to update it's MOC's state. All of this works as 
> one would expect.

Consider how this picture looks if you weren't using Core Data. You'd be 
opening a second NSDocument instance [which NSDocumentController won't do, btw, 
but ignoring that ...] on the same file, doing a save from the second instance, 
then seeing the first instance get confused.

The *key* functionality of NSDocument is its careful and thorough approach to 
guaranteeing file-level atomicity of saving. A document is saved, or it isn't. 
The file [from the user's point of view] is not changed until the user 
explicitly saves, and the file [from the user's point of view] is never in a 
partially saved state. Violate those two principles, and your users will blame 
you just as soon as they accidentally modify files.

What you're describing here is a database application, which has 
transaction-level atomicity of saving at best. (Core Data's 'save:' isn't a 
save in the NSDocument sense. It's more like a transaction commit, and that's 
precisely how you're trying to use it.)

It's not at all obvious from your description why you need a second MOC to add 
a Part (or why that needs to be in its own NSPersistentDocument, though that's 
not the source of you headache, not yet). If it must be so then I suggest at 
least re-evaluating whether you should be using NS[Persistent]Document at all. 
Or, create the new Part in a separate persistent store and copy-via-insert 
rather than merge the objects.

> From what I've learned of Core Data, this is intended use (of Core Data, 
> perhaps not of NSPersDoc in my PartDoc class). It's when I make changes to 
> the LibraryDoc's MOC and try to save that I run into this problem. Perhaps it 
> will be enough to update the mod date; I'll try that tonight.

It's intended use of Core Data, not of NSPersistentDocument.

> I'm not sure what you mean by "the marriage of NSDocument and CoreData." Did 
> you mean to say "NSPersistentDocument?" If so, this statement seems to 
> suggest Apple's implementation is just buggy. Clearly, Apple intends the two 
> to be used together.

I meant this marriage: NSDocument + Core Data = NSPersistentDocument. The 
implementation isn't buggy, it simply hides the full functionality of Core 
Data, and the full functionality of NSDocument. (Notice, for example, that 
NSPersistentDocument can't do a Save To... operation, and its Save As... is a 
little weird too.)


___

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

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

2010-01-05 Thread glenn andreas

On Jan 5, 2010, at 1:48 PM, Karolis Ramanauskas wrote:

>> 
>> By formatting the dates as MMDD and keeping them in strings you can use
>> simple string comparison to sort, compare and filter. They are also very
>> easy to format for display purposes. If you want to go standard then use the
>> ISO 8601 date format. It's -MM-DD. See
>> http://www.iso.org/iso/date_and_time_format
>> 
> 
> Great, but do not forget, in this case, to store time zone information too,
> perhaps in a separate string. Time offset won't do because it may change for
> the same time zone depending on daylight savings time. If I store date as a
> string, I also store the associated time zone's "name" property. NSDate is
> more than a plain date. It has time zone info embedded.

No it doesn't.  NSCalendarDate has a timezone, NSDate does not.

> Just try printing
> the same date object on daylight savings time date and not, and you will see
> the date object automatically adjusts the time. So, hypothetically if you
> stored 2009-12-31 as a string. Then created NSDate object from that string.
> It may later be interpreted as 2009-12-31 00:00:00 or, let's say 2009-12-30
> 23:00:00 or 2009-12-31 05:00:00, if the time zone of your user computer
> changes. Think, what if you user saves an appointment at 12:00:00 in New
> York and you store it as a string with no time zone info? In Chicago, that
> appointment will appear at 12:00:00 also even though it is really happening
> at 11:00:00.


NSDate conceptually store time relative to Jan 1, 2001, GMT.

When it is formatted for display, it uses the current time zone (or more 
correctly, the NSDateFormatter uses whatever time zone has been specified, or 
the current system time zone).  If your time zone changes (such as by daylight 
savings time, or changing the location), the resulting date will print 
differently, but timeIntervalSinceReferenceDate will be unchanged.  It is 
ultimately the date formatter that handles time zones, daylight savings time, 
etc...





Glenn Andreas  gandr...@gandreas.com 
  wicked fun!
Mad, Bad, and Dangerous to Know

___

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

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


[Moderator] Re: New Tablet

2010-01-05 Thread Scott Anguish

On Jan 5, 2010, at 12:45 PM, Shawn Erickson wrote:

> On Tue, Jan 5, 2010 at 9:33 AM, Gordon Apple  wrote:
>> I realize that we are not going to get any answers here at this time.  My
>> question is whether developer info will be forthcoming simultaneously with
>> the announcement expected later this month (according to today's WSJ
>> article).  It would be nice to know if this is a full MacOS/Cocoa or an
>> extended iPhone OS device.  (When can I place my developer order? :-)
> 
> We will have to wait until Apple announces the product (assuming one
> exists) and their 3rd party development plans for it. Idle speculation
> isn't on topic for this list.

Shaun is 100% correct.

And any speculation will lead to a poster’s account being moderated.


___

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

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


[Moderator] Re: New Tablet

2010-01-05 Thread Scott Anguish
This type of speculation is not appropriate for this list.

Discussion of this type will end up with the poster moderated, thusly.

___

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

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

2010-01-05 Thread Chris Ridd

On 5 Jan 2010, at 19:41, Nick Zitzmann wrote:

> 
> On Jan 5, 2010, at 12:23 PM, Chris Ridd wrote:
> 
>> However Core Data models "dates" using NSDate. If you needed to model dates 
>> without times in Core Data (and be able to sort/filter on them) what would 
>> you do?
> 
> Normalize the time component of the date.

Nod, except that this normalization is exactly what was being recommended 
*against* by Quincey :-)

> One idea is to use 12 PM GMT as a constant time, since then the date will be 
> the same date everywhere in the world - except in New Zealand, Fiji, 
> Kiribati, Samoa, & other states in the GMT+12/13 neighborhood, so you'll have 
> to translate for them. iCal does this when synchronizing calendar dates.

Cheers,

Chris
___

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

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

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

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


Re: Weird issue with BDAlias/FSRefs and the case of filesystem paths

2010-01-05 Thread Kyle Sluder
On Mon, Jan 4, 2010 at 11:01 PM, Rob Keniger  wrote:
> In the Finder and when using Terminal, the folder is named "Users". From what 
> I can tell there are no extended attributes on the Users folder, running 
> "xattr -l -v /Users" returns nothing.

The default Users directory has a .localized file in it, which will
cause the Finder to use the system's localized name for the folder
rather than the on-disk name. So the Finder is useless for
investigating this behavior.

If the directory is on a case-insensitive HFS volume (the default), it
won't matter whether you call it "users" or "Users"; either will work.
Therefore `stat /Users` at the Terminal will not provide conclusive
results.

It will also be helpful to see what the value of $HOME is, and if it
jives with the on-disk name.

--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: NSDate without time portion

2010-01-05 Thread Quincey Morris
On Jan 5, 2010, at 11:31, David Duncan wrote:

>> However Core Data models "dates" using NSDate. If you needed to model dates 
>> without times in Core Data (and be able to sort/filter on them) what would 
>> you do?
> 
> 
> The typical approach is to normalize your dates to a specific time before 
> storing them.

On Jan 5, 2010, at 11:41, Nick Zitzmann wrote:

> Normalize the time component of the date. One idea is to use 12 PM GMT as a 
> constant time, since then the date will be the same date everywhere in the 
> world - except in New Zealand, Fiji, Kiribati, Samoa, & other states in the 
> GMT+12/13 neighborhood, so you'll have to translate for them. iCal does this 
> when synchronizing calendar dates.

I'll say this part again, and keep saying it till someone actually tells me I'm 
wrong:

Firstly, you can't *in general* normalize to a specific time, because you can't 
in general know that the time exists on every date. With the daylight savings 
time system used in America, for example, not every date has a 2:30 am, and 
some dates have 2 of them. Whatever time you pick is a *cultural* assumption 
that can't be relied upon for every date in every calendar system -- unless 
Apple has documented somewhere the API contract that every calendar system 
implementation in Mac OS *shall* have a midnight or a noon (say).

Secondly, there's no safe way to normalize to a specific time without using 
NSDateComponents. If you have a NSDate that represents 8 am on a certain day, 
you can't just subtract 8 hours to get midnight. (Think of daylight savings 
again for a counterexample. Or the occasional leap second.) 

Thirdly, however you normalize the time, it's certainly not true that 
differences between normalized dates are multiples of precisely 24 hours, or of 
whole days. Comparisons will be fine, but elapsed days computations will be 
wrong.

I don't see any way to avoid NSDateComponents. Using them, you can reconstruct 
normalized dates (which would be normalized, therefore, to a unique time on 
each date, but not necessarily the same time on all dates), or you can just 
work with the Y-M-D (or even just Y-D) components directly, as integers.

(Well, date strings might be a viable alternative, but it's not obvious that's 
any more elegant overall.)


___

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

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

2010-01-05 Thread David Duncan
On Jan 5, 2010, at 12:15 PM, Chris Ridd wrote:

> On 5 Jan 2010, at 19:41, Nick Zitzmann wrote:
> 
>> 
>> On Jan 5, 2010, at 12:23 PM, Chris Ridd wrote:
>> 
>>> However Core Data models "dates" using NSDate. If you needed to model dates 
>>> without times in Core Data (and be able to sort/filter on them) what would 
>>> you do?
>> 
>> Normalize the time component of the date.
> 
> Nod, except that this normalization is exactly what was being recommended 
> *against* by Quincey :-)


But as Glenn just mentioned, NSDate knows nothing about time zones, daylight's 
savings time, etc. It is just an offset from Midnight 1/1/01 GMT. Everything 
else is a display issue, and as the Core Data documentation warns you must 
store the timezone information separately (which can also mean that you assume 
a standard time zone for all dates you store).
--
David Duncan
Apple DTS Animation and Printing

___

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

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

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

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


Re: NSDate without time portion

2010-01-05 Thread Karolis Ramanauskas
>
> NSDate conceptually store time relative to Jan 1, 2001, GMT.
>
> When it is formatted for display, it uses the current time zone (or more
> correctly, the NSDateFormatter uses whatever time zone has been specified,
> or the current system time zone).  If your time zone changes (such as by
> daylight savings time, or changing the location), the resulting date will
> print differently, but timeIntervalSinceReferenceDate will be unchanged.  It
> is ultimately the date formatter that handles time zones, daylight savings
> time, etc...


HA!, Thanks, I see...

Either way though, If I choose to store the date as a string somewhere, I
would need to store time zone, as this is a lossy way of storing a date. Of
course it may be good to store the date as time relative to Jan 1, 2001,
GMT.
___

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

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

2010-01-05 Thread Nick Zitzmann

On Jan 5, 2010, at 1:23 PM, Quincey Morris wrote:

> Firstly, you can't *in general* normalize to a specific time, because you 
> can't in general know that the time exists on every date.

Unless you use a specific time zone, and store that time zone information 
elsewhere in the model. And if you use GMT, as I mentioned earlier, unless some 
cosmic event happens that disturbs the flow of time, there is no such thing as 
a GMT time that does not exist, since GMT ignores transforms like daylight 
savings.

You're right about NSDateComponents, though.

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: NSDate without time portion

2010-01-05 Thread Robert Claeson

On 5 Jan 2010, at 20:33, Nick Zitzmann wrote:

> 
> On Jan 5, 2010, at 1:23 PM, Quincey Morris wrote:
> 
>> Firstly, you can't *in general* normalize to a specific time, because you 
>> can't in general know that the time exists on every date.
> 
> Unless you use a specific time zone, and store that time zone information 
> elsewhere in the model. And if you use GMT, as I mentioned earlier, unless 
> some cosmic event happens that disturbs the flow of time, there is no such 
> thing as a GMT time that does not exist, since GMT ignores transforms like 
> daylight savings.

Not really. We use GMT (Greenwich, the "G" in GMT, is in North London) here in 
the UK and we do have daylight savings. GMT without daylight savings or any 
other features are commonly referred to as UTC nowadays.

Robert



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

Re: NSDate without time portion

2010-01-05 Thread Nick Zitzmann

On Jan 5, 2010, at 1:40 PM, Robert Claeson wrote:

> Not really. We use GMT (Greenwich, the "G" in GMT, is in North London) here 
> in the UK and we do have daylight savings. GMT without daylight savings or 
> any other features are commonly referred to as UTC nowadays.

To be pedantic, you are correct, though Mac OS X's "GMT" time zone I'm 
referring to is really UTC:

% zdump -v GMT
GMT  Fri Dec 13 20:45:52 1901 UTC = Fri Dec 13 20:45:52 1901 GMT isdst=0
GMT  Sat Dec 14 20:45:52 1901 UTC = Sat Dec 14 20:45:52 1901 GMT isdst=0
GMT  Mon Jan 18 03:14:07 2038 UTC = Mon Jan 18 03:14:07 2038 GMT isdst=0
GMT  Tue Jan 19 03:14:07 2038 UTC = Tue Jan 19 03:14:07 2038 GMT isdst=0

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


Resolution Independence

2010-01-05 Thread Todd Heberlein
A friend of mine loves her new 27" iMac but has complained at how small 
everything is. Searching around on the net I found that it has about a 109 dpi 
pixel density. I also saw today that the new Nexus phone has a pixel size of 
800x480 (as opposed to my iPhone's 480x320 pixel size), and the two together 
got me thinking more seriously about resolution independence again. Other than 
making big icons for my apps, I had pretty much ignored the resolution 
independence issue.

Today I fired up Quartz Debug to set the UI Resolution to a bigger scale, and I 
am happy that my applications did OK.


But how accurate of a test is this compared to real-world resolution 
independence?

Or in other words, is there real resolution independence built into Snow 
Leopard for apps? Can I (or my friend with her 27" iMac) set a scale factor on 
an application without using Quartz Debug?

Is there something similar for iPhone development?

Or is the Xcode mailing list a better place for this question?

Thanks,

Todd

___

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

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

2010-01-05 Thread Sean McBride
On 1/5/10 7:23 PM, Chris Ridd said:

>However Core Data models "dates" using NSDate. If you needed to model
>dates without times in Core Data (and be able to sort/filter on them)
>what would you do?

Core Data has the concept of a 'transformable' type.  You can use it to
store an NSDateComponents (since they are NSCoding compliant).

--

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


___

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

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

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

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


Re: NSDate without time portion

2010-01-05 Thread mmalc Crawford

On Jan 5, 2010, at 12:40 pm, Robert Claeson wrote:

> (Greenwich, the "G" in GMT, is in North London)
> 
Well, if we're being pedantic, South East of London, actually...


GMT is typically used to refer to UTC; in summertime, Britain's time zone is 
BST.


mmalc


___

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

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

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

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


Re: NSDate without time portion

2010-01-05 Thread Quincey Morris
On Jan 5, 2010, at 12:33, Nick Zitzmann wrote:

> On Jan 5, 2010, at 1:23 PM, Quincey Morris wrote:
> 
>> Firstly, you can't *in general* normalize to a specific time, because you 
>> can't in general know that the time exists on every date.
> 
> Unless you use a specific time zone, and store that time zone information 
> elsewhere in the model. And if you use GMT, as I mentioned earlier, unless 
> some cosmic event happens that disturbs the flow of time, there is no such 
> thing as a GMT time that does not exist, since GMT ignores transforms like 
> daylight savings.

I'll say this part again, and keep saying it till someone actually tells me I'm 
wrong:

...

Wait, no, I did that already.

Assuming that you're going to ultimately present the user with dates in the 
user interface, it's still a cultural assumption that the dates as the user 
perceives them map directly onto UTC date/times. Yes, I know I'm standing up 
for cultural perspectives that likely don't exist, but I think it's important 
to make the point that dates vs date/times is a subtle matter.

The OP wanted to use NSDate objects to avoid the clunkiness of multiple 
values/variables with NSDateComponents. I'm arguing that avoiding 
NSDateComponents is a *lot* more work, and that using NSDate for this purpose 
is *very* easy to get wrong.

As to the cosmic event -- well, I already mentioned leap seconds. Depending on 
which way the leap goes, there *will* be a UTC time that doesn't exist, or one 
that exists twice*. :)

*I think -- I don't really know enough about it.


___

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

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

2010-01-05 Thread Robert Claeson

On 5 Jan 2010, at 20:59, mmalc Crawford wrote:

> 
> On Jan 5, 2010, at 12:40 pm, Robert Claeson wrote:
> 
>> (Greenwich, the "G" in GMT, is in North London)
>> 
> Well, if we're being pedantic, South East of London, actually...
> 

Ah yes. It's sort of north-ish from where I am though, however bad an excuse 
that is.

> GMT is typically used to refer to UTC; in summertime, Britain's time zone is 
> BST.
> 

Also see  as a 
second 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: Using AppleEvents to copy and past text from any application

2010-01-05 Thread has
Jesse Grosjean wrote:

> I'm developing a small open source app called QuickCursor. [...]

Services no good? 

Only alternative I can think of would be to send Cmd-C/Cmd-V keystrokes, and 
hope that the user has the right text selected at the time.

has

-- 
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net

___

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

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

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

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


NSSavePanel with accessory view and file types popup

2010-01-05 Thread jeffs87

Hi,

I'm trying to add a custom accessory view to an NSSavePanel with a file 
types popup and a couple other controls.  When 
shouldRunSavePanelWithAccessoryView returns YES for the default 
accessory view, the type popup works as expected when 
dataRepresentationOfType is invoked, the correct type is there.  But 
when shouldRunSavePanelWithAccessoryView returns NO and I set up my own 
controls in IB and prepareSavePanel, the file type is not set correctly 
when dataRepresentationOfType is invoked.  My file type popup action 
invokes setRequiredFileType and setFileType.


What am I missing?

thanks
Jeff

P.S.
I know dataRepresentationOfType is depreciated, but I would like 10.3 
compatibility.  http://adium.im/sparkle shows what OS their users have 
and it does not show a lot of people still using 10.3.  Does anyone on 
this list still support 10.3?




___

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

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

2010-01-05 Thread mmalc Crawford

On Jan 5, 2010, at 1:02 pm, Quincey Morris wrote:

> The OP wanted to use NSDate objects to avoid the clunkiness of multiple 
> values/variables with NSDateComponents. I'm arguing that avoiding 
> NSDateComponents is a *lot* more work, and that using NSDate for this purpose 
> is *very* easy to get wrong.
> 
The issue with NSDateComponents is that they must be understood in the context 
of a particular calendar.

An NSDate object represent a single point in time -- you can think of it 
basically as a wrapper for an NSTimeInterval from the reference date.  If you 
want to create components from the date, then you must do so with respect to a 
particular calendar *and time zone*...  This is of course possible, but then 
you have to be careful about always using the same combination of calendar and 
time zone to create the components and recreate the date from the components.

NSCalendar *gregorian = [[NSCalendar alloc] 
initWithCalendarIdentifier:NSGregorianCalendar];
[gregorian setTimeZone:[NSTimeZone 
timeZoneWithName:@"America/Los_Angeles"]];

NSDateComponents *components1 = [[NSDateComponents alloc] init];
[components1 setWeekday:2];
[components1 setWeekdayOrdinal:1];
[components1 setMonth:5];
[components1 setYear:2008];
NSDate *date1 = [gregorian dateFromComponents:components1];

NSLog(@"date1: %@", date1);

[gregorian setTimeZone:[NSTimeZone timeZoneWithName:@"Pacific/Fiji"]];
date1 = [gregorian dateFromComponents:components1];
NSLog(@"date1: %@", date1);


mmalc

___

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

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

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

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


Re: Resolution Independence

2010-01-05 Thread Ricky Sharp

On Jan 5, 2010, at 2:50 PM, Todd Heberlein wrote:

> A friend of mine loves her new 27" iMac but has complained at how small 
> everything is. Searching around on the net I found that it has about a 109 
> dpi pixel density. I also saw today that the new Nexus phone has a pixel size 
> of 800x480 (as opposed to my iPhone's 480x320 pixel size), and the two 
> together got me thinking more seriously about resolution independence again. 
> Other than making big icons for my apps, I had pretty much ignored the 
> resolution independence issue.
> 
> Today I fired up Quartz Debug to set the UI Resolution to a bigger scale, and 
> I am happy that my applications did OK.
> 
> 
> But how accurate of a test is this compared to real-world resolution 
> independence?
> 
> Or in other words, is there real resolution independence built into Snow 
> Leopard for apps? Can I (or my friend with her 27" iMac) set a scale factor 
> on an application without using Quartz Debug?

RI, unfortunately, is not yet 100%.  My app is fully ready to go; got it done 
back in the days of Tiger developer seeds.

However, my app uses its own UI (no Aqua).  Thus, I had full control over 
graphics (100% vector-based PDF) as well as drawing primitives.

Having said that, Quartz Debug is definitely a very useful tool to flush out RI 
issues.  There is no user-level setting currently in the OS; you need Quartz 
Debug from devtools.

My app works at all scaling factors (to include the non-integral ones such as 
1.333), but I found that the Aqua UI was not up to the same degree of 
compliance.  Integral scale factors turned out somewhat OK (e.g. 2.0), but you 
could tell where bitmapped art was still being used.  Non-integral scaling 
factors were awful for Aqua.

I was hoping that Leopard would be the debut and then later Snow Leopard, but 
alas not yet.

> Is there something similar for iPhone development?

No.  For iPhone OS, you really should use art in the most optimum format.  This 
is currently PNG (i.e. bitmapped).  Scaling things on-the-fly ends up eating 
cycles which means more power consumption.  Granted, not nearly as much power 
as cellular/network communication, but still a waste.

> Or is the Xcode mailing list a better place for this question?


No, most RI threads have been on this list.  Definitely search the archives for 
other notes or tips/tricks.

___
Ricky A. Sharp mailto:rsh...@instantinteractive.com
Instant Interactive(tm)   http://www.instantinteractive.com



___

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

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

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

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


Re: NSSavePanel with accessory view and file types popup

2010-01-05 Thread Kyle Sluder
On Tue, Jan 5, 2010 at 1:21 PM,   wrote:
> I know dataRepresentationOfType is depreciated, but I would like 10.3
> compatibility.  http://adium.im/sparkle shows what OS their users have and
> it does not show a lot of people still using 10.3.  Does anyone on this list
> still support 10.3?

We (The Omni Group) do not support 10.3 in any of our shipping
products except OmniDictionary. Currently shipping versions of
OmniGraffle and OmniGraphSketcher require 10.5, the rest require
10.4.8.

We publish statistics from our Software Update utility at
http://update.omnigroup.com. The farthest we go back there is 10.4.

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


Window Groups in Cocoa

2010-01-05 Thread Eric Gorr
Was the window group feature (CreateWindowGroup, etc.) in the Carbon UI carried 
forward into Cocoa?

As near I can tell, it was not. 

The primary feature I need from the Carbon UI is kWindowGroupAttrMoveTogether.

So, assuming I haven't missed anything, and if you've needed this yourself, how 
did you solve the problem?

One thought would be to use the windowWillMove: delegate method and tell the 
other window to move. What I worry about here is the second window appearing to 
lag behind (or ahead) of the move rather then move smoothly with the first as 
it would in Carbon. Should I be worried?

I'll probably file a bug requesting this feature be brought to Cocoa if it is 
indeed not there.

Thank you.___

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

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

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

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


Re: NSDate without time portion

2010-01-05 Thread Kyle Sluder
On Tue, Jan 5, 2010 at 1:23 PM, mmalc Crawford  wrote:
> An NSDate object represent a single point in time -- you can think of it 
> basically as a wrapper for an NSTimeInterval from the reference date.  If you 
> want to create components from the date, then you must do so with respect to 
> a particular calendar *and time zone*...  This is of course possible, but 
> then you have to be careful about always using the same combination of 
> calendar and time zone to create the components and recreate the date from 
> the components.

I believe that Quincey's argument is that it is conceptually
inaccurate in most cases to think of a point in time as simply an
interval from a reference date. I agree that in contexts where words
like "today" are meaningful, he's probably right. Especially in
calendaring/scheduling apps. Given the number of people who struggle
with the concept of daylight saving time, I am not surprised that I
have yet to meet a non-technical person who could conceptualize a
"point in time" independently of a calendar system.

--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: Window Groups in Cocoa

2010-01-05 Thread Kyle Sluder
On Tue, Jan 5, 2010 at 1:30 PM, Eric Gorr  wrote:
> Was the window group feature (CreateWindowGroup, etc.) in the Carbon UI 
> carried forward into Cocoa?

Not as flexibly, but take a look at -[NSWindow addChildWindow:ordered:].

--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: Window Groups in Cocoa

2010-01-05 Thread Jesper Storm Bache
There is no 1 to 1 match between Cocoa and Carbon "window groups". In Cocoa you 
have child windows [NSWindow addChildWindow].
child windows move with their parents.
Note that Cocoa does not have a notion of shared activation.

Jesper

On Jan 5, 2010, at 1:30 PM, Eric Gorr wrote:

> Was the window group feature (CreateWindowGroup, etc.) in the Carbon UI 
> carried forward into Cocoa?
> 
> As near I can tell, it was not. 
> 
> The primary feature I need from the Carbon UI is kWindowGroupAttrMoveTogether.
> 
> So, assuming I haven't missed anything, and if you've needed this yourself, 
> how did you solve the problem?
> 
> One thought would be to use the windowWillMove: delegate method and tell the 
> other window to move. What I worry about here is the second window appearing 
> to lag behind (or ahead) of the move rather then move smoothly with the first 
> as it would in Carbon. Should I be worried?
> 
> I'll probably file a bug requesting this feature be brought to Cocoa if it is 
> indeed not there.
> 
> Thank you.___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/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: Window Groups in Cocoa

2010-01-05 Thread Seth Willits

On Jan 5, 2010, at 1:30 PM, Eric Gorr wrote:

> Was the window group feature (CreateWindowGroup, etc.) in the Carbon UI 
> carried forward into Cocoa?

[NSWindow addChildWindow: ordered:]


--
Seth Willits



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Using AppleEvents to copy and past text from any application

2010-01-05 Thread Jesse Grosjean
> Services no good?

Well originally I dismissed them because my understanding is that they
are meant to work in place. So there would be no time for the user to
do there work in the external editor. But now that I think about it I
could maybe use services in a bit more tricky manner. For example my
app could declare two services.

Begin Editing
Save Changes

When QuickCursor detects the global hotkey to start editing it would
use the accessibility api to invoke the begin editing service. That
service wouldn't actually do anything, it would just echo the string
back so that there were no changes, but that would give QuickCursor a
way to intercept the string and send it on to the external editor.

When it's time for QuickCursor to write back changes it would invoke
he save changes service. That service would return the newly edited
string from the external editor. If it can be made to work I think
this solution is great.

But my one fear is that the write back part will not work unless the
source app is frontmost. I guess I'll just have to try it, but does
anyone know ahread of time if I'll run into the same problems that
I've run into with the paste menu not working right?

Last, how would I go about sending Cmd-C/Cmd-V keystrokes directoy to
another application?

Thanks,
Jesse
___

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

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

2010-01-05 Thread mmalc Crawford

On Jan 5, 2010, at 1:35 pm, Kyle Sluder wrote:

> On Tue, Jan 5, 2010 at 1:23 PM, mmalc Crawford  wrote:
>> An NSDate object represent a single point in time -- you can think of it 
>> basically as a wrapper for an NSTimeInterval from the reference date.  If 
>> you want to create components from the date, then you must do so with 
>> respect to a particular calendar *and time zone*...  This is of course 
>> possible, but then you have to be careful about always using the same 
>> combination of calendar and time zone to create the components and recreate 
>> the date from the components.
> 
> I believe that Quincey's argument is that it is conceptually
> inaccurate in most cases to think of a point in time as simply an
> interval from a reference date. I agree that in contexts where words
> like "today" are meaningful, he's probably right. Especially in
> calendaring/scheduling apps. Given the number of people who struggle
> with the concept of daylight saving time, I am not surprised that I
> have yet to meet a non-technical person who could conceptualize a
> "point in time" independently of a calendar system.
> 
I'm not sure what the point is here, though?
It's the job of the application to present to the user a representation of a 
date that they can understand. It's the job of the programmer to interpret that 
unambiguously such that it can be stored and recreated -- which is the issue 
here. Talking about date components in the abstract as if any date can 
arbitrarily be reduced to a collection of components without reference to any 
other context (the calendar and time zone) is misleading.

mmalc

___

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

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

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

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


Re: Using AppleEvents to copy and past text from any application

2010-01-05 Thread has

On 5 Jan 2010, at 21:41, Jesse Grosjean wrote:

> Last, how would I go about sending Cmd-C/Cmd-V keystrokes directoy to
> another application?

Haven't done it myself, but I would guess CGEventCreateKeyboardEvent() and 
friends would be simplest.

HTH

has

-- 
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net

___

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

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

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

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


Re: NSDate without time portion

2010-01-05 Thread Greg Guerin

Many good points have already been made.  Just wanted to add:

http://en.wikipedia.org/wiki/Julian_day

"The Julian day number can be considered a very simple calendar,  
where its calendar date is just an integer. This is useful for  
reference, computations, and conversions. It allows the time between  
any two dates in history to be computed by simple subtraction."

Please note, however, that Julian days transition at noon.

  -- GG
___

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

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

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

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


Re: Using AppleEvents to copy and past text from any application

2010-01-05 Thread Dave DeLong
Yep:



CGEventSourceRef source = 
CGEventSourceCreate(kCGEventSourceStateCombinedSessionState);
CGEventRef pasteCommandDown = CGEventCreateKeyboardEvent(source, 
(CGKeyCode)9, YES);
CGEventSetFlags(pasteCommandDown, kCGEventFlagMaskCommand);
CGEventRef pasteCommandUp = CGEventCreateKeyboardEvent(source, 
(CGKeyCode)9, NO);

CGEventPost(kCGAnnotatedSessionEventTap, pasteCommandDown);
CGEventPost(kCGAnnotatedSessionEventTap, pasteCommandUp);

CFRelease(pasteCommandUp);
CFRelease(pasteCommandDown);
CFRelease(source);

(CGKeyCode)9 is the code for the letter 'v', so this is the way to invoke a 
cmd-v (paste) operation.

Beware of international keyboard layouts.

Cheers,

Dave

On Jan 5, 2010, at 2:58 PM, has wrote:

> 
> On 5 Jan 2010, at 21:41, Jesse Grosjean wrote:
> 
>> Last, how would I go about sending Cmd-C/Cmd-V keystrokes directoy to
>> another application?
> 
> Haven't done it myself, but I would guess CGEventCreateKeyboardEvent() and 
> friends would be simplest.


smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

What gets automatically localized?

2010-01-05 Thread Dave DeLong
Hi everyone,

I'm working on localizing an application, and I've been trying to figure out 
what the runtime/OS/whatever will automatically localize for me (specifically 
referring to the standard menubar).  Obviously, if I add my own NSMenuItems, I 
have to localize them myself.  Some menuitems seem to be translated 
automatically (Undo, Redo, Special Characters), while others don't (Find, 
Spelling, Services).  Is there any rhyme or reason to why some menuitems get 
localized without intervention and others don't?  Do I, for example, need to 
manually localize "About MyApp", "MyApp Help", "Hide MyApp", "File" (the menu 
title), "Edit" (menu title), etc?

Any insight would be greatly appreciated.

Thanks!

Dave DeLong

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

Re: NSDate without time portion

2010-01-05 Thread Henry McGilton (Boulevardier)

On Jan 5, 2010, at 1:43 PM, mmalc Crawford wrote:

> 
> On Jan 5, 2010, at 1:35 pm, Kyle Sluder wrote:
> 
>> On Tue, Jan 5, 2010 at 1:23 PM, mmalc Crawford  wrote:
>>> An NSDate object represent a single point in time -- you can think of it 
>>> basically as a wrapper for an NSTimeInterval from the reference date.  If 
>>> you want to create components from the date, then you must do so with 
>>> respect to a particular calendar *and time zone*...  This is of course 
>>> possible, but then you have to be careful about always using the same 
>>> combination of calendar and time zone to create the components and recreate 
>>> the date from the components.
>> 
>> I believe that Quincey's argument is that it is conceptually
>> inaccurate in most cases to think of a point in time as simply an
>> interval from a reference date. I agree that in contexts where words
>> like "today" are meaningful, he's probably right. Especially in
>> calendaring/scheduling apps. Given the number of people who struggle
>> with the concept of daylight saving time, I am not surprised that I
>> have yet to meet a non-technical person who could conceptualize a
>> "point in time" independently of a calendar system.
>> 
> I'm not sure what the point is here, though?
> It's the job of the application to present to the user a representation of a 
> date that they can understand. It's the job of the programmer to interpret 
> that unambiguously such that it can be stored and recreated -- which is the 
> issue here. Talking about date components in the abstract as if any date can 
> arbitrarily be reduced to a collection of components without reference to any 
> other context (the calendar and time zone) is misleading.


For more fun with calendars, Wall(et) Street Journal had a nice article
yesterday:

http://online.wsj.com/article/SB126212850216209527.html

Cheers,
. . . . . . . .Henry


=
iPhone App Development and Developer Education . . .
Visit  www.nonatomic-retain.com

Mac OSX Application Development, Plus a Great Deal More . . .
Visit  www.trilithon.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


NSATSGlyphStorage memory usage.

2010-01-05 Thread jonat...@mugginsoft.com
My app repeatedly loads and unloads a couple of MB of text into an NSTextView.
Running heap(1) reveals

 heap 12462 -sumObjectFields | grep NSATS
 2  22833792 11416896.0   NSATSGlyphStorage   ObjCAppKit

This 23MB memory is allocated in the auto zone and does not noticeably decrease 
if the NSTextView contents are small.

Would it be correct to assume these memory blocks are managed by the layout 
manager and will be reallocated as and when appropriate?

Regards

Jonathan Mitchell

Developer
http://www.mugginsoft.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


Question about looping constructs

2010-01-05 Thread BJ Homer
<< Branching from the "Question about garbage collection" thread >>

On Sun, Jan 3, 2010 at 11:40 AM, Bill Bumgarner  wrote:

>
> If you are writing your own looping construct, you can call
> objc_clear_stack(...) to clear the stack at appropriate times, typically
> when the stack is as shallow as possible.   Prior to Snow Leopard, writing
> your own looping construct was relatively rare in Cocoa.  With Snow
> Leopard's addition of Grand Central Dispatch, writing your own looping
> construct is actively discouraged (though, certainly, there are still
> reasons to do so).
>
> b.bum


I assume that when you say "looping construct", you're not referring to
things like for, while, do-while, etc. Could you explain what you're talking
about? I'm guessing you mean run loops on detached threads, and if so, are
you referring to using custom input sources for threads?  I've seen a fair
amount of code that detaches a thread to a method with a while(!done) { //
code here } structure. Is there a better way?
___

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

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

2010-01-05 Thread Quincey Morris
On Jan 5, 2010, at 13:43, mmalc Crawford wrote:

> I'm not sure what the point is here, though?

Well, taking what's likely a rhetorical question literally, the point (at least 
my point) is that switching from dates represented by conceptual structures 
such as NSDateComponents + NSCalendar + time zone (which is an important 
complication we were ignoring till you pointed that out) to dates represented 
by NSDate objects (which are "really" times, not dates) *isn't* going to 
simplify the programmer's task, and will probably complicate it.

> It's the job of the application to present to the user a representation of a 
> date that they can understand. It's the job of the programmer to interpret 
> that unambiguously such that it can be stored and recreated -- which is the 
> issue here. Talking about date components in the abstract as if any date can 
> arbitrarily be reduced to a collection of components without reference to any 
> other context (the calendar and time zone) is misleading.

Yes, there's no answer to the question without reference to what piece of 
application functionality (what programming task) is under consideration. Dates 
with times, dates without times, dates relative to a pre-determined calendar 
and time zone, dates relative to the user's locale, dates relative to a service 
provider's locale, dates kept transiently in memory, dates written to 
persistent storage, these are all things that have to be settled on a case by 
case basis, and multiple approaches may need to co-exist in a single 
application.

I actually believe that Apple thought this through very carefully (twice -- 
once producing NSCalendarDate, which presumably wasn't a satisfactory solution, 
and once producing NSCalendar + NSDateComponents, which we hope is), and to 
ignore or bypass NSCalendarDate simply wastes the effort that was put into it. 
And risks Doing It Wrong™.

But that's probably too much soapbox time on my part, so I'll climb down now.


___

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

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

2010-01-05 Thread Aki Inoue
It's supposed to be managed automatically.

If you see suspicious behavior, please file a bug with reproducing steps if 
possible.

Thanks,

Aki

On 2010/01/05, at 15:03, jonat...@mugginsoft.com wrote:

> My app repeatedly loads and unloads a couple of MB of text into an NSTextView.
> Running heap(1) reveals
> 
> heap 12462 -sumObjectFields | grep NSATS
> 2  22833792 11416896.0   NSATSGlyphStorage   ObjCAppKit
> 
> This 23MB memory is allocated in the auto zone and does not noticeably 
> decrease if the NSTextView contents are small.
> 
> Would it be correct to assume these memory blocks are managed by the layout 
> manager and will be reallocated as and when appropriate?
> 
> Regards
> 
> Jonathan Mitchell
> 
> Developer
> http://www.mugginsoft.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/aki%40apple.com
> 
> This email sent to a...@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: Weird issue with BDAlias/FSRefs and the case of filesystem paths

2010-01-05 Thread Rob Keniger

On 06/01/2010, at 6:18 AM, Kyle Sluder wrote:

> If the directory is on a case-insensitive HFS volume (the default),

Yes, it is.

> It will also be helpful to see what the value of $HOME is, and if it
> jives with the on-disk name.


echo $HOME
/Users/rob

This is really, really weird. I've since rebuilt the directory with Diskwarrior 
with no change to the behaviour. On the other machines here everything's 
working so it must be something unique to my setup but I have absolutely no 
idea where to start looking.

--
Rob Keniger



___

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

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

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

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


Re: Weird issue with BDAlias/FSRefs and the case of filesystem paths

2010-01-05 Thread Rob Keniger

On 06/01/2010, at 10:29 AM, Rob Keniger wrote:

> This is really, really weird. I've since rebuilt the directory with 
> Diskwarrior with no change to the behaviour. On the other machines here 
> everything's working so it must be something unique to my setup but I have 
> absolutely no idea where to start looking.


OK, so I took the brute force approach. I booted into single-user mode and did 
this:

mv Users Lusers
mv Lusers Users

Now everything's fine. Nothing to see here, sorry for the waste of bandwidth.

--
Rob Keniger



___

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

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

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

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


Path comparison and case sensitivity

2010-01-05 Thread Rob Keniger
My recent troubles with filesystem case got me thinking. 

Should Cocoa applications always assume that the filesystem is case-insensitive 
when comparing path strings? Surely this could lead to problems if the user has 
formatted a volume with a case-sensitive file system? Is there any way to know 
whether or not a file is on a case-sensitive volume?

--
Rob Keniger



___

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

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

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

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


Re: NSSavePanel with accessory view and file types popup

2010-01-05 Thread jeffs87

Hi,

I'm trying to add a custom accessory view to an NSSavePanel with a 

file

types popup and a couple other controls.  When
shouldRunSavePanelWithAccessoryView returns YES for the default 

accessory
view, the type popup works as expected when dataRepresentationOfType 

is

invoked, the correct type is there.  But when
shouldRunSavePanelWithAccessoryView returns NO and I set up my own 

controls

in IB and prepareSavePanel, the file type is not set correctly when
dataRepresentationOfType is invoked.  My file type popup action 

invokes

setRequiredFileType and setFileType.


Nobody has had to add a document type popup to a custom accessory view? 
I would think this is a fairly common thing...


Is it possible to customize the default accessory view?

thanks
Jeff


___

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

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

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

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


main document window disappears when resizing

2010-01-05 Thread Shane
Hi,

I have a document based application with a main window that, when I
try to resize the window, the window just completely disappears. The
application doesn't crash and I can open up another window (as the
menu is still there) by 'Project --> New'. If I try to resize it, it
will disappear. And my debugger doesn't show anything when it
disappears, at least, that I can tell.

Any idea how to help track this problem down?

Any help much appreciated.
___

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

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

2010-01-05 Thread Graham Cox

On 06/01/2010, at 2:50 PM, Shane wrote:

> Hi,
> 
> I have a document based application with a main window that, when I
> try to resize the window, the window just completely disappears. The
> application doesn't crash and I can open up another window (as the
> menu is still there) by 'Project --> New'. If I try to resize it, it
> will disappear. And my debugger doesn't show anything when it
> disappears, at least, that I can tell.
> 
> Any idea how to help track this problem down?
> 
> Any help much appreciated.


Has the window got a silly setting for max or min size? (IB)

--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: main document window disappears when resizing

2010-01-05 Thread Shane
>
> Has the window got a silly setting for max or min size? (IB)
>

It does have a minimum size in IB in the 'window size' tab, and
maximum size is unchecked in that same tab (or something like a tabbed
page).

But even if they were both set, it shouldn't disappear. It just
shouldn't resize.

Any other ideas? Or am I missing something?
___

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

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

2010-01-05 Thread Ken Thomases
On Jan 5, 2010, at 6:51 PM, Rob Keniger wrote:

> Should Cocoa applications always assume that the filesystem is 
> case-insensitive when comparing path strings? Surely this could lead to 
> problems if the user has formatted a volume with a case-sensitive file system?

Don't compare paths.  Use APIs like FSCompareFSRefs() or call -[NSFileManager 
attributesOfItemAtPath:error:] and compare the NSFileDeviceIdentifier and 
NSFileSystemFileNumber keys (this is the Cocoa equivalent of calling stat(2) 
and comparing st_dev and st_ino).

> Is there any way to know whether or not a file is on a case-sensitive volume?

A couple of ways (there are others):

On 10.6 and later, see NSURL's new resource-values APIs and 
NSURLVolumeSupportsCaseSensitiveNamesKey.

On 10.3 and later, see getattrlist and VOL_CAP_FMT_CASE_SENSITIVE.

Regards,
Ken

___

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

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

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

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


Re: NSRecursiveLock problems

2010-01-05 Thread Stuart Carnie
Check out PLBlocks  if you want to use
blocks on 10.5.

Cheers,

Stu

On Tue, Dec 22, 2009 at 12:49 PM, PCWiz  wrote:

> Well what I meant by delegates and selectors was like the secondary thread
> calls a selector on the main thread (using performSelectorOnMainThread) but
> I guess I got a little confused there :)
>
> I would like to use blocks, however I'm using the 10.5 SDK so as far as I
> know blocks cannot be used. Is there a way to get
> performSelectorOnMainThread to return a value? That would solve my issue,
> because I could pass on the NSAttributedString to a method on the main
> thread that figures out the size and all, then returns the value.
>
> Independent Cocoa Developer, Macatomy Software
> http://macatomy.com
>
>
> On 2009-12-22, at 12:22 PM, Bill Bumgarner wrote:
>
> >
> > On Dec 22, 2009, at 11:19 AM, PCWiz wrote:
> >
> >> Is there any easy way to execute a portion of code on the main thread
> without going through the mess of delegates and selectors?
> >
> >
> > Delegates have *nothing* to do with main thread execution.   Selectors a
> bit orthogonal, too.
> >
> > If you want to execute something on the main thread, I would suggest
> using NSOperationQueue's notion of main queue and enqueuing an operation
> with a block:
> >
> > - (void)addOperationWithBlock:(void (^)(void))block
> >
> > Quite straightforward.
> >
> > b.bum
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/stuart.carnie%40gmail.com
>
> This email sent to stuart.car...@gmail.com
>



-- 
Stuart Carnie

CTO Manomio LLC
In Retro We Trust!
___

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

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

2010-01-05 Thread Chris Ridd

On 5 Jan 2010, at 20:56, Sean McBride wrote:

> On 1/5/10 7:23 PM, Chris Ridd said:
> 
>> However Core Data models "dates" using NSDate. If you needed to model
>> dates without times in Core Data (and be able to sort/filter on them)
>> what would you do?
> 
> Core Data has the concept of a 'transformable' type.  You can use it to
> store an NSDateComponents (since they are NSCoding compliant).

That sounds like a good solution, thanks!

Cheers,

Chris
___

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

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

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

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


Re: Path comparison and case sensitivity

2010-01-05 Thread Rob Keniger

On 06/01/2010, at 3:39 PM, Ken Thomases wrote:

> Don't compare paths.  Use APIs like FSCompareFSRefs() or call -[NSFileManager 
> attributesOfItemAtPath:error:] and compare the NSFileDeviceIdentifier and 
> NSFileSystemFileNumber keys (this is the Cocoa equivalent of calling stat(2) 
> and comparing st_dev and st_ino).

Many thanks for this info, I will immediately switch my code across to use this 
as it's definitely more robust.

>> Is there any way to know whether or not a file is on a case-sensitive volume?
> 
> A couple of ways (there are others):
> 
> On 10.6 and later, see NSURL's new resource-values APIs and 
> NSURLVolumeSupportsCaseSensitiveNamesKey.
> 
> On 10.3 and later, see getattrlist and VOL_CAP_FMT_CASE_SENSITIVE.


Thanks for the pointer. I guess if I'm using the aforementioned APIs to compare 
files then I won't need to worry about the case sensitivity of the file system 
anyway, though.

--
Rob Keniger



___

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

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

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

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