Re: advice for creating these controls

2012-03-23 Thread Seth Willits
On Mar 22, 2012, at 9:49 PM, Lee Ann Rucker wrote:

 The button/popup combo could still be an NSSegmentedControl. Getting a menu 
 on a segment is just a matter of setMenu:forSegment: - the triangle would 
 have to be part of the icon, because it doesn't do it for you.

You're totally right. I had forgotten about that.



On Mar 22, 2012, at 9:50 PM, Rick C. wrote:

 Thanks everyone for the replies.  Yes I guess I just need to get a bit better 
 at subclassing to get the right look. :-)  To be sure I would subclass 
 NSSegmentedControl not NSSegmentedCell right?

It's NSSegmentedCell that does the drawing for the control. Same goes for all 
of the other controls - their cells do the drawing.


--
Seth Willits




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: asynchronous nsurlconnection in nsoperation

2012-03-23 Thread Ariel Feinerman
Andreas,

thank you for your answer!  What is the well? I believe the streaming work
so we unarchive the this on the fly then write to url to avoid unnecessary
actions with copy
*
*
On Thu, Mar 22, 2012 at 4:10 PM, Andreas Grosam agro...@onlinehome.dewrote:


 On Mar 21, 2012, at 4:59 PM, Ariel Feinerman wrote:

  Hi,

  I wish to insert an asynchronous NSURLConnection into non-concurrent
  NSOperation
  the reason is to allow necessarily unarchive actions on the streaming
 date

  Is this for iOS or Mac OS?
  This for iOS
 
  The date is very large their amount is 400 Mb so the asynchronous is
  necessarily
  one cannot be in memory at once
 
  - (void) connection: (NSURLConnection *) connection didReceiveData:
  (NSData*) data {
  // Append the new data to receivedData.
  [_receivedData appendData: data];
  if ([_receivedData length] = MAX_CHUNK) {
  // unarchive
  // write to file
  // [receivedData setLength: 0];
  }
 
  }
 
  Is there a correct way to do ?

 Yes.

 And your described approach works fine - if your connection delegates run
 on a secondary thread. Not sure, if you are actually required to use
 NSOperation, but basically, when you start your connection on a secondary
 thread (in order to keep the main thread responsive), it should work fine.
 (See the code below, how one can accomplish to start a connection on a
 secondary thread.)

 Though, your approach is not optimal and it also **requires** that you can
 actually process (unarchive) **partial** data.


 If you cannot process partial data, you have to search for a more
 elaborated solution to this problem:

 There are several approaches, from simple to more complex. And, there are
 approaches which look promising but won't work!

 What you need to use in any case is an **asynchronous** (NSURL)connection.
 Don't use a synchronously scheduled NSURLConnection with that amount of
 data!

 1) The simplest one that works is to immediately write the received data
 to a temporary file (appending partial data to a file works fine). Then
 when finished downloading, process the temporary file, possibly leveraging
 mmap, NSStream, GCD or NSOperation. For this approach, you don't need
 anything special in the NSURLConnection. Starting it from the main thread
 is sufficient. Writing to the temp file is usually fast enough to keep the
 main thread responsive.
 When you are processing the data, you can schedule the task on a secondary
 thread.

 This approach is simple to implement, but is suboptimal performance wise -
 especially on devices with more than one CPU.


 2) An approach that combines high performance with low memory foot-print
 is one that is a bit more elaborated. This would also require to schedule
 the connection on a secondary thread. (example on request)


 3) A few approaches that WONT work and will likely eventually crash are
 the following:

 3.a)
 - (void) connection:(NSURLConnection*)connection didReceiveData:(NSData*)
 data
 {
dispatch_async(queue, ^{processData:data;}];
 }
 where processData: is supposed to be able to handle partial data.
 This will likely crash due to memory running out: If downloading is fast,
 and processing is slow, GCD queues a lot of buffers - until memory runs out.

 3.b)
 - (void) connection:(NSURLConnection*)connection didReceiveData:(NSData*)
 data
 {
[_receivedData appendData: data];
 }
 And when finished, processing _receivedData.
 This will crash due to memory running out.





 Regards

 Andreas



 ==

 You can start a connection in a secondary thread, as follows:

 Anywhere, for instance a ViewController handling the Start Button:

// start the NSURLConnection in a secondary thread:
[NSThread detachNewThreadSelector:@selector
 (startConnectionInSecondaryThread)
 toTarget:self withObject:nil];


 And -startConnectionInSecondaryThread is implemented:

 static NSString* kDownloadConnectionRunLoopMode =
 @MyViewControllerDownloadConnectionRunMode;


Won't  this thrash the work?

