Re: Stealing settings from Mail.app

2010-05-31 Thread Chris
Thanks, it was the iTools bit I needed. But looks like there is a bug in this 
code it won't notice me.com and could wrongly think say macdonald.com is mobile 
me. But thanks, it gives me what I needed. 

--
Chris

On 31/05/2010, at 8:11 PM, Dante Palacios  wrote:

NSString *GetPassword(NSString *userName, NSString *hostName) {
   if (!hostName.length || !userName.length) return nil;
   
   const char *serviceName = [hostName UTF8String];
   const char *serviceUserName = [userName UTF8String];
   const char *path = "";
   
   UInt32 passwordLength = 0;
   char *pass = nil;
   
   OSStatus status = noErr;
   SecKeychainItemRef itemRef;
   
   if ([hostName rangeOfString:@"mac"].location != NSNotFound) {
   serviceName = "iTools"; //<= note this
   status = SecKeychainFindGenericPassword(NULL,
   (UInt32)strlen(serviceName),
   serviceName,
   (UInt32)strlen(serviceUserName),
   serviceUserName,
   &passwordLength,
   (void **)&pass,
   &itemRef);
   }else {
   status = SecKeychainFindInternetPassword(NULL,
(UInt32)strlen(serviceName),
serviceName,
0,
NULL,
(UInt32)strlen(serviceUserName),
serviceUserName,
(UInt32)strlen(path),
path,
0,
kSecAuthenticationTypeAny,
kSecAuthenticationTypeAny,
&passwordLength,
(void **)&pass,
&itemRef);
   }
   
   if (status != noErr) {
   CFStringRef errMess = SecCopyErrorMessageString(status, NULL);
   NSLog(@"%@", (NSString *)errMess);
   CFRelease(errMess);
   return nil;
   }
   
   return [[[NSString alloc] initWithBytes:pass length:passwordLength 
encoding:NSUTF8StringEncoding] autorelease];
}

On May 31, 2010, at 12:11 AM, Jn wrote:

Would you have the API code to retrieve it?  Not sure what to pass to get the 
mobile me password.

--
Chris

On 31/05/2010, at 2:43 AM, Jens Alfke  wrote:


On May 30, 2010, at 12:55 AM, Chris Idou wrote:

OK, I see. So is Mobile-Me the only special case, or is there a more general 
rule about other places to find smtp server passwords?

AFAIK it’s the only special case. In general, an SMTP server’s password is 
stored under that server name in the keychain, as you’d expect.

—Jens




___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/palacios.dante%40gmail.com

This email sent to palacios.da...@gmail.com

All the best,
Dante.







___

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

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

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

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


Can't set header on NSURLRequest

2009-06-01 Thread Chris

Hello,

