Design question: View with hell lot of drawing
Hi All, I need to display huge number of elements in NSView (1000-2000). These elements are generally made of high resolution image files with some fancy drawing around them. These elements may vary from size 300 X 270 to 4280 X 3500. First I made use of NSView's for elements, I abandoned the idea because I was supposed to connect some elements with lines, obviously line drawing was going behind the elements . Secondly I tried with CALayer's and I have a problem of GPU constraint for the resolutions I mentioned.(I tried optimizing, by only displaying required layer in the View's visible part ,that too didn't help much) Is there any other way of approach, or should I be making use of one of the ways I mentioned ? Any help is greatly appreciated Thanks Rajesh previous message to the list: subLayers - GPU - optimizing ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Design question: View with hell lot of drawing
On 10/03/2009, at 7:39 PM, rajesh wrote: Is there any other way of approach, or should I be making use of one of the ways I mentioned ? Of course - just define a custom object that contains or manages each piece of content and draw them in one view. This is the classic approach and is probably the most scalable technique of all, since it incurs no overhead other than what you add. The simplest approach is just to hold all the objects in a list and when the view is updated, traverse the list and determine which objects need to be drawn. The view itself has methods to keep this to a minimum -needsToDrawRect: and -getRectsBeingDrawn:count: For large numbers of objects (1000, but YMMV) traversing the list testing for needs to be drawn itself becomes significant, in which case you'll need to consider alternative architectures such as binary search partitioning or R*-trees. My own DrawKit project includes classes for dealing with this problem. http://apptree.net/drawkit.htm (though right now the implementation in the current download is a bit buggy - I have a new version going out soon that fixes these issues). --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: [ANN] InspectorKit (framework/IB-plugin)
Hi Steven, this looks very interesting thanks. Could I ask you to describe how it differs from OmniInspector, other than having an IB Plugin? Mike. On 10 Mar 2009, at 05:05, Steven Degutis wrote: Hi all! I've just released a piece of open-source software (BSD license) as both a framework and an Interface Builder plugin, called InspectorKit. It's intended to give you the ability to create an inspector at design time, which mimics the aesthetics and functionality of many found in Leopard. You can read more detail about it at the following link, including finding the source, a binary download, and a video demo of the plugin in action: http://www.degutis.org/dev/open-source/2009/03/09/introducing-inspectorkit/ Thanks, I hope you find good use from it. If you end up using it in your project, I'd love to hear about it! -Steven Degutis Lead Monkey Assassin www.ThoughtfulTree.com www.TeachMeCocoa.com www.Degutis.org (also hire.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/cocoadev%40mikeabdullah.net This email sent to cocoa...@mikeabdullah.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: persisting user credentials -- how?
There's also NSURLCredentialStorage which is more specialised than the keychain services, but for a web service may be ideal. On 9 Mar 2009, at 21:32, Stefan Wolfrum wrote: Hi, I have a little app that needs a username password to log into some web service. These user credentials should be stored permanently so that the user doesn't have to enter them after each start of the application again. What's the most common way to do this? In a .plist file? But how does one encrypt the password? What does Apple suggest? I googled and searched developer docs -- to no avail. A pointer to a webpage, tutorial, document, code snippet would be cool! Thanks a lot, Stefan. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
Problem in save and open on Core Data Document Based application
Hello, I am learning mac development from Aaron Hillegas 3rd Edition. i have created two Example CarLot and Departments based on Core -Data document based application. When i created CarLot example that time it can save and open data without writing single line. Then i created Departments example so it should also save and open. But second example save successfully but when open, it gives error. But in dock panel, CarLot apps is launched. i can open this apps from dock. But i wanted to save and open Departments example. I can't understand that i saved apps from Deparetment and it launch CarLot example in dock. Is there in problemwhat is the problem..i m trying from long time. And the message is The document “DeptTest” could not be opened. The model configuration used to open the store is incompatible with the one that was used to create the store. Please anyone help to figure out this problem. Thanks, Haresh. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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 in save and open on Core Data Document Based application
Hi, the message says that the data model in the file you try to open is different than the one you have in your app. As far as I can follow you, both apps use the same file type and the former is always trying to open the others file. Of ocurse, then it complains about the different model. Have you tried opening Departments file via Departments - File - Open ? That should work. If not, you have made changes to your model after saving the document. On a side note: CoreData should not be learned by the beginner. First, try to understand the basics, than move slowly, very slowly up to CoreData, otherwise you'll be lost soon. If you're not content with the content you find via Apple's developer resources on Core Data, there is a very good book written by Markus Zarra - available as preliminary version from Pragmatic Programmers. Cheers, Volker Am 10.03.2009 um 11:39 schrieb haresh vavdiya: Hello, I am learning mac development from Aaron Hillegas 3rd Edition. i have created two Example CarLot and Departments based on Core -Data document based application. When i created CarLot example that time it can save and open data without writing single line. Then i created Departments example so it should also save and open. But second example save successfully but when open, it gives error. But in dock panel, CarLot apps is launched. i can open this apps from dock. But i wanted to save and open Departments example. I can't understand that i saved apps from Deparetment and it launch CarLot example in dock. Is there in problemwhat is the problem..i m trying from long time. And the message is The document “DeptTest” could not be opened. The model configuration used to open the store is incompatible with the one that was used to create the store. Please anyone help to figure out this problem. Thanks, Haresh. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/volker_lists%40ecoobs.de This email sent to volker_li...@ecoobs.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
Understanding how to display a context menu
Hey guys, I'm trying to understand the Apple docs for adding a context menu to an NSOutlineView: http://developer.apple.com/documentation/Cocoa/Conceptual/MenuList/Articles/DisplayContextMenu.html#//apple_ref/doc/uid/TP40004968 I am a bit stuck at how do you make it truly context sensitive, ie I'm trying to make a menu that has Add new person and Remove name, where name is the content of the row selected? I am guessing I need to talk back to the controller object which has the data? Perhaps somehow calling back to the data source object to ask it to build the menu (but I am not sure how to do that or if I should do that). This allows me to at least show the row number in the menu: @implementation NSContextOutlineView - (NSMenu *)defaultMenu { if([self selectedRow] 0) return nil; NSMenu *theMenu = [[[NSMenu alloc] initWithTitle:@Website context menu] autorelease]; [theMenu insertItemWithTitle:@Add new person action:@selector(addSite:) keyEquivalent:@ atIndex:0]; NSString* deleteItem = [NSString stringWithFormat: @Remove '%i', [self selectedRow]]; [theMenu insertItemWithTitle: deleteItem action:@selector(removeSite:) keyEquivalent:@ atIndex:1]; return theMenu; } - (NSMenu *)menuForEvent:(NSEvent *)theEvent { return [self defaultMenu]; } @end Any help much appreciated! Thanks, Jacob ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: [ANN] InspectorKit (framework/IB-plugin)
Sure. Basically, InspectorKit is designed to be a little more simple in usage and aesthetics. For example, it does not provide a specialized titlebar, and every pane is collapsible. It also uses Core Animation to animate its panels, and is thus only Leopard+ compatible. And as you mentioned, this framework comes with an IB plugin, making it much easier to design your inspector panels inside IB and test out in the Cocoa Simulator. - Steven On Tue, Mar 10, 2009 at 5:18 AM, Mike Abdullah cocoa...@mikeabdullah.net wrote: Hi Steven, this looks very interesting thanks. Could I ask you to describe how it differs from OmniInspector, other than having an IB Plugin? Mike. On 10 Mar 2009, at 05:05, Steven Degutis wrote: Hi all! I've just released a piece of open-source software (BSD license) as both a framework and an Interface Builder plugin, called InspectorKit. It's intended to give you the ability to create an inspector at design time, which mimics the aesthetics and functionality of many found in Leopard. You can read more detail about it at the following link, including finding the source, a binary download, and a video demo of the plugin in action: http://www.degutis.org/dev/open-source/2009/03/09/introducing-inspectorkit/ Thanks, I hope you find good use from it. If you end up using it in your project, I'd love to hear about it! -Steven Degutis Lead Monkey Assassin www.ThoughtfulTree.com www.TeachMeCocoa.com www.Degutis.org (also hire.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/cocoadev%40mikeabdullah.net This email sent to cocoa...@mikeabdullah.net -- ~Steven Degutis President, Thoughtful Tree Software, Inc. http://www.ThoughtfulTree.com/ http://www.TeachMeCocoa.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
launching IPhone App Via terminal in IPhone Simulator
Hi, I was writing an automation tool from which i need to build and launch IPhone App.I am able to build it. but when i try to launch the application it crashes. Can any body help me. Regards, Anshul jain ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: User In-Activity hook? And a request
For anybody who cares, the following predates CGSecondsSinceLastInputEvent, and uses only public APIs. It's probably just personal preference as to which is less vile ;-) - (float) getSystemIdleSeconds { static mach_port_t masterPort = 0; static io_iterator_t iter; static io_registry_entry_t curio; if( masterPort == 0 ) { if( IOMasterPort( MACH_PORT_NULL, masterPort ) == KERN_SUCCESS IOServiceGetMatchingServices( masterPort, IOServiceMatching( IOHIDSystem ), iter ) == KERN_SUCCESS ) { curio = IOIteratorNext( iter ); IOObjectRelease( iter ); } } CFTypeRef obj = 0; if( curio ) obj = IORegistryEntryCreateCFProperty( curio, CFSTR( HIDIdleTime ), kCFAllocatorDefault, 0 ); float val = 0; if( obj ) { uint64_t nano = 0; CFTypeID type = CFGetTypeID( obj ); if( type == CFDataGetTypeID() ) CFDataGetBytes( (CFDataRef) obj, CFRangeMake( 0, sizeof( nano )), (UInt8*) nano ); else if( type == CFNumberGetTypeID() ) CFNumberGetValue( (CFNumberRef) obj, kCFNumberSInt64Type, nano ); CFRelease( obj ); val = nano / 10.0; } return val; } -- Scott Ribe scott_r...@killerbytes.com http://www.killerbytes.com/ (303) 722-0567 voice ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
KVO Bindings: Proxy object change notifications
Hey list, I'm having some issues with KVO and updating UI elements via bindings; I'd greatly appreciate some clarification on the KVO-compliant way to do what I'm attempting: I have a preferences controller object (let's call it PrefCtrl) that's modeled after NSUserDefaultsController (for various reasons, though, it's a custom implementation.) As does NSUDC, it has a 'values' property, which mediates access to the preferences. The bindings in the UI use this 'values' proxy object to access the preferences. The role of the proxy object is simple: it forwards KVC methods (-valueForUndefinedKey: and setValue:forUndefinedKey:) to PrefCtrl, which either supplies or sets the appropriate value. Preferences can change at anytime and potentially from other processes. (I've got the correct locking mechanisms in place, and such.) When the preferences change from 'under the feet' of the app in question, I expect the UI elements of the app to update accordingly (via bindings). In order to announce that the UI elements need updating, I wrap the preferences-updating code with willChange/didChangeValueForKey: - (void)preferencesOnDiskDidChangeNotification: (NSNotification *)notification { // This code is part of PrefCtrl [self willChangeValueForKey: @values]; ... read the prefs from disk, and update our in-memory prefs dictionary to reflect the new prefs ... [self didChangeValueForKey: @values]; } Now consider when I have UI elements bound to the PrefCtrl - for example, a button's enabled property is bound to PrefCtrl's values.someFeature (when a value exists for the 'values.someFeature' key path, the button's enabled, otherwise disabled.) This all works fine - when preferences change, the enabled state of the button reflects the current value of 'values.someFeature'. The problem arises when I have 3+ elements in the binding key path. For example, if the button's enabled property is bound to PrefCtrl's values.someFeature.isEnabled. In this case, when the value of 'values.someFeature.isEnabled' changes (let's assume due to another process re-writing the preferences) is when hell breaks loose and I get this delightful message: Cannot remove an observer NSKeyValueObservance 0x137d50 for the key path someFeature.isEnabled from PrefCtrl_Proxy 0x135bd0, most likely because the value for the key someFeature has changed without an appropriate KVO notification being sent. Check the KVO-compliance of the PrefCtrl_Proxy class. (Note that PrefCtrl_Proxy is the class name of my 'values' proxy.) My question: Of course, this error is correct - the value for the 'someFeature' key DID change. But why wasn't sending willChange/didChangeValueForKey: @values enough to notify the KVO system that values.someFeature was also going to change? It seems implied that when announcing that the root segment of the key path ('values') is changing, all children keys will also be changing. But based on this console output, I suppose not. When the preferences change, do I really need to send willChange/didChange for every key that's present in 'values'? (Which makes everything work, by the way, but definitely isn't as easy as simple announcing that PrefCtrl's 'values' will change. I should also mention that I've found keyPathsForValuesAffectingValueForKey:, but it's just as clumsy as sending willChange/didChange for every key in 'values'.) What's even more confusing is that everything works fine when I exclude the 'isEnabled' suffix of the key path. That is, sending willChange/didChangeValueForKey: @values is sufficient when the button's enabled property is bound to values.someFeature; my UI updates accordingly and I don't receive any output in the console. I've created an example project that exhibits my problem, it's available here: http://www.docdave.com/kvo_project.zip I've been reading through the KVO documentation but I can't seem to find anything relevant to this issue (I'm not sure what I would even call this problem). Perhaps I'm blind - if you would be so kind to point me in the right direction :) Thanks a lot for any help! David ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Control in NSWindow top-right
Hi All, Could anyone point me towards documentation/blog on how to add a control to the top-right of a Window, or tell me if it's even possible? I'd like to add an NSButton up there, perhaps a Register now button for example. To further clarify what I'm talking about here a link http://skitch.com/mozketo/b8tfw/controlonwindow Many thanks, Ben. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Getting Distant Object In C++
Hi All, I have two application in which I want to implement IPC using cocoa distributed object . Then I have established NSConnection between two process and I am able to get proxy for the object in the remote process in the client application . Using this proxy I want to get access to various other object that exist in the remote process . These object are instance of both c++ class as well as objective c class. In the client process I have a base class pointer which I want to point to the implementing class in the remote process. At the same time in the client process I have objective c protocol in which I want to recieve implementing objective c class's object that implements our protocol. While the objective C version works peerfectly , the c++ version does not. Can you please guide me to a possible way by which I get the c++ implementation working . Please see my code below. Thanks // // remote application // /TestRemote .h*/ class CRemoteBase; @protocol RemoteProtocol - (CRemoteBase*) GetRemoteObject; @end @interface CRemote : NSObject RemoteProtocol { } - (void) RegistreRemote; @end class CRemoteBase { public: virtual void ShowMessage() = 0; }; class CRemoteDerived : public CRemoteBase { public: CRemoteDerived (); ~CRemoteDerived(); void ShowMessage(); }; / TestRemote.cpp*/ @implementing CRemote - init { return self; } - (void) RegisterRemote { [[NSConnection defaultConnection] setRootObject : self]; [[NSConnection defaultConnection] registerName :@TestRemote]; } - (void) dealloc { [super dealloc]; } - (CRemoteBase*) GetRemoteObject { return new CRemoteDerived(); } @end //end CRemoteDerived :: CRemoteDerived () {} CRemoteDerived :: ~CRemoteDerived () {} void CRemoteDerived :: ShowMessage() { printf(This is remote object testing); } // // reciever application // /TestReciever.h*/ @interface CTestReciever : NSObject { id remoteProxy; } - (CRemoteBase*) GetDistantObject : (NSString*) registerName; @end /TestReciever.cpp*/ @implementing CTestReciever - init { if (self = [super init]) { CRemoteBase ptrRemote = NULL; ptrRemote = (CRemoteBase*)[self GetDistantObject : @TestRemote]; ptrRemote-ShowMessage(); delete(ptrRemote); } return self; } - (void) dealloc { [super dealloc]; } - (CRemoteBase*) GetDistantObject : (NSString*) registerName { remoteProxy = [[NSConnection rootProxyFor ConnectionWithRegisteredName :registerName host : nil]retain]; [remoteProxy setProtocolForProxy : @protocol(RemoteProtocol)]; if(remoteProxy [remoteProxy conformsToProtocol : @protocol(RemoteProtocol)]) { return [remoteProxy GetRemoteObject ]; } else return NULL; } @end ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Remote Invocation
Hi All, I have two application in cocoa . My aim is to communicate with a protocol between both the application using IPC mechanism (through NSConnection) but I am unable to achieve my goal. I want to use id MyProtocol protocol as inout parameter for two way communication. Please see my code below and guide me what I am missing. //***Vendor Process** // Root.h @protocol MyProtocol - (long) getNumber ; @end @protocol RootProtocol - (HRESULT) getData : (id MyProtocol ) pMyProtocol; @end @interface CRoot : NSObject RootProtocol {} @end @protocol RemoteObjProtocol - (id) GetDistObject; @end @interface CRootService : NSObject RemoteObjProtocol {} @end @interface OutClass : NSObject MyProtocol {} @end // Root.m @implementation OutClass - (id) init {return self;} - (void) dealloc {[super dealloc];} - (long) getNumber {return 10;} @end @implementation CRoot - (id) init{return self;} - (void) dealloc{[super dealloc];} - (HRESULT) getData : (id MyProtocol ) pMyProtocol { pMyProtocol = [[[CRootService alloc] init] autorelease]; return S_OK; } @end @implementation CRootService - (id) init { [[NSConnection defaultConnection] setRootObject: self]; [[NSConnection defaultConnection] registerName: @RootService]; return self; } - (void) dealloc{[super dealloc];} - (id) GetDistObject { return [[[CRoot alloc] init] autorelease]; } @end //Reciever Process** /// Test.h @interface CTest : NSObject {} + (id) ReturnDistObj : (NSString*)registeredName; @end // Test.m id remoteProxy; @implementation CTest - (id) init{return self;} - (void) dealloc{[super dealloc];} + (id) ReturnDistObj : (NSString*)registeredName { remoteProxy = [[NSConnection rootProxyForConnectionWithRegisteredName: registeredName host: nil] retain]; [remoteProxy setProtocolForProxy:@protocol(RemoteObjProtocol)]; if (remoteProxy [remoteProxy conformsToProtocol: @protocol( RemoteObjProtocol)]) { return [remoteProxy GetDistObject] ; } else return NULL; } @end int main() { id RootProtocol pRootProtocol = [CTest ReturnDistObj: @Rootservice]; id MyProtocol pMyProtocol = nil; [pRootProtocol getData: pMyProtocol ]; return 1; } ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
State of performing tasks with elevated privileges
I'm fairly new to Cocoa (new to real desktop programing in general, to be honest) and am building an app that's going to want occasional system-level privileges (10.4+). Actually, here's what it needs: 1. To be able to set its preferences system-wide 2. To add itself as a login item for all users 3. To uninstall itself entirely (manually and requiring admin authorization, or silently self-destructing) 4. To do any of the above without making assumptions about the logged-in user (admin, regular, network). After poking around a lot in the documentation and on list archives, it looked like my best bet would be to create a helper tool to do anything privileged. Things started to get complicated. It looks now like I have four options: I can make a helper tool that I call with AuthorizationExecuteWithPrivileges. I already have this working, but it's vulnerable to attack (if the helper binary is replaced) and apparently has poorly-documented caveats (needing to reap the process when it's done executing, for one, which is something else I've never done). I can make a helper tool that's package-installed as suid root. I shouldn't have to worry too much about it other than checking with the parent before doing anything dangerous. Anyone with rights to modify it already has control over the system. However, this kind of tool will only run from a permissions-enabled drive and can't be drag-copied or drag-installed. Not elegant. The third option looks to be MoreSecurity. Takes care of its own copying and permissions. But it's very, very old code and I haven't even gotten the example to compile yet on my Leopard machine. Something about the many hundreds of lines of C used to solve the problem makes me uneasy (one of the reasons I'm writing this). The final option would be BetterAuthorizationSample. It's new. Wonderful. But it installs a launchd plist, and looking around at my own systems I see no evidence that any of the applications I use on an everyday basis work this way. I only find them for apps that really are running as daemons, and not in the format BAS uses. Also, this text is in the readme: if your application needs elevated privileges for a one-off task (like installing or uninstalling), you should consider using AuthorizationExecuteWithPrivileges directly. What I'm doing won't be one-off, but it won't be common either. I also hear the occasional warning that launchd has serious issues in Tiger. How true is this? I'm coming to cocoa-dev looking for some guidance on the real-world, current way of doing this. What have I missed? What's obsolete, what's advised against, and what are you all using in production? Any guidance would be deeply appreciated. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Design question: View with hell lot of drawing
On Mar 10, 2009, at 1:39 AM, rajesh wrote: I need to display huge number of elements in NSView (1000-2000). These elements are generally made of high resolution image files with some fancy drawing around them. These elements may vary from size 300 X 270 to 4280 X 3500. First I made use of NSView's for elements, I abandoned the idea because I was supposed to connect some elements with lines, obviously line drawing was going behind the elements . Secondly I tried with CALayer's and I have a problem of GPU constraint for the resolutions I mentioned.(I tried optimizing, by only displaying required layer in the View's visible part ,that too didn't help much) Is there any other way of approach, or should I be making use of one of the ways I mentioned ? In addition to Graham's comments in a previous reply, I'd also suggest that, depending on what your view does, to generate a smaller thumbnail to represent the full-sized image. This both reduces your memory footprint as well as improving drawing speed. If the thumbnail size is dependent upon the view size, you could either invalidate your thumbnail cache when the view size changes or choose a maximum thumbnail size that you just scale appropriately. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Garbage collected and non-garbage collected
I have an app built using garbage collection. I am begin asked to introduce a framework that is non garbage collected but the compiler will not allow this. I have set GC supported on the framework and recompiled which works but the framework causes cryptic errors once compiled in this manner. I am not really experienced in this manner and have read the docs which make me believe that the code should be fine but it is not. Am I misreading the docs? Is there a way to get GC and non GC code to live together happily? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Getting Distant Object In C++
On Tue, Mar 10, 2009 at 7:44 AM, rajesh swarnkar amicableraj...@gmail.com wrote: While the objective C version works peerfectly , the c++ version does not. Can you please guide me to a possible way by which I get the c++ implementation working . Please see my code below. No, we really can't guide you. Doesn't work is a meaningless thing to say. Of course it doesn't work, if it worked you wouldn't be here. Explain more about how it fails, then perhaps somebody will be able to assist. 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: Garbage collected and non-garbage collected
On 3/10/09 10:23 AM, Robert Mullen said: I have an app built using garbage collection. I am begin asked to introduce a framework that is non garbage collected but the compiler will not allow this. I have set GC supported on the framework and recompiled which works but the framework causes cryptic errors once compiled in this manner. I am not really experienced in this manner and have read the docs which make me believe that the code should be fine but it is not. Am I misreading the docs? Is there a way to get GC and non GC code to live together happily? You'll have to do a code review and testing of the framework's code to make sure it supports both GC and RR. -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Getting Distant Object In C++
A word of advice when posting code like this: use pastebin. http://pastebin.com It makes the code a lot easier to read. As it stands, your .cpp file is weird... it should be .mm to invoke the Objective-C++ compiler, and @implementing isn't an ObjC keyword. --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: Garbage collected and non-garbage collected
On Tue, Mar 10, 2009 at 1:23 PM, Robert Mullen robe...@autowc.com wrote: I have an app built using garbage collection. I am begin asked to introduce a framework that is non garbage collected but the compiler will not allow this. I have set GC supported on the framework and recompiled which works but the framework causes cryptic errors once compiled in this manner. I am not really experienced in this manner and have read the docs which make me believe that the code should be fine but it is not. Am I misreading the docs? Is there a way to get GC and non GC code to live together happily? GC is all-or-nothing. In any given process, either it is garbage collected or it is not. If it uses GC, all code which loads into the process must be GC-capable. If it does not use GC, all code must be retain/release capable. The way Cocoa's GC works, you can't just flip the switch on some old code and have it work. If you want to use this framework, you'll have to go through and actually fix it up to be properly GC capable. Apple's Garbage Collection Programming Guide has a small section on old-style patterns which don't translate across to a GC environment which may be helpful to you: http://developer.apple.com/documentation/Cocoa/Conceptual/GarbageCollection/Articles/gcInapplicablePatterns.html#//apple_ref/doc/uid/TP40006762 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: Control in NSWindow top-right
Use -[NSWindow standardWindowButton:] to get a pointer to one of the buttons in the titlebar; doesn't matter which one, but you may want to use NSWindowToolbarButton if you're putting it in the upper-right. Then use -[NSView superview] to get at the view that encloses the titlebar, and add your view as a subview. --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: State of performing tasks with elevated privileges
On Mar 10, 2009, at 10:39 AM, Sidney San Martín wrote: I can make a helper tool that I call with AuthorizationExecuteWithPrivileges. I already have this working, but it's vulnerable to attack (if the helper binary is replaced) Yes, but the chances of that happening are very, very low unless the same user who installed the application also installed some malware that intentionally targeted your app. If that's a concern to you, then you could check a checksum or some other signature before invoking AEWP (). But keep in mind that (1) malware of any kind on Mac OS X is very rare to nonexistent, and (2) you cannot stop a very determined attacker; you can make it more difficult to discourage the less determined, but not impossible. and apparently has poorly-documented caveats (needing to reap the process when it's done executing, for one, which is something else I've never done). Well, you don't _need_ to reap the zombies if you don't want to. It'll just look strange in Activity Monitor, and will waste a little RAM until the parent task exits. Nick Zitzmann http://www.chronosnet.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Getting Distant Object In C++
On 10 Mar 09, at 04:44, rajesh swarnkar wrote: I have two application in which I want to implement IPC using cocoa distributed object . Then I have established NSConnection between two process and I am able to get proxy for the object in the remote process in the client application . Using this proxy I want to get access to various other object that exist in the remote process . These object are instance of both c++ class as well as objective c class. [...] Well, yes, of course it doesn't work. Distributed Objects only works for ObjC; it won't work on C++ objects, no matter how much typecasting you do. ObjC++ doesn't work that way. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Garbage collected and non-garbage collected
On Tue, Mar 10, 2009 at 1:32 PM, Sean McBride s...@rogue-research.com wrote: You'll have to do a code review and testing of the framework's code to make sure it supports both GC and RR. Unfortunately this is true. Not just for frameworks, but any plug-ins those frameworks might load. A new, small internal project started awhile back seemed like the perfect opportunity to try out GC in a production app. This app used QTKit, but users needed the Flip4Mac plug-in to work with WMA files. At the time (I have no idea about now), any time QuickTime tried to load the Flip4Mac plug-in, it would die horribly. I reverted to good old-fashioned memory management for two reasons: 1 - I couldn't wait for the plug-in to be updated to support this (assuming it ever would be). 2 - I could see no way of nicely handling the situation even if the plug-in was updated, since some users would inevitably be using an older version ... because they may have forgotten (or not even known) the plug-in was installed, or what it even was by name. I have to admit, it was a *totally* unexpected problem that I was lucky to have noticed (because I had the plug-in installed for personal use) before investing much time and having to retro-fit everything with memory management. If you're looking for more details (the specific failure, behavior, whether it could have been caught and handled properly), I have none. It was right around Leopard's release and was a quick-and-dirty project, so I didn't bother studying the problem beyond, Oh, that won't work. Back to the tried-and-true. Sorry. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSSlider changed notification
Hi All, I'm sure this is something basic that I'm just missing. For some reason I can not find how to get a notification when my slider changes value. I want to be able to subscribe to receive a notification if the slider value changes. Is there a delegate method for this? What is the best way to get this? I guess one option would be to use KVO, but I suspect there is a simpler solution. thanks for the help -dave ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Garbage collected and non-garbage collected
On Mar 10, 2009, at 10:46 AM, I. Savant wrote: Unfortunately this is true. Not just for frameworks, but any plug-ins those frameworks might load. A new, small internal project started awhile back seemed like the perfect opportunity to try out GC in a production app. This app used QTKit, but users needed the Flip4Mac plug-in to work with WMA files. At the time (I have no idea about now), any time QuickTime tried to load the Flip4Mac plug-in, it would die horribly. I reverted to good old-fashioned memory management for two reasons: Generally, a GC incompatibility shouldn't die a horrible death. If a plug-in load is attempted and the plug-in's GC configuration mismatches the application, dyld will refuse to load it. The one 'hole' is a pure-C plug-in that makes calls that trigger GCisms in contexts where they shouldn't be; this is relatively rare, but QT plug-ins is a known source of such issues. The code needs to be compiled with GC enabled so that the correct write barrier and layout information is emitted. And, of course, it needs to be tested. If you run across plug-ins that cause issues, you can do two things to help address the issue: (1) file a bug at http://bugreport.apple.com/ to make ADC/DTS aware of the incompatibility (2) give some feedback to the folks that make the plug-in that indicates that you need GC support 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
Re: NSSlider changed notification
NSSlider fires its action when the value changes. If its continuous property is YES, this happens while the user drags the widget. Otherwise it only sends its action when the mouse is released. --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: NSSlider changed notification
On Mar 10, 2009, at 12:03 PM, David Alter wrote: Hi All, I'm sure this is something basic that I'm just missing. For some reason I can not find how to get a notification when my slider changes value. I want to be able to subscribe to receive a notification if the slider value changes. Is there a delegate method for this? What is the best way to get this? Is the slider set to be continuous (either check the box in IB or call -setContinuous:YES on it)? If so, then it's action method will be called every time the value changes. If not, then the action method will be called when the user has finished dragging the slider. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Garbage collected and non-garbage collected
Going non-GC is not an option for our main project so my only hope with said framework is to correct it myself. I have been able to do a little debugging but I dead end with a BAD_ACCESS which I guess is to be expected with this sort of thing. I will have to see if I can narrow the problem but I may be out of my depth as a fairly new OC/ Cocoa guy. Thanks for the tips all. On Mar 10, 2009, at 10:46 AM, I. Savant wrote: On Tue, Mar 10, 2009 at 1:32 PM, Sean McBride s...@rogue- research.com wrote: You'll have to do a code review and testing of the framework's code to make sure it supports both GC and RR. Unfortunately this is true. Not just for frameworks, but any plug-ins those frameworks might load. A new, small internal project started awhile back seemed like the perfect opportunity to try out GC in a production app. This app used QTKit, but users needed the Flip4Mac plug-in to work with WMA files. At the time (I have no idea about now), any time QuickTime tried to load the Flip4Mac plug-in, it would die horribly. I reverted to good old-fashioned memory management for two reasons: 1 - I couldn't wait for the plug-in to be updated to support this (assuming it ever would be). 2 - I could see no way of nicely handling the situation even if the plug-in was updated, since some users would inevitably be using an older version ... because they may have forgotten (or not even known) the plug-in was installed, or what it even was by name. I have to admit, it was a *totally* unexpected problem that I was lucky to have noticed (because I had the plug-in installed for personal use) before investing much time and having to retro-fit everything with memory management. If you're looking for more details (the specific failure, behavior, whether it could have been caught and handled properly), I have none. It was right around Leopard's release and was a quick-and-dirty project, so I didn't bother studying the problem beyond, Oh, that won't work. Back to the tried-and-true. Sorry. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSMutableDictionary drives me mad.
Hello. I am writing a method for searching for the longest common substring. The idea is to store the pieces of that LCS in an NSMutableDictionary with TMIntWrappers as keys and NSMutableStrings as values. Now, TMIntWrapper is the class i created for wrapping ints into objects. It stores an int, gives access to it via the .value property, adopts the NSCopying protocol and implements the -(BOOL) isEqual: (id) object method. The logic is, if the dictionary already has a value for a given key, the new value should be appended to the current value, if the dictionary doesn't have any value for that key yet, a new NSMutableString is created and stored in that dictionary. But I just cannot understand why, within one and the same cycle, some values get appended, and some are stored with seemingly different TMIntWrapper keys with the same value (even though the isEqual method returns YES if the int values of two int wrappers are equal). Here is the method in question: - (void) addToAddedCharAtPosition:(int)charPosition withKey: (TMIntWrapper *)key { NSLog (@___ ); NSLog (@The key is: %@, key); NSLog (@ The object for the key is: %@, [addedToDbString objectForKey:key]); if ([addedToDbString objectForKey:key] == nil) { NSMutableString *ms = [[NSMutableString alloc]initWithString:[inText substringWithRange:NSMakeRange(charPosition-1, 1)]]; NSLog(@ The ms string is: %@, ms); [addedToDbString setObject:[ms mutableCopy] forKey:[key copy]]; NSLog(@ We are trying to add this: %@, [inText substringWithRange:NSMakeRange(charPosition-1, 1)]); NSLog (@AND NOW: The object for the key is: %@, [addedToDbString objectForKey:key]); return; } NSLog (@We are trying to add this: %@,[inText substringWithRange:NSMakeRange(charPosition-1, 1)]); [[addedToDbString objectForKey:key] appendString:[inText substringWithRange:NSMakeRange(charPosition-1, 1)]]; } And here is what those NSLogs generate. 2009-03-10 21:09:48.871 SQL doc[13532:10b] ___ 2009-03-10 21:09:48.872 SQL doc[13532:10b] The key is: 0 2009-03-10 21:09:48.872 SQL doc[13532:10b] The object for the key is: (null) 2009-03-10 21:09:48.873 SQL doc[13532:10b] The ms string is: x 2009-03-10 21:09:48.874 SQL doc[13532:10b] We are trying to add this: x 2009-03-10 21:09:48.875 SQL doc[13532:10b] AND NOW: The object for the key is: (null) 2009-03-10 21:09:48.875 SQL doc[13532:10b] ___ 2009-03-10 21:09:48.877 SQL doc[13532:10b] The key is: 0 2009-03-10 21:09:48.877 SQL doc[13532:10b] The object for the key is: (null) 2009-03-10 21:09:48.879 SQL doc[13532:10b] The ms string is: e 2009-03-10 21:09:48.880 SQL doc[13532:10b] We are trying to add this: e 2009-03-10 21:09:48.880 SQL doc[13532:10b] AND NOW: The object for the key is: e 2009-03-10 21:09:48.880 SQL doc[13532:10b] ___ Please help me... ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Garbage collected and non-garbage collected
On Tue, Mar 10, 2009 at 2:16 PM, Robert Mullen robe...@autowc.com wrote: Going non-GC is not an option for our main project If you don't mind my asking ... why? Too much work invested? -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSMutableDictionary drives me mad.
Have you tried using NSNumber instead of your custom integer wrapper? I doubt this is the problem, but see what happens if you do. HTH, Alex On Mar 10, 2009, at 2:33 PM, Тимофей Даньшин wrote: Hello. I am writing a method for searching for the longest common substring. The idea is to store the pieces of that LCS in an NSMutableDictionary with TMIntWrappers as keys and NSMutableStrings as values. Now, TMIntWrapper is the class i created for wrapping ints into objects. It stores an int, gives access to it via the .value property, adopts the NSCopying protocol and implements the -(BOOL) isEqual: (id) object method. The logic is, if the dictionary already has a value for a given key, the new value should be appended to the current value, if the dictionary doesn't have any value for that key yet, a new NSMutableString is created and stored in that dictionary. But I just cannot understand why, within one and the same cycle, some values get appended, and some are stored with seemingly different TMIntWrapper keys with the same value (even though the isEqual method returns YES if the int values of two int wrappers are equal). Here is the method in question: - (void) addToAddedCharAtPosition:(int)charPosition withKey: (TMIntWrapper *)key { NSLog (@___ ); NSLog (@The key is: %@, key); NSLog (@ The object for the key is: %@, [addedToDbString objectForKey:key]); if ([addedToDbString objectForKey:key] == nil) { NSMutableString *ms = [[NSMutableString alloc]initWithString: [inText substringWithRange:NSMakeRange(charPosition-1, 1)]]; NSLog(@ The ms string is: %@, ms); [addedToDbString setObject:[ms mutableCopy] forKey:[key copy]]; NSLog(@ We are trying to add this: %@, [inText substringWithRange:NSMakeRange(charPosition-1, 1)]); NSLog (@AND NOW: The object for the key is: %@, [addedToDbString objectForKey:key]); return; } NSLog (@We are trying to add this: %@,[inText substringWithRange:NSMakeRange(charPosition-1, 1)]); [[addedToDbString objectForKey:key] appendString:[inText substringWithRange:NSMakeRange(charPosition-1, 1)]]; } And here is what those NSLogs generate. 2009-03-10 21:09:48.871 SQL doc[13532:10b] ___ 2009-03-10 21:09:48.872 SQL doc[13532:10b] The key is: 0 2009-03-10 21:09:48.872 SQL doc[13532:10b] The object for the key is: (null) 2009-03-10 21:09:48.873 SQL doc[13532:10b] The ms string is: x 2009-03-10 21:09:48.874 SQL doc[13532:10b] We are trying to add this: x 2009-03-10 21:09:48.875 SQL doc[13532:10b] AND NOW: The object for the key is: (null) 2009-03-10 21:09:48.875 SQL doc[13532:10b] ___ 2009-03-10 21:09:48.877 SQL doc[13532:10b] The key is: 0 2009-03-10 21:09:48.877 SQL doc[13532:10b] The object for the key is: (null) 2009-03-10 21:09:48.879 SQL doc[13532:10b] The ms string is: e 2009-03-10 21:09:48.880 SQL doc[13532:10b] We are trying to add this: e 2009-03-10 21:09:48.880 SQL doc[13532:10b] AND NOW: The object for the key is: e 2009-03-10 21:09:48.880 SQL doc[13532:10b] ___ Please help me... ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSMutableDictionary drives me mad.
I'm not sure what your problem is, but I wanted to point out that it appears you could use NSNumber instead of TMIntWrappers to wrap an int value inside of an NSObject which can be used as a key. Perhaps there is a bug in TMIntWrappers that is preventing it from being used as a key... Is there a reason why you need TMIntWrappers and cannot use NSNumber? On Mar 10, 2009, at 2:33 PM, Тимофей Даньшин wrote: Hello. I am writing a method for searching for the longest common substring. The idea is to store the pieces of that LCS in an NSMutableDictionary with TMIntWrappers as keys and NSMutableStrings as values. Now, TMIntWrapper is the class i created for wrapping ints into objects. It stores an int, gives access to it via the .value property, adopts the NSCopying protocol and implements the -(BOOL) isEqual: (id) object method. The logic is, if the dictionary already has a value for a given key, the new value should be appended to the current value, if the dictionary doesn't have any value for that key yet, a new NSMutableString is created and stored in that dictionary. But I just cannot understand why, within one and the same cycle, some values get appended, and some are stored with seemingly different TMIntWrapper keys with the same value (even though the isEqual method returns YES if the int values of two int wrappers are equal). Here is the method in question: - (void) addToAddedCharAtPosition:(int)charPosition withKey: (TMIntWrapper *)key { NSLog (@___ ); NSLog (@The key is: %@, key); NSLog (@ The object for the key is: %@, [addedToDbString objectForKey:key]); if ([addedToDbString objectForKey:key] == nil) { NSMutableString *ms = [[NSMutableString alloc]initWithString: [inText substringWithRange:NSMakeRange(charPosition-1, 1)]]; NSLog(@ The ms string is: %@, ms); [addedToDbString setObject:[ms mutableCopy] forKey:[key copy]]; NSLog(@ We are trying to add this: %@, [inText substringWithRange:NSMakeRange(charPosition-1, 1)]); NSLog (@AND NOW: The object for the key is: %@, [addedToDbString objectForKey:key]); return; } NSLog (@We are trying to add this: %@,[inText substringWithRange:NSMakeRange(charPosition-1, 1)]); [[addedToDbString objectForKey:key] appendString:[inText substringWithRange:NSMakeRange(charPosition-1, 1)]]; } And here is what those NSLogs generate. 2009-03-10 21:09:48.871 SQL doc[13532:10b] ___ 2009-03-10 21:09:48.872 SQL doc[13532:10b] The key is: 0 2009-03-10 21:09:48.872 SQL doc[13532:10b] The object for the key is: (null) 2009-03-10 21:09:48.873 SQL doc[13532:10b] The ms string is: x 2009-03-10 21:09:48.874 SQL doc[13532:10b] We are trying to add this: x 2009-03-10 21:09:48.875 SQL doc[13532:10b] AND NOW: The object for the key is: (null) 2009-03-10 21:09:48.875 SQL doc[13532:10b] ___ 2009-03-10 21:09:48.877 SQL doc[13532:10b] The key is: 0 2009-03-10 21:09:48.877 SQL doc[13532:10b] The object for the key is: (null) 2009-03-10 21:09:48.879 SQL doc[13532:10b] The ms string is: e 2009-03-10 21:09:48.880 SQL doc[13532:10b] We are trying to add this: e 2009-03-10 21:09:48.880 SQL doc[13532:10b] AND NOW: The object for the key is: e 2009-03-10 21:09:48.880 SQL doc[13532:10b] ___ Please help me... ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Garbage collected and non-garbage collected
Too little resource, too little experience, too little return. The first two are because this is a skunk works type corporate project that basically has myself (an ex-.NET and general Windows coder) as it's resource so is constrained by me. The third is because I don't see sufficient gain to doing all the memory management myself. GC systems have become efficient enough in our modern world that I think manual memory management has become pretty specialized and out of place in 80% of desktop applications. Certainly there is the other 20% of high performance and real time situations but mine is basically a pretty face on a database. Anybody want to argue the other direction? I am always willing to learn. On Mar 10, 2009, at 11:39 AM, I. Savant wrote: On Tue, Mar 10, 2009 at 2:16 PM, Robert Mullen robe...@autowc.com wrote: Going non-GC is not an option for our main project If you don't mind my asking ... why? Too much work invested? -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSMutableDictionary drives me mad.
On Tue, Mar 10, 2009 at 11:33 AM, Тимофей Даньшин ok5.ad...@gmail.com wrote: Hello. I am writing a method for searching for the longest common substring. The idea is to store the pieces of that LCS in an NSMutableDictionary with TMIntWrappers as keys and NSMutableStrings as values. Now, TMIntWrapper is the class i created for wrapping ints into objects. It stores an int, gives access to it via the .value property, adopts the NSCopying protocol and implements the -(BOOL) isEqual: (id) object method. (Assuming that you can't use NSNumber for some reason) Have you implemented -hash? That's an important one. -- 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
Re: Garbage collected and non-garbage collected
On Tue, Mar 10, 2009 at 2:47 PM, Robert Mullen robe...@autowc.com wrote: GC systems have become efficient enough in our modern world that I think manual memory management has become pretty specialized and out of place in 80% of desktop applications. I won't disagree there. Anybody want to argue the other direction? I am always willing to learn. Sure: Projected time invested in GC'ifying the other framework(s)? :-) -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Garbage collected and non-garbage collected
I also have the option of abandoning the framework and functionality although that is not an appealing option. I am enjoying the process of determining the course to rectify GC in this framework (in a perverse sort of way) but I am not sure how long that will last. Every time I run into a persistent problem it is an opportunity to learn Cocoa, X- Code, and Objective-C a little better and that is fun in a challenging way. I know from experience though that this can turn from an enjoyably challenging diversion into a frustratingly endless cycle of refactoring. Wish me luck... On Mar 10, 2009, at 11:57 AM, I. Savant wrote: On Tue, Mar 10, 2009 at 2:47 PM, Robert Mullen robe...@autowc.com wrote: GC systems have become efficient enough in our modern world that I think manual memory management has become pretty specialized and out of place in 80% of desktop applications. I won't disagree there. Anybody want to argue the other direction? I am always willing to learn. Sure: Projected time invested in GC'ifying the other framework(s)? :-) -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Garbage collected and non-garbage collected
On Tue, Mar 10, 2009 at 3:07 PM, Robert Mullen robe...@autowc.com wrote: I also have the option of abandoning the framework and functionality although that is not an appealing option. I am enjoying the process of determining the course to rectify GC in this framework (in a perverse sort of way) but I am not sure how long that will last. Every time I run into a persistent problem it is an opportunity to learn Cocoa, X-Code, and Objective-C a little better and that is fun in a challenging way. I know from experience though that this can turn from an enjoyably challenging diversion into a frustratingly endless cycle of refactoring. Wish me luck... Luck! Consider also, though, that learning the Retain / Release memory management approach is just as much an opportunity to learn. For your project, it sounds like the odds tip in favor of getting everything GC-compliant, but as you said, time and (bad) experience may change that view ... ;-) -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Intercepting events from a control
I need to know about events destine for a specific control. Is there a way to receive these events with out subclassing the control. All I have is a reference to the control. I need events like MouseDown, MouseUp. It would also be very helpful if I knew when the control became the first responder and resigned first responder. Is there a way to do this? thanks for the help -dave ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Intercepting events from a control
On Tue, Mar 10, 2009 at 3:43 PM, David Alter alterconsult...@gmail.com wrote: Is there a way to do this? Subclass the control and override -mouseDown:, -mouseUp:, -becomeFirstResponder, and -resignFirstResponder? Seems straightforward to me. --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: Intercepting events from a control
Subclassing isn't always an option (For example, NSButton is a class cluster). I've done something like this for iPhone, where I've embedded the control in a UIView, then set userInteractionEnabled to NO on the control, so that the tap events would fall through to the UIView underneath. The UIView handles the events how it needs to, then passes the taps back to the control for proper visual behavior. I'm not sure how that would translate to the Mac, but maybe it helps you. =) Cheers, Dave On Mar 10, 2009, at 1:47 PM, Kyle Sluder wrote: On Tue, Mar 10, 2009 at 3:43 PM, David Alter alterconsult...@gmail.com wrote: Is there a way to do this? Subclass the control and override -mouseDown:, -mouseUp:, -becomeFirstResponder, and -resignFirstResponder? Seems straightforward to me. --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/davedelong%40me.com This email sent to davedel...@me.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
[MEET] LA CocoaHeads 3/12/09 at 7:30pm
Greetings LA CocoaHeads. This Thursday we have a special guest speaker, Paul Agron, coming up all the way from San Diego to give us a presentation on a logging framework he's developed. Check out his blog here: http://www.fibrethread.com/blog/ Since he's coming from San Diego, I hope we can have a good turn out for him, especially from those of us who don't live so far away :) We meet at the offices of E! Entertainment at 7:30pm. Our meeting location is 5750 Wilshire Blvd Los Angeles, CA 90036. Here's a google map of the location: http://www.google.com/maps?f=qhl=enq=5750+Wilshire+Blvd,+Los+Angeles+CA+90036ie=UTF8z=15om=1iwloc=addr Free street parking is available after 8pm - FEED THE METER UP TO 8PM OR YOU MIGHT GET A TICKET! I'd suggest trying Masselin Ave, which is one block East of Courtyard Place. We meet near the lobby of the West building at 5750 Wilshire Blvd, on the West side of Courtyard Place. There are picknick tables in front of the lobby and we'll gather there starting at 7:20pm. From there we go inside and up to conference room 3A at around 7:45pm . If you arrive late, please ask the building security personnel in the lobby to direct you to the E! Security office, and they will be able to contact the group in conference room 3A and send someone down to meet you. Rob Ross, Lead Software Engineer E! Networks --- Beware of he who would deny you access to information, for in his heart he dreams himself your master. -- Commissioner Pravin Lal ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Garbage collected and non-garbage collected
On Mar 10, 2009, at 12:21 PM, I. Savant wrote: On Tue, Mar 10, 2009 at 3:07 PM, Robert Mullen robe...@autowc.com wrote: I also have the option of abandoning the framework and functionality although that is not an appealing option. I am enjoying the process of determining the course to rectify GC in this framework (in a perverse sort of way) but I am not sure how long that will last. Every time I run into a persistent problem it is an opportunity to learn Cocoa, X-Code, and Objective-C a little better and that is fun in a challenging way. I know from experience though that this can turn from an enjoyably challenging diversion into a frustratingly endless cycle of refactoring. Wish me luck... Luck! Consider also, though, that learning the Retain / Release memory management approach is just as much an opportunity to learn. For your project, it sounds like the odds tip in favor of getting everything GC-compliant, but as you said, time and (bad) experience may change that view ... ;-) So... is the framework open source? Got a pointer? Any kind of test case? Can you post more information about the crash? What does the stack trace look like? Got an address? What does malloc_history say? Can..? Got..? Have you tried..? Let's pull this post back to a technical analysis of the OP's problem. More likely than not, we can fix his framework and, hopefully, that'll be one less barrier to entry for everyone. 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
Re: Intercepting events from a control
On Tue, Mar 10, 2009 at 3:43 PM, David Alter alterconsult...@gmail.com wrote: I need to know about events destine for a specific control. Is there a way to receive these events with out subclassing the control. All I have is a reference to the control. I need events like MouseDown, MouseUp. It would also be very helpful if I knew when the control became the first responder and resigned first responder. How about a more detailed description of what you intend to accomplish with a reference to the event / notifications of mouse responder status? Maybe there's a better way ... -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
[MEET] BYU CocoaHeads 12 Mar 2009
Hey everyone, The BYU CocoaHeads will be having their monthly meeting this Thursday from 7 to 9 pm in W310 TNRB on BYU campus in Provo, UT. Dan Reese from Mozy (http://www.mozy.com) will be coming to talk about Cocoa at Mozy, and we'll also be having a presentation on simple Bonjour networking. Everyone is welcome to come (and there are no parking meters to feed!). See you there! Dave DeLong President, BYU CocoaHeads http://cocoaheads.byu.edu ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Intercepting events from a control
NSButton is a class cluster Are you sure about that? I don't see it anywhere in the docs. Perhaps its an iPhone thing. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Intercepting events from a control
Ah, you're right. It is on the iPhone (from what I tell; my attempts to subclass it never worked), and I was assuming the Mac side was the same. Anyway ending thread hijack. =) Dave On Mar 10, 2009, at 2:10 PM, Paul Sanders wrote: NSButton is a class cluster Are you sure about that? I don't see it anywhere in the docs. Perhaps its an iPhone thing. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Garbage collected and non-garbage collected
The framework is open source. It is the SM2DGraphView Framework. I have posted on the Snowmint forum but not getting anything. I think that is understandable as the original author built this for his own purpose and released it to the world out of generosity. I have made some minor mods to the code base already and don't mind making others but not sure what the quality of the changes will be given my inexperience. If this were .NET I would have no hesitation as I am fluent and experienced. I simply don't have that confidence yet with Cocoa and Objective-C. In the debugging I am doing right now I have noticed that there is a struct with private data the framework uses and one element of this struct is an NSMutableDictionary of text attributes. This is definitely one source of problems as reading from this element causes bad access. I insert some logging to look at this element and it has so far contained com.apple.disk-imagp , NSCFType: 0x186f4a0, and NSExtraMIData: 0x186f7e0 but not an NSMutableDictionary. Pretty clearly I am not getting the memory that is expected but my first glance at the code exposes no holes that are obvious to me. This was addressed once before on the Snowmint forum with that poster exhibiting the same crash symptoms but the thread went silent after the framework author asked specific questions about what is not working. Any pointers (bad pun intended) would be appreciated. I wouldn't mind debugging this myself with the help of a few more experienced coders. I do understand the basic tenets of memory management but am also not greatly experienced there. On Mar 10, 2009, at 12:56 PM, Bill Bumgarner wrote: On Mar 10, 2009, at 12:21 PM, I. Savant wrote: On Tue, Mar 10, 2009 at 3:07 PM, Robert Mullen robe...@autowc.com wrote: I also have the option of abandoning the framework and functionality although that is not an appealing option. I am enjoying the process of determining the course to rectify GC in this framework (in a perverse sort of way) but I am not sure how long that will last. Every time I run into a persistent problem it is an opportunity to learn Cocoa, X-Code, and Objective-C a little better and that is fun in a challenging way. I know from experience though that this can turn from an enjoyably challenging diversion into a frustratingly endless cycle of refactoring. Wish me luck... Luck! Consider also, though, that learning the Retain / Release memory management approach is just as much an opportunity to learn. For your project, it sounds like the odds tip in favor of getting everything GC-compliant, but as you said, time and (bad) experience may change that view ... ;-) So... is the framework open source? Got a pointer? Any kind of test case? Can you post more information about the crash? What does the stack trace look like? Got an address? What does malloc_history say? Can..? Got..? Have you tried..? Let's pull this post back to a technical analysis of the OP's problem. More likely than not, we can fix his framework and, hopefully, that'll be one less barrier to entry for everyone. 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
Re: [SOLVED] Re: NSArrayController -- will change selection?
On Mar 7, 2009, at 3:57 PM, Kyle Sluder wrote: On Sat, Mar 7, 2009 at 8:55 PM, Stuart Malin stu...@zhameesha.com wrote: Those are the only three means I am aware of (selection, window close, view change) that can potentially lead to loss of user data. Any others? Add and remove. You'd probably want to handle those conditions without involving the table view at all. Re: remove: Why ask for a decision about pending changes if the selected item is about to be removed? Instead, I display a remove confirmation sheet. The user can cancel that, and the pending changes remain pending. Also, must handle Quit of the application. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [SOLVED] Re: NSArrayController -- will change selection?
On Tue, Mar 10, 2009 at 4:33 PM, Stuart Malin stu...@zhameesha.com wrote: Re: remove: Why ask for a decision about pending changes if the selected item is about to be removed? Instead, I display a remove confirmation sheet. The user can cancel that, and the pending changes remain pending. Fair enough. I just thought of add and the pair came to mind. Also, must handle Quit of the application. This is true, but might be covered by closing the window or the document, depending on how your app is architected. --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
setFrame: not working in custom event loop
Hi, I am tracking the mouse pointer to dynamically resize a splitter as a separate drag handle is dragged. This is done in mouseDown: of the drag handle with a custom event loop. The loop looks like this: while (keepOn) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; theEvent = [[self window] nextEventMatchingMask: NSAnyEventMask] ;// NSLeftMouseUpMask | NSLeftMouseDraggedMask]; switch ([theEvent type]) { case NSLeftMouseUp: keepOn = NO; break; case NSLeftMouseDragged: [nc postNotificationName:NSSplitViewWillResizeSubviewsNotification object:splitView]; firstFrame = [[[splitView subviews] objectAtIndex:0] frame]; firstFrame.size.width = (isLeftResizer ? MAX(0,roundf(([splitViewconvertPoint:[theEvent locationInWindow] fromView:nil].x + offset) - firstFrame.origin.x)) : MAX(0,roundf([splitViewconvertPoint:[theEvent locationInWindow] fromView:nil].x - [splitViewdividerThickness] - offset))); firstFrame.size.width = MIN(MAX(firstFrame.size.width,min),max); NSLog( @SetFrame: %@ , NSStringFromRect(firstFrame) ) ; [[[splitView subviews] objectAtIndex:0] setFrame:firstFrame]; NSLog( @\tIs Now: %@ , NSStringFromRect([[[splitView subviews] objectAtIndex:0] frame]) ) ; [splitView adjustSubviews]; [nc postNotificationName:NSSplitViewDidResizeSubviewsNotification object:splitView]; break; default: break; } [pool release] ; } NSLog( @Finally: %@ , NSStringFromRect([[[splitView subviews] objectAtIndex:0] frame]) ) ; (you might recognize this is as the Scrivener custom split view code available on the web) Anyway, the visual updates to the screen seem to start lagging the further right I drag the handle. You can see the NSLog()s I have in the code; here is the output as I drag: [...] 2009-03-10 14:37:42.428 SkootUI[8830:10b] SetFrame: {{0, 0}, {718, 604}} 2009-03-10 14:37:42.444 SkootUI[8830:10b] Is Now: {{0, 0}, {718, 604}} 2009-03-10 14:37:42.511 SkootUI[8830:10b] SetFrame: {{0, 0}, {721, 604}} 2009-03-10 14:37:42.539 SkootUI[8830:10b] Is Now: {{0, 0}, {721, 604}} 2009-03-10 14:37:42.596 SkootUI[8830:10b] SetFrame: {{0, 0}, {723, 604}} 2009-03-10 14:37:42.600 SkootUI[8830:10b] Is Now: {{0, 0}, {723, 604}} 2009-03-10 14:37:44.101 SkootUI[8830:10b] Finally: {{0, 0}, {684, 604}} As you can see, as far as the view being resized is concerned, it is being set to what I set it to as I drag the handle; i.e., the SetFrame: dimensions match the Is Now: dimensions. During this time, however, I can see the view sizing visually lag. When the drag finishes and the Finally block prints out, querying the view for its frame displays what I believe to be the actual lagged dimensions. Can anyone tell me what's going on? Thanks, 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
Background Process?
Hi everyone: I am wondering how to create a background process that will only run when the user is logged in and will run every certain minutes (a bit like Time Machine). I am also not sure in which way the action in the background process would be programmed, so any information regarding this would be great. Thanks for any help. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Background Process?
On 10 Mar 2009, at 23:11:03, Pierce Freeman wrote: Hi everyone: I am wondering how to create a background process that will only run when the user is logged in and will run every certain minutes (a bit like Time Machine). I am also not sure in which way the action in the background process would be programmed, so any information regarding this would be great. Thanks for any help. launchd. Take a look at Lingon http://tuppis.com/lingon/ for a quick practical look at what it does. And Google. Always Google. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Why does releasing this array cause a crash?
Hello I am confused on this one: In my method I have a local array: NSMutableArray *arraySubType = [[NSMutableArray alloc]init]; Then in a loop from the database I have: while (sqlite3_step(statement) == SQLITE_ROW) { if(![aDict objectForKey: [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 1)]]){ NSMutableArray *tmpArray = [[NSMutableArray alloc]init]; [aDict setValue:tmpArray forKey: [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 1)]]; [tmpArray release]; } arraySubType = [aDict objectForKey: [NSString stringWithUTF8String: (char *)sqlite3_column_text(statement, 1)]]; [arraySubType addObject: [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 0)]] [aDict setValue:arraySubType forKey: [NSString stringWithUTF8String: (char *)sqlite3_column_text(statement, 1)]]; } Shouldn't I now release arraySubType ?? If I do, later on I get a crash, if I don't I get no crash. Thanks James Cicenia ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Why does releasing this array cause a crash?
On Mar 10, 2009, at 4:35 PM, James Cicenia wrote: NSMutableArray *arraySubType = [[NSMutableArray alloc]init]; OK, this array, you *should* release, yes. Then in a loop from the database I have: while (sqlite3_step(statement) == SQLITE_ROW) { if(![aDict objectForKey: [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 1)]]){ NSMutableArray *tmpArray = [[NSMutableArray alloc]init]; [aDict setValue:tmpArray forKey: [NSString stringWithUTF8String: (char *)sqlite3_column_text(statement, 1)]]; [tmpArray release]; } arraySubType = [aDict objectForKey: [NSString stringWithUTF8String: (char *)sqlite3_column_text(statement, 1)]]; You have now just overwritten the previous value of arraySubType, thus leaking it. You now have a handle to a completely different object, which is autoreleased. This is why when you do release it, you crash later. If you do not use arraySubType between the alloc/init above and this line, then you do not need to alloc/init it, just declare it only. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Garbage collected and non-garbage collected
On Mar 10, 2009, at 1:17 PM, Robert Mullen wrote: The framework is open source. It is the SM2DGraphView Framework. I have posted on the Snowmint forum but not getting anything. I think that is understandable as the original author built this for his own purpose and released it to the world out of generosity. I have made some minor mods to the code base already and don't mind making others but not sure what the quality of the changes will be given my inexperience. If this were .NET I would have no hesitation as I am fluent and experienced. I simply don't have that confidence yet with Cocoa and Objective-C. In the debugging I am doing right now I have noticed that there is a struct with private data the framework uses and one element of this struct is an NSMutableDictionary of text attributes. This is definitely one source of problems as reading from this element causes bad access. I insert some logging to look at this element and it has so far contained com.apple.disk- imagp , NSCFType: 0x186f4a0, and NSExtraMIData: 0x186f7e0 but not an NSMutableDictionary. Pretty clearly I am not getting the memory that is expected but my first glance at the code exposes no holes that are obvious to me. This was addressed once before on the Snowmint forum with that poster exhibiting the same crash symptoms but the thread went silent after the framework author asked specific questions about what is not working. Any pointers (bad pun intended) would be appreciated. I wouldn't mind debugging this myself with the help of a few more experienced coders. I do understand the basic tenets of memory management but am also not greatly experienced there. Sounds like the collector has reaped the location in the struct a wee- tad earlier than the code would like. Try declaring the NSMutableDictionary * as __strong { __strong NSMutableDictionary *bob; } If that doesn't work, you can call CFRetain() / CFRelease() on the dictionary reference as it goes in/out of the struct [instead of - retain/-release]. Also -- look through the -dealloc methods in the framework. You'll want to create a -finalize for any that do anything beyond -release of objects/[super dealloc] (Though you don't need to unregister notification observers). - free()s CFRelease()s can be copied directly to -finalize - close() and other resource management *may* be copied, but you need to be careful about scarce resource management in -finalize as that can be problematic Anything else? Depends... be careful about order dependencies. And you really want to avoid allocating or retaining anything in your finalizer. Avoid mucking with the object graph. All very vague, I know, but that is in the hopes that you won't have to dive deep. If you do, post some details and we'll see what we can do. 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
Re: Why does releasing this array cause a crash?
Ah... Thank you. I understand now. James On Mar 10, 2009, at 5:41 PM, Randall Meadows wrote: On Mar 10, 2009, at 4:35 PM, James Cicenia wrote: NSMutableArray *arraySubType = [[NSMutableArray alloc]init]; OK, this array, you *should* release, yes. Then in a loop from the database I have: while (sqlite3_step(statement) == SQLITE_ROW) { if(![aDict objectForKey: [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 1)]]){ NSMutableArray *tmpArray = [[NSMutableArray alloc]init]; [aDict setValue:tmpArray forKey: [NSString stringWithUTF8String: (char *)sqlite3_column_text(statement, 1)]]; [tmpArray release]; } arraySubType = [aDict objectForKey: [NSString stringWithUTF8String: (char *)sqlite3_column_text(statement, 1)]]; You have now just overwritten the previous value of arraySubType, thus leaking it. You now have a handle to a completely different object, which is autoreleased. This is why when you do release it, you crash later. If you do not use arraySubType between the alloc/init above and this line, then you do not need to alloc/init it, just declare it only. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Garbage collected and non-garbage collected
On 3/10/09 3:46 PM, Bill Bumgarner said: Also -- look through the -dealloc methods in the framework. You'll want to create a -finalize for any that do anything beyond -release of objects/[super dealloc] (Though you don't need to unregister notification observers). - free()s CFRelease()s can be copied directly to -finalize Bill, This reminds me Do you know if one can safely call IOObjectRelease() in finalize? The docs do not say if that function is thread-safe. rdar://problem/6307385. I have a real life situation where IOObjectRelease() is called in dealloc, but in GC I'm erring on the side of caution and leaking. Cheers, -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
What is using up so much memory here?
Ok - Here is the offending code that sucks up about 2MB: NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; while(thisState = [statesEnum nextObject]){ UIImageView *singleStateView = [[[UIImageView alloc]initWithFrame:CGRectMake(2,0, 293, 184)]autorelease]; [singleStateView setImage: [UIImage imageNamed:[[@wf-map-gray- stringByAppendingString:thisState ]stringByAppendingString:@_glow.png]]]; [singleStateView setTag:100]; [fruitStateView addSubview:singleStateView]; } [pool release]; These are little pngs of the states. They are tiny 4KB images yet when this loop runs it winds up taking up an additional 2MB Thanks James Ciceni ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: What is using up so much memory here?
On Mar 10, 2009, at 4:26 PM, James Cicenia wrote: Ok - Here is the offending code that sucks up about 2MB: NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; while(thisState = [statesEnum nextObject]){ UIImageView *singleStateView = [[[UIImageView alloc]initWithFrame:CGRectMake(2,0, 293, 184)]autorelease]; [singleStateView setImage: [UIImage imageNamed:[[@wf-map-gray- stringByAppendingString:thisState ]stringByAppendingString:@_glow.png]]]; [singleStateView setTag:100]; [fruitStateView addSubview:singleStateView]; } [pool release]; These are little pngs of the states. They are tiny 4KB images yet when this loop runs it winds up taking up an additional 2MB Compressed size does not matter. Your images (or at least your image views) are 293x184, which means that each view is going to consume 293x184x4 (bytes per pixel) = 210.6K. I presume your looking at the Memory Monitor tool, as the memory used by view backing stores is not reflected in the memory usage as reported by the ObjectAlloc tool, but assuming your PNGs are the same size as the view, that 210.6K number is far more indicative of memory usage than the compressed size. -- 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: What is using up so much memory here?
On Mar 10, 2009, at 4:26 PM, James Cicenia wrote: Here is the offending code that sucks up about 2MB: NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; while(thisState = [statesEnum nextObject]){ UIImageView *singleStateView = [[[UIImageView alloc]initWithFrame:CGRectMake(2,0, 293, 184)]autorelease]; [singleStateView setImage: [UIImage imageNamed:[[@wf-map-gray- stringByAppendingString:thisState ]stringByAppendingString:@_glow.png]]]; [singleStateView setTag:100]; [fruitStateView addSubview:singleStateView]; } [pool release]; These are little pngs of the states. They are tiny 4KB images yet when this loop runs it winds up taking up an additional 2MB Well, the PNG files are 4KB. The images are approximately 215KB when decompressed (293 * 184 * 4 bytes/pixel = 215,648). Probably slightly larger when the rows are padded out (assuming the PNG images are the size of the view you are creating in the code you supplied). Dave ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: What is using up so much memory here?
Interesting... I didn't know that, but then it begs the question what do the cool kids do? Should I be taking a different approach here? If so, any pointers or doc chapter would be great. Thank you James Cicenia On Mar 10, 2009, at 6:33 PM, David Duncan wrote: On Mar 10, 2009, at 4:26 PM, James Cicenia wrote: Ok - Here is the offending code that sucks up about 2MB: NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; while(thisState = [statesEnum nextObject]){ UIImageView *singleStateView = [[[UIImageView alloc]initWithFrame:CGRectMake(2,0, 293, 184)]autorelease]; [singleStateView setImage: [UIImage imageNamed:[[@wf-map-gray- stringByAppendingString:thisState ]stringByAppendingString:@_glow.png]]]; [singleStateView setTag:100]; [fruitStateView addSubview:singleStateView]; } [pool release]; These are little pngs of the states. They are tiny 4KB images yet when this loop runs it winds up taking up an additional 2MB Compressed size does not matter. Your images (or at least your image views) are 293x184, which means that each view is going to consume 293x184x4 (bytes per pixel) = 210.6K. I presume your looking at the Memory Monitor tool, as the memory used by view backing stores is not reflected in the memory usage as reported by the ObjectAlloc tool, but assuming your PNGs are the same size as the view, that 210.6K number is far more indicative of memory usage than the compressed size. -- 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: What is using up so much memory here?
On Mar 10, 2009, at 4:41 PM, James Cicenia wrote: Interesting... I didn't know that, but then it begs the question what do the cool kids do? Should I be taking a different approach here? If so, any pointers or doc chapter would be great. All depends on what you are trying to accomplish. Typically you avoid loading anything you don't need and release anything when your done with it. And you may want to switch to imageWithContentsOfFile: until you can prove that the caching behavior of imageNamed: is providing you with a performance improvement. -- 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: What is using up so much memory here?
I am just overlaying colored state images over a map of the US. I don't need performance here, just memory efficiency. I will try imageWithContetsOfFile. Thanks James On Mar 10, 2009, at 6:45 PM, David Duncan wrote: On Mar 10, 2009, at 4:41 PM, James Cicenia wrote: Interesting... I didn't know that, but then it begs the question what do the cool kids do? Should I be taking a different approach here? If so, any pointers or doc chapter would be great. All depends on what you are trying to accomplish. Typically you avoid loading anything you don't need and release anything when your done with it. And you may want to switch to imageWithContentsOfFile: until you can prove that the caching behavior of imageNamed: is providing you with a performance improvement. -- 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: What is using up so much memory here?
Well, since you obviously can't have all of those images on screen at the same time at full size, you should either just load what you need or resize them to a more appropriate size. Dave On Mar 10, 2009, at 4:41 PM, James Cicenia wrote: Interesting... I didn't know that, but then it begs the question what do the cool kids do? Should I be taking a different approach here? If so, any pointers or doc chapter would be great. Thank you James Cicenia On Mar 10, 2009, at 6:33 PM, David Duncan wrote: On Mar 10, 2009, at 4:26 PM, James Cicenia wrote: Ok - Here is the offending code that sucks up about 2MB: NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; while(thisState = [statesEnum nextObject]){ UIImageView *singleStateView = [[[UIImageView alloc]initWithFrame:CGRectMake(2,0, 293, 184)]autorelease]; [singleStateView setImage: [UIImage imageNamed:[[@wf-map-gray- stringByAppendingString:thisState ]stringByAppendingString:@_glow.png]]]; [singleStateView setTag:100]; [fruitStateView addSubview:singleStateView]; } [pool release]; These are little pngs of the states. They are tiny 4KB images yet when this loop runs it winds up taking up an additional 2MB Compressed size does not matter. Your images (or at least your image views) are 293x184, which means that each view is going to consume 293x184x4 (bytes per pixel) = 210.6K. I presume your looking at the Memory Monitor tool, as the memory used by view backing stores is not reflected in the memory usage as reported by the ObjectAlloc tool, but assuming your PNGs are the same size as the view, that 210.6K number is far more indicative of memory usage than the compressed size. -- 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/dave%40thinbits.com This email sent to d...@thinbits.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: What is using up so much memory here?
Well... easier said then done. How would one place irregular shapes of the state over the map itself? Any combination of states with a color needs to appear. I was just overlaying the same square with just one state in the square all lined up. James On Mar 10, 2009, at 6:51 PM, Dave Camp wrote: Well, since you obviously can't have all of those images on screen at the same time at full size, you should either just load what you need or resize them to a more appropriate size. Dave On Mar 10, 2009, at 4:41 PM, James Cicenia wrote: Interesting... I didn't know that, but then it begs the question what do the cool kids do? Should I be taking a different approach here? If so, any pointers or doc chapter would be great. Thank you James Cicenia On Mar 10, 2009, at 6:33 PM, David Duncan wrote: On Mar 10, 2009, at 4:26 PM, James Cicenia wrote: Ok - Here is the offending code that sucks up about 2MB: NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; while(thisState = [statesEnum nextObject]){ UIImageView *singleStateView = [[[UIImageView alloc]initWithFrame:CGRectMake(2,0, 293, 184)]autorelease]; [singleStateView setImage: [UIImage imageNamed:[[@wf-map-gray- stringByAppendingString:thisState ]stringByAppendingString:@_glow.png]]]; [singleStateView setTag:100]; [fruitStateView addSubview:singleStateView]; } [pool release]; These are little pngs of the states. They are tiny 4KB images yet when this loop runs it winds up taking up an additional 2MB Compressed size does not matter. Your images (or at least your image views) are 293x184, which means that each view is going to consume 293x184x4 (bytes per pixel) = 210.6K. I presume your looking at the Memory Monitor tool, as the memory used by view backing stores is not reflected in the memory usage as reported by the ObjectAlloc tool, but assuming your PNGs are the same size as the view, that 210.6K number is far more indicative of memory usage than the compressed size. -- 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/dave%40thinbits.com This email sent to d...@thinbits.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/james%40jimijon.com This email sent to ja...@jimijon.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: What is using up so much memory here?
On Mar 10, 2009, at 4:50 PM, James Cicenia wrote: I am just overlaying colored state images over a map of the US. I don't need performance here, just memory efficiency. I will try imageWithContetsOfFile. And just to be clear, imageWithContentsOfFile: vs imageNamed: won't save you any memory per image, it only prevents the image from being put into the image cache, which may help your performance in other ways. Dave Camp's suggestions are probably a good starting point. Only load images you need to display, and if they don't need to be as large as they are, shrink them (when creating the content, not after loading them). -- 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: What is using up so much memory here?
Ok - I figured out what I can do. I can make a database of the x/y coordinates after chopping down each state and then read the database info to place the states. Thanks for your hints and time. James On Mar 10, 2009, at 6:51 PM, Dave Camp wrote: Well, since you obviously can't have all of those images on screen at the same time at full size, you should either just load what you need or resize them to a more appropriate size. Dave On Mar 10, 2009, at 4:41 PM, James Cicenia wrote: Interesting... I didn't know that, but then it begs the question what do the cool kids do? Should I be taking a different approach here? If so, any pointers or doc chapter would be great. Thank you James Cicenia On Mar 10, 2009, at 6:33 PM, David Duncan wrote: On Mar 10, 2009, at 4:26 PM, James Cicenia wrote: Ok - Here is the offending code that sucks up about 2MB: NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; while(thisState = [statesEnum nextObject]){ UIImageView *singleStateView = [[[UIImageView alloc]initWithFrame:CGRectMake(2,0, 293, 184)]autorelease]; [singleStateView setImage: [UIImage imageNamed:[[@wf-map-gray- stringByAppendingString:thisState ]stringByAppendingString:@_glow.png]]]; [singleStateView setTag:100]; [fruitStateView addSubview:singleStateView]; } [pool release]; These are little pngs of the states. They are tiny 4KB images yet when this loop runs it winds up taking up an additional 2MB Compressed size does not matter. Your images (or at least your image views) are 293x184, which means that each view is going to consume 293x184x4 (bytes per pixel) = 210.6K. I presume your looking at the Memory Monitor tool, as the memory used by view backing stores is not reflected in the memory usage as reported by the ObjectAlloc tool, but assuming your PNGs are the same size as the view, that 210.6K number is far more indicative of memory usage than the compressed size. -- 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/dave%40thinbits.com This email sent to d...@thinbits.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/james%40jimijon.com This email sent to ja...@jimijon.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: What is using up so much memory here?
On 11/03/2009, at 11:00 AM, James Cicenia wrote: Well... easier said then done. How would one place irregular shapes of the state over the map itself? Any combination of states with a color needs to appear. Since you are in a much-more memory-constrained environment, you need to get smart. Naively loading everything isn't going to work, so you need to figure this out. You have a map of the USA, I guess, and you can see part of it on screen at any one time (presumably scrolling to show different parts, or zooming in and out to show more or less). You can treat it as a bunch of tiled shapes, each having a bounding box. The bboxes will overlap a little in many places, but that's OK. All you need to do is build a data structure that associates the bboxes with the relevant images and graphics, then determine which bboxes intersect the visible screen area. For those that don't, you don't need to do anything. For those that do, you need to load the graphic elements, scale them as appropriate for your zoom (if need be - zoom is usually taken care of using the view's scale transform, but you may want to avoid caching a full-scale image if your zoom suggests you don't need it) and draw them. When you've done that, you can discard them again, or cache them for later. That's the basic M.O. If dynamically loading these images like this is too slow, you can then consider a way to cache what you loaded in such a way that when you become memory constrained, you can examine the cache and discard parts of it that you can't see right now, again by testing which bboxes intersect the screen. The same technique will work for zooming, because all you're doing is making the screen area that intersects your data smaller and bigger. If you cached a low-resolution graphic for a zoomed-out view, you can scale it while zooming is in progress to avoid an expensive re-load, then, if needed, reload a higher-res version at the end. Unfortunately you'll have to figure a scheme for doing all of this out for yourself, there isn't anything built-in because the need to do this is not all that generalisable. It's not that hard though. I would suggest though that using an entire subview for each overlaid image is going to hurt badly in terms of performance, scalability and ease of implementation. Instead just devise your own data structure that can hold objects having a bounding box (which sets the spatial location) and a reference to the image(s) it needs. Then when you draw, ask your data structure to draw all the cells that intersect the drawing area. For those that haven't loaded their images, they should now do so, then draw as usual. The overall data structure would have one object per state, but all it needs to maintain when not visible is the bbox. 50 rects is a far lower memory footprint than 50 full-sized images. --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: setFrame: not working in custom event loop
When you modify a window it registers itself as needing redrawing in the current run loop. If you are performing active tracking, you may have to do so yourself. Try calling [window flushWindowIfNeeded] on your window at the end of your loop (inside the loop). What is the reason for your explicit tracking? You should be able to simply listen for mouseDragged, mouseDown, and mouseUp on your split view (if this is a custom sub-class). Jesper Storm Bache On Mar 10, 2009, at 2:51 PM, Mike Manzano wrote: Hi, I am tracking the mouse pointer to dynamically resize a splitter as a separate drag handle is dragged. This is done in mouseDown: of the drag handle with a custom event loop. The loop looks like this: while (keepOn) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; theEvent = [[self window] nextEventMatchingMask: NSAnyEventMask] ;// NSLeftMouseUpMask | NSLeftMouseDraggedMask]; switch ([theEvent type]) { case NSLeftMouseUp: keepOn = NO; break; case NSLeftMouseDragged: [nc postNotificationName:NSSplitViewWillResizeSubviewsNotification object:splitView]; firstFrame = [[[splitView subviews] objectAtIndex:0] frame]; firstFrame.size.width = (isLeftResizer ? MAX(0,roundf(([splitViewconvertPoint:[theEvent locationInWindow] fromView:nil].x + offset) - firstFrame.origin.x)) : MAX(0,roundf([splitViewconvertPoint:[theEvent locationInWindow] fromView:nil].x - [splitViewdividerThickness] - offset))); firstFrame.size.width = MIN(MAX(firstFrame.size.width,min),max); NSLog( @SetFrame: %@ , NSStringFromRect(firstFrame) ) ; [[[splitView subviews] objectAtIndex:0] setFrame:firstFrame]; NSLog( @\tIs Now: %@ , NSStringFromRect([[[splitView subviews] objectAtIndex:0] frame]) ) ; [splitView adjustSubviews]; [nc postNotificationName:NSSplitViewDidResizeSubviewsNotification object:splitView]; break; default: break; } [pool release] ; } NSLog( @Finally: %@ , NSStringFromRect([[[splitView subviews] objectAtIndex:0] frame]) ) ; (you might recognize this is as the Scrivener custom split view code available on the web) Anyway, the visual updates to the screen seem to start lagging the further right I drag the handle. You can see the NSLog()s I have in the code; here is the output as I drag: [...] 2009-03-10 14:37:42.428 SkootUI[8830:10b] SetFrame: {{0, 0}, {718, 604}} 2009-03-10 14:37:42.444 SkootUI[8830:10b] Is Now: {{0, 0}, {718, 604}} 2009-03-10 14:37:42.511 SkootUI[8830:10b] SetFrame: {{0, 0}, {721, 604}} 2009-03-10 14:37:42.539 SkootUI[8830:10b] Is Now: {{0, 0}, {721, 604}} 2009-03-10 14:37:42.596 SkootUI[8830:10b] SetFrame: {{0, 0}, {723, 604}} 2009-03-10 14:37:42.600 SkootUI[8830:10b] Is Now: {{0, 0}, {723, 604}} 2009-03-10 14:37:44.101 SkootUI[8830:10b] Finally: {{0, 0}, {684, 604}} As you can see, as far as the view being resized is concerned, it is being set to what I set it to as I drag the handle; i.e., the SetFrame: dimensions match the Is Now: dimensions. During this time, however, I can see the view sizing visually lag. When the drag finishes and the Finally block prints out, querying the view for its frame displays what I believe to be the actual lagged dimensions. Can anyone tell me what's going on? Thanks, 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/jsbache%40adobe.com This email sent to jsba...@adobe.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: What is using up so much memory here?
Yes, I realized I would need a different approach. I got too used to web gif/png and just doing overlays. I have already told my designer to give me just bounded states with a spreadsheet of what he chopped off from the top and left. This will then be inputted into the spreadsheet then into sqlite. It should work a lot better. Thanks again for your input. James Cicenia On Mar 10, 2009, at 7:28 PM, Graham Cox wrote: On 11/03/2009, at 11:00 AM, James Cicenia wrote: Well... easier said then done. How would one place irregular shapes of the state over the map itself? Any combination of states with a color needs to appear. Since you are in a much-more memory-constrained environment, you need to get smart. Naively loading everything isn't going to work, so you need to figure this out. You have a map of the USA, I guess, and you can see part of it on screen at any one time (presumably scrolling to show different parts, or zooming in and out to show more or less). You can treat it as a bunch of tiled shapes, each having a bounding box. The bboxes will overlap a little in many places, but that's OK. All you need to do is build a data structure that associates the bboxes with the relevant images and graphics, then determine which bboxes intersect the visible screen area. For those that don't, you don't need to do anything. For those that do, you need to load the graphic elements, scale them as appropriate for your zoom (if need be - zoom is usually taken care of using the view's scale transform, but you may want to avoid caching a full-scale image if your zoom suggests you don't need it) and draw them. When you've done that, you can discard them again, or cache them for later. That's the basic M.O. If dynamically loading these images like this is too slow, you can then consider a way to cache what you loaded in such a way that when you become memory constrained, you can examine the cache and discard parts of it that you can't see right now, again by testing which bboxes intersect the screen. The same technique will work for zooming, because all you're doing is making the screen area that intersects your data smaller and bigger. If you cached a low-resolution graphic for a zoomed-out view, you can scale it while zooming is in progress to avoid an expensive re-load, then, if needed, reload a higher-res version at the end. Unfortunately you'll have to figure a scheme for doing all of this out for yourself, there isn't anything built-in because the need to do this is not all that generalisable. It's not that hard though. I would suggest though that using an entire subview for each overlaid image is going to hurt badly in terms of performance, scalability and ease of implementation. Instead just devise your own data structure that can hold objects having a bounding box (which sets the spatial location) and a reference to the image(s) it needs. Then when you draw, ask your data structure to draw all the cells that intersect the drawing area. For those that haven't loaded their images, they should now do so, then draw as usual. The overall data structure would have one object per state, but all it needs to maintain when not visible is the bbox. 50 rects is a far lower memory footprint than 50 full-sized images. --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: Background Process?
Set your program as a User Agent with launchd on install (i.e., a login item). launchd will make sure your program is running when the user logs in. Then, take a look at the NSTimer docs to implement the every-so-often part of it. --Daniel Richman Pierce Freeman wrote: Hi everyone: I am wondering how to create a background process that will only run when the user is logged in and will run every certain minutes (a bit like Time Machine). I am also not sure in which way the action in the background process would be programmed, so any information regarding this would be great. Thanks for any help. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/applemaillist%40mm.danielrichman.com This email sent to applemaill...@mm.danielrichman.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: setFrame: not working in custom event loop
Thanks, I will try that tomorrow. The code isn't mine, I'm just trying to use it with minimal change. If this doesn't fix it, I probably will just rewrite it to use the separate events. Mike On Mar 10, 2009, at 5:41 PM, Jesper Storm Bache wrote: When you modify a window it registers itself as needing redrawing in the current run loop. If you are performing active tracking, you may have to do so yourself. Try calling [window flushWindowIfNeeded] on your window at the end of your loop (inside the loop). What is the reason for your explicit tracking? You should be able to simply listen for mouseDragged, mouseDown, and mouseUp on your split view (if this is a custom sub-class). Jesper Storm Bache On Mar 10, 2009, at 2:51 PM, Mike Manzano wrote: Hi, I am tracking the mouse pointer to dynamically resize a splitter as a separate drag handle is dragged. This is done in mouseDown: of the drag handle with a custom event loop. The loop looks like this: while (keepOn) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; theEvent = [[self window] nextEventMatchingMask: NSAnyEventMask] ;// NSLeftMouseUpMask | NSLeftMouseDraggedMask]; switch ([theEvent type]) { case NSLeftMouseUp: keepOn = NO; break; case NSLeftMouseDragged: [nc postNotificationName:NSSplitViewWillResizeSubviewsNotification object:splitView]; firstFrame = [[[splitView subviews] objectAtIndex:0] frame]; firstFrame.size.width = (isLeftResizer ? MAX(0,roundf(([splitViewconvertPoint:[theEvent locationInWindow] fromView:nil].x + offset) - firstFrame.origin.x)) : MAX(0,roundf([splitViewconvertPoint:[theEvent locationInWindow] fromView:nil].x - [splitViewdividerThickness] - offset))); firstFrame.size.width = MIN(MAX(firstFrame.size.width,min),max); NSLog( @SetFrame: %@ , NSStringFromRect(firstFrame) ) ; [[[splitView subviews] objectAtIndex:0] setFrame:firstFrame]; NSLog( @\tIs Now: %@ , NSStringFromRect([[[splitView subviews] objectAtIndex:0] frame]) ) ; [splitView adjustSubviews]; [nc postNotificationName:NSSplitViewDidResizeSubviewsNotification object:splitView]; break; default: break; } [pool release] ; } NSLog( @Finally: %@ , NSStringFromRect([[[splitView subviews] objectAtIndex:0] frame]) ) ; (you might recognize this is as the Scrivener custom split view code available on the web) Anyway, the visual updates to the screen seem to start lagging the further right I drag the handle. You can see the NSLog()s I have in the code; here is the output as I drag: [...] 2009-03-10 14:37:42.428 SkootUI[8830:10b] SetFrame: {{0, 0}, {718, 604}} 2009-03-10 14:37:42.444 SkootUI[8830:10b] Is Now: {{0, 0}, {718, 604}} 2009-03-10 14:37:42.511 SkootUI[8830:10b] SetFrame: {{0, 0}, {721, 604}} 2009-03-10 14:37:42.539 SkootUI[8830:10b] Is Now: {{0, 0}, {721, 604}} 2009-03-10 14:37:42.596 SkootUI[8830:10b] SetFrame: {{0, 0}, {723, 604}} 2009-03-10 14:37:42.600 SkootUI[8830:10b] Is Now: {{0, 0}, {723, 604}} 2009-03-10 14:37:44.101 SkootUI[8830:10b] Finally: {{0, 0}, {684, 604}} As you can see, as far as the view being resized is concerned, it is being set to what I set it to as I drag the handle; i.e., the SetFrame: dimensions match the Is Now: dimensions. During this time, however, I can see the view sizing visually lag. When the drag finishes and the Finally block prints out, querying the view for its frame displays what I believe to be the actual lagged dimensions. Can anyone tell me what's going on? Thanks, 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/jsbache%40adobe.com This email sent to jsba...@adobe.com smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription:
Re: Background Process?
On Tue, Mar 10, 2009 at 9:24 PM, Daniel Richman applemaill...@mm.danielrichman.com wrote: Set your program as a User Agent with launchd on install (i.e., a login item). launchd will make sure your program is running when the user logs in. launchd doesn't launch Login Items. It does, however, launch per-user agents, but these only work on 10.5. Then, take a look at the NSTimer docs to implement the every-so-often part of it. This is a bad idea. It will put unnecessary burden on the processor, and therefore reduce battery life on mobile machines, by doing nothing in the runloop until the timer fires. It's just not an appropriate use of the NSTimer functionality. launchd already has the capability of launching tasks on a schedule using the StartCalendarInterval plist key. Just use it. --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: Background Process?
Thanks for correcting me. I have a lot to learn about this. Kyle Sluder wrote: On Tue, Mar 10, 2009 at 9:24 PM, Daniel Richman applemaill...@mm.danielrichman.com wrote: Set your program as a User Agent with launchd on install (i.e., a login item). launchd will make sure your program is running when the user logs in. launchd doesn't launch Login Items. It does, however, launch per-user agents, but these only work on 10.5. Then, take a look at the NSTimer docs to implement the every-so-often part of it. This is a bad idea. It will put unnecessary burden on the processor, and therefore reduce battery life on mobile machines, by doing nothing in the runloop until the timer fires. It's just not an appropriate use of the NSTimer functionality. launchd already has the capability of launching tasks on a schedule using the StartCalendarInterval plist key. Just use it. --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: Background Process?
This is a bad idea. It will put unnecessary burden on the processor, and therefore reduce battery life on mobile machines, by doing nothing in the runloop until the timer fires. It's just not an appropriate use of the NSTimer functionality. launchd already has the capability of launching tasks on a schedule using the StartCalendarInterval plist key. Just use it. --Kyle Sluder Could you expand on that a bit please? My mental picture of the runloop has always been more like a select() which does nothing unless there is something to do. Not that I ever quite sorted out in my own mind how an NSTimer fits is something you can select() on. Does the runloop actually poll a whole lot even when it has nothing to do? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Background Process?
On Tue, Mar 10, 2009 at 9:49 PM, Roland King r...@rols.org wrote: Could you expand on that a bit please? My mental picture of the runloop has always been more like a select() which does nothing unless there is something to do. Not that I ever quite sorted out in my own mind how an NSTimer fits is something you can select() on. Does the runloop actually poll a whole lot even when it has nothing to do? While NSTimers are not normal input sources, the frameworks are free to add any input source to the runloop that they wish. And in order for your timer to fire, you need to keep the runloop awake, using at least a dummy input source. See Timers in Timer Programming Topics for Cocoa: A timer is not a real-time mechanism; it fires only when one of the run loop modes to which the timer has been added is running and able to check if the timer’s firing time has passed. http://developer.apple.com/documentation/Cocoa/Conceptual/Timers/Articles/timerConcepts.html#//apple_ref/doc/uid/2806 So your process will need to remain awake, which means that the processor needs to be that much more active. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: What is using up so much memory here?
On Mar 10, 2009, at 8:13 PM, James Cicenia wrote: Yes, I realized I would need a different approach. I got too used to web gif/png and just doing overlays. I have already told my designer to give me just bounded states with a spreadsheet of what he chopped off from the top and left. This will then be inputted into the spreadsheet then into sqlite. Are these images of each state perhaps always a solid color? If so, I would highly recommend creating paths for each state and just filling the path as needed. Any zooming will also give you great results as you'd be scaling vector-based content and not bitmapped content. ___ Ricky A. Sharp mailto:rsh...@instantinteractive.com Instant Interactive(tm) http://www.instantinteractive.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
Odd interaction of NSTrackingArea behaviour with drag and drop
I have tracking areas set up in an NSTableView,similar to the Cocoa PhotoSearch sample app, and these have the NSTrackingEnabledDuringMouseDrag option set. There may be various definitions of what mouse drag actually means, but the docs just indicate that this option should produce tracking events when the mouse is moved through a tracking area with buttons pressed (q.v. NSTrackingArea Class Reference, Constants). By and large tracking areas are working well, though I've had one true work-around for some odd behaviour during autoscroll (per an earlier thread here). Now though, I've come to implement drag and drop onto my table cells and have noticed immediately that things go pear-shaped with (seemingly) externally initiated drag and drop. As an item (e.g. from the finder) is dragged across the tracking areas I get frequent but intermittently timed mouseEntered - mouseExited event pairs. These are sent to the control even when no tracking area boundary is being crossed, for instance when the mouse is just dragged up and down a cell/single tracking area. I have a test app that recreates the problem in what I consider a reasonably sterile environment.. This consists of an NSTableView that defines a single tracking area that covers the area of a single cell in the table. Dragging an item over this cell, produces the same stuttering event-pair messages that I'm seeing in my main app - again with no tracking area boundary being crossed. Are these conditions familiar to anyone? Should I expect tracking areas to work for drags started in other apps? Obviously, I'd be keen to learn if tracking areas aren't supposed to work in 'normally' in during drag/drop, or if there are considerations I may have overlooked regarding how to set them up or how to keep them happy alongside other messaging that is invariably happening (table datasource drag/drop messages etc.). However, to the last point, my test app elides all extra flora and fauna besides setting up the tracking areas and writing out trace messages as mouseEntered/ mouseExited messages are received. So, the problem also exists with no particular drop-target code implemented (i.e. just passing/no parking w.r.t. the tracking area). -- lwe ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Background Process?
Hi Kyle, On Wed, Mar 11, 2009 at 1:19 PM, Kyle Sluder kyle.slu...@gmail.com wrote: While NSTimers are not normal input sources, the frameworks are free to add any input source to the runloop that they wish. And in order for your timer to fire, you need to keep the runloop awake, using at least a dummy input source. See Timers in Timer Programming Topics for Cocoa: Whilst the run loop has to have a regular input source in it, I don't think it needs to be processing any events. It's my understanding that timers will still fire even if nothing else is happening. I think the documentation is merely pointing out that if you're doing other work, such as what might be occurring in a normal application, a timer might be delayed by a few ms or more. Regards, Chris ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Background Process?
Can't somebody write a small app and and profile it to get a conclusive answer? I'd do it but I'm lazy. I am interested in the outcome though. On Tue, Mar 10, 2009 at 7:52 PM, Chris Suter csu...@sutes.co.uk wrote: Hi Kyle, On Wed, Mar 11, 2009 at 1:19 PM, Kyle Sluder kyle.slu...@gmail.com wrote: While NSTimers are not normal input sources, the frameworks are free to add any input source to the runloop that they wish. And in order for your timer to fire, you need to keep the runloop awake, using at least a dummy input source. See Timers in Timer Programming Topics for Cocoa: Whilst the run loop has to have a regular input source in it, I don't think it needs to be processing any events. It's my understanding that timers will still fire even if nothing else is happening. I think the documentation is merely pointing out that if you're doing other work, such as what might be occurring in a normal application, a timer might be delayed by a few ms or more. Regards, Chris ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/minofifa%40gmail.com This email sent to minof...@gmail.com -- Darren Minifie Graduate Studies: Computer Science www.myavalon.ca www.ohsnapmusic.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: Background Process?
Hi Darren, On Wed, Mar 11, 2009 at 2:28 PM, Darren Minifie minof...@gmail.com wrote: Can't somebody write a small app and and profile it to get a conclusive answer? I'd do it but I'm lazy. I am interested in the outcome though. Well, I did do that and ran it under Shark: zero CPU usage. I also ran another test and set a breakpoint in CoreFoundation's runloop code. It only seemed to wake when the timer fired. My test might be flawed though. Regards, Chris ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Garbage collected and non-garbage collected
On Tue, Mar 10, 2009 at 2:47 PM, Robert Mullen robe...@autowc.com wrote: Too little resource, too little experience, too little return. The first two are because this is a skunk works type corporate project that basically has myself (an ex-.NET and general Windows coder) as it's resource so is constrained by me. The third is because I don't see sufficient gain to doing all the memory management myself. GC systems have become efficient enough in our modern world that I think manual memory management has become pretty specialized and out of place in 80% of desktop applications. Certainly there is the other 20% of high performance and real time situations but mine is basically a pretty face on a database. Anybody want to argue the other direction? I am always willing to learn. IMO you're right but also asking the wrong question. You shouldn't be asking whether GC is worthwhile for desktop apps, but whether *Cocoa's* GC is. They are not, unfortunately, the same question. While Cocoa's GC is quite good given the constraints it lives in, those constraints cause many unfortunate problems which don't exist in other collectors. Some are in the collector itself (don't take the address of a global pointer-to-object variable if you don't like to crash), and some are in the frameworks (NSData has hidden gotchas, NSInvocation doesn't keep strong references to message arguments, and many other weird problems). Apple did a good job with the GC given the constraints they were under (adding GC to a C runtime environment is Not Easy) but there are still quite a few shortcomings there. You may still be right that going with GC and fixing this stuff up is the best use of your time. I won't argue with that. I just wanted to point out that it's not as simple as saying modern GCs are good enough for the job now since the GC you have isn't exactly the GC you'd have in a more managed environment. 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: Background Process?
On Tue, Mar 10, 2009 at 11:28 PM, Darren Minifie minof...@gmail.com wrote: Can't somebody write a small app and and profile it to get a conclusive answer? I'd do it but I'm lazy. I am interested in the outcome though. Just run Activity Monitor and look at one of the numerous idling GUI apps. Notice how it uses 0% CPU. The notion that adding a timer to a runloop would somehow cause that runloop to suck up CPU time when the runloop is idle is nonsensical. The whole point of the runloop is that it sleeps the process until some activity is required. A background process sitting on a timer *will* take up various resources (memory, file descriptors, kernel structures, etc.) but CPU time is not among them. 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: Odd interaction of NSTrackingArea behaviour with drag and drop
For the curious, the test app is available at: http://idisk.mac.com/luke_e-Public/TrackingTesterDragDrop.zip (61.2 KB) On 10-Mar-09, at 7:41 PM, Luke Evans wrote: I have a test app that recreates the problem in what I consider a reasonably sterile environment.. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Fwd: Problem in save and open on Core Data Document Based application
-- Forwarded message -- From: haresh vavdiya vavdiyahar...@gmail.com Date: Tue, Mar 10, 2009 at 4:50 PM Subject: Re: Problem in save and open on Core Data Document Based application To: Volker in Lists volker_li...@ecoobs.de Hi Volker, Thanks Volker, Ya u r right, i opened from File - Open and it works,,...please tell me that what should i dowhen i directly click on application. Can we use MySql for storing data instead of Core Data. Thanks, Haresh. On Tue, Mar 10, 2009 at 4:23 PM, Volker in Lists volker_li...@ecoobs.dewrote: Hi, the message says that the data model in the file you try to open is different than the one you have in your app. As far as I can follow you, both apps use the same file type and the former is always trying to open the others file. Of ocurse, then it complains about the different model. Have you tried opening Departments file via Departments - File - Open ? That should work. If not, you have made changes to your model after saving the document. On a side note: CoreData should not be learned by the beginner. First, try to understand the basics, than move slowly, very slowly up to CoreData, otherwise you'll be lost soon. If you're not content with the content you find via Apple's developer resources on Core Data, there is a very good book written by Markus Zarra - available as preliminary version from Pragmatic Programmers. Cheers, Volker Am 10.03.2009 um 11:39 schrieb haresh vavdiya: Hello, I am learning mac development from Aaron Hillegas 3rd Edition. i have created two Example CarLot and Departments based on Core -Data document based application. When i created CarLot example that time it can save and open data without writing single line. Then i created Departments example so it should also save and open. But second example save successfully but when open, it gives error. But in dock panel, CarLot apps is launched. i can open this apps from dock. But i wanted to save and open Departments example. I can't understand that i saved apps from Deparetment and it launch CarLot example in dock. Is there in problemwhat is the problem..i m trying from long time. And the message is The document “DeptTest” could not be opened. The model configuration used to open the store is incompatible with the one that was used to create the store. Please anyone help to figure out this problem. Thanks, Haresh. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/volker_lists%40ecoobs.de This email sent to volker_li...@ecoobs.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
Examples or Documentation for Non-document-based Multi-window App
Suppose I were writing an application, perhaps similar to the example at http://en.wikibooks.org/wiki/Programming_Mac_OS_X_with_Cocoa_for_beginners/B uilding_a_GUI (or many of the examples in /Developer/Examples/...) that had no file-based interaction whatsoever but for which I wanted to allow the user to open up and interact with up to N windows. Using the example above, each newly-opened window perhaps displays something from quote of the day (QOTD) or some other singular random data source rather than Hello World. It seems the document-based architecture is ill-suited to such an application because there is effectively no need to open, save, revert, print, etc. anything. Does anyone have any recommendation for examples, URLs or books that might discuss and illustrate such an application or the rough framework thereto? Thanks, Grant ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Cant figure out images
Hi guys. So I tried NSImage without much success and now I¹m trying CIImage. I have the following code: NSURL *testUrl; testUrl = [NSURL URLWithString:@/Users/Etienne/Desktop/logo.gif]; CIImage *imageTest; if(testUrl == nil) NSLog(@TEST NIL !); else NSLog(@TEST : %@, testUrl); // PRINT THE URL imageTest = [[NSImage alloc] initWithContentsOfURL:testUrl]; if(imageTest == nil) NSLog(@Init image with URL failed); // -- I GET THAT else NSLog(@image init ok\n); So my image is always nil...this seems like pretty simple code to me. What am I missing. Oh yeah and the file really is on my desktop... Thank for your help ! Etienne ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
EXC_BAD_ACCESS on NSImageView::setImage
I have a window that contains a NSImageView that displays pictures. here is the code : =CODE= NSBitmapImageRep *rawPic = [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL pixelsWide:thisFrame.width pixelsHigh:thisFrame.height bitsPerSample:8 samplesPerPixel:3 hasAlpha:NO isPlanar:NO colorSpaceName:NSCalibratedRGBColorSpace bitmapFormat:NSAlphaFirstBitmapFormat bytesPerRow:0 bitsPerPixel:0] autorelease]; unsigned char *DestinationRawData = [rawPic bitmapData]; memcpy(DestinationRawData, CurrentFrame, SzCurrentFrame); [self RGB2BGR:DestinationRawData Sz:SzCurrentFrame]; NSImage *NewDisplayImage = [[[NSImage alloc] initWithSize:thisFrame] autorelease]; [NewDisplayImage addRepresentation:rawPic]; [ExternalView setImage:NewDisplayImage]; =CODE= The ExternalView display correctly what i want for a while, no memory leak appears but after few seconds the program gives me a bad EXC_BAD_ACCESS. After commenting the last line (setImage) there is absolutely no crash. Thinking of a side-effect i checked all sizes and everything seams to fit. I also tried to remove the autorelease and replace them by some release after the set image but nothing seams to work. Can anybody see something wrong ? Is there any other way to do what i m doing ? Thanks for the peolple that will help me. Sincerely, -- I. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Cant figure out images
On Mar 10, 2009, at 6:45 PM, Etienne Gignac Bouchard wrote: testUrl = [NSURL URLWithString:@/Users/Etienne/Desktop/logo.gif]; That's not a URL; that's a POSIX path. If you want a file URL, then use +fileURLWithPath: instead. Nick Zitzmann http://www.chronosnet.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Background Process?
On Tue, Mar 10, 2009 at 11:38 PM, Michael Ash michael@gmail.com wrote: The notion that adding a timer to a runloop would somehow cause that runloop to suck up CPU time when the runloop is idle is nonsensical. The whole point of the runloop is that it sleeps the process until some activity is required. A background process sitting on a timer *will* take up various resources (memory, file descriptors, kernel structures, etc.) but CPU time is not among them. That's not what I said. What I said was that you cannot add a timer to your runloop and expect it to sit blocking on it until the timer fires. That's not how timers operate. You will need to periodically run the runloop in order to get your timer to fire. If you are doing this in an application, then the event-processing functionality of the runloop will take care of it. Otherwise, you will need to run it yourself. Either way, you will need to periodically poke the runloop, which on it's face can't take 0.0% CPU. Your app will persistently wake up (and our friend Nyquist has proven that in order for this to work it must wake at least twice as often as you want the timer to fire). --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: KVO Bindings: Proxy object change notifications
On Mar 10, 2009, at 4:14 AM, Dave Keck wrote: I have a preferences controller object (let's call it PrefCtrl) that's modeled after NSUserDefaultsController (for various reasons, though, it's a custom implementation.) As does NSUDC, it has a 'values' property, which mediates access to the preferences. The bindings in the UI use this 'values' proxy object to access the preferences. The role of the proxy object is simple: it forwards KVC methods (-valueForUndefinedKey: and setValue:forUndefinedKey:) to PrefCtrl, which either supplies or sets the appropriate value. [...] The problem arises when I have 3+ elements in the binding key path. For example, if the button's enabled property is bound to PrefCtrl's values.someFeature.isEnabled. In this case, when the value of 'values.someFeature.isEnabled' changes (let's assume due to another process re-writing the preferences) is when hell breaks loose and I get this delightful message: Cannot remove an observer NSKeyValueObservance 0x137d50 for the key path someFeature.isEnabled from PrefCtrl_Proxy 0x135bd0, most likely because the value for the key someFeature has changed without an appropriate KVO notification being sent. Check the KVO-compliance of the PrefCtrl_Proxy class. Are you sure that PrefCtrl is returning the same proxy each time? Also, at the time that you invoke -willChangeValueForKey: have you already changed your internal state such that invoking [theProxy valueForKey:@someFeature] returns the after value? It should still return the before value at that point. It must not return the after value until after the -willChangeValueForKey: call completes. My question: Of course, this error is correct - the value for the 'someFeature' key DID change. But why wasn't sending willChange/didChangeValueForKey: @values enough to notify the KVO system that values.someFeature was also going to change? It is enough. However, KVO has to unwind the set of observations on individual objects it did along the key path. In order to do that, it has to invoke -valueForKey: on the first object to get the second, on the second to get the third, etc. If any of those doesn't give back the same object it did when the original observation was established, then it can't unwind what it did. That's what it's complaining about. It's saying that [theProxy valueForKey:@someFeature] isn't the same object it was when the observation was established, so KVO can't unhook itself from the object it had earlier hooked into. Note that it's attempting this unwinding during -willChangeValueForKey:. Of course, that object won't be the same _after_ -willChangeValueForKey: -- you are, after all, changing it -- but it needs it to be the same _at_ - willChangeValueForKey: for KVO's housekeeping to work. Also, since KVO was watching the someFeature property of the proxy, and that property is different than it was, but KVO never noticed that it changed, it's reporting that the property changed in a non-KVO- compliant fashion. Since you are using a proxy to front for your PrefCtrl, are you also making sure that all changes of PrefCtrl's properties cause change notifications for the proxy's virtual properties? That is, are you forwarding all -will/didChange... invocations on your PrefCtrl object to your proxy, at least for keys other than values? You may be able to eliminate the proxy altogether, by the way. Have you tried having the values property of the PrefCtrl object just return self -- the PrefCtrl object itself? That would avoid the need to forward things in either direction, but still give you the ability to will/didChange... the values property to provoke a wholesale updating of all observers of any properties. At least, I think that should work. 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: Background Process?
Kyle Sluder wrote: On Tue, Mar 10, 2009 at 11:38 PM, Michael Ash michael@gmail.com wrote: The notion that adding a timer to a runloop would somehow cause that runloop to suck up CPU time when the runloop is idle is nonsensical. The whole point of the runloop is that it sleeps the process until some activity is required. A background process sitting on a timer *will* take up various resources (memory, file descriptors, kernel structures, etc.) but CPU time is not among them. That's not what I said. What I said was that you cannot add a timer to your runloop and expect it to sit blocking on it until the timer fires. That's not how timers operate. You will need to periodically run the runloop in order to get your timer to fire. If you are doing this in an application, then the event-processing functionality of the runloop will take care of it. Otherwise, you will need to run it yourself. Either way, you will need to periodically poke the runloop, which on it's face can't take 0.0% CPU. Your app will persistently wake up (and our friend Nyquist has proven that in order for this to work it must wake at least twice as often as you want the timer to fire). --Kyle Sluder This isn't how I understood the runloop documentation when I read it, and it's more than possible I have totally misread it. In the runloop documentation it says that at step '7' *Put the thread to sleep until one of the following events occurs: An event arrives for a port-based input source A timer fires The timeout value set for the runloop expires The runloop is explicitly woken up.* So you just add the timer to the runloop, run it, it sleeps until the timer fires, does its thing and then goes back to sleep again. What am I missing? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Remote Invocation
On Mar 10, 2009, at 9:13 AM, rajesh swarnkar wrote: I have two application in cocoa . My aim is to communicate with a protocol between both the application using IPC mechanism (through NSConnection) but I am unable to achieve my goal. I want to use id MyProtocol protocol as inout parameter for two way communication. Please see my code below and guide me what I am missing. You haven't said what's not working or is going wrong. At a glance, I can say that your initializer methods are all wrong. You aren't invoking the superclass's initializer. If you want a minimal -init method, you should just not provide any and rely entirely on your superclass's implementation. If you still want to provide it, anyway, here's the form: -(id)init { return [super init]; } Similarly, if you're just going to provide a minimal -dealloc method, you might as well just leave it out, although yours do look correct. Fix those issues and ask a proper question and you may get better help. 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