- (void) startConnectionInSecondaryThread
 {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
[self startConnection];
runLoopDone_ = NO;
// Enable the run loop:
// first, add a dummy source in order to prevent the Run loop from
 exiting
// immediately when the connection closes :
[[NSRunLoop currentRunLoop] addPort:[NSMachPort port]
 forMode:kDownloadConnectionRunLoopMode];
do {
BOOL processedSource = [[NSRunLoop currentRunLoop]
 runMode:kDownloadConnectionRunLoopMode beforeDate:[NSDate distantFuture]];
} while (!runLoopDone_);

[pool release];
 }


 And finally, -startConnection, which is shown in more detail, to show some
 things you need to care about:

 - (void) startConnection
 {
// Note: startConnection can be performed on secondary threads, thus we
 need
// to schedule UIKit methods onto the main thread.

NSString* urlString = @http://exmample.com;;
   

Re: advice for creating these controls

2012-03-23 Thread Rick C.
This is what I would expect too.  But drawSegment:inFrame:withView: doesn't 
override the cell drawing from what I know am I missing something?



On Mar 23, 2012, at 2:19 PM, Seth Willits wrote:

 On Mar 22, 2012, at 9:49 PM, Lee Ann Rucker wrote:
 
 The button/popup combo could still be an NSSegmentedControl. Getting a menu 
 on a segment is just a matter of setMenu:forSegment: - the triangle would 
 have to be part of the icon, because it doesn't do it for you.
 
 You're totally right. I had forgotten about that.
 
 
 
 On Mar 22, 2012, at 9:50 PM, Rick C. wrote:
 
 Thanks everyone for the replies.  Yes I guess I just need to get a bit 
 better at subclassing to get the right look. :-)  To be sure I would 
 subclass NSSegmentedControl not NSSegmentedCell right?
 
 It's NSSegmentedCell that does the drawing for the control. Same goes for all 
 of the other controls - their cells do the drawing.
 
 
 --
 Seth Willits
 
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/rickcorteza%40gmail.com
 
 This email sent to rickcort...@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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: asynchronous nsurlconnection in nsoperation

2012-03-23 Thread Steve Sisak

At 6:59 PM +0300 3/21/12, Ariel Feinerman wrote:

I wish to insert an asynchronous NSURLConnection into non-concurrent
NSOperation the reason is to allow necessarily unarchive actions on 
the streaming date so


Look at (and steal code from) the LinkedImageFetcher sample:

http://developer.apple.com/library/mac/#samplecode/LinkedImageFetcher/

I'm pretty sure if you steal the Core Code directory, and subclass 
QHTTPOperation, that ought to do pretty much what you want.


HTH,

-Steve
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Binding and multithreading

2012-03-23 Thread Jonathan Taylor
I have been struggling with a problem which I think I have eventually realised 
is down to me not handling multithreading issues properly. The situation is I 
have some computationally-demanding code that is running in a separate thread. 
This has input parameters and state variables associated with it. For 
diagnostic reasons I would like to be able to display the values of the state 
variables in the GUI. I had intended to do this just by binding to them. 
However I am getting occasional message sent to deallocated instance errors 
which I suspect are a symptom of the fact that I am Doing It Wrong. Further 
reading suggests that because of the way bindings work, modifying those state 
variables is leading to binding/gui type stuff happening away from the main 
thread, which appears not to be permitted.

What I can't work out is whether there is a reasonably elegant and 
uncomplicated way of achieving what I want: the properties in question are 
being modified from a secondary thread, and I would like to display their 
values in the GUI, preferably via bindings for convenience. I could for example 
keep a shadow object which the GUI binds to, whose state is updated either 
periodically or in specific response to changes to properties in the primary 
object based in the secondary thread. However that strikes me as rather 
unwieldy and requiring a fair amount of extra code to implement correctly and 
efficiently. I feel there must be a better way of dealing with my problem - or 
maybe there isn't, and I just need to accept that bindings etc do not work well 
in a multithreaded environment. Does anybody have any advice?

Cheers
Jonny
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


can't get NSTextFinder to show the find panel

2012-03-23 Thread Eric Slosser
I'm trying to use the NSTextFinder object on Lion, from an app whose base SDK 
is Tiger.

I've created an instance of NSTextFinder, called its -setClient: method, my 
client implements all methods of the NSTextFinderClient (using -string).  My 
client does _not_ do the NSTextFinderBarContainer protocol, I want to use the 
panel.

I expect that calling [m_textFinder 
performAction:NSTextFinderActionShowFindInterface] would make the find panel 
appear, but it doesn't.

It's not the app or how it's built, because in another window, I have an 
NSTextView, and it is able to show the panel.  I've traced its calls and see 
it's using NSTextFinder.

What am I doing wrong?

TIA!
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Why so many public properties all up in my grizzle?

2012-03-23 Thread Sebastian Celis
On Thu, Mar 22, 2012 at 6:39 PM, G S stokest...@gmail.com wrote:
 On Mon, Mar 19, 2012 at 1:35 PM, Sebastian Celis
 li...@sebastiancelis.comwrote:

 1) Embrace @properties...Exposing _ivars in header files is
 gross. You never want people to access them directly, so don't make
 those declarations public at all.


 2) Technically, nothing is truly private in Objective-C, so let's stop
 trying to completely prevent people from using private APIs.

 contradiction++

I think you misunderstood.

My point on (1) was that directly referencing ivars of other classes
with the - operator is generally frowned upon in Objective-C. For
one, you miss out on KVO that way. It is generally much more accepted
to use real Objective-C methods and properties. Because of this,
putting ivars in a *public* header file is strange and just clutters
up what could otherwise be a clean, compact public interface
declaration.

My point on (2) was to just try and steer the conversation away from
where it had been headed, which was an expansive discussion on how
Objective-C handles public / protected / private methods and
properties. Yes, private methods aren't really private. I can always
use NSInvocation to call your private methods if I really want to.
What I think is much more interesting is finding the best way to
create compact, readable public header files that API consumers can
reference while still finding good ways to use both traditionally
private and protected methods in your class and subclasses. I just
want to keep those out of the public header file — not to *prevent*
you from using them, but just to communicate to you that you should
try to avoid them.

