Re: NSWindowController for Prefs XIB Question (Core Data involved) - Solved

2010-05-22 Thread Steve Cronin
Folks;

I have figured at least part of this out.
My PrefsController had an instance variable that was of a class from the Core 
Data Model.
Since the MOC was not available until after the initWithWindow, anything 
derived from NSManagedObject is not valid.

Once I removed this instance variable the window now now opens.

Hopefully this is helpful to someone else….
Steve

 On May 20, 2010, at 10:08 PM, Steve Cronin wrote:
 
 Folks;
 
 I have a feeling that this is an embarrassing one so try and go easy on me…
 XC 3.2.2 
 
 I have a main nib that opens a window and that works fine.
 I used to have an NSPanel in this nib to handle preferences.
 I've decided it's a good idea to split the nib into two different nibs: the 
 main nib and a preferences nib.
 
 I've looked over the Sketch project and used it as a model.
 I've also read over the Document-Based App Overview FAQ
 
 I've added a window nib to the project and then subclassed a 
 NSWindowController.
 I've made the xib's files owner this window controller
 At this point I can get a simple empty window to open just fine.
 
 However, I'm using CoreData and I want to pass the existing MOC to the pref 
 window:
 I have added an array controller to the pref nib with its MOC set to files 
 owner's MOC in IB.
 The controller manages an entity not a mutable dictionary.
 MOC is a synthesized property of the PrefController (the windowController 
 mentioned above).
 
 if (!prefPanelController) {
 prefPanelController = [[PreferencesController alloc] 
 initWithWindowNibName:@testPref];
 [prefPanelController setManagedObjectContext:[self 
 managedObjectContext]];
 }
 [prefPanelController showWindow:sender];
 
 No window opens and I get a console error:  Cannot perform operation 
 without a managed object context
 
 Could someone give me the gentle head slap I need here?
 Steve
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/billy%40deviltrain.co.uk
 
 This email sent to bi...@deviltrain.co.uk
 

___

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

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

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

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


Re: Forcing NSImage to cache images at certain sizes

2010-05-22 Thread B.J. Buchalter


On May 21, 2010, at 10:10 PM, Ken Ferry wrote:


Hi BJ,

On Fri, May 21, 2010 at 2:44 PM, B.J. Buchalter b...@mhlabs.com wrote:
I read the NSImage and Cocoa drawing guide docs, which tends to  
indicate that calling drawInRect:fromRect:operation:fraction: on an  
NSImage will cause it to create a cached image rep that matches the  
scaled image so that the next time it is drawn it does not need to  
be scaled again.


The docs haven't fully integrated new info from 10.6, when NSImage  
changed a bunch.  Take a look at the AppKit release notes.


Oh -- sorry; I am testing on 10.5 -- I should have mentioned that.

That is not what I am seeing here, and the scaling is definitely  
taking a nontrivial amount of time when redrawing my views. I have  
played around with setting the caching and scaling on the NSImage,  
but it doesn't appear to be having any impact (the internal image  
rep for the image never changes).


Could you attach a test app please?  There's more than one thing  
that could be the issue.


I'll try to reduce my code to something very simple.

Basically what I am seeing is that when I call  
drawInRect:fromRect:operation:fraction:, no mater what I pass in the  
for drawInRect (which causes the image to draw scaled), if I  
NSLog(@%@, theImage) after doing the drawing I get:


Drawing Image with width: 49.00 and height: 49.00
NSImage 0x13e770 Size={64, 64} Reps=(
NSBitmapImageRep 0x13c4f0 Size={64, 64}  
ColorSpace=NSCalibratedRGBColorSpace BPS=8 BPP=32 Pixels=64x64  
Alpha=YES Planar=NO Format=2 CGImage=0x16007270

)

Note that the image has not cached a reduced NSBitmapImageRep or  
NSCachedImageRep with Size={49, 49}


Best regards,

B.J. Buchalter
Metric Halo
http://www.mhlabs.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


getting file time stamp from a NTFS volume

2010-05-22 Thread Angelo Chen
Hi,
I use following code to get file creation time stamp, it works with FAT32, but 
seems returning wrong date if the file is in a NTFS volume, any idea? Thanks,
Angelo
NSFileManager *fm= [NSFileManager defaultManager];NSDictionary *fileAttributes 
= [fm fileAttributesAtPath:path traverseLink:YES];   fileCreatDate = 
[fileAttributes objectForKey:NSFileCreationDate];



___

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

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

2010-05-22 Thread Bleicher Eiko
Thanks,

I'll roll my own encoding, then. I should get much less overhead during normal 
operation then anyway - which could matter in my application.

Eiko

Am 22.05.2010 um 01:41 schrieb Kyle Sluder:

 On Fri, May 21, 2010 at 4:35 PM, Eiko Bleicher bleic...@k4it.de wrote:
 When transferring data between Mac and iPhone/iPad, serializing via 
 NSKeysedArchiver seems simple and easy. Wrapping up some trivial Objects 
 like NSData, NSDictionary, NSNumber, NSString seems to work.
 
 But the question is: is it considered safe to transfer data like that? How 
 likely is this scenario going to fail? I imagine how a simple binary change 
 makes everything crash; but given that there might be tons of Applications 
 that store data in a similar fashion, this probably is just not going to 
 happen.
 
 This isn't really a safe thing to do. If you want to archive simple
 stuff like strings, arrays, and dictionaries, use
 NSPropertyListSerialization. Otherwise, write a custom serialization
 scheme. Archiving (keyed or not) is very fragile, if for no other
 reason than it relies on the existence of classes at unarchive time
 that existed at archive time.
 
 So I would need to worry about changes on one platform that generates 
 compatibilty problems on the other. Have there ever been issues with that?
 
 Not to my knowledge, but I don't see any versioning mechanism so it's
 quite possible there might be in the future.
 
 It wouldn't be a big deal if I needed to package my data on my own, but this 
 also opens room for bugs
 
 Better to do the right thing in this case.
 
 --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


