Re: IKFilterUIView uiConfiguration values - huh?

2008-11-09 Thread Nathan Kinsinger

On Nov 9, 2008, at 12:10 AM, Graham Cox wrote:


What is the value expected for:

"IKUImaxSize
Controls whose dimensions are the maximum allowable for the filter  
view. A width or height of 0 indicates that that dimension of the  
view is not restricted. If the size requested is too small, the  
filter is expected to return a view as small as possible. It is up  
to the client to verify that the returned view fits into the context."


(from 
http://developer.apple.com/documentation/GraphicsImaging/Reference/IKFilterUIAddition/IKFIlterUI_Reference.html)



I tried an NSValue containing an NSSize, and a NSNumber containing a  
float. Both throw up "unrecognised selector" exceptions - in the  
first case for -floatValue and the second for - 
getCString:maxLength:encoding:




I have defended the documentation in the past but this is some of  
the worst I've seen - it's below minimum, since it doesn't even tell  
you the type of an expected parameter, let alone properly explain  
how it gets used.


A google search on "IKUImaxSize" returned:
http://www.mailinglistarchive.com/[EMAIL PROTECTED]/msg02191.html

Interesting sidenote, the 'm' in max is not capitalized.

Sorry, I don't have an answer to your wider question.

--Nathan


Wider question: I have a view which is intended to host the filter  
controls supplied by IKFilterUIView. The view is quite limited in  
size, so I'm hoping that the UIFilter stuff in 10.5 is smart enough  
to lay out the controls to fit. So far it doesn't seem to do a great  
job but then I haven't got the above parameter working. I'm assuming  
I should pass in the width (or height??? - unclear) of my controls  
hosting view here. I also tried simply leaving out the parameter,  
which works, but then when I try and resize the view myself using - 
setFrame: it just truncates and clips off the cntrols within. It  
seems as if the controls supplied have some arbitrary minimums that  
are actually rather wide. I'm hoping this stuff isn't too lame  
because it apparently saves a ton of work, but if it does a half- 
assed job that's not really very useful, is it?


Anyone got any of this to work well yet?

tia,



Graham

___

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

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

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

This email sent to [EMAIL PROTECTED]


Observing NSArrayController selectionIndex always returns null

2008-11-09 Thread Ken Tozier

Hi

I'm trying to observe an NSArrayController's selectionIndex which,  
according to the documentation here:


http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSArrayController_Class/Reference/Reference.html#/ 
/apple_ref/occ/instm/NSArrayController/selectionIndex


Is an observable property.

Changes do trigger the observer's "observeValueForKeyPath" method but  
trying to fetch the value using


[inChange objectForKey: NSKeyValueChangeNewKey]

Always returns null. Is this a bug in NSArrayController?


___

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

Please do not post admin requests or moderator comments to the list.
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]


CoreAudio — AudioUnit and AudioUnitExternalBuf fer

2008-11-09 Thread Yoann Gini

Hi folks,

	For a project I need to use AudioUnit with an AudioUnitExternalBuffer  
with special size. But I haven't in documentation how use this buffer.  
Someone know how I can say to my AudioUnit "hey guy, use this special  
buffer!". (I've already set the property  
kAudioUnitProperty_ShouldAllocateBuffer to false).


Bests regards,
Yoann

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]

Re: runModalSession in Cocoa plugin for Carbon app does not return

2008-11-09 Thread Colin Barrett
What exactly do you mean by "Cocoa plug-in application"?

-Colin

On Sun, Nov 9, 2008 at 1:58 AM, Alexander Shmelev <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I have following code in my Cocoa plug-in application:
>
> NSModalSession session = [NSApp beginModalSessionForWindow:theWindow];
> for (;;) {
>if ([NSApp runModalSession:session] != NSRunContinuesResponse)
>break;
>[self doSomeWork];
> }
> I use modal sessions for displaying dialog with progress indicator and
> "cancel" button.
> When I run my plug-in under Carbon application, it halts on [NSApp
> runModalSession] and [self doSomeWork] is not called at all. When I click
> "cancel" button on my dialog, [NSApp runModalSession] returns !=
> NSRunContinuesResponse and execution of "for (;;)" block finished.
> How can I fix this?
> NSApplicationLoad() does not help.
> In Cocoa applications my plug-in works without problems. This issue only
> with Carbon applications.
>
> BR, Alexander.
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/dogcow%40gmail.com
>
> This email sent to [EMAIL PROTECTED]
>
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: runModalSession in Cocoa plugin for Carbon app does not return

2008-11-09 Thread Alexander Shmelev
I have TWAIN Data Source written with Cocoa. When I use it from Image  
Capture, everything is ok.
But when I try to use it from GIMP (Carbon) or Photoshop CS3 (Carbon),  
[NSApp runModalSession] is called once, but returns only when [NSApp  
stopModal] called.


But I expect that [NSApp runModalSession] is called, then it processes  
some pending events, and then returns, so my code can call [self  
doSomeWork], then loop repeat.


BR, Alexander

On 09.11.2008, at 13:37, Colin Barrett wrote:


What exactly do you mean by "Cocoa plug-in application"?

-Colin

On Sun, Nov 9, 2008 at 1:58 AM, Alexander Shmelev <[EMAIL PROTECTED]>  
wrote:

Hello,

I have following code in my Cocoa plug-in application:

NSModalSession session = [NSApp  
beginModalSessionForWindow:theWindow];

for (;;) {
  if ([NSApp runModalSession:session] != NSRunContinuesResponse)
  break;
  [self doSomeWork];
}
I use modal sessions for displaying dialog with progress indicator  
and

"cancel" button.
When I run my plug-in under Carbon application, it halts on [NSApp
runModalSession] and [self doSomeWork] is not called at all. When I  
click

"cancel" button on my dialog, [NSApp runModalSession] returns !=
NSRunContinuesResponse and execution of "for (;;)" block finished.
How can I fix this?
NSApplicationLoad() does not help.
In Cocoa applications my plug-in works without problems. This issue  
only

with Carbon applications.

BR, Alexander.

___

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

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

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

This email sent to [EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: IKFilterUIView uiConfiguration values - huh?

2008-11-09 Thread Graham Cox


On 9 Nov 2008, at 7:11 pm, Nathan Kinsinger wrote:


On Nov 9, 2008, at 12:10 AM, Graham Cox wrote:


What is the value expected for:

"IKUImaxSize
Controls whose dimensions are the maximum allowable for the filter  
view. A width or height of 0 indicates that that dimension of the  
view is not restricted. If the size requested is too small, the  
filter is expected to return a view as small as possible. It is up  
to the client to verify that the returned view fits into the  
context."


(from 
http://developer.apple.com/documentation/GraphicsImaging/Reference/IKFilterUIAddition/IKFIlterUI_Reference.html)



I tried an NSValue containing an NSSize, and a NSNumber containing  
a float. Both throw up "unrecognised selector" exceptions - in the  
first case for -floatValue and the second for - 
getCString:maxLength:encoding:




I have defended the documentation in the past but this is some of  
the worst I've seen - it's below minimum, since it doesn't even  
tell you the type of an expected parameter, let alone properly  
explain how it gets used.


A google search on "IKUImaxSize" returned:
http://www.mailinglistarchive.com/[EMAIL PROTECTED]/msg02191.html

Interesting sidenote, the 'm' in max is not capitalized.



Thanks Nathan, that does indeed seem to work. Is that really quite  
weird though, or what? Intern coder maybe?


I get better results, but still pretty poor, since while the controls  
now fit within the desired space, they overlap each other and don't  
resize very nicely. Well, some do and some don't. Which suggests to me  
that however they are set up with respect to autoresizing is done  
inconsistently.


--Graham
___

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

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

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

This email sent to [EMAIL PROTECTED]


Can't get CABasicAnimation to explicitly animate "frame" property of CALayer

2008-11-09 Thread Oleg Krupnov
Using Core Animation, I want to make a layer change its position and
size with animation. So I need to use the "frame" property of CALayer,
which is animatable, according to the documentation.

The implicit animation like this:

[theLayer setFrame:NSRectToCGRect(targetFrame)];

works perfectly, but I want to use the explicit animation, because I
want to use a delegate to be notified when the animation ends.

So here is my code:

CABasicAnimation *theAnimation;
theAnimation=[CABasicAnimation animationWithKeyPath:@"frame"];
theAnimation.toValue=[NSValue valueWithRect:targetFrame];
[theAnimation setDelegate:self];
[theLayer addAnimation:theAnimation forKey:@"animateFrame"];

The problem is that the animation does not occur! The layer stays in
the same place and size...

Interesting that the delegate's animationDidStop:finished: method DOES
get called. Also, if I replace the property to  "position", or say
"opacity", the animation occurs just fine.

What the problem might be?
___

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

Please do not post admin requests or moderator comments to the list.
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]


runModalSession in Cocoa plugin for Carbon app does not return

2008-11-09 Thread Alexander Shmelev

Hello,

I have following code in my Cocoa plug-in application:

NSModalSession session = [NSApp beginModalSessionForWindow:theWindow];
for (;;) {
if ([NSApp runModalSession:session] != NSRunContinuesResponse)
break;
[self doSomeWork];
}
I use modal sessions for displaying dialog with progress indicator and  
"cancel" button.
When I run my plug-in under Carbon application, it halts on [NSApp  
runModalSession] and [self doSomeWork] is not called at all. When I  
click "cancel" button on my dialog, [NSApp runModalSession] returns !=  
NSRunContinuesResponse and execution of "for (;;)" block finished.

How can I fix this?
NSApplicationLoad() does not help.
In Cocoa applications my plug-in works without problems. This issue  
only with Carbon applications.


BR, Alexander.

___

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

Please do not post admin requests or moderator comments to the list.
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]