- Sebastian

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

UITableView lazy instantiation question

2012-03-23 Thread Alex Zavatone
While working on practice coding exercises last night, I was trying what I 
thought should be a simple project.  I wanted to acquire some data, assign it 
as the datasource for a UITableView, then select a value in that, pass off the 
selected value to a holder of data, then push a new view for another 
UITableView, acquire data based on the selected value and then display it.

What bent my mind over a stump was that all the examples I had all never seemed 
to follow Apple's documentation in the creation of UITableView. I've got one 
empty xib file with a window tied to the App Delegate.  As a result, in my 
second UITableView, I got a nice empty white screen, until I walked through the 
TableView Programming Guide for iOS and added this code:

- (void)loadView
{
NSLog(@LocationSpecificsViewController); 
NSLog(@  In loadView);

UITableView *tableView = [[UITableView alloc] initWithFrame:[[UIScreen 
mainScreen] applicationFrame]

  style:UITableViewStylePlain];

Now, this is what I expected to have to do if creating the tableView 
programatically.  But for the life of me, I can't figure out how all the other 
examples (that aren't using a storyboard or xib file) are bringing a table into 
existence merely through lazy instantiation or with the viewController 
declaration in the application didFinishLaunching portion of the AppDelegate.

I'm expecting that I should look for a UITableView alloc somewhere, but well, 
that's obviously not the case.  Though the TVC is being created in the 
AppDelegate, I'm expecting to see a visible declaration of the UITableView, and 
am not clear how that's happening through lazy instantiation (in Hegarty's 
example) or in some of the sample files that Apple provides that don't use xibs 
or storyboards.

What's happening that allows the tableview to appear and operate with only..

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath 
*)indexPath
- (NSInteger)tableView:(UITableView *)tableView 
numberOfRowsInSection:(NSInteger)section
- (UITableViewCell *)tableView:(UITableView *)tableView 
cellForRowAtIndexPath:(NSIndexPath *)indexPath

...yet no visible UITableView allocation that I can see?

TIA
- Alex Zavatone



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: can't get NSTextFinder to show the find panel

2012-03-23 Thread Fritz Anderson
On 23 Mar 2012, at 8:18 AM, Eric Slosser wrote:

 I'm trying to use the NSTextFinder object on Lion, from an app whose base SDK 
 is Tiger.
…
 What am I doing wrong?

You're trying to use the NSTextFinder object on Lion, from an app whose base 
SDK is Tiger. Xcode is sensitive to what the base SDK is.

* Symbols exclusive to a later SDK than then base shouldn't be compilable or 
linkable at all. I'm unsure how you got past this barrier. This leads me to 
believe that either you've instituted a gigantic hack, or your description of 
your situation is inaccurate. Care to elaborate?

* To preserve backward compatibility, when OS version N detects that an 
application has been linked against SDK version (M  N), it does not provide 
bug-fixes or other changes that were instituted after version M. Even if you 
managed somehow to add NSTextFinder to your headers and libraries, Cocoa would 
not provide behavior that NSTextFinder may rely on.

But the fact that you could build at all suggests that I don't understand what 
you're doing. Could you clarify?

— F


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: UITableView lazy instantiation question

2012-03-23 Thread Luke Hiesterman
If you use a UITableViewController, the controller automatically creates a 
UITableView instance and sets it to self.view.

Luke

