Re: Strange Strange Bug

2008-09-06 Thread Kai


On 6.9.2008, at 02:10, Steve Cronin wrote:


Kai;

OK That seems reasonable but:

why do I not see this behavior anywhere else?


Yes, it surprised me a little, too, that I had never seen something  
like this. Now if I am right, this occurs only if such a variable  
happens to be at a location where another object pointer has  
previously been, which has been deallocated in the meantime. And if  
zombies are enabled, if I interpret your findings correctly. That may  
explain it.



why have I never seen it before now?


Zombies not enabled? Pure luck?



why if I restart XCode does the 'bad' instance fall on exactly the  
same string?


Because your program behaves reproducible and always does the same  
things on the stack before calling the method in question.


Again, I am not 100% sure about this.

Kai




Thanks,
Steve
On Sep 5, 2008, at 4:11 AM, Kai wrote:


Steve,

looks like the debugger tries to inspect your uninitialized string  
pointers. And it happens that the stack location assigned to the  
6th string pointer still contains the address of a now deallocated  
object left there when another method exited.


So this is a debugger-only problem and completely harmless without  
debugger (if I am not mistaken, of course).


To fix it, assign nil to the string pointers when you declare them:

NSString *gAsOf = nil;
etc..

Or, better yet, do not declare the variables before using them  
(that is, not all together at the start of the method). (Note that  
this style may be only possible with certain C dialects. I use  
Objective C++, therefore I’m not sure).


Hope this helps.
Kai


On 5.9.2008, at 09:04, Steve Cronin wrote:


Folks;

OK this behavior has me a little spooked...
This behavior occurs the first time through the method!
I have a breakpoint set at the first line of a method, which  
happens to be a NSLog(@Ready);
As is normal I have my local variable declarations at the  
beginning of the method:

NSArray *myKeys, *workingValues;
	NSString *gAsOf, *gAsOfDate,  *gDataMask, *gDataMaskName, *gID,  
*gIDName, *gVersion, *gVersionName;
	gAsOfDateName = [[NSUserDefaults standardUserDefaults]  
stringForKey:@groupAsOfDatePropertyName];
	gDataMaskName = [[NSUserDefaults standardUserDefaults]  
stringForKey:@groupDataMaskPropertyName];


Nothing surprising or complicated...

However, the console window will show at least two of these  
messages:.
2008-09-05 00:56:45.101 XYZ[345:813] *** -[CFString _cfTypeID]:  
message sent to deallocated instance 0x16d1db80
2008-09-05 00:56:45.563 XYZ[345:813] *** -[CFString _cfTypeID]:  
message sent to deallocated instance 0x16d1db80
2008-09-05 00:56:46.776 XYZ[345:813] *** -[CFString _cfTypeID]:  
message sent to deallocated instance 0x16d1db80


If I scroll the variables display at the upper right in the  
debugger window, the console will add more of these messages.
One of the strings in the variable display will have its 'Value'  
shown as the instance id shown in these messages.
For this string variable the 'Summary' will be empty as opposed to  
all other 'Summary' which have 'Invalid'
The debugger is paused several lines above the declaration of this  
variable...


If I merely switch the positions of the variables I can change  
which variable has the 'bad' instance id.

It is always the 6th declared string variable.
I can mix up the order of variables, change the actual variable  
names, or interleave NSArray declarations, it doesn't matter...the  
6th string exhibits this behavior.
Hovering over the variable it displays the 'yellow help ribbon'  
with 'NSZombie_CFString', whereas all the others are 'NSString'

Commenting out the declarations and use and compiling works fine.
Uncommenting brings back the exact behavior.

Note:  If I take out the breakpoint then the console does NOT show  
these messages even though I have left log messages in the method  
so I know the method is being executed


I have restarted XCode as well as the system (Intel 10.5.4, XC3.1)  
no change


What in the heck is going on?  Should I be worried? How can I shed  
this anomaly?


Thanks,
Steve

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kai%40granus.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]


text view example

2008-09-06 Thread Roland Silver
Can anyone point me to a Cocoa app or tutorial or example whose code I  
can adapt which has a window with a scrollable text view into which I  
can post text?


___

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

Please do not post 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: Posting Keyboard Events

2008-09-06 Thread Peter N Lewis

At 20:15 -0600 5/9/08, Dave DeLong wrote:

How on earth can I post system keyboard events (without getting a beep)?


As Ken mentioned, first off make sure the key has somewhere to go.