getting file creation date from NTFS

2010-05-22 Thread Angelo Chen
Hi,
I'd like to get creation date of a file, here are the codes:
NSDictionary *fileAttributes = [fileManager fileAttributesAtPath:path 
traverseLink:YES];NSLog(@Dict %@, fileAttributes);
This works if the file came from FAT or Mac OS X, but if it is in a NTFS 
volume, creation date is always wrong, I observe the Finder can display the 
creation date correctly, any idea how to obtain a creation date for files in 
NTFS? Thanks,
Angelo
This come from a NTFS:
2010-05-22 23:06:12.276 test1[2531:a0b] Dict {    NSFileCreationDate = 
2928613-08-09 15:06:42 +0800;    NSFileExtensionHidden = 0;    
NSFileGroupOwnerAccountID = 20;    NSFileGroupOwnerAccountName = staff;    
NSFileHFSCreatorCode = 0;    NSFileHFSTypeCode = 0;    NSFileModificationDate = 
2004-08-04 12:56:56 +0800;    NSFileOwnerAccountID = 501;    
NSFileOwnerAccountName = user1;    NSFilePosixPermissions = 493;    
NSFileReferenceCount = 1;    NSFileSize = 69120;    NSFileSystemFileNumber = 
2469;    NSFileSystemNumber = 234881027;    NSFileType = NSFileTypeRegular;}
This come from a file in FAT:
2010-05-22 23:09:43.336 test1[2702:a0b] Dict {    NSFileCreationDate = 
2009-01-13 22:56:16 +0800;    NSFileExtensionHidden = 0;    
NSFileGroupOwnerAccountID = 20;    NSFileGroupOwnerAccountName = staff;    
NSFileHFSCreatorCode = 0;    NSFileHFSTypeCode = 0;    NSFileModificationDate = 
2008-02-25 04:01:00 +0800;    NSFileOwnerAccountID = 501;    
NSFileOwnerAccountName = user1;    NSFilePosixPermissions = 511;    
NSFileReferenceCount = 1;    NSFileSize = 13086720;    NSFileSystemFileNumber = 
119;    NSFileSystemNumber = 234881031;    NSFileType = NSFileTypeRegular;}




___

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

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

2010-05-22 Thread Hank Heijink (Mailinglists)
On May 22, 2010, at 11:33 AM, Angelo Chen wrote:

 Hi,
 I'd like to get creation date of a file, here are the codes:
 NSDictionary *fileAttributes = [fileManager fileAttributesAtPath:path 
 traverseLink:YES];  NSLog(@Dict %@, fileAttributes);
 This works if the file came from FAT or Mac OS X, but if it is in a NTFS 
 volume, creation date is always wrong, I observe the Finder can display the 
 creation date correctly, any idea how to obtain a creation date for files in 
 NTFS? Thanks,
 Angelo
 This come from a NTFS:
 2010-05-22 23:06:12.276 test1[2531:a0b] Dict {NSFileCreationDate = 
 2928613-08-09 15:06:42 +0800;NSFileExtensionHidden = 0;
 NSFileGroupOwnerAccountID = 20;NSFileGroupOwnerAccountName = staff;
 NSFileHFSCreatorCode = 0;NSFileHFSTypeCode = 0;NSFileModificationDate 
 = 2004-08-04 12:56:56 +0800;NSFileOwnerAccountID = 501;
 NSFileOwnerAccountName = user1;NSFilePosixPermissions = 493;
 NSFileReferenceCount = 1;NSFileSize = 69120;NSFileSystemFileNumber = 
 2469;NSFileSystemNumber = 234881027;NSFileType = NSFileTypeRegular;}

Not sure if this helps you, but it looks like NTFS reports file creation date 
in milliseconds, instead of seconds. As a possible workaround, you could 
convert the date to an NSTimeInterval, divide by 1000 and convert it back to a 
date. I believe these creation dates are relative to 1970, so I would try this:

NSDate *wrongCreationDate = the date you have;
NSTimeInterval msSince1970 = [wrongCreationDate timeIntervalSince1970];
NSDate *rightCreationDate = [NSDate dateWithTimeIntervalSince1970: msSince1970 
/ 1000.0];

I don't know how you get the system to report the correct date in the first 
place...

Good luck,
Hank

___

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

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

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

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


core data, undo and redo

2010-05-22 Thread Martin Hewitson
Dear list,

I'm trying to understand what happens regarding undo/redo when an item 
(NSManagedObject) is removed from a NSTreeController. In particular I have an 
NSManagedObject subclass which has properties which are not part of the core 
data model, but are instead (in some sense) transient. For example, one 
property is an NSTextStorage which I create in awakeFromFetch:. At the moment, 
I have to release the NSTextStorage just before I remove the item from the 
tree-controller. I rather expected (perhaps wrongly) that removing the item 
from the tree-controller (which is bound to the managed object context) would 
result in the particular NSManagedObject being released, but I don't see that 
happening. I also checked to see if didTurnIntoFault: is called on the item, 
but it isn't. My main problem is that, when I undo the removing of items from 
the tree, I need to reinstate the transient properties like the text storage. 
When I undo, awakeFromFetch: isn't called, neither is awakeFromInsert:. So 
where does one get the chance to 'handle things' after an undo? I saw in the 
documentation the method awakeFromSnapshotEvents: but there it says Available 
in iPhone OS 3.0 and later. What about if I'm developing for 10.5?

