Re: EXC_BAD_ACCESS on releasing pool

2008-04-16 Thread Michael Vannorsdel
You probably released an object that belonged to the pool.  Set the  
environment variable NSZombieEnabled to YES to find out which object(s).



On Apr 16, 2008, at 12:20 AM, Nick Rogers wrote:

when i release the NSAutoReleasePool in a second thread, i get this  
error EXC_BAD_ACCESS on the console.

No other description is given.
What could be wrong?


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTreeController and NSOutlineView: How do I get to the outline view's item

2008-04-16 Thread Quincey Morris


On Apr 15, 2008, at 19:48, Markus Spoettl wrote:

I have a NSDocument subclass with a simple tree structure attached  
to an NSOutlineView via NSTreeController and bindings. I learned -  
through this list - to add items in KVO compliant way like this


TreeNode *node = [[TreeNode init] alloc];
[[self mutableArrayValueForKeyPath:@treeContent] addObject:node];

this works very well the NSOutlineView gets updated and displays the  
structure I fill into my model.


The only thing that I can't seem to figure out is how to get to the  
NSOutlineView's item for a specific node that was added. Say I want  
to expand or collapse a specific node when it's added:


 [myOutlineView expandItem:node];

does not work - I believe because it's the model's data object not  
the item that represents it in the OutlineView (right?).


So how do I determine the outline item for a data node?


AFAIK, there's no way to expand a row in the view starting from the  
data model. (I mean, by doing something to the data model alone, and  
having a KVO notification trigger expansion in the outline view.)


If you're doing this in the context of populating the data model (e.g.  
creating nodes when initializing a new document), you'd probably want  
to do it by brute force: create the model data, then examine suitable  
rows of the outline view (possibly all of them), expanding the ones  
that correspond to a model object that needs to be expanded. In your  
scenario, the outline view items are NSTreeNode objects provided by  
the tree controller, and the NSTreeNode's representedObject is your  
model object -- a TreeNode, I guess.


If you're doing this in the context of a user interface action (e.g.  
inside an action method that gets called when a button is clicked to  
add a something), you might be able to take a lighter-weight  
approach. If you can work out, directly, where the row(s) were added,  
you can just expand the relevant row(s) after the data model has been  
updated. In this case, it might be convenient to use tree controller  
convenience methods such as add: or insert:, or addObject: or  
insertObject:, to work with the view-side picture of the data, letting  
the data model get updated as a side effect -- instead of using  
mutableArrayValueForKey directly.


Someone may step in and correct me here, but I believe that  
programatically controlling the expanded/contracted state of outline  
view rows has always been a PITA.


HTH

___

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

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

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

This email sent to [EMAIL PROTECTED]


[ANN] ANSystemSoundWrapper - Cocoa wrapper for changing system volume

2008-04-16 Thread Antonio Nunes

Hi,

I've put together a simple wrapper to easily change the system sound  
volume using Objective-C, obviating the need to deal directly with  
lower-level CoreAudio calls.


The files are available here: 
http://sintraworks.com/media/code/ANSystemSoundWrapper.zip

The wrapper consists of a single class that implements three class  
methods to affect the system sound volume level, and a single class  
method to get the current level:

+ (float)getSystemVolume;
+ (void)setSystemVolume:(float)inVolume;
+ (void)increaseSystemVolumeBy:(float)amount;
+ (void)decreaseSystemVolumeBy:(float)amount;

To use it you need to link against the CoreAudio framework and include  
the header file in any implementation file where you want to call any  
of the above methods. The code is distributed under the MIT license,  
so you can do pretty much anything you want with it. Any comments on  
the code always appreciated.


The sample below uses a timer to trigger periodical changes to the  
sound volume, and will play a sound to feed the new volume back, as  
long as  there is an actual change in level (i.e. until the max or min  
sound level has been reached, either 0 or 1):


- (void)increaseSystemVolume:(NSTimer*)timer
{
float oldVol = [ANSystemSoundWrapper getSystemVolume];
[ANSystemSoundWrapper increaseSystemVolumeBy:.05];  
if (oldVol != [ANSystemSoundWrapper getSystemVolume]) {
[[NSSound soundNamed:@Tink] play];
}
}

- (void)decreaseSystemVolume:(NSTimer*)timer
{
float oldVol = [ANSystemSoundWrapper getSystemVolume];
[ANSystemSoundWrapper decreaseSystemVolumeBy:.05];  
if (oldVol != [ANSystemSoundWrapper getSystemVolume]) {
[[NSSound soundNamed:@Tink] play];
}
}

-António


Energy is like a muscle,
it grows stronger through being used.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTreeController and NSOutlineView: How do I get to the outline view's item

2008-04-16 Thread Markus Spoettl

On Apr 16, 2008, at 12:18 AM, Quincey Morris wrote:
If you're doing this in the context of populating the data model  
(e.g. creating nodes when initializing a new document), you'd  
probably want to do it by brute force: create the model data, then  
examine suitable rows of the outline view (possibly all of them),  
expanding the ones that correspond to a model object that needs to  
be expanded. In your scenario, the outline view items are NSTreeNode  
objects provided by the tree controller, and the NSTreeNode's  
representedObject is your model object -- a TreeNode, I guess.



representedObject is what I couldn't find. Thanks very much once again!

Regards
Markus
--
__
Markus Spoettl

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSURL and certificates

2008-04-16 Thread Bill Monk


On Apr 16, 2008, at 12:03 AM, Stephane Huaulme  
[EMAIL PROTECTED] wrote:


when I try to fetch a web page on an internal server using:

[NSString stringWithContentsOfURL:[NSURL URLWithString: theURLString]
encoding:NSASCIIStringEncoding error:theError];

I get the following error:

CFString 0xa00daec8 [0xa01d71a0]{contents = NSUnderlyingError} =
Error Domain=NSURLErrorDomain Code=-1203 UserInfo=0x15579210 bad
server certificate

what can I do about this?


Don't know if it's related, but after installing the release version  
of Safari 3.1 and some security update or other, I'm seeing this a lot.


Amusingly, one the sites 3.1 has complained about is  
developer.apple.com...


In any case, I often have to grab many files off a certain  
bastardized download site used by a client - a site which forces you  
to click on every single URL. That got old fast, so I'd hacked  
together something with NSURLDownload to automate it all. Suddenly on  
3/18, not only was developer.apple.com getting certificate errors, so  
was this particular site, in both Safari and my app.


The archives turned up a little info about the private method
[NSURLRequest setAllowsAnyHTTPSCertificate:YES forHost:hostName].

Which I guess is not a great thing to use in production code, but if  
you have to get around the problem somehow, it does work.


However I didn't want to just blow past the certificates without  
taking a look at them. Google turned up some code (from Mike Ash I  
believe?) showing how to use the Security framework to put up a  
confirmation dialog with details for the bad certificates. I fixed  
some typos and switched to a sheet rather than a modal dialog. Ripped  
directly out of the app, Mail is going to mangle it for you below...


Posted with the usual caveats about using private API. (In this case  
it was an app for my private use, so who cares; sounds like you may  
be in a similar situation.)



// NSURLDownload delegate method
- (void)download:(NSURLDownload *)download didFailWithError:(NSError  
*)error

