Re: apple remote
Il giorno 06/ott/08, alle ore 05:38, Memo Akten ha scritto: Hi All, I was wondering how straightforward it is to write an app that responds to Apple Remote events. would I get them in - (void) sendEvent:(NSEvent*)event ? I use Kahr's wrapper, too. I suggest you file a bug with Apple asking for an official Apple Remote API though. Let's hope they get enough requests to actually provide one. -- Simone Tellini http://tellini.info ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: How do I guarantee that an object is dealloced on the main thread?
IAs a side note, you always can remove statements like:[NSObject cancelPreviousPerformRequestWithTarget:self ...]; in -dealloc as they are always useless (delayed performs retain the target so if your object is dealloc'ed, there are no outstanding performs for this object). Also, if some object participates in some run loop sources, it should be somehow retained until the source is removed from the loop (or the object stops participating) - in a thread safe manner. It's especially true in a multi-threaded architecture (you have to avoid the source being triggered while the object is dealloc'ed). -- Julien On Sun, Oct 5, 2008 at 11:41 PM, Brian Stern [EMAIL PROTECTED] wrote: On Oct 5, 2008, at 4:52 PM, Jim Correia wrote: On Oct 5, 2008, at 4:43 PM, Brian Stern wrote: This is the question I really wanted to ask: I have an object X that is alloc/inited on the main thread. This object creates some NSThreads with detachNewThreadSelector:toTarget:withObject, which have object X as their target. At a later point I want to release object X and have it be dealloced on the main thread. How do I guarantee that object X is dealloced on the main thread? The problem is this: the NSThread objects retain object X. I have a stop method in object X that sets a 'cancelled' global that the thread objects inspect and they then exit when it turns true. So I send stop and then release on the main thread. The thread objects exit and eventually release object X but the last release, which causes the dealloc, can be on any thread. The real question is, why do you care what thread the -dealloc method runs on? What non-memory management side effects does your -dealloc method have which much be run on the main thread? My main reason was just cleanliness. Looking more closely at the code however, most of which I didn't write, there are some runloop sources that are removed and calls to NSObject cancelPreviousPerformRequestsWithTarge:selector:object. Most of the code that set those things up will have run on the main thread so should be cleaned up on the main thread. There's some other networking cleanup that I don't know if it's threadsafe or not. It's conceivable that I can rework the cleanup so that most of it happens in the stop method and the dealloc method is mostly empty but if there's a way to guarantee that dealloc runs on the main thread then I'd probably prefer that. I guess from your question you don't have a one sentence answer to my question. -- Brian Stern [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/jjalon%40gmail.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Cocoa and C99
In the old days I wrote: int i; float f; for( i = 0, f = 0.0; i 5; i++, f+= 3.5 ) . Now I am trying to use the C99 style: for( int i = 0, float f = 0.0; i 5; i++, f+= 3.5 ) . But I am told: parse error before 'float'. Then I tried: float f; for( int i = 0, f = 0.0; i 3; i++, f += 3.5 ) { printf(%g,f); }; But got: format '%g' expects type 'double', but argument 2 has type 'int' and: unused variable 'f' So: how to declare two variables of different type which are to be valid only in a for-loop? Tiger 10.4.11; gcc version 4.0.1 (Apple Computer, Inc. build 5363) 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 [EMAIL PROTECTED]
Re: Cocoa and C99
On Mon, Oct 6, 2008 at 12:49 AM, Gerriet M. Denkmann [EMAIL PROTECTED] wrote: In the old days I wrote: int i; float f; for( i = 0, f = 0.0; i 5; i++, f+= 3.5 ) . Now I am trying to use the C99 style: for( int i = 0, float f = 0.0; i 5; i++, f+= 3.5 ) . But I am told: parse error before 'float'. Then I tried: float f; for( int i = 0, f = 0.0; i 3; i++, f += 3.5 ) { printf(%g,f); }; But got: format '%g' expects type 'double', but argument 2 has type 'int' and: unused variable 'f' So: how to declare two variables of different type which are to be valid only in a for-loop? You can't. Either they need to be the same type, or you need to declare (and initialize) one of them outside of the loop. -- Clark S. Cox III [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Cocoa and C99
On 06 Oct 08, at 00:49, Gerriet M. Denkmann wrote: In the old days I wrote: int i; float f; for( i = 0, f = 0.0; i 5; i++, f+= 3.5 ) . Now I am trying to use the C99 style: for( int i = 0, float f = 0.0; i 5; i++, f+= 3.5 ) . But I am told: parse error before 'float'. Then I tried: float f; for( int i = 0, f = 0.0; i 3; i++, f += 3.5 ) { printf(%g,f); }; But got: format '%g' expects type 'double', but argument 2 has type 'int' and: unused variable 'f' So: how to declare two variables of different type which are to be valid only in a for-loop? You can't. The C99 spec only allows you to make a single variable declaration in a loop. If you need to declare multiple variables, do that outside the loop. (The warnings in your second example are because you declared two variables named f - one float in the outer context, and an integer in the for-loop context which shadows the float.) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Cocoa and C99
On Mon, Oct 6, 2008 at 1:00 AM, Andrew Farmer [EMAIL PROTECTED] wrote: On 06 Oct 08, at 00:49, Gerriet M. Denkmann wrote: In the old days I wrote: int i; float f; for( i = 0, f = 0.0; i 5; i++, f+= 3.5 ) . Now I am trying to use the C99 style: for( int i = 0, float f = 0.0; i 5; i++, f+= 3.5 ) . But I am told: parse error before 'float'. Then I tried: float f; for( int i = 0, f = 0.0; i 3; i++, f += 3.5 ) { printf(%g,f); }; But got: format '%g' expects type 'double', but argument 2 has type 'int' and: unused variable 'f' So: how to declare two variables of different type which are to be valid only in a for-loop? You can't. The C99 spec only allows you to make a single variable declaration in a loop. If you need to declare multiple variables, do that outside the loop. FYI: You *can* declare multiple variables in the for loop, but they all have to be the same type: for(int i = 0, j = 10; i j; ++i) { } -- Clark S. Cox III [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: window controllers and managed object contexts
Am Sa,27.09.2008 um 19:01 schrieb Daniel Child: Hmm, well that seems to be the catch. I can't get the bindings to work for the MOC. First off, to set up the table displayed in the window loaded with a separate nib file, I simply dragged in an entity object from the Librarian. That doesn't set up an MOC binding, but, following an on- line tutorial, I told it to bind the MOC parameter to File'sOwner, and immediately the setting is managedObjectContext. (Looked promising.) Now, when I init the window, I do pass in a copy of the App's own MOC (I don't have multiple MOCs). But now I get the message: not key-value coding-compliant for the value: managedObjectContext. Which makes me wonder, just how much code needs to go into setting up a separate window controller, and is it worth it (speed-wise) if your app only has four or five windows. From a tidiness standpoint, it's nice of course to separate the control portion of MVC for each window, but is all that copying and key-value coding going to be faster than simply loading one big nib? And, given that Xcode is supposed to automatically set up bindings correctly for things like Entity, why does it not work in this case? The error message seems to suggest I need to be doing something like: [myWindow setObject: theMOC forKey: @managedObjectContext but the tutorial online uses plain accessors (with the local copy of MOC as an ivar, not a property) ... and works. One difference is that their's is a doc-based CoreData app, and mine is not. But I don't see why that should matter So I'm forced to use a property to express MOC in the window controller??? You can bind the moc to the application-pbject (using the pop-up) and use the key path: delegate.managedObjetContext Cheers, Amin On Sep 26, 2008, at 3:29 PM, Kyle Sluder wrote: Erm, NSWindowController shouldn't be asking for a MOC. Perhaps whatever NSControllers you have in your nibs haven't had their managedObjectContext bindings fixed? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/negm-awad%40cocoading.de This email sent to [EMAIL PROTECTED] Amin Negm-Awad [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Cocoa and C99
Hi Gerrit You could use explicit basic blocks: static void loop(void) { int i = 5; float f = 10.0; this(); and_that(); /* new badic block */ { int i; float f = 1.0; for (i = 0; i 5; i++) { printf(%d %g\n, i, f); f += 2.0; } } i++;/* 6 */ f += 1.0; /* 11.0 */ } To improve readability and flow-control for 'break'-like constructs, I sometimes use: static void a_func(void) { do { if (cond()) break; if (other_cond()) break; result = call_me(); } while (0); } The line you tried declares two variables of type 'int', therefore the warning: for( int i = 0, f = 0.0; i 3; i++, f += 3.5 ) { printf(%g,f); }; A small remark about personal taste. I try to avoid all constructs I pointed out, even 'for (int i = 0; ) {}'. The 'do { ... } while (0);' is useful in preprocessor macros. Regards, Patrick On 06.10.2008, at 09:49, Gerriet M. Denkmann wrote: In the old days I wrote: int i; float f; for( i = 0, f = 0.0; i 5; i++, f+= 3.5 ) . Now I am trying to use the C99 style: for( int i = 0, float f = 0.0; i 5; i++, f+= 3.5 ) . But I am told: parse error before 'float'. Then I tried: float f; for( int i = 0, f = 0.0; i 3; i++, f += 3.5 ) { printf(%g,f); }; But got: format '%g' expects type 'double', but argument 2 has type 'int' and: unused variable 'f' So: how to declare two variables of different type which are to be valid only in a for-loop? Tiger 10.4.11; gcc version 4.0.1 (Apple Computer, Inc. build 5363) 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 [EMAIL PROTECTED]
Re: Crash with toolbars
Am Mo,06.10.2008 um 12:24 schrieb Felipe Monteiro de Carvalho: BOOLs are signed char. Thanks, the toolbar is working now. Does anyone know where BOOL is declared? objc.h It's a very common word, so it's hard to find ... Command double click on BOOL. -- Felipe Monteiro de Carvalho Cheers, Amin Negm-Awad [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Data Types for Extracting samples from Audio Buffer
I got the code for extracting samples from an Audio Buffer to compile and run without errors as: unsigned short *ippointer = (unsigned short *)abl-mBuffers[0].mData; unsigned short *idpointer = (unsigned short *)abl-mBuffers[1].mData; ipbuf = [[NSMutableArray alloc] init]; idbuf = [[NSMutableArray alloc] init]; NSNumber* ipsamp = [[NSNumber alloc] init]; NSNumber* idsamp = [[NSNumber alloc] init]; nsamples = abl-mBuffers[0].mDataByteSize; for (isamp = 1; nsamples; isamp++){ ipsamp = [NSNumber numberWithUnsignedShort:(unsigned short)ippointer[isamp]]; [ipbufaddObject:ipsamp]; idsamp = [NSNumber numberWithUnsignedShort:(unsigned short)idpointer[isamp]]; [idbufaddObject:idsamp]; NSLog(@ isamp %d ipsamp %d idsamp %d,isamp,ipsamp,idsamp); } 2008-10-06 07:22:45.768 Roboplasm[29177:813] isamp 108534 ipsamp 4255904 idsamp 4255904 2008-10-06 07:22:45.768 Roboplasm[29177:813] isamp 108535 ipsamp 4255904 idsamp 4255904 2008-10-06 07:22:45.768 Roboplasm[29177:813] isamp 108536 ipsamp 4255904 idsamp 4255904 2008-10-06 07:22:45.769 Roboplasm[29177:813] isamp 108537 ipsamp 4255904 idsamp 4255904 2008-10-06 07:22:45.769 Roboplasm[29177:813] isamp 108538 ipsamp 4255904 idsamp 4255904 2008-10-06 07:22:45.769 Roboplasm[29177:813] isamp 108539 ipsamp 4255904 idsamp 4255904 2008-10-06 07:22:45.770 Roboplasm[29177:813] isamp 108540 ipsamp 4255904 idsamp 4255904 Program received signal: “EXC_BAD_ACCESS”. 2008-10-06 07:22:45.770 Roboplasm[29177:813] isamp 108541 ipsamp 4255904 idsamp 4255904 2008-10-06 07:22:45.770 Roboplasm[29177:813] isamp 108542 ipsamp 4255904 idsamp 4255904 2008-10-06 07:22:45.771 Roboplasm[29177:813] isamp 108543 ipsamp 4255904 idsamp 4255904 on Line: ipsamp = [NSNumber numberWithUnsignedShort:(unsigned short)ippointer[isamp]]; nsamples is 213120 so the loop bombed before reaching the end of the buffers I'm suspicious that values like 4255904 are inappropriate for 16 bit audio samples. How can I determine what is going wrong here. Thanks, Joseph On Oct 5, 2008, at 2:32 PM, Jacob Lukas wrote: On Oct 5, 2008, at 09:47, Joseph Ayers wrote: I'm trying to extract the audio samples from an audio buffer returned from the QuickTime Audio extraction API into a NSMutableArray of NSNumbers. snip The code I am using is: AudioBufferList* abl; NSMutableArray * ipbuf; NSMutableArray * idbuf; NSNumber* ipsamp; NSNumber* idsamp; unsigned short *ippointer = (unsigned short *)abl- mBuffers[0].mData; unsigned short *idpointer = (unsigned short *)abl- mBuffers[1].mData; for (isamp = 1; abl-mBuffers[0].mDataByteSize;isamp++){ [ipsamp initWithUnsignedShort:(unsigned short)ippointer[isamp]]; [ipbuf insertObject:ipsamp atIndex:isamp]; [idsamp initWithUnsignedShort:(unsigned short)idpointer[isamp]]; [idbuf insertObject:idsamp atIndex:isamp]; } The program crashes on the line [ipsamp initWithUnsignedShort:(unsigned short)ippointer[isamp]]; with Program received signal: “EXC_BAD_ACCESS”. Try this on for size: // Edited in Mail -- not guaranteed to even compile // Completely untested AudioBufferList* abl = /* fetch valid AudioBufferList */; NSMutableArray * ipbuf = [NSMutableArray array]; NSMutableArray * idbuf = [NSMutableArray array]; NSNumber* ipsamp = nil; // not strictly necessary NSNumber* idsamp = nil; unsigned short *ippointer = (unsigned short *)abl-mBuffers[0].mData; unsigned short *idpointer = (unsigned short *)abl-mBuffers[1].mData; // Skipping first sample // where is isamp declared? for (isamp = 1; isamp abl-mBuffers[0].mDataByteSize; isamp++){ ipsamp = [NSNumber numberWithUnsignedShort:(unsigned short)ippointer[isamp]]; [ipbuf addObject:ipsamp]; idsamp = [NSNumber numberWithUnsignedShort:(unsigned short)idpointer[isamp]]; [idbuf addObject:idsamp]; } -Jacob Joseph Ayers, Professor Department of Biology and Marine Science Center Northeastern University East Point, Nahant, MA 01908 Phone (781) 581-7370 x309(office), x335(lab) Boston: 444 Richards Hall (617) 373-4044 Cellular (617) 755-7523, FAX: (781) 581-6076 eMail: [EMAIL PROTECTED] http://www.neurotechnology.neu.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 [EMAIL PROTECTED]
Re: Data Types for Extracting samples from Audio Buffer
On 6 Oct 2008, at 10:27 pm, Joseph Ayers wrote: I got the code for extracting samples from an Audio Buffer to compile and run without errors as: unsigned short *ippointer = (unsigned short *)abl- mBuffers[0].mData; unsigned short *idpointer = (unsigned short *)abl- mBuffers[1].mData; ipbuf = [[NSMutableArray alloc] init]; idbuf = [[NSMutableArray alloc] init]; NSNumber* ipsamp = [[NSNumber alloc] init]; NSNumber* idsamp = [[NSNumber alloc] init]; The above two lines just leak two NSNumber objects, otherwise contributing nothing useful. This isn't the problem you're having though, so let's move on... nsamples = abl-mBuffers[0].mDataByteSize; for (isamp = 1; nsamples; isamp++){ What terminates this loop? Nothing that I can see - 'nsamples' isn't a statement that does anything, since its value isn't changed within the loop nor compared to anything. ipsamp = [NSNumber numberWithUnsignedShort:(unsigned short)ippointer[isamp]]; [ipbufaddObject:ipsamp]; idsamp = [NSNumber numberWithUnsignedShort:(unsigned short)idpointer[isamp]]; [idbufaddObject:idsamp]; Are you *really* sure you want to allocate an entire object per sample? While not directly a cause of the problem, this could place heavy demands on your memory usage requirements. But OK, optimize later, moving on... NSLog(@ isamp %d ipsamp %d idsamp %d,isamp,ipsamp,idsamp); } 2008-10-06 07:22:45.768 Roboplasm[29177:813] isamp 108534 ipsamp 4255904 idsamp 4255904 You are logging NSNumber object references using %d, which is for an integer. Thus it's taking the address of the object and attempting to display it as an integer. Hence the value logged is not the contents of the number but its address. See: http://developer.apple.com/documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html#/ /apple_ref/doc/uid/TP40004265-SW1 You need to use %@ which will log the result of the object's - description method, which for an NSNumber includes its contained value. 2008-10-06 07:22:45.770 Roboplasm[29177:813] isamp 108540 ipsamp 4255904 idsamp 4255904 Program received signal: “EXC_BAD_ACCESS”. I suspect this is occurring because isamp is being incremented beyond the last sample value in the input array, because you have no loop termination condition. hth, Graham___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Data Types for Extracting samples from Audio Buffer
On 6 Oct 2008, at 10:27 pm, Joseph Ayers wrote: unsigned short *ippointer = (unsigned short *)abl- mBuffers[0].mData; unsigned short *idpointer = (unsigned short *)abl- mBuffers[1].mData; [] nsamples = abl-mBuffers[0].mDataByteSize; for (isamp = 1; nsamples; isamp++){ ipsamp = [NSNumber numberWithUnsignedShort:(unsigned short)ippointer[isamp]]; [ipbufaddObject:ipsamp]; idsamp = [NSNumber numberWithUnsignedShort:(unsigned short)idpointer[isamp]]; [idbufaddObject:idsamp]; Another problem I just noticed after posting my first reply. You cast your buffers to unsigned short*. That's OK, presumably each sample is 16 bits. But to me, the field mDataByteSize implies that the buffer size is specified in bytes, not 16-bit words, so the number of samples is this value / 2. If your loop were correct, it would look something like: for( sample = 0; sample nSamples; ++sample ) { sampleValue = ipPointer[sample]; } Because ipPointer is already declared as a pointer unsigned short, the array subscript will access each sample (2 bytes) at a time, even when incremented by only one. That's a Good Thing™, but makes the proper calculation of the number of *samples* critical. By forgetting to do that, you've overrun the end of your array at about the half-way mark, as you would expect. That's why you're getting the bad access error. Graham___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Should not use mogenerator in Mac OS 10.5+ ?
I hacked the mogenerator header template file to emit property declarations for Core Data-generated accessors, and changed the source template files to not emit any code for accessors. So I get the convenience of mogenerator together with the supposedly more efficient Core Data accessors. I found the template files quite easy to read and to change to my own specification. i. On Oct 5, 2008, at 00:11, Jerry Krinock wrote: When developing NSManagedObjects for Mac OS 10.4, after about 25 trips to Xcode's menu Design Data Model Copy Method -tions to Clipboard, my wrist got sore and I started using mogenerator [1]. Now, developing for Mac OS X 10.5+, I read that On Mac OS X v10.5, Core Data dynamically generates efficient public and primitive get and set attribute accessor methods and relationship accessor methods for managed object classes. So, I don't ^need^ mogenerator, although I still may want to use it in order to get type checking and generate code needed to avoid compiler warnings. And although the dynamically generated methods are efficient, I assumed that they are still not as efficient as a hard-coded method. But then, further down, in two highlighted dire warning boxes, I read ... Important: You are strongly encouraged to use dynamic properties (that is, properties whose implementation you specify as @dynamic) instead of creating custom implementations for standard or primitive accessor methods. But I don't see any reasons given. Paradoxically these boxes seemed to be followed by instructions detailing how to do what was just recommended against doing [3], including code examples of standard accessors which look like what I get out of mogenerator. My questions: Am I being strongly encouraged to ^not^ use mogenerator in a 10.5+ app? Why? Thanks, Jerry Krinock [1] http://rentzsch.com/code/mogenerator_v1.5 (Be sure to use the installer, don't just build the tool.) [2] In Core Data Programming Guide Managed Object Accessor Methods http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdAccessorMethods.html#/ /apple_ref/doc/uid/TP40002154 [3] This Well, if you insist on hanging yourself.. idiom is familiar to me in reading Apple documentation. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/in.cocoadev %40iriz.net This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Crash with toolbars
On 6 Oct 2008, at 9:24 pm, Felipe Monteiro de Carvalho wrote: BOOLs are signed char. Thanks, the toolbar is working now. Does anyone know where BOOL is declared? It's a very common word, so it's hard to find ... To find out where any type or any symbol at all is defined, command- double-click it. This is a shortcut for the right-click Jump To Definition menu command. Doing this with BOOL reveals it in objc.h hth, Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Crash with toolbars
BOOLs are signed char. Thanks, the toolbar is working now. Does anyone know where BOOL is declared? It's a very common word, so it's hard to find ... -- Felipe Monteiro de Carvalho ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Data Types for Extracting samples from Audio Buffer
Wow. Many thanks, That certainly helped. With: unsigned short *ippointer = (unsigned short *)abl-mBuffers[0].mData; unsigned short *idpointer = (unsigned short *)abl-mBuffers[1].mData; ipbuf = [[NSMutableArray alloc] init]; idbuf = [[NSMutableArray alloc] init]; NSNumber* ipsamp = [[NSNumber alloc] init]; NSNumber* idsamp = [[NSNumber alloc] init]; nsamples = (abl-mBuffers[0].mDataByteSize)/2; for (isamp = 0; isampnsamples; ++isamp){ ipsamp = [NSNumber numberWithUnsignedShort:(unsigned short)ippointer[isamp]]; [ipbufaddObject:ipsamp]; idsamp = [NSNumber numberWithUnsignedShort:(unsigned short)idpointer[isamp]]; [idbufaddObject:idsamp]; if (isamp 100) { NSLog(@ isamp %d ipsamp %@ idsamp %@,isamp,ipsamp,idsamp); } } I get 2008-10-06 08:39:05.177 Roboplasm[32065:813] isamp 0 ipsamp 0 idsamp 0 2008-10-06 08:39:05.178 Roboplasm[32065:813] isamp 1 ipsamp 15196 idsamp 15214 2008-10-06 08:39:05.178 Roboplasm[32065:813] isamp 2 ipsamp 0 idsamp 0 2008-10-06 08:39:05.178 Roboplasm[32065:813] isamp 3 ipsamp 15218 idsamp 15241 2008-10-06 08:39:05.179 Roboplasm[32065:813] isamp 4 ipsamp 0 idsamp 0 2008-10-06 08:39:05.179 Roboplasm[32065:813] isamp 5 ipsamp 15250 idsamp 15273 2008-10-06 08:39:05.179 Roboplasm[32065:813] isamp 6 ipsamp 0 idsamp 0 2008-10-06 08:39:05.180 Roboplasm[32065:813] isamp 7 ipsamp 15248 idsamp 15327 2008-10-06 08:39:05.180 Roboplasm[32065:813] isamp 8 ipsamp 0 idsamp 0 2008-10-06 08:39:05.180 Roboplasm[32065:813] isamp 9 ipsamp 15192 idsamp 15356 2008-10-06 08:39:05.180 Roboplasm[32065:813] isamp 10 ipsamp 0 idsamp 0 2008-10-06 08:39:05.181 Roboplasm[32065:813] isamp 11 ipsamp 15128 idsamp 15344 2008-10-06 08:39:05.181 Roboplasm[32065:813] isamp 12 ipsamp 0 idsamp 0 2008-10-06 08:39:05.181 Roboplasm[32065:813] isamp 13 ipsamp 15122 idsamp 15341 2008-10-06 08:39:05.182 Roboplasm[32065:813] isamp 14 ipsamp 0 idsamp 0 2008-10-06 08:39:05.182 Roboplasm[32065:813] isamp 15 ipsamp 15140 idsamp 15370 2008-10-06 08:39:05.182 Roboplasm[32065:813] isamp 16 ipsamp 0 idsamp 32768 2008-10-06 08:39:05.183 Roboplasm[32065:813] isamp 17 ipsamp 15164 idsamp 15387 2008-10-06 08:39:05.183 Roboplasm[32065:813] isamp 18 ipsamp 0 idsamp 0 2008-10-06 08:39:05.183 Roboplasm[32065:813] isamp 19 ipsamp 15214 idsamp 15375 2008-10-06 08:39:05.185 Roboplasm[32065:813] isamp 20 ipsamp 0 idsamp 0 2008-10-06 08:39:05.185 Roboplasm[32065:813] isamp 21 ipsamp 15244 idsamp 15334 2008-10-06 08:39:05.186 Roboplasm[32065:813] isamp 22 ipsamp 0 idsamp 0 2008-10-06 08:39:05.201 Roboplasm[32065:813] isamp 23 ipsamp 15237 idsamp 15316 2008-10-06 08:39:05.203 Roboplasm[32065:813] isamp 24 ipsamp 0 idsamp 0 2008-10-06 08:39:05.210 Roboplasm[32065:813] isamp 25 ipsamp 15180 idsamp 15346 2008-10-06 08:39:05.211 Roboplasm[32065:813] isamp 26 ipsamp 0 idsamp 32768 2008-10-06 08:39:05.211 Roboplasm[32065:813] isamp 27 ipsamp 15128 idsamp 15370 2008-10-06 08:39:05.212 Roboplasm[32065:813] isamp 28 ipsamp 0 idsamp 0 2008-10-06 08:39:05.214 Roboplasm[32065:813] isamp 29 ipsamp 15130 idsamp 15382 2008-10-06 08:39:05.214 Roboplasm[32065:813] isamp 30 ipsamp 0 idsamp 0 2008-10-06 08:39:05.215 Roboplasm[32065:813] isamp 31 ipsamp 15192 idsamp 15390 2008-10-06 08:39:05.218 Roboplasm[32065:813] isamp 32 ipsamp 0 idsamp 32768 2008-10-06 08:39:05.219 Roboplasm[32065:813] isamp 33 ipsamp 15258 idsamp 15389 2008-10-06 08:39:05.221 Roboplasm[32065:813] isamp 34 ipsamp 0 idsamp 32768 2008-10-06 08:39:05.222 Roboplasm[32065:813] isamp 35 ipsamp 15292 idsamp 15381 2008-10-06 08:39:05.223 Roboplasm[32065:813] isamp 36 ipsamp 0 idsamp 0 2008-10-06 08:39:05.224 Roboplasm[32065:813] isamp 37 ipsamp 15304 idsamp 15380 2008-10-06 08:39:05.224 Roboplasm[32065:813] isamp 38 ipsamp 0 idsamp 32768 2008-10-06 08:39:05.228 Roboplasm[32065:813] isamp 39 ipsamp 15300 idsamp 15383 2008-10-06 08:39:05.229 Roboplasm[32065:813] isamp 40 ipsamp 0 idsamp 0 2008-10-06 08:39:05.229 Roboplasm[32065:813] isamp 41 ipsamp 15293 idsamp 15375 2008-10-06 08:39:05.230 Roboplasm[32065:813] isamp 42 ipsamp 0 idsamp 32768 2008-10-06 08:39:05.231 Roboplasm[32065:813] isamp 43 ipsamp 15301 idsamp 15361 2008-10-06 08:39:05.231 Roboplasm[32065:813] isamp 44 ipsamp 0 idsamp 0 2008-10-06 08:39:05.232 Roboplasm[32065:813] isamp 45 ipsamp 15339 idsamp 15362 2008-10-06 08:39:05.238 Roboplasm[32065:813] isamp 46 ipsamp 32768 idsamp 0 2008-10-06 08:39:05.239 Roboplasm[32065:813] isamp 47 ipsamp 15373 idsamp 15368 2008-10-06 08:39:05.240 Roboplasm[32065:813] isamp 48 ipsamp 0 idsamp 32768 2008-10-06 08:39:05.240 Roboplasm[32065:813] isamp 49 ipsamp 15383 idsamp 15366 2008-10-06 08:39:05.241 Roboplasm[32065:813] isamp 50 ipsamp 32768 idsamp 32768 2008-10-06 08:39:05.242 Roboplasm[32065:813] isamp 51 ipsamp 15377 idsamp
Master-Detail Interface Examples
I'm looking for examples of well-designed Master-Detail interfaces. I have tried several different layouts for the details and haven't been satisfied with any of them. In looking at the layout, I think it has to do with the table view being rather wide and not finding a comfortable place to align the detail interface. I was considering a double-click for details approach, but I'm not sure if there's a design precedent for such a setup. I'm not averse to doing something new, but I don't want to do something the user is totally not expecting. Screenshots or links would be greatly appreciated. Thanks, Jamie ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Data Types for Extracting samples from Audio Buffer
On 6 Oct 2008, at 11:45 pm, Joseph Ayers wrote: Note the occurrence of samples with the value of 0 alternating with samples that are reasonable. However, this alternation is not rigid as the 0's can be substituted with reasonable numbers. Any idea what's going on here? Are you *sure* that the samples are 16 bit values? Maybe they're 32- bit values, and what you're seeing is the 2 high bytes of each sample being set to zero, but not always. Where has the data come from? If they are 32-bit, make your pointers unsigned long* and divide the bytecount by 4. Also use [NSNumber numberWithUnsignedLong:]; hth, Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Data Types for Extracting samples from Audio Buffer
That doesn't seem to be it. The audio extraction interface http://developer.apple.com/quicktime/audioextraction.html returns: 2008-10-06 09:08:03.106 Roboplasm[33253:813]format flags= 41 2008-10-06 09:08:03.106 Roboplasm[33253:813]sample rate = 48000.00 2008-10-06 09:08:03.107 Roboplasm[33253:813]bytes/packet = 4 2008-10-06 09:08:03.108 Roboplasm[33253:813]frames/packe = 1 2008-10-06 09:08:03.108 Roboplasm[33253:813]bytes/frame = 4 2008-10-06 09:08:03.109 Roboplasm[33253:813]channels/frame = 2 2008-10-06 09:08:03.109 Roboplasm[33253:813]bits/channel = 32 2008-10-06 09:08:03.109 Roboplasm[33253:813]format flags= 41 2008-10-06 09:08:03.110 Roboplasm[33253:813]sample rate = 48000.00 2008-10-06 09:08:03.110 Roboplasm[33253:813]bytes/packet = 4 2008-10-06 09:08:03.110 Roboplasm[33253:813]frames/packet= 1 2008-10-06 09:08:03.110 Roboplasm[33253:813]bytes/frame = 4 2008-10-06 09:08:03.111 Roboplasm[33253:813]channels/frame = 2 2008-10-06 09:08:03.111 Roboplasm[33253:813]bits/channel = 32 Indicating that there are two bytes per channel. Results from unsigned long *ippointer = (unsigned long *)abl-mBuffers[0].mData; unsigned long *idpointer = (unsigned long *)abl-mBuffers[1].mData; ipbuf = [[NSMutableArray alloc] init]; idbuf = [[NSMutableArray alloc] init]; NSNumber* ipsamp = [[NSNumber alloc] init]; NSNumber* idsamp = [[NSNumber alloc] init]; nsamples = (abl-mBuffers[0].mDataByteSize)/4; for (isamp = 0; isampnsamples; ++isamp){ ipsamp = [NSNumber numberWithUnsignedLong:(unsigned long)ippointer[isamp]]; [ipbufaddObject:ipsamp]; idsamp = [NSNumber numberWithUnsignedLong:(unsigned long)idpointer[isamp]]; [idbufaddObject:idsamp]; if (isamp 100) { NSLog(@ isamp %d ipsamp %@ idsamp %@,isamp,ipsamp,idsamp); } } Are: 2008-10-06 09:08:03.150 Roboplasm[33253:813] isamp 0 ipsamp 995885056 idsamp 997064704 2008-10-06 09:08:03.152 Roboplasm[33253:813] isamp 1 ipsamp 997326848 idsamp 998834176 2008-10-06 09:08:03.152 Roboplasm[33253:813] isamp 2 ipsamp 999424000 idsamp 1000931328 2008-10-06 09:08:03.152 Roboplasm[33253:813] isamp 3 ipsamp 999292928 idsamp 1004470272 2008-10-06 09:08:03.153 Roboplasm[33253:813] isamp 4 ipsamp 995622912 idsamp 1006370816 2008-10-06 09:08:03.153 Roboplasm[33253:813] isamp 5 ipsamp 991428608 idsamp 1005584384 2008-10-06 09:08:03.153 Roboplasm[33253:813] isamp 6 ipsamp 991035392 idsamp 1005387776 2008-10-06 09:08:03.154 Roboplasm[33253:813] isamp 7 ipsamp 992215040 idsamp 1007288320 2008-10-06 09:08:03.154 Roboplasm[33253:813] isamp 8 ipsamp 993787904 idsamp 1008435200 2008-10-06 09:08:03.154 Roboplasm[33253:813] isamp 9 ipsamp 997064704 idsamp 1007616000 2008-10-06 09:08:03.154 Roboplasm[33253:813] isamp 10 ipsamp 999030784 idsamp 1004929024 2008-10-06 09:08:03.155 Roboplasm[33253:813] isamp 11 ipsamp 998572032 idsamp 1003749376 2008-10-06 09:08:03.155 Roboplasm[33253:813] isamp 12 ipsamp 994836480 idsamp 1005715456 2008-10-06 09:08:03.158 Roboplasm[33253:813] isamp 13 ipsamp 991428608 idsamp 1007321088 2008-10-06 09:08:03.158 Roboplasm[33253:813] isamp 14 ipsamp 991559680 idsamp 1008074752 2008-10-06 09:08:03.158 Roboplasm[33253:813] isamp 15 ipsamp 995622912 idsamp 1008599040 2008-10-06 09:08:03.159 Roboplasm[33253:813] isamp 16 ipsamp 48288 idsamp 1008566272 2008-10-06 09:08:03.159 Roboplasm[33253:813] isamp 17 ipsamp 1002176512 idsamp 1008041984 2008-10-06 09:08:03.159 Roboplasm[33253:813] isamp 18 ipsamp 1002962944 idsamp 1007943680 2008-10-06 09:08:03.160 Roboplasm[33253:813] isamp 19 ipsamp 1002700800 idsamp 1008173056 2008-10-06 09:08:03.160 Roboplasm[33253:813] isamp 20 ipsamp 1002242048 idsamp 1007616000 2008-10-06 09:08:03.160 Roboplasm[33253:813] isamp 21 ipsamp 1002766336 idsamp 1006731264 2008-10-06 09:08:03.160 Roboplasm[33253:813] isamp 22 ipsamp 1005256704 idsamp 1006764032 2008-10-06 09:08:03.161 Roboplasm[33253:813] isamp 23 ipsamp 1007517696 idsamp 1007157248 2008-10-06 09:08:03.161 Roboplasm[33253:813] isamp 24 ipsamp 1008140288 idsamp 1007058944 2008-10-06 09:08:03.162 Roboplasm[33253:813] isamp 25 ipsamp 1007779840 idsamp 1007321088 2008-10-06 09:08:03.162 Roboplasm[33253:813] isamp 26 ipsamp 1007779840 idsamp 1008500736 2008-10-06 09:08:03.163 Roboplasm[33253:813] isamp 27 ipsamp 1008795648 idsamp 1008893952 2008-10-06 09:08:03.163 Roboplasm[33253:813] isamp 28 ipsamp 1009385472 idsamp 1007779840 2008-10-06 09:08:03.163 Roboplasm[33253:813] isamp 29 ipsamp 1008402432 idsamp 1006665728 2008-10-06 09:08:03.163 Roboplasm[33253:813] isamp 30 ipsamp 1006993408 idsamp 1006567424 2008-10-06 09:08:03.164 Roboplasm[33253:813] isamp 31 ipsamp 1006862336 idsamp 1006796800 2008-10-06 09:08:03.164
Re: Data Types for Extracting samples from Audio Buffer
On 7 Oct 2008, at 12:12 am, Joseph Ayers wrote: 2008-10-06 09:08:03.109 Roboplasm[33253:813]format flags= 41 2008-10-06 09:08:03.110 Roboplasm[33253:813]sample rate = 48000.00 2008-10-06 09:08:03.110 Roboplasm[33253:813]bytes/packet = 4 2008-10-06 09:08:03.110 Roboplasm[33253:813]frames/packet= 1 2008-10-06 09:08:03.110 Roboplasm[33253:813]bytes/frame = 4 2008-10-06 09:08:03.111 Roboplasm[33253:813]channels/frame = 2 2008-10-06 09:08:03.111 Roboplasm[33253:813]bits/channel = 32 Indicating that there are two bytes per channel. No, I read this as there are 4 bytes (32-bits per sample) per channel. From the Audio Extraction Docs: In audio data a frame is one sample across all channels. If the ASBD describes non-interleaved audio, the byte and frame count fields describe one channel (mBytesPerPacket would be 2 for non-interleaved stereo 16-bit PCM). For interleaved audio, the fields describe the set of n channels (mBytesPerPacket would be 4 for interleaved stereo 16- bit PCM). In uncompressed audio, a packet is one frame, (mFramesPerPacket == 1). To be honest this paragraph is less than illuminating, since it states if the audio is interleaved it is interpreted one way, if not, then in another way, but doesn't say whether you can tell if it is interleaved or not - presumably you can using the format flags. Also, 32-bit floating point samples are another possibility, so you need to examine the flags to find out exactly what it is you've got and then use the remainder of the information to determine how to turn that into individual samples. I notice that you can also set fields in an ASBD then call MovieAudioExtractionSetProperty followed by MovieAudioExtractionFillBuffer to convert to your chosen format. So if you always do want 16-bit samples, then you need to carry out this conversion step. Note: Don't take this as gospel, I've never done this, I'm just trying to make sense of the docs. hth, Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: How do I guarantee that an object is dealloced on the main thread?
Ok, I've fixed this as recommended. It really wasn't too difficult to move all the interesting bits of dealloc to the stop method, and to zero out all the instance variables after they're released so this can be safely called more than once. This way I can call stop from the main thread and not worry about what thread dealloc will be called on. I didn't write this code, it's a freely available server implementation, and it wasn't designed to be dealloced. It is intended to just run until the app terminates, but that doesn't meet my needs. Thanks for the input. Brian On Oct 5, 2008, at 6:08 PM, Jim Correia wrote: On Oct 5, 2008, at 5:41 PM, Brian Stern wrote: My main reason was just cleanliness. Looking more closely at the code however, most of which I didn't write, there are some runloop sources that are removed and calls to NSObject cancelPreviousPerformRequestsWithTarge:selector:object. Most of the code that set those things up will have run on the main thread so should be cleaned up on the main thread. There's some other networking cleanup that I don't know if it's threadsafe or not. It's conceivable that I can rework the cleanup so that most of it happens in the stop method and the dealloc method is mostly empty That's probably the preferable solution to this problem, even if it is more work up front. I guess from your question you don't have a one sentence answer to my question. Using classic memory management, your object will be deallocated when its last owner releases it. If this object has been shared amongst threads, the it will be deallocated on the last thread which releases it. Under garbage collection, you are encouraged not to implement a - finalize method. If you do implement one, there is no guarantee about the order it will be called in, if it will be called at all, or what thread it will be invoked on. In your -stop method, you know you are done with the object, so doing your cleanup there (on the main thread, if necessary) seems like an appropriate solution. - Jim ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Data Types for Extracting samples from Audio Buffer
On 7 Oct 2008, at 12:34 am, Graham Cox wrote: 2008-10-06 09:08:03.109 Roboplasm[33253:813]format flags= 41 [] 2008-10-06 09:08:03.111 Roboplasm[33253:813]bits/channel = 32 format flags = 41 = 0x29 = 0b101001 flags: enum { kAudioFormatFlagIsFloat = (1L 0), // -- 1 kAudioFormatFlagIsBigEndian = (1L 1), // -- 0 kAudioFormatFlagIsSignedInteger = (1L 2), // -- 0 kAudioFormatFlagIsPacked= (1L 3), // -- 1 kAudioFormatFlagIsAlignedHigh = (1L 4), // -- 0 kAudioFormatFlagIsNonInterleaved= (1L 5), // -- 1 kAudioFormatFlagIsNonMixable= (1L 6), kAudioFormatFlagsAreAllClear= (1L 31) }; Thus we have: kAudioFormatFlagIsFloat | kAudioFormatFlagIsPacked | kAudioFormatFlagIsNonInterleaved; so you have 32 bit float values for each sample. Divide the byte count by 4 and use [NSNumber numberWithFloat:], and use a float* pointer type. Note - the docs also state that this is the default format you get from the audio extraction API. hth, Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Data Types for Extracting samples from Audio Buffer: Resolved
Graham: Bingo. With float *ippointer = (float *)abl-mBuffers[0].mData; float *idpointer = (float *)abl-mBuffers[1].mData; ipbuf = [[NSMutableArray alloc] init]; idbuf = [[NSMutableArray alloc] init]; NSNumber* ipsamp = [[NSNumber alloc] init]; NSNumber* idsamp = [[NSNumber alloc] init]; nsamples = (abl-mBuffers[0].mDataByteSize)/4; for (isamp = 0; isampnsamples; ++isamp){ ipsamp = [NSNumber numberWithFloat:(float)ippointer[isamp]]; [ipbufaddObject:ipsamp]; idsamp = [NSNumber numberWithFloat:(float)idpointer[isamp]]; [idbufaddObject:idsamp]; if (isamp 100) { NSLog(@ isamp %d ipsamp %@ idsamp %@,isamp,ipsamp,idsamp); } } I get: 2008-10-06 10:43:07.702 Roboplasm[1898:813] isamp 0 ipsamp 0.003356934 idsamp 0.003631592 2008-10-06 10:43:07.702 Roboplasm[1898:813] isamp 1 ipsamp 0.003692627 idsamp 0.004180908 2008-10-06 10:43:07.702 Roboplasm[1898:813] isamp 2 ipsamp 0.004455566 idsamp 0.005157471 2008-10-06 10:43:07.703 Roboplasm[1898:813] isamp 3 ipsamp 0.004394531 idsamp 0.00680542 2008-10-06 10:43:07.703 Roboplasm[1898:813] isamp 4 ipsamp 0.003295898 idsamp 0.00769043 2008-10-06 10:43:07.703 Roboplasm[1898:813] isamp 5 ipsamp 0.002319336 idsamp 0.007324219 2008-10-06 10:43:07.704 Roboplasm[1898:813] isamp 6 ipsamp 0.002227783 idsamp 0.007232666 2008-10-06 10:43:07.705 Roboplasm[1898:813] isamp 7 ipsamp 0.002502441 idsamp 0.008422852 2008-10-06 10:43:07.706 Roboplasm[1898:813] isamp 8 ipsamp 0.002868652 idsamp 0.009490967 2008-10-06 10:43:07.706 Roboplasm[1898:813] isamp 9 ipsamp 0.003631592 idsamp 0.008728027 2008-10-06 10:43:07.706 Roboplasm[1898:813] isamp 10 ipsamp 0.004272461 idsamp 0.007019043 2008-10-06 10:43:07.707 Roboplasm[1898:813] isamp 11 ipsamp 0.004058838 idsamp 0.006469727 2008-10-06 10:43:07.707 Roboplasm[1898:813] isamp 12 ipsamp 0.003112793 idsamp 0.007385254 2008-10-06 10:43:07.707 Roboplasm[1898:813] isamp 13 ipsamp 0.002319336 idsamp 0.008453369 2008-10-06 10:43:07.707 Roboplasm[1898:813] isamp 14 ipsamp 0.002349854 idsamp 0.009155273 2008-10-06 10:43:07.708 Roboplasm[1898:813] isamp 15 ipsamp 0.003295898 idsamp 0.009643555 2008-10-06 10:43:07.708 Roboplasm[1898:813] isamp 16 ipsamp 0.004699707 idsamp 0.009613037 2008-10-06 10:43:07.708 Roboplasm[1898:813] isamp 17 ipsamp 0.005737305 idsamp 0.009124756 2008-10-06 10:43:07.709 Roboplasm[1898:813] isamp 18 ipsamp 0.006103516 idsamp 0.009033203 2008-10-06 10:43:07.709 Roboplasm[1898:813] isamp 19 ipsamp 0.005981445 idsamp 0.009246826 2008-10-06 10:43:07.711 Roboplasm[1898:813] isamp 20 ipsamp 0.005767822 idsamp 0.008728027 2008-10-06 10:43:07.711 Roboplasm[1898:813] isamp 21 ipsamp 0.006011963 idsamp 0.007904053 2008-10-06 10:43:07.712 Roboplasm[1898:813] isamp 22 ipsamp 0.007171631 idsamp 0.00793457 2008-10-06 10:43:07.713 Roboplasm[1898:813] isamp 23 ipsamp 0.008636475 idsamp 0.008300781 2008-10-06 10:43:07.714 Roboplasm[1898:813] isamp 24 ipsamp 0.009216309 idsamp 0.008209229 2008-10-06 10:43:07.715 Roboplasm[1898:813] isamp 25 ipsamp 0.008880615 idsamp 0.008453369 2008-10-06 10:43:07.715 Roboplasm[1898:813] isamp 26 ipsamp 0.008880615 idsamp 0.009552002 2008-10-06 10:43:07.716 Roboplasm[1898:813] isamp 27 ipsamp 0.00982666 idsamp 0.009918213 2008-10-06 10:43:07.717 Roboplasm[1898:813] isamp 28 ipsamp 0.01037598 idsamp 0.008880615 2008-10-06 10:43:07.718 Roboplasm[1898:813] isamp 29 ipsamp 0.009460449 idsamp 0.007843018 2008-10-06 10:43:07.718 Roboplasm[1898:813] isamp 30 ipsamp 0.008148193 idsamp 0.007781982 2008-10-06 10:43:07.719 Roboplasm[1898:813] isamp 31 ipsamp 0.008026123 idsamp 0.007965088 2008-10-06 10:43:07.720 Roboplasm[1898:813] isamp 32 ipsamp 0.00869751 idsamp 0.007965088 2008-10-06 10:43:07.721 Roboplasm[1898:813] isamp 33 ipsamp 0.009124756 idsamp 0.008392334 2008-10-06 10:43:07.722 Roboplasm[1898:813] isamp 34 ipsamp 0.009185791 idsamp 0.009399414 2008-10-06 10:43:07.722 Roboplasm[1898:813] isamp 35 ipsamp 0.00869751 idsamp 0.01043701 2008-10-06 10:43:07.723 Roboplasm[1898:813] isamp 36 ipsamp 0.0078125 idsamp 0.01104736 2008-10-06 10:43:07.724 Roboplasm[1898:813] isamp 37 ipsamp 0.0078125 idsamp 0.01086426 2008-10-06 10:43:07.725 Roboplasm[1898:813] isamp 38 ipsamp 0.009277344 idsamp 0.009918213 2008-10-06 10:43:07.725 Roboplasm[1898:813] isamp 39 ipsamp 0.01062012 idsamp 0.008911133 2008-10-06 10:43:07.726 Roboplasm[1898:813] isamp 40 ipsamp 0.01055908 idsamp 0.008453369 2008-10-06 10:43:07.727 Roboplasm[1898:813] isamp 41 ipsamp 0.01055908 idsamp 0.008117676 2008-10-06 10:43:07.728 Roboplasm[1898:813] isamp 42 ipsamp 0.01177979 idsamp 0.007476807 2008-10-06 10:43:07.728 Roboplasm[1898:813] isamp 43 ipsamp 0.01272583 idsamp 0.007171631 2008-10-06 10:43:07.729 Roboplasm[1898:813] isamp 44 ipsamp 0.012146
expanding core data model sheet
Hi All, This strikes me as something that should be absurdly easy to do, but I can't seem to find any examples with more than two or three entities, and so no one mentions it, and I don't see it in the documentation. How do you expand the Core Data model sheet??? (The part where entities are displayed as boxes with lines to show the relations) (I don't mean zoom in/out, actually expand to make space for more entities.) I would think they'd provide some sort of pages concept for more complex models. Clearly with one sheet you will run out of place after 10 - 12 entities. I could collapse them, but still, that's not ideal. Thanks. Daniel ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: expanding core data model sheet
Am Mo,06.10.2008 um 16:48 schrieb Daniel Child: Hi All, This strikes me as something that should be absurdly easy to do, but I can't seem to find any examples with more than two or three entities, and so no one mentions it, and I don't see it in the documentation. How do you expand the Core Data model sheet??? (The part where entities are displayed as boxes with lines to show the relations) (I don't mean zoom in/out, actually expand to make space for more entities.) Simply drag an entity (the box of the entity) outside the sheet, i. e. to the left. A new one will appear. Too easy? ;-) I would think they'd provide some sort of pages concept for more complex models. Clearly with one sheet you will run out of place after 10 - 12 entities. I could collapse them, but still, that's not ideal. If anybody @Appl reads this: I'd like to have more options for the layout. For example I want to be able to route the arrows between the relationships. (When I worked as hw developer, every program for schematic entry could do this.) Cheers Thanks. Daniel ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/negm-awad%40cocoading.de This email sent to [EMAIL PROTECTED] Amin Negm-Awad [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Data Types for Extracting samples from Audio Buffer: Resolved
On Oct 6, 2008, at 8:46 AM, Joseph Ayers wrote: NSNumber* ipsamp = [[NSNumber alloc] init]; NSNumber* idsamp = [[NSNumber alloc] init]; You're still leaking memory here (assuming you're not using GC) by allocating empty un-autoreleased numbers and then overwriting the pointers later. These alloc/inits are unnecessary. Nick Zitzmann http://www.chronosnet.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Problem setting the menu
Hi, Any idea about how to fix the menu problem would be appreciated. thanks, -- Felipe Monteiro de Carvalho ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: wasting space?
On Sun, Oct 5, 2008 at 4:13 PM, Michael Ash [EMAIL PROTECTED] wrote: Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -- Brian W. Kernighan A very good sentiment. I'll have to remember that. You are both right and wrong. I don't view them as trivial and not particularly useful. What I view them as is as *less* useful than the old-style techniques when used for real work. My experience has been that, in most non-trivial uses, bindings ultimately cost more time than they save. I've had a not-so-dissimilar experience myself but I believe it's my own limited vision of their place in an application that is probably causing much of it. ... my experience with bindings is that this kind of mystery behavior happens all to often, because there's simply no good way to find out what's *actually* going on, as opposed to what's supposed to be. Ah, opaque proxy objects. :-) This has been my biggest complaint, but the situation has much improved in 10.5 I realize that a lot of what I'm saying is fairly similar in theme to arguments used against OO application frameworks in the first place, I really haven't found any way to reasonably debug these things besides dumping out the bindings info in the debugger (always looks like it should look anyway), trying to put breakpoints in KVC accessors, and in general doing a lot of head-scratching and guessing. If there's a better way to fix these things when they go wrong I'd love to know what it is. I'd be interested in hearing this as well if it exists. I know mmalc had traditionally been the authority on Bindings, so maybe if we say pretty-please, he could offer some additional tips. KVO is terribly, horribly, frighteningly flawed at the API level but it can still be very handy once you know the Magic Incantation. You just *know* that when you make such a blanket statement, some smart-ass is going to ask you to cite specific examples. I would be honored if you'd consider me that smart-ass. :-) -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Master-Detail Interface Examples
On Mon, Oct 6, 2008 at 8:54 AM, Jamie Phelps [EMAIL PROTECTED] wrote: I'm looking for examples of well-designed Master-Detail interfaces. I have tried several different layouts for the details and haven't been satisfied with any of them. This is almost impossible to answer usefully without at least a) a description of your master list and detail view's fields, or b) a screenshot of your best attempt to date. I'd recommend starting there. However, UI design questions are usually directed away from cocoa-dev to other lists, so I'm not sure if this is considered on-topic. If the moderator lets it live, I'm interested in what you have so far and in the community's opinions. ... and of course I'd have my own. :-) -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Invoking 'a Paste' Programmatically
Hi All, I'm developing a Cocoa application which extends the functionality of the clipboard. I have global HotKey registered using Carbon, and this HotKey invokes a method in which I'm replacing the contents of the general Pasteboard. I want to take this one step further and have the method paste the new contents of the Pasteboard. Since this method is called when a global HotKey event is triggered it should paste into whatever field in whichever application is active. I'm fairly new to Cocoa, but from what I can tell this is a pretty tall order. Please forgive my lack of proper terminology, but I'm wondering if there is a way to programmatically call 'Paste', or if there are any facilities in Cocoa for simulating key presses? Is there any chance of this idea working? Any suggestions for where I should look for an answer? Kind Regards, Joshua Brickner ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
About Launch Other Program
Hi everybody, The following is a sample for launch other program, but I don't know how to launch the Safari when Clicked the Lanuch Safari Button after, why auto called the modalView method it? thank you very much. Source Code: #import LaunchMeAppDelegate.h @implementation LaunchMeAppDelegate @synthesize window; @synthesize usageAlertView; @synthesize showUsageAlert; - (void)applicationDidFinishLaunching:(UIApplication *)application { showUsageAlert = YES; [self performSelector:@selector(showUsageAlertDialog) withObject:nil afterDelay:0.0]; } - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url { showUsageAlert = NO; if (!url) { return NO; } NSString *URLString = [url absoluteString]; NSString *message = [NSString stringWithFormat:@The application received a request to open this URL: [EMAIL PROTECTED] Be careful when servicing handleOpenURL requests!, URLString]; UIAlertView *openURLAlert = [[UIAlertView alloc] initWithTitle:@handleOpenURL: message:message delegate:nil cancelButtonTitle:@OK otherButtonTitles:nil]; [openURLAlert show]; [openURLAlert release]; if (!URLString) { return NO; } NSInteger maximumExpectedLength = 50; if ([URLString length] maximumExpectedLength) { return NO; } return YES; } - (void)showUsageAlertDialog { if (showUsageAlert) { NSString *message = @To demonstrate how this application handles a URL request for the new URL type that it registers, enter a URL in Safari that begins the with scheme of the URL type (launchme://) and press the Go button.; self.usageAlertView = [[UIAlertView alloc] initWithTitle:@Usage message:message delegate:self cancelButtonTitle:@Launch Safari otherButtonTitles:nil]; [self.usageAlertView show]; } } - (void)dismissUsageAlert { [self.usageAlertView dismissWithClickedButtonIndex:-1 animated:YES]; } - (void)modalViewCancel:(UIAlertView *)alertView { [alertView release]; } - (void)modalView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex { if (buttonIndex != -1) { [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@http://www.apple.com;]]; } [alertView release]; } - (void)dealloc { [window release]; [super dealloc]; } @end ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
WebView Crash
Hi all, I have my own WebView window, and I need to make the Choose File button work on a input type=file item on a web page. I have implemented the WebUIDelegate method - (void)webView:(WebView *)sender runOpenPanelForFileButtonWithResultListener:(idWebOpenPanelResultListener)resultListener. Besides, I have registered it as the delegate by sending [myWebView setUIDelegate:self]. However, I'm having a crash that doesn't seem to involve any of my code. I get a EXC_BAD_ACCESS with the following stack trace: #0 0x94e8a77b in CFWriteStreamClose () #1 0x952968ec in spoolingClose () #2 0x94e8a57d in _CFStreamClose () #3 0x93d6447f in closeRequestResources () #4 0x93d5fb0f in httpConnectionStateChanged () #5 0x93d7b1e4 in sendStateChanged () #6 0x93d7b16e in _CFNetConnectionErrorOccurred () #7 0x93d6c45f in httpRequestPayloadCallBack () #8 0x94e88629 in _CFStreamSignalEventSynch () #9 0x94e76698 in CFRunLoopRunSpecific () #10 0x94e76d38 in CFRunLoopRunInMode () #11 0x9512f560 in +[NSURLConnection(NSURLConnectionReallyInternal) _resourceLoadLoop:] () #12 0x950cc04d in -[NSThread main] () #13 0x950cbbf4 in __NSThread__main__ () #14 0x93336075 in _pthread_start () #15 0x93335f32 in thread_start () Ring any bells for anyone? Any thoughts at all would be appreciated. Thanks, Rui ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: expanding core data model sheet
On Oct 6, 2008, at 7:48 AM, Daniel Child wrote: This strikes me as something that should be absurdly easy to do, but I can't seem to find any examples with more than two or three entities, and so no one mentions it, and I don't see it in the documentation. How do you expand the Core Data model sheet??? (The part where entities are displayed as boxes with lines to show the relations) (I don't mean zoom in/out, actually expand to make space for more entities.) http://developer.apple.com/documentation/DeveloperTools/Conceptual/XcodeCoreDataTools/Articles/xcdDiagramView.html Page layout. If you move diagram elements outside the current diagram bounds (whether directly, or through applying automatic layout, or by unhiding elements), the page area automatically expands. Conversely, if you remove elements such that a page is left blank, the page area automatically contracts. mmalc ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Data Types for Extracting samples from Audio Buffer
In audio data a frame is one sample across all channels. If the ASBD describes non-interleaved audio, the byte and frame count fields describe one channel (mBytesPerPacket would be 2 for non- interleaved stereo 16-bit PCM). For interleaved audio, the fields describe the set of n channels (mBytesPerPacket would be 4 for interleaved stereo 16-bit PCM). In uncompressed audio, a packet is one frame, (mFramesPerPacket == 1). To be honest this paragraph is less than illuminating, since it states if the audio is interleaved it is interpreted one way, if not, then in another way, but doesn't say whether you can tell if it is interleaved or not - presumably you can using the format flags. Also, 32-bit floating point samples are another possibility, so you need to examine the flags to find out exactly what it is you've got and then use the remainder of the information to determine how to turn that into individual samples. I notice that you can also set fields in an ASBD then call MovieAudioExtractionSetProperty followed by MovieAudioExtractionFillBuffer to convert to your chosen format. So if you always do want 16-bit samples, then you need to carry out this conversion step. Graham is correct in his interpretation of the docs. The Core Audio SDK had sample code to assist in interpreting many of its structures, including the ASBD that is used so commonly. These are C++ classes, but they should be easily incorporated into any Cocoa application (just change your source files to .mm). You can find them in /Developer/Examples/CoreAudio/PublicUtility/. The helper for ASBDs is the CAStreamBasicDescription class. Also, if you have significant Core Audio questions, I would recommend asking them on the Core-Audio list rather than on Cocoa-Dev, as I'm not aware of any Core Audio engineers lurking on this list. -- 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 [EMAIL PROTECTED]
Re: Newbie: Simple display with NSView - problem
I'm pretty sure this isn't what you're proposing, but it could be one interpretation of your description! Sorry, I should have phrased it better. I am trying to avoid hardcoding the filenames into the custom views In the NIB, just use a custom view, then set its class to your class name. Then you don't have to instantiate it in code at all - it's already in existence in the NIB. When the NIB is loaded you can set the filename of the image, most likely using the -awakeFromNib message. To obtain the reference to the view, add an IBOutlet to its controller and link it up in IB. Then you can use that outlet to refer to the view. I tried you suggestion and it worked. Thanks a lot !!! Genu ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Downloading with NSData and NSFileManager
Hi All, I was looking at downloading some files, and started to look at NSFileManager to create the file, and then saw I could use NSData to load the data via a NSURL, so this look's pretty straight forward and very small code for downloading files. So I'm wondering what is the downside of using this technique, as I guess maybe these API block ? Thanks any pointers, Mark. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Open SSL on the iPhone
I see that libssl and libcrypto have been removed from the iPhone. However my application uses low level unix sockets rather then the higher level NSUrlConnection. Not directly, but the framework / library I am using does. It would be very difficult to change my application, while it would be very easy to include libcrytpo / libssl, if there were supported on the iPhone. I had a look online and found iphone-openssl as apart of macports, however this no longer seems to be suitable for iPhone 2.1 or 2.2. I am hoping for instructions on compiling openssl libraries myself and then link against those in my applications. Does anybody have any suggestions on how to do this, or what alternatives there are ? Thanks in advance Alex ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Downloading with NSData and NSFileManager
On Oct 6, 2008, at 11:04 AM, Mark Thomas wrote: I was looking at downloading some files, and started to look at NSFileManager to create the file, and then saw I could use NSData to load the data via a NSURL, so this look's pretty straight forward and very small code for downloading files. So I'm wondering what is the downside of using this technique, as I guess maybe these API block ? Correct. If you need non-blocking I/O, then use NSURLConnection and NSURLRequest instead. Nick Zitzmann http://www.chronosnet.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: wasting space?
On Mon, Oct 6, 2008 at 11:56 AM, I. Savant [EMAIL PROTECTED] wrote: On Sun, Oct 5, 2008 at 4:13 PM, Michael Ash [EMAIL PROTECTED] wrote: KVO is terribly, horribly, frighteningly flawed at the API level but it can still be very handy once you know the Magic Incantation. You just *know* that when you make such a blanket statement, some smart-ass is going to ask you to cite specific examples. I would be honored if you'd consider me that smart-ass. :-) I thought it was obvious! But seriously The problem is fairly simple to explain, but I think the impact is best illustrated with an example that compares it to what I consider to be a good API, such as NSNotificationCenter. Here's how you respond to several different notifications with NSNotificationCenter: - (void)someObjectDidSomething:(NSNotification *)note { ... } - (void)someObjectDidSomethingElse:(NSNotification *)note { ... } - (void)anotherObjectDidSomething:(NSNotification *)note { ... } And then here's how you do the equivalent thing with KVO: - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { if(context == kMyMagicGuaranteedUniqueContextPointer) { if(object == someObject) { if([keyPath isEqualToString:@something]) { ... } else if([keyPath isEqualToString:@somethingElse]) { ... } } else if(object == anotherObject) { ... } } else { [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; } } Key problems with the second one: - The kMyMagicGuaranteedUniqueContextPointer constant has to be generated in the right way, and the only way you can really use this context parameter is the way this method does, purely to decide whether the message is meant for you or for your superclass. You can't, say, pass a handy value in it to help you with your processing. - You have to manually compare the object and the key path against the ones you're interested in to decide what to do. Basically, KVO ought to ditch the silly context pointer and let you specify a selector the way NSNotificationCenter does. Any time you have a long chain of if statements like this it means that you should probably leverage the language's built-in dispatch mechanisms rather than rolling your own. NSNotificationCenter does this nicely by letting you simply tell it what message to send you when something happens. If you have some kind of generic handler that can deal with a bunch of different cases, you can just give all those cases the same selector. To make things worse, it's really easy to implement this method in the wrong way and still have it work. Until one day the system ends up observing something new or making some other such change, and then your code blows up mysteriously. (It is so easy to implement it in the wrong way that the documentation makes absolutely no mention that I can find of the correct way, and the one example in the documentation is flat-out wrong. As far as I know the only official place where you can find the correct way to implement it is by auto-completing observe in Xcode.) It baffles me how the KVO API came to be, given the good examples in the API that the designers could have followed. I used to assume that there was some advantage to it that I just hadn't discovered yet, but after so many years of still not discovering that advantage I'm forced to conclude that it's simply bad. If I'm wrong, please tell me what it is! But like I said, it's not unworkable, and once you know the Magic Method Structure the rest is relatively straightforward, it's just really clunky. Mike ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: hyphenationFactor in typesetter and layout manager
Ross, The hyphenation factor can be set for both NSATSTypesetter and NSLayoutManager. My tests indicate that it is sufficient to send setHyphenationFactor: to the typesetter alone (and simpler, if a document has multiple layouts). Is that correct, or must each layout manager's hyphenation factor also be set? The typesetter-level API is intended to be invoked by the controller object in the text layout process, usually NSLayoutManager, for configuring a particular typesetting session. It's usually reset to whatever NSLayoutManager has inside - layoutCharactersInRange:forLayoutManager:maximumNumberOfLineFragments:. Also, if the typesetter's hyphenation factor is set to a non-zero value, what is the best way to disable hyphenation at the paragraph level? Because NSParagraphStyle -setHyphenationFactor:0 causes the typesetter's hyphenation factor to be used, is it appropriate to use a very small value, such 0.01, for the paragraph's hyphenation factor? Since the very purpose of the document-level hyphenation factor accessible via NSLayoutManager is to provide the default setting when NSParagraphStyle is not specifying the hyphenation factor (by default value, 0.0), there is no clear way to disable it from the paragraph- level setting. If you need to have paragraph-level control, I'd suggest sticking to the NSParagraphStyle API exclusively. Aki On 2008/10/05, at 14:24, Ross Carter wrote: The hyphenation factor can be set for both NSATSTypesetter and NSLayoutManager. My tests indicate that it is sufficient to send setHyphenationFactor: to the typesetter alone (and simpler, if a document has multiple layouts). Is that correct, or must each layout manager's hyphenation factor also be set? Also, if the typesetter's hyphenation factor is set to a non-zero value, what is the best way to disable hyphenation at the paragraph level? Because NSParagraphStyle -setHyphenationFactor:0 causes the typesetter's hyphenation factor to be used, is it appropriate to use a very small value, such 0.01, for the paragraph's hyphenation factor? The question arises because I would like to allow users to set a hyphenation factor for the entire document, but to override that value as desired at the paragraph level. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/aki%40apple.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Problem setting the menu
If you make a new Xcode project with the Cocoa Application template, you will get a functioning main menu. You can either base your project off of that, or use it to figure out what differs in your project to prevent the nib in your menu from showing up. If you still can't figure out why the menu in the nib is not showing up, you can send me a compiled version of your program and I'll take a look. -Peter On Oct 5, 2008, at 7:40 PM, Felipe Monteiro de Carvalho wrote: Hello, I am still trying to get the application menu to work. I have even tryed to add a very simple nib file to the project. I simply added the nib file to the bundle and set NSMainNibFile, but it doesn't show the applications menu. It doesn't matter if I comment the code which attempts to generate the application menu or not, it never shows anything inside it. Any ideas how to insert a menu in a project which is otherwise completely written in 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/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Master-Detail Interface Examples
On Oct 6, 2008, at 08:54, Jamie Phelps wrote: I was considering a double-click for details approach, but I'm not sure if there's a design precedent for such a setup. I'm not averse to doing something new, but I don't want to do something the user is totally not expecting. I'm not saying that's the best approach but I've been using the double click for detail paradigm for more than 15 years, as this was the default with 4th Dimension. I'm in the process of porting this in-house application to Cocoa/PostgreSQL and will probably continue using double-clicking to show the details views. It's been used in many applications (Mail, Xcode to name a few) and even Apple's Finder uses this paradigm (double-click to see folder's content) so I'm sure users will get it pretty fast. Andre Masse ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
synthesised variables on 64-bit
I'm trying to make use of http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_5_section_7.html - but I'm not having any luck. Is there something I have to do other than setting the ARCHITECTURES setting to 32/64 bit? (I don't seem to have a 64-bit only setting.) I'm using Xcode 3.1. Stig -- http://code.brautaset.org http://devblog.brautaset.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 [EMAIL PROTECTED]
IKImageView and delegate callback/notification of image changes
Hi list. Attempting to use IKImageView to implement a really basic image editor in my app and I've come across what appears to be a pretty odd omission: IKImageView never tells you when the image has been edited and needs saved. While the object supports a delegate, there's no documentation on whether it actually implements anything that would tell me when something changed. Has anyone come across a solution for knowing when the image has been edited? Thanks -- Jim http://nukethemfromorbit.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Master-Detail Interface Examples
On Oct 6, 2008, at 11:59 AM, I. Savant wrote: On Mon, Oct 6, 2008 at 8:54 AM, Jamie Phelps [EMAIL PROTECTED] wrote: I'm looking for examples of well-designed Master-Detail interfaces. I have tried several different layouts for the details and haven't been satisfied with any of them. This is almost impossible to answer usefully without at least a) a description of your master list and detail view's fields, or b) a screenshot of your best attempt to date. I'd recommend starting there. Also it may not be clear what you mean by a Master-Detail interface. To me the first thing that comes to mind is a single window with two panes: a list of masters, and a detail view for the currently selected master. When you single-click a list item, the detail view updates automatically. This makes more sense than a double-click, because it preserves the invariant that the detail view reflects the currently selected master. The detail view would automatically update if you use the arrow keys to select different masters. The Finder in column mode is like this -- the last column shows details of the currently selected file or folder. In business applications, the detail view often looks like a data- entry form. A simple example would be a column of text fields that are aligned along their left edges, with a right-justified label in front of each. (I think there may even be HIG docs about this kind of layout.) Another option, which can be used instead of or along with the above, is that when you double-click a master (or select it and hit Return), it opens a new window containing the detail for that master. Thus you can open detail windows open for multiple masters at the same time. The Finder's Get Info window is like this, although you open it with Command-I instead of a double-click. Yet another paradigm is an inspector paradigm, where you have a single global inspector window whose contents change automatically when you select different masters. An example is the Finder's Inspector window (hit Command-Option-I). However, UI design questions are usually directed away from cocoa-dev to other lists, Like this one: http://tech.groups.yahoo.com/group/mac-gui-dev/ --Andy so I'm not sure if this is considered on-topic. If the moderator lets it live, I'm interested in what you have so far and in the community's opinions. ... and of course I'd have my own. :-) -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/aglee%40mac.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: synthesised variables on 64-bit
On Oct 6, 2008, at 1:09 PM, Stig Brautaset wrote: I'm trying to make use ofhttp://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_5_section_7.html - but I'm not having any luck. Is there something I have to do other than setting the ARCHITECTURES setting to 32/64 bit? (I don't seem to have a 64-bit only setting.) Are you running the app in the debugger? If you're building a 4-way universal binary, then the debugger will always launch the 32-bit version of the executable, even if you're using a 64-bit Mac. If you want to build the app for 64-bit only, then you have to manually set the architectures to ppc64 x86_64 instead of using a pre-set value. Also, Xcode 3.1's debugger doesn't work correctly with 64-bit executables. I haven't checked to see if they fixed this bug in 3.1.1, but they did work correctly in 3.0. Nick Zitzmann http://www.chronosnet.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
RE: synthesised variables on 64-bit
Are you running the app in the debugger? If you're building a 4-way universal binary, then the debugger will always launch the 32-bit version of the executable, even if you're using a 64-bit Mac. If you want to build the app for 64-bit only, then you have to manually set the architectures to ppc64 x86_64 instead of using a pre-set value. Also, Xcode 3.1's debugger doesn't work correctly with 64-bit executables. I haven't checked to see if they fixed this bug in 3.1.1, but they did work correctly in 3.0. This brings up a question I had a while ago, but never asked and about which I forgot. I tried making a 64-bit app in Xcode 3.0 a while ago and set the architectures, as you mentioned, to ppc64 x86_64. When I ran the app, sizeof(long) was still 4 on a Core2 Duo running Leopard. I found a compiler option called Use 64-bit Math. After enabling that, sizeof(long) was 8. I was never sure if that was correct behavior, but, as I said, I just forgot about it. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: wasting space?
On Mon, Oct 6, 2008 at 2:05 PM, Michael Ash [EMAIL PROTECTED] wrote: It baffles me how the KVO API came to be, given the good examples in the API that the designers could have followed. I used to assume that there was some advantage to it that I just hadn't discovered yet, but after so many years of still not discovering that advantage I'm forced to conclude that it's simply bad. If I'm wrong, please tell me what it is! You make some very good points - points which I'm sure many agree upon, but I don't have any answers for them. Remember, I admitted that I have trouble getting to advanced level myself with this aspect of the framework. Second invitation to mmalc (or any others who can fight the good fight) ... ;-) -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Cocoa Programming for Mac OsX Third Edition eBook search
On Sun, Oct 5, 2008 at 2:51 AM, Howard Oakley [EMAIL PROTECTED] wrote: On 05/10/2008 02:25, David Orriss Jr wrote: I ran into the same thing. Probably one of my biggest complaints about Addison is that the ebooks they do are digitally signed and that the ONE platform Acrobat reader doesn't support for digitally signed ebooks (aside from a beta reader if you dig around) is the Mac. Rather ironic given the subject matter of the book. Has anyone tried reading it with Adobe Digital Editions http://www.adobe.com/products/digitaleditions/? Despite ill-informed rumour saying that it is beta, it is actually now in version 1.6 and works perfectly well here for such DRMed titles, under Leopard, in Windows form under VMware, and on a suitably authorised Sony Reader... Thanks for that info. Last time I tried the Mac version all I could find (that supported DRMed PDF) was a beta of the 1.5 release. I'll install this tonight. -- David Orriss Jr. My blog: http://www.codethought.com/blog ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: wasting space?
On Mon, Oct 6, 2008 at 4:22 PM, Erik Buck [EMAIL PROTECTED] wrote: If you ever find yourself writing switch statements based on the return value of a method you are doing something very wrong. If you have nested if statements comparing strings, you are doing something wrong. What of the Graphics Bindings example mmalc has on his examples page? Here: http://homepage.mac.com/mmalc/CocoaExamples/controllers.html -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: wasting space?
--- On Mon, 10/6/08, I. Savant [EMAIL PROTECTED] wrote: What of the Graphics Bindings example mmalc has on his examples page? Here: http://homepage.mac.com/mmalc/CocoaExamples/controllers.html I am not sure what Mmalc was attempting in his example. I looked at it again just now.It seems to me to be a very old example. He uses the deprecated method + (void)setKeys:(NSArray *)keys triggerChangeNotificationsForDependentKey:(NSString *)dependentKey.I think that NSArrayController can do everything his GraphicsArrayController is doing without requiring any application specific code.I think Mmacl's implementation of GraphicsView is sub-optimal unless I am just not understanding what he was trying to do.Chapter 29, Controllers, in the forthcoming Cocoa Design Patterns book coincidentally implements a simple drawing program. I wish I had thought to review Mmalc's example while I was writing.Chapter 29 takes the reader on a journey to discover why NSArrayController and other NSController classes exist. The chapter starts with a simple problem, solves it, and the evolves the solution to be general and reusable. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: wasting space?
On Mon, Oct 6, 2008 at 4:22 PM, Erik Buck [EMAIL PROTECTED] wrote: I am no fan of KVO or bindings, but I disagree with Mike Ash on his analysis. If you are even tempted to override - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context, you have missed the whole point of KVO IMHO. Let the built in framework code parse the key paths. You should forget that key paths even exist. When someone calls float currentElevation = [someObject valueForKeyPath:@document.currentTerrain.selectedObject.elevation], that is conceptually identical to the following: currentElevation = someObject document] currentTerrain] selectedObject] elevation]; In fact, the framework will call -document, -currentTerrain, -selectedObject, and -elevation for you if you let it. Just make sure someObject has a -document method, and your document object has a currentTerrain method, and your terrain object has a -selectedObject method and selected objects have an -elevation method, and you are good to go! I am very confused here. KVO has nothing to do with a call like valueForKeyPath:, other than the obvious fact that they are both built on the idea of key paths. The observeValueForKeyPath:ofObject:change:context: method doesn't interact with valueForKeyPath: in any way, and so I don't really understand what you're getting at here. If you don't override observeValueForKeyPath:ofObject:change:context:, how are you supposed to use KVO at all? As far as I understand it, that is the *only* way to get notified of changes to things you observe. If you ever find yourself writing switch statements based on the return value of a method you are doing something very wrong. If you have nested if statements comparing strings, you are doing something wrong. I agree, but the KVO API doesn't leave you much choice unless you simply forego KVO altogether. Mike ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: wasting space?
On Mon, Oct 6, 2008 at 1:22 PM, Erik Buck [EMAIL PROTECTED] wrote: I am no fan of KVO or bindings, but I disagree with Mike Ash on his analysis. If you are even tempted to override - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context, you have missed the whole point of KVO IMHO. Let the built in framework code parse the key paths. You should forget that key paths even exist. I am confused on how the remainder of your post related to what Michael posted about. If you want to create objects that support KVO and write code that observes properties of those objects then the pathway that observers have to get notifications is via observeValueForKeyPath: ofObject:change:context: (unless you are binding properties of the observed to a property of the observer, aka KVB). Of course attempting to override the observeValueForKeyPath:... method of a nontrivial Apple provided class is questionable (depending on the context and what you are attempting to do) but in your own code it is reasonable thing to do. For example I have a set of model objects that support KVO/KVC for a sub-set of properties. I have (read-only) UI that are bond to these model objects directly using the framework provided controller layer and IB support for bindings. This is nice and simple, no code to have my UI be updated to reflect the state of the model. However I also have other objects that need to observe changes to some of these same properties and since they already support KVO the observers leverage KVO (why reinvent a KVO of my own) and as a result have the type of logic that Michael denotes (switch statement | if/else tree) in observeValueForKeyPath:... to handle change notification. I agree with Michael on this aspect of things it can get a little ugly. -Shawn ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: wasting space?
I am very confused here. KVO has nothing to do with a call like valueForKeyPath:, other than the obvious fact that they are both built on the idea of key paths. The observeValueForKeyPath:ofObject:change:context: method doesn't interact with valueForKeyPath: in any way, and so I don't really understand what you're getting at here. If you don't override observeValueForKeyPath:ofObject:change:context:, how are you supposed to use KVO at all? As far as I understand it, that is the *only* way to get notified of changes to things you observe. Apple's various NSController subclasses handle KVO and bindings for you. NSController subclasses automatically call -valueForKeyPath: or -valueForKey: or -setValue:forKey:. The -observeValueForKeyPath:ofObject:change:context: _does_ interact with -valueForKeyPath: because the various NSController subclasses exist in part to provide exactly that interaction. You do often need to call -bind:toObject:withKeyPath:options:. You really don't need to override -observeValueForKeyPath:ofObject:change:context:. Or at least I haven't needed to override it because one of the existing NSController subclasses usually meets my needs. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Universal app fails on PPC.
I'm trying to test my universal app to make sure its really universal. In finder I did get info then selected run with rosetta. When I do that the application traps. The console log says, Exited abnormally: Trace/BPT trap What does that mean? How can I determine why its not working? Is there a way to run it in the debugger using rosetta? I'm including two other frameworks, Sparkle and AquaticPrime. Both of which I've compiled on my own to make sure settings said its generating universal output... or at least I think I set that right. Thanks ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Universal app fails on PPC.
On Oct 6, 2008, at 2:38 PM, David wrote: I'm including two other frameworks, Sparkle and AquaticPrime. Both of which I've compiled on my own to make sure settings said its generating universal output... or at least I think I set that right. You can use the lipo tool (see the -verify_arch and -info switches) to check the architecture(s) of the libraries that you built. for example: lipo /Library/Frameworks/MacFUSE.framework/MacFUSE -info emits: Architectures in the fat file: /Library/Frameworks/MacFUSE.framework/ MacFUSE are: ppc i386 wp ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: wasting space?
On Mon, Oct 6, 2008 at 5:26 PM, Erik Buck [EMAIL PROTECTED] wrote: I am very confused here. KVO has nothing to do with a call like valueForKeyPath:, other than the obvious fact that they are both built on the idea of key paths. The observeValueForKeyPath:ofObject:change:context: method doesn't interact with valueForKeyPath: in any way, and so I don't really understand what you're getting at here. If you don't override observeValueForKeyPath:ofObject:change:context:, how are you supposed to use KVO at all? As far as I understand it, that is the *only* way to get notified of changes to things you observe. Apple's various NSController subclasses handle KVO and bindings for you. NSController subclasses automatically call -valueForKeyPath: or -valueForKey: or -setValue:forKey:. The -observeValueForKeyPath:ofObject:change:context: _does_ interact with -valueForKeyPath: because the various NSController subclasses exist in part to provide exactly that interaction. You do often need to call -bind:toObject:withKeyPath:options:. You really don't need to override -observeValueForKeyPath:ofObject:change:context:. Or at least I haven't needed to override it because one of the existing NSController subclasses usually meets my needs. So your assertion is, essentially, that KVO is not really intended to be a user-accessible mechanism but rather is internal support for more accessible mechanisms like bindings? If I want to, say, get notified when an NSOperation finishes, am I expected to instantiate an NSController just for that? If so, then I'm going to say that this makes things worse, not better. Having to create a whole new object and deal with that just to get a notification from another object is really terrible. As far as I can see the documentation doesn't support this idea at all. It goes right ahead and talks about how to register as an observer and listen for changes, complete with a broken example of overriding observeValueForKeyPath:ofObject:change:context: to accomplish 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 [EMAIL PROTECTED]
[Moderator] Re: Open SSL on the iPhone
On 6-Oct-08, at 1:46 PM, Alexander Hartner wrote: I see that libssl and libcrypto have been removed from the iPhone. For the moment this is still not for public discussion on this list. Please re-read http://developer.apple.com/iphone/program/. The new list rules will be posted when the new program terms are. Thanks scott [moderator] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSURLConnection willSendRequest: not behaving as expected on a 302 response - no further response after nil return
Fortunately for me I probably never read the documentation you quoted :) What I've done for a similar purpose, is to wait until I've got all the data I want in hand, and then send it a -cancel. Works fine. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Problem setting the menu
I searched a lot in google and I can only see that the exact method that I tryed (using NSApp.setAppleMenu) works for some people and not for others ... maybe it only works in some Mac OS X versions. I am using Mac OS X 10.4. Also I even tryed NSBundle.loadNibNamed_owner to load a simple nib but it still doesn't work... As asked, my code is available via public subversion: svn co https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/bindings/objc objc svn co https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/bindings/pascocoa pascocoa Both are necessary. It is necessary to have the Free Pascal compiler installed to build the software: http://www.freepascal.org/ After downloading you can create the bundle and compile the software with the following commands: cp pascocoa/examples/texteditor ./createbundle.sh ./make.sh And run with open texteditor.app thanks, -- Felipe Monteiro de Carvalho ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
NSWindowController retain counts, chapter 2
After fixing things so that my NSWindowController subclass gets deallocated, I discovered that the NSWindow was not getting deallocated. It appears to be related to the fact that the NSWindow's retain count is incremented each time -[NSWindowController window] is called. I don't see anything in the documentation of the window method that would have led me to expect that behavior. Is there some general principle I should know about? For now, I've worked around the problem by overriding the window method as follows, where mWindow is a member variable: - (NSWindow *)window { if (mWindow == nil) { mWindow = [super window]; } return mWindow; } -- James W. Walker, Innoventive Software LLC http://www.frameforge3d.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Data Types for Extracting samples from Audio Buffer: Resolved
On 7 Oct 2008, at 1:46 am, Joseph Ayers wrote: ipsamp = [NSNumber numberWithFloat:(float)ippointer[isamp]]; [ipbufaddObject:ipsamp]; idsamp = [NSNumber numberWithFloat:(float)idpointer[isamp]]; [idbufaddObject:idsamp]; Just a final comment. The cast to (float) here is not required. ippointer is already declared as a float* so ippointer[index] returns data of type float as it is. I mention it because while here it's merely redundant and harmless, your first attempt as posted to me off- list has this cast as [NSNumber numberWithFloat:(unsigned long)ippointer[index]]; Where the cast is most definitely not harmless and in fact prevents the code from working. Throwing in casts without understanding why you're doing it is a good way to introduce bugs, so don't do it unless you really have to. Also, what Nick said about the memory leak. cheers, Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Universal app fails on PPC.
On Oct 6, 2008, at 3:38 PM, David wrote: I'm trying to test my universal app to make sure its really universal. In finder I did get info then selected run with rosetta. When I do that the application traps. The console log says, Exited abnormally: Trace/BPT trap What does that mean? How can I determine why its not working? Is there a way to run it in the debugger using rosetta? Does your app use GC? Rosetta will not launch GC-enabled PPC apps. The only way to test those apps is to run them on a real PPC Mac. Nick Zitzmann http://www.chronosnet.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Universal app fails on PPC.
Yes it does use GC. Wow. I had no idea it wouldn't work with rosetta. Does GC work on a ppc machine? Given that I don't have access to a ppc machine, sounds like I can't test if it works. Given that it's obviously a leopard only application, I'm not sure if I should claim support for ppc and have a user complain if it doesn't work, or drop the claim of ppc support and make it intel only. In any case thanks for the information. Sent from my iPhone On Oct 6, 2008, at 7:58 PM, Nick Zitzmann [EMAIL PROTECTED] wrote: On Oct 6, 2008, at 3:38 PM, David wrote: I'm trying to test my universal app to make sure its really universal. In finder I did get info then selected run with rosetta. When I do that the application traps. The console log says, Exited abnormally: Trace/BPT trap What does that mean? How can I determine why its not working? Is there a way to run it in the debugger using rosetta? Does your app use GC? Rosetta will not launch GC-enabled PPC apps. The only way to test those apps is to run them on a real PPC Mac. Nick Zitzmann http://www.chronosnet.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSWindowController retain counts, chapter 2
On 7 Oct 2008, at 9:57 am, James Walker wrote: After fixing things so that my NSWindowController subclass gets deallocated, I discovered that the NSWindow was not getting deallocated. It appears to be related to the fact that the NSWindow's retain count is incremented each time - [NSWindowController window] is called. I don't see anything in the documentation of the window method that would have led me to expect that behavior. Is there some general principle I should know about? For now, I've worked around the problem by overriding the window method as follows, where mWindow is a member variable: - (NSWindow *)window { if (mWindow == nil) { mWindow = [super window]; } return mWindow; } This seems a wee bit crazy. NSWindowController has a perfectly good member variable called 'window' that supplies the window in question, and is returned by the - window method (provided you remembered to hook it up in IB of course). The fact (if it is a fact) that the retain count of the window is incremented is not something you should be looking at or caring about. Retain counts are none of your business, and incrementing one doesn't imply anything. Maybe for example the [NSWindowController window] method does this: return [[window retain] autorelease]; There's nothing wrong with that, there's no leak, yet you'd see the retain count incremented if you were poking your nose into it. It's not mentioned in the documentation because it's perfectly in keeping with normal rules of ownership so doesn't need calling out as an exception to those rules. In the earlier part of this thread, which I didn't contribute to yet read with interest, you were repeatedly told to stop worrying about retain counts and just follow the rules. I'll weigh in and add my voice to that clamouring chorus. How do you know the window isn't being deallocated? Examining retain counts is not going to tell you whether it is or not. The only way would be to subclass it and log the -dealloc method. hth, Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Universal app fails on PPC.
On Oct 6, 2008, at 6:08 PM, David Melgar wrote: Yes it does use GC. Wow. I had no idea it wouldn't work with rosetta. Does GC work on a ppc machine? Yes, and it works on PPC64 as well. It's just Rosetta that doesn't support the GC library for some reason. Nick Zitzmann http://www.chronosnet.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSWindowController retain counts, chapter 2
Graham Cox wrote: On 7 Oct 2008, at 9:57 am, James Walker wrote: After fixing things so that my NSWindowController subclass gets deallocated, I discovered that the NSWindow was not getting deallocated. It appears to be related to the fact that the NSWindow's retain count is incremented each time -[NSWindowController window] is called. I don't see anything in the documentation of the window method that would have led me to expect that behavior. Is there some general principle I should know about? For now, I've worked around the problem by overriding the window method as follows, where mWindow is a member variable: - (NSWindow *)window { if (mWindow == nil) { mWindow = [super window]; } return mWindow; } This seems a wee bit crazy. NSWindowController has a perfectly good member variable called 'window' that supplies the window in question, and is returned by the -window method (provided you remembered to hook it up in IB of course). NSWindowController.h does not say that it has a member variable named window, it says that there is a private member variable named _window. The fact (if it is a fact) that the retain count of the window is incremented is not something you should be looking at or caring about. Retain counts are none of your business, and incrementing one doesn't imply anything. Maybe for example the [NSWindowController window] method does this: return [[window retain] autorelease]; There's nothing wrong with that, there's no leak, yet you'd see the retain count incremented if you were poking your nose into it. It's not mentioned in the documentation because it's perfectly in keeping with normal rules of ownership so doesn't need calling out as an exception to those rules. Hmm, OK... In the earlier part of this thread, which I didn't contribute to yet read with interest, you were repeatedly told to stop worrying about retain counts and just follow the rules. I'll weigh in and add my voice to that clamouring chorus. I can accept that looking at retain counts may just be confusing me, but just following the rules hasn't sufficed. How do you know the window isn't being deallocated? Examining retain counts is not going to tell you whether it is or not. The only way would be to subclass it and log the -dealloc method. That's exactly what I did. The dealloc method was not getting called before I added the workaround. Well, the initial symptom was that I got an access violation because a custom view was asked to draw after the window had been closed and the window controller had been destroyed. In the course of debugging that, I subclassed the window. -- James W. Walker, Innoventive Software LLC http://www.frameforge3d.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Invoking 'a Paste' Programmatically
On Sun, Oct 5, 2008 at 8:42 PM, Joshua Brickner [EMAIL PROTECTED] wrote: I'm wondering if there is a way to programmatically call 'Paste' If you're running in the process of the foreground app, you could do something along the lines of: [[[NSApp mainWindow] firstResponder] paste:nil]; You could also try using Applescript to send either a paste command or a cmd-V. I'm not sure exactly how that would work, but I'm sure others on this list do know. HTH, -Colin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
CDMA Programming
I know that the iPhone uses cell phone communication technologies, probably like CDMA. (I am a huge n00b on this area of expertise). I am in a group project that needs to do some CDMA programming. Any ideas if there are any C libraries that can help with this function? Thanks! -- If you can't be kind, at least have the decency to be vague. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
re: Code Data: Re-inserting deleted objects
Chaitanya, What is the best way to re-insert a deleted object back in to the managed object context? -insertObject: will reinsert a deleted object. -insertObject and - deleteObject will cancel each other out. Typically, one wouldn't validateForInsert until after reinserting the object, and then fixing up the relationships. -validateForInsert is closer in meaning to can I save (insert into db) this object yet ? It's perfectly fine to be in an in between state, as long as you clean it up before saving. One more thing, if i directly insert the object without checking it for validation and then call [A isInserted] it returns NO if i do it in the same loop, if i do it later, it returns YES, is there anything special i need to do so that the isInserted flag would be updated? If insertObject deleteObject cancel each other out, then -isInsert will return NO, since the deletion was effectively canceled, and you won't be saving either the insert or delete to the database. Basically, you returned to a neutral state. - Ben ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSWindowController retain counts, chapter 2
On 7 Oct 2008, at 11:38 am, James Walker wrote: NSWindowController has a perfectly good member variable called 'window' that supplies the window in question, and is returned by the -window method (provided you remembered to hook it up in IB of course). NSWindowController.h does not say that it has a member variable named window, it says that there is a private member variable named _window. Being private means just that. However, if you have an NSWindowController in IB, you'll see an outlet named 'window' (not _window). This should be wired up to the window object in the nib. How it's implemented is irrelevant - don't use or access _window. Note: peeking at the headers of Cocoa objects is almost never necessary. I can accept that looking at retain counts may just be confusing me, but just following the rules hasn't sufficed. Well, what is it in the rules that you are not understanding? How do you know the window isn't being deallocated? Examining retain counts is not going to tell you whether it is or not. The only way would be to subclass it and log the -dealloc method. That's exactly what I did. The dealloc method was not getting called before I added the workaround. Well, the initial symptom was that I got an access violation because a custom view was asked to draw after the window had been closed and the window controller had been destroyed. In the course of debugging that, I subclassed the window. I'd suggest it would be more fruitful to chase down the actual bug rather than one that appears to be related but might be just a red herring. If a view is being asked to draw but its window has gone away, then something's very, very off somewhere. Normally views are drawn by their windows, so how can such a situation arise? If you can answer that question you've probably found the problem. Is some other object retaining the view? Why? Are you drawing outside the usual update event cycle mechanism? Why? Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
performSelectorOnMainThread Help
Greetings. I need to gain a better understanding of performSelectorOnMainThread I have my main window that had a delegate and the delegate spawns threads, once the threads(NSOperation) are done they return a string, I use to do it thru a delegate but Core Data does not appreciate multiple access at the same time:) so I looked at the synchronization mechanisms and I would like to use the performSelectorOnMainThread. I defined a selector in my Aplication delegate like this. - (void) updateAirDate:(ShowAirDateItem *)showAirDateItem; and i call it from my thread like this. [MyApp_AppDelegate performSelectorOnMainThread:@selector(updateAirDate:) withObject:airDate waitUntilDone:NO]; unfortunately, this gives me this message in the run log. *** +[MyApp_AppDelegate updateAirDate:]: unrecognized selector sent to class I know i'm not doing this right, but i cant figure it out... must be to simple. could someone point me in the right direction ? thank you ! Sandro. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
[MEET] Minnesota CocoaHeads 10/9/08
The next Minnesota CocoaHeads meeting is this Thursday (10/9) from 6:00-8:00pm. We meet at the offices of Synergy Information Services in Bloomington. Gerd Knops, from bitart, will be discussing Cocoa Bindings. Please join us as Gerd guides us through the ins and outs of working with this interesting and powerful Cocoa technology. If you'd like some more information or directions, please stop by one of our sites: http://www.cocoaheadsmn.org/ http://www.cocoaheads.org/us/MinneapolisMN/index.html Thanks, Bob McCune http://www.bobmccune.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Core Data: Copying and pasting chained entities
Renaud, Now, I am nearly sure that I cannot use the NSArchiver/NSUnarchiver with NSManagedObjects, because NSArchiver/NSUnarchiver know nothing about Core Data relationships and because NSUnarchiver won't know how to insert an object in the managed object context. That's correct. Managed objects do not conform to NSCoding. However, a similar mechanism must exist, because Core Data stores and fetches entities. Not in a fashion that's meaningful to copypaste. The atomic stores (xml, binary) write everything (e.g. whole file) out all the time. The incremental sqlite store only saves deltas. Neither is helpful for the pasteboard. So once again: how do you implement copy and paste with Core Data ? It is a common operation; I was very surprised not to find any article on the subject. There are a few examples floating around. Typically, you need the NSManagedObjectID and a snapshot of the attributes. Both KVC and NSManagedObject have methods to grab a bunch of keys at once to simplify this. Relationships are an issue, because there is no one answer. Do you want a shallow copy or a deep copy ? How deep ? The related objects' related objects ? Most people settle for a mix of references and copies. Typically, relationships are stored externally as either references (NSManagedObjectID in URI form) or copies (e.g. all their attributes). Just how far you copy the object graph is up to you. Some apps don't copy the graph at all, and just put a reference (URI) on the pasteboard and when it's pasted back, look up the object. - Ben ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: performSelectorOnMainThread Help
You appear to have declared updateAirDate: to be an instance method, but you're sending the message to the class. You want something more like [appDelegate performSelectorOnMainThread:@selector(updateAirDate:) withObject:airDate waitUntilDone:NO]; where appDelegate is the relevant instance of MyApp_AppDelegate. On Oct 6, 2008, at 7:13 PM, Sandro Noel wrote: Greetings. I need to gain a better understanding of performSelectorOnMainThread I have my main window that had a delegate and the delegate spawns threads, once the threads(NSOperation) are done they return a string, I use to do it thru a delegate but Core Data does not appreciate multiple access at the same time:) so I looked at the synchronization mechanisms and I would like to use the performSelectorOnMainThread. I defined a selector in my Aplication delegate like this. - (void) updateAirDate:(ShowAirDateItem *)showAirDateItem; and i call it from my thread like this. [MyApp_AppDelegate performSelectorOnMainThread:@selector(updateAirDate:) withObject:airDate waitUntilDone:NO]; unfortunately, this gives me this message in the run log. *** +[MyApp_AppDelegate updateAirDate:]: unrecognized selector sent to class I know i'm not doing this right, but i cant figure it out... must be to simple. could someone point me in the right direction ? thank you ! Sandro. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/psagers %40ignorare.net This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSWindowController retain counts, chapter 2
Graham Cox wrote: I can accept that looking at retain counts may just be confusing me, but just following the rules hasn't sufficed. Well, what is it in the rules that you are not understanding? I didn't say I didn't understand the rules. Do you think it's inconceivable that there might be bugs in the OS when you start mixing Cocoa and Carbon? How do you know the window isn't being deallocated? Examining retain counts is not going to tell you whether it is or not. The only way would be to subclass it and log the -dealloc method. That's exactly what I did. The dealloc method was not getting called before I added the workaround. Well, the initial symptom was that I got an access violation because a custom view was asked to draw after the window had been closed and the window controller had been destroyed. In the course of debugging that, I subclassed the window. I'd suggest it would be more fruitful to chase down the actual bug rather than one that appears to be related but might be just a red herring. If a view is being asked to draw but its window has gone away, then something's very, very off somewhere. Normally views are drawn by their windows, so how can such a situation arise? If you can answer that question you've probably found the problem. Is some other object retaining the view? Why? Are you drawing outside the usual update event cycle mechanism? Why? When I said the window has gone away, I spoke imprecisely. I meant the window had been closed. But, as I said, it had not been deallocated. No, no other object retains the view. No, I don't draw in any unusual way. -- James W. Walker, Innoventive Software LLC http://www.frameforge3d.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: wasting space?
On 07/10/2008, at 7:26 AM, Erik Buck wrote: You really don't need to override - observeValueForKeyPath:ofObject:change:context:. Or at least I haven't needed to override it because one of the existing NSController subclasses usually meets my needs. If you are implementing manual bindings then you really have to implement this method. For example, how would you tell a custom view to call -setNeedsDisplayInRect: when a value changes unless you are getting notifications of observed properties through - observeValueForKeyPath:ofObject:change:context:? In my opinion the use of this method is absolutely essential in any reasonably complex use of bindings/KVO. -- 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 [EMAIL PROTECTED]
Re: CDMA Programming
iphone is on ATT which does not use CDMA. All the CDMA-based companies, Verizon, Sprint, and AllTel license their technology from QualComm. I used to teach short courses and seminars about similar spread-spectrum technologies and I knew Andy Viterbi, one of the founders of QualComm. Just Saturday I order the book, The Qualcomm Equation:... about their story. This stuff is most efficiently done in hardware, although there are ways to generate the correlation sequences for the product code polynomials in software. Of course, decision and control is in software. Qualcomm has it pretty much covered in patents, which (theoretically) means the information should be available. However, you are unlikely to to find anything useful around here, especially in the Cocoa forum. You'd be better off to just Google it. On 10/6/08 9:18 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Message: 13 Date: Mon, 6 Oct 2008 18:19:21 -0700 From: Alex Wait [EMAIL PROTECTED] Subject: CDMA Programming To: cocoa-dev Cocoa-dev@lists.apple.com Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=ISO-8859-1 I know that the iPhone uses cell phone communication technologies, probably like CDMA. (I am a huge n00b on this area of expertise). I am in a group project that needs to do some CDMA programming. Any ideas if there are any C libraries that can help with this function? Thanks! ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: CDMA Programming
(Whoops, did it again. Forgot to change the title. -- GA) iphone is on ATT which does not use CDMA. All the CDMA-based companies, Verizon, Sprint, and AllTel license their technology from QualComm. I used to teach short courses and seminars about similar spread-spectrum technologies and I knew Andy Viterbi, one of the founders of QualComm. Just Saturday I order the book, The Qualcomm Equation:... about their story. This stuff is most efficiently done in hardware, although there are ways to generate the correlation sequences for the product code polynomials in software. Of course, decision and control is in software. Qualcomm has it pretty much covered in patents, which (theoretically) means the information should be available. However, you are unlikely to to find anything useful around here, especially in the Cocoa forum. You'd be better off to just Google it. On 10/6/08 9:18 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Message: 13 Date: Mon, 6 Oct 2008 18:19:21 -0700 From: Alex Wait [EMAIL PROTECTED] Subject: CDMA Programming To: cocoa-dev Cocoa-dev@lists.apple.com Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=ISO-8859-1 I know that the iPhone uses cell phone communication technologies, probably like CDMA. (I am a huge n00b on this area of expertise). I am in a group project that needs to do some CDMA programming. Any ideas if there are any C libraries that can help with this function? Thanks! ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSWindowController retain counts, chapter 2
On 7 Oct 2008, at 1:56 pm, James Walker wrote: I didn't say I didn't understand the rules. Do you think it's inconceivable that there might be bugs in the OS when you start mixing Cocoa and Carbon? It's not inconceivable. But the chances are very high that the bug is yours. Do let us know when you find it. Cocoa and Carbon are mixed all the time in every Cocoa app, since many Cocoa objects build on Carbon ones. In what way are you mixing Carbon/ Cocoa? If you want help, maybe you should post your actual code and the errors you're getting. There's not much that anyone can do simply by guessing. G. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: CDMA Programming
On 06 Oct 08, at 18:19, Alex Wait wrote: I know that the iPhone uses cell phone communication technologies, probably like CDMA. (I am a huge n00b on this area of expertise). I am in a group project that needs to do some CDMA programming. Any ideas if there are any C libraries that can help with this function? It's unlikely that any system which you're working with will give you access to the hardware that you'd need to do anything connected with CDMA*. The iPhone only gives software extremely high-level access to the radio hardware - on the level of prompt the user to dial a phone number, for instance. As such, I doubt that any libraries are publicly available. What exactly are you planning to do? *: The exception being if you're implementing drivers for cell radio hardware. In that case, though, you've probably got plenty of docs from the company you're working for. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
[Moderator] Re: CDMA Programming
For the moment iPhone is still not for public discussion on this list. (and it isn't cocoa related, so likely won't ever be) Please re-read http://developer.apple.com/iphone/program/. The new list rules will be posted when the new program terms are. Thanks scott [moderator] On 6-Oct-08, at 9:19 PM, Alex Wait wrote: I know that the iPhone uses cell phone communication technologies, probably like CDMA. (I am a huge n00b on this area of expertise). I am in a group project that needs to do some CDMA programming. Any ideas if there are any C libraries that can help with this function? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
comparing Strings.
Gretings. i'm having a problem comparing some type of strings, for example the one giving me a problem right now. is let's say in my database i have 4 version of the same string . sandro's computer sandro's_computer sandros computer sandros_computer I would like them to compare as being equal, is there a way I can mingle with the comparing routine to ask it to ignore some characters in the comparison? thank you! Sandro. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: comparing Strings.
On 7 Oct 2008, at 4:22 pm, Sandro Noel wrote: i'm having a problem comparing some type of strings, for example the one giving me a problem right now. is let's say in my database i have 4 version of the same string . sandro's computer sandro's_computer sandros computer sandros_computer I would like them to compare as being equal, is there a way I can mingle with the comparing routine to ask it to ignore some characters in the comparison? First strip out the characters to be ignored: NSString* tempString = [myString stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:@'_ ]]; returns sandroscomputer given any of the above. then compare the resulting temporary strings as normal. hth, Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: comparing Strings.
Not aware of any such custom implementation of the strcmp() functions But here is something which you can try : Take the words from the first strings search them in the second. If all words exists in the same order (compare the index to determine the order), then you can say that these are the strings which are same. Also you need to match the total numbers of words in both the strings. For example in below strings sandro computer are the words. Hope this helps. Cheers ! On Tue, Oct 7, 2008 at 10:52 AM, Sandro Noel [EMAIL PROTECTED] wrote: Gretings. i'm having a problem comparing some type of strings, for example the one giving me a problem right now. is let's say in my database i have 4 version of the same string . sandro's computer sandro's_computer sandros computer sandros_computer I would like them to compare as being equal, is there a way I can mingle with the comparing routine to ask it to ignore some characters in the comparison? thank you! Sandro. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/dan.ribe%40gmail.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]