Re: problem with [NSImage drawAtPoint:fromRect:operation:fraction:]

2008-10-23 Thread Ken Ferry
On Wed, Oct 22, 2008 at 7:54 PM, Kenny Leung <[EMAIL PROTECTED]> wrote:

> Hi All.
>
> I just want to check with the populous to make sure I have not gone stupid
> or insane. The documentation for [NSImage
> drawAtPoint:fromRect:operation:fraction:] states:
>
> "The image content is drawn at its current resolution and is not scaled
> unless the CTM of the current coordinate system itself contains a scaling
> factor. The image is otherwise positioned and oriented using the current
> coordinate system."
>
> From what I've seen, if you specify a fromRect: that is not the full extent
> of the image, the region specified by fromRect gets **scaled to the size of
> the entire image** and then drawn.
>
> Has anyone out there had experience with this?


Yep, you're right.  Please don't rely on the bug, instead use
-drawInRect:fromRect:operation:fraction: if you have a partial source rect.

Sorry!  It isn't a new problem, but we are trying to correct it.  Be sure to
read the 10.6 AppKit release notes when they come out.

-Ken
Cocoa Frameworks


>
>
> Thanks!
>
> -Kenny
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/kenferry%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: CGPoint wrapper?

2008-10-23 Thread Ken Ferry
On Wed, Oct 22, 2008 at 9:09 PM, Graff <[EMAIL PROTECTED]> wrote:

> On Oct 22, 2008, at 5:49 PM, DKJ wrote:
>
>  Is there some straightforward way of wrapping a CGPoint so I can put
>> it in an NSArray? I don't want to use a C array because I want to have
>> fast enumeration available. Or should I just write a simple NSPoint -
>> CGPoint conversion method?
>>
>
> NSPoint and CGPoint are structs that are essentially the same.  You can
> convert between them with a simple cast:
>
> NSPoint point = *(NSPoint *)&myCGPoint;
>
> <
> http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaDrawingGuide/QuartzOpenGL/chapter_10_section_2.html
> >
>
>
> You can also use the function NSPointFromCGPoint() which does the exact
> same thing for you:
>
> NSPoint point = NSPointFromCGPoint(myCGPoint);
>
> (Declared in NSGeometry.h)


The function is actually implemented a bit better than the cast above, in
that the function does not violate strict aliasing[1].

-Ken

[1]:
http://www.cellperformance.com/mike_acton/2006/06/understanding_strict_aliasing.html
___

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

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

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

This email sent to [EMAIL PROTECTED]


Using NSDocument with NSViewControllers

2008-10-23 Thread Paul Thomas
Before I set off down the road to frustrating deadendsville, has  
anyone any experience with trying to coerce AppKit's document  
architecture into a single window interface - i.e. using tabviews in  
stead of separate windows?


A sneaky look at a couple of apps shows that people have usually  
resorted to completely custom classes, but I'd like to use NSDocument  
if possible - just with views instead of windows.


Is it possible?

ta,
pt. 
___


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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Single Bit editable Image Mask (and other strangeness)

2008-10-23 Thread Ken Ferry
On Wed, Oct 22, 2008 at 10:25 AM, Development
<[EMAIL PROTECTED]>wrote:

> Good day!
>
> I am working on pixel based drawing tool, and could use some hint on how to
> handle selection areas.
>
> In the program, each document has a couple different Bitmap context (24 bit
> RGP space CGBitmapContext ) at the same time. I draw into a scroll view
> using a Layer (CGLayer). Whenever one of the bitmap context changes, I copy
> the changes into the layer, but scrolling within the view is done only with
> the layer except for drawing the selection area.
>
> As always, I want to make sure there isn't a better way of doing what I am
> doing now.
>
> To handle the selection, I have been using a CGBitmapContext  (created with
> method CGBitmapContextCreate with a bitsPerComponent of 8, a color space of
> GreySpace, and CGBitmap info of kCGImageAlphaNone). This gives me an
> editable context, so that I can create the selection graphic using Quartz
> draw rectangles and ovals. When I need to draw using the selection, I
> convert the selection into an image (CGBitmapContextCreateImage), clip the
> context to that image (CGContextClipToMask) and then do whatever drawing I
> want to do (ex. invert, special fill, you name it).
>
> First of all, it is possible to create a single bit bitmap context (only
> black and white)?  I could only get 8 bit greyscale working correctly.


Nope.  The supported formats for contexts are listed at <
http://developer.apple.com/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_context/chapter_3_section_4.html#//apple_ref/doc/uid/TP30001066-CH203-BCIBHHBB
>.


> Should I be using ImageMask for these operations? I did not create a bitmap
> mask (using CGImageMaskCreate) because I needed to be able to constantly
> modify the mask using rectangle and oval commands (and I could not get that
> call to work).


Your current approach to drawing and using the selection sounds okay to me.
 I may not be following precisely.  An alternative might be to keep a
vector-based internal representation of the selection, with paths.  This
might be beneficial if the user can, say, scale the document without losing
the selection.


> Lastly, when when drawing between bitmap context (basically copying one
> section to another), is the best way to create an Image from the bitmap info
> (CGBitmapContextCreateImage) and then draw using the image.  Apple
> documentation suggest that this is quick enough. If I create an image, and
> then modify the context, the image I created would have a copy of the data,
> not any changes.


Yes, that's a good way to copy image data from a bitmap context to another
destination.

I didn't really follow the description of where and how CGLayers and
CGBitmapContexts are used.  If you're satisfied that that part is good,
though, the rest sounds fine to me. :-)  Of course, if you see performance
issues, the profiling tools may help point to the problems.

-Ken
Cocoa Frameworks
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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] Autocomplete from an array of dictionaries

2008-10-23 Thread Jason Wiggins

Note to self: RTFM!

I was trying:

NSArray *matchingNames = [[namesArray objectForKey:@"description"]  
filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"SELF  
beginswith[cd] %@", substring]];


which doesn't work

What I wanted was:

NSArray *matchingNames = [[namesArray valueForKey:@"description"]  
filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"SELF  
beginswith[cd] %@", substring]];


Jason


On 23/10/2008, at 19:06 , Jason Wiggins wrote:


Hi,

I'm working on an autocompletion system such as with mail To: Cc:  
fields etc.
I have an array of dictionaries and I want the autocomplete to match  
to the key "description"

This code below works great for an array of strings:

NSArray *matchingNames = [namesArray filteredArrayUsingPredicate: 
[NSPredicate predicateWithFormat:@"SELF beginswith[cd] %@",  
substring]];


But how do I get the above code to match to a specific key from a  
dictionary?


Regards,
Jason Wiggins


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Memory Leaks in CocoaEcho Sample

2008-10-23 Thread Marco Masser
Then the bug is somewhere in your changes.  The only thing you  
should do is remove the retain calls.  If you also remove the  
release calls, you will still have the memory leaks.


Here's what openStreams should look like:

- (void)openStreams {
  [inputStream setDelegate:self];
  [outputStream setDelegate:self];
  [inputStream scheduleInRunLoop:
  [NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
  [outputStream scheduleInRunLoop:
  [NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
  [inputStream open];
  [outputStream open];
}

Here's what closeStreams should look like:

- (void)closeStreams {
  [inputStream close];
  [outputStream close];
  [inputStream removeFromRunLoop:
  [NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
  [outputStream removeFromRunLoop:
  [NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
  [inputStream setDelegate:nil];
  [outputStream setDelegate:nil];
  [inputStream release];
  [outputStream release];
  inputStream = nil;
  outputStream = nil;
}


I have done exactly what you wrote above in a freshly dezipped  
CocoaEcho Project. Running it first with the retain and then  
without. It didn't work. This morning, I tried it again and it  
worked?!? I think I forgot to clean the build or something like  
that... Thanks for your help



Still, my question remains: Is there a rule of thumb for the memory  
management of object returned by reference? NSError and NSGradient  
autorelease their objects, NSNetService does not. Because the docs  
don't say anything about this (with the exception of the Error  
Handling Programming Guide), how should one know if an object should  
be retained or not?


Marco
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: commitEditing

2008-10-23 Thread Mike Abdullah

Try using the asynchronous version:

commitEditingWithDelegate:didCommitSelector:contextInfo:

It should display an alert with the error.

On 22 Oct 2008, at 23:15, Chris Idou wrote:



I'm calling commitEditing on a NSObjectController, and its returning  
NO, for no apparent or obvious reason.


How am I supposed to debug these things?





___

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

Please do not post admin requests or moderator comments to the list.
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: Memory Leaks in CocoaEcho Sample

2008-10-23 Thread Ken Ferry
Hi Marco,

> Still, my question remains: Is there a rule of thumb for the memory
> management of object returned by reference? NSError and NSGradient
> autorelease their objects, NSNetService does not. Because the docs don't say
> anything about this (with the exception of the Error Handling Programming
> Guide), how should one know if an object should be retained or not?


The rule for objects returned by reference is the same as the rule for
objects returned any other way: -copy, -alloc, -retain and -new methods
transfer ownership.  Nothing else does unless specially documented.  If you
think there's a leak with an object returned by reference, please file a
bug.

I see that there was a leak in -getInputStream:outputStream:, but it was
fixed for apps linked on or after the 10.4 SDK.  This was probably in the
Foundation release notes, but the older Foundation release notes don't seem
to be up anymore.. .

-Ken
Cocoa Frameworks

On Thu, Oct 23, 2008 at 1:52 AM, Marco Masser <[EMAIL PROTECTED]>wrote:

> Then the bug is somewhere in your changes.  The only thing you should do is
>>> remove the retain calls.  If you also remove the release calls, you will
>>> still have the memory leaks.
>>>
>>> Here's what openStreams should look like:
>>>
>>> - (void)openStreams {
>>>  [inputStream setDelegate:self];
>>>  [outputStream setDelegate:self];
>>>  [inputStream scheduleInRunLoop:
>>>  [NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
>>>  [outputStream scheduleInRunLoop:
>>>  [NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
>>>  [inputStream open];
>>>  [outputStream open];
>>> }
>>>
>>> Here's what closeStreams should look like:
>>>
>>> - (void)closeStreams {
>>>  [inputStream close];
>>>  [outputStream close];
>>>  [inputStream removeFromRunLoop:
>>>  [NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
>>>  [outputStream removeFromRunLoop:
>>>  [NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
>>>  [inputStream setDelegate:nil];
>>>  [outputStream setDelegate:nil];
>>>  [inputStream release];
>>>  [outputStream release];
>>>  inputStream = nil;
>>>  outputStream = nil;
>>> }
>>>
>>
>> I have done exactly what you wrote above in a freshly dezipped CocoaEcho
>> Project. Running it first with the retain and then without. It didn't work.
>> This morning, I tried it again and it worked?!? I think I forgot to clean
>> the build or something like that... Thanks for your help
>>
>
>
> Still, my question remains: Is there a rule of thumb for the memory
> management of object returned by reference? NSError and NSGradient
> autorelease their objects, NSNetService does not. Because the docs don't say
> anything about this (with the exception of the Error Handling Programming
> Guide), how should one know if an object should be retained or not?
>
> Marco
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/kenferry%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]


CocoaHeads chapter Bonn (Germany) Kickoff TODAY

2008-10-23 Thread Stefan Wolfrum

Hi,

just a short notice for the Germans living here in the Bonn/Cologne  
area: the CocoaHeads Bonn chapter is meeting for the first time today  
(23.10.). For details see www.cocoaheads.org or mail me.


Cheers,
Stefan.

-
Von meinem iPhone 3G gesendet. :-)
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: CGPoint wrapper?

2008-10-23 Thread Jonathan Dann
If you're targeting Leopard then you can use the NS_BUILD_32_LIKE_64  
flag and use NSRect/Point/Size and CGRect/Point/Size interchangeably  
without the cast or the inline conversion functions. Here's a how-to http://theocacao.com/document.page/552


Jonathan

http://espresso-served-here.com

On 23 Oct 2008, at 09:06, Ken Ferry wrote:


On Wed, Oct 22, 2008 at 9:09 PM, Graff <[EMAIL PROTECTED]> wrote:


On Oct 22, 2008, at 5:49 PM, DKJ wrote:

Is there some straightforward way of wrapping a CGPoint so I can put
it in an NSArray? I don't want to use a C array because I want to  
have
fast enumeration available. Or should I just write a simple  
NSPoint -

CGPoint conversion method?



NSPoint and CGPoint are structs that are essentially the same.  You  
can

convert between them with a simple cast:

NSPoint point = *(NSPoint *)&myCGPoint;

<
http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaDrawingGuide/QuartzOpenGL/chapter_10_section_2.html





You can also use the function NSPointFromCGPoint() which does the  
exact

same thing for you:

NSPoint point = NSPointFromCGPoint(myCGPoint);

(Declared in NSGeometry.h)



The function is actually implemented a bit better than the cast  
above, in

that the function does not violate strict aliasing[1].

-Ken

[1]:
http://www.cellperformance.com/mike_acton/2006/06/understanding_strict_aliasing.html
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/j.p.dann%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: Using Core Animation to animate view properties?

2008-10-23 Thread Jonathan Dann

Hi Jim,

I've been having major problems with working with non-layer-baked  
views to coordinate the animation of their positions.  Some of the  
caveats I've come across (note that I haven't used -setWantsLayer: on  
any of the views as it's unnecessary for animating the frame of an  
NSView with the -animator proxy):


1) Using -setWantsLayer: on a custom view can cause problems if you  
set it to YES in -initWithFrame: and then later create the view in IB,  
which by default sets it to NO after -initWithFrame: and just before  
you get an -awakeFromNib.


2) If you call [[self animator] setFrame:newFrame]; and then ask the  
view for it's frame, you DON'T get the toValue as one would be used to  
after using CALayers. This makes co-ordination of views very  
difficult. The value you get is the fromValue.


3) From what I've found, calling [[self animationForKey:@"frameOrigin/ 
Size"] setDelegate:self]; will cause you to receive - 
animationDidStop:finished: calls from a *bunch* of CABasicAnimation  
objects, none of which are the same object you got from - 
animationForKey:.


3)a) As soon as you set viewA as the delegate of an animation, and  
then do the same for viewB, viewA will no longer get the delegate calls.


5) I haven't found a way to detect an in-flight animation, if you  
solve it, please let me know as it would make life a lot easier for me.


If you (or anyone else) disagrees with me on these points, I'd love to  
hear from you. I've been battling with this for a while now.


Jonathan

http://espresso-served-here.com

On 22 Oct 2008, at 20:13, Jim Correia wrote:


On Oct 22, 2008, at 12:54 PM, Matt Long wrote:

1. If you want to know whether an animation is still running, just  
check to see if it is still in the animations dictionary in the  
layer. A call like this would do it:


[...]

How you apply this to view properties, I'm not sure, but this is  
how you do these things with layers. Hope that helps.


I'm trying to animation a non-layer *view* property. My view isn't  
actually layer backed.


I'm still curious how to detect an in-flight animation.

The documentation suggests I can abort the in-flight animation by  
setting the target value inside of a zero duration animation  
context. This isn't working in my sample app. After I review the  
code, I'll post a link to it here.


Jim

___

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

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

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


NSMutableDictionary won't accept my NSString as Value (NEWBIE)

2008-10-23 Thread Sebastian Pape
Hi,

This might be pretty easy for most of you. I've been trying to find
out how to solve that for the last one and a half hours and it just
doesn't work.

Basically this part of the application scans data from a buffer,
taking the first element found as "a Value" and the second element
found as "a Key" for a NSMutableDictionary.
But my NSMutableDictionary won't accept my NSString, because it
requires setValue:(id)value and I just have my NSString.

XCode gives me a warning about that and GDB sends me a "***
-[NSCFDictionary setValue:ForKey:]: unrecognized selector sent to
instance 0x1dd090".

I hope you can tell me what the problem is.

Thankyou
Sebastian.


int i;
NSCharacterSet *dividerCharSet = [NSCharacterSet
characterSetWithCharactersInString:@":\r\n"];
NSCharacterSet *allCharSet = [NSCharacterSet
characterSetWithCharactersInString:@":\r\n "];
NSScanner*scanner = [NSScanner scannerWithString:buffer];
NSString *curValue;
NSMutableDictionary *messageDictionary;

messageDictionary = [[NSMutableDictionary alloc] initWithCapacity:30];
i=0;

while ( ![scanner isAtEnd] ) {
NSString *currentData;
[scanner scanUpToCharactersFromSet:dividerCharSet 
intoString:¤tData];

switch (i) {
case 0:
curValue = [[NSString alloc] 
initWithString:currentData];
[curValue retain];
i=1;
case 1:
[messageDictionary setValue:curValue 
ForKey:currentData];  //Here's
my problem!
[curValue release];
i=0;
}
break;

[scanner scanCharactersFromSet:allCharSet intoString:nil];

}
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSMutableDictionary won't accept my NSString as Value (NEWBIE)

2008-10-23 Thread Jonathan del Strother
On Thu, Oct 23, 2008 at 12:34 PM, Sebastian Pape
<[EMAIL PROTECTED]> wrote:
> But my NSMutableDictionary won't accept my NSString, because it
> requires setValue:(id)value and I just have my NSString.

'id' is just a generic type - anything that accepts id will accept
NSString, NSObject, NSData, etc.

> XCode gives me a warning about that and GDB sends me a "***
> -[NSCFDictionary setValue:ForKey:]: unrecognized selector sent to
> instance 0x1dd090".

Try a lowercase 'f'  in ForKey.
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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]


Autocomplete from an array of dictionaries

2008-10-23 Thread Jason Wiggins

Hi,

I'm working on an autocompletion system such as with mail To: Cc:  
fields etc.
I have an array of dictionaries and I want the autocomplete to match  
to the key "description"

This code below works great for an array of strings:

NSArray *matchingNames = [namesArray filteredArrayUsingPredicate: 
[NSPredicate predicateWithFormat:@"SELF beginswith[cd] %@", substring]];


But how do I get the above code to match to a specific key from a  
dictionary?


Regards,
Jason Wiggins
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Persistent Connection to Web Server in cocoa, emulating AJAX

2008-10-23 Thread Jason Stephenson

Jack Carbaugh wrote:
What is the best way to emulate, with cocoa, an AJAX persistent 
connection to a web server.


There is no persistent connection to a web server. HTTP does not 
preserve state between discrete requests. This is why cookies were 
invented and session variables stored on the server.


Well-implemented AJAX applications may give the appearance of 
persistence, but they are still initiating a discrete XMLHTTPRequest any 
time they need new data from the server.




I've reviewed NSURLConnection, but am not sure if it what i need.


You might want to use WebKit and JavaScript. However, I can't make any 
useful suggestions without knowing more about what you really want to 
achieve.


Jason



Thank you!

Jack
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/jason%40sigio.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: When does Cocoa fall apart? (Run loops)

2008-10-23 Thread I. Savant
On Wed, Oct 22, 2008 at 6:37 PM, Chris Idou <[EMAIL PROTECTED]> wrote:
>
> I think bindings don't merely avoid glue code, it also provides a separation 
> of concerns.

  Agreed. There are a number of benefits but, as with all
technologies, those benefits don't always outweigh the detractors. It
sounds as though you're doing things that Bindings doesn't handle well
(whether due to design or bugs you've encountered). If so, it's time
to reconsider their use for this project. :-)

> As for Cocoa, the most annoying thing is the source is invisible. Why doesn't 
> Apple make it visible?

  Okay, though related, this is a completely different argument. With
respect, I'm going to leave that one alone.

> I'm in a bit of a bad mood at the moment about Apple's quality of testing. 
> The Genius playlists on my iPod Classic synched from iTunes *play the wrong 
> song* when you click on one. iDisk seems to blow up every month or two. I'm 
> just now recovering from the iPhone 2.0 software debacle, not to mention 
> Mobile Me.

  I'm chuckling not out of cruelty but recognition. :-) I understand
the sentiment and agree some closer quality control is needed. This
is, I believe, why the next 'big cat' will focus on stability and
performance more than consumer features. This is, however, veering a
bit too far off-topic for this list.

  Back to my original (on-topic) point: It sounds as though Bindings
won't work for your current project. There's nothing wrong with simply
not using the mechanism. A little more glue code to do it right and
otherwise-hassle-free isn't so bad, is it?

--
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: Persistent Connection to Web Server in cocoa, emulating AJAX

2008-10-23 Thread Jack Carbaugh

the process is as follows ...

a request/command is sent to a URL which processes the request.

The result is then sent out of a "responder" at another URL.

So what i'm wanting to do, i suppose, is to continually poll the  
"responder" URL and process it's results.



On Oct 23, 2008, at Thu-10 /23 /08-9:25 AM, Jason Stephenson wrote:


Jack Carbaugh wrote:
What is the best way to emulate, with cocoa, an AJAX persistent  
connection to a web server.


There is no persistent connection to a web server. HTTP does not  
preserve state between discrete requests. This is why cookies were  
invented and session variables stored on the server.


Well-implemented AJAX applications may give the appearance of  
persistence, but they are still initiating a discrete XMLHTTPRequest  
any time they need new data from the server.



I've reviewed NSURLConnection, but am not sure if it what i need.


You might want to use WebKit and JavaScript. However, I can't make  
any useful suggestions without knowing more about what you really  
want to achieve.


Jason


Thank you!
Jack
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/jason%40sigio.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: CGPoint wrapper?

2008-10-23 Thread Graff

On Oct 23, 2008, at 3:06 AM, Ken Ferry wrote:


On Wed, Oct 22, 2008 at 9:09 PM, Graff <[EMAIL PROTECTED]> wrote:



NSPoint and CGPoint are structs that are essentially the same.  You  
can

convert between them with a simple cast:

NSPoint point = *(NSPoint *)&myCGPoint;

http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaDrawingGuide/QuartzOpenGL/chapter_10_section_2.html

You can also use the function NSPointFromCGPoint() which does the  
exact

same thing for you:

NSPoint point = NSPointFromCGPoint(myCGPoint);

(Declared in NSGeometry.h)



The function is actually implemented a bit better than the cast  
above, in

that the function does not violate strict aliasing[1].

-Ken

[1]:
http://www.cellperformance.com/mike_acton/2006/06/understanding_strict_aliasing.html


Very interesting, I hadn't considered that issue.  Thanks for pointing  
it out.


When I looked up that function on the internet I saw that it was  
defined as a simple cast.  Now that I look at the actual header file  
on my system I see that Apple is now performing the cast by way of a  
union (referred to as type-punning in the article you linked).  It's  
an elegant solution and very instructional.


- Graff
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: WebView: Open new windows in default browser

2008-10-23 Thread Benjamin Dobson
On 23 Oct 2008, at 01:09:07, <[EMAIL PROTECTED]> <[EMAIL PROTECTED] 
> wrote:


I've been trying to get a WebView to open in the user's default  
browser. In fact, I've succeeded, but it's rather clunky,

and I'm wondering if there's a better way.


Why not simply add "target=_'blank'" to your URLs? No WebView  
hacking needed.


http://my.external.url"; title="What the user sees"  
target="_blank">


Sorry – you misunderstand. I meant a way to change the way WebView  
handles opening windows to open them in the user's default browser.  
Like I said, I have found a way to do this, but it involves a second  
WebView which intercepts the message and passes it to the default  
browser with [[NSWorkspace sharedWorkspace] openURL:[request URL]];


As such, it doesn't really matter if there is no other way to do this,  
but a better method would be an improvement.___


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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Persistent Connection to Web Server in cocoa, emulating AJAX

2008-10-23 Thread Jason Stephenson

Jack Carbaugh wrote:

the process is as follows ...

a request/command is sent to a URL which processes the request.

The result is then sent out of a "responder" at another URL.

So what i'm wanting to do, i suppose, is to continually poll the 
"responder" URL and process it's results.


NSURLRequest should do what you want. You'll want to use NSTimer and 
periodically retrieve the request in a timed loop.


Jason
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Controls disappearing from window during resize

2008-10-23 Thread I. Savant
On Thu, Oct 23, 2008 at 11:17 AM, Eric Gorr <[EMAIL PROTECTED]> wrote:
> This strange behavior is easy to reproduce using just the Cocoa Simulator.

  This isn't a bug. It's doing exactly what you told it to. You told
it (in addition to sticking to the top-left corner) to keep its
distance from the right side of its superview as well as grow *and
shrink* relative to its current size. Since the label is originally
only wide enough to contain its text, it is getting smaller as the
window gets smaller, which is cutting off its text.

  Widen the label so its original position spans its entire superview
(drag its right side to the right side of its superview).

--
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]


Controls disappearing from window during resize

2008-10-23 Thread Eric Gorr
This strange behavior is easy to reproduce using just the Cocoa  
Simulator.


You can grab an example .xib from:

http://ericgorr.net/MyDocument.xib.zip

Load this .xib into interface builder and run the simulator.

Once the window appears, resize the window to the smallest height you  
can and then resize back to the original height.


What you will see happen is the 'Label' disappear.

I can see this same behavior in my real application as well.

This looks like a bug to me, but I wanted to confirm it here before I  
file a report.


If it is not a bug, what can be done to make sure the 'Label' text  
stays in the upper left corner of the window?


Thank you.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Controls disappearing from window during resize

2008-10-23 Thread Andy Lee

On Oct 23, 2008, at 11:17 AM, Eric Gorr wrote:
Once the window appears, resize the window to the smallest height  
you can and then resize back to the original height.


What you will see happen is the 'Label' disappear.


You have the text field set to grow and shrink in proportion to its  
superview.  In the Size inspector, note the red double-ended  
horizontal arrow inside the box.  In the parlance of struts and  
springs, that is a "spring."  Click that spring to turn it off, and  
also turn off the strut on the right side outside the box.  In other  
words, only have two struts turned on: the ones on the top and left.   
This will give you a text field that maintains its size and its  
position relative to the top left corner. If you look at the animated  
preview you will see the consequence of each of these changes in real  
time.


The reason the label disappears is that when you make the window  
small, the text field's width scales to zero.  When you expand the  
window again, IB scales the width accordingly (as you specified) --  
except now it's scaling zero, which always returns zero.


--Andy


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Controls disappearing from window during resize

2008-10-23 Thread Andy Lee

On Oct 23, 2008, at 11:24 AM, I. Savant wrote:

 Widen the label so its original position spans its entire superview
(drag its right side to the right side of its superview).


This is fine if you don't have another view to the right of the label,  
but if you had, say, an input text field next to it, you obviously  
wouldn't want to make both of them the width of the window.


In general, for each view you have to ask six questions: which of the  
four outer margins do you want to be fixed (turn on the strut for each  
of those), and which of the two inner dimensions do you want to scale  
along with the superview (turn on the spring for each of those)?  Some  
combinations of answers to these six questions won't make logical  
sense, and if you give those combinations, the view will behave in  
some default way that might not be what you wanted.


Cathy Shive wrote two great blog posts on autoresizing:




I kind of like the typo in the title of the second one.  "Autre- 
sizing" sounds French. :)


--Andy


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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]


Hud window controls

2008-10-23 Thread Sandro Noel

Greetings.  

I am trying to design a HUD window, but the controls (buttons, edit  
boxes) don't fit color wise, is there a property i should set

to have them look like the hud window?

thank you.
Sandro 
___


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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Controls disappearing from window during resize

2008-10-23 Thread Andy Lee

On Oct 23, 2008, at 11:35 AM, Andy Lee wrote:
The reason the label disappears is that when you make the window  
small, the text field's width scales to zero.  When you expand the  
window again, IB scales the width accordingly (as you specified) --  
except now it's scaling zero, which always returns zero.


Correction: I think it's actually the height that's scaling to zero.

--Andy


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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 NSDocument with NSViewControllers

2008-10-23 Thread Ross Carter


On Oct 23, 2008, at 3:07 AM, Paul Thomas wrote:

Before I set off down the road to frustrating deadendsville, has  
anyone any experience with trying to coerce AppKit's document  
architecture into a single window interface - i.e. using tabviews in  
stead of separate windows?


A sneaky look at a couple of apps shows that people have usually  
resorted to completely custom classes, but I'd like to use  
NSDocument if possible - just with views instead of windows.


Is it possible?



I've done it, although my implementation is not yet bug-free. Smarter  
developers might know an easier way, but for me it was a lot of work,  
and I can't say that I saved any effort by working with NSDocument  
instead of a custom class. FWIW, here are some of the methods I had to  
override:


NSWindowController -document, -windowDidLoad, -windowWillClose:, - 
windowDidResignMain:, -windowDidBecomeMain:, -windowDidResize:


NSDocumentController -openDocumentWithContentsOfURL:display:error:, - 
openUntitledDocumentAndDisplay:error:, - 
makeUntitledDocumentOfType:error:, - 
reviewUnsavedDocumentsWithAlertTitle:cancellable:delegate:didReviewAllSelector:contextInfo 
:


NSDocument - 
canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo:


The biggest problem was window closing behavior and making sure the  
user gets prompted to save changes for each document in the window.


I didn't use NSViewController.

Ross
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Hud window controls

2008-10-23 Thread I. Savant
On Thu, Oct 23, 2008 at 11:52 AM, Sandro Noel <[EMAIL PROTECTED]> wrote:

> I am trying to design a HUD window, but the controls (buttons, edit boxes)
> don't fit color wise, is there a property i should set
> to have them look like the hud window?

  There are no properties available to control this (they're all
Apple's own custom stuff), but there is this:

http://lipidity.com/apple/ilife-controls-hud-windows-and-more

  It looks alright but I haven't tried it personally.

--
I.S.
___

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

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

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

This email sent to [EMAIL PROTECTED]


BonjourSample from Hillegass (Advanced Mac OS X Programming)

2008-10-23 Thread Jens Beuckenhauer

Hello,

I just tried out the Bonjour sample (chapter 19) from the Hillegass/ 
Dalrymple Book "Advanced Mac OS X Programming". I have some problems  
with it. First of all, the original project can be found here:


Chapter 19, Bonjour

In the line:

sendPort = [[NSSocketPort alloc]
   initRemoteWithProtocolFamily:AF_INET
   socketType:SOCK_STREAM
   protocol:INET_TCP
   address:address];

the "INET_TCP" isn't recognized on my 10.5 system. What do I have to  
put there? I searched the documentation and many, many Webpages for  
the right header file, only finding the sentence, "it is related to  
the system implementation". When simply setting it to zero, the client  
cannot connect to the server...


Thanks for your help
Jens
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: WebView: Open new windows in default browser

2008-10-23 Thread Kevin Gessner

On Oct 23, 2008, at 11:16 AM, Benjamin Dobson wrote:

On 23 Oct 2008, at 01:09:07, <[EMAIL PROTECTED]> <[EMAIL PROTECTED] 
> wrote:


I've been trying to get a WebView to open in the user's default  
browser. In fact, I've succeeded, but it's rather clunky,

and I'm wondering if there's a better way.


Why not simply add "target=_'blank'" to your URLs? No WebView  
hacking needed.


http://my.external.url"; title="What the user sees"  
target="_blank">


Sorry – you misunderstand. I meant a way to change the way WebView  
handles opening windows to open them in the user's default browser.  
Like I said, I have found a way to do this, but it involves a second  
WebView which intercepts the message and passes it to the default  
browser with [[NSWorkspace sharedWorkspace] openURL:[request URL]];


As such, it doesn't really matter if there is no other way to do  
this, but a better method would be an improvement.


What about the WebFrameLoadDelegate (frameLoadDelegate) of your  
WebView? You could intercept the click with  
webView:didStartProvisionalLoadForFrame:, cancel the webview's  
loading, and handle the URL yourself with NSWorkspace. I haven't  
actually tried this, but it might be a more elegant solution.


Thanks,
-- Kevin

Kevin Gessner
http://www.kevingessner.com
[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: Controls disappearing from window during resize

2008-10-23 Thread Eric Gorr


On Oct 23, 2008, at 11:35 AM, Andy Lee wrote:


On Oct 23, 2008, at 11:17 AM, Eric Gorr wrote:
Once the window appears, resize the window to the smallest height  
you can and then resize back to the original height.


What you will see happen is the 'Label' disappear.


You have the text field set to grow and shrink in proportion to its  
superview.  In the Size inspector, note the red double-ended  
horizontal arrow inside the box.  In the parlance of struts and  
springs, that is a "spring."  Click that spring to turn it off, and  
also turn off the strut on the right side outside the box.  In other  
words, only have two struts turned on: the ones on the top and left.


Please try this yourself and then shrink the window to it's smallest  
height. The 'Label' text will disappear.


If I understood you correctly, this should not happen.

The reason the label disappears is that when you make the window  
small, the text field's width scales to zero.  When you expand the  
window again, IB scales the width accordingly (as you specified) --  
except now it's scaling zero, which always returns zero.


The problem occurs not when I change the width of the window. The  
problem occurs when I change the height.


When resizing the window, feel free to make the width wider as the  
height becomes as small as you can make it.






___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CGPoint wrapper?

2008-10-23 Thread Sean McBride
On 10/23/08 12:06 AM, Ken Ferry said:

>The function is actually implemented a bit better than the cast above, in
>that the function does not violate strict aliasing[1].

And gcc will warn you if you ask it:

---
#import 

int main(void)
{
CGPoint myCGPoint = {0.0, 0.0};
NSPoint point = *(NSPoint *)&myCGPoint;
NSPoint point2 = NSPointFromCGPoint(myCGPoint);

return 0;
}
---

/usr/bin/gcc-4.2 -Wstrict-aliasing -fstrict-aliasing /Users/sean/Desktop/
test.m

/Users/sean/Desktop/test.m:6: warning: dereferencing type-punned pointer
will break strict-aliasing rules

Alas, it's not feasible to have this option on in a real-world Cocoa
program, since gcc will also warn just about anywhere you use 'super',
ex: 'self = [super init]'. :(  

--

Sean McBride, B. Eng [EMAIL PROTECTED]
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Unregistered weak referrer

2008-10-23 Thread Ross Carter


On Oct 22, 2008, at 9:54 PM, Bill Bumgarner wrote:


On Oct 22, 2008, at 4:48 PM, Ross Carter wrote:
Yes, GC is enabled. I get the message when I remove a subview from  
a NSScrollView's documentView. The removed subview contains 3  
NSTextViews, 2 of which have their own layoutManager and  
textStorage. A lot of code fires at that time. Without knowing what  
"unregistered weak referrer" means, or how to find what the  
offending object is, it's hard to know where to start.

On 23/10/2008, at 10:31 AM, Ross Carter wrote:

What does this console message mean?

malloc: auto malloc[542]: attempted to remove unregistered weak  
referrer 0x128538c


Mmm... fun.

So far, the only time this log message has been barfed up is when  
something somewhere has clobbered memory.  Might you be stomping  
memory somewhere?


There is a chance this is a bug in the frameworks.  Please file a  
bug.  If you have a reproducible case,  attaching the application  
(no source necessary) would be very much appreciated.


b.bum



Thanks Bill! Bug filed: 6314550. I included a Release build of the  
app, which produces the message 100% of the time.


I'll look for a memory stomper, but I confess I'm not sure exactly  
what I should be looking for.


Ross
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Unregistered weak referrer

2008-10-23 Thread Sean McBride
On 10/23/08 12:35 PM, Ross Carter said:

>I'll look for a memory stomper, but I confess I'm not sure exactly
>what I should be looking for.

First, you would try running your app with Guard Malloc.  There are
other debug settings that can help, see:


--

Sean McBride, B. Eng [EMAIL PROTECTED]
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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

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

This email sent to [EMAIL PROTECTED]


NSPredicate predicateWithFormat:

2008-10-23 Thread chaitanya pandit

Hi list,
I have an array controller that manages certain entities, each of the  
entity has an attribute "Name" now i want to search for entities with  
names from a given array,
Say i have an array (namesArray) with contents "Tom, Matt, Joe" now  
what i do is, i create a predicate which will look for the names in  
the given array within all the entities present in the array controller,


	NSArray *namesArray = [NSArray arrayWithObjects:@"Tom" , @"Matt" ,  
@"Joe", nil];
	NSPredicate *predicate = [NSPredicate predicateWithFormat: @"Name IN  
%@", namesArray];
	NSMutableArray *foundNames = [[arrayController  
arrangedObjects]filteredArrayUsingPredicate:predicate];


It works but he problem is that i have a memory leak over here, before  
creating the predicate, the retain count of namesArray is 1, but after  
i create the predicate it is 2

and in instruments i see a memory leak with the namesArray.

Any idea what i'm doing wrong?
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]


NSPredicate predicateWithFormat:

2008-10-23 Thread chaitanya pandit

Hi list,
I have an array controller that manages certain entities, each of the  
entity has an attribute "Name" now i want to search for entities with  
names from a given array,
Say i have an array (namesArray) with contents "Tom, Matt, Joe" now  
what i do is, i create a predicate which will look for the names in  
the given array within all the entities present in the array controller,


	NSArray *namesArray = [NSArray arrayWithObjects:@"Tom" , @"Matt" ,  
@"Joe", nil];
	NSPredicate *predicate = [NSPredicate predicateWithFormat: @"Name IN  
%@", namesArray];
	NSMutableArray *foundNames = [[arrayController  
arrangedObjects]filteredArrayUsingPredicate:predicate];


It works but he problem is that i have a memory leak over here, before  
creating the predicate, the retain count of namesArray is 1, but after  
i create the predicate it is 2

and in instruments i see a memory leak with the namesArray.

Any idea what i'm doing wrong?
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: BonjourSample from Hillegass (Advanced Mac OS X Programming)

2008-10-23 Thread Jens Beuckenhauer




Hello again,

my first answer was too quick...

If I put the 0x06 (I found it in the header file for INET_TCP) in the  
code, it works. But how can I include the header? I do not get it to  
work for a more cleaner approch...


I tried

#import 

and

#import 

I get: No such file or directory. Adding the CoreServices.framework or  
OSServices.framework doesn't seem to work either. What might be my  
fault?


Jens

the "INET_TCP" isn't recognized on my 10.5 system. What do I have  
to put
there? I searched the documentation and many, many Webpages for the  
right

header file, only finding the sentence, "it is related to the system
implementation". When simply setting it to zero, the client cannot  
connect

to the server...


 Sounds like they forgot to mention that it's declared in
OT/OpenTransportProviders.h ... :-)  I recommend making sure Spotlight
indexes the /Developer folder (I don't think it does by default ...
mdimport /Developer will work). That way you can search for these
things quickly and easily.

--
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: Problems when putting a window between desktop and desktop icons

2008-10-23 Thread Matt Neuburg
On Tue, 21 Oct 2008 20:43:00 +0200, "Markus Amalthea Magnuson"
<[EMAIL PROTECTED]> said:
>Hello,
>
>I am trying to put a window above the desktop but below the desktop
>icons. I have achieved this by using the following code (in my own
>subclass of NSWindow):
>
>[self setLevel:kCGDesktopIconWindowLevel - 1];

I think what you want to say is
CGWindowLevelForKey(kCGDesktopWindowLevelKey). This should be more robust
than manipulating the level value directly.

m.

-- 
matt neuburg, phd = [EMAIL PROTECTED], 
A fool + a tool + an autorelease pool = cool!
One of the 2007 MacTech Top 25: 
AppleScript: the Definitive Guide - Second Edition!




___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: BonjourSample from Hillegass (Advanced Mac OS X Programming)

2008-10-23 Thread Gary L. Wade
Use IPPROTO_TCP instead, which is in the Unix headers.

>>>
>
>Hello again,
>
>my first answer was too quick...
>
>If I put the 0x06 (I found it in the header file for INET_TCP) in the  
>code, it works. But how can I include the header? I do not get it to  
>work for a more cleaner approch...
>
>I tried
>
>#import 
>
>and
>
>#import 
>
>I get: No such file or directory. Adding the CoreServices.framework or  
>OSServices.framework doesn't seem to work either. What might be my  
>fault?
>
>Jens
>
>>> the "INET_TCP" isn't recognized on my 10.5 system. What do I have  
>>> to put
>>> there? I searched the documentation and many, many Webpages for the  
>>> right
>>> header file, only finding the sentence, "it is related to the system
>>> implementation". When simply setting it to zero, the client cannot  
>>> connect
>>> to the server...
>>
>>  Sounds like they forgot to mention that it's declared in
>> OT/OpenTransportProviders.h ... :-)  I recommend making sure Spotlight
>> indexes the /Developer folder (I don't think it does by default ...
>> mdimport /Developer will work). That way you can search for these
>> things quickly and easily.
>>
>> --
>> 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/garywade%40desisoftsystems.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: BonjourSample from Hillegass (Advanced Mac OS X Programming)

2008-10-23 Thread I. Savant
On Thu, Oct 23, 2008 at 12:16 PM, Jens Beuckenhauer
<[EMAIL PROTECTED]> wrote:

> the "INET_TCP" isn't recognized on my 10.5 system. What do I have to put
> there? I searched the documentation and many, many Webpages for the right
> header file, only finding the sentence, "it is related to the system
> implementation". When simply setting it to zero, the client cannot connect
> to the server...

  Sounds like they forgot to mention that it's declared in
OT/OpenTransportProviders.h ... :-)  I recommend making sure Spotlight
indexes the /Developer folder (I don't think it does by default ...
mdimport /Developer will work). That way you can search for these
things quickly and easily.

--
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]


[Announce] Cocoa Barcodes is now open source and available on Google Code

2008-10-23 Thread Jeff LaMarche
I just finished checking in the source code for Barcode Generator, a  
Cocoa program I wrote a few years ago into Google Code as an open  
source project (BSD Licensed). It contains a fairly easy-to-use set of  
classes for generating 2D barcodes.


http://code.google.com/p/cocoabarcodes/

Project Description:
Cocoa Barcodes is a set of classes (and a test application) for  
generating two-dimensional barcodes. It supports many of the more  
common one-dimensional linear barcodes in use today, allows you to  
export a barcode as a TIFF, EPS, or PDF image, to copy the barcode  
image to the pasteboard, or to drag it to any other application that  
accepts standard OS X PDF data from the pasteboard, including  
TextEdit?. You can also print barcodes directly to any supported  
printer. Please note that you may not be able to create readable  
barcodes at all bar widths allowed by a specification. For example,  
Code 3 of 9 allows a bar width of as small as 7.5 mils, but I haven't  
had much luck going smaller than 13 mils on ink jet printers.


You have a fair amount of control over the final appearance of the  
barcode, including the bar width (in 1/10 mil increments), bar height,  
font size, and captioning. The following barcode types are supported:


Code 3 of 9
Extended Code 3 of 9
Code 128
Interleaved 2 of 5
Industrial 2 of 5
Codabar
PostNet
Modified Plessey
Modified Plessey (hexadecimal)
UPC-A
UPC-E
EAN-13
EAN-8
Royal Mail Barcode (also known as RM4SCC or CBC)
Planet Barcode
Japan Post Barcode

Cocoa Barcodes is based on Barcode Generator, an open source Mac  
program which began its life as a test scaffold for a set of Cocoa  
classes I was writing. I did not initially intend to release it as a  
standalone program, but by the time I was done testing the code, it  
had the lion's share of the features available on other OS X barcode  
programs at the time so I decided to release it.


Jeff
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Controls disappearing from window during resize

2008-10-23 Thread I. Savant
On Thu, Oct 23, 2008 at 11:48 AM, Andy Lee <[EMAIL PROTECTED]> wrote:
> On Oct 23, 2008, at 11:24 AM, I. Savant wrote:
>>
>>  Widen the label so its original position spans its entire superview
>> (drag its right side to the right side of its superview).
>
> This is fine if you don't have another view to the right of the label, but
> if you had, say, an input text field next to it, you obviously wouldn't want
> to make both of them the width of the window.

  A good point; I assumed the label was acting as a header in that
example. Besides, I like your original explanation better than mine.
:-)

--
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: LSUIElement application and coming to the front

2008-10-23 Thread Matt Neuburg
On Wed, 22 Oct 2008 11:47:01 -0700, Nick Beadman <[EMAIL PROTECTED]> said:
>I am working on an application which is a floating palette that only
>appears when another application is frontmost. I have set LSUIElement
>in the Info.plist but when the palette comes to the front my
>application becomes active keyboard shortcuts no longer work in the
>other application.

I know this isn't quite the answer you want, but one approach is to give up
on LSUIElement and just have a normal app. Your app can watch what app is
frontmost and show and hide itself accordingly, and can intrude its palette
so that it is in front even when the other app is actually frontmost (using
NSFloatingWindowLevel), thus calling attention to itself as a window
supplementary to the other app, but there is still a distinction, and when
the user actually clicks on the palette to use it, your app comes to the
front. I use this approach and I and my users find it a lot less confusing
than e.g. what Help Viewer does in Leopard (which is simply horrendous
IMHO). m.

-- 
matt neuburg, phd = [EMAIL PROTECTED], 
A fool + a tool + an autorelease pool = cool!
One of the 2007 MacTech Top 25: 
AppleScript: the Definitive Guide - Second Edition!




___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Controls disappearing from window during resize

2008-10-23 Thread Eric Gorr

I've updated the .xib at:

http://ericgorr.net/MyDocument.xib.zip

Run this through the simulator.

Shrink the window to it's smallest height and either keep the width  
the same or feel free to make the window wider.


Grow the window again to the height it was before.

The 'Label' text will be gone. The 'Label 2' text will still be there.

Why?

In my real application, the custom view, which contains the 'Label'  
and 'Label 2' text, must resize itself as the window size changes. So,  
all of it's struts and springs are turned on.


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Controls disappearing from window during resize

2008-10-23 Thread Andy Lee

On Oct 23, 2008, at 12:30 PM, Eric Gorr wrote:

On Oct 23, 2008, at 11:35 AM, Andy Lee wrote:
You have the text field set to grow and shrink in proportion to its  
superview.  In the Size inspector, note the red double-ended  
horizontal arrow inside the box.  In the parlance of struts and  
springs, that is a "spring."  Click that spring to turn it off, and  
also turn off the strut on the right side outside the box.  In  
other words, only have two struts turned on: the ones on the top  
and left.


Please try this yourself and then shrink the window to it's smallest  
height. The 'Label' text will disappear.


You are right -- I only noticed a problem with the width, but I see  
that is not what you are asking about, since the text view does  
reappear if you only resize horizontally.


The reason the label disappears is that when you make the window  
small, the text field's width scales to zero.  When you expand the  
window again, IB scales the width accordingly (as you specified) --  
except now it's scaling zero, which always returns zero.


The problem occurs not when I change the width of the window. The  
problem occurs when I change the height.


The same reasoning applies except in the other dimension.  One or more  
vertical distances are getting scaled to zero, and this produces  
undesired results.  If you change the height gradually up and down you  
will see the text field get shoved up and out of view.  The solution  
is to either impose a minimum size on your window or implement your  
own autoresizing as Cathy Shive did.


Related problems have been reported before, for example with the  
subviews of split views.  Bottom line: if at all possible prevent any  
of the relevant measurements (width, height, margins) from scaling to  
zero.  In addition, for each direction I personally try to have two of  
the three measurements be fixed, to avoid tiny errors that I'm  
guessing are caused by roundoff when two or three of the measurements  
are "springy."  When two of the three measurements are fixed, IB only  
has to do subtraction to compute the third -- no division.


I suspect your particular problem occurs vertically and not  
horizontally because of the coordinate system.  Shrinking the window  
increases the y of the bottom edge but decreases the x of the right  
edge.  This is just a guess as to why the behavior is not symmetric.   
I would call it an annoyance rather than a bug, but either way, it  
should be fine to submit a Radar.


--Andy

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Problems when putting a window between desktop and desktop icons

2008-10-23 Thread Markus Amalthea Magnuson
On Thu, Oct 23, 2008 at 19:26, Matt Neuburg <[EMAIL PROTECTED]> wrote:

>>Hello,
>>
>>I am trying to put a window above the desktop but below the desktop
>>icons. I have achieved this by using the following code (in my own
>>subclass of NSWindow):
>>
>>[self setLevel:kCGDesktopIconWindowLevel - 1];
>
> I think what you want to say is
> CGWindowLevelForKey(kCGDesktopWindowLevelKey). This should be more robust
> than manipulating the level value directly.

Thanks for the tip! However, that doesn't really solve my problem,
which I am beginning to think is a bug on Apple's behalf. If anyone is
interested in some sample code, please download it here:

http://data.konstochvanligasaker.se/markus/GiveMeWindow.zip

Any other suggestions are welcome.
-- 
Markus Amalthea Magnuson

http://konstochvanligasaker.se
http://nattlek.se

"Life... is like a grapefruit. It's orange and squishy, and has a few
pips in it, and some folks have half a one for breakfast."
 – Douglas Adams
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSPredicate predicateWithFormat:

2008-10-23 Thread Keary Suska


On Oct 23, 2008, at 11:05 AM, chaitanya pandit wrote:

	NSArray *namesArray = [NSArray arrayWithObjects:@"Tom" , @"Matt" ,  
@"Joe", nil];
	NSPredicate *predicate = [NSPredicate predicateWithFormat: @"Name  
IN %@", namesArray];
	NSMutableArray *foundNames = [[arrayController  
arrangedObjects]filteredArrayUsingPredicate:predicate];


It works but he problem is that i have a memory leak over here,  
before creating the predicate, the retain count of namesArray is 1,  
but after i create the predicate it is 2 and in instruments i see a  
memory leak with the namesArray.


There is no memory leak in the code you provided. Everything is  
autoreleased, and should be deallocated when the pool is drained. The  
NSPredicate is probably retaining its arguments, and it should release  
them when itself is released.


To check this, use alloc/init for the predicate and explicitly release  
it before re-checking the retain count.


Anyway, you shouldn't rely on retain count for memory-related issues,  
as you now see.


HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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]


enumerating the NSApplication instances?

2008-10-23 Thread Bill Janssen
Hi.  I'm trying to write a simple Cocoa program to enumerate the
windows on the screen, across all the apps.  I can see how to use
NSWorkspace.launchedApplications() to enumerate the apps, but I don't
see how to go from those dictionaries to an instance of NSApplication,
so that I can enumerate the application's windows.

I'm sure this is perfectly simple, but I'm just not seeing it...

Bill
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Controls disappearing from window during resize

2008-10-23 Thread Andy Lee

On Oct 23, 2008, at 1:44 PM, Eric Gorr wrote:

I've updated the .xib at:

http://ericgorr.net/MyDocument.xib.zip

Run this through the simulator.

Shrink the window to it's smallest height and either keep the width  
the same or feel free to make the window wider.


Grow the window again to the height it was before.

The 'Label' text will be gone. The 'Label 2' text will still be there.

Why?


"Label" has its top margin fixed.  "Label 2" has its bottom margin  
fixed.  This leads me to suspect that when a view gets smashed to  
zero, the margin that is toward zero (in this case, the bottom) is  
able to survive if it is a strut -- just as the left margin of "Label"  
survived.


There are other variables that can make behavior inconsistent.  For  
example, if you move the enclosing view so it touches the top left  
corner of the window, you can still make "Label" disappear, but if you  
make the enclosing view exactly fill the *whole* window, it can now  
survive any change to the window.


Does the design of your app allow you impose a minimum size?

--Andy

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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]


NSInputStream Not Reading All Data

2008-10-23 Thread Thaddeus Cooper

Hi All.

I have an NSInputStream that I've set up on the run loop to read data  
from a socket. It's mostly working except that when I am sending it a  
large amount of data (say 30k), the last chunk of data never shows up.  
I have tried reading 1 byte, 10 bytes and 1024 bytes in the  
handleStream method and the last 216 bytes never show up.


I've looked in the archives and noticed that 3 years ago someone else  
had a similar problem -- but there was no followup.


The question I have is what do I need to do to get the last chunk of  
data off the stream. Below is a snippet of the code I'm using to read  
data off the stream inside handleEvent.


Thanks very much.

Thaddeus O. Cooper
([EMAIL PROTECTED])

while ([_inStream hasBytesAvailable]) {
len = [(NSInputStream *)stream read:buf maxLength:1024];
[data appendBytes:(const void *)buf length:len];
bytesRead = bytesRead + len;
}


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Controls disappearing from window during resize

2008-10-23 Thread Eric Gorr


On Oct 23, 2008, at 1:46 PM, Andy Lee wrote:


On Oct 23, 2008, at 12:30 PM, Eric Gorr wrote:

On Oct 23, 2008, at 11:35 AM, Andy Lee wrote:
You have the text field set to grow and shrink in proportion to  
its superview.  In the Size inspector, note the red double-ended  
horizontal arrow inside the box.  In the parlance of struts and  
springs, that is a "spring."  Click that spring to turn it off,  
and also turn off the strut on the right side outside the box.  In  
other words, only have two struts turned on: the ones on the top  
and left.


Please try this yourself and then shrink the window to it's  
smallest height. The 'Label' text will disappear.


You are right -- I only noticed a problem with the width, but I see  
that is not what you are asking about, since the text view does  
reappear if you only resize horizontally.


The reason the label disappears is that when you make the window  
small, the text field's width scales to zero.  When you expand the  
window again, IB scales the width accordingly (as you specified)  
-- except now it's scaling zero, which always returns zero.


The problem occurs not when I change the width of the window. The  
problem occurs when I change the height.


The same reasoning applies except in the other dimension.  One or  
more vertical distances are getting scaled to zero, and this  
produces undesired results.  If you change the height gradually up  
and down you will see the text field get shoved up and out of view.   
The solution is to either impose a minimum size on your window or  
implement your own autoresizing as Cathy Shive did.


Related problems have been reported before, for example with the  
subviews of split views.  Bottom line: if at all possible prevent  
any of the relevant measurements (width, height, margins) from  
scaling to zero.  In addition, for each direction I personally try  
to have two of the three measurements be fixed, to avoid tiny errors  
that I'm guessing are caused by roundoff when two or three of the  
measurements are "springy."  When two of the three measurements are  
fixed, IB only has to do subtraction to compute the third -- no  
division.


I suspect your particular problem occurs vertically and not  
horizontally because of the coordinate system.  Shrinking the window  
increases the y of the bottom edge but decreases the x of the right  
edge.  This is just a guess as to why the behavior is not  
symmetric.  I would call it an annoyance rather than a bug, but  
either way, it should be fine to submit a Radar.


Ok, so, now there is an understanding of the problem, I will try to  
explain why I need a workaround.


I have an NSPanel and need to implement some window shading  
functionality - i.e. the content area is hidden and only the title bar  
remains. Unfortunately, this means that the height of the content area  
does become zero.


Outside of the window shade functionality, I do have a minimum size  
defined so a user will not be able to get themselves into this  
situation simply by resizing the window.


Fortunately, part of the design of these panel's is that the content  
view will contain a view (call it THE_VIEW) that contains all of the  
controls for the NSPanel.


A workaround (which I've just implemented) that seems to work is when  
the window shade is activated, I remove THE_VIEW and then shrink the  
window. When the window shade is activated again, indicating that the  
contents of the panel should reappear, I grow the window and then add  
THE_VIEW back to the content view. This probably wouldn't work well if  
I needed to animate the shrinking & growing, but I don't need to worry  
about that for now.


If anyone has any alternative suggestions, thoughts or comments, I am  
interested.








___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: enumerating the NSApplication instances?

2008-10-23 Thread Charles Steinman
--- On Thu, 10/23/08, Bill Janssen <[EMAIL PROTECTED]> wrote:

> Hi.  I'm trying to write a simple Cocoa program to
> enumerate the
> windows on the screen, across all the apps.  I can see how
> to use
> NSWorkspace.launchedApplications() to enumerate the apps,
> but I don't
> see how to go from those dictionaries to an instance of
> NSApplication,
> so that I can enumerate the application's windows.
> 
> I'm sure this is perfectly simple, but I'm just not
> seeing it...

You can't get NSApplication instances for other applications. If you want get a 
list of all the windows on the system, take a look at CGWindow.h in Leopard. 
The CGWindowList* family of functions do what you want.

Cheers,
Chuck


  
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Controls disappearing from window during resize

2008-10-23 Thread Benjamin Dobson
Any particular reason you want to scale to zero? Because if not, why  
not just give the window a minimum size?


I see the problem. It seems like a bug. But allowing the custom view  
to scale into negative dimensions just seems... wrong.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CGPoint wrapper?

2008-10-23 Thread DKJ

On 23 Oct, 2008, at 11:26, Finlay Dobbie wrote:

I'm surprised nobody else has picked up on this - how is enumerating
an NSArray going to be faster than enumerating a C array?


I was referring to this:

for( TheClass *obj in TheArray ) {}

as fast enumeration.
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Controls disappearing from window during resize

2008-10-23 Thread Eric Gorr

I just entered a bug report: rdar//6314988

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Controls disappearing from window during resize

2008-10-23 Thread Andy Lee

On Oct 23, 2008, at 2:41 PM, Eric Gorr wrote:
I have an NSPanel and need to implement some window shading  
functionality - i.e. the content area is hidden and only the title  
bar remains. Unfortunately, this means that the height of the  
content area does become zero.


I see.  Same principle as the stacked inspector panes in IB itself, or  
in apps like OmniGraffle and Create.


A workaround (which I've just implemented) that seems to work is  
when the window shade is activated, I remove THE_VIEW and then  
shrink the window. When the window shade is activated again,  
indicating that the contents of the panel should reappear, I grow  
the window and then add THE_VIEW back to the content view. This  
probably wouldn't work well if I needed to animate the shrinking &  
growing, but I don't need to worry about that for now.


Of the three apps I tried (IB, OmniGraffle, and Create), only Create  
animates the transition.  Create's panes don't seem to need  
autoresizing behavior -- their controls all seem to be in fixed  
positions -- so it has an easier problem than you.  I wonder if the  
others use the same view-swapping workaround you do.


--Andy

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSPredicate predicateWithFormat:

2008-10-23 Thread chaitanya pandit
Well i could not find any explicit explicit alloc/init method for  
predicate, I am using Instruments to check for memory leaks, and it  
shows a memory leak with the array.


On 23-Oct-08, at 11:33 PM, Keary Suska wrote:



On Oct 23, 2008, at 11:05 AM, chaitanya pandit wrote:

	NSArray *namesArray = [NSArray arrayWithObjects:@"Tom" , @"Matt" ,  
@"Joe", nil];
	NSPredicate *predicate = [NSPredicate predicateWithFormat: @"Name  
IN %@", namesArray];
	NSMutableArray *foundNames = [[arrayController  
arrangedObjects]filteredArrayUsingPredicate:predicate];


It works but he problem is that i have a memory leak over here,  
before creating the predicate, the retain count of namesArray is 1,  
but after i create the predicate it is 2 and in instruments i see a  
memory leak with the namesArray.


There is no memory leak in the code you provided. Everything is  
autoreleased, and should be deallocated when the pool is drained.  
The NSPredicate is probably retaining its arguments, and it should  
release them when itself is released.


To check this, use alloc/init for the predicate and explicitly  
release it before re-checking the retain count.


Anyway, you shouldn't rely on retain count for memory-related  
issues, as you now see.


HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: CGPoint wrapper?

2008-10-23 Thread Sherm Pendley
On Thu, Oct 23, 2008 at 2:49 PM, DKJ <[EMAIL PROTECTED]> wrote:

> On 23 Oct, 2008, at 11:26, Finlay Dobbie wrote:
>
>> I'm surprised nobody else has picked up on this - how is enumerating
>> an NSArray going to be faster than enumerating a C array?
>>
>
> I was referring to this:
>
>for( TheClass *obj in TheArray ) {}
>
> as fast enumeration.


That's faster (and simpler) to *write*, but it performs no better than
enumerating a C array. It is, in fact, implemented by sending
-countByEnumeratingWithState:objects:count: to the array, then enumerating
over the C array that's returned by reference from that method.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: WebView: Open new windows in default browser

2008-10-23 Thread Nathan Kinsinger

On Oct 22, 2008, at 11:37 AM, Benjamin Dobson wrote:

My main WebView's method for opening windows is controlled via  
UIDelegate. These requests are passed on to a second WebView, which  
intercepts all requests via policyDelegate. It then passes them on  
to the default browser with the openURL: method in NSWorkspace.


Why create a second WebView? Just make the decision in your main  
WebView using the WebPolicyDelegate method

-webView:decidePolicyForNavigationAction:request:frame:decisionListener:
and send the listener an -ignore message (from  
WebPolicyDecisionListener protocol) if you decide to open the link in  
an external browser.


Here's an example:

// 
//   if the user clicks a link it loads the url in an external web  
browser
//   if a page is loaded progammatically (via loadHTMLString:baseURL:  
for example) then that link is opened by the WebView
- (void)webView:(WebView *)sender decidePolicyForNavigationAction: 
(NSDictionary *)actionInformation request:(NSURLRequest *)request  
frame:(WebFrame *)frame decisionListener:(id  
)listener

{   
	if ([[actionInformation objectForKey:WebActionNavigationTypeKey]  
intValue] != WebNavigationTypeOther) {

[listener ignore];
[[NSWorkspace sharedWorkspace] openURL:[request URL]];
}
else
[listener use];
}

If you only want to use the external browser when the user tries to  
open a new window use  
webView:decidePolicyForNewWindowAction:request:newFrameName:decisionListener 
: instead.


--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]


Re: enumerating the NSApplication instances?

2008-10-23 Thread Bill Janssen
Charles Steinman <[EMAIL PROTECTED]> wrote:

> You can't get NSApplication instances for other applications.

Even as root?

Bill

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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]


Debugging preference pane

2008-10-23 Thread Adam Penny

Hi there,

Apparently I need to add System Preferences as an executable to my  
xcode project in order to debug my build. Can anyone tell me how to do  
this in XCode 3 please? I'll be debugging from ~/Library/ 
PreferencePanes/


Thanks,

Adam
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: CGPoint wrapper?

2008-10-23 Thread Kyle Sluder
On Thu, Oct 23, 2008 at 3:12 PM, Sherm Pendley <[EMAIL PROTECTED]> wrote:
> That's faster (and simpler) to *write*, but it performs no better than
> enumerating a C array. It is, in fact, implemented by sending
> -countByEnumeratingWithState:objects:count: to the array, then enumerating
> over the C array that's returned by reference from that method.

The pattern itself is called "Fast Enumeration", because it's faster
than using a simple NSEnumerator.

--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: Debugging preference pane

2008-10-23 Thread Nick Zitzmann


On Oct 23, 2008, at 1:38 PM, Adam Penny wrote:

Apparently I need to add System Preferences as an executable to my  
xcode project in order to debug my build. Can anyone tell me how to  
do this in XCode 3 please? I'll be debugging from ~/Library/ 
PreferencePanes/



This is more of a question for the xcode-users list, but the way I add  
custom executables is to go to the project's Targets tab[1], then  
choose Add -> New Custom Executable... in the contextual menu.


Nick Zitzmann


[1] if you're using the condensed view, if not, then just locate the  
executables in the project list


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: enumerating the NSApplication instances?

2008-10-23 Thread Nick Zitzmann


On Oct 23, 2008, at 1:30 PM, Bill Janssen wrote:


You can't get NSApplication instances for other applications.


Even as root?



Not unless the application is specifically vending the objects through  
DO. Mac OS X isn't Windows XP, where every application can access the  
forms/controllers of every other application, which is a security  
hole. By default, applications cannot communicate with other  
applications, with the exceptions of the mandatory open/print/ping/ 
quit Apple events.


Nick Zitzmann


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: enumerating the NSApplication instances?

2008-10-23 Thread Sherm Pendley
On Thu, Oct 23, 2008 at 3:30 PM, Bill Janssen <[EMAIL PROTECTED]> wrote:

> Charles Steinman <[EMAIL PROTECTED]> wrote:
>
> > You can't get NSApplication instances for other applications.
>
> Even as root?


Don't run a GUI app as root - it's a horrible, huge, gaping security hole to
do so.

Besides which, not every app is written in Cocoa. There are still plenty of
Carbon apps around - MS Office, for instance, and Adobe's CS apps. None of
those have an NSApplication instance, and no matter how hard you try or who
you're logged in as, you can't get a reference to something that isn't
there.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: /Library/Logs vs. user/Library/Logs

2008-10-23 Thread Chris Markle
Thanks guys. Good advice. Here's my summary of what you guys said:

1. Document to read: Low-Level File Management Programming Topics:
Locating Directories on the System
(http://developer.apple.com/documentation/Cocoa/Conceptual/LowLevelFileMgmt/Tasks/LocatingDirectories.html)

2. Putting logs into the ~/Library/Logs folder is a good choice. The
user running the application is more likely to have permission to
write files in that folder. People may be annoyed if  apps drop files
outside of the user's home directory.

3. Don't put logs in ~/Documents, as a some programs do.

4. One could consider as well: ~/Library/Application
Support//* .  It all depends on the sort of log, intended
use, length of keep, size, etc... (On my system, the files in here
look to be more like DB's, etc. as opposed to something transient like
a log file; moreover, ~/Library/Logs looks to be used specifically for
this purpose by some number of apps on my system.) Still, it's worth
noting the existence of this other directory.

Thanks again.

Chris
___

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

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

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

This email sent to [EMAIL PROTECTED]


main window confusion

2008-10-23 Thread James Walker
I have a primary window and a secondary floating panel.  When the panel 
is first shown (using orderFront:), its title bar looks sort of dimmed, 
I guess that means it's not key or main.  If I then click the panel 
title bar, the primary window sends NSWindowDidResignMainNotification 
and gets a dim title bar.  I don't understand that, because the docs say 
that an NSPanel never becomes main.


If I then click on the primary window, and click again on the secondary 
window, I can get into a situation where neither title bar looks dimmed.

--
  James W. Walker, Innoventive Software LLC
  
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Debugging preference pane

2008-10-23 Thread Adam Penny
Thank you for that Nick, I now at least know my error message,  
although I am struggling to figure out what's wrong. And sorry about  
the wrong list, I'll bear that in mind in future.


This is the my console message when the panel hangs:
System Preferences[372:10b] [  
valueForUndefinedKey:]: this class is not key value coding-compliant  
for the key host.


I'm just baffled as as far as I can see I've mirrored the technique  
for bindings that worked when I did the bindings exercise in  
Hillegass' book for an NSTableView and an NSArrayController.


Thank you all.

Adam
#import "printer.h"


@implementation ADPPrinter

- (id)init
{
[super init];
name = @"New Printer's Name";
server =  @"ServerName.domain";
uri = @"URI to printer";
return self;
}

- (void)dealloc
{
[name release];
[server release];
[uri release];
[super dealloc];
}

@synthesize name;
@synthesize server;
@synthesize uri;
@end



This is the class that it's talking about, which is the model class  
for an NSArrayController.

On Oct23, 2008, at 9:52 PM, Nick Zitzmann wrote:



On Oct 23, 2008, at 1:38 PM, Adam Penny wrote:

Apparently I need to add System Preferences as an executable to my  
xcode project in order to debug my build. Can anyone tell me how to  
do this in XCode 3 please? I'll be debugging from ~/Library/ 
PreferencePanes/



This is more of a question for the xcode-users list, but the way I  
add custom executables is to go to the project's Targets tab[1],  
then choose Add -> New Custom Executable... in the contextual menu.


Nick Zitzmann


[1] if you're using the condensed view, if not, then just locate the  
executables in the project list




___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Debugging preference pane

2008-10-23 Thread Nick Zitzmann


On Oct 23, 2008, at 2:36 PM, Adam Penny wrote:


This is the my console message when the panel hangs:
System Preferences[372:10b] [  
valueForUndefinedKey:]: this class is not key value coding-compliant  
for the key host.



That means something's trying to access the key "host", and the  
ADPPrinter class is not defining that key. So either you need to  
provide that key, or if this is in error, find out what's trying to  
access that key and get rid of it. Also, I strongly recommend setting  
a global breakpoint on objc_exception_throw[1].


Nick Zitzmann


[1] assuming you're using Leopard or later; if not, then set a  
breakpoint on -[NSException raise]


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Debugging preference pane

2008-10-23 Thread Adam Penny
Nope, I've triple checked the bindings and they're fine, but I do have  
two table views in two different tab views in my prefpane window,  
could that be causing some issues with their respective array  
controllers getting mixed up?


Adam

ADPServer has the keys
name
mac

ADPPrinter has the keys
name
host
uri
On Oct23, 2008, at 10:49 PM, Nick Zitzmann wrote:



On Oct 23, 2008, at 2:36 PM, Adam Penny wrote:


This is the my console message when the panel hangs:
System Preferences[372:10b] [  
valueForUndefinedKey:]: this class is not key value coding- 
compliant for the key host.



That means something's trying to access the key "host", and the  
ADPPrinter class is not defining that key. So either you need to  
provide that key, or if this is in error, find out what's trying to  
access that key and get rid of it. Also, I strongly recommend  
setting a global breakpoint on objc_exception_throw[1].


Nick Zitzmann


[1] assuming you're using Leopard or later; if not, then set a  
breakpoint on -[NSException raise]




___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Debugging preference pane

2008-10-23 Thread glenn andreas


On Oct 23, 2008, at 4:10 PM, Adam Penny wrote:

Nope, I've triple checked the bindings and they're fine, but I do  
have two table views in two different tab views in my prefpane  
window, could that be causing some issues with their respective  
array controllers getting mixed up?


Adam

ADPServer has the keys
name
mac

ADPPrinter has the keys
name
host
uri


The source code you showed us had:
@implementation ADPPrinter
...
@synthesize name;
@synthesize server;
@synthesize uri;
@end

Note that the source says "server" and not "host" (which is what the  
runtime is looking for)



Glenn Andreas  [EMAIL PROTECTED]
  wicked fun!
Cardographer | the custom playing card designer


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSInputStream Not Reading All Data

2008-10-23 Thread Gary L. Wade
I use different APIs, but I just read until I get a 0 or -1 back for the length.

>Hi All.
>
>I have an NSInputStream that I've set up on the run loop to read data  
>from a socket. It's mostly working except that when I am sending it a  
>large amount of data (say 30k), the last chunk of data never shows up.  
>I have tried reading 1 byte, 10 bytes and 1024 bytes in the  
>handleStream method and the last 216 bytes never show up.
>
>I've looked in the archives and noticed that 3 years ago someone else  
>had a similar problem -- but there was no followup.
>
>The question I have is what do I need to do to get the last chunk of  
>data off the stream. Below is a snippet of the code I'm using to read  
>data off the stream inside handleEvent.
>
>Thanks very much.
>
>Thaddeus O. Cooper
>([EMAIL PROTECTED])
>
>while ([_inStream hasBytesAvailable]) {
>   len = [(NSInputStream *)stream read:buf maxLength:1024];
>   [data appendBytes:(const void *)buf length:len];
>   bytesRead = bytesRead + len;
>}
>
>
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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]


Getting Carbon EventRef from cocoa NSEvent

2008-10-23 Thread Rangaswamy C T
Hi All,

For some requirement in my product, I have embedded my Carbon window inside 
Cocoa window using addChildWindow method.

For getting my carbon window UI (keyboard and mouse) events working, I had to 
watch cocoa events for NSWindow of Carbon window and then redispatch carbon 
eventRef's to Carbon window using SendEventToEventTarget API.

So while converting Cocoa event to carbon events, I used the following piece of 
code

- (void)keyDown:(NSEvent *)theEvent
{
  OSStatus status;//1


  EventRef carbonEvnt;//2
carbonEvnt = (EventRef) [theEvent eventRef];//3
}

But the above NSEvent method eventRef is crashing (at 3) on Tiger. But on 
Leopard it works fine.

Am I doing anything wrong here?

Thanks


___

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

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

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

This email sent to [EMAIL PROTECTED]


RE: Getting Carbon EventRef from cocoa NSEvent

2008-10-23 Thread Rangaswamy C T
Oops, sorry got it.

Thanks


-Original Message-
From: Jesper Storm Bache
Sent: Friday, October 24, 2008 3:14 AM
To: Rangaswamy C T; cocoa-dev@lists.apple.com; [EMAIL PROTECTED]
Subject: RE: Getting Carbon EventRef from cocoa NSEvent

If you look in NSEvent.h you will see :

#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5

/* -eventRef and +eventWithEventRef:  are valid for all events */
/* -eventRef returns an EventRef corresponding to the NSEvent.  The EventRef is 
retained by the NSEvent, so will be valid as long as the NSEvent is valid, and 
will be released when the NSEvent is freed.  You can use RetainEvent to extend 
the lifetime of the EventRef, with a corresponding ReleaseEvent when you are 
done with it.  If there is no EventRef corresponding to the NSEvent, -eventRef 
will return NULL.
*/
- (const void * /* EventRef */)eventRef;
...


I.e. eventRef is only supported by Apple on 10.5 and newer.

Jesper


From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Rangaswamy C T [EMAIL 
PROTECTED]
Sent: Thursday, October 23, 2008 2:42 PM
To: cocoa-dev@lists.apple.com; [EMAIL PROTECTED]
Subject: Getting Carbon EventRef from cocoa NSEvent

Hi All,

For some requirement in my product, I have embedded my Carbon window inside 
Cocoa window using addChildWindow method.

For getting my carbon window UI (keyboard and mouse) events working, I had to 
watch cocoa events for NSWindow of Carbon window and then redispatch carbon 
eventRef's to Carbon window using SendEventToEventTarget API.

So while converting Cocoa event to carbon events, I used the following piece of 
code

- (void)keyDown:(NSEvent *)theEvent
{
  OSStatus status;//1


  EventRef carbonEvnt;//2
carbonEvnt = (EventRef) [theEvent eventRef];//3
}

But the above NSEvent method eventRef is crashing (at 3) on Tiger. But on 
Leopard it works fine.

Am I doing anything wrong here?

Thanks


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: LSUIElement application and coming to the front

2008-10-23 Thread Nick Beadman

Matt,

On Oct 23, 2008, at 10:40 am, Matt Neuburg wrote:

I know this isn't quite the answer you want, but one approach is to  
give up on LSUIElement and just have a normal app. Your app can  
watch what app is frontmost and show and hide itself accordingly,  
and can intrude its palette so that it is in front even when the  
other app is actually frontmost (using NSFloatingWindowLevel), thus  
calling attention to itself as a window supplementary to the other  
app, but there is still a distinction, and when
the user actually clicks on the palette to use it, your app comes to  
the front. I use this approach and I and my users find it a lot less  
confusing
than e.g. what Help Viewer does in Leopard (which is simply  
horrendous IMHO). m.



I actually agree that the Help Viewer is not the best UI in the Mac OS  
X universe. However, I am only using it as an example of an  
application that does exactly what I need mine to do. Believe me, my  
implementation will be much improved. I certainly will be very careful  
about the window only appearing when needed and being less intrusive  
than the Help Viewer.


While I would like this to be a separate application with it's own  
menu bar, that just simply isn't an option as I am supplementing an  
application which has it's own palettes and these must be on screen to  
maintain the illusion of my palette being part of the "host"  
application. Integration will be done via a plug-in in the host  
application which will allow me full control over the Cocoa application.


I did investigate the Help Viewer a little more and it's main window  
has a custom class of HVWindow. Doing an otool on the executable shows  
that the methods it implements are:


- (BOOL)canBecomeMainWindow
- (BOOL)becomeFirstResponder
- (BOOL)acceptsFirstResponder

which give me more clues to pursue. My next area of inquiry is going  
to be poking around Help Viewer using F-Script to see if I can figure  
out anything interesting.


Nick

--
Nick Beadman
[EMAIL PROTECTED]
(sent from my mailing list account, [EMAIL PROTECTED])

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Getting Carbon EventRef from cocoa NSEvent

2008-10-23 Thread Bill Cheeseman
on 2008-10-23 5:42 PM, Rangaswamy C T at [EMAIL PROTECTED] wrote:

> But the above NSEvent method eventRef is crashing (at 3) on Tiger. But on
> Leopard it works fine.
>  
> Am I doing anything wrong here?

According to the NSEvent documentation, the -eventRef method was introduced
in Leopard (Mac OS X 10.5).

You might have to look at the Quartz Event Taps documentation.

--

Bill Cheeseman - [EMAIL PROTECTED]
Quechee Software, Quechee, Vermont, USA
www.quecheesoftware.com

PreFab Software - www.prefabsoftware.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: Hud window controls

2008-10-23 Thread Kiel Gillard
This framework looks pretty good too 


Kiel

On 24/10/2008, at 3:06 AM, I. Savant wrote:

On Thu, Oct 23, 2008 at 11:52 AM, Sandro Noel <[EMAIL PROTECTED]>  
wrote:


I am trying to design a HUD window, but the controls (buttons, edit  
boxes)

don't fit color wise, is there a property i should set
to have them look like the hud window?


 There are no properties available to control this (they're all
Apple's own custom stuff), but there is this:

http://lipidity.com/apple/ilife-controls-hud-windows-and-more

 It looks alright but I haven't tried it personally.

--
I.S.
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%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: enumerating the NSApplication instances?

2008-10-23 Thread Charles Steinman
--- On Thu, 10/23/08, Bill Janssen <[EMAIL PROTECTED]> wrote:

> Charles Steinman <[EMAIL PROTECTED]> wrote:
> 
> > You can't get NSApplication instances for other
> applications.
> 
> Even as root?

It has nothing to do with user permissions. There is no API for getting 
NSApplication instances for arbitrary applications.

Cheers,
Chuck


  
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: /Library/Logs vs. user/Library/Logs

2008-10-23 Thread Jason Coco


On Oct 23, 2008, at 16:27 , Chris Markle wrote:


Thanks guys. Good advice. Here's my summary of what you guys said:

1. Document to read: Low-Level File Management Programming Topics:
Locating Directories on the System
(http://developer.apple.com/documentation/Cocoa/Conceptual/LowLevelFileMgmt/Tasks/LocatingDirectories.html 
)


2. Putting logs into the ~/Library/Logs folder is a good choice. The
user running the application is more likely to have permission to
write files in that folder. People may be annoyed if  apps drop files
outside of the user's home directory.


Yeah, I agree... if you have to write logs somewhere and you're not
some kind or root-daemon port, I would go for ~/Library/Logs or  
Application Support

as noted in Chris's #4.


3. Don't put logs in ~/Documents, as a some programs do.


Never do that... I hate it when programs do that... I delete the program
usually unless I absolutely need it when they do that!


4. One could consider as well: ~/Library/Application
Support//* .  It all depends on the sort of log, intended
use, length of keep, size, etc... (On my system, the files in here
look to be more like DB's, etc. as opposed to something transient like
a log file; moreover, ~/Library/Logs looks to be used specifically for
this purpose by some number of apps on my system.) Still, it's worth
noting the existence of this other directory.


Why not use ASL for logging? It's worked really well for me. I also have
an Obj-C class you can use that wraps ASL if you want.

Jason

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: /Library/Logs vs. user/Library/Logs

2008-10-23 Thread Chris Markle
Jason,

> Why not use ASL for logging? It's worked really well for me. I also have
> an Obj-C class you can use that wraps ASL if you want.

Right now our app runs (for better or for worse) on Windows and OS X
with lots of common code between the two. I think ASL might work in
the future as we become more and more OS X-aware. Thanks for the
tip...

Chris
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Debugging preference pane

2008-10-23 Thread Adam Penny
Oh good grief, thank you very much. Right that problems fixed, but now  
I have this error when the pane first loads.


Sorry, to keep asking what I imagine are pretty basic questions. I've  
been trying to get clues online, but to no avail.


This is my error message:
2008-10-24 00:30:44.604 System Preferences[1164:10b] Tried to set an  
object of class NSCFArray for filter predicate of a controller  
[object class: printer, number of  
selected objects: 0]
2008-10-24 00:30:47.855 System Preferences[1164:10b] [NSPrefPaneBundle  
instantiatePrefPaneObject] (/Users/adam/Library/PreferencePanes/ 
Wopol.prefPane): should only be called once



Here's my WopolPref.m file at the moment.
#import "WopolPref.h"


@implementation WopolPref

- (id)initWithBundle:(NSBundle *)bundle
{
if (![super initWithBundle:bundle]) return nil;
appID = CFSTR("uk.co.pennynet.Wopol");
servers=[[NSMutableArray alloc] init];
printers=[[NSMutableArray alloc] init];
broadcastIP= @"255.255.255.255";
return self;
}

- (void) mainViewDidLoad
{
CFPropertyListRef value;
/*Initialise the broadcastIP textfield*/
value=CFPreferencesCopyAppValue( CFSTR("broadcastIP"), appID);
	if (value && CFGetTypeID(value) == CFStringGetTypeID()) [broadcastIP  
setStringValue:(NSString *)value];

else [broadcastIP setStringValue:(NSString *)@"255.255.255.255"];

/*Initialise the printers array*/

/*Initialise the servers array*/

/*release the value*/
if (value) CFRelease(value);
}

- (void) setPrinters:(NSMutableArray *)a;
{
	//Method for adding a new printer, with connected server and printer  
URI to the printers dict

if (a==printers) return;
[a retain];
[printers release];
printers = a;
}

- (void) setServers:(NSMutableArray *)a;
{
//Method for adding a new server, with mac address to the servers dict
if (a==servers) return;
[a retain];
[servers release];
servers = a;
}

@end


[NSPrefPaneBundle instantiatePrefPaneObject]

2008-10-24 00:30:44.604 System Preferences[1164:10b] Tried to set an  
object of class NSCFArray for filter predicate of a controller  
[object class: printer, number of  
selected objects: 0]
2008-10-24 00:30:47.855 System Preferences[1164:10b] [NSPrefPaneBundle  
instantiatePrefPaneObject] (/Users/adam/Library/PreferencePanes/ 
Wopol.prefPane): should only be called once

On Oct23, 2008, at 11:18 PM, glenn andreas wrote:



On Oct 23, 2008, at 4:10 PM, Adam Penny wrote:

Nope, I've triple checked the bindings and they're fine, but I do  
have two table views in two different tab views in my prefpane  
window, could that be causing some issues with their respective  
array controllers getting mixed up?


Adam

ADPServer has the keys
name
mac

ADPPrinter has the keys
name
host
uri


The source code you showed us had:
@implementation ADPPrinter
...
@synthesize name;
@synthesize server;
@synthesize uri;
@end

Note that the source says "server" and not "host" (which is what the  
runtime is looking for)



Glenn Andreas  [EMAIL PROTECTED]
 wicked fun!
Cardographer | the custom playing card designer




___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Mouse Coalescing

2008-10-23 Thread Ian was here
That seems to work well. I set a counter that decrements every time the 
mouseDragged: method is called. When the counter reaches zero, it draws the 
bezier path (as well as all the other objects in the view). Thanks.



--- On Sun, 10/19/08, Michael Ash <[EMAIL PROTECTED]> wrote:

> From: Michael Ash <[EMAIL PROTECTED]>
> Subject: Re: Mouse Coalescing
> To: "Cocoa Developers" 
> Date: Sunday, October 19, 2008, 7:54 PM
> On Sun, Oct 19, 2008 at 9:06 PM, Ian was here
> <[EMAIL PROTECTED]> wrote:
> > I have a drawing application that uses a pen tool to
> do free style drawing. I am using Quartz in OS X 10.4
> (NSBezierPath). The initial problem I had was not getting
> enough points between event cycles if the user moved the
> mouse too quickly. I turned off mouse coalescing with a call
> to SetMouseCoalescingEnabled( false, NULL ). This gave me
> beautiful drawing. Only problem is that it's slow and
> takes a while to catch up after the mouse up event.
> >
> > This is kind of an off the wall question, but is there
> another way to do this? I feel my only other option may be
> to use OPenGL, where the drawing would happen much faster.
> 
> As you hint, the problem is not mouse coalescing but
> performance.
> OpenGL won't help with this, because your drawing
> performance is going
> to be tied to the refresh rate of your monitor anyway.
> 
> So how do you fix it? Make your event handler run faster.
> But how can
> you do that if you can't make drawing go faster? Easy:
> decouple mouse
> event handling from drawing.
> 
> You'll want to disable coalescing as you have done. But
> then in the
> event handler, you do *not* want to redraw every time you
> get a mouse
> moved event. Doing so guarantees that once the rate of
> mouse-moved
> events exceeds your monitor's refresh rate (or your
> ability to draw,
> if it happens to be worse) then lag will develop.
> 
> Instead, do what I'd call "display
> coalescing". Don't redraw with
> every event. Instead, have a drawing flag. When you get a
> mouse event
> and the flag isn't set, set it and then post a custom
> event to the
> event queue. Then when you receive that custom event,
> redraw. This
> will essentially coalesce all the mouse moved events that
> were
> received while drawing so that you stay up to date with
> them. You will
> have to ensure that the non-drawing parts of your code
> always run
> faster than mouse events come in, but that should be
> trivial if you're
> just adding points to some sort of data structure.
> 
> 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/howlewere%40yahoo.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: BonjourSample from Hillegass (Advanced Mac OS X Programming)

2008-10-23 Thread Roland King
and how do you do that? There's no gui doodad for adding random  
directories that I could find and googling threw up mdimport but says  
that's a one-time indexing and won't be updated. I'd love to get some  
of that stuff in spotlight.



On Oct 24, 2008, at 12:30 AM, I. Savant wrote:


On Thu, Oct 23, 2008 at 12:16 PM, Jens Beuckenhauer
<[EMAIL PROTECTED]> wrote:

the "INET_TCP" isn't recognized on my 10.5 system. What do I have  
to put
there? I searched the documentation and many, many Webpages for the  
right

header file, only finding the sentence, "it is related to the system
implementation". When simply setting it to zero, the client cannot  
connect

to the server...


 Sounds like they forgot to mention that it's declared in
OT/OpenTransportProviders.h ... :-)  I recommend making sure Spotlight
indexes the /Developer folder (I don't think it does by default ...
mdimport /Developer will work). That way you can search for these
things quickly and easily.

--
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/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: NSInputStream Not Reading All Data

2008-10-23 Thread Roland King
are you sure the data is being sent? What's on the other end sending  
it, is it buffering data and not sending the last 216 bytes?



On Oct 24, 2008, at 2:37 AM, Thaddeus Cooper wrote:


Hi All.

I have an NSInputStream that I've set up on the run loop to read  
data from a socket. It's mostly working except that when I am  
sending it a large amount of data (say 30k), the last chunk of data  
never shows up. I have tried reading 1 byte, 10 bytes and 1024 bytes  
in the handleStream method and the last 216 bytes never show up.


I've looked in the archives and noticed that 3 years ago someone  
else had a similar problem -- but there was no followup.


The question I have is what do I need to do to get the last chunk of  
data off the stream. Below is a snippet of the code I'm using to  
read data off the stream inside handleEvent.


Thanks very much.

Thaddeus O. Cooper
([EMAIL PROTECTED])

while ([_inStream hasBytesAvailable]) {
len = [(NSInputStream *)stream read:buf maxLength:1024];
[data appendBytes:(const void *)buf length:len];
bytesRead = bytesRead + len;
}


___

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

Please do not post admin requests or moderator comments to the list.
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: BonjourSample from Hillegass (Advanced Mac OS X Programming)

2008-10-23 Thread I. Savant

On Oct 23, 2008, at 6:52 PM, Roland King wrote:

and how do you do that? There's no gui doodad for adding random  
directories that I could find and googling threw up mdimport but  
says that's a one-time indexing and won't be updated. I'd love to  
get some of that stuff in spotlight.


  In my previous post, tucked away in parentheses, I said:

mdimport /Developer

  ... fire up Terminal and type that bad boy right on in. ;-)

  It *is* one-time, and you'll need to run it any time you download  
documentation updates, but it's not too painful.


--
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]