NSAttributedString in NSAffineTransform

2008-11-09 Thread Joseph Ayers
I am having a tremendous problem getting the vertical text in the y  
Axis of a graph. If i try to rotate text  specified as
NSAttributedString it appears to get translated in nonlinear ways: I  
would assume that in the below, the text would

rotate around NSMinX(rect) and NSMinY(rect) but it doesn't.

Consider:
- (void)drawYLabel:(NSRect)rect
{

NSPoint labelHere;
int xOffSet;
if(drawYLabelFlag == YES)
{
NSAffineTransform *transform = [NSAffineTransform 
transform];
NSGraphicsContext *context   = [NSGraphicsContext 
currentContext];

//  [transform translateXBy:NSMinY(gRect) yBy:0.0];
[transform rotateByDegrees:90.0];

[context saveGraphicsState];
[transform concat];

xOffSet =NSMinY(rect) + ((gHeight/2.0)  - [ylabel 
size].width/2.0);
			labelHere = NSMakePoint( xOffSet,  NSMinY(rect) +[ylabel  
size].height) ;

[ylabel drawAtPoint:labelHere];

[context restoreGraphicsState];
}
}
yLabel is a NSAttributed String
gHeight is the height of rect.
rect is a bounding rect for the graph that is smaller than the frame  
of the NSView.


yLabel doesn't appear in the NSView

What am I doing wrong here

I remain,

Joseph Ayers, Professor
Department of Biology and
Marine Science Center
Northeastern University
East Point, Nahant, MA 01908
Phone (781) 581-7370 x309(office), x335(lab)
Boston: 444 Richards Hall (617) 373-4044
Cellular (617) 755-7523, FAX: (781) 581-6076
eMail: [EMAIL PROTECTED]
http://www.neurotechnology.neu.edu/






___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSAttributedString in NSAffineTransform

2008-11-09 Thread Graham Cox


On 10 Nov 2008, at 1:01 am, Joseph Ayers wrote:

I am having a tremendous problem getting the vertical text in the y  
Axis of a graph. If i try to rotate text  specified as
NSAttributedString it appears to get translated in nonlinear ways: I  
would assume that in the below, the text would

rotate around NSMinX(rect) and NSMinY(rect) but it doesn't.

Consider:
- (void)drawYLabel:(NSRect)rect
{

NSPoint labelHere;
int xOffSet;
if(drawYLabelFlag == YES)
{
NSAffineTransform *transform = [NSAffineTransform 
transform];
NSGraphicsContext *context   = [NSGraphicsContext 
currentContext];

//  [transform translateXBy:NSMinY(gRect) yBy:0.0];
[transform rotateByDegrees:90.0];

[context saveGraphicsState];
[transform concat];

xOffSet =NSMinY(rect) + ((gHeight/2.0)  - [ylabel 
size].width/2.0);
			labelHere = NSMakePoint( xOffSet,  NSMinY(rect) +[ylabel  
size].height) ;

[ylabel drawAtPoint:labelHere];

[context restoreGraphicsState];
}
}
yLabel is a NSAttributed String
gHeight is the height of rect.
rect is a bounding rect for the graph that is smaller than the frame  
of the NSView.


yLabel doesn't appear in the NSView

What am I doing wrong here



Any rotation is with respect to the origin of the coordinate system.  
Thus, to rotate about a given point, you need to make that point the  
origin, perform the rotation, then translate back to the actual  
position you want to draw.


Thus (typed into mail):

NSAffineTransform* transform = [NSAffineTransform transform];

[transform translateXBy:myPoint.x yBy:myPoint.y];
[transform rotateByDegrees:90];
[transform translateXBy:-myPoint.x yBy:-myPoint.y];
[transform concat];

[myAttributedString drawAtPoint:myPoint];


Note that the translation to the origin and back is apparently back-to- 
front. Transforms are like that - I find it sometimes helps to read  
the series of translate/scale/rotate operations in reverse order to  
get an idea of what it does as if in a series of steps.


Anyway, in your code you need to figure the origin of your drawing  
rect and do the above. Your code refers to 'gRect' but uses 'rect'  -  
not clear if that's intentional or what it means. But if your label is  
drawn in the rect 'rect' then you should be able to use that  
information alone to handle the rotation, so I'm not sure what gRect  
is or how it's being used.


Anyhoo, hope that helps.

Here's some code I have in my current app that does something similar,  
labelling the axes of a grid. It refers to other methods and so on not  
shown here, but will give you an idea of how I do the rotation. One  
thing to note is that I do all of the positioning calculations ahead  
of doing the rotation/drawing. Also,  is the updateRect that  
originates in the view's -drawRect: method, not the box in which I  
draw the text. This also handles both X and Y axes, hence the added  
complication ;-)




- (void)	drawAnnotationElement:(unsigned) indx maxElement:(unsigned)  
max inRect:(NSRect) aRect atEdge:(DKOGridEdge) edge

