Re: Analyzing Core Data Conflict List [was: Formatting Core Data Conflict List]
On Jan 29, 2009, at 11:51 PM, Steve Steinitz wrote: The newVersion and oldVersion shows the version count on the objects really has changed. OK, that makes reading the coflict list clearer. So that version count is an ever-incrementing number -- as long as the app is running? For atomic stores, yes. For the SQLite store, it is persisted. A few things to note. First, you've set a merge policy on the NSManagedObjectContext right ? Yes, its currently objectTrump. I vacillate between that and StoreTrump, switching whenever my level of panic clips. I'm thinking of trying 'Overwrite' just for fun (my client might not think its so fun :) objectTrump is probably best. Some sources of conflicts that surprise people are (a) dirtying transients, (b) maintaining last mod timestamps (c) making blind changes in -willSave or validation callbacks, or (d) updating the contents of a to-many relationship. Great list, thanks. Pouring over the conflict list, I'm suspicious of (d) '...to-many relationship' which happens to lots of objects (because of event logging, customer history etc) whenever my client creates a sale or adds a lineItem. For something like a Sale - lineItem scenario, whenever you add or remove to the set of lineItems, the Sale object is dirtied. While we strongly discourage using no inverse relationships, something like event logging might be a place to consider it. So you might model AuditTrail - 0 Events so you would code the to-many side on AuditTrail with a fetch request using a predicate like auditRelationship = %@ where the vararg is AuditTrail's objectID. It would be your responsible to ensure all the Events get deleted properly, and you'll miss out on some validation checking without the inverse. You also won't get support from the merge policies for conflict detection. But for multiple users on large rapidly changing relationships, maintaining the relationships formally might be more expense than it's worth. That said, can you clarify (a) 'dirtying transients' a little or point me to some doco? If you have a transient property, calling a setter on it will make the object think it's been dirtied for the next save. You may also wish to refresh the objects more frequently. The larger the staleness interval the more likely an optimistic locking exception will occur due to a large window for simultaneous edits. One easy way to do this is to use a fetch request with prefetching for the related objects most likely to change. - 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 arch...@mail-archive.com
NSPredicateEditorRowTemplate and NSTokenField
Hello all, that's me again with my predicate editor problems :) I subclassed predicate editor's row and replaced default text editor with my NSTokenField in -templateViews. Predicates, that match my template, look like: ANY Tags IN {tag1, tag2, tag3} In -setPredicate I fill token field with tags from predicate: NSExpression *right = .; [pMyTokenField setObjectValue:[right constantValue]]; In -predicateWithSubPredicates I create predicate described above with right part from my token field. I added traces there and it builds exactly what I need. Now, the problem: I added observer to the predicate that I edit and it gets called at every change of predicate, but not for my token field template! Predicate editor has several rows, some of them are standard - numeric, text etc. If I change any of them - my observer gets called. If I edit my token field, observer doesn't get called at all. If I add some token and switch focus to another row, predicate editor calls -predicateWithSubPredicate, I build correct predicate and... nothing. Observer doesn't get called. If I press Enter after adding token - observer will be called. If I switch to some other row (not with my template) and then switch back - observer will be called. If I switch to another row with the same template and when switch back - observer will not be called. I added one more control to the row - a button. It does nothing, just takes some place. I can change my token fields and observer will not be called. But if I press this button - observer will be called immediately. I tried to override -rightExpressions method and return my list of tags, I tried to call -will/didChangeValueForKey: - nothing helped. It seems that I need to notify somebody about the change, but have no idea - how to do that? Please, help me :) P.S.: Things are a bit more complex, I have Filter objects, that hold predicates. Predicate editor is bound to the filter and my observer observes those filters, not the predicates themselves. I tell this to cut ideas about incorrect observing. Observing works perfect for any other row. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
CComposition in CAOpenGLLayer
i am trying to play QCComposition in CAOpenGLLayer here is the snippet of the code Thanks Anshul jain ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Disabling sorting in a programatically generated table
Hi I need to completely disable sorting in a programatically generated table, but have found that no matter what I try, clicking on the column header sorts the table. I've set the following sort descriptors to nil // On the table [table setSortDescriptors: nil]; // On the column [column setSortDescriptorPrototype: nil]; // And on the array controller for each column [controller setSortDescriptors: nil]; [controller setAutomaticallyRearrangesObjects: NO]; How do you shut down all sorting on a table? Thanks for any help ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
RE: QCComposition in CAOpenGLLayer
i am trying to play QCComposition in CAOpenGLLayer Sorry for the earlier post here is the snippet of the code According to the documentation of QCrenderer this should work fine. but at final output nothing is displayed. Can anyone tell me where i am going wrong. - (id) init { self = [super init]; if (self != nil) { [self setAsynchronous:YES]; } return self; } - (CGLPixelFormatObj)copyCGLPixelFormatForDisplayMask:(uint32_t)mask { CGLPixelFormatAttribute attributes[] = { kCGLPFADisplayMask, mask, kCGLPFAAccelerated, kCGLPFAColorSize, 2, kCGLPFAAlphaSize, 8, kCGLPFADepthSize, 16, kCGLPFANoRecovery, kCGLPFAMultisample, kCGLPFASupersample, kCGLPFASampleAlpha, 0 }; CGLPixelFormatObj pixelFormatObj = NULL; GLint numPixelFormats = 0; CGLChoosePixelFormat(attributes, pixelFormatObj, numPixelFormats); if (pixelFormatObj == NULL) NSLog(@Error: Could not choose pixel format!); return pixelFormatObj; } - (void)releaseCGLPixelFormat:(CGLPixelFormatObj)pixelFormat { CGLDestroyPixelFormat(pixelFormat); } - (CGLContextObj)copyCGLContextForPixelFormat: (CGLPixelFormatObj)pixelFormat { CGLContextObj object = [super copyCGLContextForPixelFormat:pixelFormat]; NSString *path = [[NSBundle mainBundle] pathForResource:@Blob ofType:@qtz]; QCComposition *aComposition = [QCComposition compositionWithFile:path]; CGColorSpaceRef colorRef = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); qcRenderer = [[QCRenderer alloc] initWithCGLContext:object pixelFormat:pixelFormat colorSpace:colorRef composition:aComposition]; return object; } - (BOOL)canDrawInCGLContext:(CGLContextObj)glContext pixelFormat: (CGLPixelFormatObj)pixelFormat forLayerTime: (CFTimeInterval)timeInterval displayTime:(const CVTimeStamp *)timeStamp { BOOL success = [self renderAtTime:timeStamp]; if (texture) CVOpenGLBufferRelease(texture); texture = [qcRenderer createSnapshotImageOfType:@CVOpenGLBuffer]; if (texture) return YES; else return NO; return success; } - (BOOL) renderAtTime:(const CVTimeStamp*)time { NSTimeInterval videoTime; if (time) { videoTime = (NSTimeInterval)time-videoTime / (NSTimeInterval)time- videoTimeScale; NSLog(@%f %f %f,videoTime,time-videoTime,time- videoRefreshPeriod); return [qcRenderer renderAtTime:videoTime arguments:nil]; } else NO; } - (void)drawInCGLContext:(CGLContextObj)glContext pixelFormat: (CGLPixelFormatObj)pixelFormat forLayerTime: (CFTimeInterval)timeInterval displayTime:(const CVTimeStamp *)timeStamp { glClearColor(0, 0, 0, 0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glEnable(GL_DEPTH_TEST); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); if (CFGetTypeID(texture) == CVOpenGLTextureGetTypeID()) { GLenum target = CVOpenGLTextureGetTarget(texture); GLint name = CVOpenGLTextureGetName(texture); GLfloat topLeft[2], topRight[2], bottomRight[2], bottomLeft[2]; CVOpenGLTextureGetCleanTexCoords(texture, bottomLeft, bottomRight, topRight, topLeft); glPushMatrix(); glColor4f(1.0f, 1.0f, 1.0f, 1.0); glEnable(target); glBindTexture(target, name); glBegin(GL_QUADS); glTexCoord2fv(bottomLeft); glVertex2i(-1, -1); glTexCoord2fv(topLeft); glVertex2i(-1, 1); glTexCoord2fv(topRight);glVertex2i( 1, 1); glTexCoord2fv(bottomRight); glVertex2i( 1, -1); glEnd(); glDisable(target); glPopMatrix(); } glDisable(GL_BLEND); glDisable(GL_DEPTH_TEST); [super drawInCGLContext:glContext pixelFormat:pixelFormat forLayerTime:timeInterval displayTime:timeStamp]; } ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Finding Thai Words
The logical order for Thai words is: consonant, tone mark, vowel. But if one writes with a pen, one almost always writes: consonant, SARA I, MAI EK - because this is a natural order from bottom to top. The good thing is: the find in NSString (without NSLiteralSearch) does not care about the writing order: looking for MAI EK, SARA I will also find SARA I, MAI EK. WIth one exception: SARA AM, tone mark will NOT find: tone mark, SARA AM. Bug or feature? Tested in TextEdit on 10.5.6. Kind regards, Gerriet. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Issues with Inheritance and collections?
Hi all, I have two classes DomainLogicBase and Vehicle where Vehicle inherits from DomainLogicBase (there are other classes in the project that inherit from DomainLogicBase), DomainLogicBase has some helper functions that all my models use and it also has some common vars like UID that all my models inherit. I am adding objects of type Vehicle to an NSMutableArray which are read up from disk from an SQLite database. When I try and get the object back out of the NSMutableArray and access its properties my app crashes. I have tried to use the debugger and the best I can tell is the properties seem to have invalid values. If the model class does not inherit from a custom class I have defined then the app works fine. Is there something I am missing? Does inheritance do funny things when I am adding objects of the children class to a collection? Any input is welcome. Thanks. -- The secret impresses no-one, the trick you use it for is everything - Alfred Borden (The Prestiege) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
How to find whether the file exists on Hard disk or othe mounted devices?
Hi All How to find whether the file exists on Hard disk or othe mounted devices? -Arun ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: change NSBorderlessWindowMask on NSTitledWindowMask when app is launch. how?
as i understood, when i use full screen app, new NSView component is create. As i told i use flash in my app and for test when my app is launched i wait some time when my flash's animation will changed and switch app to full screen, i've seen that my flash began play again from first frame. I think, when app is create new NSView, app hasn't declared all methods from old. so how can i make fullscreen, also having kept the old NSView? From: douglas welton douglas_wel...@earthlink.net To: Carlo Gulliani carlogulli...@yahoo.com Cc: Cocoa-dev@lists.apple.com Sent: Thursday, January 29, 2009 8:46:22 PM Subject: Re: change NSBorderlessWindowMask on NSTitledWindowMask when app is launch. how? this line: [self makeFirstResponder: self]; should probably be: [self makeFirstResponder: view]; this is assuming that self is your window an view is the view being fullScreen-ed ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Is there any Objective C supported code review tool?
Hi All, Please name me code review tool (Freeware preferred) that is commonly used by Mac/ObjectiveC/XCode developer community. Thanks in advance. Ashish ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Thai Dictionary
I have just made a Thai-Englisch Dictionary, based on stardict- lexitron-te-2.4.2.tar.bz2 from http://stardict.sourceforge.net/Dictionaries_misc.php . But when I enter: ผล I get a list of 79 words, which are not in alphabetic order at all. Not even odered via compare: much less the correct order of localizedCompare:. What have I done wrong? Kind regards, Gerriet. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Is there any Objective C supported code review tool?
Le 30 janv. 09 à 13:30, Ashish Tiwari a écrit : Hi All, Please name me code review tool (Freeware preferred) that is commonly used by Mac/ObjectiveC/XCode developer community. There is the as-yet-unnamed clang static analyzer that can help you to find common error. It's not full features yet, but it's already a valuable tool. http://clang.llvm.org/StaticAnalysis.html ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSTask Leaking...
On 30/01/2009, at 11:02 PM, Kirk Kerekes wrote: Sorry about that... http://developer.apple.com/samplecode/CryptoSample/index.html Thanks, it works now. I had to modify the CryptoSample code and convert a bunch of uint32 types to CSSM_SIZE, but it compiles fine. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to find whether the file exists on Hard disk or othe mounted devices?
On 2009 Jan 30, at 3:28, Arun wrote: How to find whether the file exists on Hard disk or othe mounted devices? This is a one of those very short questions that has many long answers. I wrote some stuff a few months ago that will give you some code and keywords to begin further research. http://sheepsystems.com/sourceCode/fileSysSearch.html ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [Solved - duh!] Core data storage of objects whose class is loaded from a bundle
Thanks for the replies - it's clear that it's a problem in my NSCoding support (see comment below) On 29-Jan-09, at 5:18 PM, Nick Zitzmann wrote: On Jan 29, 2009, at 2:32 PM, Rick Hoge wrote: -(id)initWithCoder:(NSCoder*)decoder { self = [super initWithCoder:decoder]; // Returns instance of parent class return self; } which was returning an instance of the parent class and not the subclass. Then you've got something strange going on, because initializing the superclass shouldn't be setting the object _to_ the superclass; that's the responsibility of whoever allocated the class to set the class. So either you're allocating the wrong class, or your superclass is doing something unorthodox. It turns out the superclass, which inherits from NSObject, is initializing with [[ParentClass alloc] init] instead of [super initWithCoder:decoder] - perhaps this is the problem... Nick Zitzmann http://www.chronosnet.com/ (43092.6825) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Analyzing Core Data Conflict List
Hi Ben, Thanks for your reply. I've made some comments and asked a couple questions. In particular please see the one (at the end) about prefetching in an NSArrayController scenario. On 30/1/09, Ben Trumbull wrote: While we strongly discourage using no inverse relationships, something like event logging might be a place to consider it. So you might model AuditTrail - 0 Events so you would code the to-many side on AuditTrail with a fetch request using a predicate like auditRelationship = %@ where the vararg is AuditTrail's objectID. It would be your responsible to ensure all the Events get deleted properly, and you'll miss out on some validation checking without the inverse. You also won't get support from the merge policies for conflict detection. Great 'heads-ups, thanks. for multiple users on large rapidly changing relationships, maintaining the relationships formally might be more expense than it's worth. That's interesting. An error in our 'Audit Trail' wouldn't be a big problem. We call it an 'Exposure Log' because it only logs suspicious activity. We don't expect it to be a complete audit trail. So maybe I could remove the to-many inverse relationships from Sales and Employees, as long as removing them didn't result in a corrupt database i.e. can't fulfill fault. On the other hand, we'd lose convenience in displaying the Exposure Log. Maybe I'll keep that up my sleeve for later. You may also wish to refresh the objects more frequently. The larger the staleness interval the more likely an optimistic locking exception will occur due to a large window for simultaneous edits. Is that as simple as just decreasing the ManagedObjectContext's staleness interval? I do that temporarily when calling refreshObject. Perhaps I should just keep it short. I recall your comment last year that a very short staleness interval can reveal a minor Core Data refreshObject bug. One easy way to do this is to use a fetch request with prefetching for the related objects most likely to change. For better or worse, our application rarely does programatic fetches. Instead, it makes heavy use of NSArrayControllers. We do some in-memory filtering using mmalc's excellent FilteringController technique -- but very little overt fetching. Is there a way to prefetch in that scenario? I suppose NSArrayController might have an NSFetchRequest to which I could add prefetching keys, but I can't see how to get at it. Thanks again, Steve ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Is there any Objective C supported code review tool?
Codestriker supports objective-c. I don't know how commonly it's used by Mac/ObjectiveC/XCode developer community. HTH, Geoff On Fri, Jan 30, 2009 at 7:30 AM, Ashish Tiwari ashish_tiw...@persistent.co.in wrote: Hi All, Please name me code review tool (Freeware preferred) that is commonly used by Mac/ObjectiveC/XCode developer community. Thanks in advance. Ashish ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/geoff%40mollyandgeoff.com This email sent to ge...@mollyandgeoff.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSFileHandle or a better way?
Hi folks, I've been using NSFIleHandle for a project that inserts data into a file and synchs it back to disk. Everything went smoothly until the app started getting used for larger files ( 200 megs). First, I ran into the NSFileHandle - NSData 256 megs conundrum. That was solved by, as others suggested on this list in other threads, iterating with readDataOfLength or availableData instead of a single readDataToEndOfFile. That worked well. I've got pools set up to keep the memory down. The problem now is that the reads are still really slow. For example, with a read length of 50 megs, I can only get in 3 reads per second. My apps ends up taking almost a minute to perform all of its functions on a file of 500 megs. Perhaps my overall approach was wrong to start out. What I've been doing is opening a file handle, copying the data after the insertion point to an NSData, truncating the file handle at the insertion point, adding the new data, then adding back the trimmed data. This works fairly well if the insert point is towards the end of the file. However, there are instances where I need to insert a few hundred kb into a the file at a location only a few hundred kb into the file. xxx ^ x The time hit comes from copying the trim data to the NSData. Is there a better way to do this with NSFileHandle? Is there a better way to do this than NSFileHandle? thanks for any thoughts, Jaime Magiera Sensory Research http://www.sensoryresearch.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Disabling sorting in a programatically generated table
On Jan 30, 2009, at 1:59 AM, Ken Tozier wrote: Hi I need to completely disable sorting in a programatically generated table, but have found that no matter what I try, clicking on the column header sorts the table. I've set the following sort descriptors to nil // On the table [table setSortDescriptors: nil]; // On the column [column setSortDescriptorPrototype: nil]; // And on the array controller for each column [controller setSortDescriptors: nil]; [controller setAutomaticallyRearrangesObjects: NO]; How do you shut down all sorting on a table? When you call -bind: do you pass NSCreatesSortDescriptorBindingOption NO? HTH, Keary Suska Esoteritech, Inc. Demystifying technology for your home or business ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSFileHandle or a better way?
On Jan 30, 2009, at 7:44 AM, Jaime Magiera wrote: I've been using NSFIleHandle for a project that inserts data into a file and synchs it back to disk. Everything went smoothly until the app started getting used for larger files ( 200 megs). First, I ran into the NSFileHandle - NSData 256 megs conundrum. That was solved by, as others suggested on this list in other threads, iterating with readDataOfLength or availableData instead of a single readDataToEndOfFile. That worked well. I've got pools set up to keep the memory down. The problem now is that the reads are still really slow. For example, with a read length of 50 megs, I can only get in 3 reads per second. My apps ends up taking almost a minute to perform all of its functions on a file of 500 megs. Perhaps my overall approach was wrong to start out. What I've been doing is opening a file handle, copying the data after the insertion point to an NSData, truncating the file handle at the insertion point, adding the new data, then adding back the trimmed data. This works fairly well if the insert point is towards the end of the file. However, there are instances where I need to insert a few hundred kb into a the file at a location only a few hundred kb into the file. xxx ^ x The time hit comes from copying the trim data to the NSData. Is there a better way to do this with NSFileHandle? Is there a better way to do this than NSFileHandle? I suspect your bottleneck is the filesystem. To know for sure you could try the raw C calls and see if it speeds up. In any case, instead of doing a grow/shrink on the file, write to a temp file instead then swap them. This way you could also do optimized batch- writes. This alone could speed the process up immensely. Notwithstanding, how do you recover if your app crashes after you truncate the file? HTH, Keary Suska Esoteritech, Inc. Demystifying technology for your home or business ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Sizing table columns to fit data - a solution looking for suggestions
Below is a reasonably generic Cocoa solution for implementing this behavior. The tableView I developed this for uses an arrayController with individual column bindings; not the old school -dataSource methods for handling the data. This code should exist in tableView's delegate. This solution handles both strings and images. I don't like the reliance on calling the arrayController directly but for now it serves my purpose Overall, I would do it slightly differently; I would subclass NSTAbleHeaderView, figure out what column needs it to be autoresized and when (ie: double click), and then ask the delegate (optionally) what size it wants. But, I would make a default implementation based on -cellSize (possibly doing a monte carlo simulation on the number of rows, if there were a lot of rows, to help with performance). Here are comments on your version: I am interested in both criticisms and improvements - both will serve the Cocoa community.. - (void)tableView:(NSTableView *)tableView mouseDownInHeaderOfTableColumn:(NSTableColumn *)tableColumn { First off, don't use the 'tableView:' prefix for your own delegate methods. Consider what would happen if AppKit introduced the same delegate method in a future release. Well, I can tell you from experience that it won't be good. So, please make it something like scTableView: NSEvent *event = [NSApp currentEvent]; if ([event clickCount]==2) { NSPoint location = [event locationInWindow]; NSTableHeaderView *header = [tableView headerView]; location = [header convertPoint:location fromView:nil]; if (location.x=2.0) location.x-=2; // offset point 2 pixels 'cause the 'split' cursor is a little 'permissive' NSTableColumn *thisColumn = [[tableView tableColumns] objectAtIndex:[header columnAtPoint:location]]; NSString *maxStr = @; id thisObj; NSCell *dCell; float newWidth, maxStringWidth = 0.0 ,maxImageWidth = 0.0; Use CGFloat not float. // me don't like the next line NSArray *theValues = [[myArrayController arrangedObjects] valueForKey:[thisColumn identifier]]; //dump the tableColumn values to an array Instead of this hardcoded access, do this (sorry, not complete, but you should understand the idea): CGFloat maxWidth = 0; for (NSInteger i = 0; i tableView.numberOfRows; i++) { NSCell *cell = [tableView preparedCellAtRow:i column:column]; NSSize size = [cell cellSize]; if (size.width maxWidth) maxWidth = size.width; } [tableColumn setWidth:maxWidth]; The code above is *much* more generic. Note that it doesn't consider the indentation for outlineviews. if ([thisColumn width] != newWidth) { [thisColumn setWidth:newWidth]; Setting the width in a loop is not good for performance; it might cause the table to relayout a lot of times. Anyways, as usual, it never hurts to log feature requests for AppKit to do this for you. corbin } else { //if already max then here double-click sets to half max! (maybe NOT do this if images were found?) [thisColumn setWidth:newWidth/2.0]; } } } ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Is there any Objective C supported code review tool?
Please name me code review tool (Freeware preferred) that is commonly used by Mac/ObjectiveC/XCode developer community. Review Boards supports any code, and I believe supports Objective-C syntax highlighting. http://www.review-board.org/ -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 arch...@mail-archive.com
Re: Sizing table columns to fit data - a solution looking for suggestions
Corbin; Hey thanks for replying! First off, don't use the 'tableView:' prefix for your own delegate methods. Consider what would happen if AppKit introduced the same delegate method in a future release. Well, I can tell you from experience that it won't be good. So, please make it something like scTableView: This method is an existing method provided by NSObject from Apple! I didn't make the name up, I used an already existing delegate mechanism. Am I not understanding your point? Use CGFloat not float. OK, but why? Setting the width in a loop is not good for performance; it might cause the table to relayout a lot of times. The code you cited is NOT inside a loop!?? Or am I not understanding how something works? NSCell *cell = [tableView preparedCellAtRow:i column:column]; 10.5 Only -- I wanted a 10.4 compatible solution. I didn't say that and I should have. Thanks, Steve On Jan 30, 2009, at 10:10 AM, Corbin Dunn wrote: Below is a reasonably generic Cocoa solution for implementing this behavior. The tableView I developed this for uses an arrayController with individual column bindings; not the old school -dataSource methods for handling the data. This code should exist in tableView's delegate. This solution handles both strings and images. I don't like the reliance on calling the arrayController directly but for now it serves my purpose Overall, I would do it slightly differently; I would subclass NSTAbleHeaderView, figure out what column needs it to be autoresized and when (ie: double click), and then ask the delegate (optionally) what size it wants. But, I would make a default implementation based on -cellSize (possibly doing a monte carlo simulation on the number of rows, if there were a lot of rows, to help with performance). Here are comments on your version: I am interested in both criticisms and improvements - both will serve the Cocoa community.. - (void)tableView:(NSTableView *)tableView mouseDownInHeaderOfTableColumn:(NSTableColumn *)tableColumn { NSEvent *event = [NSApp currentEvent]; if ([event clickCount]==2) { NSPoint location = [event locationInWindow]; NSTableHeaderView *header = [tableView headerView]; location = [header convertPoint:location fromView:nil]; if (location.x=2.0) location.x-=2; // offset point 2 pixels 'cause the 'split' cursor is a little 'permissive' NSTableColumn *thisColumn = [[tableView tableColumns] objectAtIndex:[header columnAtPoint:location]]; NSString *maxStr = @; id thisObj; NSCell *dCell; float newWidth, maxStringWidth = 0.0 ,maxImageWidth = 0.0; Use CGFloat not float. // me don't like the next line NSArray *theValues = [[myArrayController arrangedObjects] valueForKey:[thisColumn identifier]]; //dump the tableColumn values to an array Instead of this hardcoded access, do this (sorry, not complete, but you should understand the idea): CGFloat maxWidth = 0; for (NSInteger i = 0; i tableView.numberOfRows; i++) { NSCell *cell = [tableView preparedCellAtRow:i column:column]; NSSize size = [cell cellSize]; if (size.width maxWidth) maxWidth = size.width; } [tableColumn setWidth:maxWidth]; The code above is *much* more generic. Note that it doesn't consider the indentation for outlineviews. if ([thisColumn width] != newWidth) { [thisColumn setWidth:newWidth]; Setting the width in a loop is not good for performance; it might cause the table to relayout a lot of times. Anyways, as usual, it never hurts to log feature requests for AppKit to do this for you. corbin } else { //if already max then here double-click sets to half max! (maybe NOT do this if images were found?) [thisColumn setWidth:newWidth/2.0]; } } } ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Sizing table columns to fit data - a solution looking for suggestions
On Jan 30, 2009, at 8:33 AM, Steve Cronin wrote: Corbin; Hey thanks for replying! First off, don't use the 'tableView:' prefix for your own delegate methods. Consider what would happen if AppKit introduced the same delegate method in a future release. Well, I can tell you from experience that it won't be good. So, please make it something like scTableView: This method is an existing method provided by NSObject from Apple! I didn't make the name up, I used an already existing delegate mechanism. Am I not understanding your point? Hah! No -- that was totally an error on my part; I thought you were making up your own delegate method...I didn't read the name carefully enough. Sorry about that mistake! Use CGFloat not float. OK, but why? For 64-bit compatibility. You can read up on CGFloat / NSInteger for more info. Setting the width in a loop is not good for performance; it might cause the table to relayout a lot of times. The code you cited is NOT inside a loop!?? Or am I not understanding how something works? No; your right here too; I wasn't reading it closely enough... NSCell *cell = [tableView preparedCellAtRow:i column:column]; 10.5 Only -- I wanted a 10.4 compatible solution. I didn't say that and I should have. Ah, that's a bummer :) That means you have to use float instead of CGFloat. corbin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Registering a protocol handler for an App
Hi All, In order to register an Application to handle a protocol, do I have to change anything other than add URL Types in the Plist file? I'm having problems with my application not being opened when a protocol request is sent with a protocol ID that my App is registered for, e.g. it's Plist file says it should handle it. Do have to change anything else? Do I have to do something special at install or run time? All the Best Dave ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Core Data, Garbage Collection and SQL Store
Hi all, It has recently come up on the list again about a known issue when using Core Data + G.C. + SQL NSPersistantDocumentStore. I have a document based application that I am about to release where I have been using this exact combination through it's entire development. I have noticed this issue with the hang while saving, but at the time I had thought that it was caused by me corrupting the document's object graph. Indeed the problem seemed to stop once I had fixed some of my App's logic and I haven't seen the issue since. Me question now is, is it known if there are any particular types of models that can cause this hang? I am using SQL since I will be storing one picture and multiple images of floor plans per document as per the Core Data BLOBs docs. My data model is has about 12 entities, but will only have a few instances of each object. I haven't seen this issue in quite a while and I was wondering if it might be safe to release it with SQL set as the default backing store? Thank you for any insights you may have into this matter. Kevin Ross Feng Shui Software cocoabeans.heliohost.org ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Data, Garbage Collection and SQL Store
On 30 Jan 2009, at 17:14, Kevin Ross wrote: Hi all, It has recently come up on the list again about a known issue when using Core Data + G.C. + SQL NSPersistantDocumentStore. I have a document based application that I am about to release where I have been using this exact combination through it's entire development. I have noticed this issue with the hang while saving, but at the time I had thought that it was caused by me corrupting the document's object graph. Indeed the problem seemed to stop once I had fixed some of my App's logic and I haven't seen the issue since. Me question now is, is it known if there are any particular types of models that can cause this hang? I am using SQL since I will be storing one picture and multiple images of floor plans per document as per the Core Data BLOBs docs. My data model is has about 12 entities, but will only have a few instances of each object. I haven't seen this issue in quite a while and I was wondering if it might be safe to release it with SQL set as the default backing store? I am in the same boat. My app is very simple, probably a lot simpler than yours, but the results seem pretty clear. If I switch my store type to SQLite the second save issue is present (are you making sure to dirty the doc and then save that second time?) If I specify XML then saving is reliable. I too would prefer the SQLite store but the problem does seem to be a definite show stopper. I am running 10.5.6 + Xcode 3.1.2 Thank you for any insights you may have into this matter. Kevin Ross Feng Shui Software cocoabeans.heliohost.org ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/jonathan%40mugginsoft.com This email sent to jonat...@mugginsoft.com Jonathan Mitchell Central Conscious Unit http://www.mugginsoft.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Data, Garbage Collection and SQL Store
On 1/30/09 9:14 AM, Kevin Ross said: It has recently come up on the list again about a known issue when using Core Data + G.C. + SQL NSPersistantDocumentStore. I have a document based application that I am about to release where I have been using this exact combination through it's entire development. I have noticed this issue with the hang while saving, but at the time I had thought that it was caused by me corrupting the document's object graph. Indeed the problem seemed to stop once I had fixed some of my App's logic and I haven't seen the issue since. I think you're getting lucky. I can certainly still repro this bug. And my Radar has not come back 'fixed'. I find it quite bothersome that a bug that causes user data loss is still unfixed in 10.5.6. It must be a hard nut to crack. -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: CGAffintransform and UIImage Views
On Jan 29, 2009, at 10:24 AM, nasser salami wrote: Hello, im a newbie iphone developer and i m trying to smoothly scale an image view up and then return to the original state. here what i did but it did not work : so can you tell what it is that i did wrong? i'm sorry if it sounded stupid. thanks Assuming that all that is done one after the other, you just asked the view to scale up to 5x in size, and then before it could actually do so to scale back down to 1x in size. If you want to do it this way, then you will have to use the animation delegate and +setAnimationDidStopSelector: to be notified when the animation completes before you ask the view to scale back down to 1x. -- David Duncan Apple DTS Animation and Printing ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: QCComposition in CAOpenGLLayer
On Jan 30, 2009, at 1:03 AM, Anshul jain wrote: i am trying to play QCComposition in CAOpenGLLayer Why not use the QCCompositionLayer? -- David Duncan Apple DTS Animation and Printing ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Serial IO seems to be starving UI
On Jan 30, 2009, at 2:08 AM, Rick Mann wrote: Sorry for the cross-post, but I thought both these lists might have advice to offer. Please don't cross-post. Try one list, then the other. I just dusted off an app I'd worked on several months ago. It used to work fine (prior to 10.5.6), but now it behaves very erratically. I'm not blaming 10.5.6 necessarily, it's just that's all I can think of that might have changed. Basically, it uses NSFileHandle on a serial port to get notified when data is available. The data is coming in at 9600 baud. It parses the packets, then sends the packets to some code that graphs the values. I've been able to determine that valid data is coming in fairly frequently, and the packets are parsing correctly. This ends up calling -setNeedsDisplay: on my view, but the view's draw code is only called once in a very long while (30 seconds or more, but sometimes it'll get called faster). There is also a view that shows the raw bytes, and it, too, updates only when the graph view updates. I tried running Shark, but I'm not very good at using it or interpreting the results. It seems to spend 49% of the time on __semwait_signal, and 50% of the time in the read routine (with a lot of the time going to makeKeyAndOrderFront, for some reason). Like I said, this used to work pretty flawlessly, and now it's very unhappy. Any suggestions would be very welcome. What is likely happening is that the NSFileHandle processing is starving the main NSRunLoop. This happens because NSRunLoop processes non-user input before it processes user events (which seems backwards for the main run loop but is nevertheless the case). The only solution is to use a secondary runloop on a second thread to process the data, then safely get that info back to the main thread and trigger redrawing. You should likely process the data on the second thread as well so that the main thread is completely free for user events. I have no explanation of why it should suddenly not work other than that data is probably flowing in faster or requires more processing. Cheers, M ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSMouseEntered during drag op, losing window reference
Erg. This one is driving me loopy. With mouse events suddenly losing their window pointer when the mouse is dragged outside the window and then back, I've tried substituting a newly created NSMouseEntered _with_ the correct window (and other elements) from the windowless NSMouseEntered that is delivered, but I get various asserts in NSEvent, or other effects when I try to dispatch the event with sendEvent (on NSApp or the target window). Any suggestions would be greatly appreciated. -- lwe On 28-Jan-09, at 3:57 PM, Luke Evans wrote: I've been following some Apple sample code with respect to mouse dragging logic (within a table - but that's probably not important). The particular approach involves maintaining full control of the drag state by starting a loop that processes all pertinent events until the mouse button is released. By and large this works fine, you can watch and react to the events during the drag operation and you can dispatch events for 'normal' processing as necessary with: [NSApp sendEvent:event]; Now, I need to handle dragging beyond the bounds of the originating view because I wish to implement auto-scrolling during the drag. This actually works great using NSPeriodic events. There's one fly in the ointment however. When the mouse leaves the bounds of the view, I correctly get an NSMouseExited event from the tracking area that is set up. However, when the mouse reenters the view/tracking area, still under drag, I get an NSMouseEntered, but the window is nil. This causes grief, and is in contrast with a NSMouseEntered events that happen when I'm not managing the drag. I'm wondering if I'm missing a way to lock the window as the event target while I'm dragging (after all, code associated with this window is 'in control' at this point and making decisions about the meaning of all mouse movement). Various ideas for hacking a solution present themselves (after all, at least I'm not _missing_ the event entirely), but I'm inclined to believe that the source of my angst is likely correctable by more respectable, and/or canonical means. Cheers -- Luke ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSFileHandle or a better way?
On Jan 30, 2009, at 11:08 AM, Keary Suska wrote: I suspect your bottleneck is the filesystem. To know for sure you could try the raw C calls and see if it speeds up. In any case, instead of doing a grow/shrink on the file, write to a temp file instead then swap them. This way you could also do optimized batch- writes. This alone could speed the process up immensely. Notwithstanding, how do you recover if your app crashes after you truncate the file? Hi Keary, Thanks for the response. The project did originally start out writing to temp files for these processes. However, I got a complaint from a customer about the disk footprint of temp files. So, I tried going the other route. (I explained the value of tmp files, but they felt the tradeoff wasn't worth it). Now, it seems the original path was the best regardless. I shall return to that method. thanks for the advice, Jaime Magiera Sensory Research http://www.sensoryresearch.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
CoreData relationship/KVC question
I've been working on my first CoreData project and I have a question regarding dynamically generated accessors for to-many relationships and KVC... I'll keep it as simple as possible, let's assume I have a Department entity which contains many Employees entities from what I understand in the doc, CoreData should automatically generate those methods for Department: -addEmployees:(NSSet *)values -addEmployeesObject:(NSManagedObject *)value My question is, how would I access these 2 methods using KVC accessors? For example, if I want to set the employee's name attribute I can use: [anEmployee setValue:@John Doe forKey:@name]; Following this pattern, could I use [aDeparment setValue:anEmployee forKey@employees]; // Assuming anEmployee is an NSManagedObject* or [aDeparment setValue:someEmployees forKey@employees]; // Assuming someEmployees is an NSSet* In other words, are relationship also KVC and, will CoreData aumatically call the correct method depending on the type of the value I'm setting (either an NSSet or an NSManagedObject) ? I know I can declare an NSManagedObject category with a bunch of accessors etc.. to suppress compiler warning but I was wondering about the KVC get/set as I am using them too Thank you! Jean-Nicolas Jolivet silver...@videotron.ca http://www.silverscripting.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
animation keys
This is a documentation question, really. So, it turns out that when you call replaceSubview: through an animator proxy, the @subviews animation is triggered. You can modify what happens during replaceSubview: by adding your own animation to a view's dictionary under the key @subviews. My question is: how would I find this out? I mean, I can guess that setFrameRotation: might trigger the @frameRotation animation, but I would never have guessed this one. So where can I find a list of what actions trigger what animation keys? Thx - m. -- matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/ pantes anthropoi tou eidenai oregontai phusei Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf AppleScript: the Definitive Guide, http://tinyurl.com/2ouo3b Take Control of Customizing Leopard, http://tinyurl.com/2t9629 TidBITS, Mac news and reviews since 1990, http://www.tidbits.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Stroking on the inside with NSBezierPath
The default stroke seems to be one that assumes the path you make is the center of the stroke. How can I make the stroke be on one of the *side* of the path? Depending on how you look at it it could be to the right, left, outside or inside. Any way to modify that? Thanks,U _ Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! http://spaces.live.com/spacesapi.aspx?wx_action=createwx_url=/friends.aspxmkt=en-us___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
coreData+bindings+IB challenge.
hey guys, got a coreData+Bindings+IB challenge that I just can't figure out. The apple docs and the obligatory search of the various channels of dev data has yielded zip. so to boil it down to a clear and simple as it can be... I have 2 entities : entA and entB. entA has a to-many relationship to entB, called: entBRelationship. (with appropriate inverse) entB has a numerical attribute named: order I have a master detail interface, works great. it consists of : a tableview bound to an arrayController in turn bound to entA entities. a tableView bound to an arrayController in turn bound to the entBRelationship of the Selection of entA's list. like I said: works great. heres what doesn't work, what I can't find any documentation that even hints at how to do it, or any reference anywhere that even talks about trying something remotely like this: I have a text field. I want to bind it in IB, to the entB whose order == 1, of the EntBRelationship, of the selected entA. that sounds like I should have an ObjectController with a filter predicate (@order == 1)bound to the same arrayController that my second tableView is bound to. that SHOULD fetch the singular object in the array that fits the fetch predicate. bzzzt. nope, doesn't work. it returns a set. (in an OBJECT CONTROLLER?) or an arrayController, with a filter predicate... nope, another NSSet is returned. I subclassed NSArrayController and added a method of object: to it which returns the object of index:0 of the arranged objects, and then bound the text field to THAT, but guess what happened there? the KVC was messed up, my text field never updated, even though it allowed me to change the value of the object. unnacceptable, and not really helpful. I need to be able IN IB to set the search predicate. can anyone shed some light on how to use IB, to bind to a singular ManagedObject based upon a predicate? can anyone shed any light on the fact that ObjectControllers appear to have No utility whatsoever, because they cannot be bound to objects in an arrayController's arrangedObjects array? can anyone tell me why IB drops the inspector for the selected controller when I apply bindings? its a bug, its unavoidable, it SEEMS like it would be trivial to fix compared to most bugs, and its been around for over a year! peace, -td ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Stroking on the inside with NSBezierPath
The default stroke seems to be one that assumes the path you make is the center of the stroke. How can I make the stroke be on one of the *side* of the path? Depending on how you look at it it could be to the right, left, outside or inside. Any way to modify that? Thanks,U Just set the clip path to your path before stroking it. Matthew ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Stroking on the inside with NSBezierPath
On Jan 30, 2009, at 2:19 PM, Ulai Beekam wrote: The default stroke seems to be one that assumes the path you make is the center of the stroke. How can I make the stroke be on one of the *side* of the path? Depending on how you look at it it could be to the right, left, outside or inside. Any way to modify that? Thanks,U Adjust the clipping path (to either include or exclude the shape) and stroke the line with twice the width. Glenn Andreas gandr...@gandreas.com http://www.gandreas.com/ wicked fun! quadrium | flame : flame fractals strange attractors : build, mutate, evolve, animate ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSMouseEntered during drag op, losing window reference
OK. The window nil thing may have been a herring rouge thanks to the debugger not showing values correctly grr. However, the effect remains: - I start the drag in the window/view - Drag to the outside of the window - Drag events are dispatched to the window, and always arrive in my view (even when the mouse is outside the window) - Drag back into the bounds of the window/view - NSMouseEntered arrives in my event loop when I cross back over the tracking area covering the view, but when dispatched to the window it fails to arrive in my view At this point I have no idea who is eating the mouse entered event - i.e. where it goes after being dispatched to the window and which view handles it (if any). I could send events directly to the view concerned (probably), by sending the events directly to mouseEntered:, mouseExited: etc. when I'm in my drag loop. However, I'm not sure if that would subvert any critical handling elsewhere (is there any?). ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Re: Why does NSTableView stop responding to validateMenuItem: ?
Jason, Yes, I've read up on menu validation (more than once). I got here because my application has a few table and/or outline views in the document window, and I wanted Select All to be directed to one in particular (a master list) whenever the current first responder does not respond to selectAll:. I was handling this by implementing selectAll: in my document subclass and re-directing it to the master table. I assumed (ah, there's my problem...) that NSOutlineView, since it implements selectAll:, would be implemented to enable a Select All menu item that might reasonably be targeted at the first responder's selectAll:, and figured that the document should/could delegate the validation to the table. If I had seen the exception soon after adding the code, I probably would have figured it out. But the code was in place for months before we first noticed an exception being thrown (our QA testers regularly check the console for exception messages), so I assumed that that particular piece of code was OK. Reflecting on all this, it would appear that the menu item was (almost) always being validated by something in the responder chain ahead of the document. And that I should assume less often. :-) Andy, Jason, thanks very much for your time and help. Best regards, Doug K; On Jan 29, 2009 5:12pm, Jason Foreman ja...@threeve.org wrote: On Thu, Jan 29, 2009 at 2:37 PM, Doug Knowles knowles.d...@gmail.com wrote: And why is the exception only thrown infrequently (and persistently once it starts), when it's normally successfully invoked every time a click on the respective menu? The real question is why is the exception not thrown every time. NSTableView doesn't seem to implement validateMenuItem:. NSObjectController is an example of a class that does. Perhaps you are using an NSArrayController for your table's data, in which case you can call validateMenuItem: on that. It'd still be a good idea to check respondsToSelector first. You've read this? http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/MenuList/Articles/EnablingMenuItems.html#//apple_ref/doc/uid/2261-74653 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/knowles.doug%40gmail.com This email sent to knowles.d...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Printing WebView as a subview
I found out how to easily print a WebView that follows page margins and paginates correctly just be grabbing the documentView of the mainFrame, which as I recall was to print the NSView found at [ [ [myWebView mainFrame] frameView] documentView] But now I want to print a WebView that is a subview of another view having many other views (NSTextFields, NSTextViews, controls, etc.) where the printing is done through the parent NSView. The web view displays as a scrolling frame in the parent view, but I want the print out to show the entire contents of the web view (without scroll bars) and to paginate through that view along with pagination of the parent view. My thought was to build an off-screen window and replace the WebView subView with its own documentView resized for the entire contents on the view, but then I was not sure how to paginate that documentView as it might start anywhere on a page? --- John Nairn GEDitCOM - Genealogy Software for the Macintosh http://www.geditcom.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to draw text with fade out effect?
On Jan 29, 2009, at 5:08 PM, Peter N Lewis wrote: One option is to draw the end of the string character by character with varying alphas. Glyph by glyph, really, in the general case. You can take a look at the CircleView example for one case of drawing strings glyph by glyph-- with different affine transforms rather than varying alphas. 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 arch...@mail-archive.com
Re: CoreData relationship/KVC question
Hi Jean-Nicolas I may not grasp your question but are relationship also KVC? You can do KVC stuff with relationships like employees = [department valueForKey: @employees]; but I doubt that's what you mean. and, will CoreData aumatically call the correct method depending on the type of the value I'm setting (either an NSSet or an NSManagedObject) ? I don't think so. But don't take my word for it. I look forward to replies from people who understand your question more clearly. Cheers, Steve ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: CoreData relationship/KVC question
Perhaps my question wasn't clear hehe... What I wanted to know, more or less, is (following my previous Employee/Department example) can I add employees to a Department using KVC For example CoreData generates the following method to add an employee object to a deparment: addEmployee:(NSManagedObject *)value Using that accessor I know I can do the following: [aDepartment addEmployeesObject:anEmployee]; How would I do that using KVC ? My point is... I don't want to subclass NSManagedObject for all my entities and I don't want to create a category with ALL the possible accessors... Can I do this? [aDepartment setValue:anEmployee forKey:@employees]; CoreData (in this example) would also generate the following: addEmployees:(NSSet *)values To add multiple employees to a department once again, how would I do that using KVC?? Hopefully it's clearer now! Let me know if you still have difficulty understanding my question, I'll do my best to explain! :) On 30-Jan-09, at 4:16 PM, Steve Steinitz wrote: Hi Jean-Nicolas I may not grasp your question but are relationship also KVC? You can do KVC stuff with relationships like employees = [department valueForKey: @employees]; but I doubt that's what you mean. and, will CoreData aumatically call the correct method depending on the type of the value I'm setting (either an NSSet or an NSManagedObject) ? I don't think so. But don't take my word for it. I look forward to replies from people who understand your question more clearly. Cheers, Steve Jean-Nicolas Jolivet silver...@videotron.ca http://www.silverscripting.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: CoreData relationship/KVC question
On Jan 30, 2009, at 1:26 PM, Jean-Nicolas Jolivet wrote: What I wanted to know, more or less, is (following my previous Employee/Department example) can I add employees to a Department using KVC http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdUsingMOs.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 arch...@mail-archive.com
Re: WritePipeAsync returns error code e00002c2 (Bad Argument)
I didn't realize there was a USB mailing list. Thanks for the info. I solved my own problem. The second parameter needed to be a 1 for write, not a 2 (which is for a read). --- On Fri, 1/30/09, Dave Camp d...@thinbits.com wrote: From: Dave Camp d...@thinbits.com Subject: Re: WritePipeAsync returns error code e2c2 (Bad Argument) To: howlew...@yahoo.com Date: Friday, January 30, 2009, 12:22 PM If it's a USB question, you should probably ask it on the USB mailing list... Dave On Jan 30, 2009, at 12:02 PM, Ian was here wrote: For some reasom when I call WritePipeAsync(), I get error code e0002c2 (kIOReturnBadArgument). I Googled the heck out of it and haven't found any similar issues. If I use WritePipe(), it works great. Here is my code: char gBuffer[64] = {0}; gBuffer[0] = 1; gBuffer[1] = 1; gBuffer[2] = 's'; IOReturn kr = (*interface)-WritePipeAsync(interface, 2, gBuffer, sizeof(gBuffer), (IOAsyncCallback1)WriteCompletion, (void *)interface); Note: this is taken from Apple's USB sample code. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/dave%40thinbits.com This email sent to d...@thinbits.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: CoreData relationship/KVC question
Le 30 janv. 09 à 20:14, Jean-Nicolas Jolivet a écrit : I've been working on my first CoreData project and I have a question regarding dynamically generated accessors for to-many relationships and KVC... I'll keep it as simple as possible, let's assume I have a Department entity which contains many Employees entities from what I understand in the doc, CoreData should automatically generate those methods for Department: -addEmployees:(NSSet *)values -addEmployeesObject:(NSManagedObject *)value My question is, how would I access these 2 methods using KVC accessors? For example, if I want to set the employee's name attribute I can use: [anEmployee setValue:@John Doe forKey:@name]; Following this pattern, could I use [aDeparment setValue:anEmployee forKey@employees]; // Assuming anEmployee is an NSManagedObject* or [aDeparment setValue:someEmployees forKey@employees]; // Assuming someEmployees is an NSSet* In other words, are relationship also KVC and, will CoreData aumatically call the correct method depending on the type of the value I'm setting (either an NSSet or an NSManagedObject) ? No. I never tried, but I'm pretty sure you will obtain garbage, at least for you first proposition. The second will simply replace the old employees set with someEmployees. I know I can declare an NSManagedObject category with a bunch of accessors etc.. to suppress compiler warning but I was wondering about the KVC get/set as I am using them too If you want to use the KVC method use -mutableSetValueForKey or - mutableSetValueForKeyPath: . In return you have a proxy object for the key (keypath). Send to this proxy usual mutable set methods, the KVO notifications will be send for you. EX : [[aDepartment mutableSetForKey:@employees] addObject:someEmployees]; [[aDepartment mutableSetForKey:@employees] unionSet:someEmployees]; Frédéric ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: CoreData relationship/KVC question
Thanks a lot!... I've been reading the Managed Object Accessor Methods over and over but apparently the answer was in Using Managed Object! (To answer my own question, the correct KVC syntax would be) NSMutableSet *employees = [aDepartment mutableSetValueForKey:@employees]; [employees addObject:newEmployee]; [employees removeObject:firedEmployee]; On 30-Jan-09, at 4:30 PM, mmalc Crawford wrote: On Jan 30, 2009, at 1:26 PM, Jean-Nicolas Jolivet wrote: What I wanted to know, more or less, is (following my previous Employee/Department example) can I add employees to a Department using KVC http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdUsingMOs.html mmalc Jean-Nicolas Jolivet silver...@videotron.ca http://www.silverscripting.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
IKSlideshow and Custom Transitions
Is there any way to set an IKSlideshow to use different transitions? I can't seem to find a way to set that. Jeff ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Serial IO seems to be starving UI
On Jan 30, 2009, at 10:21:35, A.M. wrote: What is likely happening is that the NSFileHandle processing is starving the main NSRunLoop. This happens because NSRunLoop processes non-user input before it processes user events (which seems backwards for the main run loop but is nevertheless the case). The only solution is to use a secondary runloop on a second thread to process the data, then safely get that info back to the main thread and trigger redrawing. You should likely process the data on the second thread as well so that the main thread is completely free for user events. I have no explanation of why it should suddenly not work other than that data is probably flowing in faster or requires more processing. If anything, data is coming in more slowly. I used to run it at 115200, now it's at 9600. I may be able to get one of my other MBPs to run 10.5.5, and try it there. -- Rick ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
RE: Stroking on the inside with NSBezierPath
The clipping path was indeed what I was looking for to solve this. Thank you sirs! :) The default stroke seems to be one that assumes the path you make is the center of the stroke. How can I make the stroke be on one of the *side* of the path? Depending on how you look at it it could be to the right, left, outside or inside. Any way to modify that? Thanks,U Just set the clip path to your path before stroking it. Matthew _ News, entertainment and everything you care about at Live.com. Get it now! http://www.live.com/getstarted.aspx___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Data, Garbage Collection and SQL Store
On Jan 30, 2009, at 9:37 AM, Sean McBride wrote: On 1/30/09 9:14 AM, Kevin Ross said: It has recently come up on the list again about a known issue when using Core Data + G.C. + SQL NSPersistantDocumentStore. I have a document based application that I am about to release where I have been using this exact combination through it's entire development. I have noticed this issue with the hang while saving, but at the time I had thought that it was caused by me corrupting the document's object graph. Indeed the problem seemed to stop once I had fixed some of my App's logic and I haven't seen the issue since. I think you're getting lucky. I can certainly still repro this bug. And my Radar has not come back 'fixed'. I find it quite bothersome that a bug that causes user data loss is still unfixed in 10.5.6. It must be a hard nut to crack. -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada If it's not too much trouble are you able to send me your repro project? I'm wondering why it's not happening with my project anymore. To jonat...@mugginsoft.com: I am dirtying the document before each save and it still isn't happening. In certain instances, the MOC's undoManager is cleared before saving, but other times it's not (I'm not sure if this matters for this instance...). I am also running 10.5.6 + Xcode 3.1.2. Thank you all for your comments! Kevin Ross Feng Shui Software cocoabeans.heliohost.org___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Subversion Problems
I'm working through Xcode 33 Unleashed and have run into a problem: First, I'm supposed to go into terminal and run the following commands: mkdir -p /Users/Shared/Subversion/Linear cd /Users/Shared/Subversion/ svnadmin create Linear chmod -R a+rwX . ls -l Linear cat Linear/README.txt svn status Then, I modify the config file a little bit. Next, I'm supposed to go to Xcode. Xcode's SCM pane of preferences has changed a great deal, however, although not enough sothat I shouldn't have been able to follow the book. I'm supposed to type file:///Users/Shared/Subversion/Linear into URL:, and tab out, which will fill Scheme: with file and Path: with /Users/ Shared/Subversion/Linear The changes are, I believe: URL has been replaced with root with Root, and when I tabbed, instead of scheme being filled with file, (there is no scheme) host is. Path remains the same. Unfortunately, xcode says that there is an incomplete configuration. In Xcode's repositories window, there were several red x's: 1 was beside login, and while the first sub-listing was fine cvs -n update -d -P the other 2: ssh: Could not resolve hostname file: nodename nor servname provided, or not known and cvs [update aborted] : end of file from server (consult above messages if any) had x's. Next, list /Users/Shared/Subversion/Linear followed the same scheme. I'm not really sure what's going wrong here, but I'd really appreciate help. Thanks! - Walker Argendeli ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Subversion Problems
On 1/30/09 5:52 PM, Walker Argendeli said: I'm not really sure what's going wrong here, but I'd really appreciate help. Your question seems to have nothing to do with Cocoa. You should ask on the Xcode list. -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Data, Garbage Collection and SQL Store
On Jan 30, 2009, at 3:02 PM, Sean McBride wrote: On 1/30/09 2:49 PM, Kevin Ross said: If it's not too much trouble are you able to send me your repro project? I'm wondering why it's not happening with my project anymore. I'm afraid the bug I filed contains not a simple test project, but my entire (unreleased) application. I wanted to be sure they fixed my exact case. Sorry, -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada No problem, thanks anyway Sean! Kevin Ross Feng Shui Software cocoabeans.heliohost.org ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
CALayer with KVC
Hi, I am storing some Key-Value Pairs when creating a CALayer. If i read it back immediately, i can read the values intact. Later when i read it in e.g., touchesBegan, the values seem incorrect. From my reading of the document, it says it can store any key/value pairs. Is that wrong understanding ? -mohan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
keydown woes update
Hi, It seems i sent my question a moment too soon. To answer my own question in case anyone is curious, NSPanels, by default return NO for -(BOOL) canBecomeKeyWindow, whereas NSWindows return YES. - Dave h. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSFileHandle or a better way?
On 30 Jan 09, at 06:44, Jaime Magiera wrote: I've been using NSFIleHandle for a project that inserts data into a file and synchs it back to disk. ... My apps ends up taking almost a minute to perform all of its functions on a file of 500 megs. Perhaps my overall approach was wrong to start out. What I've been doing is opening a file handle, copying the data after the insertion point to an NSData, truncating the file handle at the insertion point, adding the new data, then adding back the trimmed data. This works fairly well if the insert point is towards the end of the file. However, there are instances where I need to insert a few hundred kb into a the file at a location only a few hundred kb into the file. xxx ^ x The time hit comes from copying the trim data to the NSData. Is there a better way to do this with NSFileHandle? Is there a better way to do this than NSFileHandle? Not without changing the structure of your file. There's no way to shift the contents of a file in the way you're looking for - UNIX file systems aren't structured in a way that permits that. (In fact, I'm not aware of any that are.) You'll need to either rethink how you're storing data, or cope with slow saves. Incidentally, the way you're doing saving is unsafe. If your application crashes in the middle of a save operation, the file may end up truncated. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Serial IO seems to be starving UI
On Fri, Jan 30, 2009 at 1:21 PM, A.M. age...@themactionfaction.com wrote: What is likely happening is that the NSFileHandle processing is starving the main NSRunLoop. This happens because NSRunLoop processes non-user input before it processes user events (which seems backwards for the main run loop but is nevertheless the case). Actually it makes perfect sense. If an event causes a method to call -performSelector:withObject:afterDelay:, that selector should logically be applied before the next event is processed. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Determining Previous Front Process
On Fri, 30 Jan 2009 15:44:03 -0800, Seth Willits sli...@araelium.com said: Does anyone have any experience with getting the previously front process? I tried using GetFrontProcess in applicationWillBecomeActive, but by that time my app is front. Getting front in applicationDidResignActive returns the app that was just activated after mine, but I need to know the active one right before I activate, not after I deactivate. One possible approach: http://www.cocoabuilder.com/archive/message/cocoa/2006/7/9/167174 (I've already posted my code for doing this, so check the archives.) Since you will be notified every time a different app comes to the front, you can just keep track - when your app comes to the front, the one you *previously* recorded as being in front is the one you're after. (It may, of course, have now terminated.) m. -- matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/ A fool + a tool + an autorelease pool = cool! One of the 2007 MacTech Top 25: http://tinyurl.com/2rh4pf AppleScript: the Definitive Guide - Second Edition! http://www.amazon.com/gp/product/0596102119 ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Issues with Inheritance and collections?
On Jan 30, 2009, at 5:23 AM, Devraj Mukherjee wrote: I have two classes DomainLogicBase and Vehicle where Vehicle inherits from DomainLogicBase [...] I am adding objects of type Vehicle to an NSMutableArray which are read up from disk from an SQLite database. How are you storing/reading them? Are you sure they are complete and valid at this point? When I try and get the object back out of the NSMutableArray and access its properties my app crashes. I have tried to use the debugger and the best I can tell is the properties seem to have invalid values. If the model class does not inherit from a custom class I have defined then the app works fine. Is there something I am missing? Does inheritance do funny things when I am adding objects of the children class to a collection? No, inheritance doesn't do funny things when you add the objects to a collection. Is DomainLogicBase derived, directly or indirectly, from NSObject? You might have accidentally forgotten to specify its super class, thus inadvertently making it a root class. If that's not it, then I suspect memory management problems. You might be over-releasing the objects and the memory is later reused for some other kind of object. Try turning on NSZombieEnabled. Regards, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Determining Previous Front Process
On Jan 30, 2009, at 5:48 PM, Matt Neuburg wrote: One possible approach: http://www.cocoabuilder.com/archive/message/cocoa/2006/7/9/167174 This'll work great. Thanks. (I've already posted my code for doing this, so check the archives.) Searching the archives is such a PITA. The search algorithm is lame. Searching for GetFrontProcess and Neuburg, for example, should *surely* show this thread at the top. Does it? No. It's not even anywhere in the top 100 results. What kind of search is that? -- Seth Willits ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Determining Previous Front Process
On 31/01/2009, at 12:00 PM, Seth Willits wrote: Searching the archives is such a PITA. The search algorithm is lame. Searching for GetFrontProcess and Neuburg, for example, should *surely* show this thread at the top. Does it? No. It's not even anywhere in the top 100 results. What kind of search is that? Use the advanced search and change the search type to All of the words. One result. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: animation keys
On Jan 30, 2009, at 2:03 PM, Matt Neuburg wrote: This is a documentation question, really. So, it turns out that when you call replaceSubview: through an animator proxy, the @subviews animation is triggered. You can modify what happens during replaceSubview: by adding your own animation to a view's dictionary under the key @subviews. My question is: how would I find this out? I mean, I can guess that setFrameRotation: might trigger the @frameRotation animation, but I would never have guessed this one. So where can I find a list of what actions trigger what animation keys? Thx - m. According to the comments in NSAnimation.h the key should usually be the property of the receiver that is changing. But I think when I looked at it last that this wasn't always the case. Specifically I found that a setFrame: method did not use a frame key but instead used two animations to accomplish its effect, frameOrigin and frameSize. I found that purely by trial and error and I'd love to know if there's some list of other edge cases like that. Ashley ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Determining Previous Front Process
On 2009.01.30, at 6:04 PM, Rob Keniger wrote: On 31/01/2009, at 12:00 PM, Seth Willits wrote: Searching the archives is such a PITA. The search algorithm is lame. Searching for GetFrontProcess and Neuburg, for example, should *surely* show this thread at the top. Does it? No. It's not even anywhere in the top 100 results. What kind of search is that? Use the advanced search and change the search type to All of the words. One result. Typing GetFrontProcess AND Neuburg into the normal search field will do the same. Having a disjunctive search is a silly default IMO. ~Martin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: keydown woes update
On 31/01/2009, at 10:14 AM, David Harper wrote: It seems i sent my question a moment too soon. To answer my own question in case anyone is curious, NSPanels, by default return NO for -(BOOL) canBecomeKeyWindow, whereas NSWindows return YES. Seems like I should read all my mail before replying :-) -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Core Animation/Core Image Crash
Hi all, In our application we have a window with a layer-backed NSView which has a content filter applied. The view also has a CAAnimation attached, which alters one of the filter's parameters. Our problem is: When we repeatedly close and re-open the window, the application crashes. (Note that the window's isReleasedWhenClosed flag is not set!) We broke down our setup to the following code, which always causes a crash after opening and closing the window a few times: @implementation MyView - (void) drawRect: (NSRect) dirtyRect { [[NSColor greenColor] set]; NSRectFill( [self bounds] ); } @end @implementation MyController - (void) toggleWindow: (NSWindow*) window { if ( [window isVisible] ) { [window close]; } else { [window makeKeyAndOrderFront:self]; } [self performSelector:@selector(toggleWindow:) withObject:window afterDelay:0.2]; } - (void) awakeFromNib { NSWindow* window = [[NSWindow alloc] initWithContentRect:NSMakeRect( 0.0, 0.0, 500.0, 300.0 ) styleMask:NSTitledWindowMask backing:NSBackingStoreBuffered defer:NO]; // not released [window setReleasedWhenClosed:NO]; [window center]; [[window contentView] setWantsLayer:YES]; MyView* view = [[MyView alloc] initWithFrame:NSMakeRect( 20.0, 20.0, 200.0, 100.0 )]; [[window contentView] addSubview:view]; [view release]; CIFilter* bloomFilter = [CIFilter filterWithName:@CIBloom]; [bloomFilter setDefaults]; [bloomFilter setName:@bloomFilter]; [view setContentFilters:[NSArray arrayWithObject:bloomFilter]]; CABasicAnimation* animation = [CABasicAnimation animationWithKeyPath:@filters.bloomFilter.inputRadius]; animation.fromValue = [NSNumber numberWithFloat:0.0]; animation.toValue = [NSNumber numberWithFloat:10.0]; animation.repeatCount = FLT_MAX; [[view layer] addAnimation:animation forKey:@theAnimation]; [self toggleWindow:window]; } @end We've already tried removing the filter and animation before the window closes (by listening to the NSWindowWillCloseNotification), but this only seems to delay the crash a bit. Does anybody have a clue what's wrong here? Thanks in advance. Simon Haertel ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
OpenMP installation question on Leopard 10.5.6
I am developing a computationally intense application which I need to multi-process to take advantage of the 8 cpu's on my new MacPro with dual quads. I am using Leopard 10.5 OS. After giving up on NSOperationQueue for the time-being, I have chosen to use OpenMP to run my big processing loop concurrently, by adding the #pragma omp for above my main processing loop as shown here: #pragma omp for for(count = start; count end; count++) { member = [someArray objectAtIndex:count]; [member doMassiveComputations]; } - I have no problem downloading openMP for leopard. I now have a directory named xomp on my desktop. I have set the compiler buid option to use: LLVM GCC 4.2. Q: Could anyone tell me where to install this folder, and what else if anything needs to be done to use the #pragma omp for compiler directive. Thankyou, Ron Jurincie jurin...@eecs.utk.edu ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSOperationQueue bug with leopard 10.5.6?
I have a MacPro with dual quad processors, and would LOVE to be able to multiprocess a computationally intense app I have developed. My current OS is Leopard 10.5.6 I attempted to use NSOperationQueue with NSInvocationOperations and after several frustrating days found multiple websights saying NSOperationQueue has a bug with Leopard 10.5, that will be fixed with 10.6. Q1: does anyone know when 10.6 is scheduled for release? Q2: is there in fact a bug with 10.5 and NSOperationQueue? Thankyou, Ron Jurincie jurin...@eecs.utk.edu ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Drag and drop from NSCollectionView
I'm also interested in doing this. Have any of you implemented dragging from a collection view in your app, or have any theories on how to go about it? Brandon On 28-Jan-09, at 2:00 PM, Eric Gorr wrote: I am going to need to the same thing (dragging one or more items from a NSCollectionView to some place else) and I found this old thread: http://lists.apple.com/archives/cocoa-dev/2008/Oct/msg00104.html Unfortunately, no clear solution was mentioned and I was wondering if someone might be able to point me to one. 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/bwalkin%40gmail.com This email sent to bwal...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Newbie Object Sharing Question
On Jan 30, 2009, at 1:51 PM, Joseph Crawford wrote: Why don't you create a base controller that those 2 controllers subclass, that way they would inherit the functionality of reading those properties, also they would inherit the methods for getting, setting, etc. BaseController -- Controller 1 -- Controller 2 in Base controller define those properties and any methods for interacting with them in Controller 1 and Controller 2 have your Class specific stuff there, because they both inherit from BaseController you would get those properties. This is completely irrelevant to the original question. Having a common base class does not make two objects share state. On Jan 30, 2009, at 2:46 PM, Brian Slick wrote: I want both view controllers to reference MyListItemArray. You want both view controllers to reference _an instance_ of MyListItemArray. MyListItemArray is a class. So in each one I do something like: MyListItemArray *listArray = [[MyListItemArray alloc] init]; As you seem to have figured out, this is creating (allocating and initializing) a new instance of the class. This newly-created object is separate and distinct from other objects in your program, even ones created by execution of this same line of code at other times. [...] It starts to sink in that what I have done is create a *local* instance of MyListItemArray in each view controller, and what's local to ViewControllerTabA has nothing to do with what is local to ViewControllerTabB. I'm getting local copies of the array, not the source array. As near as I can tell, there is no source array, nor is there any copying going on. You have explicitly created two separate arrays from the get-go. You have then filled them out separately to have similar initial contents. It starts to occur to me that I don't actually want an instance, I want the real deal. That statement is nonsensical. There is no real deal. An instance is real. It's not some pale reflection of something else. You do want an instance. I suspect that perhaps you don't understand the difference between an object and a pointer to an object. The reason I suspect that is because the simple solution to your dilemma, the thing you're not seeing, is that you want a single instance referenced from multiple places using multiple pointers. I read through some documentation about model objects and objects in general, and stumbled upon the concept of Singletons. Some additional searching lead me to this blog post: http://cocoawithlove.com/2008/11/singletons-appdelegates-and-top-level.html ...which seems to describe exactly what I want. I reconfigured MyListItemArray as a singleton, and remapped my data source methods accordingly, and everything seemingly works perfectly. Items added in one view are displayed in the other, and so on. It works so well that I have to assume there is a catch. I can't shake the feeling that this seems more difficult than in ought to be, and generally when I feel that way there tends to be a single line of code solution that I haven't found yet. Are singletons really the only way (that doesn't involve saving to a file, I suppose) to share a model object across multiple view controllers? I think I'm missing something really fundamental. Yes, I think your are missing something fundamental -- the ability to share references to an object simply by assigning multiple pointers to point to the same thing. A singleton implementation is _one_ solution to the issue you're having, but it's not necessary, and not even recommended for something as simple as this. One stumbling block is that you have two view controllers, but evidently no central application controller. View controllers should have logic and state specific to a view and that view's relationship to the model. An application controller manages your application overall. It manages the other controllers, including your view controllers. It has the primary responsibility for managing the application-global (as opposed to, for example, document-specific) model, and for providing access to that model to other parts of the program. Since you were concentrating on the view controllers, you thought you had to create the instance of MyListItemArray in each view controller. It follows that you got one such instance for each view controller. You should have a single application controller object (an instance of some custom class). This application controller is often also the application delegate. It is also often instantiated in the main nib, where the delegate outlet of the main application object is connected to it. If your application has one central list of items, then it would be the application controller's job to create and load that model. It would hold references to the model objects in instance variables. It would provide access to
Re: Newbie Object Sharing Question
Sorry I misunderstood the question then :) Just a newbie trying to lend a hand where I can. Thanks for correcting me. Joseph Crawford On Jan 30, 2009, at 9:47 PM, Ken Thomases wrote: On Jan 30, 2009, at 1:51 PM, Joseph Crawford wrote: Why don't you create a base controller that those 2 controllers subclass, that way they would inherit the functionality of reading those properties, also they would inherit the methods for getting, setting, etc. BaseController -- Controller 1 -- Controller 2 in Base controller define those properties and any methods for interacting with them in Controller 1 and Controller 2 have your Class specific stuff there, because they both inherit from BaseController you would get those properties. This is completely irrelevant to the original question. Having a common base class does not make two objects share state. On Jan 30, 2009, at 2:46 PM, Brian Slick wrote: I want both view controllers to reference MyListItemArray. You want both view controllers to reference _an instance_ of MyListItemArray. MyListItemArray is a class. So in each one I do something like: MyListItemArray *listArray = [[MyListItemArray alloc] init]; As you seem to have figured out, this is creating (allocating and initializing) a new instance of the class. This newly-created object is separate and distinct from other objects in your program, even ones created by execution of this same line of code at other times. [...] It starts to sink in that what I have done is create a *local* instance of MyListItemArray in each view controller, and what's local to ViewControllerTabA has nothing to do with what is local to ViewControllerTabB. I'm getting local copies of the array, not the source array. As near as I can tell, there is no source array, nor is there any copying going on. You have explicitly created two separate arrays from the get-go. You have then filled them out separately to have similar initial contents. It starts to occur to me that I don't actually want an instance, I want the real deal. That statement is nonsensical. There is no real deal. An instance is real. It's not some pale reflection of something else. You do want an instance. I suspect that perhaps you don't understand the difference between an object and a pointer to an object. The reason I suspect that is because the simple solution to your dilemma, the thing you're not seeing, is that you want a single instance referenced from multiple places using multiple pointers. I read through some documentation about model objects and objects in general, and stumbled upon the concept of Singletons. Some additional searching lead me to this blog post: http://cocoawithlove.com/2008/11/singletons-appdelegates-and-top-level.html ...which seems to describe exactly what I want. I reconfigured MyListItemArray as a singleton, and remapped my data source methods accordingly, and everything seemingly works perfectly. Items added in one view are displayed in the other, and so on. It works so well that I have to assume there is a catch. I can't shake the feeling that this seems more difficult than in ought to be, and generally when I feel that way there tends to be a single line of code solution that I haven't found yet. Are singletons really the only way (that doesn't involve saving to a file, I suppose) to share a model object across multiple view controllers? I think I'm missing something really fundamental. Yes, I think your are missing something fundamental -- the ability to share references to an object simply by assigning multiple pointers to point to the same thing. A singleton implementation is _one_ solution to the issue you're having, but it's not necessary, and not even recommended for something as simple as this. One stumbling block is that you have two view controllers, but evidently no central application controller. View controllers should have logic and state specific to a view and that view's relationship to the model. An application controller manages your application overall. It manages the other controllers, including your view controllers. It has the primary responsibility for managing the application-global (as opposed to, for example, document-specific) model, and for providing access to that model to other parts of the program. Since you were concentrating on the view controllers, you thought you had to create the instance of MyListItemArray in each view controller. It follows that you got one such instance for each view controller. You should have a single application controller object (an instance of some custom class). This application controller is often also the application delegate. It is also often instantiated in the main nib, where the delegate outlet of the main application object is connected to it. If your application has one central list of
Re: NSOperationQueue bug with leopard 10.5.6?
On Jan 30, 2009, at 6:32 PM, jurin...@eecs.utk.edu wrote: I attempted to use NSOperationQueue with NSInvocationOperations and after several frustrating days found multiple websights saying NSOperationQueue has a bug with Leopard 10.5, that will be fixed with 10.6. Q1: does anyone know when 10.6 is scheduled for release? No, we don't. Q2: is there in fact a bug with 10.5 and NSOperationQueue? Yes, there is, but the likelihood that you'll trigger it is very, very low unless you have operations that are adding other operations (that are adding other operations, ...). If you don't, then there is nothing to worry about. If you do, then the workaround is to enqueue all operations in the main thread only. FWIW, I've added thousands of operations to a single queue at once in the main thread with no problems. Nick Zitzmann http://www.chronosnet.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Serial IO seems to be starving UI
On Fri, Jan 30, 2009 at 8:00 PM, Kyle Sluder kyle.slu...@gmail.com wrote: On Fri, Jan 30, 2009 at 1:21 PM, A.M. age...@themactionfaction.com wrote: What is likely happening is that the NSFileHandle processing is starving the main NSRunLoop. This happens because NSRunLoop processes non-user input before it processes user events (which seems backwards for the main run loop but is nevertheless the case). Actually it makes perfect sense. If an event causes a method to call -performSelector:withObject:afterDelay:, that selector should logically be applied before the next event is processed. That's an argument for prioritizing that one particular kind of event (assuming you meant with a 0 delay, anyway) but not an argument for prioritizing *all* non-user events. And even there, a continuous sequence of 0-delay performs should not lock the user out of your program. Seems to me that most non-user events should be interleaved in with user events based on when they occur, or at the very least given equal time. It's too easy to lock up the main event loop such that the user can no longer do anything otherwise. 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 arch...@mail-archive.com
Re: Determining Previous Front Process
On Fri, Jan 30, 2009 at 9:00 PM, Seth Willits sli...@araelium.com wrote: On Jan 30, 2009, at 5:48 PM, Matt Neuburg wrote: One possible approach: http://www.cocoabuilder.com/archive/message/cocoa/2006/7/9/167174 This'll work great. Thanks. (I've already posted my code for doing this, so check the archives.) Searching the archives is such a PITA. The search algorithm is lame. Searching for GetFrontProcess and Neuburg, for example, should *surely* show this thread at the top. Does it? No. It's not even anywhere in the top 100 results. What kind of search is that? Use the google! My rule is never to use a site's search unless it blocks google somehow. The list archives are much better searched using site:cocoabuilder.com (or site:lists.apple.com) than trying to make the built-in search functionality produce worthwhile results. 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 arch...@mail-archive.com
Re: NSOperationQueue bug with leopard 10.5.6?
On Fri, Jan 30, 2009 at 11:25 PM, Nick Zitzmann n...@chronosnet.com wrote: On Jan 30, 2009, at 6:32 PM, jurin...@eecs.utk.edu wrote: I attempted to use NSOperationQueue with NSInvocationOperations and after several frustrating days found multiple websights saying NSOperationQueue has a bug with Leopard 10.5, that will be fixed with 10.6. Q1: does anyone know when 10.6 is scheduled for release? No, we don't. The rule for nearly *any* unreleased apple product is: those who know can't say, and those who can say don't know. Q2: is there in fact a bug with 10.5 and NSOperationQueue? Yes, there is, but the likelihood that you'll trigger it is very, very low unless you have operations that are adding other operations (that are adding other operations, ...). If you don't, then there is nothing to worry about. If you do, then the workaround is to enqueue all operations in the main thread only. That is not the case. As far as I've been able to determine, the probability for causing a crash remains the same no matter where or how you add your operations, as long as there are at least two active queues in your application. All that matters for triggering the bug is the existence of multiple queues and the frequency with which you enqueue new operations. The probability is *roughly* (as in, I would not count on my estimate to be closer than an order of magnitude, if that) one in a million that any given operation will crash your program. If you're comfortable with those odds then go for it. Or if you can create only a single queue in your program and are confident that nobody else is going to create a second one in your process before Apple fixes the bug then go for it. 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 arch...@mail-archive.com
Re: Determining Previous Front Process
On Jan 31, 2009, at 12:22 AM, Michael Ash wrote: Use the google! My rule is never to use a site's search unless it blocks google somehow. The list archives are much better searched using site:cocoabuilder.com (or site:lists.apple.com) than trying to make the built-in search functionality produce worthwhile results. And for general search, when I don't like the relevancy ranking in Xcode's doc window, I find Googling with site:developer.apple.com can be very helpful. --Andy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSTextFieldCell editing text that is an attribute of the bound object
The Cocoa docs seem silent on how to achieve this. I have an NSTextFieldCell subclass that gets sent an object from bindings. The reason for sending it an object is that I want the cell to display a number of the object's attributes - which it does nicely through custom drawing. Now I need to allow editing of the text in the cell. I have overridden: editWithFrame:inView:editor:delegate:event: and its buddy: selectWithFrame:inView:editor:delegate:start:length: These bring up the text editor nicely. However, as I have an object at the cell, I need to present a string to this mechanism (the name property of my object), and similarly I need to somehow obtain the value from the editor when editing has finished. At the moment, the default behaviour has the editor coming up with placeholder text, and when editing is finished I get an KVC error, e.g.: Error setting value for key path of object MyClass: 0x1b385c0 (...) from bound object NSTableColumn: 0x1b1ab20(null)): [MyClass 0x1b385c0 setValue:forUndefinedKey:]: the entity MyClass is not key value coding-compliant for the key . Does anyone know how to wire up the editing so that I can provide initial text to the editor and prevent whoever it is from attempting to set the final value directly onto the bound object (which it clearly doesn't know how to do as it's a particular attribute of the object at the cell)? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSPredicateEditorRowTemplate and NSTokenField
I finally found a solution that seems to work. I subclassed NSTokenField: == @implementation MyTokenField - (void) notifyTarget: (id) sender { NSControl *t = [self target]; [t sendAction:nil to:t]; } - (void)textDidEndEditing:(NSNotification *)aNotification { [super textDidEndEditing:aNotification]; [self performSelector:@selector(notifyTarget:) withObject:self afterDelay:0]; } @end == -textDidEndEditing gets called after I change something, I send nil-action to the predicate editor and it finally calls my observer. The only problem is that it needs some time to build predcate, so I call it with delay. The only thing I can't understand is why do I need to call [t sendAction:nil to:t] and can't call [self sendAction:nil to:t] the second line doesn't work (observer doesn't get called). Who should be sender of the action for predicate editor? Control? Row template? On Fri, Jan 30, 2009 at 11:21 AM, Vitaly Ovchinnikov vitaly.ovchinni...@gmail.com wrote: Hello all, that's me again with my predicate editor problems :) I subclassed predicate editor's row and replaced default text editor with my NSTokenField in -templateViews. Predicates, that match my template, look like: ANY Tags IN {tag1, tag2, tag3} In -setPredicate I fill token field with tags from predicate: NSExpression *right = .; [pMyTokenField setObjectValue:[right constantValue]]; In -predicateWithSubPredicates I create predicate described above with right part from my token field. I added traces there and it builds exactly what I need. Now, the problem: I added observer to the predicate that I edit and it gets called at every change of predicate, but not for my token field template! Predicate editor has several rows, some of them are standard - numeric, text etc. If I change any of them - my observer gets called. If I edit my token field, observer doesn't get called at all. If I add some token and switch focus to another row, predicate editor calls -predicateWithSubPredicate, I build correct predicate and... nothing. Observer doesn't get called. If I press Enter after adding token - observer will be called. If I switch to some other row (not with my template) and then switch back - observer will be called. If I switch to another row with the same template and when switch back - observer will not be called. I added one more control to the row - a button. It does nothing, just takes some place. I can change my token fields and observer will not be called. But if I press this button - observer will be called immediately. I tried to override -rightExpressions method and return my list of tags, I tried to call -will/didChangeValueForKey: - nothing helped. It seems that I need to notify somebody about the change, but have no idea - how to do that? Please, help me :) P.S.: Things are a bit more complex, I have Filter objects, that hold predicates. Predicate editor is bound to the filter and my observer observes those filters, not the predicates themselves. I tell this to cut ideas about incorrect observing. Observing works perfect for any other row. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com