NSData and NSImage

2008-10-23 Thread Andy Bell
Hi,

I have an NSData buffer with valid JPEG data which I can save to disk using
writeToFile: and view the image easily.  When I come to create an NSImage
object from the same data I get an object returned back from initWithData:
but the size property has dumb values.  What does this mean?  Is this a
valid NSImage object?

Thanks in advance
Andy
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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]


MVC

2008-10-23 Thread Max Radermacher

Hello:

I'm a n00b to cocoa and have heard a lot about MVC (Model View  
Controller). I don't fully understand it and was wondering if someone  
could point me in the direction of some good resources. Thanks.


digits
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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]


[NSOpenPanel] How to disable folder selection but still access their contents?

2008-10-23 Thread Iceberg-Dev

Solution not found in the cocoabuilder archive.

Problem:


I have a list of files and folders.

I can add items to this list through a standard NSOpenPanel dialog.

When a folder is already in the list, I want to prevent the user from  
selecting it from the NSOpenPanel dialog.


I can do this with:

- (BOOL) panel:(id)sender shouldShowFilename:(NSString *) inFileName;

The problem is that this prevents the user from selecting a file  
within this folder from the NSOpenDialog.


Question:
-

Is there a way to prevent a folder from being selected but still  
allow a file within this folder to be selected?