{
	// is the ordinal item to draw, starting from 0. The actual  
drawn element factors in the offset and increment.  specifies  
which edge(s) the annotation
	// should be drawn at. It will be left or right. For vertical  
annotation left == top, right == bottom.


if( edge == 0 )
return; // nothing to do

NSString*   str = [self annotationStringForElement:indx 
maxElement:max];
	NSAttributedString* std = [[NSAttributedString alloc]  
initWithString:str attributes:[self textAttributes]];

NSRect  bbox, ir;

// get the bounding box for the string

bbox.size = [std size];
ir = [mGridRef borderRect];

// swap the box width/height if rotated

if([self isRotated])
{
float temp = bbox.size.width;
bbox.size.width = bbox.size.height;
bbox.size.height = temp;
}

// position the box

float textOffset = [mGridRef borderAllowance] + mOffset;

float sd = [mGridRef spanLength];

if([self orientationIsVertical])
{
if( edge == kDKOLeftEdge )
bbox.origin.x = NSMinX( ir ) - bbox.size.width - 
textOffset;
else
bbox.origin.x = NSMaxX( ir ) + textOffset;

		bbox.origin.y = ( NSMinY( ir ) + ( sd * indx )) - (bbox.size.height  
* 0.5);


if([self placement] == kDKOPlaceAnnotationBetweenGrid )
bbox.origin.y += sd * 0.5;

 

Re: CoreAudio — AudioUnit and AudioUnitExter nalBuffer

2008-11-09 Thread Michael Ash
On Sun, Nov 9, 2008 at 4:20 AM, Yoann Gini <[EMAIL PROTECTED]> wrote:
> Hi folks,
>
>For a project I need to use AudioUnit with an AudioUnitExternalBuffer
> with special size. But I haven't in documentation how use this buffer.
> Someone know how I can say to my AudioUnit "hey guy, use this special
> buffer!". (I've already set the property
> kAudioUnitProperty_ShouldAllocateBuffer to false).

I'm afraid I don't know the answer, but you will probably get much
better results on the coreaudio-api list, as this question has nothing
to do with Cocoa:

http://lists.apple.com/mailman/listinfo/coreaudio-api

I hope you can find your answer.

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: CoreAudio — AudioUnit and AudioUnitExter nalBuffer

2008-11-09 Thread Yoann Gini
Thank for your answer, I try now on the coreaudio list. I've hope that  
someone have the answer here.


Thanks

Le 9 nov. 08 à 17:56, Michael Ash a écrit :

On Sun, Nov 9, 2008 at 4:20 AM, Yoann Gini <[EMAIL PROTECTED]>  
wrote:

Hi folks,

  For a project I need to use AudioUnit with an  
AudioUnitExternalBuffer
with special size. But I haven't in documentation how use this  
buffer.

Someone know how I can say to my AudioUnit "hey guy, use this special
buffer!". (I've already set the property
kAudioUnitProperty_ShouldAllocateBuffer to false).


I'm afraid I don't know the answer, but you will probably get much
better results on the coreaudio-api list, as this question has nothing
to do with Cocoa:

http://lists.apple.com/mailman/listinfo/coreaudio-api

I hope you can find your answer.

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/yoann.gini 
%40gmail.com


This email sent to [EMAIL PROTECTED]




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 manage (My)SQL data in Cocoa

2008-11-09 Thread Michele Barboni

Hi,
I'm developing a small application for showing/adding/modifying/ 
deleting entries for a MySQL database by some NSTableViews.


My (mysql) tables are very simple, all of them has as primary-key and  
foreign-key an integer (autoincrement), other columns are varchar() or  
text.


Currently I'm querying the database for a column at once, building an  
NSArray of them and add all NSArrays (the columns) in a NSMutableArray  
("the table").
For editing I'm doing queries in the NSTableView controller (and I  
really don't like this).


So, I was wondering if there's a "standard" way for storing sql data  
(not sqlite and core data of course..) with Cocoa collections.


For example, I have thought to a NSDictionary with id integers as key  
and NSArrays with the rest of the *row* as values, sounds better but  
since I'm not an experienced programmer I'm asking..


Thanks,
Michele.
___

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

Please do not post admin requests or moderator comments to the list.
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 manage (My)SQL data in Cocoa

2008-11-09 Thread Quincey Morris

On Nov 9, 2008, at 09:16, Michele Barboni wrote:

Currently I'm querying the database for a column at once, building  
an NSArray of them and add all NSArrays (the columns) in a  
NSMutableArray ("the table").
For editing I'm doing queries in the NSTableView controller (and I  
really don't like this).


So, I was wondering if there's a "standard" way for storing sql data  
(not sqlite and core data of course..) with Cocoa collections.


For example, I have thought to a NSDictionary with id integers as  
key and NSArrays with the rest of the *row* as values, sounds better  
but since I'm not an experienced programmer I'm asking..


If you're intending to read the entire database into memory, then the  
most natural "fit" with a NSTableView would probably be an array of  
dictionaries. The arrays would be rows, and each dictionary would  
contain the database column values for each row, keyed by a database  
column name. Then you could connect the table view columns to the  
dictionary with bindings, or use a data source where (say) the table  
column identifier was the dictionary key.


Or, instead of one dictionary per row, create a data model class that  
has a property (i.e. a setter and a getter, backed by a suitable  
instance variable) for each database column, and one object of this  
class per row. That would use slightly less memory than dictionaries,  
and allow you to customize the logic of data access. (The objects  
could keep track of what was changed, too, so that you could avoid  
queries at NSTableView editing time.)



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSArrayController, bindings and NSUserDefaults

2008-11-09 Thread Andre Masse

Thanks a lot for your example Steven.

I'm probably over thinking this. I'll just use IB, no custom class, no  
encoding no trouble :-)


Thanks again,

Andre Masse

On Nov 9, 2008, at 15:13, Steven Riggs wrote:


Check out a code sample (using no code, just IB)...

http://idisk.mac.com/steven.riggs-Public?view=web



___

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

Please do not post admin requests or moderator comments to the list.
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: Inviting to comment on Cocoa categories

2008-11-09 Thread Graham Cox


On 10 Nov 2008, at 5:47 am, Tommy Nordgren wrote:


//  TN+NSAffineTransform.h
@interface NSAffineTransform (TNGraphics)



A comment on naming conventions. It doesn't matter that much  
especially if you are just using them privately, but there's an  
inconsistency here. Usually I name category files primarily by the  
class they are a category on + the name of the category:


NSAffineTransform+TNGraphics.h

This seems to be a widely adopted convention.

Doing this allows you to see at a glance that the file contains  
functions which extend NSAffineTransform, which you might miss if the  
name doesn't start with the class. I tend to work with a narrowish  
files column in Xcode which truncates long filenames, so I find this  
helps there too.



+(NSAffineTransform *) transformRotatedAroundPoint:(NSPoint) p  
degrees:(CGFloat) deg;



A handy method, but I wonder if it could be named to be more readable  
with respect to its actual function, for example:


+ transformWithPoint:rotatedByDegrees:

this way each section of the method name is a functional description  
in its own right, whereas degrees: isn't (though in this case it's  
easy to guess what is wanted there). Also, it's not the transform that  
is rotated, so +transformRotatedAroundPoint: is not an accurate  
description of what the method returns. However I'm sure this could be  
improved upon further, just my first thought.


--Graham
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSGraphiteControlTint in app

2008-11-09 Thread Andrew Merenbach


On Nov 9, 2008, at 1:11 PM, Ralph Manns wrote:

There are some application, whose controls use the  
NSGraphiteControlTint,
although the control tint in System Preference is set to  
NSBlueControlTint.

How can this be done?

Thanks, Ralph.


Hi!

My answer is below, but I strongly advise you not to potentially go  
against the user's own preferences.  A user will expect your controls  
to appear the way that they're used to seeing them, and the first  
thing that I (and many others, I suspect) do when I find an app that  
doesn't "feel" quite right is drag it to the Trash.  I would submit  
that unless you have a very special case, just wanting to make your  
app look different is not a real reason to do this.


If you have a need to do this, I would go with the method -[NSCell  
setControlTint:] (a few other classes have it such a method, too;  
search the docs).


Apologies if that sounds harsh.  It is meant with no disrespect and  
also to save you trouble, as I cannot emphasize enough how important  
appearance is to a Mac app. :)


Cheers,
Andrew


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]

Re: Signature Recognition in Cocoa

2008-11-09 Thread Pierce Freeman
As I am not very familiar to signature recognition (as you may have noticed)
where can I learn how to get the algorithm in code form?  Also, are there
other methods that could get a more precise output?

Thanks,

Pierce F.


On 11/3/08 1:47 AM, "Raphael Sebbe" <[EMAIL PROTECTED]> wrote:

> If you have access to the temporal sequence of events (not just final image),
> DTW (Dynamic Time Warping) could be an easy approach. You would have to choose
> features (pressure, location, speed, acc) with respect to time, then record a
> few "templates" for the reference signature. The output of the DTW algorithm
> is a distance to each template, which you can threshold to tell OK, NOT TOO
> FAR, DIFFERENT.
> 
> To get input to that algorithm in Cocoa, well, an NSView subclass + handling
> events, I guess.
> 
> Raphael 
> 
> On Mon, Nov 3, 2008 at 3:14 AM, Pierce Freeman <[EMAIL PROTECTED]>
> wrote:
>> I have been looking at various open source projects/sites but still
>> can't find a way to check two signatures to see if they are the same in
>> Cocoa.  For example: On setup, "User A" writes his name on his tablet, then
>> "User B" tries to sign in using an imitation signature, but it will return
>> an warning message instead of doing the task.  I have read a few articles,
>> but can't make any sense out of how to use the information in Cocoa.  If
>> anyone could tell/point me to any information of the best way to do this in
>> Cocoa, it would be great.
>> 
>> 
>> Pierce F.
>> 
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> 
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/raphael.sebbe%40gmail.com
>> 
>> This email sent to [EMAIL PROTECTED]
> 
> 

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Inviting to comment on Cocoa categories

2008-11-09 Thread Bill Bumgarner

On Nov 9, 2008, at 3:07 PM, Graham Cox wrote:
+(NSAffineTransform *) transformRotatedAroundPoint:(NSPoint) p  
degrees:(CGFloat) deg;


A handy method, but I wonder if it could be named to be more  
readable with respect to its actual function, for example:


+ transformWithPoint:rotatedByDegrees:


I would highly recommend that you prefix your category methods with  
some kind of a unique identifier.


I.e.

TN_transformWithPoint:rotatedByDegrees:

Objective-C does not have namespaces, not for classes and not for  
methods.


Much confusion and lost time has been caused by a software update  
adding a method that a developer already has in a category somewhere


b.bum



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]

Re: Xcode's New Data Model reads ivars as attributes ?!?

2008-11-09 Thread Chris Hanson
Core Data can use instance variables as storage for attributes (and  
relationships) instead of managing the storage itself. This is  
discouraged though because it doesn't buy you anything as a developer  
- in fact, it can be more efficient for Core Data to manage storage  
itself - and it makes it possible to access the storage behid the  
framework's back. That would be bad.


The functionality you've discovered is there primarily to help you  
port your existing model classes to Core Data; Core Data will infer  
attributes and relationships from the class declarations, and generate  
entities that will be backed by those classes. Then you can change  
your superclasses to NSManagedObject, remove your ivars, adjust or  
eliminate your accessors, and have converted an existing app to use  
Core Data for its object graph management.


  -- Chris

On Nov 8, 2008, at 5:53 PM, Jerry Krinock <[EMAIL PROTECTED]> wrote:

One of the pillars of my understanding of Core Data, I thought, was  
that, in a managed object, instance variables are not attributes and  
attributes are not instance variables.


Well, I just created a new Data Model from scratch in Xcode 3.1, for  
the first time.  I was rather surprised when it asked me to choose  
classes to put in the model.  I just wanted an empty model.  Out of  
curiosity, I chose a class which was not an NSManagedObject  
subclass, but one that I was thinking of "converting" to be an  
NSManagedObject subclass.  To my surprise, however, the model it  
created included an entity of my selected class, and five of its six  
instance variables are now its attributes.


Surely this will not work.  Is the assumption that indeed I did  
intend to "convert" this to an NSManagedObject, and that I would be  
manually deleting the instance variables?


Jerry

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/cmh%40me.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: Inviting to comment on Cocoa categories

2008-11-09 Thread Tommy Nordgren


On 10 nov 2008, at 00.07, Graham Cox wrote:



On 10 Nov 2008, at 5:47 am, Tommy Nordgren wrote:


//  TN+NSAffineTransform.h
@interface NSAffineTransform (TNGraphics)



A comment on naming conventions. It doesn't matter that much  
especially if you are just using them privately, but there's an  
inconsistency here. Usually I name category files primarily by the  
class they are a category on + the name of the category:


NSAffineTransform+TNGraphics.h

This seems to be a widely adopted convention.

Doing this allows you to see at a glance that the file contains  
functions which extend NSAffineTransform, which you might miss if  
the name doesn't start with the class. I tend to work with a  
narrowish files column in Xcode which truncates long filenames, so I  
find this helps there too.



+(NSAffineTransform *) transformRotatedAroundPoint:(NSPoint) p  
degrees:(CGFloat) deg;



A handy method, but I wonder if it could be named to be more  
readable with respect to its actual function, for example:


+ transformWithPoint:rotatedByDegrees:


this way each section of the method name is a functional description  
in its own right, whereas degrees: isn't (though in this case it's  
easy to guess what is wanted there). Also, it's not the transform  
that is rotated, so +transformRotatedAroundPoint: is not an accurate  
description of what the method returns. However I'm sure this could  
be improved upon further, just my first thought.


--Graham

Good point.
A better name would probably be:
+ transformRotatingAroundPoint: byDegrees.
I will change it so.
I don't think the name you suggested accurately describes that the  
supplied point is the origin of the rotation.

--
The three things an undertaker should never say to a client:
-Nice doing business with you.
-Welcome back.
-Have a nice day. (The King of ID)
--
Tommy Nordgren
[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: Inviting to comment on Cocoa categories

2008-11-09 Thread Michael Ash
On Sun, Nov 9, 2008 at 9:55 PM, Kyle Sluder
<[EMAIL PROTECTED]> wrote:
> On Sun, Nov 9, 2008 at 1:47 PM, Tommy Nordgren <[EMAIL PROTECTED]> wrote:
>> +(NSAffineTransform *) transformRotatedAroundPoint:(NSPoint) p
>> degrees:(CGFloat) deg;
>
> Please be aware that rotation around a point other than the origin is
> not a linear transformation.  This may be why such functionality was
> omitted from NSAffineTransform.

That's not so. Any affine transform is a linear transformation, and
rotation around a point can certainly be represented as an affine
transform.

Most likely the reason why NSAffineTransform doesn't have this
functionality is because NSAffineTransform simply provides the basic
building blocks, and rotation about a point is actually a combination
of those basics.

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: Inviting to comment on Cocoa categories

2008-11-09 Thread Kyle Sluder
On Sun, Nov 9, 2008 at 10:43 PM, Michael Ash <[EMAIL PROTECTED]> wrote:
> That's not so. Any affine transform is a linear transformation, and
> rotation around a point can certainly be represented as an affine
> transform.

No, you have that backwards.  Any linear transformation is an affine
transformation; affine transformations can also involve translation,
which is not a linear transformation.

--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: Cocoa and NSLog

2008-11-09 Thread Marcus


9 nov 2008 kl. 23.03 skrev Tommy Nordgren:


Is it possible to open an Additional file for use by logging in Cocoa
(I want it to contain ONLY the info logged from my App)


You can do that by just redirect standard error to a file. Since each  
process has their own set of file descriptors it will only affect your  
application.


int fd = creat ("/Users/marcus/my_log", S_IRUSR | S_IWUSR | S_IRGRP |  
S_IROTH);

close (STDERR_FILENO);
dup (fd);
close (fd);
NSLog(@"this will be written to my_log");

Marcus


___

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

Please do not post admin requests or moderator comments to the list.
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: Inviting to comment on Cocoa categories

2008-11-09 Thread Graham Cox


On 10 Nov 2008, at 1:55 pm, Kyle Sluder wrote:


Please be aware that rotation around a point other than the origin is
not a linear transformation.  This may be why such functionality was
omitted from NSAffineTransform.



It is linear. But maybe what you're referring to is that it's easy to  
screw up a combination of rotation, scaling and translation so that a  
shape - say a rect - gets inadvertently skewed and becomes a  
trapezoid. That's still a linear transformation, but quite often  
definitely not what you want.


--Graham
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSGraphiteControlTint in app

2008-11-09 Thread Ralph Manns
Hello,
I don't think the method setControlTint is the solution I'm looking for,
because only a few classes have such a method, NSWindow doesn't. Maybe my
question was to general.

Is there a way without using private methods to set the complete appearance
of an application to NSGraphiteControlTint, although the control tint in
System Preference is set to NSBlueControlTint.

I understand how important the appearance is to mac apps. But the
NSGraphiteControlTint is used by some apps to give them a "pro-app"
appearance. Do you really drag Apples "pro-apps" like Aperture into the
trash, because they look different? ;-)
I think for some few apps it is okay to violate the "Aqua-HIG". Aperture for
example wouldn't look so great with a blue aqua appearance.