Many thanks in advance for any insights that anyone can offer.

Best wishes,

Martin



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


CATiledLayer Memory Usage

2010-05-22 Thread Milen Dzhumerov
Hi all,

I've been writing some code that uses CATiledLayer and noticed that the memory 
usage increased quite a bit - by a factor of 2, on average. Some numbers that 
I've collected:
Normally Sized Window
 - NS: 10mb; CA: 18.5mb
Maximized Window:
 - NS: 23mb; CA: 45.7mb

I tried playing with the tile size and it looks like it has no effect on the 
memory usage. If I just used a normal CALayer, the memory consumption was 
somewhere in-between - an increase of about 1.5 with respect to the NS version. 
I just wanted to ask whether that's the expected behavior of CATiledLayer and 
whether I should be following any tips to keep that usage down as much as 
possible.

Many thanks,
Milen

PS. Test project 
http://dl.dropbox.com/u/645995/TiledLayerMemoryUsage.zip___

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

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

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

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


Re: core data, undo and redo

2010-05-22 Thread Jerry Krinock

On 2010 May 22, at 09:36, Martin Hewitson wrote:

 In particular I have an NSManagedObject subclass which has properties which 
 are not part of the core data model, but are instead (in some sense) 
 transient.

I believe you're referring to what I'd call these regular instance variables.

 For example, one property is an NSTextStorage which I create in 
 awakeFromFetch:. At the moment, I have to release the NSTextStorage just 
 before I remove the item from the tree-controller. I rather expected (perhaps 
 wrongly) that removing the item from the tree-controller (which is bound to 
 the managed object context) would result in the particular NSManagedObject 
 being released, but I don't see that happening.

That's true.  Core Data will release objects when it gets good and ready, and 
there's no telling when that is.

 I also checked to see if didTurnIntoFault: is called on the item, but it 
 isn't.

It will be called eventually.  My understanding is that any clean-up code which 
you'd usually put in -dealloc for a regular object should be put in 
-didTurnIntoFault for a managed object.  Seems to work for me.

 My main problem is that, when I undo the removing of items from the tree, I 
 need to reinstate the transient properties like the text storage.

But if you didn't release them in the first place, you wouldn't need to put 
them back in the second place.

 When I undo, awakeFromFetch: isn't called, neither is awakeFromInsert:. So 
 where does one get the chance to 'handle things' after an undo? I saw in the 
 documentation the method awakeFromSnapshotEvents: but there it says 
 Available in iPhone OS 3.0 and later. What about if I'm developing for 10.5?

I think you should sit back and let Core Data do its work.

___

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

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

2010-05-22 Thread Richard Somers

On May 14, 2010, at 10:25 AM, Quincey Morris wrote:

If I understand you correctly, you're on the right track -- you want  
to bind the array controller's selection indexes to your data  
model's selection property.


As you noted this is easy to implement but unfortunately it does not  
work. The array controller's selection indexes are based on the  
current arrangement of objects in the array. This arranged order not  
preserved for example when a selected object is removed from the array  
and then restored with a managed object context undo. So the selected  
objects which are deleted are not the same as the selected objects  
after an undo delete. It appears now that this solution would be  
complex and difficult to implement.


Looks like I am back to trying your original suggestion as outlined  
below.


On May 13, 2010, at 10:59 PM, Quincey Morris wrote:

1. You need to add a transient property for the selection to your  
managed data model. (Or non-transient, if you want the selection to  
persist when the document is re-opened.)


2. You need to keep track of the changes to the selection by  
modifying your Core Data selection property whenever the selection  
changes. However, you don't want these to be recorded as undoable  
actions (most likely, although there are scenarios -- think of  
Photoshop -- where selection changes are undoable), so you have to  
disable the undo manager temporarily around such changes. (Don't  
forget to invoke processPendingChanges before disabling the undo  
manager, and again before enabling it.)


3. You can't just track the selection state at the time of the  
undoable action, because the selection you ultimately want is  
different depending on whether you're undoing or redoing.  
(Convincing yourself that this is an issue is left as an exercise  
for the reader.) I think the easiest way to do this is to create an  
undo group for each action that needs to restore the selection, with  
2 actions in the group: the first one changes all the non-selection  
properties to their new values; the second changes the selection  
property to the post-change selection. (The latter changes the  
selection without disabling the undo manager, of course.) I *think*  
that gives the right selection depending whether you're undoing or  
redoing. (But I haven't actually tried this approach. The last time  
I had to deal with this problem in a Core Data environment, I think  
I did something clunkier.)


--Richard

___

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

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

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

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


Re: core data, undo and redo

2010-05-22 Thread Martin Hewitson
Thanks, Jerry. I was trying to let core data do its thing, but I was getting 
errors associated with the regular instance variables of the managed objects 
after an undo, so I started down this road of trying to somehow handle myself 
the releasing and re-instantiating of the instance variables. Probably I took 
the wrong track and I should rather try harder to figure out where the problem 
was, and fix that, rather than try to get around it.

Thanks for the advice,

Martin