I could use - (BOOL)panel:(id)sender isValidFilename:(NSString *) 
filename; and always allow to select the folder but I want the user  
to know that the folder can not be selected and not just discover  
this when the Open button gets clicked.



___

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

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

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

This email sent to [EMAIL PROTECTED]


RE: Getting Carbon EventRef from cocoa NSEvent

2008-10-23 Thread Jesper Storm Bache
If you look in NSEvent.h you will see :

#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5

/* -eventRef and +eventWithEventRef:  are valid for all events */
/* -eventRef returns an EventRef corresponding to the NSEvent.  The EventRef is 
retained by the NSEvent, so will be valid as long as the NSEvent is valid, and 
will be released when the NSEvent is freed.  You can use RetainEvent to extend 
the lifetime of the EventRef, with a corresponding ReleaseEvent when you are 
done with it.  If there is no EventRef corresponding to the NSEvent, -eventRef 
will return NULL.
*/
- (const void * /* EventRef */)eventRef;
...


I.e. eventRef is only supported by Apple on 10.5 and newer.

Jesper


From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Rangaswamy C T [EMAIL 
PROTECTED]
Sent: Thursday, October 23, 2008 2:42 PM
To: cocoa-dev@lists.apple.com; [EMAIL PROTECTED]
Subject: Getting Carbon EventRef from cocoa NSEvent

