Showing activity indicator during data download

2009-10-29 Thread DKJ

I've implemented an update button like this:

- (IBAction)updateButton:(id)sender
{
   [UIApplication sharedApplication].networkActivityIndicatorVisible  
= YES;

   [downloadIndicator startAnimating];

   [[DataManager sharedDataManager] updateDataFiles];

   [downloadIndicator stopAnimating];
   [UIApplication sharedApplication].networkActivityIndicatorVisible  
= NO;

}

And in the DataManager class I have this:

- (void)updateDataFiles
{
   NSString *dataString = [NSString stringWithContentsOfURL:url
  encoding:NSASCIIStringEncoding
  error:NULL];
}

I have the downloadIndicator connected up using IB, and I'm pretty  
sure the wiring is OK. But when the button is clicked, I see an  
activity indicator spinning in the status bar, but I don't see the one  
I implemented myself using IB.


I know it's got something to do with my updateDataFiles method not  
being asynchronous, but beyond that I'm at a loss. I'd really rather  
avoid writing the extra code to do the download using NSURLConnection  
mechanisms: the user can't do anything until the download finishes  
anyway.


I'd like to have an alert panel or the second activity indicator  
visible during the download. Can someone point me towards a simple  
solution?


dkj

PS: I've started reading the "Concurrency Programming Guide", but  
that's going to take awhile. And for all I know at present, the  
solution for this particular problem may not be in there.

___

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

Please do not post 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


NSTextFieldCell subclass hobbles the field editor

2009-10-29 Thread Jonathan Fewtrell
I have a subclass of NSTextFieldCell as the dataCell of an  
NSTableColumn. When I click on the cell to edit the text, the field  
editor appears, but instead of displaying the text that was in the  
cell it displays the word 'Field' and cannot be edited.


This happens even if the subclass is 'empty', ie, has no ivars and no  
methods. It also makes no difference whether I bind the table column  
or use a data source.


No console messages are generated.

Im mystified. Does the mere creation of a subclass cause the field  
editor to stop working properly?

___

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

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

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

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


how to filter available fonts for my application?

2009-10-29 Thread XiaoGang Li
I searched the lists before posting this question, and found that it is an
old topics, but I am still confused.

I have an application which can use only a subset of fonts installed in the
system. So, I need to filter my available fonts, and users just can see the
available fonts from the font panel when he or she click the show font menu.


the document says that before the NSFontPanel object adds a
particular font family or face to its list, the NSFontPanel asks its
delegate to confirm the addition by sending the delegate a
fontManager:willIncludeFont: message. But the  tells me that this delegate methods is not called in Mac OS X
version 10.3 and later.

I don't have any idea how to implement it now? does anyone know it? thanks
ahead!
___

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

Please do not post 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: Showing activity indicator during data download

2009-10-29 Thread DKJ

On 2009-10-29, at 0:30 , DKJ wrote:


- (IBAction)updateButton:(id)sender
{
  [UIApplication sharedApplication].networkActivityIndicatorVisible  
= YES;

  [downloadIndicator startAnimating];

  [[DataManager sharedDataManager] updateDataFiles];

  [downloadIndicator stopAnimating];
  [UIApplication sharedApplication].networkActivityIndicatorVisible  
= NO;

}



I replaced the line:

   [downloadIndicator startAnimating];

with this:

   NSInvocationOperation *theOp = [[[NSInvocationOperation alloc]  
initWithTarget:downloadIndicator

  selector:@selector(startAnimating) object:nil] autorelease];
   NSOperationQueue *theQ = [[[NSOperationQueue alloc] init]  
autorelease];

   [theQ addOperation:theOp];

and now it works just the way I want it to.

But am I taking a sledgehammer to a fly? Or have I found (quite by  
accident) the best way to do it?


dkj
___

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

Please do not post 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: Cocoa replacement for Carbon CompositeIconRef() for Snow Leopard 64-bit apps?

2009-10-29 Thread Peter N Lewis

On 28/10/2009, at 13:49 , Peter N Lewis wrote:
So in order to convert from using IconRef to using NSImage for  
everything (after loading the IconRef), I need to know how to:


a) composite two images, preferably while keeping the different  
resolutions of the icon

b) how to dim an image similarly to kTransformDisabled



Jim Correia put me on to MyCompositeImageRep, and after a fair amount  
of head scratching, I came up with the following solution.


Basically, use a subclass of NSCustomImageRep to hold the two images  
to be composited or the image to be dimmed, with a drawing method that  
draws the two images, or the image and then dims it.


It seems to work, although it crashes with over release issues if any  
of the images are copied (rather than just retained).  For the life of  
me I can't see where the memory management problem is in the code.   
Since the images are icons at their source, they are immutable anyway,  
so retaining works fine, but it does leave me a triffle concerned.   
I'm not even sure I haven't hit a system bug (I normally discount this  
possibly, since it is almost always wrong, but since I'm at this point  
because of a system bug in CompositeIconRef ...).  The weird stack  
trace I discovered is this:


#0  -[MyDimmedImageRep release] (self=0x104ff4430,  
_cmd=0x7fff87f9c968) at /Users/peter/Keyboard Maestro/Project/Source/ 
XCAF/XIcon.cpp:224

#1  0x7fff85e41851 in -[NSArray initWithArray:copyItems:] ()
#2  0x7fff879fa58c in __-[NSImage copyWithZone:]_block_invoke_2 ()
#3  0x7fff878781fa in -[NSImage _usingRepProviderPerformBlock:] ()
#4  0x7fff879fa3dd in -[NSImage copyWithZone:] ()

Why would  [NSArray initWithArray:copyItems:] be calling release on  
any object?


Anyway, perhaps the code will be useful or someone can spot my bug.

Enjoy,
   Peter.


@interface MyCompositeImageRep : NSCustomImageRep {
NSImage* i_foreground;
NSImage* i_background;
}

- (id) initWithSize: (NSSize)siz background: (NSImage*) background  
foreground: (NSImage*) foreground;


@end

@implementation MyCompositeImageRep

- (id) initWithSize: (NSSize)siz background: (NSImage*) background  
foreground: (NSImage*) foreground;

{
	self = [super initWithDrawSelector:@selector(drawComposite:)  
delegate:self];

if (self != nil) {
i_background = [background retain/*copy*/];
i_foreground = [foreground retain/*copy*/];
[self setSize:siz];
}
return self;
}

- (id) copyWithZone:(NSZone *)zone;
{
	check( false ); // The code crashes if the images are copied.  Beats  
me why.


MyCompositeImageRep* newme = [super copyWithZone:zone];
newme->i_background = [i_background retain/*copy*/];
newme->i_foreground = [i_foreground retain/*copy*/];
return newme;
}

- (void) drawComposite:(NSCustomImageRep*)rep
{
	[i_background drawAtPoint:NSZeroPoint fromRect:NSZeroRect  
operation:NSCompositeCopy fraction:1.0];
	[i_foreground drawAtPoint:NSZeroPoint fromRect:NSZeroRect  
operation:NSCompositeSourceOver fraction:1.0];

}

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


@end

@interface MyDimmedImageRep : NSCustomImageRep {
NSImage* i_source;
}

- (id) initWithSize: (NSSize)siz source: (NSImage*) source;

@end

@implementation MyDimmedImageRep

- (id) initWithSize: (NSSize)siz source: (NSImage*) source;
{
	self = [super initWithDrawSelector:@selector(drawDimmed:)  
delegate:self];

if (self != nil) {
i_source = [source retain/*copy*/];
[self setSize:siz];
}
return self;
}

- (id) copyWithZone:(NSZone *)zone;
{
	check( false ); // The code crashes if the images are copied.  Beats  
me why.


MyDimmedImageRep* newme = [super copyWithZone:zone];
newme->i_source = [i_source retain/*copy*/];
return newme;
}

- (void) drawDimmed:(NSCustomImageRep*)rep
{
	[i_source drawAtPoint:NSZeroPoint fromRect:NSZeroRect  
operation:NSCompositeCopy fraction:1.0];

[[[NSColor whiteColor] colorWithAlphaComponent:0.6] set];
	NSRectFillUsingOperation(NSMakeRect( 0, 0, rep.size.width,  
rep.size.height ), NSCompositeSourceAtop);

}

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


@end

static NSImage*
CreateCompositeImage( NSImage* background, NSImage* foreground )
{
	MyCompositeImageRep* rep = [[MyCompositeImageRep alloc]  
initWithSize:background.size background:background  
foreground:foreground];

NSImage* result = [[NSImage alloc] initWithSize:background.size];
[result addRepresentation:rep];
[rep release];
return result;
}