After that, this is roughly the code I use in Keyboard Maestro 
(extracted bits and pieces, so it wont compile directly).  My 
apologies for the appearance of the code in email, but perhaps it is 
still useful.



verify_noerr( ::CGEnableEventStateCombining( false ) );
	verify_noerr( ::CGSetLocalEventsFilterDuringSuppressionState( 
kCGEventFilterMaskPermitAllEvents, 
kCGEventSupressionStateSupressionInterval ) );

verify_noerr( ::CGSetLocalEventsSuppressionInterval( 0.0 ) );

PostModifierKeys( inModifiers, true );
verify_noerr( CGPostKeyboardEvent( inChar, inKeyCode, true ) );
verify_noerr( CGPostKeyboardEvent( inChar, inKeyCode, false ) );
PostModifierKeys( inModifiers, false );

verify_noerr( ::CGEnableEventStateCombining( true ) );


with:


void
UCGRemoteControl::PostModifierKeys( const UInt32 inModifiers, 
Boolean inKeyDown )

{
if ( inModifiers( UInt32(shiftKey) ) ) {
		verify_noerr( ::CGPostKeyboardEvent( (CGCharCode)0, 
kCGShiftKeyCode, inKeyDown ) );

}

if ( inModifiers( UInt32(controlKey) ) ) {
		verify_noerr( ::CGPostKeyboardEvent( (CGCharCode)0, 
kCGControlKeyCode, inKeyDown ) );

}
if ( inModifiers( UInt32(optionKey)) ) {
		verify_noerr( ::CGPostKeyboardEvent( (CGCharCode)0, 
kCGOptionKeyCode, inKeyDown ) );

}
if ( inModifiers( UInt32(cmdKey) ) ) {
		verify_noerr( ::CGPostKeyboardEvent( (CGCharCode)0, 
kCGCommandKeyCode, inKeyDown ) );

}
}

There is an extra piece of code to release the desired key if it is 
already down (if the user is pressing the A key already, and you try 
to press it again without first releasing it, it wont work).


Also, the key code for A is 0.  6 is Z.

Further, inChar should be lowercase (ie 'a' or 'z').

Enjoy,
   Peter.

--
  Keyboard Maestro 3 Now Available!
Now With Status Menu triggers!

Keyboard Maestro http://www.keyboardmaestro.com/ Macros for your Mac
http://www.stairways.com/   http://download.stairways.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]


Using NSArrayController programmatically in library class

2008-09-06 Thread dreamcat7

Hi
I am extending a library class which is also one of my application's  
model objects. The Library class contains an NSMutableArray of NSData  
which it absolutely needs to perform its tasks. To extend the class i  
must now also hold metadata about each NSData object in the array  
(i.e. the item elements in the array now becomes a pair or triple).


Conveniently the Hillegass example is similar. In RaisMan the person  
data is displayed in columns of TableView. (and i would like to have a  
tableview maybe also but thats not the point). I should create a new  
object called person.h that defines each element in the array and  
provides the accessor methods for binding to person.expectedRaise and  
person.Name. Then an NSArrayController can give an array for each  
column of the data. Another common method is to make an NSMutableArray  
of NSMutableDictionaries and then binding the dictionary @key to the  
arrayController. Either way achieves such a goal.


But here is the crux of my problem:
The library object (which encloses these array) must keep its  
interface which is a flat array of NSData (and as originally) is used  
on the api side.


Can i store internally the complicated array including the metadata  
and use an NSArrayController to expose only the original NSData part  
of each item?


In other words;
This would be equivalent to saying that person.Name == persons.person  
and person.expectedRaise is a calculated metadata about the person. If  
i wanted to use an array of persons in a payroll department object  
then i would initialise the department with an array of person names,  
and the payroll department would take care of figuring out what the  
expectedRaise should be for each person. Then the payroll department  
would need to have itself an NSArrayController to map an array of  
string objects taken by the initializer to the internal array of  
person objects.


Is anything special required to use the NSArrayController  
programmatically as i shall not be using Interface Builder?





___

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

Please do not post 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: Posting Keyboard Events

2008-09-06 Thread Jean-Daniel Dupas


Le 6 sept. 08 à 14:00, Peter N Lewis a écrit :


At 20:15 -0600 5/9/08, Dave DeLong wrote:
How on earth can I post system keyboard events (without getting a  
beep)?


As Ken mentioned, first off make sure the key has somewhere to go.