On Mar 23, 2012, at 8:02 AM, Alex Zavatone wrote:

 While working on practice coding exercises last night, I was trying what I 
 thought should be a simple project.  I wanted to acquire some data, assign it 
 as the datasource for a UITableView, then select a value in that, pass off 
 the selected value to a holder of data, then push a new view for another 
 UITableView, acquire data based on the selected value and then display it.
 
 What bent my mind over a stump was that all the examples I had all never 
 seemed to follow Apple's documentation in the creation of UITableView. I've 
 got one empty xib file with a window tied to the App Delegate.  As a result, 
 in my second UITableView, I got a nice empty white screen, until I walked 
 through the TableView Programming Guide for iOS and added this code:
 
 - (void)loadView
 {
   NSLog(@LocationSpecificsViewController); 
   NSLog(@  In loadView);
 
   UITableView *tableView = [[UITableView alloc] initWithFrame:[[UIScreen 
 mainScreen] applicationFrame]
   
   style:UITableViewStylePlain];
   
 Now, this is what I expected to have to do if creating the tableView 
 programatically.  But for the life of me, I can't figure out how all the 
 other examples (that aren't using a storyboard or xib file) are bringing a 
 table into existence merely through lazy instantiation or with the 
 viewController declaration in the application didFinishLaunching portion of 
 the AppDelegate.
 
 I'm expecting that I should look for a UITableView alloc somewhere, but well, 
 that's obviously not the case.  Though the TVC is being created in the 
 AppDelegate, I'm expecting to see a visible declaration of the UITableView, 
 and am not clear how that's happening through lazy instantiation (in 
 Hegarty's example) or in some of the sample files that Apple provides that 
 don't use xibs or storyboards.
 
 What's happening that allows the tableview to appear and operate with only..
 
 - (void)tableView:(UITableView *)tableView 
 didSelectRowAtIndexPath:(NSIndexPath *)indexPath
 - (NSInteger)tableView:(UITableView *)tableView 
 numberOfRowsInSection:(NSInteger)section
 - (UITableViewCell *)tableView:(UITableView *)tableView 
 cellForRowAtIndexPath:(NSIndexPath *)indexPath
 
 ...yet no visible UITableView allocation that I can see?
 
 TIA
 - Alex Zavatone
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: UITableView lazy instantiation question

2012-03-23 Thread Fritz Anderson
On 23 Mar 2012, at 10:02 AM, Alex Zavatone wrote:

 I'm expecting that I should look for a UITableView alloc somewhere, but well, 
 that's obviously not the case.  Though the TVC is being created in the 
 AppDelegate, I'm expecting to see a visible declaration of the UITableView, 
 and am not clear how that's happening through lazy instantiation (in 
 Hegarty's example) or in some of the sample files that Apple provides that 
 don't use xibs or storyboards.

If you're using UITableViewController, it creates its own UITableView, filling 
the view-controller's space (i.e., net of navigation and tab views), and 
connects its data-source and delegate outlets.

— F


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: UITableView lazy instantiation question

2012-03-23 Thread Alex Zavatone

On Mar 23, 2012, at 11:24 AM, Luke Hiesterman wrote:

 If you use a UITableViewController, the controller automatically creates a 
 UITableView instance and sets it to self.view.

Do you know when this gets assigned?

Yeah, that's what I did, but I never got a table view until I added those lines.

@interface LocationSpecificsTableViewController : UITableViewController {

- Alex Zavatone



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: UITableView lazy instantiation question

2012-03-23 Thread Luke Hiesterman
The table view is created in UITableViewController's implementation of 
loadView. If the table view controller was instantiated via 
-initWithNibName:bundled: it will load the table view from the nib. Otherwise 
it will load it with alloc/init. If you were overriding loadView and not 
calling super, you would not get a table view.

Luke

On Mar 23, 2012, at 8:38 AM, Alex Zavatone wrote:

 
 On Mar 23, 2012, at 11:24 AM, Luke Hiesterman wrote:
 
 If you use a UITableViewController, the controller automatically creates a 
 UITableView instance and sets it to self.view.
 
 Do you know when this gets assigned?
 
 Yeah, that's what I did, but I never got a table view until I added those 
 lines.
 
 @interface LocationSpecificsTableViewController : UITableViewController {
 
 - Alex Zavatone
 
 
 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: asynchronous nsurlconnection in nsoperation

2012-03-23 Thread Andreas Grosam

On Mar 23, 2012, at 11:25 AM, Steve Sisak wrote:

 At 6:59 PM +0300 3/21/12, Ariel Feinerman wrote:
 I wish to insert an asynchronous NSURLConnection into non-concurrent
 NSOperation the reason is to allow necessarily unarchive actions on the 
 streaming date so
 
 Look at (and steal code from) the LinkedImageFetcher sample:
 
 http://developer.apple.com/library/mac/#samplecode/LinkedImageFetcher/
 
 I'm pretty sure if you steal the Core Code directory, and subclass 
 QHTTPOperation, that ought to do pretty much what you want.
 
 HTH,
 
 -Steve


The LinkedImageFetcher sample is quite a good example to look at when you are 
required to use NSOperation to wrap a download. For a sample, it is quite 
complex though.

So, basically, QHTTPOperation is a good but rather complex example which shows 
how to run a NSURLConnection on a secondary thread, and also how to wrap it 
into a NSOperation which can be canceled etc.

Still, the sample is not a good example to show how to *process* arbitrary data 
*during* the download process. The sample shows two ways to handle data:
-  write the received data into an NSOutputStream, and 
-  store the content into an accumulator - which is a mutable NSData.

The latter disqualifies since the OP's data is about several MBytes large, too 
large for a mobile device. 

And when the NSOutputStream is an ordinary file stream, we gain nothing than 
writing into a file directly, which can be accomplished much easier.

If you subclass the NSOutputStream in order to achieve a fancier processing, 
you will nevertheless run into issues which are completely orthogonal to using 
NSOperation. 

Furthermore, using NSStreams is often unduly cumbersome and often not that easy 
as it sounds. You need a bound stream pair, and there have been various issues 
with this.

Still, any process that handles the data via NSStreams must be able to handle 
such data in **chunks**. If this is not possible, the solution with NSStream 
becomes even more complex - if feasible at all. See also, 
https://devforums.apple.com/message/608213#608213

If the data *can* be processed *partially*, then the simplest approach is just 
doing this in

- (void) connection:(NSURLConnection*)connection didReceiveData:(NSData*) data 
{
   [self processChunk:data];
}

where  processChunk: must perform synchronously - that is, it shall block until 
after that chunk of data has been processed completely and has relinquished 
ownership from data.

If it would perform asynchronously, many NSData buffers may possibly queued - 
and this may consume too much memory.


Andreas

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: UITableView lazy instantiation question

2012-03-23 Thread Alex Zavatone

On Mar 23, 2012, at 11:33 AM, Fritz Anderson wrote:

 On 23 Mar 2012, at 10:02 AM, Alex Zavatone wrote:
 
 I'm expecting that I should look for a UITableView alloc somewhere, but 
 well, that's obviously not the case.  Though the TVC is being created in the 
 AppDelegate, I'm expecting to see a visible declaration of the UITableView, 
 and am not clear how that's happening through lazy instantiation (in 
 Hegarty's example) or in some of the sample files that Apple provides that 
 don't use xibs or storyboards.
 
 If you're using UITableViewController, it creates its own UITableView, 
 filling the view-controller's space (i.e., net of navigation and tab views), 
 and connects its data-source and delegate outlets.


Yeah, this is odd.  It didn't until I alloced the UITableView myself.  Made for 
a very long night last night trying to figure out why that was the case.  

- Alex Zavatone



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: UITableView lazy instantiation question

2012-03-23 Thread Alex Zavatone

On Mar 23, 2012, at 11:42 AM, Luke Hiesterman wrote:

 The table view is created in UITableViewController's implementation of 
 loadView. If the table view controller was instantiated via 
 -initWithNibName:bundled: it will load the table view from the nib. Otherwise 
 it will load it with alloc/init. If you were overriding loadView and not 
 calling super, you would not get a table view.

Bingo.  You are awesome.

- Alex Zavatone



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: can't get NSTextFinder to show the find panel

2012-03-23 Thread Eric Slosser
On Mar 23, 2012, at 11:05 AM, Fritz Anderson wrote:

 You're trying to use the NSTextFinder object on Lion, from an app whose base 
 SDK is Tiger. Xcode is sensitive to what the base SDK is.

I don't think that's the issue because NSTextView, when called from within my 
app, uses instances of NSTextFinder to perform the find/replace actions.

 * Symbols exclusive to a later SDK than then base shouldn't be compilable or 
 linkable at all. I'm unsure how you got past this barrier. This leads me to 
 believe that either you've instituted a gigantic hack, or your description of 
 your situation is inaccurate. Care to elaborate?

To compile, I created a subset of the NSTextFinder header with methods pulled 
from 10.7 SDK version.

There's no issue with linking because dyld finds NSTextFinder at load time, and 
the methods dispatched dynamically, not through a static offset from 'self'.

 * To preserve backward compatibility, when OS version N detects that an 
 application has been linked against SDK version (M  N), it does not provide 
 bug-fixes or other changes that were instituted after version M.

I'm aware of that issue, but for the reason I stated above, I don't believe 
it's part of the problem.

 Even if you managed somehow to add NSTextFinder to your headers and 
 libraries, Cocoa would not provide behavior that NSTextFinder may rely on.

The instances of NSTextView I use seem to be getting everything they need.  
They show the find panel when asked.

Have you used NSTextFinder with a client other than NSTextView and 
NSScrollerView?
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: can't get NSTextFinder to show the find panel

2012-03-23 Thread Kevin Perry
The public NSTextFinder API doesn't provide a way for you to access the 
old-style find panel.

-KP

On Mar 23, 2012, at 6:18 AM, Eric Slosser eric.slos...@v-fx.com wrote:

 I'm trying to use the NSTextFinder object on Lion, from an app whose base SDK 
 is Tiger.
 
 I've created an instance of NSTextFinder, called its -setClient: method, my 
 client implements all methods of the NSTextFinderClient (using -string).  My 
 client does _not_ do the NSTextFinderBarContainer protocol, I want to use the 
 panel.
 
 I expect that calling [m_textFinder 
 performAction:NSTextFinderActionShowFindInterface] would make the find panel 
 appear, but it doesn't.
 
 It's not the app or how it's built, because in another window, I have an 
 NSTextView, and it is able to show the panel.  I've traced its calls and see 
 it's using NSTextFinder.
 
 What am I doing wrong?
 
 TIA!
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/kperry%40apple.com
 
 This email sent to kpe...@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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Missing header files/folders?

2012-03-23 Thread Eric Wing
On 3/22/12, Chris Hanson c...@me.com wrote:
 On Mar 22, 2012, at 11:24 AM, Eric Wing wrote:

 Correct. Note that when setting the path, you can get away with just
 pointing to the copy of Xcode that you'd like to bless:

 sudo xcode-select -switch /Applications/Xcode.app

 Interesting, but as a courtesy note to everybody, those of us who
 write and use 3rd party tools that depend on xcode-select that are not
 from Apple, this variation may not work since the underlying internal
 layout of Xcode using /Applications/Xcode.app/Contents/Developer
 mostly mimics the old /Developer root and these tools probably haven't
 been updated to work with two different variations of the path.

 Actually, when you point OS X 10.7.3’s xcode-select at Xcode.app, it will
 record the path as /Applications/Xcode.app/Contents/Developer because that’s
 what external tools will expect.

 There is a known issue with xcode-select though: If you install or upgrade
 to OS X 10.7.3, and then install Xcode 4.2.1 or earlier along with its UNIX
 Development package (which is enabled by default), doing so will replace the
 OS X 10.7.3 version of xcode-select with Xcode 4.2.1’s or earlier.  For that
 version of xcode-select, you really will need to pass it the path to the
 Developer directory and not just Xcode.app.

   -- Chris



Thanks for the info. You saved me a bunch of time having to worry
about /Applications/Xcode.app being set. It's very nice that
xcode-select corrects that for you.

Thanks,
Eric
-- 
Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: advice for creating these controls

2012-03-23 Thread Seth Willits
On Mar 23, 2012, at 3:24 AM, Rick C. wrote:

 This is what I would expect too.  But drawSegment:inFrame:withView: doesn't 
 override the cell drawing from what I know am I missing something?


That'll draw the interior of the segment. The background is drawn by 
drawWithFrame:inView:, which then calls drawSegment: to draw the interior title 
and image in each segment. So you'll need to replicate that. 

http://code.google.com/p/bghudappkit/source/browse/trunk/Framework/BGHUDSegmentedCell.m?r=167

See this code for an example of doing custom drawing. You'll notice that it has 
to call the private method rectForSegment:inFrame:. You'll want avoid that (for 
the usual reasons) and create your own method which does the same thing.

I remember now one of the problems with subclassing a segmented control is you 
can't change the height of the segments. No matter what the height of the view 
is, the hit testing always uses standard control sizing, so hit testing won't 
line up. So if that's a problem, you'll probably want to make your own control, 
or else you'll have to do your own hit testing and add more voodoo. It takes 
less than 200 lines to create a basic segmented control anyway.


--
Seth Willits

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: advice for creating these controls

2012-03-23 Thread Lee Ann Rucker

On Mar 23, 2012, at 3:24 AM, Rick C. wrote:

 This is what I would expect too.  But drawSegment:inFrame:withView: doesn't 
 override the cell drawing from what I know am I missing something?

That draws the cell content, not the border or separator. To change that, 
subclass drawWithFrame:inView: and draw it there, then call 
drawInteriorWithFrame:inView: yourself - don't call super. The actual border 
drawing is done by a non-public method. You'll also need to draw the focus ring 
around the keySegment yourself.

(Why yes, I have a custom NSSegmentedControl :) )

 
 
 
 On Mar 23, 2012, at 2:19 PM, Seth Willits wrote:
 
 On Mar 22, 2012, at 9:49 PM, Lee Ann Rucker wrote:
 
 The button/popup combo could still be an NSSegmentedControl. Getting a menu 
 on a segment is just a matter of setMenu:forSegment: - the triangle would 
 have to be part of the icon, because it doesn't do it for you.
 
 You're totally right. I had forgotten about that.
 
 
 
 On Mar 22, 2012, at 9:50 PM, Rick C. wrote:
 
 Thanks everyone for the replies.  Yes I guess I just need to get a bit 
 better at subclassing to get the right look. :-)  To be sure I would 
 subclass NSSegmentedControl not NSSegmentedCell right?
 
 It's NSSegmentedCell that does the drawing for the control. Same goes for 
 all of the other controls - their cells do the drawing.
 
 
 --
 Seth Willits
 
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/rickcorteza%40gmail.com
 
 This email sent to rickcort...@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:
 https://lists.apple.com/mailman/options/cocoa-dev/lrucker%40vmware.com
 
 This email sent to lruc...@vmware.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSDateFormatter not working on iOS 5.

2012-03-23 Thread Heath Borders
 I will need to think about the best current workaround for this, but right 
 now I am (and have been) swamped, sorry.

I've tried the following code and it seems to work for me.  Can you
think of any reason why it might not work?  As I understand from the
unicode standard [1], V is supposed to prefer the metazone timezone
abbreviation, which is what my users commonly expect (in America: EST,
EDT, CST, CDT, MST, MDT, PST, PDT, etc; in India: IST).

Thanks!

NSLocale *indianEnglishLocale = [[[NSLocale alloc]
initWithLocaleIdentifier:@en_IN] autorelease];
NSTimeZone *timeZone = [NSTimeZone timeZoneWithName:@Asia/Kolkata];
NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
[dateFormatter setLocale:indianEnglishLocale];
[dateFormatter setDateFormat:@V]; // or @zzz
[dateFormatter setTimeZone:timeZone];

NSLog(@V date string: %@, [dateFormatter stringFromDate:[NSDate date]]);

[1] http://unicode.org/reports/tr35/tr35-10.html#Date_Format_Patterns

-Heath Borders
heath.bord...@gmail.com
Twitter: heathborders
http://heath-tech.blogspot.com



On Mon, Feb 13, 2012 at 12:09 PM, Peter Edberg pedb...@apple.com wrote:

 On Feb 2, 2012, at 7:56 AM, John Joyce wrote:


 On Feb 2, 2012, at 2:20 AM, Peter Edberg wrote:


 On Jan 31, 2012, at 2:35 PM, cocoa-dev-requ...@lists.apple.com wrote:
 --

 Message: 1
 Date: Tue, 31 Jan 2012 14:10:13 -0600
 From: Heath Borders heath.bord...@gmail.com
 To: cocoa-dev cocoa-dev@lists.apple.com

 Peter,

 If I set the locale to en_IN shouldn't that show the short time zone?

 NSLocale *indianEnglishLocale = [[[NSLocale alloc]
 initWithLocaleIdentifier:@en_IN] autorelease];
 NSTimeZone *timeZone = [NSTimeZone timeZoneWithName:@Asia/Kolkata];
 NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] 
 autorelease];
 dateFormatter.locale = indianEnglishLocale;
 dateFormatter.dateFormat = @z;
 dateFormatter.timeZone = timeZone;

 NSLog(@date string: %@, [dateFormatter stringFromDate:[NSDate date]]);
 NSLog(@time zone abbreviation: %@, [timeZone
 abbreviationForDate:[NSDate date]]);

 output:

 date string: GMT+05:30
 time zone abbreviation: IST

 -Heath Borders


 Heath,
 Yes, you are correct, for the example you provided above, [dateFormatter 
 stringFromDate:[NSDate date]] *should* use the short time zone name IST. 
 The fact that it does not is due to a deficiency in the en_IN locale data 
 in the versions of CLDR data used by ICU in the current OSX and iOS 
 releases (CLDR 1.9.1 and 2.0 respectively). The en_IN locale in those 
 CLDR versions did not override or supplement any of the timezone name data 
 from the base en locale, whose default content is for en_US.

 This is already fixed for the CLDR 21 release coming in a few days. That is 
 being incorporated into ICU 49 which will be picked up in future OSX and 
 iOS releases.

 - Peter E


 Is there any recommended workaround approach for this kind of scenario until 
 those updates are incorporated?
 More specifically, how would one best implement a workaround that would be 
 easily overridden by (or not clash terribly) the fix when it is eventually 
 incorporated into a release?
 Any best practices or recommendations in that area?

 I will need to think about the best current workaround for this, but right 
 now I am (and have been) swamped, sorry.
 - Peter E




 ___

 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com

 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/heath.borders%40gmail.com

 This email sent to heath.bord...@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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Binding and multithreading

