Re: programatically updating UI for NSArrayContoller/NSTableView combo
Thanks for taking the time to look at my code guys, I ended up taking mmalc's advice, and rewrote the datasource sans arrayController/bindings. it took me less than 2 hours! Russell On 11/01/2010, at 4:16 AM, mmalc Crawford wrote: On Jan 10, 2010, at 4:57 am, Quincey Morris wrote: I'm not sure where to go next with this ... I would strongly recommend dispensing with bindings for the moment: it's not an entry-level technology; it depends on an understanding of the fundamentals of Cocoa development including object graph management, key-value coding, and key-value observing. I would suggest that it's more fruitful and less frustrating to continue to gain experience by building simpler applications that use the traditional target-action and delegate/datasource patterns, then to return to bindings once you've mastered those. 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/sweetpproductions%40gmail.com This email sent to sweetpproducti...@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: Table object not selected on launch
Hi, I have a similar app that requires the same affect. What I did was create a boolean or valve that indicates if the cell can be selected. In my iphone app, this can be done in the didSelectRowAtIndexPath Method. Something like this: if (indexPath.row getCurrent) { return; } In this example gertCurrent is returned from a sqlite query, if the indexPath.row is greater then the sqlite query, then you can dump out of the method. Regards, Phil On Jan 12, 2010, at 2:28 AM, Jenny M wrote: When my application launches, I have a custom BackgroundView that takes the role of first responder. Within the main window, I have a NSScrollView that contains core data objects in an NSArrayController. I want the objects to load in the table on launch, but I don't want any objects to be *selected* upon launch. I've looked in IB and the docs and can't figure out which attribute to set to make this possible. Thoughts? 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/philip.vallone%40verizon.net This email sent to philip.vall...@verizon.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
widget plugin crashed when i use thread
hi, i would like to implement a widget plugin to detect iTunes current artist and current album call back to widget. i ran my widget plugin in dashcode without crashing. however, i deployed the widget into dashboard, it crashed all the time. following is part of my codes, could any one give me hints to tell me which part may cause this problem. thank you for your help. :) - (id) initWithWebView:(WebView*)webView { self = [super init]; iTunes = [SBApplication applicationWithBundleIdentifier:@com.apple.iTunes]; pTunesRun = TRUE; previousdatabaseID = @; [NSThread detachNewThreadSelector:@selector(checkiTunesStatus) toTarget:self withObject:nil]; return self; } - (void) checkiTunesStatus { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; while (pTunesRun) { if ([iTunes isRunning]) { if ([iTunes playerState] == iTunesEPlSPaused || [iTunes playerState] == iTunesEPlSStopped) { trackInfo = [NSString stringWithFormat: @%s, NOT PLAYING]; } else { if (!iTunes.currentTrack.artist || !iTunes.currentTrack.album) trackInfo = [NSString stringWithFormat: @%@|NULL|NULL, iTunes.currentTrack.name]; else if (!iTunes.currentTrack.artist) trackInfo = [NSString stringWithFormat: @%@|%@|NULL, iTunes.currentTrack.name, iTunes.currentTrack.album]; else if (!iTunes.currentTrack.album) trackInfo = [NSString stringWithFormat: @%@|NULL|%@, iTunes.currentTrack.name, iTunes.currentTrack.artist]; else trackInfo = [NSString stringWithFormat: @%@|%@|%@, iTunes.currentTrack.name, iTunes.currentTrack.album, iTunes.currentTrack.artist]; } currentdatabaseID = [NSString stringWithFormat: @%d, iTunes.currentTrack.databaseID]; } else { trackInfo = [NSString stringWithFormat: @%s, NOT RUNNING]; } if (autoRefresh) { if (![previousdatabaseID isEqualToString: currentdatabaseID]) { NSArray* args = [NSArray arrayWithObjects: trackInfo, nil]; [webScriptObject callWebScriptMethod:@_updateInfo withArguments:args]; previousdatabaseID = [NSString stringWithFormat: @%@, currentdatabaseID]; } } [NSThread sleepForTimeInterval:1.0]; } [pool release]; [NSThread release]; } best, sam ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
appController class in InterfaceBuilder
Hello everybody I'm a blind user. I knew a method to design interfaces using interfaceBuilder by blind developers. The problem is to define outlets, actions an connections in interfaceBuilder. I can add outlets to an object but I can set the controller for the window in interfaceBuilder. Does anybody know where is the appController class in the library of interfaceBuilder or how to define the controller using the keyboard in interfaceBuilder? thanks and regards Jonathan Chacón ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: widget plugin crashed when i use thread
sorry, i have another question about WebScriptObject callWebScriptMethod : i used **[webScriptObject callWebScriptMethod:@_updateInfo withArguments:args];** to call javascript _updateInfo function. it can be called with correct parameters. however, it complains document.getElementById(f_name) is null. i don't know how to access the html element after called from widget plugin. following is in javascript : function _updateInfo(currentTrack) { if (currentTrack != NOT RUNNING currentTrack != NOT PLAYING) { var info = currentTrack.split(|); song = info[0]; album = info[1]; artist = info[2]; //document.getElementById(f_name).innerHTML = song; //document.getElementById(f_album_artist).innerHTML = album + - + artist; } else { // idle(); } } following is part of codes in xcode : - (void) windowScriptObjectAvailable:(WebScriptObject *) scriptObj { [scriptObj setValue:self forKey:@pTunes]; webScriptObject = scriptObj; [webScriptObject retain]; } (omit) NSArray* args = [NSArray arrayWithObjects: trackInfo, nil]; [webScriptObject callWebScriptMethod:@_updateInfo withArguments:args]; i've read ADC documentation, but i still can't figure it out. please teach me. thank you in advance. best, sam On Tue, Jan 12, 2010 at 9:51 PM, Sam Tseng samtz1...@gmail.com wrote: hi, i would like to implement a widget plugin to detect iTunes current artist and current album call back to widget. i ran my widget plugin in dashcode without crashing. however, i deployed the widget into dashboard, it crashed all the time. following is part of my codes, could any one give me hints to tell me which part may cause this problem. thank you for your help. :) - (id) initWithWebView:(WebView*)webView { self = [super init]; iTunes = [SBApplication applicationWithBundleIdentifier:@com.apple.iTunes]; pTunesRun = TRUE; previousdatabaseID = @; [NSThread detachNewThreadSelector:@selector(checkiTunesStatus) toTarget:self withObject:nil]; return self; } - (void) checkiTunesStatus { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; while (pTunesRun) { if ([iTunes isRunning]) { if ([iTunes playerState] == iTunesEPlSPaused || [iTunes playerState] == iTunesEPlSStopped) { trackInfo = [NSString stringWithFormat: @%s, NOT PLAYING]; } else { if (!iTunes.currentTrack.artist || !iTunes.currentTrack.album) trackInfo = [NSString stringWithFormat: @%@|NULL|NULL, iTunes.currentTrack.name]; else if (!iTunes.currentTrack.artist) trackInfo = [NSString stringWithFormat: @%@|%@|NULL, iTunes.currentTrack.name, iTunes.currentTrack.album]; else if (!iTunes.currentTrack.album) trackInfo = [NSString stringWithFormat: @%@|NULL|%@, iTunes.currentTrack.name, iTunes.currentTrack.artist]; else trackInfo = [NSString stringWithFormat: @%@|%@|%@, iTunes.currentTrack.name, iTunes.currentTrack.album, iTunes.currentTrack.artist]; } currentdatabaseID = [NSString stringWithFormat: @%d, iTunes.currentTrack.databaseID]; } else { trackInfo = [NSString stringWithFormat: @%s, NOT RUNNING]; } if (autoRefresh) { if (![previousdatabaseID isEqualToString: currentdatabaseID]) { NSArray* args = [NSArray arrayWithObjects: trackInfo, nil]; [webScriptObject callWebScriptMethod:@_updateInfo withArguments:args]; previousdatabaseID = [NSString stringWithFormat: @%@, currentdatabaseID]; } } [NSThread sleepForTimeInterval:1.0]; } [pool release]; [NSThread release]; } best, sam -- Sam Tseng Academia Sinica Institute of Astronomy and Astrophysics Tel: +886-2-2366-5392 Fax: +886-2-2367-7849 ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: A password strength checker
Code is available at: http://code.google.com/p/nukethemfromorbit/source/browse/#svn/trunk/PasswordStrength It's just the method for determining the strength, any UI accouterments is an exercise left up to the reader... although I'll probably make my stuff available once I have it cleaned up. If anyone has suggestions for improvement of the algorithm, please let me know. Jim On Mon, Jan 11, 2010 at 10:05 PM, Howard Siegel hsie...@gmail.com wrote: If you would, please post your code some place and let us know the URL to it. There is supposed to be an iPhone version coming out, but I suspect that it will be done using MonoDevelop (C#.NET for non-Windows platforms) rather than being written in ObjC/Cocoa. - h On Mon, Jan 11, 2010 at 08:12, Jim Turner jturner.li...@gmail.com wrote: Awesome find, Howard. I've needed a password strength algorithm in the past and never could find one. Plus, the strength computed by the Password Assistant is questionable at best. Given a password of '' (20 lowercase 'a'), the assistant scores it about a 20%. Add one more 'a' though and it jumps to 80%. I'm not sure how that one extra 'a' is worth a 60% increase in strength. I'd be nice if their implementation was a bit more open for examination. The algorithm used by KeePass, however, scores both a 20-character 'a' and 21-character 'a' password as 10 (with 0 being no password or a worthless password). Seems more accurate. If anyone's interested in it, I wrote a Cocoa version of their implementation. I'd be happy to make it available. Jim On Thu, Jan 7, 2010 at 2:32 PM, Howard Siegel hsie...@gmail.com wrote: Have a look at the source code for KeePass Password Safe ( http://keepass.info/). It has a password generator and strength computation. Version 1.x is written in C++ for MS Windows (using MFC). Version 2.x is a rewrite in C# for .NET. It has been ported as KeyPassX for Mac OS X and Linux. - h On Thu, Jan 7, 2010 at 11:51, Martin Hewitson martin.hewit...@aei.mpg.dewrote: Dear list, Is anybody aware of a reasonable algorithm or some code that can be used to test/check the strength of a password? I'd like to give a kind of score or a color (red,yellow,green). I've looked at cracklib, but that doesn't give a score, really. Best wishes, Martin Martin Hewitson Albert-Einstein-Institut Max-Planck-Institut fuer Gravitationsphysik und Universitaet Hannover Callinstr. 38, 30167 Hannover, Germany Tel: +49-511-762-17121, Fax: +49-511-762-5861 E-Mail: martin.hewit...@aei.mpg.de WWW: http://www.aei.mpg.de/~hewitson http://www.aei.mpg.de/%7Ehewitson ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/hsiegel%40gmail.com This email sent to hsie...@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/jturner.lists%40gmail.com This email sent to jturner.li...@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
Almost! to the end
Thanks to many, many folk, I am at the very end of my project .. calculating an Excel spreadsheet, cell by cell .. with the calculations done in a background thread .. using either +detachNewThreadSelector and/or NSPorts with NSPortMessages, or even a NSOperationQueue. Tried all 3 approaches just for the sake of learning, and they all work. It's definitely been quite an education for me and quite an exercise in patience for all you folks. Oh, one more thing .. I use HAS's appscript application, ASTranslate, to convert my previous! AppleScript Studio code to Cocoa .. and it really works. After completing each row's worth of calculations, I test for the existence of both Excel and the spreadsheet .. in case the user prematurely quits the app or closes the spreadsheet .. and it works like a charm .. if quitting or closing, a message appears in my doc window. EXCEPT, if the user quits the app or closes the spreadsheet in the middle of completing the calculations for each row before I have a chance to do the appropriate testing. Even if I burden my code by testing before each cell in the entire row, I still (theoretically) could encounter a quit or a close in the middle of a cell's calculation. Clearly, getting or setting the value in a cell of a spreadsheet doc that is closed crashes my app. My very initial thoughts focus on NSError, except HAS's ASTranslate app does not seem to include a built in NSError object, such as is passed to NSDocument's -readFromURL. Any help out there for this worst-case scenario? Thanks in advance. John Love Touch the Future! Teach! ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: What's the right way to make the last (or only) table column fill the width of an NSTableView?
No, I wasn't aware of that, and I certainly don't find mention of it in the documentation for NSTableView or NSTableColumn. But tonight when I get home, I will try it! On 2010-01-11 23:53, Kyle Sluder wrote: On Mon, Jan 11, 2010 at 10:58 AM, Charles Jenkinscjenk...@tec-usa.com wrote: The ZIP Inspector program works as advertised, but I'm annoyed by the fact that the filenames shown in the Table View get truncated due to the width of their column, which does not resize no matter how big I make the Table View. (The Table View resizes with the window, and I've set the column's Max Width to 1.) I'm confused. This works out of the box for me on Snow Leopard. Drop an NSTableView in a window, set the autoresize mask, removed the second column, made the remaining column the width of the table view. Works like a charm. Perhaps you aren't aware that a column will only resize if it is already the width of the view? --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: What's the right way to make the last (or only) table column fill the width of an NSTableView?
On Jan 12, 2010, at 8:00 AM, Charles Jenkins wrote: No, I wasn't aware of that, and I certainly don't find mention of it in the documentation for NSTableView or NSTableColumn. But tonight when I get home, I will try it! Please log documentation bugs (or use the documentation feedback form at the bottom of the doc pages) to provide feedback like this. It will help us make our documentation better. Thanks! corbin On 2010-01-11 23:53, Kyle Sluder wrote: On Mon, Jan 11, 2010 at 10:58 AM, Charles Jenkinscjenk...@tec-usa.com wrote: The ZIP Inspector program works as advertised, but I'm annoyed by the fact that the filenames shown in the Table View get truncated due to the width of their column, which does not resize no matter how big I make the Table View. (The Table View resizes with the window, and I've set the column's Max Width to 1.) I'm confused. This works out of the box for me on Snow Leopard. Drop an NSTableView in a window, set the autoresize mask, removed the second column, made the remaining column the width of the table view. Works like a charm. Perhaps you aren't aware that a column will only resize if it is already the width of the view? --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: prepareSavePanel - save as or save to?
There's nothing convenient built in. My solution is to add an ivar along the lines of lastSavePanelOperation. Override like so: - (void)runModalSavePanelForSaveOperation:(NSSaveOperationType)saveOperation delegate:(id)delegate didSaveSelector:(SEL)didSaveSelector contextInfo:(void *)contextInfo { lastSavePanelOperation = saveOperation; [super runModalSavePanelForSaveOperation:saveOperation delegate:delegate didSaveSelector:didSaveSelector contextInfo:contextInfo]; } And then in -prepareSavePanel:, you have access to what the operation is. On 12 Jan 2010, at 07:11, jeff...@aol.com wrote: Hi, Is there a way to tell in prepareSavePanel if the save operation is an NSSaveAsOperation or an NSSaveToOperation? thanks Jeff ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net This email sent to cocoa...@mikeabdullah.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Drawing A Mutable String
Well, I feel dumb. Your (Andy's) mention of setNeedsDisplay: caught my eye, and I realized soon after that the button whose method causes invalidStack to be YES never tells the view the redraw. I still don't entirely understand why the text didn't get drawn when the view was subsequently redrawn (because of tabbing through controls, resizing, etc.), but at least it works as intended now. Any insight is still appreciated. Michael S Craig (908) 328 8030 On Mon, Jan 11, 2010 at 4:15 PM, Andy Lee ag...@mac.com wrote: Bizarre. I love bugs like this that it's easy to prove can't possibly be happening. :) The only desperate, farfetched suggestion I have is that somehow you've accidentally created two instances of your GameView, only one of which is visible, and for some reason when invalidStack is true, the correct drawing *is* happening but in the wrong view. I would think this would be obvious if it were the case, but still, what if you add the following line? NSLog(@%@ -- %p, [self className], self); Do you always see the same pointer value printed? As I said, farfetched, but I see that like me, you like to test the most basic assumptions. Also, I assume you aren't calling drawRect: directly, right? Or setNeedsDisplay:NO, or any other dirty rect manipulation? I'd be willing to look at the code, with complete respect for confidentiality, if you're trusting enough to send it to me and at liberty to do so. --Andy On Monday, January 11, 2010, at 12:25PM, Michael Craig mks...@gmail.com wrote: Andy: There's nothing drawing over it. I can move that chunk of code to the end of drawRect: with the same result. Quincy: rightAligned is a paragraph style object that's defined elsewhere in drawRect and used in a few different places. Fritz: All four things you mention are apparently true when I run it through the debugger, so the if statement must be working. What's more, I can see that it's working by inserting a printf inside (or after) the if and seeing the fully appended string there. How is it possible that I can append the value of infoStr, see that new value at the console with printf, then draw it and get the old value? Also, I can appended another string to infoStr after the invalidStack if statement and it gets drawn (always, since it's not in an if), but the string appended in the invalidStack if statement still doesn't get drawn. They both show up in the console when I printf infoStr, but the invalidStack piece in the middle of the string is left out when infoStr is drawn. Gah! Michael S Craig (908) 328 8030 On Thu, Jan 7, 2010 at 4:18 PM, Fritz Anderson fri...@manoverboard.org wrote: On 7 Jan 2010, at 2:29 PM, Michael Craig wrote: if ([theDeck.cardPile count] == 0) { [infoStr appendString: @\n\nThe deck is empty.]; // *2* } if (gameCon.invalidStack) { [infoStr appendString: @\n\nThat's an invalid stack.]; // *1* } [infoStr drawInRect: infoRect withAttributes: infoAtts]; ... If I move the line marked *1* to come after the line marked *2*, then both messages are drawn when the deck is empty, as one would expect. If I move the line marked *1* one line down (so it's outside of the invalidStack if statement and the if is empty), then invalidStack message is drawn at all times, as one would expect. So what is keeping it from drawing the appended text when it happens inside the invalidStack if statement? Like I said above, the if statement itself works fine. I don't understand why you say the if statement works fine. You say it doesn't execute its body when you think its condition is true. That means it doesn't work fine, doesn't it? When you execute this code line-by-line in the debugger, do you see with your own eyes: • gameCon (assuming it is an object pointer) is not nil? • gameCon.invalidStack is non-zero? • Control ever reaches line 1? • infoStr changes content? — F ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 ag...@mac.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: NSExtraMIData?
On 1/12/10 3:58 PM, Graham Cox said: The static analyzer is very good at what it does. Are you remembering to Build and Analyze? I sure am - that's what's such a pain, my app passes with no issues but I get these occasional reports from the field, but very unrepeatably. Are you using the analyzer that comes with Xcode 3.2? It's quite old at this point, you could try a newer version: http://clang-analyzer.llvm.org/ It doesn't integrate into Xcode, but you can run it from Terminal, and it generates html results. -- 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
NSFileHandle weirdness on 10.5 ...
Hello, I'm hoping someone can help me out here. I'm trying to use IPC (Unix domain socket AF_UNIX) to pass data between two applications. I have a console application which is sending data to the socket path and a Cocoa GUI app which is reading it using NSFileHandle. The problem I'm seeing is on 10.5 systems I'm not getting all of the data. I'm only getting 502 characters, but on 10.6 i'm getting the whole thing. Is there some kind of buffer size I can adjust, I'm not really sure what to do? Thanks, Charles ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSExtraMIData?
On 1/11/10 8:10 PM, Greg Parker said: Most likely, you over-released some other object and then an NSExtraMIData was allocated at the same address. When you later try to use the dead over-released object, the message is sent to the NSExtraMIData object. Greg, Is there any way to prevent future objects from being allocated at a previously used address? It seems that would help debug such things. Even more generally, can free() be made to: 1) scribble the passed buffer (MallocScribble) 2) leak the buffer 3) mark the associated pages as no access ? -- 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
(void *)contextInfo
I am trying to get some contextinfo across while a sheet is displayed. Here is the code that displays the sheet: NSArray *theContextInfo = [[NSArray alloc] init]; theContextInfo = [NSArray arrayWithObject:objTBD]; [NSApp beginSheet: alertWindow modalForWindow: [selfwindowForSheet] modalDelegate: self didEndSelector: @selector(didEndSheet:returnCode:contextInfo:) contextInfo: theContextInfo]; and here is the code that runs eventually after the sheet has been dismissed: - (void)didEndSheet:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { NSLog(@Sheet End); NSLog(@%@, [contextInfo class]); [sheet orderOut:self]; } The contextinfo's class is logged as NSConcreteMutableData. How can I get back to the array? Why is contextinfo considered to be of class void in the signature? What am I missing? (Another newbie thing I suspect...) Thanks, Rainer ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: (void *)contextInfo
On Jan 12, 2010, at 11:51 AM, Rainer Standke wrote: NSArray *theContextInfo = [[NSArray alloc] init]; theContextInfo = [NSArray arrayWithObject:objTBD]; Well that's a leak already... The alloc/init is a waste. [NSApp beginSheet: alertWindow modalForWindow: [self windowForSheet] modalDelegate: self didEndSelector: @selector(didEndSheet:returnCode:contextInfo:) contextInfo: theContextInfo]; And here you passed an autoreleased object as the context info which means it's going to be deallocated at the end of the run loop. You should be passing a retained object to context info... - (void)didEndSheet:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { And grabbing it here, and releasing it somehow to balance the retain. NSArray * array = [(NSArray *)contextInfo autorelease]; The contextinfo's class is logged as NSConcreteMutableData. Because that pointer is now pointing at entirely different object. Your array has already been deallocated and an NSMutableData instance took its place. Why is contextinfo considered to be of class void in the signature? Because void * can be a pointer to *anything*. contextInfo is not just limited to Obj-C objects. You could pass a pointer to an integer if you wanted. (It's even not out of the question to pass an integer value directly to contextInfo instead of using a pointer to one.) -- Seth Willits ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: (void *)contextInfo
On Tue, Jan 12, 2010 at 2:51 PM, Rainer Standke li...@standke.com wrote: Here is the code that displays the sheet: NSArray *theContextInfo = [[NSArray alloc] init]; This creates a new array that you are responsible for releasing when you're finished with it. theContextInfo = [NSArray arrayWithObject:objTBD]; This creates a new array that you are *not* responsible for releasing. Because you assign the result to theContextInfo without releasing the previous array, that one leaks. Because you expect to use the new array later, you should have retained it. What am I missing? (Another newbie thing I suspect...) The memory management guidelines: http://developer.apple.com/mac/library/documentation/cocoa/Conceptual/MemoryMgmt/MemoryMgmt.html Additionally, I'd recommend making theContextInfo into an instance variable, rather than passing it through the contextInfo. You can then write (or @synthesize) an accessor method that encapsulates all of the relevant memory management into one place, which is *far* less error-prone than scattering -retain and -release calls all over the place. sherm-- -- Cocoa programming in Perl: http://www.camelbones.org ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: (void *)contextInfo
On Jan 12, 2010, at 12:51 PM, Rainer Standke wrote: The contextinfo's class is logged as NSConcreteMutableData. How can I get back to the array? Why is contextinfo considered to be of class void in the signature? What am I missing? (Another newbie thing I suspect...) If you're using RR, then you must manually retain the array, and release it in the did-end selector, because in this case, the autorelease pool is deleting the array, and the pointer is being reassigned. The reason is because contextInfo is a void * and can be set to any memory address, not just an object, so the beginSheet method does not retain the object. If you're using GC, and the pointer's address is being re-assigned, then it probably got finalized behind your app's back, and so you can emulate retain/release in this case by using the disable/enable methods of NSGarbageCollector. Nick Zitzmann http://www.chronosnet.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: (void *)contextInfo
On Jan 12, 2010, at 2:51 PM, Rainer Standke wrote: I am trying to get some contextinfo across while a sheet is displayed. Here is the code that displays the sheet: NSArray *theContextInfo = [[NSArray alloc] init]; theContextInfo = [NSArray arrayWithObject:objTBD]; You're leaking an array here. The first [[NSArray alloc] init] is unnecessary, since you're overwriting theContextInfo immediately afterwards. Also, if you're just putting one object in your array, you might as well just pass that object instead of the array in theContextInfo. [NSApp beginSheet: alertWindow modalForWindow: [selfwindowForSheet] modalDelegate: self didEndSelector: @selector(didEndSheet:returnCode:contextInfo:) contextInfo: theContextInfo]; and here is the code that runs eventually after the sheet has been dismissed: - (void)didEndSheet:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { NSLog(@Sheet End); NSLog(@%@, [contextInfo class]); [sheet orderOut:self]; } The contextinfo's class is logged as NSConcreteMutableData. How can I get back to the array? Why is contextinfo considered to be of class void in the signature? NSArray *theOriginalArray = (NSArray *)contextInfo. contextInfo is a void * to make it possible to pass in anything you like. You just have to cast it back to whatever it was when you passed it in in your other method. By the way, It's also not of class void. Void is not a class at all, and calling class on a void * is meaningless - at this point, you're the only one who knows what class contextInfo should be interpreted as (if it's a class, which it doesn't have to be). Best, Hank ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Snapshotting hidden UIViews
I'm trying to create a snapshot UIImage from a UITextView that's inside a larger, hidden UIView. renderInContext: works fine for visible UIView layers, but I can't get consistent results for hidden views. I read somewhere (can't recall the source, but it wasn't authoritative) that this is expected behavior, and that -renderInContext: is only guaranteed to work for visible UIViews' layers. Is this true? If so, how else can I replicate *exactly* what my UITextView would look like when visible? -Michael ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: (void *)contextInfo
On Jan 12, 2010, at 8:51 PM, Rainer Standke wrote: Here is the code that displays the sheet: NSArray *theContextInfo = [[NSArray alloc] init]; theContextInfo = [NSArray arrayWithObject:objTBD]; [NSApp beginSheet: alertWindow modalForWindow: [selfwindowForSheet] modalDelegate: self didEndSelector: @selector(didEndSheet:returnCode:contextInfo:) contextInfo: theContextInfo]; and here is the code that runs eventually after the sheet has been dismissed: - (void)didEndSheet:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { NSLog(@Sheet End); NSLog(@%@, [contextInfo class]); [sheet orderOut:self]; } The contextinfo's class is logged as NSConcreteMutableData. How can I get back to the array? Why is contextinfo considered to be of class void in the signature? What am I missing? (Another newbie thing I suspect...) The first array is created (and you own it) but the second assignment one throws away the reference (so you leak the just created array). Also, the second reference (which gets passed to your didEndSheet: message) is likely garbage by the time the sheet returns because you didn't retain the array. You probably want something like this: NSArray *theContextInfo = [[NSArray alloc] initWithObject:objTBD]; [... your sheet code here]; - (void)didEndSheet:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { NSArray *array = (NSArray *)contextInfo; [... do something with the array] // you need to release it when done because you own it. [array release]; NSLog(@Sheet End); NSLog(@%@, [contextInfo class]); [sheet orderOut:self]; } Regards Markus -- __ Markus Spoettl smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: (void *)contextInfo
On 1/12/10 3:04 PM, Sherm Pendley said: Additionally, I'd recommend making theContextInfo into an instance variable, rather than passing it through the contextInfo. You can then write (or @synthesize) an accessor method that encapsulates all of the relevant memory management into one place, which is *far* less error-prone than scattering -retain and -release calls all over the place. Additionally, with GC, one must be very careful passing Obj-C objects through void* pointers. See Managing Opaque Pointers here: http://developer.apple.com/mac/library/documentation/cocoa/conceptual/ GarbageCollection/Articles/gcUsing.html If you can require 10.6, I believe the new block APIs make the memory management simpler (haven't tried myself). -- 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
how do you set the value of a UIPickerView programatically? [solved]
First, sorry about my last post with the RE:Contents of ... title. My bad. Anyhow, I figured out what was wrong. Seems you need to call [self.view addSubview:picker] to hook up the picker to the view controller. I am doing that in my viewDidLoad method. Regards, Paul ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: how do you set the value of a UIPickerView programatically?
This should work but would make most sense in viewDidAppear if the user should be able to enjoy the animation. [picker selectRow:indexOfCurrentValue inComponent:0 animated:YES]; You have set the Pickers delegate? Regards, Bertil___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: how do you set the value of a UIPickerView programatically? [solved]
On Jan 12, 2010, at 12:26 PM, Paul Archibald wrote: Anyhow, I figured out what was wrong. Seems you need to call [self.view addSubview:picker] to hook up the picker to the view controller. I am doing that in my viewDidLoad method. If the picker is already a subview of the view controller's view in the XIB, then this should not be necessary. -- David Duncan Apple DTS Animation and Printing ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSExtraMIData?
Turn on NSZombieEnabled. On 12 Jan 2010, at 18:51, Sean McBride wrote: On 1/11/10 8:10 PM, Greg Parker said: Most likely, you over-released some other object and then an NSExtraMIData was allocated at the same address. When you later try to use the dead over-released object, the message is sent to the NSExtraMIData object. Greg, Is there any way to prevent future objects from being allocated at a previously used address? It seems that would help debug such things. Even more generally, can free() be made to: 1) scribble the passed buffer (MallocScribble) 2) leak the buffer 3) mark the associated pages as no access ? -- 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/cocoadev%40mikeabdullah.net This email sent to cocoa...@mikeabdullah.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Table object not selected on launch
Hi Phillip, Hmm, I don't think your solution will work for me. I don't have a didSelectRowAtIndexPath method anywhere in my code. I'm not building an iPhone app, so, I think I can use IB and my components a bit differently. Is there any method anywhere that deselects, either in the table cell or in the object array controller? Thanks though, Jenny On Tue, Jan 12, 2010 at 2:14 AM, Philip Vallone philip.vall...@verizon.netwrote: Hi, I have a similar app that requires the same affect. What I did was create a boolean or valve that indicates if the cell can be selected. In my iphone app, this can be done in the didSelectRowAtIndexPath Method. Something like this: if (indexPath.row getCurrent) { return; } In this example gertCurrent is returned from a sqlite query, if the indexPath.row is greater then the sqlite query, then you can dump out of the method. Regards, Phil On Jan 12, 2010, at 2:28 AM, Jenny M wrote: When my application launches, I have a custom BackgroundView that takes the role of first responder. Within the main window, I have a NSScrollView that contains core data objects in an NSArrayController. I want the objects to load in the table on launch, but I don't want any objects to be *selected* upon launch. I've looked in IB and the docs and can't figure out which attribute to set to make this possible. Thoughts? 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/philip.vallone%40verizon.net This email sent to philip.vall...@verizon.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSExtraMIData?
I guess when dealing with Obj-C objects, NSZombieEnabled=YES together with NSDeallocateZombies=NO does #2 and sorta does #3. But, as I said, I was wondering if there is a way to extend this to all allocations (ie non-objects). Additionally, NSZombieEnabled does nothing under GC, and I'd be interesting in knowing if there is something similar for that case. On 1/12/10 9:37 PM, Mike Abdullah said: Turn on NSZombieEnabled. On 12 Jan 2010, at 18:51, Sean McBride wrote: On 1/11/10 8:10 PM, Greg Parker said: Most likely, you over-released some other object and then an NSExtraMIData was allocated at the same address. When you later try to use the dead over-released object, the message is sent to the NSExtraMIData object. Greg, Is there any way to prevent future objects from being allocated at a previously used address? It seems that would help debug such things. Even more generally, can free() be made to: 1) scribble the passed buffer (MallocScribble) 2) leak the buffer 3) mark the associated pages as no access ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: (void *)contextInfo
Thanks, everyone, for your help. Rainer On Jan 12, 2010, at 12:19 , Markus Spoettl wrote: On Jan 12, 2010, at 8:51 PM, Rainer Standke wrote: Here is the code that displays the sheet: NSArray *theContextInfo = [[NSArray alloc] init]; theContextInfo = [NSArray arrayWithObject:objTBD]; [NSApp beginSheet: alertWindow modalForWindow: [selfwindowForSheet] modalDelegate: self didEndSelector: @selector(didEndSheet:returnCode:contextInfo:) contextInfo: theContextInfo]; and here is the code that runs eventually after the sheet has been dismissed: - (void)didEndSheet:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { NSLog(@Sheet End); NSLog(@%@, [contextInfo class]); [sheet orderOut:self]; } The contextinfo's class is logged as NSConcreteMutableData. How can I get back to the array? Why is contextinfo considered to be of class void in the signature? What am I missing? (Another newbie thing I suspect...) The first array is created (and you own it) but the second assignment one throws away the reference (so you leak the just created array). Also, the second reference (which gets passed to your didEndSheet: message) is likely garbage by the time the sheet returns because you didn't retain the array. You probably want something like this: NSArray *theContextInfo = [[NSArray alloc] initWithObject:objTBD]; [... your sheet code here]; - (void)didEndSheet:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { NSArray *array = (NSArray *)contextInfo; [... do something with the array] // you need to release it when done because you own it. [array release]; NSLog(@Sheet End); NSLog(@%@, [contextInfo class]); [sheet orderOut:self]; } Regards Markus -- __ Markus Spoettl ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/lists%40standke.com This email sent to li...@standke.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: Table object not selected on launch
Thanks to a hint from Laurent and a point to the right part of NSArrayController's documentation, I have a solution. I placed this line of code in AppDelegate's awakeFromNib: - [myArrayController setSelectionIndexes:[NSIndexSet indexSet]]; - and UN-checked the Avoid Empty Selection checkbox in IB for the arraycontroller. Works great now.. On Mon, Jan 11, 2010 at 11:28 PM, Jenny M safflo...@gmail.com wrote: When my application launches, I have a custom BackgroundView that takes the role of first responder. Within the main window, I have a NSScrollView that contains core data objects in an NSArrayController. I want the objects to load in the table on launch, but I don't want any objects to be *selected* upon launch. I've looked in IB and the docs and can't figure out which attribute to set to make this possible. Thoughts? 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: NSExtraMIData?
On Jan 12, 2010, at 1:52 PM, Sean McBride wrote: I guess when dealing with Obj-C objects, NSZombieEnabled=YES together with NSDeallocateZombies=NO does #2 and sorta does #3. But, as I said, I was wondering if there is a way to extend this to all allocations (ie non-objects). Additionally, NSZombieEnabled does nothing under GC, and I'd be interesting in knowing if there is something similar for that case. Guard Malloc is the heavyweight catch-everything guard. It memory-protects all freed blocks, both objects and non-objects. But the cost is a big performance hit in time and space. On Snow Leopard, AUTO_USE_GUARDS=YES is similar to Guard Malloc for GC-allocated memory. -- 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: how do you set the value of a UIPickerView programatically? [solved]
Ahh, now I see it, you are correct. I had been alloc/init'ing some other UI elements that were not created in IB, and this got that treatment, too, so the picker was double-allocated. I need to more careful copy/pasting my own code. On Jan 12, 2010, at 12:53 PM, David Duncan wrote: On Jan 12, 2010, at 12:26 PM, Paul Archibald wrote: Anyhow, I figured out what was wrong. Seems you need to call [self.view addSubview:picker] to hook up the picker to the view controller. I am doing that in my viewDidLoad method. If the picker is already a subview of the view controller's view in the XIB, then this should not be necessary. -- David Duncan Apple DTS Animation and Printing ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: (void *)contextInfo
Nick Zitzmann wrote: If you're using GC, and the pointer's address is being re-assigned, then it probably got finalized behind your app's back, and so you can emulate retain/release in this case by using the disable/enable methods of NSGarbageCollector. I didn't understand that bit. disable/enable methods of NSGarbageCollector, that seems like a very heavy-handed way to stop a pointer from being collected, just shutting GC off. I never totally understood the section in the GC documents about opaque (void*) pointers and why they need to be specifically handled in order for the garbage collector to find them (it's a pointer to something which turns out to be an object but I'm sure it's a whole load more complicated than that), however it's there and tells you to use a CFRetain()/CFRelease() pair on them if you are using GC. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: (void *)contextInfo
On Jan 12, 2010, at 5:47 PM, Roland King wrote: I didn't understand that bit. disable/enable methods of NSGarbageCollector, that seems like a very heavy-handed way to stop a pointer from being collected, just shutting GC off. I didn't mean shutting GC off entirely. I meant disabling collection for a pointer temporarily and re-enabling it when you're done, which is one way of solving the problem of passing an object into a function/method that takes a generic pointer. You can do that with NSGarbageCollector. Nick Zitzmann http://www.chronosnet.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: (void *)contextInfo
ah I see you mean the disableColectorForPointer: and enableCollectorForPointer: methods, sorry I read enable/disable and went to look at those methods Nick Zitzmann wrote: On Jan 12, 2010, at 5:47 PM, Roland King wrote: I didn't understand that bit. disable/enable methods of NSGarbageCollector, that seems like a very heavy-handed way to stop a pointer from being collected, just shutting GC off. I didn't mean shutting GC off entirely. I meant disabling collection for a pointer temporarily and re-enabling it when you're done, which is one way of solving the problem of passing an object into a function/method that takes a generic pointer. You can do that with NSGarbageCollector. Nick Zitzmann http://www.chronosnet.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Managed Object with Getter
A property declaration attribute with the getter shown below does not work for a NSManagedObject subclass. @property (nonatomic, retain, getter=isSelected) NSNumber *selected; It produces error unrecognized selector sent to instance. What did I do wrong? --Richard ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Gray Scope Buttons in UISearchBar
I have an iPhone app which has a UISearchBar with Scope Buttons. But when I change the colour of the UISearchBar (e.g. to Black Opaque) the scope buttons still are displayed in the default gray. How can I change the color of the scope buttons to be the same (or similar) as the UISearchBar? A related questions: is there a way to influence the colour of a UITableView (e.g. the Section Headers)? Kind regards, Gerriet. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
AppController dealloc is never called. Why?
Hi, All, Perhaps my question is stupid, but this is my first Cocoa project, so I'll try to ask. I've noticed that my main window controller (usually named AppController) is never freed. I don't know where it is allocated, but suppose it happens somewhere within NSApplication. All other windows, used in the program, are freed OK, as I'm doing it explicitly, as well as their initialization. On the other hand, I'm getting BAD_ACCESS exception, if I insert [self release] within applicationWillTerminate delegate method of my AppController. So, what is the correct way to free AppController? Thanks, Alexander ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: AppController dealloc is never called. Why?
On Jan 12, 2010, at 9:55 PM, Alexander Bokovikov wrote: On the other hand, I'm getting BAD_ACCESS exception, if I insert [self release] within applicationWillTerminate delegate method of my AppController. So, what is the correct way to free AppController? Don't worry about it. When the task exits, the memory it used is reclaimed by the OS. If your application needs to do something else besides free memory when it terminates, then you must do that in -applicationWillTerminate: and not the -dealloc method of the application controller. Nick Zitzmann http://www.chronosnet.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Drawing A Mutable String
On Jan 12, 2010, at 1:29 PM, Michael Craig wrote: Well, I feel dumb. Your (Andy's) mention of setNeedsDisplay: caught my eye, and I realized soon after that the button whose method causes invalidStack to be YES never tells the view the redraw. I still don't entirely understand why the text didn't get drawn when the view was subsequently redrawn (because of tabbing through controls, resizing, etc.), but at least it works as intended now. Any insight is still appreciated. My guess is that the rectangle passed to drawRect: did not intersect the area where you draw the string. Drawing is clipped to that rectangle, so even though you were executing drawing code no pixels were actually changed. See what happens if you do NSLog(@%@ intersects %...@? %d, NSStringFromRect(dirtyRect), NSStringFromRect(infoRect), NSIntersectsRect(dirtyRect, infoRect)); ...where dirtyRect is the argument passed to drawRect:. --Andy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com