Thanks, Ralph.


2008/11/10 Andrew Merenbach <[EMAIL PROTECTED]>

>
> On Nov 9, 2008, at 1:11 PM, Ralph Manns wrote:
>
>  There are some application, whose controls use the NSGraphiteControlTint,
>> although the control tint in System Preference is set to
>> NSBlueControlTint.
>> How can this be done?
>>
>> Thanks, Ralph.
>>
>
> Hi!
>
> My answer is below, but I strongly advise you not to potentially go against
> the user's own preferences.  A user will expect your controls to appear the
> way that they're used to seeing them, and the first thing that I (and many
> others, I suspect) do when I find an app that doesn't "feel" quite right is
> drag it to the Trash.  I would submit that unless you have a very special
> case, just wanting to make your app look different is not a real reason to
> do this.
>
> If you have a need to do this, I would go with the method -[NSCell
> setControlTint:] (a few other classes have it such a method, too; search the
> docs).
>
> Apologies if that sounds harsh.  It is meant with no disrespect and also to
> save you trouble, as I cannot emphasize enough how important appearance is
> to a Mac app. :)
>
> Cheers,
>Andrew
>
___

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

Please do not post admin requests or moderator comments to the list.
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: Help with this crashing method

2008-11-09 Thread Andre Masse

Ahh! Thanks a lot guys. Now I can sleep :-)

Have a good night,

Andre Masse

___

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

Please do not post admin requests or moderator comments to the list.
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]


NSGraphiteControlTint in app

2008-11-09 Thread Ralph Manns
There are some application, whose controls use the NSGraphiteControlTint,
although the control tint in System Preference is set to NSBlueControlTint.
How can this be done?

Thanks, Ralph.
___

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

Please do not post admin requests or moderator comments to the list.
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: Help with this crashing method

2008-11-09 Thread mmalcolm crawford


On Nov 9, 2008, at 9:03 PM, Andre Masse wrote:

	[userDict setObject:[NSImage imageNamed:NSImageNameUser]  
forKey:@"userImage"];


"A default’s value must be a property list, that is, an instance of  
(or for collections a combination of instances of): NSData, NSString,  
NSNumber, NSDate, NSArray, or NSDictionary. If you want to store any  
other type of object, you should typically archive it to create an  
instance of NSData. For more details, see User Defaults Programming  
Topics for Cocoa."



mmalc

___

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

Please do not post admin requests or moderator comments to the list.
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 microphone

2008-11-09 Thread chaitanya pandit

Hi List,
I'm using core audio to record sound, however i want to detect if a  
microphone is connected to the computer, how can i do that?

I tried using QTKit to do this:

QTCaptureDevice *soundDevice = [QTCaptureDevice  
defaultInputDeviceWithMediaType:QTMediaTypeSound];

BOOL micPresent = [soundDevice isConnected]];

But on my Mac Mini which doesn't have a built in microphone it still  
returns YES for isConnected and the device returned is "Built-in input"

Any help would be appreciated,
Thanks,
Chaitanya
___

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

Please do not post admin requests or moderator comments to the list.
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: NSArrayController, bindings and NSUserDefaults

2008-11-09 Thread Andre Masse

Thanks for your reply,

I was using NSKeyeyArchiver to encoded my custom object. Didn't know  
about NSUnarchiveFromData though. Couldn't find it in Apple  
documentation neither. Anyway, I moved to a much simpler version which  
bypass using a custom class. It's now an array of NSMutableDictionary  
all setup in IB.


Have a good night,

Andre Masse


On Nov 9, 2008, at 16:05, Volker in Lists wrote:

you need an formatter - NSUnarchiveFromData and then it works rather  
well. I store supplementary information that each user can edit in  
NSUserDefaults. The info is maintained in NSTableViews and stored as  
an Array of NSMutableDictionary. Works really well.



___

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

Please do not post admin requests or moderator comments to the list.
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: Help with this crashing method

2008-11-09 Thread Roland King

can you put NSImage's in preferences without wrapping them in NSData first?

by the way - why do you use [ NSString stringWithString:string> ] instead of just using the string constant?


Andre Masse wrote:


Hi,

I've been struggling with this method for the last couple of hours. I  
just can't see where the problem is. I get the following error which 
I  suppose indicate that I've released something I shouldn't... Since 
I'm  not releasing anything, I wonder what I'm doing wrong. Must be 
some  stupid thing but I just can't see it...


The Debugger has exited due to signal 10 (SIGBUS).The Debugger has  
exited due to signal 10 (SIGBUS).


Stepping with the debugger shows that the crash happends on the last  
line. Obviously, commenting it out prevent the crash.



+ (void) initialize
{
NSMutableDictionary *defaultValues = [NSMutableDictionary 
dictionary];

NSMutableDictionary *userDict = [NSMutableDictionary dictionary];

[userDict setObject:[NSImage imageNamed:NSImageNameUser]  
forKey:@"userImage"];

[userDict setObject:NSFullUserName() forKey:@"userFullName"];
[userDict setObject:NSUserName() forKey:@"loginName"];
[userDict setObject:[NSString stringWithString:@""]  
forKey:@"loginPassword"];
[userDict setObject:[NSString stringWithString:@"localhost"]  
forKey:@"loginHost"];
[userDict setObject:[NSString stringWithString:@"tdhsql"]  
forKey:@"loginDatabaseName"];
[userDict setObject:[NSString stringWithString:@"5432"]  
forKey:@"loginPort"];


NSMutableArray *applicationUsers = [NSMutableArray  
arrayWithObject:userDict];

[defaultValues setObject:applicationUsers 
forKey:@"applicationUsers"];

// register it   
[[NSUserDefaults standardUserDefaults]  
registerDefaults:defaultValues]; <--- crash here

}


Any help someone so I can go to sleep :-)


Thanks,

Andre Masse
___

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

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

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

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: NSArrayController, bindings and NSUserDefaults

2008-11-09 Thread Andre Masse

Thanks for your reply Steven,

I've tried that but no luck. I get the following error:

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



In interface builder, you will need an Array controller


done.


Mode: ClassClass Name:NSMutableDictionary


done.

Content Array bound to Shared User Defaults Controller -  controller  
key:values -  modal key path:yourDefaultsKey


done.


Make sure handles content as a compound value is checked here.


checked.

I think you need to archive and unarchive when you read and write  
each key in your dictionary.


The array controller model key path is an array of objects, so it  
don't need any value transformer, right?. Now, somehow somewhere it  
will need to unarchive a particular object to get at a member's value.  
This is where it bites, how can I set the key path for, let's say the  
userName, when this value is encoded somewhere inside the fully  
encoded NSData object?


Maybe I got this all wrong and need to use another data structure for  
saving in the user defaults database.The "magic" behind the bindings  
concept is still pretty confusing to me even after having read a lot  
both in books and on the net...


Thanks,

Andre Masse
___

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

Please do not post admin requests or moderator comments to the list.
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: Cocoa and NSLog

2008-11-09 Thread Uli Kusterer

On 09.11.2008, at 23:03, Tommy Nordgren wrote:

Is it possible to open an Additional file for use by logging in Cocoa
(I want it to contain ONLY the info logged from my App)


 You can write your own logging function/macro that uses [NSString  
stringWithFormat: @"", ...] and then appends that to a file of your  
choice.


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: Inviting to comment on Cocoa categories

2008-11-09 Thread Kyle Sluder
On Sun, Nov 9, 2008 at 1:47 PM, Tommy Nordgren <[EMAIL PROTECTED]> wrote:
> +(NSAffineTransform *) transformRotatedAroundPoint:(NSPoint) p
> degrees:(CGFloat) deg;

Please be aware that rotation around a point other than the origin is
not a linear transformation.  This may be why such functionality was
omitted from NSAffineTransform.