static NSImage*
CreateDimmedImage( NSImage* source )
{
	MyDimmedImageRep* rep = [[MyDimmedImageRep alloc]  
initWithSize:source.size source:source];

NSImage* result = [[NSImage alloc] initWithSize:source.size];
[result addRepresentation:re

Re: A distinct group of pictures in the bundle

2009-10-29 Thread Pierre Berloquin
I was quite dumb. Had I but read the documentation on Copy Files ...
Indeed the directory you enter there is the one you can access in the
bundle.
What I didn't see is that the files must be entered into the resources
first.
Just what I was looking for.

I was misled by old blogs from the past, apparently before this was fixed. I
should have gone to the doc first

Thanks

Pierre


2009/10/29 Ron Fleckner 

> When you add your folder of jpgs to your project, be sure to set "Create
> folder references for any added folders" to true.  Also don't forget to
> check the checkbox with "Copy items into destination group's folder, if
> needed."  Then you can do, for example:
>
>NSString *bellSoundPath = [[NSBundle mainBundle] pathForResource:@"Cow
> Bell" ofType:@"aiff" inDirectory:@"Sounds"];
>
> and it Just Works™.
>
> Ron
>
>
>
> On 29/10/2009, at 4:01 PM, Pierre Berloquin wrote:
>
>  I do use pathForResource:ofType:inDirectory: with nil for Directory and
>> jpg
>> for Type
>> It helps separate jpg's from other pictures
>>
>> But suppose I want to have my pictures in a directory called Pic, how do I
>> go about it?
>> Thanks Dave
>> Pierre
>>
>> 2009/10/28 Dave Carrigan 
>>
>>
>>> On Oct 28, 2009, at 10:46 AM, Pierre Berloquin wrote:
>>>
>>> My app uses a hundred pictures.
>>>
 How can I group them somewhere in the bundle so that my app loads them
 without confusing them with button images and icons .


>>> Have you tried NSBundle's -pathForResource:ofType:inDirectory:
>>>
>>> To install them, create a new copy files build phase that copies them to
>>> the subdirectory of your choosing.
>>>
>>> --
>>> Dave Carrigan
>>> d...@rudedog.org
>>> Seattle, WA, USA
>>>
>>>
>>>
>>
>> --
>> Blogs : http://bibliobs.nouvelobs.com/blog/jeux-litteraires
>>  http://pierre-berloquin.blogspot.com/
>>
>> Développement durable des neurones par le jeu de réflexion
>> www.crealude.net
>>
>> Sustainable development of neurones through mind games
>> www.crealude.net/us
>>
>> Que fait-on pour les mal-codants ?
>> ___
>>
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>
>> Please do not post 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/ronfleckner%40ozemail.com.au
>>
>> This email sent to ronfleck...@ozemail.com.au
>>
>
>


-- 
Blogs : http://bibliobs.nouvelobs.com/blog/jeux-litteraires
   http://pierre-berloquin.blogspot.com/

Développement durable des neurones par le jeu de réflexion
www.crealude.net

Sustainable development of neurones through mind games
www.crealude.net/us

Que fait-on pour les mal-codants ?
___

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

Please do not post 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: Showing activity indicator during data download

2009-10-29 Thread Claus Guttesen
> I've implemented an update button like this:
>
> - (IBAction)updateButton:(id)sender
> {
>   [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
>   [downloadIndicator startAnimating];
>
>   [[DataManager sharedDataManager] updateDataFiles];
>
>   [downloadIndicator stopAnimating];
>   [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
> }
>
> And in the DataManager class I have this:
>
> - (void)updateDataFiles
> {
>   NSString *dataString = [NSString stringWithContentsOfURL:url
>      encoding:NSASCIIStringEncoding
>      error:NULL];
> }
>
> I have the downloadIndicator connected up using IB, and I'm pretty sure the
> wiring is OK. But when the button is clicked, I see an activity indicator
> spinning in the status bar, but I don't see the one I implemented myself
> using IB.
>
> I know it's got something to do with my updateDataFiles method not being
> asynchronous, but beyond that I'm at a loss. I'd really rather avoid writing
> the extra code to do the download using NSURLConnection mechanisms: the user
> can't do anything until the download finishes anyway.
>
> I'd like to have an alert panel or the second activity indicator visible
> during the download. Can someone point me towards a simple solution?

Did you define an outlet in the interface-statement (h-file) for your class? Ie.

@interface MyViewController : UIViewController {
   ...
   IBOutlet UIActivityIndicatorView *activityIndicatorView;
   ...
}

@property (nonatomic, retain) IBOutlet UIActivityIndicatorView
*activityIndicatorView;

Don't forget to synthesize in the implementation file.

When the activity indicator is connected you can do a
activityIndicatorView.startAnimating; and stopAnimating.

HTH.

-- 
regards
Claus

When lenity and cruelty play for a kingdom,
the gentler gamester is the soonest winner.

Shakespeare

twitter.com/kometen
___

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

Please do not post 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: Cocoa replacement for Carbon CompositeIconRef() for Snow Leopard 64-bit apps?

2009-10-29 Thread Dave Keck
> Why would  [NSArray initWithArray:copyItems:] be calling release on any
> object?

When that method copies the objects in the supplied array, the copies
start with a retain count of 1. Then, when each of these copies are
placed into the new array, their retain count becomes 2.
-initWithArray:copyItems then releases each of the copied objects once
so that the array becomes the sole owner of them. (If it didn't do
this, the copied objects would never get released, even when the
resulting array is released.)
___

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

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

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

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


Re: A distinct group of pictures in the bundle

2009-10-29 Thread Ron Fleckner
Hmm... maybe I'm the dumb one.  I don't see why one would want to futz  
with a copy files build phase.  I've never done that and, as they say,  
It Just Works™.  Maybe I've been lucky...


Ron


On 29/10/2009, at 8:25 PM, Pierre Berloquin wrote:


I was quite dumb. Had I but read the documentation on Copy Files ...
Indeed the directory you enter there is the one you can access in  
the bundle.
What I didn't see is that the files must be entered into the  
resources first.

Just what I was looking for.

I was misled by old blogs from the past, apparently before this was  
fixed. I should have gone to the doc first


Thanks

Pierre


2009/10/29 Ron Fleckner 
When you add your folder of jpgs to your project, be sure to set  
"Create folder references for any added folders" to true.  Also  
don't forget to check the checkbox with "Copy items into destination  
group's folder, if needed."  Then you can do, for example:


   NSString *bellSoundPath = [[NSBundle mainBundle]  
pathForResource:@"Cow Bell" ofType:@"aiff" inDirectory:@"Sounds"];


and it Just Works™.

Ron



On 29/10/2009, at 4:01 PM, Pierre Berloquin wrote:

I do use pathForResource:ofType:inDirectory: with nil for Directory  
and jpg

for Type
It helps separate jpg's from other pictures

But suppose I want to have my pictures in a directory called Pic,  
how do I

go about it?
Thanks Dave
Pierre

2009/10/28 Dave Carrigan 


On Oct 28, 2009, at 10:46 AM, Pierre Berloquin wrote:

My app uses a hundred pictures.
How can I group them somewhere in the bundle so that my app loads them
without confusing them with button images and icons .


Have you tried NSBundle's -pathForResource:ofType:inDirectory:

To install them, create a new copy files build phase that copies  
them to

the subdirectory of your choosing.

--
Dave Carrigan
d...@rudedog.org
Seattle, WA, USA




--
Blogs : http://bibliobs.nouvelobs.com/blog/jeux-litteraires
 http://pierre-berloquin.blogspot.com/

Développement durable des neurones par le jeu de réflexion
www.crealude.net

Sustainable development of neurones through mind games
www.crealude.net/us

Que fait-on pour les mal-codants ?
___

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

Please do not post 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/ronfleckner%40ozemail.com.au

This email sent to ronfleck...@ozemail.com.au




--
Blogs : http://bibliobs.nouvelobs.com/blog/jeux-litteraires
   http://pierre-berloquin.blogspot.com/

Développement durable des neurones par le jeu de réflexion
www.crealude.net

Sustainable development of neurones through mind games
www.crealude.net/us

Que fait-on pour les mal-codants ?


___

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

Please do not post 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


"Could not merge data"-error on save in a single moc app

2009-10-29 Thread Ruotger Skupin

Hi,

I get a "Could not merge changes"-error on save in a single moc app 
(*). The docs state this is a problem of a multi-moc setup:


http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CoreData/Articles/cdTroubleshooting.html

The error does not appear on every system and seems to be related to  
when save is called. (race condition?) So far I only have users  
complaining that run Mac OS 10.6. I can rarely reproduce the error  
myself.


Any pointers where to look?

I use garbage collection.

regards
Ruotger

(*) the context is handed out by a singleton method. I NSAssert() this  
method is only called by the main thread.  
 I have seen horses puke in  
front of a pharmacy 

___

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

Please do not post 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


Seemingly Documentation confusion?

2009-10-29 Thread Michael de Haan

I wonder if someone could explain the following.


In "NSDraggingDestination Protocol Reference (informal protocol)", it  
states:


 "The NSDraggingDestination informal protocol declares methods that  
the destination object (or recipient) of a dragged image must  
implement."


 The methods ( which include )

- prepareForDragOperation:  required method
- performDragOperation:  required method
- concludeDragOperation:  required method

are all marked as "required method".



However, in the " Drag and Drop Programming Topics for Cocoa" , in the  
section " Receiving Drag Operations " the following is noted.


 "When the image is dropped with a drag operation other than  
NSDragOperationNone, the destination is sent a  
prepareForDragOperation: message followed by performDragOperation:  
andconcludeDragOperation:. You can cancel the drag by returning NO  
from either of the first two methods.
You do the bulk of the data handling in the performDragOperation:  
method;   ***the other two methods are implemented only if  
necessary***."  (My emphasis)



In my test app, the latter statement seems to be true ie only  
"performDragOperation:" seemed necessary to allow the drop.



Is this a contradiction, or my not following exactly what the  
documentation is saying?  (more likely  :-) )


___

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

Please do not post 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: Seemingly Documentation confusion?

2009-10-29 Thread I. Savant

On Oct 29, 2009, at 7:58 AM, Michael de Haan wrote:

In "NSDraggingDestination Protocol Reference (informal protocol)",  
it states:

...

The methods ( which include )

   - prepareForDragOperation:  required method
   - performDragOperation:  required method
   - concludeDragOperation:  required method

are all marked as "required method".



  I believe you're right. I don't think -prepare... and -conclude...  
are required. If your tests show they aren't, file a bug against that  
doc page (links at the bottom).



--
I.S.


___

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

Please do not post 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: Seemingly Documentation confusion?

2009-10-29 Thread Michael de Haan

Will do...thank you.


On Oct 29, 2009, at 5:03 AM, I. Savant wrote:


On Oct 29, 2009, at 7:58 AM, Michael de Haan wrote:

In "NSDraggingDestination Protocol Reference (informal protocol)",  
it states:

...

The methods ( which include )

  - prepareForDragOperation:  required method
  - performDragOperation:  required method
  - concludeDragOperation:  required method

are all marked as "required method".



 I believe you're right. I don't think -prepare... and -conclude...  
are required. If your tests show they aren't, file a bug against  
that doc page (links at the bottom).



--
I.S.




___

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

Please do not post 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: Showing activity indicator during data download

2009-10-29 Thread Alastair Houghton

On 29 Oct 2009, at 08:36, DKJ wrote:


I replaced the line:

  [downloadIndicator startAnimating];

with this:

  NSInvocationOperation *theOp = [[[NSInvocationOperation alloc]  
initWithTarget:downloadIndicator

 selector:@selector(startAnimating) object:nil] autorelease];
  NSOperationQueue *theQ = [[[NSOperationQueue alloc] init]  
autorelease];

  [theQ addOperation:theOp];

and now it works just the way I want it to.

But am I taking a sledgehammer to a fly? Or have I found (quite by  
accident) the best way to do it?


Unless the documentation says specifically that NSProgressIndicator is  
thread-safe, the code above is a no-no.


You need to rewrite your code so that the download is asynchronous.   
It's either that or periodic calls to a nested event loop, which is  
(a) really ugly and (b) error-prone.


Kind regards,

Alastair.

--
http://alastairs-place.net



___

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

Please do not post 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


Runloop hangs/stops when clicking programmatically on GUI

2009-10-29 Thread Gabriel Höhener

Hello together

How can I avoid that my program "hangs" when I programmatically simulate 
a mouseclick on my app window?
If I simulate a click on the desktop or any other app or app component, 
everything works fine, but if I click programmatically
on a let's say a button or a slider, the GUI tries to update itself and 
the program hangs and I cannot simulate any other

mouseclick.

Why does this happen? Is it because CGEventPost(kCGHIDEventTap, myEvent) 
works synchronously?


Thanks for any help

Gabe
___

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

Please do not post 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: Showing activity indicator during data download

2009-10-29 Thread DKJ

On 2009-10-29, at 7:05 , Alastair Houghton wrote:

You need to rewrite your code so that the download is asynchronous.


Would doing the NSOperationQueue thing with my updateDataFiles method  
be OK? The docs (Appendix A of "Threading Programming Guide") lists  
NSString as being thread-safe.

___

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

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

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

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


Re: how to filter available fonts for my application?

2009-10-29 Thread Jens Alfke


On Oct 29, 2009, at 1:34 AM, XiaoGang Li wrote:


But the Reference> tells me that this delegate methods is not called in Mac  
OS X

version 10.3 and later.

I don't have any idea how to implement it now? does anyone know it?  
thanks


Do you really need to support 10.3? I'm sure there are few copies of  
it still in the wild, and someone who hasn't even upgraded the OS in  
five years is unlikely to be installing new apps, anyway.


—Jens___

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

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

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

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


Re: 10.4 System Preferences Cannot Find Its Main Window When Launched by a Pane Bundle

2009-10-29 Thread Michael Ash
On Wed, Oct 28, 2009 at 7:18 PM, Grant Erickson  wrote:
> I am working on a preference pane and in order to accommodate differences
> among 10.4 and 10.5 and later without hard-coding widths, I call my own
> [self resizeView] from mainViewDidLoad to adjust the view width as
> appropriate:
>
>    - (void) resizeView
>    {
>        NSRect viewFrame, windowFrame;
>        NSWindow * mainWindow = NULL;
>
>        viewFrame = [[self mainView] frame];
>
>        mainWindow = [[NSApplication sharedApplication] mainWindow];
>
>        if (mainWindow != NULL) {
>            contentFrame = [mainWindow contentRectForFrameRect: [mainWindow
>                                                                 frame]];
>
>            viewFrame.size.width = contentFrame.size.width;
>
>            [[self mainView] setFrame: viewFrame];
>        }
>    }
>
> Overall, this seems to work well; however, when testing automatic updates
> with Sparkle, I noticed that when Sparkle relaunches the bundle
> ("/Library/PreferencePanes/MyPane.prefPane") using its 'relaunch' binary
> (which in turn uses NSWorkspace), that [[NSApplication sharedApplication]
> mainWindow] returns NULL.
>
> In fact, when I check [[NSApplication sharedApplication] mainWindow] in all
> of:
>
>    * initWithBundle
>    * mainViewDidLoad
>    * willSelect
>    * didSelect
>
> it is always NULL. Removing Sparkle from the loop, I can recreate the
> problem using the 'open' shell executable:
>
>    % open /Library/PreferencePanes/MyPane.prefPane
>
> Anyone else seen this behavior or developed a reasonable workaround? Perhaps
> registering for and resize on NSWindowDidBecomeMainNotification?

Quoth the docs:

-
mainWindow
Returns the main window.

- (NSWindow *)mainWindow

Return Value
The application’s main window or nil if there is no main window.

Discussion
This method might return nil if the application’s nib file hasn’t
finished loading,
if the receiver is not active,
^^
or if the application is hidden.
-

For a workaround, why not just query for the window that your view is in?

Mike
___

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

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

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

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


Re: Showing activity indicator during data download

2009-10-29 Thread Alastair Houghton

On 29 Oct 2009, at 15:08, DKJ wrote:


On 2009-10-29, at 7:05 , Alastair Houghton wrote:

You need to rewrite your code so that the download is asynchronous.


Would doing the NSOperationQueue thing with my updateDataFiles  
method be OK? The docs (Appendix A of "Threading Programming Guide")  
lists NSString as being thread-safe.


If you insist on using threading, then yes, you could do this in the  
background with an NSOperationQueue (or by using NSThread directly).   
As for Foundation objects and thread-safety, note that immutable  
objects generally *are* thread-safe, but mutable ones generally  
aren't.  So NSString is, but NSMutableString isn't.


To be honest, it's going to be easiest just to use the asynchronous  
NSURLConnection approach.  It really isn't that hard (honest); for the  
most part it just means that part of your code turns into a state  
machine.  The best part, though, is that you don't have to worry about  
thread safety.


Finally, some (hopefully) useful advice:-  If you're writing code that  
uses an asynchronous approach like this, it's often easiest to hive  
the resulting state machine off into a separate object and use that  
object as the delegate of the NSURLConnection.  While you'll still  
need to send messages back to your original object, doing things this  
way isolates the code in the same way that writing a separate function  
does.


Kind regards,

Alastair.

--
http://alastairs-place.net



___

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

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

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

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


Re: how to filter available fonts for my application?

2009-10-29 Thread Ross Carter

On Oct 29, 2009, at 11:17 AM, Jens Alfke wrote:


But the Reference> tells me that this delegate methods is not called in Mac  
OS X

version 10.3 and later.

I don't have any idea how to implement it now? does anyone know it?  
thanks


Do you really need to support 10.3? I'm sure there are few copies of  
it still in the wild, and someone who hasn't even upgraded the OS in  
five years is unlikely to be installing new apps, anyway.


I think the question is how to support post-10.3, not how to support  
10.3. I don't know the answer, but it might help to subclass  
NSFontManager, override -availableFonts, and use  
+setFontManagerFactory:.

___

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

Please do not post 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: Showing activity indicator during data download

2009-10-29 Thread Alastair Houghton

On 29 Oct 2009, at 16:04, DKJ wrote:


On 2009-10-29, at 7:05 , Alastair Houghton wrote:

the code above is a no-no


Thanks for your reply. I'm using a UIActivityIndicatorView, and I  
found a place in the docs where it says almost all of UIKit is not  
thread-safe.


But just out of curiosity, what horrible things might happen with  
the code I posted?


Everything from rendering faults down to outright crashes, memory  
corruption and so on.  It all depends on exactly what code is being  
run and how it's been written.


Moreover, some of the problems may manifest themselves as  
"Heisenbugs", which are notoriously difficult to track down (and in  
some cases hard enough just to *understand*).  Or they may only happen  
on particular models, perhaps because they have a slightly faster or  
slower CPU, or because they're using e.g. a different graphics driver.


Basically, all the usual problems that you might have if you start  
writing multi-threaded code without paying any attention to thread- 
safety.


Oh, *and* just in case you're tempted to try the "test it and use it  
if it works, because it's simple" approach to software development,  
you should remember that *even if* you were to test on every currently  
available device and with every currently in-use version of the iPhone  
OS, there's nothing stopping Apple from releasing new devices or  
software updates that will cause it to break, because they didn't  
guarantee thread-safety and you're assuming it.


Kind regards,

Alastair.

--
http://alastairs-place.net



___

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

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

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

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


Re: how to filter available fonts for my application?

2009-10-29 Thread Jens Alfke


On Oct 29, 2009, at 9:02 AM, Ross Carter wrote:

Do you really need to support 10.3? I'm sure there are few copies  
of it still in the wild, and someone who hasn't even upgraded the  
OS in five years is unlikely to be installing new apps, anyway.


I think the question is how to support post-10.3, not how to support  
10.3. I don't know the answer, but it might help to subclass  
NSFontManager, override -availableFonts, and use  
+setFontManagerFactory:.


Oops, I misread the OP as "...not called on 10.3 and earlier". Sorry  
about that :/


The subclassing approach sounds good, especially since the use of the  
factory pattern indicates that NSFontManager is intended to be  
replaceable.


—Jens___

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

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

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

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


Re: Showing activity indicator during data download

2009-10-29 Thread Jens Alfke


On Oct 29, 2009, at 9:00 AM, Alastair Houghton wrote:

If you insist on using threading, then yes, you could do this in the  
background with an NSOperationQueue (or by using NSThread  
directly).  As for Foundation objects and thread-safety, note that  
immutable objects generally *are* thread-safe, but mutable ones  
generally aren't.  So NSString is, but NSMutableString isn't.


Also, it's generally safe to use even mutable Foundation objects in a  
single thread. So for example you could create an NSMutableString on a  
background thread and mess with it all you want on that thread.


This fits in with the growing consensus about parallelism, that it's  
best to avoid sharing data between threads. Pass a minimum amount of  
data to the background task using immutable objects, and have it  
return results similarly. Make the background task stateless, using  
only the data that was passed in and not any global state.


On the other hand, if you run the download on a background thread  
you're going to have to register some kind of callback in the main  
thread to be invoked when it finishes, and pass the downloaded data  
(and any error state) to the callback. This ends up being pretty much  
equivalent to what you'd do to use NSURLConnection's asynchronous  
mode, plus you have to implement some of the infrastructure yourself.  
Why not just use the async mode?


Basically, concurrency is not free. You have to do some work to  
achieve it, whether you use threads or dispatch queues or asynchrony.  
Having your activity indicator update during the download counts as  
concurrency :)


—Jens___

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

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

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

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


Re: Showing activity indicator during data download

2009-10-29 Thread DKJ

On 2009-10-29, at 9:00 , Alastair Houghton wrote:
it's going to be easiest just to use the asynchronous  
NSURLConnection approach.



I did implement this, and got it to work. But some of the files I'm  
downloading are XML data that needs to be parsed. And the parser can't  
start until the file download is complete, which is what made the  
synchronous download so appealing.


Since non-XML files are also being downloaded, I can't simply initiate  
the XML parsing from the connectionDidFinishLoading delegate method.  
But I could have that method set a flag, and hold off the parsing  
until the flag is set.


So how to start the parsing? The following seems rather amateurish:

   while( !downloadFinished )
[self amuseTheUser];
   [self startParsing];

I suspect there's a better way.

dkj

___

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

Please do not post 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: Showing activity indicator during data download

2009-10-29 Thread Alastair Houghton

On 29 Oct 2009, at 16:40, DKJ wrote:


On 2009-10-29, at 9:00 , Alastair Houghton wrote:
it's going to be easiest just to use the asynchronous  
NSURLConnection approach.



I did implement this, and got it to work. But some of the files I'm  
downloading are XML data that needs to be parsed. And the parser  
can't start until the file download is complete, which is what made  
the synchronous download so appealing.


Since non-XML files are also being downloaded, I can't simply  
initiate the XML parsing from the connectionDidFinishLoading  
delegate method.


Because?  Is the problem here that you need *all* files downloaded  
first?  In that case, just keep track of what you need to download,  
then in your -connectionDidFinishLoading method, test whether you have  
everything, and if you have, start your parse.


Alternatively, if the problem is that you're using the same delegate  
for multiple NSURLConnections, you just need to keep track of which  
one it is that returns the data you need to start parsing.


It might be a little easier to give some advice if you could be more  
specific about what you are downloading and why you currently think  
this will be a problem for you.



So how to start the parsing? The following seems rather amateurish:

  while( !downloadFinished )
[self amuseTheUser];
  [self startParsing];

I suspect there's a better way.


Yeah, don't do that.

In non-threaded code it won't work (without nested run loops, and you  
*really* don't want to get into that quagmire), and in threaded code  
it may still not work because of thread safety issues with your shared  
variable.


You *should* be able to do everything you need from the - 
connectionDidFinishLoading method.


Kind regards,

Alastair.

--
http://alastairs-place.net



___

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

Please do not post 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


Binding To Array Controller From A Different XIB?

2009-10-29 Thread Chunk 1978
i've created an NSMenuItem in the MainMenu.xib that targets an action in a
different XIB thru the first responder.  the action removes an object from
the array.  however, i'd like to binn the NSMenuItem object to the array
controller's canRemove controller key so that the NSMenuItem is only
accassable when appropriate (when an item on the table view is highlighted
and elegable for removal).  is it even possible to access bindings of an
array controller that is in a different XIB?  is this possible?
___

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

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

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

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


How to increase the height of NSTableView Header

2009-10-29 Thread Arun
Hi All,

Does any one know how can we increase the Height of the NSTableView Header?
In the IB, the height is fixed and non-editable.

Thanks
Arun KA
___

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

Please do not post 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: Binding To Array Controller From A Different XIB?

2009-10-29 Thread I. Savant
On Thu, Oct 29, 2009 at 1:07 PM, Chunk 1978  wrote:
> i've created an NSMenuItem in the MainMenu.xib that targets an action in a
> different XIB thru the first responder.  the action removes an object from
> the array.  however, i'd like to binn the NSMenuItem object to the array
> controller's canRemove controller key so that the NSMenuItem is only
> accassable when appropriate (when an item on the table view is highlighted
> and elegable for removal).  is it even possible to access bindings of an
> array controller that is in a different XIB?  is this possible?


 There isn't enough information about your application and its
architecture to give you a direct answer as to "how", but in general,
yes. It's mind-numbingly simple in some cases.

 I assume the menu item is a main menu item in your MainMenu.xib? Is
the 'the other' xib the document prototype for an NS*Document-based
application?

 If so, you can bind to File's Owner, using the path,
"mainWindow.windowController.document.property", where "property" is
whatever property you want.

 You'd need to make the array controller (let's call it
"peopleArrayController") available via KVC-compliant accessor, but the
full keypath in your case would be:

"mainWindow.windowController.document.peopleArrayController.canRemove"

 The key to understanding this is to fully understand what "First
Responder" actually is in Cocoa, then understanding the overall
architecture of a Cocoa document-based application (and how to walk
the path).

 The approach for other situations (not targeting something in a
document) is similar - you just need to make sure every element in the
path is properly accessible via a KVC-compliant accessor.

 Note: All this has the prerequisite requirement of understanding
Cocoa (because Bindings is an advanced Cocoa technology) on a more
fundamental level (because Bindings is an advanced Cocoa technology),
so any questions about the specifics should not be lumped into one
broad-sweeping, all-encompassing thread. You'll want to "break it
down" and attack each piece as it comes.

--
I.S.
___

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

Please do not post 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: Binding To Array Controller From A Different XIB?

2009-10-29 Thread Chunk 1978
ahhh, that was easy!  thanks for clearing this up for me :)

On Thu, Oct 29, 2009 at 1:32 PM, I. Savant wrote:

> On Thu, Oct 29, 2009 at 1:07 PM, Chunk 1978  wrote:
> > i've created an NSMenuItem in the MainMenu.xib that targets an action in
> a
> > different XIB thru the first responder.  the action removes an object
> from
> > the array.  however, i'd like to binn the NSMenuItem object to the array
> > controller's canRemove controller key so that the NSMenuItem is only
> > accassable when appropriate (when an item on the table view is
> highlighted
> > and elegable for removal).  is it even possible to access bindings of an
> > array controller that is in a different XIB?  is this possible?
>
>
>  There isn't enough information about your application and its
> architecture to give you a direct answer as to "how", but in general,
> yes. It's mind-numbingly simple in some cases.
>
>  I assume the menu item is a main menu item in your MainMenu.xib? Is
> the 'the other' xib the document prototype for an NS*Document-based
> application?
>
>  If so, you can bind to File's Owner, using the path,
> "mainWindow.windowController.document.property", where "property" is
> whatever property you want.
>
>  You'd need to make the array controller (let's call it
> "peopleArrayController") available via KVC-compliant accessor, but the
> full keypath in your case would be:
>
> "mainWindow.windowController.document.peopleArrayController.canRemove"
>
>  The key to understanding this is to fully understand what "First
> Responder" actually is in Cocoa, then understanding the overall
> architecture of a Cocoa document-based application (and how to walk
> the path).
>
>  The approach for other situations (not targeting something in a
> document) is similar - you just need to make sure every element in the
> path is properly accessible via a KVC-compliant accessor.
>
>  Note: All this has the prerequisite requirement of understanding
> Cocoa (because Bindings is an advanced Cocoa technology) on a more
> fundamental level (because Bindings is an advanced Cocoa technology),
> so any questions about the specifics should not be lumped into one
> broad-sweeping, all-encompassing thread. You'll want to "break it
> down" and attack each piece as it comes.
>
> --
> I.S.
>
___

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