On May 22, 2010, at 6:50 PM, Jerry Krinock wrote:

 
 On 2010 May 22, at 09:36, Martin Hewitson wrote:
 
 In particular I have an NSManagedObject subclass which has properties which 
 are not part of the core data model, but are instead (in some sense) 
 transient.
 
 I believe you're referring to what I'd call these regular instance 
 variables.
 
 For example, one property is an NSTextStorage which I create in 
 awakeFromFetch:. At the moment, I have to release the NSTextStorage just 
 before I remove the item from the tree-controller. I rather expected 
 (perhaps wrongly) that removing the item from the tree-controller (which is 
 bound to the managed object context) would result in the particular 
 NSManagedObject being released, but I don't see that happening.
 
 That's true.  Core Data will release objects when it gets good and ready, and 
 there's no telling when that is.
 
 I also checked to see if didTurnIntoFault: is called on the item, but it 
 isn't.
 
 It will be called eventually.  My understanding is that any clean-up code 
 which you'd usually put in -dealloc for a regular object should be put in 
 -didTurnIntoFault for a managed object.  Seems to work for me.
 
 My main problem is that, when I undo the removing of items from the tree, I 
 need to reinstate the transient properties like the text storage.
 
 But if you didn't release them in the first place, you wouldn't need to put 
 them back in the second place.
 
 When I undo, awakeFromFetch: isn't called, neither is awakeFromInsert:. So 
 where does one get the chance to 'handle things' after an undo? I saw in the 
 documentation the method awakeFromSnapshotEvents: but there it says 
 Available in iPhone OS 3.0 and later. What about if I'm developing for 
 10.5?
 
 I think you should sit back and let Core Data do its work.
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/martin.hewitson%40aei.mpg.de
 
 This email sent to martin.hewit...@aei.mpg.de


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


Re: getting file creation date from NTFS

2010-05-22 Thread Ken Thomases
On May 22, 2010, at 10:33 AM, Angelo Chen wrote:

 I'd like to get creation date of a file, here are the codes:

Since there seems to be a bug with Cocoa (that you should file at 
http://bugreport.apple.com), you may wish to try stat(2) or perhaps 
FSGetCatalogInfo().

For stat(2), if you're targeting pre-Snow Leopard, make sure to define 
_DARWIN_USE_64_BIT_INODE before including the headers so the stat structure 
will have the st_birthtimespec field.

Also be aware that not all file systems support the notion of creation dates of 
their objects.  I don't know off-hand if NTFS does.  You can use getattrlist(2) 
to check.  (Come to think of it, you can use getattrlist() to obtain the file 
creation date, too, although stat() is much simpler.)

You can avoid writing a lot of experimental test code yourself by downloading 
and using Apple's FSMegaInfo sample tool.  Apply that and its various 
sub-commands to see what results you get from an NTFS volume.
http://developer.apple.com/mac/library/samplecode/FSMegaInfo/

Cheers,
Ken

___

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

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

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

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


Object Ownership

2010-05-22 Thread Michael Jackson
Hi all,

First day with Cocoa, so please excuse the basic newbness of this
question. ;) I've read through the documentation about object
ownership and disposal and just wanted to make sure I'm doing
everything correctly in the following method.


- (NSURL *)makeURL:(NSString *)aURLString
{
NSMutableString *aCopy = [aURLString mutableCopy];

// do some stuff with aCopy here

NSURL *aURL = [NSURL URLWithString:aCopy];
[aCopy release];

return aURL;
}


The question is whether or not NSURL's URLWithString: is going to
retain aCopy, so it's safe to be released on the next line. I'm just
looking for some confirmation or any pointers from people who are more
used to managing memory than I am.

Thanks,

Michael

--
Michael Jackson
http://mjijackson.com
@mjijackson
___

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

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

2010-05-22 Thread Dave Carrigan

On May 22, 2010, at 8:18 AM, Michael Jackson wrote:

 Hi all,
 
 First day with Cocoa, so please excuse the basic newbness of this
 question. ;) I've read through the documentation about object
 ownership and disposal and just wanted to make sure I'm doing
 everything correctly in the following method.
 
 
 - (NSURL *)makeURL:(NSString *)aURLString
 {
   NSMutableString *aCopy = [aURLString mutableCopy];
   
   // do some stuff with aCopy here
   
   NSURL *aURL = [NSURL URLWithString:aCopy];
   [aCopy release];
   
   return aURL;
 }
 
 
 The question is whether or not NSURL's URLWithString: is going to
 retain aCopy, so it's safe to be released on the next line. I'm just
 looking for some confirmation or any pointers from people who are more
 used to managing memory than I am.

This is fine. If NSURL needs to keep aCopy, it will retain it; if it doesn't, 
it will not. That's not your concern; only the implementor of NSURL needs to 
worry about that. 

Your only concern is to release aCopy when you don't need it any more, which is 
what you are doing.


___

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

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

2010-05-22 Thread Paul Sanders
 Also be aware that not all file systems support the notion of 
 creation dates of their objects.  I don't know off-hand if 
 NTFS does.

It does.

Paul Sanders. 



___

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

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

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

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


Re: core data, undo and redo - follow-up question

2010-05-22 Thread Martin Hewitson
Actually, I remembered what the other problem was that 'lead me down the wrong 
path'. I'm observing one of the properties of the NSManagedObject, so before I 
remove it from the tree-controller, I stop observing the property. Now if I 
undo the removal, I need a place to set up the observing again. 

Can anybody recommend where I should do that? I notice that 
insertObject:atArrangedObjectIndexPath: of NSTreeController is not called when 
I undo the removal.

Best,

Martin