2012-03-23 Thread Jan E. Schotsman

 Jonathan Taylor wrote:
I have been struggling with a problem which I think I have  
eventually realised is down to me not handling multithreading issues  
properly. The situation is I have some computationally-demanding  
code that is running in a separate thread. This has input parameters  
and state variables associated with it. For diagnostic reasons I  
would like to be able to display the values of the state variables  
in the GUI. I had intended to do this just by binding to them.  
However I am getting occasional message sent to deallocated  
instance errors which I suspect are a symptom of the fact that I am  
Doing It Wrong. Further reading suggests that because of the way  
bindings work, modifying those state variables is leading to binding/ 
gui type stuff happening away from the main thread, which appears  
not to be permitted.
I use KVO for this. Have your main thread observe the state variables  
(declared as properties) and update the GUI in your  
observeValueForKeyPath:ofObject:change:context: method.

I hope this is elegant enough for you  ;-)
Jan E.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Binding and multithreading

2012-03-23 Thread Dave Fernandes
See the Cocoa Design Patterns doc:
The Receptionist Design Pattern in Practice
A KVO notification invokes the observeValueForKeyPath:ofObject:change:context: 
method implemented by an observer. If the change to the property occurs on a 
secondary thread, theobserveValueForKeyPath:ofObject:change:context: code 
executes on that same thread.