After that, this is roughly the code I use in Keyboard Maestro  
(extracted bits and pieces, so it wont compile directly).  My  
apologies for the appearance of the code in email, but perhaps it is  
still useful.



verify_noerr( ::CGEnableEventStateCombining( false ) );
	 
verify_noerr 
( ::CGSetLocalEventsFilterDuringSuppressionState 
( kCGEventFilterMaskPermitAllEvents,  
kCGEventSupressionStateSupressionInterval ) );

verify_noerr( ::CGSetLocalEventsSuppressionInterval( 0.0 ) );

PostModifierKeys( inModifiers, true );
verify_noerr( CGPostKeyboardEvent( inChar, inKeyCode, true ) );
verify_noerr( CGPostKeyboardEvent( inChar, inKeyCode, false ) );
PostModifierKeys( inModifiers, false );

verify_noerr( ::CGEnableEventStateCombining( true ) );


with:


void
UCGRemoteControl::PostModifierKeys( const UInt32 inModifiers,  
Boolean inKeyDown )

{
if ( inModifiers( UInt32(shiftKey) ) ) {
		verify_noerr( ::CGPostKeyboardEvent( (CGCharCode)0,  
kCGShiftKeyCode, inKeyDown ) );

}

if ( inModifiers( UInt32(controlKey) ) ) {
		verify_noerr( ::CGPostKeyboardEvent( (CGCharCode)0,  
kCGControlKeyCode, inKeyDown ) );

}
if ( inModifiers( UInt32(optionKey)) ) {
		verify_noerr( ::CGPostKeyboardEvent( (CGCharCode)0,  
kCGOptionKeyCode, inKeyDown ) );

}
if ( inModifiers( UInt32(cmdKey) ) ) {
		verify_noerr( ::CGPostKeyboardEvent( (CGCharCode)0,  
kCGCommandKeyCode, inKeyDown ) );

}
}

There is an extra piece of code to release the desired key if it is  
already down (if the user is pressing the A key already, and you try  
to press it again without first releasing it, it wont work).


Also, the key code for A is 0.  6 is Z.


It's true on QWERTY keyboard, but you should not rely on this.




___

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

Please do not post 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: text view example

2008-09-06 Thread Joshua Pennington

Look at the source code for TextEdit inside /Developer/Examples/.

However, that may be beyond the scope of what you're trying to  
achieve. Most of the functionality you'd expect from a text view is  
built-in to NSTextView.


What are you specifically trying to so?

Cheers,
Joshua
Sent from my iPhone

On Sep 6, 2008, at 6:10 AM, Roland Silver [EMAIL PROTECTED] wrote:

Can anyone point me to a Cocoa app or tutorial or example whose code  
I can adapt which has a window with a scrollable text view into  
which I can post text?


___

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

Please do not post 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/joshuapennington%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]


Re: Using NSArrayController programmatically in library class

2008-09-06 Thread dreamcat7


Can i bind arrayController.contentArray to employees.name ?
or bind arrayController.contentArray to employees and then bind an  
NSMutableArray to arrayController.arrangedObjects.name ?


On 6 Sep 2008, at 14:03, dreamcat7 wrote:


Hi
I am extending a library class which is also one of my application's  
model objects. The Library class contains an NSMutableArray of  
NSData which it absolutely needs to perform its tasks. To extend the  
class i must now also hold metadata about each NSData object in the  
array (i.e. the item elements in the array now becomes a pair or  
triple).


Conveniently the Hillegass example is similar. In RaisMan the person  
data is displayed in columns of TableView. (and i would like to have  
a tableview maybe also but thats not the point). I should create a  
new object called person.h that defines each element in the array  
and provides the accessor methods for binding to  
person.expectedRaise and person.Name. Then an NSArrayController can  
give an array for each column of the data. Another common method is  
to make an NSMutableArray of NSMutableDictionaries and then binding  
the dictionary @key to the arrayController. Either way achieves  
such a goal.


But here is the crux of my problem:
The library object (which encloses these array) must keep its  
interface which is a flat array of NSData (and as originally) is  
used on the api side.


Can i store internally the complicated array including the metadata  
and use an NSArrayController to expose only the original NSData part  
of each item?