Please do not post 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: Showing activity indicator during data download

2009-10-29 Thread Matt Neuburg
On Thu, 29 Oct 2009 16:00:42 +, Alastair Houghton
 said:
>To be honest, it's going to be easiest just to use the asynchronous
>NSURLConnection approach.  It really isn't that hard

I'd have to agree with this. I just tried NSURLConnection for the first time
and it worked perfectly right out of the box. What was I so scared of? Apple
actually hands you all the code on a silver platter: you just copy it out of
the docs and into your code, tweak slightly, and presto, you are downloading
asynchronously. m.

-- 
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings



___

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

Please do not post 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: Binding To Array Controller From A Different XIB?

2009-10-29 Thread Quincey Morris

On Oct 29, 2009, at 10:32, I. Savant wrote:


I assume the menu item is a main menu item in your MainMenu.xib? Is
the 'the other' xib the document prototype for an NS*Document-based
application?

If so, you can bind to File's Owner, using the path,
"mainWindow.windowController.document.property", where "property" is
whatever property you want.

You'd need to make the array controller (let's call it
"peopleArrayController") available via KVC-compliant accessor, but the
full keypath in your case would be:

"mainWindow.windowController.document.peopleArrayController.canRemove"


Perfectly true, but in this case I'd suggest this is the wrong approach.



