__weak pointer collection firing prematurely???

2012-08-13 Thread Britt Durbrow
I am looking at something very strange. I have a document object, that has an object that it owns; which has a __weak pointer back to the document object. Another object also has an indirect pointer to the document object. So, something like this: @interface MyDoc : NSDocument { MySubOb

Re: __weak pointer collection firing prematurely???

2012-08-13 Thread Quincey Morris
On Aug 13, 2012, at 00:04 , Britt Durbrow wrote: > This is the exact line of code in question: > > TrDocument *document=(TrDocument *)__RPCPersistentInfo__pool->document; > > The document object in question is, when this happens, still in the middle of > it's init method when that __weak __RP

Core Graphics optimisation

2012-08-13 Thread Fulbert Boussaton
Hi everyone, on iOS, I was using the following "immediate CG code" to display hundreds procedural sprites : CGContextSetShadow(Ctx, CGSizeMake(3, 4), 3.0f); CGMutablePathRefShapePath = CGPathCreateMutable(); CGPathAddArc(ShapePath, &CGAffineTransformIdentity, radius+3, radius+3, radius,

Sending keyboard events with unicode strings causes Pages/Keynote/Numbers to hang

2012-08-13 Thread Huy Phan
Hi all, I'm having this weird issue after upgrading iWork on Mountain Lion. I wrote a small app to monitor and modify user's keystrokes, it works fine with other applications except latest version of Pages. Every time I send keyboard events with unicode strings contain 2-byte unicode character

Re: Core Graphics optimisation

2012-08-13 Thread Thomas Davie
On 10 Aug 2012, at 09:09, Fulbert Boussaton <4...@flubb.net> wrote: > Hi everyone, > > on iOS, I was using the following "immediate CG code" to display hundreds > procedural sprites : I'd suggest simply dropping CG, and drawing them using OpenGL ES instead. Thanks Tom Davie _

Re: __weak pointer collection firing prematurely???

2012-08-13 Thread Britt Durbrow
On Aug 13, 2012, at 1:00 AM, Quincey Morris wrote: > On Aug 13, 2012, at 00:04 , Britt Durbrow > wrote: > >> This is the exact line of code in question: >> >> TrDocument *document=(TrDocument *)__RPCPersistentInfo__pool->document; >> >> The document object in question is, when this happens

Alternative method for makeViewWithIdentifier

2012-08-13 Thread Alfian Busyro
Hi, I have an application that must support minimum OS X. Snow Leopard (10.6). But accidentally I using makeViewWithIdentifier inside a delegate of table view to calling object that created on the nib, unfortunately this is only supported minimum Lion. So instead of using this, what should I do

Re: Alternative method for makeViewWithIdentifier

2012-08-13 Thread Mike Abdullah
You need to go back to old school cell-based table views then. On 13 Aug 2012, at 09:52, Alfian Busyro wrote: > Hi, > I have an application that must support minimum OS X. Snow Leopard (10.6). > But accidentally I using makeViewWithIdentifier inside a delegate of table > view to calling object

Re: Core Graphics optimisation

2012-08-13 Thread Mike Abdullah
On 10 Aug 2012, at 09:09, Fulbert Boussaton <4...@flubb.net> wrote: > Hi everyone, > > on iOS, I was using the following "immediate CG code" to display hundreds > procedural sprites : > > CGContextSetShadow(Ctx, CGSizeMake(3, 4), 3.0f); > CGMutablePathRef ShapePath = CGPathCreateMutable()

Re: Core Graphics optimisation

2012-08-13 Thread Richard Altenburg (Brainchild)
You have no time to watch WWDC 2012 presentations and like to avoid OpenGL ES as an alternative, how on earth are you going to write a fast app with thousands of drawings on a device with (in worst case) 256 MB of internal memory? I am not sure OpenGL ES will help, and one session from WWDC will

Re: Core Graphics optimisation

2012-08-13 Thread Bill Dudney
A much faster and simpler approach to do exactly what you have here is CAShapeLayer. That will draw the path via OpenGL on your behalf without you having to study OpenGL. That said, copying and pasting from stack overflow or cocoa-dev list is never a good solution in the long run. You might not

Re: Core Graphics optimisation

2012-08-13 Thread Graham Cox
On 10/08/2012, at 6:09 PM, Fulbert Boussaton <4...@flubb.net> wrote: > CGContextSetShadow(Ctx, CGSizeMake(3, 4), 3.0f); As well as the advice you've received, do you have to have shadows? They drag performance into the gutter. Try losing this line and watch your code speed up dramatically. -

Help Indexer error - what does it MEAN?

2012-08-13 Thread Graham Cox
I'm trying to index our help files with Help Indexer, a process that has worked smoothly in all our previous versions. Now though, I'm getting a screed of errors that mean nothing to me, e.g: helptopics/lessons/Working_with_Layers.html -- Parse error: The operation couldn’t be completed. (NSXML

Re: Help Indexer error - what does it MEAN?

2012-08-13 Thread Graham Cox
On 13/08/2012, at 10:43 PM, Graham Cox wrote: > errors that mean nothing to me BTW, I looked up the error - but I'm none the wiser. What's a "tag name mismatch"? NSXMLParserTagNameMismatchError = 76, NSXMLParserTagNameMismatchError Tag name mismatch. Available in OS X v10.3 and later. Decla

Re: Help Indexer error - what does it MEAN?

2012-08-13 Thread Andy Lee
I haven't used Help Indexer, so this is an un-educated guess: maybe you have something like ... in your HTML? Maybe earlier versions of Help Indexer were more forgiving. Have you run your files through an HTML validator? --Andy On Aug 13, 2012, at 8:51 AM, Graham Cox wrote: > > On 13/08/2

Re: Help Indexer error - what does it MEAN?

2012-08-13 Thread Kyle Sluder
Help Indexer is broken for HTML input on Mountain Lion. You could try XHTML input, or do what we do and run the indexer on 10.7. --Kyle Sluder (Sent from the road) On Aug 13, 2012, at 5:43 AM, Graham Cox wrote: > I'm trying to index our help files with Help Indexer, a process that has > worke

Re: Sending keyboard events with unicode strings causes Pages/Keynote/Numbers to hang

2012-08-13 Thread Ken Thomases
On Aug 11, 2012, at 3:39 PM, Huy Phan wrote: > Every time I send keyboard events with unicode strings contain 2-byte unicode > characters, … >CGEventKeyboardSetUnicodeString(keyEventDown, 1, unicodeString); >CGEventKeyboardSetUnicodeString(keyEventUp, 1, unicodeString); > Pages doesn't

Re: filtering the values in an NSTableColumn

2012-08-13 Thread Koen van der Drift
Just to follow up, I decided to show both valueA and valueB in my table, which not only made perfectly sense in my app, but also made my question no longer relevant. Thanks everyone for chiming in. - Koen. On Sat, Aug 11, 2012 at 7:31 AM, Koen van der Drift wrote: > > On Aug 11, 2012, at 7:26

Classes incompatible with weak references

2012-08-13 Thread Ben
I see in the documentation - and from a compiler error - that some classes are not compatible with weak references. What makes these classes incompatible? Perhaps I'm using the wrong search terms, but I can't seem to find information on why this should be the case. Can anyone shed some light on

Re: Classes incompatible with weak references

2012-08-13 Thread Kyle Sluder
On Aug 13, 2012, at 8:42 AM, Ben wrote: > I see in the documentation - and from a compiler error - that some classes > are not compatible with weak references. > > What makes these classes incompatible? They have custom implementations of -retain and -release. When NextSTEP was first released

Re: How do I get memory usage numbers?

2012-08-13 Thread Jens Alfke
On Aug 12, 2012, at 7:10 PM, Charlie Dickman <3tothe...@comcast.net> wrote: > Initially I'm interested in system wide memory usage (free, wired,active, > inactive) Hm, I've always found those numbers to be nearly useless, but YMMV. > If hacking through Darwin is the only way to do this than ne

Re: __weak pointer collection firing prematurely???

2012-08-13 Thread Kyle Sluder
On Aug 13, 2012, at 1:00 AM, Quincey Morris wrote: > There's nothing about the fact that the document is executing a method that > prevents it from being deallocated before the method ends. As was discussed on the objc-language list recently, the ARC spec specifically guarantees that an objec

Re: How to size a TextView to fit a given line?

2012-08-13 Thread Ross Carter
On Aug 12, 2012, at 5:34 AM, Gerriet M. Denkmann wrote: > In windowWillUseStandardFrame:defaultFrame: in a subclass of NSDocument > (which is also the delegate of it's window) I want to set the window to just > contain a certain line. > > - (NSRect)windowWillUseStandardFrame:(NSWindow *)sender

Re: Classes incompatible with weak references

2012-08-13 Thread Jean-Daniel Dupas
Le 13 août 2012 à 17:56, Kyle Sluder a écrit : > On Aug 13, 2012, at 8:42 AM, Ben wrote: > >> I see in the documentation - and from a compiler error - that some classes >> are not compatible with weak references. >> >> What makes these classes incompatible? > > They have custom implementati

Re: __weak pointer collection firing prematurely???

2012-08-13 Thread Kyle Sluder
On Aug 13, 2012, at 9:01 AM, Kyle Sluder wrote: > Xcode 4.1.1 is pretty old Whoops, you said 4.4.1. My mistake. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list.

Re: __weak pointer collection firing prematurely???

2012-08-13 Thread Quincey Morris
On Aug 13, 2012, at 09:01 , Kyle Sluder wrote: > As was discussed on the objc-language list recently, the ARC spec > specifically guarantees that an object's lifetime includes the entire > duration of a method invocation. An object *cannot* be deallocated while one > of its methods is executin

NSTextView paste:

2012-08-13 Thread ecir hana
Dear list, I have a NSTextView, where the user can paste plain text into. When the users has "foo" in the pasteboard I would like "bar" to be pasted. In other words, a user goes to, say, a web browser, selects "foo", cmd+c, switches to my NSTextView, cmd+v and "bar" appears at insertion point. P

Re: Classes incompatible with weak references

2012-08-13 Thread John McCall
On Aug 13, 2012, at 9:29 AM, Jean-Daniel Dupas wrote: > Le 13 août 2012 à 17:56, Kyle Sluder a écrit : >> On Aug 13, 2012, at 8:42 AM, Ben wrote: >> >>> I see in the documentation - and from a compiler error - that some classes >>> are not compatible with weak references. >>> >>> What makes th

Re: How do I get memory usage numbers?

2012-08-13 Thread David Duncan
On Aug 12, 2012, at 7:10 PM, Charlie Dickman <3tothe...@comcast.net> wrote: > Initially I'm interested in system wide memory usage (free, wired,active, > inactive) but following on I might like numbers for just my process. > If hacking through Darwin is the only way to do this than never mind but

Re: reading preferences from com.apple.mail under 10.8

2012-08-13 Thread Rob McBroom
Sorry to revive an old thread. I've been out on vacation. To clarify, my application is *not* sandboxed. The application who's prefs I'm interested in (Mail) is. The question is: Should that matter? Documentation says "no". Trial and error says "yes". Since no one seems to know, I guess I'll fi

Re: Classes incompatible with weak references

2012-08-13 Thread Jean-Daniel Dupas
Le 13 août 2012 à 19:54, John McCall a écrit : > On Aug 13, 2012, at 9:29 AM, Jean-Daniel Dupas wrote: >> Le 13 août 2012 à 17:56, Kyle Sluder a écrit : >>> On Aug 13, 2012, at 8:42 AM, Ben wrote: >>> I see in the documentation - and from a compiler error - that some classes are no

Re: Help Indexer error - what does it MEAN?

2012-08-13 Thread Jerry Krinock
On 2012 Aug 13, at 07:17, Kyle Sluder wrote: > Help Indexer is broken for HTML input on Mountain Lion. You could try XHTML > input, or do what we do and run the indexer on 10.7. There is a new version of Help Indexer, version 4.2 (50). Please tell me that you're using an older version and th

NSSegmentedControl in ToolBar

2012-08-13 Thread koko
Add a Toolbar to a window in IB Add a Segmented Control as a Toolbar Item The default Label is 'Custom View' The control has 3 segments The label is centered under segment 1 Change the number of segment to 2 The label is centered on the center of the control Run

Re: Classes incompatible with weak references

2012-08-13 Thread Kyle Sluder
On Mon, Aug 13, 2012, at 11:30 AM, Jean-Daniel Dupas wrote: > > Thanks for the details. I know what the fragile ABI, and the modern ABI > are but where I don't agree is when Kyle says that it was not possible to > add a refcount ivar when retain/release was introduced. As retain/release > was alre

PackageMaker Unable to Change Content Permission

2012-08-13 Thread Tony S. Wu
Hi, I am trying to use PackageMaker to create a package for my application. This is the first time I opened up PackageMaker in Mountain Lion. I am running into a problem where the content permission cannot be changed to anyone else but me. I don't see any other users populated in the drop-down

Re: 32-bit on 10.8

2012-08-13 Thread Greg Parker
On Aug 11, 2012, at 6:16 PM, Jayson Adams wrote: > Poor reading skills are keeping this thread alive. No, I have not been > saying anything related to whatever work I may or may not have that's related > to 64-bit porting. What I have been ranting and raving about is the fact > that the 64-bi

Re: NSSegmentedControl in ToolBar [ANSWER]

2012-08-13 Thread koko
So it must be that the KVO of a tool bar item to its underlying control is out of whack. Select the toolbar item and adjust its width. -koko On Aug 13, 2012, at 12:41 PM, koko wrote: > Add a Toolbar to a window in IB > > Add a Segmented Control as a Toolbar Item > > The default Lab

Re: How do I get memory usage numbers?

2012-08-13 Thread Charlie Dickman
I'm using the system "say" command to speak phrases within my app. I've tried NSSpeechSynthesizer and Carbon's Speech Synthesis Engine but both have a serious memory leak problem which gets my app into trouble. By using the system "say" command I move the problem out of my app and into the syste

Re: NSCopyObject is a disaster (was Re: Another NSOutlineView issue)

2012-08-13 Thread Uli Kusterer
On 09.08.2012, at 01:21, Graham Cox wrote: > If a superclass implements copies using NSCopyObject, then any pointer ivars > we add in a subclass need to be additionally -retained. But if the superclass > implements copy by alloc/initing a new object and setting properties, then > this extra st

Re: NSCopyObject is a disaster (was Re: Another NSOutlineView issue)

2012-08-13 Thread Uli Kusterer
On 09.08.2012, at 02:01, Greg Parker wrote: >- (id) copyWithZone:(NSZone*) zone >{ >MyCell* copy = [super copyWithZone:zone]; >copy->someInternalPointer = [copy->someInternalPointer copy]; >return copy; >} Change this to > - (id) copyWithZone:(NSZone*) zone

Using NSPipe to get system command output

2012-08-13 Thread Charlie Dickman
I'm trying to get the output from a vm_stat command using the following code. My app hangs in the [vmRead availableData] call as it should if there is no data available but it never comes back. What am I doing wrong? I have searched through the sample code on apples developer site with no luck.

Re: NSCopyObject is a disaster (was Re: Another NSOutlineView issue)

2012-08-13 Thread Greg Parker
On Aug 13, 2012, at 2:12 PM, Uli Kusterer wrote: > On 09.08.2012, at 01:21, Graham Cox wrote: >> If a superclass implements copies using NSCopyObject, then any pointer ivars >> we add in a subclass need to be additionally -retained. But if the >> superclass implements copy by alloc/initing a ne

Re: NSTextView paste:

2012-08-13 Thread Seth Willits
On Aug 13, 2012, at 10:54 AM, ecir hana wrote: > I have a NSTextView, where the user can paste plain text into. > > When the users has "foo" in the pasteboard I would like "bar" to be pasted. > In other words, a user goes to, say, a web browser, selects "foo", cmd+c, > switches to my NSTextView,

Re: Classes incompatible with weak references

2012-08-13 Thread Mike Abdullah
On 13 Aug 2012, at 19:30, Jean-Daniel Dupas wrote: > > Le 13 août 2012 à 19:54, John McCall a écrit : > >> On Aug 13, 2012, at 9:29 AM, Jean-Daniel Dupas wrote: >>> Le 13 août 2012 à 17:56, Kyle Sluder a écrit : On Aug 13, 2012, at 8:42 AM, Ben wrote: > I see in the documenta

Re: How do I get memory usage numbers?

2012-08-13 Thread Jens Alfke
On Aug 13, 2012, at 2:01 PM, Charlie Dickman <3tothe...@comcast.net> wrote: > What I want to do is determine the ratio of inactive to free in order to > determine when to execute the purge command to free up the inactive memory > before the system gets into trouble. That's not what purge(1) do

Re: Using NSPipe to get system command output

2012-08-13 Thread Jens Alfke
On Aug 13, 2012, at 2:17 PM, Charlie Dickman <3tothe...@comcast.net> wrote: > int vmDataLength = 0; > do { > vmData = [vmRead availableData]; > vmDataLength = [vmData length]; > } while (vmDataLength != 0); Don't you mean "== 0" on the final line? Al

Re: How do I get memory usage numbers?

2012-08-13 Thread Alex Zavatone
Actually, when Safari is paging to the HD because it decided it needed to use 5+ GB of RAM, purge is really useful in temporarily getting the Mac back to normal speed until the memory bloats again. On Aug 13, 2012, at 5:54 PM, Jens Alfke wrote: > > On Aug 13, 2012, at 2:01 PM, Charlie Dickman

Re: Classes incompatible with weak references

2012-08-13 Thread Kyle Sluder
On Mon, Aug 13, 2012, at 02:47 PM, Mike Abdullah wrote: > An idea I've vaguely wondered about would be turning the isa variable > into a tagged pointer. If you know nothing is accessing it directly (to > do so was deprecated with the modern runtime), then, say, the last 4 bits > of the pointer coul

Re: Using NSPipe to get system command output

2012-08-13 Thread Kyle Sluder
On Mon, Aug 13, 2012, at 02:17 PM, Charlie Dickman wrote: > I'm trying to get the output from a vm_stat command using the following > code. My app hangs in the [vmRead availableData] call as it should if > there is no data available but it never comes back. What am I doing > wrong? I have searched

Re: NSTextView paste:

2012-08-13 Thread ecir hana
On Mon, Aug 13, 2012 at 11:45 PM, Seth Willits wrote: > > > - (BOOL)readSelectionFromPasteboard:(NSPasteboard *)pboard type:(NSString > *)type > { > if ([type isEqual:NSStringPboardType]) { > if ([[pboard stringForType:type] isEqual:@"foo"]) { > [se

Re: Using NSPipe to get system command output

2012-08-13 Thread Ken Thomases
On Aug 13, 2012, at 5:09 PM, Jens Alfke wrote: > On Aug 13, 2012, at 2:17 PM, Charlie Dickman <3tothe...@comcast.net> wrote: > >> int vmDataLength = 0; >> do { >> vmData = [vmRead availableData]; >> vmDataLength = [vmData length]; >> } while (vmDataLength

Re: NSTextView paste:

2012-08-13 Thread ecir hana
On Tue, Aug 14, 2012 at 12:55 AM, ecir hana wrote: > > > > aaa > bbb > > > I mean: foo foo ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev

Re: Using NSPipe to get system command output

2012-08-13 Thread Andy Lee
Apple seems to have pulled the ancient "Moriarity" example which demonstrates basic use of NSTask, but my cleanup of it should still work. --Andy On Aug 13, 2012, at 6:42 PM, Kyle Sluder wrote: > On Mon, Aug 13, 2012, at 02:17 PM, Charlie Dickman wrote: >>

Re: Using NSPipe to get system command output

2012-08-13 Thread Charlie Dickman
This is just test code to see if I can actually get the vm_stat data. It is run only under the debugger 1 or 2 steps at a time. When I have the concept down I will modify it. No, I actually mean != 0, see below - it is the description of how reading available data from a NSFileHandleForReading.

Re: Using NSPipe to get system command output

2012-08-13 Thread Charlie Dickman
So why doesn't it work??? On Aug 13, 2012, at 7:08 PM, Ken Thomases wrote: > On Aug 13, 2012, at 5:09 PM, Jens Alfke wrote: > >> On Aug 13, 2012, at 2:17 PM, Charlie Dickman <3tothe...@comcast.net> wrote: >> >>> int vmDataLength = 0; >>> do { >>> vmData = [vmRead availableDa

Re: Using NSPipe to get system command output

2012-08-13 Thread Ken Thomases
On Aug 13, 2012, at 5:42 PM, Kyle Sluder wrote: > On Mon, Aug 13, 2012, at 02:17 PM, Charlie Dickman wrote: >> I'm trying to get the output from a vm_stat command using the following >> code. My app hangs in the [vmRead availableData] call as it should if >> there is no data available but it never

Re: Using NSPipe to get system command output

2012-08-13 Thread Charlie Dickman
Andy, THANK YOU SO MUCH!! I am glad my inquiry spawned some interest but you have taught me how to fish ;^) Thanks again On Aug 13, 2012, at 7:27 PM, Andy Lee wrote: > Apple seems to have pulled the ancient "Moriarity" example which demonstrates > basic use of NSTask, but my cleanup of it sh

Re: Classes incompatible with weak references

2012-08-13 Thread Ken Ferry
On Aug 13, 2012, at 9:29 AM, Jean-Daniel Dupas wrote: > > Le 13 août 2012 à 17:56, Kyle Sluder a écrit : > >> On Aug 13, 2012, at 8:42 AM, Ben wrote: >> >>> I see in the documentation - and from a compiler error - that some classes >>> are not compatible with weak references. >>> >>> What

Re: Using NSPipe to get system command output

2012-08-13 Thread Andy Lee
You're very welcome. Although I wonder if you could simply replace the do-while loop with a call to NSTask's waitUntilExit method. --Andy On Aug 13, 2012, at 7:42 PM, Charlie Dickman <3tothe...@comcast.net> wrote: > Andy, > > THANK YOU SO MUCH!! > > I am glad my inquiry spawned some interest

Re: Using NSPipe to get system command output

2012-08-13 Thread Kyle Sluder
On Mon, Aug 13, 2012, at 04:38 PM, Ken Thomases wrote: > On Aug 13, 2012, at 5:42 PM, Kyle Sluder wrote: > > > On Mon, Aug 13, 2012, at 02:17 PM, Charlie Dickman wrote: > >> I'm trying to get the output from a vm_stat command using the following > >> code. My app hangs in the [vmRead availableData

Re: NSTextView paste:

2012-08-13 Thread Graham Cox
On 14/08/2012, at 3:54 AM, ecir hana wrote: > Please, does anyone know how to approach this? You don't need to do anything, AFAICS. NSTextView supports -paste: and will do the right thing internally. You only have to ensure it's first responder at the time you want to paste. --Graham __

Re: Help Indexer error - what does it MEAN?

2012-08-13 Thread Graham Cox
On 14/08/2012, at 12:17 AM, Kyle Sluder wrote: > Help Indexer is broken for HTML input on Mountain Lion. You could try XHTML > input, or do what we do and run the indexer on 10.7. Thanks! I was able to index my help by doing it in 10.7. (I tried 4.2, the latest I could find, and it doesn't

Re: NSTextView paste:

2012-08-13 Thread Seth Willits
On Aug 13, 2012, at 3:55 PM, ecir hana wrote: > Thank you for the reply! Unfortunately, there seem to be a tiny bug with > undo. My textview has "setRichText:" set to NO so that it triggers the first > condition. When the textview looks like this: > > aaa > bbb > > and I select and copy "aaa",

Re: Using NSPipe to get system command output

2012-08-13 Thread Ken Thomases
On Aug 13, 2012, at 6:52 PM, Andy Lee wrote: > You're very welcome. Although I wonder if you could simply replace the > do-while loop with a call to NSTask's waitUntilExit method. You can't unless you issue a -read..InBackgroundAndNotify method on the output file handle. Otherwise, if you're n

Re: Help Indexer error - what does it MEAN?

2012-08-13 Thread Graham Cox
On 14/08/2012, at 10:47 AM, Dennis wrote: > Running this script might help. It was posted by somebody on the Apple Help > list some time ago. That's a good resource for questions like these. > > Thanks... Seems out of date for ML but I was able to kill off the various caches manually by l