In other words;
This would be equivalent to saying that person.Name ==  
persons.person and person.expectedRaise is a calculated metadata  
about the person. If i wanted to use an array of persons in a  
payroll department object then i would initialise the department  
with an array of person names, and the payroll department would take  
care of figuring out what the expectedRaise should be for each  
person. Then the payroll department would need to have itself an  
NSArrayController to map an array of string objects taken by the  
initializer to the internal array of person objects.


Is anything special required to use the NSArrayController  
programmatically as i shall not be using Interface Builder?







___

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

Please do not post 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: Posting Keyboard Events

2008-09-06 Thread Dave DeLong

Yes, thank you for asking.

This code is in an IBOutlet for a simple controller object.  The  
controller has an outlet for the window and a textfield.  The first  
thing fun on this outlet is the following:

[window makeFirstResponder:textField];

And that does work, because the NSTextField is getting the focus and  
blinking cursor, etc.


Dave

On 5 Sep, 2008, at 8:56 PM, Ken Thomases wrote:


On Sep 5, 2008, at 9:15 PM, Dave DeLong wrote:

How on earth can I post system keyboard events (without getting a  
beep)?


You know, there are plenty of occasions when typing a letter causes  
a beep.  In particular, if there's no responder which is ready to  
accept keyboard input.  Is there a text view with focus at the time  
you're posting the event?


Cheers,
Ken



___

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

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

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

This email sent to [EMAIL PROTECTED]


coredata nstableview bindings/multiple arrays/joins

2008-09-06 Thread Amy Gibbs
I've got an NSTableView that has some columns bound to an  
NSArrayController.


I've also got a some columns that don't want to be bound to the same  
NSArrayController, called counted,date, and a checkbox called update.


I want to be able to enter text into the counted field and tick/untick  
the textbox, and then when I click a button it updates values in the  
NSArrayController.


Is there a way I can do this? I've tried allsort but I'm a complete  
newbie I'm afraid. If anyone can point me in the correct direction I'd  
appreciate it,


I can't change the Data Model at all as it uses a file from another  
application that I can't edit. Basically I'm trying to access the data  
in another coredata app that I can't get at from the original app.


Many Thanks
Amy
___

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

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


MultiTouch.framework Beta Program

2008-09-06 Thread Stefan Hafeneger

Hi,

We now started the beta program of our Cocoa multi-touch framework and  
also did a video (http://www.viddler.com/explore/i10rwthaachen/videos/ 
1/ or alternative HD link http://www.vimeo.com/1651801) showing how to  
develop multi-touch applications for Mac OS X using our framework.


If you like to try this on your own, please visit our website http://www.multitouchframework.com/ 
 to find out how to get the beta.


With best wishes, Stefan



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]

How to create a GUID?

2008-09-06 Thread Meik Schuetz

Dear everyone,
  I feel kind of embarrassed to ask, but could someone lead me the  
way on how to create an globally unique ID (such as for example  
d73e066c-cc88-4d66-be42-94dc091bb571) ?


Best regards and thanks to everyone.
Meik
___

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

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


SOLVED: Using NSArrayController programmatically in library class

2008-09-06 Thread dreamcat7

Hi,
I have now solved my problem by writing a sample project. Here is the  
solution:



//
//  MyDocument.h
//  Arrays
//
//  Created by id on 06/09/2008.
//  Copyright dreamcat7 2008 . All rights reserved.
//
#import Cocoa/Cocoa.h

@interface MyDocument : NSDocument
{
NSMutableArray* items;
NSMutableArray* rep;
NSArrayController* arrayController;
}
@property (retain) NSMutableArray* items;
@property (retain) NSMutableArray* rep;
@property (retain) NSArrayController* arrayController;

@end

//
//  MyDocument.m
//  Arrays
//
//  Created by id on 06/09/2008.
//  Copyright dreamcat7 2008 . All rights reserved.
//

#import MyDocument.h
#import Item.h
@implementation MyDocument

@synthesize items;
@synthesize rep;
@synthesize arrayController;