So you shouldn't use observeValueForKeyPath:ofObject:change:context to update 
the GUI in this context. I don't know of any better method than what the OP 
suggested.

Cheers,
Dave

On 2012-03-23, at 6:32 PM, Jan E. Schotsman wrote:

 Jonathan Taylor wrote:
 I have been struggling with a problem which I think I have eventually 
 realised is down to me not handling multithreading issues properly. The 
 situation is I have some computationally-demanding code that is running in a 
 separate thread. This has input parameters and state variables associated 
 with it. For diagnostic reasons I would like to be able to display the 
 values of the state variables in the GUI. I had intended to do this just by 
 binding to them. However I am getting occasional message sent to 
 deallocated instance errors which I suspect are a symptom of the fact that 
 I am Doing It Wrong. Further reading suggests that because of the way 
 bindings work, modifying those state variables is leading to binding/gui 
 type stuff happening away from the main thread, which appears not to be 
 permitted.
 I use KVO for this. Have your main thread observe the state variables 
 (declared as properties) and update the GUI in your 
 observeValueForKeyPath:ofObject:change:context: method.
 I hope this is elegant enough for you  ;-)
 Jan E.
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/dave.fernandes%40utoronto.ca
 
 This email sent to dave.fernan...@utoronto.ca


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSDocument disc undo stack

