Re: NSCalendarDate to be deprecated
As written, 70 microseconds. When I set the calendar's time zone to GMT, the time drops to 43 microseconds. Since my app will only work with dates in GMT, this is a plus. Even so, 40 microseconds is far slower than the 7 - 8 microseconds offered by -[NSCalendarDate dayOfYear]. Unless someone has another offering, I plan to file a bug report on this issue. This calculation is part of an animation loop, so the performance hit is important. Sorry to jump in late, but I am just now getting around to reading about 5 days worth of email. Did you try caching the NSCalendar creation call? I believe we had a similar performance issue with CFCalendar (which no doubt shares its implementation with NSCalendar), and I found out with Shark and fs_usage that each CFCalendarCreate call results in many (very large) region data files being read into memory. sarcasmTurns out reading several megabytes from the filesystem is expensive/sarcasm, so caching the CFCalendarCreate resulted in a big performance gain. Not sure if NSCalendar implements any caching on its own, but you might give it a shot. Ryan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Am Do,21.08.2008 um 19:54 schrieb Michael Ash: On Thu, Aug 21, 2008 at 10:40 AM, Negm-Awad Amin [EMAIL PROTECTED] wrote: Am Do,21.08.2008 um 16:15 schrieb Michael Ash: On Thu, Aug 21, 2008 at 6:47 AM, Negm-Awad Amin [EMAIL PROTECTED] wrote: Am Do,21.08.2008 um 12:25 schrieb Thomas Engelmeier: Am 21.08.2008 um 11:04 schrieb Negm-Awad Amin: Sometimes you see in source code something like this: if( booleanVarOrExpression == YES ) (I think, Rentzsch does it that way, IIRC) and Ithink, that this is simply correct. Oh, that is another discussion. Yeah, but connected It is antoher discussion in that way, that we have other types. (BOOL vs. type of logical expression in C) It is the same discussion in that way, that most programmers make some assumptions about the value (and the casting). (I bet, that 10 % believe, that the expression inside the if is typed BOOL) I'd be very surprised at this, given that BOOL is found only in Objective-C, and if statements are found in C. IIRC this depends on the concrete standard? No, it does not. Objective-C does not have a standard, and no C standard includes BOOL. Objective-C has a reference. The reference includes BOOL. BOOL A Boolean value, either YES or NO. Doing this is absolutly correct. BOOL var = …; // Something evaluating to YES or NO if( var == YES ) It's correct in that it is a legal language construct and it has well-defined results. But it is incorrect as far as doing what most people would want it to do. Consider this: BOOL var = 2; If somebody wants to do this, he does something wrong. 2 is no valid assignment for a BOOL. Of course it's valid: typedef signed char BOOL; This is an implementation detil. You should see the difference between reference and implementation. This is basical. Beside this, you misunderstood the meaning of types. If somebody defines a type, he gives the new type a semantical meaning. Otherwise there is no need to define a new type. When $somebody started to define BOOL, bool, Boolean, boolean … he wanted to say, that this a boolean value. Valid boolean values are YES ans NO. (or TRUE and FALSE or True and False or true and false - but boolean values). The C standard guarantees that a signed char can hold at least values in the range of -127 to 127. Depending on the implementation, it may be abel to hold more. Thus any number in that range is a valid value for a variable of type BOOL. There is a conception about types. It is not rolling the dices. if(var == YES) That if statement will evaluate to false, even though the value of var is conceptually true. There is no conpetionally true. BOOL has the valid values YES and NO, not 2, not CONCEPTIONALLYYES. No, BOOL has the valid values -127 through 127, and possibly more. In the C language, all non-zero values are true. No, it has the valid vlues YES and NO. This is defined by the language reference. (True in C meaning anything that is not zero.) This is not a BOOL. *You* said, that there is no bool in C. No, I said that there is no BOOL in C. Of course, when discussion about different languages, it is strange to refer to a series of lettrs. Shall I start to write BOOL, Bool bool, Boolean, boolean? There is an idea of booleans. This idea is not related to programming languages or a specific programming language. And it is not the idea of boolean numbers, that there is a pari 0, !0. It is the idea, that there is a pair YES and NO (or TRUE and FALSE or true and false … The idea does not depend on a specific language) Thinking about the concept type you sould realize, that types are not made for a special series of characters to name it, but a semantical conception, meaning. Of course it is also true that there is no bool in C. And it's true. But C does have the concept of logical truth and falsehood, it's just not expressed by means of a boolean type, or boolean values. Exactly. But in Objective-C it is expressed by a boolean type. The logical truth in an if-statement bases on the difference betwenn == 0 and != 0, The logical truth of a boolean type in Objective-C is based on YES and NO. BOOL A Boolean value, either YES or NO. This is, what I said. so if( boolean ) changes the type. It only works, because NO is defined as 0 and YES is defined to something else then 0. As I said hours ago, this is disclused by the reference, so in Objective-C you can use this assumption without danger. But you *need* that, because logical expressions and BOOLs are not the same. An if takes no BOOL, but the type of an logical expression. There is no such thing in the C language as type of an logical expression. Typically logical expression is the term for the superset of relational expressions and expressions with logical operators. They have in common, that they only accepts the values related to truth and falseness. This term isn't inveted by me. I. e.:
File Extensions Problem
Hi, I want to display in a tableview, list of all media files (audio, video files) present in a certain directory. Currently what i am doing is that i am getting the file names in an NSMutableArray using NSFileManager function directoryContentsAtPath I get the list, but the problem is that it get all the files. I want only those files that have a certain extension (for example mp4, mp3). How can i do that. Thanx in advance ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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]
Displaying time
Hi, I want to display the current time in a full screen window. I'm making my computer into a digital clock (for my own use). I've done it by using NSCalendarDate and extracting the hours, minutes, and seconds, formatting a string and displaying it. I use an NSTimer to update the display every half a second. My question is: Is there a better way to display what is essentially the same as the menu bar clock? Thanks for any ideas, Ron ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: File Extensions Problem
On Aug 22, 2008, at 2:29 AM, Adil Saleem wrote: Hi, I want to display in a tableview, list of all media files (audio, video files) present in a certain directory. Currently what i am doing is that i am getting the file names in an NSMutableArray using NSFileManager function directoryContentsAtPath I get the list, but the problem is that it get all the files. I want only those files that have a certain extension (for example mp4, mp3). How can i do that. Thanx in advance After fetching the contents and before displaying contents in the table view, why not enumerate through the mutable array and remove any files that *do not have* the extensions you are looking for. You can do something like: NSString * fullFileName; en = [ myMutableArray objectEnumerator ] while(( fullFileName = [ en nextObject ) != NULL ) { // if the file is not an .mp3 file... if( [[ fullFileName pathExtension ] compare: @.mp3 options: NSCaseInsensitiveSearch ] != NSOrderedSame ) [ myMutableArray removeObject: fullFileName ]; // .. remove it } In other words, [ NSString pathExtension ] could be very helpful to you here. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: File Extensions Problem
On Aug 22, 2008, at 12:10 AM, Michael Dautermann wrote: On Aug 22, 2008, at 2:29 AM, Adil Saleem wrote: Hi, I want to display in a tableview, list of all media files (audio, video files) present in a certain directory. Currently what i am doing is that i am getting the file names in an NSMutableArray using NSFileManager function directoryContentsAtPath I get the list, but the problem is that it get all the files. I want only those files that have a certain extension (for example mp4, mp3). How can i do that. Thanx in advance After fetching the contents and before displaying contents in the table view, why not enumerate through the mutable array and remove any files that *do not have* the extensions you are looking for. You can do something like: NSString * fullFileName; en = [ myMutableArray objectEnumerator ] while(( fullFileName = [ en nextObject ) != NULL ) { // if the file is not an .mp3 file... if( [[ fullFileName pathExtension ] compare: @.mp3 options: NSCaseInsensitiveSearch ] != NSOrderedSame ) [ myMutableArray removeObject: fullFileName ]; // .. remove it } In other words, [ NSString pathExtension ] could be very helpful to you here. Hi! It appears that you're removing an object from a mutable array while enumerating, so that will unfortunately not work. To modify your concept: NSMutableArray *myMutableArray = [myOriginalArray copy]; for (NSString *fullFileName in myOriginalArray) { if( [[ fullFileName pathExtension ] compare: @.mp3 options: NSCaseInsensitiveSearch ] != NSOrderedSame ) [ myMutableArray removeObject: fullFileName ]; // .. remove it } // do something with myMutableArray... Also of note is that the path extension probably shouldn't have the period in it. Cheers, Andrew smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: File Extensions Problem
On 22 Aug 2008, at 5:22 pm, Andrew Merenbach wrote: Hi! It appears that you're removing an object from a mutable array while enumerating, so that will unfortunately not work. To modify your concept: NSMutableArray *myMutableArray = [myOriginalArray copy]; Or just use reverseObjectEnumerator. Removing the current iteration item from the array while iterating backwards is OK. Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: !foo vs foo == nil
On 22/08/2008, at 00.38, Andy Lee wrote: On Aug 21, 2008, at 3:42 PM, Jim Correia wrote: On Aug 21, 2008, at 3:54 AM, Jules Colding wrote: For that simple reason, I'd go for nil == foo every time. Yes, and in general you should always do if (CONSTANT == foo) to catch the potential if (CONSTANT = foo) error. If your name is Yoda, then perhaps if (3 != x) reads naturally to you. :-) Actually it does even though my name isn't Yoda ;-) Anyway, it is a matter of personal taste what style you choose. I just happen to prefer to put the constant first. An old habit I guess... Best regards, jules As in most things, I think it is critical to strike a balance between code readability/skim-ability and other considerations. I keep changing my mind about this, so my code is inconsistent about it, but I've basically come to the same conclusion. One thing I've noticed is that I rarely get a bug due to misreading a boolean expression. More often I'm looking right at it (even if it's as unmistakeable as nil == obj) and I do the wrong thing anyway. Like I'll get the if-block and the else-block mixed up. It's like some kind of boolean-dyslexia in my brain. I find it helps to comment my logic. --Andy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
NSString and special characters
Hello All, I am working on a command line tool. I use NSArray *params = [[NSProcessInfo processInfo] arguments] to get a list of command line parameters. Then I use NSString *param1 = [params objectAtIndex:1]; to get it. But when I pass for example ...myapplication test$test param1 got testest instead of test$test It means as I understand that $ is interpreted as special character. So my question is how to pass a parameter with $ inside? And are there any other special characters which are interpreted as special one? Thanks, Vlad ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSString and special characters
On Aug 22, 2008, at 4:00 AM, Vladimir Sokolov wrote: But when I pass for example ...myapplication test$test param1 got testest instead of test$test It means as I understand that $ is interpreted as special character. $ usually expands (or allows access to) a variable in a shell. Try putting test$test between quote marks when you call your command line tool. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSString and special characters
On Aug 22, 2008, at 1:00 AM, Vladimir Sokolov wrote: Hello All, I am working on a command line tool. I use NSArray *params = [[NSProcessInfo processInfo] arguments] to get a list of command line parameters. Then I use NSString *param1 = [params objectAtIndex:1]; to get it. But when I pass for example ...myapplication test$test param1 got testest instead of test$test It means as I understand that $ is interpreted as special character. So my question is how to pass a parameter with $ inside? And are there any other special characters which are interpreted as special one? To be clear, this has nothing to do with NSString and everything to do with how the shell parses command lines. As Michael D alluded to, the shell is seeing $test and expanding the $t to be the value of -- typically -- the environment variable 't', which doesn't have a value and, thus, you end up with 'testest'. That is, all argument processing has been completed long before your command line tool is even launched. Now, the syntax and rules for substitution change depending on the shell used and how your command line tool is launched. As well, APIs for launching processes such as NSTask, popen(), system(), and the various fork()/exec*() combinations may or may not behave similarly. So -- the real questions: What is launching your command line tool? Do you really need an argument with a $ character in it? Most command line tools avoid such characters for the reasons stated above. Have you read this book? http://tinyurl.com/6kxxgc b.bum smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: File Extensions Problem
On Fri, Aug 22, 2008 at 7:28 PM, Graham Cox [EMAIL PROTECTED] wrote: Or just use reverseObjectEnumerator. Removing the current iteration item from the array while iterating backwards is OK. Even going backwards, it's still not ok... From the -reverseObjectEnumerator 'special considerations' section of the documentation: When you use this method with mutable subclasses of NSArray, you must not modify the array during enumeration. And from NSEnumerator: Some enumerators may currently allow enumeration of a collection that is modified, but this behavior is not guaranteed to be supported in the future. Phil ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSString and special characters
2008/8/22, Bill Bumgarner [EMAIL PROTECTED]: On Aug 22, 2008, at 1:00 AM, Vladimir Sokolov wrote: Hello All, I am working on a command line tool. I use NSArray *params = [[NSProcessInfo processInfo] arguments] to get a list of command line parameters. Then I use NSString *param1 = [params objectAtIndex:1]; to get it. But when I pass for example ...myapplication test$test param1 got testest instead of test$test It means as I understand that $ is interpreted as special character. So my question is how to pass a parameter with $ inside? And are there any other special characters which are interpreted as special one? To be clear, this has nothing to do with NSString and everything to do with how the shell parses command lines. As Michael D alluded to, the shell is seeing $test and expanding the $t to be the value of -- typically -- the environment variable 't', which doesn't have a value and, thus, you end up with 'testest'. That is, all argument processing has been completed long before your command line tool is even launched. Now, the syntax and rules for substitution change depending on the shell used and how your command line tool is launched. As well, APIs for launching processes such as NSTask, popen(), system(), and the various fork()/exec*() combinations may or may not behave similarly. So -- the real questions: What is launching your command line tool? Do you really need an argument with a $ character in it? Most command line tools avoid such characters for the reasons stated above. Have you read this book? http://tinyurl.com/6kxxgc b.bum Thanks for your messages. Now I see my problem ( Learn Unix! :)) The $ character is part of the user password, that is why I need to use it. Now for the test I am launching my tool in bash. thanks again, Vlad ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: File Extensions Problem
On Fri, Aug 22, 2008 at 6:29 PM, Adil Saleem [EMAIL PROTECTED] wrote: Currently what i am doing is that i am getting the file names in an NSMutableArray using NSFileManager function directoryContentsAtPath I get the list, but the problem is that it get all the files. I want only those files that have a certain extension (for example mp4, mp3). How can i do that. I'd recommend using -enumeratorAtPath: and adding each path that meets your criteria to a new array. Also, consider if you want to check for a particular file extension, or a particular file type: do you just want files ending in .mp3, or any valid MP3 file? If you want the latter, then you should investigate checking the file extensions for conformance against the particular UTIs you're interested in. The documentation for UTIs isn't great, but take a look at the UTType.h and UTCoreTypes.h header files. Phil ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
WebFrame stopLoading in delegate crashes app
Hello, Using the WebKit I'd like to be able to look at the URL that a frame is loading and on some occasions stop the load. - (void)webView:(WebView *)sender didStartProvisionalLoadForFrame: (WebFrame *)frame { [frame stopLoading]; } Calling [WebFrame stopLoading] within the delegate didStartProvisionalLoadForFrame crashes the app. Is this a bug or am I doing something silly? Cheers, Ewan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: File Extensions Problem
On 22 Aug 2008, at 7:10 pm, Phil wrote: From the -reverseObjectEnumerator 'special considerations' section of the documentation: When you use this method with mutable subclasses of NSArray, you must not modify the array during enumeration. You shouldn't go modifying the array in general, for sure. But the special case of modification by deleting the last item in the array is safe, and always will be. In fact deleting any item with a higher index than current is safe, and always will be. Why? Because an ordinary for loop that counts down is free to do this and the existence of such loops in shipped code means that NSMutableArray can never be changed in such a way as to break code like that. (It's also hard to see how it could be, even theoretically). -reverseObjectEnumerator is no different, because it lets you access each object in the receiver, in order, from the element at the highest index down to the element at index 0. This statement will hold true for any future implementation of NSMutableArray, meaning that it is now, and always will be safe to delete items in the array at or higher than the current index. By the definition of an array, removing an item only affects the indexes of objects with equal or greater indexes than the removed item. But be clear, this is a special case, so the warning about modification *in general* should be heeded. In the OP's case of weeding out unwanted file extensions from a list, using a reverse enumerator to do this is quite safe. The argument may well be moot in these days of fast enumerators though. It's also trivial to make a copy and iterate that, as Andrew suggested, though with very huge arrays, that copy might be worth avoiding. Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Displaying time
On Aug 22, 2008, at 12:59 AM, Ron Fleckner wrote: Hi, I want to display the current time in a full screen window. I'm making my computer into a digital clock (for my own use). I've done it by using NSCalendarDate and extracting the hours, minutes, and seconds, formatting a string and displaying it. I use an NSTimer to update the display every half a second. My question is: Is there a better way to display what is essentially the same as the menu bar clock? Thanks for any ideas, Ron Look at NSDateFormatter. Here's one way to do that. IBOutlet NSTextField *theTextField; NSDateFormatter *dateFormatter; + (void)initialize { [NSDateFormatter setDefaultFormatterBehavior:NSDateFormatterBehavior10_4]; } - (void)updateClockTime { [theTextField setStringValue:[dateFormatter stringFromDate:[NSDate date]]]; } - (void)startClock { dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateStyle:NSDateFormatterNoStyle]; [dateFormatter setTimeStyle:NSDateFormatterMediumStyle]; [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(updateClockTime) userInfo:nil repeats:YES]; } --Nathan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Displaying time
On 22 Aug 2008, at 4:59 pm, Ron Fleckner wrote: My question is: Is there a better way to display what is essentially the same as the menu bar clock? I think only you can really answer that - after all you are the one making the clock app. What's better for you? Big digital 7-segment display perhaps? Maybe in binary with simulated LEDs like those Think Geek clocks? Maybe I misunderstood the question... Reminds me though of one of my first ever apps - a big digital clock on the C64. Each digit was a double-sized sprite. Couldn't miss that sucker ;-) cheers, Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Object networks
Hi everyone, I've been reading Object-Oriented Programming with Objective-C, Cocoa Fundamentals Guide and The Objective-C 2.0 Programming Language guide and I still have an unanswered question regarding object networks. Say I have my controller object Controller, a model class Model and a custom class textParser. Controller creates an instance of both Model and textParser. As such, Controller can communicate with both the instantiated classes as it has a direct reference to them. But how can I communicate between Model and textParser? How do they know about each other? I have an #import statement in the respective class in both cases but I don't understand where any connection lies beyond that. Sure they know about each others class, but not the instances of that class. More abstractly, how do I get one arbitrary object to communicate with another? What reference do I use? file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/Conceptual/CocoaFundamentals/CommunicatingWithObjects/chapter_6_section_3.html states: An application typically sets outlet connections between its custom controller objects and objects on the user interface, but they can be made between any objects that can be represented as instances in Interface Builder, even between two custom objects. As with any instance variable, you should be able to justify its inclusion in a class; the more instance variables an object has, the more memory it takes up. If there are other ways to obtain a reference to an object, such as finding it through its index position in a matrix, or through its inclusion as a function parameter, or through use of a tag (an assigned numeric identifier), you should do that instead. Okay, if there are other ways of referencing an object, how? I haven't found any clear examples of function parameters or tags. file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/Conceptual/OOP_ObjC/Articles/chapter_5_section_1.html talks about an object network, yet doesn't say how to create it. (ref Figure 3-2 Object Network) Any pointers to any docs on how this works would be greatly appreciated. Regards, Jason ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: File Extensions Problem
On Fri, Aug 22, 2008 at 10:23 PM, Graham Cox [EMAIL PROTECTED] wrote: You shouldn't go modifying the array in general, for sure. But the special case of modification by deleting the last item in the array is safe, and always will be. In fact deleting any item with a higher index than current is safe, and always will be. Why? Because an ordinary for loop that counts down is free to do this and the existence of such loops in shipped code means that NSMutableArray can never be changed in such a way as to break code like that. (It's also hard to see how it could be, even theoretically). Although an NSEnumerator is analogous to a for loop using an index variable, that doesn't make the contract on them the same. NSMutableArray can't be changed to break the traditional for loop that modifies the array, but the NSEnumerator returned by NSMutableArray can be. You're making an assumption about the implementation of how the enumerator moves through the list; and although I think this is a sane assumption (any other way of enumerating through the list would be strange), you're still breaking the contract of NSEnumerator. There is no documented exception about the objects that have already been enumerated over, so it shouldn't be assumed that there is one. Phil ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Displaying time
Ron Fleckner wrote: I want to display the current time in a full screen window. I'm making my computer into a digital clock (for my own use). I've done it by using NSCalendarDate and extracting the hours, minutes, and seconds, formatting a string and displaying it. I use an NSTimer to update the display every half a second. My question is: Is there a better way to display what is essentially the same as the menu bar clock? The menu bar uses the user's specified short date format, potentially adjusting for its own settings by controlling whether or not the string starts with the day-of-week and/or ends with AM/PM indicator. I think the quickest route to get close to that is to use an NSDateFormatter with the time style set to NSDateFormatterShortStyle and the date style set to NSDateFormatterNoStyle. If you want to do the same fiddling that the menu bar does, you'll have to retrieve the actual format string from NSUserDefaults and tweak it ahead of time. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSString and special characters
On Aug 22, 2008, at 05:26 , Vladimir Sokolov wrote: 2008/8/22, Bill Bumgarner [EMAIL PROTECTED]: On Aug 22, 2008, at 1:00 AM, Vladimir Sokolov wrote: Hello All, I am working on a command line tool. I use NSArray *params = [[NSProcessInfo processInfo] arguments] to get a list of command line parameters. Then I use NSString *param1 = [params objectAtIndex:1]; to get it. But when I pass for example ...myapplication test$test param1 got testest instead of test$test It means as I understand that $ is interpreted as special character. So my question is how to pass a parameter with $ inside? And are there any other special characters which are interpreted as special one? To be clear, this has nothing to do with NSString and everything to do with how the shell parses command lines. As Michael D alluded to, the shell is seeing $test and expanding the $t to be the value of -- typically -- the environment variable 't', which doesn't have a value and, thus, you end up with 'testest'. That is, all argument processing has been completed long before your command line tool is even launched. Now, the syntax and rules for substitution change depending on the shell used and how your command line tool is launched. As well, APIs for launching processes such as NSTask, popen(), system(), and the various fork()/exec*() combinations may or may not behave similarly. So -- the real questions: What is launching your command line tool? Do you really need an argument with a $ character in it? Most command line tools avoid such characters for the reasons stated above. Have you read this book? http://tinyurl.com/6kxxgc b.bum Thanks for your messages. Now I see my problem ( Learn Unix! :)) The $ character is part of the user password, that is why I need to use it. Now for the test I am launching my tool in bash. If you're using bash you can surround the argument in single quotes (e.g., 'test$test') and it won't do any expansion. However, it's a really bad idea to pass a password on the command line in Unix in general because any application can read your process's argument list without any special privileges. Jason smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Displaying time
On 22/08/2008, at 8:32 PM, Nathan Kinsinger wrote: On Aug 22, 2008, at 12:59 AM, Ron Fleckner wrote: Hi, I want to display the current time in a full screen window. I'm making my computer into a digital clock (for my own use). I've done it by using NSCalendarDate and extracting the hours, minutes, and seconds, formatting a string and displaying it. I use an NSTimer to update the display every half a second. My question is: Is there a better way to display what is essentially the same as the menu bar clock? Thanks for any ideas, Ron Look at NSDateFormatter. On 22/08/2008, at 8:41 PM, Graham Cox wrote: On 22 Aug 2008, at 4:59 pm, Ron Fleckner wrote: My question is: Is there a better way to display what is essentially the same as the menu bar clock? Maybe I misunderstood the question... Reminds me though of one of my first ever apps - a big digital clock on the C64. Each digit was a double-sized sprite. Couldn't miss that sucker ;-) cheers, Graham Oh, sorry Graham and Nathan. My question wasn't clear. It should've been: Is there a way to update the time without using an NSTimer? I'd like my clock to be synchronised with the menu bar clock. Maybe this isn't a Cocoa question. Thanks for your answers. Ron ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Displaying time
On 22/08/2008, at 10:38 PM, Gregory Weston wrote: Ron Fleckner wrote: I want to display the current time in a full screen window. I'm making my computer into a digital clock (for my own use). I've done it by using NSCalendarDate and extracting the hours, minutes, and seconds, formatting a string and displaying it. I use an NSTimer to update the display every half a second. My question is: Is there a better way to display what is essentially the same as the menu bar clock? The menu bar uses the user's specified short date format, potentially adjusting for its own settings by controlling whether or not the string starts with the day-of-week and/or ends with AM/ PM indicator. I think the quickest route to get close to that is to use an NSDateFormatter with the time style set to NSDateFormatterShortStyle and the date style set to NSDateFormatterNoStyle. If you want to do the same fiddling that the menu bar does, you'll have to retrieve the actual format string from NSUserDefaults and tweak it ahead of time. Sorry, my question was very badly put. I've already apologised to two other answerers. I should have said: Is there a better way - other than using an NSTimer - to update the clock? That is, how does the system clock do it? I think now that this is not strictly a Cocoa question. Ron ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSString and special characters
On Aug 22, 2008, at 3:39 AM, Bill Bumgarner wrote: Have you read this book? http://tinyurl.com/6kxxgc And it's even available online, now: http://www.simson.net/ref/ugh.pdf -Dave ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Displaying time
On 22 Aug 2008, at 10:55 pm, Ron Fleckner wrote: Sorry, my question was very badly put. I've already apologised to two other answerers. I should have said: Is there a better way - other than using an NSTimer - to update the clock? That is, how does the system clock do it? I think now that this is not strictly a Cocoa question. Using a timer isn't too bad. Running at two updates per second should be acceptable since you're sampling at twice the highest event frequency. You might want to go a bit faster and maybe at a slightly odd multiple of one second to make sure you don't end up with a constant half-second lag. The timer should compare the previous second with the current second and only update the display if it's changed. That way your timer isn't wasting cycles redrawing the same thing every time, but only when it changes. hth, Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Displaying time
Am Fr,22.08.2008 um 15:28 schrieb Graham Cox: On 22 Aug 2008, at 10:55 pm, Ron Fleckner wrote: Sorry, my question was very badly put. I've already apologised to two other answerers. I should have said: Is there a better way - other than using an NSTimer - to update the clock? That is, how does the system clock do it? I think now that this is not strictly a Cocoa question. Using a timer isn't too bad. Running at two updates per second should be acceptable since you're sampling at twice the highest event frequency. You might want to go a bit faster and maybe at a slightly odd multiple of one second to make sure you don't end up with a constant half-second lag. I think, that a higher event-frequency is not neccessary. He should use an interval of close to one second (something like 0.99 seconds). In his timer method he simply waits in a loop for the tick tack and displays the result. So he will not have a constant phase shift (except of the drawing interval). If the system becomes busy (his application doesn't sound like that), he maybe misses a second. That is acceptable if the system is busy. Cheers, Amin The timer should compare the previous second with the current second and only update the display if it's changed. That way your timer isn't wasting cycles redrawing the same thing every time, but only when it changes. hth, Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/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/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Displaying time
Using a timer isn't too bad. Running at two updates per second should be acceptable since you're sampling at twice the highest event frequency. You might want to go a bit faster and maybe at a slightly odd multiple of one second to make sure you don't end up with a constant half-second lag. I think, that a higher event-frequency is not neccessary. He should use an interval of close to one second (something like 0.99 seconds). In his timer method he simply waits in a loop for the tick tack and displays the result. So he will not have a constant phase shift (except of the drawing interval). If the system becomes busy (his application doesn't sound like that), he maybe misses a second. That is acceptable if the system is busy. He would miss a second every 100 seconds, whether the system was busy or not, as the timer fires, finds the time hadn't changed, and goes back to sleep for another 0.99 seconds. Bob ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Displaying time
Am Fr,22.08.2008 um 15:45 schrieb Thomas Davie: Using a timer isn't too bad. Running at two updates per second should be acceptable since you're sampling at twice the highest event frequency. You might want to go a bit faster and maybe at a slightly odd multiple of one second to make sure you don't end up with a constant half-second lag. I think, that a higher event-frequency is not neccessary. He should use an interval of close to one second (something like 0.99 seconds). In his timer method he simply waits in a loop for the tick tack and displays the result. So he will not have a constant phase shift (except of the drawing interval). If the system becomes busy (his application doesn't sound like that), he maybe misses a second. That is acceptable if the system is busy. He would miss a second every 100 seconds, whether the system was busy or not, as the timer fires, finds the time hadn't changed, and goes back to sleep for another 0.99 seconds. Bob »In his timer method he *simply waits in a loop for the tick tack* and displays the result. So he will not have a constant phase shift (except of the drawing interval).« Cheers, 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/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Displaying time
On 22 Aug 2008, at 15:47, Negm-Awad Amin wrote: Am Fr,22.08.2008 um 15:45 schrieb Thomas Davie: Using a timer isn't too bad. Running at two updates per second should be acceptable since you're sampling at twice the highest event frequency. You might want to go a bit faster and maybe at a slightly odd multiple of one second to make sure you don't end up with a constant half-second lag. I think, that a higher event-frequency is not neccessary. He should use an interval of close to one second (something like 0.99 seconds). In his timer method he simply waits in a loop for the tick tack and displays the result. So he will not have a constant phase shift (except of the drawing interval). If the system becomes busy (his application doesn't sound like that), he maybe misses a second. That is acceptable if the system is busy. He would miss a second every 100 seconds, whether the system was busy or not, as the timer fires, finds the time hadn't changed, and goes back to sleep for another 0.99 seconds. Bob »In his timer method he *simply waits in a loop for the tick tack* and displays the result. So he will not have a constant phase shift (except of the drawing interval).« Oh, sorry, I assumed you weren't suggesting something ugly . Bob___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Displaying time
On 22 Aug 2008, at 11:39 pm, Negm-Awad Amin wrote: I think, that a higher event-frequency is not neccessary. He should use an interval of close to one second (something like 0.99 seconds). In his timer method he simply waits in a loop for the tick tack and displays the result. So he will not have a constant phase shift (except of the drawing interval). Why wait in a loop? While it's doing that you're just burning up CPU time for no good reason, stealing cycles from the rest of the app, and it's more complex. Just set the timer rate to the acceptable delay you want. It's a straightforward application of Nyquist's Sampling Theorem - sample at twice the fastest event you want to capture, which is 1 second. Thus, go at twice per second, plus a little bit to avoid getting locked into a constant delay (or faster still). The CPU will sleep between firings and a few Hz isn't a big deal, so this is far simpler and plays nicer. If the system becomes busy (his application doesn't sound like that), he maybe misses a second. That is acceptable if the system is busy. Says you, maybe it isn't acceptable to the OP? Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Displaying time
Am Fr,22.08.2008 um 15:52 schrieb Thomas Davie: On 22 Aug 2008, at 15:47, Negm-Awad Amin wrote: Am Fr,22.08.2008 um 15:45 schrieb Thomas Davie: Using a timer isn't too bad. Running at two updates per second should be acceptable since you're sampling at twice the highest event frequency. You might want to go a bit faster and maybe at a slightly odd multiple of one second to make sure you don't end up with a constant half-second lag. I think, that a higher event-frequency is not neccessary. He should use an interval of close to one second (something like 0.99 seconds). In his timer method he simply waits in a loop for the tick tack and displays the result. So he will not have a constant phase shift (except of the drawing interval). If the system becomes busy (his application doesn't sound like that), he maybe misses a second. That is acceptable if the system is busy. He would miss a second every 100 seconds, whether the system was busy or not, as the timer fires, finds the time hadn't changed, and goes back to sleep for another 0.99 seconds. Bob »In his timer method he *simply waits in a loop for the tick tack* and displays the result. So he will not have a constant phase shift (except of the drawing interval).« Oh, sorry, I assumed you weren't suggesting something ugly . Bob This is not ugly, but the starting point for a software PLL. Cheers 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/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Displaying time
On 22 Aug 2008, at 11:54 pm, Negm-Awad Amin wrote: This is not ugly, but the starting point for a software PLL. Well, there's no loop to phase lock here. The PLL analogy might hold up if you used your timer to measure the interval between changes of the clock, then use that to change the timer rate (feedback). Then you could ensure that the timer callback always occurred within a certain interval of the clock changing (analogous to the phase delay in a PLL). But, it's pretty complex for such a simple task, and not necessary. If the clock were running much, much faster and you wanted to keep up with sub-millisecond changes then yes, you might have a point... cheers, Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Displaying time
On 22/08/2008, at 11:28 PM, Graham Cox wrote: On 22 Aug 2008, at 10:55 pm, Ron Fleckner wrote: Sorry, my question was very badly put. I've already apologised to two other answerers. I should have said: Is there a better way - other than using an NSTimer - to update the clock? That is, how does the system clock do it? I think now that this is not strictly a Cocoa question. Using a timer isn't too bad. Running at two updates per second should be acceptable since you're sampling at twice the highest event frequency. You might want to go a bit faster and maybe at a slightly odd multiple of one second to make sure you don't end up with a constant half-second lag. The timer should compare the previous second with the current second and only update the display if it's changed. That way your timer isn't wasting cycles redrawing the same thing every time, but only when it changes. hth, Graham OK, thanks Graham. I'll stick with the timer. Your suggestion of increasing the fire rate of the timer works well. I've set it to fire at 0.3 seconds and the display is almost exactly the same as the menu bar clock. Thanks again, Ron ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Displaying time
Am Fr,22.08.2008 um 16:00 schrieb Graham Cox: On 22 Aug 2008, at 11:54 pm, Negm-Awad Amin wrote: This is not ugly, but the starting point for a software PLL. Well, there's no loop to phase lock here. This was the reason for me, to write: starting point. Look to my newer answer. The PLL analogy might hold up if you used your timer to measure the interval between changes of the clock, then use that to change the timer rate (feedback). Then you could ensure that the timer callback always occurred within a certain interval of the clock changing (analogous to the phase delay in a PLL). But, it's pretty complex for such a simple task, and not necessary. If the clock were running much, much faster and you wanted to keep up with sub-millisecond changes then yes, you might have a point... cheers, Graham Cheers, 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/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Displaying time
Sorry for sending the responds solely to Graham: Am Fr,22.08.2008 um 15:53 schrieb Graham Cox: On 22 Aug 2008, at 11:39 pm, Negm-Awad Amin wrote: I think, that a higher event-frequency is not neccessary. He should use an interval of close to one second (something like 0.99 seconds). In his timer method he simply waits in a loop for the tick tack and displays the result. So he will not have a constant phase shift (except of the drawing interval). Why wait in a loop? While it's doing that you're just burning up CPU time for no good reason, If he needs 1/100 precision you would prefer to set-up a timer firing 100 times in a second. Probably this will burn more performance. stealing cycles from the rest of the app, and it's more complex. Just set the timer rate to the acceptable delay you want. What is it? If the acceptable delay becomes smaller, incresing the event frequency makes your solution worse and worse. It's a straightforward application of Nyquist's Sampling Theorem - sample at twice the fastest event you want to capture, which is 1 second. Nyquist's theorem can lead to a phase shift. This is the problem in the case of the TS. Beside this Nyquist's theorem requests an ideal filter. He doesn't have any filter. We have a phase-lock problem. Thus, go at twice per second, plus a little bit to avoid getting locked into a constant delay (or faster still). Why not going a little bit faster then 1 second? The CPU will sleep between firings and a few Hz isn't a big deal, so this is far simpler and plays nicer. If you implement a software PLL with some additional engagement, you simply measure the gap to the full second and recalculate the next interval. This is what a analog PLL do, when it loads/unloads a ramp. If the system becomes busy (his application doesn't sound like that), he maybe misses a second. That is acceptable if the system is busy. Says you, maybe it isn't acceptable to the OP? If the system is busy, every timer-based solution will fail, because the timer does not guarante nothing of none. Graham Cheers, Amin Negm-Awad ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Displaying time
On 23 Aug 2008, at 12:04 am, Negm-Awad Amin wrote: This is what a analog PLL do, when it loads/unloads a ramp. Analogue PLL design (Audio to GHz RF) were my bread-and-butter for many years, so do be careful not to teach your granny to suck eggs here ;-) If the system is busy, every timer-based solution will fail, because the timer does not guarante nothing of none. So you're stuffed in any case then, since the only other way is to poll for a time change and there's no guarantee your main event loop will be run in a timely fashion either. Timers are in the event loop, so it's as broad as it's long... Since the OP wants to display time to 1 second resolution *on screen*, you are clearly not talking about wanting this to be very precise. You'll be capped at 16mS anyway. A timer running at a few hertz is simple, if not perfect nor scalable to a real-time OS. Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Displaying time
Am Fr,22.08.2008 um 16:15 schrieb Graham Cox: On 23 Aug 2008, at 12:04 am, Negm-Awad Amin wrote: This is what a analog PLL do, when it loads/unloads a ramp. Analogue PLL design (Audio to GHz RF) were my bread-and-butter for many years, so do be careful not to teach your granny to suck eggs here ;-) :-) I developed digital PLLs in a former life. If the system is busy, every timer-based solution will fail, because the timer does not guarante nothing of none. So you're stuffed in any case then, since the only other way is to poll for a time change and there's no guarantee your main event loop will be run in a timely fashion either. Yup, as I said: If your system is busy, an application-based solution is never very exact. But in the case, that the system is not busy (as I said, his TS sounds like this), you get a more precise timer (precise in relation to phase shifting, not related to frequency. frequency is no problem here), if you reduce the number of events and try to get close to the tick tack. I gueass, after running the software PLL 4, 5, 6 seconds (times), it will burn less cpu performance. Timers are in the event loop, so it's as broad as it's long... Since the OP wants to display time to 1 second resolution *on screen*, you are clearly not talking about wanting this to be very precise. You'll be capped at 16mS anyway. A timer running at a few hertz is simple, if not perfect nor scalable to a real-time OS. Yes, this is, what I wanted to say: If you really, really need an exact timer you should not use an application-bases solution on a OS like OS X. We can think about hundreds, but not about thousands. Graham Cheers, 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/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Preventing windows from being dragged
On Aug 21, 2008, at 8:31 PM, Kyle Sluder wrote: On Thu, Aug 21, 2008 at 11:18 PM, Steve Christensen [EMAIL PROTECTED] wrote: The great majority of Mac applications do not run in kiosk mode so for most cases preventing window movement *is* wrong because you take control away from the user. Hold on, I don't agree with that. Taking control away from the user is wrong except in situation where it's right, in which case you typically want something like a kiosk. The way you've phrased it seems like you're claiming that kiosk mode is wrong on its face. Sorry, I thought I had been clear. The OP had written that he wanted to prevent a window from moving without providing the critical detail that he was writing a kiosk application, and some of the replies reflected that. If you have a good reason for taking over the screen (kiosk app, full-screen game, animated desktop background, slideshow/ presentation mode in a regular app, etc.), I think it's perfectly fine to use a window that doesn't move. If you're writing a regular app, the user should be able to arrange windows as s/he sees fit. My two cents... steve ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: [moderator] Re: reusing cookies set in UIWebView
Is any information available about when that NDA will be lifted? Thanks, John Scott Anguish wrote: the reason you can't find this information is that the iPhone SDK is still under non-disclosure. You can't talk about it here or anywhere publicly. scott [moderator] On 21-Aug-08, at 8:18 PM, John Greene wrote: Hi, I've done a little bit of searching and haven't found an answer to this dilemma: I want to use a webservice in my app that returns XML, but the catch is the user has to be logged in to get valid results, and the log-in is quite distinct from the webservice. I could create a UIWebView to the login screen, and somehow capture a successful login, but I don't know how to reuse the cookies that get set later in a NSURLRequest. Actually, I don't even know if that's possible. Does anyone have any suggestions? The keys to the issue are I *have* to use the login screen via a browser, and the webservice *has* to recieve valid cookies. Thanks, John ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/scott%40cocoadoc.com 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/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: File Extensions Problem
On Aug 22, 2008, at 2:27 AM, Phil wrote: On Fri, Aug 22, 2008 at 6:29 PM, Adil Saleem [EMAIL PROTECTED] wrote: Currently what i am doing is that i am getting the file names in an NSMutableArray using NSFileManager function directoryContentsAtPath I get the list, but the problem is that it get all the files. I want only those files that have a certain extension (for example mp4, mp3). How can i do that. I'd recommend using -enumeratorAtPath: and adding each path that meets your criteria to a new array. Also, consider if you want to check for a particular file extension, or a particular file type: do you just want files ending in .mp3, or any valid MP3 file? If you want the latter, then you should investigate checking the file extensions for conformance against the particular UTIs you're interested in. The documentation for UTIs isn't great, but take a look at the UTType.h and UTCoreTypes.h header files. I agree that Using UTIs is a good idea in general. If you can use extensions, though, you can filter out all filenames with a single call to -[NSArray pathsMatchingExtensions:]. -- Adam smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Object change to NSView update
I feel I can nearly grasp what I need to do, but not quite. I know what I shouldn't be doing--which is what I am doing and I feel I'm a little in the weeds. I seek a nudge in the right direction if someone can help. I have a master-detail setup with a normal table displaying a list of orders. Below it is my subclass of NSView which draws a tree diagram of the selected order and its descendent order steps, each of which might have its own descendants. In fact, here it is: http://special-lite.com/satellite/Picture%204.png I am forcing the view to update after a change to one of the order step objects in what I am sure is The Wrong Way™ by basically chucking setNeedsDisplay into areas of my code such as the contextual menu handling code, etc. This works great for GUI-driven changes even though it's wrong, but it falls apart of course when changes occur due to Applescript. What I think I understand that I need is that when an object belonging to the current selection of the table is modified, that a controller is notified and it tells the view to update. Or perhaps I can programmatically bind the view to the table's selection. I think I could maybe (maybe!) figure out how do this for the order (the table's selection), but I am totally lost as to how I would do it for the order's great-grandchildren order steps. If someone could give me a short breakdown of the idea of how to do it, I will happily go read hours of documentation and examples to learn the details. Thank you___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Object change to NSView update
On Fri, Aug 22, 2008 at 3:58 PM, Paul Bruneau [EMAIL PROTECTED] wrote: I feel I can nearly grasp what I need to do, but not quite. I know what I shouldn't be doing--which is what I am doing and I feel I'm a little in the weeds. I seek a nudge in the right direction if someone can help. I have a master-detail setup with a normal table displaying a list of orders. Below it is my subclass of NSView which draws a tree diagram of the selected order and its descendent order steps, each of which might have its own descendants. In fact, here it is: http://special-lite.com/satellite/Picture%204.png I am forcing the view to update after a change to one of the order step objects in what I am sure is The Wrong Way™ by basically chucking setNeedsDisplay into areas of my code such as the contextual menu handling code, etc. This works great for GUI-driven changes even though it's wrong, but it falls apart of course when changes occur due to Applescript. What I think I understand that I need is that when an object belonging to the current selection of the table is modified, that a controller is notified and it tells the view to update. Or perhaps I can programmatically bind the view to the table's selection. I think I could maybe (maybe!) figure out how do this for the order (the table's selection), but I am totally lost as to how I would do it for the order's great-grandchildren order steps. If someone could give me a short breakdown of the idea of how to do it, I will happily go read hours of documentation and examples to learn the details. How about having the object post an NSNotification whenever it's changed? Your controller can observe the notification call setNeedsDisplay accordingly. If you're posting a lot of notifications at the same time, you might look at coalescing them (http://developer.apple.com/documentation/Cocoa/Conceptual/Notifications/Articles/NotificationQueues.html) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Displaying time
On Fri, Aug 22, 2008 at 8:51 AM, Ron Fleckner [EMAIL PROTECTED] wrote: Is there a way to update the time without using an NSTimer? I'd like my clock to be synchronised with the menu bar clock. Maybe this isn't a Cocoa question. Thanks for your answers. It's pretty simple. Use a *non* repeating timer. In the timer's action method, compute the time until the next update. Then set up a new *non* repeating timer for that time interval. For example, something like this: - (void)updateClock:(id)ignore { // update your clock based on the current time NSTimeInterval now = [NSDate timeIntervalSinceReferenceDate]; double whole = trunc(now); double fract = now - whole; double remaining = 1.0 - fract; [NSTimer scheduledTimerWithTimeInterval:remaining target:self selector:_cmd userInfo:nil repeats:NO]; } And then just call this method once on startup to get the ball rolling. The advantage is that you're only updating once per second, but your updates still follow extremely closely after the value updates. And it's self synchronizing, so if some kind of event happens to interrupt the update cycle (like sleeping the computer, or a huge burst of disk IO which blocks your app) then it will quickly get back on schedule once the method does manage to fire. The same technique can be applied to fractions of a second, or to minutes, hours, days, etc. Mike ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Object change to NSView update
On 23 Aug 2008, at 12:58 am, Paul Bruneau wrote: I think I could maybe (maybe!) figure out how do this for the order (the table's selection), but I am totally lost as to how I would do it for the order's great-grandchildren order steps. Data structure? Does an order keep a list of its children? And those objects keep a list of their children and so on? Then just propagate needs display change to the children, then they'll do the same, and so on. Usually these will all be objects of the same class, or share some common subclass, or at least have certain methods in common. You have to arrange all of this. So let's say you have this: // MyObject.h @interface MyObject : NSObject { NSArray* myChildren; NSView* myViewRef; NSRect myBounds; } - (void) flagChanged; @end //MyObject.m @implementation MyObject - (void) flagChanged { [myViewRef setNeedsDisplayInRect:myBounds]; [myChildren makeObjectsPerformSelector:@selector(flagChanged)]; // -- will call flagChanged on every child object, which recurses in turn } @end Now assuming that these objects are all linked together correctly in a nice tree structure, sending -flagChanged to the root object will propagate that change down to every child and every child's child, and so on. This is very conceptual, but may help - does it? Note that this assumes that if you are modelling something that is structured as a tree or hierarchy in real life, you've implemented it as a tree or hierarchy in your code. Normally this is what you would do! cheers, Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: File Extensions Problem
On Fri, Aug 22, 2008 at 6:23 AM, Graham Cox [EMAIL PROTECTED] wrote: -reverseObjectEnumerator is no different, because it lets you access each object in the receiver, in order, from the element at the highest index down to the element at index 0. This statement will hold true for any future implementation of NSMutableArray, meaning that it is now, and always will be safe to delete items in the array at or higher than the current index. By the definition of an array, removing an item only affects the indexes of objects with equal or greater indexes than the removed item. You are making a big, unwarranted assumption about how reverseObjectEnumerator works. Namely, you are assuming that it merely tracks an index, and uses -objectAtIndex: (or equivalent) to retrieve each object. What if the enumerator actually just keeps a pointer to the array's internal storage? This would be perfectly allowed by the API. But then, as you delete things, the array may decide to reallocate its internal storage, leaving the enumerator's pointer to dangle, and causing you to crash. Do not modify collections while you enumerate them. You're not allowed to. Just because it seems like maybe you ought to be allowed in this one special case doesn't make it so. If you really want to enumerate backwards while deleting items at the tail end of the array, write a manual for loop that calls -objectAtIndex: each time. This is guaranteed to work. Mike ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: File Extensions Problem
On Aug 22, 2008, at 8:23 AM, Michael Ash wrote: On Fri, Aug 22, 2008 at 6:23 AM, Graham Cox [EMAIL PROTECTED] wrote: -reverseObjectEnumerator is no different, because it lets you access each object in the receiver, in order, from the element at the highest index down to the element at index 0. This statement will hold true for any future implementation of NSMutableArray, meaning that it is now, and always will be safe to delete items in the array at or higher than the current index. By the definition of an array, removing an item only affects the indexes of objects with equal or greater indexes than the removed item. You are making a big, unwarranted assumption about how reverseObjectEnumerator works. Namely, you are assuming that it merely tracks an index, and uses -objectAtIndex: (or equivalent) to retrieve each object. What if the enumerator actually just keeps a pointer to the array's internal storage? This would be perfectly allowed by the API. But then, as you delete things, the array may decide to reallocate its internal storage, leaving the enumerator's pointer to dangle, and causing you to crash. Do not modify collections while you enumerate them. You're not allowed to. Just because it seems like maybe you ought to be allowed in this one special case doesn't make it so. If you really want to enumerate backwards while deleting items at the tail end of the array, write a manual for loop that calls -objectAtIndex: each time. This is guaranteed to work. Mike To build on this, doesn't fast enumeration (Leopard-only, of course) raise an exception if a value is modified while the enumeration is running? (Not tested personally by me, but building upon an earlier thread from a little while back.) Cheers, Andrew smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Object change to NSView update
On Aug 22, 2008, at 11:09 AM, Jonathan del Strother wrote: How about having the object post an NSNotification whenever it's changed? Your controller can observe the notification call setNeedsDisplay accordingly. If you're posting a lot of notifications at the same time, you might look at coalescing them (http://developer.apple.com/documentation/Cocoa/Conceptual/Notifications/Articles/NotificationQueues.html ) I like the suggestion. My concern would be that there would be a lot of extraneous notifications (but maybe it doesn't matter). The orders are in this table while they are being built but then once they are scheduled they join a few hundred friends where lots of edits to the order steps occur, but no longer does that concern the view that is the subject of this thread. But I could always have the objects check to see if they are still in that order entry array and not send the notifications if they aren't. I'm sure that violates MVC or something but at this point I'm not sure I'm too concerned. Thanks! ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Object change to NSView update
On Fri, Aug 22, 2008 at 10:58 AM, Paul Bruneau [EMAIL PROTECTED] wrote: I am forcing the view to update after a change to one of the order step objects in what I am sure is The Wrong Way™ by basically chucking setNeedsDisplay into areas of my code such as the contextual menu handling code, etc. This works great for GUI-driven changes even though it's wrong, but it falls apart of course when changes occur due to Applescript. Are you saying that when some GUI event occurs (like clicking a button), you are calling -setNeedsDisplay: on your custom view? Where's is your controller object? All of your model changes should be going through a controller, and this controller would know to update the other views. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: File Extensions Problem
On Fri, Aug 22, 2008 at 11:39 AM, Andrew Merenbach [EMAIL PROTECTED] wrote: To build on this, doesn't fast enumeration (Leopard-only, of course) raise an exception if a value is modified while the enumeration is running? (Not tested personally by me, but building upon an earlier thread from a little while back.) I would assume that Bad Things would happen in that case, based on my understanding of how fast enumeration is implemented. It gathers and returns a C array of pointers to the values in the collection, which can then be enumerated with simple pointer arithmetic. Changing the original collection object would leave the C array out of sync with it, leading to Bad Things happening - maybe an exception, maybe a crash, I don't know, but definitely nothing good. sherm-- -- Cocoa programming in Perl: http://camelbones.sourceforge.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSString and special characters
On Aug 22, 2008, at 7:54 AM, Joeles Baker wrote: Just read through the book. I really wonder, what the author of the foreword (obviously an apple employee) thought, when Mac OS X was announced :-) Is this really true? Is Unix defective by design ? :-) Amazingly powerful tool, easy to remove a limb. Kind of like the Hole Hawg: http://www.team.net/mjb/hawg.html Which is why, when I write Cocoa programs, I stick to the highest level APIs as much as possible; Cocoa, CoreData, Foundation, CoreAnimation, etc... It makes my code easier to maintain and, more attractively, it means that my code just naturally gets faster and has more features as Apple adds stuff to the system and optimizes existing stuff. Look at the performance gains in CoreData between Tiger and Leopard, for example. Yet, I can still dip to Unix or other underlying at the metal APIs when I need to solve a particular performance problem or have access to a feature in a specific configuration that Cocoa has not yet encapsulated. Write the Code. Make it Work. Make it Right. Make it Fast. To bring this back around to the OP's question, passing user passwords on the command line is *never* the right answer. Which is why Mac OS X provides authentication/authorization APIs (and extensive documentation). Vladimir: Why are you passing the password as an argument? b.bum smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Tabbed preference panels
Hi, I'm working on a preferences panel. I want to build a compound panel like the kind seen in most mainstream apps today: a toolbar on top with tabbed view switching. The panel changes its appearance depending on which 32x32 toolbar icon you have selected. I'm not sure where to start. Looking for examples, I've looked in Safari's app bundle resources dir, and I see that Safari uses separate nibs per preferences tab. When I open one of these nibs, I see a window object, and that window object has the preference tab's layout. Pretty straightforward. Of course, Safari is not open source, so I can't go any further and see how this design works. Looking at the source for Transmission, I see they've taken a different approach, which is to have one PrefsWindow.xib, and in that xib, a number of View objects, one for each tab. Open the view object representing a particular preference tab, and you see its layout. I have not studied the Transmission source yet to see how they make it all work. So we have at least 2 accepted ways of doing the tabbed preference panel thing. But I'd like a better understanding of the hows and why's overall. Can anyone point me to some Cocoa programming guide docs, or programming topics docs, on tabbed preference panels? (Are they even called tabbed preference panels?) 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/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: [moderator] Re: reusing cookies set in UIWebView
No, not at this time. On 22-Aug-08, at 10:48 AM, John Greene wrote: Is any information available about when that NDA will be lifted? Thanks, John Scott Anguish wrote: the reason you can't find this information is that the iPhone SDK is still under non-disclosure. You can't talk about it here or anywhere publicly. scott [moderator] On 21-Aug-08, at 8:18 PM, John Greene wrote: Hi, I've done a little bit of searching and haven't found an answer to this dilemma: I want to use a webservice in my app that returns XML, but the catch is the user has to be logged in to get valid results, and the log-in is quite distinct from the webservice. I could create a UIWebView to the login screen, and somehow capture a successful login, but I don't know how to reuse the cookies that get set later in a NSURLRequest. Actually, I don't even know if that's possible. Does anyone have any suggestions? The keys to the issue are I *have* to use the login screen via a browser, and the webservice *has* to recieve valid cookies. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Tabbed preference panels
Am Fr,22.08.2008 um 18:29 schrieb Sumner Trammell: Hi, I'm working on a preferences panel. I want to build a compound panel like the kind seen in most mainstream apps today: a toolbar on top with tabbed view switching. The panel changes its appearance depending on which 32x32 toolbar icon you have selected. I'm not sure where to start. Looking for examples, I've looked in Safari's app bundle resources dir, and I see that Safari uses separate nibs per preferences tab. When I open one of these nibs, I see a window object, and that window object has the preference tab's layout. Pretty straightforward. Of course, Safari is not open source, so I can't go any further and see how this design works. Looking at the source for Transmission, I see they've taken a different approach, which is to have one PrefsWindow.xib, and in that xib, a number of View objects, one for each tab. Open the view object representing a particular preference tab, and you see its layout. I have not studied the Transmission source yet to see how they make it all work. So we have at least 2 accepted ways of doing the tabbed preference panel thing. But I'd like a better understanding of the hows and why's overall. Can anyone point me to some Cocoa programming guide docs, or programming topics docs, on tabbed preference panels? (Are they even called tabbed preference panels?) There are some different problems: 1) The selection bar You can use a toolbar from IB and put some items there. If you want the items to be selected (pressed into the toolbar) you need a delegate, which tells the toolbar, which items are selectable. In most cases all items are selectable in such a pref-window. So you can do a hack by writing a method in the toolbar delegate: - (NSArray*)toolbarSelectableItemIdentifiers:(NSToolbar*)toolbar; { NSMutableArray* selectables = [NSMutableArray array]; for( NSToolbarItem* item in [toolbar items] ) { [selectables addObject:[item itemIdentifier]]; } return selectables; } (Otherwise you get a problem with item identifiers.) 2. Of course you have to connect the items to an action. The action should change the content of the window. There are two approaches: 2.1. TabView Use a tabview with the different selections and simply switch the tab view. 2.2. View hierarchy Get a seperate view for each selection (inside the same nib or one nib per view) and exchange the actual view with this view (- removeFromSuperview:, -addSubview:). You have to take care about: - At the beginning you need one view as a placeholder. (You do not need it, but it is easier to me to handle it.) In -awakeFromNib you can replace that view with the view, which needs to be displayed first. So the placeholder view is a simple placeholder, say NSBox. To me this is easier to handle in IB (Autosizing and so on). - Every time you replace the view, because the selection changed, you have to calculate the frame of the newly inserted view from the last displayed view. - Memory mangement: It depends a little bit on the way you load/create/ refer to the different views. In any case remember: If you replace a view, this view isn't retained by its superview any more and will disappear, if you or somebody else do no -retain on it. If it is in a nib, the nib will hold the view. If you put each view in an extra nib, the extra nib will hold it. (Unloading the nib will unload the view, reloading the nib will reload the view.) This is the basic approach, I use it in this cases. I think there are different ways and there is no Switching Window Documentation. But I think you're having now enough keywords for your own search. Cheers, Amin 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/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/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
SSDP / UPNP
Hi. I am working on a project where I need to access a UPNP device on a local network. What is the best way to discover this device using SSDP and then interact with it (shared directory on the device)? Thanks in advance. -Jeremy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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]
Beginners problem: setKeyEquivalent in controlTextEndEditing method (NSComboBox)
Hi, in my project I have a window with 1 combobox and 2 buttons. Buttons are 'Cancel' and 'Ok'. This is a sort of login window. Combobox uses PGresult (PostgreSQL result) as data source and has autocomplete set to YES. Button 'Ok' is disabled and is programatically enabled if criteria is meet. Scenario is like this: window opens, user enters login name in combobox or selects it for list and then presses return key to validate his choice. Validation is in method controlTextEndEditing. If his login name is found in the result (PGresult) button 'Ok' is enabled and his key equivalent becomes return key. My problem is that as soon as return key is pressed for validation of entered text in combobox (when criteria is meet) button 'Ok' is pressed too. I would like to have scenario where user presses return key, his login name is validated, and if it is o.k. button 'Ok' is enabled with key equivalent return key and then user must hit return key once again to press button 'Ok'. Code I use: @interface AppController : NSObject { ...//other outlets and members IBOutlet NSComboBox *users; IBOutlet NSButton *loginOK; } ...//some methods @end #import AppController.h @implementation AppController ...//other methods //part handling combobox -(id)comboBox:(NSComboBox *)aComboBox objectValueForItemAtIndex: (int)index { int fieldNum = 1; NSString *value; value = [dbhelp getFieldValue:index fieldNo:fieldNum]; return value; } -(int)numberOfItemsInComboBox:(NSComboBox *)aComboBox { return [dbhelp numOfRows]; } - (void)controlTextDidEndEditing:(NSNotification *)notification { BOOL search = [dbhelp fieldValueInResult:[users stringValue] filedNo: 1]; if (search==YES) { [loginOK setEnabled:YES]; [loginsheet makeFirstResponder:loginOK]; [loginOK setKeyEquivalent:@\r] }else{ //send note to user about wrong login name } } @end --Nenad ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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]
NSMenuItem - setHidden
Hi, I've got a menu item in my app's root menu that I want to hide. I've referenced it as an IBOutlet as per: IBOutlet id itemToBeHidden; I'm trying to hide it as per: [itemToBeHidden setHidden:YES]; Problem is, item does not hide. Any ideas? Thanks, Stu ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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]
Noobie CalEvent question
Hi All, I'm just starting out with the intent of building a meal planning app using Core Data and the Calendar Store. Instead of having a date property for my Meal entity, I was thinking I wanted to use a CalEvent. That way I can change the date and time from my app or iCal, easily implement recurrence, etc. How would I implement such a thing in Core Data? As a transformable property? Does the idea even make sense? When listening for changes from iCal, if the user changes one instance of a recurrence, could I have my Meal entity create a new distinct version, so the rest of my Meal entities properties could be unique from the rest of the recurrence? Any suggestion for the right doc to read, functions/keywords to look up, or better yet an example... would be much appreciated! :) Thanks, ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Tabbed preference panels
You may also want to take a look at OmniAppKit's OAPreferences implementation: http://www.omnigroup.com/developer/. Hope this helps, - Greg On Aug 22, 2008, at 9:29 AM, Sumner Trammell wrote: Hi, I'm working on a preferences panel. I want to build a compound panel like the kind seen in most mainstream apps today: a toolbar on top with tabbed view switching. The panel changes its appearance depending on which 32x32 toolbar icon you have selected. I'm not sure where to start. Looking for examples, I've looked in Safari's app bundle resources dir, and I see that Safari uses separate nibs per preferences tab. When I open one of these nibs, I see a window object, and that window object has the preference tab's layout. Pretty straightforward. Of course, Safari is not open source, so I can't go any further and see how this design works. Looking at the source for Transmission, I see they've taken a different approach, which is to have one PrefsWindow.xib, and in that xib, a number of View objects, one for each tab. Open the view object representing a particular preference tab, and you see its layout. I have not studied the Transmission source yet to see how they make it all work. So we have at least 2 accepted ways of doing the tabbed preference panel thing. But I'd like a better understanding of the hows and why's overall. Can anyone point me to some Cocoa programming guide docs, or programming topics docs, on tabbed preference panels? (Are they even called tabbed preference panels?) 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/greg%40omnigroup.com 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/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
failing opening socket
Hi all. I'm porting a Linux project (using sockets to implement a ping function) on Mac OS X. My problem is that the function: int sock_icmp = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP); returns always -1. Where is my mistake? For me is the very first time using socket on Mac. Thanks in advance for any idea. Luca. _ Win New York holidays with Kellogg’s Live Search http://clk.atdmt.com/UKM/go/107571440/direct/01/___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Object change to NSView update
On Aug 22, 2008, at 12:09 PM, Kyle Sluder wrote: On Fri, Aug 22, 2008 at 10:58 AM, Paul Bruneau [EMAIL PROTECTED] wrote: I am forcing the view to update after a change to one of the order step objects in what I am sure is The Wrong Way™ by basically chucking setNeedsDisplay into areas of my code such as the contextual menu handling code, etc. This works great for GUI-driven changes even though it's wrong, but it falls apart of course when changes occur due to Applescript. Are you saying that when some GUI event occurs (like clicking a button), you are calling -setNeedsDisplay: on your custom view? Pretty much, yes, I'm sorry to say. There are no buttons, but you have the idea. In that screenshot you see the contextual menu. I can set some things from there, and one of the items in the menu makes a sheet for some other choices. When the sheet is finished Where's is your controller object? It's in my nib! But which controller do you mean? I have an array controller for the array that holds these orders and it is the datasource of the table and is bound to the columns of the table. All of your model changes should be going through a controller, and this controller would know to update the other views. Yes I think we agree on that part! The problem I am trying to communicate is where do I learn to make my model changes go through a controller, and how do I teach this controller to know to update the other views? As I said, I think I could get my way through this if the properties were in the order objects, but they can be in the children of the children of the order objects.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Object change to NSView update
On Aug 22, 2008, at 11:19 AM, Graham Cox wrote: On 23 Aug 2008, at 12:58 am, Paul Bruneau wrote: I think I could maybe (maybe!) figure out how do this for the order (the table's selection), but I am totally lost as to how I would do it for the order's great-grandchildren order steps. Data structure? Does an order keep a list of its children? And those objects keep a list of their children and so on? Then just propagate needs display change to the children, then they'll do the same, and so on. Usually these will all be objects of the same class, or share some common subclass, or at least have certain methods in common. You have to arrange all of this. snip code Now assuming that these objects are all linked together correctly in a nice tree structure, sending -flagChanged to the root object will propagate that change down to every child and every child's child, and so on. This is very conceptual, but may help - does it? Note that this assumes that if you are modelling something that is structured as a tree or hierarchy in real life, you've implemented it as a tree or hierarchy in your code. Normally this is what you would do! Thank you Graham. Yes, sorry I failed to say, but yes, the root order object has an NSArray of its nextSteps and each order step object also has an array of its nextSteps. But I am not so much worried about propagating down to the children, for it is the children who are getting changed without the root object's knowledge. However, I do also have a previousStep pointer in each order step that points back up to its parent that I could utilize. But similar to the other suggestion, I would have to be doing this every time anything changed about any order step, then I would have to communicate from the parent (order) object to this view directly? Which makes bells go off in my head that the model isn't supposed to be sending stuff to the view? But I do like your suggestion because it is a way that I might come up with, but I'm nervous that it isn't the Right Way. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSMenuItem - setHidden
Set the menuitem's menu's setAutoEnablesItems to NO Or you may have an option to do so in IB itself On 22-Aug-08, at 9:28 AM, Stuart Green wrote: Hi, I've got a menu item in my app's root menu that I want to hide. I've referenced it as an IBOutlet as per: IBOutlet id itemToBeHidden; I'm trying to hide it as per: [itemToBeHidden setHidden:YES]; Problem is, item does not hide. Any ideas? Thanks, Stu ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/chaitanya%40expersis.com 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/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSMenuItem - setHidden
Cheers, Tried: [itemToBeHidden setAutoEnablesItems:NO]; [itemToBeHidden setHidden:YES]; Still doesn't work. Couldn't see any options in IB to set this. Stu On 22 Aug 2008, at 18:26, chaitanya pandit wrote: Set the menuitem's menu's setAutoEnablesItems to NO Or you may have an option to do so in IB itself On 22-Aug-08, at 9:28 AM, Stuart Green wrote: Hi, I've got a menu item in my app's root menu that I want to hide. I've referenced it as an IBOutlet as per: IBOutlet id itemToBeHidden; I'm trying to hide it as per: [itemToBeHidden setHidden:YES]; Problem is, item does not hide. Any ideas? Thanks, Stu ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/chaitanya%40expersis.com 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/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: WebFrame stopLoading in delegate crashes app
On Aug 22, 2008, at 4:18 AM, Ewan McDougall wrote: Calling [WebFrame stopLoading] within the delegate didStartProvisionalLoadForFrame crashes the app. Is this a bug or am I doing something silly? What's the backtrace? If it's within the WebKit framework, then you should probably consider downloading the WebKit source code from http://webkit.macosforge.org/ and figure out what's causing the crash. Filing a bug is nice, but having a patch to fix the bug is better. :) Nick Zitzmann http://www.chronosnet.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSMenuItem - setHidden
On Aug 22, 2008, at 9:28 AM, Stuart Green wrote: I've got a menu item in my app's root menu that I want to hide. I've referenced it as an IBOutlet as per: IBOutlet id itemToBeHidden; Any reason you don't declare this as an NSMenuItem? Doing so would give you a little protection from silly errors like connecting to the wrong kind of object in IB, or sending a message the object doesn't respond to. I'm trying to hide it as per: [itemToBeHidden setHidden:YES]; I haven't used this method myself, but I see it's Leopard-only. Any chance you're running on Tiger? Also, are you sure the message is being sent and that itemToBeHidden is not nil? An NSLog just before the above line would confirm. --Andy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Tabbed preference panels
It's also worth noting that Dave Batton has a class+tutorial on his site that takes care of this for you: http://www.mere-mortal-software.com/blog/details.php?d=2007-03-14 However, it would probably be best to roll your own implementation at least once, so you know how it works under the hood. Then, in future projects, save some time and just drop in a ready-to-go implementation. Also, I'd recommend putting each view in a separate NIB and loading each as it's needed. This saves you from loading things that you don't need and should cut down on memory usage a bit (If the user only opens view A, there's no reason to load the views for B, C, D, E, etc). - Matt Ball On Fri, Aug 22, 2008 at 10:03 AM, Greg Titus [EMAIL PROTECTED] wrote: You may also want to take a look at OmniAppKit's OAPreferences implementation: http://www.omnigroup.com/developer/. Hope this helps, - Greg On Aug 22, 2008, at 9:29 AM, Sumner Trammell wrote: Hi, I'm working on a preferences panel. I want to build a compound panel like the kind seen in most mainstream apps today: a toolbar on top with tabbed view switching. The panel changes its appearance depending on which 32x32 toolbar icon you have selected. I'm not sure where to start. Looking for examples, I've looked in Safari's app bundle resources dir, and I see that Safari uses separate nibs per preferences tab. When I open one of these nibs, I see a window object, and that window object has the preference tab's layout. Pretty straightforward. Of course, Safari is not open source, so I can't go any further and see how this design works. Looking at the source for Transmission, I see they've taken a different approach, which is to have one PrefsWindow.xib, and in that xib, a number of View objects, one for each tab. Open the view object representing a particular preference tab, and you see its layout. I have not studied the Transmission source yet to see how they make it all work. So we have at least 2 accepted ways of doing the tabbed preference panel thing. But I'd like a better understanding of the hows and why's overall. Can anyone point me to some Cocoa programming guide docs, or programming topics docs, on tabbed preference panels? (Are they even called tabbed preference panels?) 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/greg%40omnigroup.com 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/ball.matt%40gmail.com 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/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: failing opening socket
On Aug 22, 2008, at 11:12 AM, Luca Ciciriello wrote: int sock_icmp = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP); returns always -1. Where is my mistake? For me is the very first time using socket on Mac. Is your application running as root? Attempts to create raw sockets don't work if your app isn't running as root. Also, when a low-level function like that returns an error, you can find out more about the error by looking at the errno variable. Nick Zitzmann http://www.chronosnet.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Object change to NSView update
On Aug 22, 2008, at 12:18 PM, Paul Bruneau wrote: Yes I think we agree on that part! The problem I am trying to communicate is where do I learn to make my model changes go through a controller, and how do I teach this controller to know to update the other views? As I said, I think I could get my way through this if the properties were in the order objects, but they can be in the children of the children of the order objects. To learn about the Model-View-Controller design pattern, read the Cocoa Fundamentals Guide http://developer.apple.com/documentation/ Cocoa/Conceptual/CocoaFundamentals/. That will also tell you about some types of controllers and their roles (coordinating controller vs. mediating controller). In there you will also find a discussion of ways to communicate among objects (the Communicating With Objects chapter). Notifications have already been mentioned. Key-value Observing (KVO) and Bindings may also serve your needs. Implementing Bindings on a custom view sounds like it would be a bit advanced for where you are, but it might be a long-term goal. After you've familiarized yourself with the fundamentals in this guide, follow the links it contains to the other, more topic-specific guides: Key-Value Coding Programming Guide http://developer.apple.com/ documentation/Cocoa/Conceptual/KeyValueCoding/ Key-Value Observing Programming Guide http://developer.apple.com/ documentation/Cocoa/Conceptual/KeyValueObserving/ Cocoa Bindings Programming Topics http://developer.apple.com/ documentation/Cocoa/Conceptual/CocoaBindings/ Feel free to ask more questions about what you find there. Cheers, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Cloning of cocoa screensaver to windows/linux(KDE)
It seems that finding someone who is both well versed in Cocoa and in the windows api or linux KDE screensaver API is a bit tricky. I was wondering if anyone here is capable of porting a cocoa screensaver to Windows or Linux (KDE environment)? I'd like Moire X to be ported over to both environments with no noticeable differences, the source code can be obtained here: http://downloads.sourceforge.net/moirex/Moirev4.0.1.source.zip. The end product should be a compiled binary and the source code, in addition the developer should expect both the binary and source to be posted to the sourceforge.net project. If you think you can take on this project, please contact me offlist. Payment amount is negotiable, I will pay promptly via PayPal after end product is approved as satisfactory. -- Best Regards, John Musbach ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Preventing windows from being dragged
On Aug 21, 2008, at 10:02 PM, Ricky Sharp wrote: Creating a non-movable, non-titled window is _trivial_. Just create a tiny subclass and away you go. I do this myself, along with following the guidelines of that technote. Why would it be necessary to make a subclass? Shouldn't it be possible to pass NSBorderlessWindowMask as the styleMask parameter in - [NSWindow initWithContentRect:styleMask:backing:defer:] to get a window with no title bar (which thus can't be dragged)? Charles ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSMenuItem - setHidden
On 22-Aug-08, at 1:34 PM, Stuart Green wrote: Cheers, Tried: [itemToBeHidden setAutoEnablesItems:NO]; Don't call setAutoEnblesItems on the item you want to hide (NSMenuItem) call it on the menu to which the item belongs (or is gonna get added- NSMenu class) [itemToBeHidden setHidden:YES]; Still doesn't work. Couldn't see any options in IB to set this. in IB you'd see the option when the NSMenu is selected, not the NSMenuItem Stu On 22 Aug 2008, at 18:26, chaitanya pandit wrote: Set the menuitem's menu's setAutoEnablesItems to NO Or you may have an option to do so in IB itself On 22-Aug-08, at 9:28 AM, Stuart Green wrote: Hi, I've got a menu item in my app's root menu that I want to hide. I've referenced it as an IBOutlet as per: IBOutlet id itemToBeHidden; I'm trying to hide it as per: [itemToBeHidden setHidden:YES]; Problem is, item does not hide. Any ideas? Thanks, Stu ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/chaitanya%40expersis.com 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/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Preventing windows from being dragged
On Aug 21, 2008, at 10:02 PM, Ricky Sharp wrote: (1) never ever ever capture the display when using AppKit. This appears to be incorrect, as Apple seems to endorse and even provides sample code for capturing the screen while using AppKit: http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaDrawingGuide/AdvancedDrawing/chapter_9_section_4.html#/ /apple_ref/doc/uid/TP40003290-CH207-DontLinkElementID_8 Charles ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Preventing windows from being dragged
On Aug 22, 2008, at 3:13 PM, Charles Srstka wrote: On Aug 21, 2008, at 10:02 PM, Ricky Sharp wrote: Creating a non-movable, non-titled window is _trivial_. Just create a tiny subclass and away you go. I do this myself, along with following the guidelines of that technote. Why would it be necessary to make a subclass? Shouldn't it be possible to pass NSBorderlessWindowMask as the styleMask parameter in -[NSWindow initWithContentRect:styleMask:backing:defer:] to get a window with no title bar (which thus can't be dragged)? Yes, but the OP didn't want to create the window in code. That's not so unreasonable -- I'd prefer to use IB to create the window and fill in UI components, like with any other window. You *could* create a content view in IB, create the borderless window in code, then swap in the content view. But that seems like slightly more work. Back when I made the much-hated metallic windows a user pref, I used this approach so that I could use the same nib file to load a window and decide at runtime, depending on the user pref, whether it should be textured or not. --Andy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Leopard crash in CFRunLoopAddObserver()
Hi All, I am sorry if I have posted to cross dev-lists. I am in a very strange situation. I am bit new to Mac. I had an existing desktop application. I wanted to run this application inside Firefox process for some requirement. So I just built my existing application as bundle and started running the application main body in a different thread inside firefox process. As a result of that Firefox has its own RunApplicationEventLoop() and its application queue. And in the secondary thread I created to run my application also has one more RunApplicationEventLoop(). Inside my application I have a idleTimer proc that's keeps fetching the events from main Application's queue and re fires the events to different controls in my application. After this simple change, everything (my application as well as Firefox) was working fine on Tiger and PPC. But when I run the same on Leapord, firefox's main thread is crashing predominantly at the following place if I keep the firefox app idle for a mintute or so. 0 com.apple.CoreFoundation 0x959ee13c CFRunLoopAddObserver + 44 1 com.apple.AppKit 0x9628bd0b -[NSApplication setWindowsNeedUpdate:] + 271 2 com.apple.Foundation 0x96b8fb13 __NSThreadPerformPerform + 547 3 com.apple.CoreFoundation 0x959f0615 CFRunLoopRunSpecific + 3141 4 com.apple.CoreFoundation 0x959f0cf8 CFRunLoopRunInMode + 88 5 com.apple.HIToolbox 0x90499da4 RunCurrentEventLoopInMode + 283 6 com.apple.HIToolbox 0x90499bbd ReceiveNextEventCommon + 374 7 com.apple.HIToolbox 0x904f85f2 _AcquireNextEvent + 58 8 com.apple.HIToolbox 0x904f6d4f RunApplicationEventLoop + 207 9 org.mozilla.firefox 0x00237f3f nsAppShell::~nsAppShell() + 133 10 org.mozilla.firefox 0x002c3cde nsAppStartup::DestroyExitEvent(PLEvent*) + 148 11 org.mozilla.firefox 0x656e XRE_main + 5892 12 org.mozilla.firefox 0x3178 main + 32 13 org.mozilla.firefox 0x30fe start + 270 14 org.mozilla.firefox 0x3019 start + 41 When firefox crashed, following the call trace of my secondary (applications) thread. #0 0x934f84a6 in mach_msg_trap #1 0x934ffc9c in mach_msg #2 0x95cfe0ce in CFRunLoopRunSpecific #3 0x95cfecf8 in CFRunLoopRunInMode #4 0x9552dda4 in RunCurrentEventLoopInMode #5 0x9552dbbd in ReceiveNextEventCommon #6 0x9558c5f2 in _AcquireNextEvent #7 0x9558ad4f in RunApplicationEventLoop #8 0x1129b6b9 in CRealApp::Run at CRealApp.cpp:622 #9 0x112bbffc in CWinAppImpl::Run at CWinAppPPImpl.cpp:386 #10 0x112bc0ff in RunContributeMain at CWinAppPPImpl.cpp:263 #11 0x111cd519 in IBEThreadProc at CContributeApp.cpp:32 #12 0x935296f5 in _pthread_start #13 0x935295b2 in thread_start The last call from my app is CRealApp::Run(), that has the main event loop of our app (RunApplicationEventLoop). In the other thread, the complete application is running. This thread is also doing UI work. You think of a application running in this thread, so whatever application does, something happens here also. I spoke with my senior colleagues regarding this, from them I got the information that in an application all UI work must happen in one thread and we should only have one RunApplicationEventLoop() for the application. But for me at this point of time, pulling out all the UI code from my secondary thread to the Firefox's application thread and making changes for single RunApplicationEventLoop will be time consuming and I may not able to do now. Is there are hack that I can do to fix this crash. Is there anybody who had this kind of situation. Could you please through some pointers ?. Thanks ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: failing opening socket
On Aug 22, 2008, at 13:12 , Luca Ciciriello wrote: Hi all. I'm porting a Linux project (using sockets to implement a ping function) on Mac OS X. My problem is that the function: int sock_icmp = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP); returns always -1. Where is my mistake? For me is the very first time using socket on Mac. Thanks in advance for any idea. Hi Luca, This isn't really a Cocoa question... you would probably get faster/ more responses for these kinds of questions on the Darwin-dev mailing list... but, you should do something like this (at least to debug): int sock_icmp; if( (sock_icmp = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP)) == -1 ) { fprintf(stderr, -- Error opening socket: %s\n, strerror(errno)); return -1; } However, your problem most likely is EACCES... in darwin, SOCK_RAW requires root privileges to open. HTH, Jason smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Preventing windows from being dragged
On Aug 22, 2008, at 15:46 , Charles Srstka wrote: On Aug 21, 2008, at 10:02 PM, Ricky Sharp wrote: (1) never ever ever capture the display when using AppKit. This appears to be incorrect, as Apple seems to endorse and even provides sample code for capturing the screen while using AppKit: It also appears that Leopard has added some support for this within AppKit itself... three new methods were added to NSView: -(BOOL)enterFullScreenMode:(NSScreen *)screen withOptions: (NSDictionary *)options; -(void)exitFullScreenModeWithScreen:(NSScreen *)screen; -(BOOL)isInFullScreenMode; I just tried them out and they were pretty easy and seemed to work well enough. I didn't even bother with the options, just sent: if( ![myView enterFullScreenMode:[NSScreen mainScreen] withOptions:nil] ) { /* error out */ } smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Preventing windows from being dragged
Am 22.08.2008 um 05:31 schrieb Kyle Sluder: . In my mind, I have a choice: either make the control interface a standard OS X app, allowing users the full functionality of the computer, or make a kiosk app that runs on some stripped-down Linux distribution in single-user mode. I still haven't determined which I'll do. I opted for some CoreAnimation based simplified interface. Most striped down Linux installs I've seen tended to end up.. erm.. with plenty room for visual improvements. Regards, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSMenuItem - setHidden
On Aug 22, 2008, at 6:28 AM, Stuart Green wrote: Hi, I've got a menu item in my app's root menu that I want to hide. I've referenced it as an IBOutlet as per: IBOutlet id itemToBeHidden; I'm trying to hide it as per: [itemToBeHidden setHidden:YES]; Problem is, item does not hide. Any ideas? Thanks, The most likely reason is that you never connected the outlet, so itemToBeHidden is nil. -Peter ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: File Extensions Problem
On Aug 22, 2008, at 10:39 AM, Andrew Merenbach wrote: To build on this, doesn't fast enumeration (Leopard-only, of course) raise an exception if a value is modified while the enumeration is running? (Not tested personally by me, but building upon an earlier thread from a little while back.) It does throw an exception, and what's more, even plain old NSEnumerator uses NSFastEnumeration under the hood if you compile against the 10.5 SDK and set Mac OS X 10.5 as the deployment target, so you'll get exceptions even if you use the old-fashioned enumerators. The best way to do this is not to remove objects from anything. Just create a new, empty mutable array, and *add* .mp3 files to the array as you find them. Charles ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Preventing windows from being dragged
On Aug 22, 2008, at 2:13 PM, Charles Srstka wrote: On Aug 21, 2008, at 10:02 PM, Ricky Sharp wrote: Creating a non-movable, non-titled window is _trivial_. Just create a tiny subclass and away you go. I do this myself, along with following the guidelines of that technote. Why would it be necessary to make a subclass? Shouldn't it be possible to pass NSBorderlessWindowMask as the styleMask parameter in -[NSWindow initWithContentRect:styleMask:backing:defer:] to get a window with no title bar (which thus can't be dragged)? I suppose depending upon your needs, you may be able to avoid a subclass. For my stuff, my subclass provides a bit more than just an override to the designated initializer: - Provides a mouse-moved delegate - Overrides canBecomeKeyWindow and canBecomeMainWindow (content window always returns YES for these APIs; blanking window always returns NO) - Accessibility overrides - to mainly route 'confirm' and 'cancel' actions to appropriate controls. - Misc APIs that provide conveniences to my custom UI framework. A category was not possible in my case since I needed to add ivars. ___ Ricky A. Sharp mailto:[EMAIL PROTECTED] Instant Interactive(tm) http://www.instantinteractive.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
CollectionView, PopupButton, CoreData and Bindings
Hi everone, I am trying to insert a PopupButton in the prototype of my collectionView with CoreData and binding. I have the following data model: Entity Author with the property name and the to-many-relationship books (- to Entity Book) Entity Book with property title and to-one-relationship author (- to Entity Author) A classical invers relationship. I have two ArrayControllers: Authors and Books. The Books-Controller is bound through ContentSet (Authors.selection.books) to the Authors-Controller and as usual to the managedObjectContext. I also have the default CollectionViewItem-Controller. It is no problem to manage a textField (in the prototype view of the collectionView) showing for example the name of the author via the representedObject and binding to Collection View Item. What I want: A popupButton in the prototype view showing the titles of the books as content values via binding. What I tried: Accessing the data via the representedObject.books - failed Accessing the data via a new controller, bound to Collection View Item and representedObject to contenObject - failed Accessing the data via a ValueTransformer that transforms the Author-Entity of representedObject to an array of Book - failed Anyone any ideas??? Thanks. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Two questions about CoreData migration
The first question is a simple one. After migration, the old persistent store is renamed sourceURL~.xml, and the document is supposed to open with a new persistent store with the old url, sourceURL.xml,. However, the document window that appears after migration has the title sourceURL~.xml, and saving this replaces the original, unmigrated document. Why doesn't the document open with sourceURL? I have examined the document at various stages during the open document process, and it consistently reports the URL without the tilde. And that is how the window initially appears. However, it switches to the form with the tilde as soon as the window is activated. The second question is a bit more complicated. I have two entities with a one-to-many parent-child relationship. Say the parent is an entity named Parent. This is an abstract class; only Parent subclasses are instantiated. In the data model, the destination of the child to parent relationship is the abstract Parent class. When I create a mapping model, there is no entity mapping for the Parent class automatically, I suppose because it is abstract. I can't compile the mapping model if there is no property mapping for the child to parent relationship. So I create an entity mapping for the abstract class Parent, and make a property mapping for the relationship using this mapping. But when the model is migrated, the Parent mapping is never used, I suppose because there are no Parent entities. So that destinationInstancesForEntityMappingNamed:@Parent is empty for any child instance when the relations are being recreated. But it gets even stranger. I created a new migration policy class, MyPolicy, and assigned it as the custom policy for the child entity mapping. This class overrides only createRelationshipsForDestinationInstance. When this is called for a child instance, the child initially has a parent; but after executing super's createRelationshipsForDestinationInstance, the parent relationship is gone, which is consistent with there being no destination instances. So what I've done is to save the parent, call the super method, and then restore the parent. This fixes the problem, but seems rather desperate. What is the correct method for dealing with a property mapping that involves an abstract class? -- Timothy Larkin Abstract Tools Caroline, NY PGP.sig Description: This is a digitally signed message part ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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]
NSURLDownload Tiger Leopard
Hello, I have made a software to download a file from the http server. Connection to the server require authentication. I use standard NSURLDownload and delegate method didReceiveAuthenticationChallenge to authenticate. On Leopard it works just fine. On Tiger it present authentication error. Do you have any idea? Thanks, Vlad ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Preventing windows from being dragged
On Aug 22, 2008, at 2:46 PM, Charles Srstka wrote: On Aug 21, 2008, at 10:02 PM, Ricky Sharp wrote: (1) never ever ever capture the display when using AppKit. This appears to be incorrect, as Apple seems to endorse and even provides sample code for capturing the screen while using AppKit: http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaDrawingGuide/AdvancedDrawing/chapter_9_section_4.html#/ /apple_ref/doc/uid/TP40003290-CH207-DontLinkElementID_8 Hmm...they are not explicit about what they're doing in that doc. It's really about situations where you want complete control over all drawing (e.g. via OpenGL) Apple engineers on quartz-dev first pointed out the huge problems you can run into if mixing captured displays with AppKit such that AppKit will also be drawing stuff. You'll end up with numerous issues if attempting, for example, to use NSAlert. Alert windows usually will end up below your content window since its too high in the window list. You can also end up with numerous drawing artifacts. ___ Ricky A. Sharp mailto:[EMAIL PROTECTED] Instant Interactive(tm) http://www.instantinteractive.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Displaying time
On 23/08/2008, at 1:18 AM, Michael Ash wrote: On Fri, Aug 22, 2008 at 8:51 AM, Ron Fleckner [EMAIL PROTECTED] wrote: Is there a way to update the time without using an NSTimer? I'd like my clock to be synchronised with the menu bar clock. Maybe this isn't a Cocoa question. Thanks for your answers. It's pretty simple. Use a *non* repeating timer. In the timer's action method, compute the time until the next update. Then set up a new *non* repeating timer for that time interval. For example, something like this: - (void)updateClock:(id)ignore { // update your clock based on the current time NSTimeInterval now = [NSDate timeIntervalSinceReferenceDate]; double whole = trunc(now); double fract = now - whole; double remaining = 1.0 - fract; [NSTimer scheduledTimerWithTimeInterval:remaining target:self selector:_cmd userInfo:nil repeats:NO]; } And then just call this method once on startup to get the ball rolling. The advantage is that you're only updating once per second, but your updates still follow extremely closely after the value updates. And it's self synchronizing, so if some kind of event happens to interrupt the update cycle (like sleeping the computer, or a huge burst of disk IO which blocks your app) then it will quickly get back on schedule once the method does manage to fire. The same technique can be applied to fractions of a second, or to minutes, hours, days, etc. Mike Wow, cool. I didn't know about _cmd, but found it in the docs in The Objective-C Programming Language. Thanks very much. It's a pity someone had to write my code for me, but I appreciate it anyway. Ron ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: File Extensions Problem
Am 22.08.2008 um 17:23 schrieb Michael Ash: On Fri, Aug 22, 2008 at 6:23 AM, Graham Cox [EMAIL PROTECTED] wrote: safe to delete items in the array at or higher than the current index. By the definition of an array, removing an item only affects the indexes of objects with equal or greater indexes than the removed item. You are making a big, unwarranted assumption about how reverseObjectEnumerator works. Namely, you are assuming that it merely tracks an index, and uses -objectAtIndex: (or equivalent) to retrieve each object. actually, there was an extensive thread last year. It seemed each enumerator created surprisingly a copy of the array, giving the OP some memory (or performance?) related trouble. IIRC it was the combination of a tight loop with tons of enumerators w/o local autorelease pools. Fast enumerators probably changed the rules since Tiger. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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]
Getting the active web page edit field for a WebView
I need to get the currently active edit field on a web page in my WebView (or nil if no edit field is active). Is there an easy way to do this without having to dive into the DOM? Thanks, Mike ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Custom view instantiated twice?
I have an NSView subclass defined in IB. It's a custom object in my nib and it's a child of a window's content view. I have an outlet defined in the NSView subclass that's bound to a static text field within my custom view. Upon running the app, two instances of my custom NSView class are created. In one of them, my outlet is bound correctly, but [view subviews] returns an empty array. In the other instance, my outlet is not bound (it's nil), but subviews returns the correct result (it shows the static text field)! In subsequent callbacks to my class, it's the instance whose outlet is not bound that is called. Any help? Xcode 3.1, BTW. Nick Pilch / Tacit Knowledge, LLC [EMAIL PROTECTED] Cell: 510-381-6777 ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Custom view instantiated twice?
On Aug 22, 2008, at 7:49 PM, Nick Pilch wrote: I have an NSView subclass defined in IB. It's a custom object in my nib and it's a child of a window's content view. You answered your own question. The custom object is a separate instance from the one you created within your window. You could create ten different custom objects and they would be different instances. You only need the one that's in your window. --Andy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSMenuItem - setHidden
On 23 Aug 2008, at 5:30 am, chaitanya pandit wrote: [itemToBeHidden setAutoEnablesItems:NO]; Don't call setAutoEnblesItems on the item you want to hide (NSMenuItem) call it on the menu to which the item belongs (or is gonna get added- NSMenu class) -setAutoEnablesItems: doesn't affect visible/hidden, it affects checked/unchecked. So it's unlikely to bear on this problem. hth, Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSMenuItem - setHidden
On 23 Aug 2008, at 11:15 am, Graham Cox wrote: -setAutoEnablesItems: doesn't affect visible/hidden, it affects checked/unchecked. So it's unlikely to bear on this problem. Oops, correction - it affects greyed out/not greyed out. But not visible/hidden. Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: ObjC 2.0, properties, KVC, special _ hacks etc.
On 22/08/2008, at 12:59 PM, Thomas Engelmeier wrote: Am 22.08.2008 um 00:59 schrieb Dave MacLachlan: Also, are the _ in front of member variables for Apple only (so we don't stomp on each other with member var names) or are they using them for the readability reason mentioned above? There is documentation where they have claimed _ at the beginning of method names as being Apple only, but nothing about method vars, and the KVC compliance docs seem to imply that it is fine to do. Officially it is Apple only, but everybody and his dog uses it - in consistency to quite some Apple-provided samples. Also, in C++ the _ variable prefix is reserved for stdlib- implementation. The reasoning why many people do not consider it as problematic if there is a collision with an Apple defined _ prefixed ivar is you will see an compiler error once there is a collision. Which pretty much means the preceding _ is just noise and gibberish and therefore plain bad style – something to avoid, it's not clever programming. Good style is to choose plain-language identifiers. The use of _ is to put white space between words in long identifiers, in contrast to poorly readable camelCase (maybe that should be hunchback case). (And note the spaces are outside the parentheses, not inside.) Why is it programmers generally choose the less-good way to do things, like programming Windows and C++!! For methods OTOH, you don't get an warning but potential runtime crashes and undefined behavior. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Wow, I'm simply blown away at the level of confusion. I've been doing C for a long long time. Prior to C99 there was no boolean type in C. I have never missed it. I have never ever seen a bug introduced by doing code like if(foo) or if(!foo) I have seen a large number of bugs introduced by programmers trying to make a boolean type for C and a lot of bugs introduced by trying to test for explicit trueness or nullness with code like if(foo == true) or if(foo = NULL) and so forth. I have also spent a lot of time devising clever macros to work around conflicting boolean types in other people's libraries. All of the right things happen if you simply accept that zero in all of its forms is false and not zero is true. All of the trouble comes when trying to define what is true or trying to write a comparison expression when simply testing the value of the variable would do. Put me firmly in the if(foo) camp. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: UTI Example
On Aug 22, 2008, at 10:42 PM, Adam Thorsen wrote: Are there any examples of using the UTI API to determine the UTI given a path to a file? On 10.4 and later, use LSCopyItemAttribute: FSRef fileRef; /* assuming valid fileRef */ CFStringRef theUTI; LSCopyItemAttribute(fileRef, kLSRolesAll, kLSItemContentType, (CFTypeRef *)theUTI); On 10.5 and later you can use -[NSWorkspace typeOfFile:error:]. -- Adam smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]