- (id)init
{
self = [super init];

self.items = [[NSMutableArray alloc] initWithCapacity:6];
self.rep = [[NSMutableArray alloc] initWithCapacity:6];

int count = 0;
while(count  6)
{
		Item* newItem = [[Item alloc] initWithString:[NSString  
stringWithFormat:@Item %i, count]

integer:(NSUInteger)count number:[NSNumber 
numberWithInt:count]];

[items addObject:newItem];
count++;
}

	self.arrayController = [[NSArrayController alloc]  
initWithContent:self.items];


	NSLog(@%@:%s %@, [self class], _cmd,  
arrayController.arrangedObjects);


NSLog(@%@:%s Binding to arrayController.string:, [self class], _cmd);

	[self bind:@rep toObject:arrayController  
withKeyPath:@arrangedObjects.string options:nil];

NSLog(@%@:%s %@, [self class], _cmd, rep);
[self unbind:@rep];

	NSLog(@%@:%s Binding to arrayController.integer:, [self class],  
_cmd);


	[self bind:@rep toObject:arrayController  
withKeyPath:@arrangedObjects.integer options:nil];

NSLog(@%@:%s %@, [self class], _cmd, rep);
[self unbind:@rep];

NSLog(@%@:%s Binding to arrayController.number:, [self class], _cmd);

	[self bind:@rep toObject:arrayController  
withKeyPath:@arrangedObjects.number options:nil];

NSLog(@%@:%s %@, [self class], _cmd, rep);
[self unbind:@rep];


return self;
}

//
//  Item.h
//  Arrays
//
//  Created by id on 06/09/2008.
//  Copyright 2008 dreamcat7. All rights reserved.
//

#import Cocoa/Cocoa.h


@interface Item : NSObject {
NSString* string;
NSUInteger integer;
NSNumber* number;
}
@property (copy) NSString* string;
@property (copy) NSNumber* number;

- (id)initWithString:(NSString*)aString integer:(NSUInteger)aUint  
number:(NSNumber*)aNumber;


@end

//
//  Item.m
//  Arrays
//
//  Created by id on 06/09/2008.
//  Copyright 2008 dreamcat7. All rights reserved.
//

#import Item.h


@implementation Item
@synthesize string;
@synthesize number;

- (NSUInteger)integer
{
return integer;
}

- (void)setInteger:(NSUInteger)anInteger
{
integer = anInteger;
}

- (id)init
{
return [self initWithString:nil integer:0 number:nil];
}

- (id)initWithString:(NSString*)aString integer:(NSUInteger)aUint  
number:(NSNumber*)aNumber

{
self = [super init];
self.string = aString;
self.integer = aUint;
self.number = aNumber;
return self;
}

- (void)dealloc
{
[string release];
[number release];
[super dealloc];
}
@end


On 6 Sep 2008, at 15:47, dreamcat7 wrote:



Can i bind arrayController.contentArray to employees.name ?
or bind arrayController.contentArray to employees and then bind an  
NSMutableArray to arrayController.arrangedObjects.name ?


On 6 Sep 2008, at 14:03, dreamcat7 wrote:


Hi
I am extending a library class which is also one of my  
application's model objects. The Library class contains an  
NSMutableArray of NSData which it absolutely needs to perform its  
tasks. To extend the class i must now also hold metadata about each  
NSData object in the array (i.e. the item elements in the array  
now becomes a pair or triple).


Conveniently the Hillegass example is similar. In RaisMan the  
person data is displayed in columns of TableView. (and i would like  
to have a tableview maybe also but thats not the point). I should  
create a new object called person.h that defines each element in  
the array and provides the accessor methods for binding to  
person.expectedRaise and person.Name. Then an NSArrayController can  
give an array for each column of the data. Another common method is  
to make an NSMutableArray of NSMutableDictionaries and then binding  
the dictionary @key to the arrayController. Either way achieves  
such a goal.


But here is the crux of my problem:
The library object (which encloses these array) must keep its  
interface which is a flat array of NSData (and as originally) is  
used on the api side.


Can i store internally the complicated array including the metadata  
and 

Re: How to create a GUID?

2008-09-06 Thread Mike Abdullah

CFUUIDCreate() followed by CFUUIDCreateString()

Mike.

On 6 Sep 2008, at 22:39, Meik Schuetz wrote:


Dear everyone,
 I feel kind of embarrassed to ask, but could someone lead me the  
way on how to create an globally unique ID (such as for example  
d73e066c-cc88-4d66-be42-94dc091bb571) ?


Best regards and thanks to everyone.
Meik
___

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

Please do not post 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: How to create a GUID?

2008-09-06 Thread I. Savant

On Sep 6, 2008, at 5:39 PM, Meik Schuetz wrote:

 I feel kind of embarrassed to ask, but could someone lead me the  
way on how to create an globally unique ID (such as for example  
d73e066c-cc88-4d66-be42-94dc091bb571) ?



  In addition to Mike's response, remember that Google is your  
friend ... and so is cocoadev.com. :-)