{
NSURL*url = [[download request] URL];
NSString *path = [url absoluteString];
NSString *description = [error localizedDescription];
NSString *reason = [error localizedFailureReason];

int errorCode = [error code];

// handle sudden onset certificate errors
//
	// first saw NSURLErrorServerCertificateHasUnknownRoot == -1203 on  
3/18/08

// after update to Safari 3.1 and a security update.
	if ( (errorCode = NSURLErrorServerCertificateHasBadDate)   
(errorCode = NSURLErrorClientCertificateRejected) )	

{
		NSURL *failingURL = [[error userInfo]  
objectForKey:@NSErrorFailingURLKey];
		NSArray *badCerts = [[error userInfo]  
objectForKey:@NSErrorPeerCertificateChainKey];


SecPolicySearchRef policySearch = NULL;

		if (SecPolicySearchCreate(CSSM_CERT_X_509v3, CSSMOID_APPLE_TP_SSL,  
NULL, policySearch) == noErr)

{
SecPolicyRef policy = NULL;
OSStatus status;

			// original code says this while-loop will only loop once, but on  
my problem
			// site it looped twice per failed URL - evidently the site had - 
two- bad
			// certificates per URL. (If it's even their fault and not  
Safari's...)
			while ((status = SecPolicySearchCopyNext(policySearch, policy))  
== noErr)	

{
SecTrustRef trust = NULL;
if (SecTrustCreateWithCertificates((CFArrayRef)badCerts, policy,  
trust) == noErr)

{
	SFCertificateTrustPanel *panel = [SFCertificateTrustPanel  
sharedCertificateTrustPanel];

NSString *host = [failingURL host];
//NSString *host = [failingURL 
_web_hostString];

[panel 
setDefaultButtonTitle:@Continue];
[panel 
setAlternateButtonTitle:@Cancel];

	if ([panel respondsToSelector:@selector 
(setInformativeText:)])	// this method is in Tiger but is undocumented

{
		//NSString *informativeText = [NSString  
stringWithFormat:@Security certificate is invalid for item %d, host % 
@, failed host [EMAIL PROTECTED], (downloadIndex + 1), [url host], host];
		// the problem with this is that once you set it, subsequent  
attempts to change it do nothing; the originally-set text remains  
unchanged. Must be doing something wrong. For now, just hardcoded to  
the problem site.
		//[panel performSelector:@selector(setInformativeText:)  
withObject:informativeText];


		[panel performSelector:@selector(setInformativeText:)  
withObject:@DownloadYouSendItItems];


Re: binary search trees binning

2008-04-16 Thread Jean-Daniel Dupas


Le 16 avr. 08 à 04:14, Michael Ash a écrit :

On Tue, Apr 15, 2008 at 5:38 PM, Jean-Daniel Dupas
[EMAIL PROTECTED] wrote:
If you need a storage that provide binary search, you can probably  
use a

CFBinaryHeap.

CFBinaryHeap  implements a container that stores values sorted  
using a

binary search algorithm. All binary heaps are mutable; there is not a
separate immutable variety.


Despite the name, CFBinaryHeap does not provide any binary search  
facilities.


It is a priority queue, heap being another name for that. In other
words, it's an object where you can put things into it in any order,
but when you get an object from it that object is always the smallest
one in the container, and it's implemented so that this is very fast,
O(log n).

I can see ways to use this object to implement this sort of histogram,
but it doesn't let you specify an input value and get an index to the
closest match.

Mike


Sorry, I was abused by the class description.
So I think the closer way to do it using built-in function is using  
CFArray (NSArray free bridged) and the CFArrayBSearchValues() function.
But it look like it does not really returns the closest match, but the  
index of the value greater than the target value (if exact value not  
found).


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: binary search trees binning

2008-04-16 Thread Jean-Daniel Dupas




Le 16 avr. 08 à 00:07, John Stiles a écrit :


Hmm, setdouble sounds a lot easier than this to me.

Just use insert to put all the doubles into the set (one line), then  
use lower_bound to find the delineations between each group (another  
one-liner, though of course you'll need to loop over the number of  
groups you want). Then the distance between iterators is the size of  
each group (std::distance can compute this in another one-liner).


Unfortunately this is another case where Cocoa's collection classes  
just aren't very strong,  but STL is made for this sort of work...  
though Jens is probably right that performance isn't going to be a  
big problem if it's 1 items. The set will be a whole lot  
faster, but any naive implementation will be fast enough unless  
you expect your data set will eventually be a lot larger than this.




Do not make assumptions on CFArray vs STL vectors performances,  
especially for big arrays.
CFArray has some optimizations that made it really fast for some  
usages. (http://ridiculousfish.com/blog/archives/2005/12/23/array/).



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Memory leak when re-alloc Methods

2008-04-16 Thread Jonathan del Strother
On Wed, Apr 16, 2008 at 1:17 AM, Mario Gajardo Tassara
[EMAIL PROTECTED] wrote:

  El 15-04-2008, a las 14:21, [EMAIL PROTECTED] escribió:


 
   I have a nasty leak problem when i realloc several methods of the main
 class of my app.
  
 
   Without seeing your code, all I can suggest is making sure you've
  followed these rules:
 
 
 http://devworld.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Tasks/MemoryManagementRules.html#
 
  --
  I.S.
 

  Problem solved !!! ,

  I just moved the alloc and init of  blisterModelClass_ from:

  //the button to star the game and initialize several related methods

  - (IBAction)button {

 /*  blisterModelClass_=[[BlisterModel alloc]init]; */ // here
 was the leak problem

 [blisterModelClass_ cleanMiscArrays];
 [blisterModelClass_ initArrays];
 [blisterModelClass_ initObjectsArrays];
 [blisterModelClass_ initSpriteArrays];
 [blisterModelClass_ setObjectsMainData];
 [blisterModelClass_
 initSpritesObjectsPosition:the_cg_rect_];
 [blisterModelClass_ changeCursor];

 [NSTimer scheduledTimerWithTimeInterval:0.04

 target:self

 selector:@selector(refreshDisplay)

 userInfo:nil

 repeats:YES];

 blisterModelClass_ changeCursor];
 }
  }

  to the NSView initWithFrameMethod:

  -(id)initWithFrame:(NSRect)frameRect {

 self=[super initWithFrame:frameRect];

 if (self) {
 blisterModelClass_=[[BlisterModel alloc]init]; //
 is_full_screen_=FALSE;
 is_anim_started_=FALSE;
 }
 return self;
  }

  this prevent the re allocation of the same Class instance every time i hit
 the button to renew the state of the game.


If you've still got that timer in the button method, you're going to
be installing new timers every time the button is hit...
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Getting feedback from application

2008-04-16 Thread parag vibhute
Thanks for url.

But this  earlier urls which I received in this thread are for tutorials
for making an application like stuff. What I require is adding native
functionality by using which user will send feedback regarding that
application. I would like to know has Apple mentioned some guidelines or
APIs regarding this?

Thanks,
Palav


On Tue, Apr 15, 2008 at 9:31 PM, Matt Long [EMAIL PROTECTED]
wrote:

 This might help you:
 http://www.matthew-long.com/2007/11/09/xcode-30-tutorial/

 It's a bit shorter tutorial than the Apple one.

 -Matt




 On Apr 15, 2008, at 9:25 AM, Mike R. Manzano wrote:

  Please read one of the many fine tutorials on the subject, including this
  one:
  http://developer.apple.com/documentation/Cocoa/Conceptual/ObjCTutorial/objctutorial.pdf
 
  Regards,
 
  Mike
 
 
  On Apr 15, 2008, at 1:31 AM, parag vibhute wrote:
 
   Hi guys,
  
   I have created a cocoa application. Now I would like to have
   functionality
   such that there will be a button, on clicking that application will
   send
   feedback to me. Is there any class or any documentation available for
   this?
  
   Please give your feedback/comments.
  
   Thank,
   Parag
  
 
  ___
 
  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/matt.long%40matthew-long.com
 
  This email sent to [EMAIL PROTECTED]
 




-- 

There are many things in your life that will catch your eye but only a few
will catch your heartpursue those'.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [ANN] ANSystemSoundWrapper - Cocoa wrapper for changing system volume

2008-04-16 Thread Antonio Nunes

On Apr 16, 2008, at 9:06 AM, Jean-Daniel Dupas wrote:

I don't want to start another Code design war, but just wonder if  
doing Utility Class is a common practice in obj-c. Unlike Java or  
other object oriented language, obj-c is a superset of C and support  
simple functions. Wouldn't it be simpler to declare 4 functions  
instead of 4 class methods ?


float ANGetSystemVolume();
void ANSetSystemVolume:(float volume);


Don't know about simpler, but it's certainly a valid, and possibly  
more common, alternative. I don't think I have a pronounced preference  
for either. I'll just as happily create a functions based  
implementation if requested.


António


Today you are You, that is truer than true.
There is no one alive who is Youer than You.
Today I am Me, and I am freer than free.
There is no one alive who is Me-er than Me.
I am the BEST I can possibly be.

--Dr. Seuss



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Getting feedback from application

2008-04-16 Thread Ron Fleckner


On 16/04/2008, at 6:19 PM, parag vibhute wrote:

Thanks for url.

But this  earlier urls which I received in this thread are for  
tutorials

for making an application like stuff. What I require is adding native
functionality by using which user will send feedback regarding that
application. I would like to know has Apple mentioned some  
guidelines or

APIs regarding this?

Thanks,
Palav


Hi Palav,

yes, your original post could have been taken to mean a number of  
things.  I suspected you were asking about sending feedback from your  
app in the wild to your server on the net, yes?  I became curious and  
had a quick look.


It looks like you'd need to implement some ftp transfer to upload the  
feedback message to wherever you want, so I think the answers can be  
found in the CFNetwork Programming Guide.  It would be in your  
Xcode documentation or on Apple's dev site.


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 [EMAIL PROTECTED]


Detect phone number in NSString

2008-04-16 Thread Brad Peterson
Hi all,

Like many cell phones are doing these days, I want to
be able to detect phone numbers in NSStrings and
highlight them in some way for the user. 

So, if I had some text, say : Hi Tom, Please call
Cheryl at 444-555-6767 and she can get you that
info... I want to be able to know that 444-555-6767
is a phone number and should be marked as such. 

I've searched the archives, but didn't find anything
on this list. I thought about using NSString's isLike:
method, but that doesn't necessarily help me locate
the position of the phone number, IIRC; merely to know
that there might be one.

Any thoughts would be greatly appreciated.

Thank you!


  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
___

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

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

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

This email sent to [EMAIL PROTECTED]


NSValue value:withObjCType:

2008-04-16 Thread Gerriet M. Denkmann
NSValue has two methods: value:withObjCType: and  
valueWithBytes:objCType: .


What is the difference between these two methods? When do I have to  
use the first, when the second?

I am rather confused.

Kind regards,

Gerriet.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Enabling File Open/Save etc in a non-document-based application

2008-04-16 Thread Roland King
First post. I've been dragging my way through the Cocoa documentation  
and trying some simple apps. I started with non-document apps and of  
course you still get the File menu, but most of it's disabled. I  
understand that when you create a document-based app (and I have a lot  
more reading to do there) those menu items are enabled and you get the  
file browser etc for free.


I was trying to figure out if it's possible to enable and use the file  
save and open even on a non-document-based app, eg assume some  
stupidly simple app which just lets you 'open' any file you like and  
gives you information about it in a window. I haven't been able to  
understand what's driving those menu items, what's enabling and  
disabling them in the Document-based app which isn't there in a non- 
document-based one and what methods I'd need to supply if I wanted to  
add that kind of support.


Is there an example out there somewhere of a non-document-based app  
which uses some or all of the file menu items, or a piece of API  
documentation I haven't found which explains it? Or is this just  
something you just don't do .. if you want to use File menu stuff at  
all .. you make a document-based app?


Thanks
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Getting feedback from application

2008-04-16 Thread parag vibhute
Hi Ron,

Ya it is right that I will need to implement the networking functionality
for sending feedback from my application to server. But I wanted to know
that has Apple mentioned some guideline for this? I would like to follow
those guideline.

Thanks,
Palav

On Wed, Apr 16, 2008 at 2:15 PM, Ron Fleckner [EMAIL PROTECTED]
wrote:


 On 16/04/2008, at 6:19 PM, parag vibhute wrote:

  Thanks for url.
 
  But this  earlier urls which I received in this thread are for
  tutorials
  for making an application like stuff. What I require is adding native
  functionality by using which user will send feedback regarding that
  application. I would like to know has Apple mentioned some guidelines or
  APIs regarding this?
 
  Thanks,
  Palav
 

 Hi Palav,

 yes, your original post could have been taken to mean a number of things.
  I suspected you were asking about sending feedback from your app in the
 wild to your server on the net, yes?  I became curious and had a quick look.

 It looks like you'd need to implement some ftp transfer to upload the
 feedback message to wherever you want, so I think the answers can be found
 in the CFNetwork Programming Guide.  It would be in your Xcode
 documentation or on Apple's dev site.

 Ron




-- 

There are many things in your life that will catch your eye but only a few
will catch your heartpursue those'.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSAllocateCollectable() questions

2008-04-16 Thread Alastair Houghton

On 16 Apr 2008, at 03:29, Michael Ash wrote:

On Tue, Apr 15, 2008 at 4:53 PM, Greg Parker [EMAIL PROTECTED]  
wrote:


You don't need a write barrier when erasing GC-scanned memory. The  
write

barrier helps the collector see pointers that it might otherwise miss
because it's cheating. It does not help the collector forget a  
value that
it saw previously. (In particular, the old pointer value might be  
gone from
the zeroed location, but without re-scanning everything there's no  
way to

know that it doesn't still exist somewhere else.)


If this is the case then how does the collector know that you have
cleared the memory. It seems to me that without a write barrier, the
collector will not see the change and will think that that you
continue to hold the old pointer in this memory.


No.  The garbage collector does not use reference counting, and so  
your statement is not true.  If you overwrite the last pointer to an  
object with a nil, the pointed-to object *may* survive the current  
garbage collection cycle, but it will not survive the next one.


If you want to understand why, there are a number of books and papers  
on the subject, as well as numerous resources on the Internet that  
explain how garbage collectors are implemented.  One of the best is  
Paul R. Wilson's Uniprocessor Garbage Collection Techniques, which you  
can find here:


  ftp://ftp.cs.utexas.edu/pub/garbage/bigsurv.ps

Cocoa GC is actually a concurrent collector, but if you read through  
the parts describing mark-sweep, incremental and generational  
collection you will have a good idea what the write barrier does and  
doesn't do and why it is needed.


Richard Jones' Garbage Collection Page is also quite good, and he has  
written a book on the topic as well:


  http://www.cs.kent.ac.uk/people/staff/rej/gc.html

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 [EMAIL PROTECTED]


Re: Getting feedback from application

2008-04-16 Thread Ron Fleckner


On 16/04/2008, at 6:51 PM, parag vibhute wrote:


Hi Ron,

Ya it is right that I will need to implement the networking  
functionality for sending feedback from my application to server.  
But I wanted to know that has Apple mentioned some guideline for  
this? I would like to follow those guideline.


Thanks,
Palav


Well, yeah, it's a 'guide', so I suppose that means you could think  
of it as giving you 'guidelines'.  Seriously, have a look.  I've  
found reading the programming guides to be very helpful.  There's  
usually good example code which you can often copy and paste from.   
There certainly is in the CFNetwork Programming Guide.


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 [EMAIL PROTECTED]


Re: [ANN] ANSystemSoundWrapper - Cocoa wrapper for changing system volume

2008-04-16 Thread Mike Abdullah
Also, another alternative is to follow a singleton pattern like  
NSFileManager et. al and implement these as instance methods. If you  
do persist with either of the ObjC-based approaches, I would also  
suggest changing your first method to:


+ (float)systemVolume;

as this is more common Cocoa practice. The get prefix is generally  
reserved for methods that return something by reference.


Finally, it occurs to me that one possible good reason for using a  
singleton approach rather than anything else, is if you can make - 
systemVolume KVO compliant such that the user changing the system  
volume normally will issue a notification in your app that it has  
changed. Very nice for UI code to bind to.


Actually, I have a further alternative that I've just thought of.  
Rather than declaring your own class for these methods, you could keep  
them as class methods, but turn it into a category on NSSound. So  
you'd have:


@interface NSSound (ANSystemVolumeAdditions)

+ (float)systemVolume;
+ (void)setSystemVolume:(float)inVolume;
+ (void)increaseSystemVolumeBy:(float)amount;
+ (void)decreaseSystemVolumeBy:(float)amount;

@end

On 16 Apr 2008, at 09:35, Antonio Nunes wrote:


On Apr 16, 2008, at 9:06 AM, Jean-Daniel Dupas wrote:

I don't want to start another Code design war, but just wonder if  
doing Utility Class is a common practice in obj-c. Unlike Java or  
other object oriented language, obj-c is a superset of C and  
support simple functions. Wouldn't it be simpler to declare 4  
functions instead of 4 class methods ?


float ANGetSystemVolume();
void ANSetSystemVolume:(float volume);


Don't know about simpler, but it's certainly a valid, and possibly  
more common, alternative. I don't think I have a pronounced  
preference for either. I'll just as happily create a functions based  
implementation if requested.


António


Today you are You, that is truer than true.
There is no one alive who is Youer than You.
Today I am Me, and I am freer than free.
There is no one alive who is Me-er than Me.
I am the BEST I can possibly be.

--Dr. Seuss



___

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/cocoadev%40mikeabdullah.net

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Getting feedback from application

2008-04-16 Thread Johan Kool

Hello Parag,

Is this the kind of functionality you were after:

http://www.zathras.de/angelweb/sourcecode.htm#UKCrashReporter

See UKFeedbackProvider  and NiftyFeatures on that page...

Johan

---
http://www.johankool.nl/




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Enabling File Open/Save etc in a non-document-based application

2008-04-16 Thread Roland King

I think perhaps I'm not being clear in what I'm asking.

The File Open (for instance) menu item is already assigned, it sends  
openDocument: to FirstResponder. I can see it right there in the  
bindings, that menu item is already set up to call something.


Yes I suppose I could write my own entirely different method which  
pops up a file chooser, then waits for user input and displays the  
results, but that doesn't seem to be using the framework, I want it to  
pop up the open file dialog (like it usually does) and just hand me  
the filename in a callback later. But is that plumbing only available  
automatically in document-based applications.




On Apr 16, 2008, at 5:45 PM, Ramón Medrano Llamas wrote:

First implement a -(IBAction)myaction:(id)sender; method that, for  
example, shows file properties. Assign this method (action) to the  
menu intem and it is done.


When a menu item has an action, it will be enabled automatically.

El 16/04/2008, a las 11:30, Roland King escribió:
but they are already assigned to .. the first responder I think.  
And they are disabled menu items too .. what enables them?




On Apr 16, 2008, at 5:26 PM, Ramón Medrano Llamas wrote:

It's easy, you must assign in Interface Builder an action to those  
menu items that do the tasks you want.


2008/4/16, Roland King [EMAIL PROTECTED]:
First post. I've been dragging my way through the Cocoa  
documentation and trying some simple apps. I started with non- 
document apps and of course you still get the File menu, but most  
of it's disabled. I understand that when you create a document- 
based app (and I have a lot more reading to do there) those menu  
items are enabled and you get the file browser etc for free.


I was trying to figure out if it's possible to enable and use the  
file save and open even on a non-document-based app, eg assume  
some stupidly simple app which just lets you 'open' any file you  
like and gives you information about it in a window. I haven't  
been able to understand what's driving those menu items, what's  
enabling and disabling them in the Document-based app which isn't  
there in a non-document-based one and what methods I'd need to  
supply if I wanted to add that kind of support.


Is there an example out there somewhere of a non-document-based  
app which uses some or all of the file menu items, or a piece of  
API documentation I haven't found which explains it? Or is this  
just something you just don't do .. if you want to use File menu  
stuff at all .. you make a document-based app?


Thanks
___

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

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

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

This email sent to [EMAIL PROTECTED]



--

Ramón Medrano Llamas
Coordinador de eventos  Webmaster
EUITIO Mac's Users  Developers

[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]

http://ramonmedrano.es/


Advertencia Legal:
Este correo electrónico es confidencial y no se autoriza su uso,  
revelación, distribución, impresión o copia.
Este mensaje de correo electrónico y sus documentos adjuntos están  
dirigidos exclusivamente a los destinatarios especificados.
La información contenida puede ser confidencial y/o estar  
legalmente protegida.
Si Usted recibe este mensaje por error, por favor comuníqueselo  
inmediatamente al remitente y elimínelo ya que usted no está  
autorizado al uso, revelación, distribución, impresión o copia de  
toda o alguna parte de la información contenida.


___

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/ramon%40ramonmedrano.es

This email sent to [EMAIL PROTECTED]



--

Ramón Medrano Llamas
Coordinador de eventos  Webmaster
EUITIO Mac's Users  Developers

[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]

http://ramonmedrano.es/


Advertencia Legal:
Este correo electrónico es confidencial y no se autoriza su uso,  
revelación, distribución, impresión o copia.
Este mensaje de correo electrónico y sus documentos adjuntos están  
dirigidos exclusivamente a los destinatarios especificados.
La información contenida puede ser confidencial y/o estar legalmente  
protegida.
Si Usted recibe este mensaje por error, por favor comuníqueselo  
inmediatamente al remitente y elimínelo ya que usted no está  
autorizado al uso, revelación, distribución, impresión o copia de  
toda o alguna parte de la información contenida.








___

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

Please do not post 

Re: Enabling File Open/Save etc in a non-document-based application

2008-04-16 Thread Roland King
but they are already assigned to .. the first responder I think. And  
they are disabled menu items too .. what enables them?




On Apr 16, 2008, at 5:26 PM, Ramón Medrano Llamas wrote:

It's easy, you must assign in Interface Builder an action to those  
menu items that do the tasks you want.


2008/4/16, Roland King [EMAIL PROTECTED]:
First post. I've been dragging my way through the Cocoa  
documentation and trying some simple apps. I started with non- 
document apps and of course you still get the File menu, but most of  
it's disabled. I understand that when you create a document-based  
app (and I have a lot more reading to do there) those menu items are  
enabled and you get the file browser etc for free.


I was trying to figure out if it's possible to enable and use the  
file save and open even on a non-document-based app, eg assume some  
stupidly simple app which just lets you 'open' any file you like and  
gives you information about it in a window. I haven't been able to  
understand what's driving those menu items, what's enabling and  
disabling them in the Document-based app which isn't there in a non- 
document-based one and what methods I'd need to supply if I wanted  
to add that kind of support.


Is there an example out there somewhere of a non-document-based app  
which uses some or all of the file menu items, or a piece of API  
documentation I haven't found which explains it? Or is this just  
something you just don't do .. if you want to use File menu stuff at  
all .. you make a document-based app?


Thanks
___

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

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

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

This email sent to [EMAIL PROTECTED]



--

Ramón Medrano Llamas
Coordinador de eventos  Webmaster
EUITIO Mac's Users  Developers

[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]

http://ramonmedrano.es/


Advertencia Legal:
Este correo electrónico es confidencial y no se autoriza su uso,  
revelación, distribución, impresión o copia.
Este mensaje de correo electrónico y sus documentos adjuntos están  
dirigidos exclusivamente a los destinatarios especificados.
La información contenida puede ser confidencial y/o estar legalmente  
protegida.
Si Usted recibe este mensaje por error, por favor comuníqueselo  
inmediatamente al remitente y elimínelo ya que usted no está  
autorizado al uso, revelación, distribución, impresión o copia de  
toda o alguna parte de la información contenida.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Chained Migration of Leopard CoreData stores

2008-04-16 Thread Ruotger Skupin

Hi,

let's say I have four versions of my data model:

DataModel1.xcdatamodel
DataModel2.xcdatamodel
DataModel3.xcdatamodel
DataModel4.xcdatamodel (this is the current one)

and three model mapping files which always map from version n to  
version n+1:


Mapping1to2.xcmappingmodel
Mapping2to3.xcmappingmodel
Mapping3to4.xcmappingmodel


Now I load a version 1 data file:

NSDictionary *options = [NSDictionary dictionaryWithObject:[NSNumber  
numberWithBool:YES]  
forKey:NSMigratePersistentStoresAutomaticallyOption];

NSError *error = nil;
if (![persistentStoreCoordinator  
addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:url  
options:options error:error])

{
 ...
}

should the data file automatically be migrated to the current version  
4 or do I need a single direct mapping like this:


Mapping1to4.xcmappingmodel


Ruotger

___

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

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

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

This email sent to [EMAIL PROTECTED]


HICocoaViewCreate question

2008-04-16 Thread Dmitry Markman

Hi, I'm playing with the HICocoaViewCreate method

so here is a code which I call from the main thread

HIViewRef rootView = HIViewGetRoot(rootWindow);
NSRect  buttonRect = NSMakeRect(0,0,150,30);
NSButton *button = [[NSButton alloc] initWithFrame : buttonRect];
[button setButtonType:NSMomentaryPushButton ];
[button setImagePosition : NSNoImage];
[button setBezelStyle  : NSRoundedBezelStyle];
[button setKeyEquivalent:@\r];
[button setTitle:@Cocoa Button];

OSErr err = HICocoaViewCreate(button,0,cocoaView);
[button release];
if(err == noErr) {
HIRect outRect = CGRectMake(100,30,150,30);
HIViewSetFrame(cocoaView, outRect);
err = HIViewAddSubview(rootView, cocoaView);
HIViewSetVisible(cocoaView,TRUE);
}

after that I CAN SEE the button in the expected place
but it's dead:  doesn't respond to any event and it's not flashing  
as a default button (it's just a blue button)

also in the console I can see
2008-04-16 07:09:46.800 Gateways[57273:882b] NSView is wrapped by  
HIView but drawn out of band


thanks in advance for any help

Dmitry Markman

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: binary search trees binning

2008-04-16 Thread Army Research Lab
Have you looked at hash_multimap
(http://www.sgi.com/tech/stl/hash_multimap.html)?  Note that the following
code was beaten out in entourage, without compiling, testing, etc.

struct eqdouble
{
  bool operator()(const double d1, const double d2) const
  {
double diff = d1 - d2;
if (diff  0.0)
diff = -diff;
return diff  0.1; // Or whatever other epsilon you want.
  }
};

struct hashfunc
{
// This operator hashes numbers into bins of differing ranges.
// If all your bins are the same size, use divide.
size_t operator()(const double d) const
{
if (d  1.0)
return 1.0;
if (d  3.0)
return 2.0;
if (d  35.0987)
return 3.0;
return 4.0;
}
};

typedef hash_multimapdouble, double, hashfunc, eqdouble map_type;

void lookup(const map_type Map, const double d)
{
  cout  d  : ;
  pairmap_type::const_iterator, map_type::const_iterator p =
Map.equal_range(d);
  for (map_type::const_iterator i = p.first; i != p.second; ++i)
cout  (*i).second   ;
  cout  endl;
}

int main()
{
  map_type M;
  M.insert(map_type::value_type(1.0, 1.0));
  M.insert(map_type::value_type(2.0, 2.0));
  M.insert(map_type::value_type(2.0, 12.0));
  M.insert(map_type::value_type(2.0, 13.0));
  M.insert(map_type::value_type(3.0, 16.0));
  M.insert(map_type::value_type(35.0, 17.0));
  M.insert(map_type::value_type(-56.9, 18.0));
  M.insert(map_type::value_type(42.0, 127.0));

  lookup(M, 1.0);
  lookup(M, 2.0);
  lookup(M, 35.0);
}

Thanks,
Cem Karan

___

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

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

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

This email sent to [EMAIL PROTECTED]


WebKit+AppleScript+JavaScript

2008-04-16 Thread Praveen Kumar

Hi,

	I created a Cocoa application that uses WebKit to show the Html  
pages. The Javascript files access cocoa methods using the concept   
Using Objective-C From JavaScript . I got a issue after adding apple  
scriptability to the project. The app is not quitting from dock and  
also not quitting when the shutdown process sends the SIGTERM signal  
to it.


	After a struggle i got to know that the issue is caused by the  
NSAppleScriptEnabled set to YES in the info.plist file. If i set to NO  
or remove it from info.plist then quit is working fine.


	Instead of AppleScript, I tend to use NSTask to launch the  
application, but it won't use the active application instead it opens  
another one and do the stuff.


Please let me know if you have any suggestions.

Thanks in advance,
M Praveen Kumar.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: listing users

2008-04-16 Thread Jean-Daniel Dupas


Le 16 avr. 08 à 15:09, Alexander Cohen a écrit :

Whats the best way in cocoa to get a list of users on a machine for  
10.4 and up?


thx

AC


The most reliable way to do it is to use Directory Services.
There is no official Obj-C DS API  (The DSObjcWrapper is part of  
darwin and is open sources but it's a private framework) and the C API  
is fairly complex.


But, POSIX call uses Directory Service API under the hood, so using  
the BSD API is probably the way to go:


#include sys/types.h
#include pwd.h

int main () {
  struct passwd *p;

  while ((p = getpwent())) {
// Note: p-pw_uid is declared as an unsigned int,
// but Darwin uses it as an signed value (nobody has id -2), so  
you have to cast it

if ((int32_t)p-pw_uid = 500) {
  printf (id %d = '%s'\n, p-pw_uid, p-pw_name);
} else {
  printf ((system) - id %d = '%s'\n, p-pw_uid, p-pw_name);
}
  }

  return 0;
}

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSDrawer resizing problem - no longer resizes when parent window resized

2008-04-16 Thread Karl Moskowski
I found this message in the archives from a few months ago. In case  
anyone else runs into it, I discovered that it happens only when  
garbage collection is enabled. I filed Radar 5867411.




I've an odd problem with a drawer in my application. I'm seeing the
behavior on Leopard, but it could have started sooner.

It opens itself normally, and when I move the parent window around, it
stays attached and moves as it should.

However, when I resize the parent window, the drawer doesn't resize
itself. It stays put.
If I make the parent window larger, it can obscure the drawer. If I
make the parent window smaller, the drawer is detached. It is like the
link is completely broken on resizes.

Closing and opening the drawer sets things right again.

I'm a bit lost on this one. Anyone seen anything like it?



Karl Moskowski [EMAIL PROTECTED]
Voodoo Ergonomics Inc. http://voodooergonomics.com/

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Resizing NSView with CABasicAnimation

2008-04-16 Thread Michael Fey

Bill,

Given that you've written the book on Core Animation, I really  
appreciate your insights.  Since my view is layer backed (I called  
setWantsLayer:YES on a parent view), then my call to [[self layer]  
addAnimation...] should be [self addAnimation] instead?  The other  
thing that I'm not sure about is the NSString values that I'm passing  
in for animationWithKeyPath: and addAnimation:forKey:.  Do those look  
correct for resizing the view?


Scott,

Your suggesstion to do away with the explicit animation is a good one,  
so let me explain my reasons for using it:  I am trying to chain  
together a series of animations and I don't want one to happen before  
the previous one has finished.  By using a CABasicAnimation I can  
specify a delegate (in this case my NSView subclass) that has the  
animationDidStart and animationDidEnd methods.  Using these delegate  
methods I intended to control the series of animations.  If there is a  
better way of waiting for one animation to finish before starting  
another one I am all ears, especially if I can do it with implicit  
animations.



Thanks to both of you,
 Michael


On Apr 16, 2008, at 1:02 AM, Scott Anguish wrote:



On Apr 15, 2008, at 11:01 PM, Bill Dudney wrote:

Hi Michael,

Are you layer backed or layer hosting (i.e. did you se the layer  
explicitly?) If you are layer hosting then add he explicit  
animation to the view instead of the layer (when layer backing you  
should not manipulate the layer directly).




I don't think it matters.  If he's trying to resize the view, the  
layers aren't relevant.  this can be done trivially through the  
view's animator with or without layer backing/layer hosting/ being on.



If you are doing layer hosting then try leaving the 'from' and 'to'  
values out.




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: WebKit+AppleScript+JavaScript

2008-04-16 Thread Jens Alfke


On 16 Apr '08, at 5:16 AM, Praveen Kumar wrote:

	Instead of AppleScript, I tend to use NSTask to launch the  
application, but it won't use the active application instead it  
opens another one and do the stuff.


Launching GUI apps via low-level Unix system calls (as NSTask does)  
can be problematic. CoreServices, which keeps track of application  
processes, either isn't aware of those, or is but treats them  
differently; I'm not sure which. I do know that the only one copy of  
an app can be running at once rule only applies to apps launched by  
LaunchServices; so if you start one yourself via exec or NSTask, and  
then something goes through the normal launch mechanism (in this case  
AppleScript), a second copy will be launched.


It would be better if you used NSWorkspace to launch your app. Or for  
more control, you can call LaunchServices directly.


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Propagation of KVO through bindings

2008-04-16 Thread Hamish Allan
Hi,

If I set up key-value observing of an NSArrayController's
arrangedObjects like so:

[myArrayController addObserver:self forKeyPath:@arrangedObjects
options:(NSKeyValueObservingOptionOld|NSKeyValueObservingOptionNew)
context:nil];

I get informed when the array controller's content changes.

Now if I set up an extra level of indirection:

myDictionary = [[NSMutableDictionary alloc] init];
[myDictionary bind:@boundArrangedObjects toObject:myArrayController
withKeyPath:@arrangedObjects options:nil];
[myDictionary addObserver:self forKeyPath:@boundArrangedObjects
options:(NSKeyValueObservingOptionOld|NSKeyValueObservingOptionNew)
context:nil];

I would expect to be informed of the change twice, but though (if I
log its contents) myDictionary.array seems to be being kept up to
date, KVO is not informing me of the change through the binding.

Is this expected behaviour, and if so, is it possible to get the
notifications I want some other way?

Thanks,
Hamish

P.S. I have tried the array controller in both entity and class modes
and it seems to make no difference.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: WebKit+AppleScript+JavaScript

2008-04-16 Thread Mike Abdullah
If it is absolutely necessary to use NSTask for launching the app, you  
can also use the open command which honours the one instance per-app  
rule properly. However, I agree that NSWorkspace is the best thing to  
use in most cases.


Mike.

On 16 Apr 2008, at 15:43, Jens Alfke wrote:



On 16 Apr '08, at 5:16 AM, Praveen Kumar wrote:

	Instead of AppleScript, I tend to use NSTask to launch the  
application, but it won't use the active application instead it  
opens another one and do the stuff.


Launching GUI apps via low-level Unix system calls (as NSTask does)  
can be problematic. CoreServices, which keeps track of application  
processes, either isn't aware of those, or is but treats them  
differently; I'm not sure which. I do know that the only one copy  
of an app can be running at once rule only applies to apps launched  
by LaunchServices; so if you start one yourself via exec or NSTask,  
and then something goes through the normal launch mechanism (in this  
case AppleScript), a second copy will be launched.


It would be better if you used NSWorkspace to launch your app. Or  
for more control, you can call LaunchServices directly.


—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/cocoadev%40mikeabdullah.net

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Frameworks in bundles?

2008-04-16 Thread Karsten

Hi Thomas,

you need to link the plugins to the frameworks as well, or you add the  
linker option: -undefined dynamic_lookup to the plugins. That will  
stop linker errors, but you'll have to make sure that the objects that  
are not found during linking, are there at execution time, when they  
are accessed. Otherwise your app will crash.


You can also specify where the frameworks are located, that's  
something like @executablePath/../Framworks, but i'm not sure about  
how to do that, but that must be specified in your main bundle's build  
settings already.


If that all doesn't help, maybe you should also write which errors  
occur.


Kind Regards
Karsten



Am 15.04.2008 um 23:15 schrieb Thomas Backman:


Hi everybody.
I'm writing a plugin architecture for my app. I just moved a class  
from the main project to a new Bundle project, and got 18 errors  
because of a few missing frameworks. I'm using two frameworks that I  
ship with the app, since they're not included in OS X.
To start with, I'll have three plugins, all of which require those  
frameworks.
Now, that means that the three plugins, each with only 100-150 lines  
of code, need 4MB worth of frameworks... Is there a way to get  
around this without making it ugly, to include the frameworks *once*?


Obviously, it'd be great if the solution meant that plugin  
developers wouldn't have to include the frameworks as well...

Any ideas?

Regards,
Thomas
___

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/karsten%40briksoftware.com

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Detect phone number in NSString

2008-04-16 Thread Dave DeLong
The thing that first comes to mind would be to use regular expressions.
 CocoaDev has a good page listing where you could find some Regex
frameworks:
http://www.cocoadev.com/index.pl?RegularExpressions

Then you'd run your string through a matcher while looking for the phone
number pattern.  You could use a pattern similar to:

(\(\d{3}\)\s?)?\d{3}[-\s\.]\d{4} (UNTESTED)
This will look for a phone number that has an area code in parenthesis (but
that is optional), followed by three digits, a hyphen, space, or period, and
then four digits.

If your regex returns a successful match, then you know a phone number is
in the string.

Googling should lead you to some much cleaner regexes for phone numbers,
since those are a relatively common thing to search for.

HTH,

Dave DeLong

On Wed, Apr 16, 2008 at 2:47 AM, Brad Peterson [EMAIL PROTECTED] wrote:

 Hi all,

 Like many cell phones are doing these days, I want to
 be able to detect phone numbers in NSStrings and
 highlight them in some way for the user.

 So, if I had some text, say : Hi Tom, Please call
 Cheryl at 444-555-6767 and she can get you that
 info... I want to be able to know that 444-555-6767
 is a phone number and should be marked as such.

 I've searched the archives, but didn't find anything
 on this list. I thought about using NSString's isLike:
 method, but that doesn't necessarily help me locate
 the position of the phone number, IIRC; merely to know
 that there might be one.

 Any thoughts would be greatly appreciated.

 Thank you!
___

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

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

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

This email sent to [EMAIL PROTECTED]


NSString and utf16

2008-04-16 Thread Alexander Cohen
I have an NSString that contains this Unicode character: '\u00e9'. I  
have another app that represents the same character as 'e\u0301'. Is  
there any way to transform one to the other so that isEqualToString  
returns YES?


thx

AC
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Why should we set ivars to nil in dealloc?

2008-04-16 Thread Scott Ribe
 For example, how long does the typical app run for with libgmalloc
 hanging out and chewing up pages?

Well, that is actually one reason that I've been wanting to go 64-bit ;-)

-- 
Scott Ribe
[EMAIL PROTECTED]
http://www.killerbytes.com/
(303) 722-0567 voice


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Enabling File Open/Save etc in a non-document-based application

2008-04-16 Thread Erik Buck
See the TextEdit example code on you hard disk.  The last time I looked, it was 
not a document based application, and it certainly displays an Open dialog.  
Or, you can look at the sample in Cocoa Programming which explains in detail 
how the Cocoa document infrastructure works including a partial 
re-implementation in sample code.  
http://www.cocoaprogramming.net/Downloads.html


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSAllocateCollectable() questions

2008-04-16 Thread Clark Cox
On Tue, Apr 15, 2008 at 7:29 PM, Michael Ash [EMAIL PROTECTED] wrote:
 On Tue, Apr 15, 2008 at 4:53 PM, Greg Parker [EMAIL PROTECTED] wrote:
You don't need a write barrier when erasing GC-scanned memory. The write
   barrier helps the collector see pointers that it might otherwise miss
   because it's cheating. It does not help the collector forget a value that
   it saw previously. (In particular, the old pointer value might be gone from
   the zeroed location, but without re-scanning everything there's no way to
   know that it doesn't still exist somewhere else.)

  If this is the case then how does the collector know that you have
  cleared the memory. It seems to me that without a write barrier, the
  collector will not see the change and will think that that you
  continue to hold the old pointer in this memory.

The purpose of the write barrier is to tell the collector to keep
something alive; it has nothing to do with when to collect it.

 This will result in a memory leak of sorts,

It will lead to an object being kept around for the current GC cycle.
However, the next time the collector scans, it will find that there
are no references left to that particular object, and it will then
collect it. This is the essential argument between supporters of
manual memory management and garbage collection:

Manual Memory Management:
I can know exactly when my object is destroyed, and I can count on
that fact (i.e. when I call free(), I know that that object is gone
immediately)
But it is complicated, and much of the housekeeping is easy to get wrong.

Garbage Collection:
The housekeeping is taken care of, I don't have to worry about it.
However, I cannot know exactly when my object will be destroyed (it
might be right away, it might be in a couple of seconds).

 although it can't really grow without bound in
  most scenarios. But still, the collector needs to know when you nil
  out a variable so that it can know that a particular link no longer
  exists, just like it needs to know when you store a non-nil value so
  that it can know that a new link now exists.
  In other words, not using a write barrier for nil isn't a disaster but
  it can cause garbage to fail to be recognized as such.

  What did I miss?

-- 
Clark S. Cox III
[EMAIL PROTECTED]
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSAllocateCollectable() questions

2008-04-16 Thread Michael Ash
On Wed, Apr 16, 2008 at 5:28 AM, Alastair Houghton
[EMAIL PROTECTED] wrote:
 On 16 Apr 2008, at 03:29, Michael Ash wrote:
  If this is the case then how does the collector know that you have
  cleared the memory. It seems to me that without a write barrier, the
  collector will not see the change and will think that that you
  continue to hold the old pointer in this memory.

  No.  The garbage collector does not use reference counting, and so your
 statement is not true.  If you overwrite the last pointer to an object with
 a nil, the pointed-to object *may* survive the current garbage collection
 cycle, but it will not survive the next one.

It has nothing to do with reference counting. I thought that the
collector was using write barriers as a shortcut to knowing when a
block of memory was modified so that it could avoid constantly
re-scanning unchanging blocks. But now I see that it's only a
mechanism to avoid stopping all threads while scanning. This is kind
of disappointing because it means that an application which uses GC
must necessarily have its working set equal to the sum total of all
scanned memory plus the working set in any unscanned memory, but what
can you do.

Thanks for the links.

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 [EMAIL PROTECTED]


Re: Detect phone number in NSString

2008-04-16 Thread Uli Kusterer

Am 16.04.2008 um 10:47 schrieb Brad Peterson:

So, if I had some text, say : Hi Tom, Please call
Cheryl at 444-555-6767 and she can get you that
info... I want to be able to know that 444-555-6767
is a phone number and should be marked as such.



 Apple has this in Mail. No idea whether there's a public API, but in  
ye olde days this technology was called Apple Data Detectors, maybe  
that'll help you google something up? Otherwise, see what Apple calls  
it in the Mail.app docs, maybe that term will bring up a related API.


Cheers,
-- Uli Kusterer
The Witnesses of TeachText are everywhere...
http://www.zathras.de





___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Detect phone number in NSString

2008-04-16 Thread Mike Wright
On 16 Apr 2008 09:40:46 -0600, Dave DeLong [EMAIL PROTECTED]  
wrote:


(Guess I have to keep top posting.)

If you're only concerned with US phone numbers, about a half-dozen  
canned patterns should suffice. However, if you need to deal with  
phone numbers in places like Australia, Japan, and France, the number  
quickly increases.


What I do in my software (iData 3) is to provide a preference item  
where users can specify the patterns they, themselves, use. You can  
see the Help page for this at http://www.idata3.com/idata3help/iD3PrefsDialing.html#extension 
. It shows a set of default patterns in the Telephone Number  
Templates field. There's a brief explanation farther down the page.


Using iData's template notation, non-US phone numbers can contain such  
patterns as:


-nnn
n-nn
nnn.nnn.
nn nn nnn.nnn-

Rather than test against lots of irrelevant patterns--and still risk  
missing some--it's better to let the user define the set of expected  
patterns. (I'm serious. I've had all of these, and more, thrown at me  
before I finally broke down and started making the users define their  
own.)


I don't use regular expressions--the basic code goes back to System 7  
or 8, just updated for Cocoa. What I do is to scan the text (from the  
end of the current selection) for the first digit:


NSString * myString; // derived from NSTextView content
NSRange numeralRange = [myString rangeOfCharacterFromSet: 
[NSCharacterSet decimalDigitCharacterSet]];


Then I test the following text to see if it matches any of the  
patterns. If it does, it gets dialed. If not, I search  on from there-- 
and wrap to the beginning of the text if appropriate.


Having found a numeric character, the testing algorithm is  
approximately:


1. Find the potential end of the phone number, the earliest of:
a. End of the string
b. End of line (\n)
c. Three non-numerics in a row. (This is an assumption on my part.
Four or five might be safer.)
2. Copy the resulting range of myString to an NSMutableString.
3. Change all numerals in the mutable string to 'n'.
4. Compare the resulting copy to each string in template list. If any  
is equal, return the potential number string as the real thing.


Unless the text contains *lots* of other numbers, it's quite fast.  
(And, as you'll see from the Help page, the user can always force the  
dialing of any particular number, regardless of format, by  
highlighting it, or by enclosing it in user-defined brackets.)


Mike Wright
http://www.idata3.com/


The thing that first comes to mind would be to use regular  
expressions.

CocoaDev has a good page listing where you could find some Regex
frameworks:
http://www.cocoadev.com/index.pl?RegularExpressions

Then you'd run your string through a matcher while looking for the  
phone

number pattern.  You could use a pattern similar to:

(\(\d{3}\)\s?)?\d{3}[-\s\.]\d{4} (UNTESTED)
This will look for a phone number that has an area code in  
parenthesis (but
that is optional), followed by three digits, a hyphen, space, or  
period, and

then four digits.

If your regex returns a successful match, then you know a phone  
number is

in the string.

Googling should lead you to some much cleaner regexes for phone  
numbers,

since those are a relatively common thing to search for.

HTH,

Dave DeLong

On Wed, Apr 16, 2008 at 2:47 AM, Brad Peterson [EMAIL PROTECTED]  
wrote:



Hi all,

Like many cell phones are doing these days, I want to
be able to detect phone numbers in NSStrings and
highlight them in some way for the user.

So, if I had some text, say : Hi Tom, Please call
Cheryl at 444-555-6767 and she can get you that
info... I want to be able to know that 444-555-6767
is a phone number and should be marked as such.

I've searched the archives, but didn't find anything
on this list. I thought about using NSString's isLike:
method, but that doesn't necessarily help me locate
the position of the phone number, IIRC; merely to know
that there might be one.

Any thoughts would be greatly appreciated.

Thank you!


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: binary search trees binning

2008-04-16 Thread John Stiles

Jean-Daniel Dupas wrote:

Le 16 avr. 08 à 00:07, John Stiles a écrit :


Hmm, setdouble sounds a lot easier than this to me.

Just use insert to put all the doubles into the set (one line), then 
use lower_bound to find the delineations between each group (another 
one-liner, though of course you'll need to loop over the number of 
groups you want). Then the distance between iterators is the size of 
each group (std::distance can compute this in another one-liner).


Unfortunately this is another case where Cocoa's collection classes 
just aren't very strong,  but STL is made for this sort of work... 
though Jens is probably right that performance isn't going to be a 
big problem if it's 1 items. The set will be a whole lot 
faster, but any naive implementation will be fast enough unless you 
expect your data set will eventually be a lot larger than this.




Do not make assumptions on CFArray vs STL vectors performances, 
especially for big arrays.
CFArray has some optimizations that made it really fast for some 
usages. (http://ridiculousfish.com/blog/archives/2005/12/23/array/).
That's not how I read this article. Rather, when I look at CFArray 
versus the STL, it looks like CFArray does better than STL for 
worst-case operations (removing the first entry of an array?) but does 
much worse for typical- and best-case operations (accessing an item by 
index, insertion and removal at the end, etc).


The difference is, in STL, if you want an array where you can remove 
from the beginning, you would never use vector anyway. You'd use 
deque, which has different tradeoffs and allows fast removal of 
elements from the beginning of the array. CoreFoundation doesn't let you 
choose and instead it just changes which algorithms it uses as the size 
of the array grows past a certain point, which to me is just weird. It 
doesn't seem like a great design to me. If you wanted to say one good 
thing about it, though... CFArray may never give you the best 
performance, but it will probably also prevent you from getting 
worst-case performance if you write really poorly-designed algorithms.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: binary search trees binning

2008-04-16 Thread Boyd Collier
Thanks very much to everyone who replied to my question.  You've given  
me a lot to think about; I'll crank up the old grey cells and see if I  
can digest all of it (sorry for the mixed metaphor).  If I come up  
with any brilliant insights (very unlikely), I'll post a note.


Boyd
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSAllocateCollectable() questions

2008-04-16 Thread Clark Cox
On Wed, Apr 16, 2008 at 9:26 AM, Michael Ash [EMAIL PROTECTED] wrote:
 On Wed, Apr 16, 2008 at 12:04 PM, Clark Cox [EMAIL PROTECTED] wrote:
The purpose of the write barrier is to tell the collector to keep
something alive; it has nothing to do with when to collect it.

  Right, I get that now.

  [snip]

   Garbage Collection:
The housekeeping is taken care of, I don't have to worry about it.
However, I cannot know exactly when my object will be destroyed (it
might be right away, it might be in a couple of seconds).

  I don't see the relevance of this. The Cocoa GC explicitly only works
  properly if you play by the rules it sets out. For example, if you
  store a pointer in unscanned memory then you're playing with fire and
  the object may well have been destroyed by the next time you try to
  use it.

But, in normal Cocoa patterns, after doing some relatively trivial
replacements (i.e. use NSAllocateCollectable instead of malloc, etc.),
it usually takes effort to store pointers in unscanned memory.

 Skipping write barriers likewise.

Again, under most circumstances, it usually takes effort to skip the
write barriers, as they are added automatically by the compiler.

 I had thought that using
  write barriers for clearing memory was part of the required rules, but
  now it appears that it is not. But regardless, Cocoa GC only takes
  care of its housekeeping when you take care of yours.

Indeed. GC doesn't allow the developer to abdicate all memory
management responsibility; however, the responsibilities that one
still has are  much smaller in scope and severity (i.e. Don't store a
GC-managed pointer into non-scanned memory) , and the exceptions to
the rules are few and far between. In the past year, I've had to make
a special allowance for the garbage collector only once that I can
recall.

Generally, the only difference between my non-GC and my GC code is
that the GC code lacks retain, release and autorelease calls as well
as dealloc implementations. At this point, if I could do away with
writing pre-GC Cocoa code, I would do so in a heartbeat.

-- 
Clark S. Cox III
[EMAIL PROTECTED]
___

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

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

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

This email sent to [EMAIL PROTECTED]


KVO Problem with NSCollectionView

2008-04-16 Thread Joachim Deelen

Hi all,

I'm having problems with KVO and a NSCollectionView. As far as I know  
should the Property selctionIndexes be KVO compliant. I've added an  
Observer and it gets called, every time I'm sending  
setSelectionIndexes to the Collection view. But if I set the  
selection directly on a NSCollectionViewItem, using the setSelected- 
Message, the selectionIndexes gets changed but the KV-Observer is  
not being called. Does KVO in this case mean, that the Observer only  
gets triggered, when the NSIndexSet Object is replaced with another? I  
expected that KVO gets triggered, each time the content of the  
IndexSet is changed.


regards
Joachim Deelen

AQUARIUS-software
http://www.aquarius-software.de



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: binary search trees binning

2008-04-16 Thread Scott Ribe
 Hmm, setdouble sounds a lot easier than this to me.

That's one way. Personally, I would try mapdouble, setdouble with the
map key being the lower bound of the bucket.

-- 
Scott Ribe
[EMAIL PROTECTED]
http://www.killerbytes.com/
(303) 722-0567 voice


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Enabling File Open/Save etc in a non-document-based application

2008-04-16 Thread Scott Ribe
 The File Open (for instance) menu item is already assigned, it sends
 openDocument: to FirstResponder. I can see it right there in the
 bindings, that menu item is already set up to call something.

Yes. But what is the first responder?

It is the user interface item which has focus. In many cases this will be a
control such as a text field, which does not respond to openDocument:, and
will pass it up the chain to the next responder an so on, until typically it
reaches the window, which does not respond either, but will give its
delegate a chance to respond, and if that doesn't handle it, it will go up
the application which will give its delegate a chance to handle it.

So the immediate answer to your question is that you need an instance of a
class that responds to openDocument: either a) assigned to be the
application delegate or b) assigned to be file's owner (set up in the nib by
setting the class of file's owner, and setting the file's owner to be the
window delegate).

Quincey gave you the outline already of the longer-view learning curve in
understanding the rest of how things fit together.

-- 
Scott Ribe
[EMAIL PROTECTED]
http://www.killerbytes.com/
(303) 722-0567 voice


___

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

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

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

This email sent to [EMAIL PROTECTED]


NSUserDefaults, threads, and binding

2008-04-16 Thread Greg Hoover
I've encountered a situation where NSUserDefaults is definitely not  
thread safe.  Consider an user defaults value bound to an interface  
object.  A background thread modifies this value, first acquiring the  
lock to write to the user defaults, writes the new value, and finally  
triggers a KVO notification, in turn triggering a call to the main  
thread to draw the updated value in the interface. Meanwhile the main  
thread wants to access a value in the user defaults too, but blocks on  
the lock because the background thread acquired it.  The application  
is now deadlocked with both threads waiting on the other.


This is my understanding of what's happening in my app based on the  
following stack traces.  An existing post mentions putting all access  
to NSUserDefaults in a @synchronized block.  Before doing this, can  
anyone verify that that works?


Main Thread:
		61 -[NSWindow makeKeyAndOrderFront:] + 189 (in AppKit)  
[0x95308afa]
  61 -[NSWindow  
orderWindow:relativeTo:] + 105 (in AppKit) [0x953410d8]
61 -[NSWindow  
_reallyDoOrderWindow:relativeTo:findKey:forCounter:force:isModal:] +  
1354 (in AppKit) [0x95341681]
  61 - 
[NSWindow displayIfNeeded] + 189 (in AppKit) [0x95285ab9]
61 - 
[NSView displayIfNeeded] + 933 (in AppKit) [0x95285f09]
  61 - 
[NSView  
_displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] +  
3090 (in AppKit) [0x9534552d]
61 - 
[NSThemeFrame  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:] + 306 (in AppKit) [0x953489f7]
  61 - 
[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:] + 759 (in AppKit) [0x953490b4]
 
61 -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1902  
(in AppKit) [0x9534aaa5]


...
  61 
 -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1050 (in  
AppKit) [0x9534a751]
61 
 -[NSTextView _drawRect:clip:] + 2579 (in AppKit) [0x953b07a6]
  61 
 -[NSTextView drawRect:] + 250 (in AppKit) [0x953b09fd]
61 
 -[NSUserDefaults(NSUserDefaults) objectForKey:] + 36 (in Foundation)  
[0x91907524]
  61 
 _semaphore_wait_signal_trap + 10 (in libSystem.B.dylib) [0x91403a2e]


Background Thread:
  61 -[NSUserDefaults(NSUserDefaults)  
setObject:forKey:] + 113 (in Foundation) [0x91964821]
61 __CFXPreferencesSetValue + 102 (in  
CoreFoundation) [0x90966c46]
  61 - 
[CFXPreferencesPropertyListSource setValue:forKey:] + 86 (in  
CoreFoundation) [0x90965f86]
61 - 
[NSObject(NSKeyValueObserverNotification) didChangeValueForKey:] + 546  
(in Foundation) [0x91907f22]
  61 _NSKVONotify + 62 (in  
Foundation) [0x9198b58e]
61 -[NSController  
observeValueForKeyPath:ofObject:change:context:] + 949 (in AppKit)  
[0x95488920]
  61 -[NSController  
_notifyObserversForKeyPath:change:] + 248 (in AppKit) [0x9526b15e]
61 - 
[NSObject(NSKeyValueObservingPrivate)  
_notifyObserversForKeyPath:change:] + 373 (in Foundation) [0x9191be45]
  61 _NSKVONotify + 62  
(in Foundation) [0x9198b58e]
61 -[NSEditableBinder  
_observeValueForKeyPath:ofObject:context:] + 124 (in AppKit)  
[0x9544ab24]
  61 -[NSView  
_setHidden:] + 50 (in AppKit) [0x9527290d]
61 - 
[NSView(NSInternal) _setHidden:setNeedsDisplay:] + 1318 (in AppKit)  
[0x95272e3c]
  61 -[NSView  
_invalidateGStatesForTree] + 49 (in AppKit) [0x9526648a]
61 -[NSView  

Re: binary search trees binning

2008-04-16 Thread Michael Ash
On Wed, Apr 16, 2008 at 1:20 PM, John Stiles [EMAIL PROTECTED] wrote:
  The difference is, in STL, if you want an array where you can remove from
 the beginning, you would never use vector anyway. You'd use deque, which
 has different tradeoffs and allows fast removal of elements from the
 beginning of the array. CoreFoundation doesn't let you choose and instead it
 just changes which algorithms it uses as the size of the array grows past a
 certain point, which to me is just weird. It doesn't seem like a great
 design to me. If you wanted to say one good thing about it, though...
 CFArray may never give you the best performance, but it will probably also
 prevent you from getting worst-case performance if you write really
 poorly-designed algorithms.

The real difference is that they provide different concepts. STL
provides data structures, CF and Foundation provide containers. You
generally know how STL data structures are implemented and they have
performance guarantees which are pretty ironclad. CF collections are
considerably more vague about both implementation and performance.

With STL you can choose exactly how you want your stuff to be stored.
With CF, you generally choose how you want to *access* your data, and
leave the rest up to the implementation. If you want an ordered
collection, you just choose a CFArray and you can generally assume
that the performance will be decent. Since most such uses are not
performance critical, the ability to save programmer time by not
having to make a choice is generally a good tradeoff.

The nice thing about CF is that, thanks to toll-free bridging, if
you've used a CFArray everywhere and it turns out that your particular
access pattern isn't fast enough with the built-in implementation, you
can easily write a replacement (perhaps using STL on the back end) and
drop it in without changing any code other than the bit that
instantiates it.

Interestingly, CFBinaryHeap doesn't fit into this at all. It all but
advertises exactly how it's implemented inside, provides tight
performance guarantees to match, and has no bridging so you can't
provide your own implementation.

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 [EMAIL PROTECTED]


Re: Capsule-Style Toolbar Controls

2008-04-16 Thread Peter Ammon


On Apr 16, 2008, at 1:27 PM, Stefan Hafeneger wrote:


Hi,

Has anyone tried to use the Capsule-Style Toolbar Controls in an app  
so that it looks and behaves like Mail or Preview? When I add them  
to my toolbar it looks like Mail. But if I compare them side by side  
the ones in Mail and Preview there is a 2 pixel difference of the  
baseline. And I think it looks better in Mail/Preview. When I add a  
multi-segment control I only have one Label (not two or more). In  
Mail and Preview it looks like there are as many labels as segments.  
You can fake this by adding blanks. But there is one more point:  
In Mail and Preview the size of the control is adjusted (I think  
depending on the size of the label(s)). Well, in the nib files from  
Mail and Preview there are no toolbars, so Apple builds them via  
code. So the question is: If I code them as well, is it possible to  
do the same that Apple does in Mail and Preview via NSSegmentedCell  
or is this all done by hand?


With best wishes, Stefan


Hi Stefan,

As of Leopard, this is all possible using standard AppKit controls,  
which Mail and Preview both use.


Regarding the two pixel difference in the baseline, this may be  
because the segmented control is too short and so is clipped.  Try  
using sizeToFit.  You may also be referring to different window  
metrics; try giving the window a unified title/toolbar to see if that  
gives the appearance you expect.  It shouldn't affect the appearance  
much, but it does subtly change the toolbar positioning.  If these  
don't fix your issue, maybe you can provide a screenshot so I  
understand what you mean.


To have multiple labels in a single toolbar item, make an  
NSToolbarItemGroup, and give it subitems.  If you set a view (but not  
a label) on the Group, the labels of the subitems will be arranged  
under the view.  If the view is a segmented control, the labels will  
be aligned with corresponding segments, assuming there's the same  
number of both. This is what Mail and Preview do.


I hope that's clear,
-Peter

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: binary search trees binning

2008-04-16 Thread John Stiles
Honestly, I can't see value in always coding to CFArray just so I can 
rip out the back end later if I don't like the results.


If anything, it would make more sense to me to use NSArray for that 
purpose, since I know working with and subclassing NSArray will be easy 
and painless. Core Foundation is just ugly in comparison... :)



Michael Ash wrote:

On Wed, Apr 16, 2008 at 1:20 PM, John Stiles [EMAIL PROTECTED] wrote:
  

 The difference is, in STL, if you want an array where you can remove from
the beginning, you would never use vector anyway. You'd use deque, which
has different tradeoffs and allows fast removal of elements from the
beginning of the array. CoreFoundation doesn't let you choose and instead it
just changes which algorithms it uses as the size of the array grows past a
certain point, which to me is just weird. It doesn't seem like a great
design to me. If you wanted to say one good thing about it, though...
CFArray may never give you the best performance, but it will probably also
prevent you from getting worst-case performance if you write really
poorly-designed algorithms.



The real difference is that they provide different concepts. STL
provides data structures, CF and Foundation provide containers. You
generally know how STL data structures are implemented and they have
performance guarantees which are pretty ironclad. CF collections are
considerably more vague about both implementation and performance.

With STL you can choose exactly how you want your stuff to be stored.
With CF, you generally choose how you want to *access* your data, and
leave the rest up to the implementation. If you want an ordered
collection, you just choose a CFArray and you can generally assume
that the performance will be decent. Since most such uses are not
performance critical, the ability to save programmer time by not
having to make a choice is generally a good tradeoff.

The nice thing about CF is that, thanks to toll-free bridging, if
you've used a CFArray everywhere and it turns out that your particular
access pattern isn't fast enough with the built-in implementation, you
can easily write a replacement (perhaps using STL on the back end) and
drop it in without changing any code other than the bit that
instantiates it.

Interestingly, CFBinaryHeap doesn't fit into this at all. It all but
advertises exactly how it's implemented inside, provides tight
performance guarantees to match, and has no bridging so you can't
provide your own implementation.

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/jstiles%40blizzard.com

This email sent to [EMAIL PROTECTED]
  

___

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

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

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

This email sent to [EMAIL PROTECTED]


Printing and tabular data (again)

2008-04-16 Thread Luca Torella

Hi all,
I know this has been discussed many times before, but I still can't  
find a definitely easy and all-purpose answer. Is it really that hard  
to print the content of an NSTableView? It seems there are two main  
ways to do that.


- The first way is to create another NSTableView in an invisible  
window as covered in this topic:

http://forums.macrumors.com/showthread.php?t=273153

- The second approach is to create an NSString containing HTML code  
that should be rendered by the fabulous WebKit.


Well I dislike both approaches: they are both not so smooth as I'm  
used to with Cocoa. And I can't believe there isn't an open-source  
class or a framework that can be used and can be improved by Cocoa  
developers. Printing tabular data in Cocoa is just to hard and this  
should be fixed as soon as possible in my opinion, in the while the  
Cocoa community should work out to find a solution.
I'll be happy to give my contribute, but first I'd like to know some  
opinions about other Cocoa developers and their approaches to this  
problem.


Thanks in advance,
Luca



___

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

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

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

This email sent to [EMAIL PROTECTED]


NSArrayController bound to @unionOfArrays not updating

2008-04-16 Thread William Towe
This is my first post to the list, I've been using it as a reference for
quite some time and usually I can find a solution to my problems, but
searching didn't turn anything up that applied to my current issue.  So
here's the gist of it:
I'm working on an IDE for z80 calculator programmers, and have tried to
model some of the interface after Xcode's (where appropriate of course).  I
have an NSOutlineView on the left hand side that mirrors the project
directory structure (a little different than Xcode, but the same general
idea) which is bound via bindings to an array of my file node objects.  Then
I have an NSTableView on the right hand side that shows the files in the
currently selected folder from the outline view and includes all the files
within folders of that folder (just like Xcode).

To achieve this I bound the table view's contentArray binding to controller
key selection and model key path: @unionOfArrays.allDescendantsNodes.
 The allDescendantNodes method in my file node class returns an array with
all its descendants in it as well as itself.  This works as I expected, all
the nodes are shown belonging to the selected folder(s), the folder objects
themselves are filtered out and if a single file is selected it is the only
thing shown in the table view.  The problem arises when I insert objects
into the childNodes array of the currently selected folder (this happens
when the user imports existing files into the project);  the outline view
updates as it should, showing the new items in their parent's folder, but
the table view does not update.  If i change the selection in the outline
view and then click back on the folder, the new files are show correctly in
the table view, but I would like it show up without the user having to
change the selection.  All the insertions are done with KVC compliant
methods, so I'm kind of baffled.

Did I miss something setting up the bindings in IB?  Or perhaps it is
something else?  Any help is very much appreciated.

-William Towe
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: binary search trees binning

2008-04-16 Thread Mike Abdullah


On 16 Apr 2008, at 22:34, John Stiles wrote:

Honestly, I can't see value in always coding to CFArray just so I  
can rip out the back end later if I don't like the results.


If anything, it would make more sense to me to use NSArray for that  
purpose, since I know working with and subclassing NSArray will be  
easy and painless. Core Foundation is just ugly in comparison... :)


But that's the beauty of toll-free bridging; you can use NSArray or  
CFArray as you please. I think Michael Ash was merely pointing out  
that you could take this approach with CFArray, but not that you  
necessarily should. NSArray does the job just as well.




Michael Ash wrote:
On Wed, Apr 16, 2008 at 1:20 PM, John Stiles [EMAIL PROTECTED]  
wrote:


The difference is, in STL, if you want an array where you can  
remove from
the beginning, you would never use vector anyway. You'd use  
deque, which

has different tradeoffs and allows fast removal of elements from the
beginning of the array. CoreFoundation doesn't let you choose and  
instead it
just changes which algorithms it uses as the size of the array  
grows past a
certain point, which to me is just weird. It doesn't seem like a  
great
design to me. If you wanted to say one good thing about it,  
though...
CFArray may never give you the best performance, but it will  
probably also

prevent you from getting worst-case performance if you write really
poorly-designed algorithms.



The real difference is that they provide different concepts. STL
provides data structures, CF and Foundation provide containers. You
generally know how STL data structures are implemented and they have
performance guarantees which are pretty ironclad. CF collections are
considerably more vague about both implementation and performance.

With STL you can choose exactly how you want your stuff to be stored.
With CF, you generally choose how you want to *access* your data, and
leave the rest up to the implementation. If you want an ordered
collection, you just choose a CFArray and you can generally assume
that the performance will be decent. Since most such uses are not
performance critical, the ability to save programmer time by not
having to make a choice is generally a good tradeoff.

The nice thing about CF is that, thanks to toll-free bridging, if
you've used a CFArray everywhere and it turns out that your  
particular
access pattern isn't fast enough with the built-in implementation,  
you
can easily write a replacement (perhaps using STL on the back end)  
and

drop it in without changing any code other than the bit that
instantiates it.

Interestingly, CFBinaryHeap doesn't fit into this at all. It all but
advertises exactly how it's implemented inside, provides tight
performance guarantees to match, and has no bridging so you can't
provide your own implementation.

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/jstiles%40blizzard.com

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Drawing a 1 pixel-perfect wide bordered NSBezierPath

2008-04-16 Thread Martin

Hi,

I'm trying to draw a rounded rectangle with a 1 pixel-perfect wide  
border. Although I made sure that the rect has integral values and its  
height it an even number (so that height/2.0 is also even), the top  
and bottom lines look blurry (screenshot: http://img01.picoodle.com/img/img01/4/4/16/f_Picture2m_d4f9168.png 
 ). I don't want to disable anti-alias because of the rounded parts.


What's wrong with my code?

[controlView lockFocus];

NSBezierPath *rectangle = [NSBezierPath  
bezierPathWithRoundedRect:cellFrame xRadius:cellFrame.size.height/2.0  
yRadius:cellFrame.size.height/2.0];


[[NSColor colorWithCalibratedRed:222.0/255.0 green:231.0/255.0 blue: 
248.0/255.0 alpha:1.0] setFill];

[rectangle fill];

[[NSColor colorWithCalibratedRed:164.0/255.0 green:189.0/255.0 blue: 
236.0/255.0 alpha:1.0] setStroke];

[rectangle setLineWidth:1.0];
[rectangle stroke];

[controlView unlockFocus];


Thanks,
Martin.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: binary search trees binning

2008-04-16 Thread Michael Ash
On Wed, Apr 16, 2008 at 5:34 PM, John Stiles [EMAIL PROTECTED] wrote:

  Honestly, I can't see value in always coding to CFArray just so I can rip
 out the back end later if I don't like the results.

The value is that 99% of the time you won't need to, saving time and
effort by using a nice built-in class with reasonable performance.

  If anything, it would make more sense to me to use NSArray for that
 purpose, since I know working with and subclassing NSArray will be easy and
 painless. Core Foundation is just ugly in comparison... :)

I don't really follow. NSArray *is* CFArray. They are just two names
for one entity, so you make a custom CFArray the same way you make a
custom NSArray: subclass NS[Mutable]Array and override the primitive
methods. It's just annoying to talk about NS/CFArray all the time so I
picked one name and used it.

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 [EMAIL PROTECTED]


Re: Getting selection of IKImageView?

2008-04-16 Thread Jamie Phelps

On Apr 16, 2008, at 12:38 PM, Colin Cornaby wrote:

The issue is that I really need a rect. Getting the actual image of  
what is selected will tell me the width and height of the rect, but  
not the x and y.


So, you're after the origin of the rect in addition to the dimensions?  
Since IKImageView inherits from NSResponder, you can capture the mouse  
coordinates in the -mouseDown: event and then again using - 
mouseDragged:. Off the cuff, you'll then need to set the origin to the  
minimum x value and minimum y value of the two points and set the size  
to the max x-min x and max y-min y. (There's a good example of this in  
Hillegass, Cocoa Programming for Mac OS X, 2nd ed if you have it handy.)


All that being said, I have to ask what functionality you are using  
from IKImageView that you couldn't get from NSImageView? The above  
would apply to NSImageView, too, but you wouldn't be including all the  
IK goodness of IKImageView such as editing and NSImageView is  
supported on more than just Leopard. Just a thought.


HTH
Jamie
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Drawing a 1 pixel-perfect wide bordered NSBezierPath

2008-04-16 Thread Martin

It works!
Why such a behaviour?

Thanks,
-Martin

On Apr 17, 2008, at 1:15 AM, John Terranova wrote:

Try adding these lines before creating the NSBezierPath:

cellFrame.origin.x += 0.5;
cellFrame.origin.y += 0.5;

Let me know if it works.  It should.

john

On Apr 16, 2008, at 3:52 PM, Martin wrote:

Hi,

I'm trying to draw a rounded rectangle with a 1 pixel-perfect wide  
border. Although I made sure that the rect has integral values and  
its height it an even number (so that height/2.0 is also even), the  
top and bottom lines look blurry (screenshot: http://img01.picoodle.com/img/img01/4/4/16/f_Picture2m_d4f9168.png 
 ). I don't want to disable anti-alias because of the rounded parts.


What's wrong with my code?

[controlView lockFocus];

NSBezierPath *rectangle = [NSBezierPath  
bezierPathWithRoundedRect:cellFrame xRadius:cellFrame.size.height/ 
2.0 yRadius:cellFrame.size.height/2.0];


[[NSColor colorWithCalibratedRed:222.0/255.0 green:231.0/255.0 blue: 
248.0/255.0 alpha:1.0] setFill];

[rectangle fill];

[[NSColor colorWithCalibratedRed:164.0/255.0 green:189.0/255.0 blue: 
236.0/255.0 alpha:1.0] setStroke];

[rectangle setLineWidth:1.0];
[rectangle stroke];

[controlView unlockFocus];


Thanks,
Martin.
___

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/johnte%40mac.com

This email sent to [EMAIL PROTECTED]




___

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

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

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

This email sent to [EMAIL PROTECTED]


Poking NSTextView Binding to Update

2008-04-16 Thread Seth Willits
I have a text view bound to a key path through an array controller's  
selectedObject, and it doesn't update the value immediately when  
changing the text, it only updates the model if the text view loses  
first responder. I need the model sync'd before I do a certain  
operation, so I need to binding to update the value in the model. I  
can change first responder manually to trigger the update, but is  
there a proper way to poke the binding to update?



--
Seth Willits




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Poking NSTextView Binding to Update

2008-04-16 Thread Seth Willits

On Apr 16, 2008, at 4:26 PM, Seth Willits wrote:

I have a text view bound to a key path through an array controller's  
selectedObject, and it doesn't update the value immediately when  
changing the text, it only updates the model if the text view loses  
first responder. I need the model sync'd before I do a certain  
operation, so I need to binding to update the value in the model. I  
can change first responder manually to trigger the update, but is  
there a proper way to poke the binding to update?


Bah. I totally forgot the NSController superclass existed. I only went  
down as far as NSObjectController. Forgive my quite newbish mistake. :(


-commitEditing:

--
Seth Willits




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Drawing a 1 pixel-perfect wide bordered NSBezierPath

2008-04-16 Thread Graham Cox
Because strokes are drawn centred on the coordinate of the path, so a  
1-pixel line extends 0.5 of a pixel above and below the coordinate.  
Offsetting by 0.5 makes it draw such that the exact pixel is filled.



--
S.O.S.


On 17 Apr 2008, at 9:17 am, Martin wrote:

It works!
Why such a behaviour?

Thanks,
-Martin

On Apr 17, 2008, at 1:15 AM, John Terranova wrote:

Try adding these lines before creating the NSBezierPath:

cellFrame.origin.x += 0.5;
cellFrame.origin.y += 0.5;



___

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

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

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

This email sent to [EMAIL PROTECTED]


re: Chained Migration of Leopard CoreData stores

2008-04-16 Thread Ben Trumbull

Hi,

let's say I have four versions of my data model:

DataModel1.xcdatamodel
DataModel2.xcdatamodel
DataModel3.xcdatamodel
DataModel4.xcdatamodel (this is the current one)

and three model mapping files which always map from version n to 
version n+1:


Mapping1to2.xcmappingmodel
Mapping2to3.xcmappingmodel
Mapping3to4.xcmappingmodel


Now I load a version 1 data file:

NSDictionary *options = [NSDictionary dictionaryWithObject:[NSNumber 
numberWithBool:YES] 
forKey:NSMigratePersistentStoresAutomaticallyOption];

NSError *error = nil;
if (![persistentStoreCoordinator 
addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:url 
options:options error:error])

{
  ...
}

should the data file automatically be migrated to the current version 
4 or do I need a single direct mapping like this:


Mapping1to4.xcmappingmodel


If you want Core Data to do everything, you'll need 1 mapping model, 
since we don't assume that iterative upgrades will necessarily work.


If you're confident that composing your N+1 mapping models together 
makes sense for your app, you can run N+1 migrations in a row to 
avoid needing an umbrella mapping model.

--

-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 [EMAIL PROTECTED]


Core Animation/Layers and Borderless Windows

2008-04-16 Thread Karl Goiser

Hello,

I'm creating a borderless window whose content view uses Core  
Animation...


When I do this, the window is drawn without any shadow no matter the  
alpha of the content.


- a borderless window with a normal view draws the window's shadow.

- a normal window with a content view which uses core animation shows  
the window's shadow (for example, the Recipes example).  This is  
probably because it is opaque.



If I set the borderless window to opaque, a shadow is drawn.  However,  
I want the window to be transparent - and have a shadow just like can  
be done with a normal view.



Is there something I need to do to get the desired behaviour?


Thanks in advance!

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 [EMAIL PROTECTED]


1-bit NSBitmapImageRep?

2008-04-16 Thread Graham Cox
Is it possible to create a 1-bit (black and white) NSBitMapImageRep?  
If so, what are the magic parameters? If not, what is the smallest  
number of bits per pixel supported?


--
S.O.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 [EMAIL PROTECTED]