On May 22, 2010, at 6:54 PM, Martin Hewitson wrote:

 Thanks, Jerry. I was trying to let core data do its thing, but I was getting 
 errors associated with the regular instance variables of the managed objects 
 after an undo, so I started down this road of trying to somehow handle myself 
 the releasing and re-instantiating of the instance variables. Probably I took 
 the wrong track and I should rather try harder to figure out where the 
 problem was, and fix that, rather than try to get around it.
 
 Thanks for the advice,
 
 Martin
 
 
 
 On May 22, 2010, at 6:50 PM, Jerry Krinock wrote:
 
 
 On 2010 May 22, at 09:36, Martin Hewitson wrote:
 
 In particular I have an NSManagedObject subclass which has properties which 
 are not part of the core data model, but are instead (in some sense) 
 transient.
 
 I believe you're referring to what I'd call these regular instance 
 variables.
 
 For example, one property is an NSTextStorage which I create in 
 awakeFromFetch:. At the moment, I have to release the NSTextStorage just 
 before I remove the item from the tree-controller. I rather expected 
 (perhaps wrongly) that removing the item from the tree-controller (which is 
 bound to the managed object context) would result in the particular 
 NSManagedObject being released, but I don't see that happening.
 
 That's true.  Core Data will release objects when it gets good and ready, 
 and there's no telling when that is.
 
 I also checked to see if didTurnIntoFault: is called on the item, but it 
 isn't.
 
 It will be called eventually.  My understanding is that any clean-up code 
 which you'd usually put in -dealloc for a regular object should be put in 
 -didTurnIntoFault for a managed object.  Seems to work for me.
 
 My main problem is that, when I undo the removing of items from the tree, I 
 need to reinstate the transient properties like the text storage.
 
 But if you didn't release them in the first place, you wouldn't need to put 
 them back in the second place.
 
 When I undo, awakeFromFetch: isn't called, neither is awakeFromInsert:. So 
 where does one get the chance to 'handle things' after an undo? I saw in 
 the documentation the method awakeFromSnapshotEvents: but there it says 
 Available in iPhone OS 3.0 and later. What about if I'm developing for 
 10.5?
 
 I think you should sit back and let Core Data do its work.
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/martin.hewitson%40aei.mpg.de
 
 This email sent to martin.hewit...@aei.mpg.de
 
 
 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
 
 
 
 
 
 


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


Re: core data, undo and redo - follow-up question

2010-05-22 Thread Kyle Sluder
On Sat, May 22, 2010 at 10:20 AM, Martin Hewitson
martin.hewit...@aei.mpg.de wrote:
 Actually, I remembered what the other problem was that 'lead me down the 
 wrong path'. I'm observing one of the properties of the NSManagedObject, so 
 before I remove it from the tree-controller, I stop observing the property. 
 Now if I undo the removal, I need a place to set up the observing again.

 Can anybody recommend where I should do that? I notice that 
 insertObject:atArrangedObjectIndexPath: of NSTreeController is not called 
 when I undo the removal.

In the undo action itself? Barring that, other options depend on who's
doing the observing. If it's controller-level code, you should
theoretically be able to set up all your observing as objects are
added to and removed from the controller's set of objects it controls.
If it's model-level code, that answer depends on specifics of your
model.

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


[Moderator] Behavior on the list and off.

2010-05-22 Thread Scott Anguish
I shouldn’t have to post this.

List users are expected to behave in a professional manner. 

This is not the place for personal arguments. Period. Doing so will get you 
moderated, and then unsubbed. Attempting to bypass that will result in further 
action. If others assist, they’ll also be subject to the same issues.

Abusing or ignoring the behavior direction of Apple Employees will also cause 
moderation, possibly unsubbed, and reporting to WWDR. Swearing and harassing 
employees will result in immediate reporting to WWDR. 

Behaving off-list in the same manner, harassing list members, swearing at them 
or being abusive in that manner will ALSO get you moderation, possibly 
unsubbed, and reporting to WWDR.

As I said, I shouldn’t have to post this. 


The list is for technical discussion only, otherwise, actions will be taken.

Scott Anguish
[moderator]___

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

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

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

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


Re: core data, undo and redo - follow-up question

2010-05-22 Thread Martin Hewitson

On May 22, 2010, at 7:25 PM, Kyle Sluder wrote:

 On Sat, May 22, 2010 at 10:20 AM, Martin Hewitson
 martin.hewit...@aei.mpg.de wrote:
 Actually, I remembered what the other problem was that 'lead me down the 
 wrong path'. I'm observing one of the properties of the NSManagedObject, so 
 before I remove it from the tree-controller, I stop observing the property. 
 Now if I undo the removal, I need a place to set up the observing again.
 
 Can anybody recommend where I should do that? I notice that 
 insertObject:atArrangedObjectIndexPath: of NSTreeController is not called 
 when I undo the removal.
 
 In the undo action itself?

So I would override undo: and then try to figure out which items were 
re-inserted, then observe them?

 Barring that, other options depend on who's
 doing the observing. If it's controller-level code, you should
 theoretically be able to set up all your observing as objects are
 added to and removed from the controller's set of objects it controls.

Yes, it's controller-level code, in fact it's my tree-controller subclass 
that's doing the observing. That's why I was hoping that 
insertObject:atArrangedObjectIndexPath: would be called when I undo the 
removal, alas...

Thanks,

Martin


 If it's model-level code, that answer depends on specifics of your
 model.
 
 --Kyle Sluder


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


Re: core data, undo and redo - follow-up question

2010-05-22 Thread Kyle Sluder

Oops, forgot to copy the list.

--Kyle Sluder

Begin forwarded message:


From: Kyle Sluder kyle.slu...@gmail.com
Date: May 22, 2010 10:57:47 AM PDT
To: Martin Hewitson martin.hewit...@aei.mpg.de
Subject: Re: core data, undo and redo - follow-up question