http://www.cocoadev.com/index.pl?IDentifiers

  At the bottom of the page, there's this:

- (NSString *)uuid
{
CFUUIDRef uuidRef = CFUUIDCreate(NULL);
CFStringRef uuidStringRef = CFUUIDCreateString(NULL, uuidRef);
CFRelease(uuidRef);
	NSString *uuid = [NSString stringWithString:(NSString *)  
uuidStringRef];

CFRelease(uuidStringRef);
return uuid;
}

--
I.S.




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to create a GUID?

2008-09-06 Thread I. Savant

On Sep 6, 2008, at 7:06 PM, Finlay Dobbie wrote:


Why the unnecessary copy?

- (NSString *)uuid
{
  CFUUIDRef uuidRef = CFUUIDCreate(NULL);
  CFStringRef uuidStringRef = CFUUIDCreateString(NULL, uuidRef);
  CFRelease(uuidRef);
  return [(NSString *)uuidStringRef autorelease];
}



  I didn't write or verify the code, but you appear to be absolutely  
right. Maybe you'd like to update the wiki?


--
I.S.

___

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

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

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

This email sent to [EMAIL PROTECTED]


new to Cocoa -- threading question

2008-09-06 Thread John Michael Zorko


Hello, all ...

I'm new to Cocoa, and i'm trying to launch a thread.  Yet, the app  
bombs when I try, and the console says it's because the selector isn't  
implemented:


2008-09-06 18:23:30.919 XXX[2363:20b] SEL: playMP3StreamThread
2008-09-06 18:23:30.927 XXX[2363:20b] *** Terminating app due to  
uncaught exception 'NSInvalidArgumentException', reason: '*** - 
[NSThread initWithTarget:selector:object:]: target does not implement  
selector (*** -[XXXAppDelegate playMP3StreamThread])'


Yet, here it is -- i'm not understanding something obviously (the  
example I saw looked easy enough):


@implementation XXXAppDelegate

.
.
.

- (void)playMP3StreamThread:(Song *)streamToPlay
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

	// initialize a mutex and condition so that we can block on buffers  
in use.


pthread_mutex_init(myData.mutex, NULL);
pthread_cond_init(myData.cond, NULL);

	OSStatus err = AudioFileStreamOpen(myData, MyPropertyListenerProc,  
MyPacketsProc,

   
kAudioFileAAC_ADTSType, myData.audioFileStream);
if (err)
{
NSLog(@AudioFileOStreamOpen error %d, err);
}

NSString *url = @http://some_hostl/;;
url = [url stringByAppendingString:streamToPlay.mp3];
	NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL  
URLWithString:[url  
stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]]  
cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];
	NSURLConnection *connection = [[NSURLConnection alloc]  
initWithRequest:request delegate:self];


if (connection)
{
receivedData = [[NSMutableData data] retain];
}
else
{
NSLog(@can't connect to server);
}

[pool release];
}


- (void)playStream:(Song *)streamToPlay
{
NSLog(@playing mp3 stream %s, [streamToPlay.mp3 UTF8String]);

// make sure current song play thread is stopped ...






// start a new thread with the new song ...

	[NSThread detachNewThreadSelector:@selector(playMP3StreamThread)  
toTarget:self withObject:streamToPlay];

}

What am I not grokking?  Any pointers would be appreciated ...

Regards,

John




___

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

Please do not post 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: new to Cocoa -- threading question

2008-09-06 Thread Kyle Sluder
On Sat, Sep 6, 2008 at 9:35 PM, John Michael Zorko [EMAIL PROTECTED]
wrote:
[NSThread detachNewThreadSelector:@selector(playMP3StreamThread)
 toTarget:self withObject:streamToPlay];

The selector you want is playMP3StreamThread:, not
playMP3StreamThread.  That colon is very important.

--Kyle Sluder
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: new to Cocoa -- threading question

2008-09-06 Thread John Michael Zorko


Kyle,



  [NSThread  
detachNewThreadSelector:@selector(playMP3StreamThread)

toTarget:self withObject:streamToPlay];


The selector you want is playMP3StreamThread:, not
playMP3StreamThread.  That colon is very important.


Ah, yes -- the colon.  I couldn't live without mine ;-)

*cymbal crash*

Regards,

John, who will be here all week ;-)


___

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

Please do not post 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: How to create a GUID?