2012-03-23 Thread Steven
Hello,

Where is the correct place to store an on-disc undo stack associated with a 
NSDocument instance ?
The stack may contain several potentially large files so we don't want them to 
occupy memory.
For a compound document the stack could reside in a directory NSFileWrapper.
For a single file document should a temporary directory be used ?
I guess the chosen location may need to persist beyond the occurrence of the 
automatic termination feature.
Any advice appreciated.
Thanks.

Steven.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Binding and multithreading

2012-03-23 Thread Jens Alfke

On Mar 23, 2012, at 3:32 PM, Jan E. Schotsman wrote:

 I use KVO for this. Have your main thread observe the state variables 
 (declared as properties) and update the GUI in your 
 observeValueForKeyPath:ofObject:change:context: method.

That’s just going to call observeValue… on whatever thread the model state 
property changed on, not on the main thread. Which is exactly what the OP is 
asking how to avoid.

I don’t have an easy answer, other than implementing an observeValue… method 
that uses performSelector:onThread: to defer the real work to the main thread.

—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: advice for creating these controls

2012-03-23 Thread Rick C.
Thanks again to everyone much appreciated!



On Mar 24, 2012, at 2:44 AM, Lee Ann Rucker wrote:

 
 On Mar 23, 2012, at 3:24 AM, Rick C. wrote:
 
 This is what I would expect too.  But drawSegment:inFrame:withView: doesn't 
 override the cell drawing from what I know am I missing something?
 
 That draws the cell content, not the border or separator. To change that, 
 subclass drawWithFrame:inView: and draw it there, then call 
 drawInteriorWithFrame:inView: yourself - don't call super. The actual border 
 drawing is done by a non-public method. You'll also need to draw the focus 
 ring around the keySegment yourself.
 
 (Why yes, I have a custom NSSegmentedControl :) )
 
 
 
 
 On Mar 23, 2012, at 2:19 PM, Seth Willits wrote:
 
 On Mar 22, 2012, at 9:49 PM, Lee Ann Rucker wrote:
 
 The button/popup combo could still be an NSSegmentedControl. Getting a 
 menu on a segment is just a matter of setMenu:forSegment: - the triangle 
 would have to be part of the icon, because it doesn't do it for you.
 
 You're totally right. I had forgotten about that.
 
 
 
 On Mar 22, 2012, at 9:50 PM, Rick C. wrote:
 
 Thanks everyone for the replies.  Yes I guess I just need to get a bit 
 better at subclassing to get the right look. :-)  To be sure I would 
 subclass NSSegmentedControl not NSSegmentedCell right?
 
 It's NSSegmentedCell that does the drawing for the control. Same goes for 
 all of the other controls - their cells do the drawing.
 
 
 --
 Seth Willits
 
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/rickcorteza%40gmail.com
 
 This email sent to rickcort...@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:
 https://lists.apple.com/mailman/options/cocoa-dev/lrucker%40vmware.com
 
 This email sent to lruc...@vmware.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSDocument disc undo stack