I'm having an issue with setting two headers for my NSURLRequest:

	[theRequest setValue: [NSString stringWithFormat:@"/principals/ 
__uids__/%@/\r\n",self.userGUID] forHTTPHeaderField:@"Originator"];


	[theRequest setValue: [NSString stringWithFormat:@"/principals/ 
__uids__/%@/\r\n",roomGUID] forHTTPHeaderField:@"Recipient"];


When I send the request they don't appear in the headers and the  
server fails to respond correctly as they are required headers.  I  
also tried addValue:forHTTPHeaderField, with the same result.


If I set them without the NSString (@"string...") it works fine.  Am I  
missing something here?


Thanks!
___

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

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

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

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


Calendar Store- iCal Notifications

2009-06-24 Thread Chris
I know you can use the Calendar Store API to receive notifications if  
iCal data has changed.  Can you use the same API to receive  
notifications if the ical user has received a notification related to  
a calDAV account (i.e. new meeting invitations, rejected meeting  
invitations, etc.).


Thanks!

--Chris
___

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

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

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

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


Cookies Problems

2009-08-02 Thread Chris

Hello

I am trying to write a test program that will send a value through a  
web form, get the cookie information and then relay that cookie  
information back to the sever. I have setup 3 php pages, which work  
correctly. The first page displays a web form with one field named  
"name". The second page "validates" the input, puts the "name"  
variable into a session variable, then forwards you to the third page.  
The third page checks for the session variable and then either
displays "You are logged in as: Bob" (using the $name / session  
variable) or displays "failure". Each page also displays the SessionID  
at the top of the screen.
When I run these PHP pages through a browser, it works as expected.  
When I try to run this through Cocoa, I am able to retrieve the  
Session Cookie, but when I call the data from the third page, I always  
get a "failure" response, even though it seems to be relaying the  
correct Session ID back to the server.


I have found many different articles online, but they all seem to be  
giving the same basic code, which doesn't seem to work. I've tried  
several different variations but I'm not sure where to go from here.


You can access the form at http://www.abovetheclamor.com/testform.php

Here are all the files I'm using:





### PHP 1 (testform.php) ###
';
echo '


';
?>





### PHP 2 (testform2.php) ###
';
$_SESSION['sessionvariable'] = $_POST['name'];
header("Location: testform3.php");
?>






### PHP 3 (testform3.php) ###
';
if ($_SESSION['sessionvariable'] == NULL) {
echo 'failure on page 3';
exit;


} else {

echo 'You are logged in as: ';
echo $_SESSION['sessionvariable'];

}

?>




### Cocoa / Objective-C ###
- (void)applicationDidFinishLaunching:(UIApplication *)application {
NSHTTPURLResponse *response;
NSError *error;
NSString *post = @"name=Bob"; // send the value "Bob" to the  
form
NSData *postData = [post  
dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSString *postLength = [NSString stringWithFormat:@"%d",  
[postData length]];
NSMutableURLRequest *request = [[[NSMutableURLRequest alloc]  
init] autorelease];


  // setup the request to submit the data to the form
[request setURL:[NSURL URLWithString:@"http://www.abovetheclamor.com/testform.php 
"]];

[request setHTTPMethod:@"POST"]; // run it as a POST
[request setValue:postLength forHTTPHeaderField:@"Content- 
Length"];
[request setValue:@"application/x-www-form-urlencoded"  
forHTTPHeaderField:@"Content-Type"];

[request setHTTPBody:postData];

// run the request
NSURLConnection *theConnection = [[NSURLConnection alloc]  
initWithRequest:request delegate:self];


  // run the request to get the cookies
[NSURLConnection sendSynchronousRequest:request  
returningResponse:&response error:&error];


  // get allCookies from the request
NSArray *allCookies = [NSHTTPCookie  
cookiesWithResponseHeaderFields: [response allHeaderFields]


		forURL:[NSURL URLWithString:@"http://www.abovetheclamor.com/testform.php 
"]];


NSLog(@"How many Cookies: %d", allCookies.count);

for (NSHTTPCookie *cookie in allCookies) {
NSLog(@"Name: %@ : Value: %@, Expires: %@",  
cookie.name, cookie.value, ookie.expiresDate);

}

[[NSHTTPCookieStorage sharedHTTPCookieStorage]  
setCookies:allCookies


forURL:[NSURL URLWithString:@"http://www.abovetheclamor.com/";]  
mainDocumentURL:nil];



NSArray * availableCookies = [[NSHTTPCookieStorage  
sharedHTTPCookieStorage] cookiesForURL:[NSURL URLWithString:@"http://www.abovetheclamor.com/ 
"]];


NSDictionary * headers = [NSHTTPCookie  
requestHeaderFieldsWithCookies:availableCookies];

NSMutableURLRequest *req = [[NSMutableURLRequest alloc] init];

// set the request to call the final page
[req setURL:[NSURL URLWithString:@"http://www.abovetheclamor.com/ 
 testform3.php"]];

[req setAllHTTPHeaderFields:headers];
[req setHTTPShouldHandleCookies:NO];

// send the request to the final page
NSData *data = [NSURLConnection sendSynchronousRequest:req  
returningResponse:&response error:&error];


// what did the server get? probably "failure". why?
NSLog(@"The server saw: %@", [[[NSString alloc]  
initWithData:data encoding: NSASCIIStringEncoding] autorelease]);

[window makeKeyAndVisible];


}




Any help or guidance that you can provide would be greatly appreciated
___

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

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

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

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


Re: Apple Developer Update

2013-07-25 Thread Chris
Vincent, I respectfully disagree. If we encourage anyone who feels entitled to 
"discharge overflow of emotional frustration" to vent here, what's to stop 
anyone who disagree with Apple's policy to spam our mailboxes with tirades.

I am frustrated too, but do something constructive. Blogging is a soapbox for 
anyone with an opinion or need to vent.

– Chris

On Jul 25, 2013, at 15:56, Vincent Habchi  wrote:

> Kyle,
> 
>> Following that line of thought, how many of you actually think griping
>> on this list is going to accomplish anything other than filling up
>> everyone else's inboxes from what would otherwise be one of the
>> remaining useful channels?
> 
> While I agree with you, I think it is also essential to keep a thread open to 
> sort of discharge the overflow of emotional frustration – we’re not Vulcans! 
> :) I admit it is an off-topic and maybe off-color and whatever-off-you-like 
> thread, but it acts as a safety valve and helps people overcome this 
> unexpected downtime. And since, as you clearly state, this list is one of the 
> few remaining open media…
> 
> Cheers!
> Vincent
> 
> 
> 
> 
> ___
> 
> 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/mailbox20040630%40gmail.com
> 
> This email sent to mailbox20040...@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

NSPredicateEditorRowTemplate

2008-06-24 Thread Chris
I've got a NSPredicateEditor and I'm inheriting from
NSPredicateEditorRowTemplate to make a custom template. It implements
copyWithZone as the doco seems to imply I should. In Interface builder I
have a number of standard row templates, and I've added my custom one at the
end by setting the class in the identity pane.

When I load the nib containing the NSPredicateEditor, for some reason it
calls copyWithZone on my custom NSPredicateEditorRowTemplate during the nib
loading process. Let's call this object passed to copyWithZone as object
"A", and I return from copyWithZone as instance "B". So now there are two
instances created during the nib loading process. Nothing in the
documentation seems to explain why this would happen during nib
loading. From my reading of the doco, it should only get called when I do a
setObjectValue on the NSPredicateEditor.
Anyway, when I call setObjectValue, it does indeed call copyWithZone again
with object "A" and creates another object. Let's call this one "C". It then
calls setPredicate on object "C" as you'd expect, whereupon I populate the
fields of MyCustomPredicateRowTemplate.

When the user clicks ok, then I call objectValue on the NSPredicateEditor
and it calls predicateWithSubpredicates not on object "C", but on object
"B", which is always going to be blank, because it is in fact object "C"
which is the one displayed. Thus I can never retrieve values from the row.
This phantom and unexplained object "B" that is created during NIB loading
suddenly seems to be the one it cares about.

I'm not sure where to go next. Has anyone got any advice?
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Allocating outlets from NIB file

2008-06-24 Thread Chris


Hi,

You should not be allocating either SpriteView or SpriteController if  
they are referred to in the NIB. (which is the normal case).


Instead you go to the File's Owner object in interface builder, and go  
to the Identity tab, and set the Class to be whatever class contains  
your loadNib statement. ONLY load the NIB, don't attempt to create  
windows, views or controllers. (Let's call this class that loads the  
NIB as class "A".). Now you add some outlets to class "A" called  
spriteView, spriteWIndow, spriteController or whatever else you need.  
Then in interface builder you connect these outlets of "File's Owner"  
to those objects. Now when you load the NIB, you'll have pointers to  
all the objects you care about in the same object that loaded the NIB.






On 24/06/2008, at 10:17 PM, Joseph Ayers wrote:

I am quite confounded with regard to how/when to allocate outlets  
which are classes existing as instances in

another class. Consider

@interface SpriteController : NSWindowController {
  IBOutlet  SpriteView* spriteView;
  IBOutlet  NSWindow* spriteWindow;
}

SpriteController* spriteController;

- (id)spriteWindow;
- (id)spriteView;
-(void)setSpriteView:(SpriteView*)view;
}

SpriteView is defined in another subclass as:

@interface SpriteView: NSView
{
  NSImage  *spriteImage;
}

SpriteController and SpriteView are defined and connected in the NIB

When I open the NIB with

-(void)loadSpriteController{
  if (spriteController == NULL) {
  spriteController = [[SpriteController alloc] init];
if (![NSBundle loadNibNamed:@"spriteWindow"  
owner:spriteController]) {

   NSLog(@"Error loading SpriteController");}
  else{
   NSLog(@"SpriteController NIB Loaded");   }
  }

}

spriteController gets a pointer, but spriteView is NIL.  All  
subsequent messages to spriteView are

messages to NIL

How/where should I be allocating spriteView. I've tried adding:

  [self setSpriteView: [[SpriteView alloc] init]];

to loadSpriteController with no consequence. spriteView gets a  
pointer but


  [[spriteController spriteView] drawRect:[[spriteController  
spriteWindow] bounds]];

does not get to drawRect

ja


--
Joseph Ayers, Professor
Department of Biology and
Marine Science Center
Northeastern University
East Point, Nahant, MA 01908
Phone (781) 581-7370 x309(office), x335(lab)
Cellular (617) 755-7523, FAX: (781) 581-6076 Boston Office 444RI,  
(617) 373-4044

eMail: [EMAIL PROTECTED]
http://www.neurotechnology.neu.edu/

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/idou747%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Seconds since system startup

2008-06-24 Thread Chris



Do a

 man 3 sysctl

in the terminal and look for KERN_BOOTTIME






On 24/06/2008, at 10:51 PM, Stefan Hafeneger wrote:


Hi,

I'm looking for a Cocoa function like GetCurrentEventTime() for  
Carbon to get the interval since system startup. Any ideas?


With best wishes,  
Stefan___


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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/idou747%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSPredicateEditorRowTemplate

2008-06-24 Thread Chris


Hi!

This is very interesting information. Wish it was in the doco!

I have a custom view which wasn't responding to setObjectValue /  
objectValue.


When I add those methods I find that on startup it does indeed copy  
the values from object "C" to object "B". This means that when I  
retrieve the values later on, instead of returning blank like before,  
it now returns the old value instead of blank. However I need the new  
value! If it were to copy the values across AFTER the user made  
changes or prior to me calling objectValue, then it would work. I  
thought maybe [rulePredicateEditor reloadPredicate] sounded like it  
might do it perhaps, but that doesn't help either. Once the user hits  
ok, we are still left with bogus values from object "B", albeit now  
old values instead of nil values.





On 24/06/2008, at 11:02 PM, Jim Turner wrote:


On Tue, Jun 24, 2008 at 2:02 AM, Chris <[EMAIL PROTECTED]> wrote:
When the user clicks ok, then I call objectValue on the  
NSPredicateEditor
and it calls predicateWithSubpredicates not on object "C", but on  
object
"B", which is always going to be blank, because it is in fact  
object "C"
which is the one displayed. Thus I can never retrieve values from  
the row.
This phantom and unexplained object "B" that is created during NIB  
loading

suddenly seems to be the one it cares about.

I'm not sure where to go next. Has anyone got any advice?


Hi Chris,

I saw this very same behavior and was fortunate enough to get the
following explanation from Peter Ammon:

"A single row may be composed of views from multiple templates.  When
it's time to construct a predicate for that row, we pick one template,
and if its views are not actually in the row, we call objectValue on
the view in the row, and then setObjectValue: on the corresponding
view in your template.

Due to a bug, this happens more often than it should :(

What this means for your NSTextField subclass is that it should do the
right thing for objectValue and setObjectValue:.  The object value of
your view should encapsulate all the state your template needs to
compute that portion of the predicate."

The short answer, for me at least, was to make sure my custom
NSTextField in my template handled objectValue/setObjectValue:
properly.  That way, when predicateWithSubpredicates: is called, the
internals of the editor can pass around the values needed to properly
compute the predicate.

--
Jim
http://nukethemfromorbit.com


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSPredicateEditorRowTemplate

2008-06-24 Thread Chris


Hi,

No, I'm doing that all correctly. But now I seem to have changed  
something minor, but I'm not sure what, and now its working.  Now its  
copying the object across correctly when I call objectValue.


Anyway, thanks for the setObjectValue tip which was the key. I never  
would have guessed that one.



On 25/06/2008, at 12:52 AM, Jim Turner wrote:


On Tue, Jun 24, 2008 at 8:46 AM, Chris <[EMAIL PROTECTED]> wrote:


Hi!
This is very interesting information. Wish it was in the doco!
I have a custom view which wasn't responding to setObjectValue /
objectValue.
When I add those methods I find that on startup it does indeed copy  
the
values from object "C" to object "B". This means that when I  
retrieve the
values later on, instead of returning blank like before, it now  
returns the
old value instead of blank. However I need the new value! If it  
were to copy

the values across AFTER the user made changes or prior to me calling
objectValue, then it would work. I thought maybe [rulePredicateEditor
reloadPredicate] sounded like it might do it perhaps, but that  
doesn't help
either. Once the user hits ok, we are still left with bogus values  
from

object "B", albeit now old values instead of nil values.


How are you accessing your custom view's object value?  It almost
sounds like you're asking your original custom view for it's value
each time instead of the object currently being displayed.

When you create your template and insert your custom view, make sure
to keep a reference to that specific object so you can query it later
on.

@interface CustomPredicateEditorRowTemplate :  
NSPredicateEditorRowTemplate

{
CustomTextField *myTextField;
}
-(CustomTextField *) myTextField;
@end

@implementation CustomPredicateEditorRowTemplate
-(CustomTextField *) myTextField
{
if( !myTextField )
   // init your view

return( myTextField );
}

- (NSArray *)templateViews
{
   return( [[super templateViews] arrayByAddingObject:[self  
myTextField]] );

}

-(void) dealloc
{
[myTextField release];
[super dealloc];
}

- (NSPredicate *)predicateWithSubpredicates:(NSArray *)subpredicates
{
   id objectValue = [[self myTextField] objectValue];
   // Do magical things with objectValue
}
@end


--
Jim
http://nukethemfromorbit.com


___

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

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

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

This email sent to [EMAIL PROTECTED]


NSPredicateEditor

2008-06-24 Thread Chris
Let's say I create a NSPredicateEditor and it looks like this:


[All] of the following are true:

[Name] equals [ ]
---

So the user enters say "Fred" and the predicate returned is "Name == Fred".

Later on, I reload that predicate into the NSPredicateEditor and it looks
like this:


[Name] equals [ Fred ]
---

But now there is no option to change it to say:

[Some] of the following are true:

because that line isn't shown.

How do I make that line reappear the next time?
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSPredicateEditor

2008-06-25 Thread Chris


Cool.

Now I notice that if you manually plug in a complex predicate like "a  
= b or c = d and e = f", that it is capable of displaying it correctly.


Do you know if there is any way to allow the user to create more  
complex expressions? By default it only seems to allow either AND or  
OR, but not both from the user, even though the machinery seems to  
know how to display things more complex.




On 25/06/2008, at 11:57 PM, Jim Turner wrote:


On Wed, Jun 25, 2008 at 1:08 AM, Chris <[EMAIL PROTECTED]> wrote:

Let's say I create a NSPredicateEditor and it looks like this:


[All] of the following are true:

[Name] equals [ ]
---

So the user enters say "Fred" and the predicate returned is "Name  
== Fred".


Later on, I reload that predicate into the NSPredicateEditor and it  
looks

like this:


[Name] equals [ Fred ]
---

But now there is no option to change it to say:

[Some] of the following are true:

because that line isn't shown.

How do I make that line reappear the next time?


By default, the NSPredicateEditor object in IB creates a compound
predicate.  Wrap your "Name == Fred" predicate in a compound predicate
before reloading it in the editor and the Any/All/None row should
return.

--
Jim
http://nukethemfromorbit.com


___

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

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

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

This email sent to [EMAIL PROTECTED]


NSPredicateEditor

2008-06-25 Thread Chris
Consider the following code, any NSPredicateEditor gurus:

NSPredicateEditorRowTemplate *tmpTemplate =

[[NSPredicateEditorRowTemplate alloc]

   initWithCompoundTypes: [NSArray

arrayWithObjects: [NSNumber numberWithInt: NSNotPredicateType],
nil]];

NSPredicate * tmpPredicate = [NSPredicate predicateWithFormat:@"mykey =
'foo'"];

NSPredicate * tmpCompPredicate = [NSCompoundPredicate
notPredicateWithSubpredicate:tmpPredicate];

double result = [tmpTemplate matchForPredicate:tmpCompPredicate];

NSLog(@"RESULT: %f", result);


This code prints 0.0.


The net effect is that NSPredicateEditor can't display a predicate like

NOT (foo = "bar")


A bug in NSPredicateEditor system perhaps? But surely someone would have
seen it before.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSPredicateEditor

2008-06-26 Thread Chris
On Fri, Jun 27, 2008 at 10:09 AM, Peter Ammon <[EMAIL PROTECTED]> wrote:

>
> On Jun 25, 2008, at 7:27 PM, Chris wrote:
>
>>
>> The net effect is that NSPredicateEditor can't display a predicate like
>>
>> NOT (foo = "bar")
>>
>>
>> A bug in NSPredicateEditor system perhaps? But surely someone would have
>> seen it before.
>>
>
> Hi Chris,
>
> NOT type compound predicates only support exactly one subpredicate, or at
> least they did when NSPredicateEditor was written.  For this reason, the
> default implementation of NOT expects the sole subpredicate to be an OR
> type.  So set this:
>
> NOT(OR(foo="bar"))


Ahh, this would explain why it hasn't been reported before.

However the BNF description of predicates does not impose that restriction:

http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/Predicates.pdf

And also, when you convert the predicate to a string, it doesn't show the
OR. The OR is apparently optimized away by the predicateFormat routine.
Since the only way to feasibly store a predicate is as a string, and then
parse it back in, its not really consistent.

I've worked around it by replacing the matchForPredicate routine of
NSPredicateEditorRowTemplate, which is where I think the actual problem
lies:


- (double)matchForPredicate:(NSPredicate *)predicate {

if ([predicate class] == [NSCompoundPredicate self]) {

return 0.5;

}

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

This email sent to [EMAIL PROTECTED]


NSExpression

2008-06-28 Thread Chris


NSExpression defines this method:

+ (NSExpression *)expressionForFunction:(NSString *)name arguments: 
(NSArray *)parameters


and the doco provides this example:

[NSExpression expressionForFunction:(@selector(random)) arguments:nil];


Isn't that wrong? Can you really pass a selector to a NSString  
argument? The compiler is complaining, and the program crashes when I  
attempt it.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSExpression

2008-06-28 Thread Chris


If anyone has a clue how to use it, I'd be grateful. This was my  
unsuccessful attempt:


NSExpression * ex = [NSExpression expressionForFunction:[NSExpression  
expressionForConstantValue:@"BAR"] selectorName:@"length"  
arguments:nil];


NSPredicate * predicate = [NSCompoundPredicate
andPredicateWithSubpredicates:[NSArray arrayWithObject: ex]];

[predicate evaluateWithObject:@"FOO" substitutionVariables:nil];

[NSFunctionExpression evaluateWithObject:substitutionVariables:]:  
unrecognized selector sent to instance 0x68b8af0



On 29/06/2008, at 12:43 AM, Shawn Erickson wrote:


On Jun 28, 2008, at 12:13 AM, Chris <[EMAIL PROTECTED]> wrote:



NSExpression defines this method:

+ (NSExpression *)expressionForFunction:(NSString *)name arguments: 
(NSArray *)parameters


and the doco provides this example:

[NSExpression expressionForFunction:(@selector(random))  
arguments:nil];



Isn't that wrong? Can you really pass a selector to a NSString  
argument? The compiler is complaining, and the program crashes when  
I attempt.


Yeah it is wrong. I believe you just pass a string with the same  
contents as what you would put in @selector.


-shawn


___

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

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

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

This email sent to [EMAIL PROTECTED]


Disabling column selection NSTableView

2008-07-02 Thread Chris

Hi,

I've disabled column sorting. When I click on the header it seems to 
select the entire row. I want to disable this functionality, partly 
because it is meaningless for my app, and partly because I would like to 
make doubleclick action on the header do something to the selected row, 
and since single click on the header unselects the selected row, that 
isn't working. How do I disable single click on the header selecting the 
entire row?


___

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

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

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

This email sent to [EMAIL PROTECTED]


NSPredicateEditorRowTemplate

2008-07-04 Thread Chris


I have a custom view in a NSPredicateEditorRowTemplate. It seems like  
the NSPredicateEditor isn't aware when I change the state of the  
custom view, because when I ask it for the predicate it just returns  
the old one without even calling predicateWithSubPredicates on my  
template. I'm guessing that NSPredicateEditor installs some kind of  
callback on the components and needs to know when they change, but  
being inexperienced with Cocoa, I'm not sure what it might be or how  
to implement it. I tried calling sendActionTo: with the action on the  
custom component when it changes, but that didn't seem to help.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: IB3 and custom controls: problem with actions

2008-07-04 Thread Chris


I think I've seen this a few times in IB3. But I fiddled a bit, saved,  
restarted and then it was working as I expected. I wrote it off to a  
bug at the time.



On 04/07/2008, at 4:19 PM, Vitaly Ovchinnikov wrote:


Hello all,

I'm porting my project from XCode 2.5 to 3.0 and have a big trouble
with custom controls. I have some custom controls (subclassed from
NSControl), that I use in Interface Builder to create GUI.  When I
used IB 2.5, I placed "Custom View" object to the window, changed it's
class and then I was able to Ctrl+Drag an action to controller.

After upgrade to XCode 3.0 I found out that now it is impossible. Old
links are still alive (marked with yellow triangles), but I can't
create a new one. I don't see "Sent action" group by right-clicking my
controls. If I perform Ctrl+Drag from my control to the controller -
it doesn't highlited. But if I do the same for NSButton - all works
fine.

Did I miss something?

Thank you.
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/idou747%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


NSTableView Issue

2008-11-13 Thread Chris

Hello,

This is an issue I've been stuck on for a while, I'm trying to load an  
instance of NSHTTPCookieStorage into a table view.  I have it far  
enough so that when I build the app and load it, it displays this http://i38.tinypic.com/315en3c.png 
.  However when I attempt to scroll up or down, the app does nothing  
and I receive these error message in the console:


*** -[NSCFArray objectAtIndex:]: index (2) beyond bounds (2)

and

[ valueForUndefinedKey:]: this class is not key  
value coding-compliant for the key name.


Here are my two table methods for reference:

- (int)numberOfRowsInTableView:(NSTableView *)tableView
{
return ([cookies count]);
}

- (id)tableView:(NSTableView *)tableView
objectValueForTableColumn:(NSTableColumn *)tableColumn
row:(int)row
{

NSHTTPCookie *cookie = [cookies objectAtIndex: row];
NSString *identifier = [tableColumn identifier];
return [cookie valueForKey: identifier];
}


Thank you, any guidance would be appreciated!

--Chris

___

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

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

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

This email sent to [EMAIL PROTECTED]


Creating a NSHTTPCookie

2009-05-04 Thread Chris

Hello,

I'm trying to create a NSHTTPCookie with this code:

//dictionary of attributes for the new cookie
	NSDictionary *newCookieDict = [NSMutableDictionary  
dictionaryWithObjectsAndKeys:@".example.com", NSHTTPCookieDomain,

   @"Test 
Cookie", NSHTTPCookieName,
   @"/", 
NSHTTPCookiePath,
   
@"test12345", NSHTTPCookieValue,
   @"2010-05-03 
21:02:41 -0700", NSHTTPCookieExpires, nil];
//create a new cookie
	NSHTTPCookie *newCookie = [NSHTTPCookie  
cookieWithProperties:newCookieDict];


//add the new cookie
[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookie:newCookie];

When I try to set the newly created cookie to the  
sharedHTTPCookieStorage it doesn't ever get set.  Am I doing something  
wrong?


Thanks!
___

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

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

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

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


Creating a NSHTTPCookie

2009-05-04 Thread Chris

Hello,

I'm trying to create a NSHTTPCookie with this code:

//dictionary of attributes for the new cookie
	NSDictionary *newCookieDict = [NSMutableDictionary  
dictionaryWithObjectsAndKeys:@".example.com", NSHTTPCookieDomain,

   @"Test 
Cookie", NSHTTPCookieName,
   @"/", 
NSHTTPCookiePath,
   
@"test12345", NSHTTPCookieValue,
   @"2010-05-03 
21:02:41 -0700", NSHTTPCookieExpires, nil];
//create a new cookie
	NSHTTPCookie *newCookie = [NSHTTPCookie  
cookieWithProperties:newCookieDict];


//add the new cookie
[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookie:newCookie];

When I try to set the newly created cookie to the  
sharedHTTPCookieStorage it doesn't ever get set.  Am I doing something  
wrong?


Thanks!
___

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

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

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

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


Re: Getting key data out of the keychain

2016-01-01 Thread Chris Ridd

> On 1 Jan 2016, at 13:09, Andreas Mayer  wrote:
> 
> But I *still* don't know how to get at the key bytes of a SecKeyRef. :P

Try asking on the apple-cdsa mailing list. It covers the security frameworks in 
OS X, including (hence the historical name) CDSA.

Chris
___

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: Deleting an file that's been NSData memory mapped - safe?

2016-02-14 Thread Chris Ridd

> On 14 Feb 2016, at 11:45, dangerwillrobinsondan...@gmail.com wrote:
> 
> Would the file itself be accessible by another process before your process 
> exits?

Only if it manages to open it before it gets unlinked. After it gets unlinked, 
there’s no way to open it because there’s no longer any associated filename.

Chris
___

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: Where are my bytes hiding?

2016-05-05 Thread Chris Ridd

> On 5 May 2016, at 20:01, Martin Wierschin  wrote:
> 
>> Those files are compressed by the filesystem. In HFS+/MacOS Extended that
>> means that the data fork is empty and the file contents are stored in the
>> resource fork or extended attributes structure.
>> 
>> http://wiki.sleuthkit.org/index.php?title=HFS#HFS.2B_File_Compression
> 
> Huh, that's interesting and surprising, thanks for the link. Is this method 
> of stashing compressed data in the xattrs something that's currently commonly 
> used by OSX? Or is it just some weird infrequently used trick? I see this on 
> the linked page:
> 
>> Compression is most often used for files installed as part of Mac OS X; user 
>> files are typically not compressed (but certainly can be!)
> 
> Are a lot of system files compressed like this? Is there any way a user file 
> might be compressed in such a way through normal user actions?

You can do it explicitly using /usr/bin/ditto.

Chris
___

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: NSFileWrapper

2016-06-04 Thread Chris Ridd

> On 4 Jun 2016, at 23:02, Daryle Walker  wrote:
> 
>> On Jun 4, 2016, at 12:18 PM, Peter Hudson  wrote:
>> 
>> Hi Mike
>> 
>> You're right - I want the behaviour of a package. Do you happen to know how 
>> I can achieve it?   I had presumed it might be some mix of flag setting at 
>> system level. If for example i set the extension on an NSFileWrapper to   
>> .bundle i get some of what I need - but I cant find out how to ‎get an icon 
>> of my choosing associated with it.
> 
> You’ll have to work at it; it won’t be completely transparent to your users 
> to experience nor you to program.
> 
> The “.bundle” extension is already in use for system plug-ins.  You have to 
> come up with a new extension.  For instance, if you’re already using “.xyz” 
> for you single-file format, you could use “.xyz-pkg” for your package format.

Are you sure that’s true? Apps like OmniGraffle have a flat file format *and* a 
bundle format, both using the .graffle extension. In OmniGraffle Pro's document 
inspector you can switch between formats.

If you have the app or a demo you can investigate its Info.plist.

Chris
___

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: "Live" NSFetchRequest?

2016-09-24 Thread Chris Hanson
Are you asking about an NSFetchRequest that notices when objects are added to 
or changed in your persistent store by another process, or by another thread in 
the same process?

In the latter case you can use the notifications posted by the 
NSManagedObjectContext that's being saved, and use that to refresh the objects 
in the context you're using for your human interface.

Multi-process coordination is a much harder problem.

 -- Chris

> On Sep 17, 2016, at 2:37 PM, Frank D. Engel, Jr.  wrote:
> 
> Before I go reinventing the wheel to try to code around this...
> 
> Is there any way I can set up a "live" NSFetchRequest in a Core Data model, 
> so that is matches against the predicate change (for example, predicate 
> filters on a field, the value of that field changes such that an object 
> suddenly matches that did not before, or no longer matches when it previously 
> did), I can get some sort of notification of the change - or even that there 
> /was/ a change?
> 
> 
> Notes:
> 
> * The predicate is being created by the user using an NSPredicateEditor and I 
> am allowing a large selection of fields.
> 
> * The data set could grow to include several thousand objects (maybe 
> tens/hundreds of thousands in some cases)
> 
> * I am using the result set in "real time" in some cases and need to know 
> almost immediately when a change takes place - not a good thing to be 
> rerunning the query multiple times per second if I don't know that a change 
> happened - and changes to some of the attributes could be happening multiple 
> times per second in some cases.
> 
> * Some of the attributes are calculated from other attributes, but I am 
> updating them in such a way that bindings fire.
> 
> * MacOS X, not iDevices
> 
> 
> ___
> 
> 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/cmh%40me.com
> 
> This email sent to c...@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: SecStaticCodeCheckValidity fails when app is lauched from Terminal

2016-09-27 Thread Chris Hanson
How are you getting the URL that you pass to represent your application?

Could it be that you’re constructing the URL from a relative path when run from 
the command line, rather than the full path? (You can’t depend on being run 
from any particular working directory.)

  -- Chris

> On Sep 26, 2016, at 2:44 AM, Markus Spoettl  wrote:
> 
> I'm using SecStaticCodeCheckValidity() to self check the signature of my own 
> app when it is launched. This works fine and always has.
> 
> All of a sudden, the call to SecStaticCodeCheckValidity() fails if (and only 
> if the application) is started from the Terminal. When I start the very same 
> app from the Dock or from the Finder the check succeeds (iow. the call 
> returns noErr).
> 
> I don't know exactly when it started failing. I only know it definitely 
> worked before on previous versions of El Capitan but now it no longer does (v 
> 10.11.6).
> 
> Any ideas?
> 
> Regards
> Markus
> -- 
> __
> Markus Spoettl
> ___
> 
> 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/cmh%40me.com
> 
> This email sent to c...@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: SecStaticCodeCheckValidity fails when app is lauched from Terminal

2016-09-27 Thread Chris Hanson
On Sep 27, 2016, at 1:54 PM, Markus Spoettl  wrote:
> 
> On 27/09/16 22:39, Chris Hanson wrote:
>> How are you getting the URL that you pass to represent your application?
>> 
>> Could it be that you’re constructing the URL from a relative path when run
>> from the command line, rather than the full path? (You can’t depend on being
>> run from any particular working directory.)
> 
> Not sure what you mean by URL, I'm merely executing the app's executable from 
> the command line. Assuming the My.app bundle is located in 
> "~/Projects/My/Debug", I cd into "~/Projects/My" and execute 
> "./Debug/My.App/Contents/MacOS/My”.

I mean, how are you constructing the SecStaticCodeRef that you pass to 
SecStaticCodeCheckValidity()?

  -- Chris



___

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: CoreData headaches

2016-10-30 Thread Chris Hanson
On Oct 27, 2016, at 9:02 PM, Steve Mills  wrote:
> 
> Yes, the Asset is an NSManagedObject. In this call chain, there is no 
> NSManagedObjectContext in sight.

There is always an NSManagedObjectContext involved; an NSManagedObject doesn’t 
exist outside one. Fortunately, you don’t need to pass one along with an 
NSManagedObject, you can just ask the NSManagedObject for the context it’s a 
part of.

  -- Chris

___

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: CoreData headaches

2016-10-30 Thread Chris Hanson
On Oct 28, 2016, at 9:44 PM, Steve Mills  wrote:
> 
> On Oct 27, 2016, at 23:35:39, Dave Fernandes  wrote:
>> 
>> The managed objects exist in a MOC whether you have a reference to that MOC 
>> or not. You can get a reference to the MOC that an MO “belongs to" from the 
>> -[NSManagedObject managedObjectContext] instance method. Since the 
>> properties you need are so few and simple, why don’t you just pass these in 
>> to the NSOperation when you create it on the main thread instead of giving 
>> it the managed object? Then the MO will never be accessed off the main queue.
> 
> I moved the CGImageSource creation to outside the block, which is where I 
> needed to access the managed object's folder and name properties. The block 
> now just loads the image from the source, converts it to an NSImage, and sets 
> the managed object's thumb property. It's no longer crashing, but the setting 
> of the thumb property seems like that shouldn't happen inside the block.

You’re correct in this, reading a property of an NSManagedObject from another 
thread isn’t safe, and writing it isn’t either.

> So would that be the right place to use the NSManagedObjectContext's 
> performBlock:?

What you’ve done actually looks correct, in that you’re only interacting with 
the managed object’s managed (Core Data) properties (“thumb” in this case) 
within the block passed to -performBlock:.

  -- Chris


___

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: Representing an object graph

2016-12-06 Thread Chris Hanson
On Dec 5, 2016, at 4:18 PM, Daryle Walker  wrote:

> I've heard that Core Data is a object graph and persistence library. What if 
> you want just the first part?  The graph seems like a neat way to save on 
> modeling code, the external format is not database-ish at all (so the 
> capability for custom export formats won't help). Can I just not use the 
> persistence part and use custom save & load functions? Or do I have to (or 
> should) give up on Core Data?

This is exactly the sort of thing that subclassing NSAtomicStore 
<https://developer.apple.com/reference/coredata/nsatomicstore> lets you do.

There are only a few methods to override, and then you can just use one of your 
own documents as if it were one of the built-in persistent store types.

  -- Chris

___

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: Representing an object graph

2016-12-15 Thread Chris Hanson
On Dec 15, 2016, at 7:24 PM, Daryle Walker  wrote:
> 
> On Dec 6, 2016, at 10:18 PM, Chris Hanson mailto:c...@me.com>> 
> wrote:
>> 
>> On Dec 5, 2016, at 4:18 PM, Daryle Walker > <mailto:dary...@mac.com>> wrote:
>> 
>>> I've heard that Core Data is a object graph and persistence library. What 
>>> if you want just the first part?  The graph seems like a neat way to save 
>>> on modeling code, the external format is not database-ish at all (so the 
>>> capability for custom export formats won't help). Can I just not use the 
>>> persistence part and use custom save & load functions? Or do I have to (or 
>>> should) give up on Core Data?
>> 
>> This is exactly the sort of thing that subclassing NSAtomicStore 
>> <https://developer.apple.com/reference/coredata/nsatomicstore> lets you do.
>> 
>> There are only a few methods to override, and then you can just use one of 
>> your own documents as if it were one of the built-in persistent store types.
> 
> I have looked into that, that’s why I wrote in:
> 
>>> the external format is not database-ish at all (so the capability for 
>>> custom export formats won't help)
> 
> The store format assumes there’s at least one field in a record that can be 
> used like a database(-ish) index.  Custom stores can’t help if the data is 
> too dumb to have such a qualifying field.

What do you mean?

Most atomically read/written file formats should be supportable as an 
NSAtomicStore. Object IDs can be purely an in-memory construct for such a 
store, for example based on the order an object was (initially) read or 
instantiated.

  -- Chris

___

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: Weird NSPredicate structure when using "first" in keypath

2017-01-17 Thread Chris Hanson
On Jan 9, 2017, at 8:29 PM, Jens Alfke  wrote:
> On Jan 9, 2017, at 6:38 PM, Aaron Tuller  wrote:
>> Try doing
>> name.#first
>> as FIRST and LAST are reserved words and need escaping:
> 
> Thanks for the answer. Unfortunately this is a library that will allow 
> developers to provide their own predicate strings, and I can imagine this 
> causing confusion (and therefore support requests for us.)
> 
> I added a workaround to my code that will recognize the weird predicates 
> formed by using unescaped ‘first’ and ‘last’, and handle them appropriately. 
> I hope that’ll be robust enough!

If that's the case, why not just provide your library's API in terms of 
NSPredicate objects?

Then if your users want to use a predicate string (rather than an 
NSPredicateEditor or other form of direct instantiation) they still trivially 
can, but it's on them to get the syntax correct rather than on you to try to 
figure out their intent.

  -- Chris


___

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

Building .ipa in XC6.01

2014-09-22 Thread Chris Paveglio
We're having a hard time building an IPA file in XC6. From what I have read 
online, it seems to be a bug. We can make a .pkg file or an XCarchive file from 
our app. Any confirmation this really is a bug? Seems really unusual for such 
an important feature. We have already tried to add the LSRequiresiPhoneOS key 
in the Plist but that didn't do anything for us.
Any other tips or related links appreciated.
___

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

Multiple Today Widgets

2014-09-22 Thread Chris Paveglio
Would there be any issue with creating an app that contains multiple Today 
Widgets? I've actually done it, and it works on the simulator and on my phone. 
But now with XC6, I can't build an archive so I am wondering if it is related 
to the .IPA build problem, or Apple won't allow multiple widgets for 
distribution? I see no technical reason why it would not.
Thanks,
Chris
___

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

[MODERATOR] End of Thread: Re: Blurry is the New Sharp

2015-01-08 Thread Chris Hanson
Please stick to technical discussion on cocoa-dev.

If there are remaining technical questions in this thread, please ask them in 
their own threads. (And avoid off-topic derails.) 

Thanks.

 -- Chris (cocoa-dev co-mod)


___

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: All buttons lost focus ring on Yosemite

2015-03-12 Thread Chris Cianflone
Hi all,

We had a similar issue.  When running on Yosemite the same thing would
happen to us with the focus rings not displaying.  Don't know if this helps
in your case, but the "fix" for us was to stop building with the 10.7 SDK.
Moving to the 10.8 SDK fixed the problem for us. (Don't ask why we are
using such old SDKs, and only moved to 10.8 instead of 10.9 or 10.10,
that's another story for another time.)  You can see this in a simple Cocoa
app too started from an Xcode template.

Thanks,
Chris

_
Chris Cianflone
www.makemusic.com


On Tue, Mar 10, 2015 at 5:13 AM,  wrote:

> What happens if you turn on full keyboard access?
>
> Sent from my iPhone
>
> > On 2015/03/10, at 18:45, Dragan Milić  wrote:
> >
> > My previous message sent to the list apparently didn’t get admin
> approval, there were two attached images showing standard alarm panels with
> buttons which don’t draw their focus ring. Therefore, in this message I’ll
> combine answers to both Kyle and Graham.
> >
> >> On pon 09.03.2015., at 17.48, Kyle Sluder wrote:
> >>
> >> I'd start by looking at that -[NSView(NTExtensions) drawFocusRing]
> method. If you comment it out, what happens?
> >
> > No changes :-(  I even went that far to remove the category completely
> and ignore all compiler warnings where added methods were used. Now, that
> would normally throw exceptions, but before even loading any application
> window and using any view requiring added category methods, the application
> shows two alert panels (one by one, attached images of those panels is the
> reason my previous message didn’t get through ), depending on current user
> preferences. That enables me to see buttons' behaviour even before any
> exception is thrown. Here is the link to the image of the first alert panel:
> >
> > http://media.cocoatech.com/first_alert.png
> >
> > What’s interesting here is that, as you can see, the alert’s
> suppressionButton checkbox DOES draw its focus ring, but other two buttons
> don’t! Believe my words, if I use tab/shift+tabs to change focus on them,
> they are focused (I can then activate them with the space), but the focus
> ring is not drawn, only the checkbox gets it correctly.
> >
> > Immediately after that first alert is dismissed, the second one appears,
> here is the link:
> >
> > http://media.cocoatech.com/second_alert.png
> >
> > With this one, even the focused suppressionButton checkbox doesn’t draw
> its focus ring. Other two buttons don’t too. And all this is with the
> NSView category completely removed. There are other NSView or NSControl or
> NSButton or NSButtonCell categories defined. The code defining both alarm
> panels is pretty standard, I can post it if necessary.
> >
> > Everything worked well in Mavericks, I’ve got no idea what happened in
> the meanwhile.
> >
> >> For safety, you really ought to be prefixing all of your category
> methods with some unique-to-you prefix.
> >
> > Yeah. As I’ve mentioned already, this is not my code, it was first
> created back in 2002 and until this problem I haven’t even looked into it.
> >
> >
> >> On uto 10.03.2015., at 00.44, Graham Cox wrote:
> >>
> >> In Xcode, add OBJC_PRINT_REPLACED_METHODS (value: YES) to your scheme's
> environment variables. Then all of the methods replaced by categories are
> logged when your app launches. While the list can be long and might take
> some time to go through, it will show you if any of your category methods
> are replacing anything - it's a much more reliable way to check than doing
> a class dump.
> >
> > Thanks for the suggestion Graham, I’ll do that. It’s be interesting to
> see if and what methods are replaced, although I don’t think it’ll solve
> this particular problem. I mentioned above it still happens even with the
> NSView  category completely removed.
> >
> >> If you're not using those category methods, remove them. Most of them
> seem to be convenience methods that are possible "nice to haves" rather
> than vital to use NSView. Some appear to me to wholly misunderstand how a
> view stack (involving semi-transparancy for example) is actually drawn.
> Others are things that could be useful in particular circumstances but you
> probably wouldn't want to apply to every view your app ever instantiates
> including framework ones. For those custom views of yours that use these
> things, relocate that code to the custom view. It may mean a small
> duplication of code across a few different views, but it will be a lot
> safer than swapping out NSView wholesale. NSView just may be Cocoa's single
&

MODERATOR: End of Thread (was Re: I am reluctant to file any more bugs until those already reported are fixed)

2015-07-21 Thread Chris Hanson
This is the place for neither rants nor personal attacks.

Please keep it technical. Thanks.

  -- Chris Hanson (cocoa-dev co-moderator)

___

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: MODERATOR: End of Thread (was Re: I am reluctant to file any more bugs until those already reported are fixed)

2015-07-21 Thread Chris Hanson
Once again, this thread is over. Please do not post in it again.

This list is for asking and answering questions about development with the 
Cocoa, Cocoa Touch, and related frameworks.

There are appropriate venues for feedback to Apple, including the site at 
<http://www.apple.com/feedback/ <http://www.apple.com/feedback/>> and the bug 
reporter at <http://bugreport.apple.com/ <http://bugreport.apple.com/>>.

  -- Chris Hanson (cocoa-dev co-mod)

___

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: system(root) locale

2009-08-31 Thread Chris Kane

[NSLocale systemLocale] returns the root NSLocale.

If you are referring to the BSD/Unix-level locale, you can start by  
looking in /usr/include/xlocale.h, but I don't know anything else  
about that.



Chris Kane
Cocoa Frameworks, Apple


On Aug 31, 2009, at 12:53 AM, Maggie Zhang wrote:


Hi,
Does anyone know how to get the root locale in Objective-c or C or  
using
Unix commands? I tried NSLocale but it didn't give what I want.  
Though I can

get the user's current locale in different ways.

Thanks for you help.
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/ckane%40apple.com

This email sent to ck...@apple.com


___

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

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

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

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


Re: What about revamping OpenUp.app for Snow Leopard?

2009-09-04 Thread Chris Hanson

On Sep 3, 2009, at 10:14 PM, Scott Anguish wrote:

Looking inside zip/tar/tar.gz files (something OpenUp never did)  
would best be accomplished by writing a QuickLook plug-in (which  
probably exists.


I don’t know about any Quick Look plug-ins, but the ZipBrowser example  
code both provides a skeleton of browsing zip archives and  
demonstrates a number of modern Cocoa development techniques:


This example shows two versions of a single application: the  
original version of the application, in ZipBrowserBefore, and the  
polished version, in ZipBrowserAfter. ZipBrowser is a simple  
document-based application used for perusing the contents of a zip  
archive without having to unarchive it. The modifications between  
ZipBrowserBefore and ZipBrowserAfter fall into six categories: 64- 
bit readiness, performance and responsiveness, security,  
localization and internationalization, usability, and accessibility.


Download ZipBrowser 1.1 here:

http://developer.apple.com/mac/library/samplecode/ZipBrowser/index.html

You can also search for ZipBrowser in the Snow Leopard documentation,  
and download & open the project right within Xcode.


  — Chris

___

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

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

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

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


Re: Code Signing

2009-09-06 Thread Chris Suter
Hi Peter,

On Sun, Sep 6, 2009 at 9:00 PM, Peter Hudson wrote:
> I notice that when I sign code ( the whole app )  I  land up with 2
> additional items in my /Contents directory in the app bundle.
> These items are a folder called _CodeSignature  and an alias called
> CodeResources.
>
> If I delete these two items, the code still identifies itself as signed (
> when I attempt to run codesign on it again ).
> Also, the app still runs.
>
> I was wondering if these files are meant to remain or if removing them is
> not an issue ?

Within an application bundle there are signatures for all the files
within the bundle and then there's a signature for the binary itself.
The signature for the binary is stored within executable and you can
see it if you use the otool -l command (look for the
LC_CODE_SIGNATURE). The signature for all the resources is stored
within the file you've discovered.

As far as I know, except for static validation (using the codesign
tool), the signature for the resources isn't used by much (or at least
it wasn't for Leopard).

The signature for the binary is used by the system for various things.
For example you can set the kill flag to have your application
terminated if there's an invalid signature, and it's used for Keychain
access (so that if you upgrade an application, you won't be prompted
again for password access provided the signature remains valid).

It's important to remember that code signatures are not really there
to prevent malware from running, or make it harder for hackers (since
it's trivial to remove a code signature or replace them other valid
signatures).

At any rate, you shouldn't be deleting those files. If you remove
them, the signature will be invalidated.

By the way, the best list for code signing questions is the apple-cdsa list.

Kind regards,

Chris
___

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

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

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

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


usb notification

2009-09-08 Thread Chris Carson
Hi all,

Can't get a simple example working. AppearedNotificationHandler() should be 
called in the code below when a USB device (any device for now) is plugged in. 
I see the NSLog(@"registerDeviceCallbackHandler") message appear in the console 
when I start the application, but never see the 
NSLog(@"AppearedNotificationHandler") message when I plug in a device. What am 
I missing?

Note: The project's MainMenu.nib Interface Builder file has an NSObject whose 
class is "USBDriver".


static void AppearedNotificationHandler (void * refCon, io_iterator_t iterator);

@interface USBDriver(Private)
- (void) registerDeviceCallbackHandler;
@end

@implementation USBDriver(Private)

- (void) registerDeviceCallbackHandler
{
IOReturnkernErr;
CFRunLoopSourceRef  runLoopSource;
CFMutableDictionaryRef  matchingDict = IOServiceMatching 
(kIOUSBDeviceClassName);
CFRunLoopRefrunLoop;

// Create the port on which we will receive notifications. We'll wrap 
it in a runLoopSource
// which we then feed into the runLoop for async event notifications.
deviceNotifyPort = IONotificationPortCreate (kIOMasterPortDefault);
if (deviceNotifyPort == NULL)
{
return;
}

// Get a runLoopSource for our mach port.
runLoopSource = IONotificationPortGetRunLoopSource (deviceNotifyPort);

matchingDict = (CFMutableDictionaryRef) CFRetain (matchingDict);

kernErr = IOServiceAddMatchingNotification (deviceNotifyPort,
kIOFirstMatchNotification,
matchingDict,
AppearedNotificationHandler,
(void *) self,
&deviceAppearedIterator);

kernErr = IOServiceAddMatchingNotification (deviceNotifyPort,
kIOTerminatedNotification,
matchingDict,

DisappearedNotificationHandler,
(void *) self,
&deviceDisappearedIterator 
);

// Get our runLoop
runLoop = [[NSRunLoop currentRunLoop] getCFRunLoop];

// Add our runLoopSource to our runLoop
CFRunLoopAddSource (runLoop, runLoopSource, kCFRunLoopDefaultMode);

NSLog(@"registerDeviceCallbackHandler");
}

@end


@implementation USBDriver

- (id) init
{
[super init];

if (self) {
deviceNotifyPort= IO_OBJECT_NULL;
deviceAppearedIterator  = 0;

[self registerDeviceCallbackHandler];
}

return self;
}

@end

static void AppearedNotificationHandler (void * refCon, io_iterator_t iterator)
{
NSLog(@"AppearedNotificationHandler");
}


Any help is much appreciated.

Thanks,
Chris


  

___

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

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

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

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


Re: usb notification

2009-09-08 Thread Chris Carson
> >IOReturnkernErr;
> 
> You never seem to check for errors.  Please ensure
> your calls are
> succeeding by checking the value of this variable.  If
> they're
> failing, use macerror(1) to look up the error number.

IOServiceAddMatchingNotification() returns no errors (0).

> > - (id) init
> > {
> >[super init];
> >
> >if (self) {
> 
> This is not the correct initializer pattern.  You need
> to assign to self here.
> 
> --Kyle Sluder

Changed this to self = [super init];

However, the issue still persists.

Chris


  

___

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

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

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

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


testing ppc on intel

2009-09-13 Thread Chris Idou

Every program that I build universal but run on intel (OS 10.5) with "arch 
-ppc" option, crashes with a report like the following, and I've tested quite a 
few, even simple ones.

Is it unreasonable to try to test ppc programs on intel, or am I doing 
something wrong, or what?




Version: ??? (???)
Code Type:   PPC (Translated)
Parent Process:  bash [1652]

Interval Since Last Report:  83 sec
Crashes Since Last Report:   1
Per-App Interval Since Last Report:  0 sec
Per-App Crashes Since Last Report:   1

Date/Time:   2009-09-14 15:05:30.700 +1000
OS Version:  Mac OS X 10.5.8 (9L30)
Report Version:  6
Anonymous UUID:  FA165A8B-95AA-4C9A-9296-C70D9F3138FC

Exception Type:  EXC_CRASH (SIGTRAP)
Exception Codes: 0x, 0x
Crashed Thread:  2

Thread 0:
0   ???   0x816a5e28 0 + 2171231784

Thread 1:
0   ???   0x800bc286 0 + 2148254342
1   ???   0x800c3a7c 0 + 2148285052
2   translate 0xb818b6ea CallPPCFunctionAtAddressInt + 
202886
3   ???   0x800ed155 0 + 2148454741
4   ???   0x800ed012 0 + 2148454418

Thread 2 Crashed:
0   ???   0x8019d402 0 + 2149176322
1   translate 0xb80b6b00 0xb800 + 748288
2   translate 0xb80b7007 0xb800 + 749575
3   translate 0xb80d49c0 0xb800 + 870848
4   translate 0xb813d75f spin_lock_wrapper + 4259
5   translate 0xb8011b64 0xb800 + 72548

Thread 2 crashed with X86 Thread State (32-bit):
  eax: 0x  ebx: 0xb80b6c78  ecx: 0xb009adcc  edx: 0x8019d402
  edi: 0xb8208980  esi: 0x0005  ebp: 0xb009adf8  esp: 0xb009adcc
   ss: 0x001f  efl: 0x0246  eip: 0x8019d402   cs: 0x0007
   ds: 0x001f   es: 0x001f   fs: 0x001f   gs: 0x0037
  cr2: 0xf00fffd0

Binary Images:
0xb800 - 0xb81d7fe7  translate ??? (???) /usr/libexec/oah/translate

Translated Code Information:
NO CRASH REPORT


  
__
Get more done like never before with Yahoo!7 Mail.
Learn more: http://au.overview.mail.yahoo.com/
___

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

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

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

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


Re: testing ppc on intel

2009-09-14 Thread Chris Idou

10.5.8. Now that I try, a new empty Cocoa app in XCode works. My app is just a 
one window Cocoa program that links with two frameworks (both of which are 
universal with ppc). arch -ppc works with /bin/cat, iTunes and so forth. Just 
not with my programs. I'm pretty sure I have no input managers, I cleared the 
contents of ~/Library/InputManagers and /Library/InputManagers, and I don't 
think I have kexts, I haven't installed those sort of programs, or any haxies.

If there is something wrong with my program, I'm not sure how to debug it.







From: Greg Guerin 
To: list-cocoa-dev 
Sent: Monday, 14 September, 2009 5:33:48 PM
Subject: Re: testing ppc on intel

Chris Idou wrote:

> Every program that I build universal but run on intel (OS 10.5) with "arch 
> -ppc" option, crashes with a report like the following, and I've tested quite 
> a few, even simple ones.


How simple is simple?  Hello world, or simpler?

What about programs you didn't write, such as /bin/cat?

Exactly which version of Leopard?  10.5 covers at least nine revisions.

Do you have any input managers, haxies, kexts, etc. active?

  -- GG

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/idou747%40yahoo.com

This email sent to idou...@yahoo.com



  
__
Get more done like never before with Yahoo!7 Mail.
Learn more: http://au.overview.mail.yahoo.com/
___

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

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

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

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


Re: Grand Central Dispatch vs CFRunLoop

2009-09-16 Thread Chris Kane
eneral danger in all this is that some API you are using refers to  
the "current run loop" and does something to it which is crucial  
later.  This has always been true for background threads, but the  
pitfall becomes more pronounced as more developers move to  
multithreading, particularly using the "indirect" kinds of mechanisms  
like dispatch queues and NSOperationQueues.




With respect to NSTask, there's no reason to believe that it will  
work if you just run the main dispatch queue rather than running the  
NSRunLoop.  I highly doubt it would.


I think it will work fine as long as you don't want the  
NSTaskDidTerminateNotification and related (ie, -isRunning to return  
the right answer) and anything else the NSTask might do as a result of  
the child process dying.


However, if you are also using NSFileHandle "in-background"  
operations, then you will need the run loop run (on the thread(s)  
which start those background reads) to get those notifications.
That's a separate matter from NSTask, but people may confuse the two  
together so I mention it here.



Chris Kane
Cocoa Frameworks, Apple


___

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

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

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

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


Re: Is a serial NSOperationQueue FIFO?

2009-09-16 Thread Chris Kane

On Sep 6, 2009, at 9:32 PM, Eric Hermanson wrote:

When working with a serial NSOperationQueue (i.e.  
setMaxConcurrentOperationCount==1), are the operations added to the  
queue guaranteed to run in FIFO order if all operations have the  
same priority and no operation dependencies are involved?  My guess  
is that the NSOperationQueue will run the operations in FIFO order,  
however, I don't believe the NSOperationQueue documentation  
guarantees this.  The documentation says operations will run based  
on priority, then on dependency structure.  Because all operations  
in this aforementioned serial queue have the same priority (i.e  
normal) and no dependencies, then I suppose the NSOperationQueue  
could sort the operations any way it wanted, not necessarily in the  
order I added them to the queue.


Does anyone have insight into this, or is there documentation  
anywhere that can guarantee to me an NSOperationQueue with a  
concurrent operation count of 1 will indeed process the operations  
first come first serve?



If all operations have the same priority (which is not changed after  
the operation is added to a queue) and all operations are always - 
isReady==YES by the time they get put in the operation queue, then a  
serial NSOperationQueue is FIFO.  The second condition I mention there  
is stronger than "no operation dependencies" -- dependencies don't  
directly matter to a queue, just the readiness of the operations, and  
dependencies are just one thing that can affect readiness.


If you are adding NSOperations to a given queue from multiple threads,  
keep in mind that it is very tricky (well, impossible) to accurately  
observe from the outside the actual order of events (ie, who got in  
first).



Chris Kane
Cocoa Frameworks, Apple

___

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

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

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

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


Re: Need -[NSTask waitUntilExitOrTimeout:] (was NSTask "Thread Unsafe"...)

2009-09-16 Thread Chris Kane


On Sep 14, 2009, at 6:29 PM, Jerry Krinock wrote:


The reason why I asked this is because I need:
-[NSTask waitUntilExitOrTimeout:(NSTimeInterval)].
But there is no such method.  So, I wrote a wrapper around NSTask  
that does this.


On 2009 Sep 14, at 07:41, Adam R. Maxwell wrote:

Ordinarily, I'd guess that it's supposed to mean that you can't  
share instances between threads.  However, guesswork when dealing  
with the threading docs drives me crazy.


For NSTask in particular, I recommend that you interpret that more  
conservatively...


Also, I presume it means that you should not invoke the same  
instance from more than one thread.  I'm not sure how much more  
conservative you could get, other than to run it on the main thread.


I wrote an implementation of NSTask from scratch to work around the  
problem.


Whew, Adam.  Since I'm 10.5+, and don't think I'll ever be running  
more than one NSTask at a time, I won't be quite that conservative.   
In my NSTask wrapper, I detach a new thread.  In this new thread, I  
set up the task, then run the run loop once...


[task launch] ;
if ([task isRunning]) {
   // Write data to stdin file/pipe
   // ...
   // ...
}

NSDate* limitTime = [NSDate dateWithTimeIntervalSinceNow:timeout] ;
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
beforeDate:limitTime] ;
// The above will block and be run to here either due to
// the posting of an NSTaskDidTerminateNotification, or the
// passing of limitTime, whichever occurs first.


That is not a valid assumption (described in the comments and apparent  
from the rest of the code).


Just do the loop, checking the time and isRunning.  Running the run  
loop once is not necessarily sufficient.


Keep in mind that isRunning can start returning NO before (or after)  
the notification gets delivered.  There's no necessary correlation  
between the two.  If you actually care that the notification has been  
posted, you should register an observer and change some shared state  
in the handler method, which the looping can check for.




if (![task isRunning]) {
   taskResult = [task terminationStatus] ;

   // Read stdout and stderr
   // ...
   // ...
}
else {
   taskResult = SSYShellTaskerErrorTimedOut ;

   // Clean up
   kill([task processIdentifier], SIGKILL) ;

   // Set NSError indicating timeout
   // ...
   // ...
}

Actually, I originally was doing this on the main thread, except  
that the -[NSRunLoop runMode:beforeDate] was in a while() loop.   
When the loop ran, I would check and see if there was a timeout,  
task was finished, or neither (presumably some other input source  
triggered the run).  But then I found an obscure bug: If I had  
disabled undo registration in order to do some behind-the-scenes  
changes, it would re-enable undo registration.  Uh, yeah, it took me  
a while to track that one down.  Apparently, running a run loop that  
is already running is not a good idea.  I suppose I could also have  
done it with a timer.



If I interpret your explanation of the previous code correctly and it  
was similar to the code above, the problem here, in a sense, is more  
your desire to block until the task is finished or a timeout expires.   
Go back to the main thread.  Setup a oneshot NSTimer for the timeout  
period.  Setup a notification handler to listen for the  
NSTaskDidTerminateNotification.  If the timer fires first, kill the  
task, unregister the notification handler, etc.  If the notification  
happens first, invalidate the timer, unregister the notification  
handler, etc.  Don't run the run loop yourself.  Let your code be  
event-driven.


A run loop can be run re-entrantly, but as Jens said, usually it is  
done in a private mode, to prevent (say) the default mode stuff from  
happening at times which are surprising to that stuff (breaking  
assumptions or requirements it has), and possibly surprising to your  
app (breaking assumptions or requirements it has).  However in this  
case, the task death notification, if you need that, requires the  
default run loop mode to be run to get delivered.



Chris Kane
Cocoa Frameworks, Apple




___

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

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

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

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


Re: #pragma to suppress a warning message

2009-09-17 Thread Chris Hanson

On Sep 16, 2009, at 6:09 PM, Jay Boyer wrote:

Finally, I am doing this because the preferredLanguages method is  
specified to be an OS 10.5+ method and the project I am working on  
is being built on the 10.4 SDK.


The proper way to set up this project, as you’ve described it, is to  
build the project using a Base SDK of Mac OS X 10.5 (or later), and a  
Mac OS X Deployment Target of 10.4.


- Base SDK is the latest operating system from which you wish to use  
features
- Deployment Target is the earliest operating system on which your  
software will run


This is the case for both Mac OS X and iPhone OS.  You do not need to  
use the SDK specific to an operating system just because that is the  
minimum operating system your application will support.


  — Chris

___

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

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

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

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


Re: Static Analyzer and Core Foundation

2009-09-18 Thread Chris Parker


On 18 Sep 2009, at 4:33 PM, Steve Cronin wrote:


Alert - potential boneheaded-ness lies ahead - please be gentle.

I'll be the first to admit that I'm much happier in ObjC than C…

I thought I would try static analysis and see what turned up.
On the whole I must say I'm pleased but this one has me questioning  
my basic understanding


if (![[NSFileManager defaultManager] fileExistsAtPath:thisPath]) {
…
41  } else {
42  MDItemRef mdi = MDItemCreate( nil, (CFStringRef)thisPath );
43  if  ( mdi != nil )  {
44			CFDictionaryRef dictRef = MDItemCopyAttributes( mdi,  
MDItemCopyAttributeNames(mdi));

…
CFRelease(dictRef);
} else {
… handle error
}
}

Static Analysis tells me I have a potential leak of object allocated  
on line 44 -- that's all.


My questions are:
1) Why is there not a warning for the object allocated on line 42 -  
mdi ?


Seems like it should be; you're not releasing it and it's going out of  
scope.



2) Why is the CFRelease(dictRef) not sufficient?


In this case, it's probably complaining about the  
MDItemCopyAttributeNames() call, which (because it has "Copy" in the  
name) returns an object you'd have to release.


I.e., line 44 allocates two objects, the dictionary which you *are*  
releasing and the attribute names array, which you're not.


.chris

--
Chris Parker
Apple Inc.

___

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

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

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

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


building and running on Snow Leopard

2009-09-23 Thread Chris Idou

If you build an application on Snow Leopard, but against the 10.5 deployment 
target, and then you run the program on Snow Leopard, do you get all the 
Leopard 10.5 bugs as if you ran it on Leopard, or do you get to benefit from 
Snow Leopard bug fixes only if you build against the 10.6 deplotment target?


  
__
Get more done like never before with Yahoo!7 Mail.
Learn more: http://au.overview.mail.yahoo.com/
___

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

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

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

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


Re: building and running on Snow Leopard

2009-09-23 Thread Chris Idou

Ok, so if I don't desire bug for bug 10.5 compatibility, but I do want it to 
run on 10.5, then I select 10.6 SDK and 10.5 deployment target, is that right? 

I'm curious what happens if you use some external frameworks that were built 
against 10.5 SDK, yet your main app is 10.6 - I assume it will have to go with 
what your app says, I guess?

Also, since I'd like to take advantage of Snow Leopard bug fixes, but I don't 
want to blow up on Leopard, what is the correct way to test whether you are 
running on Leopard so that the code at runtime can implement Leopard specific 
work arounds?







From: Ken Thomases 
To: Chris Idou 
Cc: cocoa-dev@lists.apple.com
Sent: Wednesday, 23 September, 2009 5:37:01 PM
Subject: Re: building and running on Snow Leopard

On Sep 23, 2009, at 2:20 AM, Chris Idou wrote:

> If you build an application on Snow Leopard, but against the 10.5 deployment 
> target, and then you run the program on Snow Leopard, do you get all the 
> Leopard 10.5 bugs as if you ran it on Leopard, or do you get to benefit from 
> Snow Leopard bug fixes only if you build against the 10.6 deplotment target?

Not quite either.

At runtime, your app can only use the frameworks provided on the host system.  
Just because you linked against the 10.5 SDK doesn't change the fact that Snow 
Leopard only provides Snow Leopard's frameworks.

In general, your app will get the benefit of bug fixes in the Snow Leopard 
frameworks when running on Snow Leopard.  However, there are some bug fixes 
which Apple has determined would break backward compatibility with apps built 
and tested on Leopard or earlier.  For those fixes, they test which SDK the app 
was built against.  For those built against the pre-Snow Leopard SDK, they 
continue to provide the old, compatible-bug-buggy behavior.  This is documented 
in the release notes for the affected frameworks.

Note that this tests for the SDK that the app was built against.  You mentioned 
deployment target.  That's not the same thing.  If you build against the 10.6 
SDK but with a 10.5 deployment target, it is expected that you will be testing 
on both 10.6 and 10.5.  It is then your code's responsibility to handle both 
the old framework behavior the new behavior.  The Snow Leopard frameworks _do 
not_ go out of their way to maintain the old behavior in this case.

Regards,
Ken


  
__
Get more done like never before with Yahoo!7 Mail.
Learn more: http://au.overview.mail.yahoo.com/
___

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

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

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

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


Re: building and running on Snow Leopard

2009-09-23 Thread Chris Idou






From: Ken Thomases 

>Don't test whether you're running on Leopard.  Just write your code to cope 
>with either behavior of the framework.  Read the release notes for the 
>frameworks on which you rely for more guidance.  I think when you see the 
>sorts of bugfixes which are special-cased in this way, it will be 
>obvious how you should code in response.

Well I'm thinking of a particular bug on Leopard with MDItemCreate where you 
have to choose between your program crashing and leaking memory. Apple tells me 
it is fixed in Snow Leopard. On Leopard I choose to leak memory, but I'd rather 
not do that on Snow Leopard.


  
__
Get more done like never before with Yahoo!7 Mail.
Learn more: http://au.overview.mail.yahoo.com/
___

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

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

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

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


Re: NSManagedObject Initialization Methods Not Called

2009-09-23 Thread Chris Hanson

On Sep 21, 2009, at 12:12 PM, Richard Somers wrote:

I have a core data document based application. When a file on the  
disk is opened -awakeFromInsert and -awakeFromFetch are never called  
for one of my NSManagedObject objects.


Why is not one of these methods getting called when the object is  
loaded into memory from disk?


It sounds like you’re expecting adding a persistent store to a  
persistent store coordinator to result in all of its managed objects  
being sent either -awakeFromInsert or -awakeFromFetch.


* -awakeFromInsert will only be sent to a managed object when it’s  
actually inserted into a managed object context, not when it’s  
realized from a fault.


* -awakeFromFetch will only be sent to a managed object when it’s  
actually realized from a fault, not when the persistent store  
containing it is added to a persistent store coordinator — or even  
when it’s fetched via a fetch request or relationship traversal.


Hope this clears things up a little.

  — Chris

___

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

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

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

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


Snow Leopard: unsupported PointerFunctions configuration was requested

2009-09-23 Thread Chris Idou
I'm porting an app to Snow Leopard. 

Very early in application startup, even before main() is called, I get the 
following error:

2009-09-24 12:07:11.462 MyApp[5534:a0f] *** An unsupported PointerFunctions 
configuration was requested, probably for use by NSMapTable, NSHashTable, or 
NSPointerArray.  The requested configuration fails due to integer personality 
not using opaque memory

It happens twice on startup, and below are the stack traces when it happens:

What does it all mean?


#00x7fff84b342f7 in NSLog
#10x7fff84ac84d1 in +[NSConcretePointerFunctions 
initializeSlice:withOptions:]
#20x7fff84aea796 in -[NSConcretePointerFunctions initWithOptions:]
#30x7fff84aea74d in +[NSPointerFunctions pointerFunctionsWithOptions:]
#40x10004b633 in +[RKCache load]
#50x7fff8764141b in call_load_methods
#60x7fff87641160 in load_images
#70x7fff5fc0315a in 
__dyld__ZN4dyldL12notifySingleE17dyld_image_statesPK11ImageLoader
#80x7fff5fc0bcdd in 
__dyld__ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEj
#90x7fff5fc0bc9d in 
__dyld__ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEj
#100x7fff5fc0bda6 in 
__dyld__ZN11ImageLoader15runInitializersERKNS_11LinkContextE
#110x7fff5fc0210e in __dyld__ZN4dyld24initializeMainExecutableEv
#120x7fff5fc06981 in __dyld__ZN4dyld5_mainEPK12macho_headermiPPKcS5_S5_
#130x7fff5fc016d2 in __dyld__ZN13dyldbootstrap5startEPK12macho_headeriPPKcl
#140x7fff5fc01052 in __dyld__dyld_start


#00x7fff84b342f7 in NSLog
#10x7fff84aea7bd in -[NSConcretePointerFunctions initWithOptions:]
#20x7fff84aea74d in +[NSPointerFunctions pointerFunctionsWithOptions:]
#30x10004b633 in +[RKCache load]
#40x7fff8764141b in call_load_methods
#50x7fff87641160 in load_images
#60x7fff5fc0315a in 
__dyld__ZN4dyldL12notifySingleE17dyld_image_statesPK11ImageLoader
#70x7fff5fc0bcdd in 
__dyld__ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEj
#80x7fff5fc0bc9d in 
__dyld__ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEj
#90x7fff5fc0bda6 in 
__dyld__ZN11ImageLoader15runInitializersERKNS_11LinkContextE
#100x7fff5fc0210e in __dyld__ZN4dyld24initializeMainExecutableEv
#110x7fff5fc06981 in __dyld__ZN4dyld5_mainEPK12macho_headermiPPKcS5_S5_
#120x7fff5fc016d2 in __dyld__ZN13dyldbootstrap5startEPK12macho_headeriPPKcl
#130x7fff5fc01052 in __dyld__dyld_start


  
__
Get more done like never before with Yahoo!7 Mail.
Learn more: http://au.overview.mail.yahoo.com/
___

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

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

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

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


Re: Controlling Spaces and retrieving information about the current Space?

2009-09-23 Thread Chris Idou



>>> Secondly, is there any way in any of those environments to
>>> programmatically switch Spaces? [ ... ]
>>
>> No, there is no API (in Cocoa or otherwise) to control the active space.

>But how does Spaces do it? Is it via an internal, private API that
>people like us don't have access to?

There may not be any API, internal or otherwise. It might be all just built 
into the internal workings of the window manager process.

One would presume there is an internal API for switching to the grid view, 
since Spaces.app does that.


  
__
Get more done like never before with Yahoo!7 Mail.
Learn more: http://au.overview.mail.yahoo.com/
___

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

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

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

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


Snow Leopard, core data, read only and multiple threads

2009-09-27 Thread Chris Idou
I've got an app that worked on Leopard. I ported it to Snow Leopard SDK 10.6, 
and now it works on Snow Leopard, but it doesn't work correctly on Leopard 
anymore. I haven't changed anything that ought to affect this.

It's an app with a foreground gui that writes an XML coredata store. A 
background thread reads the repository and takes action. Both threads have the 
full core data stack with their own coordinators. As soon as I activate the 
background thread, the XML store gets set to zero bytes.

When I encountered the problem I read the doco and I added the 
NSReadOnlyPersistentStoreOption when calling addPersistentStoreWithType in the 
background thread, but that hasn't helped. It wasn't necessary before.

Has anyone got any thoughts?

And also, how am I going to debug this? Xcode 3.2 doesn't run on 10.5 does it? 
And is an Xcode 3.2 project now going to work with XCode 3.1?


  
__
Get more done like never before with Yahoo!7 Mail.
Learn more: http://au.overview.mail.yahoo.com/
___

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

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

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

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


NSDocumentController didCloseAllSelector

2009-09-30 Thread Chris Idou
The doco for closeAllDocumentsWithDelegate:didCloseAllSelector:contextInfo: 
says that it should call
the didCloseAllSelector. How would one do that? This is what I am doing:

[delegate performSelector:didCloseAllSelector withObject:(id)YES 
withObject:contextInfo];

but I'm nervous about that typecast. Is that the way, or is there another way?


  
__
Get more done like never before with Yahoo!7 Mail.
Learn more: http://au.overview.mail.yahoo.com/
___

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

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

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

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


Re: NSWindowController and GC

2009-09-30 Thread Chris Idou


The right way is to make sure something in your program retains a pointer to 
your window controller. Sometimes there will be an obvious place, like a member 
of the object that created the window controller. That is most typical. Worst 
case is you retain a pointer in some global variable or similar, but that also 
has a greater danger that you will forget to zero it out when you are finished 
with it, and it won't get collected. Some of my temporary dialog box 
controllers inherit from a class that puts itself in a global dictionary when 
created, and removes itself when the window closes.





From: Bryan Matteson 
To: cocoa-dev@lists.apple.com
Sent: Thursday, 1 October, 2009 9:20:16 AM
Subject: NSWindowController and GC

I was just reminded of something. I use GC in my app, and unless I specifically 
disable collection for a window controller, it's destroyed as soon as it loses 
key. I solved it by setting the controller as the delegate of the window, 
disabling collection for the window controller in windowDidLoad, and 
re-enabling it in windowWillClose:. Is there another way?

-B
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/idou747%40yahoo.com

This email sent to idou...@yahoo.com



  
__
Get more done like never before with Yahoo!7 Mail.
Learn more: http://au.overview.mail.yahoo.com/
___

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

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

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

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


Re: Best Design Advice

2009-09-30 Thread Chris Idou
If it displays a window it should be an app. If its an app it should be in 
/Applications and it should be started from Login Items.

You can't install it automatically by security design. But once you get the 
user to install and run it, there are no permissions issues in adding it to 
login items (although asking the user is polite), and connecting to your web 
site.





From: David Blanton 
To: cocoa-dev List 
Sent: Sunday, 15 November, 2009 4:21:31 AM
Subject: Best Design Advice

I need to create an app the is auto downloaded and installed from a web site 
when the user clicks a web page button.

The app needs to be installed so that it always runs when the user logs in.

The app needs to periodically (by user preference setting) connect to a web 
server.

The app needs to display a window with information gleaned from its last web 
server connect.

=
1. Where should the app be installed.

2. Are there any permission issues.

3. Is this a background service or status like item.

4. Is it's periodic web connect fired by a timer or some other means.

5. Any other general tips / tricks.
=


Thanks in advance!

db


___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/idou747%40yahoo.com

This email sent to idou...@yahoo.com



  
__
Get more done like never before with Yahoo!7 Mail.
Learn more: http://au.overview.mail.yahoo.com/
___

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

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

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

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


Re: NSDocumentController didCloseAllSelector

2009-09-30 Thread Chris Idou


What I have is a document based app, but it automatically saves everything - I 
don't want to ask the user. So I'm saving all my documents in 
closeAllDocumentsWithDelegate. It's working pretty good, the only major hassle 
is the app doesn't die on machine shutdown, presumably because I wasn't calling 
didCloseAllSelector.

I agree the whole setup is pretty confusing but after ponding it extensively, I 
think it is more or less sensible, given the need for the RunLoop and so on. 
(albeit, poorly documented).

I'm not sure what you mean you can "invoke the method easily enough".

Maybe the right way to do it is with NSInvocation. But knowing what I know 
about objective-c, I can't see how setArgument:atIndex: would be able to know 
that the second argument is a BOOL which is one byte. Maybe it does know and it 
all just works.




____
From: Graham Cox 
To: Chris Idou 
Cc: cocoa-dev@lists.apple.com
Sent: Thursday, 1 October, 2009 11:42:05 AM
Subject: Re: NSDocumentController didCloseAllSelector


On 01/10/2009, at 11:00 AM, Chris Idou wrote:

> The doco for closeAllDocumentsWithDelegate:didCloseAllSelector:contextInfo: 
> says that it should call
> the didCloseAllSelector. How would one do that? This is what I am doing:

Chris, this stuff is a right old mess. No wonder you're confused.

It says *it* will call that method if all documents are closed. You don't 
necessarily have to call anything - looking at the byzantine interactions 
between all these methods all I can say is, if you can avoid it, do so!

What do you want to do? Unless you're overriding - 
(void)canCloseDocumentWithDelegate:(id)delegate 
shouldCloseSelector:(SEL)shouldCloseSelector contextInfo:(void *)contextInfo
to do something in a non-standard way there's nothing to do. If you are 
overriding it, you need to handle the whole kit-n-kaboodle, including 
presenting the alert to the user and saving the document to disk, and finally 
invoking the mysterious callback selector.

I can't actually see an easy way to invoke the callback selector with the 
signature as given - you need to pass it the document (self), a BOOL and the 
contextInfo. You can invoke the method directly on the delegate easily enough, 
but since you're supposed to use the callback supplied, that might not work. 
The only way I can see to do it is to create an NSInvocation with the selector, 
set each argument and call invokeWithTarget: passing the delegate.

Someone else might have a brighter idea - this seems very involved and badly 
thought-out.

--Graham


  
__
Get more done like never before with Yahoo!7 Mail.
Learn more: http://au.overview.mail.yahoo.com/
___

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

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

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

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


Re: whether to use core data...

2009-10-04 Thread Chris Hanson
On Oct 4, 2009, at 10:39 AM, Jeffrey Oleander wrote:

>> It's not a toy language or API by any stretch of the
>> imagination.
> 
> But Core Data seems to be.

Please expand on this, and why you feel it to be the case.

A great many people are using Core Data successfully in their applications on 
both Mac OS X and iPhone OS.  It is by no means a toy.  That you don’t 
currently think it meets your (unarticulated) needs does not make it one.

  — Chris

___

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

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

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

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


Re: Snow Leopard: unsupported PointerFunctions configuration was requested

2009-10-10 Thread Chris Idou


Below is the RegexKit code that causes the Snow Leopard error. After reading 
the doco, I don't feel very enlightened about what the unsupported 
configuration is, or what the solution might be. Can anyone give me a clue?


+ (void)load
{
  RKAtomicMemoryBarrier(); // Extra cautious
  if(RKCacheLoadInitialized== 1) { return; }
  
  if(RKAtomicCompareAndSwapInt(0, 1, &RKCacheLoadInitialized)) {
if((cacheMapKeyCallBacks= dlsym(RTLD_DEFAULT, "NSIntegerMapKeyCallBacks")) 
== NULL) { cacheMapKeyCallBacks= dlsym(RTLD_DEFAULT, "NSIntMapKeyCallBacks"); }

#ifdef ENABLE_MACOSX_GARBAGE_COLLECTION
id garbageCollector = objc_getClass("NSGarbageCollector");

if(garbageCollector != NULL) {
  if([garbageCollector defaultCollector] != NULL) {
id pointerFunctions = objc_getClass("NSPointerFunctions");

RKCacheIntegerKeyPointerFunctions = [pointerFunctions 
pointerFunctionsWithOptions:NSPointerFunctionsIntegerPersonality];
RKCacheIntegerKeyPointerFunctions.acquireFunction = 
intPointerFunctionsAcquire;
RKCacheIntegerKeyPointerFunctions.descriptionFunction = 
intPointerFunctionsDescription;
RKCacheIntegerKeyPointerFunctions.hashFunction= 
intPointerFunctionsHash;
RKCacheIntegerKeyPointerFunctions.isEqualFunction = 
intPointerFunctionsIsEqual;
RKCacheIntegerKeyPointerFunctions.relinquishFunction  = 
intPointerFunctionsRelinquish;
RKCacheIntegerKeyPointerFunctions.sizeFunction= 
intPointerFunctionsSize;

RKCacheObjectValuePointerFunctions = [pointerFunctions 
pointerFunctionsWithOptions:(NSPointerFunctionsZeroingWeakMemory| 
NSPointerFunctionsObjectPersonality)];

[[garbageCollector defaultCollector] 
disableCollectorForPointer:RKCacheIntegerKeyPointerFunctions];
[[garbageCollector defaultCollector] 
disableCollectorForPointer:RKCacheObjectValuePointerFunctions];
  }
}
#endif // ENABLE_MACOSX_GARBAGE_COLLECTION
  }
}





____
From: Bill Bumgarner 
To: Chris Idou 
Cc: cocoa-dev@lists.apple.com
Sent: Thu, 24 September, 2009 12:36:04 PM
Subject: Re: Snow Leopard: unsupported PointerFunctions configuration was 
requested

On Sep 23, 2009, at 7:09 PM, Chris Idou wrote:
Very early in application startup, even before main() is called, I get the 
following error:
> 
> 2009-09-24 12:07:11.462 MyApp[5534:a0f] *** An unsupported PointerFunctions 
> configuration was requested, probably for use by NSMapTable, NSHashTable, or 
> NSPointerArray.  The requested configuration fails due to integer personality 
> not using opaque memory
> 
> It happens twice on startup, and below are the stack traces when it happens:
> 
> What does it all mean?
> 
> 
> #00x7fff84b342f7 in NSLog
> #10x7fff84ac84d1 in +[NSConcretePointerFunctions 
> initializeSlice:withOptions:]
> #20x7fff84aea796 in -[NSConcretePointerFunctions initWithOptions:]
> #30x7fff84aea74d in +[NSPointerFunctions pointerFunctionsWithOptions:]
> #40x10004b633 in +[RKCache load]

One change to the NSPointerFunction based collection classes (which support a 
number of things that NSArray & the like do not) between Leopard and Snow 
Leopard was to tighten up the validation of the pointer function validation 
such that a handful of non-sensical configurations are detected that weren't 
before.

I.e. RKCache is trying to create a set of pointer functions that doesn't make 
sense (and for whose behavior is undefined).

As someone else pointed out, RK is most likely RegexKit and, thus, the source 
is available and can be fixed.  Given the relatively common use of RK*, please 
provide a patch to the author so it can be fixed upstream.

b.bum


  
__
Get more done like never before with Yahoo!7 Mail.
Learn more: http://au.overview.mail.yahoo.com/
___

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

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

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

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


Re: real verses Virtual memory

2009-10-10 Thread Chris Ridd


On 10 Oct 2009, at 17:44, jon wrote:

no,  no control over the website,   but on webView i turned off all  
the java script and flash and stuff,  so that helps with the speed,   
not with it using virtual memory every 20 seconds,  and it does need  
to be 20 seconds.


So if you change your process to sleep 20 seconds and then repeat -  
instead of exiting and getting restarted - how does that change the  
disk activity?


Cheers,

Chris

___

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

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

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

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


Fw: Snow Leopard: unsupported PointerFunctions configuration was requested

2009-10-10 Thread Chris Idou




Below is the RegexKit code that causes the Snow Leopard error. After reading 
the doco, I don't feel very enlightened about what the unsupported 
configuration is, or what the solution might be. Can anyone give me a clue?


+ (void)load
{
  RKAtomicMemoryBarrier(); // Extra cautious
  if(RKCacheLoadInitialized== 1) { return; }
  
  if(RKAtomicCompareAndSwapInt(0, 1, &RKCacheLoadInitialized)) {
if((cacheMapKeyCallBacks= dlsym(RTLD_DEFAULT, "NSIntegerMapKeyCallBacks")) 
== NULL) { cacheMapKeyCallBacks= dlsym(RTLD_DEFAULT, "NSIntMapKeyCallBacks"); }

#ifdef ENABLE_MACOSX_GARBAGE_COLLECTION
id garbageCollector = objc_getClass("NSGarbageCollector");

if(garbageCollector != NULL) {
  if([garbageCollector defaultCollector] != NULL) {
id pointerFunctions = objc_getClass("NSPointerFunctions");

RKCacheIntegerKeyPointerFunctions = [pointerFunctions 
pointerFunctionsWithOptions:NSPointerFunctionsIntegerPersonality];
RKCacheIntegerKeyPointerFunctions.acquireFunction = 
intPointerFunctionsAcquire;
RKCacheIntegerKeyPointerFunctions.descriptionFunction = 
intPointerFunctionsDescription;
RKCacheIntegerKeyPointerFunctions.hashFunction= 
intPointerFunctionsHash;
RKCacheIntegerKeyPointerFunctions.isEqualFunction = 
intPointerFunctionsIsEqual;
RKCacheIntegerKeyPointerFunctions.relinquishFunction  = 
intPointerFunctionsRelinquish;
RKCacheIntegerKeyPointerFunctions.sizeFunction= 
intPointerFunctionsSize;

RKCacheObjectValuePointerFunctions = [pointerFunctions 
pointerFunctionsWithOptions:(NSPointerFunctionsZeroingWeakMemory| 
NSPointerFunctionsObjectPersonality)];

[[garbageCollector defaultCollector] 
disableCollectorForPointer:RKCacheIntegerKeyPointerFunctions];
[[garbageCollector defaultCollector] 
disableCollectorForPointer:RKCacheObjectValuePointerFunctions];
  }
}
#endif // ENABLE_MACOSX_GARBAGE_COLLECTION
  }
}





____
From: Bill Bumgarner 
To: Chris Idou 
Cc: cocoa-dev@lists.apple.com
Sent: Thu, 24 September, 2009 12:36:04 PM
Subject: Re: Snow Leopard: unsupported PointerFunctions configuration was 
requested

On Sep 23, 2009, at 7:09 PM, Chris Idou wrote:
Very early in application startup, even before main() is called, I get the 
following error:
> 
> 2009-09-24 12:07:11.462 MyApp[5534:a0f] *** An unsupported PointerFunctions 
> configuration was requested, probably for use by NSMapTable, NSHashTable, or 
> NSPointerArray.  The requested configuration fails due to integer personality 
> not using opaque memory
> 
> It happens twice on startup, and below are the stack traces when it happens:
> 
> What does it all mean?
> 
> 
> #00x7fff84b342f7 in NSLog
> #10x7fff84ac84d1 in +[NSConcretePointerFunctions 
> initializeSlice:withOptions:]
> #20x7fff84aea796 in -[NSConcretePointerFunctions initWithOptions:]
> #30x7fff84aea74d in +[NSPointerFunctions pointerFunctionsWithOptions:]
> #40x10004b633 in +[RKCache load]

One change to the NSPointerFunction based collection classes (which support a 
number of things that NSArray & the like do not) between Leopard and Snow 
Leopard was to tighten up the validation of the pointer function validation 
such that a handful of non-sensical configurations are detected that weren't 
before.

I.e. RKCache is trying to create a set of pointer functions that doesn't make 
sense (and for whose behavior is undefined).

As someone else pointed out, RK is most likely RegexKit and, thus, the source 
is available and can be fixed.  Given the relatively common use of RK*, please 
provide a patch to the author so it can be fixed upstream.

b.bum



 Get more done like never before with Yahoo!7 Mail. Learn more.


  
__
Get more done like never before with Yahoo!7 Mail.
Learn more: http://au.overview.mail.yahoo.com/
___

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

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

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

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


Re: Appropriate dealloc and finalize actions

2009-10-13 Thread Chris Hanson
On Oct 12, 2009, at 8:25 AM, Jens Alfke wrote:

> On Oct 12, 2009, at 4:26 AM, Karolis Ramanauskas wrote:
> 
>> As you can see each box has one or more little "inputs" and "outputs" in
>> fact these inputs and outputs are instances of one class (KROMPort). When I
>> drag a connection from output to an input, I set each "port's" connection
>> property to point to another "port". So Input points to Output and Output
>> points to Input. Only one-to-one relationships are allowed (one connection
>> per input/output).
> 
> It's best not to do this kind of cleanup in dealloc/finalize. Instead, have 
> an explicit method like -disconnect that's called to remove the object from 
> the graph. That way you're in direct control of removing objects. And yes, 
> when [foo disconnect] is called it will need to tell its connected object to 
> clear the connection to itself.

It’s also good in cases like this not to represent ownership of objects via the 
graph, but by some outer container.

For example, if I were creating an application with documents that consisted of 
connected nodes, I’d have the document own (retain) the nodes and have the 
nodes just reference (assign) each other.

That would allow me to keep “stop referencing node A from node B” distinct from 
“remove node A from the document.”  The latter may imply the former, but the 
former generally doesn’t imply the latter.

  — Chris


___

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

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

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

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


Re: SelectedRowIndexes

2009-10-15 Thread Chris Williams
Graham's solution is excellent.  You could also have a couple of buttons
between the two lists, with arrows (one right, one left) to move items to
and remove them from, the sub-group list.  And an additional pair to the
right of the sub-group list (one up, one down) allowing reordering.  This
would allow a completely "control" (e.g. Buttons and lists) way of doing it.

Finally, you could present the sub-group info above or below the sub-group
list.


> From: Graham Cox 
> Date: Thu, 15 Oct 2009 17:45:59 +1100
> To: Peter Hudson 
> Cc: 
> Subject: Re: SelectedRowIndexes
> 
> 
> On 15/10/2009, at 5:24 PM, Peter Hudson wrote:
> 
>> The user has an NSTableView in which is presented a number of
>> elements ( 1 per row, typically  20 - 200 rows  )  out of which they
>> need to produce a number of sequenced sub groups.
>> The user presses the 'Start Sub Group' key ( i.e. clear the sequence
>> selection cache )  and then by picking a possible sequence ( one row/
>> element  at a time ) they build a group.
>> As the group is selected, further info about that particular sub
>> group of elements is presented.
>> They can close/abort/store a given sub group at any time.
> 
> 
> That does make some sense, but falls into the trap of not avoiding
> modes (in this case a "build subgroup" mode).
> 
> If it were me, I'd have two lists: a master list and a sub-group list.
> Drag items from the master to the group, and allow drag reordering of
> the group to set the sequence. As a short-cut you could allow a double-
> click on an item in the master list to add it to the end of the
> subgroup, which almost duplicates the current approach but with a
> double-click instead of a single, yet avoids the mode.
> 
> Just a thought ;-)
> 
> --Graham
> 
>   
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/chris%40clwill.com
> 
> This email sent to ch...@clwill.com

___

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

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

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

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


Re: Problem writing unit tests - "Incompatible types in initialization"

2009-10-25 Thread Chris Hanson
On Oct 25, 2009, at 1:08 PM, Ian Piper wrote:

> testConverter = Converter.new;

Dot syntax is for accessing state (properties) of objects, not for invoking 
behavior.

This should be either

testConverter = [Converter new];

or

testConverter = [[Converter alloc] init];

to indicate that it’s invoking behavior rather than accessing state on the 
Converter class itself.

  — Chris

___

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

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

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

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


Odd window behavior LSUIElement=1

2009-10-27 Thread Chris Idou


I have an app running without dock icon, and it exhibits odd behavior.

Let's say I have existing applications running, "A" with a window on top of 
application "B". My program pops up a window and forces it to the front. So I 
have "MyApp" on top of "A" on top of "B". Now I click on Application "A", 
bringing it to the front. Now I have "A" on top of "MyApp" on top of "B". Now I 
quit "A". As I quit "A", "MyApp" suddenly pops behind "B".

The same thing happens whether I programmatically forced "MyApp" to the front, 
or whether I bring it to the front by clicking on it. It doesn't happen when I 
run LSUIElement=0

Can anyone tell me what is going on?


  
__
Get more done like never before with Yahoo!7 Mail.
Learn more: http://au.overview.mail.yahoo.com/
___

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

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

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

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


Of FontManagers and responder chains

2009-10-29 Thread Chris Idou


I am trying to implement choosing default fonts, as found in the OS-X 10.6 
version of TextEdit's Preferences dialog.

i.e., you press a button, and it brings up the Font Chooser, and you select a 
font and it shows the name of the font in the dialog.

Now I thought I had it all working, but the trouble is I have the option in 
System Preferences, Keyboard prefs called "Full Keyboard Access" to allow focus 
in all controls. When I turn that option off, nothing in my dialog has explicit 
focus, and so it seems, changeFont: is never called, presumably because my 
delegate object for the window is not in the responder chain. I've tried to 
explicitly make my window the first responder, and to make the button the first 
responder, but apparently no dice, they are not allowed to be first responder, 
or even in the responder chain, because they have no focusable objects.

I could change the action for NSFontManager, but this breaks things for other 
uses of the NSFontManager, and seems like a bad idea. I notice that TextEdit 
when you press a change font in TextEdit Preferences it explicitly makes the 
text fields to NOT be first responder, so it seems like it is also using the 
first responder mechanism to make it work. But I can't seem to.


  
__
Get more done like never before with Yahoo!7 Mail.
Learn more: http://au.overview.mail.yahoo.com/
___

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

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

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

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


Re: why use pow(x, 2)?

2009-11-02 Thread Chris Williams
How completely rude of you, Greg, to confuse a good argument with facts :)

But it still does leave the style question: is pow(x,2) clearer than x*x?

In the case from the OP, I think that the pow is clearer, because it is
implementing an algorithm that calls specifically for x-squared.  And in the
case where x is not a simple variable, but rather an expression, it's even
more clear (and less prone to typing errors).

My $0.02...

> From: Greg Parker 
> Subject: Re: why use pow(x, 2)?
> 
> This is easy to test empirically. In this simple case, the compiler
> does optimize pow(x, 2) directly to a single-instruction x*x.
> 
> % cat test.c
> #include 
> int main(int argc, char **argv) {
>  return pow(argc, 2);
> }
> % cc -O3 test.c -o - -S
> [...]
> _main:
> LFB17:
> pushq %rbp// build stack frame
> LCFI0:
> movq %rsp, %rbp   // build stack frame
> LCFI1:
> cvtsi2sd %edi, %xmm0  // convert int argc to float
> mulsd %xmm0, %xmm0  // pow(argc, 2)
> cvttsd2si %xmm0, %eax  // convert float->int for return
> leave
> ret

___

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

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

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

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


NSOperationQueue for NSXMLParser object

2009-11-05 Thread Chris Purcell
Let me start with what I'm trying to accomplish.  I have an app that  
is constantly running an animation, which's attributes are determined  
after downloading and parsing some XML.  The XML is parsed at a given  
interval using an NSTimer.  As expected, sometimes when the XML is  
being parsed the animation stalls.  I've determined that I'll need to  
do the parsing on a separate thread from the main thread (Unless there  
is a better solution?).


I'm running into some problems using NSOperation with a NSTimer.  Here  
are some portions of the code:

//From the App delegate

//create a timer to parse the XML
self.timer = [NSTimer scheduledTimerWithTimeInterval: 2

  target: self

selector: @selector(parseXML:)

userInfo: nil

 repeats: YES]; 

//Parse the XML
- (void) parseXML:(NSTimer *)timer {
		XMLParser *parser = [[XMLParser alloc] initWithURL:@"Location of the  
XML" delegate:self];

[queue addOperation:parser];
[parser release]; //this is where my problem is
}


XMLParser is a subclass of NSOperation, here is some of that class.

- (void)main {
[self startParsing]; //this method starts the parsing   
 }

 When the parsing is complete, I use this code to send the result  
back to the delegate object:

//sends the result back to the delegate
if ( [delegate respondsToSelector:@selector(status:)] ) {
[delegate status:self.result];  
}

This code works, as long as I don't release the parser object after  
this:


[queue addOperation:parser];
[parser release];

However, if I don't release the Parser object, the app leaks like  
crazy, since it's creating new Parser objects on each fire of the  
timer.  When I release the parser, the second fire the app terminates:  
"Program received signal:  “EXC_BAD_ACCESS”.".


Thank you for any advice!









___

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

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

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

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


Re: Hardware UUID

2009-11-09 Thread Chris Parker
Please remember that gethostuuid() has all the same caveats mentioned  
in TN1103.


.chris

On 8 Nov 2009, at 3:13 PM, Grigutis, John A wrote:


Also look at gethostuuid:

int gethostuuid(uuid_t id, const struct timespec *wait)

I don't think it was around when that technote was last updated.

--  
John Anthony Grigutis

Systems Analyst/Programmer/Mac Specialist
Indiana University : UITS : Communication & Support : SDD

On Nov 8, 2009, at 3:53 PM, Brent Smith wrote:


Thanks Jerry,
This is exactly what I needed.

On Nov 8, 2009, at 12:14 PM, Jerry Krinock wrote:



On 2009 Nov 08, at 11:05, Brent Smith wrote:


Is there a simple way to obtain and hardware uuid of the mac?


Read this first:

http://developer.apple.com/mac/library/technotes/tn/tn1103.html
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/liarepmi
%40hack3r.com

This email sent to liare...@hack3r.com


___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/grigutis
%40indiana.edu

This email sent to grigu...@indiana.edu


___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/ctp%40apple.com

This email sent to c...@apple.com


___

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

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

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

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


Re: Should I learn CoreData for this project?

2009-11-10 Thread Chris Hanson
On Nov 10, 2009, at 8:15 AM, Ruotger Skupin wrote:

> True, but as I found out the hard way, using Core Data multithreaded and 
> Bindings at the same time is a very bad idea and will lead you into a world 
> of pain. 

This is part of the reason for Core Data’s recommended thread isolation policy: 
Use a separate NSManagedObjectContext per thread.

If you follow this recommendation, instead of attempting to share objects from 
a single context between multiple threads, then there should be no problems 
using Core Data multithreaded.

  — Chris

___

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

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

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

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


Performance

2009-11-15 Thread Chris Carson
Hi all,

A performance related question:

I've written a Cocoa app that continuously reads data from a USB device and 
plots it on a graph. It consists of three of my own classes.

The first class is the model that submits asynchronous bulk reads to the USB 
device. The callback for these reads copies the received data from the buffer 
asynchronous filled by the request and into an NSData object that is allocated 
and added to an NSArray. The buffer that the asynchronous request was using is 
recycled into a new asynchronous request. So the pool of buffers is allocated 
once and reused while the NSData objects are continuously allocated and 
deallocated (when released by the controller).

The second class is the view that uses an NSTimer to call [self 
setNeedsDisplay:YES] 24 times per second. The drawRect: method requests data 
from the data source (the third, controller class) and draws it with OpenGL.

The third class is the controller class that serves as a data source for the 
view. When the view calls the giveMeData: method, the controller class calls 
the buffer: method in the model class, which removes and returns the oldest 
NSData object in its NSArray. The controller then does some computations on it 
and passes it off to the view in a new NSData object.

The application runs pretty well, and running it through the Leaks instrument 
there are no leaks except for 16-bytes when the application is first starting 
caused by IOUSBLib. However, looking at it in the Activity Monitor, the real 
memory used starts off at 25 MB and steadily grows to 250+ MB while the virtual 
memory starts off at about the same and steadily grows to about the same or 
sometimes close to 500MB, over the course of several minutes. This especially 
happens if I don't move the mouse for a while, or don't have the application in 
focus. As soon as a move the mouse or bring the application into focus, it's as 
if an autorelease pool is drained and the memory drops back down to 30-40MB 
real and 30-40MB virtual. This is annoying since the application hangs for 5 
seconds or so when this memory draining is occurring. Has anyone dealt with 
this before? Any ideas on what could be causing this and how to work around it?


Another related question:

The number of asynchronous requests that the driver submits at once and the 
maximum number of objects in the NSArray are set to some constant. Now in 
theory, the requests should be added and drained "simultaneously" (i.e. by 
separate threads), but if I make this constant larger, I notice a greater delay 
between when data entering the USB device and being plotted. It's as if the 
asynchronous requests are being filled and added to the NSArray all in a group, 
and then drained by the view all in a group... maybe? Is this something subtle 
from the way run loops work? Is the USB asynchronous bulk read run loop source 
on the same thread as the view class's drawRect method?


My apologies for the length of this post and if the USB stuff isn't strictly 
Cocoa related, but since it's so intertwined with Cocoa classes, I figured this 
was the best place to ask. Advice is much appreciated. Please CC me on replies.

Chris


  

___

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

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

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

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


Advice about crash requested

2009-11-19 Thread Chris Idou



I've got a user getting the following crash, and I don't know what to make of 
it because it all happens in Apple code. Has anyone got any advice?



Process: XXX [242]
Path:/Applications/XXX.app/Contents/MacOS/XXX
Identifier:  XXX
Version: 1.19 (19)
Code Type:   X86-64 (Native)
Parent Process:  launchd [180]

Date/Time:   2009-11-15 23:34:52.052 -0500
OS Version:  Mac OS X 10.6.2 (10C540)
Report Version:  6

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x000b
Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Application Specific Information:
objc_msgSend() selector name: invalidate
NSTextAttachmentImageView
objc[242]: garbage collection is ON

Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   libobjc.A.dylib   0x7fff85a4210a objc_msgSend + 22
1   com.apple.AppKit  0x7fff8169871e 
-[NSImageCell(NSPrivateAnimationSupport) _stopAnimation] + 43
2   com.apple.AppKit  0x7fff819b60c2 -[NSImageView finalize] + 
26
3   libobjc.A.dylib   0x7fff85a48f67 finalizeOneObject + 48
4   libauto.dylib 0x7fff85b113d5 
Auto::foreach_block_do(auto_zone_cursor*, void (*)(void*, void*), void*) + 85
5   libobjc.A.dylib   0x7fff85a48b5c batchFinalize + 64
6   libobjc.A.dylib   0x7fff85a48e00 batchFinalizeOnMainThread 
+ 87
7   libSystem.B.dylib 0x7fff879e3ce8 
_dispatch_call_block_and_release + 15
8   libSystem.B.dylib 0x7fff879c287a _dispatch_queue_drain + 251
9   libSystem.B.dylib 0x7fff879c3127 
_dispatch_queue_serial_drain_till_empty + 9
10  libSystem.B.dylib 0x7fff879f5e4c 
_dispatch_main_queue_callback_4CF + 37
11  com.apple.CoreFoundation  0x7fff86c99b00 __CFRunLoopRun + 2560
12  com.apple.CoreFoundation  0x7fff86c98c2f CFRunLoopRunSpecific + 575
13  com.apple.HIToolbox   0x7fff865b9a4e RunCurrentEventLoopInMode 
+ 333
14  com.apple.HIToolbox   0x7fff865b9853 ReceiveNextEventCommon + 
310
15  com.apple.HIToolbox   0x7fff865b970c 
BlockUntilNextEventMatchingListInMode + 59
16  com.apple.AppKit  0x7fff815f31f2 _DPSNextEvent + 708
17  com.apple.AppKit  0x7fff815f2b41 -[NSApplication 
nextEventMatchingMask:untilDate:inMode:dequeue:] + 155
18  com.apple.AppKit  0x7fff815b8747 -[NSApplication run] + 395
19  XXX 0x00010eea main + 76
20  XXX 0x00010e7c start + 52

Thread 1:  Dispatch queue: com.apple.libdispatch-manager
0   libSystem.B.dylib 0x7fff879c0bba kevent + 10
1   libSystem.B.dylib 0x7fff879c2a85 _dispatch_mgr_invoke + 154
2   libSystem.B.dylib 0x7fff879c275c _dispatch_queue_invoke + 
185
3   libSystem.B.dylib 0x7fff879c2286 _dispatch_worker_thread2 + 
244
4   libSystem.B.dylib 0x7fff879c1bb8 _pthread_wqthread + 353
5   libSystem.B.dylib 0x7fff879c1a55 start_wqthread + 13

Thread 2:
0   libSystem.B.dylib 0x7fff879a7e3a mach_msg_trap + 10
1   libSystem.B.dylib 0x7fff879a84ad mach_msg + 59
2   com.apple.CoreFoundation  0x7fff86c997a2 __CFRunLoopRun + 1698
3   com.apple.CoreFoundation  0x7fff86c98c2f CFRunLoopRunSpecific + 575
4   com.apple.Foundation  0x7fff82021a24 -[NSRunLoop(NSRunLoop) 
runMode:beforeDate:] + 270
5   au.com.tech.CocoaTools0x000101f152af -[InfiniteThread main] + 
171
6   AutoFilerPlugin   0x00010352040c -[FilerExecutor main] + 72
7   com.apple.Foundation  0x7fff81fe6e99 __NSThread__main__ + 1429
8   libSystem.B.dylib 0x7fff879e0f8e _pthread_start + 331
9   libSystem.B.dylib 0x7fff879e0e41 thread_start + 13

Thread 3:  Dispatch queue: Garbage Collection Work Queue
0   libSystem.B.dylib 0x7fff879e29ee __semwait_signal + 10
1   libSystem.B.dylib 0x7fff879e67f1 _pthread_cond_wait + 1286
2   libobjc.A.dylib   0x7fff85a48cd8 batchFinalizeOnTwoThreads 
+ 250
3   libauto.dylib 0x7fff85b0b1e7 
Auto::Zone::invalidate_garbage(unsigned long, unsigned long const*) + 71
4   libauto.dylib 0x7fff85afbbd1 
auto_collect_internal(Auto::Zone*, unsigned int) + 481
5   libauto.dylib 0x7fff85afc16d 
auto_collection_work(Auto::Zone*) + 157
6   libSystem.B.dylib 0x7fff879e3ce8 
_dispatch_call_block_and_release + 15
7   libSystem.B.dylib 0x7fff879c287a _dispatch_queue_drain + 251
8   libSystem.B.dylib 0x7fff879c26dc _dispatch_queue_invoke + 57
9   libSystem.B.dylib 0x7fff879c2286 _dispatch_worker_thread2 + 
244
10  libSystem.B.dylib 0x7fff879c1bb8 _pthread_wqthread + 353
11  libSy

tiffs on pasteboard

2009-11-19 Thread Chris Idou


I'm trying to read a TIFF off the pasteboard, but it doesn't seem to work for 
me. What I'm doing is going into Finder, finding a TIFF file and Command-C it.

Among other types I then find on the pasteboard are:
NeXT TIFF v4.0 pasteboard type
and
public.tiff

If I take either of those from the pasteboard and write the NSData object to a 
file:

[content writeToFile:@"/tmp/foo.tiff"atomically:YES];

or else if I make an NSImage from the data:
[[NSImagealloc] initWithData:content]

and display it in an NSImageView then I always see the generic TIFF icon, i.e. 
the one with a photo of a child scattered on the table, with a loupe on top of 
it.

The same thing happens for JPEGs, GIFS and PNGs, but not for com.apple.icns. If 
I take the com.apple.icns, it displays correctly.

What am I doing wrong?


  
__
Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7.
Enter now: http://au.docs.yahoo.com/homepageset/
___

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

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

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

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


Re: Advice about crash requested

2009-11-19 Thread Chris Idou



Mainly stuff to do with examining files, and on the odd occasion it needs to do 
anything in the GUI it executes it on the main thread.





From: David Duncan 
To: Chris Idou 
Cc: cocoa-dev@lists.apple.com
Sent: Fri, 20 November, 2009 11:21:58 AM
Subject: Re: Advice about crash requested

On Nov 19, 2009, at 4:18 PM, Chris Idou wrote:

> I've got a user getting the following crash, and I don't know what to make of 
> it because it all happens in Apple code. Has anyone got any advice?


What are you doing on Thread 2 ([FilerExecutor main])?
--
David Duncan
Apple DTS Animation and Printing


  
__
Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7.
Enter now: http://au.docs.yahoo.com/homepageset/
___

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

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

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

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


Re: tiffs on pasteboard

2009-11-19 Thread Chris Idou


If I double click the tiff in Finder, and open it in Preview, click it in 
Preview, Command-A, Command-C, the same thing happens.





From: Kyle Sluder 
To: Chris Idou 
Cc: cocoa-dev@lists.apple.com
Sent: Fri, 20 November, 2009 11:36:54 AM
Subject: Re: tiffs on pasteboard

On Thu, Nov 19, 2009 at 4:33 PM, Chris Idou  wrote:
> I'm trying to read a TIFF off the pasteboard, but it doesn't seem to work for 
> me. What I'm doing is going into Finder, finding a TIFF file and Command-C it.

You've copied the file icon.  If you want to copy the file's data, you
need to open it in Preview and copy that.

--Kyle Sluder



  
__
Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7.
Enter now: http://au.docs.yahoo.com/homepageset/
___

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

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

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

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


Re: tiffs on pasteboard

2009-11-19 Thread Chris Idou


I notice that at least com.apple.icns works when I copy it from Preview, but it 
doesn't work when just copying from Finder.

But either way TextEdit seems to be able to get the right thing if I paste into 
it.





From: Chris Idou 
To: Kyle Sluder 
Cc: cocoa-dev@lists.apple.com
Sent: Fri, 20 November, 2009 11:43:17 AM
Subject: Re: tiffs on pasteboard



If I double click the tiff in Finder, and open it in Preview, click it in 
Preview, Command-A, Command-C, the same thing happens.





From: Kyle Sluder 
To: Chris Idou 
Cc: cocoa-dev@lists.apple.com
Sent: Fri, 20 November, 2009 11:36:54 AM
Subject: Re: tiffs on pasteboard

On Thu, Nov 19, 2009 at 4:33 PM, Chris Idou  wrote:
> I'm trying to read a TIFF off the pasteboard, but it doesn't seem to work for 
> me. What I'm doing is going into Finder, finding a TIFF file and Command-C it.

You've copied the file icon.  If you want to copy the file's data, you
need to open it in Preview and copy that.

--Kyle Sluder



  
__
Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7.
Enter now: http://au.docs.yahoo.com/homepageset/
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/idou747%40yahoo.com

This email sent to idou...@yahoo.com



  
__
Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7.
Enter now: http://au.docs.yahoo.com/homepageset/
___

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

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

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

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


Re: tiffs on pasteboard

2009-11-19 Thread Chris Idou


OK, its working now as far as copying from Preview. Not sure what happened 
there.

But I'm still confused about one thing: If copying from Finder actually copies 
the file icon, and not the actual tiff, how come it pastes ok into TextEdit?




From: Jens Alfke 
To: Chris Idou 
Cc: Kyle Sluder ; cocoa-dev@lists.apple.com
Sent: Fri, 20 November, 2009 12:11:34 PM
Subject: Re: tiffs on pasteboard


On Nov 19, 2009, at 4:43 PM, Chris Idou wrote:

> If I double click the tiff in Finder, and open it in Preview, click it in 
> Preview, Command-A, Command-C, the same thing happens.

That's weird. Can you show us the code that reads the image data off the 
pasteboard?

—Jens


  
__
Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7.
Enter now: http://au.docs.yahoo.com/homepageset/
___

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

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

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

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


Re: Advice about crash requested

2009-11-19 Thread Chris Idou


This will help if I'm ever able to repeat it. Right now its just a user report 
and I can't repeat it.





From: Sean McBride 
To: Jens Alfke ; Chris Idou 
Cc: cocoa-dev@lists.apple.com
Sent: Fri, 20 November, 2009 12:03:33 PM
Subject: Re: Advice about crash requested

On 11/19/09 4:54 PM, Jens Alfke said:

>On Nov 19, 2009, at 4:18 PM, Chris Idou wrote:
>
>> Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
>> 0   libobjc.A.dylib   0x7fff85a4210a objc_msgSend + 22
>> 1   com.apple.AppKit  0x7fff8169871e -[NSImageCell
>(NSPrivateAnimationSupport) _stopAnimation] + 43
>> 2   com.apple.AppKit  0x7fff819b60c2 -[NSImageView
>finalize] + 26
>
>Looks like NSImageCell is calling a bogus object, probably one that's
>already been freed. That's sort of unusual for a GC'd app -- usually this
>indicates a ref-counting bug. You're not calling AppKit from a
>background thread, are you?
>
>Turning on NSZombieEnabled might help shed some light on this.

It won't, because NSZombieEnabled does nothing in GC apps. :(

>There's a
>"So, You've Crashed In objc_msgsend" FAQ out there on teh interwebz
>somewhere that goes into more detail on troubleshooting.

It's here:
<http://www.sealiesoftware.com/blog/archive/2008/09/22/
objc_explain_So_you_crashed_in_objc_msgSend.html>

--

Sean McBride, B. Engs...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


  
__
Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7.
Enter now: http://au.docs.yahoo.com/homepageset/
___

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

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

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

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


Re: tiffs on pasteboard

2009-11-19 Thread Chris Idou



But what are the rules and conventions? Why would Finder put the icon in the 
pasteboard on the assumption that is what the user wants, but TextEdit would 
paste in the actual file on the assumption that is what the user wants? It 
seems schizophrenic. I just want a list of rules of how to use the Pasteboard 
in a way that conforms to what users expect. If I start ignoring the TIFF part 
of the pasteboard in favor of the URL on the assumption that is what the user 
wants, why is the tiff there anyway? And will that get me into trouble in other 
cases?





From: Jens Alfke 
To: Chris Idou 
Cc: Kyle Sluder ; cocoa-dev@lists.apple.com
Sent: Fri, 20 November, 2009 12:29:51 PM
Subject: Re: tiffs on pasteboard


On Nov 19, 2009, at 5:24 PM, Chris Idou wrote:

> But I'm still confused about one thing: If copying from Finder actually 
> copies the file icon, and not the actual tiff, how come it pastes ok into 
> TextEdit?

The Finder also puts the location of the file on the pasteboard, and I believe 
TextEdit sees that, recognizes that it's an image file, and reads the file into 
an image. You can do the same fairly easily.

—Jens


  
__
Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7.
Enter now: http://au.docs.yahoo.com/homepageset/
___

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

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

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

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


asl_log aborts the program?

2009-11-19 Thread Chris Idou


I've got a report from a user of my program crashing.

In the console they are getting this:

11/19/09 3:08:46 PM[0x0-0x18a18a]Progname[8699]Progname(8699,0x1167b) 
malloc: *** error for object 0x100563870: pointer being freed was not allocated
11/19/09 3:08:46 PM[0x0-0x18a18a] Progname[8699]*** set a breakpoint in 
malloc_error_break to debug

And in the crash report:

Process: Progname [11128]
Path:/Applications/Progname.app/Contents/MacOS/Progname
Identifier:  Progname
Version: 1.19 (19)
Code Type:   X86-64 (Native)
Parent Process:  launchd [180]

Date/Time:   2009-11-19 17:40:42.570 -0500
OS Version:  Mac OS X 10.6.2 (10C540)
Report Version:  6

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x, 0x
Crashed Thread:  2

Application Specific Information:
abort() called
objc[11128]: garbage collection is ON

Thread 0:  Dispatch queue: com.apple.main-thread
0   libSystem.B.dylib 0x7fff879a7e3a mach_msg_trap + 10
1   libSystem.B.dylib 0x7fff879a84ad mach_msg + 59
2   com.apple.CoreFoundation  0x7fff86c997a2 __CFRunLoopRun + 1698
3   com.apple.CoreFoundation  0x7fff86c98c2f CFRunLoopRunSpecific + 575
4   com.apple.HIToolbox   0x7fff865b9a4e RunCurrentEventLoopInMode 
+ 333
5   com.apple.HIToolbox   0x7fff865b9853 ReceiveNextEventCommon + 
310
6   com.apple.HIToolbox   0x7fff865b970c 
BlockUntilNextEventMatchingListInMode + 59
7   com.apple.AppKit  0x7fff815f31f2 _DPSNextEvent + 708
8   com.apple.AppKit  0x7fff815f2b41 -[NSApplication 
nextEventMatchingMask:untilDate:inMode:dequeue:] + 155
9   com.apple.AppKit  0x7fff815b8747 -[NSApplication run] + 395
10  Progname 0x00010eea main + 76
11  Progname 0x00010e7c start + 52

Thread 1:  Dispatch queue: com.apple.libdispatch-manager
0   libSystem.B.dylib 0x7fff879c0bba kevent + 10
1   libSystem.B.dylib 0x7fff879c2a85 _dispatch_mgr_invoke + 154
2   libSystem.B.dylib 0x7fff879c275c _dispatch_queue_invoke + 
185
3   libSystem.B.dylib 0x7fff879c2286 _dispatch_worker_thread2 + 
244
4   libSystem.B.dylib 0x7fff879c1bb8 _pthread_wqthread + 353
5   libSystem.B.dylib 0x7fff879c1a55 start_wqthread + 13

Thread 2 Crashed:
0   libSystem.B.dylib 0x7fff87a7784d usleep$NOCANCEL + 0
1   libSystem.B.dylib 0x7fff87a96e3c abort + 93
2   libSystem.B.dylib 0x7fff879ae155 free + 128
3   libSystem.B.dylib 0x7fff879fa16e asl_set_query + 572
4   libSystem.B.dylib 0x7fff87a16239 asl_send + 824
5   libSystem.B.dylib 0x7fff87a15e56 asl_vlog + 570
6   libSystem.B.dylib 0x7fff87a15c19 asl_log + 153
7   Progname.CocoaTools0x000104567101 -[Log 
vlogLevel:format:arguments:] + 270
8   Progname.CocoaTools0x00010456730c -[Log notice:] + 164
etc

Does this look like an Apple bug? It looks to me like the asl subsystem is 
freeing something it shouldn't and aborting the program.


  
__
Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7.
Enter now: http://au.docs.yahoo.com/homepageset/
___

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

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

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

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


Re: tiffs on pasteboard

2009-11-20 Thread Chris Idou



I thought the solution to big files was to use pasteboard promises... not to 
setup a pasteboard which is  conflicted about what item it is trying to store. 
At least that's what I find documented by Apple.





From: Alexander Spohr 
To: Chris Idou 
Cc: Jens Alfke ; cocoa-dev@lists.apple.com
Sent: Fri, 20 November, 2009 7:00:18 PM
Subject: Re: tiffs on pasteboard


Am 20.11.2009 um 03:04 schrieb Chris Idou:

> But what are the rules and conventions? Why would Finder put the icon in the 
> pasteboard on the assumption that is what the user wants, but TextEdit would 
> paste in the actual file on the assumption that is what the user wants? It 
> seems schizophrenic.

Yeah. Copying a 20MB image to the pasteboard would be what the user wants. Or 
better one Gig of video. I think not.
You think like a user (who would assume that the file is really on the 
pasteboard) and not like a developer (who should know that the pasteboard 
content has to be lightweight).

> I just want a list of rules of how to use the Pasteboard in a way that 
> conforms to what users expect. If I start ignoring the TIFF part of the 
> pasteboard in favor of the URL on the assumption that is what the user wants, 
> why is the tiff there anyway?

The TIFF is a preview. The URL is the meat.

> And will that get me into trouble in other cases?

That depends only on the pasteboard provider. There is no strict rule. The 
provider does not know the recipient and therefore puts everything on the 
pasteboard that will satisfy the task the provider offers.

atze


  
__
Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7.
Enter now: http://au.docs.yahoo.com/homepageset/
___

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

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

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

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


Re: asl_log aborts the program?

2009-11-20 Thread Chris Idou


I just noticed something I didn't see before, namely that the doco says to call 
asl_open once for each thread, which I'm not doing. I guess this most likely is 
the cause.





From: Jeremy Pereira 
To: Chris Idou ; Cocoa Forum 
Cc: Jeremy Pereira 
Sent: Fri, 20 November, 2009 9:35:01 PM
Subject: Re: asl_log aborts the program?


On 20 Nov 2009, at 06:33, Chris Idou wrote:

> 
> 
> I've got a report from a user of my program crashing.
> 
> In the console they are getting this:
> 
> 11/19/09 3:08:46 PM[0x0-0x18a18a]Progname[8699]Progname(8699,0x1167b) 
> malloc: *** error for object 0x100563870: pointer being freed was not 
> allocated
> 11/19/09 3:08:46 PM[0x0-0x18a18a] Progname[8699]*** set a breakpoint in 
> malloc_error_break to debug
> 
> 
> Thread 2 Crashed:
> 0   libSystem.B.dylib 0x7fff87a7784d usleep$NOCANCEL + 0
> 1   libSystem.B.dylib 0x7fff87a96e3c abort + 93
> 2   libSystem.B.dylib 0x7fff879ae155 free + 128
> 3   libSystem.B.dylib 0x7fff879fa16e asl_set_query + 572
> 4   libSystem.B.dylib 0x7fff87a16239 asl_send + 824
> 5   libSystem.B.dylib 0x7fff87a15e56 asl_vlog + 570
> 6   libSystem.B.dylib 0x7fff87a15c19 asl_log + 153
> 7   Progname.CocoaTools0x000104567101 -[Log 
> vlogLevel:format:arguments:] + 270
> 8   Progname.CocoaTools0x00010456730c -[Log notice:] + 164
> etc
> 
> Does this look like an Apple bug? It looks to me like the asl subsystem is 
> freeing something it shouldn't and aborting the program.
> 

Normally when I see crashes involving calls to methods with format strings, I 
immediately assume that the arguments following the the format string do not 
match the format specifiers in the format string. e.g. if -[Log notice:] is 
declared like this

-(void) notice: (NSString*) format, ...;

[log notice: @"blah blah blah %@ %s", "blah"];

The above line has an NSObject missing from its argument list.  There's also

[log notice: someNSStringofIndeterminateOrigin];

which may crash if the string contains format specifiers e.g. if it is a URL 
with % escapes in it.

So you probably want to check your calls to -[Log notice:].


> 
>  
> __
> Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7.
> Enter now: http://au.docs.yahoo.com/homepageset/
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/adc%40jeremyp.net
> 
> This email sent to a...@jeremyp.net


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__



  
__
Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7.
Enter now: http://au.docs.yahoo.com/homepageset/
___

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

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

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

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


Re: tiffs on pasteboard

2009-11-20 Thread Chris Idou


Well... now that in 10.6 the pasteboard types are UTI types, I'm not sure that 
one can say anymore that there is no mapping from files to pasteboard types. 
And 10.6 Finder puts a public.tiff into the pasteboard in this case, but I 
would argue it is the wrong tiff.





On Nov 20, 2009, at 1:35 AM, Chris Idou wrote:

> I thought the solution to big files was to use pasteboard promises... not to 
> setup a pasteboard which is  conflicted about what item it is trying to 
> store. At least that's what I find documented by Apple.

You're correct that promises would overcome some of the inefficiencies 
(although I can envision other situations where the size would be a problem.)

I suspect the real reason is that there isn't a straightforward mapping between 
file types and pasteboard types. There is not in general any table that says "a 
file with extension ".foo" contains data that can be stored in a pasteboard 
using type 'FooPasteboardType'"; so the Finder would not be able to decide in 
all cases what pasteboard type to use for the contents of the dragged/copied 
file.*

You could argue that images are a useful special case; but I suspect that the 
engineers responsible decided that it was better to remain consistent..

(And actually, it doesn't even work for all image types. The old Mac 'PICT' 
format is infamous for having a slightly different representation in memory 
than in a file, so you can't just slurp a PICT file into the pasteboard and 
have it be useable.)

—Jens

* Especially for package file types that are actually directories; would the 
rule be to create a Zip archive? :-P


  
__
Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7.
Enter now: http://au.docs.yahoo.com/homepageset/
___

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

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

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

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


core data and migration

2009-11-22 Thread Chris Idou


If I have versions of my model, A, B and C, do I only need a mapping model from 
A->B and B->C, and if someone wants to upgrade A->C is core data smart enough 
to do the two migrations, or do I need a separate mapping model from A->C ?


  
__
Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7.
Enter now: http://au.docs.yahoo.com/homepageset/
___

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

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

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

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


Re: Better sorting using threads?

2010-03-12 Thread Chris Ridd

On 12 Mar 2010, at 20:20, Kyle Sluder wrote:

> On Fri, Mar 12, 2010 at 11:55 AM, Andrew James  
> wrote:
>> I've made the assumption that NSArray wraps an old school contiguous C-style 
>> array ( ala C++ std:::vector )
> 
> This assumption is false.

There was a good analysis of NSArrays at 
<http://ridiculousfish.com/blog/archives/2005/12/23/array/>

Cheers,

Chris
___

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

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

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

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


Re: App modal window and secondary thread

2010-03-20 Thread Chris Hanson
On Mar 20, 2010, at 4:24 AM, Philippe Sismondi   
wrote:


Had I not been compelled to support OS X 10.4 I would have re- 
written the whole thing to use something better than threads - GCD  
or NSOperationQueue capabilities are said to be safer, although I  
have not yet learned them.


Let's nip this in the bud: NSOperation and GCD are not "safer than  
threads" -they *are* threads.


They are a more convenient API but they're still concurrent  
programming -and that's what's hard about programming against threads,  
not the API itself.


In particular, they *do not* insulate you from AppKit or Core Data's  
threading model. And a particular operation or dispatch to a  
concurrent queue can be served by any thread, without any strong  
binding to one thread (modulo the binding of the main queue to the  
main thread).


I would also not invoke abortModal on a background thread just as a  
matter of cleanliness. I'd implement a delegate/callback/notification  
for my background processor to tell whatever is controlling it that  
it's done. That's what would invoke abortModal - and it would do that  
on the main thread/queue.


  -- Chris

___

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

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

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

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


Re: Allowing incoming connections.

2010-03-25 Thread Chris Hanson
On Mar 24, 2010, at 1:15 AM, Ken Thomases wrote:

> You can work around this by signing your app properly as part of building it, 
> but I'm not sure it's common to sign development builds.

It’s somewhat common to sign debug builds of Internet applications, using a 
self-signing certificate:

http://www.red-sweater.com/blog/514/development-phase-code-signing

Note that the article predates some Xcode support for code signing.  With 
modern versions of Xcode — Xcode 3.1 and later, I believe — you don’t need to 
use a Run Script build phase to do the code signing.  Specify the identity in 
your build settings just like you would to debug your application on the iPhone 
and Xcode will sign it.

Release builds of applications that listen for connections and applications 
that use the Keychain really should be signed using a real certificate, to 
avoid prompting the user to re-authorize on every update to the application.

  — Chris

___

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

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

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

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


NSImageView Will Not Alias Images

2010-04-06 Thread Chris Tracewell
I am trying to get NSImageView to alias dropped images, but it  
refuses. Just spent an hour looking and trying several variations to  
no avail. Here's what I have done in a subclass of NSImageView.


-(void)drawRect:(NSRect)rect
{   
	[[NSGraphicsContext currentContext]  
setImageInterpolation:NSImageInterpolationHigh];

[[NSGraphicsContext currentContext] setShouldAntialias:YES];

[super drawRect:rect];
}

I have assigned the ImageView in IB my subclass and used NSLog to  
verify that it is drawing through the above drawRect method of my  
subclass - but the images (PNG screen captures) will not alias.


Any suggestions?
___

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

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

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

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


Tricky binding and continuous update problem

2010-04-06 Thread Chris Idou


I've got a problem that I had working, but my app suddenly seems broken, and 
I'm not sure if I did something or what. All I know is old versions of my app 
work, but now my code base doesn't.

I've got a UI with a NSTableView at the top, and some individual fields at the 
bottom. Typical UI where you click on a table row and it shows you the values 
in the fields.

Now one of the fields shown in the table is a derived value from the base 
fields. I have continuous update values set in the NSTextField at the bottom. 
So what I expect as you type in the field, the value in the table gets 
continuously updated also. (I'm using keyPathsForValuesAffecting etc for 
the derived field).

But what's happening is if I type in the lower field, the value gets sent to 
the derived field in the table, but then Text field gets immediately set back 
to the original value. So the effect is you type one character and it is lost 
as far as the lower field is concerned, but the derived value in the table is 
updated. You can only ever change one character. And also the lower text field 
loses focus.

I've put break points in all the setters and getters, and there seems like no 
reason for this odd behavior. I can't see how the field would get set back to 
the old value.

If I turn off Continuously  Update Value, it works sensibly, albeit not as nice 
since you've got to exit the field to have everything in synch.

Any thoughts?




___

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

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

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

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


Re: NSImageView Will Not Alias Images

2010-04-06 Thread Chris Tracewell


On Apr 6, 2010, at 4:50 PM, Ken Ferry wrote:



On Tue, Apr 6, 2010 at 2:58 PM, Jens Alfke  wrote:

On Apr 6, 2010, at 1:17 PM, Chris Tracewell wrote:

I am trying to get NSImageView to alias dropped images, but it  
refuses.


Nitpick: you mean "antialias". Aliasing is what creates the jaggies,  
antialiasing smooths them away.



Just spent an hour looking and trying several variations to no  
avail. Here's what I have done in a subclass of NSImageView.


I remember having to deal with this too, years ago. It's too bad  
AppKit hasn't added support for this yet :(


The problem is that NSImageView internally keeps a scaled copy of  
the image. So the actual scaling that creates the aliasing isn't  
done in the drawRect: method at all.


This was once true, but is out of date.  I'd like to see a test  
app.  For example, how do you know you aren't getting antialiasing?   
It may be that you just don't like the output. :-)


Well - NSImageInterpolationHigh and NSImageInterpolationNone produce  
the same exact result - screen shot copy (control-command-shift-4) the  
imageView built once using NSImageInterpolationHigh  and once using  
NSImageInterpolationNone then paste each into a Photoshop layer, align  
them perfectly and then turn the top layer off and on at 800% and  
there is not a single pixel that moves or changes color.


The dropped image is roughly 1000 x 1000 (a screen shot PNG) and the  
imageView size is 200x200


To make sure the currentContext was correct - I log  
[[NSGraphicsContext currentContext] imageInterpolation] for each build  
and it shows the correct values 3 and 1 respectively. And then just to  
be super sure I I log [[NSGraphicsContext currentContext]  
isDrawingToScreen] inside drawRect of my NSImageView subclass and get  
YES.


I did implement my own image sizing in drawRect and then used [self  
setImage] and it works great. Not sure what could be the issue.




It would also be good to know what OS you are working on.

-Ken



I'm using 10.5.8. - XCode   3.1.2 - iMac Core 2 Duo and the app is GC.
___

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

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

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

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


Re: Tricky binding and continuous update problem

2010-04-06 Thread Chris Idou


I am using an NSArrayController.

I don't know, it seems to me like having everything always in synch is nicer. 
The user can see immediately how changing one field is affecting the other. And 
it used to work.



- Original Message 
From: Jerry Krinock 
To: Chris Idou 
Sent: Wed, 7 April, 2010 10:24:18 AM
Subject: Re: Tricky binding and continuous update problem


On 2010 Apr 06, at 16:36, Chris Idou wrote:

> If I turn off Continuously  Update Value, it works sensibly,

Turn it off.  Look at any of Apple's Sample Code.  Also, Cocoa Design Rule #1: 
If something is off/on by default, don't change it unless you're knowingly 
doing something weird.

> albeit not as nice since you've got to exit the field to have everything in 
> synch.

That's the way most apps work.

You did not mention using an array controller.  To insure data integrity in 
case user tabs out, abruptly closes the window, etc., do not bind directly to 
the model.  Instead, bind your text fields ("detail views") to an 
NSArrayController to which the table columns are also bound.  As a matter of 
fact, if you didn't use an array controller, you'd better look at Apple's 
DepartmentAndEmployees sample code and be prepared for a little re-work.  There 
may be a way to make your design paradigm work, but why bother?

The way I understand it, the NSArrayController superclass NSObjectController 
fulfills the same purpose of data integrity if you can't bind to an array 
controller, for example if you have an Inspector in another nib.  
NSObjectController seems like a heavy weight for this purpose, but it works.  
For an example of this, in DepartmentAndEmployees's MyDocument.nib, look at the 
NSObjectController named 'Department Controller'.  It seems like it's useless 
but it's not.

Probably someone else can give a more in-depth explanation.



___

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

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

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

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


Re: Tricky binding and continuous update problem

2010-04-06 Thread Chris Idou


How does it wreak havoc with undo? Undo seems to work still. In something like 
TextExpander, you change the textfield where your expansion goes, and the table 
in the left hand side changes as you type. That's what I was aiming for.

But I've found why it suddenly stopped working. I stumbled upon the URL below. 
Apparently the "Automatically rearrange content" for the NSArrayController 
makes this all go awry. It seems like I can choose between auto rearrange 
content, or continuously update values, but not both. Don't know if this is a 
bug or if there is some reason for it.


http://stackoverflow.com/questions/1028700/core-data-strange-bindings-error-on-re-opening-a-document-help




- Original Message ----
From: Kyle Sluder 
To: Chris Idou 
Cc: Jerry Krinock ; cocoa-dev@lists.apple.com
Sent: Wed, 7 April, 2010 11:21:28 AM
Subject: Re: Tricky binding and continuous update problem

On Tue, Apr 6, 2010 at 5:28 PM, Chris Idou  wrote:
> I don't know, it seems to me like having everything always in synch is nicer. 
> The user can see immediately how changing one field is affecting the other. 
> And it used to work.

That will wreak havoc with Undo. Continuously updating values is not
pretty, and it's not how text fields behave on the Mac. Rich text does
behave as you describe, but you can't use bindings for that.

Avoid fighting the framework. ;-)

--Kyle Sluder





___

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

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

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

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


Reordered columns and [tableView editColumn:0 row:ind withEvent:nil select:YES];

2010-04-07 Thread Chris Idou


I've got some code that uses editColumn:0 to force the user into edit mode on 
the first column.

But I've noticed that if user column reordering is allowed, this no longer 
edits the correct column. This seems odd to me because I thought Cocoa pretty 
much shielded the programmer from all the user reordering stuff.

Even more oddly, if the user puts a checkbox as the first column, the checkbox 
seems to start behaving like a text box, albeit with invisible characters. 
Could I be doing something wrong, or is this some kind of bug? And do I have to 
somehow translate column 0 to find out the real column? I know Java tables have 
methods to translate between model and view column numbers because of user 
reordering, but I haven't noticed such a thing in Cocoa.




___

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

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

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

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


NSTableView Key Value Observing performance pickle

2010-04-08 Thread Chris Idou


I seem to have got myself into some pickle with key value observing whereby 
things to do with NSTableView are freezing up for minutes at a time. Every time 
I pause the program there are things to do with adding and removing observers, 
but all of it is in Apple's code, so I'm not quite sure what I've done to cause 
this problem.





#00x7fff8453d06b in append_referrer_no_lock
#10x7fff8453ea58 in weak_register
#20x7fff845366e2 in auto_assign_weak_reference
#30x7fff81d6a36e in -[NSConcretePointerArray arrayGrow:]
#40x7fff81c64cdd in -[NSConcretePointerArray addPointer:]
#50x7fff81c6aa99 in -[NSKeyValueObservationInfo _initWithObservances:count:]
#60x7fff81c70399 in _NSKeyValueObservationInfoCreateByRemoving
#70x7fff81c6fcfe in -[NSObject(NSKeyValueObserverRegistration) 
_removeObserver:forProperty:]
#80x7fff81c6fc3f in -[NSObject(NSKeyValueObserverRegistration) 
removeObserver:forKeyPath:]
#90x7fff81c70522 in -[NSKeyValueNestedProperty 
object:didRemoveObservance:recurse:]
#100x7fff81c7077f in -[NSKeyValueUnnestedProperty 
object:didRemoveObservance:recurse:]
#110x7fff81c6fd5b in -[NSObject(NSKeyValueObserverRegistration) 
_removeObserver:forProperty:]
#120x7fff81c6fc3f in -[NSObject(NSKeyValueObserverRegistration) 
removeObserver:forKeyPath:]
#130x7fff81c70522 in -[NSKeyValueNestedProperty 
object:didRemoveObservance:recurse:]
#140x7fff81c7077f in -[NSKeyValueUnnestedProperty 
object:didRemoveObservance:recurse:]
#150x7fff81c6fd5b in -[NSObject(NSKeyValueObserverRegistration) 
_removeObserver:forProperty:]
#160x7fff81c6fc3f in -[NSObject(NSKeyValueObserverRegistration) 
removeObserver:forKeyPath:]
#170x7fff810e23c7 in -[_NSModelObservingTracker 
_registerOrUnregister:observerNotificationsForModelObject:]
#180x7fff810e1a07 in -[_NSModelObservingTracker clearAllModelObjectObserving]
#190x7fff811bc4b3 in -[_NSModelObservingTracker 
setIndexReferenceModelObjectArray:clearAllModelObjectObserving:]
#200x7fff811bc44c in -[NSArrayController _setObjects:]
#210x7fff81255d9f in -[NSArrayController 
_arrangeObjectsWithSelectedObjects:avoidsEmptySelection:operationsMask:useBasis:]
#220x7fff811bc9ff in -[NSArrayController setContent:]
#240x7fff8125ad66 in -[NSArrayDetailBinder _refreshDetailContentInBackground:]
#250x7fff81c791a1 in -[NSObject(NSKeyValueObservingPrivate) 
_notifyObserversForKeyPath:change:]
#260x7fff810de96e in -[NSController _notifyObserversForKeyPath:change:]
#270x7fff811e8575 in -[NSArrayController 
didChangeValuesForArrangedKeys:objectKeys:indexKeys:]
#280x7fff811e894b in -[NSArrayController 
_selectObjectsAtIndexesNoCopy:avoidsEmptySelection:sendObserverNotifications:forceUpdate:]
#290x7fff81c6f43d in -[NSObject(NSKeyValueCoding) setValue:forKey:]
#300x7fff81ccdf42 in -[NSObject(NSKeyValueCoding) setValue:forKeyPath:]
#310x7fff8126a3ed in -[NSBinder 
_setValue:forKeyPath:ofObject:mode:validateImmediately:raisesForNotApplicableKeys:error:]
#320x7fff8126a2a5 in -[NSBinder setValue:forBinding:error:]
#330x7fff812655c8 in -[NSTableBinder tableView:didChangeToSelectedRowIndexes:]
#340x7fff81261e8f in -[_NSBindingAdaptor 
tableView:didChangeToSelectedRowIndexes:]
#350x7fff811368e2 in -[NSTableView _enableSelectionPostingAndPost]
#360x7fff811f8556 in -[NSTableView mouseDown:]
#370x7fff81199f1b in -[NSWindow sendEvent:]
#380x7fff810cf662 in -[NSApplication sendEvent:]




___

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

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

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

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


  1   2   3   4   5   6   7   8   9   10   >