The whole point of targeting "first responder" is to allow different  
objects to have control of the menu item at different times. [The case  
of having even just one controlling object, but in a different NIB  
from the main menu NIB, is a special case of this.]


The natural mechanism for controlling the appearance of such a menu  
item (including its text, its check mark and its enabled state) is to  
use interface validation (validateUserInterfaceItem: or  
validateMenuItem:) in each possible controlling class.


The controlling object in this case, where the dependency is  
ultimately on a NSArrayController property, is likely to be either the  
NSDocument subclass, or the relevant window controller (set as a  
window delegate to get it into the NSResponder chain).


Under the circumstances, interface validation is likely to be a whole  
lot simpler than using KVO.



___

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

Please do not post 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: Runloop hangs/stops when clicking programmatically on GUI

2009-10-29 Thread Kyle Sluder
2009/10/29 Gabriel Höhener :
> How can I avoid that my program "hangs" when I programmatically simulate a
> mouseclick on my app window?

Why are you simulating mouse clicks?  This is usually an indication of
a very poor design.

> If I simulate a click on the desktop or any other app or app component,
> everything works fine, but if I click programmatically
> on a let's say a button or a slider, the GUI tries to update itself and the
> program hangs and I cannot simulate any other
> mouseclick.

Methinks you might want to brush up on the MVC pattern again.  Don't
manipulate the view in order to change your model.  That's what the
controller layer is for.

--Kyle Sluder
___

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

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

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

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


re: EXC_BAD_ACCESS when migrating a store, but only sometimes...

2009-10-29 Thread Ben Trumbull
> I've come across a rather perplexing problem which is driving me nuts.  
> I'm attempting to migrate a core data SQLite store to the current  
> model version, and most of the time it works fine. However, sometimes  
> I get an EXC_BAD_ACCESS in the following stack:
> 
> objc_assign_strongCast + 19
> -[NSMigrationManager  
> migrateStoreFromURL:type:options:withMappingModel:toDestinationURL:destinationType:destinationOptions:error
>  
> :] + 2750
> (My methods...)

If you can reproduce it in a small sample project (with your models, etc, but 
the least amount of custom code), then please file a bug.

One thing you might try is, before creating the NSMigrationManager with 
-[NSMigrationManager  initWithSourceModel:destinationModel:] is creating 2 
empty throw away PSCs, one that uses the source model and one that uses the 
destination model.  Then just release the PSCs and use those models to 
construct the NSMigrationManager.  That should work around the one known GC 
issue here.  

If you're not using GC, than try breaking out Instruments' ObjectAlloc with 
NSZombie detection.

- Ben

___

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

Please do not post 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: Binding To Array Controller From A Different XIB?

2009-10-29 Thread I . Savant

On Oct 29, 2009, at 1:57 PM, Quincey Morris wrote:

The natural mechanism for controlling the appearance of such a menu  
item (including its text, its check mark and its enabled state) is  
to use interface validation (validateUserInterfaceItem: or  
validateMenuItem:) in each possible controlling class.


The controlling object in this case, where the dependency is  
ultimately on a NSArrayController property, is likely to be either  
the NSDocument subclass, or the relevant window controller (set as a  
window delegate to get it into the NSResponder chain).


  Of course you're right that it would probably be easier for menus.  
It is definitely cleaner from an architectural standpoint to have one  
point of entry to your the abstract idea of "the active document" from  
the menu system.


  The approach I mentioned is far more useful for, say, a shared  
"Inspector" pane, whose UI reflects something about the active  
document (or some selected item therein). But as I said in my  
response. It's possible and even easy in some cases do do as the OP  
requested. :-)


--
I.S.




___

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

Please do not post 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: Showing activity indicator during data download

2009-10-29 Thread Jens Alfke


On Oct 29, 2009, at 9:40 AM, DKJ wrote:

I did implement this, and got it to work. But some of the files I'm  
downloading are XML data that needs to be parsed. And the parser  
can't start until the file download is complete, which is what made  
the synchronous download so appealing.


It's annoying that Foundation and CF still don't provide an  
incremental parser. But you can use the lower-level libxml2 to parse  
incrementally as the data arrives, if that's important.


Since non-XML files are also being downloaded, I can't simply  
initiate the XML parsing from the connectionDidFinishLoading  
delegate method.


Sure you can. Either use a different delegate class for your XML  
files, or put a flag in the delegate that's YES if this file should be  
parsed.


—Jens

___

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

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

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

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


re: "Could not merge data"-error on save in a single moc app