On May 22, 2010, at 10:38 AM, Martin Hewitson martin.hewit...@aei.mpg.de 
 wrote:


So I would override undo: and then try to figure out which items  
were re-inserted, then observe them?


No. The action method that performs the deletion would also register  
an undo action in the current group that reestablishes KVO.


--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: core data, undo and redo - follow-up question

2010-05-22 Thread Martin Hewitson
Thanks, Kyle. I can see a way forward now based on what you suggested. I'll 
give it a go.

Best wishes,

Martin

On May 22, 2010, at 8:01 PM, Kyle Sluder wrote:

 Oops, forgot to copy the list.
 
 --Kyle Sluder
 
 Begin forwarded message:
 
 From: Kyle Sluder kyle.slu...@gmail.com
 Date: May 22, 2010 10:57:47 AM PDT
 To: Martin Hewitson martin.hewit...@aei.mpg.de
 Subject: Re: core data, undo and redo - follow-up question
 
 
 On May 22, 2010, at 10:38 AM, Martin Hewitson martin.hewit...@aei.mpg.de 
 wrote:
 
 So I would override undo: and then try to figure out which items were 
 re-inserted, then observe them?
 
 No. The action method that performs the deletion would also register an undo 
 action in the current group that reestablishes KVO.
 
 --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/martin.hewitson%40aei.mpg.de
 
 This email sent to martin.hewit...@aei.mpg.de


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


NSMovieView - QTMovieView; rate problems...

2010-05-22 Thread Matthew Weinstein
Dear developers,

One important aspect of my app is teh ability to speed and slow audio (and 
video playback). On the old NSMovieview this worked like an analog tape 
machine: if you used NSMovieview setRate: it would slow the sound down smoothly 
but make it lower; which is fine. Under the new regime, the audio playback 
using [[QTMovieview movie] setRate: (float)] you get VERY choppy sound and no 
variation in tone. I don't actually care about the variation in tone, I care a 
lot about the smoothness of the sound. Is there any way to get smooth audio 
while changing the rate to r != 1?

___

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

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


NSTokenField memory management issue

2010-05-22 Thread Dan Treiman
I have a cocoa app which changes the content of a window as you navigate, 
similar to a web browser.  This app is compiled using gc required.  Everything 
is fine unless my NSTokenField subclass is displayed, in which case the entire 
view hierarchy remains rooted and does not get garbage collected.

I'm using NSRoundedTokenStyle, and my best guess is that the tokens are 
registered somewhere to track the mouse?  Why else would they be rooted?  
Anyway, does anybody have any insight or any suggestions on how to work around 
this?

thanks!
- Dan Treiman


(gdb) info gc-roots 0x20073ff80
Number of roots: 3
Root:
   0 Kind: bytes   rc:   1  Address: 0x0002011a6960
   1 Kind: bytes   rc:   0  Address: 0x0002011a6ee0  Offset: 
0x0050
   2 Kind: object  rc:   0  Address: 0x00020086bc60  Offset: 
0x0020  Class: NSTokenAttachment
   3 Kind: object  rc:   0  Address: 0x00020070e220  Class: 
NSTokenFieldCell  ivar: NSTextFieldCell.NSActionCell._controlView
   4 Kind: object  rc:   0  Address: 0x000200726c40  Class: 
GSAttributeTokenField  ivar: 
NSTokenField.NSTextField.NSControl.NSView.NSResponder._nextResponder
   5 Kind: object  rc:   0  Address: 0x00020073bcc0  Class: NSView  ivar: 
NSResponder._nextResponder
   6 Kind: object  rc:   0  Address: 0x0002007eb000  Class: NSTabView  
ivar: _delegate

___

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

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


Undo/Redo Notifications

2010-05-22 Thread Gordon Apple
So far, I don't see what I need for enabling/disabling undo/redo buttons in
iPhoneOS NSUndoManager.  I want to implement an undo button/popover, a la
Pages, for a UITextView.  I know I can read canUndo/canRedo, but I need an
active notification when undo status changes in order to enable/disable the
button and popover action buttons.  What is the best way to get this,
preferably without subclassing UITextView?  Available notifications don't
seem to be what I need.