2008-09-06 Thread Clark Cox
On Sat, Sep 6, 2008 at 5:06 PM, I. Savant [EMAIL PROTECTED] wrote:
 On Sep 6, 2008, at 7:06 PM, Finlay Dobbie wrote:

 Why the unnecessary copy?

 - (NSString *)uuid
 {
  CFUUIDRef uuidRef = CFUUIDCreate(NULL);
  CFStringRef uuidStringRef = CFUUIDCreateString(NULL, uuidRef);
  CFRelease(uuidRef);
  return [(NSString *)uuidStringRef autorelease];
 }


  I didn't write or verify the code, but you appear to be absolutely right.
 Maybe you'd like to update the wiki?

The original works with both GC and non-GC, while the version with
autorelease will leak under GC (because the string is never
CFRelease'd). In order to work with both runtimes, either use the
original, or do this:

- (NSString *)uuid
{
 CFUUIDRef uuidRef = CFUUIDCreate(NULL);
 CFStringRef uuidStringRef = CFUUIDCreateString(NULL, uuidRef);
 CFRelease(uuidRef);
 return [NSMakeCollectable(uuidStringRef) autorelease];
}

-- 
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: How to create a GUID?

2008-09-06 Thread Finlay Dobbie
On Sat, Sep 6, 2008 at 10:55 PM, I. Savant [EMAIL PROTECTED] wrote:
  At the bottom of the page, there's this:

 - (NSString *)uuid
 {
CFUUIDRef uuidRef = CFUUIDCreate(NULL);
CFStringRef uuidStringRef = CFUUIDCreateString(NULL, uuidRef);
CFRelease(uuidRef);
NSString *uuid = [NSString stringWithString:(NSString *)
 uuidStringRef];
CFRelease(uuidStringRef);
return uuid;
 }

Why the unnecessary copy?

- (NSString *)uuid
{
   CFUUIDRef uuidRef = CFUUIDCreate(NULL);
   CFStringRef uuidStringRef = CFUUIDCreateString(NULL, uuidRef);
   CFRelease(uuidRef);
   return [(NSString *)uuidStringRef autorelease];
}

 -- Finlay
___

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

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


[NEWB] An object, an array item and a string

2008-09-06 Thread Aron Spesard
So after reading the various image viewer tutorials on the web and  
getting through the StretchView chapter in Cocoa Programming for MAC  
OS X,  I decided to try and write one that takes a couple of arrays of  
images and composites two images together. Click a button and the view  
updates to the next composite image.
I was able to get the items in the arrays from open sheets and that  
all made sense. Before I even tried to start drawing things in Rect I  
tried to just put the path in a text box with the click of a button. I  
thought the below was the way to go:


- (IBAction)viewClientFiles:(id)sender
{
NSString *imagePath = (clientFileName);
[textField setStringValue:imagePath];
NSLog(@current client file name:%a,imageName);
}   

which compiles but hangs the app

The thing I don't really understand is that when I log clientFileName  
in openPanelDidEnd action
the log is the path to the file, but in the above action it's  
0x1.838000f085p-1029


Why is that and how can I get that item's path?

thanks,
Aaron
___

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

Please do not post 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: [NEWB] An object, an array item and a string

2008-09-06 Thread Nathan Kinsinger


On Sep 6, 2008, at 7:10 PM, Aron Spesard wrote:

So after reading the various image viewer tutorials on the web and  
getting through the StretchView chapter in Cocoa Programming for MAC  
OS X,  I decided to try and write one that takes a couple of arrays  
of images and composites two images together. Click a button and the  
view updates to the next composite image.
I was able to get the items in the arrays from open sheets and that  
all made sense. Before I even tried to start drawing things in Rect  
I tried to just put the path in a text box with the click of a  
button. I thought the below was the way to go:


- (IBAction)viewClientFiles:(id)sender
{
NSString *imagePath = (clientFileName);
[textField setStringValue:imagePath];
NSLog(@current client file name:%a,imageName);
}   

which compiles but hangs the app

The thing I don't really understand is that when I log  
clientFileName in openPanelDidEnd action
the log is the path to the file, but in the above action it's  
0x1.838000f085p-1029


Why is that and how can I get that item's path?

thanks,
Aaron


The problem is the %a in the NSLog string. %a is a floating point  
number in hex format. In this case it's converting the address of the  
pointer imageName to a hex floating point number.


The correct conversion character for NSStrings (or most any Objective- 
C object) is [EMAIL PROTECTED]


--Nathan
___

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

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