Re: JDBC Frameworks?
On 11/07/2008, at 3:10 PM, Tom Jones wrote: Thanks, for the extra info. I'm looking to create a multi-user inventory type application for a customer. They want it custom and to run on Mac OS X. I guess what I'm really going to do is develop the front end in Cocoa and use SOAP for all of the database communications. JDBC would be a good way to go, if the Cocoa-Java bridge were still supported, as JDBC drivers are easy to get. (This is the reason that so many generic database interface applications are written in Java.) That said, Mac OS X has built-in support for ODBC using iODBC; there's a detailed description here: http://www.iodbc.org/index.php?page=docs/macosodbcstory/index and you can download the SDK here: http://sourceforge.net/project/showfiles.php?group_id=90493 Using that, you ought to be able to do your database interface using the iODBC library in C (or even Python or Ruby if you want to). Cheers, Brett ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Design Question: Where to observe using KVO?
On Jul 10, 2008, at 4:55 PM, Patrick Mau wrote: I'd like to show you one ugly detail. I put all observed objects, including their keyPath in a local NSDictionary, because I have to remove the observers on deletion of a table row. The 'observeObject' looks like that: - (void)observeObject:(id)object withKeyPath:(NSString *)keyPath { NSLog(@start observing %p with keypath %@, object, keyPath); [object addObserver:self forKeyPath:keyPath options:NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld context:nil]; [observers setValue:object forKeyPath:[NSString stringWithFormat:@%p.%@, object, keyPath]]; } In my opinion, this is as ugly as it can possibly get. I'm using the address of the observed object and append the keypath to create a pseudo key for each observed instance. I don't like that at all, but how would I be able to remove all observers when I have to clean them up later? Is there a better approach instead of observing every property of all array entries? How about a dictionary whose keys are NSValues representing the objects? For each object, the value from the dictionary would be an NSMutableArray whose elements are the key paths being observed on that object. // ... NSValue* objectKey = [NSValue valueWithNonretainedObject:object]; NSMutableArray* keyPaths = [observers objectForKey:objectKey]; if (!keyPaths) { keyPaths = [NSMutableArray array]; [observers setObject:keyPaths forKey:objectKey]; } [keyPaths addObject:keyPath]; Cheers, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: JDBC Frameworks?
On Jul 10, 2008, at 9:21 PM, Tom Jones wrote: Hmm, this is really a shame. I guess I was just looking for a good framework to use to connect to a database. I think this is a big hole that Apple should really fill. It would be really cool if we could connect to other databases rather than just SQLite. They do; it's called ODBC. And it connects to databases other than SQLite. Nick Zitzmann http://www.chronosnet.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: garbage collection and NSConnection
There are several ways to share the implementation: 1. Do nothing, CF and Foundation already do it for most of their objects (and they share their implementation...probably unreasonably...) This, obviously, doesn't work for your own classes. But a lot of the objects you will use will tend to be Foundation objects, especially if you've adopted the temp-object-heavy style. 2. Implement a common superclass This doesn't work if you're subclassing something other than NSObject already. Non-NSObject subclasses tend to be things like NSViews which are fairly heavy-weight and not that temporary. 3. Implement a function, inline function or macro that takes a pointer to the refcount ivar. This works, but still leaves you to copy/paste glue code everywhere. You don't even have to do that if you don't want to. Not every solution works in every context, but combined, they cover the bases rather well, making sharing the implementation quite easy. In my experience. [not referring to scanning overhead] - Temporary objects get a 'release' at the end of their life, and usually an 'autorelease' at the beginning. The cost of a single refcounting op is negligible compared to the cost of object allocation, so these two are quite irrelevant. - Jumping objects across the end of an autorelease pool by retaining them before destroying the pool. In my experience, this is rather rare, and the cost once again tends to be completely negligible compared to the cost of destroying the pool and the objects in the pool. - Paranoid or thread-safe accessors do a retain/autorelease dance before returning. This one is actually a problem. Don't do that, it isn't actually thread-safe and can cause at least as many problems as it 'solves'. Yes, just like objects don't get retained when they are stored in local variables, that happens when you store them into instance variables. They do get released though, which is a refcount operation that doesn't happen in the GC world. Once again, the -release is completely negligible compared to the actual deallocation. Taking into account the programming style a language supports is about as far from a micro-optimization as you can get. It is an architectural concern that informs how you structure your system, changing it after-the-fact often turns out to be impossible. At least that's been my experience over the last 20 years or so, YMMV. I'm not sure I understand what you're saying here. My point is that ObjC makes it very easy and natural to create temporary objects without worrying about their lifetimes. That is exactly my point: this is one case where the comparative ease is deceptive, as creating lots of temporary objects is not something that Objective-C supports well. Objective-C is a *hybrid* OO language, not a pure OO language. In my experience, code which goes to great lengths to avoid autoreleased objects is messy and much more bug prone than the normal way. Yes, if it is autoreleasing you avoid, not object creation in the first place. The extra autorelease only costs you maybe 30%, the extra object allocation costs you an order of magnitude or more. So for example, my standard pattern for initialization is something like this: -init { self=[super init]; [self setFoo:[Bar bar]]; return self; } Thus, yes, you can avoid many autoreleased objects if you want, but this is a painful micro optimization, not the standard way to do things. Once again, avoiding temporary object-creation is not a micro- optimization, and creating lots of temporary objects is definitely NOT the standard way to do things in Objective-C. You might have heard about the 80/20 rule, which is actually more a 90/10 or 95/05 rule: most of the execution time is spent in a very small portion of your code. Being able to go in and *really* optimize those hotspots actually gives you the most bang for the buck. The typical usage, meaning the bulk of the program, generally does not matter. I did my master's thesis on high performance code and optimization; I am more than vaguely familiar with these concepts. Glad to hear that! However, in the sections above you were continually treating ops that differ in cost by an order of magnitude or more with equal weight, which makes me somewhat dubious of your claimed credentials... My point is merely that GC can help you without you needing to change your code in any way. This, to me, is more valuable than peppering my code with lots of painful manual memory management to make it go faster. ...as does this. Once again: this is not about randomly peppering code with lots of painful manual memory management, this is about (a) adopting a coding style that is clean, (b) flows with what Objective-C provides and is good at and (c) allows for the highly focused optimizations that actually make an
Re: Storing structured data in file - any easy way?
On 11/07/2008, at 01.28, Chris Hanson wrote: On Jul 10, 2008, at 6:09 AM, Jules Colding wrote: I'm trying to figure out how to write and read structured data to a specific file. I have a very bad feeling that the answer is Core Data, but I'm feeling totally at lost after having been reading up on Core Data for a couple of days by now. That's what Core Data is for, yes. This is what I would like to do: 1) I want to store several top-level objects. 2) A top-level object have a few optional attributes. 3) Each top-level object have two-way relationships to sub-objects. 4) Sub-objects has also a few optional attributes. 5) A top-level object may contain many sub-objects. Obviously I would like to read and write to the data file as well as create and delete objects within. There must be a simple way to do this but I just can't figure out how... Out of curiosity, what do you find not simple about doing the above using Core Data? It is easy enough to create the data model using xcode, but how that connects to actual code is harder to see. Maybe I'm just overwhelmed... I've had to learn about Sync Services, Cocoa, xcode, the Foundation framework and not to forget Objective-C, from scratch in just the last month or so. I'm new to the entire Mac development environment (I'm coming from linux) so you can imagine that my head is rather busy digesting it all. Anyway, I must say that I find it the best thought-out development environment that I've ever had the pleasure to work within. Best regards, jules ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Setting DPI of image data
On Jul 10, 2008, at 20:16 , Graham Cox wrote: I'm using NSBitMapImageRep's -representationUsingType:properties: method to convert data to JPEG, TIFF, etc. I'd like to be able to specify the DPI of the image. I can calculate the right number of pixels needed for a given DPI OK, but the image always comes up as having 72 dpi when opened in another app. Is there a way to set this property at this level, or am I forced to drop down into Image I/O? DPI of the NSBitmapImageRep is controlled indirectly via the 'size' instance variable, with the size given in Postscript points. I just tried it out and it still works as expected, at least when generating a TIFFRepresentation: [EMAIL PROTECTED] image := NSBitmapImageRep alloc initWithData:(NSData dataWithContentsOfFile:'IMG_0193.JPG') image NSBitmapImageRep 0x232800 Size={1126.4, 844.8} ColorSpace=NSCalibratedRGBColorSpace BPS=8 BPP=24 Pixels=2816x2112 Alpha=NO Planar=NO Format=0 image size. {1126.4, 844.8} image TIFFRepresentation writeToFile:'/tmp/img0193.tiff' atomically: 1. 1 image setSize:((image size) / ([EMAIL PROTECTED])) image size. {563.2, 422.4} image TIFFRepresentation writeToFile:'/tmp/img0193_d2.tiff' atomically:1. 1 ^D Bye! [EMAIL PROTECTED] /tmp /tmp ~/Pictures [EMAIL PROTECTED] -info *.tiff *** img0193.tiff Directory at 0x1104008 Image Width: 2816 Image Length: 2112 Resolution: 180, 180 Resolution Unit: pixels/inch Bits/Sample: 8 Sample Format: unsigned integer Compression Scheme: none Photometric Interpretation: RGB color Orientation: row 0 top, col 0 lhs Samples/Pixel: 3 Rows/Strip: 15 Number of Strips: 141 Planar Configuration: Not planar *** img0193_d2.tiff Directory at 0x1104008 Image Width: 2816 Image Length: 2112 Resolution: 360, 360 Resolution Unit: pixels/inch Bits/Sample: 8 Sample Format: unsigned integer Compression Scheme: none Photometric Interpretation: RGB color Orientation: row 0 top, col 0 lhs Samples/Pixel: 3 Rows/Strip: 15 Number of Strips: 141 Planar Configuration: Not planar [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Calling autorelease on CFAllocated objects?
One caveat: If you're writing code that needs to function with garbage collection on, CFRelease and -release are not equivalent. See http://developer.apple.com/documentation/Cocoa/Conceptual/GarbageCollection/Articles/gcCoreFoundation.html for details, but the form thats safe for both gc and non-gc is [NSMakeCollectable(someCFThing) autorelease]. -Ken On Wed, Jul 9, 2008 at 4:47 PM, Wade Tregaskis [EMAIL PROTECTED] wrote: http://www.cocoabuilder.com/archive/message/cocoa/2008/7/5/212046 I wish this were better documented; the Search Kit docs show autorelease being sent to an SKDocumentRef, also, and that's always made me nervous (I think I actually sent feedback on that one a long time ago). I do apologise, you are absolutely correct. The confusion arises from the fact that the term toll-free bridging is used to describe CF objects that have real NS equivalents, functionally. In fact, all CF objects are bridged, in a functional sense - just that by default they're bridged to essentially NSObject so all you get is the basic NSObject functionality. So my previous answer was actually right, just not helpful. :D The documentation could be clearer, yes. I just filed a bug report myself, which I know isn't the first, but if you do encounter places in the documentation which talk about toll-free bridging and are ambiguous or seemingly contrary to this, please file bug reports for those specifically. Wade ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/kenferry%40gmail.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: JDBC Frameworks?
On Jul 11, 2008, at 9:39 AM, Nick Zitzmann wrote: Hmm, this is really a shame. I guess I was just looking for a good framework to use to connect to a database. I think this is a big hole that Apple should really fill. It would be really cool if we could connect to other databases rather than just SQLite. They do; it's called ODBC. And it connects to databases other than SQLite. Andy Satori's open source ODBCKit framework is a good start for ObjC apps: http://sourceforge.net/projects/odbckit Jonathan Monroe Actual Technologies - ODBC for Mac OS X [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Learning How to Program in Objective-C
I'm in the same boat. The best thing I can recommend is to buy the Cocoa Programming book by Hillegass: http://www.amazon.com/exec/obidos/ASIN/0321503619/bignerdranch-20 I'm halfway through, working on the chapter 18 challenge. Between that book, Apple's developer web site, and this mailling list, there is more than enough to get you started. Good luck! Jon On 7/11/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello forum, This is my very first post and will get right to the point. First, I have no programming experience at all. I want to learn how to program using Xcode. I'd like to do it at home self paced and I also understand that this is going to be a very long journey and I'm ready for it. So, I ask you for suggestion/inputs and please don't hold back. If it's not possible I'll understand. If it is possible, since I'm on 10.4.11, would the latest version of Xcode be 2.5to download? And does it include everything I need? Thank you all for reading very much appreciated ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/jonbuys76%40gmail.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Learning How to Program in Objective-C
You might also look for a CocoaHeads group near you (http://www.cocoaheads.org), and start combing through blogs of other Mac developers (see http://www.cocoablogs.com/). Chuck On 7/11/08 9:30 AM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello forum, This is my very first post and will get right to the point. First, I have no programming experience at all. I want to learn how to program using Xcode. I'd like to do it at home self paced and I also understand that this is going to be a very long journey and I'm ready for it. So, I ask you for suggestion/inputs and please don't hold back. If it's not possible I'll understand. If it is possible, since I'm on 10.4.11, would the latest version of Xcode be 2.5to download? And does it include everything I need? Thank you all for reading very much appreciated ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/chuck.toporek%40pearson.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Learning How to Program in Objective-C
Hi, I understand where you're coming from having just come down this road not to recently myself... The path I took was Learn C - Obj-C - Cocoa. It worked really well because it went from the most basic to the more advanced starting at quite a low level. The C tutorial I used was http://gd.tuwien.ac.at/languages/c/programming-bbrown/cstart.htm It's quite good and got me to learn a lot about C. Then I echo the recommendation for Aaron Hillegass's Cocoa Programming and as an added recommendation -- grab the ADC doc The Objective-C 2.0 Programming Langauge and print a copy (I recommend getting it spiral bound). While learning it's a great reference to help refresh you when you get stuck. If you go with the Spiral Bound version at Kinko's double sided it should run about $10 to $15. -Joe Kavanagh ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Learning How to Program in Objective-C
On Jul 11, 2008, at 6:54 AM, Jon Buys wrote: The best thing I can recommend is to buy the Cocoa Programming book by Hillegass: http://www.amazon.com/exec/obidos/ASIN/0321503619/bignerdranch-20 If you have no programming experience, this is probably too advanced a starting point. Start with Kochan's book (Programming in Objective-C): http://www.amazon.com/Programming-Objective-C-Developers-Library-Stephen/dp/0672325861/ref=sr_1_1?ie=UTF8s=booksqid=1215785694sr=8-1 mmalc ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Learning How to Program in Objective-C
On Jul 11, 2008, at 7:16 AM, Joe Kavanagh wrote: Then I echo the recommendation for Aaron Hillegass's Cocoa Programming and as an added recommendation -- grab the ADC doc The Objective-C 2.0 Programming Langauge and print a copy (I recommend getting it spiral bound). While learning it's a great reference to help refresh you when you get stuck. If you're still on Mac OS X 10.4, then the 2.0 version contains information that you will not be able to use. If you don't have the original documentation on your system, then see instead the first version of the Guide (which combines the language guide and the introduction to OOP using Objective-C). http://developer.apple.com/documentation/Cocoa/Conceptual/OOPandObjC1/Introduction/chapter_1_section_1.html mmalc ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Learning How to Program in Objective-C
The BYU CocoaHeads group is actively collecting links to just about every Cocoa related resource we can find. We have several pages to browse through: http://cocoaheads.byu.edu/resources Cheers, Dave DeLong On Fri, Jul 11, 2008 at 8:00 AM, Toporek, Chuck [EMAIL PROTECTED] wrote: You might also look for a CocoaHeads group near you (http://www.cocoaheads.org), and start combing through blogs of other Mac developers (see http://www.cocoablogs.com/). Chuck ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Any good advice for naming parameters of init methods?
On 11.7.2008, at 04:59, William Xu wrote: Jens Alfke [EMAIL PROTECTED] writes: With any naming convention, the possible problem is a conflict with a name in a superclass. Apple's Cocoa frameworks tend to use a _ prefix for both ivars and private method names. How about using _ as postfix then? Like `this_one_'. I find google c++ guide suggests that: http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Variable_Names Looks good to me. The only disadvantage of this approach is that KVC’s direct access to your ivars_ will no longer work. KVC knows about the _ivar convention (because it is used by Apple ;-) ) and matches an _ivar to the key ivar. It won’t for ivar_. But than again it is better anyway to have explicit accessors, I’d say. Kai PS and OT: _ivar is not (any more) considered portable C++ either because all names beginning with _ are reserved for compiler/library use by the standard. -- William http://williamxu.net9.org ... I think I'd better go back to my DESK and toy with a few common MISAPPREHENSIONS ... ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/kai%40granus.net This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Trashing files and undo
Note that if a file is on a secondary volume, and you move the file to the Trash, it doesn't get moved to ~/.Trash; you'll find it in the .Trashes directory on the root of the volume on which it resides. -- m-s On 11 Jul, 2008, at 10:42, Abernathy, Joshua wrote: ~/.Trash? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] ] On Behalf Of Ruotger Skupin Sent: Friday, July 11, 2008 10:39 AM To: Cocoa-dev@lists.apple.com Subject: Trashing files and undo Hi, my app trashes files with -[NSWorkspace performFileOperation:source:destination:files:tag:] and NSWorkspaceRecycleOperation. This works flawlessly but users want undo. NSWorkspace does not seem to allow undoing said file operation (or any file operation for that matter). Correct me if I'm wrong. So I might have to figure out where the trash directory for a given volume/user/file etc is and move it myself. Is there an easy way to find that out? Thanks for any pointers Ruotger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/jabernathy%40burrislogi stics.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/mikey-san %40bungie.org This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Learning How to Program in Objective-C
On Fri, Jul 11, 2008 at 10:16 AM, Joe Kavanagh [EMAIL PROTECTED] wrote: grab the ADC doc The Objective-C 2.0 Programming Langauge and print a copy (I recommend getting it spiral bound). While learning it's a great reference to help refresh you when you get stuck. It may also confuse someone who's learning to program on 10.4 and Xcode 2.5. I would advise against using the web-based docs in such a situation - the ones that are included with Xcode are more directly relevant to the version he's using, and won't have any distractions that only apply to 10.5 Xcode 3. sherm-- -- Cocoa programming in Perl: http://camelbones.sourceforge.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
#define and #ifdef statements for different build configs
I have an app that uses different frameworks and method calls based upon the currently selected build configuration. How can I easily setup an #ifdef statement that will only execute if I've chosen the Release build configuraiton? Thanks in advance. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
starting external program at runtime
Hi All, I want to start an application (it's bundled with my main app) in a specific case. It was previously installed to a known location (it's a helper app, so I put it in ~/Library/Application Support -- was that the right thing to do?), so is there any class I can call upon, or is the best thing just a system() call? Daniel ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
RE: starting external program at runtime
NSWorkspace can launch applications for you. Check out http://theocacao.com/document.page/183 and http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/ Classes/NSWorkspace_Class/Reference/Reference.html. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] ] On Behalf Of Daniel Richman Sent: Friday, July 11, 2008 11:15 AM To: Cocoa-dev List Subject: starting external program at runtime Hi All, I want to start an application (it's bundled with my main app) in a specific case. It was previously installed to a known location (it's a helper app, so I put it in ~/Library/Application Support -- was that the right thing to do?), so is there any class I can call upon, or is the best thing just a system() call? Daniel ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/jabernathy%40burrislogi stics.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: starting external program at runtime
If your helper application is a console app, however, you should keep it with your main application bundle and use NSTask to run it and interact with it. (By console app I simply mean something that doesn't interact directly with the user). On Jul 11, 2008, at 11:19 , Abernathy, Joshua wrote: NSWorkspace can launch applications for you. Check out http://theocacao.com/document.page/183 and http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/ Classes/NSWorkspace_Class/Reference/Reference.html. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] ] On Behalf Of Daniel Richman Sent: Friday, July 11, 2008 11:15 AM To: Cocoa-dev List Subject: starting external program at runtime Hi All, I want to start an application (it's bundled with my main app) in a specific case. It was previously installed to a known location (it's a helper app, so I put it in ~/Library/Application Support -- was that the right thing to do?), so is there any class I can call upon, or is the best thing just a system() call? Daniel ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/jabernathy%40burrislogi stics.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/jason.coco %40gmail.com This email sent to [EMAIL PROTECTED] smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Is there any way to show disclosure button always closed
I am working on a project that needs the disclosure button of NSOutlineView always closed whether its row are expanded or not. Does anyone know that how to do that? Please tell me. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: #define and #ifdef statements for different build configs
On Fri, Jul 11, 2008 at 11:01 AM, Carter R. Harrison [EMAIL PROTECTED] wrote: I have an app that uses different frameworks and method calls based upon the currently selected build configuration. How can I easily setup an #ifdef statement that will only execute if I've chosen the Release build configuraiton? Get Info on your target, choose the Release configuration, and add a macro to the Preprocessor Macros setting. sherm-- -- Cocoa programming in Perl: http://camelbones.sourceforge.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
RE: #define and #ifdef statements for different build configs
What I've always done is to have that block in code like #ifdef RELEASE { ... code ... } #endif and then, in the build configuration of either the project or target, I select the Release configuration and add the pre processor macro RELEASE. I forget the setting name exactley, but it's along the lines of other preprocessor macros but it's pretty easy to find. There may well be a better way to do this, but this approach has worked fine so far. -Andy From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Carter R. Harrison [EMAIL PROTECTED] Sent: Friday, July 11, 2008 8:01 AM To: cocoa-dev list Subject: #define and #ifdef statements for different build configs I have an app that uses different frameworks and method calls based upon the currently selected build configuration. How can I easily setup an #ifdef statement that will only execute if I've chosen the Release build configuraiton? Thanks in advance. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/andy.klepack%40microsoft.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Trashing files and undo
Ruotger Skupin wrote: my app trashes files with -[NSWorkspace performFileOperation:source:destination:files:tag:] and NSWorkspaceRecycleOperation. This works flawlessly but users want undo. NSWorkspace does not seem to allow undoing said file operation (or any file operation for that matter). Correct me if I'm wrong. So I might have to figure out where the trash directory for a given volume/user/file etc is and move it myself. Is there an easy way to find that out? Drop-dead simple. FSFindFolder is your friend. Give it a volume reference number and tell it you're looking for the user's trash and it'll hand it back to you (creating it if necessary and you asked for that behavior). I think possibly a bigger issue here is going to be that moving files to the trash can cause them to be renamed. At least doing so in Finder can; I'm not sure if the NSWorkspace routine does the same. You'll need a reliable way to track the file and map that back to the original location and name. You'll want to look at aliases for that. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Trashing files and undo
On Jul 11, 2008, at 10:44 AM, Gregory Weston wrote: Drop-dead simple. FSFindFolder is your friend. Give it a volume reference number and tell it you're looking for the user's trash and it'll hand it back to you (creating it if necessary and you asked for that behavior). I think possibly a bigger issue here is going to be that moving files to the trash can cause them to be renamed. At least doing so in Finder can; I'm not sure if the NSWorkspace routine does the same. You'll need a reliable way to track the file and map that back to the original location and name. You'll want to look at aliases for that. You can just use an FSRef, which will track the file even after it's been moved. You have to use a little Carbon for this, but it's not bad. Just use either FSPathMakeRef() or CFURLGetFSRef() to make the FSRef before you move the file to the trash, and then use FSRefMakePath() or CFURLCreateFromFSRef() to get the new path to the file after you've trashed it. An added benefit to this is that even if Apple ends up moving ~/.Trash to some other location in a future version of OS X, this will still work (as long as FSRefs still work on whatever new file system we get moved to). Charles ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Trashing files and undo
On Jul 11, 2008, at 10:54 AM, Sean McBride wrote: Unless of course between trashing the file and trying to undo the trashing, a file of the same name as the trashed item is put in its old location. 1) that would cause the wrong alias resolution (since aliases resolve by path first) and 2) it would make restoring the trashed file tricky. I think it is very hard to get all the edge cases. Maybe if you script the finder to trash the file, then the finder's undo would be available. With aliases, there's a kResolveAliasTryFileIDFirst constant that will avoid this situation, although if you just use FSRefs, I don't think they keep track of the path at all, so that should always track the same file node no matter what. At any rate, if you do the resolution immediately after performing the trash operation, this should prevent this situation from happening in the first place. Charles ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
KVO notifications and threads
I have an application whose data model (classes, shared Instances, etc) gets updated by various threads for calculations, network comms, etc. Some of the application's Views use binding and KVO. For example an NSTextField may get bound to SharedInstance.currentLattitude It the property gets updated using KVO compliant code, on what thread is the NSTextField updated? Possible answers include: * thread that invokes the set method * MainThread - because all UI updates should happen there. Perhaps the KVO means that the View gets marked as needing an update in next update cycle, and thus we have a combination of these two answers: * invoking thread marks the View for update * MainThread does the update in its next graphics update cycle Jerry Isdale [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
CFBundleIdentifier Application Version
Reading things like, http://developer.apple.com/qa/qa2004/qa1373.html which discuss CFBundleIdentifier, the example always given for what it should look like is of the form: com.mycompany.MyApp My question is, as different versions, of the same application, are released, it is a good idea or recommended that the CFBundleIdentifier reflect the version of the application as well. For example, one might have: com.mycompany.MyApp2007 com.mycompany.MyApp2008 com.mycompany.MyApp2009 If it is not a good idea or not recommended, why? The tech note above does say: Note: Most Xcode templates give a generic default value for CFBundleIdentifier to try to avoid as many problems as possible. It is still important to set your own unique value, however, as applications with identical CFBundleIdentifier values will override each other. While it is obviously important that two different applications (say a word processor and a game) have unique identifiers, it isn't clear to me that different versions of the same application should have a unique identifier as there are other items in a plist for declaring the version of the application. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
RE: CFBundleIdentifier Application Version
It's really up to you and the kinds of changes that you expect to happen between each version. Having a single ID allows preferences to be mixed and matched if different versions of the product are used, but if you want to support the simultaneous use of last year's version and this year's version, or a pro and lite version, then that can get in the way. If you want to read last year's version's preferences and then copy those over into this year's version's preferences upon install/startup, then that could be a solution. If you want to, you can name this year's version's ID: com.mycompany.MyApp.2008 to distinguish it from last year's: com.mycompany.MyApp Reading things like, http://developer.apple.com/qa/qa2004/qa1373.html which discuss CFBundleIdentifier, the example always given for what it should look like is of the form: com.mycompany.MyApp My question is, as different versions, of the same application, are released, it is a good idea or recommended that the CFBundleIdentifier reflect the version of the application as well. For example, one might have: com.mycompany.MyApp2007 com.mycompany.MyApp2008 com.mycompany.MyApp2009 If it is not a good idea or not recommended, why? The tech note above does say: Note: Most Xcode templates give a generic default value for CFBundleIdentifier to try to avoid as many problems as possible. It is still important to set your own unique value, however, as applications with identical CFBundleIdentifier values will override each other. While it is obviously important that two different applications (say a word processor and a game) have unique identifiers, it isn't clear to me that different versions of the same application should have a unique identifier as there are other items in a plist for declaring the version of the application. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/garywade%40desisoftsystems.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: CFBundleIdentifier Application Version
On Jul 11, 2008, at 9:40 AM, Eric Gorr wrote: My question is, as different versions, of the same application, are released, it is a good idea or recommended that the CFBundleIdentifier reflect the version of the application as well. For example, one might have: com.mycompany.MyApp2007 com.mycompany.MyApp2008 com.mycompany.MyApp2009 If it is not a good idea or not recommended, why? In most cases I would expect that one would change the CFBundleVersion and other version-related items in the Info.plist rather than the bundle identifier. There might be cases in which one would want to change the bundle identifier, though--perhaps for a sweeping, clean- break change in the app. Remember that preferences and the like are keyed off of the bundle identifier, so changing it would give you some work to do in migrating older settings. Douglas Davidson ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Trashing files and undo
On Jul 11, 2008, at 11:49 AM, glenn andreas wrote: On Jul 11, 2008, at 10:44 AM, Gregory Weston wrote: Ruotger Skupin wrote: my app trashes files with -[NSWorkspace performFileOperation:source:destination:files:tag:] and NSWorkspaceRecycleOperation. This works flawlessly but users want undo. NSWorkspace does not seem to allow undoing said file operation (or any file operation for that matter). Correct me if I'm wrong. So I might have to figure out where the trash directory for a given volume/user/file etc is and move it myself. Is there an easy way to find that out? Drop-dead simple. FSFindFolder is your friend. Give it a volume reference number and tell it you're looking for the user's trash and it'll hand it back to you (creating it if necessary and you asked for that behavior). I think possibly a bigger issue here is going to be that moving files to the trash can cause them to be renamed. At least doing so in Finder can; I'm not sure if the NSWorkspace routine does the same. You'll need a reliable way to track the file and map that back to the original location and name. You'll want to look at aliases for that. If you use aliases (and due to the renaming issues, you really should), you won't need to worry about where the trash is located, since you'd just resolve where the file currently is (which just happens to be the correct trash folder for that volume/user). An excellent point. I think I had somehow got it in my head that the OP might want to handle the move *to* the trash as well, but I have no justification for that belief. Just the excuse that I'm operating on 2 hours' sleep for the 3rd day this week. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Mini Popup Window (Like iCal)
On 10 Jul 2008, at 19:33, Seth Willits wrote: Has anyone created a custom window like the event info editor in iCal in 10.5? There's a few things I'm not sure how to do: 1) Drawing the window background gradient is pretty straightforward, but creating the thin border on the window is not. I'm concerned about not being getting it thin enough. Any tips on that? 2) The zoom-in effect. I'm going to go out on a limb here and say that this is probably done using private methods. The only public way I can think of to do it would be to grab an image of my window using the CGWindow API while the window is still hidden, then scale that in an overlay window for the effect. I can come up with solutions for both of these, but I was hoping someone might have some better ideas or experience. I'm working on one at the moment. This may help you on your way http://developer.apple.com/samplecode/RoundTransparentWindow/index.html just draw whatever you want in -drawRect:, like a rounded rect or something. The arrow is harder. There's a window with an arrow on Matt Gemmell's site http://mattgemmell.com/ but that uses an NSColor with a pattern image to fill the window background and that seems mess up with core animation, which can't cache the drawn window prior to animation. HTH Jon smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: CFBundleIdentifier Application Version
On Fri, Jul 11, 2008 at 9:40 AM, Eric Gorr [EMAIL PROTECTED] wrote: Reading things like, http://developer.apple.com/qa/qa2004/qa1373.html which discuss CFBundleIdentifier, the example always given for what it should look like is of the form: com.mycompany.MyApp My question is, as different versions, of the same application, are released, it is a good idea or recommended that the CFBundleIdentifier reflect the version of the application as well. For example, one might have: com.mycompany.MyApp2007 com.mycompany.MyApp2008 com.mycompany.MyApp2009 If it is not a good idea or not recommended, why? That's not really a good idea. Many facilities identify applications by bundle ID. If your new app is truly an new version of the old app, then the bundle ID shouldn't change. Use the other Info.plist keys to identify the version of your application (such as CFBundleVersion). -- Clark S. Cox III [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSSpeechSynthesizer lifetime and garbage collected (GC) applications
On Fri, Jul 11, 2008 at 7:20 AM, Sean McBride [EMAIL PROTECTED] wrote: Hi all, The following works just fine in non-GC apps when called in an IBAction method: NSSpeechSynthesizer* speechSynthesizer = [[[NSSpeechSynthesizer alloc] init] autorelease]; [speechSynthesizer startSpeakingString: @Hello. I'm Macintosh. It sure is great to get out of that bag.]; In GC apps it crashes (non main thread): #0 0x907586e8 in objc_msgSend () #1 0x952f6f23 in SpeechDoneProc () #2 0x1f00d979 in MTBEDoneTask::Execute () #3 0x1f018b01 in MTBEWorker::WorkLoop () #4 0x1f018b5d in MTBEWorkerStartMPTask () #5 0x91ec555b in PrivateMPEntryPoint () #6 0x96fa76f5 in _pthread_start () #7 0x96fa75b2 in thread_start () I'm guessing this is because the speechSynthesizer is collected before it finishes speaking. Is this 'correct behaviour' or a bug? Needless to say, the docs say nothing about special considerations for garbage collection. My speechSynthesizer has no delegate, and I don't care when it starts or stops speaking. Shouldn't that make it NSSpeechSynthesizer's job to keep itself alive until it finishes speaking? Afterall, _I'm_ finished with the speechSynthesizer. If I were you, I'd file a Bug. -- Clark S. Cox III [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Quick look preview multipage rich text
That's right, I realized after posting the message that I should have boiled it down to the following: + (NSPrintOperation *)PDFOperationWithView:insideRect:toData:printInfo: This operation produces a single page of PDF no matter what print settings I pass in, one very long page. + (NSPrintOperation *)printOperationWithView:printInfo:aPrintInfo This operation when set to write the data to disk correctly produces a paginated document. It's like the NSPrintOperation methods do not allow you to create a multi-page PDF in memory. You have to write it to disk first. I did take a look at the output in both operations, and that's exactly what happens. The fist op gives you one long page of pdf, which is unreadable when scaled to fit inside the quicklook preview. The second op gives you what you expect. I suppose I could use the second operation and then read back in the correctly paginated pdf, but then I'm writing out to the hard disk any time the user wants to quicklook my document. This seems like a terrible waste of resources. -- In response to Jean-Daniel's suggestion. I can convert the RTFD to HTML, but then I need to go in and account for all of the rich text attachments, which doesn't sound like a simple task. I'd love to just create multi-page pdf data in memory and send that to quicklook. ~Phil On Jul 9, 2008, at 2:54 PM, Julien Jalon wrote: If I understand correctly your point, it seems that in the first case, you use the direct to data print operation and in the second case, you use the direct to file print operation then read back the file in memory and send it to Quick Look. Both methods use QLPreviewRequestSetDataRepresentation(). Am I right? What do you mean when you say does not display the content as multipage. What does it display? You should try to dump on disk the data produced in the first case and take a look at it. -- Julien On Wed, Jul 9, 2008 at 4:40 AM, Philip Dow [EMAIL PROTECTED] wrote: Hi all, I am trying to generate multipage pdf data for display in a quick look preview from rich text attributed string data. Attributed strings don't know anything about pages, so it seems to me that I'll have to go through the OS printing architecture to generate the multipage pdf content. Frustrating thing is, this works if I write the data to a file but not if I send it to quicklook. I can generate the pdf data with a custom print info specifying the page attributes, but quicklook does not display the content as multipage. If I use the same settings but a different print operation, writing the data to a temporary file instead, I get a correctly paginated document. Code follows. I understand that PDF content can be created with CGPDFContextCreate and the associated begin and end page calls, but the attributed string doesn't know about pages, so that seems like a dead end to me. If there's a method for doing it that way, I'm all for switching. You might also suggest just sending RTF to Quick Look, but I'd like the text attachments to display. Converting it to html seems like even more work. === GenerateMultiPagePDFPreviewForURL(...) NSAttributedString *attrString = ...; NSTextView *textView = ... (filled with attrString); NSMutableData *pdfData = [NSMutableData data]; NSPrintInfo *printInfo = [NSPrintInfo sharedPrintInfo]; [printInfo setPaperSize:NSMakeSize(612,792)]; [printInfo setHorizontalPagination: NSFitPagination]; [printInfo setVerticalPagination: NSAutoPagination]; [printInfo setVerticallyCentered:NO]; NSPrintOperation *po = [NSPrintOperation PDFOperationWithView:textView insideRect:[textView bounds] toData:pdfData printInfo:printInfo]; [po runOperation]; QLPreviewRequestSetDataRepresentation(preview, (CFDataRef)pdfData, kUTTypePDF, NULL); === Quicklook does not present a multipage preview with that code. But the following code writes a multipage document... === NSAttributedString *attrString = ...; NSTextView *textView = ... (filled with attrString); NSPrintInfo *printInfo = [NSPrintInfo sharedPrintInfo]; NSMutableDictionary *printInfoDict = [NSMutableDictionary dictionaryWithDictionary:[printInfo dictionary]]; [printInfoDict setObject:NSPrintSaveJob forKey:NSPrintJobDisposition]; [printInfoDict setObject:@someLocation.pdf forKey:NSPrintSavePath]; printInfo = [[NSPrintInfo alloc] initWithDictionary: printInfoDict]; [printInfo setHorizontalPagination: NSFitPagination]; [printInfo setVerticalPagination: NSAutoPagination]; [printInfo setVerticallyCentered:NO]; po = [NSPrintOperation printOperationWithView:textView printInfo:printInfo]; [po setShowPanels:NO]; [po runOperation]; === In the first case I'm using [NSPrintOperation PDFOperationWithView:insideRect:toData:printInfo:] and in the second [NSPrintOperation printOperationWithView: printInfo:]. Is the PDFOperationWithView method not capable of producing multipage pdf data despite the
Re: Learning How to Program in Objective-C
It has been my experience that it's much easier to learn programming in a procedure language than an OO-language. I don't think this will ever really change, since OO is an abstraction built on top of a procedural foundation, which is closer to how a CPU actually executes a software program. So if you really have zero programming experience, I suggest you start with a language like Python. You can learn the basics about programming, and that language will even introduce you to OO concepts. But it's much simpler than starting with C or Objective-C. I wish they still used Pascal in Universities for teaching programming. It's a great first language. But anyway, Mac OS ships with support for Python so you have everything you need to get started. Type python in a terminal window, then type 2 + 2 when you see the prompt. Congratulations, you've written your first program! (Ok, technically you've written an expression, but for these purposes it's a python program.) More info: http://docs.python.org/tut/ Python is not only a great first language, it's a great scripting language all on it own, so even if you later become a hard-core OO/ Objective-C programmer, you still might find uses for it. And finally, there's a Cocoa-Python bridge, which means after you become more proficient with Python, you'll be able to use it to write Cocoa- apps. When you start doing that, you're probably ready to learn Objective-C. Rob Ross, Lead Software Engineer E! Networks --- Beware of he who would deny you access to information, for in his heart he dreams himself your master. -- Commissioner Pravin Lal On Jul 11, 2008, at 6:30 AM, [EMAIL PROTECTED] wrote: Hello forum, This is my very first post and will get right to the point. First, I have no programming experience at all. I want to learn how to program using Xcode. I'd like to do it at home self paced and I also understand that this is going to be a very long journey and I'm ready for it. So, I ask you for suggestion/inputs and please don't hold back. If it's not possible I'll understand. If it is possible, since I'm on 10.4.11, would the latest version of Xcode be 2.5to download? And does it include everything I need? Thank you all for reading very much appreciated ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/rob.ross%40gmail.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: garbage collection and NSConnection
On Jul 11, 2008, at 8:59 , Michael Ash wrote: The cost of a single refcounting op is negligible compared to the cost of object allocation, so these two are quite irrelevant. A quick test of this claim would appear to disprove it. On my Mac Pro, an alloc/init/release cycle of NSObject costs about 290ns. Adding an extra pair of retain/release costs about 480ns. I'm not sure how I can reasonably measure the object allocation by itself, or the cost of just retain or just release. But it seems clear that these refcounting operations are quite significant in cost. This is the extra refcount table in action, and why inline reference counts can be such a performance win on objects that are frequently retained and released. Changing the object to an NSString (which has an internal reference count) yields the following results on my MacBook Pro: retain+release NSString: time per iteration: 67 nanoseconds Compare this with the times for NSObject, both retain/release and allocation / deallocation: retain+release NSObject 2-3 / 3-2 : time per iteration: 223 nanoseconds retain+release NSObject 1-2 / 2-1 : time per iteration: 276 nanoseconds alloc+dealloc NSObject: time per iteration: 415 nanoseconds Cheers, Marcel [EOT for me] [Differences of opinion and experience snipped] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: KVO notifications and threads
On Jul 11, 2008, at 11:30 AM, Jerry Isdale wrote: I have an application whose data model (classes, shared Instances, etc) gets updated by various threads for calculations, network comms, etc. Some of the application's Views use binding and KVO. For example an NSTextField may get bound to SharedInstance.currentLattitude It the property gets updated using KVO compliant code, on what thread is the NSTextField updated? Possible answers include: * thread that invokes the set method * MainThread - because all UI updates should happen there. Perhaps the KVO means that the View gets marked as needing an update in next update cycle, and thus we have a combination of these two answers: * invoking thread marks the View for update * MainThread does the update in its next graphics update cycle The answer is: you're playing with fire and will be burned. Bindings to the GUI don't play well with threading. All KVO notifications are delivered on the thread where the property is changed (thread that invokes the set method). The controllers and views which are typically on the receiving end of those notifications are not thread-safe. That is, if the main thread is working with the state of those objects and a background thread is manipulating that state in response to a KVO notification, the two won't play nicely together -- there's no attempt to synchronize. You need the facade of your model to appear to be single threaded. If there's work going on in background threads, those threads should not directly manipulate state which can be queried from GUI bindings. Instead, you can use performSelectorOnMainThread:... when a background thread has a transaction ready to commit to pass that transaction to the main thread for committing. Cheers, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: CFBundleIdentifier Application Version
On Jul 11, 2008, at 1:01 PM, Douglas Davidson wrote: Remember that preferences and the like are keyed off of the bundle identifier, so changing it would give you some work to do in migrating older settings. I am focused on your phrase 'and the like'. Other then preferences, what else is keyed off of the bundle identifier? So, just to be clear, would you generally consider it to be the case that a unique bundle identifier is intended to identify a unique application and not different versions of the same application? If this is true, then I could see how some feature of the OS (either now or in the future) would depend upon this being true - that a bundle identifier identifies a unique application. Is this a valid concern? Thank you. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Trashing files and undo
On Jul 11, 2008, at 11:11 AM, Charles Srstka wrote: At any rate, if you do the resolution immediately after performing the trash operation, this should prevent this situation from happening in the first place. I don't know if this ever happens in practice, but in theory performFileOperation:source:destination:files:tag: can do its work asynchronously. You have to be sure it's complete before you attempt to resolve the file's new location. Cheers, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Completely cleaning the Launch Services Database handler's
So, occasionally, I need to clean out my Launch Services Database. Most of the work can be done by executing: lsregister -kill -r -domain local -domain system -domain user However, this leaves behind information such as: handler id:3160 extension: dtd options: all roles: com.barebones.bbedit (0xee80) (i.e. I wand to load files with the .dtd extension with bbedit) As reported by lsregister -dump. Assuming they can, how can these custom handler's be cleaned out as well? Thank you. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: KVO notifications and threads
On Fri, Jul 11, 2008 at 9:30 AM, Jerry Isdale [EMAIL PROTECTED] wrote: I have an application whose data model (classes, shared Instances, etc) gets updated by various threads for calculations, network comms, etc. Some of the application's Views use binding and KVO. For example an NSTextField may get bound to SharedInstance.currentLattitude It the property gets updated using KVO compliant code, on what thread is the NSTextField updated? On the same thread as the property was set (i.e. probably not what you want, as most views and controllers need to do their work on the main thread). Possible answers include: * thread that invokes the set method This. * MainThread - because all UI updates should happen there. Not This :) Essentially, you will have to make sure that all properties that are being observed by views and their controllers happen on the main thread. A category such as the following has helped me in the past in such situations (warning, typed up from memory in my mail window): @implementation NSObject(CSCAdditions) - (void)CSCSetValueForKeyImpl:(NSDictionary*)dict { [self setValue: [dict objectForKey: @value] forKeyPath: [dict objectForKey: @key]]; } - (void)CSCSetValueForKeyPathImpl:(NSDictionary*)dict { [self setValue: [dict objectForKey: @value] forKeyPath: [dict objectForKey: @keyPath]]; } - (void)setValuesOnMainThreadForKeysWithDictionary:(NSDictionary *)dict waitUntilDone:(BOOL)wait { [self performSelectorOnMainThread: @selector(setValuesForKeysWithDictionary:) withObject: dict waitUntilDone: wait] } - (void)setValueOnMainThread:(id)value forKey:(NSString *)key waitUntilDone:(BOOL)wait { NSParameterAssert(key != nil); [self performSelectorOnMainThread: @selector(CSCSetValueForKeyImpl:) withObject: [NSDictionary dictionaryWithObjectsAndKeys: keyPath, @key, value, @value, nil] waitUntilDone: wait]; } - (void)setValueOnMainThread:(id)value forKeyPath:(NSString *)keyPath waitUntilDone:(BOOL)wait { NSParameterAssert(keyPath != nil); [self performSelectorOnMainThread: @selector(CSCSetValueForKeyPathImpl:) withObject: [NSDictionary dictionaryWithObjectsAndKeys: keyPath, @keyPath, value, @value, nil] waitUntilDone: wait]; } @end Then, you just have to make sure that any modifications to properties that happen on a background thread go through one of these three -set...onMainThread:... methods. -- Clark S. Cox III [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: CFBundleIdentifier Application Version
On Jul 11, 2008, at 11:54 AM, Eric Gorr wrote: Other then preferences, what else is keyed off of the bundle identifier? So, just to be clear, would you generally consider it to be the case that a unique bundle identifier is intended to identify a unique application and not different versions of the same application? Generally, that is the case. For example, Launch Services has mechanisms to locate an app by bundle identifier, and I believe AppleScript now has a way to address an app by bundle identifier; in such cases, the bundle identifier is regarded as more stable than the application name, and in general the preferred way to locate a particular application. Douglas Davidson ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
looking for some help
Hi everybody I'm very new to programming the mac looking for some help also #1 I want to make the about my app window larger I cant seem to figure out where to do this #2 if i wanted a document with a image in the center basically a text document where the text would flow over an image. Would I have to do a subclass of textView ? Thanks G- -- Gary Robertson -- ACTC [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: KVO notifications and threads
So having mutiple CPUs and cores doesnt buy us much more than bragging rights, at least as far as KVO and UI goes. oh well. I like Clark Cox's suggestion for wrapping the set methods in a category that forces the actual set to occur on the MainThread note to Apple developers observing: it would be really nice to make the MVC and KVO play nicely with threads. On Jul 11, 2008, at 11:50 AM, Ken Thomases wrote: On Jul 11, 2008, at 11:30 AM, Jerry Isdale wrote: I have an application whose data model (classes, shared Instances, etc) gets updated by various threads for calculations, network comms, etc. Some of the application's Views use binding and KVO. For example an NSTextField may get bound to SharedInstance.currentLattitude It the property gets updated using KVO compliant code, on what thread is the NSTextField updated? Possible answers include: * thread that invokes the set method * MainThread - because all UI updates should happen there. Perhaps the KVO means that the View gets marked as needing an update in next update cycle, and thus we have a combination of these two answers: * invoking thread marks the View for update * MainThread does the update in its next graphics update cycle The answer is: you're playing with fire and will be burned. Bindings to the GUI don't play well with threading. All KVO notifications are delivered on the thread where the property is changed (thread that invokes the set method). The controllers and views which are typically on the receiving end of those notifications are not thread-safe. That is, if the main thread is working with the state of those objects and a background thread is manipulating that state in response to a KVO notification, the two won't play nicely together -- there's no attempt to synchronize. You need the facade of your model to appear to be single threaded. If there's work going on in background threads, those threads should not directly manipulate state which can be queried from GUI bindings. Instead, you can use performSelectorOnMainThread:... when a background thread has a transaction ready to commit to pass that transaction to the main thread for committing. Cheers, Ken Jerry Isdale [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: CFBundleIdentifier Application Version
On Jul 11, 2008, at 12:58 PM, Gary L. Wade wrote: It's really up to you and the kinds of changes that you expect to happen between each version. Having a single ID allows preferences to be mixed and matched if different versions of the product are used, but if you want to support the simultaneous use of last year's version and this year's version, or a pro and lite version, then that can get in the way. Assuming the CFPreferences API is being used, one can pass in a custom application id as a CFString. So, it would seem that if the behavior one wanted was to have a different preference file for a different version of an application, passing in an application id with version information appended to it would be the way to go - as opposed to declaring a unique custom identifier and using the kCFPreferencesCurrentApplication constant with the CFPreferences API. Of course, using a custom application id would likely have the side effect that the OS would not be able to directly connect the preference file to the application (assuming the OS does or would ever make the attempt), but the code should work properly. But, perhaps this would work correctly if the bundle identifier was com.mycompany.myapp and the custom application id passed into CFPreferences functions was: com.mycompany.myapp.2009 ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Problem with undo in a secondary nib file
Hello list, I have an application with two nib files. I have one text view each in both the nibs. The problem is, I can undo the text view in the Mainmenu.nib but can't undo in the text view in the second nib. What I'm missing here? Any help would be greatly appreciated. Thanks in advance, Vish... ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: KVO notifications and threads
On Jul 11, 2008, at 12:22 PM, Jerry Isdale wrote: So having mutiple CPUs and cores doesnt buy us much more than bragging rights, at least as far as KVO and UI goes. oh well. I like Clark Cox's suggestion for wrapping the set methods in a category that forces the actual set to occur on the MainThread note to Apple developers observing: it would be really nice to make the MVC and KVO play nicely with threads. MVC and KVO play perfectly nicely with threads, when you follow the rules. ;) You really wouldn't want your model layer generically and arbitrarily spamming the main even loop with change notifications anyway. Nor do you really want a fully threadsafe AppKit where any method can be invoked anywhere from anytime. Sounds grand, but down that path lies the madness of unpredictability unresponsive applications and performance nightmares that are fantastically difficult to unravel. Unfortunately, threading within an application is inherently tied to the business model -- the user experience -- of your application and, thus, threading your various operations and getting said changes over to the MEL are tasks that need to be designed for within your application. Certainly, Cocoa can be made to better support multicore development. And effort has been and will continue to be expended upon on that front with each release of Mac OS X. If you have specific enhancement requests, please file a bug via http://bugreporter.apple.com. If your request is make MVC and KVO play nicely with threads, you will need to provide details on exactly what you mean -- exactly how that is to be achieved. b.bum smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: garbage collection and NSConnection
On Fri, Jul 11, 2008 at 2:17 PM, Marcel Weiher [EMAIL PROTECTED] wrote: On Jul 11, 2008, at 8:59 , Michael Ash wrote: The cost of a single refcounting op is negligible compared to the cost of object allocation, so these two are quite irrelevant. A quick test of this claim would appear to disprove it. On my Mac Pro, an alloc/init/release cycle of NSObject costs about 290ns. Adding an extra pair of retain/release costs about 480ns. I'm not sure how I can reasonably measure the object allocation by itself, or the cost of just retain or just release. But it seems clear that these refcounting operations are quite significant in cost. This is the extra refcount table in action, and why inline reference counts can be such a performance win on objects that are frequently retained and released. Changing the object to an NSString (which has an internal reference count) yields the following results on my MacBook Pro: retain+release NSString: time per iteration: 67 nanoseconds Compare this with the times for NSObject, both retain/release and allocation / deallocation: retain+release NSObject 2-3 / 3-2 : time per iteration: 223 nanoseconds retain+release NSObject 1-2 / 2-1 : time per iteration: 276 nanoseconds alloc+dealloc NSObject: time per iteration: 415 nanoseconds Seems that NSString and NSMutableString are just faster at everything. In all cases, the cost of an extra retain/release for them is still roughly 50% of the cost of an alloc/init/retain. Here are my raw numbers, times in nanoseconds: NSObject alloc/init/release 284.3 NSObject alloc/init/retain/release/release 495.7 Extra time taken: 74% NSString alloc/init/release 40.2 NSString alloc/init/retain/release/release 73.4 Extra time taken: 45% NSMutableString alloc/init/release 194.7 NSMutableString alloc/init/retain/release/release 300.7 Extra time taken: 54% I have no explanation as to why NSMutableString is so much slower at everything. They both end up creating an instance of NSCFString, so this is puzzling. But there you are. Mike ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: looking for some help
#1 I want to make the about my app window larger I cant seem to figure out where to do this The about panel is a standard panel that can't be edited. There's an old archived tutorial at cocoadevcentral.com that shows how to create your own About panel (the scrolling panel, I believe) but it was written for the old Project Builder (pre-Xcode era). The approach is generally the same though. #2 if i wanted a document with a image in the center basically a text document where the text would flow over an image. Would I have to do a subclass of textView ? You'll want to read up on the Cocoa text system: http://developer.apple.com/documentation/Cocoa/Conceptual/TextArchitecture/TextArchitecture.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 [EMAIL PROTECTED]
Re: Why can't I name a property `tag'?
It is just simple as you said. And it is cool just after I know what's on earthing happening there. Thanks a lot. On Fri, Jul 11, 2008 at 2:03 AM, Bill Bumgarner [EMAIL PROTECTED] wrote: On Jul 10, 2008, at 8:55 AM, an0 wrote: Sure. I'm grateful that you tell me the internal truth instead of confusing me even more by just saying it is my responsibility to tell compiler more. But if different return types cause different native code, how could my program still work with the mistaken type(an NSString * returned from the inner message is treated as an NSInteger at the first place, then is passed as an NSString * to the outer message) guessed by compiler? Whichever method the compiler sees first wins. While Objective-C is polymorphic, it does not support type based dispatch or type based method differentiation (like, say, Java). In Objective-C, the following doesn't make sense: - (NSInteger) tag; - (NSString *) tag; It won't compile if in the same class file and, as you have discovered, it'll cause no end of problems when the same method name -- the same selector -- has different argumentation across different classes in the class hierarchy. To put it more precisely: Objective-C has a single, global, namespace for all methods. Every method's name, every selector, is in a shared namespace. The method's selector does not include any typing information and, thus, the type of the arguments and return value of the method are not used by the compiler to disambiguate invocations. As a result, the standard pattern is to *never* declare the same method name twice, but with different types of arguments or return values. For someone coming from C++ or Java, this may seem like a pretty nasty restriction. It really isn't. It is just different. And it has some very distinct advantages. Two, in fact: - there is no name mangling - you don't have to figure out the types of the arguments to figure out which of N possible methods on your class, all named identically save for argumentation differences, were invoked I.e. it is dead simple. b.bum ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Quick look preview multipage rich text
On Fri, Jul 11, 2008 at 8:00 PM, Philip Dow [EMAIL PROTECTED] wrote: That's right, I realized after posting the message that I should have boiled it down to the following: + (NSPrintOperation *)PDFOperationWithView:insideRect:toData:printInfo: This operation produces a single page of PDF no matter what print settings I pass in, one very long page. + (NSPrintOperation *)printOperationWithView:printInfo:aPrintInfo This operation when set to write the data to disk correctly produces a paginated document. It's like the NSPrintOperation methods do not allow you to create a multi-page PDF in memory. You have to write it to disk first. I did take a look at the output in both operations, and that's exactly what happens. The fist op gives you one long page of pdf, which is unreadable when scaled to fit inside the quicklook preview. The second op gives you what you expect. I suppose I could use the second operation and then read back in the correctly paginated pdf, but then I'm writing out to the hard disk any time the user wants to quicklook my document. This seems like a terrible waste of resources. Please, don't do that as your plug-in really should avoid doing anything but reading stuff on disk. Maybe someone from the AppKit team will be able to find the source of your problem. -- Julien ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: delegation strategy
Hi Michael, Thanks for the suggestion. I think you're right. I'll give it a shot. best, wes On Thu, Jul 10, 2008 at 11:32 PM, Michael Ash [EMAIL PROTECTED] wrote: On Wed, Jul 9, 2008 at 11:19 AM, Wesley Smith [EMAIL PROTECTED] wrote: Hi list, I'm trying to provide a particular windowing interface that combines NSWindow and NSPanel. For the most part I'm using a custom subclass of NSWindow that adds a decent amount of functionality. Occasionally, I want to make use of NSPanel (for the NSUtilityWindowMask style flag) and I'd like it to behave exactly as my custom NSWindow subclass does. I'm sure there's a way to make this work via some form of delegation/message passing so that I don't have to duplicate code and can just have messages passed from the NSWindow and NSPanel objects to my custom methods, but I'm not really sure how that kind of design pattern plays out in Cocoa. Any ideas? suggestions? Are you sure you really need an NSWindow subclass? It's pretty unusual, and when it is needed it's often for minor things like getting nib-archived windows to use a style mask that IB doesn't let you choose. If you can move your behaviors into a controller class, then it will be easy to make that controller class work with either an NSWindow or an NSPanel. Whether this is possible or easy will depend on exactly what you're doing, of course, but generally that's where this kind of thing belongs anyway. Mike ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/wesley.hoke%40gmail.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
any other type of value for the fromValue property of CAAnimation?
Hi everyone.After explore the Core Animation for a while, I found that the fromValue property of CAAnimation was only set to NSNumber in many samples and tutorials, although the Apple's document says it accepts the id value. I am wondering whether I could set this property to NSColor or CGColor inorder to change the layer color dynamically. For example, If I want to change a Green layer to a red one from time to time, could anyone give me a guidance? Thank you very much for any help. -- Best regards. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Creating MetaPackages using PackageMaker 3 on 10.5
I would like to make a meta package containing a standard pkg file, some configuration files which go into the users home directory as well as the system folder. When I drag the pkg into Package Maker and install it, I end up getting a Content folder in the root of my system drive. It seems to expand the compressed pkg file and place it's content there. I also would like to specify the current users home directory. I have seen the option to choose Users home directory however this seems to apply to the all sub packages included. I only want to specify one part of the install to go to the current users home folder. I also would like to grant the installing user permission on those files. Which user should I select in the Content tab. thanks in advance for any feedback on this issue. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Completely cleaning the Launch Services Database handler's
Eric, This is not really a Cocoa question, but... I've had success in the past by moving the /Library/Caches/ com.apple.LaunchServices csstore files to the trash and rebooting. -Jeff On Jul 11, 2008, at 2:13 PM, Eric Gorr wrote: So, occasionally, I need to clean out my Launch Services Database. Most of the work can be done by executing: lsregister -kill -r -domain local -domain system -domain user However, this leaves behind information such as: handler id:3160 extension: dtd options: all roles: com.barebones.bbedit (0xee80) (i.e. I wand to load files with the .dtd extension with bbedit) As reported by lsregister -dump. Assuming they can, how can these custom handler's be cleaned out as well? Thank you. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: looking for some help
Gary Robertson wrote: I'm very new to programming the mac looking for some help also #1 I want to make the about my app window larger I cant seem to figure out where to do this I'm fairly new myself, and can't really help you with #2, though I.S. gave you a good pointer in another message. On #1, you can also make your own panel in Interface Builder and make it whatever size you want, put whatever text you want in it, and then wire the About MyApp... menu item to a routine to open that panel. I usually do the above by making a nib in my project just for the about panel and sometimes add a window controller subclass called AboutController to handle event. (The latter is often unnecessary, but depends upon how complicated your about panel is.) HtH, Jason ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Storing structured data in file - any easy way?
Hi Jens, On 10/07/2008, at 22.50, Jens Alfke wrote: On 10 Jul '08, at 11:29 AM, Jules Colding wrote: Assume that I want to store the set {HI, HELLO}. At one point I want to be able to use HI as key and get HELLO. At another point I want to use HELLO as key and get HI. There are several trivial ways to do this. I could use two NSDictionary's and use the NSCopying protocol to store both. Unfortunately that will make at least one, possibly both, dictionaries present in memory at query time. You mean NSCoding, not NSCopying, right? oops, yes. The overhead for two dictionaries as opposed to one shouldn't be too high. Hash-table overhead is something like 4*sizeof(void*) bytes times the number of keys. It's the strings themselves that will take up most of the memory, and those are shared between dictionaries. On the other hand, if the overhead of even one copy of the data in memory is too high, archiving isn't the way to go. The best solution seems to be some kind of lightweight database... Is there any cocoa framework that implements a simple database or should I manually seek through a file? The typical solution for this is SQLite, Exactly what I've decided. Thanks, jules ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Search NSString for a word and get a boolean value
Hello! I am an absolute newbie to Cocoa and I am trying to teach myself a little bit. I already have had a whole bunch of problems with my little applications I write, but have been able to solve them using the documentation or the Cocoa Builder Archive. But now I have a problem I am not able to solve: I have a string and I want to search it for the word *** FLOP *** and get a simple boolean value to know if the string contains this word. I have tried with the NSScanner class` methods, but i am not even sure if they are made for that purposes. Is there a simple method to do the job? Are the NSScanner methods the right way and I am just handling them wrong? If you think this question is too stupid and i should solve it on my own please just ignore it ;-) Greetings, Moritz. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Search NSString for a word and get a boolean value
You want the -rangeOfString: family of methods. On 11 Jul 2008, at 22:12, Moritz Siller wrote: Hello! I am an absolute newbie to Cocoa and I am trying to teach myself a little bit. I already have had a whole bunch of problems with my little applications I write, but have been able to solve them using the documentation or the Cocoa Builder Archive. But now I have a problem I am not able to solve: I have a string and I want to search it for the word *** FLOP *** and get a simple boolean value to know if the string contains this word. I have tried with the NSScanner class` methods, but i am not even sure if they are made for that purposes. Is there a simple method to do the job? Are the NSScanner methods the right way and I am just handling them wrong? If you think this question is too stupid and i should solve it on my own please just ignore it ;-) Greetings, Moritz. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: any other type of value for the fromValue property of CAAnimation?
On Jul 11, 2008, at 5:38 AM, Cloud Strife wrote: I am wondering whether I could set this property to NSColor or CGColor inorder to change the layer color dynamically. For example, If I want to change a Green layer to a red one from time to time, could anyone give me a guidance? CGColorRefs are Core Foundatation data types, and therefore analogous to NSObject decedents, thus you can typecast a CGColorRef to an id and assign it as a fromValue or toValue of a CAAnimation without needing to do any kind of conversion. Note however that NSColor and CGColorRef are NOT toll-free bridged, therefore it is an error to assign an NSColor where a CGColorRef is expected (or vise versa). -- David Duncan Apple DTS Animation and Printing [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: KVO notifications and threads
At 1:10 PM -0700 7/11/08, [EMAIL PROTECTED] wrote: So having mutiple CPUs and cores doesnt buy us much more than bragging rights, at least as far as KVO and UI goes. oh well. I like Clark Cox's suggestion for wrapping the set methods in a category that forces the actual set to occur on the MainThread note to Apple developers observing: it would be really nice to make the MVC and KVO play nicely with threads. KVO + Threads = Fail. Instead, try enqueuing and coalescing the KVO notifications, and then later pass off a group of them to the main thread's run loop (or similar pull mechanism). If you don't understand how the proper granularity of tasks and overall division of labor is crucial to scalability, you're not going to get anything out of your multiple cores anyway. Many operations are not worth the overhead of scheduling on another processor. Extremely fine grained operations induce a vast amount of communication and coordination overhead, while at the same time create some bizarre and non-intuitive semantic results. Very few objects are in a coherent state if individual properties are asynchronously changed, even if the individual changes are atomic. (1) EOF post discussing cache coherency and transactional integrity problems with fine grained locking: http://lists.apple.com/archives/webobjects-dev/2004/Dec/msg00255.html (2) Performance problems with fine grained locking KVO http://lists.apple.com/archives/cocoa-dev/2007/Mar/msg00739.html Some books and articles worth your time: (3) Java Concurrency in Practice The first really good book about multi-threading *engineering* instead of theory or APIs http://www.amazon.com/Java-Concurrency-Practice-Brian-Goetz/dp/0321349601/ref=pd_bbs_sr_1?ie=UTF8s=booksqid=1206565296sr=8-1 (4) Intel Threading Building Blocks. Another book about actually getting things done right by people who consider the granularity of tasks a serious design consideration. http://www.amazon.com/Intel-Threading-Building-Blocks-Parallelism/dp/0596514808/ref=sr_1_1?ie=UTF8s=booksqid=1215811648sr=1-1 (5) Pattern Language for Parallel Programming Basically, the Gang of 4 design patterns book, done for parallel programming. Not quite as good as Design Patterns, but then, what is ? http://www.amazon.com/Patterns-Parallel-Programming-Software/dp/0321228111/ref=pd_bbs_sr_1?ie=UTF8s=booksqid=1206565387sr=1-1 (6) a great article by Edward Lee from UC Berkeley. The canonical why threads suck and what we could do about it article. http://www.computer.org/portal/site/computer/menuitem.5d61c1d591162e4b0ef1bd108bcd45f3/index.jsp?path=computer/homepage/0506file=cover.xmlxsl=article.xsl (7) Article on serious performance optimizations for multicore machines. It discusses several practical techniques like lock striping that ObjC and CF now use: http://developers.sun.com/learning/javaoneonline/2006/coolstuff/TS-5354.pdf For experienced programmers looking to go further, an excellent grad level book: (8) The Art of Multiprocessor Programming http://www.amazon.com/Art-Multiprocessor-Programming-Maurice-Herlihy/dp/0123705916/ref=pd_sim_b_1 -- -Ben ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSSpeechSynthesizer lifetime and garbage collected (GC) applications
On 7/11/08 10:36 AM, Clark Cox said: I'm guessing this is because the speechSynthesizer is collected before it finishes speaking. Is this 'correct behaviour' or a bug? Needless to say, the docs say nothing about special considerations for garbage collection. My speechSynthesizer has no delegate, and I don't care when it starts or stops speaking. Shouldn't that make it NSSpeechSynthesizer's job to keep itself alive until it finishes speaking? Afterall, _I'm_ finished with the speechSynthesizer. If I were you, I'd file a Bug. Meaning you agree with me that it shouldn't be my job to keep a strong reference until its finished speaking? Cheers, -- Sean McBride, B. Eng [EMAIL PROTECTED] Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
XCode 3.1 quits each time after launch
Hi, each time I launch the current XCode 3.1 release, it quits either a second later or when I click in the welcome screen. Console reports only this 12.07.08 00:22:57 Xcode[1744] Xcode(1744,0xa082dfa0) malloc: *** error for object 0xa650a5c: pointer being freed was not allocated 12.07.08 00:22:57 [0x0-0x95095].Xcode[1744] Xcode(1744,0xa082dfa0) malloc: *** error for object 0xa650a5c: pointer being freed was not allocated Since I have 10.5.4 current and I did a full uninstall/reinstall cycle for XCode, I wonder, what to do. Any hints, how to track down the problem an make XCode work again? Kind regards, Stefan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
PDFDocument Subclass and Undo Manager Redux
Hello cocoa-devs! I'm not sure if I'm heading in the right direction here or if I'm running off into the brush... I have a PDFDocument subclass that has it's own undoManager. This is so it can perform transformations upon itself and undo/redo. The trouble is when I try to integrate it into my NSDocument class. I'll try to return the PDF's undoManager like so: - (NSUndoManager *)windowWillReturnUndoManager:(NSWindow *)window; { return [(KRPDFDocument *)[pdfView document] undoManager]; } While this returns an NSUndoManager which != NULL, it doesn't actually hook into the responder chain so when I make a change it doesn't register in the menu. Is this because PDFDocument does not inherit from NSResponder? Is the proper way to have the undoManager *in* the PDFDocument sublcass? Or is it better to use the undoManager provided by NSDocument? It seems like I'm missing something that's right in front of my nose, but if anyone has some insight out there, please let me know! Thanks! - Kevin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSSpeechSynthesizer lifetime and garbage collected (GC) applications
On Fri, Jul 11, 2008 at 3:08 PM, Sean McBride [EMAIL PROTECTED] wrote: On 7/11/08 10:36 AM, Clark Cox said: I'm guessing this is because the speechSynthesizer is collected before it finishes speaking. Is this 'correct behaviour' or a bug? Needless to say, the docs say nothing about special considerations for garbage collection. My speechSynthesizer has no delegate, and I don't care when it starts or stops speaking. Shouldn't that make it NSSpeechSynthesizer's job to keep itself alive until it finishes speaking? Afterall, _I'm_ finished with the speechSynthesizer. If I were you, I'd file a Bug. Meaning you agree with me that it shouldn't be my job to keep a strong reference until its finished speaking? Yes, I agree with you. (I'm, of course, just speaking for myself, not Apple) -- Clark S. Cox III [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: XCode 3.1 quits each time after launch
I have seen this twice. Once I had to reinstall, the other time, it stopped after a reboot. Wish I had something more definitive for you... Guy On Jul 11, 2008, at 5:25 PM, Stefan wrote: Hi, each time I launch the current XCode 3.1 release, it quits either a second later or when I click in the welcome screen. Console reports only this 12.07.08 00:22:57 Xcode[1744] Xcode(1744,0xa082dfa0) malloc: *** error for object 0xa650a5c: pointer being freed was not allocated 12.07.08 00:22:57 [0x0-0x95095].Xcode[1744] Xcode(1744,0xa082dfa0) malloc: *** error for object 0xa650a5c: pointer being freed was not allocated Since I have 10.5.4 current and I did a full uninstall/reinstall cycle for XCode, I wonder, what to do. Any hints, how to track down the problem an make XCode work again? Kind regards, Stefan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/guy-list%40kickstandsoft.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Learning How to Program in Objective-C
From the thread starter Hello to everyone on this list. Whao, You are all amazing, fine people. You have all made my day even though I was ready for the worse if there were no chances at this. I will return the favor in the near future. I'd like to thank each and every single one for the responses provided on the subject, your professionalism, links supplied and kindness. Thank you. Thank you. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Search NSString for a word and get a boolean value
Moritz Siller [EMAIL PROTECTED] said: For the first occurrence: BOOL found = ([myString rangeOfString:@*** FLOP ***].location != NSNotFound); which you could have easily found in the FInding Characters and Substrings section of the NSString Class Reference documentation. Happy coding. I have a string and I want to search it for the word *** FLOP *** and get a simple boolean value to know if the string contains this word. I have tried with the NSScanner class` methods, but i am not even sure if they are made for that purposes. Is there a simple method to do the job? Are the NSScanner methods the right way and I am just handling them wrong? If you think this question is too stupid and i should solve it on my own please just ignore it ;-) Greetings, Moritz. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Objective-C default initialization
I've noticed that objects get initialized to nil if you don't set them, is this guaranteed in objective-c? I've been trying to find documentation from Apple on this but have been unable. In other words, if you have a simple class like this: @interface MyClass : NSObject { id obj; } @end Then when -init is called is 'obj' *guaranteed*, always, in all versions of OS X, to be nil? Thanks, - Greg ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Objective-C default initialization
In other words, if you have a simple class like this: @interface MyClass : NSObject { id obj; } @end Then when -init is called is 'obj' *guaranteed*, always, in all versions of OS X, to be nil? Yes: http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Tasks/AllocInitObjects.html#/ /apple_ref/doc/uid/2048-1003201 Although it happens on alloc/allocWithZone/etc, not init. Ryan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Objective-C default initialization
Thank you kindly. :-) On Jul 11, 2008, at 8:18 PM, Ryan Brown wrote: Yes: http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Tasks/AllocInitObjects.html#/ /apple_ref/doc/uid/2048-1003201 Although it happens on alloc/allocWithZone/etc, not init. Ryan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: XCode 3.1 quits each time after launch
failing Guy's solution, try the xcode-users list. On Jul 11, 2008, at 7:13 PM, Guy Umbright wrote: I have seen this twice. Once I had to reinstall, the other time, it stopped after a reboot. Wish I had something more definitive for you... ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Objective-C default initialization
On Fri, Jul 11, 2008 at 8:10 PM, Greg [EMAIL PROTECTED] wrote: I've noticed that objects get initialized to nil if you don't set them, is this guaranteed in objective-c? I've been trying to find documentation from Apple on this but have been unable. In other words, if you have a simple class like this: @interface MyClass : NSObject { id obj; } @end Then when -init is called is 'obj' *guaranteed*, always, in all versions of OS X, to be nil? Yes, but that's because it's an instance variable. When memory for a new object is allocated, its ivars are initialized to nil, 0, or 0.0 as appropriate. On the other hand, local variables are *not* initialized: -(void) foo { id obj; // This can be anything } sherm-- -- Cocoa programming in Perl: http://camelbones.sourceforge.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: XCode 3.1 quits each time after launch
Last reply here: I did some instrumented runs of XCode and deleted some Quicktime components and cleared ~/Library/Caches/ Now, XCode starts as expected. Remains to see, if the OS X starts ;-) Am 12.07.2008 um 00:25 schrieb Stefan: Hi, each time I launch the current XCode 3.1 release, it quits either a second later or when I click in the welcome screen. Console reports only this 12.07.08 00:22:57 Xcode[1744] Xcode(1744,0xa082dfa0) malloc: *** error for object 0xa650a5c: pointer being freed was not allocated 12.07.08 00:22:57 [0x0-0x95095].Xcode[1744] Xcode(1744,0xa082dfa0) malloc: *** error for object 0xa650a5c: pointer being freed was not allocated Since I have 10.5.4 current and I did a full uninstall/reinstall cycle for XCode, I wonder, what to do. Any hints, how to track down the problem an make XCode work again? Kind regards, Stefan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/seaside.ki%40mac.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Protocol-conforming object does not include retain?
I have a protocol and an object that conforms to that protocol referenced by an ivar: @protocol FKPointArraySourcing -(NSInteger)fooMethod; @end @interface FKObject : NSObject FKPointArraySourcing { id FKPointArraySourcing mGrid; } If I attempt to retain the ivar like this: [mGrid retain]; then I get a warning that -retain was not found in protocol(s). If I change the protocol definition to: @protocol FKPointArraySourcing NSObject -(NSInteger)foo; @end then the warning goes away. If I remove the protocol conformance and just use a naked id, then the warning goes away as well. Or if I cast mGrid to id the warning goes away. Why is this addition needed? I don't see it used in other code. It's as though the compiler believes that conformance to a protocol implies that it exclusively provides those methods, which is not the idea of protocol conformance at all. Steve Weller [EMAIL PROTECTED] Technical Writing, Editing, Developer Guides, and a little Cocoa ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Protocol-conforming object does not include retain?
On Jul 11, 2008, at 7:39 PM, Steve Weller wrote: Why is this addition needed? I don't see it used in other code. It's as though the compiler believes that conformance to a protocol implies that it exclusively provides those methods, which is not the idea of protocol conformance at all. That is exactly the idea of the protocol. By saying... id mGrid; ... you would be indicating to the compiler that mGrid might potentially respond to any method ever seen. By adding... id FKPointArraySourcing mGrid; ... you are telling the compiler to constrain the set of methods to exactly the set of methods found within the protocol declaration. By adding the NSObject protocol @protocol FKPointArraySourcing NSObject ... you are effectively declaring that anything that implements FKPointArraySourcing will also behave like a standard NSObject. Most likely and most commonly, this will be achieved by subclassing NSObject, though you could also chose to implement all of the methods in NSObject to achieve conformance. The alternative is to declare mGrid as always being a subclass of NSObject... NSObject FKPointArraySourcing *mGrid; b.bum smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Protocol-conforming object does not include retain?
On Jul 11, 2008, at 7:59 PM, Bill Bumgarner wrote: id mGrid; ... you would be indicating to the compiler that mGrid might potentially respond to any method ever seen. I'm either misunderstand what you're saying or something is wrong with my compiler because this: id bar; [bar foo:NSZeroRect super:nil underConstruction:YES]; triggers a compiler warning for me (Xcode 3.0): warning: no '-foo:super:underConstruction:' method found The only thing that removes that warning (for me) is an informal protocol on NSObject that declares the method. Markus -- __ Markus Spoettl smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]