RE:Instantly delete a directory without recursion?
Is there a way to delete a directory instantly and completely without first deleting all its subdirectories and files recursively? The hierarchical structure that you see is not real -- directories are not physical containers for the files that they appear to contain. The directory hierarchy is a carefully maintained fiction. Irrelevant aside: The original Mac file system took this a step further -- it made the directory structure totally a visual fiction -- all of the files were at the root of the (3.5) floppy) disk, and only _seemed_ to be arranged in folders. Thankfully this was supplanted by HFS. It is better to think of directories/folders as a special kind of file that contains an index to a set of files that it is going to _pretend_ to contain. Conceptually, this works much like classical Cocoa memory management. Each (directory/object) owns a set of (files/objects) by reference (retains the (file/object)). When you delete a file from a directory, it is released. If no other directory has an ownership claim on that file, it is dealloc'ed. Your (folder/object) doesn't contain the objects that it owns. It doesn't really even own them -- it just has a ownership claim on them. From Wikipedia's article about Hard Links: a hard link is a directory entry that associates a name with a file on a file system. A directory is itself a special kind of file that contains a list of such entries. Note that due to the use of hard links it is possible to have a single physical file that can appear in multiple directories. Each one of those directories owns a reference to the real file. Each reference is as real as any other. All references have to be unlinked for the file to be marked as deleted. The file can even have different names in the different directories! Hard links are the chain saw of filesystem features -- powerful, but potentially quite dangerous. Note that the OSX GUI provides no means of producing hard links, or even symlinks. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Why isn't this delegate protocol being seen?
Why not just include all of CoreLocation and have you added CoreLocation to your framework list in Xcode. On Oct 4, 2010, at 13:11, G S stokest...@gmail.com wrote: Hi all. I'm getting a compiler warning that this delegate protocol isn't defined, when it most certainly is defined in the CLLocationManager.h file that I've included: #import UIKit/UIKit.h #import CoreLocation/CLLocation.h #importCoreLocation/CLLocationManager.h @interface MyController : UIViewController CLLocationManagerDelegate { UITableViewController*tableViewController; CLLocationManager*locationManager; } The message says no definition of protocol 'CLLocationManagerDelegate' is found. Any ideas? Thanks! ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/rols%40rols.org This email sent to r...@rols.org ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Why isn't this delegate protocol being seen?
On Sun, Oct 3, 2010 at 10:11 PM, G S stokest...@gmail.com wrote: Hi all. I'm getting a compiler warning that this delegate protocol isn't defined, when it most certainly is defined in the CLLocationManager.h file that I've included: No it's not. CLLocationManagerDelegate is defined in CLLocationManagerDelegate.h. CLLocationManager.h only includes a forward reference to the protocol. While #importing CLLocationMangaerDelegate.h will work, you're probably best off replacing your individual header file imports with an import of the umbrella header CoreLocation.h. Also, a style point: when including framework headers, convention is to use angle brackets, as you have done for your UIKit.h import. It visually separates system headers from header files in your own project. --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: Instantly delete a directory without recursion?
When removing directories, the OS should remove all the tree created in the filesystem. I think you cannot do anything else? Is it so critical? How many files do you have to delete? On Oct 4, 2010, at 10:12 AM, Oleg Krupnov wrote: Let me make the question more clear: I am aware of functions like [NSFileManager removeItemAtPath: error:], but what they do under the hood is they iterate through the subdirectories and files and delete them first. This takes some time. I am interested if it is possible to do this instantly, without even implicit recursion. Just remove the directory and the files and subdirectories would disappear? Thanks! On Mon, Oct 4, 2010 at 11:03 AM, Oleg Krupnov oleg.krup...@gmail.com wrote: Hi, Is there a way to delete a directory instantly and completely without first deleting all its subdirectories and files recursively? Thanks. Oleg. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/guillem.palou%40gmail.com This email sent to guillem.pa...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Instantly delete a directory without recursion?
Hi Guillem, You are correct, in many cases the number of files will not be big, so it should not matter too much, but using the opportunity, I decided to illuminate myself regarding the possibilities there are in the file system. I had an idea that because the directory tree is growing from a single root, there *might* be a possibility to axe it off with a single hit. Is it possible? Thanks. On Mon, Oct 4, 2010 at 11:18 AM, Guillem Palou guillem.pa...@gmail.com wrote: When removing directories, the OS should remove all the tree created in the filesystem. I think you cannot do anything else? Is it so critical? How many files do you have to delete? On Oct 4, 2010, at 10:12 AM, Oleg Krupnov wrote: Let me make the question more clear: I am aware of functions like [NSFileManager removeItemAtPath: error:], but what they do under the hood is they iterate through the subdirectories and files and delete them first. This takes some time. I am interested if it is possible to do this instantly, without even implicit recursion. Just remove the directory and the files and subdirectories would disappear? Thanks! On Mon, Oct 4, 2010 at 11:03 AM, Oleg Krupnov oleg.krup...@gmail.com wrote: Hi, Is there a way to delete a directory instantly and completely without first deleting all its subdirectories and files recursively? Thanks. Oleg. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/guillem.palou%40gmail.com This email sent to guillem.pa...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Why isn't this delegate protocol being seen?
Hi all. I'm getting a compiler warning that this delegate protocol isn't defined, when it most certainly is defined in the CLLocationManager.h file that I've included: #import UIKit/UIKit.h #import CoreLocation/CLLocation.h #import CoreLocation/CLLocationManager.h @interface MyController : UIViewController CLLocationManagerDelegate { UITableViewController* tableViewController; CLLocationManager* locationManager; } The message says no definition of protocol 'CLLocationManagerDelegate' is found. Any ideas? Thanks! ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Why isn't this delegate protocol being seen?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/3/10 10:11 PM, G S wrote: Hi all. I'm getting a compiler warning that this delegate protocol isn't defined, when it most certainly is defined in the CLLocationManager.h file that I've included: #import UIKit/UIKit.h #import CoreLocation/CLLocation.h #import CoreLocation/CLLocationManager.h Works for me (so long as Core Location is added to frameworks). The following is all you really need: #import CoreLocation/CoreLocation.h - -- Conrad Shultz Synthetiq Solutions www.synthetiqsolutions.com -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.14 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkypZbUACgkQaOlrz5+0JdUEcwCfTGLtH+Gxb8bjfqVX5m9enttF l8cAnRED3wra0HXCn4pqknBn3mbUId/H =3iNM -END PGP 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: Why isn't this delegate protocol being seen?
G S wrote: No it's not. CLLocationManagerDelegate is defined in CLLocationManagerDelegate.h. CLLocationManager.h only includes a forward reference to the protocol. Aha, right-O. Thanks. I had just done a quick search and found the string in there, and left it at that. I have a bunch of examples that for some reason import the specific files instead of CoreLocation.h. Replacing them with that single file did the trick. I do prefer the angle brackets, but have encountered unpredictable results when using them in the past. They do work here, however. Kyle was not quite accurate in simply referring to the brackets vs. quotes as a matter of style. An include directive with quotes searches in more locations than one using brackets. The oversimplified delineation is that the brackets will only consider system-provided headers while the quotes will consider those *after* first looking within your project. For a more correct explanation, I'd point you toward any C language reference. But as a practical matter the summary'll do fine until you get a chance. Greg ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
How to get selected text in a WebView
I have a Webview, and I want to do something with the selected text. I tried: DOMRange *dr = [ webView selectedDOMRange ]; NSString *m = [ dr markupString ]; this contains the selected characters, but buried in lots of markup language. But I just want the characters. NSString *s= [ dr stringRepresentation ]; just returns Undefined. I could do [webView copy:nil ]; and then get the string from the general pasteboard, but I rather do not like to mess up the pasteboard - the user might have put something important there. So I tried: NSPasteboard *pasteboard = [ NSPasteboard pasteboardWithUniqueName ]; NSArray *types = [ NSArray arrayWithObject: NSPasteboardTypeString ]; [ webView writeSelectionWithPasteboardTypes: types toPasteboard: pasteboard ]; NSString *po = [ pasteboard stringForType: NSPasteboardTypeString ]; NSLog(@%s selectedString \%...@\,__FUNCTION__,po); but the result is: selectedString (null) Adding [ pasteboard declareTypes: types owner: nil ] does not make any changes. So what am I doing wrong? How to get the selection as string form a WebView? Kind regards, Gerriet. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Instantly delete a directory without recursion?
No; the OS doesn't support this. From the lowest levels I can think of... One the posix side, you call rmdir() and that only works if the directory is empty (witht the exception of '.' and '..'). On the Carbon FileManager side, you call FSDeleteObject() and again, that only works if the directory is empty. On Mon, Oct 4, 2010 at 3:12 AM, Oleg Krupnov oleg.krup...@gmail.com wrote: Let me make the question more clear: I am aware of functions like [NSFileManager removeItemAtPath: error:], but what they do under the hood is they iterate through the subdirectories and files and delete them first. This takes some time. I am interested if it is possible to do this instantly, without even implicit recursion. Just remove the directory and the files and subdirectories would disappear? Thanks! On Mon, Oct 4, 2010 at 11:03 AM, Oleg Krupnov oleg.krup...@gmail.com wrote: Hi, Is there a way to delete a directory instantly and completely without first deleting all its subdirectories and files recursively? Thanks. Oleg. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/stephen.butler%40gmail.com This email sent to stephen.but...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Instantly delete a directory without recursion?
I don't think so, If time is a constraint, try running the delete process in a background thread, if it is not a problem. On Oct 4, 2010, at 10:24 AM, Oleg Krupnov wrote: Hi Guillem, You are correct, in many cases the number of files will not be big, so it should not matter too much, but using the opportunity, I decided to illuminate myself regarding the possibilities there are in the file system. I had an idea that because the directory tree is growing from a single root, there *might* be a possibility to axe it off with a single hit. Is it possible? Thanks. On Mon, Oct 4, 2010 at 11:18 AM, Guillem Palou guillem.pa...@gmail.com wrote: When removing directories, the OS should remove all the tree created in the filesystem. I think you cannot do anything else? Is it so critical? How many files do you have to delete? On Oct 4, 2010, at 10:12 AM, Oleg Krupnov wrote: Let me make the question more clear: I am aware of functions like [NSFileManager removeItemAtPath: error:], but what they do under the hood is they iterate through the subdirectories and files and delete them first. This takes some time. I am interested if it is possible to do this instantly, without even implicit recursion. Just remove the directory and the files and subdirectories would disappear? Thanks! On Mon, Oct 4, 2010 at 11:03 AM, Oleg Krupnov oleg.krup...@gmail.com wrote: Hi, Is there a way to delete a directory instantly and completely without first deleting all its subdirectories and files recursively? Thanks. Oleg. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/guillem.palou%40gmail.com This email sent to guillem.pa...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Instantly delete a directory without recursion?
If you unlinked just the top-level directory node, you would leave all of its descendents with a link count 0, and the corresponding blocks claimed by the descendents would never be freed. (Ever. No one would have a reference to them, and they'd never be found in subsequent traversals.) To regain the space, you have to traverse through the structure and decrement the link count of the children of the tree. So, no. -- m On 04 Oct, 2010, at 01:24, Oleg Krupnov wrote: Hi Guillem, You are correct, in many cases the number of files will not be big, so it should not matter too much, but using the opportunity, I decided to illuminate myself regarding the possibilities there are in the file system. I had an idea that because the directory tree is growing from a single root, there *might* be a possibility to axe it off with a single hit. Is it possible? Thanks. On Mon, Oct 4, 2010 at 11:18 AM, Guillem Palou guillem.pa...@gmail.com wrote: When removing directories, the OS should remove all the tree created in the filesystem. I think you cannot do anything else? Is it so critical? How many files do you have to delete? On Oct 4, 2010, at 10:12 AM, Oleg Krupnov wrote: Let me make the question more clear: I am aware of functions like [NSFileManager removeItemAtPath: error:], but what they do under the hood is they iterate through the subdirectories and files and delete them first. This takes some time. I am interested if it is possible to do this instantly, without even implicit recursion. Just remove the directory and the files and subdirectories would disappear? Thanks! On Mon, Oct 4, 2010 at 11:03 AM, Oleg Krupnov oleg.krup...@gmail.com wrote: Hi, Is there a way to delete a directory instantly and completely without first deleting all its subdirectories and files recursively? Thanks. Oleg. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/guillem.palou%40gmail.com This email sent to guillem.pa...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/mikey-san%40bungie.org This email sent to mikey-...@bungie.org ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Instantly delete a directory without recursion?
Thanks everyone! Now I see. Oleg. On Mon, Oct 4, 2010 at 4:14 PM, Kirk Kerekes kirkkere...@gmail.com wrote: Is there a way to delete a directory instantly and completely without first deleting all its subdirectories and files recursively? The hierarchical structure that you see is not real -- directories are not physical containers for the files that they appear to contain. The directory hierarchy is a carefully maintained fiction. Irrelevant aside: The original Mac file system took this a step further -- it made the directory structure totally a visual fiction -- all of the files were at the root of the (3.5) floppy) disk, and only _seemed_ to be arranged in folders. Thankfully this was supplanted by HFS. It is better to think of directories/folders as a special kind of file that contains an index to a set of files that it is going to _pretend_ to contain. Conceptually, this works much like classical Cocoa memory management. Each (directory/object) owns a set of (files/objects) by reference (retains the (file/object)). When you delete a file from a directory, it is released. If no other directory has an ownership claim on that file, it is dealloc'ed. Your (folder/object) doesn't contain the objects that it owns. It doesn't really even own them -- it just has a ownership claim on them. From Wikipedia's article about Hard Links: a hard link is a directory entry that associates a name with a file on a file system. A directory is itself a special kind of file that contains a list of such entries. Note that due to the use of hard links it is possible to have a single physical file that can appear in multiple directories. Each one of those directories owns a reference to the real file. Each reference is as real as any other. All references have to be unlinked for the file to be marked as deleted. The file can even have different names in the different directories! Hard links are the chain saw of filesystem features -- powerful, but potentially quite dangerous. Note that the OSX GUI provides no means of producing hard links, or even symlinks. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Property list file with NSNumber objects as keys
http://developer.apple.com/library/mac/#documentation/cocoa/Conceptual/PropertyLists/AboutPropertyLists/AboutPropertyLists.html%23//apple_ref/doc/uid/1048i-CH3-46719-CJBIGFCD No. writeToFile: writes a property list representation of the dictionary and from the above you can see that NSDictionary must have String keys to be a property list. You could turn it into NSData and write it like that perhaps. On 04-Oct-2010, at 8:45 PM, Remco Poelstra wrote: Hi, In the NSDictionary documentation it is stated that NSNumber objects are valid property list objects. But when I create a dictionary with NSNumbers as keys, writeToFile: fails. If I use strings, then it succeeds. Is it possible to use NSNumbers as keys and have the, read/written from/to file? Thanks in advance. Kind regards, Remco Poelstra ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/rols%40rols.org This email sent to r...@rols.org ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Instantly delete a directory without recursion?
Hi, Is there a way to delete a directory instantly and completely without first deleting all its subdirectories and files recursively? Thanks. Oleg. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Property list file with NSNumber objects as keys
Hi, In the NSDictionary documentation it is stated that NSNumber objects are valid property list objects. But when I create a dictionary with NSNumbers as keys, writeToFile: fails. If I use strings, then it succeeds. Is it possible to use NSNumbers as keys and have the, read/written from/to file? Thanks in advance. Kind regards, Remco Poelstra ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Property list file with NSNumber objects as keys
It has to be strings because that's the definition of a property list and that method writes a property list representation. On 04-Oct-2010, at 9:00 PM, Remco Poelstra wrote: Op 4-10-2010 14:55, Roland King schreef: http://developer.apple.com/library/mac/#documentation/cocoa/Conceptual/PropertyLists/AboutPropertyLists/AboutPropertyLists.html%23//apple_ref/doc/uid/1048i-CH3-46719-CJBIGFCD No. writeToFile: writes a property list representation of the dictionary and from the above you can see that NSDictionary must have String keys to be a property list. You could turn it into NSData and write it like that perhaps. Thanks for your reply. I don't see why it have to be strings, just because it will be an XML file, but if it's not possible than that's OK for me. I just hoped that using NSNumber would make it faster (to look up), since it requires less conversions. Regards, Remco Poelstra ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/rols%40rols.org This email sent to r...@rols.org ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Instantly delete a directory without recursion?
Let me make the question more clear: I am aware of functions like [NSFileManager removeItemAtPath: error:], but what they do under the hood is they iterate through the subdirectories and files and delete them first. This takes some time. I am interested if it is possible to do this instantly, without even implicit recursion. Just remove the directory and the files and subdirectories would disappear? Thanks! On Mon, Oct 4, 2010 at 11:03 AM, Oleg Krupnov oleg.krup...@gmail.com wrote: Hi, Is there a way to delete a directory instantly and completely without first deleting all its subdirectories and files recursively? Thanks. Oleg. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Why isn't this delegate protocol being seen?
No it's not. CLLocationManagerDelegate is defined in CLLocationManagerDelegate.h. CLLocationManager.h only includes a forward reference to the protocol. Aha, right-O. Thanks. I had just done a quick search and found the string in there, and left it at that. I have a bunch of examples that for some reason import the specific files instead of CoreLocation.h. Replacing them with that single file did the trick. I do prefer the angle brackets, but have encountered unpredictable results when using them in the past. They do work here, however. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Instantly delete a directory without recursion?
Hello, Oleg, If you're worried about the time this would take and you need an instant results you could rename the folder (which is virtually instantaneous) then remove the renamed folder and it's contents in a background thread. Regards, Rob. On 4 Oct 2010, at 09:03, Oleg Krupnov wrote: Hi, Is there a way to delete a directory instantly and completely without first deleting all its subdirectories and files recursively? Thanks. Oleg. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Images / ImageRep
Hi, I'm trying to add a feature to my application, where it collects all of the images related to an entity, and puts them into an image in a grid, so I'm planning on looping through the images, scaling them down then placing them onto a new(blank) image, changing the placement point each time. I'm struggling with the whole image section, I think I can just use NSImage, but I think I need NSImageRep for some things, one of which being getting the original size to calulate the rescaled size. From what I can tell I can't just tell it to resize to 100 pixels high, I have to calculate what the width would be and set that at the same time (I know I've also got to bear in mind it's points not pixels). Is there a good tutorial anywhere for this? It doesn't seem too complicated to me, if I can just get stated. So far I can't get the size from an NSImage, and I can't get it to set the NSImageRep. My images are stored as filepaths in the data, so the array I'll be looping though will contain strings for the filepath for each image. Code I'm working with: - (IBAction)generateKitImages:(id)sender; { NSObject *kit; kit = [[kits selectedObjects] objectAtIndex:0]; NSString* fileName = [kit valueForKey:@kitName]; //create new image 300px square NSImage *image; NSSize size = NSMakeSize (300, 300); image = [[NSImage alloc] initWithSize:size]; //select all images for kit NSArray* kitImages = [kit valueForKeyPath:@kitItems.kitItemProduct.productImage]; //set coordinates to x,y - 0,100 //for each image NSEnumerator *imageLoop = [kitImages objectEnumerator]; NSString *imgPath; while ((imgPath = [imageLoop nextObject])) { NSImage *img = [[NSImage alloc]initWithContentsOfFile:imgPath]; //resize to 100px high //get original size //calculate scale factor //[img setScalesWhenResized: YES]; //[img setSize: NSMakeSize (100., 100.)]; //get new coordinates //if coordinates are too wide, start new row - if x300, reset x to 0 and add 100 to y //apply image to view //get image width and add to coordinates //set new coordinates } //apply kit logo to view //apply kit date (text) to view //save files out ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Property list file with NSNumber objects as keys
Op 4-10-2010 14:55, Roland King schreef: http://developer.apple.com/library/mac/#documentation/cocoa/Conceptual/PropertyLists/AboutPropertyLists/AboutPropertyLists.html%23//apple_ref/doc/uid/1048i-CH3-46719-CJBIGFCD No. writeToFile: writes a property list representation of the dictionary and from the above you can see that NSDictionary must have String keys to be a property list. You could turn it into NSData and write it like that perhaps. Thanks for your reply. I don't see why it have to be strings, just because it will be an XML file, but if it's not possible than that's OK for me. I just hoped that using NSNumber would make it faster (to look up), since it requires less conversions. Regards, Remco Poelstra ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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] Changing iPhone Application Language Programatically.
Hi, I would like to know whether its possible to change to a language other than provided list of languages in iPhone Settings. By default using localized .lproj folders .strings files we could make applicaton localized into selected language. For example, Languages like Sinhala are not in those set of languages in Settings. And there also does not have Sinhala Keyboard on iPhone. But Sinhala unicode font is available from iOS 4 onwards which is nice even it has some rendering issues. If I want to build a localized app for that language, is it legal and whether its possible that I will create si.lproj directory and programatically forcing the app to use strings in that folder ?? Thanks and Kind Regards, Tharindu. tharindufit.wordpress.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
Interacting Sizes of NSScrollView and its NSClipView and a Custom NSView
I have a question based on my confusion over the interacting behaviors of an NSScrollView, its NSClipView and a custom NSView being displayed and clipped. I have an NSScrollView which resizes as its window resizes. Therefore the NSClipView resizes within the NSScrollView as the the window resizes. The custom NSView being displayed is small enough in size so that by enlarging the window far enough the NSClipView can become larger than the custom NSView. At this point the custom NSView becomes locked to the lower left corner of the NSScrollView and extra space is added to the top and right margins outside the bounds of the custom NSView. I would like the custom NSView to float in the middle of the NSScrollView under these conditions. Other applications seem to implement this behavior. I've been experimenting with settings but haven't been able to figure out how to get what I want. For the time being I have added the window delegate method windowWillResize:toSize: to force the window to stop growing at the point where the NSClipView reaches the same size as the custom NSView, so at least things look nice and neat, with the scroll bars going inactive at the exact point where the window stops growing, but I'd rather have the floating behavior. Can anyone offer any advice? Tom Wetmore, Massachusetts___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Adding subviews to collapsed splitview
Thanks for the tip Rainer - with that, I was able to track down the problem by adding the subview directly to the outer split view. Thanks again for providing such a useful component. Regards Gideon On 02/10/2010, at 5:48 AM, Rainer Brockerhoff wrote: Is there any special reason for you to add the subview at runtime? And are you actually adding the inner RBSplitView directly as a subview to the outer one (which is recommended), or inserting it into an empty RBSplitSubview? You could try calling -adjustSubviews on the inner RBSplitView after adding it, which should force it to recalculate its own subviews. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: What does core data do during a Save As?
On Sat, 2 Oct 2010 06:35:21 -0700, Jerry Krinock said: I have no tool to diff models When you create a mapping model between two data models, there is a Show Differences button in the upper left corner. Which is nice, but there seems to be no way to diff two .xcdatamodels in the general case. For example, during development, the model can be in flux, and it would be nice to be able to diff one's changes before committing to SCM. -- 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: Hitting Layers
I solved the problem by examining checking to see if the game was in fullscreen mode, and then changing how the NSPoint was calculated. It turns out that everything was slightly offset in fullscreen mode when using convertScreetToBase:. Not exactly a solution with an explanation; but at least it is a solution (code below). CGPoint point; if (GameData sharedGameData] gameController] contentView] isInFullScreenMode]) { point = NSPointToCGPoint(mouseloc); } else { NSPoint translated = [[gameController window] convertScreenToBase:mouseloc]; point = NSPointToCGPoint(translated); } CALayer *rootLayer = [[[gameController window] contentView] layer]; id hitLayer = [rootLayer hitTest:point]; if (![hitLayer isKindOfClass:[GameObjectLayer class]]) return nil; else return hitLayer; On Sat, Oct 2, 2010 at 6:30 AM, Matt Neuburg m...@tidbits.com wrote: I'm wondering that too. CALayer's hitTest requires a point in *superlayer* coordinates. So I'm wondering if you're getting that wrong (as people often do, because it's so surprising), and maybe there's something about how you're obtaining mouseloc (your original point) that masks the issue when you're not in fullscreen mode. m. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: What does core data do during a Save As?
On Sat, 2 Oct 2010 04:28:20 +1000, Gideon King said: The next thing I'm dreading with Core Data is trying to get autosave to work. I got some tips from Ben Trumbull, but it looks like a scary amount of work that I don't fully understand...but that's for another day... Hear hear. It's sad that NSDocument gives us autosave 'for free' and NSPersistentDocument takes that away. :( -- 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: How to get selected text in a WebView
On Oct 4, 2010, at 1:15 AM, Gerriet M. Denkmann wrote: I have a Webview, and I want to do something with the selected text. I tried: DOMRange *dr = [ webView selectedDOMRange ]; NSString *m = [ dr markupString ]; this contains the selected characters, but buried in lots of markup language. But I just want the characters. NSString *s= [ dr stringRepresentation ]; just returns Undefined. I could do [webView copy:nil ]; and then get the string from the general pasteboard, but I rather do not like to mess up the pasteboard - the user might have put something important there. The first thing I would try is use NSAttributedString to convert the HTML. HTH, Keary Suska Esoteritech, Inc. Demystifying technology for your home or business ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Interacting Sizes of NSScrollView and its NSClipView and a Custom NSView
On Oct 4, 2010, at 9:22 AM, Thomas Wetmore wrote: I have a question based on my confusion over the interacting behaviors of an NSScrollView, its NSClipView and a custom NSView being displayed and clipped. I have an NSScrollView which resizes as its window resizes. Therefore the NSClipView resizes within the NSScrollView as the the window resizes. The custom NSView being displayed is small enough in size so that by enlarging the window far enough the NSClipView can become larger than the custom NSView. At this point the custom NSView becomes locked to the lower left corner of the NSScrollView and extra space is added to the top and right margins outside the bounds of the custom NSView. I would like the custom NSView to float in the middle of the NSScrollView under these conditions. Other applications seem to implement this behavior. I've been experimenting with settings but haven't been able to figure out how to get what I want. For the time being I have added the window delegate method windowWillResize:toSize: to force the window to stop growing at the point where the NSClipView reaches the same size as the custom NSView, so at least things look nice and neat, with the scroll bars going inactive at the exact point where the window stops growing, but I'd rather have the floating behavior. Can anyone offer any advice? Yes: http://lmgtfy.com/?q=center+view+in+nsscrollview Keary Suska Esoteritech, Inc. Demystifying technology for your home or business ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
clear a CGContextRef in an iPhone app
Hello, wondering how to clear a context. I'm using this: CGContextClearRect(context, drawingRect); But yet, afetr I do that, and then start to draw something new, I get remnants of the previous content of the context. My workaround is to create brand new context for the second drawing, but shouldn't there be a way to clear an existing context? Thanks for any help, Rainer ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Instantly delete a directory without recursion?
On Oct 4, 2010, at 1:24 AM, Oleg Krupnov wrote: I had an idea that because the directory tree is growing from a single root, there *might* be a possibility to axe it off with a single hit. Is it possible? As Kirk explained, no. Another reason is file permissions. The filesystem needs to check every item in the directory tree to make sure that you are allowed to delete it. -- Greg Parker gpar...@apple.com Runtime Wrangler ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: info.plist with DYLD_LIBRARY_PATH = ~/test
On Oct 2, 2010, at 6:54 PM, Kyle Sluder wrote: Maybe weak linking can help here. If you weak link the Python library and call dlopen early on in your program's lifetime with the appropriate path, I think dyld will populate all the weak linked functions it finds. No, weak linking doesn't do that. You want deferred binding: if the symbol you want is not present at load time but appears later, resolve to that one at that time. dlopen+dlsym is the only way to get that on Mac OS. Normal linking is required and not deferred: if the symbol you want is not present at load time, your process halts. Weak linking is optional, but still not deferred: if the symbol you want is not present at load time, then your references resolve to NULL. You don't get a chance to try again later. -- Greg Parker gpar...@apple.com Runtime Wrangler ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: clear a CGContextRef in an iPhone app
On Oct 4, 2010, at 11:04 AM, Rainer Standke wrote: wondering how to clear a context. I'm using this: CGContextClearRect(context, drawingRect); But yet, afetr I do that, and then start to draw something new, I get remnants of the previous content of the context. Where are you calling this? About the only thing I know of that might cause this is trying to call UIGraphicsGetCurrentContext() from outside of -drawRect: (in which case unless you've pushed or started your own context you get back NULL, which CG ignores). -- David Duncan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: info.plist with DYLD_LIBRARY_PATH = ~/test
On Mon, Oct 4, 2010 at 11:11 AM, Greg Parker gpar...@apple.com wrote: On Oct 2, 2010, at 6:54 PM, Kyle Sluder wrote: Maybe weak linking can help here. If you weak link the Python library and call dlopen early on in your program's lifetime with the appropriate path, I think dyld will populate all the weak linked functions it finds. No, weak linking doesn't do that. You want deferred binding: if the symbol you want is not present at load time but appears later, resolve to that one at that time. dlopen+dlsym is the only way to get that on Mac OS. Normal linking is required and not deferred: if the symbol you want is not present at load time, your process halts. Weak linking is optional, but still not deferred: if the symbol you want is not present at load time, then your references resolve to NULL. You don't get a chance to try again later. Okay, I was confused by this statement in the manpage for dlopen(3): RTLD_NOWAll external function references are bound immediately during the call to dlopen(). I suppose that applies to external function references in the library being loaded, not the one doing the loading. --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: clear a CGContextRef in an iPhone app
This is indeed outside of -drawRect, and it's a context I create myself, like so: // returns a new 'abstract' graphics context to draw in: CGContextRefcontext = NULL; CGColorSpaceRef colorSpace; void * bitmapData; int bitmapByteCount; int bitmapBytesPerRow; bitmapBytesPerRow = (pixelsWide * 4); bitmapByteCount = (bitmapBytesPerRow * pixelsHigh); colorSpace = CGColorSpaceCreateDeviceRGB(); bitmapData = malloc( bitmapByteCount ); if (bitmapData == NULL) { fprintf (stderr, Memory not allocated!); return NULL; } context = CGBitmapContextCreate (bitmapData, pixelsWide, pixelsHigh, 8, // bits per component bitmapBytesPerRow, colorSpace, kCGImageAlphaPremultipliedLast); if (context== NULL) { free (bitmapData); fprintf (stderr, Context not created!); return NULL; } CGColorSpaceRelease( colorSpace ); CGContextSetAllowsAntialiasing(context, YES); CGContextSetShouldAntialias(context, YES); return context; Rainer On Oct 4, 2010, at 11:15 , David Duncan wrote: On Oct 4, 2010, at 11:04 AM, Rainer Standke wrote: wondering how to clear a context. I'm using this: CGContextClearRect(context, drawingRect); But yet, afetr I do that, and then start to draw something new, I get remnants of the previous content of the context. Where are you calling this? About the only thing I know of that might cause this is trying to call UIGraphicsGetCurrentContext() from outside of -drawRect: (in which case unless you've pushed or started your own context you get back NULL, which CG ignores). -- David Duncan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: clear a CGContextRef in an iPhone app
On Oct 4, 2010, at 11:34 AM, Rainer Standke wrote: This is indeed outside of -drawRect, and it's a context I create myself, like so: Then you will need to show more code, specifically the code that is showing the issue you are experiencing, because none of the code you've shown thus far should be causing any problems. -- David Duncan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
MPMusicPlayerController queue index?
I have buttons that track back / next track. I am displaying the Now Playing artwork for the song in a UIScrollView. There is a static UILabel below that control. When one uses a button, is there a queue index in the MPMusicPlayer I can query or some technique other than handling that all myself with my own defined index, etc? - (IBAction)nextTrack:(id)sender { //TODO: Are there items? If so, move the UIScrollView update the UITableView. [myPlayer skipToNextItem]; //Move the UIScrollView into position to match... //int pt = 240 * *(THE INDEX IN THE QUEUE - easy to access?)* //CGPoint offset = CGPointMake(pt, 0); //[NowPlayingScrollView setContentOffset:offset animated:YES]; MPMediaItem *currentItem = myPlayer.nowPlayingItem; NSString *tmp = [NSString stringWithFormat:@%@,[currentItem valueForProperty:MPMediaItemPropertyTitle]]; songTitleLabel.text = tmp; } Google Voice: (508) 656-0622 Twitter: eric_dolecki XBoxLive: edolecki PSN: eric_dolecki http://blog.ericd.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
NSTextView Line Endings
I haven't seen anything thong on this, so here goes: Can the line endings in an NSTexyView be changed from UNIX (lf) to windows (crlf). -koko ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: What does core data do during a Save As?
On 2010 Oct 04, at 09:07, Sean McBride wrote: For example, during development, the model can be in flux, and it would be nice to be able to diff one's changes before committing to SCM. I believe you could create a mapping model, use it for diff, and then trash 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: clear a CGContextRef in an iPhone app
I have to wonder why you're going to all this trouble when UIGraphicsBeginImageContext exists. What exactly are you planning on doing, ultimately, with this context? And why do you need to clear the entire thing after you've drawn into it? m. On Mon, 4 Oct 2010 11:34:23 -0700, Rainer Standke li...@standke.com said: This is indeed outside of -drawRect, and it's a context I create myself, like so: // returns a new 'abstract' graphics context to draw in: CGContextRefcontext = NULL; CGColorSpaceRef colorSpace; void * bitmapData; int bitmapByteCount; int bitmapBytesPerRow; bitmapBytesPerRow = (pixelsWide * 4); bitmapByteCount = (bitmapBytesPerRow * pixelsHigh); colorSpace = CGColorSpaceCreateDeviceRGB(); bitmapData = malloc( bitmapByteCount ); if (bitmapData == NULL) { fprintf (stderr, Memory not allocated!); return NULL; } context = CGBitmapContextCreate (bitmapData, pixelsWide, pixelsHigh, 8, // bits per component bitmapBytesPerRow, colorSpace, kCGImageAlphaPremultipliedLast); if (context== NULL) { free (bitmapData); fprintf (stderr, Context not created!); return NULL; } CGColorSpaceRelease( colorSpace ); CGContextSetAllowsAntialiasing(context, YES); CGContextSetShouldAntialias(context, YES); return context; Rainer On Oct 4, 2010, at 11:15 , David Duncan wrote: On Oct 4, 2010, at 11:04 AM, Rainer Standke wrote: wondering how to clear a context. I'm using this: CGContextClearRect(context, drawingRect); But yet, afetr I do that, and then start to draw something new, I get remnants of the previous content of the context. Where are you calling this? About the only thing I know of that might cause this is trying to call UIGraphicsGetCurrentContext() from outside of -drawRect: (in which case unless you've pushed or started your own context you get back NULL, which CG ignores). -- David Duncan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: What does core data do during a Save As?
On Oct 1, 2010, at 10:02 PM, Jerry Krinock wrote: On 2010 Oct 01, at 10:44, Quincey Morris wrote: Core Data implements Save As as a migration process using a mapping model that it constructs on the fly Eeek. I never knew that. I'm late to the game, but this is incorrect. The Save As functionality does not use the migration feature. Save As simply(?) loads all the objects, messes with the objectIDs, and saves to the new location. This means that all the standard rules for loading objects (ie don't touch relationships in awakeFromFetch) apply, and any business logic your classes implement on save will be triggered (unlike migration, which modifies the model to use NSManagedObject instead of custom classes). +Melissa ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
allKeys and allValues
Hi, On the docs I read that for both the NSDictionary's allKeys and allValues, the order of the elements in the array is not defined. Ok. But, are the two arrays aligned each other? I mean, I have a dictionary containing several entries whose key is, e.g. @0, @3, @42,... I show these entries on a tableView picking the dict from the rowIndex. aDict = [[dicts allValues] objectAtIndex:row]; It works. But now, If I delete a row, using the rowIndex, I should do NSString *ID = [[dicts allKeys] objectAtIndex:row]; [dicts removeObjectForKey:ID]; Is that correct? Is it assured that the n key of the allKeys array always corresponds to the n value in the allValues array? -- Leo ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: allKeys and allValues
On Oct 4, 2010, at 3:21 PM, gMail.com wrote: On the docs I read that for both the NSDictionary's allKeys and allValues, the order of the elements in the array is not defined. Ok. But, are the two arrays aligned each other? I mean, I have a dictionary containing several entries whose key is, e.g. @0, @3, @42,... I show these entries on a tableView picking the dict from the rowIndex. aDict = [[dicts allValues] objectAtIndex:row]; It works. But now, If I delete a row, using the rowIndex, I should do NSString *ID = [[dicts allKeys] objectAtIndex:row]; [dicts removeObjectForKey:ID]; Is that correct? Is it assured that the n key of the allKeys array always corresponds to the n value in the allValues array? If that works, it's an implementation detail, and I wouldn't rely on that behavior because it could change at any time. You should use an array of dictionaries in a table view, not an enumerated dictionary. Nick Zitzmann http://www.chronosnet.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: allKeys and allValues
On Oct 4, 2010, at 4:21 PM, gMail.com wrote: On the docs I read that for both the NSDictionary's allKeys and allValues, the order of the elements in the array is not defined. Ok. But, are the two arrays aligned each other? If the docs don't contain that promise, then you can't rely on it. 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: allKeys and allValues
Or do something like: NSArray * allKeys = [dictionary allKeys]; NSArray * allValues = [dictionary objectsForKeys:allKeys notFoundMarker:[NSNull null]]; This also guarantees a 1-to-1 correspondance. Dave On Oct 4, 2010, at 3:40 PM, Greg Parker wrote: The documentation for CFDictionaryGetKeysAndValues() does promise to return parallel arrays, so you might be able to use that instead. 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: allKeys and allValues
Ok, I will not rely on that. Anyway, I have seen that iTunes uses the same dictionary structure. The file iTunes Music Library.xml contains a dictionary called Tracks. This dict contains a series of dictionaries with an ID as key. So it's very easy to get a track's dict asking for e.g. [tracks objectForKey:@2604]; Instead using an array of dicts, in case I have to search for an item by its ID, I must iterate through the whole array looking for that ID, e.g. for(id item in items){ NSString *ID = [item objectForKey:@ID]; if([ID isEqualToString:@inID]) return item; } -- Leo Da: Ken Thomases k...@codeweavers.com Data: Mon, 4 Oct 2010 16:31:17 -0500 A: gMail.com mac.iphone@gmail.com Cc: cocoa-dev@lists.apple.com Oggetto: Re: allKeys and allValues On Oct 4, 2010, at 4:21 PM, gMail.com wrote: On the docs I read that for both the NSDictionary's allKeys and allValues, the order of the elements in the array is not defined. Ok. But, are the two arrays aligned each other? If the docs don't contain that promise, then you can't rely on it. 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: How to get selected text in a WebView
On 5 Oct 2010, at 00:45, Keary Suska wrote: On Oct 4, 2010, at 1:15 AM, Gerriet M. Denkmann wrote: I have a Webview, and I want to do something with the selected text. I tried: DOMRange *dr = [ webView selectedDOMRange ]; NSString *m = [ dr markupString ]; this contains the selected characters, but buried in lots of markup language. But I just want the characters. NSString *s= [ dr stringRepresentation ]; just returns Undefined. I could do [webView copy:nil ]; and then get the string from the general pasteboard, but I rather do not like to mess up the pasteboard - the user might have put something important there. The first thing I would try is use NSAttributedString to convert the HTML. Well, the first thing I tried, was to remove all ... from the markupString manually. It worked. But I admit that your suggestion is certainly much better. This seems to work: DOMRange *ff = [ webView selectedDOMRange ]; NSString *marki = [ ff markupString]; NSData *data = [ marki dataUsingEncoding: NSUTF8StringEncoding ]; NSNumber *n = [ NSNumber numberWithUnsignedInteger: NSUTF8StringEncoding ]; NSDictionary *options = [ NSDictionary dictionaryWithObject: n forKey: NSCharacterEncodingDocumentOption ]; NSAttributedString *as =[ [ NSAttributedString alloc ] initWithHTML: data options:options documentAttributes: NULL ]; NSString *selectedString = [ as string ]; [ as release ]; But the question remains: Why does writeSelectionWithPasteboardTypes:toPasteboard: behave like a non-op ? Anyway, thanks very much for your suggestion! Kind regards, Gerriet. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to get selected text in a WebView
Was there a problem with what dr.text or [dr toString] returned after your first line? On 10/04/2010 12:15 AM, Gerriet M. Denkmann gerr...@mdenkmann.de wrote: I have a Webview, and I want to do something with the selected text. I tried: DOMRange *dr = [ webView selectedDOMRange ]; NSString *m = [ dr markupString ]; this contains the selected characters, but buried in lots of markup language. But I just want the characters. NSString *s= [ dr stringRepresentation ]; just returns Undefined. I could do [webView copy:nil ]; and then get the string from the general pasteboard, but I rather do not like to mess up the pasteboard - the user might have put something important there. So I tried: NSPasteboard *pasteboard = [ NSPasteboard pasteboardWithUniqueName ]; NSArray *types = [ NSArray arrayWithObject: NSPasteboardTypeString ]; [ webView writeSelectionWithPasteboardTypes: types toPasteboard: pasteboard ]; NSString *po = [ pasteboard stringForType: NSPasteboardTypeString ]; NSLog(@%s selectedString \%...@\,__FUNCTION__,po); but the result is: selectedString (null) Adding [ pasteboard declareTypes: types owner: nil ] does not make any changes. So what am I doing wrong? How to get the selection as string form a WebView? Kind regards, Gerriet. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com