--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: Help with this crashing method

2008-11-09 Thread Steven Riggs
You should try setObject:forKey: instead of registerDefaults:   
also... If you are using an array controller to handle the array in  
your user defaults, add your userDict object to the array controller  
instead of writing to defaults.


Steven Riggs
http://www.stevenriggs.com

On Nov 10, 2008, at 12:03 AM, Andre Masse wrote:


Hi,

I've been struggling with this method for the last couple of hours.  
I just can't see where the problem is. I get the following error  
which I suppose indicate that I've released something I shouldn't...  
Since I'm not releasing anything, I wonder what I'm doing wrong.  
Must be some stupid thing but I just can't see it...


The Debugger has exited due to signal 10 (SIGBUS).The Debugger has  
exited due to signal 10 (SIGBUS).


Stepping with the debugger shows that the crash happends on the last  
line. Obviously, commenting it out prevent the crash.



+ (void) initialize
{
	NSMutableDictionary *defaultValues = [NSMutableDictionary  
dictionary];


NSMutableDictionary *userDict = [NSMutableDictionary dictionary];

	[userDict setObject:[NSImage imageNamed:NSImageNameUser]  
forKey:@"userImage"];

[userDict setObject:NSFullUserName() forKey:@"userFullName"];
[userDict setObject:NSUserName() forKey:@"loginName"];
	[userDict setObject:[NSString stringWithString:@""]  
forKey:@"loginPassword"];
	[userDict setObject:[NSString stringWithString:@"localhost"]  
forKey:@"loginHost"];
	[userDict setObject:[NSString stringWithString:@"tdhsql"]  
forKey:@"loginDatabaseName"];
	[userDict setObject:[NSString stringWithString:@"5432"]  
forKey:@"loginPort"];



	NSMutableArray *applicationUsers = [NSMutableArray  
arrayWithObject:userDict];


	[defaultValues setObject:applicationUsers  
forKey:@"applicationUsers"];


// register it  
	[[NSUserDefaults standardUserDefaults]  
registerDefaults:defaultValues]; <--- crash here


}

Any help someone so I can go to sleep :-)


Thanks,

Andre Masse
___

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

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

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


NSArrayController, bindings and NSUserDefaults

2008-11-09 Thread Andre Masse

Hi,

I'm having difficulties binding (in IB) my application's preferences  
to NSUserDefaults. It's easy to bind simple values, but not so when  
using composite objects in an array where each element is an object  
archived as NSData with NSKeyedArchiver. Further more, when the object  
has another object for one of its member... At first, I was reading  
the user defaults myself and populating an array by decoding each  
object. The NSArrayController was using this array for its content and  
all worked great. Now, I want to get rid of this intermediate array  
and bind directly to the user default dictionary. So I removed all  
binding to the old array and this is where I'm stuck...


In the binding tab in IB, I bind the NSArrayController's controller  
content to "Shared User Default Controller", used "values" for  
controller key, "users" (which is the key in the user defaults  
dictionary) for model key path and NSKeyedUnarchiveFromData for value  
transformer. This is obviously not the way to go cause I'm getting the  
following error:


*** -[NSCFArray bytes]: unrecognized selector sent to instance  
0x15e03900



Here's the code called from the application controller to set up the  
defaults:


+ (void) initialize
{
NSMutableDictionary *defaultValues = [NSMutableDictionary dictionary];
GHLoginInfos *loginInfo = [[[GHLoginInfos alloc] init] autorelease];
NSImage *img = [NSImage imageNamed:NSImageNameUser];
NSString *name = NSFullUserName();
	GHUser *user = [[GHUser alloc] initWithUserName:name userImage:img  
loginInfos:loginInfo];


NSData *userAsData = [NSKeyedArchiver archivedDataWithRootObject:user];
NSMutableArray *users = [NSMutableArray arrayWithObject:userAsData];
[defaultValues setObject:users forKey:@"users"];
	[[NSUserDefaults standardUserDefaults]  
registerDefaults:defaultValues];	

}

GHUser members are:

NSString *userName;
NSImage *userImage;
GHLoginInfos *loginInfos;

and GHLoginInfos members:
NSString* loginName;
NSString* password;
NSString* host;
NSString* dbName;
NSString* port;

The view contains an NSTableView and NSTextFields displaying the  
currently selected row content but at this point I'm only trying  
(without any success) to fill up the table view.


Any help, pointer to tutorial etc appreciated.

Thanks,

Andre Masse
___

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

Please do not post admin requests or moderator comments to the list.
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]


Help with this crashing method

2008-11-09 Thread Andre Masse

Hi,

I've been struggling with this method for the last couple of hours. I  
just can't see where the problem is. I get the following error which I  
suppose indicate that I've released something I shouldn't... Since I'm  
not releasing anything, I wonder what I'm doing wrong. Must be some  
stupid thing but I just can't see it...


The Debugger has exited due to signal 10 (SIGBUS).The Debugger has  
exited due to signal 10 (SIGBUS).


Stepping with the debugger shows that the crash happends on the last  
line. Obviously, commenting it out prevent the crash.



+ (void) initialize
{
NSMutableDictionary *defaultValues = [NSMutableDictionary dictionary];

NSMutableDictionary *userDict = [NSMutableDictionary dictionary];

	[userDict setObject:[NSImage imageNamed:NSImageNameUser]  
forKey:@"userImage"];

[userDict setObject:NSFullUserName() forKey:@"userFullName"];
[userDict setObject:NSUserName() forKey:@"loginName"];
	[userDict setObject:[NSString stringWithString:@""]  
forKey:@"loginPassword"];
	[userDict setObject:[NSString stringWithString:@"localhost"]  
forKey:@"loginHost"];
	[userDict setObject:[NSString stringWithString:@"tdhsql"]  
forKey:@"loginDatabaseName"];
	[userDict setObject:[NSString stringWithString:@"5432"]  
forKey:@"loginPort"];



	NSMutableArray *applicationUsers = [NSMutableArray  
arrayWithObject:userDict];


[defaultValues setObject:applicationUsers forKey:@"applicationUsers"];

// register it  
	[[NSUserDefaults standardUserDefaults]  
registerDefaults:defaultValues]; <--- crash here


}

Any help someone so I can go to sleep :-)


Thanks,

Andre Masse
___

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

Please do not post admin requests or moderator comments to the list.
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: NSArrayController, bindings and NSUserDefaults

2008-11-09 Thread Volker in Lists

Hi,

you need an formatter - NSUnarchiveFromData and then it works rather  
well. I store supplementary information that each user can edit in  
NSUserDefaults. The info is maintained in NSTableViews and stored as  
an Array of NSMutableDictionary. Works really well.


Volker

Am 09.11.2008 um 20:41 schrieb Andre Masse:

I think you need to archive and unarchive when you read and write  
each key in your dictionary.


The array controller model key path is an array of objects, so it  
don't need any value transformer, right?. Now, somehow somewhere it  
will need to unarchive a particular object to get at a member's  
value. This is where it bites, how can I set the key path for, let's  
say the userName, when this value is encoded somewhere inside the  
fully encoded NSData object?


___

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

Please do not post admin requests or moderator comments to the list.
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: Help with this crashing method

2008-11-09 Thread Bill Bumgarner

On Nov 9, 2008, at 9:03 PM, Andre Masse wrote:

+ (void) initialize
{
	NSMutableDictionary *defaultValues = [NSMutableDictionary  
dictionary];


NSMutableDictionary *userDict = [NSMutableDictionary dictionary];

	[userDict setObject:[NSImage imageNamed:NSImageNameUser]  
forKey:@"userImage"];

[userDict setObject:NSFullUserName() forKey:@"userFullName"];
[userDict setObject:NSUserName() forKey:@"loginName"];
	[userDict setObject:[NSString stringWithString:@""]  
forKey:@"loginPassword"];
	[userDict setObject:[NSString stringWithString:@"localhost"]  
forKey:@"loginHost"];
	[userDict setObject:[NSString stringWithString:@"tdhsql"]  
forKey:@"loginDatabaseName"];
	[userDict setObject:[NSString stringWithString:@"5432"]  
forKey:@"loginPort"];



	NSMutableArray *applicationUsers = [NSMutableArray  
arrayWithObject:userDict];


	[defaultValues setObject:applicationUsers  
forKey:@"applicationUsers"];


// register it  
	[[NSUserDefaults standardUserDefaults]  
registerDefaults:defaultValues]; <--- crash here


}