2012-03-23 Thread Graham Cox
You can read and write to the Application Support folder.

But FILES in an Undo stack? That makes little sense to me.

If you want to undo changes to a file, store the changes or the command that 
will cause the changes in the undo stack. If you are changing the organisation 
of files on disc then save a description of that organisation in the undo 
stack. You may want to read up on the way Cocoa utilises Undo, because it 
sounds like you might not have a good grasp on it.

Even if you need to store very large objects in the undo stack, unless you can 
prove it's a serious problem, just let the memory get paged to disk VM 
naturally. It's rare that users need to undo a very long history, so even if 
the older history is paged out, the chances are the user will never know.

--Graham





On 24/03/2012, at 10:17 AM, Steven wrote:

 Hello,
 
 Where is the correct place to store an on-disc undo stack associated with a 
 NSDocument instance ?
 The stack may contain several potentially large files so we don't want them 
 to occupy memory.
 For a compound document the stack could reside in a directory NSFileWrapper.
 For a single file document should a temporary directory be used ?
 I guess the chosen location may need to persist beyond the occurrence of the 
 automatic termination feature.
 Any advice appreciated.
 Thanks.
 
 Steven.
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/graham.cox%40bigpond.com
 
 This email sent to graham@bigpond.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


display a section of view zoomed

2012-03-23 Thread Timothy Reaves
I have a subclass of NSView, and draw into using CoreGraphics.  I'd like to
add a second view (not NSScrollView) to display a zoomed section of the
primary view.  I thought I had a sample project for this bookmarked, but
can no longer find it.  Would anyone be able to point me in the correct
direction?

Thanks.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: display a section of view zoomed

2012-03-23 Thread Jens Alfke

On Mar 23, 2012, at 6:05 PM, Timothy Reaves wrote:

 I have a subclass of NSView, and draw into using CoreGraphics.  I'd like to
 add a second view (not NSScrollView) to display a zoomed section of the
 primary view. 

You’ll need a second instance of the same view class, displaying the same 
model. Make its bounds rect smaller than its frame, and the contents will be 
scaled up by the same proportion when drawn.

—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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

syslog with strings?

2012-03-23 Thread Prime Coderama
Trying to write out syslog entries containing strings but they don't register.

E.g.

// where person.name is an NSSTring
syslog(LOG_NOTICE, Some string %@, person.name);
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: syslog with strings?

2012-03-23 Thread Peter Teeson

On 2012-03-23, at 10:08 PM, Prime Coderama wrote:

 Trying to write out syslog entries containing strings but they don't register.
 
 E.g.
 
 // where person.name is an NSSTring
 syslog(LOG_NOTICE, Some string %@, person.name);
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/pteeson%40me.com
 
 This email sent to ptee...@me.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: syslog with strings?

2012-03-23 Thread Ken Thomases
On Mar 23, 2012, at 9:08 PM, Prime Coderama wrote:

 Trying to write out syslog entries containing strings but they don't register.
 
 E.g.
 
 // where person.name is an NSSTring
 syslog(LOG_NOTICE, Some string %@, person.name);

The %@ format specifier is a Cocoa-ism.  (Well, it's also understood by Core 
Foundation.)  It is not one of the standard printf-style format specifiers.  
You can't expect any random C library routine to understand them and then 
interpret the passed-in argument as an object pointer and invoke -description 
on it.

Try:

syslog(LOG_NOTICE, Some string %s, [person.name UTF8String]);

Regards,
Ken


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


GLKit's GLKBaseEffect leaking?

2012-03-23 Thread Scott Andrew
Has anyone been noticing that GLKit's base effect is leaking when calling 
prepareToDraw? There are repeated leaks in GLKShaderBlockNode. It seems that 
this may be new to 5.1 SDK. I could have sworn i did a check with 5.0.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com