Re: Cocoa bindings problem
On Oct 30, 2009, at 3:01 PM, Squ Aire wrote: Thanks for the tip. However, the value transformer idea did not work. Even though it ended up showing exactly the same date (the value transformer just strips the time from the date) for each row, selecting multiple rows still leaves us with "Multiple values" in the text field. Might be a good idea to post your code so we know what you tried. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Creating a tiled image from resource images
On Oct 30, 2009, at 2:27 PM, Michael Abendroth wrote: i would like to (programmatically) create a tiled image from resource images I created. I will have to use 9 tiles to create the image I want. I think I read somewhere that some methods exist in Cocoa that make this very easy, but I cannot find that reference anymore, neither anything other useful about my problem. That one's a little tricky to find. NSDrawNinePartImage() ... http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Miscellaneous/AppKit_Functions/Reference/reference.html#//apple_ref/c/func/NSDrawNinePartImage Bookmark the page - lots of useful functions there. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Cocoa bindings problem
On Oct 29, 2009, at 9:44 PM, Squ Aire wrote: My problem is that when I bind a some text field to the "last login date" column, and choose multiple rows with same date (but NOT THE SAME TIME), I get "Multiple Values". Do you mean you have a separate NSTextView or NSTextField that is bound to the array controller's selection.lastLoginDate? This is a classic master/detail view setup. How can I make it just show the date without time in the text field? Can bindings accommodate me in some way to accomplish this? If you have multiple rows selected, there's no way for the mechanism to 'know' (or trust) that the dates are the same. Indeed they're not (in the "this exact timestamp" sense, nor, likely, in the "same object by pointer" sense). You might try an NSValueTransformer to substitute one date with a "best-guess" date (allowing for differing "to-the-day" dates), following whatever logic you want. I don't know if this'll work for multiple values, though. I've never done what you're proposing personally. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Binding To Array Controller From A Different XIB?
On Oct 29, 2009, at 1:57 PM, Quincey Morris wrote: The natural mechanism for controlling the appearance of such a menu item (including its text, its check mark and its enabled state) is to use interface validation (validateUserInterfaceItem: or validateMenuItem:) in each possible controlling class. The controlling object in this case, where the dependency is ultimately on a NSArrayController property, is likely to be either the NSDocument subclass, or the relevant window controller (set as a window delegate to get it into the NSResponder chain). Of course you're right that it would probably be easier for menus. It is definitely cleaner from an architectural standpoint to have one point of entry to your the abstract idea of "the active document" from the menu system. The approach I mentioned is far more useful for, say, a shared "Inspector" pane, whose UI reflects something about the active document (or some selected item therein). But as I said in my response. It's possible and even easy in some cases do do as the OP requested. :-) -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Binding To Array Controller From A Different XIB?
On Thu, Oct 29, 2009 at 1:07 PM, Chunk 1978 wrote: > i've created an NSMenuItem in the MainMenu.xib that targets an action in a > different XIB thru the first responder. the action removes an object from > the array. however, i'd like to binn the NSMenuItem object to the array > controller's canRemove controller key so that the NSMenuItem is only > accassable when appropriate (when an item on the table view is highlighted > and elegable for removal). is it even possible to access bindings of an > array controller that is in a different XIB? is this possible? There isn't enough information about your application and its architecture to give you a direct answer as to "how", but in general, yes. It's mind-numbingly simple in some cases. I assume the menu item is a main menu item in your MainMenu.xib? Is the 'the other' xib the document prototype for an NS*Document-based application? If so, you can bind to File's Owner, using the path, "mainWindow.windowController.document.property", where "property" is whatever property you want. You'd need to make the array controller (let's call it "peopleArrayController") available via KVC-compliant accessor, but the full keypath in your case would be: "mainWindow.windowController.document.peopleArrayController.canRemove" The key to understanding this is to fully understand what "First Responder" actually is in Cocoa, then understanding the overall architecture of a Cocoa document-based application (and how to walk the path). The approach for other situations (not targeting something in a document) is similar - you just need to make sure every element in the path is properly accessible via a KVC-compliant accessor. Note: All this has the prerequisite requirement of understanding Cocoa (because Bindings is an advanced Cocoa technology) on a more fundamental level (because Bindings is an advanced Cocoa technology), so any questions about the specifics should not be lumped into one broad-sweeping, all-encompassing thread. You'll want to "break it down" and attack each piece as it comes. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Seemingly Documentation confusion?
On Oct 29, 2009, at 7:58 AM, Michael de Haan wrote: In "NSDraggingDestination Protocol Reference (informal protocol)", it states: ... The methods ( which include ) - prepareForDragOperation: required method - performDragOperation: required method - concludeDragOperation: required method are all marked as "required method". I believe you're right. I don't think -prepare... and -conclude... are required. If your tests show they aren't, file a bug against that doc page (links at the bottom). -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Software visualisation tool
On Oct 28, 2009, at 11:01 AM, MacProjects wrote: Which from apple developer maillists in Your opinion would be more appropriate for discussing the "algorithm/structure visualisation stage" when developing on osx? Apple mailing lists for this topic? There are none. There's the Apple Developer Forums (google it), or else you'll have to find lists elsewhere. Google is your friend. There are plenty of places out there (you even cited one - StackOverflow) that are more broad in scope. Which list would hold users that are more likely using such tools and can give a good advice based on empirical knowledge? Completely irrelevant as an excuse for posting here and up to you to search for better-suited places. Again, you already cited one such place. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Software visualisation tool
On Oct 28, 2009, at 10:20 AM, MacProjects wrote: Pardon for being a bit off-cocoa-topic, but thought this is a good place to ask. You thought a Cocoa development list with strict topic rules was a good place to post questions about which visualization applications are best? Come on. It's not just 'a bit' off topic. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: keyPathsForValuesAffectingValueFor: not updating immediately
On Oct 26, 2009, at 10:03 PM, Brad Gibbs wrote: I did read the documentation, which is why I used +keyPathsForValuesAffectingFullAddress. I also tried +keyPathsForValuesAffectingValueForFullAddress: Both methods work, but only after changing the view and then coming back to it. Read it again. More carefully. I'll do the same.[1] ;-) You've gotten several very important things wrong. I just saw Jim's response, so I'll reiterate his point then the other issues: 1 - You did not pay close attention to the method signature as noted in the API reference. As Jim indicated, it's a class method, not an instance method (+ vs. -). 2 - +keyPathsForValuesAffectingValueForFullAddress: is completely wrong. You appear to be bastardizing the + keyPathsForValuesAffectingValueForKey: method. This is a separate method which I encourage you to read about. 3 - The correct signature is the first one you used. It's meant to be read in the docs as "+keyPathsForValuesAffectingCompliantWayHere>". You then changed it (see #1) and made it wrong as well. 4 - If it only works when "changing the view" (I assume you mean some action that causes it to redraw), then it doesn't work. Right? The whole purpose of the collective Cocoa Bindings mechanism is to avoid this very issue, so clearly your approach is not working. [1] I now realize I myself was not reading or responding carefully when looking for that phrase yesterday evening. +keyPathsForValuesAffectingValueForKey: is the method that cannot be overridden in a category; +keyPathsForValuesAffecting is fine in categories. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: keyPathsForValuesAffectingValueFor: not updating immediately
On Oct 26, 2009, at 9:07 PM, Brad Gibbs wrote: I have a Core Data app with a category on a model object, Address. The category has a method to return a fullAddress property, which is composed of the streetAddress, city, state and zipCode. Did you read the documentation for this method? "Note: You must not override this method when you add a computed property to an existing class using a category, overriding methods in categories is unsupported. In that case, implement a matching +keyPathsForValuesAffecting to take advantage of this mechanism." -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Make a solid line look like 3D
On Oct 26, 2009, at 1:10 PM, Jean-Daniel Dupas wrote: What do you expect as rectangle ? drawRect: parameter is the smaller rectangle that contains all rect marked as dirty. If you want to exact list of dirty rects, you can query it using the -getRectsBeingDrawn:count: methods. This is more specific and more correct than what I said (see my "in the general sense" comment, though). :-) In practice, however, for an on-screen view, the dirty rects are usually the areas that are or have just become visible. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Make a solid line look like 3D
On Oct 26, 2009, at 12:44 PM, Matthias Arndt wrote: For some reasons I still don't understand (Argh!) the drawRect: method of my view didn't pass the right rectangle to the object actually responsible for the drawing. I just fixed the code to aim for the best performance improvement: Don't draw at all (at least not hidden objects). I'm satisfied with the result as the poor performance was while zooming and scrolling zoomed areas, exactly the situations, which benefit most from drawing only in the visible part. Well, this is an important issue. :-) While you don't have to include all your drawing code, I would encourage you to post at least the basics. Speaking in the general sense and assuming your "stitch view" is all one view (not a combination of subviews), your view should definitely be getting only the visible rect passed into -drawRect: when displaying it on screen in this way unless something's specifically asking for the entire view (as in saving as an image or printing). If you're having problems that are causing the entire view to be redrawn while zoomed into a small portion and scrolling around, something is wrong and should be addressed. Also, some people seem to want to call -drawRect: directly, or call -display when they really should be calling -setNeedsDisplay:. Another thing to consider is your NSScrollView settings in Interface Builder ... is Copy On Scroll enabled or disabled? The best way to get help from the list on this issue is to post (the relevant parts of) your code. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Make a solid line look like 3D
On Oct 25, 2009, at 8:00 PM, Graham Cox wrote: But caching to a bitmap of some kind is a much bigger win, provided you do it at the scale you need to draw it at (and recache if that scale changes). Using CGLayer can generate really big speedups, so that's worth looking into, but even the venerable NSBitmapImageRep is a good way to cache and easier to use than CGLayer. I don't know enough about the performance differences to agree or disagree, but it makes sense. The zooming resolution issues inherent to bitmaps, however, would probably negate any perceived advantage for the user, since clicking the zoom in/out buttons would take you right back to the original problem at least once during the session. Sometimes usability is at least as much about perception as actual performance. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Make a solid line look like 3D
On Oct 25, 2009, at 7:48 PM, I. Savant wrote: Quincey's suggestion to cache is right on the money: draw it with bezier paths once, then only display the finished product as PDF data. You could even separate it out into different 'overlays' for each 'thread file'. That minimizes any redrawing that's necessary when changing the color of a 'thread file'. One more thing: If you separate each thread file out into a separate overlay image, and you're targeting Leopard or above, you can easily use NSOperation/Queue to put each overlay into its own separate operation (multithread your threads, so to speak). Just draw straight to images instead of the view. Then your view only has to cache the images and redraw them. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Make a solid line look like 3D
On Oct 25, 2009, at 7:22 PM, Graham Cox wrote: screensavers should be low impact - personally, if a screensaver uses more that about 10-15% cpu, I'll ditch it imediately Really? It's not as if your computer has anything better to do. Again: battery. Many of us are laptop users. The OP included a link to his project - it's not a screensaver. That was entirely my fault, sorry. I have no idea where I got the idea it was for a screen saver. I did not follow the link. In my defense, a better description of the application's requirements would've helped in determining a course. The original suggestion to measure first then decide still applies but OpenGL is probably unnecessary since this doesn't appear to be an editor (ie, it's only displaying). Quincey's suggestion to cache is right on the money: draw it with bezier paths once, then only display the finished product as PDF data. You could even separate it out into different 'overlays' for each 'thread file'. That minimizes any redrawing that's necessary when changing the color of a 'thread file'. Again, sorry for apparently pulling an aspect of the original post out of my ***. :-D -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Is there a cocoa treeview?
On Oct 25, 2009, at 6:49 PM, Gevik wrote: Coming from .NET, I was wondering if there is anything like a TreeView control in Cocoa? NSOutlineView? -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Make a solid line look like 3D
On Oct 25, 2009, at 5:44 PM, Matthias Arndt wrote: Thanks for your response. I'm nearly convinced to look into the gradients tomorrow, although I'm afraid it won't result in a better performance: Empty the path, calculate the angle, create the rect (with rounded edges), apply the gradient and fill the path ... vs. three move to / line to ... I'll see. A few points: 1 - You're guessing regarding the performance. Measure, then decide. 2 - Less work is automatically better performance (ie, 1 path is better than 3). 3 - I have no idea what you mean by "empty the path" ... do you mean release it and create a new one, assigning it to your "currentPath" (or whatever) pointer? If so, see point 2. 4 - You're calculating the angle for your current approach anyway, aren't you? OpenGL to make some basic lines look somehow three-dimensional? Isn't that over-kill? Sorry for my ignorance, I haven't coded OpenGL, yet, and I am a bit reluctant to add it to my (already long) todo list for this project ... But it would be interesting ... I'll have to make up my mind :-) Again, you're guessing. You *did* indicate a desire for better performance than your current approach, right? It's in your best interest to at least investigate OpenGL since it was suggested. A few minutes with Google can do wonders. OpenGL does just as well (better?) with 2D objects. It's exceptional at creating them and filling them with gradients. Ridiculously better than the high-level Cocoa drawing mechanisms could ever hope to be. Further, since you said you're making a screen saver, that's even more of an argument for OpenGL. I've downloaded, tried, and immediately deleted many screen savers because they immediately started heating up my laptop and draining its battery because of how poorly they performed. Be kind to your users or they'll ditch you quickly. Finally, you don't necessarily have to know the "nitty-gritty" of OpenGL. Quartz Composer (part of Xcode Tools) would make this task easy with just a few hours of effort spent learning how to use it. Depending on what you're doing, you might even get away with *zero code* if you create a composition that accepts your preferences as inputs into the patches you create, using bindings to connect everything. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Make a solid line look like 3D
On Oct 25, 2009, at 2:42 PM, Matthias Arndt wrote: My code draws lines some thousand times with different angles. I'd like to have the lines to look similar to 3D objects. So currently I draw each line segment three times: 1. one time with a thick line in black 2. the second time with a slightly thinner line in the current color 3. and a third time with a very thin white line (some kind of highlighting) How about creating 1 NSGradient instance for each color you want, then creating one bezier path for each line. The path would describe the outer edges of the pipe, then you'd *fill* it with the gradient at the desired angle, rather than stroking. If you need better performance than that, you should seriously consider OpenGL. In fact, you should be kind to your users' batteries and processor loads (you *are* considering laptops, aren't you?) and consider OpenGL anyway. It'd make quick and light work of this by comparison ... -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Sending a Selector to another Class.
On Oct 21, 2009, at 12:23 PM, Joshua Garnham wrote: How would I send a Selector to another class? I know to send it to a selector in the same file you do [self performSelector:@selector(doSomething)]; and for sending it to another class I've tried [otherClass performSelector:@selector(doSomethingElse)]; But I just get an error in the Debugger saying +[otherClass doSomethingElse]: unrecognized selector sent to class 0xe5c4 What have I done wrong? You seem to be missing the very basics of Objective-C (and I'd dare to say object-oriented programming topics in general). You should (re) read the introductory material in the documentation and take advantage of places like cocoadevcentral.com (free articles) to get a handle on this. The Objective-C Programming Language http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ObjectiveC/Introduction/introObjectiveC.html Cocoa Application Tutorial http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ObjCTutorial/01Introduction/01Introduction.html CocoaDev Central http://www.cocoadevcentral.com -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Hiding tab view items
On Oct 21, 2009, at 9:03 AM, BareFeet wrote: [tabView removeTabViewItem:oldItem] But isn't that going to destroy the tab item, the view it contains, and everything in that view? Can I get it back when that tab view item is valid again, or do I have to programmatically create all the objects? Not if you retain it and assign it to an ivar to keep it around. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Curious about SSH --> actually about: Keychain --> (passive aggressive)
On Oct 19, 2009, at 8:32 AM, Stuart Malin wrote: What you perceived as "passive aggressive" is... I.S.'s style, which, if you were a regular reader of the list, you'd be familiar with; a style that (I suspect) ameliorates his frustration and enables him to answer yet-once-again a query that should never have been posted, and do so with useful guidance, all in the hopes (I further suspect) that if others would read, the list would become a place of ever-more streamlined activity. Well said, but to be fair, he directly quoted Jens' comment (which included his desire to invest in SEO for his class). I believe I'm innocent there. :-D (Note: None of the following is aimed at the OP.) You are right that malformed (or even lazy) questions become tiresome to those who try to contribute to the list every day. Sometimes it's easy to laugh about it and come up with a witty way of pointing out laziness (in research or in framing the question) but other times impatience and annoyance get the better of many of us. We're human. Want a less annoyed response? Mind your manners: do your research and make an effort not to waste our time. It's also important to consider - and I bring this up because another poster said he felt it was condescending - the "how to ask smart questions" link is 100% on the money. Sure, it's irreverent but for some posters, I think the best thing for them is to be shamed into reconsidering how they approach a technical mailing list for help. It worked for me years ago - yes, shocker, I was new to using a list and didn't understand how wrong my approach was until someone gave me a stern talking-to, forcing me to consider it. So, while my own response made light of the stock "please search first" (ie, "intellectual laziness is considered rude among professional developers"), my annoyance was minor and levity was my main goal. I won't speak for Jens but when I saw his response, I didn't think his SEO comment was aimed at the OP, just that he lamented his own hard work wasn't found with a Google search with relevant keywords. Shame on him! ;-) And, finally: "Passive-aggressive" is something of which I've never been accused. "Blunt ***hole" however ... well, guilty as charged. ;-) -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Curious about SSH
On Oct 18, 2009, at 11:26 AM, Brent Smith wrote: Is there a certain class or framework that people are using to store Keychain Information? Yes. Apps like Coda, and Transmit, and Versions that store passwords, how do they add them to Apples Keychain access, for use with apps like SSH/SFTP and so on. Have you tried searching the documentation for "keychain"? Search engines are rapidly growing in popularity these days for their ability to quickly find documents based on one or more keywords. I highly recommend them for finding information. ;-) -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Calculating a total from a collection of numeric attributes
On Oct 17, 2009, at 7:40 PM, Ian Piper wrote: I have a Core Data entity that has an attribute called charge (stored as a float). So I am storing a number of records each of which has a charge. I simply want to be able to show a running total of charges as I add or remove items. I was hoping that I might be able to use a simple binding for this: I created a label and thought I might be able to bind its value to array controller.arrangedObjects.charge.sum or something like that. No luck though. I cannot see anything in the documentation or from searches. Can anyone point me towards either examples or documentation? You want set and array operators: http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/ArrayOperators.html You really should read the KVC, KVO, Bindings, and Core Data guides front to back since there are terms you wouldn't otherwise know to search for. It's best to know you read about something but forget the specifics then to not read it at all and have no idea. :-) -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Slider with tag?
On Oct 16, 2009, at 10:33 PM, Sean McBride wrote: On 10/14/09 10:24 PM, Gabriel Zachmann said: Could someone please explain to me how I can present a little tag to the user that moves along with a slider's handle (above or below), in which I can give some feedback to the user about the current value of the slider? I'm afraid I couldn't find an example, but I think I have seen such a thing somewhere ... You have to do it yourself. ... MAAttachedWindow is a good starting point: http://mattgemmell.com/source -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: File Encryption / Decription
On Oct 16, 2009, at 10:05 PM, Chunk 1978 wrote: what is the best way to encrypt and then decrepit a file in Cocoa? I suppose you could burn the encrypted file to a disk then neglect said disk. Bit rot would make the file quite decrepit. ;-) But seriously folks*, there are a few categories on NSData on cocoadev.com that can help. -- I.S. * I'm here all night. Remember to tip your waitresses. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Extract plain text content from a Text View
On Oct 16, 2009, at 3:44 PM, I. Savant wrote: I want to figure out a way to build a search predicate that will allow me to search a Text View and I think this is likely to be the only way. Seems a bit odd. Could you elaborate? Let *me* elaborate on *that*. :-) You normally use predicates to filter objects in the model layer of your application. Note "normally". If you're trying to provide a way to search within a text view, this is a very strange way of going about it: 1 - NSTextView already takes advantage of the Find field. 2 - Searching for a substring inside a string with a predicate searches the *whole* string as one ... this is only really useful if your text view's content is made up of a bunch of smaller units, but then again ... see 1 above. 3 - The predicate would be used to filter an array of NSTextStorages, not one NSTextStorage, returning those which contain your search string. 4 - Related to 3: if you're searching text storages because you treat them as individual subunits in your model, it would likely make more sense to apply this filter to the model layer. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Extract plain text content from a Text View
On Oct 16, 2009, at 3:37 PM, Ian Piper wrote: Is there a way to get the plain text content out of an NSTextStorage object (displaying using a Text View) that contains rich text and images? An NSTextStorage is a subclass of NSMutableAttributedString, which is a subclass of NSAttributedString. With this in mind ... I want to figure out a way to build a search predicate that will allow me to search a Text View and I think this is likely to be the only way. Seems a bit odd. Could you elaborate? -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSCollectionView issues
On Oct 16, 2009, at 11:42 AM, Jim Turner wrote: If you need to get the ViewItem for a specific index (available via NSCollectionView's itemAtIndex: under 10.6) Bah - I failed to notice -itemAtIndex: is also 10.6-only. I mostly agree with the train wreck sentiment. The 10.5 implementation seemed useful only for its most common demonstration: image thumbnails. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSCollectionView issues
On Oct 16, 2009, at 10:32 AM, Half Activist wrote: I'm using a NSCollectionView to display a stack of items (a table) but since what's display is far too complex to be laid out programmatically I went for the NSCollectionView. And it's been all problems from the beginning. Yes, depending on what you need from it, its convenience can be outweighed by its limitations. First of all with setContent that never worked no matter what I did...it only works if I bind the content to an nsarraycontroller. Okay ... what have you tried? Can't help if you don't say what you did. Now, when I add a new item in this "table" i want to be able to scroll it to the displayed area of the view, Can you rephrase this? The "displayed area of the view" is ambiguous, but generally the displayed area is displayed because the scroll vie is already scrolled to that area. :-) Did you mean you want to scroll to the currently-selected (or newly- added) collection view item (or some UI element within that view item)? Suppose I have N items and therefore N subviews in the NSCollectionView, after changing the array that now contains N + 1 items, the nscollectionview has after the update N + N + 1 subviews! So, accessing subviews is not an option either. I haven't heard of this problem but then again, I had dismissed NSCollectionView early on as not being up to the tasks for which I'd hoped it'd be useful, so my experience with it is limited. Again, what did you try? How did you go about this? I find it odd that it doesn't scroll to the selection (if that's what you were doing), but I imagine if you ask the array controller for the *arranged* index of the object just inserted (whole other question - ask it if it's required), then ask the collection view for the - itemAtIndex:, you can ask that item for its -view, then use the scrolling methods as needed. If anyone knows how to do fix these bugs, and how to disable the animation, i'd be really glad. I don't think there's any (public API) way to disable the animation. Why do you want to do that? I'm considering writing an homebrew nscollectionview. Depending on your needs, this could be easier. If you only need one "column", it's *almost* trivial. Especially if, like NSCollectionView, the size of each view is the same. If they can vary in vertical size, you can even use the same "prototype view" approach by caching at least the height of the items for the current view width, which lets you quickly size the whole view and work out the rect for the desired item (or the items for the desired rect). This can *greatly* improve performance for lots of irregularly-sized items. Of course there is more than one way to approach this but building a basic one-column layout view like this is fairly simple. Even adding drag-and-drop to this isn't too difficult for a moderately-experienced Cocoa developer. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: SelectedRowIndexes
On Oct 14, 2009, at 11:55 AM, gMail.com wrote: Oh, come on, at least pick a witty pseudonym. :-D when I call [tableView selectedRowIndexes]; I always get a indexSet already sorted by row. Instead I need to sort it as the selection order. I mean, if the user selected the rows in the order Row 6 Row 2 Row 8 I want to get 6, 2, 8 and not 2, 6, 8 as I get now with selectedRowIndexes. How can I do that? You can't. Not with -selectedRowIndexes. As you said, it returns an NSIndexSet. Sets are unordered by nature. Not in the sense you're looking for. They're kept internally as an ascending-order list for efficiency. You're going to have to track changes in selection yourself (examine the NSTableView API - there are methods to help you with this). Also consider a few scenarios that will affect "the selection order": 1 - Click the third row, shift-click the seventh row. Now the selection index set is now {2, 3, 4, 5, 6}. 2 - With that last result, command-click row 3, then, 4, then 3 again. The selection set is now {2, 3, 5, 6}. 3 - Click row 7, shift-click row 6, then Cmd-click row 8. Selection is now {5, 6, 7}. Considering these scenarios, what would your selection order be in each? What about combining them? Selection can go in many directions and things can be added and removed to/from anywhere in the set. Think carefully - getting this basic behavior wrong has the potential to annoy users. Please note that I can select the rows even programmatically, because the user selects an object on the canvas. Same as above - you'll have to track the order. I'd make a table view subclass and override (calling super, then my custom code) the selection-changing methods, then provide a separate selection-getting routine (to provide an ordered array of indexes) called "orderedSelection" or something similar. This gives you one central place for user- or code-initiated selection changes. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Examples of MVC pattern with Core Data
On Oct 14, 2009, at 11:29 AM, Kyle Sluder wrote: On Oct 14, 2009, at 7:03 AM, Darren Wheatley > wrote: I've been Googling and searching the XCode docs for good examples of using the MVC pattern with Core Data, but not had a lot of success. Because MVC is so pervasive throughout Cocoa, its use is rarely called out except in introductory documentation. Almost every Core Data application sample you find is going to employ an MVC architecture, if for no other reason than that's what AppKit is designed for. Indeed the most basic example (creating a new, plain Core Data application - non-document-based) is almost a perfect, complete example. Just add a "Person" entity with the usual attributes, then (is it option-drag, command-drag, control-drag?) drag the entity into the main window of your nib and let it create the basic interface needed for managing "Person" objects. Make sure it works as expected and there you have a complete example. The model (your Managed Object Model), the view (your window, table, fetch button, search bar, etc.), and the controller (the NSArrayController added when the UI was auto-generated) are all represented in a rather clean demonstration. Of course there are other things about this basic setup that represent all three of these layers, but asking "what are they" is far too broad a question. You'll just have to study the Cocoa frameworks to identify them. As other recent threads highlight, there's room for flexibility in both interpretation of the MVC "rules" and the implementation of your application's ultimate design. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: arrayWithContentsOfFile
On Oct 13, 2009, at 3:52 PM, DKJ wrote: NSArray *data; data = [NSArray arrayWithContentsOfFile:[NSHomeDirectory() stringByAppendingPathComponent:@"/Documents/file.plist"]]; if( data == nil ) do this; There's no file.plist in the directory. But "do this" doesn't get done. So that's exactly how the code appears? You declare your "data" array and immediately assign it thereafter? Nothing in between? Very odd. I haven't seen this behavior, nor can I reproduce it. What happens if you set a breakpoint, step past the +arrayWithContentsOfFile call, and "po data" at the debugger console? What does it log? -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: arrayWithContentsOfFile
On Oct 13, 2009, at 3:23 PM, DKJ wrote: On 2009-10-13, at 12:12 , I. Savant wrote: Let me see if I understand what you're saying: You are expecting there to be *no* PLIST files (and so, you expect to get nil) but are getting an empty array? Bingo. Again, can you post your relevant code? -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: arrayWithContentsOfFile
On Oct 13, 2009, at 3:08 PM, DKJ wrote: I looked in the directory itself before running the code, and the plist files weren't there at all. Let me see if I understand what you're saying: You are expecting there to be *no* PLIST files (and so, you expect to get nil) but are getting an empty array? Can you post your relevant code? It almost sounds like you've created the array somewhere first. If someone else gets the same result, perhaps they could file a bug: I lack sufficient self-esteem to file one myself. Well, let's exhaust the possibility of developer error first, then, if we've ruled that out, file away. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: arrayWithContentsOfFile
On Oct 13, 2009, at 2:54 PM, Jens Alfke wrote: The docs say it returns nil if the file doesn't exist, and he's getting an empty array. That was his question. ... You must have misread his code — he's using NSHomeDirectory() as a prefix. My apologies, you're absolutely right. I read that on the iPhone in Google's mobile gmail reader ... while walking. :-) Sorry for the noise. A PLIST can have an array root or a dictionary root. Are you sure your PLIST has an array root? I would still expect nil (ie, it can't create an array from a dictionary-rooted PLIST), but it's worth checking. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: arrayWithContentsOfFile
On Oct 13, 2009, at 2:43 PM, DKJ wrote: I'm using this code to read an array from a plist: NSArray *data = [NSArray arrayWithContentsOfFile:[NSHomeDirectory() stringByAppendingPathComponent:@"/Documents/file.plist"]]; The docs say this method returns nil when the file doesn't exist (precisely: "Returns nil if the file can’t be opened..."). But the above code gives me an empty array instead, which caused some confusion. Surely the docs can't be wrong... Nope. The docs are correct and I'm betting the file you specified in fact *doesn't* exist. "/Documents/file.plist" is probably not a valid path. You probably meant "~/Documents/file.plist", but that string isn't a valid path either. Use the appropriate path-manipulating NSString methods to expand the tilde to a full "/Users/someuser/..." path. I'll bet that fixes things. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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 'Help' to your App.
On Oct 13, 2009, at 12:37 PM, Joshua Garnham wrote: Just wondering if there is some documentation on how to add 'help' to your app. You're just wondering? Seriously? How about SEARCHING, then? -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Preserving camelCase when prefixing a method name?
On Oct 13, 2009, at 10:24 AM, Graham Cox wrote: I think just making the first character uppercase would be sufficient, but I'm not sure how to do that reliably with the unichar data type, so that's my first question. Why not replace the first character with an upper-case version instead of applying this to the whole string? The second is that when generating selectors programmatically like this, are there other pitfalls to consider so that the resulting selector is always predictable? The scheme needs to work with arbitrary properties, just as various parts of KVC and KVO do. Not sure I can answer this knowledgeably so I'll leave this one alone. :-) -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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 with OpenGL
On Oct 13, 2009, at 9:58 AM, Erik Buck wrote: I think that the Core Data model and any generated classes should be left untouched because you may want to regenerate the classes later. I use Categories to add View specific drawing methods to the objects that represent Core Data entities. I like this idea even more. Very good point about regenerating the representative classes behind entities - a separate category for drawing neatly segregates things. Maybe a good radar incident will see the Sketch example updated. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Safari problem
On Oct 13, 2009, at 9:54 AM, fawad shafi wrote: i am developing an application in which i need that System permanently disables/hides the status bars at the top and bottom of safari for the duration of session. They do not reappear at any point. ' If you're really trying to show/hide the status bars in Safari, this is the wrong list (it's not a Cocoa-related question at all). I believe this can be done with JavaScript. Otherwise, you can use a plain WebView in your own application to display the web page/site without any window dressings. I tried my best to do that but no success. That statement is irrelevant without telling us *what* you tried. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: More Core Data Questions
On Oct 12, 2009, at 4:32 PM, Jon Hull wrote: I have spent the last 48 hours (re)reading core data docs. My head is swimming in docs. Understandable. It's a complicated technology (especially when you consider its interaction with Bindings). The short answer is yes, I understand to give each thread it's own context, but I don't know if it will break without a run loop. Maybe I'm being dense - a distinct possibility - but I don't get what you mean by this. It might be good to start a separate (mailing list) thread with a detailed explanation of what you intend to do. Yes, although I also read a warning about using these cross-stores somewhere, so I was thinking of rolling my own. If I encountered the same warning, I honestly can't remember it. :-) The core data UUID would probably also be temporary with the way I am currently creating my objects (because I wouldn't have saved yet), so I would need something persistent. I don't think adding a UUID hurts anything, honestly, so if it simplifies things for you, go for it. Yes, well it is fairly complex... but it looks like core data is not a good fit since a basic requirement is that I need it to store nested arrays of immutable objects and keep the order (I also need to allow those objects to be inserted at multiple points in the array). The immutability and the possibility of multiple entries make an order property unworkable. Possibly, but you might be pleasantly surprised (not a knowing hint, just an honest possibility :-)). If you can, try to explain your needs. Someone might just have a good suggestion (or solid reasons why not). -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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 with OpenGL
On Oct 12, 2009, at 4:27 PM, Ben Trumbull wrote: but in this case it must draw itself. No, it doesn't must do anything. Views draw themselves, model objects are state, and controllers are intermediaries. ... What problem are you trying to solve by knowingly violating the MVC design patterns ? Hmmm ... must draw itself? No, from a pure MVC approach, I agree with you 100% that not only does it not "must" but it "shouldn't". However, it's only fair to point out theSketch example - the quintessential example for drawing applications. The STKGraphic class has draw...InView: methods. For a drawing app, I can see why it might be considered a cleaner design, despite "knowingly violating the MVC design patterns". A "Shape" knows how - and where - to draw itself - just give it a view. I think it's mostly a matter of personal taste and methodology but it certainly isn't "wrong", which I suppose is why it's now one of the few examples left in the developer examples folder in Snow Leopard. In theory this violates MVC, but in practice this design approach is much easier to understand and maintain (in my opinion, anyway) for a drawing application like Sketch. This isn't meant to contradict your overall advice, but I do think an application's architecture doesn't have to *rigidly* adhere to any one design pattern to be "good". -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: More Core Data Questions
On Oct 12, 2009, at 3:31 PM, Jon Hull wrote: 1) Can I count on a to-many relationship keeping the order of the managedObjects it points to? The order is very important in this case, and I need a way to ensure that the order does not change when the object is saved and reloaded. No. This is stated in the documentation and has come up on this list many times. You'll want to add a property to keep track of the desired order. 2) Does core data require a run-loop to work? I'm not quite sure how to answer that, specifically ... All of the work takes place in a background thread, and that is the only thread which would be accessing these objects ... so I'll answer this (what you appear to be asking). Multithreading with Core Data gets its own section in the documentation - each thread needs its own context. Read the documentation. 3) What is the best way of connecting objects from different stores? I am considering giving them UUIDs and then storing that as a reference. Then setting a transient property based on that in - awakeFromFetch. Alternatively, I could store it as a fetched property, but I want it to be a 1:1 correspondence. If the objects are already saved to a store, they already have a stable, unique ID. This is also covered in the documentation and in the list archives. 4) Is there a better way to get this lazy loading? My main goal is to keep only those objects from this large (>1000) object graph in memory that are needed (since the iPhone has limited memory). You're going to need to be specific about the relevant parts of your data model fora "best approach" suggestion. General guidelines are in the docs. You can always have a separate entity for the large data (to act as a BLOB). IE, an "Image" entity that holds lots of metadata, possibly a small thumbnail, and a reference to an instance of "ImageData" that holds the actual data. • Use core data in a rather complex way What complex way? • Roll my own SQL with a single table that stores blobs by that identifier (see above) and then returns a freeze dried object from the blob. Not possible (or at least remotely sane) with a Core Data created store. Don't edit the store. Its implementation details (ie, the schema) are private and subject to change. This is a Bad Idea. • Store each object as a small file in a folder and use the identifier in the filename Also possible if you don't want the data inside the store. You can create (and archive) an FSRef for more robust "locate-the-moved-file- between-sessions" behavior. • Something with proxies that go grab it just in time (combined with SQL or the files above) I'm not sure what this means. • Something I haven't thought of... You were on the right track with the idea of a BLOB if you don't mind saving the BLOB in the store. The alternative - which you also guessed - is to save a reference to an external file. The choice is yours: neither is better than the other in the general case. Any help is greatly appreciated! You can help yourself better than anybody else by (re-)reading the Core Data Programming Guide. It contains answers to pretty much everything you've asked here. Very specific answers. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSCollectionView delegate methods aren't called
On Oct 11, 2009, at 3:28 PM, Rick Mann wrote: I'm trying to implement drag & drop in my NSCollectionView, following the 10.6 release notes. I've got my delegate set, but nothing was happening. I then implemented each of the methods to see if any were called, and none are. I've verified that the delegate is indeed connected. Where is your delegate instantiated? In the nib or at runtime? Where is your delegate set? In the nib or at runtime? Have you queried the collection view's delegate at runtime as well to see if it's changed (or not set when you thought it was)? What is the exact method signature of your delegate methods? Did you copy and paste or did you type them by hand? -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Newbie Core Data question.
On Oct 11, 2009, at 9:20 AM, Gustavo Pizano wrote: Thanks for the link, I will then see the example and try to understand these bindings better, I thought they were something similar as in WO-EOF, but its seems lot of things changed here. You might want to search the list archives for related terms, comparing EOF to Core Data. Essentially, the official response is, "don't (Core Data is not a replacement for EOF and is in many ways very different)". Bindings are a whole different animal. Best bet is to forget about EOF while learning these technologies. That knowledge will probably do more to hinder you than to help you. I dunno what will be more difficult, if make an IB plugin or set the bindings by code, ( I guess the first one ).. so I will see hoe it goes doing it manually. :S Well, you don't really have a choice for a custom view. :-D You have to build your view similarly to the example before moving on to palletizing your view for IB Goodness anyway, so ... -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Newbie Core Data question.
On Oct 11, 2009, at 6:00 AM, Gustavo Pizano wrote: but I can't set the Key Model and key path to something to work.. Let's forget about the drag and drop part for now and simplify the problem. You said earlier: I have a window with 2 custom views, each view with their corresponding controller. Your problem is with Bindings, not Core Data. This is, I believe, your problem. There are several things you need with a custom view (depending on level of developer convenience desired): 1 - You need to have all the proper "bindings guts" in your custom view. See the "Graphics Bindings" example (specifically, the custom view's bindings-related code) here: http://homepage.mac.com/mmalc/CocoaExamples/controllers.html 2 - You'll probably need to establish the bindings manually (in code) unless you've done #3. See -bind:toObject:withKeyPath:options: ... 3 - If you want to establish bindings conveniently in Interface Builder (ie, for an easily-reusable view), you'll need to expose the binding and make an IB plugin for your view. As you can see, your problem is one of Bindings, not Core Data. The two technologies work well together but are quite independent. Good luck. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: real verses Virtual memory
On Oct 10, 2009, at 3:35 PM, Thomas Wetmore wrote: Please take this off list. That's an awfully presumptuous demand, don't you think? It's a relevant and interesting Cocoa topic. I've been following it with interest and it's quite obvious others have as well. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Hide an Item on Desktop
On Oct 9, 2009, at 2:00 AM, M Pulis wrote: Following trends, it is easy to imagine a future Desktop becoming an increasingly protected space. One thing I have learned in 25 years is never underestimate Apple's ability to change and force our world to recompile. 10.6 just killed off an entire CPU line. Wait for OS 10.7 my friend, the Finder, she is nice now, yes? :-) (sigh) I believe Kyle was right. You're just making things up. As others have told you, dot-files being hidden is a convention that's been around for many, many years. Apple continues to find new uses for it with every release (.fseventsd, .Spotlight- V100, .Trashes ...), and many of the tools installed as part of the BSD subsystem use it as well (.ssh/) -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Hide an Item on Desktop
On Oct 8, 2009, at 9:18 PM, M Pulis wrote: Please do not advise this hack. It is not supported by the Finder. Wrong. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Hide an Item on Desktop
On Thursday, October 8, 2009, Ken Thomases > Well, there's also the hidden bit in the file's metadata. It's accessible a > number of ways: > I thought I read somewhere that this isn't always honored. At the least it's not supported on all file systems, I don't believe. Cant find references, though. I'm mobile at the moment. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Hide an Item on Desktop
On Oct 8, 2009, at 7:24 PM, Maggie Zhang wrote: Does anyone know if it's possible to programmatically hide an single item (e.g. a file or a mounted disk or a directory) from the Desktop? Rename it so that it starts with a period. "Dot-files" are hidden. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: debugging cursors
On Oct 8, 2009, at 7:01 PM, David M. Cotter wrote: Read the documentation i have extensively read the documentation tell us what you tried (preferably by posting your code), and we might be able to help. i told you: i set the cursor in response to the user pressing enter after editing a text edit. (sigh) Since you read the documentation, you'll know there's more than one way to do so and clearly things that can interfere (cursor rects). When you're ready to ask questions the smart way: http://catb.org/~esr/faqs/smart-questions.html ... I'll take your inquiry more seriously. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: debugging cursors
On Oct 8, 2009, at 5:02 PM, David M. Cotter wrote: sorry, yes. when the user types a number in a box and presses enter, i create a cursor based on that number and set it. one second later, without any of my code running, the OS seems to change the cursor to an arrow. i want to find out why, and stop it if i can. even just being able to setting a breakpoint on it would help Read the documentation, tell us what you tried (preferably by posting your code), and we might be able to help. Suggested reading: Cursor Management http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CursorMgmt/CursorMgmt.html NSCursor Class Reference http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSCursor_Class/Reference/Reference.html -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: debugging cursors
On Oct 8, 2009, at 4:50 PM, David M. Cotter wrote: Really?? does nobody know how to do this? Likely not, because you're not explaining why. You mention "changed the cursor out from under me" ... is this because you're having some problem in your app or do you really want to try changing the basic cursor behavior for the entire OS? Hint: the latter is unsupported, so the answer (on this list, by its rules) is "no". -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: whether to use core data...
On Oct 3, 2009, at 11:14 AM, Colin Howarth wrote: This is a long (but witty and interesting) rambling post about design, apple documentation, learning Obj-C & Cocoa and so on. [ big, massive, much-needed snip ] FOCUS!!! I get that you're trying to be witty, but I was forced to skim much of your "question" because it's mostly rambling. Witty is fine. Even a good dose of funny irrelevance, but you do need at least a *little* focus. :-) Following will be matter-of-fact, but not at all hostile. Please keep this in mind. You appear to be saying / asking four things: 1 - The documentation is large and unhelpful. 2 - You're trying for your first real Cocoa application. 3 - Is Core Data right for your project? 4 - How do I model my idea? A1: A lot of beginners complain about this. A lot of intermediate to pros recognize that the documentation is far better than most platforms. The trick is, you just have to take the time to familiarize yourself with it. Study, study, study. This is a very large platform with a lot of powerful technologies. It's not a toy language or API by any stretch of the imagination. Finding your way around will take time. Learning what are clearly labeled as "advanced" technologies will require you to master the basics first (surprise!), so give it time and study. A2: All the more reason to heed the warnings and stick to basics. Whether Core Data is a good match for your project or not (more on that in a second) is largely irrelevant since you have already indicated (I think - the rambling makes this hard to say for sure) that you haven't read the more basic technologies upon which Core Data is built. Therefore, your first app should use the most basic methods. Build your data structures with dictionaries, arrays, and NSCoder- compliant custom objects as you wish ... then write the main container to a file. There's your document format. Start with the basics, then move on to the voodoo. A3: Is it right for your project? Possibly (see A4), but the better question is, "is it right for my skill level?" Best answer: an emphatic NO. A4: The short answer: I have no idea. None whatsoever. It's hard to tell what your model is because your e-mail is extremely disorganized. I refer back to my opening point: You need to organize your thoughts into pointed descriptions and questions. Throw in some funny as you wish, but your entire e-mail is all but inscrutable. Clearly describe your best guess at the model layer (not a stream-of-consciousness ramble with lots of inline corrections) and the list will probably be able to help describe how your Managed Object Model should be constructed. As it stands, I couldn't tell what you were really trying to build. In closing: If you want help, follow technical mailing list etiquette and ask coherent questions. If you want to ramble and lament, tell it to the blogosphere. :-) -- I.S. I'm writing a raytracing / lens design program. This is basically my fist serious attempt at a real Cocoa program, and whist I'm quite happy with C and Perl, I don't like Java and hate C++. So far Objective C is nice and simple, except that the compiler doesn't help much :-) I've read Aaron's 'Cocoa Programming for Mac OS X' (1st & 3rd editions) which is, of course, excellent, and have Scott et all. 's 'Cocoa Programming' which is, ummm, big (and good) :-) (It's an old 2003 edition though, so doesn't have anything on Core Data). I've got over the initial "Huh? What's going on? Where's the code?" frustration. And the way IB keeps changing from one version to the next. Now I'm happy with Aaron's "click here, ctrl-drag that there, alt swish here - and look: it works!" Right - now to the subject at hand... Whilst scribbling some of my classes down on a bit of paper, and sorting out which objects are supposed to know what, I ended up with a class with just one instance (a singleton, I guess) called Lens. It contains an array of glass data (refractive index, dispersion constants etc.). It also contains an array of Elements (an 'element' being a single lens-shaped bit of glass. A 'lens' usually has lots of elements). [Well, that's wrong for starters! What does a Lens have to do with Schott's glass catalogue? Answer: nothing. The Element class needs to know what the various values are for the instances it creates - but I don't want the whole table in each element. A class variable in Element would have been ok...] The actual program (which works) at present uses an array of Surfaces, but I realized that's not right. Say you're holding a simple element (e.g. a magnifying glass). What's the surface made of? :-) Also, how does a Surface know the distance to the next Surface? [-- embarrassed silence -- Well? -- OK, it has a pointer to the app and accesses the app's array of surfaces... :-( -- Arrrgh! How *could* you? --
Re: reading (parsing) CSV (or Excel) data
On Oct 2, 2009, at 4:19 PM, Alex Kac wrote: Yes! In any case, I'm sure libcsv is more powerful and correct, but the category there worked for my purposes working with several cloud services. You need only address quoted fields, line breaks within fields, respect character encodings, and line ending variations (CR/LF/CR+LF). Cocoa handles two of these four automagically (in most cases for character encodings, all cases for line endings). The parsing category on macresearch.org adds the other two. I'm fascinated by the NSMutableCharacterSet efficiency issue but the category seems to work quickly on impressively-sized files (100,000 records with 100 fields, with reasonably long text in the fields), despite its memory inefficiencies. I'll be giving it a test with Mike's suggested modification to see how much better it runs, though. :-) -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: reading (parsing) CSV (or Excel) data
On Oct 2, 2009, at 4:15 PM, Alex Kac wrote: Here is something I use that has worked for me fairly well. I found it either on this list or somewhere on the web, so sharing back to the list. http://pastie.org/639863 This appears to be the code listing from the article I mentioned on MacResearch.org . :-) -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: reading (parsing) CSV (or Excel) data
On Oct 2, 2009, at 4:03 PM, Colin Howarth wrote: CSV isn't *that* hard to parse, once you know about quotes and NLs inside cells. ... and encodings and line endings. Don't forget how much goodness Cocoa gives you automagically. :-) -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: reading (parsing) CSV (or Excel) data
On Oct 2, 2009, at 7:42 AM, Mike Abdullah wrote: While using this code in an experimental project I found the app was routinely using 500+ MB of RAM. When measured with Instruments I realised that every time you use a character set for string scanning, Foundation internally copies it, presumably to ensure it has an immutable object to work with. As a result, potentially thousands of copies are being created, resulting in either: A) Outrunning the garbage collector B) Spending far more time allocating and deallocating character sets than doing the actual scanning Easiest solution is just to make a single copy yourself early on. Also the docs for NSMutableCharacterSet do point out that it's inefficient but don't really offer any detail. Very good to know, thanks, Mike. You might want to post a comment on the macresearch.org page so Drew can adjust the example. Do you happen to remember what percentage of difference you were able to achieve? It's fine if not - it's not too difficult to set up a test. :-) -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: reading (parsing) CSV (or Excel) data
On Oct 2, 2009, at 6:34 AM, Mike Abdullah wrote: inefficient due to its use of NSMutableCharacterSet. Could you expand on this? Once created and manipulated, what makes it slow for string scanning compared to NSCharacterSet? I hadn't heard this. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSValueTransformer problem with NSTextField update
On Oct 1, 2009, at 4:38 PM, Paul Bruneau wrote: I do have 20ish edit fields to contend with on my main window. I could set up a preference to let the user select his preferred entry method (there are just 2), but I still think I would still have the trouble with the inconsistent updating behavior between text fields and table views which is the reason for this thread. Plus it works so very very well and my users are all trained from 10 years of using the Classic and then Carbon versions of this app :) Then, assuming Quincey is unable to produce a clean work-around, might I suggest an ugly kludge? :-) Perhaps your text field could inform a delegate that it has changed (using "continuously updates"). The delegate could then force just that field to re-format itself. That *might* work and might save you writing separate -validate... methods. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Weird NSToolbar glitch
On Oct 1, 2009, at 4:01 PM, Bryan Matteson wrote: I couldn't find it anywhere in the documentation. But the thing is, it doesn't seem like you can even move a toolbar from one window to another, even properly making sure that it never belongs to more than one at a time, without getting weird drawing errors. I didn't dig too much into that, it's enough to know that it doesn't work. But creating a new one each time DOES work and creates very little additional overhead, as far as I can tell. Toolbars have always been "special". It seems a lot of "funky things" happen when a window is sent -setToolbar: (even with the shiny new IB 3 toolbar editing support). It's best to stick to the "Window <-> Toolbar" approach (as an immutable relationship, once set). In the grand scheme of things, toolbar creation probably isn't something to worry about. Unless you suspect performance really is causing problems, don't worry about optimizing. If you suspect performance *is* causing a problem, measure it first (with Instruments, for example), then decide on the best course of action. I'm betting it's barely a blip on the radar, compared with any other stuff you might be doing while "switching" windows. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Provisioning Question
On Oct 1, 2009, at 3:59 PM, Bob Barnes wrote: Yes, I realize it's off-topic and I did try to post on the iPhone development forum, but I keep getting an error trying to create an account. I mean no disrespect, but if you know it's off-topic, why post? In any case, if you're having trouble creating an account, call Apple Developer Relations and get it sorted out. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Weird NSToolbar glitch
On Oct 1, 2009, at 3:40 PM, Bryan Matteson wrote: OK, it's solved now. Turns out NSToolbar does not like being on two windows at the same, Hah. No, definitely not. :-D Window <-> Toolbar ... always. You'll never have Window <<-> Toolbar or Window <->> Toolbar. I thought this was stated in the documentation but I can't find it in the API reference or the guide at a quick glance. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Bad stardardUserDeafaults
On Oct 1, 2009, at 3:49 PM, Jacob Schwartz wrote: I didn't post it right away in case this was a common mistake That's the problem. If you think about it, how can we know what kind of mistake it was without seeing what you actually did? :-) -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Provisioning Question
On Oct 1, 2009, at 3:38 PM, Bob Barnes wrote: I've generated the appropriate certificates and created a provisioning profile (development) that is generic, i.e., uses the wild-card character This has nothing to do with Cocoa, specifically. I think you might have better luck using the iPhone development forum hosted at iPhone Dev Center at developer.apple.com ... -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Bad stardardUserDeafaults
On Oct 1, 2009, at 3:32 PM, Jacob Schwartz wrote: So I have a code segment that turns an NSString that is a file path on my computer into an NSURL, archives the NSURL into NSData, and then puts that into a NSMutableDictionary to be saved in the standardUserDefaults. I can archive and unarchive the NSData with no problem, but if I try to unarchive it after taking out of the dictionary, then it tells me (at least I think that is what gdb is telling me) that it is an NSButton. I have no clue where this could have come from and was hoping someone has had this problem before and fixed it. There's no way we can possibly answer your question without seeing your code. It *could* be a memory management issue or it could be a mistaken assignment, but there's no way to tell why your code is misbehaving when you haven't actually shown it. Just post the relevant parts (the storage part and the retrieval part). You don't have to share your whole project, but you *do* have to post the relevant code if you want help debugging it. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSValueTransformer problem with NSTextField update
On Oct 1, 2009, at 3:26 PM, Paul Bruneau wrote: I just thought of something IS said earlier: Thing is, aside from transformed values, the value that makes it to the model layer is usually a direct reflection of what was just set in the view. :-) In 99% of cases, this would seem a waste of CPU cycles to go back and make sure the view reflects the value it itself just claimed to have set. The key thing you said, IS, was "aside from transformed values" which of course is exactly the case I am interested in. I am a little surprised that more developers haven't wanted their text fields to update to the reverse-transformed value after the user commits the change. It seems that Cocoa could easily look to see if a transformer is on the field, and do a reverse transform after entry. I continue to be surprised that no one else has been bothered by this difference in behavior between these common UI types. Maybe transformers are very rarely used? The problem is, I think, that most developers aren't overloading the input as you are. :-) You're allowing (if I'm counting correctly) three different modes of input into the same text field with no indication, aside from the formatting of the text, which format the user is inputting. How about this (IMO) cleaner UI solution? 1 - Keep your base unit of measurement behind the scenes. 2 - Add a control that sets and shows (NSSegmentedControl, perhaps?) the input format. Place it beside or below the text field. 3 - Use an NSFormatter (one for each input mode, swapped out when the mode is changed) to format the input as required for that mode. 4 - Likewise, use an NSValueTransformer (one for each input mode, swapped on mode change) to convert the currently-selected mode's input to the base unit of measurement. It might be slightly less-convenient in that you can't type in just anything and have it magically formatted, but it ensures proper input and, if done right, demonstrates to the user the expected input format. It also frees you writing what is likely some very error-prone parsing code. Compare this to Apple's rocky love affair with natural language date input in NSDateFormatter. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSValueTransformer problem with NSTextField update
On Oct 1, 2009, at 1:02 PM, Paul Bruneau wrote: Well if you look at Figure 2, step #23, it says "Updated value now stored in model object. Key-value observing notifications are sent to observers of this model property." So due to the binding, the text field would get updated by this mechanism, wouldn't it? I wouldn't expect that behavior normally. The transformer is doing only that - transforming the value that's being propagated to the model layer via Bindings. Thing is, aside from transformed values, the value that makes it to the model layer is usually a direct reflection of what was just set in the view. :-) In 99% of cases, this would seem a waste of CPU cycles to go back and make sure the view reflects the value it itself just claimed to have set. I may be wrong and welcome education from anybody who knows better. And promise or no, it is occurring in the table view...it's mysterious. As Quincey mentioned, it's probably because the data cell for that column (the prototype that's reused to draw that column's value for each row) is being updated per row, which involves reading that value and setting it as the cell's object value. I agree: this seems the most likely reason for this behavior. I am pretty ignorant of the differences, but in converting from a fraction to a number of 32nds, I picked NSValueTransformer. It does work great :) I'm just seeing this inconsistency between cells in a table, and text fields in a window. Ah, you're right. You're actually changing the value, not merely shifting its decimal. I hadn't noticed that (maybe it was in your original post, but I didn't go back to read that and if it was in your repost, I completely failed to see it :-}). I believe you made the right choice there. I admit I hadn't thought of Quincey's suggestion - you should definitely try that and see if it helps. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSValueTransformer problem with NSTextField update
On Oct 1, 2009, at 10:58 AM, Paul Bruneau wrote: Thanks for the suggestion, IS. I had in fact tried those and I tried them again just now (in all combinations), no change. Hmmm ... This (figure 2): http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Conceptual/CocoaBindings/Concepts/MessageFlow.html#//apple_ref/doc/uid/TP40002149 ... seems to make no promise that anything in the view will be changed / updated in this scenario, regardless of a transformer. This seems more like a job for an NSFormatter ... -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSValueTransformer problem with NSTextField update
Paul: On Oct 1, 2009, at 8:49 AM, Paul Bruneau wrote: But when I use the transformer on a regular NSTextField, I don't get that benefit. It properly transforms the value and the correct value gets stored in my model, but the reverse transformation doesn't fire like it does when used in the table view. Have you tried turning on the text field's value binding's "continuously updates value" option? Maybe even the "validates immediately" option? I imagine the wrong combination of these (including "off") could have something to do with it. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Does Core Data have reserved Entity names?
On Sep 30, 2009, at 1:11 PM, Alex Reynolds wrote: Unfortunately, that simple solution means parting ways with the naming scheme of the source I'm pulling data from and changing the naming scheme for all my other entities/classes, too, which I was hoping to avoid. But thanks to all for the confirmation. I hear you, but ... "them's the breaks" I'm afraid. Such a basic name is sure to collide. I doubt it's as complex a problem as you're making it out to be, though: 1 - Renaming a class is easy to do with the refactoring tool in Xcode and choosing another entity name can't be *that* earth-shattering. The hardest part is finding any places you've referenced the entity by name (-insertEntityForName:...) and replacing them with the new name. 2 - Just because it's not called "Object" in the object model doesn't mean you can't call it "Object" in the user interface ... -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Does Core Data have reserved Entity names?
On Sep 30, 2009, at 3:53 AM, Alex Reynolds wrote: After I added an Entity called "Object", I get the following message when executing my application on the iPhone: objc[4219]: Class Object is implemented in both /usr/lib/ libobjc.A.dylib and /var/mobile/Applications/BFDFC14C-DB60-44BB-8118- D2AAB39E2EE6/MyApp.app/MyApp. One of the two will be used. Which one is undefined. "Object" is the "original" root class in Objective-C. ObjC allows multiple root classes but Apple's implementation uses NSObject. It appears "Object" is still available somewhere, though. I remember reading about it years ago but I can only find references to this fact and not a clear statement of the fact itself. Hate it when that happens. Whatever the answer, the simple solution is to change your entity's name. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Efficient searching of an NSArray of NSDictionary
On Sep 29, 2009, at 1:21 PM, Todd Heberlein wrote: Don't forget, Google yields different results for different people based on a variety of factors. Good point. My intention, however, is not to instruct on how to use Google, but rather to use it in the first place. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Efficient searching of an NSArray of NSDictionary
On Sep 29, 2009, at 12:53 PM, Oftenwrong Soong wrote: is Predicate Editor (in IB) related in some way? And if so, what is it supposed to do? By the way, a quick google search of, "nspredicateeditor example" yields a very helpful first result ... -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Efficient searching of an NSArray of NSDictionary
On Sep 29, 2009, at 12:53 PM, Oftenwrong Soong wrote: IIUC, what you're saying is that NSPredicate is used as a filter. Is that correct? Well, it's more of a (unit of a) query. You can create compound predicates, etc. to build a more complex query. If so, is Predicate Editor (in IB) related in some way? Well ... yes ... it is an editor control for predicates. :-) And if so, what is it supposed to do? Honestly I could never understand the docs on this particular control. :) If you have specific questions, you need to ask those instead of "what is it supposed to do"? What don't you understand? The Overview section of the NSPredicateEditor reference is incredibly clear. The very first sentence even tells you what it's a subclass of, which, if you follow the link and read *its* overview, will give you even more information. Further, the related "Companion Guide" about predicates is highly relevant. Are you saying you're unsure how to actually use it / set it up? I *think* that's covered between it and its superclass's documentation, but admittedly I've never read in depth for that specific information. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Efficient searching of an NSArray of NSDictionary
On Sep 29, 2009, at 10:38 AM, Pascal Harris wrote: My current method is to iterate through the array, searching for a match for a particular key. I suspect that there may be a faster way - but I cannot find a tutorial (especially since all the example code seems to have gone AWOL in Snow Leopard). Two points: 1 - The examples are found by searching in XCode's documentation window or the ADC web site. 2 - You can use NSPredicate (without Core Data). Read up on it and craft the appropriate predicate, then (hint: search keywords to follow) filter the array using the predicate. At this stage I would rather not use Core Data (even if this is the most optimal method) because I don't yet have a manual for it. Core Data has nothing specifically to do with this problem. The core technology that makes this easy is a mix of Cocoa Bindings and NSPredicate. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Best way to implement drag and drop for multiple types of nstableview
On Sep 25, 2009, at 9:25 AM, Paul Bruneau wrote: I have used mmalc's DNDArrayController class from his Bookmarks example code to implement drag and drop for one of my NSTableViews. Of course it works great. But now I would like to set up a couple other table views with other types of data. I can re-use my DNDArrayController, but then the interface thinks a user can drag between two tables with totally different types of data in them. Paul: Unless I'm missing something, why not add properties to your array controller class that keeps track of the desired types? If you use multiple tables for the same array controller instance, you could get even fancier and keep an association between provided and accepted types for each table. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Subview drawn with reverted order
On Sep 24, 2009, at 8:36 PM, Jens Alfke wrote: Overlapping sibling views aren't really supported in AppKit. No longer true as of Leopard. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: CoreData Mysterious Conditional Data Loss
On Sep 24, 2009, at 9:59 AM, Milen Dzhumerov wrote: You got it right first time, many thanks. The images were created using NSImage's initByReferencingFile: which I presume only references the image file. That's what I thought at first (that CoreData stored the path to the image within the bundle so when the bundle was moved, it couldn't find the file) but then I looked at the raw data stored in the XML file (which was base64 encoded) and saw the actual PNG data with no filesystem paths. It seems that I there's more magic going on behind the scenes. In any case, thanks for the help. I don't think this is Core Data magic so much as NSImageView's caching magic. I would expect an archived copy of this image to be stored only with its file reference, not with its data (while still attempting to reference the file when it's recreated). I would call this a bug if a careful review of the documentation doesn't reveal something you missed. Since I haven't used -initByReferencingFile: or tried to archive an image created with it, I haven't read the documentation regarding this approach, so I leave that to you. In any case, you need to decide if you want to store the image itself (ie, its data) or just a reference to it. If you only need a file reference, you can use an FSRef (lots of convenient Cocoa wrappers exist on the web) for anything before Snow Leopard or use Snow Leopard's latest FSRef-loving NSURL goodness. If you need the image data itself, try leaving your attribute as Transformable and creating the image with –initWithContentsOfFile: or – initWithContentsOfURL: and storing that. I think that'll work for you. Alternatively, you could store the image's data as an NSData attribute. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: CoreData Mysterious Conditional Data Loss
On Sep 24, 2009, at 8:38 AM, Milen Dzhumerov wrote: Hi all, I'm experiencing the weirdest conditional data loss that I've seen in a long time. One of my managed objects has an NSImage property (stored as Transformable). Now here's the bug in summary: If the app bundle which initially created the persistence file (SQLite or XML) gets moved, the icon property doesn't get restored. If I move the bundle back to where it originally was, it gets restored. We're probably going to need a bit more information than this. You say the icons are "gone". I assume your entity instances are still there and all their other properties are present but only the NSImage attribute is coming back with an empty image? In that case, how exactly are you creating / storing / accessing this image? That seems to be the most relevant part to all this but one which you've completely left out. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Reliable way to find out if CoreData finished loading
On Sep 17, 2009, at 6:46 PM, Mantas Masalskis wrote: I'm loading Core Data object via Managed Object Context in IB. It looks like it hasn't finished loading when applicationDidFinishLoading is fired. Perhaps thinking about this a different way would clarify things. You don't "load a context". You create a context and use it to fetch objects from the store (or merely to create objects if you're using an in-memory store). So, if you have some controllers that aren't ready yet, you can simply instruct them to -fetch: ... this will force them to fetch immediately, rather than waiting for a future cycle of the run loop. What is the appropriate way to do smth once Managed Object Context is loaded? What's a "smth"? -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Populating TableView Via Button.
On Sep 18, 2009, at 9:34 AM, Philip Juel Borges wrote: Does anyone know how you'd populate a tableview when clicking a button? Nope. That kind of high-tech stuff is beyond any Cocoa developer. ;-) I tried this: -(void)populateTableView:(id)sender { [super init]; ... return self; } This doesn't work. If I replace the void function in the class .m file with (id) init, everything works fine. But then it populates the tableview on launch and I'd like to populate the tableView only when I click a button. In all seriousness, there are a number of things that seem to be wrong with your understanding of Objective-C and the Cocoa frameworks. So first of all, this code example goes beyond trouble populating the table view. It's as much to do with initializing (what I assume must be) an instance variable called "sourceArray". Since you said everything works fine (ie, you see things in your table) when you take another approach, I'll assume your table datasource (or bindings) setup is configured correctly. Second, this very strange call you make to [super init] is inexplicable. There's just no good reason to call your class's superclass's init or even the class's own init method from some random place within your class. Even if you give a good technical reason, I'd argue you don't. :-) Read the "Allocating and Initializing Objects" section of the Objective C 2.0 Programming Language guide to get a better idea of the hows and whys: http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ObjectiveC/Articles/ocAllocInit.html#//apple_ref/doc/uid/TP30001163-CH22-SW1 Third, you're returning self within a method that claims to return nothing at all (void). I assume this and the call to [super init] are a result of your trying to get things working (and moving them to a method that you can call yourself, directly). Unfortunately both these issues will only confuse things further. Move initialization stuff back to your init method and diagnose the real problem. Fourth - the real problem: You never ask the table to -reloadData (if you're using the NSTableDataSource protocol) or you never tell the NSArrayController where to get its information. So it comes down to that ... are you using the data source protocol or bindings? If you're using the data source protocol, all you need to do is tell the table view to -reloadData when you've changed its data. If you're using Bindings, it's a bit more complicated: you need to change your "sourceArray" in a KVO-compliant way so the array controller to which your table is bound "hears about" the change. Search the archives for phrases like, "changing the array behind the controller's back" and read: http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/KeyValueObserving/ (Better yet, create KVC/KVO-compliant accessors for your sourceArray and use those to set a new array. Using Objective-C 2.0 properties makes this *very* easy.) -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: debugging strategy
On Sep 16, 2009, at 1:05 PM, Michael Cinkosky wrote: Here is the situation. We have a large application that has been in the field for several years now. We are adding new feature for our next release, and we are testing the new builds against Snow Leopard as well as earlier versions of OS X. Under Snow Leopard, some existing functionality has stopped working in a mysterious way. It is crashing deep inside webkit, but the initial symptom is that the - drain method is invoked on a object other than an autoreleasepool. The class of the object on which -drain is being invoked varies with the run. Obviously, we are not calling -drain deliberately, and I doubt that webkit is either, so something is getting screwed up. You haven't posted your crash log, but I'm guessing it's a good old fashioned memory management error. There are lots of articles and sources out there showing the various debugging tricks necessary for debugging memory management issues (and Instruments is now even better at this). The trick (and fun) is discovering whether it's yours or the system's. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Binding a model's ivar array to the contents of an NSArrayController
On Sep 16, 2009, at 11:29 AM, A B wrote: So in short, my need is pretty simple: Bind an array to an NSArrayController. That being said, it seems that no combination of exposeBindings:, bind:toObject:withKeypath:options:, observeValueForKey:ofObject:change:context:, etc. is working as I expect it to. Admittedly, I have done most of my binding work via IB and I've never really done much with bind:toObject:withKeypath:options: before, so I wouldn't be surprised to find that that was where my problem lay. Can anybody offer any general tips as to how I might be able to accomplish this? I'm sure that this is one of those basic things that once I get it I'll do a full-on forehead slap when the light goes on, but right now I'm just feeling around in the dark. An example, perhaps? http://homepage.mac.com/mmalc/CocoaExamples/controllers.html See the "Graphics Bindings" example. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Upgrading NSDocument format, best practice
On Sep 16, 2009, at 10:48 AM, Graham Cox wrote: So far I haven't experienced any problems and it prompts for save just like any untitled document would. Hmmm ... it just seems wrong to me, though. :-) Perhaps it's not a "short-circuiting" in the sense I so dramatically described, but a well-defined mechanism already exists in Cocoa. In your case, I would imagine a ".mydoctemplate" as a non-editing-role type for ".mydoc" would be "more Cocoa-like". That's my opinion, though, not gospel. For that matter, isn't this a job for "stationary"? Does Cocoa respect it and "do the right thing"? I see you yourself had asked this very question: http://lists.apple.com/archives/Cocoa-dev/2008/Oct/msg00804.html :-) -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Upgrading NSDocument format, best practice
On Sep 16, 2009, at 10:28 AM, Markus Spoettl wrote: Better, yes, though I haven't had many problems understanding the first version either. You mustn't be too hard on yourself. Hard on myself? Nah. I was laughing at myself. :-) It was particularly funny when an angry person who shall go unnamed took every a few opportunities to hit me off-list any time I'd slip up. S/he had no idea whatsoever how much it only added to my laughter. :-D I didn't think of changing the file extension, that would definitely work. Thanks for that! I'm loosing my precious file extension which I'm so fond of, though. I faced that once too. I got over it. You might try simply expanding it. Say you named your "Retro Frabulator Document" as ".rfd". Why not call it ".retrofab" or ".retrofabdoc"? Obviously you don't want the extension to be ridiculously long but there are a LOT of custom doc formats out there (tens of thousands? hundreds of thousands?) and we have a more modern file system ... why limit ourselves? -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Upgrading NSDocument format, best practice
On Sep 16, 2009, at 10:15 AM, I. Savant wrote: In my opinion, you're on the right track. I think the simplest solution is to create a new file extension. Forget renaming the file - a different extension implies a different format. Doing this gives you all the mechanisms and warnings for free: marking the old format as "read only" (ie, the app isn't an editor of that format, only a viewer), then providing the new extension as an "editor role extension", when the user saves, I believe the dialog will automatically pop up the Save As dialogue with that format / extension (or the first editor-role extension) selected. Wow ... let me decipher this paragraph, which I obviously didn't proofread. :-D When defining your document types (in the Info.plist file), you can designate a type as having an "Editor" role. This is typical. Unchecking this makes it a type your application will only read, but not save. If you uncheck the editor role for your old type, then add a new type that has the editor role, a save action on a document of the old type should trigger the Save As dialog, with the new format (as an editor role) selected. Better? ;-) As Gemmell would say: Official coffee times. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Upgrading NSDocument format, best practice
On Sep 16, 2009, at 9:52 AM, Markus Spoettl wrote: I have an NSDocument that reads old-format files which it does no longer write. When loading such an old format file, the app warns the user about the format-change and the fact the file can't be read by older versions once saved with the new one. Unfortunately, producing files in a compatible format is not possible. I know... This is not at all uncommon. It's extremely difficult (and often quite simply unsustainable) to produce a completely-backward- compatible format. The problem is most warning messages are quickly dismissed unread. Yes, but this is a problem that you can't easily solve. Best to minimize the possibility of loss if the warning is ignored. So in order to avoid that the user accidentally overwrites old- format files he wanted to keep, I make sure the he has to pick a filename when he decides to save the freshly upgraded document. In my opinion, you're on the right track. I think the simplest solution is to create a new file extension. Forget renaming the file - a different extension implies a different format. Doing this gives you all the mechanisms and warnings for free: marking the old format as "read only" (ie, the app isn't an editor of that format, only a viewer), then providing the new extension as an "editor role extension", when the user saves, I believe the dialog will automatically pop up the Save As dialogue with that format / extension (or the first editor-role extension) selected. Problem solved (as far as an individual app should attempt to solve it). To do so I set -fileURL to NIL and tell the document it has been loaded from a different file using -updateChangeCount: Um ... yuck. :-} It reminds me of all the SciFi shows where the hero jams something into the electronic lock mechanism (or shoots it with an energy weapon) and the door pops open. Worst. Lock. Ever. In reality, such an action is more likely to guarantee the door won't be able to be opened, having affected the mechanism in unexpected (and likely unwanted) ways ... Similarly, it's generally a bad idea to short-circuit Cocoa mechanisms if you can possibly help it. I guess my question is, is this the way to do it? Are there alternatives? Yes. Use the existing Cocoa document mechanisms. Don't shoot at electronic locks. :-) -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: File Conversion Using Cocoa
On Sep 15, 2009, at 9:53 AM, Ramesh P wrote: I would like to convert pdf, doc files to html files using Cocoa? Please help me in this. If you want more specific information, break your problem down into steps. "How do I write this application?" is an unreasonably-broad question. In general: there's no direct way to do this while preserving images and layout exactly. You're probably best off using PDFKit to parse the PDF document (and get its text runs and images). For .doc files, you're best to load them with the Cocoa text system and parse them that way (I don't know how images are handled in this case). You can then convert the data you've parsed into HTML as you wish. Again, I don't think there's a way to exactly preserve the formatting in either case, given the complexities and wide-open possibilities of both formats. See also: http://catb.org/~esr/faqs/smart-questions.html -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSFireTimer Crash
On Sep 15, 2009, at 12:51 AM, Anurag Khare wrote: At least tell me the reason for this crash report.Please At least post your code, please. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: document-based application
On Sep 7, 2009, at 1:24 AM, Oftenwrong Soong wrote: In my doc-based app, I need to initially display a startup window instead of a new empty document. Its function would be somewhat akin to that of the Template Chooser that comes up when you launch Pages. This might help (it's a little hard to find via Google unless you know it exists): http://www.stepwise.com/Articles/2006/eb1/index.html -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Finding nearby places
On Sep 7, 2009, at 5:48 AM, Mahaboob wrote: I get the latitude and longitude from the iPhone using coreLocation framework. Now I need to show the nearby hotels, restaurants etc. Which api I need to use for this? I'm using iPhone OS 2.2 This has to be the fourth or fifth time you've asked this exact same question and it's becoming annoying. Posting the same question again and again is a gross violation of etiquette on any list and is only going to cause people to ignore all messages from you. As to your question, I believe someone (maybe me?) answered this the first time you asked it: You're going to have to interface with a web service that provides this information based on geolocation - there is no dedicated framework to do this (because there still has to be a service providing the data). Now, you have your answer (again). Search the documentation and the web for tutorials on how to use Cococa to interface with a web service (there are dozens). It's up to you (not this list) to find a service to provide the data for you. If you have *specific* questions about *specific* parts of the Cocoa framework, ask them, but please ... STOP ASKING THE SAME QUESTION AGAIN AND AGAIN. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: (no subject)
On Sep 4, 2009, at 6:16 PM, David Blanton wrote: I want to develop a CocoaTouch app that talks to a web server without doing 'web pages'. I.e. the app does http gets and posts driving php (or other) scripts on the server to access some sql database. ... Make sense or shoveling against the tide? So ... you want to access a web service? Sounds perfectly typical to me. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Having problem with fetch request in NSDocument based application
On Sep 4, 2009, at 10:48 AM, Clayton Leitch wrote: I re-typed everything in a freshly produced document based application. So you created a new Core Data Document based application and put your code and data model into it, and it's still not working correctly? I'm utterly mystified. Since this seems like a small project that you haven't gotten too far with, it might be a good idea to zip this up (delete the build folder so it's small) and post it to a file sharing site like rapidshare.com ... this will allow everybody to take a look at it and see if they can spot the problem. The code itself looks fine. I can't imagine why it's not working. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Having problem with fetch request in NSDocument based application
On Sep 4, 2009, at 10:38 AM, Clayton Leitch wrote: The debugger shows 0 objects in the array. Interestingly, this same code works perfectly in a non-NSDocument version of this application. Wait, when you say it works in a non-NSDocument-based version, it makes me wonder: did you copy code from a non-doc-based app into a doc- based app? If so, is your document subclass really an NSDocument subclass or an NSPersistentDocument subclass? -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Having problem with fetch request in NSDocument based application
On Sep 4, 2009, at 9:47 AM, Clayton Leitch wrote: fetchedObjects = nil; ... fetchRequest = [[NSFetchRequest alloc] init]; ... fetchedObjects = [context executeFetchRequest:fetchRequest error:&error]; ... [fetchRequest release]; One other thing (memory-management-related). You seem not to be using garbage collection (since you release your fetch request), but your example indicates you don't appear to be retaining your fetchedObjects array (or releasing an existing one at the top of your method). You might want to think about that more closely. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Having problem with fetch request in NSDocument based application
On Sep 4, 2009, at 10:24 AM, Clayton Leitch wrote: Yes, I saved it as XML and opened the file. Below is what I found: Okay, so since there're definitely some instances in the store, and nothing is nil in the debugger, the only thing remaining is your message delivery. ... have you specifically verified in the debugger that the array in fact has a count of zero? If you find that it does not, I suspect your "errorMessage" field's outlet isn't connected and its default string is set to "0". That way, no matter what the count is, the field is never updated from "0". That's really the only thing I can see. I've gone over your code several times and can't find anything wrong with it. So, if someone points out something obvious, you're not the only one who will be embarrassed. :-) -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Having problem with fetch request in NSDocument based application
Taking this back on-list where it belongs. On Sep 4, 2009, at 9:53 AM, Clayton Leitch wrote: Yes, there is a Measurement instance in the the data model. Debugger shows that everything is set properly until the array gets no objects in answer to the query. Are you sure? How have you verified all of this? To verify an instance exists, have you saved the context to the store (as XML, perhaps) and looked inside the resulting file to make sure the instance is actually there? -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Having problem with fetch request in NSDocument based application
On Sep 4, 2009, at 9:47 AM, Clayton Leitch wrote: Here is the code in MyDocument: -(IBAction)calculateStat:(id)sender{ fetchedObjects = nil; context = [self managedObjectContext]; fetchRequest = [[NSFetchRequest alloc] init]; entity = [NSEntityDescription entityForName:@"Measurement" inManagedObjectContext:context]; [fetchRequest setEntity:entity]; fetchedObjects = [context executeFetchRequest:fetchRequest error:&error]; if (fetchedObjects == nil) { NSLog(@"error"); [errorMessage setStringValue:@"no objects"]; }else { [errorMessage setIntValue:[fetchedObjects count]]; } [fetchRequest release]; The fetchedObjects count is always 0. Any idea what silly thing I forgot. ... do you *have* any "Measurement" instances in your context? Have you used the debugger to verify that all your variables were assigned objects when / as you expected? -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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