2009-10-29 Thread Ben Trumbull
> I get a "Could not merge changes"-error on save in a single moc app 
> (*). The docs state this is a problem of a multi-moc setup:
> 
> http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CoreData/Articles/cdTroubleshooting.html
> 

Yes, the MOC you are saving refers to data that has changed out from underneath 
it in either the PSC or the database file itself.  This is an optimistic 
concurrency control failure.

> The error does not appear on every system and seems to be related to  
> when save is called. (race condition?) So far I only have users  
> complaining that run Mac OS 10.6. I can rarely reproduce the error  
> myself.
> 
> Any pointers where to look?

Well, you can break on -[NSManagedObjectContext init], and -save: to see if you 
really only have 1 MOC.  Other than that, breaking on +[NSError 
errorWithDomain:code:userInfo:] and doing "thread apply all bt" in gdb is 
usually helpful.

> 
> I use garbage collection.
> 
> regards
>   Ruotger
> 
> (*) the context is handed out by a singleton method. I NSAssert() this  
> method is only called by the main thread.  

Well, it's still possible for code to leak it to another thread if, you say, 
pass NSManagedObjects around, and then ask them for their MOC.

- Ben



___

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

Please do not post 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


Changing the NSView bounds origin point

2009-10-29 Thread Gustavo Pizano

Hello.

I have a custom NSView and Im drawing in it a glossy background, BUT  
it seems the algorithm that Im using assumes as coordinates origin to  
be on the upper left corner and the nsview origin start on the bottom  
left corner. Is there any work around this?


Thanks

Gustavo.
___

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

Please do not post 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: Changing the NSView bounds origin point

2009-10-29 Thread Jens Alfke


On Oct 29, 2009, at 2:37 PM, Gustavo Pizano wrote:

I have a custom NSView and Im drawing in it a glossy background, BUT  
it seems the algorithm that Im using assumes as coordinates origin  
to be on the upper left corner and the nsview origin start on the  
bottom left corner. Is there any work around this?


Use flipped coordinates. (Look up "flipped" in the Cocoa docs.)

—Jens___

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

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

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

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


Re: Changing the NSView bounds origin point

2009-10-29 Thread Kyle Sluder
On Thu, Oct 29, 2009 at 2:37 PM, Gustavo Pizano
 wrote:
> I have a custom NSView and Im drawing in it a glossy background, BUT it
> seems the algorithm that Im using assumes as coordinates origin to be on the
> upper left corner and the nsview origin start on the bottom left corner. Is
> there any work around this?

Fix your algorithm.

--Kyle Sluder
___

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

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

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

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


Re: Changing the NSView bounds origin point

2009-10-29 Thread Gustavo Pizano
hehe.. well the problem is that it happens only with NSView when I  
apply the same to a NSButtonCell it does it normally. So far I pass  
the rectangle to the algorithm with a negative height and the origin  
to be (0, height)  and it works,. but Im not happy with this solution.


G.


On Oct 29, 2009, at 10:43 PM, Kyle Sluder wrote:


On Thu, Oct 29, 2009 at 2:37 PM, Gustavo Pizano
 wrote:
I have a custom NSView and Im drawing in it a glossy background,  
BUT it
seems the algorithm that Im using assumes as coordinates origin to  
be on the
upper left corner and the nsview origin start on the bottom left  
corner. Is

there any work around this?


Fix your algorithm.

--Kyle Sluder


___

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

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

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

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


Re: 10.4 System Preferences Cannot Find Its Main Window When Launched by a Pane Bundle

2009-10-29 Thread Grant Erickson
On 10/29/09 8:38 AM, Michael Ash wrote:
> On Wed, Oct 28, 2009 at 7:18 PM, Grant Erickson  wrote:
>> I am working on a preference pane and in order to accommodate differences
>> among 10.4 and 10.5 and later without hard-coding widths, I call my own
>> [self resizeView] from mainViewDidLoad to adjust the view width as
>> appropriate:
>> 
>> [ ... sample code omitted ... ]
>> 
>> Overall, this seems to work well; however, when testing automatic updates
>> with Sparkle, I noticed that when Sparkle relaunches the bundle
>> ("/Library/PreferencePanes/MyPane.prefPane") using its 'relaunch' binary
>> (which in turn uses NSWorkspace), that [[NSApplication sharedApplication]
>> mainWindow] returns NULL.
>> 
>> In fact, when I check [[NSApplication sharedApplication] mainWindow] in all
>> of:
>> 
>>    * initWithBundle
>>    * mainViewDidLoad
>>    * willSelect
>>    * didSelect
>> 
>> Anyone else seen this behavior or developed a reasonable workaround? Perhaps
>> registering for and resize on NSWindowDidBecomeMainNotification?
> 
> Quoth the docs:
> 
> -
> mainWindow
> Returns the main window.
> 
> - (NSWindow *)mainWindow
> 
> Return Value
> The application¹s main window or nil if there is no main window.
> 
> Discussion
> This method might return nil if the application¹s nib file hasn¹t
> finished loading,
> if the receiver is not active,
> ^^
> or if the application is hidden.

I definitely saw that in the documentation; however, my confusion and
reconciliation was around 10.4 vs. 10.5 behaviors and direction application
vs. bundle launch behavior variances.

> For a workaround, why not just query for the window that your view is in?

That appears to work well enough for the didSelect case, whether opening by
the application or by a pane bundle.

The following also correctly catches the pane bundle launch case
effectively:

- (void) windowDidBecomeMain: (NSNotification *)inNotification
{
NSWindow * changedWindow = [inNotification object];
NSWindow * mainWindow = [[NSApplication sharedApplication]
 mainWindow];

if ([changedWindow isEqualTo: mainWindow]) {
[self resizeView];
}
}

Regards,

Grant


___

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

Please do not post 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: Help debugging "Dangling reference to an invalid object." Core Data error

2009-10-29 Thread Sean McBride
On 10/22/09 4:59 PM, Melissa J. Turner said:

>> I have an entity 'Scene' with a to-many relationship to an entity
>> 'Target'.  The inverse relationship is also to-many.  Both relationships
>> are optional and the delete rule for both sides is nullify.
>>
>> To repro, I delete all Scenes then try to save.  It gives:
>>
>> "Dangling reference to an invalid object." = ;
>> NSAffectedObjectsErrorKey = (
>>   (entity: Scene; id: 0x2004f32a0 > FCE3E0E3-F187-4C44-BFC3-60D7AF3E579F/Scene/p343> ; ...
>>
>> This error gives only 4 hits with Google. :(
>>
>> The problem is that some Targets still have relationships to some
>> Scenes!  How can that happen?  It seems like the delete rule is not
>> doing its job.
>
>Does the object with the ID BFC3-60D7AF3E579F/Scene/p343> exist in the affected store? What happens
>when you call existingObjectWithID:error:?
>
>Do you know what version of the OS the bad documents were created on? A
>lot changed in the relationship handling area in 10.6 (for the better,
>really and truly ;-), so knowing whether your customers created them on
>10.5.x or 10.6.x would help narrow down the possibilities.

Thanks Melissa and Ben for your replies!

I have been working on this issue for days now and am getting
increasingly confused. :)

My coworker found a way to create a document (in 10.6.1) with almost the
same problem as originally described (it complains about the inverse
relationship instead).

Examination of the XML document (as text) suggests that the object graph
is ok.

To repro: 1) open said document 2) delete a particular managed object 3)
attempt to save -> receive "dangling reference" error.  Repros 100%.

I've also found that changing a particular line of my code prevents
(100%) the error from occurring.  Said line only runs when the document
is opened (as a result of a controller getting a KVO notification).

The entities in question are Scene and Target.  Scene has a to-many
'targetsWeak' relationship.  Target has a to-many 'scenesWeak'
relationship.  They are inverses.  They are optional and nullify.

The code snippet in question:

NSSet* currentTargets = [scene targetsWeak];
NSSet* additionallyDesiredTargets = ;
BOOL isEqual = [currentTargets isEqualToSet:
additionallyDesiredTargets];
assert (isEqual);
//if (!equal)
{
[scene addTargetsWeak:additionallyDesiredTargets];
}

It turns out that isEqual is always YES in this limited repro case.
Therefore, I don't really need to change 'targetsWeak' (the 'if' body).
But if I do anyway (the commented 'if'), I get the 'dangling reference'
error.  If I don't, I don't.

Even if I do [scene addTargetsWeak:[scene targetsWeak]] I get the error.

Does this make any sense to anyone?

Thanks,

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

Please do not post 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


[MEET] November CocoaHeads Mac Developer Meetings

2009-10-29 Thread Stephen Zyszkiewicz

Greetings,

CocoaHeads is an international Mac programmer's group. Meetings are  
free and open to the public. We specialize in Cocoa, but everything  
Mac programming related is welcome.


Upcoming meetings:
Austria
Wien- Thursday, November 12, 2009 19:00.

Canada
Ottawa/Gatineau- Thursday, November 12, 2009 19:00.

Denmark
Aarhus- Tuesday, November 10, 2009 19:00.
Copenhagen- Tuesday, November 10, 2009 19:00.

Germany
Stuttgart- Wednesday, November 11, 2009 19:00.

Sweden
Malmö- Tuesday, November 10, 2009 19:00.
Stockholm- Monday, November 2, 2009 18:00.


Switzerland
Zürich- Wednesday, November 11, 2009 19:00.

United States
Ann Arbor- Thursday, November 12, 2009 19:00.
Atlanta- Thursday, November 12, 2009 19:00.
Boulder- Tuesday, November 10, 2009 19:00.
Colorado Springs- Thursday, November 12, 2009 19:00.
Columbia- Tuesday, November 10, 2009 19:00.
Columbus- Tuesday, November 10, 2009 19:00.
Denver- Tuesday, November 10, 2009 19:00.
Lake Forest- Wednesday, November 11, 2009 19:00.
Nashville- Thursday, November 12, 2009 16:00.
Phoenix- Thursday, November 13, 2008 19:00.


Some chapters may have yet to post their meeting for next month.  
Meeting times may change. Locations and more information here:

http://cocoaheads.org

Also be sure to check for an NSCoder Night in your area:
http://nscodernight.com/


Steve
Silicon Valley CocoaHeads
___

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

Please do not post 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: Help debugging "Dangling reference to an invalid object." Core Data error

2009-10-29 Thread Ben Trumbull

On Oct 29, 2009, at 16:55 , Sean McBride wrote:

> On 10/22/09 4:59 PM, Melissa J. Turner said:
> 
>>> I have an entity 'Scene' with a to-many relationship to an entity
>>> 'Target'.  The inverse relationship is also to-many.  Both relationships
>>> are optional and the delete rule for both sides is nullify.
>>> 
>>> To repro, I delete all Scenes then try to save.  It gives:
>>> 
>>> "Dangling reference to an invalid object." = ;
>>> NSAffectedObjectsErrorKey = (
>>>  (entity: Scene; id: 0x2004f32a0 >> FCE3E0E3-F187-4C44-BFC3-60D7AF3E579F/Scene/p343> ; ...
>>> 
>>> This error gives only 4 hits with Google. :(
>>> 
>>> The problem is that some Targets still have relationships to some
>>> Scenes!  How can that happen?  It seems like the delete rule is not
>>> doing its job.
>> 
>> Does the object with the ID > BFC3-60D7AF3E579F/Scene/p343> exist in the affected store? What happens
>> when you call existingObjectWithID:error:?
>> 
>> Do you know what version of the OS the bad documents were created on? A
>> lot changed in the relationship handling area in 10.6 (for the better,
>> really and truly ;-), so knowing whether your customers created them on
>> 10.5.x or 10.6.x would help narrow down the possibilities.
> 
> Thanks Melissa and Ben for your replies!
> 
> I have been working on this issue for days now and am getting
> increasingly confused. :)
> 
> My coworker found a way to create a document (in 10.6.1) with almost the
> same problem as originally described (it complains about the inverse
> relationship instead).
> 
> Examination of the XML document (as text) suggests that the object graph
> is ok.
> 
> To repro: 1) open said document 2) delete a particular managed object 3)
> attempt to save -> receive "dangling reference" error.  Repros 100%.
> 
> I've also found that changing a particular line of my code prevents
> (100%) the error from occurring.  Said line only runs when the document
> is opened (as a result of a controller getting a KVO notification).
> 
> The entities in question are Scene and Target.  Scene has a to-many
> 'targetsWeak' relationship.  Target has a to-many 'scenesWeak'
> relationship.  They are inverses.  They are optional and nullify.
> 
> The code snippet in question:
> 
> NSSet* currentTargets = [scene targetsWeak];
> NSSet* additionallyDesiredTargets = ;
> BOOL isEqual = [currentTargets isEqualToSet:
>additionallyDesiredTargets];
> assert (isEqual);
> //if (!equal)
> {
>   [scene addTargetsWeak:additionallyDesiredTargets];
> }
> 
> It turns out that isEqual is always YES in this limited repro case.
> Therefore, I don't really need to change 'targetsWeak' (the 'if' body).
> But if I do anyway (the commented 'if'), I get the 'dangling reference'
> error.  If I don't, I don't.
> 
> Even if I do [scene addTargetsWeak:[scene targetsWeak]] I get the error.
> 
> Does this make any sense to anyone?


The only caveat is you cannot change relationships from within -awakeFromFetch. 
 This is documented:


Otherwise, if this repros 100% of the time, file a bug and we'll take a look at 
it.

- Ben

___

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

Please do not post 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: Detecting a network connection

2009-10-29 Thread colors
One challenge I am facing is that there are cases where the product I  
am working on is run within a network that does not have extranet  
access, but need to access a server inside the network.  I do not know  
what the domain or address is for this server, since it is different  
for each installation.


So before I try to communicate with the server, I would like to know  
that I can actually get off the machine to some kind of network.  This  
will help avoid having to wait for curl to timeout.  It looks like  
NSHost and SCNetwork... depend on having a specific address or  
domain.  How can I just determine if there is a physical connection to  
a network?


Rich

On Oct 28, 2009, at 7:32 AM, colors wrote:

I am currently use NSHost to determine if I can see a particular  
domain, before I initiate a lengthly sso to that domain.  However, I  
am finding that depending on the settings of some network DNS  
servers, this method does not always work.  Any suggestions of a  
better way to confirm a live internet connection?


*
Richard Collyer
iseecol...@sbcglobal.net
*

___

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

Please do not post 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


[MEET] (Sydney/Australia) CocoaHeads/NSCoder Sydney - November 5th - Mac/iPhone hack night

2009-10-29 Thread Mark Aufflick
First Thursday of the month == one of CocoaHeads Sydney or NSCoder
Sydney (Australia).

After much discussion (and an excellent Guinness pie) we have decided
on an alternating calendar - one month we'll have a CocoaHeads night,
with presentations etc. - the alternate month we'll have an NSCoder
night where everyone brings their laptops and gets to work on their
iPhone or Mac projects, showing off your code, asking questions,
whatever. Newbies allowed!

In either case we start at 6:30pm followed by beer posthaste!

Same as last month, we are in room CB02.05.32 of UTS (University of
Technology Sydney).

That's Building 2, Level 5, Room 32. You can access building 2 via the
main entrance. This will be our room for the rest of the year.

You might find the UTS Broadway campus map useful: http://is.gd/3l1iu

Thanks to David Morrison for organising the room as always.

A gleaming pile of laptops will surely guide you, else call me on my
mobile: 0438 700 647.

The Australian CocoaHeads mailing list is at
http://groups.google.com/group/cocoaheadsau

-- 
Mark Aufflick
  contact info at http://mark.aufflick.com/about/contact
___

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

Please do not post 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


Cocoa bindings problem

2009-10-29 Thread Squ Aire

Let's say I have a table view bound to an array controller which in turn is 
bound to a MOC... you all know how it works.

The table view has two columns: "Name" and "Last Login Date". The thing is that 
in underneath in the model, the "last login date" is stored with both date and 
time information. However, the table view column formats it such that only the 
date is shown (because usually when browsing the names I have no interest in 
what time the last login happened).

My problem is that when I bind a some text field to the "last login date" 
column, and choose multiple rows with same date (but NOT THE SAME TIME), I get 
"Multiple Values". How can I make it just show the date without time in the 
text field? Can bindings accommodate me in some way to accomplish this?

I really don't want to get rid of the time in underlying data because, hey, 
data is data and who knows, I might be interested in it down the road later on.

  
_
Windows Live: Make it easier for your friends to see what you’re up to on 
Facebook.
http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_2:092009___

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

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

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

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


Re: how to filter available fonts for my application?

2009-10-29 Thread XiaoGang Li
Thanks a lot. I will try.

On Fri, Oct 30, 2009 at 12:33 AM, Jens Alfke  wrote:

>
> On Oct 29, 2009, at 9:02 AM, Ross Carter wrote:
>
>  Do you really need to support 10.3? I'm sure there are few copies of it
>>> still in the wild, and someone who hasn't even upgraded the OS in five years
>>> is unlikely to be installing new apps, anyway.
>>>
>>
>> I think the question is how to support post-10.3, not how to support 10.3.
>> I don't know the answer, but it might help to subclass NSFontManager,
>> override -availableFonts, and use +setFontManagerFactory:.
>>
>
> Oops, I misread the OP as "...not called on 10.3 and earlier". Sorry about
> that :/
>
> The subclassing approach sounds good, especially since the use of the
> factory pattern indicates that NSFontManager is intended to be replaceable.
>
> —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/andrew.macdev%40gmail.com
>
> This email sent to andrew.mac...@gmail.com
>
___

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

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

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

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


Re: Cocoa bindings problem

2009-10-29 Thread I. Savant

On Oct 29, 2009, at 9:44 PM, Squ Aire wrote:

My problem is that when I bind a some text field to the "last login  
date" column, and choose multiple rows with same date (but NOT THE  
SAME TIME), I get "Multiple Values".


  Do you mean you have a separate NSTextView or NSTextField that is  
bound to the array controller's selection.lastLoginDate? This is a  
classic master/detail view setup.



How can I make it just show the date without time in the text field?  
Can bindings accommodate me in some way to accomplish this?


  If you have multiple rows selected, there's no way for the  
mechanism to 'know' (or trust) that the dates are the same. Indeed  
they're not (in the "this exact timestamp" sense, nor, likely, in the  
"same object by pointer" sense).


  You might try an NSValueTransformer to substitute one date with a  
"best-guess" date (allowing for differing "to-the-day" dates),  
following whatever logic you want. I don't know if this'll work for  
multiple values, though. I've never done what you're proposing  
personally.


--
I.S.


___

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

Please do not post 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: Detecting a network connection

2009-10-29 Thread Shawn Erickson
On Thu, Oct 29, 2009 at 6:35 PM, colors  wrote:

> One challenge I am facing is that there are cases where the product I am
> working on is run within a network that does not have extranet access, but
> need to access a server inside the network.  I do not know what the domain
> or address is for this server, since it is different for each installation.
>
> So before I try to communicate with the server, I would like to know that I
> can actually get off the machine to some kind of network.


How do you communicate to the server? Seems like you would have to know its
address in one way or another and if you have that you should be able to use
the reachability API.

If you don't have the address then.. how do you get the address?

-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 arch...@mail-archive.com


[iphone] in app store - remembering a purchase

2009-10-29 Thread Dragos Ionel
excerpt from:

*Built-in Product
Model*
*

In the built-in product model, everything required to deliver products is
built in to your application. *
*,,,
After a product is successfully purchased, your application must unlock the
feature and deliver it to the user. The simplest way to unlock features is
by changing your Application Preferences. Application preferences are backed
up when users backs up their phones. **Your application may want to
recommend to users that they back up their phones after making a purchase to
ensure that purchases are not lost.*
*
*
*
*
Question:

Is it correct to assume that if a user buys an in app store item, but does
not back up his iphone, and deletes the application and reinstalls it, there
is no way for the app to know that the item was bought before?

If this is not correct, what would be the options available?

Thank you,
Dragos
iphodea.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: Detecting a network connection

2009-10-29 Thread Jens Alfke


On Oct 29, 2009, at 6:35 PM, colors wrote:

So before I try to communicate with the server, I would like to know  
that I can actually get off the machine to some kind of network.   
This will help avoid having to wait for curl to timeout.  It looks  
like NSHost and SCNetwork... depend on having a specific address or  
domain.  How can I just determine if there is a physical connection  
to a network?


This question doesn't really have a good answer. If I plug my Mac into  
an Ethernet hub, but the hub's not connected to anything else, is that  
a network? If I plug both ends of an Ethernet cable into two Macs (so  
they can connect to each other) is that a network? What about the  
similar case of a 'computer-to-computer' AirPort network? What about  
if the base station for my wireless network has lost its Ethernet  
connection, so I can see the ten other machines on that network but  
nothing else? What about a company intranet where it's not possible to  
reach the outside except via proxies?


At some point the answer starts to become "yes" for your app. But that  
point is different for different apps, and there's no clear dividing  
line. Generally the best you can do is determine a specific hostname  
or IP address you want to connect to, and see if it's possibly  
reachable.


If you need something more generic, you could use SC to check whether  
there's a DNS server available; that generally indicates that you're  
on some kind of nontrivial network (although it could be as vestigial  
as you and a disconnected NAT router.)


—Jens___

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

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

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

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


The ghost in the bundle

2009-10-29 Thread Pierre Berloquin
OK here is a mystery for you.
Before I knew how to use a Copy Files build phase, I placed a bunch of jpg's
in the scope of the product, dragged them in the Resources folder and hit
the bundle with

