Re: Coalesced updates and refresh rate

2011-06-15 Thread Graham Cox
On 15/06/2011, at 1:04 AM, Wolfgang Kundrus wrote: > Is there anyway, I > can inform the window that graphics need to be flushed ? Have you tried [NSWindow displayIfNeeded] (or just [... display])? --Graham ___ Cocoa-dev mailing list (Cocoa-dev@list

Re: Coalesced updates and refresh rate

2011-06-15 Thread Wolfgang Kundrus
This did not influence it in a positive way. [NSWindow display] makes it worth and takes down the performance of the whole application. > > Is there anyway, I can inform the window that graphics need to be flushed > ? > > Have you tried [NSWindow displayIfNeeded] (or just [... display])? > > ___

Re: flipipng a CALayer from right to left

2011-06-15 Thread Gabriel Zachmann
> > Im trying to flip some CALayers, ones from left to right and another > from right to left over the y axis.. So this is what Im doing to flip > from left to right and the results is good. > > CATransform3D t = actual.transform; > t.m11 = 0.5; > actual.

Re: Coalesced updates and refresh rate

2011-06-15 Thread Graham Cox
On 15/06/2011, at 7:16 PM, Wolfgang Kundrus wrote: > This did not influence it in a positive way. [NSWindow display] makes it > worth and takes down the performance of the whole application. > > > Is there anyway, I can inform the window that graphics need to be flushed ? > > Have you tried

Re: Coalesced updates and refresh rate

2011-06-15 Thread Wolfgang Kundrus
We have to update a lot of small onscreen objects and performance is way better, when we travers them outside the Cocoa view tree. If we would use invalidating, we would have to go thru our complete view tree and check for overlaps with the update rect. Wolfgang This did not influence it in a pos

Re: Coalesced updates and refresh rate

2011-06-15 Thread Graham Cox
On 15/06/2011, at 10:30 PM, Wolfgang Kundrus wrote: > We have to update a lot of small onscreen objects and performance is way > better, when we travers them outside the Cocoa view tree. If we would use > invalidating, we would have to go thru our complete view tree and check for > overlaps wi

Re: Coalesced updates and refresh rate

2011-06-15 Thread Wolfgang Kundrus
Thanks for taking the time to respond. I am certainly not a newbie, being a Mac programmer since 1987 having brought three major applications with millions of customers to market that all run cross platform. That aside, I am trying to understand, why Cocoa does not flush the graphics, if there has

Re: Coalesced updates and refresh rate

2011-06-15 Thread Graham Cox
On 15/06/2011, at 11:42 PM, Wolfgang Kundrus wrote: > Thanks for taking the time to respond. I am certainly not a newbie, being a > Mac programmer since 1987 having brought three major applications with > millions of customers to market that all run cross platform. Cool. I wasn't calling into

NSDragOperation for operationNotAllowedCursor !!

2011-06-15 Thread Naresh Kongara
Hi, I'm working on a cocoa application, which is like a file browser similar to finder. In this application we implemented drag and drop of files/folder. we succeeded in displaying copy and link cursors for respective drag operations. As in finder how can we display a OperationNotAllwedCursor

NSDragOperation for operationNotAllowedCursor !!

2011-06-15 Thread Naresh Kongara
Hi, I'm working on a cocoa application, which is like a file browser similar to finder. In this application we implemented drag and drop of files/folder. we succeeded in displaying copy and link cursors for respective drag operations. As in finder how can we display a OperationNotAllwedCursor

Re: Interface item validation through first responder

2011-06-15 Thread Luc Van Bogaert
Laurent, I'm sorry I haven't been any clearer, but that's exactly what I am doing: I have designed two seperate views in IB, but I'm instantiating each of them with a view controller (and adding them to the content pane) in code. So, even though I have two nib files in IB, I'm assuming I can no

Re: Coalesced updates and refresh rate

2011-06-15 Thread Ken Thomases
On Jun 15, 2011, at 8:42 AM, Wolfgang Kundrus wrote: > That aside, I am trying to understand, why Cocoa does not flush the > graphics, if there has been drawn something to the window with the a method > that works well otherwise. I understand coalescing updates and I want to > stay away from CGCon

Copying files with authorization; best choice?

2011-06-15 Thread Sean McBride
Hi all, I need to copy files to /Library/Application Support/My Company. For users with lesser privileges, I'll need to prompt for authorization. (I'm not writing an installer. But within my app, I present an open panel for a user to choose a special config file that needs to be stored where

Re: Copying files with authorization; best choice?

2011-06-15 Thread Nick Zitzmann
On Jun 15, 2011, at 9:17 AM, Sean McBride wrote: > Hi all, > > I need to copy files to /Library/Application Support/My Company. For users > with lesser privileges, I'll need to prompt for authorization. > > (I'm not writing an installer. But within my app, I present an open panel > for a us

Re: Coalesced updates and refresh rate

2011-06-15 Thread Sean McBride
On Wed, 15 Jun 2011 22:47:44 +1000, Graham Cox said: >On 15/06/2011, at 10:30 PM, Wolfgang Kundrus wrote: > >> We have to update a lot of small onscreen objects and performance is >way better, when we travers them outside the Cocoa view tree. If we >would use invalidating, we would have to go thru

Re: NSDragOperation for operationNotAllowedCursor !!

2011-06-15 Thread Tony Romano
Return this NSDragOperationNone is validateDrop: Tony Romano On 6/15/11 7:48 AM, "Naresh Kongara" wrote: >Hi, > >I'm working on a cocoa application, which is like a file browser similar >to finder. In this application we implemented drag and drop of >files/folder. we succeeded in dis

Re: Copying files with authorization; best choice?

2011-06-15 Thread Ken Thomases
On Jun 15, 2011, at 10:35 AM, Nick Zitzmann wrote: > On Jun 15, 2011, at 9:17 AM, Sean McBride wrote: > >> I need to copy files to /Library/Application Support/My Company. For users >> with lesser privileges, I'll need to prompt for authorization. >> >> (I'm not writing an installer. But with

Re: Interface item validation through first responder

2011-06-15 Thread Luc Van Bogaert
On 14 Jun 2011, at 22:39, Quincey Morris wrote: > When you connect an action to "First Responder", that doesn't mean that it's > sent to the first responder object, but rather that it's sent to the first > object in the responder chain that implements the action. OK, I'm sure I understand this.

After Autoreleasing Still Getting Leaked

2011-06-15 Thread Bing Li
Dear all, I got a problem which confused me. The following method is put into NSOperationQueue so that it can run asynchronously. The method received data from a remote node and then converted the bytes to NSMutableString. This is a loop so that I set up an autorelease pool. I even set up an addit

Re: After Autoreleasing Still Getting Leaked

2011-06-15 Thread Scott Ribe
On Jun 15, 2011, at 10:02 AM, Bing Li wrote: >char buffer[1024]; >ssize_t numberBytesReceived; >while (true) >{ >NSAutoreleasePool *loopPool = [[NSAutoreleasePool alloc] > init]; >numberBytesReceived = recv(clientSocket, buffer, 1024

After Autoreleasing Still Getting Leaked

2011-06-15 Thread Bing Li
Dear all, I got a problem which confused me. The following method is put into NSOperationQueue so that it can run asynchronously. The method received data from a remote node and then converted the bytes to NSMutableString. This is a loop so that I set up an autorelease pool. I even set up an addit

Re: After Autoreleasing Still Getting Leaked

2011-06-15 Thread Gary L. Wade
There are so many fundamental issues with your coding. Rather than just throwing solutions at perceived problems, I would recommend you step back and document your justification for every line of code you write. In order to learn, you should consider this exercise to be descriptive enough to exp

Re: After Autoreleasing Still Getting Leaked

2011-06-15 Thread Scott Ribe
On Jun 15, 2011, at 10:22 AM, Bing Li wrote: > In addition, according to Activity Monitor, the memory consumed by the > program increased only when some new threads are added. After the threads > were dead, the memory was lowered to a fixed amount. Is it fine? Each thread has data structures asso

Re: Interface item validation through first responder

2011-06-15 Thread Quincey Morris
On Jun 15, 2011, at 08:56, Luc Van Bogaert wrote: > I'm not sure I understand how to accomplish this. What I have already tried, > is message the window with "makeFirstResponder:" passing my view controllers > as a parameter. This initially seemed to work fine; until I add an extra view > with

Re: After Autoreleasing Still Getting Leaked

2011-06-15 Thread Bing Li
Dear Scott, Gary and all, I appreciate so much for your replies! I am not a good C programmer. So I made some mistakes in the code. C is used only when programming with BSD sockets. According to your suggestions, the code is changed as follows. But the leaks are still notified by Instruments. But

Re: After Autoreleasing Still Getting Leaked

2011-06-15 Thread Scott Ribe
On Jun 15, 2011, at 11:38 AM, Bing Li wrote: > According to your suggestions, the code is changed as follows. But the leaks > are still notified by Instruments. But in Activity Monitor, the program works > fine. I feel weird about that. Could you figure out the problem? Thanks! OK, 1st, your bu

Re: Drawing noise in Cocoa (preferably fast)

2011-06-15 Thread Stephen Blinkhorn
On 14 Jun 2011, at 16:07, Quincey Morris wrote: On Jun 14, 2011, at 14:56, Stephen Blinkhorn wrote: I'm looking to fill a large custom view with noise. The solution I have arrived at so far is taking much too long to draw for it to be useable. Does anyone know any better ways of achieving

Re: Drawing noise in Cocoa (preferably fast)

2011-06-15 Thread Stephen Blinkhorn
Thanks Ken, will test this out. Stephen On 14 Jun 2011, at 23:44, Ken Tozier wrote: I didn't test this (basically cut and pasted from some existing code I have) but it should run plenty fast #define RGB_BYTES_PER_PIXEL 3 - (NSBitmapImageRep *) noiseImageRepWithBaseRed:(float) in

Re: Drawing noise in Cocoa (preferably fast)

2011-06-15 Thread David Duncan
On Jun 15, 2011, at 11:30 AM, Stephen Blinkhorn wrote: > On 14 Jun 2011, at 16:07, Quincey Morris wrote: > >> On Jun 14, 2011, at 14:56, Stephen Blinkhorn wrote: >> >>> I'm looking to fill a large custom view with noise. The solution I have >>> arrived at so far is taking much too long to draw

Re: After Autoreleasing Still Getting Leaked

2011-06-15 Thread Jens Alfke
What Scott said. Also, have you tried the "Build & Analyze" command in Xcode 3 (“Analyze” in Xcode 4)? It can detect a lot of common refcounting errors at compile time. Also also, be aware that creating an NSString from UTF-8 data can result in a nil string if the data is not valid UTF-8. This

Re: Drawing noise in Cocoa (preferably fast)

2011-06-15 Thread Stephen Blinkhorn
On 15 Jun 2011, at 12:35, David Duncan wrote: CGContextSetAlpha Brilliant ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lis

Re: After Autoreleasing Still Getting Leaked

2011-06-15 Thread Scott Ribe
On Jun 15, 2011, at 12:38 PM, Jens Alfke wrote: > Also also, be aware that creating an NSString from UTF-8 data can result in a > nil string if the data is not valid UTF-8. This can happen if the packet gets > corrupted in transit or if something else is accidentally or maliciously > sending un

Re: After Autoreleasing Still Getting Leaked

2011-06-15 Thread Bing Li
I test the program just on a single Mac machine using TCP, i.e., both the client and the server are located on the same machine. So I think it is impossible that the data is corrupted during the transmission. Thanks so much! Bing On Thu, Jun 16, 2011 at 2:57 AM, Scott Ribe wrote: > On Jun 15, 20

Re: Interface item validation through first responder

2011-06-15 Thread Luc Van Bogaert
On 15 Jun 2011, at 19:25, Quincey Morris wrote: > On Jun 15, 2011, at 08:56, Luc Van Bogaert wrote: > >> I'm not sure I understand how to accomplish this. What I have already tried, >> is message the window with "makeFirstResponder:" passing my view controllers >> as a parameter. This initially

Re: After Autoreleasing Still Getting Leaked

2011-06-15 Thread Scott Ribe
On Jun 15, 2011, at 1:04 PM, Bing Li wrote: > I test the program just on a single Mac machine using TCP, i.e., both the > client and the server are located on the same machine. So I think it is > impossible that the data is corrupted during the transmission. Correction to my prior post: even if

[iOS] What's the point of UISegementedControl.tintColor?

2011-06-15 Thread Rick Mann
When I set this in IB to say, black, the control becomes black, and there's no distinguishing between the selected segment and unselected segments. What's the point of tintColor? -- Rick ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please

Re: After Autoreleasing Still Getting Leaked

2011-06-15 Thread Wade Williams
Bing, That's not the point. The point is a program has to be ready to handle the possibility of corrupted, truncated or fragmented data. Writing a client-server program, particularly at the socket level, is not easy for that very reason. If you fail to take the possibilities into account, you

Re: [iOS] What's the point of UISegementedControl.tintColor?

2011-06-15 Thread Luke Hiesterman
If you set it to a color that isn't black, you will be able to see a difference. Black behaves this way because selection is shown by making the button appear depressed, and therefore darker. You can't get darker than black, thus what you see. Luke On Jun 15, 2011, at 12:15 PM, Rick Mann wrote

Re: [iOS] What's the point of UISegementedControl.tintColor?

2011-06-15 Thread Rick Mann
On Jun 15, 2011, at 12:19 , Luke Hiesterman wrote: > If you set it to a color that isn't black, you will be able to see a > difference. Black behaves this way because selection is shown by making the > button appear depressed, and therefore darker. You can't get darker than > black, thus what

Re: Interface item validation through first responder

2011-06-15 Thread Kyle Sluder
On Wed, Jun 15, 2011 at 12:12 PM, Luc Van Bogaert wrote: > So does this mean my window doesn't have a next responder? If so, I'm > completely lost about why that would be. But of course that would explain why > the validation methods are never called. Re-read Quincey's post. -nextResponder is N

Re: After Autoreleasing Still Getting Leaked

2011-06-15 Thread Bing Li
The string can be any length. I put the received strings into a queue and another thread gets the strings out of the queue and parse there. Actually, the string is XML. During the test, the string length is always 259. I also wonder why it works fine according to Activity Monitor if such a huge le

Re: After Autoreleasing Still Getting Leaked

2011-06-15 Thread Jens Alfke
On Jun 15, 2011, at 12:24 PM, Bing Li wrote: > The string can be any length. I put the received strings into a queue and > another thread gets the strings out of the queue and parse there. Actually, > the string is XML. During the test, the string length is always 259. If it’s XML, you should av

Re: After Autoreleasing Still Getting Leaked

2011-06-15 Thread Bing Li
Scott, Yes, TCP has the boundary issue. So I put a "\n" at the end of each XML. And there is no "\n" within any XML. Thanks! Bing On Thu, Jun 16, 2011 at 3:13 AM, Scott Ribe wrote: > On Jun 15, 2011, at 1:04 PM, Bing Li wrote: > > > I test the program just on a single Mac machine using TCP, i.e

Re: After Autoreleasing Still Getting Leaked

2011-06-15 Thread Jens Alfke
On Jun 15, 2011, at 12:04 PM, Bing Li wrote: > I test the program just on a single Mac machine using TCP, i.e., both the > client and the server are located on the same machine. So I think it is > impossible that the data is corrupted during the transmission. The UTF-8 issue isn’t something th

Re: After Autoreleasing Still Getting Leaked

2011-06-15 Thread Bing Li
OK. That's a good solution to XML transmission. However, it should not be the reason to cause memory leaks, right? On Thu, Jun 16, 2011 at 3:33 AM, Jens Alfke wrote: > > On Jun 15, 2011, at 12:24 PM, Bing Li wrote: > > > The string can be any length. I put the received strings into a queue and

Re: After Autoreleasing Still Getting Leaked

2011-06-15 Thread Jens Alfke
On Jun 15, 2011, at 12:34 PM, Bing Li wrote: > Yes, TCP has the boundary issue. So I put a "\n" at the end of each XML. And > there is no "\n" within any XML. That has nothing to do with the issue of UTF-8 sequences being split across reads. In UTF-8, non-ASCII characters are represented as m

Re: Interface item validation through first responder

2011-06-15 Thread Quincey Morris
On Jun 15, 2011, at 12:12, Luc Van Bogaert wrote: > Because things still don't work, I have tried to visualize the responder > chain by adding this into applicationDidFinishLaunching: > > NSResponder *nextResponder = [self.window nextResponder]; > do { > NSLog(@"%@", [nextRespond

Re: After Autoreleasing Still Getting Leaked

2011-06-15 Thread Bing Li
Jens, Thanks so much for your suggestions! I wonder why it works fine according to Activity Monitor if such a huge leak exists. The consumed memory in the Activity Monitor is stable and much smaller unless some threads are created at a high concurrent moment. After the threads are dead, the consu

Re: After Autoreleasing Still Getting Leaked

2011-06-15 Thread Conrad Shultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 6/15/11 12:50 PM, Bing Li wrote: > Jens, > > Thanks so much for your suggestions! > > I wonder why it works fine according to Activity Monitor if such a huge leak > exists. The consumed memory in the Activity Monitor is stable and much > smaller u

Re: Interface item validation through first responder

2011-06-15 Thread Luc Van Bogaert
On 15 Jun 2011, at 21:49, Quincey Morris wrote: > On Jun 15, 2011, at 12:12, Luc Van Bogaert wrote: > >> Because things still don't work, I have tried to visualize the responder >> chain by adding this into applicationDidFinishLaunching: >> >> NSResponder *nextResponder = [self.window nextR

addChildWindow and hiding the toolbar

2011-06-15 Thread Leonardo
Hi, I need a transparent NSDrawer, so since I can't get it, I create a borderless window and I add it as child to my main window  [infoWindow setBackgroundColor:[NSColor clearColor]]; [self addChildWindow:infoWindow ordered:NSWindowBelow]; Everything works as expected, except when I cli

Re: After Autoreleasing Still Getting Leaked

2011-06-15 Thread Bing Li
Dear Conrad, I appreciate so much for your suggestions! Actually, I attempt to design P2P system using Cocoa. Meanwhile, the peer on Mac OS X must communicate with some Java systems. So I need to use sockets and transmit XML. Best regards, Bing On Thu, Jun 16, 2011 at 4:10 AM, Conrad Shultz < c

Re: After Autoreleasing Still Getting Leaked

2011-06-15 Thread Jens Alfke
On Jun 15, 2011, at 1:26 PM, Bing Li wrote: > Actually, I attempt to design P2P system using Cocoa. Meanwhile, the peer on > Mac OS X must communicate with some Java systems. So I need to use sockets > and transmit XML. Sorry to be blunt, but it’s clear from this answer (and others) that you’r

Re: addChildWindow and hiding the toolbar

2011-06-15 Thread Jens Alfke
On Jun 15, 2011, at 1:23 PM, Leonardo wrote: > I need a transparent NSDrawer, so since I can't get it Have you tried something like [[[drawer contentView] window] setAlphaValue: 0.5]; ? > So my question is, how to resize the infoWindow too? > I tried to override the methods: > > - (voi

Re: After Autoreleasing Still Getting Leaked

2011-06-15 Thread Bing Li
Dear Jens and Conrad, I appreciate so much for your help! Actually, I am still new to program Cocoa. My past experiences are more high level languages such as C# and Java. So I am not familiar with memory management although I have read the documents. I will follow your suggestions and reread the

Re: Interface item validation through first responder

2011-06-15 Thread Quincey Morris
On Jun 15, 2011, at 13:12, Luc Van Bogaert wrote: > This indeed results in a tree of responder objects becoming visible: > > 2011-06-15 21:56:28.622 DotSketcher[3267:903] NSTextView > 2011-06-15 21:56:28.623 DotSketcher[3267:903] _NSKeyboardFocusClipView > 2011-06-15 21:56:28.624 DotSketcher[3267

Re: After Autoreleasing Still Getting Leaked

2011-06-15 Thread Scott Ribe
On Jun 15, 2011, at 2:30 PM, Jens Alfke wrote: > On Jun 15, 2011, at 1:26 PM, Bing Li wrote: > >> Actually, I attempt to design P2P system using Cocoa. Meanwhile, the peer on >> Mac OS X must communicate with some Java systems. So I need to use sockets >> and transmit XML. > > Sorry to be blun

Re: iOS: encoding a custom view with a shape in it

2011-06-15 Thread Steve Christensen
On Jun 15, 2011, at 8:29 AM, Development wrote: > Using the keyed archiver I save all of the values related to the drawing > inside of the view. Then of course I save the view's parameters. OK, I can see archiving the properties of the shape(s) so that you can restore them. It sounds like you'r

Re: addChildWindow and hiding the toolbar

2011-06-15 Thread Leonardo
> [[[drawer contentView] window] setAlphaValue: 0.5]; This makes the whole drawer transparent. I would indeed drawn my own shape using a picture. So I thought to set the window transparent and the content opaque. > It¹s easier to observe NSWindowDidResizeNotification. I am gonna try that out. Than

Re: addChildWindow and hiding the toolbar

2011-06-15 Thread Leonardo
I forgot, the other problem I get using the child window is that the child window never gets active. Even if I override - (BOOL)canBecomeKeyWindow { return YES;} I can't click and activate any textField nor a tableView... not even the keyboard works. I create the child window this way MyChildW

Custom NSSlider

2011-06-15 Thread Nick
Hello I am wondering if there are any free custom NSSlider controles available with changed knob and trackbar images? The ones similar to QuickTime Player and iTunes (for a player application). Does everyone implement them from scratch by subclassing the cell class? Thank you __

Re: Drawing noise in Cocoa (preferably fast)

2011-06-15 Thread Ken Tozier
Just curious, what kind of speed are you getting with the CIImage methods? I saw the usefulness of generating random images for my own purposes and polished the posted code a bit today. It was generating 100 million pixel images (10,000 x 10,000) with per-pixel randomization in about 2.2 seconds

Re: After Autoreleasing Still Getting Leaked

2011-06-15 Thread Tony Romano
I state a point slightly different to Bing about the TCP issue. TCP does NOT guarantee you will get the WHOLE PACKET on one receive call. BEFORE you PROCESS any data, you need to know that you have ALL the data. It may work MOST of the TIME, but there are times when it won't and your code WILL FAI

Re: After Autoreleasing Still Getting Leaked

2011-06-15 Thread Scott Ribe
On Jun 15, 2011, at 8:01 PM, Tony Romano wrote: > 2. You need to know how many bytes any particular packet contains. > Usually there is some operation code pair with the number of byte to > expect for the operation. That's certainly the way I prefer, but it is also possible to use a marker at th

Animating NSSplitPane position

2011-06-15 Thread Graham Cox
Does anyone know how to animate the positioning of a split pane? I'm using -setPosition:ofDividerAtIndex: and I call this using the view's animator: [[mySplitPane animator] setPosition:position ofDividerAtIndex:0]; But it doesn't animate and just jumps into position. I see other apps ma

Re: Animating NSSplitPane position

2011-06-15 Thread Dave DeLong
I have no special insights into this other than that the BWSplitView (part of BWToolkit) also does animated resizing, so it may be worth a poke around in the BWToolkit source: https://bitbucket.org/bwalkin/bwtoolkit HTH, Dave On Jun 15, 2011, at 7:48 PM, Graham Cox wrote: > Does anyone know

Re: Animating NSSplitPane position

2011-06-15 Thread Antonio Nunes
On 16 Jun 2011, at 03:48, Graham Cox wrote: > I'm using -setPosition:ofDividerAtIndex: and I call this using the view's > animator: > > [[mySplitPane animator] setPosition:position ofDividerAtIndex:0]; > > But it doesn't animate and just jumps into position. I see other apps manage > thi

Re: Animating NSSplitPane position

2011-06-15 Thread Graham Cox
Hi Antonio, wow - that's a substantial response! Thanks! I did find a simple way to do it which suits my needs, though it's not perfect. I added a category on NSSplitView (not pane - my bad) as follows: @implementation NSSplitView (Animation) + (id) defaultAnimationForKey:(NSString *)key {