Re: Solving memory leaks
On 28 Mar 2010, at 02:14, Quincey Morris wrote: On Mar 27, 2010, at 16:51, Noah Desch wrote: If you are *not* using getters and setters but instead have myFields declared as: @interface MyClass { NSMutableDictionary *myFields; } and you use the above line of code, and subsequently release myFields in your dealloc method this would *not* be a memory leak, correct? Correct (except that the 'self.' syntax won't work.) The OP had exactly the code pattern you describe: ... if (myFields == nil) myFields = [[NSMutableArray alloc] init]; ... - (void) dealloc { [myFields release]; ... } (The OP called it just 'fields'.) That's not a memory leak -- in the first part, the MyClass object owns the array it creates (once), and it relinquishes ownership in its 'dealloc' (once). There can only be a leak for one of 3 reasons: 1. Some other piece of code assigns a new value to 'myFields' without releasing the old value. That is the only part of my code that adds values to the field. 2. Some other piece of code retains 'myFields', but never releases it. I return the values as keys for an NSDictionary that is the database row. 3. The MyClass object is itself leaked, so its dealloc is never called. I shall try and find out if that is happening, but this was the heaviest hit in Instruments. Is there any easy way to find out if this is happening? M___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Solving memory leaks
That would be gut for the fact that my fields are released and set to nil whenever a new SELECT query is executed - however, I think I can do this by emptying the array when a new query is done and just counting the size of the array in my fetch method - thanks... On 28 Mar 2010, at 18:11, Klaus Backert wrote: On 28 Mar 2010, at 18:40, Michael Davey wrote: 1. Some other piece of code assigns a new value to 'myFields' without releasing the old value. That is the only part of my code that adds values to the field. In order to handle your fields instance variable correctly, what do you think about the following: Create fields in the init method of your MyClass object (I don't know how you call this class): fields = [[NSMutableDictionary alloc] init]; by which you retain the fields dictionary. And destroy fields in the corresponding dealloc method: [fields release]; fields = nil; If you want to use the fields dictionary anywhere in your code, you just do only calls like: [fields addObject: ...]; [fields removeObject: ...]; MyOtherObject *myOtherObject = [fields objectWithKey: ...]; etc. but you do *not* invoke methods which initialize or dealloc the fields object. Klaus ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/frak.off%40gmail.com This email sent to frak@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Solving memory leaks
-(NSDictionary *)fetch { NSMutableDictionary *output = nil; if (db != nil sth != nil) { int c = sqlite3_column_count(sth); if (fields == nil) { fields = [[NSMutableArray alloc] init]; for (int i = 0; i c; ++i) { const char *name = sqlite3_column_name(sth, i); [fields addObject:[NSString stringWithUTF8String:name]]; } } if (sqlite3_step(sth) == SQLITE_ROW) { output = [[[NSMutableDictionary alloc] init] autorelease]; for (int i = 0; i c; ++i) { const unsigned char *val = sqlite3_column_text(sth, i); NSString *value; if (val == nil) { value = @{NULL}; } else { value = [NSString stringWithUTF8String:(char *)val]; } [output setObject:value forKey:[fields objectAtIndex:i]]; } } } return output; } However, can anyone answer how I best go about either of the tasks that I have outlined as red, as they are leaking a lot of memory in comparison?___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Solving memory leaks
I cache the fields array on the first run so that the method is efficient - this is a generic SQLite db wrapper that may potentially be used to access 1000s of rows, and it seems perfectly reasonable that I should be able to store the fields in between SELECTs On 28 Mar 2010, at 19:04, Jack Carbaugh wrote: I'm trying to understand your code logic ... It looks as if you are running a query which returns a list of Fields ... then the values for each of those fields. In the first IF below, you are grabbing the column names to use as keys ... and assigning values for those keys in the 2nd IF. The fields should be local in scope to THIS METHOD only. Therefore, you should release it after using it. if Fields is meant to be used by a tableview or something else, you can get those keys from the output dictionary via allKeys ... so here is my suggested rewrite -(NSDictionary *)fetch { NSMutableDictionary *output = [[NSMutableDictionary alloc] init]; // local only to this method, returned autoreleased NSMutableArray *fields = [[NSMutableArray alloc] init];; // local only to this method, only need to grab column names from a query if (db != nil sth != nil) { int c = sqlite3_column_count(sth); for (int i = 0; i c; ++i) { const char *name = sqlite3_column_name(sth, i); [fields addObject:[NSString stringWithUTF8String:name]]; } if (sqlite3_step(sth) == SQLITE_ROW) { for (int i = 0; i c; ++i) { const unsigned char *val = sqlite3_column_text(sth, i); NSString *value; if (val == nil) { value = @{NULL}; } else { value = [NSString stringWithUTF8String:(char *)val]; } [output setObject:value forKey:[fields objectAtIndex:i]]; } } } // fields no longer needed, so release [fields release]; return [output autorelease]; } However, can anyone answer how I best go about either of the tasks that I have outlined as red, as they are leaking a lot of memory in comparison?___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/intrntmn%40aol.com This email sent to intrn...@aol.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Solving memory leaks
OK, thanks for the links, and the help - I am going to read through and apply what I have learned to my code, I have already managed to fix two other leaks as a result of what I have learned. Thank you. On 28 Mar 2010, at 19:03, Philip Mobley wrote: On Mar 28, 2010, at 10:42 AM, mmalc Crawford wrote: That would be gut for the fact that my fields are released and set to nil whenever a new SELECT query is executed - however, I think I can do this by emptying the array when a new query is done and just counting the size of the array in my fetch method - thanks... Why not follow what someone else suggested earlier in the thread, and the pattern that is recommended in the documentation, and use accessor methods. As soon as you start sprinkling retains and releases throughout your code, you're liable to make a mistake. http://developer.apple.com/mac/library/documentation/cocoa/Conceptual/MemoryMgmt/Articles/mmPractical.html#//apple_ref/doc/uid/TP40004447 Plus when you use accessor, you can put in a call to your NSLog( ) and see exactly whats going on... - (void)setFields:(NSMutableArray *)newFields { NSLog( @-setFields, old fields value: %p with new value %p, fields, newFields ); [fields autorelease]; fields = [newFields mutableCopy]; } When calling setFields, you are then responsible for releasing the newFields NSMutableArray you created in your sample code, because [newFields mutableCopy] increments the ref counter. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/frak.off%40gmail.com This email sent to frak@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Solving memory leaks
Hi! I have been running my iPhone application through the Leaks Instrument in an attempt to further understand what I have been coding, however, I fear I do not know enough about how retain/release work to be able to fix my leaks, and I was wondering if I could paste one trouble spot function that I have identified, and if someone could be so kind as to point out how I can fix the leaks and how to code them out in the future? My function returns a row from a SQLite database as an NSDictionary, and is as follows: -(NSDictionary *)fetch { NSMutableDictionary *output = nil; if (db != nil sth != nil) { int c = sqlite3_column_count(sth); if (fields == nil) { fields = [[NSMutableArray alloc] init]; for (int i = 0; i c; ++i) { const char *name = sqlite3_column_name(sth, i); [fields addObject:[NSString stringWithUTF8String:name]]; } } if (sqlite3_step(sth) == SQLITE_ROW) { output = [[[NSMutableDictionary alloc] init] autorelease]; for (int i = 0; i c; ++i) { const unsigned char *val = sqlite3_column_text(sth, i); NSString *value; if (val == nil) { value = @{NULL}; } else { value = [NSString stringWithUTF8String:(char *)val]; } [output setObject:value forKey:[fields objectAtIndex:i]]; } } } return output; } The first leak reported by instruments is on the line where I alloc and init fields as an NSMutable array. Firstly, fields is declared in my header, and is released in my dealloc method, so I am unsure what I have missed here and would be glad for any pointers on this problem. The second is reported in the following line: [fields addObject:[NSString stringWithUTF8String:name]]; Now, I can see that there is an anonymous string being created, but I am totally unsure as to how I can avoid leaking memory right here? The third leak reported is here: output = [[[NSMutableDictionary alloc] init] autorelease]; Now, I thought by using autorelease I was able to sidestep the issue of releasing this object (and I am pretty sure that adding this help fix an error that clang reported - could this be a false positive?) And the last error is where I create the NSString value from the char *val - I believe this to be a similar class of error as my second leak, and would probably be addressed in a similar fashion. So, sorry for such a lengthy email, and for asking so much of someone's time, but I hope that by seeing where I am going wrong here, I will be able to adopt good practices early on and make my code more robust in the future. Many thanks to the poor soul who has to teach me the error of my ways in advance :o) Mikey___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Solving memory leaks
So, you are saying I should call a retain when I get my reference so that it is kept as an instance var? On 27 Mar 2010, at 19:33, Sandor Szatmari wrote: Every time this method runs you would loose the reference to the memory previously allocated for the fields array. This happens when you assign a newly allocated array to feilds. You should either release fields before reassigning it (conditionally if it is not nil), or do not reallocate memory for it, instead empty it and reuse the existing memory. Sandor Szatmari On Mar 27, 2010, at 15:06, Michael Davey frak@gmail.com wrote: Hi! I have been running my iPhone application through the Leaks Instrument in an attempt to further understand what I have been coding, however, I fear I do not know enough about how retain/release work to be able to fix my leaks, and I was wondering if I could paste one trouble spot function that I have identified, and if someone could be so kind as to point out how I can fix the leaks and how to code them out in the future? My function returns a row from a SQLite database as an NSDictionary, and is as follows: -(NSDictionary *)fetch { NSMutableDictionary *output = nil; if (db != nil sth != nil) { int c = sqlite3_column_count(sth); if (fields == nil) { fields = [[NSMutableArray alloc] init]; for (int i = 0; i c; ++i) { const char *name = sqlite3_column_name(sth, i); [fields addObject:[NSString stringWithUTF8String:name]]; } } if (sqlite3_step(sth) == SQLITE_ROW) { output = [[[NSMutableDictionary alloc] init] autorelease]; for (int i = 0; i c; ++i) { const unsigned char *val = sqlite3_column_text(sth, i); NSString *value; if (val == nil) { value = @{NULL}; } else { value = [NSString stringWithUTF8String:(char *)val]; } [output setObject:value forKey:[fields objectAtIndex:i]]; } } } return output; } The first leak reported by instruments is on the line where I alloc and init fields as an NSMutable array. Firstly, fields is declared in my header, and is released in my dealloc method, so I am unsure what I have missed here and would be glad for any pointers on this problem. The second is reported in the following line: [fields addObject:[NSString stringWithUTF8String:name]]; Now, I can see that there is an anonymous string being created, but I am totally unsure as to how I can avoid leaking memory right here? The third leak reported is here: output = [[[NSMutableDictionary alloc] init] autorelease]; Now, I thought by using autorelease I was able to sidestep the issue of releasing this object (and I am pretty sure that adding this help fix an error that clang reported - could this be a false positive?) And the last error is where I create the NSString value from the char *val - I believe this to be a similar class of error as my second leak, and would probably be addressed in a similar fashion. So, sorry for such a lengthy email, and for asking so much of someone's time, but I hope that by seeing where I am going wrong here, I will be able to adopt good practices early on and make my code more robust in the future. Many thanks to the poor soul who has to teach me the error of my ways in advance :o) Mikey___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/admin.szatmari.net%40gmail.com This email sent to admin.szatmari@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Solving memory leaks
On 27 Mar 2010, at 22:16, Quincey Morris wrote: On Mar 27, 2010, at 14:11, Klaus Backert wrote: something like this (caution: typed in mail, etc.) Yeah, something like this, but *not* this: self.myFields = [[NSMutableArray alloc] init]; That's a memory leak right there. :) Incidentally, I think the OP was mistakenly interpreting Instruments as indicating the point of the leak. Instruments was indicating the place where the leaked object was originally created, which is likely *not* the point of the error. (In fact, there usually isn't a point where the leak occurs -- it occurs because some necessary 'release' was omitted.) So, how do I go about finding this place? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Solving memory leaks
Thank you all so much for your responses - I will give them much better attention tomorrow, and sober :o) On 28 Mar 2010, at 02:23, Klaus Backert wrote: On 27 Mar 2010, at 23:16, Quincey Morris wrote: On Mar 27, 2010, at 14:11, Klaus Backert wrote: something like this (caution: typed in mail, etc.) Yeah, something like this, but *not* this: self.myFields = [[NSMutableArray alloc] init]; That's a memory leak right there. :) Yes, sorry, and shame on me; too fast, too erroneous. The alloc-init retains and is not balanced by a release. Klaus ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/frak.off%40gmail.com This email sent to frak@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: UITable Views and display lags / NSOperation vs NSURLConnection
NSURLConnection was indeed more appropriate for what I needed, and what I ended up using. On 21 Mar 2010, at 18:06, Jack Carbaugh wrote: NSURLConnection does this as well. The main issue i had with using an NSOperation/OperationQueue was that is was serial ... using the NSURLConnection allowed me to handle MULTIPLE asynchronous downloads which, when used with properties allowed near instantaneous UI updates. With the NSOperation avenue, it took longer, UI updates were not as fast as the queue would handle only one operation at a time, in series. For me, the NSURLConnection route was just better for my specific needs and, i think may be as well for the OP. jack On Mar 21, 2010, at 1:53 PM, WT wrote: On Mar 21, 2010, at 6:25 PM, Jack Carbaugh wrote: You don't need to overcomplicate downloading the images with an NSOperation. In my experience, downloading asynchronously with an NSURLConnection and the delegate methods works far better. Jack I don't think using NSOperation is overcomplicating things. It's entirely trivial to use it and, as far as I know, NSOperationQueue takes care of scheduling the threads to make the best use of the resources available. W.= ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/frak.off%40gmail.com This email sent to frak@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
FREED(id)
Hi, I have just encountered the following error at (seemingly) random intervals when trying to debug my iPhone application, and I was wondering what causes it and how I might go about hunting it down so that I can try and fix it? objc[22029]: FREED(id): message release sent to freed object=0x3b45c20 Program received signal: “EXC_BAD_INSTRUCTION”. Many thanks for any help that you can offer... Mikey ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
UITable Views and display lags
Another question... In my application, I have several connected UITable views, and on the last level, I am displaying images that may or may not already be cached, what I would like to know is whether there is some way I can display some sort of notification to the user that this is what is happening, rather than my application hanging whilst the images are fetched from the server? TIA, Mikey___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: FREED(id)
Thank you both for your suggestions, I will give them a go later :o) On 19 Mar 2010, at 18:09, Don Quixote de la Mancha wrote: On Fri, Mar 19, 2010 at 11:00 AM, Nick Zitzmann n...@chronosnet.com wrote: Run your app with Instruments with the object alloc tool, and turn on reference counting and zombies. And hope your app doesn't run out of memory before catching the double-free. You can also try turning on Guard Malloc. That is a menu option in Xcode, and can also be enabled on the command-line for programs that aren't run within Xcode. What Guard Malloc could do for you is catch the use of memory which has been freed. Just using freed memory is likely to occur before your attempt to free it a second time, and so is more likely to be closer to the original release. Don Quixote -- Don Quixote de la Mancha quix...@dulcineatech.com http://www.dulcineatech.com Dulcinea Technologies Corporation: Software of Elegance and Beauty. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/frak.off%40gmail.com This email sent to frak@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: FREED(id)
Thanks, I have managed to find and fix my error, just by using Zombies - I turned on Guard Malloc and it didn't do anything, and I tried instruments and found myself in a whole new world of things I have no idea how to use :o) On 19 Mar 2010, at 18:09, Don Quixote de la Mancha wrote: On Fri, Mar 19, 2010 at 11:00 AM, Nick Zitzmann n...@chronosnet.com wrote: Run your app with Instruments with the object alloc tool, and turn on reference counting and zombies. And hope your app doesn't run out of memory before catching the double-free. You can also try turning on Guard Malloc. That is a menu option in Xcode, and can also be enabled on the command-line for programs that aren't run within Xcode. What Guard Malloc could do for you is catch the use of memory which has been freed. Just using freed memory is likely to occur before your attempt to free it a second time, and so is more likely to be closer to the original release. Don Quixote -- Don Quixote de la Mancha quix...@dulcineatech.com http://www.dulcineatech.com Dulcinea Technologies Corporation: Software of Elegance and Beauty. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/frak.off%40gmail.com This email sent to frak@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: FREED(id)
I will, but for now I just need to get this out of the door for a client - however, it certainly looked like a very powerful tool. On 19 Mar 2010, at 19:43, Greg Parker wrote: On Mar 19, 2010, at 11:55 AM, Michael Davey wrote: Thanks, I have managed to find and fix my error, just by using Zombies - I turned on Guard Malloc and it didn't do anything, and I tried instruments and found myself in a whole new world of things I have no idea how to use :o) Learn it! The Zombie instrument is the best way to track down over-release and under-retain bugs that the static analyzer does not catch. -- Greg Parker gpar...@apple.com Runtime Wrangler ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: FREED(id)
Thank you for your help On 19 Mar 2010, at 20:04, Don Quixote de la Mancha wrote: While Guard Malloc didn't find this particular problem, before you deliver to your client you would do well to test your entire application with Guard Malloc enabled. If it complains, then you've got a bug and a potentially serious one. What it does is manipulate the virtual memory manager so that memory which is not explicitly allocated by your application is marked as unmapped by the VM system. If you try to access any of that memory, even just to read from it, you'll get an immediate crash. Those kinds of bugs can cause all manner of grief, but often would be hard to figure out any other way. Don Quixote -- Don Quixote de la Mancha quix...@dulcineatech.com http://www.dulcineatech.com Dulcinea Technologies Corporation: Software of Elegance and Beauty. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/frak.off%40gmail.com This email sent to frak@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: UITable Views and display lags
That worked a treat - thanks. I was already aware of the threading issues as have developed for the Mac before, but thanks for the heads up On 19 Mar 2010, at 17:55, WT wrote: On Mar 19, 2010, at 6:40 PM, Michael Davey wrote: OK, so I have changed the code to show a placeholder image, but I am a little uncertain as to how to fetch the images asynchronously. I could start a background thread with performSelectorInBackground, but am concerned that this would spawn far too many threads - does anyone have any suggestions? You might want to use an NSOperationQueue. Define NSOperation instances, each fetching one or more images. For each fetching NSOperation you define, you should also define a cleanup NSOperation, dependent on its associated fetching one, so that when the fetching one ends, the cleanup one then swaps the placeholder image out and the fetched images in. Make sure, though, that this swap happens in the main thread, meaning that the cleanup NSOperation should invoke a -performSelectorInMainThread method, rather than access the UI directly. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Case sensitive fileName
I don't think that the OP wanted to iterate through the entire directory though... On 17 Mar 2010, at 16:15, Don Quixote de la Mancha wrote: Does readdir work on Mac OS X? I don't have a Mac handy right now to check, but it should work because so many *NIX programs build on OS X right out of the box. More or less what you do is call opendir on a directory, then rewinddir to set your iterator to the beginning of the directory, then repeatedly call readdir to read each of the items in the directory. This is actually a portable and standardized interface to reading the directory inode. Note that there is both a readdir system call and a readdir library call. You want the library call. The system call is there for the private use of the library call, and isn't meant to make sense or be portable. If readdir does work on OS X, it will get you the filename as it is actually found in the filesystem - that is, with the case preserved. Look up man 3 readdir and friends. Don Quixote -- Don Quixote de la Mancha quix...@dulcineatech.com http://www.dulcineatech.com Dulcinea Technologies Corporation: Software of Elegance and Beauty. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/frak.off%40gmail.com This email sent to frak@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Noob iPhone Question
Hi, I am now being approached to develop an iPhone application for one of my clients which will involve storing a cache of previously downloaded images. My question is whether or not there are constraints as to how my storage space I have at my disposal, and whether any of you have a link to further reading on this subject? regards, M___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Noob iPhone Question
Thanks - I think I may still implement some form of cache control just to keep it manageable though. On 11 Mar 2010, at 21:32, Thomas Mueller wrote: Hi Michael, I don't think there are any artificial limits for how much memory your application can use. As long as there is space left on the device you should be able to keep using it for storing your downloaded images. Regards, Thomas On 12 March 2010 08:08, Michael Davey frak@gmail.com wrote: Hi, I am now being approached to develop an iPhone application for one of my clients which will involve storing a cache of previously downloaded images. My question is whether or not there are constraints as to how my storage space I have at my disposal, and whether any of you have a link to further reading on this subject? regards, M___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/thomasmueller76%40googlemail.com This email sent to thomasmuelle...@googlemail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
UILabel updating from a button click
Hi, I have, for a bit of fun, taken my first steps out of Mac development and into iPhone development, and have encountered a bit of a problem. Basically, what I want to do is update a UILabel when a button is clicked in the view, but I want to be able to update it in intervals with different values. I have tried basically doing this (although this is simplified for the purposes of demonstration) in the IBAction for the button click event: for (int i = 0; i 10; ++i) { label.text = [stringList objectAtIndex:i]; sleep(1); } What happens is that I only see the last value that is set - does anyone here know what I should be doing to code this correctly? Mikey___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSTableViewDataSource Protocol
Hi, I am writing an app that needs to be able to target 10.5 at least and hopefully 10.4, but I have just found that the way that table views are handled has changed - does anyone have a link to some documentation for the old way to do things? Many thanks, Mikey___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSTableViewDataSource Protocol
Weird, cos when I change the Active SDK in Xcode to 10.5 I get the following error: cannot find protocol declaration for 'NSTableViewDataSource' And the docs here: http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Reference/ApplicationKit/Protocols/NSTableDataSource_Protocol/Reference/Reference.html Suggest that it is available to 10.6 and later Any idea what I might be doing wrong? On 18 Feb 2010, at 12:14, Graham Cox wrote: On 18/02/2010, at 11:07 PM, Michael Davey wrote: I have just found that the way that table views are handled has changed That's news to the rest of us! NSTableView dataSource still works just fine. --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 arch...@mail-archive.com
Re: NSTableViewDataSource Protocol
My class is describes as follows: @interface AppController : NSObject MGTwitterEngineDelegate,NSTableViewDataSource I tried removing NSObject and putting it there, but that did not work - any clues? Thanks, btw On 18 Feb 2010, at 12:28, Graham Cox wrote: On 18/02/2010, at 11:21 PM, Michael Davey wrote: Weird, cos when I change the Active SDK in Xcode to 10.5 I get the following error: cannot find protocol declaration for 'NSTableViewDataSource' And the docs here: http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Reference/ApplicationKit/Protocols/NSTableDataSource_Protocol/Reference/Reference.html Suggest that it is available to 10.6 and later Any idea what I might be doing wrong? In 10.6, NSTableViewDataSource became a formal protocol, where previously it was an informal one. While the docs are strictly correct, they're a bit misleading since the methods of the protocol have been available since 10.0 If your datasource is declared thus: @interface MyDS NSTableViewDataSource ... @end you need to remove the angle bracket part for 10.5 --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 arch...@mail-archive.com
Re: NSTableViewDataSource Protocol
OK, just did some reading on informal protocols, thanks a lot for your help Mikey On 18 Feb 2010, at 12:40, Graham Cox wrote: On 18/02/2010, at 11:37 PM, Michael Davey wrote: My class is describes as follows: @interface AppController : NSObject MGTwitterEngineDelegate,NSTableViewDataSource I tried removing NSObject and putting it there, but that did not work - any clues? Thanks, btw Yes, do what I told you, remove the NSTableViewDataSource from the protocol list, like this: @interface AppController : NSObject MGTwitterEngineDelegate --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 arch...@mail-archive.com
Re: NSTableViewDataSource Protocol
Thanks for that! On 18 Feb 2010, at 16:05, Sean McBride wrote: On 2/18/10 12:07 PM, Michael Davey said: I am writing an app that needs to be able to target 10.5 at least and hopefully 10.4, but I have just found that the way that table views are handled has changed - does anyone have a link to some documentation for the old way to do things? http://developer.apple.com/mac/library/releasenotes/Cocoa/Foundation.html Formal Protocol Adoption says: If you need to target Leopard or Tiger with the same sources, you should conditionally declare empty protocols, or else the compiler will complain about missing protocols declarations. For example: #if MAC_OS_X_VERSION_10_6 MAC_OS_X_VERSION_MAX_ALLOWED @protocol NSConnectionDelegate NSObject @end #endif -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSExtraMIData?
I googled and found this, I hope it helps: http://imlocation.wordpress.com/2007/09/13/strange-objects-nscftype-indicate-memory-management-bugs/ On 12 Jan 2010, at 14:54, Graham Cox wrote: Anyone got any idea what NSExtraMIData is? I'm getting a unrecognized selector error logged on this class, but I've never heard of it. --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/frak.off%40gmail.com This email sent to frak@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] how do I stop a running thread
To elaborate and agree... Run your thread in a loop such as: while (isRunning) { // work done here } and have a method such as: -(void)stopThread { isRunning = NO; } On 3 Jan 2010, at 16:56, Glenn L. Austin wrote: Your best bet -- have a flag that the thread can check for exiting. Terminating a thread from outside the thread could leave resources locked and unavailable. On Jan 2, 2010, at 9:49 PM, Tharindu Madushanka wrote: I am creating a thread with method detachNewThreadSelector: How could I stop the thread while it is running ? -- Glenn L. Austin, Computer Wizard and Race Car Driver http://www.austin-soft.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/frak.off%40gmail.com This email sent to frak@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Adding sub menus programatically [SOLVED]
Thanks, this is just what I was mis-understanding - I thought that an NSMenuItem was just a special case of NSMenu, but in fact an NSMenu contains NSMenuItems - which, now, seems very straightforward :o) Hope everyone had a good xmas! Mikey On 25 Dec 2009, at 02:59, Paul Bruneau wrote: On Dec 24, 2009, at 4:25 AM, Michael Davey wrote: Hi, I have googled around but have found nothing that can help me with this... I have a menu in my application that I wish to add sub items to programatically. I have the Menu itself connected up and I can add NSMenuItems to it just fine, but seem at a loss to be able to add a sub menu and the sub itmes to that menu. I suspect my answer lies in this function: - (void)setSubmenu:(NSMenu *)aMenu forItem:(NSMenuItem *)anItem But I do not understand what the forItem part of the method is for. Further, I can retrieve a menu item from the menu, but am also at a loss as to how to retrieve my submenu at a stage in the future. I have a feeling that there is something very simple that I am not understanding here, and would be very grateful if someone could point me in the right direction. And Merry Christmas to everyone!!! anItem is a pointer to the menu item to which you wish to connect the submenu. I was working on code to do this yesterday, and I saw this method, but I preferred instead to just use the -setSubmenu method of my menu items. What you might not be understanding is that you attach a menu to the submenu property of a menu item. You don't add a submenu to a menu as you seem to have put it above. In either case, in the future, when you want to get the submenu, you can send the -submenu message to your menu item that has the submenu attached to it in order to retrieve the submenu. If you don't know which menu item has a particular submenu that you are interested in, you can search through them, or you could set the tag of the menu item of interest and find the item that has that tag at some later time using NSMenu's –itemWithTag: method. Definitely read the menu programming guide and and NSMenu and NSMenuItem class descriptions and I think you'll find that menus are one of the most straightforward parts of Cocoa to understand. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Detect dim/brightness keys on laptop
As far as I know, the system provides you with this choice. On 26 Dec 2009, at 01:01, John Clayton wrote: Hi All I there a way to detect, on a system wide basis, that the dim/brightness keys (or volume keys) have been pressed? I tried using the event-tap API using a HID + head based intercept, running as root with assistive access switched on, but even that doesn't receive the events. My aim is to write a little util that swaps the function keys depending on which app is running (i.e. so that during certain apps you don't have to use the FN key on the laptop to get F1). So I need to have the ability to modify the event stream - e.g. exactly what event taps provides. The only fly in the soup so far is that the brightness (F1 and F2 as well as the volume keys) are not seen by the event tap spike program that Ive written. Looking forward to any tips - thanks. -- John Clayton ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/frak.off%40gmail.com This email sent to frak@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Adding sub menus programatically
Hi, I have googled around but have found nothing that can help me with this... I have a menu in my application that I wish to add sub items to programatically. I have the Menu itself connected up and I can add NSMenuItems to it just fine, but seem at a loss to be able to add a sub menu and the sub itmes to that menu. I suspect my answer lies in this function: - (void)setSubmenu:(NSMenu *)aMenu forItem:(NSMenuItem *)anItem But I do not understand what the forItem part of the method is for. Further, I can retrieve a menu item from the menu, but am also at a loss as to how to retrieve my submenu at a stage in the future. I have a feeling that there is something very simple that I am not understanding here, and would be very grateful if someone could point me in the right direction. And Merry Christmas to everyone!!! Mikey___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Weird problem closing windows
Not quite sure how but I seem to have fixed this - sorry for wasting your time... On 19 Dec 2009, at 18:22, Michael Davey wrote: Hi, I am experiencing a weird problem with my GC (if this is relevant) application when trying to re-display windows that are in the main xib file. More specifically, when I try to launch the preferences panel for the second time it hangs the window with even the close button disabled. Is there something really obvious I am missing with this? Thanks for your time, Mikey ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSAlert or what?
Hi, Sorry for the really noob posting, but I am currently using the NSAlert class to display alerts in my application, but what I would rather do is display one of the alert boxes that slide out of the title bar, as with the installer, firefox and a slew of other applications. Does anyone know what I need to do to do this? Thanks for you time in advance! Mikey___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Weird problem closing windows
Hi, I am experiencing a weird problem with my GC (if this is relevant) application when trying to re-display windows that are in the main xib file. More specifically, when I try to launch the preferences panel for the second time it hangs the window with even the close button disabled. Is there something really obvious I am missing with this? Thanks for your time, Mikey___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSAlert or what?
Thanks for the pointer! On 19 Dec 2009, at 18:37, David A. Lyons wrote: Here's a recipe I discovered recently: Consult the Apple Human Interface Guidelines PDF [1], which sometimes has an Implementation section that tells you what classes, APIs, or constants to use. In this case, browsing for this section: Part III: Aqua Windows Dialogs Types of Dialogs and When to Use Them Sheets (Document-Modal Dialogs) ...reveals the key word sheet, which in NSAlert.h will lead you straight to -[NSAlert beginSheetModalForWindow:modalDelegate:didEndSelector:contextInfo:] In the old days, the HI Guidelines always left us to discover the appropriate implementation ourselves. I like the new Implementation sections a lot, though currently they seem to only exist for the various views and controls. [1] http://developer.apple.com/mac/library/DOCUMENTATION/UserExperience/Conceptual/AppleHIGuidelines/OSXHIGuidelines.pdf Cheers, --Dave On Dec 18, 2009, at 10:37 PM, Michael Davey wrote: Hi, Sorry for the really noob posting, but I am currently using the NSAlert class to display alerts in my application, but what I would rather do is display one of the alert boxes that slide out of the title bar, as with the installer, firefox and a slew of other applications. Does anyone know what I need to do to do this? Thanks for you time in advance! Mikey___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/dlyons%40lyons42.com This email sent to dly...@lyons42.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSAlert or what?
So the problem I was having with my googling was that I was trying alert, popup and dialog - not sheet ;o) On 19 Dec 2009, at 18:41, Ken Thomases wrote: On Dec 19, 2009, at 12:37 AM, Michael Davey wrote: Sorry for the really noob posting, but I am currently using the NSAlert class to display alerts in my application, but what I would rather do is display one of the alert boxes that slide out of the title bar, as with the installer, firefox and a slew of other applications. Does anyone know what I need to do to do this? Those are called sheets. There are methods on NSAlert for displaying the alert as a sheet. Also, read the companion guides listed at the top of the class reference for NSAlert. Cheers, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
A question of legality...
I want to share with you all the 4 arch version of the mysql libs that I went to some trouble to make today, but in light of the information given to me today by Andrew Farmer, I do not know if this is legal. Anyone know? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
mySQL libs and an apology...
First off, sorry to those who I have offended by asking the question of whether or not I can share my libs legally to this list. It was not my intention to do that. What I end up distributing with my application is still being considered, and I hope to resolve that before I approach my clients with my application - as far as I have seen (from router companies at least) is that only the work that is open source needs to be shared and not your entire application. Anyway, that is OT, and I will leave that there as a matter for myself. What I do want to share is this, the 4 architecture mysql client libraries that really should be distributed with the downloaded binaries: http://www.4shared.com/file/157776724/f48387d3/libmysqlclient_r16.html To comply with the licence I also supply the source tarball: http://www.4shared.com/file/158401438/b943a20e/mysql-5141tar.html However, to create the library itself I merely downloaded the 4 binary distributions for each of the architectures from this page: http://dev.mysql.com/downloads/mysql/5.1.html I then extracted the tarballs into one folder and used the following lipo command to create the universal binary: lipo mysql-5.1.40-osx10.5-powerpc/lib/libmysqlclient_r.16.dylib mysql-5.1.40-osx10.5-powerpc-64bit/lib/libmysqlclient_r.16.dylib mysql-5.1.41-osx10.5-x86_64/lib/libmysqlclient_r.16.dylib mysql-5.1.41-osx10.5-x86l/lib/libmysqlclient_r.16.dylib -create -output libmysqlclient_r.16.dylib It was discussed that the PPC64 architecture is a waste of space as it is not widely used, so if you wish you could probably make this again yourself and skip that part entirely. As you can also see, I have only made the thread-safe versions of the library, I need that myself and am guyessing that is most usefulk to the list as well, however, you could follow the same procedure yourselves to make the normal version of the libraries. Again, sorry for the OT part of my discussion, I hope that the libraries I have supplied are of use to someone... Mikey___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Build target question
I am about to add a new target to my project as it will be re-using a lot of the code generated from my server application and I do not want to start creating duplicate copies of classes that I am writing. So far, so good, I am finding my way around making my new target, but have a quick question about sharing... Is it possible for me to use the same main.m Prefix.pch and Info.plist file in both of my applications or will that muck things up? regards, Mikey___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Build target question
Thanks! On 24 Nov 2009, at 14:02, Karolis Ramanauskas wrote: Perhaps not quite what you need but I am working on code for iPhone and OSX in parallel and I am using one main.m, one Prefix.pch. I believe you will need several info.plist files because target specific stuff lives in them, this is easy though because you point to info.plist from the target info panel's build tab. You may need to find a way to separate what part of prefix.pch or main.m is meant for which target. I am doing this with: #if TARGET_OS_IPHONE you may need some other #if statements or may not, since you are not building for a different platform. Karolis On Mon, Nov 23, 2009 at 7:51 PM, Michael Davey frak@gmail.com wrote: I am about to add a new target to my project as it will be re-using a lot of the code generated from my server application and I do not want to start creating duplicate copies of classes that I am writing. So far, so good, I am finding my way around making my new target, but have a quick question about sharing... Is it possible for me to use the same main.m Prefix.pch and Info.plist file in both of my applications or will that muck things up? regards, Mikey___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/karolisr%40gmail.com This email sent to karol...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: UI Question: Hide application window after minimising
I made the same mistake again, of not posting to the list but to my respondent. Fritz, I am sorry. Just to let you know, this was exactly what I required, I managed to get it working and there was absolutely no additional code required to get it to restore! Not that I needed it, but further proof of how far superior the Objective-C/Cocoa paradigm is to C#/.NET Thanks again Fritz On 21 Nov 2009, at 10:09, Michael Davey wrote: On 21 Nov 2009, at 08:19, Fritz Anderson wrote: On 20 Nov 2009, at 2:02 AM, Michael Davey wrote: Basically, when you minimise the application, it is window goes down into the dock as per normal, but once this has been doe it then vanishes from the dock, and does not re-appear. Does anyone know if this is possible within Cocoa and which class docs I need to look at to begin implementing it? Important threshold point: Mac OS X is not Windows. You can't minimize an application — there is nothing on the screen that reifies a whole application.* Applications appear in the form of a set of windows. If there is more than one window, or more than one document, they are all a part of the same application instance. My application only has one window, so this dicussion is a bit moot, but I see your point. What this sounds like is that the application hides itself when one of its windows is miniaturized. ([NSApp hide: nil] when a window's delegate receives windowDidMiniaturize:) This does indeed sound like what I want to do - I guess what I need to know now is how to set a delegate for a window and how to capture events (will try looking for that myself first) I'm curious to know what the use case for this behavior is. On first impression it sounds like a crummy thing to do to the user. When a Mac user clicks the yellow button, he means that he wants to send the window to the Dock. That's what it means in every other application,** and it's not right to appropriate the gesture to mean something else. If the user wants to hide the application, he already knows how to do that: Select Hide (or cmd-H) from the application menu. He doesn't need another way to do it. Or do you mean just to remove the one window from the Dock, leaving all the other windows visible? Again, I'd argue it's a misuse of the gesture. Minimize means minimize, not vanish. If you want vanish, close the window, using the close button or menu command, and not the gesture and animation that say, I'm going to the Dock, and you can find me there. Your application can always bring a closed window back if you want it. I may be missing something in what you're saying. Can you explain what you mean to do in more detail? — F My application is a long running, almost server like application, and the window only really serves the purpose of starting/stopping certain services. Once they are running, having the window visible may actually be a problem as services could be stopped accidentally. I do appreciate your sentiments of the User and why the experience of using a Mac should be as consistent as possible, however, what you seem to be suggesting is that all applications should behave exactly one way whether it is pertinent to the application or not. And one other question, as the application will only then have it's normal dock applcation visible as a way to re-instate the window, could you possibly tell me how this is done? Mikey ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
mySQL client lib linking problem...
I am using the mysql c library in my application, and have wrapped the C calls in an objective-C class (source available if needed). I have added the linking references as per instructions I have found on the web and when I run my application in debug mode everything works just fine, however, when I build it for release, I get a lot of errors that seem to stem from the following: ld: warning: in /usr/local/mysql/lib/libmysqlclient_r.dylib, file is not of required architecture What does this mean if my application compiles and runs just fine in debug mode? I have checked and the links to the zlib and mysqlclient are present for both build configurations, but for whatever reason, it will not build in release. Any help will be gratefully received... Mikey___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: mySQL client lib linking problem...
On 23 Nov 2009, at 16:19, Michael Davey wrote: I am using the mysql c library in my application, and have wrapped the C calls in an objective-C class (source available if needed). I have added the linking references as per instructions I have found on the web and when I run my application in debug mode everything works just fine, however, when I build it for release, I get a lot of errors that seem to stem from the following: ld: warning: in /usr/local/mysql/lib/libmysqlclient_r.dylib, file is not of required architecture What does this mean if my application compiles and runs just fine in debug mode? I have checked and the links to the zlib and mysqlclient are present for both build configurations, but for whatever reason, it will not build in release. Any help will be gratefully received... Mikey I have found the answer - it turns out that the default for release is to build for PPC/i386 and i386_64 - I now either need to find a universal build library or just have my application run on my own architecture only. I have googled and found this solution for building a universal lib: http://nevali.net/post/155123567/how-to-build-universal-binary-mysql-client-libraries However this fails - does anyone else out here either know what to do, or how I can fix the following error: checking for restartable system calls... configure: error: in `/opt/mysql-5.1.41': configure: error: cannot run test program while cross compiling Many thanks... ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: mySQL client lib linking problem...
The dylib is the one that comes from the OS X build of mySQL - I did not build it myself :o( On 23 Nov 2009, at 16:50, Karolis Ramanauskas wrote: I think your dylib file has been compiled under debug only. When you compile your app under release, the compiler complains that dylib is compiled under debug. Recompile your dylib under release then compile your app under release. Better yet you should add you dylib project (drag and drop) to your app project and then in your app's target add dylib as direct dependence this way it will recompile whenever you compile your app. Karolis On Sun, Nov 22, 2009 at 11:19 PM, Michael Davey frak@gmail.com wrote: I am using the mysql c library in my application, and have wrapped the C calls in an objective-C class (source available if needed). I have added the linking references as per instructions I have found on the web and when I run my application in debug mode everything works just fine, however, when I build it for release, I get a lot of errors that seem to stem from the following: ld: warning: in /usr/local/mysql/lib/libmysqlclient_r.dylib, file is not of required architecture What does this mean if my application compiles and runs just fine in debug mode? I have checked and the links to the zlib and mysqlclient are present for both build configurations, but for whatever reason, it will not build in release. Any help will be gratefully received... Mikey___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/karolisr%40gmail.com This email sent to karol...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
UI Question: Hide application window after minimising
Hi there, This is my first post, so please be gentle ;o) I am writing an application using obj-c/Cocoa and I was curious about something I have seen in another application that I would like mine to be able to do. Basically, when you minimise the application, it's window goes down into the dock as per normal, but once this has been doe it then vanishes from the dock, and does not re-appear. Does anyone know if this is possible within Cocoa and which class docs I need to look at to begin implementing it? Many thanks, Mikey___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Fwd: UI Question: Hide application window after minimising
Ooops, forgot the list... From: Michael Davey frak@gmail.com Date: 21 November 2009 09:59:39 GMT+11:00 To: Jason Foreman ja...@threeve.org Subject: Re: UI Question: Hide application window after minimising This is not what I wanted to do, but thanks... On 21 Nov 2009, at 08:05, Jason Foreman wrote: On Nov 20, 2009, at 2:02 AM, Michael Davey wrote: Hi there, This is my first post, so please be gentle ;o) I am writing an application using obj-c/Cocoa and I was curious about something I have seen in another application that I would like mine to be able to do. Basically, when you minimise the application, it's window goes down into the dock as per normal, but once this has been doe it then vanishes from the dock, and does not re-appear. Does anyone know if this is possible within Cocoa and which class docs I need to look at to begin implementing it? In Snow Leopard there is the Minimize windows into application icon preference in the Dock preference pane. The affects all apps though, but has the benefit of having the windows available for the new Dock expose modes. Otherwise, a good place to start looking might be the NSWindow delegate methods. Regards, Jason ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com