[listeImages addObjectsFromArray:[mainBundle pathsForResourcesOfType:@"jpg"
inDirectory:nil]];

That gave me 94 pictures that my app displayed and played with.
Now, I drag only 40 pictures in a subdirectory of Resources called Pics,
drag them in a Copy Files and name the directory Pics.
I hit the bundle with

[listeImages addObjectsFromArray:[mainBundle pathsForResourcesOfType:@"jpg"
inDirectory:@"Pics"]];

I get my 40 pictures OK that I can display and play with.

EXCEPT ... that just out of curiosity, I tried inDirectory:nil again and it
gave me my former 94 jpg's back, that I can display and play with. What
worries me is that they are not in Resources anymore and some were moved to
a directory outside the scope of the app. Worse : one of them, that was
moved AND renamed, is still loaded and displayed.
It looks like the app is going to carry a ghost load forever, that I don't
need.
What can I do?

Thanks
Pierre


2009/10/29 Ron Fleckner 

> Hmm... maybe I'm the dumb one.  I don't see why one would want to futz with
> a copy files build phase.  I've never done that and, as they say, It Just
> Works™.  Maybe I've been lucky...
>
> Ron
>
>
>
> On 29/10/2009, at 8:25 PM, Pierre Berloquin wrote:
>
>  I was quite dumb. Had I but read the documentation on Copy Files ...
>> Indeed the directory you enter there is the one you can access in the
>> bundle.
>> What I didn't see is that the files must be entered into the resources
>> first.
>> Just what I was looking for.
>>
>> I was misled by old blogs from the past, apparently before this was fixed.
>> I should have gone to the doc first
>>
>> Thanks
>>
>> Pierre
>>
>>
>> 2009/10/29 Ron Fleckner 
>> When you add your folder of jpgs to your project, be sure to set "Create
>> folder references for any added folders" to true.  Also don't forget to
>> check the checkbox with "Copy items into destination group's folder, if
>> needed."  Then you can do, for example:
>>
>>   NSString *bellSoundPath = [[NSBundle mainBundle] pathForResource:@"Cow
>> Bell" ofType:@"aiff" inDirectory:@"Sounds"];
>>
>> and it Just Works™.
>>
>> Ron
>>
>>
>>
>> On 29/10/2009, at 4:01 PM, Pierre Berloquin wrote:
>>
>> I do use pathForResource:ofType:inDirectory: with nil for Directory and
>> jpg
>> for Type
>> It helps separate jpg's from other pictures
>>
>> But suppose I want to have my pictures in a directory called Pic, how do I
>> go about it?
>> Thanks Dave
>> Pierre
>>
>> 2009/10/28 Dave Carrigan 
>>
>>
>> On Oct 28, 2009, at 10:46 AM, Pierre Berloquin wrote:
>>
>> My app uses a hundred pictures.
>> How can I group them somewhere in the bundle so that my app loads them
>> without confusing them with button images and icons .
>>
>>
>> Have you tried NSBundle's -pathForResource:ofType:inDirectory:
>>
>> To install them, create a new copy files build phase that copies them to
>> the subdirectory of your choosing.
>>
>> --
>> Dave Carrigan
>> d...@rudedog.org
>> Seattle, WA, USA
>>
>>
>>
>>
>>
___

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

Please do not post 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: The ghost in the bundle

2009-10-29 Thread Graham Cox


On 30/10/2009, at 2:51 PM, Pierre Berloquin wrote:

It looks like the app is going to carry a ghost load forever, that I  
don't

need.
What can I do?



Are you sure you did a clean build? If not, the new folder will be  
added, but the OLD resources are not moved or deleted, so they'll  
still be there.


--Graham


___

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

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

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

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


Re: The ghost in the bundle

2009-10-29 Thread Ron Fleckner


On 30/10/2009, at 3:16 PM, Graham Cox wrote:



On 30/10/2009, at 2:51 PM, Pierre Berloquin wrote:

It looks like the app is going to carry a ghost load forever, that  
I don't

need.
What can I do?



Are you sure you did a clean build? If not, the new folder will be  
added, but the OLD resources are not moved or deleted, so they'll  
still be there.


--Graham


I concur.

But, Pierre, why do you think you need a copy files build phase?   
That's a question, not a rhetorical statement.  To explain: my  
experience is that if I want to add a bunch of resource type files to  
a project, I select the Resources folder in the Groups and Files pane  
on the left of the Xcode project window.  Then I cntrl-click and  
choose "Add existing files..." and navigate to my folder of jpgs or  
sound files or whatever and choose them.  Then, in code, one can do


	myArray = [[NSBundle mainBundle] pathsForResourcesOfType:@"jpg"  
inDirectory:@"myJpgsFolder"];


Ron

___

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

Please do not post 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: [iphone] in app store - remembering a purchase

2009-10-29 Thread Stuart Carnie
No, you should still provide some option to 'restore transactions' for
non-consumable / subscription based items.  See Restoring
Transactions


Cheers,

Stuart

On Thu, Oct 29, 2009 at 8:34 PM, Dragos Ionel  wrote:

> excerpt from:
>
> *Built-in Product
> Model*<
> http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Overview%20of%20the%20Store%20Kit%20API/OverviewoftheStoreKitAPI.html#//apple_ref/doc/uid/TP40008267-CH100-SW12
> >
> *
>
> In the built-in product model, everything required to deliver products is
> built in to your application. *
> *,,,
> After a product is successfully purchased, your application must unlock the
> feature and deliver it to the user. The simplest way to unlock features is
> by changing your Application Preferences. Application preferences are
> backed
> up when users backs up their phones. **Your application may want to
> recommend to users that they back up their phones after making a purchase
> to
> ensure that purchases are not lost.*
> *
> *
> *
> *
> Question:
>
> Is it correct to assume that if a user buys an in app store item, but does
> not back up his iphone, and deletes the application and reinstalls it,
> there
> is no way for the app to know that the item was bought before?
>
> If this is not correct, what would be the options available?
>
> Thank you,
> Dragos
> iphodea.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/stuart.carnie%40gmail.com
>
> This email sent to stuart.car...@gmail.com
>



-- 
Stuart Carnie
___

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

Please do not post 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


createbackupPath from boost library not working for MAC

2009-10-29 Thread Nikhil Khandelwal
Hi List,


I am running unit test cases to check the functionality. In this I am checking 
createbackupPath of boost library. Its working well for windows platform but 
not able to create backupPath for MAC. It throws some exception and later on 
when I tried to copy some file on the same location it throws system error code 
2 (address_in_use = EADDRINUSE).

Is it a known issue on MAC that createbackupPath from boost library does not 
behave as expected.



Anyone faced such issue can help me or can give some pointers to resolve it.



Thanks,

Nikhil

DISCLAIMER
==
This e-mail may contain privileged and confidential information which is the 
property of Persistent Systems Ltd. It is intended only for the use of the 
individual or entity to which it is addressed. If you are not the intended 
recipient, you are not authorized to read, retain, copy, print, distribute or 
use this message. If you have received this communication in error, please 
notify the sender and delete all copies of this message. Persistent Systems 
Ltd. does not accept any liability for virus infected mails.
___

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

Please do not post 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: createbackupPath from boost library not working for MAC

2009-10-29 Thread Kyle Sluder
On Thu, Oct 29, 2009 at 11:03 PM, Nikhil Khandelwal
 wrote:
> Is it a known issue on MAC that createbackupPath from boost library does not 
> behave as expected.

1) It's Mac, not MAC.  MAC is an acronym for Media Access Control, and
is related to Ethernet networking.

2) This is Cocoa-dev, not Boost-dev or C++-dev.

--Kyle Sluder
___

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

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

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

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


RE: createbackupPath from boost library not working for MAC OSX

2009-10-29 Thread Nikhil Khandelwal
Sorry, I mean to say MAC OSX.

Thanks,
Nikhil

-Original Message-
From: Kyle Sluder [mailto:kyle.slu...@gmail.com]
Sent: Friday, October 30, 2009 11:44 AM
To: Nikhil Khandelwal
Cc: Cocoa-dev@lists.apple.com
Subject: Re: createbackupPath from boost library not working for MAC

On Thu, Oct 29, 2009 at 11:03 PM, Nikhil Khandelwal
 wrote:
> Is it a known issue on MAC that createbackupPath from boost library does not 
> behave as expected.

1) It's Mac, not MAC.  MAC is an acronym for Media Access Control, and
is related to Ethernet networking.

2) This is Cocoa-dev, not Boost-dev or C++-dev.

--Kyle Sluder

DISCLAIMER
==
This e-mail may contain privileged and confidential information which is the 
property of Persistent Systems Ltd. It is intended only for the use of the 
individual or entity to which it is addressed. If you are not the intended 
recipient, you are not authorized to read, retain, copy, print, distribute or 
use this message. If you have received this communication in error, please 
notify the sender and delete all copies of this message. Persistent Systems 
Ltd. does not accept any liability for virus infected mails.
___

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

Please do not post 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


Cocoa conventions for floats & ints

2009-10-29 Thread Bryan Pietrzak
I've just started getting back into programming after being out of the  
game for a few years. When I was last coding for a living it was with  
Carbon. Now I'm jumping into Cocoa.


Just a quick question about conventions.

Previously it seemed the carbon world was moving to an abstract way to  
declare numbers: UInt32, SInt64, Float32, etc. Is there a similar  
convention in the Cocoa world? (Doesn't comprehensively seem to be in  
my limited searching.)


This question seems more relevant than ever now that we fast  
approaching a world where 64 bit is the norm and not the "future".


I found this information:

http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Cocoa64BitGuide/64BitChangesCocoa/64BitChangesCocoa.html#//apple_ref/doc/uid/TP40004247-CH4-SW11

where NSInteger is discussed, but I was a bit surprised to not find  
something along the lines of 8, 16, 32, 64 support for various integer  
types. Or am I just missing it?


Now I did see a few references to the C99 types (int8_t, int16_t,  
etc.), but it wasn't clear to me that this was really the Cocoa Way to  
go.


Just looking for a little guidance on the Cocoa-way of things.

Thanks

Bryan



p.s. what a wonderful time to come back to the coding side of  
things... carbon and codewarrior were old friends that served me well  
for a long time, but cocoa and xcode are very exciting!

___

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

Please do not post 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


Scripting Bridge and Xcode rule problem

2009-10-29 Thread timm...@gmail.com

Hello,

I followed the Read Me included in the SBSystemPrefs sample code to  
have Xcode automatically generate the Scripting Bridge headers for any  
application I add to my project (currently I am only using System  
Preferences). The problem is every time I build my project, either 2  
instances of System Preferences open (and stay open after the build  
finishes), or Xcode errors out with error:


	sdef: couldn't get sdef for /Applications/System Preferences.app  
(error -600)