(MacOS usually does this when dropping a menu.  That doesn't work here.)




___

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

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

2010-05-22 Thread Ken Ferry
On Sat, May 22, 2010 at 12:14 AM, B.J. Buchalter b...@mhlabs.com wrote:


 On May 21, 2010, at 10:10 PM, Ken Ferry wrote:

  Hi BJ,

 On Fri, May 21, 2010 at 2:44 PM, B.J. Buchalter b...@mhlabs.com wrote:
 I read the NSImage and Cocoa drawing guide docs, which tends to indicate
 that calling drawInRect:fromRect:operation:fraction: on an NSImage will
 cause it to create a cached image rep that matches the scaled image so that
 the next time it is drawn it does not need to be scaled again.

 The docs haven't fully integrated new info from 10.6, when NSImage changed
 a bunch.  Take a look at the AppKit release notes.


 Oh -- sorry; I am testing on 10.5 -- I should have mentioned that.


  That is not what I am seeing here, and the scaling is definitely taking a
 nontrivial amount of time when redrawing my views. I have played around with
 setting the caching and scaling on the NSImage, but it doesn't appear to be
 having any impact (the internal image rep for the image never changes).

 Could you attach a test app please?  There's more than one thing that
 could be the issue.


 I'll try to reduce my code to something very simple.

 Basically what I am seeing is that when I call
 drawInRect:fromRect:operation:fraction:, no mater what I pass in the for
 drawInRect (which causes the image to draw scaled), if I NSLog(@%@,
 theImage) after doing the drawing I get:

 Drawing Image with width: 49.00 and height: 49.00
 NSImage 0x13e770 Size={64, 64} Reps=(
NSBitmapImageRep 0x13c4f0 Size={64, 64}
 ColorSpace=NSCalibratedRGBColorSpace BPS=8 BPP=32 Pixels=64x64 Alpha=YES
 Planar=NO Format=2 CGImage=0x16007270
 )

 Note that the image has not cached a reduced NSBitmapImageRep or
 NSCachedImageRep with Size={49, 49}


I would want to profile your code, the description method is not enough to
debug a perf problem of this sort.

In 10.6 at least, if you are simply drawing with an NSImage that is backed
by a single CGImage, that CGImage itself would normally be considered the
Cocoa-level cache - there would be no extra allocation.  This is because CG
should have enough info to cache correctly in this case, so anything Cocoa
did on top we would expect to be a waste.  A cache (which itself is a
CGImage) would be generated for something like a PDF.

The applicability of caches may depend on how you're drawing the image.  Is
it always targeting new contexts?  Different colorspaces?  Different pixel
alignments?  Alternating sizes? etc.  Perhaps the CG-level cache is never
judged applicable.  Or, perhaps caches get expired because there's too much
stuff that wants caching.  Etc.

-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: Calling allObjects memory allocation problem

2010-05-22 Thread Clark S. Cox III

On May 21, 2010, at 8:54 AM, Keary Suska wrote:

 On May 21, 2010, at 9:18 AM, Paul Sanders wrote:
 
 Also be aware that just because memory is released, doesn't mean it is 
 returned to the system (e.g. you will not
 see your apps memory usage go down in Activity Monitor). In fact,  AFAIK, 
 it is never returned to the system,
 except perhaps in low memory situations.
 
 I don't actually think that's true.  At least, it's not what I observe.  I 
 think it's more accurate to say that you cannot predict when memory which 
 has been allocated and then freed will be returned to the operating system, 
 nor how much.  It happens, I believe, in 4k pages, but probably not one at a 
 time and will be heavily dependent on fragmentation of the process's heap.  
 No doubt there is much more to know.
 
 I agree with the sentiment of keeping an eye on your peak memory usage.  I 
 use Instruments for this, and it found one instance where memory usage was 
 creeping steadily up when the app was playing audio but otherwise idle.
 
 Maybe AFAIK should be As Far As I have Observed, as although using tools 
 like instruments I have seen constant tiny increases and decreases, I have 
 yet to see peak memory reduce over the lifetime of an application. 
 Fragmentation could certainly play a role--I don't know of any means to check 
 that. If this truly is the issue most of the time, it seems to me that for 
 most practical points and purposes that the memory won't get returned anyway, 
 as fragmentation seems to be so common. 

Allocations below a certain size (which varies based on CPU and installed RAM 
and other factors) are unlikely to be returned to the OS. Instead, they are 
re-used for future allocations of similar size. Allocations above that size are 
allocated directly from the OS and are returned thereto upon deallocation. Of 
course, all of the parameters are subject to change (and have changed over 
various OS releases), but the general concept holds. This is, of course, why 
tools such as heap are much better for inspecting your process' memory usage 
than tools like Activity Monitor, as they are much better informed about the 
specific behavior of malloc.___

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

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

2010-05-22 Thread James W. Walker

On May 22, 2010, at 1:26 PM, Matthew Weinstein wrote:

 One important aspect of my app is teh ability to speed and slow audio (and 
 video playback). On the old NSMovieview this worked like an analog tape 
 machine: if you used NSMovieview setRate: it would slow the sound down 
 smoothly but make it lower; which is fine. Under the new regime, the audio 
 playback using [[QTMovieview movie] setRate: (float)] you get VERY choppy 
 sound and no variation in tone. I don't actually care about the variation in 
 tone, I care a lot about the smoothness of the sound. Is there any way to get 
 smooth audio while changing the rate to r != 1?

Maybe you could try setting QTMovieRateChangesPreservePitchAttribute to NO when 
you initialize the QTMovie.

___

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

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

2010-05-22 Thread Fritz Anderson
On 22 May 2010, at 4:30 PM, Gordon Apple wrote:

 So far, I don't see what I need for enabling/disabling undo/redo buttons in
 iPhoneOS NSUndoManager.  I want to implement an undo button/popover, a la
 Pages, for a UITextView.  I know I can read canUndo/canRedo, but I need an
 active notification when undo status changes in order to enable/disable the
 button and popover action buttons.  What is the best way to get this,
 preferably without subclassing UITextView?  Available notifications don't
 seem to be what I need.
 
 (MacOS usually does this when dropping a menu.  That doesn't work here.)

Tell us how the NSUndoManager...Notifications don't work for you. They apply 
only to actual undo/redo events, and the opening and closing of undo groups, 
but I'd have enough hope that the UIKit text system aggregated change events 
that I'd test to see if those notifications came through. Have you done that?

Analogies to Mac OS menu validations don't work. It's pretty plain that Apple 
_really_ doesn't want to see menus in iPhone OS applications. 

Pages can do it (technically) because it doesn't rely on the text controls to 
modify text. Everything goes through the Pages event loop, so it knows 
independently whether something has been modified.

Pages can do it as UI, on Apple's long-standing user-experience principle of 
Quod Licet Jovi Non Licet Bovi.

If you really needed it, you could hold your nose and poll every half-second or 
so.

— F

___

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

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

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

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


Re: getting file creation date from NTFS

2010-05-22 Thread Angelo Chen
As suggested by Ken, I tried FSMegaInfo on NOTEPAD.EXE in a bootcamp volume:if 
I compared it with Finder's display, Finder listed March 30, 2010 6:48PM as 
'Created'looks like, st_atime is the creation date?
'NOTEPAD.EXE'    st_dev     = 0x0e03 (major=14, minor=3, disk0s3)    st_ino 
    = 2469    st_mode    = 0x81ed (-rwxr-xr-x)    st_nlink   = 1    st_uid  
   = 501 (user1)    st_gid     = 20 (staff)    st_rdev    = 0x 
(major=0, minor=0, console)    st_atime   = 1269957274.686875000 (Tue Mar 30 
13:54:34 2010)    st_mtime   = 1091595416.0 (Wed Aug  4 04:56:56 2004)    
st_ctime   = 1274540319.708286000 (Sat May 22 14:58:39 2010)    st_size    = 
69120 (67 KB)    st_blocks  = 136    st_blksize = 33554432    st_flags   = 
0x    st_gen     = 0

--- 2010年5月23日 星期日,Paul Sanders p.sand...@alpinesoft.co.uk 寫道﹕

寄件人: Paul Sanders p.sand...@alpinesoft.co.uk
主題: Re: getting file creation date from NTFS
收件人: Ken Thomases k...@codeweavers.com, Angelo Chen 
angelochen...@yahoo.com.hk
副本(CC): cocoa-dev@lists.apple.com
日期: 2010年5月23日,星期日,上午1:14

 Also be aware that not all file systems support the notion of 
 creation dates of their objects.  I don't know off-hand if 
 NTFS does.

It does.

Paul Sanders. 







___

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

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

2010-05-22 Thread Gordon Apple
Well, I was hoping maybe someone could show me the obvious that I was
missing.  :-)   I guess I'm going to have to brush up on my undo handling,
especially since I'm also doing some programmatic edits.

I didn't use the popover for now, just did separate undo/redo buttons, which
works.  But I would like to disable them if there is nothing in the
respective undo/redo stacks.  Yup, I could always poll it for
canUndo/canRedo.  Yeeech!  That is in fact what I did for my 2-column font
picker.  They provided the means to have dependent columns in the
PickerView, but no way to actually update them -- so I polled it.  Works ok
for something sparsely used, but I hate to use polling for something in
long-term operation, like text editing.

I guess the advantage of a single undo button/popover is that is is more
like a Mac menu, although more persistent, allowing serial taps.  It could
also allow for undo/redo titles, although I notice that Pages didn't bother
with such.

The docs are still pretty sparse.  I didn't even realize that UITextView
supported undo/redo until I accidentally (who knows how) triggered an alert
asking if I wanted to undo typing.  So I implemented it and, much to my
surprise, it worked.


On 5/22/10 8:02 PM, Fritz Anderson fri...@manoverboard.org wrote:

 On 22 May 2010, at 4:30 PM, Gordon Apple wrote:
 
 So far, I don't see what I need for enabling/disabling undo/redo buttons in
 iPhoneOS NSUndoManager.  I want to implement an undo button/popover, a la
 Pages, for a UITextView.  I know I can read canUndo/canRedo, but I need an
 active notification when undo status changes in order to enable/disable the
 button and popover action buttons.  What is the best way to get this,
 preferably without subclassing UITextView?  Available notifications don't
 seem to be what I need.
 
 (MacOS usually does this when dropping a menu.  That doesn't work here.)
 
 Tell us how the NSUndoManager...Notifications don't work for you. They apply
 only to actual undo/redo events, and the opening and closing of undo groups,
 but I'd have enough hope that the UIKit text system aggregated change events
 that I'd test to see if those notifications came through. Have you done that?
 
 Analogies to Mac OS menu validations don't work. It's pretty plain that Apple
 _really_ doesn't want to see menus in iPhone OS applications.
 
 Pages can do it (technically) because it doesn't rely on the text controls to
 modify text. Everything goes through the Pages event loop, so it knows
 independently whether something has been modified.
 
 Pages can do it as UI, on Apple's long-standing user-experience principle of
 Quod Licet Jovi Non Licet Bovi.
 
 If you really needed it, you could hold your nose and poll every half-second
 or so.
 
 ‹ F
 


___

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

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

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

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


Re: Undo/Redo Notifications

2010-05-22 Thread Gideon King
If you want to do something that the standard undo manager doesn't do, you 
could drop in GCUndoManager from http://apptree.net/gcundomanager.htm

I have been using it in my current project, and have found the ability to 
actually see what is going on in the undo stack a real boon, and of course with 
the source code right there, it would be easy to add a notification such as 
what you describe. I haven't encountered any problems using this replacement 
undo manager, and it has dramatically sped up my debugging of undo issues.

I'm using it in an OSX app, and have never done any iPhone programming, so 
don't know if there would be any issues using it in an iPhone app.

HTH

Gideon

On 23/05/2010, at 1:52 PM, Gordon Apple wrote:

 
 On 22 May 2010, at 4:30 PM, Gordon Apple wrote:
 
 So far, I don't see what I need for enabling/disabling undo/redo buttons in
 iPhoneOS NSUndoManager.  I want to implement an undo button/popover, a la
 Pages, for a UITextView.  I know I can read canUndo/canRedo, but I need an
 active notification when undo status changes in order to enable/disable the
 button and popover action buttons.  What is the best way to get this,
 preferably without subclassing UITextView?  Available notifications don't
 seem to be what I need.
 

___

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

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