Re: Notification when network volume disappears
no you are in the weed there On Mon, Jun 14, 2010 at 9:40 AM, Boris Prohaska wrote: > Thats exactly the problem. IF the OS was aware of it, then there would be no > problem. There is also no setting for timeouts etc when performing blocking > operations onto the filesystem. > Maybe that is a OS X limitation?? > > Boris > > On 14.06.2010, at 17:04, Ken Thomases wrote: > >> On Jun 14, 2010, at 4:52 AM, Boris Prohaska wrote: >> >>> i was just wondering, is there any way to determine when for example a >>> network cable is plugged off while copying data to a network share? The >>> Finder has a pretty long timeout... >>> >>> Is there a way in the FS API or ANY other way to get notified, when a >>> volume isn't available for writing anymore? >> >> If you just want to know when a volume disappears (is unmounted), >> NSWorkspace provides notifications for that. But I don't think that will >> address the issue you describe. >> >> The problem is that the volume hasn't disappeared, it's just incommunicado >> as far as the OS is concerned. If it had disappeared in a way that the OS >> was aware of, then there would be no way for something to be stuck writing >> to it (or to begin writing to it, etc.). That is, there would be no paths >> to it for opening new file descriptors and all existing file descriptors >> would return errors on access. >> >> -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/0xcafefeed%40gmail.com > > This email sent to 0xcafef...@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: Notification when network volume disappears
I don't know which kind of connection you want to observe, but basically SCNetwork and SCNetworkReachability are your friends. then control these (and get the right conf) using two callback handlers use NSWorkspace to get your entry and your exit (if this case happens) NSWorkspaceDidMountNotification NSWorkspaceWillUnmountNotification you could add a third observer on a custom object trying to connect to the network you want, for instance every 10 seconds (a timer) now when you launch your app you need to perform a lookup to know the status. (I think the most annoying part) Best, On Mon, Jun 14, 2010 at 2:52 AM, Boris Prohaska wrote: > Hi guys, > > i was just wondering, is there any way to determine when for example a > network cable is plugged off while copying data to a network share? The > Finder has a pretty long timeout... > > Is there a way in the FS API or ANY other way to get notified, when a volume > isn't available for writing anymore? > > Thanks, > Boris > -- > GMX DSL: Internet-, Telefon- und Handy-Flat ab 19,99 EUR/mtl. > Bis zu 150 EUR Startguthaben inklusive! http://portal.gmx.net/de/go/dsl > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/0xcafefeed%40gmail.com > > This email sent to 0xcafef...@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: How to debug invalidated core data object
Hello, you might place some breakpoints, you did only post the consequences, debugging is matter of understanding. On Sun, Jun 13, 2010 at 8:49 AM, Gideon King wrote: > I have a situation where I create a temporary managed object context and do a > bunch of things with various managed objects before releasing the context > again. > > After this, there appears to be an asynchronous cleanup operation done by > coredata, at which point I get an exception as per the trace below (The > NSManagedObject with ID:(whatever) has been invalidated). > > I'm sure that there is something somewhere in my code where I am either > setting up a queued notification or something like that which is being called > after the context has been released, or something being picked up in the > drawing code etc, but there are many thousands of lines of code, all sorts of > windows and views involved, so it looks really hard to narrow it down. > > I'd really appreciate any suggestions about how to pinpoint the source of > this problem. > > > > > #0 0x7fff832070da in objc_exception_throw () > #1 0x7fff83c4b11a in -[_NSInvalidationFaultHandler > fulfillFault:withContext:] () > #2 0x7fff83beddbe in _PF_FulfillDeferredFault () > #3 0x7fff83bf1ab7 in _sharedIMPL_pvfk_core () > #4 0x7fff83bf1c28 in > -[NSManagedObject(_PFDynamicAccessorsAndPropertySupport) > _genericValueForKey:withIndex:flags:] () > #5 0x7fff83bf74be in -[NSManagedObject valueForKey:] () > #6 0x7fff84a95d34 in -[NSObject(NSKeyValueCoding) valueForKeyPath:] () > #7 0x7fff84a95dca in -[NSObject(NSKeyValueCoding) valueForKeyPath:] () > #8 0x7fff84a99843 in NSKeyValueWillChangeBySetting () > #9 0x7fff84a9921c in NSKeyValueWillChange () > #10 0x7fff84b6c0c6 in -[NSObject(NSKeyValueObservingPrivate) > _willChangeValuesForKeys:] () > #11 0x7fff83bf8c60 in -[NSFaultHandler turnObject:intoFaultWithContext:] > () > #12 0x7fff83c0a254 in -[NSManagedObjectContext(_NSInternalAdditions) > _disposeObjects:count:notifyParent:] () > #13 0x7fff83c09b48 in -[NSManagedObjectContext(_NSInternalAdditions) > _dispose:] () > #14 0x7fff83c2fc69 in _deallocateContextBackgroundThread () > #15 0x7fff83bcbe10 in minion_duties2 () > #16 0x7fff8385a8b6 in _pthread_start () > #17 0x7fff8385a769 in thread_start () > > > Thanks > > Gideon > > > > > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/0xcafefeed%40gmail.com > > This email sent to 0xcafef...@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: Explicit release when using garbage collection with circular references
and to close this: I will open the discussion: in a cpp program I will use a type-recasting behaviour on a circular ref ? Cheers! On Sun, Mar 22, 2009 at 5:26 PM, mm w wrote: > ref my previous email, > > anyway there are other aspects and side effects due to the circular > refs, and one this is a memory issue, GC is now almost clever to > detect that's ObjectB reference is hold by a previous ObjectA ref to > Object0 our first reference, but it wasn't true at the beginning, and > I am pretty sure there are still some undiscovered effects > > by adopting a proper design you will avoid this, here you can see a > bunch of unsolvable requests due to this kind of mistake, sure people > find patch on patch on patch and finish with a ton of lines to try to > correct the reasons, > > see my previous comment on symptoms and consequences > > Cheers! > > On Sun, Mar 22, 2009 at 4:53 PM, mm w wrote: >> On Sun, Mar 22, 2009 at 4:32 PM, David Melgar wrote: >>> Some people do that to try and impress. >>> I'm not impressed. >>> No useful information. >>> >> >> it's not my point, i don't understand your feeling here, I am not >> trying to impress anyone, I'm only give some points >> >>> On Mar 22, 2009, at 7:22 PM, Clark Cox wrote: >>> >>>> It's not very conducive to conversation to make claims, and then >>>> refuse to back them up, and leave it at "I let you discover it". >>>> >>>> On Sun, Mar 22, 2009 at 4:19 PM, mm w wrote: >>>>> >>>>> maybe in your world, anyway there are a bunch of reasons to avoid >>>>> circular refs >>>>> I let you discover it >>>>> >>>>> Cheers! >>>>> >>>>> On Sun, Mar 22, 2009 at 3:58 PM, Clark Cox wrote: >>>>>> >>>>>> On Sun, Mar 22, 2009 at 3:37 PM, mm w wrote: >>>>>>> >>>>>>> Because I am like this I won't do the job for you, I will only point >>>>>>> you directions, that's it >>>>>>> >>>>>>> Google "garbage collection", it's naive to think that's a "linear" >>>>>>> tree. >>>>>>> >>>>>>> What Bill told you is right, and my comment is following his thought >>>>>>> >>>>>>> Avoiding circular refs: in 95% of cases it can be avoided, >>>>>> >>>>>> They can be avoided, but why? They are not an error under garbage >>>>>> collection, and there is no reason to avoid them. >>>>>> >>>>>> -- >>>>>> Clark S. Cox III >>>>>> clarkc...@gmail.com >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> -mmw >>>>> >>>> >>>> >>>> >>>> -- >>>> Clark S. Cox III >>>> clarkc...@gmail.com >>> >>> >> >> >> >> -- >> -mmw >> > > > > -- > -mmw > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Explicit release when using garbage collection with circular references
ref my previous email, anyway there are other aspects and side effects due to the circular refs, and one this is a memory issue, GC is now almost clever to detect that's ObjectB reference is hold by a previous ObjectA ref to Object0 our first reference, but it wasn't true at the beginning, and I am pretty sure there are still some undiscovered effects by adopting a proper design you will avoid this, here you can see a bunch of unsolvable requests due to this kind of mistake, sure people find patch on patch on patch and finish with a ton of lines to try to correct the reasons, see my previous comment on symptoms and consequences Cheers! On Sun, Mar 22, 2009 at 4:53 PM, mm w wrote: > On Sun, Mar 22, 2009 at 4:32 PM, David Melgar wrote: >> Some people do that to try and impress. >> I'm not impressed. >> No useful information. >> > > it's not my point, i don't understand your feeling here, I am not > trying to impress anyone, I'm only give some points > >> On Mar 22, 2009, at 7:22 PM, Clark Cox wrote: >> >>> It's not very conducive to conversation to make claims, and then >>> refuse to back them up, and leave it at "I let you discover it". >>> >>> On Sun, Mar 22, 2009 at 4:19 PM, mm w wrote: >>>> >>>> maybe in your world, anyway there are a bunch of reasons to avoid >>>> circular refs >>>> I let you discover it >>>> >>>> Cheers! >>>> >>>> On Sun, Mar 22, 2009 at 3:58 PM, Clark Cox wrote: >>>>> >>>>> On Sun, Mar 22, 2009 at 3:37 PM, mm w wrote: >>>>>> >>>>>> Because I am like this I won't do the job for you, I will only point >>>>>> you directions, that's it >>>>>> >>>>>> Google "garbage collection", it's naive to think that's a "linear" >>>>>> tree. >>>>>> >>>>>> What Bill told you is right, and my comment is following his thought >>>>>> >>>>>> Avoiding circular refs: in 95% of cases it can be avoided, >>>>> >>>>> They can be avoided, but why? They are not an error under garbage >>>>> collection, and there is no reason to avoid them. >>>>> >>>>> -- >>>>> Clark S. Cox III >>>>> clarkc...@gmail.com >>>>> >>>> >>>> >>>> >>>> -- >>>> -mmw >>>> >>> >>> >>> >>> -- >>> Clark S. Cox III >>> clarkc...@gmail.com >> >> > > > > -- > -mmw > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Explicit release when using garbage collection with circular references
On Sun, Mar 22, 2009 at 4:32 PM, David Melgar wrote: > Some people do that to try and impress. > I'm not impressed. > No useful information. > it's not my point, i don't understand your feeling here, I am not trying to impress anyone, I'm only give some points > On Mar 22, 2009, at 7:22 PM, Clark Cox wrote: > >> It's not very conducive to conversation to make claims, and then >> refuse to back them up, and leave it at "I let you discover it". >> >> On Sun, Mar 22, 2009 at 4:19 PM, mm w wrote: >>> >>> maybe in your world, anyway there are a bunch of reasons to avoid >>> circular refs >>> I let you discover it >>> >>> Cheers! >>> >>> On Sun, Mar 22, 2009 at 3:58 PM, Clark Cox wrote: >>>> >>>> On Sun, Mar 22, 2009 at 3:37 PM, mm w wrote: >>>>> >>>>> Because I am like this I won't do the job for you, I will only point >>>>> you directions, that's it >>>>> >>>>> Google "garbage collection", it's naive to think that's a "linear" >>>>> tree. >>>>> >>>>> What Bill told you is right, and my comment is following his thought >>>>> >>>>> Avoiding circular refs: in 95% of cases it can be avoided, >>>> >>>> They can be avoided, but why? They are not an error under garbage >>>> collection, and there is no reason to avoid them. >>>> >>>> -- >>>> Clark S. Cox III >>>> clarkc...@gmail.com >>>> >>> >>> >>> >>> -- >>> -mmw >>> >> >> >> >> -- >> Clark S. Cox III >> clarkc...@gmail.com > > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Explicit release when using garbage collection with circular references
No but this point is on left-side of this subject, anyway, here we can see one side effect at code design-level: here we have some symptoms: - a lack of visibility - when you can be the owner : "be the owner" and control what is happening direct effect you are screwing up the garbage collection system a last comment: when someone is hill, do you try to fix the symptoms or the reasons? one rule: there is no circular refs in your design, it's the same for people who are designing circuits: there is no bridge, there is no circular refs allowed if you start with those constraints in mind I can ensure you that you won't fall in this kind of trap, and always be able to increase the possibility of your application, circular refs are against every oop design logic, when you face it, that's the result and the consequence of a previous mistake, sure sometimes for various reasons you will use a circular ref it's not 100% rule, sometimes it's good to be evil! Cheers! On Sun, Mar 22, 2009 at 4:22 PM, Clark Cox wrote: > It's not very conducive to conversation to make claims, and then > refuse to back them up, and leave it at "I let you discover it". > > On Sun, Mar 22, 2009 at 4:19 PM, mm w wrote: >> maybe in your world, anyway there are a bunch of reasons to avoid circular >> refs >> I let you discover it >> >> Cheers! >> >> On Sun, Mar 22, 2009 at 3:58 PM, Clark Cox wrote: >>> On Sun, Mar 22, 2009 at 3:37 PM, mm w wrote: >>>> Because I am like this I won't do the job for you, I will only point >>>> you directions, that's it >>>> >>>> Google "garbage collection", it's naive to think that's a "linear" tree. >>>> >>>> What Bill told you is right, and my comment is following his thought >>>> >>>> Avoiding circular refs: in 95% of cases it can be avoided, >>> >>> They can be avoided, but why? They are not an error under garbage >>> collection, and there is no reason to avoid them. >>> >>> -- >>> Clark S. Cox III >>> clarkc...@gmail.com >>> >> >> >> >> -- >> -mmw >> > > > > -- > Clark S. Cox III > clarkc...@gmail.com > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Explicit release when using garbage collection with circular references
maybe in your world, anyway there are a bunch of reasons to avoid circular refs I let you discover it Cheers! On Sun, Mar 22, 2009 at 3:58 PM, Clark Cox wrote: > On Sun, Mar 22, 2009 at 3:37 PM, mm w wrote: >> Because I am like this I won't do the job for you, I will only point >> you directions, that's it >> >> Google "garbage collection", it's naive to think that's a "linear" tree. >> >> What Bill told you is right, and my comment is following his thought >> >> Avoiding circular refs: in 95% of cases it can be avoided, > > They can be avoided, but why? They are not an error under garbage > collection, and there is no reason to avoid them. > > -- > Clark S. Cox III > clarkc...@gmail.com > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Explicit release when using garbage collection with circular references
On Sun, Mar 22, 2009 at 3:54 PM, Jean-Daniel Dupas wrote: > > Le 22 mars 09 à 23:37, mm w a écrit : > >> Because I am like this I won't do the job for you, I will only point >> you directions, that's it >> >> Google "garbage collection", it's naive to think that's a "linear" tree. >> >> What Bill told you is right, and my comment is following his thought >> >> Avoiding circular refs: in 95% of cases it can be avoided, by >> refactoring his work, >> taking a pen and a white paper... and think >> > > I don't understand your point here. > > Circular references have not to be avoid. They are not an error. > yes that's true > As previously mention, the garbage collector tracks root objects, and so it > should properly deal with circular references. > yep right, my point was circular refs are bad > In a reference counted world, they are valid too, as long as the who retain > who policy is properly designed. > > yep right, my point was circular refs are bad -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Explicit release when using garbage collection with circular references
Because I am like this I won't do the job for you, I will only point you directions, that's it Google "garbage collection", it's naive to think that's a "linear" tree. What Bill told you is right, and my comment is following his thought Avoiding circular refs: in 95% of cases it can be avoided, by refactoring his work, taking a pen and a white paper... and think Cheers! On Sun, Mar 22, 2009 at 3:21 PM, David Melgar wrote: > I'm confused. Bill said that the garbage collection will correctly handle > releasing these types of objects despite the circular references. Therefore > it appears that no additional actions are required since I am using garbage > collection. > > What is your approach trying to solve? > I certainly don't follow your reply. Google for what? > Naive in what way? > Avoid circular refs by a "proper" design? Ok... what is "proper"? > > Generally your message alludes to many things yet provides little > information. > > On Mar 22, 2009, at 5:53 PM, mm w wrote: > >> I changed my mind, when I was writting this >> >> - (void)sendSharedMessage:(NSString *)msg >> { >> NSString *print = [[[NSString alloc] initWithFormat:@" %@",msg] >> autorelease]; >> >> NSLog(@" %@", print); >> } >> >> anyway it doesn't change the background >> >> >> On Sun, Mar 22, 2009 at 2:47 PM, mm w wrote: >>> >>> Hello David, >>> >>> your garbage collection approach is a bit naive, but not everything >>> is wrong, you can make a google search, it will point you good >>> resources anyway, >>> >>> @implementation AppDelegate >>> >>> - (void)sendSharedMessage:(NSString *)msg >>> { >>> return [[[NSString alloc] initWithFormat:@" %@",msg] autorelease]; >>> } >>> >>> @end >>> >>> >>> @implementation MyObject >>> >>> - (void)aMathod >>> { >>> id sharedController = [[NSApplication sharedApplication] delegate]; >>> >>> if ([[sharedController class] >>> instancesRespondToSelector:@selector(sendSharedMessage:)]) { >>> NSString aMsg = [[NSString alloc] initWithString:@"hello"]; >>> [sharedController performSelector:@selector(sendSharedMessage:) >>> withObject:aMsg]; >>> [aMsg release]; >>> } >>> >>> } >>> >>> @end >>> >>> (sorry if there is synthax errors this is a live code) >>> >>> this model will apply with/or without garbage collection, release >>> autorelease will be ignored in garbage collection env, avoid "as far >>> is possible" circular refs by a proper design. >>> >>> On Sat, Mar 21, 2009 at 9:16 PM, Bill Bumgarner wrote: >>>> >>>> On Mar 21, 2009, at 9:11 PM, David wrote: >>>>> >>>>> Is there any issue issuing explicit release when using garbage >>>>> collection with Leopard and Obj-c 2.0? >>>> >>>> -release is ignored entirely. >>>> >>>> CFRelease() work as it always does, and balances CFRetain() nicely. >>>> >>>> But that isn't the issue. >>>> >>>>> I've become aware that I have lots of memory not being freed within my >>>>> application. I presume this is because its a tree structure with >>>>> parent child pointers between the objects. If I drop the last >>>>> reference to the tree, I presume the tree does not get garbage >>>>> collected because each object has circular pointers between them, ie >>>>> parent has references to children and each child has a reference to >>>>> its parent. In this case, it seem that the appropriate course of >>>>> action would be to call a specific method to forcibly release each >>>>> node in the tree. >>>>> Is this the proper approach? >>>>> Should garbage collection somehow work anyway? >>>> >>>> That would be an incorrect presumption. The garbage collector handles >>>> complexly connected, but not rooted, graphs just fine. Your sub-graphs >>>> -- >>>> trees -- of objects that are no longer referenced by your rooted object >>>> graphs should be reaped without a problem. >>>> >>>> So, something else is going on. >>>> >>>> Have you used 'info gc-roots' to see what is causing the items within >>>> your >>>> tree to stick around? >>>> >>>> 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/openspecies%40gmail.com >>>> >>>> This email sent to openspec...@gmail.com >>>> >>> >>> >>> >>> -- >>> -mmw >>> >> >> >> >> -- >> -mmw > > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Explicit release when using garbage collection with circular references
I changed my mind, when I was writting this - (void)sendSharedMessage:(NSString *)msg { NSString *print = [[[NSString alloc] initWithFormat:@" %@",msg] autorelease]; NSLog(@" %@", print); } anyway it doesn't change the background On Sun, Mar 22, 2009 at 2:47 PM, mm w wrote: > Hello David, > > your garbage collection approach is a bit naive, but not everything > is wrong, you can make a google search, it will point you good > resources anyway, > > @implementation AppDelegate > > - (void)sendSharedMessage:(NSString *)msg > { > return [[[NSString alloc] initWithFormat:@" %@",msg] autorelease]; > } > > @end > > > @implementation MyObject > > - (void)aMathod > { > id sharedController = [[NSApplication sharedApplication] delegate]; > > if ([[sharedController class] > instancesRespondToSelector:@selector(sendSharedMessage:)]) { > NSString aMsg = [[NSString alloc] initWithString:@"hello"]; > [sharedController performSelector:@selector(sendSharedMessage:) > withObject:aMsg]; > [aMsg release]; > } > > } > > @end > > (sorry if there is synthax errors this is a live code) > > this model will apply with/or without garbage collection, release > autorelease will be ignored in garbage collection env, avoid "as far > is possible" circular refs by a proper design. > > On Sat, Mar 21, 2009 at 9:16 PM, Bill Bumgarner wrote: >> On Mar 21, 2009, at 9:11 PM, David wrote: >>> >>> Is there any issue issuing explicit release when using garbage >>> collection with Leopard and Obj-c 2.0? >> >> -release is ignored entirely. >> >> CFRelease() work as it always does, and balances CFRetain() nicely. >> >> But that isn't the issue. >> >>> I've become aware that I have lots of memory not being freed within my >>> application. I presume this is because its a tree structure with >>> parent child pointers between the objects. If I drop the last >>> reference to the tree, I presume the tree does not get garbage >>> collected because each object has circular pointers between them, ie >>> parent has references to children and each child has a reference to >>> its parent. In this case, it seem that the appropriate course of >>> action would be to call a specific method to forcibly release each >>> node in the tree. >>> Is this the proper approach? >>> Should garbage collection somehow work anyway? >> >> That would be an incorrect presumption. The garbage collector handles >> complexly connected, but not rooted, graphs just fine. Your sub-graphs -- >> trees -- of objects that are no longer referenced by your rooted object >> graphs should be reaped without a problem. >> >> So, something else is going on. >> >> Have you used 'info gc-roots' to see what is causing the items within your >> tree to stick around? >> >> 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/openspecies%40gmail.com >> >> This email sent to openspec...@gmail.com >> > > > > -- > -mmw > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Explicit release when using garbage collection with circular references
Hello David, your garbage collection approach is a bit naive, but not everything is wrong, you can make a google search, it will point you good resources anyway, @implementation AppDelegate - (void)sendSharedMessage:(NSString *)msg { return [[[NSString alloc] initWithFormat:@" %@",msg] autorelease]; } @end @implementation MyObject - (void)aMathod { id sharedController = [[NSApplication sharedApplication] delegate]; if ([[sharedController class] instancesRespondToSelector:@selector(sendSharedMessage:)]) { NSString aMsg = [[NSString alloc] initWithString:@"hello"]; [sharedController performSelector:@selector(sendSharedMessage:) withObject:aMsg]; [aMsg release]; } } @end (sorry if there is synthax errors this is a live code) this model will apply with/or without garbage collection, release autorelease will be ignored in garbage collection env, avoid "as far is possible" circular refs by a proper design. On Sat, Mar 21, 2009 at 9:16 PM, Bill Bumgarner wrote: > On Mar 21, 2009, at 9:11 PM, David wrote: >> >> Is there any issue issuing explicit release when using garbage >> collection with Leopard and Obj-c 2.0? > > -release is ignored entirely. > > CFRelease() work as it always does, and balances CFRetain() nicely. > > But that isn't the issue. > >> I've become aware that I have lots of memory not being freed within my >> application. I presume this is because its a tree structure with >> parent child pointers between the objects. If I drop the last >> reference to the tree, I presume the tree does not get garbage >> collected because each object has circular pointers between them, ie >> parent has references to children and each child has a reference to >> its parent. In this case, it seem that the appropriate course of >> action would be to call a specific method to forcibly release each >> node in the tree. >> Is this the proper approach? >> Should garbage collection somehow work anyway? > > That would be an incorrect presumption. The garbage collector handles > complexly connected, but not rooted, graphs just fine. Your sub-graphs -- > trees -- of objects that are no longer referenced by your rooted object > graphs should be reaped without a problem. > > So, something else is going on. > > Have you used 'info gc-roots' to see what is causing the items within your > tree to stick around? > > 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/openspecies%40gmail.com > > This email sent to openspec...@gmail.com > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSString and Leaks Instrument, False Positives?
sorry for the extra characters that you got my iphone auto-provides me words... On Sat, Mar 21, 2009 at 5:51 PM, mm w wrote: > if you want I have a similar one with LibTiff and imageIO (10.5.6) > make a simple project with a 2 NSButton with a Tiff Image > > Cheers! > > On Sat, Mar 21, 2009 at 5:33 PM, Bill Bumgarner wrote: >> On Mar 21, 2009, at 5:09 PM, Kevin Ross wrote: >>> >>> KRStarChartMO drawPortentsInRect:circleStyle:] | +[NSFont >>> fontWithName:size:] | __NSFontFactoryWithName | +[__NSFontTypefaceInfo >>> typefaceInfoForPostscriptName:] | >>> TDescriptor::CreateMatchingDescriptorInternal(__CFSet const*) const | >>> TDescriptorSourceImp::CopyFontDescriptorPerPostscriptName(__CFString const*, >>> unsigned int) const | ATSFontFindFromPostScriptName | >>> _eATSFontFindFromPostScriptName | _eATSSendFontQuery | >>> CFStringCreateWithCString | __CFStringCreateImmutableFunnel3 | >>> _CFRuntimeCreateInstance | malloc_zone_malloc >> >> That looks an awful lot like a leak in the ATS subsystem. >> >> File a bug via http://bugreport.apple.com/ and send me the #, please. >> >> b.bum >> >> > > > > -- > -mmw > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSString and Leaks Instrument, False Positives?
if you want I have a similar one with LibTiff and imageIO (10.5.6) make a simple project with a 2 NSButton with a Tiff Image Cheers! On Sat, Mar 21, 2009 at 5:33 PM, Bill Bumgarner wrote: > On Mar 21, 2009, at 5:09 PM, Kevin Ross wrote: >> >> KRStarChartMO drawPortentsInRect:circleStyle:] | +[NSFont >> fontWithName:size:] | __NSFontFactoryWithName | +[__NSFontTypefaceInfo >> typefaceInfoForPostscriptName:] | >> TDescriptor::CreateMatchingDescriptorInternal(__CFSet const*) const | >> TDescriptorSourceImp::CopyFontDescriptorPerPostscriptName(__CFString const*, >> unsigned int) const | ATSFontFindFromPostScriptName | >> _eATSFontFindFromPostScriptName | _eATSSendFontQuery | >> CFStringCreateWithCString | __CFStringCreateImmutableFunnel3 | >> _CFRuntimeCreateInstance | malloc_zone_malloc > > That looks an awful lot like a leak in the ATS subsystem. > > File a bug via http://bugreport.apple.com/ and send me the #, please. > > b.bum > > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSString and Leaks Instrument, False Positives?
be careful with clang, sometimes is missing point, your problem is coming not from this @"Arial Bold", give the complete stack and explain what is the condition of the leak False/positive: I have an extensive use of perf tools since years and I didn't see that since a while the leak can be deeper than your app === give the complete stack-trace On Sat, Mar 21, 2009 at 4:43 PM, Kevin Ross wrote: > Whoops, I thought that I'd also mention that I've run the code though the > clang static analyzer and it doesn't report that there are any bugs. I'm > also happy to post more code if it will help. > > Thanks again! > > Kevin > > > On Mar 21, 2009, at 4:36 PM, Kevin Ross wrote: > >> Hi everyone, I'm auditing my app and the both the "leaks" command line >> tool and the Instruments tool are both reporting that I have NSString leaks. >> All of the leaks are coming from code similar to the following: >> >> NSFont *ageStarTextFont = [NSFont fontWithName:@"Arial Bold" >> size:KRLesserDimensionOfRect(transientDrawingRect)/3]; >> >> I'm guessing that the string in question is the @"Arial Bold" since it >> that is the only string on that line, but from what I understand a string >> created like that doesn't require a -release message. Could these be false >> positives generated by the leaks tool, or is there something that I'm >> missing? >> >> Thanks for any pointers! >> >> >> Kevin Ross >> >> Twenty-Four Mountains >> Mac Feng Shui Software >> ke...@twentyfourmountains.com >> twentyfourmountains.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/faderanger%40sbcglobal.net >> >> This email sent to faderan...@sbcglobal.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/openspecies%40gmail.com > > This email sent to openspec...@gmail.com > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSData confusion
on the backside, for this kind of game, sometimes is good to know to use C rather than object/scalar layers, and use only an object to represent the final result. Cheers! On Fri, Mar 20, 2009 at 2:57 PM, Boyd Collier wrote: > In a program I've been developing, I make a lot of use of matrices of > doubles, and I've written some straight-forward code for doing this that > might be of interest to you. If you're interested, I'd be happy to send it > to you. > > Boyd > > > > On Mar 20, 2009, at 11:33 AM, James Maxwell wrote: > >> I've been using NSData to wrap up float arrays and matrices, so I can pass >> them around my methods and classes. >> However, I'm finding they're using loads of memory. Now, I do admit this >> is probably because I'm not doing this properly, so I'd like some >> clarification. The NSData objects are instance variables, and I need to be >> able to perform operations on the float arrays/matrices inside, and have >> these operations permanently change the state of the array/matrix. >> >> I've been doing something like: >> >> - (NSData *) doSomethingToFloatData >> { >> float stuff[20]; >> >> [[self floatData] getBytes:stuff]; >> >> // do something to change the float values in stuff >> >> [self setFloatData:[NSData dataWithBytes:stuff length:(20 * >> sizeof(float))]]; >> >> return [self floatData]; >> } >> >> But this seems like a memory hungry way of doing things (even though >> setFloatData is a "properly written" accessor, I think, and does release the >> current copy "m_floatData" before storing the new one). Is there any way to >> just operate on the float array "in place", so to speak? Do I really need >> the "[self setFloatData]" call, if I want the changes to stuff to be >> retained? >> >> Just in case there's a problem with the accessor, I'm doing something like >> this: >> >> - (void) setFloatData:(NSData *) theData >> { >> if(m_floatData) >> [m_floatData release]; >> m_floatData = [theData retain]; >> } >> >> This is how I've seen it done in the Apple docs, but maybe this isn't the >> best way to do things...(??) >> >> Keep in mind, I'm from a Java background, so I may be missing some things >> that would be obvious to a C expert... I'm also open to a totally different >> way of doing all this, with the one caveat that the float arrays and >> matrices can get fairly large, and I'm running through lots of them (i.e., >> NSMutableArrays will likely be too slow and awkward). Would NSValue be more >> convenient? >> >> J. >> ___ >> >> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >> >> Please do not post admin requests or moderator comments to the list. >> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >> >> Help/Unsubscribe/Update your Subscription: >> >> http://lists.apple.com/mailman/options/cocoa-dev/bcollier%40sunstroke.sdsu.edu >> >> This email sent to bcoll...@sunstroke.sdsu.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/openspecies%40gmail.com > > This email sent to openspec...@gmail.com > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSDate isEqual to...
Right the comment of Mike is fair, I don't know what you are doing (a lie), anyway your interest is to know a time interval rather than a date you should design a object with a referential start-time: CFAbsoluteTime timeNow(void) { return (CFAbsoluteTime) (CFAbsoluteTimeGetCurrent() - kCFAbsoluteTimeIntervalSince1970); // you have similar access thru Cocoa } and use only NSDate (rather than to play with it, it's also a main memory consumer) to make a representation of this time interval at (T), I think it will save you a lot of pain for the next time... :) Cheers! On Fri, Mar 20, 2009 at 2:50 PM, Mike Abdullah wrote: > > On 20 Mar 2009, at 21:17, Charles E. Heizer wrote: > >> Thanks, >> No it's just playing around right now. It would be nice to be able to >> specify if you wanted NSDate to be sub-second or second precision based. >> >> Just as question, can NSDate be overridden to be second precision based? > > Theoretically yes. Practically, it would be a rather bad idea. 1 second is > meaningful to you, but consider a completely different culture's calendaring > system where "a second" is actually equivalent to 3 of ours seconds. What > would second precision be then? > > The point is that you don't really want to test the equality of two dates. > Instead you want to compare them like so: > > date1 >= date2 > date1 <= date2 > > Or you want to know if they're roughly equal to each other. "Is date1 within > 0.5 seconds of date2" > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com > > This email sent to openspec...@gmail.com > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSDate isEqual to...
yes, see my previous message; you should NSLogged a NSDate object Cheers! On Fri, Mar 20, 2009 at 2:17 PM, Charles E. Heizer wrote: > Thanks, > No it's just playing around right now. It would be nice to be able to > specify if you wanted NSDate to be sub-second or second precision based. > > Just as question, can NSDate be overridden to be second precision based? > > Thanks, > - Charles > > > On Mar 20, 2009, at 2:05 PM, Mike Abdullah wrote: > >> >> On 20 Mar 2009, at 20:50, Charles E. Heizer wrote: >> >>> Hello, >>> I'm playing around with date time stuff right now and I'm trying to >>> figure out the bets way to determine if one datetime is equal to >>> another. The problem I'm running in to is "isEqualToDate" does not >>> appear to work, the NSLog statement will show two identical datetime >>> statements but I never see a "These dates are the same!". >>> >>> Can someone please tell me how I can get this to work. >>> >>> Thanks, >>> Charles >>> >>> NSDate *theDateTimeToRunAt = [NSDate dateWithString:@"2009-03-20 >>> 13:18:00 -0700"]; >>> NSDate *theCurrentDateTime = [NSDate date]; >>> while(1) >>> { >>> NSLog(@"theDateTime1=%@ | theCurrentDate=%@", theDateTimeToRunAt, >>> theCurrentDateTime); >>> if ([theDateTime1 isEqualToDate:theCurrentDate]) { >>> NSLog(@"These dates are the same!"); >>> [theDateTimeToRunAt addTimeInterval:900]; // Add 15 >>> Minutes to say >>> hi again! >>> } >>> >>> sleep(1); >>> theDate = [NSDate date]; >>> } >> >> Because quite simply the dates are not exactly the same. NSDate is >> based on NSTimeInterval which offers sub-second precision, and so it >> is pretty unlikely that fetching the current time gives you a date >> that is precisely 13:18. Instead, you want to compare the dates to see >> if current date is greater than or equal to theDateTimeToRunAt. >> >> Is this really your intention for the code though, or just an example >> method? If the former, why not just use +[NSThread sleepUntilDate:] ? >> >> 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/openspecies%40gmail.com > > This email sent to openspec...@gmail.com > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSDate isEqual to...
+ (BOOL)isADayEqualToAnotherDay:(NSDate*)date anotherDate:(NSDate*)anotherDate { NSCalendar *cal; NSDateComponents *componentsFromDate, *componentsFromAnotherDate; NSUInteger unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit; cal = [NSCalendar currentCalendar]; componentsFromDate = [cal components:unitFlags fromDate:date]; componentsFromAnotherDate = [cal components:unitFlags fromDate:anotherDate]; return ( [componentsFromDate year] == [componentsFromAnotherDate year] && [componentsFromDate month] == [componentsFromAnotherDate month] && [componentsFromDate day] == [componentsFromAnotherDate day] ); } + (NSDate *)timeWithInterval:(NSInteger)timeInterval { NSDateComponents *comps = [[NSDateComponents alloc] init]; NSCalendar *cal = [[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar] autorelease]; NSDate *result; [comps setHour:(timeInterval / 3600)]; [comps setMinute:(timeInterval / 60) - ((timeInterval / 3600) * 60)]; [comps setSecond:(timeInterval % 60)]; result = [cal dateFromComponents:comps]; [comps release]; return result; } (those are only sample codes there are better ways to handle this, I only pointed you some methods, that will let you the opportunity to digg into NSDate/NSIntervalTime/NSCalendar APIs, and reach your way) what you need to compare: is the time of the dateTime object, Cheers! On Fri, Mar 20, 2009 at 2:05 PM, Mike Abdullah wrote: > > On 20 Mar 2009, at 20:50, Charles E. Heizer wrote: > >> Hello, >> I'm playing around with date time stuff right now and I'm trying to figure >> out the bets way to determine if one datetime is equal to another. The >> problem I'm running in to is "isEqualToDate" does not appear to work, the >> NSLog statement will show two identical datetime statements but I never see >> a "These dates are the same!". >> >> Can someone please tell me how I can get this to work. >> >> Thanks, >> Charles >> >> NSDate *theDateTimeToRunAt = [NSDate dateWithString:@"2009-03-20 13:18:00 >> -0700"]; >> NSDate *theCurrentDateTime = [NSDate date]; >> while(1) >> { >> NSLog(@"theDateTime1=%@ | theCurrentDate=%@", theDateTimeToRunAt, >> theCurrentDateTime); >> if ([theDateTime1 isEqualToDate:theCurrentDate]) { >> NSLog(@"These dates are the same!"); >> [theDateTimeToRunAt addTimeInterval:900]; // Add 15 Minutes >> to say hi again! >> } >> >> sleep(1); >> theDate = [NSDate date]; >> } > > Because quite simply the dates are not exactly the same. NSDate is based on > NSTimeInterval which offers sub-second precision, and so it is pretty > unlikely that fetching the current time gives you a date that is precisely > 13:18. Instead, you want to compare the dates to see if current date is > greater than or equal to theDateTimeToRunAt. > > Is this really your intention for the code though, or just an example > method? If the former, why not just use +[NSThread sleepUntilDate:] ? > > 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/openspecies%40gmail.com > > This email sent to openspec...@gmail.com > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Banding/smoothing problem with drawing angled gradients.
seriously you should think to use a GLView, you also have to think to lock your context... 2009/3/19 Phi Le : > Hello, > > I want to draw angled gradients with multiple sharp transitions using > NSGradient. I am not getting very smooth transitions between the > colors. Please take a look at my attachment to see the problem. Are > there solutions without having to use NSShading? > > Thanks, > > Phi > > > > - (void) drawRect: (NSRect) rect { > [[NSGraphicsContext currentContext] setShouldAntialias:YES]; > float locs[8] = {0.0, 0.25, 0.3, 0.35, 0.5, 0.6, 0.7, 1.0 }; > NSMutableArray * colors = [[NSMutableArray alloc] init]; > > [colors addObject: [NSColor blackColor]]; > > [colors addObject: [NSColor blackColor]]; > [colors addObject: [NSColor greenColor]]; > [colors addObject: [NSColor blackColor]]; > > [colors addObject: [NSColor blackColor]]; > [colors addObject: [NSColor redColor]]; > [colors addObject: [NSColor blackColor]]; > > [colors addObject: [NSColor blackColor]]; > > NSColorSpace * space = [NSColorSpace genericRGBColorSpace]; > NSGradient * gradient = [[NSGradient alloc] initWithColors:colors > atLocations:&locs colorSpace: space]; > > float angle = 0; > for(int r = 0; r < 5; r++) { > for(int c = 0; c < 3; c++) { > [gradient drawInRect:NSMakeRect(c*200, r*90, > 180, 80) angle: angle]; > angle += 5; > } > } > } > > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com > > This email sent to openspec...@gmail.com > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: problems with CAAnimation - SOLVED (kinda)
your design simply sucks, you don't understand the library I cannot help you on this, I am not Jesus and I cannot save all people who are pretending to program, once again I did complex design with CA related API, and I have never been stuck in this kind of issue, so I let you think, nobody can solve your issue you took the wrong way Cheers! On Thu, Mar 19, 2009 at 4:05 PM, Memo Akten wrote: > Hi, I've used jQuery, but I don't understand the relevance or what you mean? > > On 19 Mar 2009, at 22:30, mm w wrote: > >> you should really create a html page and play for instance with jQuery >> to understand how those mechanisms/API have been designed, and when you >> will >> understand what you are doing you will welcome to come again >> >> Cheers! >> >> On Thu, Mar 19, 2009 at 3:26 PM, Memo Akten wrote: >>> >>> Hi Matt, thanks for lengthy reply. At this point, I"ve only tried the >>> first >>> part, and I cannot get it to use the time I'm supplying in the animation, >>> basically its just doing an implicit animation not explicit. It doesn't >>> matter whether I setValue before or after the addAnimation. >>> >>> Actually I ended up writing the generic code below. If I apply the >>> CAAnimationGroup as a group (i.e. bApplyIndividually = NO), then it >>> doesn't >>> work at all for some reason, the values from the layer.presentationLayer >>> do >>> not represent what I am seeing so a lot of snapping going on if I apply >>> animations before the previous one is finished. If I only use the >>> CAAnimationGroup as a glorified array and apply all animations >>> individually >>> then all my animations are applied correctly. So I think this is my >>> solution. I do find it strange that I had to resort to this (writing my >>> own >>> AnimationGroup!), and this behavior is not built in. Thanks for all the >>> tips >>> and help. >>> >>> (P.S. this assumes that all the animations in the CAAnimationGroup are >>> CABasicAnimations). >>> >>> >>> void applyBasicAnimation(CALayer *layer, CABasicAnimation *animation, >>> BOOL >>> bApply) { >>> animation.fromValue = >>> [layer.presentationLayer valueForKeyPath:animation.keyPath]; >>> animation.removedOnCompletion = NO; >>> animation.fillMode = >>> kCAFillModeBoth; >>> NSLog(@"applyBasicAnimation forLayer:%@ key:%@ currentValue:%@", >>> layer.name, animation.keyPath, animation.fromValue); >>> if(bApply) [layer addAnimation:animation forKey:animation.keyPath]; >>> } >>> >>> void applyAnimationGroup(CALayer *layer, CAAnimationGroup >>> *animationGroup, >>> NSString* key, BOOL bApplyIndividually) { >>> animationGroup.removedOnCompletion = NO; >>> animationGroup.fillMode = kCAFillModeBoth; >>> for(id animation in animationGroup.animations) >>> applyBasicAnimation(layer, animation, bApplyIndividually); >>> if(!bApplyIndividually) [layer addAnimation:animationGroup >>> forKey:key]; >>> } >>> >>> >>> On 19 Mar 2009, at 18:07, Matt Long wrote: >>> >>>> I'll address the issue with the animation ignoring your duration first. >>>> Try placing your addAnimation call before the setValue:forKeyPath. Let >>>> me >>>> know if that works. Also, you will *need* to specify a fromValue in your >>>> animation. If you want the current value (in the case where an animation >>>> is >>>> already running), get it from the presentationLayer, e.g. [[layer >>>> presentationLayer] valueForKeyPath@"transform.scale"]; This is the >>>> "in-flight" value. >>>> >>>> Now let me try to clarify what I mean with the derived layer. Say you've >>>> declared a layer called RolloverLayer that inherits from CALayer. >>>> Calling >>>> animationForKey will return the default animation for the keyPath you >>>> specify in the key. If you override it, *you* determine what animation >>>> to >>>> use. It would look something like this: >>>> >>>> - (CAAnimation *)animationForKey:(NSString *)key >>>> { >>>> if ([key isEqualToString:@"transform.scale"] )
Re: - (IBAction) executes normally, but then crushes.
There is no manual except a descent knoledge of assembly when you program You are trying to write at freed address On 3/19/09, Тимофей Даньшин wrote: > Hello again. > > Here is what is says in the debugger: > > 0 objc_msgSend > 1 NSPopAutoReleasePool > 2 -[NSApplication run] > 3 NSApplicationMain > 4 main > > Here is the stacktrace with the 0th line selected. > > > 0x91edd670 <+> mov0x8(%esp),%ecx > 0x91edd674 <+0004> mov0x4(%esp),%eax > 0x91edd678 <+0008> cmp$0xfffeb010,%ecx > 0x91edd67e <+0014> je 0x91edd6fb > 0x91edd680 <+0016> test %eax,%eax > 0x91edd682 <+0018> je 0x91edd6e0 > 0x91edd684 <+0020> mov0x0(%eax),%edx > 0x91edd687 <+0023> push %edi > >>> 0x91edd688 <+0024> mov0x20(%edx),%edi // The line with the > red arrow > 0x91edd68b <+0027> push %esi > 0x91edd68c <+0028> mov0x0(%edi),%esi > 0x91edd68f <+0031> lea0x8(%edi),%edi > 0x91edd692 <+0034> mov%ecx,%edx > 0x91edd694 <+0036> shr$0x2,%edx > 0x91edd697 <+0039> and%esi,%edx > 0x91edd699 <+0041> mov(%edi,%edx,4),%eax > > By the way, are there any manuals on reading these stacktraces? > > > On Mar 20, 2009, at 1:36 AM, Shawn Erickson wrote: > >> 2009/3/19 Тимофей Даньшин : >> >>> 2009-03-19 23:47:28.204 Untitled[16510:10b] The splitString is 'dra' >>> >>> [Session started at 2009-03-19 23:47:28 +0300.] >>> 2009-03-19 23:47:28.207 Untitled[16510:10b] The splitString is 'raw' >>> 2009-03-19 23:47:28.211 Untitled[16510:10b] The splitString is 'aw.' >>> 2009-03-19 23:47:28.214 Untitled[16510:10b] Finished Adding to DB; >>> Loading program into debugger... >>> GNU gdb 6.3.50-20050815 (Apple version gdb-962) (Sat Jul 26 >>> 08:14:40 UTC >>> 2008) >>> >>> What can possibly go wrong there? >> >> Can you outline how it crashed? The backtrace for the thread that >> crashed, the type of crash, etc. >> >> If you use the debugger you should be able to tell the code pathway >> involved in the crash... (likely best to launch the application in the >> debugger and then cause the failure you are seeing). >> >> -Shawn > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com > > This email sent to openspec...@gmail.com > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: problems with CAAnimation - SOLVED (kinda)
you should really create a html page and play for instance with jQuery to understand how those mechanisms/API have been designed, and when you will understand what you are doing you will welcome to come again Cheers! On Thu, Mar 19, 2009 at 3:26 PM, Memo Akten wrote: > Hi Matt, thanks for lengthy reply. At this point, I"ve only tried the first > part, and I cannot get it to use the time I'm supplying in the animation, > basically its just doing an implicit animation not explicit. It doesn't > matter whether I setValue before or after the addAnimation. > > Actually I ended up writing the generic code below. If I apply the > CAAnimationGroup as a group (i.e. bApplyIndividually = NO), then it doesn't > work at all for some reason, the values from the layer.presentationLayer do > not represent what I am seeing so a lot of snapping going on if I apply > animations before the previous one is finished. If I only use the > CAAnimationGroup as a glorified array and apply all animations individually > then all my animations are applied correctly. So I think this is my > solution. I do find it strange that I had to resort to this (writing my own > AnimationGroup!), and this behavior is not built in. Thanks for all the tips > and help. > > (P.S. this assumes that all the animations in the CAAnimationGroup are > CABasicAnimations). > > > void applyBasicAnimation(CALayer *layer, CABasicAnimation *animation, BOOL > bApply) { > animation.fromValue = > [layer.presentationLayer valueForKeyPath:animation.keyPath]; > animation.removedOnCompletion = NO; > animation.fillMode = > kCAFillModeBoth; > NSLog(@"applyBasicAnimation forLayer:%@ key:%@ currentValue:%@", > layer.name, animation.keyPath, animation.fromValue); > if(bApply) [layer addAnimation:animation forKey:animation.keyPath]; > } > > void applyAnimationGroup(CALayer *layer, CAAnimationGroup *animationGroup, > NSString* key, BOOL bApplyIndividually) { > animationGroup.removedOnCompletion = NO; > animationGroup.fillMode = kCAFillModeBoth; > for(id animation in animationGroup.animations) > applyBasicAnimation(layer, animation, bApplyIndividually); > if(!bApplyIndividually) [layer addAnimation:animationGroup > forKey:key]; > } > > > On 19 Mar 2009, at 18:07, Matt Long wrote: > >> I'll address the issue with the animation ignoring your duration first. >> Try placing your addAnimation call before the setValue:forKeyPath. Let me >> know if that works. Also, you will *need* to specify a fromValue in your >> animation. If you want the current value (in the case where an animation is >> already running), get it from the presentationLayer, e.g. [[layer >> presentationLayer] valueForKeyPath@"transform.scale"]; This is the >> "in-flight" value. >> >> Now let me try to clarify what I mean with the derived layer. Say you've >> declared a layer called RolloverLayer that inherits from CALayer. Calling >> animationForKey will return the default animation for the keyPath you >> specify in the key. If you override it, *you* determine what animation to >> use. It would look something like this: >> >> - (CAAnimation *)animationForKey:(NSString *)key >> { >> if ([key isEqualToString:@"transform.scale"] ) >> { >> CABasicAnimation *growAnimation = [[CABasicAnimation >> animationWithKeyPath:@"transform.scale"] retain]; >> growAnimation.duration = 5; // very slow >> // Need from value here >> growAnimation.fromValue = [[self presentationLayer] >> valueForKeyPath:@"transform.scale"]; >> growAnimation.toValue = [[[CardManager instance] config] >> objectForKey:@"cardHoverScale"]; >> growAnimation.timingFunction = [CAMediaTimingFunction >> functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; >> return growAnimation; >> } >> else if ([key isEqualToString:@"position"]) >> { >> CABasicAnimation *postiionAnimation = [CABasicAnimation >> animationWithKeyPath:@"position"]; >> positionAnimation.fromValue = [[self presentationLayer] position]; >> positionAnimation.toValue = // etc... >> >> } >> // . >> else >> { >> return [super animationForKey:key]; >> } >> } >> >> Now, when you have one of your derived layers in use, you can do this: >> >> // Assuming it's tied to a button or something >> - (IBAction)animate:(id)sender >> { >> // rolloverLayer is a RolloverLayer ivar >> [rolloverLayer setValue:[[[CardManager instance] config] >> objectForKey:@"cardHoverScale"] forKeyPath:@"transform.scale"]; >> [rolloverLayer setPosition:CGPointMake(x,y)]; >> // etc. >> } >> >> Your overridden animationForKey will get called to get the proper >> animation. >> >> HTH, >> >> -Matt >> >> p.s. if you want to know when an animation has completed, set the layer's >> delegate to your app delegate and then implement - >> (void)a
Re: any recommended zip framework ?
if this is xml plain/text if this is bin application/octet-stream On Thu, Mar 19, 2009 at 3:02 PM, Mike Abdullah wrote: > Your problem there is that plist is Apple's semi-proprietary format. I'm > pretty certain no standard MIME type exists. You could make up your own in > accordance with the MIME type rules though. > > On 19 Mar 2009, at 16:48, Sandeep Chayapathi wrote: > >> one more related question - does anyone the mime-type for plists/binary >> plists ? Currently I have setup the mime type for my plist files as >> text/plain. >> -- Sandeep >> >> >> On Mon, Mar 16, 2009 at 10:05 PM, Sandeep Chayapathi >> wrote: >> >>> spot on - thanks for the suggestion. I guess I have a bit of Rube >>> Goldberg >>> (http://en.wikipedia.org/wiki/Rube_Goldberg) in me. >>> -- Sandeep >>> >>> >>> >>> On Mon, Mar 16, 2009 at 6:18 PM, Mike Abdullah >>> wrote: >>> If you are in control of these zip files, why not make use of HTTP's built in support for delivering compressed content? I believe NSURLConnection will handle this transparently. On 16 Mar 2009, at 20:42, Sandeep Chayapathi wrote: Hi all, > > Im looking for a framework to unzip a given file (either as a NSData or > as > a file path). I have search cocoa-dev mailing, so far I have come > across > this framework: http://code.google.com/p/zip-framework/ and one example > that > calls 'unzip' in the background. Can you recommend a good framework to > handle (mainly unzip) zip files ? > > Note: this is for an iphone app. Im planning to zip files on a network > and > let the app download and extract the content - is this a good idea ? > any > suggestion is appreciated. > > -- Sandeep > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > 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/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/openspecies%40gmail.com > > This email sent to openspec...@gmail.com > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
NSLog broken after call of NSTask and setStandardError
Hi all, this is an old message I know, but I run into the same issue, the successive answers were wrong: this is definitely a Debugger issue, this is only happens in a gdb session, the debugguer doesn't forward sighandlers then the StandardOutput is not restored, and if you run an another task just behind the first one and stop it, you will close the current StandardOutput and get a crash when ibtool is trying to log 3/19/09 10:23:17 AM ibtool[20817] *** Terminating app due to uncaught exception 'NSFileHandleOperationException', reason: '*** -[NSConcreteFileHandle writeData:]: Broken pipe' this condition is easily reproducible. Cheers! -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: !foo vs foo == nil
great alignement On Wed, Aug 20, 2008 at 8:32 PM, Clark Cox <[EMAIL PROTECTED]> wrote: > On Wed, Aug 20, 2008 at 8:06 PM, Michael Ash <[EMAIL PROTECTED]> wrote: >> On Wed, Aug 20, 2008 at 8:34 PM, Douglas Davidson <[EMAIL PROTECTED]> wrote: >>> Well, after all, zero is zero, how much difference can it make? Quite a >>> bit, as it turns out, since in 64-bit one of them is four bytes of zero, and >>> the other is eight bytes of zero. If you're just comparing against NULL, it >>> doesn't matter, but if you're using it in something where size counts--say, >>> a list of vararg arguments--then it matters a lot. It's not easy to debug, >>> though, because who would think that you need to distinguish one NULL from >>> another? >> >> It is a little known fact that when passing NULL (and by extension nil >> or Nil) as a parameter to a vararg function, you *must* cast it to the >> appropriate pointer type to guarantee correct behavior. >> >> Interestingly, Apple's vararg methods which use nil as a terminator >> (such as dictionaryWithObjectsAndKeys:) make no mention of this in >> their documentation, and have a great deal of officially sanctioned >> sample code which doesn't use such a cast. (And none of my code uses >> it either.) I suppose Apple must be implicitly making a stronger >> guarantee about the pointer-ness of nil than the C language makes >> about NULL. > > GCC does that for you (i.e. the NULL defined by GCC is already typed > to a pointer): > > [EMAIL PROTECTED]:~]% cat test.c > #include > > int main() { > > printf("sizeof(NULL) == %zu\n", sizeof(NULL)); > return 0; > } > [EMAIL PROTECTED]:~]% cc test.c -arch i386 && ./a.out > sizeof(NULL) == 4 > [EMAIL PROTECTED]:~]% cc test.c -arch x86_64 && ./a.out > sizeof(NULL) == 8 > > -- > Clark S. Cox III > [EMAIL PROTECTED] > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com > > This email sent to [EMAIL PROTECTED] > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: !foo vs foo == nil
please, don't truncate my answer... especially * On Wed, Aug 20, 2008 at 8:27 PM, Clark Cox <[EMAIL PROTECTED]> wrote: > On Wed, Aug 20, 2008 at 7:44 PM, mm w <[EMAIL PROTECTED]> wrote: >> NULL does not have to be 0, 0 could be a valid pointer value > > This is not true, the C standard guarantees that 0, converted to any > pointer type is a NULL pointer constant. It is not possible to convert > 0 to a non-NULL pointer. > > -- > Clark S. Cox III > [EMAIL PROTECTED] > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: !foo vs foo == nil
Using NULL would make your code easier to read, setting a variable to NULL makes it obvious that a variable is a pointer, at least in C, NULL does not have to be 0, 0 could be a valid pointer value*, and NULL some other invalid value, many people got in the habit of writing if (!foo) sure the compiler will automagically convert 0 in a pointer context to an invalid pointer value, plus preprocessor turns NULL back into 0 which is then recognized by the it using NULL or nil (ObjC) is the recommended way, when referring to a pointer for the tip an uninitialized variable is not really nothing On Wed, Aug 20, 2008 at 6:50 PM, Quincey Morris <[EMAIL PROTECTED]> wrote: > On Aug 20, 2008, at 18:15, mm w wrote: > >> as a previous oppenant said yeh dude it's normal it's undefined/ nothin >> nada :) >> >> int main(void) {g >> char *p1; >> char *p2 = NULL; >> >> if(!p1) >>puts("hello p1"); >> >> if(!p2) >>puts("hello p2"); >> >> return 0; >> } >> >> output "hello p2" > > I not sure of the state of computer science on planet Neptune, but here on > Earth we pretty much grasped the concept of an uninitialized variable about > 50 years ago. > > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com > > This email sent to [EMAIL PROTECTED] > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: !foo vs foo == nil
anyway I m going to add a hint as a previous oppenant said yeh dude it's normal it's undefined/ nothin nada :) int main(void) {g char *p1; char *p2 = NULL; if(!p1) puts("hello p1"); if(!p2) puts("hello p2"); return 0; } output "hello p2" On Wed, Aug 20, 2008 at 6:00 PM, mm w <[EMAIL PROTECTED]> wrote: > ok Im like a puppy I like to play, I will stop to play the evil > advogate for 98% of cases > > here my late Initialization: > we can say (!toto) is the same of toto == NULL > > but the Douglas pointed something really interesting... let see ahead > > > > > On Wed, Aug 20, 2008 at 5:39 PM, Andrew Merenbach > <[EMAIL PROTECTED]> wrote: >> With all due respect, this seems a little more confusing than enlightening. >> Alignment has little to do with the question, as far as I can see. Would >> you be so kind as to explain what bearing your answer has on the original >> poster's question? >> >> -- Andrew >> >> On Aug 20, 2008, at 3:29 PM, mm w wrote: >> >>> #include >>> #include >>> >>> int main(void) { >>> char *p1; >>> char *p2 = NULL; >>> >>> free(p1); >>> >>> free(p2); >>> >>> return 0; >>> } >>> >>> if (toto)... just align your answer >>> >>> On Wed, Aug 20, 2008 at 3:23 PM, Torsten Curdt <[EMAIL PROTECTED]> wrote: >>>> >>>> This question has come up during the last CocoaHeads and no one was >>>> really >>>> able to give a definite answer. >>>> Do both expressions really mean the same thing (as nil is not null)? >>>> >>>> if (!foo) { >>>> ... >>>> } >>>> >>>> if (foo == nil) { >>>> ... >>>> } >>>> >>>> cheers >>>> -- >>>> Torsten >>>> ___ >>>> >>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >>>> >>>> Please do not post admin requests or moderator comments to the list. >>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >>>> >>>> Help/Unsubscribe/Update your Subscription: >>>> http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com >>>> >>>> This email sent to [EMAIL PROTECTED] >>>> >>> >>> >>> >>> -- >>> -mmw >>> ___ >>> >>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >>> >>> Please do not post admin requests or moderator comments to the list. >>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >>> >>> Help/Unsubscribe/Update your Subscription: >>> >>> http://lists.apple.com/mailman/options/cocoa-dev/andrew.merenbach%40ucla.edu >>> >>> This email sent to [EMAIL PROTECTED] >> >> >> ___ >> >> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >> >> Please do not post admin requests or moderator comments to the list. >> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >> >> Help/Unsubscribe/Update your Subscription: >> http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com >> >> This email sent to [EMAIL PROTECTED] >> > > > > -- > -mmw > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: !foo vs foo == nil
ok Im like a puppy I like to play, I will stop to play the evil advogate for 98% of cases here my late Initialization: we can say (!toto) is the same of toto == NULL but the Douglas pointed something really interesting... let see ahead On Wed, Aug 20, 2008 at 5:39 PM, Andrew Merenbach <[EMAIL PROTECTED]> wrote: > With all due respect, this seems a little more confusing than enlightening. > Alignment has little to do with the question, as far as I can see. Would > you be so kind as to explain what bearing your answer has on the original > poster's question? > > -- Andrew > > On Aug 20, 2008, at 3:29 PM, mm w wrote: > >> #include >> #include >> >> int main(void) { >> char *p1; >> char *p2 = NULL; >> >> free(p1); >> >> free(p2); >> >> return 0; >> } >> >> if (toto)... just align your answer >> >> On Wed, Aug 20, 2008 at 3:23 PM, Torsten Curdt <[EMAIL PROTECTED]> wrote: >>> >>> This question has come up during the last CocoaHeads and no one was >>> really >>> able to give a definite answer. >>> Do both expressions really mean the same thing (as nil is not null)? >>> >>> if (!foo) { >>> ... >>> } >>> >>> if (foo == nil) { >>> ... >>> } >>> >>> cheers >>> -- >>> Torsten >>> ___ >>> >>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >>> >>> Please do not post admin requests or moderator comments to the list. >>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >>> >>> Help/Unsubscribe/Update your Subscription: >>> http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com >>> >>> This email sent to [EMAIL PROTECTED] >>> >> >> >> >> -- >> -mmw >> ___ >> >> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >> >> Please do not post admin requests or moderator comments to the list. >> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >> >> Help/Unsubscribe/Update your Subscription: >> >> http://lists.apple.com/mailman/options/cocoa-dev/andrew.merenbach%40ucla.edu >> >> This email sent to [EMAIL PROTECTED] > > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com > > This email sent to [EMAIL PROTECTED] > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: !foo vs foo == nil
foo = -1 On Wed, Aug 20, 2008 at 5:19 PM, Clark Cox <[EMAIL PROTECTED]> wrote: > On Wed, Aug 20, 2008 at 5:07 PM, mm w <[EMAIL PROTECTED]> wrote: >> as Mike and me pointed NULL === NULL >> but Im yet not alright with >> >> (!foo) === if(foo == nil) > > if(!foo) and if(foo == nil) are 100% identical as far as the language > is concerned. Trust me. > >> >> as I sent previously > > How is this related to your question? > >> #include >> #include >> >> int main(void) { >> char *p1; > > p1 is uninitialized, and has an indeterminate value... > >> char *p2 = NULL; >> >> free(p1); > > ... so this free call is undefined behavior (and will likely crash) > >> >> free(p2); >> >> return 0; >> } > > -- > Clark S. Cox III > [EMAIL PROTECTED] > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: !foo vs foo == nil
as Mike and me pointed NULL === NULL but Im yet not alright with (!foo) === if(foo == nil) as I sent previously #include #include int main(void) { char *p1; char *p2 = NULL; free(p1); free(p2); return 0; } On Wed, Aug 20, 2008 at 4:57 PM, Michael Ash <[EMAIL PROTECTED]> wrote: > On Wed, Aug 20, 2008 at 7:15 PM, Torsten Curdt <[EMAIL PROTECTED]> wrote: >> I guess my questions wasn't phrased correctly. The point was more: is 'nil' >> really the equivalent of 0 or NULL. >> >> There was a common perception that NULL is not really the same as nil. But >> seems like in the end it really is (void*)0. > > As always, it's helpful to follow the rabbit down his hole and see > where he goes. > > On stddef:403 we find this: > > #define NULL ((void *)0) > > So that's what NULL really is, at least on my system. Now, on > objc/objc.h:57 we find this: > > #define nil __DARWIN_NULL /* id of Nil instance */ > > Well, we have to follow that a bit further. But here we are, on > sys/_types.h:91: > > #define __DARWIN_NULL ((void *)0) > > So not only are NULL and nil equivalent, they are the *same thing*. > > (Now, they don't have to be. As I recall, NULL can just be a plain > integer 0 as well. But they do have to be equivalent, and it just so > happens that they are identical even though they don't need to be.) > > Now, that's not to say that they're semantically equivalent. NULL is > meant to be any pointer type, whereas nil is meant to be for objects > only (and Nil, capital N, is meant to be for the Class type). So it's > best to keep that separation in your code to better indicate what's > truly going on. After all, that's why nil (and Nil) exist at all, > rather than just reusing NULL. But in the end they are ultimately the > same. > > 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/openspecies%40gmail.com > > This email sent to [EMAIL PROTECTED] > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: !foo vs foo == nil
#define __DARWIN_NULL ((void *)0) #define nil __DARWIN_NULL typedef struct objc_object { Class isa; } *id; typedef id (*IMP)(id, SEL, ...); id is a pointer you just demonstrated that 1 = 1 On Wed, Aug 20, 2008 at 4:42 PM, Jim Puls <[EMAIL PROTECTED]> wrote: >>> Just try it out in a small project... >>> >>> Keep in mind that Objective-C is the same as C, and C only checks for >>> numbers within the if() statement... >>> 0 = false, 1 or more = true... >>> >>> nil = 0 so, they mean the same thing... >> >> I guess my questions wasn't phrased correctly. The point was more: is >> 'nil' really the equivalent of 0 or NULL. >> >> There was a common perception that NULL is not really the same as nil. But >> seems like in the end it really is (void*)0. >> >> http://cocoawithlove.com/2008/06/doing-things-in-cocoa-with.html > > NULL is (void *)0. > nil is (id)0. > > Use one for generic pointers and the other for objects to keep your mind > sane. > > -> jp > > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com > > This email sent to [EMAIL PROTECTED] > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: !foo vs foo == nil
and especially for someone who's developing in Java On Wed, Aug 20, 2008 at 4:15 PM, Torsten Curdt <[EMAIL PROTECTED]> wrote: > > On Aug 21, 2008, at 00:30, Filip van der Meeren wrote: > >> On 21 Aug 2008, at 00:23, Torsten Curdt wrote: >> >>> This question has come up during the last CocoaHeads and no one was >>> really able to give a definite answer. >>> Do both expressions really mean the same thing (as nil is not null)? >>> >>> if (!foo) { >>> ... >>> } >>> >>> if (foo == nil) { >>> ... >>> } >>> >> >> Just try it out in a small project... >> >> Keep in mind that Objective-C is the same as C, and C only checks for >> numbers within the if() statement... >> 0 = false, 1 or more = true... >> >> nil = 0 so, they mean the same thing... > > I guess my questions wasn't phrased correctly. The point was more: is 'nil' > really the equivalent of 0 or NULL. > > There was a common perception that NULL is not really the same as nil. But > seems like in the end it really is (void*)0. > > http://cocoawithlove.com/2008/06/doing-things-in-cocoa-with.html > > cheers > -- > Torsten > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com > > This email sent to [EMAIL PROTECTED] > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: !foo vs foo == nil
hum (void *)0 is equal to 0 interesting... type *ptr != type *ptr= NULL you should also align your knowledge you failed, you are a lazy pointer On Wed, Aug 20, 2008 at 4:15 PM, Torsten Curdt <[EMAIL PROTECTED]> wrote: > > On Aug 21, 2008, at 00:30, Filip van der Meeren wrote: > >> On 21 Aug 2008, at 00:23, Torsten Curdt wrote: >> >>> This question has come up during the last CocoaHeads and no one was >>> really able to give a definite answer. >>> Do both expressions really mean the same thing (as nil is not null)? >>> >>> if (!foo) { >>> ... >>> } >>> >>> if (foo == nil) { >>> ... >>> } >>> >> >> Just try it out in a small project... >> >> Keep in mind that Objective-C is the same as C, and C only checks for >> numbers within the if() statement... >> 0 = false, 1 or more = true... >> >> nil = 0 so, they mean the same thing... > > I guess my questions wasn't phrased correctly. The point was more: is 'nil' > really the equivalent of 0 or NULL. > > There was a common perception that NULL is not really the same as nil. But > seems like in the end it really is (void*)0. > > http://cocoawithlove.com/2008/06/doing-things-in-cocoa-with.html > > cheers > -- > Torsten > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com > > This email sent to [EMAIL PROTECTED] > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: !foo vs foo == nil
On Wed, Aug 20, 2008 at 3:32 PM, David Duncan <[EMAIL PROTECTED]> wrote: > On Aug 20, 2008, at 3:23 PM, Torsten Curdt wrote: > >> This question has come up during the last CocoaHeads and no one was really >> able to give a definite answer. >> Do both expressions really mean the same thing (as nil is not null)? > > > nil == 0. 0 is false, !0 is true. 0 == 0 is true. Therefore they are > equivalent :). no you failed, you are a lazy pointer :D > -- > 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/openspecies%40gmail.com > > This email sent to [EMAIL PROTECTED] > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: !foo vs foo == nil
#include #include int main(void) { char *p1; char *p2 = NULL; free(p1); free(p2); return 0; } if (toto)... just align your answer On Wed, Aug 20, 2008 at 3:23 PM, Torsten Curdt <[EMAIL PROTECTED]> wrote: > This question has come up during the last CocoaHeads and no one was really > able to give a definite answer. > Do both expressions really mean the same thing (as nil is not null)? > > if (!foo) { > ... > } > > if (foo == nil) { > ... > } > > cheers > -- > Torsten > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com > > This email sent to [EMAIL PROTECTED] > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Parse form values from HTTP POST
http://developer.apple.com/samplecode/CocoaSOAP/listing7.html On Wed, Aug 20, 2008 at 1:54 PM, Jesse Grosjean <[EMAIL PROTECTED]> wrote: > Does anyone know what the best way to parse form values from and HTTP Post > is? > > I have a mini HTTP server in my app, and it needs to accept posts. I'm using > CFHTTP to implement the server, so I have a CFHTTPMessageRef. I'm trying to > figure out how to turn that into a dictionary of keys and values. Is there > an API that can do this, or any example code around? > > Thanks for any help. > > Jesse > > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com > > This email sent to [EMAIL PROTECTED] > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Calling an object from a C function
hi charlie give your code or something clearer what are you trying to do? a C object runtime? or a wrapper obj-c to C? (kidding) maybe you could have the right answers, when I read you, my feelings is that you don't go in the right direction On Tue, Aug 19, 2008 at 5:06 PM, Charlie Dickman <[EMAIL PROTECTED]> wrote: > Thanks to all who responded. I must have had a mental block against this. > > Now, how do I define things like 'self' and 'super' to a C program? > > On Aug 19, 2008, at 7:38 PM, David Duncan wrote: > >> On Aug 19, 2008, at 4:28 PM, Charlie Dickman wrote: >> >>> from within a C (not Objective C) function and make use of the result? >>> >>> In Objective C I would invoke >>> >>> [myObject myMethod: myInt]; >> >> >> You invoke it exactly the same way. There is no difference. But you need >> to compile as Obj-C. >> >> int foo(id bar) { [bar foobaz]; } >> -- >> David Duncan >> Apple DTS Animation and Printing >> > > Charlie Dickman > [EMAIL PROTECTED] > > > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com > > This email sent to [EMAIL PROTECTED] > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Calling an object from a C function
did you mean: (im not sure to understand your problem) ???!!! #import int foo(int a, int b) { return (a + b); } @interface myObject: NSObject -(SInt32)aIntegertFunction:(SInt32)a plus:(SInt32)b; @end @implementation myObject -(SInt32)aIntegertFunction:(SInt32)a plus:(SInt32)b { return foo(a,b); } @end int main ( int argc, const char * argv[]) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; myObject *obj = [[myObject alloc] init]; NSLog(@" %i", [obj aIntegertFunction:10 plus:10]); [obj release]; [pool drain]; return 0; } On Tue, Aug 19, 2008 at 4:38 PM, David Duncan <[EMAIL PROTECTED]> wrote: > On Aug 19, 2008, at 4:28 PM, Charlie Dickman wrote: > >> from within a C (not Objective C) function and make use of the result? >> >> In Objective C I would invoke >> >> [myObject myMethod: myInt]; > > > You invoke it exactly the same way. There is no difference. But you need to > compile as Obj-C. > > int foo(id bar) { [bar foobaz]; } > -- > 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/openspecies%40gmail.com > > This email sent to [EMAIL PROTECTED] > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Including frameworks in your app bundle
example FRAMEWORK = MyFoo PREFIX = @executable_path/../Frameworks gcc -Wl,-single_module \ $(OBJS) \ $(LDFLAGS) \ -compatibility_version 1.0.0 \ -current_version 1.0.0 \ -install_name $(PREFIX)/$(FRAMEWORK).framework/Versions/$(VERSION)/$(FRAMEWORK) \ -dynamiclib \ -o $(FRAMEWORK) export your -F path and link your executable against the framework, you can also deploy OS libs / home ecetera On Mon, Aug 18, 2008 at 4:59 PM, Nick Pilch <[EMAIL PROTECTED]> wrote: > I've been searching, but I can't find the documentation explaining how to > include frameworks in your app bundle (third-party frameworks, for example), > so that your user does not have to install these frameworks. Could someone > point me at the correct documentation/build settings? Thanks. > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com > > This email sent to [EMAIL PROTECTED] > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Using Flex/Lex in a Cocoa project
if you knew flex you could understand On Mon, Aug 18, 2008 at 1:55 PM, Ricky Sharp <[EMAIL PROTECTED]> wrote: > > On Aug 18, 2008, at 3:40 PM, mm w wrote: > >> to avoid the splitting problem >> >> (c < 128) ? "%c" : "\\u%04x", c); > > I'm not sure what this solves. > > Per Michael's e-mail below, this is indeed a difficult problem. UTF-8 is > just a particular scheme to store Unicode strings. Operating on individual > bytes in such streams will most likely not make any sense. > > What I would do is pick some normalized form and operate on that data. For > a recent feature at my day job, we normalized all input CSV files to > UTF-16BE. We were able to handle all of our customer data so far. The > final solution still isn't 100% Unicode-savvy (e.g. it does crap-out with > surrogate pairs), but we have unit tests to expose/document such > limitations. And, customer data doesn't yet have such things. > > >> On Sat, Aug 16, 2008 at 7:43 AM, Michael Ash <[EMAIL PROTECTED]> >> wrote: >>> >>> - It's very difficult to split UTF-8 strings correctly. If you >>> encounter a run of non-ASCII characters, ensure that you follow that >>> run through the end, until you get back to ASCII. Don't have a regex >>> that stops in the middle of it and then expects your code to be able >>> to do something useful with it. >>> > > ___ > Ricky A. Sharp mailto:[EMAIL PROTECTED] > Instant Interactive(tm) http://www.instantinteractive.com > > > > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Using Flex/Lex in a Cocoa project
to avoid the splitting problem (c < 128) ? "%c" : "\\u%04x", c); On Sat, Aug 16, 2008 at 7:43 AM, Michael Ash <[EMAIL PROTECTED]> wrote: > On Fri, Aug 15, 2008 at 10:53 PM, John Joyce > <[EMAIL PROTECTED]> wrote: >> Right now, I'm toying with using Flex/Lex in a Cocoa project. >> Unfortunately, I don't see a reliable or easy way to handle NSStrings >> correctly all the time with Flex. >> Does anybody have any suggestions for such text handling and reliable >> unicode aware regexes? >> I'm seriously not interested in implementing such details in C with Flex. >> Flex is fast and cool for that, but if it's going to be stupidly difficult >> to use reliably with other languages on a mac, it's not a good idea for me. > > Depending on exactly what you need, unicode awareness can be fairly > straightforward. > > Commonly, unicode in regexes is only needed to pass through > undifferentiated blobs of text, with ASCII delimiters. For example, > imagine parsing a CSV file which potentially has unicode text inside > the quotes. For this case, you can convert the file to UTF-8, and then > constructs like . will accept them. All non-ASCII characters in UTF-8 > are represented as bytes 128-255, so if you just pass those through > then you'll be fine. But be aware of some potential problem areas: > > - Each non-ASCII character will be more than one byte, and flex will > think of it as more than one character. Write your regexes > accordingly. In particular, avoid length limits on runs of arbitrary > characters, and avoid using non-ASCII characters directly in your > regex. > > - It's very difficult to split UTF-8 strings correctly. If you > encounter a run of non-ASCII characters, ensure that you follow that > run through the end, until you get back to ASCII. Don't have a regex > that stops in the middle of it and then expects your code to be able > to do something useful with it. > > - If you need to do something with non-ASCII characters besides read > them in one side and write them out the other, for example doing > something special with all accented characters, then Flex is probably > not the right answer. > > Besides this it ought to be pretty straightforward. Since Flex just > passes your code straight through to the compiler, you can write > Objective-C in the actions (as long as you compile the result as > Objective-C, of course!), convert the text from UTF-8 back to an > NSString, and take things from there. > > 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/openspecies%40gmail.com > > This email sent to [EMAIL PROTECTED] > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Should I retain a variable returned from this accessor?
no as far as possible, you shouldn't retain an accessor, you are not the owner of this accessor the accessor is owned by an the his object, you are the owner of an instance of one object when you create it for an example myobject { private dict; } string title(); ... string title() { return dict['title']; } obj = new myobject(); obj->title(); it's a non-sense if you retain and release it, in certain case you could copy an accessor returned value this is not a particular cocoa thing Cheers! On Tue, Aug 12, 2008 at 2:01 PM, has <[EMAIL PROTECTED]> wrote: > Peter N Lewis wrote: > >> I'm no Cocoa expert, but I think you're wrong on this, you've missed >> out a crucial line: >> >> At 3:12 PM -0400 11/8/08, Sean DeNigris wrote: >>> >>>// Get uid to return >>>NSString* todoUid = [newTodo uid]; >>> >>>// Clean up >>>[newTodo release]; >>>newTodo = nil; >>> >>>return todoUid; >> >> [newTodo release] is not [newTodo autorelease]. So it may >> immediately call dealloc and dealloc the uid returned by by [newTodo >> uid]. > > I don't think so. > > The problem here is that you're thinking about Scripting Bridge in > conventional Cocoa/proxy object terms. This is understandable given that > this is the illusion that the SB API is intended to create. *However*, the > thing to realise about Apple event IPC is that it's *RPC plus queries* (a > very un-Cocoa-like beast), and what SB does is plaster over this mechanism > with a load of obfuscations in a well-meaning (but misguided) attempt to > make it look and feel like regular Cocoa (which it isn't, and never will > be). > > For example, the whole: > >iCalTodo* newTodo = [[[iCal classForScriptingClass:@"todo"] alloc] init]; >[[myCalendar todos] addObject:newTodo]; >[newTodo release]; > > rigmarole is just a bunch of pseudo Cocoa-isms on top of a standard 'make' > Apple event, which in AppleScript would appear as: > >tell application "iCal" to make new todo at end of todos > > and in objc-appscript - which, unlike SB, is bluntly honest about what's > going on beneath - as: > >ICCommand *cmd = [[[iCal make] > new: [ICConstant todo]]; > at: [[ICApp todos] end]]; >id result = [cmd send]; > > (I'll spare you the equivalent C though as we'd be here all day.) > > Basically, all that SB is doing in that first line is creating a temporary > SB object representing an application object that doesn't actually exist > yet. This SB object contains one or more values that will be used as > parameters to a 'make' event that will be sent later. (The one parameter > that's always required is 'new'; others may be optional or required > depending on the application implementation, type of object being created, > etc.) > > As soon as you pass this object to -addObject:, a 'make' event containing > those parameters is sent off to the target application to handle. Once > that's done, your original temporary object no longer has any real part to > play; unlike Distributed Objects, there is no permanent two-way connection > where a local object acts as the official proxy for a remote object as long > as both objects remain live. > > > The fact that you can subsequently refer to this temporary object to set and > get properties belonging to iCal's newly created todo object is kinda > incidental. All that's happening here is that SB is stuffing the object > specifier (i.e. query) returned by the 'make' command into your SB object, > and subsequently accessing that object's properties is sending fresh > 'get'/'set' events to the application with that object specifier as their > direct parameter. > > However, even this aspect of SB's behaviour is misleading; for example, some > applications may not return a result for the 'make' event (in which case > you'll be talking to air), and many that do will return a by-index or > by-name reference that is not guaranteed to identify the same application > object the next time you want to talk to it. Also bear in mind that setting > properties after -addObject: is called is not the same as setting them as > part of the 'make' event; for example, read-only properties can often have > values assigned at the time the object is created, but can't be set > afterwards. > > > As for memory management of the NSString returned by [newTodo uid], remember > that it's the product of a 'get' event sent to the target application, and > not something that belongs to or held in an ivar of the SB object that > returned it. All SB does is add the NSString to the current autorelease pool > before returning it, so once that pool is dealloced the NSString will be > disposed of as well unless you -retain it beforehand. > > > Anyway, hope that's of some use, though personally if I were the OP I'd see > about using Leopard's new Calendar Store framework instead, thereby avoiding > the need to muck about with Apple event IPC at all. Users wil
Re: Why won't Gmail cooperate with authentication delegate methods? (Gmail RSS feeds do.)
hi, do you use gdata obj-c client? I think it's a cookie problem, did you ask for an auth basic? On Wed, Aug 13, 2008 at 9:05 AM, Sumner Trammell <[EMAIL PROTECTED]> wrote: > (I realize that this is bordering on a Google API question, but there > is some Cocoa content.) > > > > Hi. One can whip up a WebKit/Cocoa app, aim it at a Gmail URL like this: > > https://www.google.com/accounts/ServiceLoginAuth?continue=http://mail.google.com/gmail&service=mail&Email=YOUR_LOGIN&Passwd=YOUR_PASSWORD&null=Sign+in > > and get automatically logged into her Gmail account. Pretty cool. > > > > > > > > Even cooler, in my opinion, is implementing this delegate method: > > - (void)webView:(WebView *)aSender > resource:(id)anIdentifier > didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)aChallenge > fromDataSource:(WebDataSource *)aDataSource > > (Pages 20-21 of the URL Loading System documentation have the details.) > > So now, when you aim your app at the Gmail RSS feed URL: > > https://mail.google.com/mail/feed/atom > > > you are authenticated automatically as well. > > > > > > > > The second case has me wishing there were a special URL for the first > case that used standard authentication. (And thus would work with > authentication delegate methods.) > > I tried the obvious, https://mail.google.com/mail, and that doesn't > work. I'm still presented with the Gmail login form screen. > > Does anyone know if a special URL exists for Gmail that uses standard > SSLv3 authentication like the Gmail RSS feed URL does? > > > > > > Thanks, > -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/openspecies%40gmail.com > > This email sent to [EMAIL PROTECTED] > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Accessing memory of another application?
Who liked to spit fire? :D as I said do not use mach primitives, I will not dive into details but it's one of worst advice you got here, spawn + run code into an exception handler do what you want with the result Cheers! On Tue, Aug 12, 2008 at 11:12 AM, Josh <[EMAIL PROTECTED]> wrote: > I've worked with GDB before to debug some console applications on linux > before (half-life gaming server) - but nothing very extensive. > > You know of any GUI tools? > > Also - thanks EVERYONE for your help - this has been very helpful - already > checking out mach_star - looks very promising if I can find some function > offsets in the game. :-) > > On Tue, Aug 12, 2008 at 2:10 PM, David Duncan <[EMAIL PROTECTED]>wrote: > >> On Aug 12, 2008, at 9:04 AM, Josh wrote: >> >> I'm trying to get started w/viewing/editing/interacting with the memory of >>> another running application but I'm not where to get started. You could >>> think of this as being a simple "game trainer" - which basically allows >>> you >>> to view and edit values in memory. >>> >> >> >> Your effectively asking how to create a debugger. If your brave enough to >> delve into the arcane art of doing so, you can try looking at the GDB >> sources, and there might be other ways you can do this too, but there be >> dragons here... >> -- >> 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/openspecies%40gmail.com > > This email sent to [EMAIL PROTECTED] > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Accessing memory of another application?
do not use mach primitives in your case On Tue, Aug 12, 2008 at 10:33 AM, Jean-Daniel Dupas <[EMAIL PROTECTED]> wrote: > > In practice, it's perfectly possible to access other processes memory using > public functions (it require some privileges since 10.4 intel). > But to do it you have to use the low-level mach API and that's off topic > here. > > And no, code injection is not used only by virus. (see > http://rentzsch.com/mach_star/ ) > > > Le 12 août 08 à 19:18, Negm-Awad Amin a écrit : > >> >> Am Di,12.08.2008 um 19:01 schrieb Mike Abdullah: >> >>> You can't do this. Each application runs in its own protected memory. >> >> Sometimes you can do this: >> http://en.wikipedia.org/wiki/Computer_virus >> ;-) >> >> Serious: There are techniques to get acccess to another application memory >> under some circumstances. None of them is related to Cocoa since there is no >> class named NSVirus. >> >> Amin >> >> >>> >>> >>> On 12 Aug 2008, at 17:04, Josh wrote: >>> All, I'm trying to get started w/viewing/editing/interacting with the memory of another running application but I'm not where to get started. You could think of this as being a simple "game trainer" - which basically allows you to view and edit values in memory. Can anyone point me to where I should get started? Function names/examples would be a GREAT help - I haven't had experience with hooking into another application's memory. Thanks ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net This email sent to [EMAIL PROTECTED] >>> >>> ___ >>> >>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >>> >>> Please do not post admin requests or moderator comments to the list. >>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >>> >>> Help/Unsubscribe/Update your Subscription: >>> http://lists.apple.com/mailman/options/cocoa-dev/negm-awad%40cocoading.de >>> >>> This email sent to [EMAIL PROTECTED] >> >> Amin Negm-Awad >> [EMAIL PROTECTED] >> >> >> >> >> ___ >> >> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >> >> Please do not post admin requests or moderator comments to the list. >> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >> >> Help/Unsubscribe/Update your Subscription: >> http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org >> >> This email sent to [EMAIL PROTECTED] >> > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com > > This email sent to [EMAIL PROTECTED] > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Accessing memory of another application?
If you 're developing the both application you can create a layer/IPC system via shm (shared memory) to communicate between your two apps, what you asked is really a newbie question regarding C programming, before trying cocoa and obj-c you should learn the base Cheers On Tue, Aug 12, 2008 at 9:04 AM, Josh <[EMAIL PROTECTED]> wrote: > All, > > I'm trying to get started w/viewing/editing/interacting with the memory of > another running application but I'm not where to get started. You could > think of this as being a simple "game trainer" - which basically allows you > to view and edit values in memory. > > Can anyone point me to where I should get started? Function names/examples > would be a GREAT help - I haven't had experience with hooking into another > application's memory. > > Thanks > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com > > This email sent to [EMAIL PROTECTED] > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: When the getter returns a BOOL, is "is" the preferred prefix?
is or should On Fri, Aug 8, 2008 at 9:15 PM, Ken Thomases <[EMAIL PROTECTED]> wrote: > On Aug 8, 2008, at 10:53 PM, Sumner Trammell wrote: > >> We know that Cocoa strongly suggests using setFoo and foo for setters >> and getters. >> >> Sometimes I see setters and getters using the idiom setFoo and isFoo. >> For example, in NSToolbar, you have setVisible and isVisible. >> >> When the getter returns a BOOL, is "is" the preferred prefix? > > http://developer.apple.com/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingMethods.html#//apple_ref/doc/uid/20001282-1004202-BCIGGFCC > > >> Side question: do KVC and KVO still work when the getter is prefixed with >> "is" ? > > Yes, as I. Savant already pointed out. Moreover, if "is" broke KVC and KVO, > it would be actively discouraged and you probably wouldn't see it in Apple's > classes. > > Cheers, > Ken > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com > > This email sent to [EMAIL PROTECTED] > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Some crash.
Hi let me suggest you the good question: what's actually triggering the -copyWithZone call? On Sat, Aug 2, 2008 at 12:32 PM, Sandro Noel <[EMAIL PROTECTED]> wrote: > I've tried enumerating the objects to the log, with a button on the > interface. > and they are all still in memory, they are not being released. > all the items report. > > anything else ? > > Sandro. > > > On 2-Aug-08, at 2:06 PM, mm w wrote: > >> maybe a retain problem >> >> On Sat, Aug 2, 2008 at 11:03 AM, Sandro Noel <[EMAIL PROTECTED]> wrote: >>> >>> Greetings, >>> >>> I don't quite know how to explain this.. :) so please excuse me if I'm >>> not >>> very precise. >>> >>> In my application controller i have an object "statement" that contains >>> an >>> array of "transactions" called transactions. >>> here is the structure of transaction. >>> @interface OFXTransaction : NSObject { >>> NSString*transactionType; >>> NSDate *datePosted; >>> double transactionAmount; >>> NSString*uniqueID; >>> NSString*displayName; >>> NSString*memo; >>> } >>> @property (readwrite, copy) NSString*transactionType; >>> @property (readwrite, copy) NSDate *datePosted; >>> @property (readwrite, assign) double transactionAmount; >>> @property (readwrite, copy) NSString*uniqueID; >>> @property (readwrite, copy) NSString*displayName; >>> @property (readwrite, copy) NSString*memo; >>> >>> - (void) setStringDatePosted: (NSString *)dateString; >>> @end >>> >>> In interface builder I've set my appController as the Datasource of the >>> tableview, implemented the methods for the table to load data. >>> the array controller is bound to "statement.transactions" as the keypath. >>> the table view is bound to the array controller, and each column is bound >>> to >>> a field in the transaction class. >>> >>> everything seems to be working good, except when i have a value in the >>> transactionAmount property. >>> >>> can anyone enlighten me as for why it breaks ? please :) >>> >>> I get this error. >>> 2008-08-02 13:52:23.411 OFXImport[27702:10b] *** -[OFXTransaction >>> copyWithZone:]: unrecognized selector sent to instance 0xf4fb80 >>> 2008-08-02 13:52:23.412 OFXImport[27702:10b] An uncaught exception was >>> raised >>> 2008-08-02 13:52:23.413 OFXImport[27702:10b] *** -[OFXTransaction >>> copyWithZone:]: unrecognized selector sent to instance 0xf4fb80 >>> 2008-08-02 13:52:23.413 OFXImport[27702:10b] *** Terminating app due to >>> uncaught exception 'NSInvalidArgumentException', reason: '*** >>> -[OFXTransaction copyWithZone:]: unrecognized selector sent to instance >>> 0xf4fb80' >>> 2008-08-02 13:52:23.414 OFXImport[27702:10b] Stack: ( >>> 2417631563, >>> 2425491707, >>> 2417660746, >>> 2417654092, >>> 2417654290, >>> 2519207652, >>> 2519290634, >>> 2519290371, >>> 2519978356, >>> 2519977828, >>> 2519975066, >>> 2519603468, >>> 2519598064, >>> 2520189316, >>> 2520183931, >>> 2520184850, >>> 2520184850, >>> 2520184850, >>> 2520184850, >>> 2520178129, >>> 2520176403, >>> 2520162871, >>> 2519379087, >>> 2519377981, >>> 2520146833, >>> 2520145384, >>> 2520350309, >>> 2519174399, >>> 2519133714, >>> 2519132020, >>> 2519131063, >>> 2519130869, >>> 2519130020 >>> ) >>> >>> >>> >>> ___ >>> >>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >>> >>> Please do not post admin requests or moderator comments to the list. >>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >>> >>> Help/Unsubscribe/Update your Subscription: >>> http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com >>> >>> This email sent to [EMAIL PROTECTED] >>> >> >> >> >> -- >> -mmw > > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: pointers in objective-c?
in a more accurate way: #include long __auto_increment = 0; typedef struct { long *addr; void *value; } Object; Object ObjectNew(void *value) { Object obj; long i = __auto_increment++; obj.addr = &i; obj.value = value; return obj; } int main (void) { Object obj; Object *obj_1; Object *obj_2; int i = 0; char *value = "hello world!"; while (++i < 5) { obj = ObjectNew(value); obj_1 = &obj; obj_2 = obj_1; printf("obj_1.addr = %#x, obj_1.value = %s \n", obj_1->addr, obj_1->value); printf("obj_2.addr = %lo, obj_2.value = %s \n", *(long *)obj_2->addr, obj_2->value); } return 0; } On Sat, Aug 2, 2008 at 9:50 AM, mm w <[EMAIL PROTECTED]> wrote: > Hi I'm sorry, it's not a confusion, it's only a bad knowledge of C, and > "pointers" are not understood, NS and what about CF or every-prefix in the > world > of frameworks gtk_object ... kobject ... > > #include > > long __auto_increment = 0; > > typedef struct { >long *addr; >void *value; > } Object; > > Object ObjectNew(void *value) { >Object obj; >long i = __auto_increment++; > >obj.addr = &i; >obj.value = value; > >return obj; > } > > int main (void) { >Object obj; >Object *obj_1; >Object *obj_2; > >char *value = "hello world!"; >obj = ObjectNew(value); > >obj_1 = &obj; >obj_2 = obj_1; > >printf("obj_1.addr = %x, obj_1.value = %s \n", >obj_1->addr, obj_1->value); > >printf("obj_2.addr = %x, obj_2.value = %s \n", >obj_1->addr, obj_1->value); > >return 0; > } > > On Sat, Aug 2, 2008 at 12:05 AM, Negm-Awad Amin <[EMAIL PROTECTED]> wrote: >> Hi, >> >> Am Fr,01.08.2008 um 22:07 schrieb Giulio Cesare Solaroli: >> >>> On Fri, Aug 1, 2008 at 10:01 PM, Clark Cox <[EMAIL PROTECTED]> wrote: >>>> >>>> On Fri, Aug 1, 2008 at 12:38 PM, Arthur Coleman <[EMAIL PROTECTED]> >>>> wrote: >>>>> >>>>> I hate to be dense, but what about C structs like NSRect? There are >>>>> initialized on the stack aren't they? >>>> >>>> They're C structs, they aren't Objective-C objects. >>> >>> That's very true, but the common NS prefix used by both full obj-c >>> classes and simple C structures may lead to some confusion, mainly for >>> someone learning obj-c and Cocoa. >> >> yup, sometimes people are confused about the NS-prefix. But NS means >> NextStep, so refers to the framework *not* to the type. It is no good idea >> to use hungarian notation in objective-c. >> >> Amin >> >>> >>> >>> Giulio Cesare >>> ___ >>> >>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >>> >>> Please do not post admin requests or moderator comments to the list. >>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >>> >>> Help/Unsubscribe/Update your Subscription: >>> http://lists.apple.com/mailman/options/cocoa-dev/negm-awad%40cocoading.de >>> >>> This email sent to [EMAIL PROTECTED] >> >> Amin Negm-Awad >> [EMAIL PROTECTED] >> >> >> >> >> ___ >> >> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >> >> Please do not post admin requests or moderator comments to the list. >> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >> >> Help/Unsubscribe/Update your Subscription: >> http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com >> >> This email sent to [EMAIL PROTECTED] >> > > > > -- > -mmw > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Some crash.
maybe a retain problem On Sat, Aug 2, 2008 at 11:03 AM, Sandro Noel <[EMAIL PROTECTED]> wrote: > Greetings, > > I don't quite know how to explain this.. :) so please excuse me if I'm not > very precise. > > In my application controller i have an object "statement" that contains an > array of "transactions" called transactions. > here is the structure of transaction. > @interface OFXTransaction : NSObject { >NSString*transactionType; >NSDate *datePosted; >double transactionAmount; >NSString*uniqueID; >NSString*displayName; >NSString*memo; > } > @property (readwrite, copy) NSString*transactionType; > @property (readwrite, copy) NSDate *datePosted; > @property (readwrite, assign) double transactionAmount; > @property (readwrite, copy) NSString*uniqueID; > @property (readwrite, copy) NSString*displayName; > @property (readwrite, copy) NSString*memo; > > - (void) setStringDatePosted: (NSString *)dateString; > @end > > In interface builder I've set my appController as the Datasource of the > tableview, implemented the methods for the table to load data. > the array controller is bound to "statement.transactions" as the keypath. > the table view is bound to the array controller, and each column is bound to > a field in the transaction class. > > everything seems to be working good, except when i have a value in the > transactionAmount property. > > can anyone enlighten me as for why it breaks ? please :) > > I get this error. > 2008-08-02 13:52:23.411 OFXImport[27702:10b] *** -[OFXTransaction > copyWithZone:]: unrecognized selector sent to instance 0xf4fb80 > 2008-08-02 13:52:23.412 OFXImport[27702:10b] An uncaught exception was > raised > 2008-08-02 13:52:23.413 OFXImport[27702:10b] *** -[OFXTransaction > copyWithZone:]: unrecognized selector sent to instance 0xf4fb80 > 2008-08-02 13:52:23.413 OFXImport[27702:10b] *** Terminating app due to > uncaught exception 'NSInvalidArgumentException', reason: '*** > -[OFXTransaction copyWithZone:]: unrecognized selector sent to instance > 0xf4fb80' > 2008-08-02 13:52:23.414 OFXImport[27702:10b] Stack: ( >2417631563, >2425491707, >2417660746, >2417654092, >2417654290, >2519207652, >2519290634, >2519290371, >2519978356, >2519977828, >2519975066, >2519603468, >2519598064, >2520189316, >2520183931, >2520184850, >2520184850, >2520184850, >2520184850, >2520178129, >2520176403, >2520162871, >2519379087, >2519377981, >2520146833, >2520145384, >2520350309, >2519174399, >2519133714, >2519132020, >2519131063, >2519130869, >2519130020 > ) > > > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com > > This email sent to [EMAIL PROTECTED] > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: pointers in objective-c?
Hi I'm sorry, it's not a confusion, it's only a bad knowledge of C, and "pointers" are not understood, NS and what about CF or every-prefix in the world of frameworks gtk_object ... kobject ... #include long __auto_increment = 0; typedef struct { long *addr; void *value; } Object; Object ObjectNew(void *value) { Object obj; long i = __auto_increment++; obj.addr = &i; obj.value = value; return obj; } int main (void) { Object obj; Object *obj_1; Object *obj_2; char *value = "hello world!"; obj = ObjectNew(value); obj_1 = &obj; obj_2 = obj_1; printf("obj_1.addr = %x, obj_1.value = %s \n", obj_1->addr, obj_1->value); printf("obj_2.addr = %x, obj_2.value = %s \n", obj_1->addr, obj_1->value); return 0; } On Sat, Aug 2, 2008 at 12:05 AM, Negm-Awad Amin <[EMAIL PROTECTED]> wrote: > Hi, > > Am Fr,01.08.2008 um 22:07 schrieb Giulio Cesare Solaroli: > >> On Fri, Aug 1, 2008 at 10:01 PM, Clark Cox <[EMAIL PROTECTED]> wrote: >>> >>> On Fri, Aug 1, 2008 at 12:38 PM, Arthur Coleman <[EMAIL PROTECTED]> >>> wrote: I hate to be dense, but what about C structs like NSRect? There are initialized on the stack aren't they? >>> >>> They're C structs, they aren't Objective-C objects. >> >> That's very true, but the common NS prefix used by both full obj-c >> classes and simple C structures may lead to some confusion, mainly for >> someone learning obj-c and Cocoa. > > yup, sometimes people are confused about the NS-prefix. But NS means > NextStep, so refers to the framework *not* to the type. It is no good idea > to use hungarian notation in objective-c. > > Amin > >> >> >> Giulio Cesare >> ___ >> >> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >> >> Please do not post admin requests or moderator comments to the list. >> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >> >> Help/Unsubscribe/Update your Subscription: >> http://lists.apple.com/mailman/options/cocoa-dev/negm-awad%40cocoading.de >> >> This email sent to [EMAIL PROTECTED] > > Amin Negm-Awad > [EMAIL PROTECTED] > > > > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com > > This email sent to [EMAIL PROTECTED] > -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]