Any help someone so I can go to sleep :-)


You can't directly or indirectly set an NSImage as a value for a  
default.   Try removing the @"userImage" key and see if it still  
crashes.


b.bum

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]

Cocoa and NSLog

2008-11-09 Thread Tommy Nordgren

Is it possible to open an Additional file for use by logging in Cocoa
(I want it to contain ONLY the info logged from my App)
--
"Home is not where you are born, but where your heart finds peace" -
Tommy Nordgren, "The dying old crone"
[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]


Inviting to comment on Cocoa categories

2008-11-09 Thread Tommy Nordgren


TN+NSAffineTransform.h
Description: Binary data


TN+NSBezierPath.h
Description: Binary data


TN+NSAffineTransform.m
Description: Binary data


TN+NSBezierPath.m
Description: Binary data



I would like comments on the following Categories on NSBezierPath and  
NSAffineTransform.
In particular I would like comments on other suitable methods to be  
added, and alternate protocols

to set up input data.
I'm not including the code in the body of the message,but as  
Attachments.

//
//  TN+NSAffineTransform.h
//  GraphicsUtilities
//
//  Created by Tommy Nordgren ([EMAIL PROTECTED]  http://www.tommynordgren.com 
) on 2008-11-09.

//  Copyright 2008 Tommy Nordgren. All rights reserved.
//

#import 


@interface NSAffineTransform (TNGraphics)

+(NSAffineTransform *) transformRotatedAroundPoint:(NSPoint) p degrees: 
(CGFloat) deg;


+(NSAffineTransform *) transformRotatedAroundPoint:(NSPoint) p radians: 
(CGFloat) rad;


+(NSAffineTransform *) transformByTranslatingOriginToPoint:(NSPoint) p;

@end

//
//  TN+NSBezierPath.h
//  GraphicsUtilities
//
//  Created by Tommy Nordgren ([EMAIL PROTECTED]  http://www.tommynordgren.com 
) on 2008-11-09.

//  Copyright 2008 Tommy Nordgren. All rights reserved.
//

#import 


@interface NSBezierPath (TNGraphics)

+(NSBezierPath *) bezierPathWithOvalInRectOfWidth:(CGFloat) w height: 
(CGFloat) h centeredAt:(NSPoint) p rotatedByDegrees:(CGFloat) d;
+(NSBezierPath *) bezierPathWithOvalInRectOfWidth:(CGFloat) w height: 
(CGFloat) h centeredAt:(NSPoint) p rotatedByRadians:(CGFloat) r;
+(NSBezierPath *) bezierPathWithRectOfWidth:(CGFloat) w height: 
(CGFloat) h centeredAt:(NSPoint) p rotatedByDegrees:(CGFloat) d;
+(NSBezierPath *) bezierPathWithRectOfWidth:(CGFloat) w height: 
(CGFloat) h centeredAt:(NSPoint) p rotatedByRadians:(CGFloat) r;


@end

---
See the amazing new SF reel: Invasion of the man eating cucumbers from  
outer space.
On congratulations for a fantastic parody, the producer replies :  
"What parody?"


Tommy Nordgren
[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]

Subject: Re: Core Data entity fetching by date

2008-11-09 Thread Steve Steinitz

Hi,

Quincy gave such a masterful and complete answer that I felt 
compelled to also make a small contribution.  If you decide to 
go the in-memory route, this simple routine may save you a few 
minutes of head scratching:


- (BOOL)
selectedRangeContainsDate: (NSDate *) date
{
NSComparisonResult fromDateResult = [date compare: [self fromDate]];
NSComparisonResult toDateResult   = [date compare: [self toDate]];
BOOL isAfterFromDate  = (fromDateResult == NSOrderedSame) ||
(fromDateResult == NSOrderedDescending);
BOOL isBeforeToDate   = (toDateResult   == NSOrderedSame) ||
(toDateResult   == 
NSOrderedAscending );

return isAfterFromDate && isBeforeToDate;
}

I used it in an NSArrayController subclass with a couple of date 
pickers but you could adapt it for programmatically-generated 
date ranges.


Cheers,

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: NSArrayController, bindings and NSUserDefaults

2008-11-09 Thread Steven Riggs

Check out a code sample (using no code, just IB)...

http://idisk.mac.com/steven.riggs-Public?view=web

-Steve



On Nov 9, 2008, at 2:41 PM, Andre Masse wrote:


Thanks for your reply Steven,

I've tried that but no luck. I get the following error:

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



In interface builder, you will need an Array controller


done.


Mode: ClassClass Name:NSMutableDictionary


done.

Content Array bound to Shared User Defaults Controller -   
controller key:values -  modal key path:yourDefaultsKey


done.


Make sure handles content as a compound value is checked here.


checked.

I think you need to archive and unarchive when you read and write  
each key in your dictionary.


The array controller model key path is an array of objects, so it  
don't need any value transformer, right?. Now, somehow somewhere it  
will need to unarchive a particular object to get at a member's  
value. This is where it bites, how can I set the key path for, let's  
say the userName, when this value is encoded somewhere inside the  
fully encoded NSData object?


Maybe I got this all wrong and need to use another data structure  
for saving in the user defaults database.The "magic" behind the  
bindings concept is still pretty confusing to me even after having  
read a lot both in books and on the net...


Thanks,

Andre Masse
___

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

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

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


Using CIFilter and IKFilterUIView

2008-11-09 Thread Graham Cox
I'm using CIFilter to perform some special effects in my app, and I'm  
using IKFilterUIView to provide the interactive parameters to this.  
Leaving aside the problem of this UI being all over the place, layout- 
wise, I'm also having difficulty understanding what I need to do to  
actually make a functional system here.


IKFilterUIView uses an NSObjectController internally to connect the  
CIFilter to the UI controls. That seems fine, but then what? How can I  
get notified when the filter has changed and so update the objects  
that use the filter "live"? It looks as if I'll already have to modify  
my data model to handle this, since previously I created the CIFilter  
on the fly as needed and just stored its name and attributes  
dictionary in my object - looks like I need to cache the actual  
filter. But it's still not clear how I can pick up any change to the  
filter when the UI changes it via the controller. KVO possibly, but on  
what property? CIFilter has very few, and none that appear to be KVO  
compatible.


Stumped,


Graham


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: MVC Question . . .

2008-11-09 Thread Ken Thomases

On Nov 8, 2008, at 7:46 PM, Michael A. Crawford wrote:

I have a model-view-control class hierarchy that I'd like to add an  
auxiliary (test-only) view to.  I've created a 2nd NIB with an  
NSPanel instance associated with a sub-classed NSWindowController.   
I'm able to load the NIB and instantiate the panel but how to I  
associate the model class with the new view?  They are in separate  
NIBs.


Does that last sentence imply that your model is "in" a nib?  Except  
in very simple circumstances, your model should not be instantiated in  
a nib.


Usually, the model is instantiated by a controller.  If the model is  
application-wide, then it's usually your application controller which  
instantiates it.  If it's of a more narrow scope, then there's usually  
a controller that corresponds to that narrow scope, and it would  
instantiate the model.  For example, an NSDocument object would create  
the model holding and managing the state information for that document.



Logically, it seems like the easiest thing to do would be to create  
a second view in the same NIB as the first and have a model-view1- 
view2-controller setup.  I tried this by copying the NSPanel class  
into the MainMenu.xib file, from it's original NIB file, and then  
trying to reference it directly via IB connections.  In the process  
I left its associated controller behind in its private NIB, thinking  
I wouldn't need it.


