Re: SelectedRowIndexes
The user has an NSTableView in which is presented a number of elements ( 1 per row, typically 20 - 200 rows ) out of which they need to produce a number of sequenced sub groups. The user presses the 'Start Sub Group' key ( i.e. clear the sequence selection cache ) and then by picking a possible sequence ( one row/ element at a time ) they build a group. As the group is selected, further info about that particular sub group of elements is presented. They can close/abort/store a given sub group at any time. Peter On 15 Oct 2009, at 00:12, Graham Cox wrote: On 15/10/2009, at 10:01 AM, Peter Hudson wrote: I have tackled this problem by using the NSTableView delegate method tableViewSelectionDidChange: In this method I query the table for selected rows and then compare with the index set from the previous call to tableViewSelectionDidChange: I simply store the incremental changes in sequence. Like Kyle I'm curious about the rationale for this. Since there's no indication of how time played its part in coming up with the selection, doesn't this lead to strange behaviour for the user? What if I made a selection, got interrupted and only got back to work several hours later? How would what happened next make sense given that I'd almost certainly forgotten the selection sequence and had no feedback to remind me? Or does the selection get reflected in a second list that shows the sequence? That would make more sense but a pure selection with a hidden time element seems like a problematic UI to me. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: SelectedRowIndexes
On 15/10/2009, at 5:24 PM, Peter Hudson wrote: The user has an NSTableView in which is presented a number of elements ( 1 per row, typically 20 - 200 rows ) out of which they need to produce a number of sequenced sub groups. The user presses the 'Start Sub Group' key ( i.e. clear the sequence selection cache ) and then by picking a possible sequence ( one row/ element at a time ) they build a group. As the group is selected, further info about that particular sub group of elements is presented. They can close/abort/store a given sub group at any time. That does make some sense, but falls into the trap of not avoiding modes (in this case a build subgroup mode). If it were me, I'd have two lists: a master list and a sub-group list. Drag items from the master to the group, and allow drag reordering of the group to set the sequence. As a short-cut you could allow a double- click on an item in the master list to add it to the end of the subgroup, which almost duplicates the current approach but with a double-click instead of a single, yet avoids the mode. Just a thought ;-) --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: SelectedRowIndexes
We offer a drag and drop option as well - very similar to your idea. The problem is that our users find it easier to scroll their way through the list and command click on the appropriate rows. Users prefer to have their way I find. Peter On 15 Oct 2009, at 07:45, Graham Cox wrote: On 15/10/2009, at 5:24 PM, Peter Hudson wrote: The user has an NSTableView in which is presented a number of elements ( 1 per row, typically 20 - 200 rows ) out of which they need to produce a number of sequenced sub groups. The user presses the 'Start Sub Group' key ( i.e. clear the sequence selection cache ) and then by picking a possible sequence ( one row/element at a time ) they build a group. As the group is selected, further info about that particular sub group of elements is presented. They can close/abort/store a given sub group at any time. That does make some sense, but falls into the trap of not avoiding modes (in this case a build subgroup mode). If it were me, I'd have two lists: a master list and a sub-group list. Drag items from the master to the group, and allow drag reordering of the group to set the sequence. As a short-cut you could allow a double-click on an item in the master list to add it to the end of the subgroup, which almost duplicates the current approach but with a double-click instead of a single, yet avoids the mode. Just a thought ;-) --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: SelectedRowIndexes
Graham's solution is excellent. You could also have a couple of buttons between the two lists, with arrows (one right, one left) to move items to and remove them from, the sub-group list. And an additional pair to the right of the sub-group list (one up, one down) allowing reordering. This would allow a completely control (e.g. Buttons and lists) way of doing it. Finally, you could present the sub-group info above or below the sub-group list. From: Graham Cox graham@bigpond.com Date: Thu, 15 Oct 2009 17:45:59 +1100 To: Peter Hudson peter.hud...@mac.com Cc: cocoa-dev@lists.apple.com Subject: Re: SelectedRowIndexes On 15/10/2009, at 5:24 PM, Peter Hudson wrote: The user has an NSTableView in which is presented a number of elements ( 1 per row, typically 20 - 200 rows ) out of which they need to produce a number of sequenced sub groups. The user presses the 'Start Sub Group' key ( i.e. clear the sequence selection cache ) and then by picking a possible sequence ( one row/ element at a time ) they build a group. As the group is selected, further info about that particular sub group of elements is presented. They can close/abort/store a given sub group at any time. That does make some sense, but falls into the trap of not avoiding modes (in this case a build subgroup mode). If it were me, I'd have two lists: a master list and a sub-group list. Drag items from the master to the group, and allow drag reordering of the group to set the sequence. As a short-cut you could allow a double- click on an item in the master list to add it to the end of the subgroup, which almost duplicates the current approach but with a double-click instead of a single, yet avoids the mode. Just a thought ;-) --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/chris%40clwill.com This email sent to ch...@clwill.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: SelectedRowIndexes
On 15/10/2009, at 5:56 PM, Peter Hudson wrote: The problem is that our users find it easier to scroll their way through the list and command click on the appropriate rows. Users prefer to have their way I find. Ah, users. The bane of our lives! If only they didn't pay our wages... ;-) --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Record and Playback immediately
Hi, I took the examples of afplay afrecord. But it does the normal record to completion and play to completion manner. How can I Record into buffer and play from there. I hope instead of AFPlay, Queue based recording and playing would help. Can anybody put some light on this example. Regards symadept ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Record and Playback immediately
Le 15 oct. 2009 à 09:41, Symadept a écrit : Hi, I took the examples of afplay afrecord. But it does the normal record to completion and play to completion manner. How can I Record into buffer and play from there. I hope instead of AFPlay, Queue based recording and playing would help. Can anybody put some light on this example. Cocoa-dev is not Macos-dev. This question has nothing to do with Cocoa and should be ask on coreaudio list. That said, maybe the AudioQueueTools sample code may help. -- Jean-Daniel ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSSplitView and NSScrollView
I have placed a NSSplitView inside a NSScrollView in code. However, when the user resizes one of the views so part of it outside the NSScrollView visible bounds, the NSScrollView does not display the scroll bars. Is this not possible? Thank you, Harry Sfougaris ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Can I make custom pasteboard type for an object reference?
I messed around with this problem for some time, before I gave up trying to be clever and cast the pointer as an unsigned long. NSNumber *p = [NSNumber numberWithUnsignedLong:(unsigned long)object]; The number can be added to a pasteboard. Or if dragging more than one object, NSNumbers can be added to an NSArray, and the array written to the pasteboard. Tim Larkin Abstract Tools ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Can I make custom pasteboard type for an object reference?
On 15/10/2009, at 9:34 PM, Timothy Stafford Larkin wrote: I messed around with this problem for some time, before I gave up trying to be clever and cast the pointer as an unsigned long. NSNumber *p = [NSNumber numberWithUnsignedLong:(unsigned long) object]; The number can be added to a pasteboard. Or if dragging more than one object, NSNumbers can be added to an NSArray, and the array written to the pasteboard. You don't have to actually pass the data through the pasteboard if it's only moving it from one place to another within your app. You could just store the objects in some global (or better, class static) and then fetch them when you paste. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSArrayController performance using NSManagedObject content on 10.6
I am using an array of simple NSManagedObject subclasses bound to an NSArrayController. The object graph is shallow with a tiny number of objects (500). All objects are loaded into the NSArrayController MOC using an NSFetchRequest with setReturnsObjectsAsFaults:YES. Therefore no faulting should be occurring. The app is garbage collected. The CoreData atore type is XML. The NSArrayController's arrangedObjects is bound to an NSTableView. The NSArrayController's filterPredicate is bound to an NSSearchField. Under 10.5 manipulating the NSArrayController's arrangedObjects using either sort descriptors or the predicate is quick. Under 10.6 the performance is noticeably worse. Shark shows the following for both 10.5 and 10.6 when the filter predicate is updated. The issue seems to make itself manifest on the lines marked . Obviously the implementation here is different. NSPointerArray -compact seems to be the centre of activity. What options do I have here to try and restore performance? Is the issue related to the use of NSManagedObject content at all? OS X 10.6 (poor) 0.0% 89.5% AppKit -[NSArrayController setFilterPredicate:] 0.0% 89.5% AppKit -[NSArrayController _didChangeArrangementCriteriaWithOperationsMask:useBasis:] 0.0% 65.3% AppKit -[NSArrayController _arrangeObjectsWithSelectedObjects:avoidsEmptySelection:operationsMask:useBasis :] 0.0% 49.7% AppKit -[NSArrayController _setObjects:] 0.0% 49.7% AppKit - [_NSModelObservingTracker setIndexReferenceModelObjectArray:clearAllModelObjectObserving:] 0.0% 49.7% AppKit - [_NSModelObservingTracker clearAllModelObjectObserving] 0.0% 49.6% AppKit - [_NSModelObservingTracker _registerOrUnregister:observerNotificationsForModelObject:] 0.0% 49.6% Foundation -[NSObject (NSKeyValueObserverRegistration) removeObserver:forKeyPath:] 0.0% 49.5% Foundation -[NSObject (NSKeyValueObserverRegistration) _removeObserver:forProperty:] 0.1% 49.0% Foundation _NSKeyValueObservationInfoCreateByRemoving 0.0% 48.5% Foundation - [NSKeyValueObservationInfo _initWithObservances:count:] 3.6% 46.4% Foundation - [NSConcretePointerArray compact] 10.0% 42.8% Foundation readWeakAt 9.7% 31.4% libobjc.A.dylib objc_read_weak 19.6% 19.8% libauto.dylib auto_read_weak_reference 0.2% 0.2% libSystem.B.dylib __spin_lock OS X 10.5 (Good) 0.0% 37.6% AppKit -[NSArrayController setFilterPredicate:] 0.0% 37.6% AppKit -[NSArrayController _didChangeArrangementCriteriaWithOperationsMask:useBasis:] 0.0% 29.9% AppKit -[NSArrayController _arrangeObjectsWithSelectedObjects:avoidsEmptySelection:operationsMask:useBasis :] 0.0% 13.3% AppKit -[NSArrayController _setObjects:] 0.0% 12.4% AppKit -[NSArrayController _updateObservingForAutomaticallyRearrangingObjects] 0.0% 12.1% AppKit - [_NSModelObservingTracker startObservingModelObjectsAtReferenceIndexes:] 0.0% 12.1% AppKit - [_NSModelObservingTracker _startObservingModelObject:] 0.0% 12.1% AppKit - [_NSModelObservingTracker _registerOrUnregister:observerNotificationsForModelObject:] 0.0% 12.1% AppKit - [_NSModelObservingTracker _registerOrUnregister:observerNotificationsForKeyPath:ofModelObject:] 0.3% 12.1% Foundation -[NSObject (NSKeyValueObserverRegistration) addObserver:forKeyPath:options:context:] 0.3% 10.7% Foundation -[NSObject (NSKeyValueObserverRegistration) _addObserver:forProperty:options:context:] 0.0% 9.5% Foundation _NSKeyValueObservationInfoCreateByAdding 0.9% 6.5% Foundation - [NSKeyValueObservationInfo _initWithObservances:count:] 0.0% 4.1% CoreFoundation - [__NSPlaceholderArray initWithObjects:count:] 0.3% 4.1% CoreFoundation CFArrayCreate 0.0% 2.7% CoreFoundation __CFArrayInit 0.0% 2.7% CoreFoundation _CFRuntimeCreateInstance 0.0% 2.7% CoreFoundation
NSArrayController performance using NSManagedObject content on 10.6 (fixed typo)
The following is correct: All objects are loaded into the NSArrayController MOC using an NSFetchRequest with setReturnsObjectsAsFaults:NO. Jonathan Mitchell Developer http://www.mugginsoft.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Mixed font sizes in a UILabel?
I have a simple question. In my application (iPhone) I am displaying the current time. NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease]; [formatter setTimeStyle:NSDateFormatterShortStyle]; NSDate *date = [NSDate date]; [formatter setDateFormat:@h:mm a]; [clockLabel setText:[formatter stringFromDate:date]]; However I would like the AM or PM to display in a smaller font than the rest of the time string in my UILabel. How do I go about introducing that without resorting to using a separate UILabel? 9:00 AM Thanks, Eric ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Mixed font sizes in a UILabel?
If you don't want to use labels, you can draw the text yourself using UIStringDrawing methods. Otherwise, you need two labels for this. Luke On Oct 15, 2009, at 6:45 AM, Eric E. Dolecki wrote: I have a simple question. In my application (iPhone) I am displaying the current time. NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease]; [formatter setTimeStyle:NSDateFormatterShortStyle]; NSDate *date = [NSDate date]; [formatter setDateFormat:@h:mm a]; [clockLabel setText:[formatter stringFromDate:date]]; However I would like the AM or PM to display in a smaller font than the rest of the time string in my UILabel. How do I go about introducing that without resorting to using a separate UILabel? 9:00 AM Thanks, Eric ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com This email sent to luket...@apple.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Opening a NSSavePanel as a Sheet, and blocking like in [panel runModal]
On Oct 14, 2009, at 8:02 AM, Motti Shneor wrote: Hello. I'm in a strange situation, where I am implementing a plugin component that runs within a host application which I don't have access to. Within this context, The host sometimes calls my plug-in to open an NSSavePanel (or NSOpenPanel). The host expects that I'm synchronous --- i.e. I only return when the NSSavePanel is dismissed, and there's a result. However, The host also provides me with its own Window, and I need to open my NSSavePanel as a Sheet-window over the host's window. You really can't - sheets are document modal (by design), not application modal - if a window has a sheet displayed, the user needs to still be able to switch to other documents within the application and do stuff. The description of the plugin model does not sound like it supports it, so you'd use an application modal document, not a sheet. So you can probably make it look right, but you won't be able to make it work right (from the point of view of the user). Glenn Andreas gandr...@gandreas.com http://www.gandreas.com/ wicked fun! Mad, Bad, and Dangerous to Know ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Code Sign verification on Leopard
The malicious code could just move the entire original bundle wholesale. Code signature check still sees the original bundle. Sent from my iPhone On Oct 14, 2009, at 21:42, Charles Srstka cocoa...@charlessoft.com wrote: On Oct 14, 2009, at 11:40 PM, Jeff Laing wrote: Actually, heck, you wouldn't even need that. All a virus would have to do would be to move the binary somewhere else and put a binary in its place that does something malicious and then launches the real binary, and the user would never tell the difference. Unless, of course, the app checked its code signature. Ok, I'll bite. How does the real binary checking its code signature detect the case you just described? Its 100% byte for byte the original executable, its just been moved somewhere else and as far as I'm aware, code signatures do not include your location on disk. You check the signature of the .app bundle, not the executable itself. 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/clarkcox3%40gmail.com This email sent to clarkc...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Code Sign verification on Leopard
On Oct 15, 2009, at 9:57 AM, Clark S. Cox III wrote: The malicious code could just move the entire original bundle wholesale. Code signature check still sees the original bundle. Sent from my iPhone Presumably, this would be more noticeable to the user than simply copying a binary file inside an opaque app bundle that most users never look inside. Charles ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Code Sign verification on Leopard
On Oct 15, 2009, at 8:51 AM, Charles Srstka wrote: Presumably, this would be more noticeable to the user than simply copying a binary file inside an opaque app bundle that most users never look inside. The malicious code could also break the code sign checking APIs to always return 'true'. When you aren't certain if the code your running is yours, you can't trust anything that it does, including telling you it is valid. -- David Duncan Apple DTS Animation and Printing ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Code Sign verification on Leopard
On Thu, Oct 15, 2009 at 8:51 AM, Charles Srstka cocoa...@charlessoft.com wrote: On Oct 15, 2009, at 9:57 AM, Clark S. Cox III wrote: The malicious code could just move the entire original bundle wholesale. Code signature check still sees the original bundle. Sent from my iPhone Presumably, this would be more noticeable to the user than simply copying a binary file inside an opaque app bundle that most users never look inside. Not if the new opaque app bundle looks the same to the user (the new location of the application can be *within* a wrapper set up by the malicious code. Noticeable or not, the fact is that a check of your code signature, from within the same signed code is useless against malicious tampering. In order to detect malicious tampering, the code signature check must come from the outside. Period. Once the malicious code has the wherewithal to modify the application's code, there is nothing stopping it from modifying the signature check itself to always return true. -- Clark S. Cox III clarkc...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Can I make custom pasteboard type for an object reference?
On Wed, Oct 14, 2009 at 8:21 PM, Rick Mann rm...@latencyzero.com wrote: I'm trying to implement a library like Interface Builder's. When the user drags an item out of the library and onto one of my custom views, it should instantiate an object and place it in the view accordingly. I'm trying to implement the drag by writing to the pasteboard an NSData object I create that contains a reference to the object, like so: Skip the pasteboard. NSDraggingInfo has a -draggingSource method. This will return the source object that you passed in to the drag method when you initiated it. Just have the source implement some sort of -draggedObjects method, and then you can query it directly. Mike ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Mixed font sizes in a UILabel?
Thanks Luke. This might be a nice feature request to be able to do this easily (and let's say truncation and resizing would not work if implemented (I realize the pitfalls)). Eric On Thu, Oct 15, 2009 at 9:46 AM, Luke the Hiesterman luket...@apple.comwrote: If you don't want to use labels, you can draw the text yourself using UIStringDrawing methods. Otherwise, you need two labels for this. Luke On Oct 15, 2009, at 6:45 AM, Eric E. Dolecki wrote: I have a simple question. In my application (iPhone) I am displaying the current time. NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease]; [formatter setTimeStyle:NSDateFormatterShortStyle]; NSDate *date = [NSDate date]; [formatter setDateFormat:@h:mm a]; [clockLabel setText:[formatter stringFromDate:date]]; However I would like the AM or PM to display in a smaller font than the rest of the time string in my UILabel. How do I go about introducing that without resorting to using a separate UILabel? 9:00 AM Thanks, Eric ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com This email sent to luket...@apple.com -- http://ericd.net Interactive design and development ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Mixed font sizes in a UILabel?
Truncation and resizing would be super simple to implement since the UIStringDrawing handles all that for you. Simply make UIView that autoresizes and have the content style to redraw. SO a couple lines there. Then a drawRect with the UIStringDrawing methods to the size of the view and voila - its pretty much done. It'd be less code than this thread :D On Oct 15, 2009, at 11:20 AM, Eric E. Dolecki wrote: Thanks Luke. This might be a nice feature request to be able to do this easily (and let's say truncation and resizing would not work if implemented (I realize the pitfalls)). Eric On Thu, Oct 15, 2009 at 9:46 AM, Luke the Hiesterman luket...@apple.com wrote: If you don't want to use labels, you can draw the text yourself using UIStringDrawing methods. Otherwise, you need two labels for this. Luke On Oct 15, 2009, at 6:45 AM, Eric E. Dolecki wrote: I have a simple question. In my application (iPhone) I am displaying the current time. NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease]; [formatter setTimeStyle:NSDateFormatterShortStyle]; NSDate *date = [NSDate date]; [formatter setDateFormat:@h:mm a]; [clockLabel setText:[formatter stringFromDate:date]]; However I would like the AM or PM to display in a smaller font than the rest of the time string in my UILabel. How do I go about introducing that without resorting to using a separate UILabel? 9:00 AM Thanks, Eric ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/luketheh %40apple.com This email sent to luket...@apple.com -- http://ericd.net Interactive design and development ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/alex%40webis.net This email sent to a...@webis.net Alex Kac - President and Founder Web Information Solutions, Inc. You cannot build a reputation on what you intend to do. -- Liz Smith ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: shared preferences.
Thank a bunch guy's , this is exactly what i was looking for! Tegards. Sandro Noël sandro.n...@mac.com Mac OS X : Swear by your computer, not at it. -Pensez vert! avant d’imprimer ce courriel. -Go Green! please consider the environment before printing this email. On 2009-10-15, at 11:20 AM, Robert Douglas wrote: ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Mixed font sizes in a UILabel?
On Thu, Oct 15, 2009 at 9:20 AM, Eric E. Dolecki edole...@gmail.com wrote: Thanks Luke. This might be a nice feature request to be able to do this easily (and let's say truncation and resizing would not work if implemented (I realize the pitfalls)). You might want to check out Joe Hewitt (of Facebook fame)'s library: Three20. http://github.com/joehewitt/three20 It supports styled text labels with css among many other features. NSString* kText = @\ This is a test of styled labels. Styled labels support \ bbold text/b, iitalic text/i, span class=\blueText\colored text/span, \ span class=\largeText\font sizes/span, \ span class=\blueBox\spans with backgrounds/span, inline images \ img src=\bundle://smiley.png\/, and a href=\http://www.google.com\;hyperlinks/a you can \ actually touch. URLs are automatically converted into links, like this: http://www.foo.com\ divYou can enclose blocks within an HTML div./div\ Both line break characters\n\nand HTML line breaksbr/are respected.; TTStyledTextLabel* label1 = [[[TTStyledTextLabel alloc] initWithFrame:self.view.bounds] autorelease]; label1.font = [UIFont systemFontOfSize:17]; label1.text = [TTStyledText textFromXHTML:kText lineBreaks:YES URLs:YES]; label1.contentInset = UIEdgeInsetsMake(10, 10, 10, 10); [label1 sizeToFit]; [self.view addSubview:label1]; -jsd- ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
How to switch the default printer?
I tried different options to transparently switch the default printer and restore it (lpoptions called from my app) but although it works under SL, it doesn't seem to work so well for Leopard. Anybody has any suggestion on how to do that? Thanks in advance! -Laurent. -- Laurent Daudelin AIM/iChat/Skype:LaurentDaudelin http://nemesys.dyndns.org Logiciels Nemesys Software laurent.daude...@verizon.net Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSSplitView and NSScrollView
Good day, Would you like to share some of your code? It would be a lot easier to see what may be going on... Cheers! On Thu, Oct 15, 2009 at 3:31 AM, Harry Sfougaris hsfouga...@mac.com wrote: I have placed a NSSplitView inside a NSScrollView in code. However, when the user resizes one of the views so part of it outside the NSScrollView visible bounds, the NSScrollView does not display the scroll bars. Is this not possible? Thank you, Harry Sfougaris ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSSplitView and NSScrollView
On Thu, Oct 15, 2009 at 1:31 AM, Harry Sfougaris hsfouga...@mac.com wrote: I have placed a NSSplitView inside a NSScrollView in code. Obligatory question: why are you doing this in code, and not in Interface Builder? However, when the user resizes one of the views so part of it outside the NSScrollView visible bounds, the NSScrollView does not display the scroll bars. Sounds like you have an autoresize mask problem. Please post your code. If you're getting the scroll view itself from a nib (one of the very valid reasons to be actually inserting it into the split view in code), then please check the autoresize mask on the scroll view's content view. Is this not possible? Yes, it's certainly possible, and in the majority of cases it's far easier to do it in Interface Builder. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to switch the default printer?
On Thu, Oct 15, 2009 at 10:33 AM, Laurent Daudelin laurent.daude...@verizon.net wrote: Anybody has any suggestion on how to do that? This sounds like a terrible idea. If you want to maintain a separate default printer for your app or for a document (InDesign does this, for example, because documents are often tied to a specific print process) then use -[NSPrintInfo setPrinter:]. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to switch the default printer?
Yes, I know, it's terrible, but it's part of being able to convert any document to PDF and so far, I haven't found any other way then using a virtual printer driver. So, I have to temporarily switch to that printer to convert a document, then revert back to what it was. It's not only for my app, so NSPrintInfo is of no use in my situation :-( -Laurent. -- Laurent Daudelin AIM/iChat/Skype:LaurentDaudelin http://nemesys.dyndns.org Logiciels Nemesys Software laurent.daude...@verizon.net Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries On Oct 15, 2009, at 10:55, Kyle Sluder wrote: On Thu, Oct 15, 2009 at 10:33 AM, Laurent Daudelin laurent.daude...@verizon.net wrote: Anybody has any suggestion on how to do that? This sounds like a terrible idea. If you want to maintain a separate default printer for your app or for a document (InDesign does this, for example, because documents are often tied to a specific print process) then use -[NSPrintInfo setPrinter:]. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSSplitView and NSScrollView
I need it to be dynamic, as I am trying to build something similar to a report designer with multiple user-defined bands. My problem is that the split view just tries to autofit itself in the scroll view, and the size of the views changes as I resize the scroll view I'm doing the following: splitVw = [[NSSplitView alloc] initWithFrame:NSMakeRect(15, 15, 900, 800)]; [splitVw setVertical:NO]; [splitVw setAutoresizingMask:(NSViewHeightSizable )]; [splitVw addSubview:vw1]; [splitVw addSubview:vw2]; [splitVw addSubview:vw3]; [splitVw setAutoresizingMask:NSViewHeightSizable]; [scrollVw setDocumentView:splitVw]; Thanks, Harry On 15 Οκτ 2009, at 8:53 μ.μ., Kyle Sluder wrote: On Thu, Oct 15, 2009 at 1:31 AM, Harry Sfougaris hsfouga...@mac.com wrote: I have placed a NSSplitView inside a NSScrollView in code. Obligatory question: why are you doing this in code, and not in Interface Builder? However, when the user resizes one of the views so part of it outside the NSScrollView visible bounds, the NSScrollView does not display the scroll bars. Sounds like you have an autoresize mask problem. Please post your code. If you're getting the scroll view itself from a nib (one of the very valid reasons to be actually inserting it into the split view in code), then please check the autoresize mask on the scroll view's content view. Is this not possible? Yes, it's certainly possible, and in the majority of cases it's far easier to do it in Interface Builder. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to switch the default printer?
On Thu, Oct 15, 2009 at 10:58 AM, Laurent Daudelin laurent.daude...@verizon.net wrote: Yes, I know, it's terrible, but it's part of being able to convert any document to PDF and so far, I haven't found any other way then using a virtual printer driver. So, I have to temporarily switch to that printer to convert a document, then revert back to what it was. It's not only for my app, so NSPrintInfo is of no use in my situation :-( Hm, please elaborate. The OS can already turn any print operation into a PDF. What exactly does your solution do, and why should it not require the user to specify your virtual printer as the chosen one, a la Distiller? --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to switch the default printer?
On Oct 15, 2009, at 10:58 AM, Laurent Daudelin wrote: Yes, I know, it's terrible, but it's part of being able to convert any document to PDF and so far, I haven't found any other way then using a virtual printer driver. So, I have to temporarily switch to that printer to convert a document, then revert back to what it was. It's not only for my app, so NSPrintInfo is of no use in my situation :-( For your NSPrintInfo, set NSPrintJobDisposition to NSPrintSaveJob, and set the NSPrintSavePath or NSPrintJobSavingURL (10.6 or later) to the location you want to save the print job to. Then you can just run the print job as usual and it will save the PDF to file. -- David Duncan Apple DTS Animation and Printing ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: language based scaning
what I'm trying to do is sort of Twitter client, in which the tweets can be English or Arabic so in case of Arabic the alignment should be from right to left, i hope I made it clear this time cheers On Oct 13, 2009, at 2:26 PM, Ricky Sharp rsh...@mac.com wrote: You probably do not want to approach things this way. Arabic is bidirectional and you may have situations where you have a mixture of languages. What you should look at instead is to just localize your app to Arabic. In the Arabic version of your nibs, make the necessary adjustments. Sent from my iPhone On Oct 13, 2009, at 6:16 AM, Nz Gmail nassers...@gmail.com wrote: Hi, Is there is a way to figure out the occurance of Arabic chars so the label's alignment would be set accordingly (right to left)? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/rsharp%40mac.com This email sent to rsh...@mac.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to switch the default printer?
Well... suppose from my application, I want to convert a Word document to PDF. How would I do that? I did quite a bit of research and the only way I found was to use CUPS-PDF and have Word print to that printer. Then, I can retrieve the converted PDF document. Is there any other way? I don't do any printing from my own app but I want to have various applications that can print to convert a given document to PDF... -Laurent. -- Laurent Daudelin AIM/iChat/Skype:LaurentDaudelin http://nemesys.dyndns.org Logiciels Nemesys Software laurent.daude...@verizon.net Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries On Oct 15, 2009, at 11:01, Kyle Sluder wrote: On Thu, Oct 15, 2009 at 10:58 AM, Laurent Daudelin laurent.daude...@verizon.net wrote: Yes, I know, it's terrible, but it's part of being able to convert any document to PDF and so far, I haven't found any other way then using a virtual printer driver. So, I have to temporarily switch to that printer to convert a document, then revert back to what it was. It's not only for my app, so NSPrintInfo is of no use in my situation :-( Hm, please elaborate. The OS can already turn any print operation into a PDF. What exactly does your solution do, and why should it not require the user to specify your virtual printer as the chosen one, a la Distiller? --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to switch the default printer?
On Thu, Oct 15, 2009 at 11:17 AM, Laurent Daudelin laurent.daude...@verizon.net wrote: Well... suppose from my application, I want to convert a Word document to PDF. How would I do that? I did quite a bit of research and the only way I found was to use CUPS-PDF and have Word print to that printer. Then, I can retrieve the converted PDF document. Is there any other way? I don't do any printing from my own app but I want to have various applications that can print to convert a given document to PDF... The mental model needs to become Suppose the user is using Word and wants to send a PDF to my application. Then they will start a print job using your virtual printer as the device. If you want to automate this process, you can send a print Apple Event with the appropriate print settings. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to switch the default printer?
A print Apple Event? Can you elaborate a bit? -Laurent. -- Laurent Daudelin AIM/iChat/Skype:LaurentDaudelin http://nemesys.dyndns.org Logiciels Nemesys Software laurent.daude...@verizon.net Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries On Oct 15, 2009, at 11:22, Kyle Sluder wrote: On Thu, Oct 15, 2009 at 11:17 AM, Laurent Daudelin laurent.daude...@verizon.net wrote: Well... suppose from my application, I want to convert a Word document to PDF. How would I do that? I did quite a bit of research and the only way I found was to use CUPS-PDF and have Word print to that printer. Then, I can retrieve the converted PDF document. Is there any other way? I don't do any printing from my own app but I want to have various applications that can print to convert a given document to PDF... The mental model needs to become Suppose the user is using Word and wants to send a PDF to my application. Then they will start a print job using your virtual printer as the device. If you want to automate this process, you can send a print Apple Event with the appropriate print settings. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to switch the default printer?
On Thu, Oct 15, 2009 at 11:27 AM, Laurent Daudelin laurent.daude...@verizon.net wrote: A print Apple Event? Can you elaborate a bit? Apple Events are the IPC mechanism underlying AppleScript and Automator. I won't go into a detailed explanation, but open up AppleScript Editor and take a look at TextEdit's scripting dictionary, in particular the print command. Print is a part of the standard suite, so almost every application supports it. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: language based scaning
On Oct 15, 2009, at 1:11 PM, Nz Gmail wrote: what I'm trying to do is sort of Twitter client, in which the tweets can be English or Arabic so in case of Arabic the alignment should be from right to left, i hope I made it clear this time cheers In that case, you can probably scan the text for a Unicode code point within the ranges 0x0600 to 0x06FF and 0x750 to 0x77F. Hopefully that should cover it. However, should the Arabic text also contain presentation forms, code points can also fall within 0xFB50 to 0xFDFF and 0xFE70 to 0xFEFF. Now, I'm not sure about your exact content, but you may have blocks of text that are primarily English with Arabic content and visa versa. So, maybe just scan the first character and drive the layout based on that? e.g. [English block of text with arabic phrase here.whitespace] [whitespace.english phrase here with text of block Arabic] An exception arises if an Arabic block of text begins with Western Arabic digits; you may have to continue scanning until you reach the first alphabetic character. ___ Ricky A. Sharp mailto:rsh...@instantinteractive.com Instant Interactive(tm) http://www.instantinteractive.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSURLConnection timeout -- what happens?
I have looked through the NSURLConnection class reference, the NSURLRequest class reference, the URL Loading System guide, queried Google, searched mailing list archives, and even looked through NSURLConnection.h, but can not find documentation about what happens when an NSURLConnection times out. I presume that -- for the asynchronous case -- the invoker's -connection:didFailWithError: selector will be messaged. Is this so? Where is that defined? Also, the class reference for NSURLConnection's - connection:didFailWithError: says of the provided NSError object: An error object containing details of why the connection failed to load the request successfully. But I haven't been able to find any documentation of what the possible errors are, and what the data would be for those reported failures. The URL Loading System guide has an example that uses the key NSErrorFailingURLStringKey to access a value from the error object's userInfo dictionary. Where might other such keys be defined? Can someone please point me to appropriate reference materials. TIA, --Stuart ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Malloc leak from ImageIO library
Good day, I was running my app with Instruments - Leaks. This is a document-based-application. Whenever I save or open a file I get this leak: Category: Malloc 4.50 KB Event Type: Malloc RefCt: 1 Address: 0x103108000 Size: 4608 Responsible Library: ImageIO Responsible Caller: du_block::set_max_bytes(int, bool) Is there anything I can do about it? I don't know where to begin... Please let me know if any other info is necessary, I could attach .trace file from instruments. Thanks. Stack trace: 0 libSystem.B.dylib malloc 1 libstdc++.6.dylib operator new(unsigned long) 2 libstdc++.6.dylib operator new[](unsigned long) 3 ImageIO kdu_block::set_max_bytes(int, bool) 4 ImageIO kd_block::retrieve_data(kdu_block*, int) 5 ImageIO kdu_subband::open_block(kdu_coords, int*, kdu_thread_env*) 6 ImageIO kd_decoder::do_job(kdu_thread_entity*, int) 7 ImageIO kd_decoder::pull(kdu_line_buf, kdu_thread_env*) 8 ImageIO kd_synthesis::horizontal_synthesis(kd_vlift_line*, int, kdu_thread_env*) 9 ImageIO kd_synthesis::pull(kdu_line_buf, kdu_thread_env*) 10 ImageIO kd_multi_component::do_job(kdu_thread_entity*, int) 11 ImageIO kd_multi_synthesis::get_line(kd_multi_line*, int, kdu_thread_env*) 12 ImageIO kd_multi_synthesis::get_line(int, kdu_thread_env*) 13 ImageIO kdu_region_decompressor::process_generic(int, int, kdu_coords, int, int, int, kdu_dims, kdu_dims, int, bool) 14 ImageIO kdu_region_decompressor::process(int*, kdu_coords, int, int, int, int, kdu_dims, kdu_dims) 15 ImageIO kdrc_stream::process(int, kdu_dims, int) 16 ImageIO kdu_region_compositor::process(int, kdu_dims) 17 ImageIO _cg_JP2DecompressBand 18 ImageIO getBandProcJP2 19 ImageIO glueCopyImageBlockSet 20 ImageIO ImageProviderCopyImageBlockSetCallback 21 CoreGraphics img_blocks_create 22 CoreGraphics img_blocks_extent 23 CoreGraphics img_interpolate_extent 24 CoreGraphics img_data_lock 25 CoreGraphics CGSImageDataLock 26 libRIP.A.dylib ripc_AcquireImage 27 libRIP.A.dylib ripc_DrawImage 28 CoreGraphics CGContextDrawImage 29 AppKit __-[NSImageRep drawInRect:fromRect:operation:fraction:respectFlipped:hints:]_block_invoke_1 30 AppKit -[NSImageRep drawInRect:fromRect:operation:fraction:respectFlipped:hints:] 31 AppKit __-[NSImage drawInRect:fromRect:operation:fraction:respectFlipped:hints:]_block_invoke_1 32 AppKit -[NSImage _usingBestRepresentationForRect:context:hints:body:] 33 AppKit -[NSImage drawInRect:fromRect:operation:fraction:respectFlipped:hints:] 34 AppKit -[NSCompositeImageRep draw] 35 AppKit -[NSImageRep drawInRect:] 36 AppKit __-[NSImageRep drawInRect:fromRect:operation:fraction:respectFlipped:hints:]_block_invoke_2 37 AppKit __-[NSImageRep drawInRect:fromRect:operation:fraction:respectFlipped:hints:]_block_invoke_1 38 AppKit -[NSImageRep drawInRect:fromRect:operation:fraction:respectFlipped:hints:] 39 AppKit -[NSImageRep _createCGImageForProposedRect:context:hints:flipped:] 40 AppKit -[NSImageRep CGImageForProposedRect:context:hints:] 41 AppKit -[NSImageRep CGImageForProposedRect:context:hints:flipped:] 42 AppKit -[NSImage _createSnapshotRepForRep:rect:context:processedHints:] 43 AppKit -[NSImage _snapshotRepForRep:rect:context:processedHints:] 44 AppKit __-[NSImage drawInRect:fromRect:operation:fraction:respectFlipped:hints:]_block_invoke_1 45 AppKit -[NSImage _usingBestRepresentationForRect:context:hints:body:] 46 AppKit -[NSImage drawInRect:fromRect:operation:fraction:respectFlipped:hints:] 47 AppKit -[NSImage _drawMappingAlignmentRectToRect:withState:backgroundStyle:operation:fraction:flip:hints:] 48 AppKit -[NSImageCell drawInteriorWithFrame:inView:] 49 AppKit -[NSImageCell drawWithFrame:inView:] 50 AppKit -[NSControl drawRect:] 51 AppKit -[NSView _drawRect:clip:] 52 AppKit -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] 53 AppKit -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] 54 AppKit -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] 55 AppKit -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] 56 AppKit -[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] 57 AppKit -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] 58 AppKit -[NSView displayIfNeeded] 59 AppKit -[NSWindow _reallyDoOrderWindow:relativeTo:findKey:forCounter:force:isModal:] 60 AppKit -[NSApplication _orderFrontModalWindow:relativeToWindow:] 61 AppKit -[NSApplication _commonBeginModalSessionForWindow:relativeToWindow:modalDelegate:didEndSelector:contextInfo:] 62 AppKit -[NSAlert beginSheetModalForWindow:modalDelegate:didEndSelector:contextInfo:] 63 AppKit -[NSSavePanel _overwriteExistingFileCheck:] 64 AppKit -[NSSavePanel _okForSaveMode] 65 AppKit -[NSSavePanel ok:] 66 AppKit -[NSApplication sendAction:to:from:] 67 AppKit -[NSControl sendAction:to:] 68 AppKit -[NSCell
Re: How to switch the default printer?
On Oct 15, 2009, at 11:42, Kyle Sluder wrote: On Thu, Oct 15, 2009 at 11:27 AM, Laurent Daudelin laurent.daude...@verizon.net wrote: A print Apple Event? Can you elaborate a bit? Apple Events are the IPC mechanism underlying AppleScript and Automator. I won't go into a detailed explanation, but open up AppleScript Editor and take a look at TextEdit's scripting dictionary, in particular the print command. Print is a part of the standard suite, so almost every application supports it. --Kyle Sluder Kyle, I'm sorry to report that it doesn't work. Maybe it's a Word problem not reading the print settings but the print job will always go to the default printer (which is the last one I used in my testing), not to the CUPS-PDF one: tell application Microsoft Word set theDoc to alias Mac OS X:Users:laurent:Desktop:To Convert:MagazineSource Complaints.doc set printConfig to {copies:1, target printer:CUPS-PDF} print theDoc with properties printConfig end tell A;as Any other suggestion? -Laurent. -- Laurent Daudelin AIM/iChat/Skype:LaurentDaudelin http://nemesys.dyndns.org Logiciels Nemesys Software laurent.daude...@verizon.net Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: language based scaning,
thanks Ricky, so what classes should i be looking at ? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Opening a NSSavePanel as a Sheet, and blocking like in [panel runModal]
I had written this NSOpenPanel category to work in a plugin environment, and I think it should do the right thing. Just set up the NSOpenPanel as you like then call - runModalForDirectory:file:types:relativeToWindow: and it will return when the user has selected (or not) a file. steve // category on NSOpenPanel that runs the open sheet modally and returns when done @interface NSOpenPanel(ModalSheets) - (NSInteger)runModalForDirectory:(NSString*)path file:(NSString*) name types:(NSArray*)fileTypes relativeToWindow:(NSWindow*)window; @end @implementation NSOpenPanel(ModalSheets) - (void)__modalOpenPanelDidEnd:(NSOpenPanel*)panel returnCode:(int) returnCode contextInfo:(void*)contextInfo { #pragma unused(panel, contextInfo) [NSApp stopModalWithCode:returnCode]; } - (NSInteger)runModalForDirectory:(NSString*)path file:(NSString*) name types:(NSArray*)fileTypes relativeToWindow:(NSWindow*)window { NSInteger result; if (window != nil) { [self beginSheetForDirectory:path file:name modalForWindow:window modalDelegate:self didEndSelector:@selector (__modalOpenPanelDidEnd:returnCode:contextInfo:) contextInfo:nil]; result = [NSApp runModalForWindow:self]; [NSApp endSheet:self]; } else { result = [self runModalForDirectory:path file:name types:fileTypes]; } return result; } @end On Oct 14, 2009, at 6:02 AM, Motti Shneor wrote: I'm in a strange situation, where I am implementing a plugin component that runs within a host application which I don't have access to. Within this context, The host sometimes calls my plug-in to open an NSSavePanel (or NSOpenPanel). The host expects that I'm synchronous --- i.e. I only return when the NSSavePanel is dismissed, and there's a result. However, The host also provides me with its own Window, and I need to open my NSSavePanel as a Sheet-window over the host's window. Now NSSavePanel (and NSOpenPanel) provide 2 different ways to run them 1. runModal (or a vaiant) that is synchronous --- but it does not create a sheet window 2 beginSheetFor... (or variants) that are asynchronous (I must supply with a callback selector to be called as the NSSavePanel is dismissed) --- these DO create a sheet over the parent window. Is there a decent way to combine these two requirements? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSURLConnection timeout -- what happens?
On Oct 15, 2009, at 11:44 AM, Stuart Malin wrote: I have looked through the NSURLConnection class reference, the NSURLRequest class reference, the URL Loading System guide, queried Google, searched mailing list archives, and even looked through NSURLConnection.h, but can not find documentation about what happens when an NSURLConnection times out. I presume that -- for the asynchronous case -- the invoker's -connection:didFailWithError: selector will be messaged. Is this so? Where is that defined? I think so, but I don't remember for sure. Why not try it? Set a timeout of 0.1 sec and send a request to a slow server. But I haven't been able to find any documentation of what the possible errors are, and what the data would be for those reported failures. NSURLError.h. But in practice you can sometimes get errors from other domains too, especially if SSL is involved. The URL Loading System guide has an example that uses the key NSErrorFailingURLStringKey to access a value from the error object's userInfo dictionary. Where might other such keys be defined? Tip: To see where a symbol is defined, hold down Command and double- click it. If you'd done that with that key, it would have taken you to NSURLError.h and answered part of your question. —Jens___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: language based scaning,
On Oct 15, 2009, at 12:33 PM, Nasser Al Zahrani wrote: so what classes should i be looking at ? NSString, mostly. Call -characters and loop over the UniChar[] array it returns. It's possible there are APIs for language/script detection at a lower level, like CoreText, but this may be the wrong list to find experts on that. Another possibility that just occurred to me — assuming you're loading the text into an NSTextView already, you can look at the layout information which should tell you the directionality of each run. This is probably somewhere in NSLayoutManager, but I'm not an expert on that class. —Jens___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Malloc leak from ImageIO library
Hi Karolis, That one's a false positive. The JPEG2000 library allocates memory at pointer p, but holds onto a pointer q and constant k such that q + k is p. Leaks cannot tell that the app can still get at the pointer, so it thinks the memory has been leaked. Of course, one never wants to see false positives. Either leaks or the library should be modified to make this go away. There's a bug for it. -Ken Cocoa Frameworks On Thu, Oct 15, 2009 at 11:51 AM, Karolis Ramanauskas karol...@gmail.comwrote: Good day, I was running my app with Instruments - Leaks. This is a document-based-application. Whenever I save or open a file I get this leak: Category: Malloc 4.50 KB Event Type: Malloc RefCt: 1 Address: 0x103108000 Size: 4608 Responsible Library: ImageIO Responsible Caller: du_block::set_max_bytes(int, bool) Is there anything I can do about it? I don't know where to begin... Please let me know if any other info is necessary, I could attach .trace file from instruments. Thanks. Stack trace: 0 libSystem.B.dylib malloc 1 libstdc++.6.dylib operator new(unsigned long) 2 libstdc++.6.dylib operator new[](unsigned long) 3 ImageIO kdu_block::set_max_bytes(int, bool) 4 ImageIO kd_block::retrieve_data(kdu_block*, int) 5 ImageIO kdu_subband::open_block(kdu_coords, int*, kdu_thread_env*) 6 ImageIO kd_decoder::do_job(kdu_thread_entity*, int) 7 ImageIO kd_decoder::pull(kdu_line_buf, kdu_thread_env*) 8 ImageIO kd_synthesis::horizontal_synthesis(kd_vlift_line*, int, kdu_thread_env*) 9 ImageIO kd_synthesis::pull(kdu_line_buf, kdu_thread_env*) 10 ImageIO kd_multi_component::do_job(kdu_thread_entity*, int) 11 ImageIO kd_multi_synthesis::get_line(kd_multi_line*, int, kdu_thread_env*) 12 ImageIO kd_multi_synthesis::get_line(int, kdu_thread_env*) 13 ImageIO kdu_region_decompressor::process_generic(int, int, kdu_coords, int, int, int, kdu_dims, kdu_dims, int, bool) 14 ImageIO kdu_region_decompressor::process(int*, kdu_coords, int, int, int, int, kdu_dims, kdu_dims) 15 ImageIO kdrc_stream::process(int, kdu_dims, int) 16 ImageIO kdu_region_compositor::process(int, kdu_dims) 17 ImageIO _cg_JP2DecompressBand 18 ImageIO getBandProcJP2 19 ImageIO glueCopyImageBlockSet 20 ImageIO ImageProviderCopyImageBlockSetCallback 21 CoreGraphics img_blocks_create 22 CoreGraphics img_blocks_extent 23 CoreGraphics img_interpolate_extent 24 CoreGraphics img_data_lock 25 CoreGraphics CGSImageDataLock 26 libRIP.A.dylib ripc_AcquireImage 27 libRIP.A.dylib ripc_DrawImage 28 CoreGraphics CGContextDrawImage 29 AppKit __-[NSImageRep drawInRect:fromRect:operation:fraction:respectFlipped:hints:]_block_invoke_1 30 AppKit -[NSImageRep drawInRect:fromRect:operation:fraction:respectFlipped:hints:] 31 AppKit __-[NSImage drawInRect:fromRect:operation:fraction:respectFlipped:hints:]_block_invoke_1 32 AppKit -[NSImage _usingBestRepresentationForRect:context:hints:body:] 33 AppKit -[NSImage drawInRect:fromRect:operation:fraction:respectFlipped:hints:] 34 AppKit -[NSCompositeImageRep draw] 35 AppKit -[NSImageRep drawInRect:] 36 AppKit __-[NSImageRep drawInRect:fromRect:operation:fraction:respectFlipped:hints:]_block_invoke_2 37 AppKit __-[NSImageRep drawInRect:fromRect:operation:fraction:respectFlipped:hints:]_block_invoke_1 38 AppKit -[NSImageRep drawInRect:fromRect:operation:fraction:respectFlipped:hints:] 39 AppKit -[NSImageRep _createCGImageForProposedRect:context:hints:flipped:] 40 AppKit -[NSImageRep CGImageForProposedRect:context:hints:] 41 AppKit -[NSImageRep CGImageForProposedRect:context:hints:flipped:] 42 AppKit -[NSImage _createSnapshotRepForRep:rect:context:processedHints:] 43 AppKit -[NSImage _snapshotRepForRep:rect:context:processedHints:] 44 AppKit __-[NSImage drawInRect:fromRect:operation:fraction:respectFlipped:hints:]_block_invoke_1 45 AppKit -[NSImage _usingBestRepresentationForRect:context:hints:body:] 46 AppKit -[NSImage drawInRect:fromRect:operation:fraction:respectFlipped:hints:] 47 AppKit -[NSImage _drawMappingAlignmentRectToRect:withState:backgroundStyle:operation:fraction:flip:hints:] 48 AppKit -[NSImageCell drawInteriorWithFrame:inView:] 49 AppKit -[NSImageCell drawWithFrame:inView:] 50 AppKit -[NSControl drawRect:] 51 AppKit -[NSView _drawRect:clip:] 52 AppKit -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] 53 AppKit -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] 54 AppKit -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] 55 AppKit -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] 56 AppKit -[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] 57 AppKit -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] 58 AppKit -[NSView displayIfNeeded] 59 AppKit -[NSWindow
Re: Malloc leak from ImageIO library
Thank you On Thu, Oct 15, 2009 at 3:05 PM, Ken Ferry kenfe...@gmail.com wrote: Hi Karolis, That one's a false positive. The JPEG2000 library allocates memory at pointer p, but holds onto a pointer q and constant k such that q + k is p. Leaks cannot tell that the app can still get at the pointer, so it thinks the memory has been leaked. Of course, one never wants to see false positives. Either leaks or the library should be modified to make this go away. There's a bug for it. -Ken Cocoa Frameworks ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
A good Obc-C framework for sending email?
Hi all. I need a good Obj-C framework for sending email. I used to use the Message.framework associated with Apple's Mail, but they killed that a long time ago, sadly. Then I used Pantomime; but it seems to also be abandoned, now, and it is crashing on 10.5 (and it was never terribly reliable anyway). Does anybody know of a good replacement? I haven't had any luck trying to find one using Google. Jens Alfke suggested wrapping a call to sendmail in NSTask, while somehow groping out the right SMTP settings from Mail's prefs, but that sounds like quite a hassle, and hard to get really right such that emails would be reliably delivered. Does anybody have reusable code to do something along these lines? If no good replacement exists, then: if there is anybody on this list who knows Pantomime's code, it could very much use an update. I will be happy to supply crash logs. :- Thanks! Ben Haller Stick Software ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: A good Obc-C framework for sending email?
Perhaps EDMessage? http://www.mulle-kybernetik.com/software/EDFrameworks/ -B ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: A good Obc-C framework for sending email?
On 15-Oct-09, at 4:57 PM, Bryan Matteson wrote: Perhaps EDMessage? http://www.mulle-kybernetik.com/software/EDFrameworks/ EDMessage looks good, thanks! Ben Haller Stick Software ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: language based scaning,
On Oct 15, 2009, at 1:02 PM, Jens Alfke wrote: NSString, mostly. Call -characters and loop over the UniChar[] array it returns. It's possible there are APIs for language/script detection at a lower level, like CoreText, but this may be the wrong list to find experts on that. Another possibility that just occurred to me — assuming you're loading the text into an NSTextView already, you can look at the layout information which should tell you the directionality of each run. This is probably somewhere in NSLayoutManager, but I'm not an expert on that class. Yes, there are better ways to do this. What they are depends a bit on exactly what is wanted. The easiest case is one where you do no work, and just let the system handle things--for example, if you set the paragraph alignment to natural, then the text system automatically aligns to the left or right depending on whether the text is LTR or RTL. If you need to detect the language of a piece of text, CFStringTokenizer can do that; in Snow Leopard there is also a higher- level language detection feature, as part of text checking, which is available via NSTextView. If you want to find pieces of text that are in a given script, you can use NSCharacterSet--that's better than getting an array of characters and looping over it manually. And yes, if you want the resolved layout directionality of a bit of text as it is laid out, you can ask for the NSGlyphAttributeBidiLevel in NSLayoutManager, but that's probably more detailed than you really want. Douglas Davidson ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to switch the default printer?
Any more suggestion on this problem? After I reported that the little script I tried was not working, everybody suddenly went mute. I'm still having to find a solution to this nagging and, quite stupid problem. Thanks in advance. -Laurent. -- Laurent Daudelin AIM/iChat/Skype:LaurentDaudelin http://nemesys.dyndns.org Logiciels Nemesys Software laurent.daude...@verizon.net Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries On Oct 15, 2009, at 11:05, David Duncan wrote: On Oct 15, 2009, at 10:58 AM, Laurent Daudelin wrote: Yes, I know, it's terrible, but it's part of being able to convert any document to PDF and so far, I haven't found any other way then using a virtual printer driver. So, I have to temporarily switch to that printer to convert a document, then revert back to what it was. It's not only for my app, so NSPrintInfo is of no use in my situation :-( For your NSPrintInfo, set NSPrintJobDisposition to NSPrintSaveJob, and set the NSPrintSavePath or NSPrintJobSavingURL (10.6 or later) to the location you want to save the print job to. Then you can just run the print job as usual and it will save the PDF to file. -- David Duncan Apple DTS Animation and Printing ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
iSync: getting events attachments?
Hi. Am I missing something or is it not possible to retrieve events' attachments when using iSync? I don't see any property in the default event schema. Anyone? -Laurent. -- Laurent Daudelin AIM/iChat/Skype:LaurentDaudelin http://nemesys.dyndns.org Logiciels Nemesys Software laurent.daude...@verizon.net Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
GC crash due to being naughty
Hi all. I'm getting a crash in auto_zone_root_write_barrier() that I don't understand. I suspect it has to do with this little blurb in the Garbage Collection Programming Guide: Limitations on Mac OS X v10.5: You may pass addresses of strong globals or statics into routines expecting pointers to object pointers (such as id* or NSError**) only if they have first been assigned to directly, rather than through a pointer dereference. You should never take the address of a weak global, static or instance variable, as assigning or reading through that pointer will bypass the weak barriers and expose your programs to race conditions. But I'm not really sure. :- Here's the situation. My app generates floods of instances of an NSObject subclass called AKIndividual. So many, in fact, that I don't want to alloc and dealloc them all, as that just thrashes the allocator madly (as verified with Sampler). Instead, I want to allocate a pool of them, and then throw them in the pool when I'm done with them, and get new ones out of the pool. (When I reuse them, I don't call -init again, I just wipe the ivars I'm using and put new values in, which I believe is OK.) When I'm messing about with them, and when they're in the pool, I don't want to keep them in Cocoa collections like NSMutableArray, because again that introduces too much overhead. Countless billions upon billions of these little guys I'm making, and the runtimes of my app will be measured in days to weeks, so optimizing this bottleneck really is important. So my solution was to keep pointers to them in malloced buffers instead. The unused pool is a malloced buffer, the pools of ones that are doing various things are also malloced buffers, and everything is nice fast C code at this level. But I guess pointers to objects kept in malloced buffers are weak references, so my objects would be collected if I didn't have a strong reference somewhere. So when I first allocate them, I throw them into an NSMutableArray, and I don't ever take them out. That array is kept by the controller of the whole shebang; so when that controller gets collected, then all the individuals will be collected, but until then, they should always be strong-referenced. This seems like it ought to work; and yet I get that crash in auto_zone_root_write_barrier(). After some puzzling, I found the above paragraph in the GC guide. I am indeed on 10.5. Is this what's biting me? I guess all the pointers to my AKIndividuals that are kept in my malloced arrays are all weak references, and so I guess the pointer to the malloced array itself, for example, is a pointer to a weak reference such as I am not supposed to use, and whenever I do something like individuals[i] to get an instance from my malloced buffer I guess I'm violating the weak barriers. I find it hard to believe that I'm not allowed to keep an array of pointers to objects, though; is that really what this blurb is saying? (On the other hand, the GC guide also says that the malloc zone is never scanned, which would imply that this is fine, and that the references I put in my malloced arrays are not even weak; but then I'm puzzled by the crash in a write barrier function...) I don't really understand what is prohibited and exactly why; that blurb is way too short, and the example is too short and cryptic. Can some explain what is actually prohibited, and why, and whether what I'm doing is prohibited? Given the architecture I'm aiming for, I don't need the references to even be weak references; I don't need them to zero out, because they never will, because these AKIndividuals live at least as long as any given malloced array of them will live. Indeed, I don't care about GC on them at all; I'd be quite happy to exclude them from the GC scheme altogether, and get back the overhead of these read/write barriers, given how much thrash is involved with them. Is that possible? For example, can I malloc the instances of AKIndividual myself out of the malloc zone to exclude them from GC, or is that a Bad Idea? Sorry for the long email. Comments? Ben Haller Stick Software ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: GC crash due to being naughty
Hi Ben, Have you considered the so-called Flyweight design pattern? It is designed to solve the problem of having a zillion objects to allocate. It sounds like this pattern might prevent your having to play the dirty tricks that are causing you problems. In the frameworks, Flyweight is used, AFAIK, in NSNumber, NSCell, and other classes. There's a good description of the pattern here: http://en.wikipedia.org/wiki/Flyweight_pattern Hope this helps a little. (I don't know what could be done to solve the crash you describe but passing pointers as you described sounds like it's bound to cause nasty problems.) Soong - Original Message From: Ben Haller bhcocoa...@sticksoftware.com To: Cocoa List cocoa-dev@lists.apple.com Sent: Thu, October 15, 2009 3:54:11 PM Subject: GC crash due to being naughty Hi all. I'm getting a crash in auto_zone_root_write_barrier() that I don't understand. I suspect it has to do with this little blurb in the Garbage Collection Programming Guide: Limitations on Mac OS X v10.5: You may pass addresses of strong globals or statics into routines expecting pointers to object pointers (such as id* or NSError**) only if they have first been assigned to directly, rather than through a pointer dereference. You should never take the address of a weak global, static or instance variable, as assigning or reading through that pointer will bypass the weak barriers and expose your programs to race conditions. But I'm not really sure. :- Here's the situation. My app generates floods of instances of an NSObject subclass called AKIndividual. So many, in fact, that I don't want to alloc and dealloc them all, as that just thrashes the allocator madly (as verified with Sampler). Instead, I want to allocate a pool of them, and then throw them in the pool when I'm done with them, and get new ones out of the pool. (When I reuse them, I don't call -init again, I just wipe the ivars I'm using and put new values in, which I believe is OK.) When I'm messing about with them, and when they're in the pool, I don't want to keep them in Cocoa collections like NSMutableArray, because again that introduces too much overhead. Countless billions upon billions of these little guys I'm making, and the runtimes of my app will be measured in days to weeks, so optimizing this bottleneck really is important. So my solution was to keep pointers to them in malloced buffers instead. The unused pool is a malloced buffer, the pools of ones that are doing various things are also malloced buffers, and everything is nice fast C code at this level. But I guess pointers to objects kept in malloced buffers are weak references, so my objects would be collected if I didn't have a strong reference somewhere. So when I first allocate them, I throw them into an NSMutableArray, and I don't ever take them out. That array is kept by the controller of the whole shebang; so when that controller gets collected, then all the individuals will be collected, but until then, they should always be strong-referenced. This seems like it ought to work; and yet I get that crash in auto_zone_root_write_barrier(). After some puzzling, I found the above paragraph in the GC guide. I am indeed on 10.5. Is this what's biting me? I guess all the pointers to my AKIndividuals that are kept in my malloced arrays are all weak references, and so I guess the pointer to the malloced array itself, for example, is a pointer to a weak reference such as I am not supposed to use, and whenever I do something like individuals[i] to get an instance from my malloced buffer I guess I'm violating the weak barriers. I find it hard to believe that I'm not allowed to keep an array of pointers to objects, though; is that really what this blurb is saying? (On the other hand, the GC guide also says that the malloc zone is never scanned, which would imply that this is fine, and that the references I put in my malloced arrays are not even weak; but then I'm puzzled by the crash in a write barrier function...) I don't really understand what is prohibited and exactly why; that blurb is way too short, and the example is too short and cryptic. Can some explain what is actually prohibited, and why, and whether what I'm doing is prohibited? Given the architecture I'm aiming for, I don't need the references to even be weak references; I don't need them to zero out, because they never will, because these AKIndividuals live at least as long as any given malloced array of them will live. Indeed, I don't care about GC on them at all; I'd be quite happy to exclude them from the GC scheme altogether, and get back the overhead of these read/write barriers, given how much thrash is involved with them. Is that possible? For example, can I malloc the instances of AKIndividual myself out of the malloc zone to exclude them from GC, or is that a Bad Idea? Sorry for the long email. Comments? Ben
Re: Subclassing a view class from an external framework
Although Interface Builder 3 is supposed to automatically sync with header files in your project, it seems to have trouble with headers in frameworks. Which version of Interface Builder were you seeing this on? IB 3.2.x will parse the headers for all frameworks you've linked against in your Xcode project. Kevin On 13 Oct 2009, at 07:55, Jeff Johnson wrote: Hi Mark. I had the same problem with NSWindow subclasses. Although Interface Builder 3 is supposed to automatically sync with header files in your project, it seems to have trouble with headers in frameworks. What I did was select Read Class Files... in the File menu of Interface Builder and read the header file for my framework class. The solved the problem for me. -Jeff On Oct 12, 2009, at 11:22 AM, Mark Gallegly wrote: I have an NSView subclass defined in a framework called FrameworkView. The FrameworkView class has a property like so: @property (nonatomic, retain) IBOutlet NSView* someView; This framework has the necessary code in it to work as an Interface Builder plugin, and everything seems to work fine in Interface Builder. However, if I subclass the FrameworkView in a separate project that contains my .app target, with say a class called MyFrameworkViewSubclass, I get a warning like this when building the .xib file containing MyFrameworkViewSubclass: The 'someView' outlet of 'MyFrameworkViewSubclass' is connected to 'Custom View' but 'someView' is no longer defined on MyFrameworkViewSubclass. Now, within IB the outlet shows up and I am able to make the connection, and when the app runs everything works fine, but for some reason XCode spits out this warning. Does anybody know what is going on here and how to get rid of the warning? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/cathey%40apple.com This email sent to cat...@apple.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Status Bar Search Field Can't Get Focus w/ LSUIElement PList Setting
I'm having a problem getting a NSSearchField to work properly in an NSStatusItem a la the Apple Help menu or the Apple Spotlight menu. Here's what's happening. I create my custom NSStatusItem / menu / custom view/ search field, and insert into into the status bar in -awakeFromNib. Setting the LSUIElement property in the Info.plist file then results in everything displaying and working correctly the very first time the NSStatusItem is clicked (after running the application from Xcode and it becomes active). The associated menu pops up with the custom view and search field, the search field has focus, shows the insertion pointer, and I can type a search term, press enter, and everything works great. But if I select the NSStatusItem a second time to perform a second search there is no insertion pointer, and I can't select the search field. When I try clicking around the custom view several times I get the following error: HIViewSetFocus() failed with error -30599 Now, if I don't set the LSUIElement property in the Info.plist file, and just run the application as a normal application, then I can get around the above problem by selecting the application first (making it active) and then the search field in the menu associated with the NSStatusItem always gets focus, the insertion pointer appears, and everything works fine. But I want to build an application that doesn't have a doc icon, window, or main menu using the LSUIElement property setting. From what I understand, it seems that the application needs to be active in order for the search field to get focus and for the text insertion pointer to appear, but I don't understand how to force this for an application that doesn't have a main window, doc icon, or menu bar by enabling LSUElement. Can anyone help? Best, Dalmazio ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: GC crash due to being naughty
That looks like it is more a matter of decreasing memory usage than decreasing alloc/dealloc/containment overhead. A flyweight is an object that minimizes memory use by sharing as much data as possible with other similar objects; it is a way to use objects in large numbers when a simple repeated representation would use an unacceptable amount of memory. So I don't think it applies to my problem. Thanks though! Ben Haller Stick Software On 15-Oct-09, at 7:14 PM, Oftenwrong Soong wrote: Hi Ben, Have you considered the so-called Flyweight design pattern? It is designed to solve the problem of having a zillion objects to allocate. It sounds like this pattern might prevent your having to play the dirty tricks that are causing you problems. In the frameworks, Flyweight is used, AFAIK, in NSNumber, NSCell, and other classes. There's a good description of the pattern here: http://en.wikipedia.org/wiki/Flyweight_pattern Hope this helps a little. (I don't know what could be done to solve the crash you describe but passing pointers as you described sounds like it's bound to cause nasty problems.) Soong - Original Message From: Ben Haller bhcocoa...@sticksoftware.com To: Cocoa List cocoa-dev@lists.apple.com Sent: Thu, October 15, 2009 3:54:11 PM Subject: GC crash due to being naughty Hi all. I'm getting a crash in auto_zone_root_write_barrier() that I don't understand. I suspect it has to do with this little blurb in the Garbage Collection Programming Guide: Limitations on Mac OS X v10.5: You may pass addresses of strong globals or statics into routines expecting pointers to object pointers (such as id* or NSError**) only if they have first been assigned to directly, rather than through a pointer dereference. You should never take the address of a weak global, static or instance variable, as assigning or reading through that pointer will bypass the weak barriers and expose your programs to race conditions. But I'm not really sure. :- Here's the situation. My app generates floods of instances of an NSObject subclass called AKIndividual. So many, in fact, that I don't want to alloc and dealloc them all, as that just thrashes the allocator madly (as verified with Sampler). Instead, I want to allocate a pool of them, and then throw them in the pool when I'm done with them, and get new ones out of the pool. (When I reuse them, I don't call -init again, I just wipe the ivars I'm using and put new values in, which I believe is OK.) When I'm messing about with them, and when they're in the pool, I don't want to keep them in Cocoa collections like NSMutableArray, because again that introduces too much overhead. Countless billions upon billions of these little guys I'm making, and the runtimes of my app will be measured in days to weeks, so optimizing this bottleneck really is important. So my solution was to keep pointers to them in malloced buffers instead. The unused pool is a malloced buffer, the pools of ones that are doing various things are also malloced buffers, and everything is nice fast C code at this level. But I guess pointers to objects kept in malloced buffers are weak references, so my objects would be collected if I didn't have a strong reference somewhere. So when I first allocate them, I throw them into an NSMutableArray, and I don't ever take them out. That array is kept by the controller of the whole shebang; so when that controller gets collected, then all the individuals will be collected, but until then, they should always be strong-referenced. This seems like it ought to work; and yet I get that crash in auto_zone_root_write_barrier(). After some puzzling, I found the above paragraph in the GC guide. I am indeed on 10.5. Is this what's biting me? I guess all the pointers to my AKIndividuals that are kept in my malloced arrays are all weak references, and so I guess the pointer to the malloced array itself, for example, is a pointer to a weak reference such as I am not supposed to use, and whenever I do something like individuals[i] to get an instance from my malloced buffer I guess I'm violating the weak barriers. I find it hard to believe that I'm not allowed to keep an array of pointers to objects, though; is that really what this blurb is saying? (On the other hand, the GC guide also says that the malloc zone is never scanned, which would imply that this is fine, and that the references I put in my malloced arrays are not even weak; but then I'm puzzled by the crash in a write barrier function...) I don't really understand what is prohibited and exactly why; that blurb is way too short, and the example is too short and cryptic. Can some explain what is actually prohibited, and why, and whether what I'm doing is prohibited? Given the architecture I'm aiming for, I don't need the references to even be weak
Re: GC crash due to being naughty
On Oct 15, 2009, at 3:54 PM, Ben Haller wrote: Hi all. I'm getting a crash in auto_zone_root_write_barrier() that I don't understand. I suspect it has to do with this little blurb in the Garbage Collection Programming Guide: Limitations on Mac OS X v10.5: You may pass addresses of strong globals or statics into routines expecting pointers to object pointers (such as id* or NSError**) only if they have first been assigned to directly, rather than through a pointer dereference. You should never take the address of a weak global, static or instance variable, as assigning or reading through that pointer will bypass the weak barriers and expose your programs to race conditions. But I'm not really sure. :- Here's the situation. My app generates floods of instances of an NSObject subclass called AKIndividual. So many, in fact, that I don't want to alloc and dealloc them all, as that just thrashes the allocator madly (as verified with Sampler). Instead, I want to allocate a pool of them, and then throw them in the pool when I'm done with them, and get new ones out of the pool. (When I reuse them, I don't call -init again, I just wipe the ivars I'm using and put new values in, which I believe is OK.) When I'm messing about with them, and when they're in the pool, I don't want to keep them in Cocoa collections like NSMutableArray, because again that introduces too much overhead. Countless billions upon billions of these little guys I'm making, and the runtimes of my app will be measured in days to weeks, so optimizing this bottleneck really is important. So my solution was to keep pointers to them in malloced buffers instead. The unused pool is a malloced buffer, the pools of ones that are doing various things are also malloced buffers, and everything is nice fast C code at this level. But I guess pointers to objects kept in malloced buffers are weak references, so my objects would be collected if I didn't have a strong reference somewhere. So when I first allocate them, I throw them into an NSMutableArray, and I don't ever take them out. That array is kept by the controller of the whole shebang; so when that controller gets collected, then all the individuals will be collected, but until then, they should always be strong-referenced. This seems like it ought to work; and yet I get that crash in auto_zone_root_write_barrier(). After some puzzling, I found the above paragraph in the GC guide. I am indeed on 10.5. Is this what's biting me? I guess all the pointers to my AKIndividuals that are kept in my malloced arrays are all weak references, and so I guess the pointer to the malloced array itself, for example, is a pointer to a weak reference such as I am not supposed to use, and whenever I do something like individuals[i] to get an instance from my malloced buffer I guess I'm violating the weak barriers. I find it hard to believe that I'm not allowed to keep an array of pointers to objects, though; is that really what this blurb is saying? (On the other hand, the GC guide also says that the malloc zone is never scanned, which would imply that this is fine, and that the references I put in my malloced arrays are not even weak; but then I'm puzzled by the crash in a write barrier function...) I don't really understand what is prohibited and exactly why; that blurb is way too short, and the example is too short and cryptic. Can some explain what is actually prohibited, and why, and whether what I'm doing is prohibited? A pointer value stored in an ordinary malloc block is neither a strong nor a weak reference. It is a dangling pointer. It can be used safely, but requires great care because the garbage collector has no knowledge of what you're doing. The auto_zone_root_write_barrier() crash can occur when you take the address of a global variable, then store into the global indirectly via that address. What does the crashed line of code look like? -- Greg Parker gpar...@apple.com Runtime Wrangler ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Subclassing a view class from an external framework
Turns out the issue I was having was caused by the fact that I did not have the headers in the framework bundle, once I figured out how to add the header files to the framework - which was not easy to figure out - and did the 'reload all class files' menu item in IB for each xib the problem went away. At least on my xcode 3.2.1 machine. On a machine running xcode 3.1 the warnings still show up, but I have not bothered to open each xib and choose to 'reload all class files' yet.. Mark On 10/15/09 4:24 PM, Kevin Cathey cat...@apple.com wrote: Although Interface Builder 3 is supposed to automatically sync with header files in your project, it seems to have trouble with headers in frameworks. Which version of Interface Builder were you seeing this on? IB 3.2.x will parse the headers for all frameworks you've linked against in your Xcode project. Kevin On 13 Oct 2009, at 07:55, Jeff Johnson wrote: Hi Mark. I had the same problem with NSWindow subclasses. Although Interface Builder 3 is supposed to automatically sync with header files in your project, it seems to have trouble with headers in frameworks. What I did was select Read Class Files... in the File menu of Interface Builder and read the header file for my framework class. The solved the problem for me. -Jeff On Oct 12, 2009, at 11:22 AM, Mark Gallegly wrote: I have an NSView subclass defined in a framework called FrameworkView. The FrameworkView class has a property like so: @property (nonatomic, retain) IBOutlet NSView* someView; This framework has the necessary code in it to work as an Interface Builder plugin, and everything seems to work fine in Interface Builder. However, if I subclass the FrameworkView in a separate project that contains my .app target, with say a class called MyFrameworkViewSubclass, I get a warning like this when building the .xib file containing MyFrameworkViewSubclass: The 'someView' outlet of 'MyFrameworkViewSubclass' is connected to 'Custom View' but 'someView' is no longer defined on MyFrameworkViewSubclass. Now, within IB the outlet shows up and I am able to make the connection, and when the app runs everything works fine, but for some reason XCode spits out this warning. Does anybody know what is going on here and how to get rid of the warning? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/cathey%40apple.com This email sent to cat...@apple.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: A good Obc-C framework for sending email?
The ED code looks like interesting and I will give it a try as well. Does anybody know of a good primer on creating / sending email ( possibly in a Cocoa / Objective-C environment ) 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 arch...@mail-archive.com
Re: GC crash due to being naughty
On 15-Oct-09, at 7:30 PM, Greg Parker wrote: A pointer value stored in an ordinary malloc block is neither a strong nor a weak reference. It is a dangling pointer. It can be used safely, but requires great care because the garbage collector has no knowledge of what you're doing. The auto_zone_root_write_barrier() crash can occur when you take the address of a global variable, then store into the global indirectly via that address. What does the crashed line of code look like? OK, here's a bit of context. The backtrace: #0 0x95058d7b in auto_zone_root_write_barrier () #1 0x964e40a8 in objc_assign_strongCast_gc () #2 0x7198 in -[AKPopulation addIndividualsFromPopulation:] (self=0x102b740, _cmd=0xe76c, population=0x10a9250) at .../ AKPopulation.m:101 That method: - (void)addIndividualsFromPopulation:(AKPopulation *)population { UInt32 individualCountForPop = [population individualCount]; AKIndividual **individualsForPop = [population individuals]; int i; if (individualCount + individualCountForPop individualCapacity) { individualCapacity = (individualCount + individualCountForPop) * 2; individuals = realloc(individuals, individualCapacity * sizeof(AKIndividual *)); } for (i = 0; i individualCountForPop; ++i) individuals[individualCount++] = individualsForPop[i]; } The crash is in the last line of the method, in the assignment. The class as it stands right now: @interface AKPopulation : NSObject { NSString *title; UInt32 individualCount; UInt32 individualCapacity; AKIndividual **individuals; // malloc'ed array of AKIndividual * } @property (readwrite, copy) NSString *title; @property (readonly) UInt32 individualCount; @property (readonly) AKIndividual **individuals; ... @end So the intent of the method is just to bulk-add individuals from one population into another population. Perhaps another way to ask the question is: suppose you wanted to implement a new collection class, akin to NSMutableArray but somehow different. How would you safely do it under GC, without using any of the pre-made Cocoa collections internally? That's all my AKPopulation really is: a poor man's (but a speedy man's!) re-implementation of something like NSMutableArray. Ought to be possible, right? So how do I manage this write barrier business to make it work properly? Ben Haller Stick Software ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: GC crash due to being naughty
I'd start by taking a look at the CHDataStructures framework: http://cocoaheads.byu.edu/wiki/chdatastructures It's a framework hosted by our local CocoaHeads group that includes most of the data structures that Apple forgot. =) Cheers, Dave On Oct 15, 2009, at 5:44 PM, Ben Haller wrote: Perhaps another way to ask the question is: suppose you wanted to implement a new collection class, akin to NSMutableArray but somehow different. How would you safely do it under GC, without using any of the pre-made Cocoa collections internally? That's all my AKPopulation really is: a poor man's (but a speedy man's!) re- implementation of something like NSMutableArray. Ought to be possible, right? So how do I manage this write barrier business to make it work properly? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to switch the default printer?
On 16/10/2009, at 6:05 AM, Laurent Daudelin wrote: Any other suggestion? Log a bug with Microsoft? As usual, they have a tendency to do things their way rather than the right way. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: GC crash due to being naughty
I'd start by taking a look at the CHDataStructures framework: http://cocoaheads.byu.edu/wiki/chdatastructures It's a framework hosted by our local CocoaHeads group that includes most of the data structures that Apple forgot. =) An interesting framework, looks useful. Looking at the CHAbstractCircularBufferCollection class, I don't see it doing any special GC-related dance. The only substantial differences between it and what I am doing are that: - I use malloc to make my array of pointers to objects, and it uses NSAllocateCollectable with NSScannedOption - I declare my pointer as AKIndividual **individuals and it uses __strong id *array So perhaps those choices avoid the issue, by avoiding the caveat You should never take the address of a weak global, static or instance variable, as assigning or reading through that pointer will bypass the weak barriers and expose your programs to race conditions. But then as Greg Parker said, references stored in a malloced block are neither weak nor strong, they are just dangling pointers. So I don't really understand why I'm getting bitten in the first place. Dangling pointers is exactly what I want; why is auto_zone_root_write_barrier() getting into the middle of my assignment loop in the first place? Ben Haller Stick Software ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: GC crash due to being naughty
Hi Ben, You say the crash occurs in this line: individuals[individualCount++] = individualsForPop[i]; The problem may be in the post-increment (individualCount++). IIRC, there is no agreed-upon compiler standard as to whether the post-increment will occur before or after the assignment. It is possible that you're using the bytes after the end of the array as a pointer, which points to a random location rather than to your desired data. If you want the increment to happen after the assignment, do this: for (i = 0; i individualCountForPop; ++i) { individuals[individualCount] = individualsForPop[i]; individualCount++; } If you want it before, just reverse the order of the two lines. I've had many a headache in the past with things like this!! Soong - Original Message From: Ben Haller bhcocoa...@sticksoftware.com To: Greg Parker gpar...@apple.com Cc: Cocoa List cocoa-dev@lists.apple.com Sent: Thu, October 15, 2009 4:44:23 PM Subject: Re: GC crash due to being naughty On 15-Oct-09, at 7:30 PM, Greg Parker wrote: A pointer value stored in an ordinary malloc block is neither a strong nor a weak reference. It is a dangling pointer. It can be used safely, but requires great care because the garbage collector has no knowledge of what you're doing. The auto_zone_root_write_barrier() crash can occur when you take the address of a global variable, then store into the global indirectly via that address. What does the crashed line of code look like? OK, here's a bit of context. The backtrace: #0 0x95058d7b in auto_zone_root_write_barrier () #1 0x964e40a8 in objc_assign_strongCast_gc () #2 0x7198 in -[AKPopulation addIndividualsFromPopulation:] (self=0x102b740, _cmd=0xe76c, population=0x10a9250) at .../AKPopulation.m:101 That method: - (void)addIndividualsFromPopulation:(AKPopulation *)population { UInt32 individualCountForPop = [population individualCount]; AKIndividual **individualsForPop = [population individuals]; int i; if (individualCount + individualCountForPop individualCapacity) { individualCapacity = (individualCount + individualCountForPop) * 2; individuals = realloc(individuals, individualCapacity * sizeof(AKIndividual *)); } for (i = 0; i individualCountForPop; ++i) individuals[individualCount++] = individualsForPop[i]; } The crash is in the last line of the method, in the assignment. The class as it stands right now: @interface AKPopulation : NSObject { NSString *title; UInt32 individualCount; UInt32 individualCapacity; AKIndividual **individuals;// malloc'ed array of AKIndividual * } @property (readwrite, copy) NSString *title; @property (readonly) UInt32 individualCount; @property (readonly) AKIndividual **individuals; ... @end So the intent of the method is just to bulk-add individuals from one population into another population. Perhaps another way to ask the question is: suppose you wanted to implement a new collection class, akin to NSMutableArray but somehow different. How would you safely do it under GC, without using any of the pre-made Cocoa collections internally? That's all my AKPopulation really is: a poor man's (but a speedy man's!) re-implementation of something like NSMutableArray. Ought to be possible, right? So how do I manage this write barrier business to make it work properly? Ben Haller Stick Software ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/oftenwrongsoong%40yahoo.com This email sent to oftenwrongso...@yahoo.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Serial comm in Cocoa?
Hi All, What is the Cocoa-fied way to communicate via a serial port? Using a kext to support the Prolific PL2303 chip and a shell utility like cu, it is possible to communicate via many USB-based serial ports. (For those who need it, the kext is at sourceforge.net/projects/osx-pl2303.) I am writing a Cocoa app that needs to communicate interactively with a device using an in-house message protocol, as opposed to just sending a file across a link. (If it were the latter case, I would just spawn a process using NSTask and send the file across.) I have written such an app under Windows before. In the .NET framework, there is a class SerialPort that makes it easy. You can do everything, including set the baud rate, parity, data bits, stop bits, etc. I hope there is something similar in Cocoa (but I couldn't find it). Thanks all, Soong ps, Since I mentioned the kext, I'd like to point out that if you use VMware Fusion, it is my experience that while this kext is loaded, a virtual machine cannot connect to the serial port. In this case, I unload the kext using kextunload, and then it works fine. There was a discussion about this at http://communities.vmware.com/message/1073355. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: GC crash due to being naughty
On 15-Oct-09, at 8:10 PM, Oftenwrong Soong wrote: Hi Ben, You say the crash occurs in this line: individuals[individualCount++] = individualsForPop[i]; The problem may be in the post-increment (individualCount++). IIRC, there is no agreed-upon compiler standard as to whether the post- increment will occur before or after the assignment. It is possible that you're using the bytes after the end of the array as a pointer, which points to a random location rather than to your desired data. If you want the increment to happen after the assignment, do this: for (i = 0; i individualCountForPop; ++i) { individuals[individualCount] = individualsForPop[i]; individualCount++; } If you want it before, just reverse the order of the two lines. I've had many a headache in the past with things like this!! Huh. Could've sworn that was well-defined. Well, I've been away from coding for about six years now, guess I've gotten a little rusty. In any case, this change does not fix the problem; same crash, on the assignment line. Ben Haller Stick Software ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to switch the default printer?
Yes, I guess I could do that. And then go after every application developer that doesn't support the Apple Event print properties. That probably means I would never finish the application I'm working on. Unfortunately, that's the bottom line, I have to find a way to convert any document that can be printed to a pdf document. I'm glad though that it seems I came to the logical conclusions that this can only reliably be done through a virtual printer like CUPS-PDF. Now, back to find a way to switch the default printer globally and restore it. I'm still open to suggestions, though! -Laurent. -- Laurent Daudelin AIM/iChat/Skype:LaurentDaudelin http://nemesys.dyndns.org Logiciels Nemesys Software laurent.daude...@verizon.net Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries On Oct 15, 2009, at 16:49, Graham Cox wrote: On 16/10/2009, at 6:05 AM, Laurent Daudelin wrote: Any other suggestion? Log a bug with Microsoft? As usual, they have a tendency to do things their way rather than the right way. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: GC crash due to being naughty
On Oct 15, 2009, at 4:44 PM, Ben Haller wrote: On 15-Oct-09, at 7:30 PM, Greg Parker wrote: A pointer value stored in an ordinary malloc block is neither a strong nor a weak reference. It is a dangling pointer. It can be used safely, but requires great care because the garbage collector has no knowledge of what you're doing. The auto_zone_root_write_barrier() crash can occur when you take the address of a global variable, then store into the global indirectly via that address. What does the crashed line of code look like? OK, here's a bit of context. The backtrace: #0 0x95058d7b in auto_zone_root_write_barrier () #1 0x964e40a8 in objc_assign_strongCast_gc () #2 0x7198 in -[AKPopulation addIndividualsFromPopulation:] (self=0x102b740, _cmd=0xe76c, population=0x10a9250) at .../ AKPopulation.m:101 That method: - (void)addIndividualsFromPopulation:(AKPopulation *)population { UInt32 individualCountForPop = [population individualCount]; AKIndividual **individualsForPop = [population individuals]; int i; if (individualCount + individualCountForPop individualCapacity) { individualCapacity = (individualCount + individualCountForPop) * 2; individuals = realloc(individuals, individualCapacity * sizeof (AKIndividual *)); } for (i = 0; i individualCountForPop; ++i) individuals[individualCount++] = individualsForPop[i]; } The crash is in the last line of the method, in the assignment. I don't see any global pointer variables involved. My guess is that `individuals` is uninitialized or NULL or `individuals[individualCount] ` is out of bounds. The write barrier objc_assign_strongCast() does range checks on the destination address, and will fall back to auto_zone_root_write_barrier() for addresses it doesn't recognize. Those include malloc blocks, global variables, and bogus addresses. Perhaps another way to ask the question is: suppose you wanted to implement a new collection class, akin to NSMutableArray but somehow different. How would you safely do it under GC, without using any of the pre-made Cocoa collections internally? That's all my AKPopulation really is: a poor man's (but a speedy man's!) re- implementation of something like NSMutableArray. Ought to be possible, right? So how do I manage this write barrier business to make it work properly? You need to ensure two things when implementing storage for GC pointers. First, the storage must be scanned by the garbage collector. Second, writes to the storage must use an appropriate write barrier function. Stack variables, __strong-typed instance variables, and __strong-typed global variables need no extra work; they are always scanned, and always use a write barrier (or don't need one). See below for the definition of __strong types. For the first, allocate your memory with NSAllocateCollectable (NSScannedOption). Note that the returned pointer is itself a GC- managed pointer, and requires all of the same precautions. For the second, by far the easiest option is to use __strong pointer types and let the compiler add write barriers for you. The compiler automatically uses write barriers when writing to pointers of Objective-C object types (like id or NSSomething*), or any level of pointers to pointers of those types (like id* or NSSomething*). The compiler does not use write barriers for other pointer types (like void** or CFSomethingRef), unless you mark the type `__strong`: `__strong void**` or `__strong CFSomethingRef`. Beware of memcpy() and memmove() and OSAtomicCompareAndSwapBarrier(). They do not use write barriers. Use objc_memmove_collectable() and objc_atomicCompareAndSwapPtrBarrier(). (The OSAtomic barrier is a memory barrier, not a GC write barrier.) The upshot is something like this. You want heap allocation so you need to allocate carefully. You don't need __strong because you're only working with Objective-C object types. AKIndividual **individuals; // global variable or ivar individuals = NSAllocateCollectable(size, NSScannedOption); individuals[i] = [[AKIndividual alloc] init]; // automatic write barrier newIndividuals = NSAllocateCollectable(newSize, NSScannedOption); objc_memmove_collectable(newIndividuals, oldIndividuals, oldSize); // memmove() is unsafe here individuals = newIndividuals; // GC will collect the old array object. -- Greg Parker gpar...@apple.com Runtime Wrangler ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to
Re: Serial comm in Cocoa?
Oftenwrong Soong wrote: What is the Cocoa-fied way to communicate via a serial port? http://lists.apple.com/archives/Cocoa-dev/2009/Jun/msg00976.html -- GG ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Serial comm in Cocoa?
Look for AMSerialPort on this page: http://www.harmless.de/cocoa-code.php Kiel On 16/10/2009, at 11:12 AM, Oftenwrong Soong wrote: Hi All, What is the Cocoa-fied way to communicate via a serial port? Using a kext to support the Prolific PL2303 chip and a shell utility like cu, it is possible to communicate via many USB-based serial ports. (For those who need it, the kext is at sourceforge.net/ projects/osx-pl2303.) I am writing a Cocoa app that needs to communicate interactively with a device using an in-house message protocol, as opposed to just sending a file across a link. (If it were the latter case, I would just spawn a process using NSTask and send the file across.) I have written such an app under Windows before. In the .NET framework, there is a class SerialPort that makes it easy. You can do everything, including set the baud rate, parity, data bits, stop bits, etc. I hope there is something similar in Cocoa (but I couldn't find it). Thanks all, Soong ps, Since I mentioned the kext, I'd like to point out that if you use VMware Fusion, it is my experience that while this kext is loaded, a virtual machine cannot connect to the serial port. In this case, I unload the kext using kextunload, and then it works fine. There was a discussion about this at http://communities.vmware.com/message/1073355 . ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com This email sent to kiel.gill...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: GC crash due to being naughty
On 15-Oct-09, at 8:26 PM, Greg Parker wrote: I don't see any global pointer variables involved. My guess is that `individuals` is uninitialized or NULL or `individuals[individualCount]` is out of bounds. The write barrier objc_assign_strongCast() does range checks on the destination address, and will fall back to auto_zone_root_write_barrier() for addresses it doesn't recognize. Those include malloc blocks, global variables, and bogus addresses. Perhaps another way to ask the question is: suppose you wanted to implement a new collection class, akin to NSMutableArray but somehow different. How would you safely do it under GC, without using any of the pre-made Cocoa collections internally? That's all my AKPopulation really is: a poor man's (but a speedy man's!) re- implementation of something like NSMutableArray. Ought to be possible, right? So how do I manage this write barrier business to make it work properly? You need to ensure two things when implementing storage for GC pointers. First, the storage must be scanned by the garbage collector. Second, writes to the storage must use an appropriate write barrier function... This all makes sense to me, to the extent that I understand write barriers at all. :- I switched my code over to NSAllocateCollectable with NSScannedOption, and it still crashed. This led me to generate a new hypothesis: that I am an idiot. I have now proven that hypothesis to my full satisfaction. I will not be telling the list what the error was that caused my code to crash. Let's just say I'm very out of practice at this whole coding thing, and leave it at that. :- Still, this thread was quite useful in that it did solidify my understanding of weak/strong/dangling, and led me to switch my collection class over to strong references. That's progress. Thanks to everybody for their help! Ben Haller Stick Software ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: GC crash due to being naughty
That is simply not true. That code is perfectly well defined. Sent from my iPhone On Oct 15, 2009, at 17:10, Oftenwrong Soong oftenwrongso...@yahoo.com wrote: Hi Ben, You say the crash occurs in this line: individuals[individualCount++] = individualsForPop[i]; The problem may be in the post-increment (individualCount++). IIRC, there is no agreed-upon compiler standard as to whether the post- increment will occur before or after the assignment. It is possible that you're using the bytes after the end of the array as a pointer, which points to a random location rather than to your desired data. If you want the increment to happen after the assignment, do this: for (i = 0; i individualCountForPop; ++i) { individuals[individualCount] = individualsForPop[i]; individualCount++; } If you want it before, just reverse the order of the two lines. I've had many a headache in the past with things like this!! Soong - Original Message From: Ben Haller bhcocoa...@sticksoftware.com To: Greg Parker gpar...@apple.com Cc: Cocoa List cocoa-dev@lists.apple.com Sent: Thu, October 15, 2009 4:44:23 PM Subject: Re: GC crash due to being naughty On 15-Oct-09, at 7:30 PM, Greg Parker wrote: A pointer value stored in an ordinary malloc block is neither a strong nor a weak reference. It is a dangling pointer. It can be used safely, but requires great care because the garbage collector has no knowledge of what you're doing. The auto_zone_root_write_barrier() crash can occur when you take the address of a global variable, then store into the global indirectly via that address. What does the crashed line of code look like? OK, here's a bit of context. The backtrace: #0 0x95058d7b in auto_zone_root_write_barrier () #1 0x964e40a8 in objc_assign_strongCast_gc () #2 0x7198 in -[AKPopulation addIndividualsFromPopulation:] (self=0x102b740, _cmd=0xe76c, population=0x10a9250) at .../ AKPopulation.m:101 That method: - (void)addIndividualsFromPopulation:(AKPopulation *)population { UInt32 individualCountForPop = [population individualCount]; AKIndividual **individualsForPop = [population individuals]; int i; if (individualCount + individualCountForPop individualCapacity) { individualCapacity = (individualCount + individualCountForPop) * 2; individuals = realloc(individuals, individualCapacity * sizeof (AKIndividual *)); } for (i = 0; i individualCountForPop; ++i) individuals[individualCount++] = individualsForPop[i]; } The crash is in the last line of the method, in the assignment. The class as it stands right now: @interface AKPopulation : NSObject { NSString *title; UInt32 individualCount; UInt32 individualCapacity; AKIndividual **individuals;// malloc'ed array of AKIndividual * } @property (readwrite, copy) NSString *title; @property (readonly) UInt32 individualCount; @property (readonly) AKIndividual **individuals; ... @end So the intent of the method is just to bulk-add individuals from one population into another population. Perhaps another way to ask the question is: suppose you wanted to implement a new collection class, akin to NSMutableArray but somehow different. How would you safely do it under GC, without using any of the pre-made Cocoa collections internally? That's all my AKPopulation really is: a poor man's (but a speedy man's!) re- implementation of something like NSMutableArray. Ought to be possible, right? So how do I manage this write barrier business to make it work properly? Ben Haller Stick Software ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/oftenwrongsoong%40yahoo.com This email sent to oftenwrongso...@yahoo.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/clarkcox3%40gmail.com This email sent to clarkc...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Programming Style: Method Definition with or without a semicolon.
1) I've seen an alternative way of defining a method, with the semicolon after the declaration, before the body: - (NSArray *)sortedIncredients; -- notice the semicolon { ... } 2) ... versus the standard declaration + body of the definition (without the semicolon): - (NSArray *)sortedIncredients { ... } Both seem to work the same. Is there any benefit of (1) over (2) or is it merely style of programming? Ric. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Programming Style: Method Definition with or without a semicolon.
On Oct 15, 2009, at 6:54 PM, Frederick C. Lee wrote: Is there any benefit of (1) over (2) or is it merely style of programming? IMHO (1) should not be allowed, because you can't write C functions that way (the compiler throws a parsing error if you do that), so it's odd that you can write ObjC methods that way... Nick Zitzmann http://www.chronosnet.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Serial comm in Cocoa?
Thanks Louis... I'm studying the code right now. -Soong - Original Message From: Louis Demers louisdem...@mac.com To: Oftenwrong Soong oftenwrongso...@yahoo.com Sent: Thu, October 15, 2009 5:58:02 PM Subject: Re: Serial comm in Cocoa? I use 2 C routines I found on the net and adapted. Here is some code I use, quickly ripped out of one of my app, i.e. not re-tested. On 15-Oct-09, at 20:12 , Oftenwrong Soong wrote: Hi All, What is the Cocoa-fied way to communicate via a serial port? Using a kext to support the Prolific PL2303 chip and a shell utility like cu, it is possible to communicate via many USB-based serial ports. (For those who need it, the kext is at sourceforge.net/projects/osx-pl2303.) I am writing a Cocoa app that needs to communicate interactively with a device using an in-house message protocol, as opposed to just sending a file across a link. (If it were the latter case, I would just spawn a process using NSTask and send the file across.) I have written such an app under Windows before. In the .NET framework, there is a class SerialPort that makes it easy. You can do everything, including set the baud rate, parity, data bits, stop bits, etc. I hope there is something similar in Cocoa (but I couldn't find it). Thanks all, Soong ps, Since I mentioned the kext, I'd like to point out that if you use VMware Fusion, it is my experience that while this kext is loaded, a virtual machine cannot connect to the serial port. In this case, I unload the kext using kextunload, and then it works fine. There was a discussion about this at http://communities.vmware.com/message/1073355. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/louisdemers%40mac.com This email sent to louisdem...@mac.com Louis Demers eng. www.obzerv.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Programming Style: Method Definition with or without a semicolon.
On 16/10/2009, at 11:54 AM, Frederick C. Lee wrote: Both seem to work the same. Is there any benefit of (1) over (2) or is it merely style of programming? (1) isn't really an alternative way of implementing a method, it's just that the trailing semicolon is ignored. I'm not even sure if it's deliberately allowed (it wouldn't be for a C function) or merely an artifact of the way Obj-C is parsed. -(void) foo { } and - (void) foo { } are both perfectly valid ways of defining any block in C and always have been (though I personally abhor the second style yet seem to be ploughing my own furrow on that one - almost everyone uses it :( The ignored trailing semicolon is sort of useful when fleshing out the body of a class that you've declared methods for in the header - you need the semicolon for the method's prototypes, so you can cut and paste the prototype into the main body and just add a trailing block to implement the method - the semicolon doesn't have to be removed. However, again a personal thing, I prefer it not to be there so it's consistent with ordinary C functions, and provided you are just fleshing out the body from the headers for the first time (i.e. no other code has yet been written) doing a search/replace of ';' for '\n {\n\n\n}\n\n' is a useful way to convert all your header methods into bodies ready to be filled in with code. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Programming Style: Method Definition with or without a semicolon.
Graham Cox wrote: On 16/10/2009, at 11:54 AM, Frederick C. Lee wrote: Both seem to work the same. Is there any benefit of (1) over (2) or is it merely style of programming? (1) isn't really an alternative way of implementing a method, it's just that the trailing semicolon is ignored. I'm not even sure if it's deliberately allowed (it wouldn't be for a C function) or merely an artifact of the way Obj-C is parsed. -(void) foo { } and - (void) foo { } are both perfectly valid ways of defining any block in C and always have been (though I personally abhor the second style yet seem to be ploughing my own furrow on that one - almost everyone uses it :( I'm ploughing it with you, I hate it too and spend 30 seconds every time I let XCode stub out a function for me moving the brace onto the correct line, andputtingspacesbackbetweenparanetheses,bracketsandarguments so I have a hope in hell of reading the code later. I came across that trailing ';' thing the other day purely by accident and couldn't believe my code actually worked. I think I'll take this over to XCode and ask about it. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Programming Style: Method Definition with or without a semicolon.
On 16/10/2009, at 12:30 PM, Roland King wrote: I'm ploughing it with you, I hate it too and spend 30 seconds every time I let XCode stub out a function for me moving the brace onto the correct line, andputtingspacesbackbetweenparanetheses,bracketsandarguments so I have a hope in hell of reading the code later. Agree 2000%! But you don't have to let Xcode frustrate you like this - you can define your own templates for all of the stubs it inserts. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Automatic language detection - a bug (again) or what. Snow Foundation NSSpellServer.
Dear Mr. Davidson / to whom it may concern: Just had a little time to work on the project/problem (hope I'm not the only one) and found out that: Steps to reproduce pt. 16 and Actual Results pt. 4 should sound now: 4) If the new method introduced in 10.6 – spellServer:checkString:offset:types:options:orthography:wordCount: is called instead of old one – spellServer:findMisspelledWordInString:language:wordCount:countOnly: then suggestions for completions (- spellServer:suggestGuessesForWord:word inLanguage:) IS NOT called when right-clicking misspelled word. Suggestions however show up in how Spelling and Grammar panel. = HOWEVER This is valid to only some applications (tested on 4 Apple apps) I.e., In Apple provided TextEdit.app, Stickies.app the behaviour is as described above. Thus meaning that error is in client side (NSSpellChecker implementation in those apps). In Mail.app and Safari.app the suggestions are delivered on ctrl+click even when only spellServer:checkString:offset:types:options:orthography:wordCount: is implemented leaving old method out. Resumē: Yes, the old method should be fully implemented anyway, as such relatively wide used apps as OOo3, NeoO3 that takes advance of syswide spellcheck, are calling old method. Just want to point out the inconsistency of Apple apps in 10.6., where the behaviour cannot be expected/predicted. Developing a spellserver for osx means primary verifying that it works on systems bundled software!, then iwork, iweb packages and then 3rd parties, and doing so by following sdk documentation. As it seems, somebody doesn't follow sdk documentation that has been written by himself... Exactly this point of the story is the most frustrating. Should I file bugreports against TextEdit, Stickies and who-nows-how- more osx bundled apps? I understand that ~90% of osx users doesn't have any relevance to this topic - there is no bug - as they belong to the group of ApleSpell.service registred languages (my guess). The other 9% are using probably OpenSpell on 10.6 now and do not cry that automatic language option is not working (yet). The left 1% will be affected by those couple custom spellchecker developers for osx out there, that are/will face the issues. Before 10.6. (10.45) custom spellserver was the only way for Latvian a.o. languages; now in 10.6. I'm willing to extend it with numerous features, that again would bring better and more specific solution for the language than OSX provided out of box OpenSpell... please, allow me. :)) Many thanks in advance, Reinis Adovics On 09.10.2009., at 17:38, MacProjects wrote: Just submitted in bug reporter. Bug ID# 7290111 Problem Report Title: NSSpellServer: OSX 10.6. Error in automatic language detection. Product: Mac OSX Version/Build Number: 10B504 Classification: Serious Bug Is It Reproducible?: Always NSSpellServer: OSX 10.6. Error in automatic language detection for any 3rd party spellcheck including OpenSpell Summary: After creating a new spelling checker (service) that’s available to any application and adding it to Automatic by language setup in System Preferences 1) NSSpellServer fails to use this spellchecker (registered language (s)) when Automatic by language spelling is used. 2) When spelling with Automatic by language option NSSpellServer calls only some of the necessary methods to the service. 3) Spellcheck is run only after user selects its registered language in an applications Spelling options, then user has to switch back for Automatic by language. 4) Implementing – spellServer:checkString:offset:types:options:orthography:wordCount: invokes unexpected behaviour when right-clicking misspelled word. Steps to Reproduce: // Any custom spellcheck 1) Set in System Preferences : Language Text spelling to Automatic by language 2) Write, build and install a new spellcheck under /Library/Servces 4) Login/out (update dynamic services) for the new service to register. 5) Set the newly registered language delivered by the spell check as one of the languages for Automatic by language in System Preferences : Language Text setup list. 6) Open any application that makes use of NSSpellChecker, i.e., TextEdit. 7) Write partly correct, partly incorrect text in the new language. 8) Try to spellcheck it. It fails to suggest words in intended language. 9) Look for spellcheck service in currently running processes. It isn't listed. But it should be run automatically as the registered language (service) is set in Automatic by language list in system preferences meaning OSX is providing user ability to check for custom languages/spellchecks that are added to automatic list. 10) Open up applications (TextEdit) Edit : Spelling and Grammar : Show Spelling and Grammar panel. 11) Select the newly registered language in languages list. 12) $ top or Activity Monitor reports that service is finally run. 13) Check
Re: Programming Style: Method Definition with or without a semicolon.
Agree 2000%! Same here. A side note: in (Objective-)C you can also type jibberish after the trailing quote of an #include and it gets ignored (at least with GCC, not sure about Clang.) Not as useful as the semicolon bug, but I think it helps illuminate just because you can, doesn't mean you should. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Programming Style: Method Definition with or without a semicolon.
I keep meaning to file an enhancement request for the space before ()'s, I have to go back and manually change every occurrence and then add spaces after the commas in the function arguments. I also prefer - (void)foo { } over - (void)foo { } Regards, Rob. On 16 Oct 2009, at 02:30, Roland King wrote: I'm ploughing it with you, I hate it too and spend 30 seconds every time I let XCode stub out a function for me moving the brace onto the correct line, andputtingspacesbackbetweenparanetheses,bracketsandarguments so I have a hope in hell of reading the code later. I came across that trailing ';' thing the other day purely by accident and couldn't believe my code actually worked. I think I'll take this over to XCode and ask about it. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Programming Style: Method Definition with or without a semicolon.
Hi Rols, The same happened to me once. Accidently part of copy paste from header to .m, it happened that structure. But why Objective C compiler won't give any error for this. Really frustrating. Regards Mustafa On Fri, Oct 16, 2009 at 10:32 AM, Robert Tillyard r...@atvetsystems.comwrote: I keep meaning to file an enhancement request for the space before ()'s, I have to go back and manually change every occurrence and then add spaces after the commas in the function arguments. I also prefer - (void)foo { } over - (void)foo { } Regards, Rob. On 16 Oct 2009, at 02:30, Roland King wrote: I'm ploughing it with you, I hate it too and spend 30 seconds every time I let XCode stub out a function for me moving the brace onto the correct line, andputtingspacesbackbetweenparanetheses,bracketsandarguments so I have a hope in hell of reading the code later. I came across that trailing ';' thing the other day purely by accident and couldn't believe my code actually worked. I think I'll take this over to XCode and ask about it. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/symadept%40gmail.com This email sent to symad...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Programming Style: Method Definition with or without a semicolon.
Ric 1) I've seen an alternative way of defining a method, with the semicolon after the declaration, before the body: - (NSArray *)sortedIncredients; -- notice the semicolon { ... } 2) ... versus the standard declaration + body of the definition (without the semicolon): - (NSArray *)sortedIncredients { ... } Both seem to work the same. Is there any benefit of (1) over (2) or is it merely style of programming? It is definitely a question of style. I prefer #1 above. I prefer to have my brackets on the next line and by including a semi-colon at the end, I can triple click my new method, copy, and paste it into the header and it works since the semi-colon is required in the header. Likewise, I can go to the header of a class, triple-click and copy a method and just paste it into my implementation (delegate method or override) and it's good. But other than copying and pasting, I can't see any advantage (though it's easier for me to read but probably just because that's what I'm used to). Hope this helps Marc ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Record and Playback immediately
Hi Jean, Thank you very much for your response. Similarly Cocoa dev do we have any Macos Dev forums where I can ask this kind of questions. And I am working on AQRecord/Play. But still I haven't figured it out how to make it immediately. Regards Mustafa On Thu, Oct 15, 2009 at 4:27 PM, Jean-Daniel Dupas devli...@shadowlab.orgwrote: Le 15 oct. 2009 à 09:41, Symadept a écrit : Hi, I took the examples of afplay afrecord. But it does the normal record to completion and play to completion manner. How can I Record into buffer and play from there. I hope instead of AFPlay, Queue based recording and playing would help. Can anybody put some light on this example. Cocoa-dev is not Macos-dev. This question has nothing to do with Cocoa and should be ask on coreaudio list. That said, maybe the AudioQueueTools sample code may help. -- Jean-Daniel ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Custom NSComboBox
Hi, Can anybody put some light on this. Regards Mustafa On Wed, Oct 14, 2009 at 7:09 PM, Symadept symad...@gmail.com wrote: Hi, I am designing a custom NSComboBox to display the rect image as some ComboboxBg.png and set foreground (text) color to Red. To render image I am doing the following things. @interface CustomComboBoxCell : NSComboBoxCell { } @end @implementation CustomComboBoxCell - (void)drawWithFrame:(NSRect)bounds inView:(NSView *)controlView { NSLog(@CPProfileComboBoxCell drawWithFrame[%f %f - %f %f], bounds.origin.x, bounds.origin.y, bounds.size.width, bounds.size.height); NSRect imageRect = bounds;//[self drawingRectForBounds:bounds];//[self imageRectForBounds:bounds]; NSLog(@Image rect [%f %f - %f %f], imageRect.origin.x, imageRect.origin.y, imageRect.size.width, imageRect.size.height); NSImage *bgImage = [NSImage imageNamed:@ComboBox2]; [bgImage drawInRect:imageRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0]; NSLog(@Image drawn); // Make attributes for our strings NSMutableParagraphStyle * aParagraphStyle = [[[NSMutableParagraphStyle alloc] init] autorelease]; [aParagraphStyle setLineBreakMode:NSLineBreakByTruncatingTail]; //[aParagraphStyle setAlignment:NSCenterTextAlignment]; // Title attributes: system font, 14pt, black, truncate tail NSMutableDictionary * aTitleAttributes = [[[NSMutableDictionary alloc] initWithObjectsAndKeys: [NSColor blackColor],NSForegroundColorAttributeName, [NSFont systemFontOfSize:21.0],NSFontAttributeName, aParagraphStyle, NSParagraphStyleAttributeName, nil] autorelease]; // Make a Title string NSString * aTitle = [self stringValue];//[NSString stringWithString:@Title]; // get the size of the string for layout // Icon box: center the icon vertically inside of the inset rect NSLog(@CellFrame:[%f %f] [%f %f], bounds.origin.x, bounds.origin.y, bounds.size.width, bounds.size.height); NSRect aTitleBox = bounds; [aTitleAttributes setValue:[NSColor yellowColor] forKey:NSForegroundColorAttributeName]; [aTitle drawInRect:aTitleBox withAttributes:aTitleAttributes]; } @end And If I dont draw the string by myself, the chosed item will not be shown. To make the combobox to show the value, I have to click inside once. Can anybody help me to resolve this issue? Thanks in advance Regards symad...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Background image of CustomTableView Cells
Hi,Can anybody please help me regarding this. Regards Symadept On Wed, Oct 14, 2009 at 6:50 PM, Symadept symad...@gmail.com wrote: Hi, Can you help me to fix this problem. I am customizing my table view to show various images in the background of the cells accordingly as Selected : Font Changed to While Colour, Background image, Highlighted.png Deselected/Normal: Font - Black colour, Bg Image: Default.png I tried to override - (void)drawInteriorWithFrame:(NSRect)theCellFrame inView:(NSView*)theControlView of NSCell to change the Font Color and BgImage according to the state as I mentioned earlier. Result: Once the application launched it is ok. Once I select col1 and select col2, my Col1 still shows the Highlighted image, infact it is deselected and supposed to show the Default Image. This because my Default image is a transparent image. Even after overlapping Default.png on Highlighted.png it is showing the same Highlighted.png. I guess what I need to do is to remove the image from the Cell before redrawing it. How to do I really don't know. Kindly look into this and help me in this regards. CustomTableCell @interface CustomTableCell : NSCell { } @end #import CustomTableCell.h @implementation CustomTableCell - (void)drawInteriorWithFrame:(NSRect)theCellFrame inView:(NSView*)theControlView { NSLog(@CustomTableCell drawInteriorWithFrame); NSImage *bgImage = [NSImage imageNamed:@DefaultCell]; // Make attributes for our strings NSMutableParagraphStyle * aParagraphStyle = [[[NSMutableParagraphStyle alloc] init] autorelease]; [aParagraphStyle setLineBreakMode:NSLineBreakByTruncatingTail]; [aParagraphStyle setAlignment:NSCenterTextAlignment]; // Title attributes: system font, 14pt, black, truncate tail NSMutableDictionary * aTitleAttributes = [[[NSMutableDictionary alloc] initWithObjectsAndKeys: [NSColor blackColor],NSForegroundColorAttributeName, [NSFont systemFontOfSize:21.0],NSFontAttributeName, aParagraphStyle, NSParagraphStyleAttributeName, nil] autorelease]; // Make a Title string NSString * aTitle = [self stringValue]; NSLog(@CellFrame:[%f %f] [%f %f], theCellFrame.origin.x, theCellFrame. origin.y, theCellFrame.size.width, theCellFrame.size.height); NSRect anIconBox = theCellFrame; NSRect aTitleBox = NSMakeRect(theCellFrame.origin.x, theCellFrame.origin.y + theCellFrame.size.height/2-10, theCellFrame.size.width, theCellFrame.size.height); if( [self isHighlighted]) { // if the cell is highlighted, draw the text white [aTitleAttributes setValue:[NSColor whiteColor] forKey: NSForegroundColorAttributeName]; bgImage = [NSImage imageNamed:@FocusedCell]; } else { // if the cell is not highlighted, draw the title black and the subtile gray [aTitleAttributes setValue:[NSColor orangeColor] forKey: NSForegroundColorAttributeName]; } // Draw the icon [bgImage drawInRect:anIconBox fromRect:NSZeroRect operation: NSCompositePlusLighter fraction:1.0]; // Draw the text [aTitle drawInRect:aTitleBox withAttributes:aTitleAttributes]; } @end CustomTableView @interface CustomTableView : NSTableView { } @end #import CustomTableView.h @implementation CustomTableView - (void)awakeFromNib { NSLog(@CustomTableView awakeFromNib); [[self enclosingScrollView] setDrawsBackground:NO]; } - (void)drawBackgroundInClipRect:(NSRect)clipRect { NSLog(@CustomTableView drawBackgroundInClipRect); } #pragma mark - #pragma mark Selection Highlighting - (id)_highlightColorForCell:(NSCell *)cell { // we need to override this to return nil // or we'll see the default selection rectangle when the app is running // in any OS before leopard // you can also return a color if you simply want to change the table's default selection color return nil; } @end Thanks in advance Regards symadept ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Custom NSComboBox
On 16/10/2009, at 1:42 PM, Symadept wrote: Can anybody put some light on this. Well, it might help if you format your email so it's readable to some extent. I took one look at it and passed it over because I'm not going to bother unravelling the unformatted mess to find out what it is you're asking. Most people here are busy and probably thought something similar. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: A good Obc-C framework for sending email?
On 15 Oct 2009, at 13:34, Ben Haller wrote: Hi all. I need a good Obj-C framework for sending email. I used to use the Message.framework associated with Apple's Mail, but they killed that a long time ago, sadly. Then I used Pantomime; but it seems to also be abandoned, now, and it is crashing on 10.5 (and it was never terribly reliable anyway). Does anybody know of a good replacement? I haven't had any luck trying to find one using Google. Keep in mind that many users may not have any SMTP server configured -- an increasing number of users use webmail for everything, and don't have a desktop client set up. And, in many of these cases, they may be behind a firewall or ISP that blocks connections to port 25 (SMTP) on all servers other than their own. If you need to reliably deliver email from a user's machine, you'll probably need to set up a gateway of some sort yourself, or have them input SMTP settings manually. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Simultaneous Recording and Playback
Hi, Can anyone help me how to achieve playback immediately the recorded voice and shall be able to stop them simultaneously. I am following the AQRecord/Play of the AudioQueueTools of CoreAudio Samples. But unable to reach to the target. I am putting more effort on it to converge what exactly I can do. Thanks in advance. Regards Symadept On Wed, Oct 14, 2009 at 4:21 PM, Sven co...@unlogic.co.uk wrote: On Tue, 13 Oct 2009, Jens Alfke wrote: On Oct 13, 2009, at 9:30 AM, Sven wrote: Thanks... I don't want to encode any audio files, I merely want to be able to get and set tag data. For MP3s I can use id3lib no problems, but that doesn't help me with AAC files. I guess if there's no way to edit tags via the Apple libraries (if I understand you correctly) then the only thing left to do is write my own. You can get tags via QuickTime. The problem is that changing tags, in general, requires re-writing the entire file. I think QuickTime could be used to update those tags along the way, if it were reading the file contents and writing them out to a new file, but I don't know nearly enough about the very gnarly QuickTime APIs for that. There is an open source project called AtomicParsely that is supposed to help with parsing and generating AAC metadata, but I haven't used it. ?Jens I saw AtomicParsely and they do a good job of describing the weird and wonderful structure of atoms in m4a's I'll have a closer look at their library and see what can be done. Otherwise I'll have to stick with just ID3 support for now until I can get my head around tagging AACs thanks again ./Sven ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/symadept%40gmail.com This email sent to symad...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Toolbar with capsule style items (Similiar to Mail)
Hi All, I am new at programming with Cocoa - so I had a basic question. Is it possible to create a capsule style toolbar with a search field in it (like how Mail's toolbar is) just using interface building to create the UI? And if so - how would it be done? I am trying to create by first dragging a Toolbar item to the window. When I try to put a segmented control or a search control in the toolbar it gets rejected. Thanks! Mazen Abdel-Rahman ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
How to detect and disable/delay sleep event in cocoa for some critical threads to complete
Hi All When my app is doing some critical I/O transactions with OpenSsl, And the user is sleeping the machine (just by folding the laptop). Some of the app threads are hanging Is there any way in cocoa to do following steps? Also is this logic correct? 1. Detect when a sleep (soft or hard) is issued 2. Delay sleep till my threads come out 3. Then continue to going into sleep. Please suggest. Thank you -Parimal Das ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: odd behavior with NSError?
On Oct 2, 2009, at 7:45 AM, Bill Bumgarner wrote: In either case, assuming the undefined reference is nil would be a bug. Initializing the variables to nil prior to the call isn't going to change anything in that regard. (And, yes, there are methods that modify their error parameter on success -- purely an implementation detail. Perfect valid thing to do since the return value is undefined on success.) Ouch. So the following pattern is incorrect? NSError* internalError = nil; (void)[foo somethingReturningBool:bar error:internalError]; if (internalError) { // ... } I got into this habit because most every method is documented to say things like parameter used if an error occurs and May be NULL. You're saying that some methods go out of their way to trample my (potentially unavailable) error storage even on success? I'm starting to worry that I'll spend tomorrow fixing much old code instead of getting to make new mistakes... thanks, -natevw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: odd behavior with NSError?
(response is pedantic for the purposes of the archive :) On Oct 15, 2009, at 10:41 PM, Nathan Vander Wilt wrote: Ouch. So the following pattern is incorrect? Yes; it is incorrect. NSError* internalError = nil; (void)[foo somethingReturningBool:bar error:internalError]; if (internalError) { // ... } Specifically, assuming anything about the value of 'internalError' without first determining the return value of - somethingReturningBool:error: returned a value indicating an error (typically NO/0/nil/NULL) is an error. I got into this habit because most every method is documented to say things like parameter used if an error occurs and May be NULL. You're saying that some methods go out of their way to trample my (potentially unavailable) error storage even on success? I'm starting to worry that I'll spend tomorrow fixing much old code instead of getting to make new mistakes... They don't go out of the way to trample it, but may trample it as a part of whatever internal implementation they use. I have, however, debugged several bugs that have boiled down to code assuming the NSError**'s value is definitively indicative of an error. In one case, a method that takes an (NSError **) argument may call other methods that take the same, it might -- as an implementation detail -- pass the argument through, maybe even one of those returns hey, man, an error occurred, and the caller might recover from it and eventually return success, but not actually clear the error value in the process (because there is no need to do so, by definition of the API). A similar problem occurred when the NSError** was set up to describe some problem, later corrected, and then the error was released. Success was returned, but the caller assumed the error was valid... *boom*. b.bum ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: odd behavior with NSError?
On Thu, Oct 15, 2009 at 10:41 PM, Nathan Vander Wilt nate-li...@calftrail.com wrote: Ouch. So the following pattern is incorrect? NSError* internalError = nil; (void)[foo somethingReturningBool:bar error:internalError]; if (internalError) { Indeed, this is very incorrect. If the existence of the NSError object were intended to be the indication of an error, the methods would just return NSErrors rather than BOOLs. I got into this habit because most every method is documented to say things like parameter used if an error occurs and May be NULL. You're saying that some methods go out of their way to trample my (potentially unavailable) error storage even on success? I'm starting to worry that I'll spend tomorrow fixing much old code instead of getting to make new mistakes... In fact they do. AppKit *loves* to do this. We've filed Radars on the cases where it does. But your use of the error object as indication of failure is misguided and is your bug, not Apple's. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com