Anyone have any ideas why sometimes sdef fails like that? Also, is it  
possible to make System Preferences open once and/or quit after sdef  
and sdp have finished with it?


Thanks!
Karl
___

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

Please do not post 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


NSManagedObjectModel

2009-10-29 Thread Logan Cautrell
I"m programmatically generating an NSManagedObjectModel (based on a web 
service). I am aware of the potential risks in doing this and have known issues 
and contingencies planned for.

My question is how do I persist changes to the model? The MOC that I create 
from the model persists properly, but I am not clear on how I can persist 
changes to the model. There does not appear to be a built-in way of doing so. 

I am prepared to save the appropriate information and regenerate the MOM at 
runtime, but I was curious if there is a way for me to persist changes using 
the framework.
   -logan___

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

Please do not post 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


Trying blocks

2009-10-29 Thread Charlie Dickman
I am trying to implement a block in one of my apps. The code looks  
like this...


BOOL (^fillWindow)(void) = ^(void) {
BOOL empty = YES;
int s = 0;
for (NSTextField *theTextField in textFieldArray) {
int textFieldValue = [[theTextField stringValue] 
intValue];
empty = empty && (textFieldValue == 0);
			[thePuzzle replaceObjectAtIndex: s++ withObject: [NSNumber  
numberWithInt: sudokuTextFieldValue]];		

}
return empty;
};
if (!fillWindow()) {...

It compiles fine but the load fails with...

  "__NSConcreteGlobalBlock", referenced from:
  ___block_holder_tmp_1.1207 in Controller.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

Can anyone explain this and help me with what I'm not doing or not  
doing right?


Charlie Dickman
3tothe...@comcast.net



___

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

Please do not post 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


Breakpoint bubbles

2009-10-29 Thread Charlie Dickman
Breakpoint bubbles have started showing in the midst of my debugging  
window for each breakpoint I have set.


What have I done to cause this and how do I stop it from happening?

Charlie Dickman
3tothe...@comcast.net



___

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

Please do not post 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


show as free/busy API for iCal

2009-10-29 Thread Nava Carmon

Hi,

I need to retrieve the "show as free/busy" property of iCal event. I  
couldn't find any matching property in CalendarStore.framework headers.
This property has became available in iCal only for Snow Leopard. How  
can i get it in my application?


Thanks a lot,

Nava.
___

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

Please do not post 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


PolKit for Leopard and later

2009-10-29 Thread Pierre-Olivier Latour
Hi everyone,

I wanted to let you know about this collection of reusable Obj-C classes
which I have used in several projects and have open-sourced some time ago.
It's called "PolKit" and provides features like advanced networking, file
system utilities, HID, MIDI & serial port devices support, OpenSSL
encryption, file upload & download for many protocols, etc...

The code is clean, ready to be used in your project, self-documented and has
unit tests. Most classes are also independent from each other, so you can
just pick what you need.

The entire project is available open-source under GPLv3 license hosted on
Google Code. If you are interested in using PolKit in a non-open-source
project and need a commercial license, please contact me.

For more info, please follow this link: http://code.google.com/p/polkit/

- Pol
___

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

Please do not post 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: NSManagedObjectModel

2009-10-29 Thread Logan Cautrell
For the record, I found using NSKeyedArchiver and it's companion to work quite 
well in saving my generated MOM. I simply serialize the MOM into my app's 
documents directory after I have generated it. I then deserialize it as needed 
during subsequent application sessions.
   -logan

On Oct 28, 2009, at 4:56 PM, Logan Cautrell wrote:

> I"m programmatically generating an NSManagedObjectModel (based on a web 
> service). I am aware of the potential risks in doing this and have known 
> issues and contingencies planned for.
> 
> My question is how do I persist changes to the model? The MOC that I create 
> from the model persists properly, but I am not clear on how I can persist 
> changes to the model. There does not appear to be a built-in way of doing so. 
> 
> I am prepared to save the appropriate information and regenerate the MOM at 
> runtime, but I was curious if there is a way for me to persist changes using 
> the framework.
>   -logan

___

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

Please do not post 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


Scripting Bridge running method passing an array

2009-10-29 Thread Scott
Hello,

I'm just learning Objective-C/Cocoa with limited programming
background. I am trying to control an application via AppleScript
commands using Scripting Bridge. I am able to do almost everything I
want except for two methods I can't get to work. I would like to
implement the following methods found in the header file created to
use Scripting Bridge

- (void) connectTo:(NSArray *)x password:(NSString *)password;  //
Connect to the Airport Express speakers
- (void) disconnectFrom:(NSArray *)x;  // Disconnect from the speakers

I am able to do many of the other methods in the header I just can't
get these two to work. I've tried not building an Array and just
sending a String and that didn't work at all. I don't get any errors
when I do the following it just doesn't do anythings. I've tried both
the disconnectFrom and connectTo just in case connecTo was failing
because of the password.

-(void)connectToSpeaker:(NSString*)connectToThisSpeaker
{

   AirfoilApplication *Airfoil =
[SBApplicationapplicationWithBundleIdentifier:@"com.rogueamoeba.Airfoil"];

   NSArray *setTheSpeaker;
   setTheSpeaker = [[NSArray alloc]
initWithObjects:connectToThisSpeaker, nil];

   @try{

   [Airfoil connectTo:setTheSpeaker password:nil];

   }

   @catch(NSException *e)
   {
   NSLog(@"Exception:%@");
   }
   NSLog(@"connected");
}


This is the code from my header file. Airfoil.h

@interface AirfoilApplication : SBApplication

- (SBElementArray *) documents;
- (SBElementArray *) windows;

@property (readonly) BOOL frontmost;  // Is this the frontmost
(active) application?
@property (copy, readonly) NSString *name;  // The name of the application.
@property (copy, readonly) NSString *version;  // The version of the
application.

- (AirfoilDocument *) open:(NSURL *)x;  // Open an object.
- (void) print:(NSURL *)x printDialog:(BOOL)printDialog
withProperties:(AirfoilPrintSettings *)withProperties;  // Print an
object.
- (void) quitSaving:(AirfoilSavo)saving;  // Quit an application.
- (void) connectTo:(NSArray *)x password:(NSString *)password;  //
Connect to the Airport Express speakers
- (void) disconnectFrom:(NSArray *)x;  // Disconnect from the speakers
- (void) openx:(NSURL *)x;  // Open an object.
- (void) print:(NSURL *)x;  // Print an object.
- (void) quitSaving:(AirfoilSavo)saving;  // Quit an application.

@end

I'd rather not use NSAppleScript just for these two methods. I've read
the Scripting Bridge developer documents but can't figure out what I
am doing wrong. Thanks for any help.

scott
___

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

Please do not post 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: Trying blocks

2009-10-29 Thread Greg Parker

On Oct 28, 2009, at 5:56 PM, Charlie Dickman wrote:

It compiles fine but the load fails with...

 "__NSConcreteGlobalBlock", referenced from:
 ___block_holder_tmp_1.1207 in Controller.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

Can anyone explain this and help me with what I'm not doing or not  
doing right?


Blocks are only available on Mac OS X 10.6. Make sure your project's  
SDK is set to 10.6 (or alternatively "Current Mac OS" if you're  
compiling on a 10.6 machine). Blocks are currently unsupported on Mac  
OS X 10.5 and iPhone OS.


_NSConcreteGlobalBlock comes from CoreFoundation. You could get this  
error if you weren't liking to CoreFoundation, but presumably you are  
linking to CoreFoundation by way of Cocoa.framework. (Otherwise you'd  
have trouble with NSNumber and NSTextField too.)



--
Greg Parker gpar...@apple.com Runtime Wrangler


___

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

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

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

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


Re: Breakpoint bubbles

2009-10-29 Thread Kyle Sluder
On Wed, Oct 28, 2009 at 5:58 PM, Charlie Dickman <3tothe...@comcast.net> wrote:
> Breakpoint bubbles have started showing in the midst of my debugging window
> for each breakpoint I have set.

Please ask the Xcode-users list.

--Kyle Sluder
___

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

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

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

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


Re: Cocoa conventions for floats & ints

2009-10-29 Thread Greg Parker

On Oct 28, 2009, at 2:35 AM, Bryan Pietrzak wrote:

I found this information:

http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Cocoa64BitGuide/64BitChangesCocoa/64BitChangesCocoa.html#//apple_ref/doc/uid/TP40004247-CH4-SW11

where NSInteger is discussed, but I was a bit surprised to not find  
something along the lines of 8, 16, 32, 64 support for various  
integer types. Or am I just missing it?


Now I did see a few references to the C99 types (int8_t, int16_t,  
etc.), but it wasn't clear to me that this was really the Cocoa Way  
to go.



Use the C99 types for explicitly-sized integers. Pretty much every  
other sized-integer type is now present for historical reasons only.



--
Greg Parker gpar...@apple.com Runtime Wrangler


___

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

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

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

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


Re: Scripting Bridge running method passing an array

2009-10-29 Thread Kyle Sluder
On Thu, Oct 29, 2009 at 7:13 PM, Scott  wrote:
> - (void) connectTo:(NSArray *)x password:(NSString *)password;  //
> Connect to the Airport Express speakers
> - (void) disconnectFrom:(NSArray *)x;  // Disconnect from the speakers

What kind of objects do these commands take when using them from AppleScript?

You're more likely to get good help if you ask Rogue Amoeba directly.

--Kyle Sluder
___

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

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

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

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


Re: Scripting Bridge and Xcode rule problem

2009-10-29 Thread Kyle Sluder
On Wed, Oct 28, 2009 at 3:08 PM, timm...@gmail.com  wrote:
> Anyone have any ideas why sometimes sdef fails like that? Also, is it
> possible to make System Preferences open once and/or quit after sdef and sdp
> have finished with it?

Even though this isn't Xcode-users (where your sdp/sdef question would
be more appropriate)… are you doing something wacky like running your
app as root?  The system shouldn't be launching multiple copies of
System Preferences.

--Kyle Sluder
___

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

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

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

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


Re: Scripting Bridge running method passing an array

2009-10-29 Thread Scott
Thanks for the response Kyle. I will ask Rogue. This is how you send
commands via AS

tell application "Airfoil"

-- Connect to Airport Express
connect to (every speaker whose name is "Computer")

end tell

On Fri, Oct 30, 2009 at 2:41 AM, Kyle Sluder  wrote:
> On Thu, Oct 29, 2009 at 7:13 PM, Scott  wrote:
>> - (void) connectTo:(NSArray *)x password:(NSString *)password;  //
>> Connect to the Airport Express speakers
>> - (void) disconnectFrom:(NSArray *)x;  // Disconnect from the speakers
>
> What kind of objects do these commands take when using them from AppleScript?
>
> You're more likely to get good help if you ask Rogue Amoeba directly.
>
> --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