Re: [ myWorkSpace openURL: myurl ] is leaking. Why??
On Dec 10, 2009, at 11:55 PM, Parimal Das wrote: I must be missing something here. Can anyone point what is wrong here. (1) there is no need for an autorelease pool in such a simple -awakeFromNib. It will be in the context of an autorelease pool to begin with and doesn't create enough memory load to warrant a nested pool. (2) To determine why leaks says those two dictionaries are leaking, first find their content and then turn on malloc stack logging and figure out where they were allocated. To do the first, break into gdb and -- obviously substituting the address that leaks reports -- 'po 0x13b9b0'. That'll dump the contents of the dictionary. If you set the environment MallocStackLoggingNoCompact to YES, then you can do -- also in gdb -- 'info malloc 0x13b9b0' and see the allocation point of the object in question. Or... alternatively... use Instruments as it can track leaks. b.bum ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Anyone written a framework for setting xattr attributes?
The subject says pretty much everything. I’m looking for a simple way to set some xattr attributes. thanks scott ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Anyone written a framework for setting xattr attributes?
On 11.12.2009, at 09:33, Scott Anguish wrote: The subject says pretty much everything. I’m looking for a simple way to set some xattr attributes. http://www.zathras.de/sourcecode.htm#UKXattrMetadataStore That about what you're looking for? Cheers, -- Uli Kusterer The Witnesses of TeachText are everywhere... http://www.zathras.de ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Finding process path from Cocoa?
On 09.12.2009, at 23:49, Laurent Daudelin wrote: I guess that with Carbon not being ported to 64bits, NSRunningApplication was needed. It just makes life a little harder if you have to support both 10.5 (which doesn't have NSRunningApplication but has Process Manager) and 10.6 (which has NSRunningApplication but doesn't support Process Manager in 64bits)... You can always write your code against NSRunningApplication, then implement your own class with the same method names as NSRunningApplication that uses the Process Manager under the hood. Use the pimpl pattern and #if __LP_64__ to make this class call through to NSRunningApplication whenever it's available (You can use NSClassFromString() to avoid link-time dependencies). If you're afraid Apple will remove the Process Manager from 32 bit, you could even put that class into an NSBundle, build two versions, one that uses the PM, the other that is a shim around NSRA, and then load the right one at startup depending on system version. Cheers, -- Uli Kusterer The Witnesses of TeachText are everywhere... http://www.lookandfeelcast.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
NSBezierPath vs. NSImage
Hi, when drawing custom buttons, should you use NSBezierPath or NSImage instances? Which is more efficient, performance-wise / memory-wise? Thanks for any tips, - Mike ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSBezierPath vs. NSImage
On 11 Dec 2009, at 09:10, Michael Abendroth wrote: when drawing custom buttons, should you use NSBezierPath or NSImage instances? Yes. Which is more efficient, performance-wise / memory-wise? You probably don't need to worry too much about this on modern systems. In fact, I'll go further than that: worrying too much about it is a mistake; caching and hardware acceleration make it quite difficult to state categorically that one is faster than the other, and changes in either of those areas at any point in the future may significantly alter the balance. (e.g. Right now, enabling QuartzGL for your app is probably going to make quite a significant difference one way or another... see http://developer.apple.com/mac/library/qa/qa2007/qa1536.html. Apple might even make that the default some day.) The time to worry is if you discover that it's a performance problem in your application. Then you can use Instruments et al to see where the bottleneck is and then decide what to do about it. I'll add one more thing: using NSBezierPath means it's much easier to be resolution independent, but at the cost of making it slightly harder to achieve certain special effects. There's been less talk about resolution independence recently, but high DPI displays are pretty much inevitable... Kind regards, Alastair. -- http://alastairs-place.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: Additional action when a view's value changes (Cocoa Bindings)
On 10.12.2009, at 13:26, Graham Cox wrote: On 10/12/2009, at 10:45 PM, Christian Ziegler wrote: In the target controller I don't have IBOutlets for those steppers and textfields. Those are in another (mediating) controller. Question is whether there is another way to do this instead of defining outlets also in the target controller. I guess assigning tags to each stepper/textfield and defining an enum for them would be an option? In general I've found it's a false economy to avoid outlets for all controls - you'll want them sooner or later so may as well give everything an outlet just as a matter of habit. The target controller should be the controller with these outlets. It's OK to have multiple tiers of controllers, but make sure each one has a clearly defined role. Sounds like you have not defined a clear role for each controller and each is doing part of the job of the other. Multiple controllers would usually be arranged in series, not in parallel. Well in general I usually have a hard time defining roles for my controlers. At the moment the idea is: I got one controller for all actions triggered by the mainMenu, one for all actions triggered by gui elements (my app only got one window) and another one for the rest of the logic. My problem was, that either menuitems and gui elements trigger certain actions which need to read values from many gui elements, so I introduced this mediating controller, which is not target for any action but knows all views via outlets. Also the MainMenuController and the MainWindowController got references to the MediatingController, so they can invoke methods. Don't use tags to identify controls - that's not what they are for and there are far more elegant ways to handle this. To avoid the problem of keeping a stepper and a textfield in synch, you generally want to include the relevant property of your data model within the complete feedback loop that is created: stepper - controller(s) - data model - change notification - controller(s) -- text field text field-^ |- stepper If you organise things this way then anyone else that changes that property of the data model also will cause your UI to update correctly (Undo, for example, or a different UI on the same property). This is precisely what bindings does, but you can do the same using target/action as well though it's a bit more work. e.g. You can set up the controller to observe the property changes using KVO (or some other means, such as notifications or a direct protocol of your own devising) and then respond to those changes by setting the relevant controls' values through their outlets. For new code, bindings is the way to go - it uses KVO internally and is the least work to set up. The thing is, I don't have a model for those values because it is a one way street. I only have to read the values to compute stuff, but never have to set new values programatically. Also there is no persistince. Would you still write a model? --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: NSBezierPath vs. NSImage
On Fri, Dec 11, 2009 at 11:14 AM, Alastair Houghton wrote: On 11 Dec 2009, at 09:10, Michael Abendroth wrote: when drawing custom buttons, should you use NSBezierPath or NSImage instances? Yes. Which is more efficient, performance-wise / memory-wise? You probably don't need to worry too much about this on modern systems. In fact, I'll go further than that: worrying too much about it is a mistake; caching and hardware acceleration make it quite difficult to state categorically that one is faster than the other, and changes in either of those areas at any point in the future may significantly alter the balance. (e.g. Right now, enabling QuartzGL for your app is probably going to make quite a significant difference one way or another... see http://developer.apple.com/mac/library/qa/qa2007/qa1536.html. Apple might even make that the default some day.) The time to worry is if you discover that it's a performance problem in your application. Then you can use Instruments et al to see where the bottleneck is and then decide what to do about it. I'll add one more thing: using NSBezierPath means it's much easier to be resolution independent, but at the cost of making it slightly harder to achieve certain special effects. There's been less talk about resolution independence recently, but high DPI displays are pretty much inevitable... Kind regards, Alastair. Woah, thanks a lot, Alastair! The reason I asked was because e.g. NSTextFieldCell subclasses get drawn redrawn quite a lot, so on slower systems this might have been a problem ... ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSBezierPath vs. NSImage
On 11 Dec 2009, at 10:35, Michael Abendroth wrote: Woah, thanks a lot, Alastair! The reason I asked was because e.g. NSTextFieldCell subclasses get drawn redrawn quite a lot, so on slower systems this might have been a problem ... If you were e.g. rendering something huge with an NSShadow set in the graphics context, it might be a problem, since the shadow drawing is an expensive operation. There are ways around that (caching the rendering yourself to an image, for instance). Just to give an example of what is possible, at a reasonable speed, take a look at the pie chart in iPartition (excuse the blatant plug, but it's kind of pretty and a fairly complex piece of drawing): http://www.coriolis-systems.com/iPartition.php It's rendered using NSBezierPath; we use an NSShadow for the shadow behind it, but drawing that is too slow on slower machines so that gets cached to an NSImage. Quartz is more than fast enough to render the chart and the shadowed text in real time, and to update them as the user drags the slider. In this particular case we also render differently during a live resize (specifically, we draw the background by scaling the cached image, because re-rendering the shadow is too expensive and would make the resize jerky on slower machines). That's another useful trick, I might add, if you do find that drawing is too slow in some case. Anyway, the thing to do is to draw what you want, and then *if* it's going too slowly there are various things you can do to speed it up (like caching any expensive rendering in an NSImage, doing reduced or simplified rendering during live resize and so on). Kind regards, Alastair. -- http://alastairs-place.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
[iPhone] Animate tableView reloadData
Hi List, I have a table that gets reloaded when a user presses a button. Is it possible to animate reloadData and if so can you point me in the right direction? Thanks Phil ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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] Animate tableView reloadData
There's a set of methods in UITableView for animated table updates. All the insert/delete/road calls should be within a beginUpdates/ endUpdates block. - (void)beginUpdates; // allow multiple insert/delete of rows and sections to be animated simultaneously. Nestable - (void)endUpdates; // only call insert/delete/reload calls inside an update block. otherwise things like row count, etc. may be invalid. - (void)insertSections:(NSIndexSet *)sections withRowAnimation: (UITableViewRowAnimation)animation; - (void)deleteSections:(NSIndexSet *)sections withRowAnimation: (UITableViewRowAnimation)animation; - (void)reloadSections:(NSIndexSet *)sections withRowAnimation: (UITableViewRowAnimation)animation __OSX_AVAILABLE_STARTING (__MAC_NA,__IPHONE_3_0); - (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation: (UITableViewRowAnimation)animation; - (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation: (UITableViewRowAnimation)animation; - (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation: (UITableViewRowAnimation)animation __OSX_AVAILABLE_STARTING (__MAC_NA,__IPHONE_3_0); Luke On Dec 11, 2009, at 3:53 AM, Philip Vallone wrote: Hi List, I have a table that gets reloaded when a user presses a button. Is it possible to animate reloadData and if so can you point me in the right direction? Thanks Phil ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com This email sent to luket...@apple.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: Binding an Array of Dictionaries
On Dec 11, 2009, at 12:45 AM, Gerriet M. Denkmann wrote: I have a window with an NSTableView which is bound to an NSArrayController which has as content an NSMutableArray called theArrayOfDictionaries. Works fine. theArrayOfDictionaries contains NSMutableDictionaries. So I added another NSTableView to my window, bound to an NSDictionaryController, which has it's content bound to NSArrayController.selection. But the documentation says about selection: proxy object representing the receiver’s selection. And it's no surprise that I get an exception: Cannot create NSDictionary from object [...] of class _NSControllerObjectProxy Well, everything behaves as documented - no reason to complain. But: how to I populate my NSDictionaryController with the NSMutableDictionary currently selected in my NSArrayController? And also: make sure that any changes done in this current dictionary (the NSTableViews will be editable) get back into theArrayOfDictionaries? You will have to maintain the currently selected object in your model. HTH, Keary Suska Esoteritech, Inc. Demystifying technology for your home or business ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Outing the poseAsClass: poseur
I still get reports of this crash: #8 0x968b411d +[%NSToolbarView _findFirstKeyViewInDirection:forKeyLoopGroupingView:] (see http://lists.apple.com/archives/cocoa-dev/2009/Aug/msg01974.html) I would like to know what hack is responsible. Is there a way to find the name of the application that has inserted its code into the food chain via poseAsClass? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
NSSavePanel crash!
Hello All, I'm developping a document-based application that up to today could read two document types and write one of the two. So one type was set as an editor the other one as viewer in the Info.plist. All the save/open panel stuff is the plain AppKit behavior and I haven't overridden a tiny ounce of it all in my NSDocument subclass. Today I added a new editor document type in the info.plist. Gave it a name, an icon, an extension, etc and set the app as an editor of this type. Now I open a document, choose File Save As, the save panel appears and bang, crash! So i traced it back and my own document's awakeFromNib is being called by the savepanel opening process! That's _really_ weird. If anyone already experienced this, did I do something wrong (clearly I don't think so because I haven't even changed the source code, except for one test)? Yes the weirdest thing is that my code hasn't changed! Regards.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Problem with missing symbol
On Dec 10, 2009, at 2:45 PM, Lee Ann Rucker wrote: On Dec 10, 2009, at 1:24 PM, Emmanuel Pinault wrote: Have you tried using [NSStatusItem setView:]? setView is for custom view.. Because if I dont do a setView, the view Method return nil so far. And looking at the doc it mentions that it is for custom view. I am looking at something similar called MAAAttachedWindow class made by someone else. Seems like the way around is to actually use a custom view in a way. The developer seem to use the NSScreen and some other logic to figure out based on where you click (so on the status item in the bar) and get the exact point of the click. Then he calculate where his custom view and window should be displayed. Right. Custom view just means a view where you put your own UI; it doesn't have to be a subclass of NSView. It would be a lot easier than creating a window - which contains an NSView, if it's Cocoa - and working out where to show it; all that work is done for you. Sounds good. I ll give it a try and see what happens :) Thanks Emmanuel ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Outing the poseAsClass: poseur
Set a breakpoint on +[NSObject poseAsClass:] and launch your app perhaps? On 11 Dec 2009, at 16:47, David Riggle wrote: I still get reports of this crash: #8 0x968b411d +[%NSToolbarView _findFirstKeyViewInDirection:forKeyLoopGroupingView:] (see http://lists.apple.com/archives/cocoa-dev/2009/Aug/msg01974.html) I would like to know what hack is responsible. Is there a way to find the name of the application that has inserted its code into the food chain via poseAsClass? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
Screwy Binding/KVO
Hi, Sorry if this has been posted before; I did a quick scour but might not have used the right keywords (this issue isn't very general). Basically I'm noticing that when I expect KVO observations to be triggered, they aren't. Most likely this is due to my misunderstanding, but I'd like to post a test case here for good measure (I write this last night so bear with me if the comments are a little strange). #import Foundation/Foundation.h #import AppKit/AppKit.h @interface SDObject : NSObject { NSArray *content; } @property (readwrite, retain) NSArray *content; @end int main (int argc, const char * argv[]) { [NSAutoreleasePool new]; SDObject *object = [[SDObject alloc] init]; NSArrayController *controller1 = [[NSArrayController alloc] init]; NSArrayController *controller2 = [[NSArrayController alloc] init]; NSLog(@mark 1); // when this is called, the KVO in SDObject is triggered with an empty array [object bind:@content toObject:controller2 withKeyPath:@arrangedObjects options:nil]; NSLog(@mark 2); [controller2 bind:@contentArray toObject:controller1 withKeyPath:@arrangedObjects options:nil]; NSLog(@mark 3); // these might suppose to trigger it (i thought it would but it doesnt) [controller1 addObject:@test1]; [controller1 addObject:@test2]; // okay i *know* this and the -didChange... should trigger it [controller2 willChangeValueForKey:@arrangedObjects]; // this should too though, right? [controller2 rearrangeObjects]; // (see -willChange... above) [controller2 didChangeValueForKey:@arrangedObjects]; // proving that they all contain the right things NSLog(@%@, [controller2 arrangedObjects]); NSLog(@%@, [object content]); return EXIT_SUCCESS; } @implementation SDObject @synthesize content; + (void) initialize { if (self == [SDObject class]) { [self exposeBinding:@content]; } } - (id) init { self = [super init]; [self addObserver:self forKeyPath:@content options:0 context:NULL]; return self; } - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { NSLog(@observing keypath [...@] == [...@], keyPath, [self valueForKeyPath :keyPath]); } @end This is the output: *2009-12-11 11:10:02.139 ScrewyKVO[21311:a0f] mark 1* *2009-12-11 11:10:02.515 ScrewyKVO[21311:a0f] observing keypath [content] == [(* *)]* *2009-12-11 11:10:02.516 ScrewyKVO[21311:a0f] mark 2* *2009-12-11 11:10:02.521 ScrewyKVO[21311:a0f] mark 3* *2009-12-11 11:10:02.522 ScrewyKVO[21311:a0f] (* *test1,* *test2* *)* *2009-12-11 11:10:02.522 ScrewyKVO[21311:a0f] (* *test1,* *test2* *)* * * -- Steven Degutis http://www.thoughtfultree.com/ http://www.degutis.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
NSProgress Indicator
Hi All, The standard progress indicator in IB comes with Blue color fill. Is it possible to change the color to green? Thanks Arun KA ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSProgress Indicator
On Fri, Dec 11, 2009 at 10:22 AM, Arun arun...@gmail.com wrote: The standard progress indicator in IB comes with Blue color fill. Is it possible to change the color to green? No. --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: NSProgress Indicator
Not easily. Why do you want to do this? Are you perhaps looking for NSLevelIndicator? On 11 Dec 2009, at 18:22, Arun wrote: Hi All, The standard progress indicator in IB comes with Blue color fill. Is it possible to change the color to green? Thanks Arun KA ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
My app not in services menu, but appears to be registered
I'm at my wits end trying to add a service to my app, with no luck getting it into the services menu of anything. It appears to have the right info in both the lsregister dump, and the ~/Library/Preferences/pbs. ... .plist file. (I've included these below). Could it be that something is wrong with my launch services or pasteboard services?, or is it still something I'm missing with my application? (I've read so many examples and documents I'm getting a little punch drunk). Is there a way to debug this other than simply going over code and documents over and over? My app services implementation is based on the example in iSpend, but without making a category on MyDocument. Here are relevant parts (I think) of the lsregister dump output, followed by the appropriate section from pbs. ... .plist: lsregister: bundle id:166192 path: /Users/jr/Applications/QlMemo.app name: QlMemo identifier:com.johnvelman.QlMemo (0x80070dbe) canonical id: com.johnvelman.qlmemo (0x80066a53) version: 1 mod date: 12/11/2009 10:16:01 reg date: 12/11/2009 10:19:29 type code: 'APPL' creator code: 'QlMm' sys version: 0 flags: item flags:container package application extension-hidden native-app services i386 icon: executable:Contents/MacOS/QlMemo inode: 7421410 exec inode:7421426 container id: 32 library: library items: claim id:82460 name: QlMemo rank: Default roles: Editor flags: icon: bindings: .qlm, 'qlmM' service id:6540 menu: QlMemo key: port: QlMemo message: importData user data: timeout: -1 send types:NSStringPasteboardType return types: pbs. ... .plist: dict keyNSBundleIdentifier/key stringcom.johnvelman.QlMemo/string keyNSBundlePath/key string/Users/jr/Applications/QlMemo.app/string keyNSExecutablePath/key string/Users/jr/Applications/QlMemo.app/Contents/MacOS/QlMemo/string keyNSMenuItem/key dict keydefault/key stringQlMemo/string /dict keyNSMessage/key stringimportData/string keyNSPortName/key stringQlMemo/string keyNSSendTypes/key array stringNSStringPasteboardType/string /array /dict ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Relation Between a View's Bounds and its CTM
Are there any good way to get/set a view's transform? (No, not using CALayers.) It is possible to flip a view's horizontal and/or vertical orientation by setting negative values for the bounds size. However, a request for the view's bounds always returns a validated rect, giving no indication of its flipped state. It's also not clear how this all relates to a containing scrollView and how to keep them in sync. This gets especially tricky with an NSTextView. Display is no problem and can be handled in drawRect. However, for editing, the view's coordinate transform need to be set correctly for mouse actions, especially in an NSTextView, because it tracks internally and there's no way to intercept the events. What exactly happens to the CTM when you set bounds, boundsOrigin, boundsSize? Setting boundsSize with positive values does not affect the flippedness. Setting a negative size value does flip it (which ever sign it is). The magnitude looks like a replacement, but the sign looks like a concatenation. So what's it really doing? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
UIDatePicker in landscape - displaying items moving into position weirdness
I am using a UIDatePicker in landscape - and I have noticed on the device (in Simulator it works fine) that the animation of the numerals into position can be seen floating and delayed into position. What I mean is that if I scroll a column down, I see a number fly up from the bottom to it's position up top out of view, ready to be displayed if needed. This numeral should be hidden while being placed. If I scroll quickly, I'll see an empty column and then the numbers fly up into place. In my viewDidLoad: picker.frame = CGRectMake(135,37,205,162); for(UIView *subview in picker.subviews){ subview.frame = picker.bounds; } Is there a mask or something else that I would need to set the frame for as well so that the animations look correct? It seems like this control really doesn't enjoy being used in landscape. - Eric ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
altering width of NSComboBox's popup
I'd like to display a NSComboBox that is narrower than the widest of strings in the list of items, but have the popup list be wide enough so the whole string can be read. But I haven't found a way to have the 'non-tracking' width to be different from the tracking width. I've tried altering the width in a delegate's comboBoxWillPopUp:, calling [obj setFrame:], but that affects the width of the unclicked area, the scrolling list is still narrow. I've tried subclassing NSComboBox, and doing the same width switching by overriding and wrapping -[NSComboBox mouseDown:], but that seems to cancel the display of the popup altogether. I imagine I could try getting the NSComboBox's menu, and calling -[NSMenu setMinimumWidth:] on it, but that call isn't available until 10.6, and I'm supporting 10.4.11. I don't see how I'd play with NSComboBoxCell, but maybe that's part of the solution. FWIW, I'm using setButtonBordered:NO. Would someone please cast me a pearl? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: UIDatePicker in landscape - displaying items moving into position weirdness
I take it back - it does not work in the Simulator either. I am calling up the view from the AppDelegate like this: EditAlarmViewController *myEditView = [[EditAlarmViewController alloc] initWithNibName:@EditAlarmViewController bundle:[NSBundle mainBundle]]; //TODO: get these to come out of the corners [myEditView.view setCenter:CGPointMake(160, 240)]; myEditView.view.bounds = CGRectMake(0, 0, 480, 320); [myEditView whichAlarmAmI:whichAlarm]; [window addSubview:myEditView.view]; myEditView.view.alpha = 0.0; CGAffineTransform transformA = CGAffineTransformMakeScale(0.5, 0.5); CGAffineTransform transformB = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(90)); myEditView.view.transform = CGAffineTransformConcat(transformA, transformB); [UIView beginAnimations:nil context:nil]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDuration:0.5f]; myEditView.view.alpha = 1.0; CGAffineTransform transformNorm = CGAffineTransformMakeScale(1.0, 1.0); CGAffineTransform transformC = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(90)); myEditView.view.transform = CGAffineTransformConcat(transformNorm, transformC); [UIView commitAnimations]; On Fri, Dec 11, 2009 at 3:32 PM, Eric E. Dolecki edole...@gmail.com wrote: I am using a UIDatePicker in landscape - and I have noticed on the device (in Simulator it works fine) that the animation of the numerals into position can be seen floating and delayed into position. What I mean is that if I scroll a column down, I see a number fly up from the bottom to it's position up top out of view, ready to be displayed if needed. This numeral should be hidden while being placed. If I scroll quickly, I'll see an empty column and then the numbers fly up into place. In my viewDidLoad: picker.frame = CGRectMake(135,37,205,162); for(UIView *subview in picker.subviews){ subview.frame = picker.bounds; } Is there a mask or something else that I would need to set the frame for as well so that the animations look correct? It seems like this control really doesn't enjoy being used in landscape. - Eric -- http://ericd.net Interactive design and development ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: UIDatePicker in landscape - displaying items moving into position weirdness
I found that this control works fine in Iphone OS 3.0 and higher in landscape - but only if its initialized when in landscape mode (i.e. status bar and all). If you rotate it or its rotated, it won’t work. On Dec 11, 2009, at 2:38 PM, Eric E. Dolecki wrote: I take it back - it does not work in the Simulator either. I am calling up the view from the AppDelegate like this: EditAlarmViewController *myEditView = [[EditAlarmViewController alloc] initWithNibName:@EditAlarmViewController bundle:[NSBundle mainBundle]]; //TODO: get these to come out of the corners [myEditView.view setCenter:CGPointMake(160, 240)]; myEditView.view.bounds = CGRectMake(0, 0, 480, 320); [myEditView whichAlarmAmI:whichAlarm]; [window addSubview:myEditView.view]; myEditView.view.alpha = 0.0; CGAffineTransform transformA = CGAffineTransformMakeScale(0.5, 0.5); CGAffineTransform transformB = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(90)); myEditView.view.transform = CGAffineTransformConcat(transformA, transformB); [UIView beginAnimations:nil context:nil]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDuration:0.5f]; myEditView.view.alpha = 1.0; CGAffineTransform transformNorm = CGAffineTransformMakeScale(1.0, 1.0); CGAffineTransform transformC = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(90)); myEditView.view.transform = CGAffineTransformConcat(transformNorm, transformC); [UIView commitAnimations]; On Fri, Dec 11, 2009 at 3:32 PM, Eric E. Dolecki edole...@gmail.com wrote: I am using a UIDatePicker in landscape - and I have noticed on the device (in Simulator it works fine) that the animation of the numerals into position can be seen floating and delayed into position. What I mean is that if I scroll a column down, I see a number fly up from the bottom to it's position up top out of view, ready to be displayed if needed. This numeral should be hidden while being placed. If I scroll quickly, I'll see an empty column and then the numbers fly up into place. In my viewDidLoad: picker.frame = CGRectMake(135,37,205,162); for(UIView *subview in picker.subviews){ subview.frame = picker.bounds; } Is there a mask or something else that I would need to set the frame for as well so that the animations look correct? It seems like this control really doesn't enjoy being used in landscape. - Eric -- http://ericd.net Interactive design and development ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/alex%40webis.net This email sent to a...@webis.net Alex Kac - President and Founder Web Information Solutions, Inc. The optimist proclaims that we live in the best of all possible worlds; and the pessimist fears this is true. -- James Clabell ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: UIDatePicker in landscape - displaying items moving into position weirdness
What do you mean initialized when in landscape mode? (I'm still green here). How can I make sure that happens? On Fri, Dec 11, 2009 at 3:41 PM, Alex Kac a...@webis.net wrote: I found that this control works fine in Iphone OS 3.0 and higher in landscape - but only if its initialized when in landscape mode (i.e. status bar and all). If you rotate it or its rotated, it won’t work. On Dec 11, 2009, at 2:38 PM, Eric E. Dolecki wrote: I take it back - it does not work in the Simulator either. I am calling up the view from the AppDelegate like this: EditAlarmViewController *myEditView = [[EditAlarmViewController alloc] initWithNibName:@EditAlarmViewController bundle:[NSBundle mainBundle]]; //TODO: get these to come out of the corners [myEditView.view setCenter:CGPointMake(160, 240)]; myEditView.view.bounds = CGRectMake(0, 0, 480, 320); [myEditView whichAlarmAmI:whichAlarm]; [window addSubview:myEditView.view]; myEditView.view.alpha = 0.0; CGAffineTransform transformA = CGAffineTransformMakeScale(0.5, 0.5); CGAffineTransform transformB = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(90)); myEditView.view.transform = CGAffineTransformConcat(transformA, transformB); [UIView beginAnimations:nil context:nil]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDuration:0.5f]; myEditView.view.alpha = 1.0; CGAffineTransform transformNorm = CGAffineTransformMakeScale(1.0, 1.0); CGAffineTransform transformC = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(90)); myEditView.view.transform = CGAffineTransformConcat(transformNorm, transformC); [UIView commitAnimations]; On Fri, Dec 11, 2009 at 3:32 PM, Eric E. Dolecki edole...@gmail.com wrote: I am using a UIDatePicker in landscape - and I have noticed on the device (in Simulator it works fine) that the animation of the numerals into position can be seen floating and delayed into position. What I mean is that if I scroll a column down, I see a number fly up from the bottom to it's position up top out of view, ready to be displayed if needed. This numeral should be hidden while being placed. If I scroll quickly, I'll see an empty column and then the numbers fly up into place. In my viewDidLoad: picker.frame = CGRectMake(135,37,205,162); for(UIView *subview in picker.subviews){ subview.frame = picker.bounds; } Is there a mask or something else that I would need to set the frame for as well so that the animations look correct? It seems like this control really doesn't enjoy being used in landscape. - Eric -- http://ericd.net Interactive design and development ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/alex%40webis.net This email sent to a...@webis.net Alex Kac - President and Founder Web Information Solutions, Inc. The optimist proclaims that we live in the best of all possible worlds; and the pessimist fears this is true. -- James Clabell -- http://ericd.net Interactive design and development ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: UIDatePicker in landscape - displaying items moving into position weirdness
I placed the picker using IB if that matters - does this means it will init before the app goes to landscape? Do I need viewDidLoad and create the picker by hand, and then rotate it? On Fri, Dec 11, 2009 at 3:55 PM, Eric E. Dolecki edole...@gmail.com wrote: What do you mean initialized when in landscape mode? (I'm still green here). How can I make sure that happens? On Fri, Dec 11, 2009 at 3:41 PM, Alex Kac a...@webis.net wrote: I found that this control works fine in Iphone OS 3.0 and higher in landscape - but only if its initialized when in landscape mode (i.e. status bar and all). If you rotate it or its rotated, it won’t work. On Dec 11, 2009, at 2:38 PM, Eric E. Dolecki wrote: I take it back - it does not work in the Simulator either. I am calling up the view from the AppDelegate like this: EditAlarmViewController *myEditView = [[EditAlarmViewController alloc] initWithNibName:@EditAlarmViewController bundle:[NSBundle mainBundle]]; //TODO: get these to come out of the corners [myEditView.view setCenter:CGPointMake(160, 240)]; myEditView.view.bounds = CGRectMake(0, 0, 480, 320); [myEditView whichAlarmAmI:whichAlarm]; [window addSubview:myEditView.view]; myEditView.view.alpha = 0.0; CGAffineTransform transformA = CGAffineTransformMakeScale(0.5, 0.5); CGAffineTransform transformB = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(90)); myEditView.view.transform = CGAffineTransformConcat(transformA, transformB); [UIView beginAnimations:nil context:nil]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDuration:0.5f]; myEditView.view.alpha = 1.0; CGAffineTransform transformNorm = CGAffineTransformMakeScale(1.0, 1.0); CGAffineTransform transformC = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(90)); myEditView.view.transform = CGAffineTransformConcat(transformNorm, transformC); [UIView commitAnimations]; On Fri, Dec 11, 2009 at 3:32 PM, Eric E. Dolecki edole...@gmail.com wrote: I am using a UIDatePicker in landscape - and I have noticed on the device (in Simulator it works fine) that the animation of the numerals into position can be seen floating and delayed into position. What I mean is that if I scroll a column down, I see a number fly up from the bottom to it's position up top out of view, ready to be displayed if needed. This numeral should be hidden while being placed. If I scroll quickly, I'll see an empty column and then the numbers fly up into place. In my viewDidLoad: picker.frame = CGRectMake(135,37,205,162); for(UIView *subview in picker.subviews){ subview.frame = picker.bounds; } Is there a mask or something else that I would need to set the frame for as well so that the animations look correct? It seems like this control really doesn't enjoy being used in landscape. - Eric -- http://ericd.net Interactive design and development ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/alex%40webis.net This email sent to a...@webis.net Alex Kac - President and Founder Web Information Solutions, Inc. The optimist proclaims that we live in the best of all possible worlds; and the pessimist fears this is true. -- James Clabell -- http://ericd.net Interactive design and development -- http://ericd.net Interactive design and development ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: UIDatePicker in landscape - displaying items moving into position weirdness
Don’t use IB if you’re going to use landscape UIPicker. On Dec 11, 2009, at 2:58 PM, Eric E. Dolecki wrote: I placed the picker using IB if that matters - does this means it will init before the app goes to landscape? Do I need viewDidLoad and create the picker by hand, and then rotate it? On Fri, Dec 11, 2009 at 3:55 PM, Eric E. Dolecki edole...@gmail.com wrote: What do you mean initialized when in landscape mode? (I'm still green here). How can I make sure that happens? On Fri, Dec 11, 2009 at 3:41 PM, Alex Kac a...@webis.net wrote: I found that this control works fine in Iphone OS 3.0 and higher in landscape - but only if its initialized when in landscape mode (i.e. status bar and all). If you rotate it or its rotated, it won’t work. On Dec 11, 2009, at 2:38 PM, Eric E. Dolecki wrote: I take it back - it does not work in the Simulator either. I am calling up the view from the AppDelegate like this: EditAlarmViewController *myEditView = [[EditAlarmViewController alloc] initWithNibName:@EditAlarmViewController bundle:[NSBundle mainBundle]]; //TODO: get these to come out of the corners [myEditView.view setCenter:CGPointMake(160, 240)]; myEditView.view.bounds = CGRectMake(0, 0, 480, 320); [myEditView whichAlarmAmI:whichAlarm]; [window addSubview:myEditView.view]; myEditView.view.alpha = 0.0; CGAffineTransform transformA = CGAffineTransformMakeScale(0.5, 0.5); CGAffineTransform transformB = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(90)); myEditView.view.transform = CGAffineTransformConcat(transformA, transformB); [UIView beginAnimations:nil context:nil]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDuration:0.5f]; myEditView.view.alpha = 1.0; CGAffineTransform transformNorm = CGAffineTransformMakeScale(1.0, 1.0); CGAffineTransform transformC = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(90)); myEditView.view.transform = CGAffineTransformConcat(transformNorm, transformC); [UIView commitAnimations]; On Fri, Dec 11, 2009 at 3:32 PM, Eric E. Dolecki edole...@gmail.com wrote: I am using a UIDatePicker in landscape - and I have noticed on the device (in Simulator it works fine) that the animation of the numerals into position can be seen floating and delayed into position. What I mean is that if I scroll a column down, I see a number fly up from the bottom to it's position up top out of view, ready to be displayed if needed. This numeral should be hidden while being placed. If I scroll quickly, I'll see an empty column and then the numbers fly up into place. In my viewDidLoad: picker.frame = CGRectMake(135,37,205,162); for(UIView *subview in picker.subviews){ subview.frame = picker.bounds; } Is there a mask or something else that I would need to set the frame for as well so that the animations look correct? It seems like this control really doesn't enjoy being used in landscape. - Eric -- http://ericd.net Interactive design and development ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/alex%40webis.net This email sent to a...@webis.net Alex Kac - President and Founder Web Information Solutions, Inc. The optimist proclaims that we live in the best of all possible worlds; and the pessimist fears this is true. -- James Clabell -- http://ericd.net Interactive design and development -- http://ericd.net Interactive design and development Alex Kac - President and Founder Web Information Solutions, Inc. Forgiveness is not an occasional act: it is a permanent attitude. -- Dr. Martin Luther King ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Finding a printer on bonjour
I have printer sharing turned on on my computer. I am trying to discover the two shared printers with bonjour and am using the following line of code for it: [serviceBrowser searchForServicesOfType:@_printer._http._tcp. inDomain:@]; I know that the printers are shared so why are they not showing up in my browser?___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: UIDatePicker in landscape - displaying items moving into position weirdness
Well, we simply create the control via code on loadView and then when orientation changes, we release it and recreate it. This way its always initialized properly for that orientation. - (void)createRelativeTriggerTimeSpanPicker { timeSpanPicker = [[UITimeSpanPicker alloc] initWithFrame: CGRectZero]; timeSpanPicker.timeSpanDuration = relativeTrigger; [timeSpanPicker addTarget: self action: @selector(_updateRelativeTime) forControlEvents: UIControlEventValueChanged]; [self.view addSubview: timeSpanPicker]; } - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { if (timeSpanPicker) { //remove it [timeSpanPicker removeFromSuperview]; [timeSpanPicker release]; //now add it again [self createRelativeTriggerTimeSpanPicker]; } } On Dec 11, 2009, at 2:55 PM, Eric E. Dolecki wrote: What do you mean initialized when in landscape mode? (I'm still green here). How can I make sure that happens? On Fri, Dec 11, 2009 at 3:41 PM, Alex Kac a...@webis.net wrote: I found that this control works fine in Iphone OS 3.0 and higher in landscape - but only if its initialized when in landscape mode (i.e. status bar and all). If you rotate it or its rotated, it won’t work. On Dec 11, 2009, at 2:38 PM, Eric E. Dolecki wrote: I take it back - it does not work in the Simulator either. I am calling up the view from the AppDelegate like this: EditAlarmViewController *myEditView = [[EditAlarmViewController alloc] initWithNibName:@EditAlarmViewController bundle:[NSBundle mainBundle]]; //TODO: get these to come out of the corners [myEditView.view setCenter:CGPointMake(160, 240)]; myEditView.view.bounds = CGRectMake(0, 0, 480, 320); [myEditView whichAlarmAmI:whichAlarm]; [window addSubview:myEditView.view]; myEditView.view.alpha = 0.0; CGAffineTransform transformA = CGAffineTransformMakeScale(0.5, 0.5); CGAffineTransform transformB = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(90)); myEditView.view.transform = CGAffineTransformConcat(transformA, transformB); [UIView beginAnimations:nil context:nil]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDuration:0.5f]; myEditView.view.alpha = 1.0; CGAffineTransform transformNorm = CGAffineTransformMakeScale(1.0, 1.0); CGAffineTransform transformC = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(90)); myEditView.view.transform = CGAffineTransformConcat(transformNorm, transformC); [UIView commitAnimations]; On Fri, Dec 11, 2009 at 3:32 PM, Eric E. Dolecki edole...@gmail.com wrote: I am using a UIDatePicker in landscape - and I have noticed on the device (in Simulator it works fine) that the animation of the numerals into position can be seen floating and delayed into position. What I mean is that if I scroll a column down, I see a number fly up from the bottom to it's position up top out of view, ready to be displayed if needed. This numeral should be hidden while being placed. If I scroll quickly, I'll see an empty column and then the numbers fly up into place. In my viewDidLoad: picker.frame = CGRectMake(135,37,205,162); for(UIView *subview in picker.subviews){ subview.frame = picker.bounds; } Is there a mask or something else that I would need to set the frame for as well so that the animations look correct? It seems like this control really doesn't enjoy being used in landscape. - Eric -- http://ericd.net Interactive design and development ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/alex%40webis.net This email sent to a...@webis.net Alex Kac - President and Founder Web Information Solutions, Inc. The optimist proclaims that we live in the best of all possible worlds; and the pessimist fears this is true. -- James Clabell -- http://ericd.net Interactive design and development Alex Kac - President and Founder Web Information Solutions, Inc. Patience is the companion of wisdom. --Anonymous ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Screwy Binding/KVO
On Dec 11, 2009, at 09:10, Steven Degutis wrote: [reformatted to be less annoying] // when this is called, the KVO in SDObject is triggered with an empty array [object bind:@content toObject:controller2 withKeyPath:@arrangedObjects options:nil]; NSLog(@mark 2); Yeah, well, at this point controller2 has no content array, so of course its 'arrangedObjects' is empty. However, this line of code is the heart of your problem, because SDObject has no content binding. It has a content property, but that's not the same as a binding. Compare this with (say) a NSTableView, which has a content binding but no content property. 'bind:toObject:withKeyPath:options:' cannot be used as you are doing, in spite of what the documentation might suggest for the binding parameter: The key path for a property of the receiver previously exposed using the exposeBinding: method. It's not a key path but a binding name. Look at: http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CocoaBindings/Concepts/HowDoBindingsWork.html#//apple_ref/doc/uid/20002373 if you want gory details, but even that document is somewhat inexact in its terminology. It sometimes confuses properties and binding names, or it sometimes uses binds from ... to in the opposite direction from the way we usually say it, or it sometimes confuses the idea that bindings are two-way (they are) with the idea that they're symmetrical (they are not) -- it's a bit hard to tell which. [controller2 bind:@contentArray toObject:controller1 withKeyPath:@arrangedObjects options:nil]; NSLog(@mark 3); // these might suppose to trigger it (i thought it would but it doesnt) [controller1 addObject:@test1]; [controller1 addObject:@test2]; In your sample code, you never gave controller1 any content array. There's nothing to add objects to. // okay i *know* this and the -didChange... should trigger it [controller2 willChangeValueForKey:@arrangedObjects]; Sending willChange/didChange to an object whose implementation you don't control seems like a *terrible* idea. Especially something funky like NSArrayController. // this should too though, right? [controller2 rearrangeObjects]; // (see -willChange... above) [controller2 didChangeValueForKey:@arrangedObjects]; I'm actually surprised you didn't get any exceptions using this code. Did you check the log? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: UIDatePicker in landscape - displaying items moving into position weirdness
That's brilliant - thank you very much. Works great! On Fri, Dec 11, 2009 at 4:01 PM, Alex Kac a...@webis.net wrote: Well, we simply create the control via code on loadView and then when orientation changes, we release it and recreate it. This way its always initialized properly for that orientation. - (void)createRelativeTriggerTimeSpanPicker { timeSpanPicker = [[UITimeSpanPicker alloc] initWithFrame: CGRectZero]; timeSpanPicker.timeSpanDuration = relativeTrigger; [timeSpanPicker addTarget: self action: @selector(_updateRelativeTime) forControlEvents: UIControlEventValueChanged]; [self.view addSubview: timeSpanPicker]; } - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { if (timeSpanPicker) { //remove it [timeSpanPicker removeFromSuperview]; [timeSpanPicker release]; //now add it again [self createRelativeTriggerTimeSpanPicker]; } } On Dec 11, 2009, at 2:55 PM, Eric E. Dolecki wrote: What do you mean initialized when in landscape mode? (I'm still green here). How can I make sure that happens? On Fri, Dec 11, 2009 at 3:41 PM, Alex Kac a...@webis.net wrote: I found that this control works fine in Iphone OS 3.0 and higher in landscape - but only if its initialized when in landscape mode (i.e. status bar and all). If you rotate it or its rotated, it won’t work. On Dec 11, 2009, at 2:38 PM, Eric E. Dolecki wrote: I take it back - it does not work in the Simulator either. I am calling up the view from the AppDelegate like this: EditAlarmViewController *myEditView = [[EditAlarmViewController alloc] initWithNibName:@EditAlarmViewController bundle:[NSBundle mainBundle]]; //TODO: get these to come out of the corners [myEditView.view setCenter:CGPointMake(160, 240)]; myEditView.view.bounds = CGRectMake(0, 0, 480, 320); [myEditView whichAlarmAmI:whichAlarm]; [window addSubview:myEditView.view]; myEditView.view.alpha = 0.0; CGAffineTransform transformA = CGAffineTransformMakeScale(0.5, 0.5); CGAffineTransform transformB = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(90)); myEditView.view.transform = CGAffineTransformConcat(transformA, transformB); [UIView beginAnimations:nil context:nil]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDuration:0.5f]; myEditView.view.alpha = 1.0; CGAffineTransform transformNorm = CGAffineTransformMakeScale(1.0, 1.0); CGAffineTransform transformC = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(90)); myEditView.view.transform = CGAffineTransformConcat(transformNorm, transformC); [UIView commitAnimations]; On Fri, Dec 11, 2009 at 3:32 PM, Eric E. Dolecki edole...@gmail.com wrote: I am using a UIDatePicker in landscape - and I have noticed on the device (in Simulator it works fine) that the animation of the numerals into position can be seen floating and delayed into position. What I mean is that if I scroll a column down, I see a number fly up from the bottom to it's position up top out of view, ready to be displayed if needed. This numeral should be hidden while being placed. If I scroll quickly, I'll see an empty column and then the numbers fly up into place. In my viewDidLoad: picker.frame = CGRectMake(135,37,205,162); for(UIView *subview in picker.subviews){ subview.frame = picker.bounds; } Is there a mask or something else that I would need to set the frame for as well so that the animations look correct? It seems like this control really doesn't enjoy being used in landscape. - Eric -- http://ericd.net Interactive design and development ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/alex%40webis.net This email sent to a...@webis.net Alex Kac - President and Founder Web Information Solutions, Inc. The optimist proclaims that we live in the best of all possible worlds; and the pessimist fears this is true. -- James Clabell -- http://ericd.net Interactive design and development *Alex Kac - **President and Founder* *Web Information Solutions, Inc.* Patience is the companion of wisdom. --Anonymous -- http://ericd.net Interactive design and development ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: My app not in services menu, but appears to be registered
Forgot to note that I'm still working in OS X 10.5.8, XCode 3.1.4. On Fri, Dec 11, 2009 at 11:06:38AM -0800, John Velman wrote: I'm at my wits end trying to add a service to my app, with no luck getting it into the services menu of anything. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: UIDatePicker in landscape - displaying items moving into position weirdness
That works great. I have another view that does some animation, and I forgot to close the animation block with a commitAnimations, and the view with the picker in it animates in too - seems like an unclosed animation block anywhere in such a case can screw up a view with a picker in landscape in it. On Fri, Dec 11, 2009 at 4:10 PM, Eric E. Dolecki edole...@gmail.com wrote: That's brilliant - thank you very much. Works great! On Fri, Dec 11, 2009 at 4:01 PM, Alex Kac a...@webis.net wrote: Well, we simply create the control via code on loadView and then when orientation changes, we release it and recreate it. This way its always initialized properly for that orientation. - (void)createRelativeTriggerTimeSpanPicker { timeSpanPicker = [[UITimeSpanPicker alloc] initWithFrame: CGRectZero]; timeSpanPicker.timeSpanDuration = relativeTrigger; [timeSpanPicker addTarget: self action: @selector(_updateRelativeTime) forControlEvents: UIControlEventValueChanged]; [self.view addSubview: timeSpanPicker]; } - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { if (timeSpanPicker) { //remove it [timeSpanPicker removeFromSuperview]; [timeSpanPicker release]; //now add it again [self createRelativeTriggerTimeSpanPicker]; } } On Dec 11, 2009, at 2:55 PM, Eric E. Dolecki wrote: What do you mean initialized when in landscape mode? (I'm still green here). How can I make sure that happens? On Fri, Dec 11, 2009 at 3:41 PM, Alex Kac a...@webis.net wrote: I found that this control works fine in Iphone OS 3.0 and higher in landscape - but only if its initialized when in landscape mode (i.e. status bar and all). If you rotate it or its rotated, it won’t work. On Dec 11, 2009, at 2:38 PM, Eric E. Dolecki wrote: I take it back - it does not work in the Simulator either. I am calling up the view from the AppDelegate like this: EditAlarmViewController *myEditView = [[EditAlarmViewController alloc] initWithNibName:@EditAlarmViewController bundle:[NSBundle mainBundle]]; //TODO: get these to come out of the corners [myEditView.view setCenter:CGPointMake(160, 240)]; myEditView.view.bounds = CGRectMake(0, 0, 480, 320); [myEditView whichAlarmAmI:whichAlarm]; [window addSubview:myEditView.view]; myEditView.view.alpha = 0.0; CGAffineTransform transformA = CGAffineTransformMakeScale(0.5, 0.5); CGAffineTransform transformB = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(90)); myEditView.view.transform = CGAffineTransformConcat(transformA, transformB); [UIView beginAnimations:nil context:nil]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDuration:0.5f]; myEditView.view.alpha = 1.0; CGAffineTransform transformNorm = CGAffineTransformMakeScale(1.0, 1.0); CGAffineTransform transformC = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(90)); myEditView.view.transform = CGAffineTransformConcat(transformNorm, transformC); [UIView commitAnimations]; On Fri, Dec 11, 2009 at 3:32 PM, Eric E. Dolecki edole...@gmail.com wrote: I am using a UIDatePicker in landscape - and I have noticed on the device (in Simulator it works fine) that the animation of the numerals into position can be seen floating and delayed into position. What I mean is that if I scroll a column down, I see a number fly up from the bottom to it's position up top out of view, ready to be displayed if needed. This numeral should be hidden while being placed. If I scroll quickly, I'll see an empty column and then the numbers fly up into place. In my viewDidLoad: picker.frame = CGRectMake(135,37,205,162); for(UIView *subview in picker.subviews){ subview.frame = picker.bounds; } Is there a mask or something else that I would need to set the frame for as well so that the animations look correct? It seems like this control really doesn't enjoy being used in landscape. - Eric -- http://ericd.net Interactive design and development ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/alex%40webis.net This email sent to a...@webis.net Alex Kac - President and Founder Web Information Solutions, Inc. The optimist proclaims that we live in the best of all possible worlds; and the pessimist fears this is true. -- James Clabell -- http://ericd.net Interactive design and development *Alex Kac - **President and Founder* *Web Information Solutions, Inc.* Patience is the companion of wisdom. --Anonymous -- http://ericd.net Interactive design and development -- http://ericd.net Interactive
Printing to a ipp printer discovered with bonjour
Ok, well in my previous message I did not realize I was suppose to search for ipp not printer. when I browse and find ipp printers I am taken to the cups reference page. So I am wondering if there is a fairly basic guide to printing to a cups printer from cocoa. or over bonjour? 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: NSSavePanel crash!
On Dec 11, 2009, at 8:49 AM, Half Activist wrote: Hello All, I'm developping a document-based application that up to today could read two document types and write one of the two. So one type was set as an editor the other one as viewer in the Info.plist. All the save/open panel stuff is the plain AppKit behavior and I haven't overridden a tiny ounce of it all in my NSDocument subclass. Today I added a new editor document type in the info.plist. Gave it a name, an icon, an extension, etc and set the app as an editor of this type. Now I open a document, choose File Save As, the save panel appears and bang, crash! So i traced it back and my own document's awakeFromNib is being called by the savepanel opening process! That's _really_ weird. If anyone already experienced this, did I do something wrong (clearly I don't think so because I haven't even changed the source code, except for one test)? Yes the weirdest thing is that my code hasn't changed! Hi Half, You should post your crash report; that will help people diagnose the problem. corbin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Outing the poseAsClass: poseur
On Dec 11, 2009, at 8:47 AM, David Riggle wrote: I still get reports of this crash: #8 0x968b411d +[%NSToolbarView _findFirstKeyViewInDirection:forKeyLoopGroupingView:] (see http://lists.apple.com/archives/cocoa-dev/2009/Aug/msg01974.html) I would like to know what hack is responsible. Is there a way to find the name of the application that has inserted its code into the food chain via poseAsClass? The easiest option is to look at the Binary Images section of the crash logs. The hack's binary may show up there. If it's not in the Binary Images, then you may have no options other than installing hacks on your own machine and running with a breakpoint on class_poseAs(). -- 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: Printing to a ipp printer discovered with bonjour
On Dec 11, 2009, at 1:58 PM, Development wrote: Ok, well in my previous message I did not realize I was suppose to search for ipp not printer. when I browse and find ipp printers I am taken to the cups reference page. So I am wondering if there is a fairly basic guide to printing to a cups printer from cocoa. or over bonjour? What are you trying to do? Typically issue such as browsing and adding printers is done at a much higher level by the user and applications can generally be ignorant of how this all works (or if a printer is even connected to the system). -- 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
Detaching a thread to save a file?
Hi, Apologies for a rather basic question, but I’ve searched my Cocoa books and the web and despite lots of information on threads I’m still a little confused about how best to do what I want to do ensuring that I’m not opening myself up to crashes (possibly just nervousness owing to not using NSThread before). My app allows the user to open multiple text files within a project. To allow in-project searching of this text, and also for Spotlight purposes, my app keeps a dictionary of plain text representations of all of these texts. In the current version, it writes this dictionary of plain text representations to disk whenever the user does a manual save. (This information needs to be saved to disk, but it’s not critical - if the app crashes and it’s not saved, it can be rebuilt from the rich text documents easily enough.) The problem is that if the project grows in size, saving this dictionary to disk can take two or three seconds. For this reason, I would like to save it in the background, so it doesn’t hold up the interface. According to Scott Anguish’s Cocoa Programming book, NSThread is ideal for this sort of thing, and that is what I would like to do (I’m stuck supporting Tiger, so I need to use -detachNewThreadSelector:). But I can’t find any obvious examples of detaching a thread specifically to save a file. So, my question is - and I already apologised for its basicness :) - what is the best way to detach a thread for saving a file, and what issues do I need to be aware of? For instance, what if the user tries to close the project (document) while the other thread is saving the file? Presumably it’s not as simple as using -detachNewThreadSelector:... to spawn a thread that just does a simple -writeToFile: method. If I’ve missed a really simple example somewhere, please feel free to tell me to RTFM, but I’d be grateful for a link. :) Many thanks and all the best, have a great weekend, Keith ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Printing to a ipp printer discovered with bonjour
I'm trying to figure out how to print using IPP from an iphone. I'm able to get bits of info from google but nothing so far has been overly clear. I'm still trying to figure it all out. On Dec 11, 2009, at 3:07 PM, David Duncan wrote: On Dec 11, 2009, at 1:58 PM, Development wrote: Ok, well in my previous message I did not realize I was suppose to search for ipp not printer. when I browse and find ipp printers I am taken to the cups reference page. So I am wondering if there is a fairly basic guide to printing to a cups printer from cocoa. or over bonjour? What are you trying to do? Typically issue such as browsing and adding printers is done at a much higher level by the user and applications can generally be ignorant of how this all works (or if a printer is even connected to the system). -- 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: NSProgress Indicator
insert wild hair of an idea here Have you tried making the view layer-back and applying a CIHueAdjust filter to the layer? On Dec 11, 2009, at 1:59 PM, Mike Abdullah wrote: Not easily. Why do you want to do this? Are you perhaps looking for NSLevelIndicator? On 11 Dec 2009, at 18:22, Arun wrote: Hi All, The standard progress indicator in IB comes with Blue color fill. Is it possible to change the color to green? Thanks Arun KA ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Detaching a thread to save a file?
On Dec 11, 2009, at 4:43 PM, Keith Blount wrote: The problem is that if the project grows in size, saving this dictionary to disk can take two or three seconds. For this reason, I would like to save it in the background, so it doesn’t hold up the interface. According to Scott Anguish’s Cocoa Programming book, NSThread is ideal for this sort of thing, and that is what I would like to do (I’m stuck supporting Tiger, so I need to use - detachNewThreadSelector:). But I can’t find any obvious examples of detaching a thread specifically to save a file. So, my question is - and I already apologised for its basicness :) - what is the best way to detach a thread for saving a file, and what issues do I need to be aware of? For instance, what if the user tries to close the project (document) while the other thread is saving the file? Presumably it’s not as simple as using -detachNewThreadSelector:... to spawn a thread that just does a simple -writeToFile: method. It could very well be that simple. The danger with secondary threads is if they may access data structures that are also accessible from other threads, especially if one of the threads may be altering the data structure. So, the easiest way to be safe is to have the thread deal only with data to which it has exclusive access. For example, if you were going to write an array to file, you might be tempted to pass to the background thread a reference to the NSMutableArray ivar that your document object holds. The problem is that while the background thread is invoking -writeToFile: on the array, the main thread is mutating it. One solution is to make a copy of the array in the main thread and pass the copy to the background thread. With respect to the user closing the document while the other thread is saving, that depends. From your description, it seems as though the thread would be writing a non-essential adjunct file, not the document itself. In that case, you should be fine. The thread may continue with its (independent) write operation. 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
iPhone voice synthesis
Is there a way to do voice synthesis on the iPhone/iTouch like there is in OS X Cocoa using a [NS}voiceSynthesizer? Charlie Dickman 3tothe...@comcast.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: iPhone voice synthesis
On Dec 11, 2009, at 3:48 PM, Charlie Dickman wrote: Is there a way to do voice synthesis on the iPhone/iTouch like there is in OS X Cocoa using a [NS}voiceSynthesizer? iPhone OS does not provide support for doing this. If you would like it, I would recommend filing a bug report asking for it. -- 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: Additional action when a view's value changes (Cocoa Bindings)
On 11/12/2009, at 9:35 PM, Christian Ziegler wrote: The target controller should be the controller with these outlets. It's OK to have multiple tiers of controllers, but make sure each one has a clearly defined role. Sounds like you have not defined a clear role for each controller and each is doing part of the job of the other. Multiple controllers would usually be arranged in series, not in parallel. Well in general I usually have a hard time defining roles for my controlers. At the moment the idea is: I got one controller for all actions triggered by the mainMenu, one for all actions triggered by gui elements (my app only got one window) and another one for the rest of the logic. My problem was, that either menuitems and gui elements trigger certain actions which need to read values from many gui elements, so I introduced this mediating controller, which is not target for any action but knows all views via outlets. Also the MainMenuController and the MainWindowController got references to the MediatingController, so they can invoke methods. Well, this sounds like a mistake. Menus are just another kind of view, so it's not clear why you'd arbitrarily separate that out from the rest of your GUI. If you want to organise things into different functional groups for the sake of managing your code more easily, categories might be helpful. In fact menus are typically nil-targeted, which allows them to easily be context sensitive, but this might not be necessary in your case as you don't have multiple documents/windows. But even in a vastly more complex app, menus and other views often end up handled by the same controller. The fact you're running into difficulties with the approach you've got shows that there's a problem with your design. The thing is, I don't have a model for those values because it is a one way street. I only have to read the values to compute stuff, but never have to set new values programatically. Also there is no persistince. Would you still write a model? You have a model, whether you appreciate it or not. Even an app that just adds two numbers displays the answer has a model which embodies the actual addition. Perhaps the functions you've put in your 'mediating controller' are in fact your model? Sounds like you have something that takes a bunch of input values, performs some computation on them and returns one or more result values. That's your model. It should not know or care about the GUI in any way. Instead, the input and output values are its properties. The controller is responsible ONLY for the mapping between these and the GUI. By binding your textfield and stepper to the relevant input value property that they stand for, they will be correctly synchronised as well as driving that property as they should. Here I use the term 'binding' to mean any means of handling that input, including target/action, not just Bindings. But in this case Bindings would probably be best anyway. --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
Problem with mouse events in a custom NSControl subclass
Hello all, Reasonably descriptive title. I'm writing the Cocoa GUI for an audio unit plugin and I've run into a problem. In one host app I'm not receiving mouse events in my custom sliders/buttons etc. My drop down menus work fine but they are subclasses of NSPopUpMenu and NSPopUpMenuCell. The sliders are just NSControl subclasses. If I click on a text field then the containing window gets the focus and all my controls work as expected. I think the host should be setting the containing window's focus but it isn't and other plugins work ok in that host. Curiously, my controls receive mouse wheel events without problems and standard NSSlider controls work too. So I suppose my question is: what are NSPopUpMenu and NSSlider doing to receive mouse events that I'm not doing? Any ideas? Also, double clicks are registering mouse events to some extent. Thanks, Stephen ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Bluetooth failure
I have a Gen 2 iPod and the simulator trying to share data over bluetooth I am using the standard GK routines. However the iPod cannot see the simulator and the simulator, though it can see the ipod, as soon as I try to connect I get the error in the connect screen :Connection Lost when i log the error this is the error data : com.apple.gamekit.GKSessionErrorDomain Code=30505 UserInfo=0x1420f30 Failed while pending outgoing invitation. Basically I'm almost thinking that there is something wrong with the iPod's bluetooth since it appears blind and cannot accept connections. None of the connectivity routines are ever called in the code. - (void)session:(GKSession *)session didReceiveConnectionRequestFromPeer:(NSString *)peerID { NSLog(@Connections request from: %@ to session: %@,peerID,session); [session acceptConnectionFromPeer:peerID error:nil]; // } is never called on the iPod even though I am attempting to connect.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSBezierPath vs. NSImage
On 11/12/2009, at 8:59 PM, Alastair Houghton wrote: Anyway, the thing to do is to draw what you want, and then *if* it's going too slowly there are various things you can do to speed it up (like caching any expensive rendering in an NSImage, doing reduced or simplified rendering during live resize and so on). It's also worth considering looking at Core Animation Layers, depending on what you're drawing. I have a custom view with several objects that are expensive to draw, and what I am now doing is drawing them into CALayers. Because these are cached to the GPU, there is virtually no cost to dragging the objects around as the only time they need to be redrawn is when the content of the objects changes. Since my objects are overlaid on a large image background (at least 1000 x 1000), drawing was very expensive before I did this as the image needed to be redrawn any time the view content changed. With CALayers it is only drawn once. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Sqlite3 R*Tree module and the iPhone
I was wondering if iPhone OS 3.0 or better had the R-Tree module compiled into the sqlite3 framework that ships on the device? I've got 19,500 or so annotations and adding them all at once to the MKMapView object I have seems at the very least insane... -- Jeff___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Detaching a thread to save a file?
Hi Ken, Many thanks for your reply, much appreciated. And thanks for pointing out the potential pitfalls. I most likely would have passed it the NSMutableDictionary ivar had you not pointed this out. So, if I understand correctly, I could do something as simple as this: // Presumably as the objects within the dictionary might // change this should be a total copy: NSDictionary *searchIndexesDeepCopy = [NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:searchIndexes]]; [NSThread detachNewThreadSelector:@selector(saveSearchIndexes:) toTarget:self withObject:searchIndexesDeepCopy]; // The save method: - (void)saveSearchIndexes:(NSDictionary *)searchInfo { [myXMLGeneratedData writeToURL:myUrl atomically:YES]; } I guess I expected to have to quit the thread on project close or something in the same way as you have to stop observing objects or notifications, or unbind programmatic bindings. And from looking at the docs I thought I would need to worry about locks etc. Thanks again. I'll go ahead and try implementing this tomorrow. I really thought I must be making it too easy. :) All the best, Keith --- On Fri, 12/11/09, Ken Thomases k...@codeweavers.com wrote: From: Ken Thomases k...@codeweavers.com Subject: Re: Detaching a thread to save a file? To: Keith Blount keithblo...@yahoo.com Cc: cocoa-dev@lists.apple.com Date: Friday, December 11, 2009, 11:15 PM On Dec 11, 2009, at 4:43 PM, Keith Blount wrote: The problem is that if the project grows in size, saving this dictionary to disk can take two or three seconds. For this reason, I would like to save it in the background, so it doesn’t hold up the interface. According to Scott Anguish’s Cocoa Programming book, NSThread is ideal for this sort of thing, and that is what I would like to do (I’m stuck supporting Tiger, so I need to use -detachNewThreadSelector:). But I can’t find any obvious examples of detaching a thread specifically to save a file. So, my question is - and I already apologised for its basicness :) - what is the best way to detach a thread for saving a file, and what issues do I need to be aware of? For instance, what if the user tries to close the project (document) while the other thread is saving the file? Presumably it’s not as simple as using -detachNewThreadSelector:... to spawn a thread that just does a simple -writeToFile: method. It could very well be that simple. The danger with secondary threads is if they may access data structures that are also accessible from other threads, especially if one of the threads may be altering the data structure. So, the easiest way to be safe is to have the thread deal only with data to which it has exclusive access. For example, if you were going to write an array to file, you might be tempted to pass to the background thread a reference to the NSMutableArray ivar that your document object holds. The problem is that while the background thread is invoking -writeToFile: on the array, the main thread is mutating it. One solution is to make a copy of the array in the main thread and pass the copy to the background thread. With respect to the user closing the document while the other thread is saving, that depends. From your description, it seems as though the thread would be writing a non-essential adjunct file, not the document itself. In that case, you should be fine. The thread may continue with its (independent) write operation. 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
Re: Detaching a thread to save a file?
Oops, sorry, forgot to ask: what happens if the user hits save again while the separate thread is already saving the search indexes to disk? So, there is one save which detaches a thread and starts to write the data to disk, then seconds later the user instigates another save that causes the data to be written to the same path - couldn't this corrupt the data? Sorry for two e-mails. All the best, Keith --- On Fri, 12/11/09, Ken Thomases k...@codeweavers.com wrote: From: Ken Thomases k...@codeweavers.com Subject: Re: Detaching a thread to save a file? To: Keith Blount keithblo...@yahoo.com Cc: cocoa-dev@lists.apple.com Date: Friday, December 11, 2009, 11:15 PM On Dec 11, 2009, at 4:43 PM, Keith Blount wrote: The problem is that if the project grows in size, saving this dictionary to disk can take two or three seconds. For this reason, I would like to save it in the background, so it doesn’t hold up the interface. According to Scott Anguish’s Cocoa Programming book, NSThread is ideal for this sort of thing, and that is what I would like to do (I’m stuck supporting Tiger, so I need to use -detachNewThreadSelector:). But I can’t find any obvious examples of detaching a thread specifically to save a file. So, my question is - and I already apologised for its basicness :) - what is the best way to detach a thread for saving a file, and what issues do I need to be aware of? For instance, what if the user tries to close the project (document) while the other thread is saving the file? Presumably it’s not as simple as using -detachNewThreadSelector:... to spawn a thread that just does a simple -writeToFile: method. It could very well be that simple. The danger with secondary threads is if they may access data structures that are also accessible from other threads, especially if one of the threads may be altering the data structure. So, the easiest way to be safe is to have the thread deal only with data to which it has exclusive access. For example, if you were going to write an array to file, you might be tempted to pass to the background thread a reference to the NSMutableArray ivar that your document object holds. The problem is that while the background thread is invoking -writeToFile: on the array, the main thread is mutating it. One solution is to make a copy of the array in the main thread and pass the copy to the background thread. With respect to the user closing the document while the other thread is saving, that depends. From your description, it seems as though the thread would be writing a non-essential adjunct file, not the document itself. In that case, you should be fine. The thread may continue with its (independent) write operation. 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
Re: Detaching a thread to save a file?
On 12/12/2009, at 12:37 PM, Keith Blount wrote: NSDictionary *searchIndexesDeepCopy = [NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:searchIndexes]]; [NSThread detachNewThreadSelector:@selector(saveSearchIndexes:) toTarget:self withObject:searchIndexesDeepCopy]; OK, but 'searchesIndexDeepCopy' (which becomes 'searchInfo') is not used in the thread as written, so why do this? - (void)saveSearchIndexes:(NSDictionary *)searchInfo { [myXMLGeneratedData writeToURL:myUrl atomically:YES]; } Where does 'myXMLGeneratedData' and 'myUrl' come from? If they are data members of the document (or whatever) you need to consider whether they could be mutated by the main thread. If you're gettin gthese out of 'searchInfo' in unshown code you should be OK. If your app uses retain/release (not garbage collection), you also need to put an autorelease pool in there: - (void)saveSearchIndexes:(NSDictionary *)searchInfo { NSAutoreleasePool* pool = [NSAutoreleasePool new]; [myXMLGeneratedData writeToURL:myUrl atomically:YES]; [pool drain]; } --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: UIDatePicker in landscape - displaying items moving into position weirdness
On Dec 11, 2009, at 1:06 pm, Alex Kac wrote: if (timeSpanPicker) { //remove it [timeSpanPicker removeFromSuperview]; [timeSpanPicker release]; //now add it again [self createRelativeTriggerTimeSpanPicker]; } I would strongly suggest replacing [timeSpanPicker release]; with [self setTimeSpanPicker:nil]; This is generally better form for memory management. Generally direct assignment is discouraged anywhere other than in initialiser methods, so I'd also suggest replacing timeSpanPicker = [[UITimeSpanPicker alloc] initWithFrame: CGRectZero]; with something more like: UITimeSpanPicker *aTimeSpanPicker = [[UITimeSpanPicker alloc] initWithFrame: CGRectZero]; self.aTimeSpanPicker = aTimeSpanPicker; [aTimeSpanPicker release]; mmalc ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
[iPhone] Track for iPhone App Re-Install
Hi, Is there a way to track if an iPhone application is re-installed locally with the SDK.. without having a server ? Kind Regards, Tharindu Madushanka tharindufit.wordpress.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
water effect on iPhone with touch methods
i haven't yet started to study OpenGL, but i just came across a java sample online that creates a water effect, and the sample code was surprisingly quite small. here is the java example: http://www.neilwallis.com/java/water.html essentially, i'd like to replicate this, or something similar, using a UIImage and touch methods. how difficult will this be? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Detaching a thread to save a file?
On Dec 11, 2009, at 7:43 PM, Keith Blount wrote: Oops, sorry, forgot to ask: what happens if the user hits save again while the separate thread is already saving the search indexes to disk? So, there is one save which detaches a thread and starts to write the data to disk, then seconds later the user instigates another save that causes the data to be written to the same path - couldn't this corrupt the data? Since you're passing YES for the atomically parameter of - writeToFile:atomically:, then the data won't be corrupted. Each thread will be writing to its own temporary file and then, when the write is complete, it will atomically move the file into place. However, it is up in the air as to which thread's write operation will win. The second thread to finish will replace the file written by the first, but the order may be different than the order in which the threads were started. You can use a lock or similar mechanism to strictly order the threads. At some point, you might want to force the user to actually wait for background operations to complete. If saving a document entails a time-consuming process, you can't really completely hide that fact from the user. What if they hit Save over and over again in rapid succession? You don't want to detach umpteen threads, each with their own copy of the document data, each writing to their own temporary files, etc. At some point you probably want to put up a sheet saying Saving document... with a (possibly indeterminate) progress bar and a Cancel button. To let the main thread know when the background save is complete, you can have the background thread do a -performSelectorOnMainThread:... call. Or, you can register an NSPort in the main thread's run loop and have the background thread message it. Etc. By the way, in the code you proposed: On Dec 11, 2009, at 7:37 PM, Keith Blount wrote: // Presumably as the objects within the dictionary might // change this should be a total copy: NSDictionary *searchIndexesDeepCopy = [NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:searchIndexes]]; [NSThread detachNewThreadSelector:@selector(saveSearchIndexes:) toTarget:self withObject:searchIndexesDeepCopy]; You could actually move the unarchiving operation into the thread, too, just to increase the concurrency a bit. 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
Re: Detaching a thread to save a file?
On Fri, Dec 11, 2009 at 8:43 PM, Keith Blount keithblo...@yahoo.com wrote: Oops, sorry, forgot to ask: what happens if the user hits save again while the separate thread is already saving the search indexes to disk? Also consider what happens when the user hits save, then immediately quits before your file writing thread has finished writing the file to disk. (Since users generally get upset when you lose their data, you'll have to handle this case as well.) - Jim ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Hang Initializing App
I made a similar post to the Xcode list originally, but it was suggested that I redirect it to the Cocoa list. Here it is: I'm working with a Cocoa app compiling with gcc 4.0 in Xcode 3.2.1. Both the debug and the release builds launch fine from the Finder, but the app does not launch through the debugger in Xcode. The app's icon appears in the doc, but the app just hangs in the debugger. This app was debugging fine under Xcode 2.5 and 10.5.x. However, I had to update the code in countless places to get it to build in 3.2.1 and 10.6. Backing out those changes to discover the cause is something I'd like to avoid if possible. I made some changes to resources, but I *think* I was able to back them all out with the error still occurring. Two occurrences of this massage are appearing in the console: -[NSCFArray _getCString:maxLength:encoding:]: unrecognized selector sent to instance 0x4016e0 In a reply to my Xcode list post, From the method signature, it looks like the message should have been sent to an instance of NSString, rather than NSArray, but the leading underscore indicates it is an internal method and might indicate some 'class cluster' trickery going on behind the scenes. I would concur. With my limited knowledge of Cocoa, viewing the call stack does not reveal the cause of this problem. #0 0x92fad4e6 in objc_exception_throw #1 0x92a0790b in -[NSObject(NSObject) doesNotRecognizeSelector:] #2 0x92962db6 in ___forwarding___ #3 0x92962982 in __forwarding_prep_0___ #4 0x9291bc53 in CFStringGetCString #5 0x930a4990 in _RegisterApplication #6 0x930a3182 in GetCurrentProcess #7 0x908e2071 in GetSystemUIMode #8 0x908e2013 in IsMenuBarVisible #9 0x93991092 in _NSInitializeAppContext #10 0x9399094c in -[NSApplication init] #11 0x93990485 in +[NSApplication sharedApplication] #12 0x9398f45d in NSApplicationMain #13 0x2f6e in main at main.m:42 Occasionally, I am able to continue stepping/breaking through model and controller init code beyond the two breaks at objc_exception_throw, but never consistently, probably because memory is trashed. Might anyone offer any insight as to what might be going on and/or where to go from here? Thanks, Joe ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
NSNumber stringValue
Hi, I need to output a double into a text file and then read it back with 100% accuracy, will using NSNumber stringValue and then using NSString doubleValue give me good results? For example, if I write the following: double a,b; a=some number; b=[[[NSNumber numberWithDouble:a] stringValue] doubleValue]; will a==b TIA ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
custom view to display an analouge signal
Hi All, I'm looking for a custom view to display an analogue signal similar to garage band or instruments - does anyone know of any open source efforts in this area or even something like an IBplugin I could purchase? Cheers - james ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Limiting the area of an NSShadow
Hello, I'm trying to mimic the background of Time Machine's large On/Off switch ( http://zcr.me/l/n2 ) by drawing it via code. This is my code so far: cellFrame.size.height = 27; NSBezierPath *border = [NSBezierPath bezierPathWithRoundedRect:cellFrame xRadius:5.0 yRadius:5.0]; [border setLineWidth:1.0]; [[CZColor colorWithCalibratedWhite:0.246 alpha:1.000] set]; NSGradient *backGradient = [[NSGradient alloc] initWithStartingColor:[CZColor colorWithCalibratedWhite:0.387 alpha:1.000] endingColor:[CZColor colorWithCalibratedWhite:0.73 alpha:1.000]]; [backGradient drawInBezierPath:border angle:90.0]; NSShadow *innerShadow = [[NSShadow alloc] init]; [border addClip]; [innerShadow setShadowColor:[CZColor colorWithCalibratedWhite:0.0 alpha:0.60]]; [innerShadow setShadowOffset:NSMakeSize(0.0, -0.75)]; [innerShadow setShadowBlurRadius:1.5]; [innerShadow set]; [border stroke]; Note: CZColor is a subclass of NSColor with no modifications, only additions. It shouldn't cause any issues. This code produces the following: http://zcr.me/l/n3 The result is close to Apple's Time Machine image, but not quite: the shadow is drawn all the way around the bezier path, and not just on the top. Is there a way for my to limit the NSShadow so that it only draws on the top part of the bezier path? Thanks so much, Carter Allen ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
NSURL Name of a File: Content nor Attribute, how to check for modification?
hello list As I change the name of a File in Finder, neither NSURLContentModificationDateKey nor NSURLAttributeModificationDateKey do change. I have an internal list of Files as NSURLs in my application and watch the directory with FSEvents. I properly receive the notification that something in the watched directory changed and can properly react if some content or some metadata has changed (ie. Label). But how can i detect if the name has changed? A few years ago I read an interesting and philosophical discussion: does the name of a file belong to it's content or to it's metadata. It was very controversially discussed and as I see now for NSURL, it actually does not belong to any :-) so it's part of the URL itself. As i work only with fileReferenceURLs i don't know how to determine the change. thank you everybody for this superb mailing list. regards mahal ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
[COCOA] notification of enter/focus event?
Sorry if this is a bit too basic, but... I want to know when the user exits edit fields, so I can check values and provide immediate feedback. I'm using - (void)controlTextDidEndEditing:(NSNotification *)aNotification and it works. I also need to know when a user enters an edit field, so I can provide feedback (like a hint). I was using - (void)controlTextDidBeginEditing:(NSNotification *)aNotification but it only works when the user types something. My question is this: how can I get notification when a user simply enters a field by tabbing to it or mouse-clicking in it (and gives focus to that field)? Thanks, Paxton ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSNumber stringValue
You should not compare floating point numbers for equality in most cases. This is true of any language on any platform. See http://www.cygnus-software.com/papers/comparingfloats/Comparing%20floating%20point%20numbers.htm - Bryan On Dec 10, 2009, at 10:02:23 PM, RedleX Support wrote: Hi, I need to output a double into a text file and then read it back with 100% accuracy, will using NSNumber stringValue and then using NSString doubleValue give me good results? For example, if I write the following: double a,b; a=some number; b=[[[NSNumber numberWithDouble:a] stringValue] doubleValue]; will a==b TIA ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/bryanhenry%40mac.com This email sent to bryanhe...@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: Hang Initializing App
On Dec 10, 2009, at 4:51 PM, Joe Programmer wrote: I made a similar post to the Xcode list originally, but it was suggested that I redirect it to the Cocoa list. Here it is: I'm working with a Cocoa app compiling with gcc 4.0 in Xcode 3.2.1. Both the debug and the release builds launch fine from the Finder, but the app does not launch through the debugger in Xcode. The app's icon appears in the doc, but the app just hangs in the debugger. This app was debugging fine under Xcode 2.5 and 10.5.x. However, I had to update the code in countless places to get it to build in 3.2.1 and 10.6. Backing out those changes to discover the cause is something I'd like to avoid if possible. I made some changes to resources, but I *think* I was able to back them all out with the error still occurring. Two occurrences of this massage are appearing in the console: -[NSCFArray _getCString:maxLength:encoding:]: unrecognized selector sent to instance 0x4016e0 In a reply to my Xcode list post, From the method signature, it looks like the message should have been sent to an instance of NSString, rather than NSArray, but the leading underscore indicates it is an internal method and might indicate some 'class cluster' trickery going on behind the scenes. I would concur. H --- I would not concur.Here's a potential cause: The ' fingerprint ' of the error you are seeing occurs when an object has been over-released.Let's say that in this case the object in question was an NSString. Somehow, well, because of a mistaken over-release, the memory that was previously occupied by the now deallocated NSString is now occupied by an NSArray (NSCFArray). The code then sends an NSString message via an object reference that was once pointing to an NSString but is now pointing to an NSArray . . . With my limited knowledge of Cocoa, viewing the call stack does not reveal the cause of this problem. #00x92fad4e6 in objc_exception_throw #10x92a0790b in -[NSObject(NSObject) doesNotRecognizeSelector:] #20x92962db6 in ___forwarding___ #30x92962982 in __forwarding_prep_0___ #40x9291bc53 in CFStringGetCString #50x930a4990 in _RegisterApplication #60x930a3182 in GetCurrentProcess #70x908e2071 in GetSystemUIMode #80x908e2013 in IsMenuBarVisible #90x93991092 in _NSInitializeAppContext #10 0x9399094c in -[NSApplication init] #11 0x93990485 in +[NSApplication sharedApplication] #12 0x9398f45d in NSApplicationMain #13 0x2f6e in main at main.m:42 Occasionally, I am able to continue stepping/breaking through model and controller init code beyond the two breaks at objc_exception_throw, but never consistently, probably because memory is trashed. Might anyone offer any insight as to what might be going on and/or where to go from here? If you can run Clang (via Build and Analyse), it might help pinpoint potential trouble spots. But it also sounds as if you are fairly close to homing in on it based on what you just said about stepping through the code. Cheers, . . . . . . . .Henry ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Binding an Array of Dictionaries
On 11 Dec 2009, at 22:54, Keary Suska wrote: On Dec 11, 2009, at 12:45 AM, Gerriet M. Denkmann wrote: I have a window with an NSTableView which is bound to an NSArrayController which has as content an NSMutableArray called theArrayOfDictionaries. Works fine. theArrayOfDictionaries contains NSMutableDictionaries. So I added another NSTableView to my window, bound to an NSDictionaryController, which has it's content bound to NSArrayController.selection. But the documentation says about selection: proxy object representing the receiver’s selection. And it's no surprise that I get an exception: Cannot create NSDictionary from object [...] of class _NSControllerObjectProxy Well, everything behaves as documented - no reason to complain. But: how to I populate my NSDictionaryController with the NSMutableDictionary currently selected in my NSArrayController? And also: make sure that any changes done in this current dictionary (the NSTableViews will be editable) get back into theArrayOfDictionaries? You will have to maintain the currently selected object in your model. HTH, This certainly helps - if only in destroying my hopes for an easy solution. So: you are telling me to observe the selection of my NSArrayController updating some property like currentlySelectedArrayElement whenever the selection changes. And setting the content of my NSDictionaryController to this currentlySelectedArrayElement. And also observing currentlySelectedArrayElement - so that in case the user did edit it's NSTableVIew the new thing can be reinserted into my NSArray. Sounds like much work. The more so, because it is possible to bind a controllers content to NSDictionaryControllers selection.value without any problems - so that the inability to bind something to NSArrayController selection seems a kind of unexpected limitation. But this is by the way. Well, in the end I tried another solution: My NSArray not longer contains NSDictionaries, but a new class GmdContent which has just one property called realContent (which contains the NSDictionary). And now I can bind the content of the NSDictionaryController to NSArrayController selection.realContent and everything works perfectly - changes done in the TableView of my Dictionary automatically get inserted into my Array. Question: Is this really a very clever idea - or (as I am about to find out later) an awfully silly one? And what about another idea I had: Replace the NSArray (a0, a1, ..., an ) with an NSDictionary: ( 0 → a0, 1 → a1, ..., n → an )? I have not tried this yet, but it sounds a plausible workaround. Or is it? 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
-[NSWorkspace absolutePathForAppBundleWithIdentifier:] and the Trash
Could someone please clarify the behavior of -[NSWorkspace absolutePathForAppBundleWithIdentifier:] when an application is in the Trash? In almost all of my testing, the method returns nil when an app is in the Trash. However, one time in the debugger (on Mac OS X 10.5.8) I caught it returning an app's path in /Users/jeff/.Trash. Strangely, I've never been able to reproduce that result a second time. I would appreciate any clarification on how the method handles the Trash. There doesn't seem to be any documentation about that. Given my one-time result, we may have to consider the behavior undefined. But maybe that one instance was just a bug. Clearly the behavior is not entirely random. -Jeff ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [COCOA] notification of enter/focus event?
On Dec 11, 2009, at 10:23 AM, Paxton Sanders wrote: Sorry if this is a bit too basic, but... I want to know when the user exits edit fields, so I can check values and provide immediate feedback. I'm using - (void)controlTextDidEndEditing:(NSNotification *)aNotification and it works. I also need to know when a user enters an edit field, so I can provide feedback (like a hint). I was using - (void)controlTextDidBeginEditing:(NSNotification *)aNotification but it only works when the user types something. My question is this: how can I get notification when a user simply enters a field by tabbing to it or mouse-clicking in it (and gives focus to that field)? How about -becomeFirstResponder ? Cheers, . . . . . . . .Henry ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSNumber stringValue
On 11 Dec 2009, at 21:14, Bryan Henry wrote: You should not compare floating point numbers for equality in most cases. This is true of any language on any platform. Indeed, some floating-point numbers (such as the one represented by the integer 0x7fc0) will compare as not equal to themselves: { union { float f; long i; } u; u.i = 0x7fc0; if(u.f == u.f) printf(As expected.\n); else printf(How strange.\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: NSURL Name of a File: Content nor Attribute, how to check for modification?
On Dec 11, 2009, at 4:56 AM, martin halter wrote: As I change the name of a File in Finder, neither NSURLContentModificationDateKey nor NSURLAttributeModificationDateKey do change. I have an internal list of Files as NSURLs in my application and watch the directory with FSEvents. I properly receive the notification that something in the watched directory changed and can properly react if some content or some metadata has changed (ie. Label). But how can i detect if the name has changed? A few years ago I read an interesting and philosophical discussion: does the name of a file belong to it's content or to it's metadata. It was very controversially discussed and as I see now for NSURL, it actually does not belong to any :-) so it's part of the URL itself. In most Unix systems, the file name belongs to the directory containing the file. This is important in light of the possibility of a single file being hardlinked from multiple directories. Each may use a different name for the same file. As i work only with fileReferenceURLs i don't know how to determine the change. You can examine the NSURLNameKey to find the current name (I assume; I haven't checked that it's always up to date; it may be cached). If you want to detect that the name has changed, I guess you'd have to keep the old name along with the URL and compare. You might also consider using the kqueue API. It has an event type for watching individual files for changes, including deletion or renaming. Regards, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Hang Initializing App
On Dec 10, 2009, at 6:51 PM, Joe Programmer wrote: #0 0x92fad4e6 in objc_exception_throw #1 0x92a0790b in -[NSObject(NSObject) doesNotRecognizeSelector:] #2 0x92962db6 in ___forwarding___ #3 0x92962982 in __forwarding_prep_0___ #4 0x9291bc53 in CFStringGetCString #5 0x930a4990 in _RegisterApplication #6 0x930a3182 in GetCurrentProcess #7 0x908e2071 in GetSystemUIMode #8 0x908e2013 in IsMenuBarVisible #9 0x93991092 in _NSInitializeAppContext #10 0x9399094c in -[NSApplication init] #11 0x93990485 in +[NSApplication sharedApplication] #12 0x9398f45d in NSApplicationMain #13 0x2f6e in main at main.m:42 I agree with Henry that it looks like an over-released object. Enabling NSZombie along with malloc stack logging, or using the Zombies Instrument, would probably be the quickest way to identify it. Given the above stack trace, it would have to be very early in process startup. In particular, by this point I can think of only a few parts of your code which would have been executed: * Any C++ static initializers or other functions marked as constructors * Stuff in main() prior to the call of NSApplicationMain Since it doesn't show up in the stack trace, you're apparently not using a custom subclass of NSApplication, or I'd suspect its initializer, too. Anyway, no point in guessing. The tools should be able to show you precisely what's gone wrong. Regards, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSUserDefaults Croaks on Dictionary Containing NSNumber as Key
Sorry for the wonky subject. It's easier to explain in code: NSNumber* innerKey = [NSNumber numberWithInt:0] ; NSDictionary* dic = [NSDictionary dictionaryWithObject:@Hello forKey:innerKey] ; [[NSUserDefaults standardUserDefaults] setObject:dic forKey:@outerKey] ; Result: *** -[NSUserDefaults setObject:forKey:]: Attempt to insert non-property value '{ 0 = Hello; }' of class 'NSCFDictionary'. If I change innerKey to a string such as @0, then all works fine. In my opinion, after reading the documentation carefully, this exception is a false alarm. First of all, NSCFDictionary *is*, as required, one of the property list objects: NSData, NSString, NSNumber, NSDate, NSArray, or NSDictionary. Furthermore, all of its objects and keys are themselves property list objects. Furthermore, NSNumber conforms to NSCopying protocol, as required for dictionary keys. Is there some other requirement that I missed? Jerry Krinock ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSUserDefaults Croaks on Dictionary Containing NSNumber as Key
On Fri, Dec 11, 2009 at 11:10 PM, Jerry Krinock je...@ieee.org wrote: Sorry for the wonky subject. It's easier to explain in code: NSNumber* innerKey = [NSNumber numberWithInt:0] ; NSDictionary* dic = [NSDictionary dictionaryWithObject:@Hello forKey:innerKey] ; [[NSUserDefaults standardUserDefaults] setObject:dic forKey:@outerKey] ; Result: *** -[NSUserDefaults setObject:forKey:]: Attempt to insert non-property value '{ 0 = Hello; }' of class 'NSCFDictionary'. The message printed is unfortunate, as it doesn't really tell you what is wrong (please file a bug). It's fine to have numbers as keys in dictionaries; however keys property lists (and therefore in user defaults) must be strings. -- Clark S. Cox III clarkc...@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