Hi All,

For some requirement in my product, I have embedded my Carbon window inside 
Cocoa window using addChildWindow method.

For getting my carbon window UI (keyboard and mouse) events working, I had to 
watch cocoa events for NSWindow of Carbon window and then redispatch carbon 
eventRef’s to Carbon window using SendEventToEventTarget API.

So while converting Cocoa event to carbon events, I used the following piece of 
code

- (void)keyDown:(NSEvent *)theEvent
{
  OSStatus status;//1


  EventRef carbonEvnt;//2
carbonEvnt = (EventRef) [theEvent eventRef];//3
}

But the above NSEvent method eventRef is crashing (at 3) on Tiger. But on 
Leopard it works fine.

Am I doing anything wrong here?

Thanks


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: MVC

2008-10-23 Thread Nick Zitzmann


On Oct 23, 2008, at 2:09 PM, Max Radermacher wrote:

I'm a n00b to cocoa and have heard a lot about MVC (Model View  
Controller). I don't fully understand it and was wondering if  
someone could point me in the direction of some good resources.  
Thanks.



 :)

Nick Zitzmann


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSInputStream Not Reading All Data [SOLVED]

2008-10-23 Thread Thaddeus Cooper
Thanks to all who responded. It turns out the issue was the bytesRead  
count not being properly updated. The data was actually there...