Bottom line, I can't make any connections to the new outlet I  
defined in my main controller class.  This is still new to me and  
I'm confused.  Can someone please tell me how best to create a  
second (different) view to the same model that is modeless and can  
share a common controller?


My guess is that you're stuck thinking that you can (or should) only  
have the one controller.


There are a variety of different types of controllers.  There are  
model-controllers (e.g. NSDocument), which are primarily responsible  
for managing a model.  There are view-controllers which are primary  
responsible for managing views (including windows).  And there are  
controllers which aren't necessarily closer to the model or the view,  
but manage higher level logic about the way the two interact.  Also,  
there are mediating controllers like NSObjectController and  
NSArrayController which are primary used with bindings to convey data  
between models and views.


The main nib often contains an application controller, because that's  
convenient.  Other types of nibs may contain mediating controllers but  
don't often contain coordinating controllers.  Instead, the File's  
Owner of the nib is a window- or view-controller.  This object is not  
"in" the nib; it's not instantiated within the nib.  Instead, it's  
generally instantiated in code and is specified as the owner of the  
nib at the point when the nib is loaded.  Usually, NSWindowController  
or NSViewController (or subclasses) actually do the loading of the nib  
and make themselves the owner at that point.


An NSViewController has a representedObject property, which is a  
convenient reference it will have to (part of) the model.  Again, this  
is set by the code which instantiated the view controller.  If you  
subclass NSWindowController, your subclass can have a similar sort of  
reference to the model.


Similarly, a view/window controller may have a reference to another  
controller, usually the controller which chose to instantiate it.   
That controller is usually a "superior" which has a broader scope of  
responsibility.  The view/window controller may access parts of the  
model through that superior controller.  It might also forward action  
methods to it.  Etc.  The "document" property of NSWindowController is  
an example of this kind of relationship.


So, to get back to your question, I think your nib with the panel  
would have a subclass of NSWindowController as its File's Owner.  The  
code which currently directly loads the nib should instead allocate  
and initialize an instance of your subclass, and have it do that.  If  
you need that controller to have a reference back to the rest of your  
application (either directly to the model or to another controller),  
you would define a property on your subclass to hold that reference.   
You could pass in the reference as a parameter to a custom initializer  
on your subclass or set it immediately after the new object is  
instantiated.  Within the nib, if you want to bind a view to some  
property in your model, you would bind to File's Owner using a key  
path which goes through this new property to get to your ultimate  
destination (some property of your model or a superior controller, for  
example).


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 Subs

Re: NSArrayController, bindings and NSUserDefaults

2008-11-09 Thread Steven Riggs

This worked for me...

In interface builder, you will need an Array controller
Mode: ClassClass Name:NSMutableDictionary
Content Array bound to Shared User Defaults Controller -  controller  
key:values -  modal key path:yourDefaultsKey

Make sure handles content as a compound value is checked here.

I think you need to archive and unarchive when you read and write each  
key in your dictionary.


Good luck,
   Steven Riggs

On Nov 9, 2008, at 1:09 PM, Andre Masse wrote:


Hi,

I'm having difficulties binding (in IB) my application's preferences  
to NSUserDefaults. It's easy to bind simple values, but not so when  
using composite objects in an array where each element is an object  
archived as NSData with NSKeyedArchiver. Further more, when the  
object has another object for one of its member... At first, I was  
reading the user defaults myself and populating an array by decoding  
each object. The NSArrayController was using this array for its  
content and all worked great. Now, I want to get rid of this  
intermediate array and bind directly to the user default dictionary.  
So I removed all binding to the old array and this is where I'm  
stuck...


In the binding tab in IB, I bind the NSArrayController's controller  
content to "Shared User Default Controller", used "values" for  
controller key, "users" (which is the key in the user defaults  
dictionary) for model key path and NSKeyedUnarchiveFromData for  
value transformer. This is obviously not the way to go cause I'm  
getting the following error:


*** -[NSCFArray bytes]: unrecognized selector sent to instance  
0x15e03900



Here's the code called from the application controller to set up the  
defaults:


+ (void) initialize
{
	NSMutableDictionary *defaultValues = [NSMutableDictionary  
dictionary];

GHLoginInfos *loginInfo = [[[GHLoginInfos alloc] init] autorelease];
NSImage *img = [NSImage imageNamed:NSImageNameUser];
NSString *name = NSFullUserName();
	GHUser *user = [[GHUser alloc] initWithUserName:name userImage:img  
loginInfos:loginInfo];


	NSData *userAsData = [NSKeyedArchiver  
archivedDataWithRootObject:user];

NSMutableArray *users = [NSMutableArray arrayWithObject:userAsData];
[defaultValues setObject:users forKey:@"users"];
	[[NSUserDefaults standardUserDefaults]  
registerDefaults:defaultValues];	

}

GHUser members are:

NSString *userName;
NSImage *userImage;
GHLoginInfos *loginInfos;

and GHLoginInfos members:
NSString* loginName;
NSString* password;
NSString* host;
NSString* dbName;
NSString* port;

The view contains an NSTableView and NSTextFields displaying the  
currently selected row content but at this point I'm only trying  
(without any success) to fill up the table view.


Any help, pointer to tutorial etc appreciated.

Thanks,

Andre Masse
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/steven.riggs%40me.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: Signature Recognition in Cocoa

2008-11-09 Thread Michael Paluszek

There is a lot of information available

http://www.ee.bilkent.edu.tr/~signal/defevent/papers/cr2010.pdf
http://code.google.com/p/sigrecnn/
http://www.it.lut.fi/kurssit/03-04/01097/seminars/Kalenova.pdf

Sincerely,

Mike


On Nov 9, 2008, at 7:14 PM, Pierce Freeman wrote:

As I am not very familiar to signature recognition (as you may have  
noticed)
where can I learn how to get the algorithm in code form?  Also, are  
there

other methods that could get a more precise output?

Thanks,

Pierce F.


On 11/3/08 1:47 AM, "Raphael Sebbe" <[EMAIL PROTECTED]> wrote:

If you have access to the temporal sequence of events (not just  
final image),
DTW (Dynamic Time Warping) could be an easy approach. You would  
have to choose
features (pressure, location, speed, acc) with respect to time,  
then record a
few "templates" for the reference signature. The output of the DTW  
algorithm
is a distance to each template, which you can threshold to tell OK,  
NOT TOO

FAR, DIFFERENT.

To get input to that algorithm in Cocoa, well, an NSView subclass +  
handling

events, I guess.

Raphael

On Mon, Nov 3, 2008 at 3:14 AM, Pierce Freeman <[EMAIL PROTECTED] 
>

wrote:
   I have been looking at various open source projects/sites but  
still
can't find a way to check two signatures to see if they are the  
same in
Cocoa.  For example: On setup, "User A" writes his name on his  
tablet, then
"User B" tries to sign in using an imitation signature, but it  
will return
an warning message instead of doing the task.  I have read a few  
articles,
but can't make any sense out of how to use the information in  
Cocoa.  If
anyone could tell/point me to any information of the best way to  
do this in

Cocoa, it would be great.


Pierce F.


___

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

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


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

This email sent to [EMAIL PROTECTED]





___

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

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

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

This email sent to [EMAIL PROTECTED]


--
Michael Paluszek
Princeton Satellite Systems
33 Witherspoon Street
Princeton, NJ 08542-3207
Phone (609) 279-9606
Fax (609) 279-9607
[EMAIL PROTECTED]
www.psatellite.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: Opening persistent data store

2008-11-09 Thread Charles Srstka

On Nov 8, 2008, at 11:06 PM, Jerry Krinock wrote:

Try -[NSDocument readFromData:ofType:error:].  True, because you  
must read an sqlite database, you're not going to use the data that  
you are passed as an argument.  But that's OK.  It will be  
autoreleased and go away.


What if the file is a couple of GB large? That would make the VM page  
like crazy. It wouldn't be fun.


Just override readFromURL:ofType:error: instead.

Charles
___

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

Please do not post admin requests or moderator comments to the list.
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]