Thaddeus O. Cooper
([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: NSData and NSImage

2008-10-23 Thread David Duncan

On Oct 23, 2008, at 11:30 AM, Andy Bell wrote:

I have an NSData buffer with valid JPEG data which I can save to  
disk using
writeToFile: and view the image easily.  When I come to create an  
NSImage
object from the same data I get an object returned back from  
initWithData:
but the size property has dumb values.  What does this mean?  Is  
this a

valid NSImage object?



What are the "dumb" values? The size that an NSImage reports are in  
points, not pixels, so if the image is recorded as having a DPI other  
than 72, then you will see values other than the pixel size of the  
image.

--
David Duncan
Apple DTS Animation and Printing

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: [NSOpenPanel] How to disable folder selection but still access their contents?

2008-10-23 Thread Corbin Dunn


On Oct 23, 2008, at 1:38 PM, Iceberg-Dev wrote:


Solution not found in the cocoabuilder archive.

Problem:


I have a list of files and folders.

I can add items to this list through a standard NSOpenPanel dialog.

When a folder is already in the list, I want to prevent the user  
from selecting it from the NSOpenPanel dialog.


I can do this with:

- (BOOL) panel:(id)sender shouldShowFilename:(NSString *) inFileName;

The problem is that this prevents the user from selecting a file  
within this folder from the NSOpenDialog.


Question:
-

Is there a way to prevent a folder from being selected but still  
allow a file within this folder to be selected?


Yes; I think just calling setCanChooseDirectories:NO will work.

If not, then:

1. Don't use shouldShowFilename:
2. Call setCanChooseDirectories:NO
3. Call beginForDirectory:.. types:(your types)

If you have to do some specific dynamic processing to turn on/off  
enabled types, then you may be out of luck.


Feel free to log a bug requesting to make this process easier. (I  
already do have some bugs logged for this ability to be easier, so I  
am aware of the problem).


-corbin
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: enumerating the NSApplication instances?

2008-10-23 Thread Andrew Farmer

On 23 Oct 08, at 14:55, Charles Steinman wrote:

--- On Thu, 10/23/08, Bill Janssen <[EMAIL PROTECTED]> wrote:

Charles Steinman <[EMAIL PROTECTED]> wrote:

You can't get NSApplication instances for other
applications.


Even as root?


It has nothing to do with user permissions. There is no API for  
getting NSApplication instances for arbitrary applications.


Primarily because those instances are in other applications' address  
spaces, which your application has no access to. As far as your  
application is concerned, they don't exist at all.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Hud window controls

2008-10-23 Thread Sandro Noel

Thank you pretty cool stuff 

Sandro

On 23-Oct-08, at 5:52 PM, Kiel Gillard wrote:

This framework looks pretty good too 


Kiel

On 24/10/2008, at 3:06 AM, I. Savant wrote:

On Thu, Oct 23, 2008 at 11:52 AM, Sandro Noel <[EMAIL PROTECTED]>  
wrote:


I am trying to design a HUD window, but the controls (buttons,  
edit boxes)

don't fit color wise, is there a property i should set
to have them look like the hud window?


There are no properties available to control this (they're all
Apple's own custom stuff), but there is this:

http://lipidity.com/apple/ilife-controls-hud-windows-and-more

It looks alright but I haven't tried it personally.

--
I.S.
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%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: Debugging preference pane

2008-10-23 Thread Adam Penny

Hi Nick, hi Glen,

Just a quick note to say that I've finally cracked the problem and  
thank you both very much for your help.


For that last bit, I was binding my array to the filter predicate (no  
idea what it is)of the array controller where I should have been  
binding to the content array.


Thanks again,

Adam




On Oct23, 2008, at 11:18 PM, glenn andreas wrote:



On Oct 23, 2008, at 4:10 PM, Adam Penny wrote:

Nope, I've triple checked the bindings and they're fine, but I do  
have two table views in two different tab views in my prefpane  
window, could that be causing some issues with their respective  
array controllers getting mixed up?


Adam

ADPServer has the keys
name
mac

ADPPrinter has the keys
name
host
uri


The source code you showed us had:
@implementation ADPPrinter
...
@synthesize name;
@synthesize server;
@synthesize uri;
@end

Note that the source says "server" and not "host" (which is what the  
runtime is looking for)



Glenn Andreas  [EMAIL PROTECTED]
 wicked fun!
Cardographer | the custom playing card designer




___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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 Design] Model Controller Rationale?

2008-10-23 Thread John Velman

On Fri, Oct 17, 2008 at 03:47:04PM -0400, Kyle Sluder wrote:
> On Fri, Oct 17, 2008 at 5:28 AM, Oleg Krupnov <[EMAIL PROTECTED]> wrote:
> > Is there any benefit in introducing a model controller, as another
> > layer of indirection between the model and the view controller? Or
> > should all business logic live right in the model? In what cases
> > having a separate model controller can be justified?
> 
> Your NSDocument subclass is a model controller.  Think of the model as
> being strictly the data your app works with -- all the NSStrings,
> NSDatas, and other value types that compose a meaningful
> file/document/whatever.  Your NSDocument subclass is the controller
> which manages all of that data in the context of the rest of your
> application.
> 
> This manifests itself a bit subtly.  For example, strictly speaking
> your app's data has no way of knowing how to save itself.  Your
> NSDocument subclass, in its role as model controller, does.
> 
> --Kyle Sluder


There isn't a question here, but if someone would care to comment on my
architecture and perspective, I'd be interested.

In my app, I'm using an external sqlite database (rather than core data for
a variety of reasons).

I need a rather large number of views with separate windows into the
database, including both browsing and editing.  So far, I've gotten one of
those implemented pretty satisfactorily for both me and my user (according
to reports so far).

I use a master window, which is owned by MyDocument, and various other Nib
based windows that are owned by custom window controllers.  These are
brought into being by actions of the user on the Master window. via
MyDocument.  The user views data or modifies it in these windows.

MyDocument is responsible for finding and opening the database.

MyDocument also alloc-inits various objects that do any SQL needed in
response to user actions in the various windows. I've always regarded these
as part of the model.

But based on Kyle's remarks, I now think it would be more proper to say
that they are part of a model controller layer, and only the database
itself is the model. So far, all they do is SQL, hold information about the
active interface, and hold array's that are shown in tables. 

If, there was computed data that was not part of the database itself, then
the objects taking care of this would (in a purist sense) be part of the
model.

I guess one way to look at it would be -- The objects that could be pulled
out and then run with a console based interface constitute the model.

In one sense it doesn't matter what I call these unless I want to describe
the architecture to a third party.  In another sense, it is important to
think of them in such a way as to encourage (for myself) appropriate MVC
modularization as I proceed.

Thanks for listening!

John Velman

> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/velman%40cox.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: MVC

2008-10-23 Thread Sherm Pendley
On Thu, Oct 23, 2008 at 4:09 PM, Max Radermacher <
[EMAIL PROTECTED]> wrote:

>
> I'm a n00b to cocoa and have heard a lot about MVC (Model View Controller).
> I don't fully understand it and was wondering if someone could point me in
> the direction of some good resources. Thanks.


<
http://developer.apple.com/documentation/Cocoa/Conceptual/ObjCTutorial/02Essence/chapter_2_section_4.html
>

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Problems when putting a window between desktop and desktop icons

2008-10-23 Thread Andreas Mayer


Am 23.10.2008 um 19:48 Uhr schrieb Markus Amalthea Magnuson:


Any other suggestions are welcome.


I did not see any reply to Charles' suggestion:

Am 21.10.2008 um 23:09 Uhr schrieb Charles Steinman:


Does [window setIgnoresMouseEvents:YES] work?


In case that does *not* work, you may need to additionally tell Carbon  
that you want the window to ignore mouse events:


- (void)setClickThrough:(BOOL)clickThrough
{
/* carbon */
void *ref = [window windowRef];
if (clickThrough) {
		ChangeWindowAttributes(ref, kWindowIgnoreClicksAttribute,  
kWindowNoAttributes);

} else {
		ChangeWindowAttributes(ref, kWindowNoAttributes,  
kWindowIgnoreClicksAttribute);

}
/* cocoa */
[window setIgnoresMouseEvents:clickThrough];
}


Andreas
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: /Library/Logs vs. user/Library/Logs

2008-10-23 Thread Jason Coco


On Oct 23, 2008, at 18:27 , Chris Markle wrote:


Jason,

Why not use ASL for logging? It's worked really well for me. I also  
have

an Obj-C class you can use that wraps ASL if you want.


Right now our app runs (for better or for worse) on Windows and OS X
with lots of common code between the two. I think ASL might work in
the future as we become more and more OS X-aware. Thanks for the
tip...


Ah, okay... in that case I suppose ~/Library/Logs is probably best.  
Definitely
look into ASL though, it's not difficult at all to wrap and would  
probably only
take you an hour to do... then it's really easy to search and sort for  
messages

from your application in OSX :)

J

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]

  1   2   >