How To Deal With Rounding Errors

2008-12-04 Thread Bridger Maxwell
Hey,
Short version of my question: I believe I am having rounding errors because
I am working with really, really small values. Would it help if I multiplied
these values by a scalar (say, 1,000), did math with them, and then divided
them by the scalar? I remember learning how IEEE floating point numbers are
stored, but I can't remember enough about it to know if this would have any
effect on precision. If not, what is a good way to get better precision? I
am already using doubles instead of floats.


Long explanation of my question:
In my project, I have users clicking and dragging to adjust values. I would
like to map values from the left-most of the view being zero, and the
right-most of the view to be one. This is fairly simple. However, it feels a
little unnatural if the value initially jumps to match where the mouse
clicks before dragging. For example, if the initial value is 0.3, and they
click in the middle of the view, the value jumps to 0.5. To take care of
this I construct a polynomial which maps 0 to 0, the right-most of the view
to 1, and the initial click location (middle) to the initial value (0.3).
This works very well, and feels natural. However, when any of the values
near the edges (the user clicks just off the left of the view), the values
go crazy. I believe this is because of a rounding error. The same question
still stands, would multiplying (and later dividing) everything by a scalar
help me get greater precision?

Thank You,
Bridger Maxwell
___

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

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


any control over NSRunAlertPanel placing on screen

2008-12-04 Thread Nick Rogers

Hi,
I want the alert panel to be placed in the middle of my main window.
Is it possible?

I gather that NSRunAlertPanelRelativeToWindow() is declared deprecated.


Thanks,
Nick
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: any control over NSRunAlertPanel placing on screen

2008-12-04 Thread Rob Keniger


On 04/12/2008, at 6:17 PM, Nick Rogers wrote:


I want the alert panel to be placed in the middle of my main window.
Is it possible?

I gather that NSRunAlertPanelRelativeToWindow() is declared  
deprecated.



If you have a window-specific alert, you should use a sheet:

http://developer.apple.com/documentation/Cocoa/Conceptual/Sheets/Tasks/UsingAlertSheets.html

--
Rob Keniger



___

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

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

2008-12-04 Thread EVS


Thank you, I suppose the reason I find it confusing  is because self  
is a pointer to the current object. If self were to release self ( the  
current object ), while it is being used, I would have guessed that  
would cause problems.


On Dec 4, 2008, at 12:39 AM, Nathan Day wrote:

Usually self does not change, when the instance returned is  
different to the initially self then it is because the super init  
has decided that the initial self is not what it whats so it  
releases the initially self and returns a different object.


This can happen for singltons or cluster object or perhaps in a  
suation where the object represents some resource and if there is  
already an object for that resource the new instance is released and  
a retained version of the original instance is returned in its place.


On 04/12/2008, at 06:14 , EVS wrote:


self = [super init];

Why does the above  line of code not cause a memory leak or memory  
fault?


___

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

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

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

This email sent to [EMAIL PROTECTED]




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Live image preview, huge memory usage...

2008-12-04 Thread Jean-Nicolas Jolivet
One last thing (I know, I'm annoying!..) I'm guessing its impossible  
to have this sweet workaround working in a thread right?


Thing is, I have a lot of images to generate.. so I do it in a  
separate thread... your trick works well (borrowing an onscreen  
graphic context), but as soon as I do it in a thread, the leak re- 
appears...


On 4-Dec-08, at 3:26 AM, Jean-Nicolas Jolivet wrote:


Just wanted to say that I got it to work finally! :)

basically I thought the last part of your code, where you render the  
CGImage in the current context was a necessary part of the trick, I  
realized that it wasn't hehe...


No noticeable leaks now! Thanks a lot for this trick!


On 3-Dec-08, at 8:27 PM, Rob Keniger wrote:



On 03/12/2008, at 6:22 PM, Jean-Nicolas Jolivet wrote:

Quick question (2 actually), right now Im drawing my CIImage in a  
custom view... would drawing the CIImage in my view's drawRect  
method achieve the same (leak-free) result as your piece of  
code??? i.e. something simple like:

snip


As far as I know, as long as you are drawing the CIImage to an on- 
screen context there will be no memory leak, so this should be fine  
if the view is in an on-screen window.


Second question; my app does batch image processing so eventually  
I will have to draw those CIImage offscreen.. (only for the Color  
Control Filter actually)... I assume I have to live with the leak??



No, just use the code I posted which will prevent the leak from  
occurring when drawing offscreen, you just have to get an existing  
on-screen context to draw into. The drawing itself happens  
offscreen, you are just borrowing the on-screen context. You  
could get the context from anywhere as long as it's a valid on- 
screen context - in the example I posted I used the main window's  
context ([[NSApp mainWindow] graphicsContext]) but this is not the  
only way to do it.


--
Rob Keniger



___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/silvertab%40videotron.ca

This email sent to [EMAIL PROTECTED]


Jean-Nicolas Jolivet
[EMAIL PROTECTED]
http://www.silverscripting.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/silvertab%40videotron.ca

This email sent to [EMAIL PROTECTED]


Jean-Nicolas Jolivet
[EMAIL PROTECTED]
http://www.silverscripting.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: self = [super init];

2008-12-04 Thread Stephen J. Butler
On Thu, Dec 4, 2008 at 2:32 AM, EVS [EMAIL PROTECTED] wrote:
 Thank you, I suppose the reason I find it confusing  is because self is a
 pointer to the current object. If self were to release self ( the current
 object ), while it is being used, I would have guessed that would cause
 problems.

You can call [self release] as long as you don't access (directly or
indirectly) self for the rest of the method. So if you keep from
touching instance variables or calling methods off self then things
will be fine. And if your caller knows somehow (like checking return
values, in the case of init) to not reference the released self then
everything is kosher.

In fact, the same is true in C++ with this, only a little more
pathologically so. You're allowed to call non-virtual member functions
off a bad this pointer because those functions are statically bound.
Causes confusion in every intro C++ course because students can't
figure out why their program is crashing in the middle of a method
call (when they finally access an instance variable off the bad this
pointer).

I even saw a horrible design pattern, probably on The Daily WTF, where
the programmer was doing singletons via something like:

((MyClass*)NULL)-getInstance();

Totally pathological, but nothing technically wrong with it as long as
you're careful.
___

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

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


Asynchronous timers (without a run loop)

2008-12-04 Thread Påhl Melin
I need to use timers in a low level library where I need to specify
asynchronous callbacks to a timer function. I will not have any run
loop so I cannot use NSTimer. Are there any low level timer API to use
instead? I haven't found anything useful (yet) on google nor ADC. I
assume there must exist some Mach or BSD level API:s that can be used?

Any suggestions?

/ Påhl
___

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

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

2008-12-04 Thread chaitanya pandit

Hi,
Okay so i have been debugging the problem for some time now and i find  
a weird thing happening.
Usually, the proposed rect that is passed to the text container in the  
lineFragmentRectForProposedRect: method has either very large width or  
extends to the right edge of the text container.
But i observed that some times i get a proposed like X=25; Y=18;  
Width=120; Height=14 even though i didn't return this as the remaining  
rect in the last call. I don't understand why it's X=25 instead of  
being 0.


Also Some times i get a NSZeroRect as the proposed rect.
Do you have any idea as in which cases the typesetter might call with  
such a proposed rect?


Also considering the above mentioned rect, say my container width is  
400, but there is a hole in the text container that will intersect the  
proposed rect say the square hole has  X=55; and Width=50

In this case should i divide proposed rect as:
rectToReturn : X=25; Y=18; Width=30; Height=14 rectRemained = X=105;  
Y=18; Width=15; Height=14


Or the rectRemained should extend till the right edge of the text  
container.


I'd appreciate any help.
Thanks,
Chaitanya

On 26-Nov-08, at 12:55 AM, Aki Inoue wrote:

The recursive invocation of layout is being trigged because the info  
between layout manager and text view got out of sync.

Does it still reproduce when you remove your overridden method ?

Also, I wonder if the infinite recursion is related to the initial  
recursive layout invocation at all.

Can you provide the bt of the final infinite recursion ?

Aki

On 2008/11/25, at 1:19, chaitanya pandit wrote:



Actually i'm doing nothing special in setLineFragmentRect... i  
simply note the fragment and call super's setLineFragmentRect...
What i observed is that the a new typesetter gets initialized only  
when i try to edit the text, and then it goes in to an infinite loop



On 25-Nov-08, at 12:35 AM, Aki Inoue wrote:

NSATSTypesetter trying to create a new instance is a normal  
behavior.
When the typesetter detects it's being invoked to layout  
recursively, it instantiates a copy.


The real culprit here is probably at #15 -[TTypesetter  
setLineFragmentRect:forGlyphRange:usedRect:baselineOffset:]   
that's triggering the recursive layout.




Aki

On 2008/11/23, at 22:45, chaitanya pandit wrote:

In my application i have an NSTextView with custom  
NSTextContainer and also a custom NSTypesetter, i have a problem  
with displaying HTML stuff in the textView.
I copied and pasted the entire contents of an html page ( it was  
news.google.com to be precise), it displays it fine, but whenever  
i try to edit the text contents, my app goes into an infinite loop.


While debugging i observed a very weird thing, a new typesetter  
is getting initialized within the  
layoutCharactersInRange:forLayoutManager:maximumNumberOfLineFragments 
 method.

Any idea about what might be going wrong?
I'd appreciate any help.

Here is the trace(note the  #0):

#0  0x00077a35 in -[TTypesetter init] at TTypesetter.m:25
#1	0x907691a9 in -[NSATSTypesetter  
layoutCharactersInRange:forLayoutManager:maximumNumberOfLineFragments 
:]
#2	0x00077c08 in -[TTypesetter  
layoutCharactersInRange:forLayoutManager:maximumNumberOfLineFragments 
:] at TTypesetter.m:95
#3	0x90455f77 in -[NSLayoutManager(NSPrivate)  
_fillLayoutHoleForCharacterRange:desiredNumberOfLines:isSoft:]

#4  0x905953b6 in _NSFastFillAllLayoutHolesForGlyphRange
#5	0x9051e0ba in -[NSLayoutManager(NSPrivate)  
_firstPassGlyphRangeForBoundingRect:inTextContainer:okToFillHoles:]
#6	0x9051cff1 in -[NSLayoutManager(NSPrivate)  
_glyphRangeForBoundingRect:inTextContainer:fast:okToFillHoles:]
#7	0x9051ce27 in -[NSLayoutManager  
glyphRangeForBoundingRect:inTextContainer:]
#8	0x9051c35e in -[NSTextView  
setNeedsDisplayInRect:avoidAdditionalLayout:]

#9  0x9051be8b in -[NSTextView setNeedsDisplayInRect:]
#10 0x903be662 in -[NSView setNeedsDisplay:]
#11 0x9051cb82 in -[NSTextView textContainerOrigin]
#12	0x90521b8f in -[NSLayoutManager(NSPrivate)  
_resizeTextViewForTextContainer:]
#13	0x90406ed0 in -[NSLayoutManager(NSPrivate)  
_updateUsageForTextContainer:addingUsedRect:]
#14	0x9045be46 in -[NSLayoutManager  
setLineFragmentRect:forGlyphRange:usedRect:]
#15	0x00078688 in -[TTypesetter  
setLineFragmentRect:forGlyphRange:usedRect:baselineOffset:] at  
TTypesetter.m:325
#16	0x90420776 in -[NSATSTypesetter  
_layoutLineFragmentStartingWithGlyphAtIndex:characterIndex:atPoint:renderingContext 
:]

#17 0x904583db in -[NSATSTypesetter layoutParagraphAtPoint:]
#18	0x00077ba8 in -[TTypesetter layoutParagraphAtPoint:] at  
TTypesetter.m:86
#19	0x90400bcd in -[NSTypesetter  
_layoutGlyphsInLayoutManager:startingAtGlyphIndex:maxNumberOfLineFragments:maxCharacterIndex:nextGlyphIndex:nextCharacterIndex 
:]
#20	0x909ed6f6 in -[NSTypesetter  
layoutCharactersInRange:forLayoutManager:maximumNumberOfLineFragments 
:]
#21	0x90769238 in -[NSATSTypesetter  

Re: Determining unreleased objects after Quit

2008-12-04 Thread jmunson

Namaste!

I never did figure it out *exactly*.  Over time, as I made  
corrections/edits (mostly in the NIB), the problem simply ceased to  
exist.


I think it was mashed bindings...as some had gotten toasted for  
whatever reason.


Peace, Love, and Light,

/s/ Jon C. Munson II

Quoting Michael Ash [EMAIL PROTECTED]:


On Wed, Dec 3, 2008 at 11:57 AM, Jon C. Munson II [EMAIL PROTECTED] wrote:
Well, simply put, the application is still running.  That is, after  
 Quitting, the Stop button is enabled, and, if I try to run it   
again, I get a message to terminate the currently running version   
first...


So the problem is not unreleased objects, it's that your app is still
running. Hit the pause button in the debugger and figure out what it's
doing.

Mike





___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Linking CFBundle with static libraries

2008-12-04 Thread frank

On 4 Dec 2008, at 05:33, Nick Zitzmann wrote:



On Dec 3, 2008, at 7:33 AM, frank wrote:

The reason I have elected to use CFBundle is that I require the  
ability to load and unload plugins and as far as I have seen, this is

not possible with NSBundle. See:


It doesn't matter; CFBundle and NSBundle are two sides of a coin.  
They aren't toll-free bridged, however.


And C and C++ bundles can be unloaded. In Tiger and earlier,  
Objective-C bundles couldn't be unloaded in any way whatsoever. I'm  
not sure if this was addressed in Leopard.


ld: absolute addressing (perhaps -mdynamic-no-pic) used in ___tcf_0  
from /Users/botmanx/Documents/src/trunk/Build/Debug/libboost- 
filesystem.a(error_code.o) not allowed in slidable image. Use '- 
read_only_relocs suppress' to enable text relocs


On seeing this, I added the '-read_only_relocs suppress' CFlag to  
my build options as the compiler suggested but the error remains.

Does anyone know how I might get around this problem?



Are you sure the static library was built correctly? Libraries of  
any sort cannot contain position-independent code, and that linker  
error suggests that the static library was compiled with the - 
mdynamic-no-pic option. Do you have the source code for the static  
library?


Nick Zitzmann
http://www.chronosnet.com/



Hi Nick,

the problem was with the way I was building my libraries; I was using  
the Generate Position-Dependent Code from the GCC 4.0 Code  
Generation options. Once I disabled this my bundle built without any  
problems.


Thanks for your help!

Best Regards,
Frank




___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Programmatically loading an NSImage via other field

2008-12-04 Thread jmunson

In response to all the responses...

This monitoring needs to happen whether the user types in a field,  
or, there is a choice made via NSOpenPanel, or the record is scrolled  
(meaning moved next, moved previous).


So, using the beginning of the KVO below (which is the route I  
suspected I'd have to go, but not sure exactly how), would I need to  
add other delegate methods to handle the other cases?


Also, is dragging the delegate from the text field to the File's Owner  
the same as the awake from NIB call, or do I need to add the  
awakFromNIB as well?


Thanks!

Peace, Love, and Light,

/s/ Jon C. Munson II

Quoting Ken Tozier [EMAIL PROTECTED]:


Something like this should get you in the ballpark

MyController : NSObject
{
IBOutlet NSTextField*imagePathField;
IBOutlet NSImageView*imageView;
}

// register controller to receive messages from the text field
- (void) awakeFromNib
{
[imagePathField setDelegate: self];
}

// when user hits return key, the text field calls this handler
allowing you to respond
- (void) controlTextDidEndEditing:(NSNotification *) inNotification
{
// check message type
if ([[inNotification name] isEqualToString:
NSControlTextDidEndEditingNotification])
{
// type OK, check which object sent message. (can be used to 
respond
to multipe text fields)
if ([inNotification object] == imagePathField)
{
// get text from field and try to load it into a new 
image
NSImage *tempImage  = [NSImage 
imageWithContentsOfFIe:
[imagePathField stringValue]];

// set the image in the image view
if (tempImage != nil)
[imageView setImage: tempImage];
}
}
}


On Dec 3, 2008, at 10:23 PM, [EMAIL PROTECTED] wrote:


Namaste!

OK, I'm beat for the day...

I'm struggling with how to load an image into an NSImage via   
another field's value.


I have a field that contains a path  name of an image file.  The   
user can type it in or select it via OpenFile sheet.  This works   
just fine and I'm setting the underlying data object so the value   
persists.


Now, my question:  how do I get that value to propagate over to the image?

In Windows, I can monitor via the onChange event for the textbox.
Piece of cake.


Here, though, I'm a bit perplexed.

I thought perhaps the textDidChange delegate method might do it (I   
put that in my File's Owner, and made the File's Owner a delegate   
of the NSTextField that contains the image name).  However, it   
doesn't fire e'en though the text clearly changes (onscreen).


So, how do I accomplish this should-be-easy feat?

Thanks!

Peace, Love, and Light,

/s/ Jon C. Munson II

___

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

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

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


NSTimer

2008-12-04 Thread Mahaboob
Hi,
I need to fire the thread repeatedly in regular time intervals. So I used
the timer like:
timer =  [[NSTimer scheduledTimerWithTimeInterval:(double)[txtTimeinterval
doubleValue] target:self selector:@selector(myThread:) userInfo:nil
repeats:YES]retain];

It is working but, the thread is fired only after the the time interval I
had given. But actually I need to begin the thread in 0Sec and then keep the
regular time interval. For that I used the code :
NSDate* theDate = [NSDate dateWithTimeIntervalSinceReferenceDate:0];
 [[timer initWithFireDate:theDate interval:(double)[txtTimeinterval
doubleValue] target:self selector:@selector(myThread:) userInfo:nil
repeats:YES]retain];

But it is not firing the thread.
Where I got wrong?
How can I do this?

Thanks in advance
mahaboob


___

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

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

2008-12-04 Thread Nathan Day
NSRunLoop use to be based on the function select() (it was in GnuStep  
anyway), it waits for inputs but also has a single timeout value also,  
NSRunLoop works out how long the timeout value should be for the  
shortest NSTimer. If you want to wait on multiple timers without using  
run NSRunLoop then you will have to implement this kind of  
functionality yourself. You can then just use sleep() to make your  
thread wait.


On 04/12/2008, at 9:32 PM, Påhl Melin wrote:


I need to use timers in a low level library where I need to specify
asynchronous callbacks to a timer function. I will not have any run
loop so I cannot use NSTimer. Are there any low level timer API to use
instead? I haven't found anything useful (yet) on google nor ADC. I
assume there must exist some Mach or BSD level API:s that can be used?

Any suggestions?

/ Påhl
___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: self = [super init];

2008-12-04 Thread mmalcolm crawford


On Dec 3, 2008, at 2:14 PM, EVS wrote:

Why does the above  line of code not cause a memory leak or memory  
fault?



This may be of interest:
	http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_4_section_4.html 



mmalc

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How To Deal With Rounding Errors

2008-12-04 Thread Nathan Day
The way floats work the round will always be to the same number of  
bits no matter what the order of magnitude (ignoring the extreme  
values  2^-1023 for doubles). Check that you haven't let any integers  
into you calculations.


On 04/12/2008, at 7:08 PM, Bridger Maxwell wrote:


Hey,
Short version of my question: I believe I am having rounding errors  
because
I am working with really, really small values. Would it help if I  
multiplied
these values by a scalar (say, 1,000), did math with them, and then  
divided
them by the scalar? I remember learning how IEEE floating point  
numbers are
stored, but I can't remember enough about it to know if this would  
have any
effect on precision. If not, what is a good way to get better  
precision? I

am already using doubles instead of floats.


Long explanation of my question:
In my project, I have users clicking and dragging to adjust values.  
I would

like to map values from the left-most of the view being zero, and the
right-most of the view to be one. This is fairly simple. However, it  
feels a
little unnatural if the value initially jumps to match where the  
mouse
clicks before dragging. For example, if the initial value is 0.3,  
and they
click in the middle of the view, the value jumps to 0.5. To take  
care of
this I construct a polynomial which maps 0 to 0, the right-most of  
the view
to 1, and the initial click location (middle) to the initial value  
(0.3).
This works very well, and feels natural. However, when any of the  
values
near the edges (the user clicks just off the left of the view), the  
values
go crazy. I believe this is because of a rounding error. The same  
question
still stands, would multiplying (and later dividing) everything by a  
scalar

help me get greater precision?

Thank You,
Bridger Maxwell
___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How To Deal With Rounding Errors

2008-12-04 Thread Andrew Farmer

On 04 Dec 08, at 00:08, Bridger Maxwell wrote:
Short version of my question: I believe I am having rounding errors  
because
I am working with really, really small values. Would it help if I  
multiplied
these values by a scalar (say, 1,000), did math with them, and then  
divided
them by the scalar? I remember learning how IEEE floating point  
numbers are
stored, but I can't remember enough about it to know if this would  
have any
effect on precision. If not, what is a good way to get better  
precision? I

am already using doubles instead of floats.


No; if anything, multiplying by a constant will reduce your precision  
slightly.


If you're having precision issues with doubles, you are probably  
manipulating your intermediate values in such a way as to destroy  
precision (loss of significance). A common culprit is subtracting  
two values of nearly equal value. Without knowing what your math looks  
like, it's hard to guess what might be at fault, but rearranging your  
float math to avoid this sort of thing may improve your results.


Goldberg's What Every Computer Scientist Should Know About Floating  
Point is a worthwhile read, and covers this issue (as well as many  
other pitfalls) in great detail:


http://www.engr.pitt.edu/hunsaker/3097/floatingpoint.pdf
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How To Deal With Rounding Errors

2008-12-04 Thread Ricky Sharp


On Dec 4, 2008, at 6:37 AM, Andrew Farmer wrote:


On 04 Dec 08, at 00:08, Bridger Maxwell wrote:
Short version of my question: I believe I am having rounding errors  
because
I am working with really, really small values. Would it help if I  
multiplied
these values by a scalar (say, 1,000), did math with them, and then  
divided
them by the scalar? I remember learning how IEEE floating point  
numbers are
stored, but I can't remember enough about it to know if this would  
have any
effect on precision. If not, what is a good way to get better  
precision? I

am already using doubles instead of floats.


No; if anything, multiplying by a constant will reduce your  
precision slightly.


If you're having precision issues with doubles, you are probably  
manipulating your intermediate values in such a way as to destroy  
precision (loss of significance). A common culprit is subtracting  
two values of nearly equal value. Without knowing what your math  
looks like, it's hard to guess what might be at fault, but  
rearranging your float math to avoid this sort of thing may improve  
your results.


Goldberg's What Every Computer Scientist Should Know About Floating  
Point is a worthwhile read, and covers this issue (as well as many  
other pitfalls) in great detail:


http://www.engr.pitt.edu/hunsaker/3097/floatingpoint.pdf


One common thing to do when working with very small values (i.e.  
values close to zero), is to order your operations.  For example, if  
you have a set of values that you want to compute a sum, adding them  
in smallest to largest order will often be different than largest to  
smallest.


___
Ricky A. Sharp mailto:[EMAIL PROTECTED]
Instant Interactive(tm)   http://www.instantinteractive.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: Asynchronous timers (without a run loop)

2008-12-04 Thread Påhl Melin
Yes, I could set up a new thread, handling a list of usleep()
intervals between the actual timer events but it would be very hard to
make a reliable, drift-free timer service, handling lots of timer
events and it would take quite some time to develop a fully functional
and reliable version. I really hope I don't have to...

In the Kernel Programming Guide in ADC, chapter 7, Mach Overview, Time
Management, it says:

The mach_timespec_t API is deprecated in Mac OS X. The newer and
preferred API is based on timer objects
that in turn use AbsoluteTime as the basic data type. AbsoluteTime is
a machine-dependent type, typically
based on the platform-native time base. Routines are provided to
convert AbsoluteTime values to and from
other data types, such as nanoseconds. Timer objects support
asynchronous, drift-free notification, cancellation,
and premature alarms. They are more efficient and permit higher
resolution than clocks.

Does anyone know about this new API or any higher level API build on
it? I sounds like a good candidate for my project.

/ Påhl

2008/12/4 Nathan Day [EMAIL PROTECTED]:
 NSRunLoop use to be based on the function select() (it was in GnuStep
 anyway), it waits for inputs but also has a single timeout value also,
 NSRunLoop works out how long the timeout value should be for the shortest
 NSTimer. If you want to wait on multiple timers without using run NSRunLoop
 then you will have to implement this kind of functionality yourself. You can
 then just use sleep() to make your thread wait.

 On 04/12/2008, at 9:32 PM, Påhl Melin wrote:

 I need to use timers in a low level library where I need to specify
 asynchronous callbacks to a timer function. I will not have any run
 loop so I cannot use NSTimer. Are there any low level timer API to use
 instead? I haven't found anything useful (yet) on google nor ADC. I
 assume there must exist some Mach or BSD level API:s that can be used?

 Any suggestions?

 / Påhl
 ___

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

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

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

 This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Asynchronous timers (without a run loop)

2008-12-04 Thread Jean-Daniel Dupas


Le 4 déc. 08 à 14:00, Påhl Melin a écrit :


Yes, I could set up a new thread, handling a list of usleep()
intervals between the actual timer events but it would be very hard to
make a reliable, drift-free timer service, handling lots of timer
events and it would take quite some time to develop a fully functional
and reliable version. I really hope I don't have to...

In the Kernel Programming Guide in ADC, chapter 7, Mach Overview, Time
Management, it says:

The mach_timespec_t API is deprecated in Mac OS X. The newer and
preferred API is based on timer objects
that in turn use AbsoluteTime as the basic data type. AbsoluteTime is
a machine-dependent type, typically
based on the platform-native time base. Routines are provided to
convert AbsoluteTime values to and from
other data types, such as nanoseconds. Timer objects support
asynchronous, drift-free notification, cancellation,
and premature alarms. They are more efficient and permit higher
resolution than clocks.

Does anyone know about this new API or any higher level API build on
it? I sounds like a good candidate for my project.

/ Påhl

2008/12/4 Nathan Day [EMAIL PROTECTED]:

NSRunLoop use to be based on the function select() (it was in GnuStep
anyway), it waits for inputs but also has a single timeout value  
also,
NSRunLoop works out how long the timeout value should be for the  
shortest
NSTimer. If you want to wait on multiple timers without using run  
NSRunLoop
then you will have to implement this kind of functionality  
yourself. You can

then just use sleep() to make your thread wait.

On 04/12/2008, at 9:32 PM, Påhl Melin wrote:


I need to use timers in a low level library where I need to specify
asynchronous callbacks to a timer function. I will not have any run
loop so I cannot use NSTimer. Are there any low level timer API to  
use

instead? I haven't found anything useful (yet) on google nor ADC. I
assume there must exist some Mach or BSD level API:s that can be  
used?


Any suggestions?





If you want to avoid Cocoa, Cocoa-dev is probably not the best mailing  
list to ask.

You will have more chance on darwin-dev.

What do you mean by low-leve ? What prevent you to use NS classes ?
Is this contraint preventing you to use CoreFoundation ?  (which is  
low-level IMHO).


If you want lower level primitive, you can use kevent's timers, or if  
you want really low-level, there is a mach timer API, but I don't  
think it is considere public as the header cannot be found in /usr/ 
include/mach
Anyway, that's the API used in CoreFoundation for CFTimer and declared  
in mk_timer.h (see XNU sources for details). But I wont go this way in  
a shipping product.



___

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

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

2008-12-04 Thread Jean-Daniel Dupas


Le 4 déc. 08 à 15:17, Påhl Melin a écrit :


2008/12/4 Jean-Daniel Dupas [EMAIL PROTECTED]:
If you want to avoid Cocoa, Cocoa-dev is probably not the best  
mailing list

to ask.
You will have more chance on darwin-dev.


I don't want to avoid Cocoa, but I just haven't found any Cocoa class
that supports timers without a run loop. But maybe I need to switch to
darwin-dev.


What do you mean by low-leve ? What prevent you to use NS classes ?
Is this contraint preventing you to use CoreFoundation ?  (which is
low-level IMHO).


Nothing prevents me from using NS classes per se. I will use the
timers in a C++ class and want to get a callback to a normal
function—not calling a selector on an Objective-C class that most NS
classes would do. And since it's supposed to be the lowest level of my
architecture I want it to be as efficient as possible.

The only problem I have is that I will run the timers on threads
without run loops so both NSTimer and CFRunLoopTimer (I didn't find
any reference information about CFTimer on ADC) are impossible to use.



Of course, CFTimer was a shortened form for CFRunLoopTimer.

If you use timer, you need some primitive function that waits until  
one timer trigger. I don't understand what is the difference between  
waiting using select, kevent,
or any other primitive and waiting using CFRunLoopRun(). All threads  
have a runloop (or create one when needed), so I really don't  
understand what is the problem here.


For kevent, I'm surprised the doc say so, it look like it is  
implemented (at least in 10.4.11 and 10.5 XNU sources).



If you want lower level primitive, you can use kevent's timers, or  
if you
want really low-level, there is a mach timer API, but I don't think  
it is

considere public as the header cannot be found in /usr/include/mach


In the man page for kevent it says that kevent timers are not
supported (EVFILT_TIMER This filter is currently unsupported.). I
just assumed that the man page was correct and haven't made any tests.
Are you sure kevent timers are implemented in Mac OS X? When it comes
to Mach timers I wouldn't dare to use that in a commercial product
since Apple seems to ask developers to keep away from Mach.

Anyway, that's the API used in CoreFoundation for CFTimer and  
declared in

mk_timer.h (see XNU sources for details). But I wont go this way in a
shipping product.


Agree... I will keep away from any private API:s.

/ Påhl



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Programmatically loading an NSImage via other field

2008-12-04 Thread jmunson

In continuance...

Alright, so it isn't strictly KVO...:)  But it looks like it...:)

Anyway, is there a way to know when the stuff in the cell changes?

Most everything I can find is relative to when the user interacts with  
the control.  But I can't find anything, as yet, for when the user  
doesn't, but the code does...


For instance, when the window displays, there is a value in the text  
field for the path/image.  Yet the image doesn't load.  Is there an  
event/method that I can utilize to push the image?  I only found  
windowDidLoad, which didn't do it.


It also appears that I'll have to implement mine own  
MoveNext/MovePrevious methods in order to push the picture (although I  
still need to test that first).


Thanks!

Peace, Love, and Light,

/s/ Jon C. Munson II


Quoting [EMAIL PROTECTED]:


In response to all the responses...

This monitoring needs to happen whether the user types in a field,
or, there is a choice made via NSOpenPanel, or the record is scrolled
(meaning moved next, moved previous).

So, using the beginning of the KVO below (which is the route I
suspected I'd have to go, but not sure exactly how), would I need to
add other delegate methods to handle the other cases?

Also, is dragging the delegate from the text field to the File's Owner
the same as the awake from NIB call, or do I need to add the
awakFromNIB as well?

Thanks!

Peace, Love, and Light,

/s/ Jon C. Munson II

Quoting Ken Tozier [EMAIL PROTECTED]:


Something like this should get you in the ballpark

MyController : NSObject
{
IBOutlet NSTextField*imagePathField;
IBOutlet NSImageView*imageView;
}

// register controller to receive messages from the text field
- (void) awakeFromNib
{
[imagePathField setDelegate: self];
}

// when user hits return key, the text field calls this handler
allowing you to respond
- (void) controlTextDidEndEditing:(NSNotification *) inNotification
{
// check message type
if ([[inNotification name] isEqualToString:
NSControlTextDidEndEditingNotification])
{
// type OK, check which object sent message. (can be used to 
respond
to multipe text fields)
if ([inNotification object] == imagePathField)
{
// get text from field and try to load it into a new 
image
NSImage *tempImage  = [NSImage 
imageWithContentsOfFIe:
[imagePathField stringValue]];

// set the image in the image view
if (tempImage != nil)
[imageView setImage: tempImage];
}
}
}


On Dec 3, 2008, at 10:23 PM, [EMAIL PROTECTED] wrote:


Namaste!

OK, I'm beat for the day...

I'm struggling with how to load an image into an NSImage via
another field's value.


I have a field that contains a path  name of an image file.  The   
 user can type it in or select it via OpenFile sheet.  This works   
 just fine and I'm setting the underlying data object so the value  
  persists.


Now, my question:  how do I get that value to propagate over to the image?

In Windows, I can monitor via the onChange event for the textbox.   
  Piece of cake.


Here, though, I'm a bit perplexed.

I thought perhaps the textDidChange delegate method might do it (I  
  put that in my File's Owner, and made the File's Owner a  
delegate   of the NSTextField that contains the image name).   
However, it   doesn't fire e'en though the text clearly changes  
(onscreen).


So, how do I accomplish this should-be-easy feat?

Thanks!

Peace, Love, and Light,

/s/ Jon C. Munson II

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kentozier%40comcast.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/jmunson%40his.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/jmunson%40his.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.

Webview and streaming data

2008-12-04 Thread Reza Farhad

Dear all

I am loading a web page that has a Quicktime streaming file. I was  
expecting to get the load delegate message didFinishLoadForFrame for  
the main frame when all the page is loaded and the movie starts  
playing, but the message is not called at that stage. Does anyone know  
how I can get to know that the page is fully loaded just before the  
movie starts playing.


Thanks

Reza
___

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

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

2008-12-04 Thread Joseph Kelly

You could call [self myThread:nil] after you start your timer.

Joe K.


On Dec 4, 2008, at 3:17 AM, Mahaboob wrote:


Hi,
I need to fire the thread repeatedly in regular time intervals. So I  
used

the timer like:
timer =  [[NSTimer scheduledTimerWithTimeInterval:(double) 
[txtTimeinterval

doubleValue] target:self selector:@selector(myThread:) userInfo:nil
repeats:YES]retain];

It is working but, the thread is fired only after the the time  
interval I
had given. But actually I need to begin the thread in 0Sec and then  
keep the

regular time interval. For that I used the code :
NSDate* theDate = [NSDate dateWithTimeIntervalSinceReferenceDate:0];
[[timer initWithFireDate:theDate interval:(double)[txtTimeinterval
doubleValue] target:self selector:@selector(myThread:) userInfo:nil
repeats:YES]retain];

But it is not firing the thread.
Where I got wrong?
How can I do this?

Thanks in advance
mahaboob


___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Asynchronous timers (without a run loop)

2008-12-04 Thread Påhl Melin
2008/12/4 Jean-Daniel Dupas [EMAIL PROTECTED]:

 Le 4 déc. 08 à 15:17, Påhl Melin a écrit :

 2008/12/4 Jean-Daniel Dupas [EMAIL PROTECTED]:

 If you want to avoid Cocoa, Cocoa-dev is probably not the best mailing
 list
 to ask.
 You will have more chance on darwin-dev.

 I don't want to avoid Cocoa, but I just haven't found any Cocoa class
 that supports timers without a run loop. But maybe I need to switch to
 darwin-dev.

 What do you mean by low-leve ? What prevent you to use NS classes ?
 Is this contraint preventing you to use CoreFoundation ?  (which is
 low-level IMHO).

 Nothing prevents me from using NS classes per se. I will use the
 timers in a C++ class and want to get a callback to a normal
 function—not calling a selector on an Objective-C class that most NS
 classes would do. And since it's supposed to be the lowest level of my
 architecture I want it to be as efficient as possible.

 The only problem I have is that I will run the timers on threads
 without run loops so both NSTimer and CFRunLoopTimer (I didn't find
 any reference information about CFTimer on ADC) are impossible to use.


 Of course, CFTimer was a shortened form for CFRunLoopTimer.

 If you use timer, you need some primitive function that waits until one
 timer trigger. I don't understand what is the difference between waiting
 using select, kevent,
 or any other primitive and waiting using CFRunLoopRun(). All threads have a
 runloop (or create one when needed), so I really don't understand what is
 the problem here.

The difference is that my threads will not have any run loops. They
will run all the time or sleep on a blocking primitive in my
framework. Only Cocoa threads automatically have a run loop (my
interpretation). I will run my threads using the pthread library
directly so no run loops are created.

 For kevent, I'm surprised the doc say so, it look like it is implemented (at
 least in 10.4.11 and 10.5 XNU sources).

That's interesting. I will check it out. The man page is from april
14, 2000, so maybe Apple just forgot to update it.



 If you want lower level primitive, you can use kevent's timers, or if you
 want really low-level, there is a mach timer API, but I don't think it is
 considere public as the header cannot be found in /usr/include/mach

 In the man page for kevent it says that kevent timers are not
 supported (EVFILT_TIMER This filter is currently unsupported.). I
 just assumed that the man page was correct and haven't made any tests.
 Are you sure kevent timers are implemented in Mac OS X? When it comes
 to Mach timers I wouldn't dare to use that in a commercial product
 since Apple seems to ask developers to keep away from Mach.

 Anyway, that's the API used in CoreFoundation for CFTimer and declared in
 mk_timer.h (see XNU sources for details). But I wont go this way in a
 shipping product.

 Agree... I will keep away from any private API:s.

 / Påhl



___

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

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

2008-12-04 Thread Joseph Kelly
I've used both the CF and NS timer apis in many different situations  
without a hitch. They're fairly reliable. Perhaps you could explain  
your can't use a runloop restriction -- e.g. if you are writing a  
daemon or a kext, this is not the list you want to post to.


You might find if you refactor your design a bit, that it will take to  
a runloop model quite well. In fact, most of the user space IOKit  
async routines require that you use a runloop.


Also, the Mach APIs are not strictly private -- the headers are  
publicly available. They are subject to change between releases, so if  
you do start using them, you will need to stay on top of things --  
check your binaries on pre-release OS seeds etc.


Joe K.

On Dec 4, 2008, at 6:17 AM, Påhl Melin wrote:


2008/12/4 Jean-Daniel Dupas [EMAIL PROTECTED]:
If you want to avoid Cocoa, Cocoa-dev is probably not the best  
mailing list

to ask.
You will have more chance on darwin-dev.


I don't want to avoid Cocoa, but I just haven't found any Cocoa class
that supports timers without a run loop. But maybe I need to switch to
darwin-dev.


What do you mean by low-leve ? What prevent you to use NS classes ?
Is this contraint preventing you to use CoreFoundation ?  (which is
low-level IMHO).


Nothing prevents me from using NS classes per se. I will use the
timers in a C++ class and want to get a callback to a normal
function—not calling a selector on an Objective-C class that most NS
classes would do. And since it's supposed to be the lowest level of my
architecture I want it to be as efficient as possible.

The only problem I have is that I will run the timers on threads
without run loops so both NSTimer and CFRunLoopTimer (I didn't find
any reference information about CFTimer on ADC) are impossible to use.

If you want lower level primitive, you can use kevent's timers, or  
if you
want really low-level, there is a mach timer API, but I don't think  
it is

considere public as the header cannot be found in /usr/include/mach


In the man page for kevent it says that kevent timers are not
supported (EVFILT_TIMER This filter is currently unsupported.). I
just assumed that the man page was correct and haven't made any tests.
Are you sure kevent timers are implemented in Mac OS X? When it comes
to Mach timers I wouldn't dare to use that in a commercial product
since Apple seems to ask developers to keep away from Mach.

Anyway, that's the API used in CoreFoundation for CFTimer and  
declared in

mk_timer.h (see XNU sources for details). But I wont go this way in a
shipping product.


Agree... I will keep away from any private API: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: Asynchronous timers (without a run loop)

2008-12-04 Thread Påhl Melin
2008/12/4 Joseph Kelly [EMAIL PROTECTED]:
 I've used both the CF and NS timer apis in many different situations without
 a hitch. They're fairly reliable. Perhaps you could explain your can't use
 a runloop restriction -- e.g. if you are writing a daemon or a kext, this
 is not the list you want to post to.

I'm not writing a daemon or a kext. I'm porting a framework that I've
designed and used on .Net before that will form the foundation of my
architecture for my future Mac OS applications (I'm new to Mac OS
programming). The framework is used for easy communication and
synchronization between threads, processes and computers (with the
same syntax) and make it possible to design an application in small
modules that communicates via messages and it's straightforward to
start with the modules as threads in a single application and then
split into several processes on a computer or ever distribute certain
modules to other computers without changing much (or any) code at all.
But mainly it makes it easier to write efficient multithreaded
applications that work.

I'm very happy with the messaging framework and would like to use it
on Mac OS X as well. Run loops are not compatible with this approach
since my threads need to run forever or block in my framework when
they are waiting for messages (the timers are used to generate timer
messages internally in the framework). The threads are not event
driven and will not return to the run loop.

 You might find if you refactor your design a bit, that it will take to a
 runloop model quite well. In fact, most of the user space IOKit async
 routines require that you use a runloop.

I don't want to refactor my design. :-) To do that, I would have
give up the framework design completely. I'm generally happy with the
design just want to make a good port to Mac OS X.

 Also, the Mach APIs are not strictly private -- the headers are publicly
 available. They are subject to change between releases, so if you do start
 using them, you will need to stay on top of things -- check your binaries on
 pre-release OS seeds etc.

Okay, thats great to know. But I suppose it's still begging for
trouble, if you can avoid it.

 Joe K.
___

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

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

2008-12-04 Thread Jean-Daniel Dupas


Le 4 déc. 08 à 15:50, Påhl Melin a écrit :


2008/12/4 Jean-Daniel Dupas [EMAIL PROTECTED]:


Le 4 déc. 08 à 15:17, Påhl Melin a écrit :


2008/12/4 Jean-Daniel Dupas [EMAIL PROTECTED]:


If you want to avoid Cocoa, Cocoa-dev is probably not the best  
mailing

list
to ask.
You will have more chance on darwin-dev.


I don't want to avoid Cocoa, but I just haven't found any Cocoa  
class
that supports timers without a run loop. But maybe I need to  
switch to

darwin-dev.

What do you mean by low-leve ? What prevent you to use NS  
classes ?

Is this contraint preventing you to use CoreFoundation ?  (which is
low-level IMHO).


Nothing prevents me from using NS classes per se. I will use the
timers in a C++ class and want to get a callback to a normal
function—not calling a selector on an Objective-C class that most NS
classes would do. And since it's supposed to be the lowest level  
of my

architecture I want it to be as efficient as possible.

The only problem I have is that I will run the timers on threads
without run loops so both NSTimer and CFRunLoopTimer (I didn't find
any reference information about CFTimer on ADC) are impossible to  
use.




Of course, CFTimer was a shortened form for CFRunLoopTimer.

If you use timer, you need some primitive function that waits until  
one
timer trigger. I don't understand what is the difference between  
waiting

using select, kevent,
or any other primitive and waiting using CFRunLoopRun(). All  
threads have a
runloop (or create one when needed), so I really don't understand  
what is

the problem here.


The difference is that my threads will not have any run loops. They
will run all the time or sleep on a blocking primitive in my
framework. Only Cocoa threads automatically have a run loop (my
interpretation). I will run my threads using the pthread library
directly so no run loops are created.



My understanding is that ALL threads have a runloop (from the  
CFRunLoop doc):


«There is exactly one run loop per thread. You neither create nor  
destroy a thread’s run loop. Core Foundation automatically creates it  
for you as needed. »


As CoreFoundation is not part of Cocoa, I doubt that only Cocoa thread  
can have a CFRunLoop. (In fact, I do not doubt, i'm pretty sure  
CoreFoundation is based on pthread and do not use Cocoa at all).


I did tool that do not use obj-c at all and use pthread and CFRunLoop  
to managed networks events (using CFSocket) and it works just as it  
should.


For kevent, I'm surprised the doc say so, it look like it is  
implemented (at

least in 10.4.11 and 10.5 XNU sources).


That's interesting. I will check it out. The man page is from april
14, 2000, so maybe Apple just forgot to update it.




If you want lower level primitive, you can use kevent's timers,  
or if you
want really low-level, there is a mach timer API, but I don't  
think it is

considere public as the header cannot be found in /usr/include/mach


In the man page for kevent it says that kevent timers are not
supported (EVFILT_TIMER This filter is currently unsupported.). I
just assumed that the man page was correct and haven't made any  
tests.
Are you sure kevent timers are implemented in Mac OS X? When it  
comes

to Mach timers I wouldn't dare to use that in a commercial product
since Apple seems to ask developers to keep away from Mach.

Anyway, that's the API used in CoreFoundation for CFTimer and  
declared in
mk_timer.h (see XNU sources for details). But I wont go this way  
in a

shipping product.


Agree... I will keep away from any private API:s.

/ Påhl




___

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

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

2008-12-04 Thread Matthew Johnson
As far as I know it's the only way, all the examples I've ever seen  
use a similar method. Array iteration is pretty fast and I can only  
imagine it being slow for a very large data set. I've definitely  
never had performance issues with it, but I am not creating large  
trees.


I also would love to hear from Apple if there's a better way. It's  
certainly a shame there is not more example code out there.


I agree it's a shame.  There are plenty of examples for simpler  
binding scenarios, but none I have found for custom views binding to  
NSTreeController.  I really appreciate your sample will do something  
similar if I don't find a better way.


You're right that it will be fast for smaller data sets.  The problem  
is that it should be a constant time operation and your code is much  
more expensive than that.  Depending on the implementation of  
removeItemsInArray your code is at least O(n) and it is likely to be O 
(n2). That will not scale to large data sets very well.


Matthew

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Programmatically loading an NSImage via other field

2008-12-04 Thread Ken Tozier
My example wasn't, strictly speaking, KVO. To set up an observer you  
would need to do something like the following


@interface

MYController : NSObject
{
IBOutlet NSTextField *imagePath;
}

@end

@implementation

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

return self;
}

- (void) addObservers
{
[imagePath addObserver: self
forKeyPath: @value
options: NSKeyValueObservingOptionOld | 
NSKeyValueObservingOptionNew
context: NULL];
}

- (void) observeValueForKeyPath:(NSString *) inKeyPath
ofObject:(id) inObject
change:(NSDictionary *) inChange
context:(void *) inContext
{
if ([inKeyPath isEqualToString: @value])
{
if (inObject == imagePath)
{
			NSString	*oldValue = [[inChange objectForKey:  
NSKeyValueChangeOldKey] stringValue],
		*newValue = [[inChange objectForKey: NSKeyValueChangeNewKey]  
stringValue];


			/* decide whether the difference between  oldValue and newValue  
warrants loading a new image */

}
}
}

I'm not 100 percent certain you can bind to the value of a text field  
this way (haven't tried it) but the above is the way you observe  
properties of objects. Another approach would be to write a subclass  
of NSTextField and override the setValue method. That way, whenever  
something tries to change the field, you know about it.


- (void) setValue:(id) inVaue
{
[super setValue: inVaue];

/* do image load here if change warrants an action */
}

As to dragging connectors, that doesn't set up a binding, it basically  
just associates a GUI element with a property of your controller. It  
just says this text field corresponds with this outlet in my  
controller. It gives you a way to refer to specific gui objects in  
your code which you can see used in addObservers above. There are no  
actions associated with this connection you have to establish the  
behavior yourself using bindings, kvo, subclassing etc


On Dec 4, 2008, at 5:55 AM, [EMAIL PROTECTED] wrote:


In response to all the responses...

This monitoring needs to happen whether the user types in a field,  
or, there is a choice made via NSOpenPanel, or the record is  
scrolled (meaning moved next, moved previous).


So, using the beginning of the KVO below (which is the route I  
suspected I'd have to go, but not sure exactly how), would I need to  
add other delegate methods to handle the other cases?


Also, is dragging the delegate from the text field to the File's  
Owner the same as the awake from NIB call, or do I need to add the  
awakFromNIB as well?


Thanks!

Peace, Love, and Light,

/s/ Jon C. Munson II

Quoting Ken Tozier [EMAIL PROTECTED]:


Something like this should get you in the ballpark

MyController : NSObject
{
IBOutlet NSTextField*imagePathField;
IBOutlet NSImageView*imageView;
}

// register controller to receive messages from the text field
- (void) awakeFromNib
{
[imagePathField setDelegate: self];
}

// when user hits return key, the text field calls this handler
allowing you to respond
- (void) controlTextDidEndEditing:(NSNotification *) inNotification
{
// check message type
if ([[inNotification name] isEqualToString:
NSControlTextDidEndEditingNotification])
{
		// type OK, check which object sent message. (can be used to  
respond

to multipe text fields)
if ([inNotification object] == imagePathField)
{
// get text from field and try to load it into a new 
image
NSImage *tempImage  = [NSImage 
imageWithContentsOfFIe:
[imagePathField stringValue]];

// set the image in the image view
if (tempImage != nil)
[imageView setImage: tempImage];
}
}
}


On Dec 3, 2008, at 10:23 PM, [EMAIL PROTECTED] wrote:


Namaste!

OK, I'm beat for the day...

I'm struggling with how to load an image into an NSImage via   
another field's value.


I have a field that contains a path  name of an image file.  The   
user can type it in or select it via OpenFile sheet.  This works   
just fine and I'm setting the underlying data object so the value   
persists.


Now, my question:  how do I get that value to propagate over to  
the image?


In Windows, I can monitor via the onChange event for the  
textbox.   Piece of cake.


Here, though, I'm a bit perplexed.

I thought perhaps the textDidChange delegate method might do it  
(I  put that in my File's Owner, and made the File's Owner a  
delegate  of the NSTextField that contains the image name).   
However, it  doesn't fire e'en though the text clearly changes  
(onscreen).


So, how do I accomplish this should-be-easy feat?

Thanks!


Re: Asynchronous timers (without a run loop)

2008-12-04 Thread Jeremy Pereira
If I were trying to generate an asynchronous timer event in C I'd  
probably just run a thread in a tight loop calling poll (man 2 poll  
for details) each time round with a timeout equal to your timer  
interval and no other events.  And when the poll returns do whatever  
processing you need on your timer.


Will that not work for you?

Otherwise your question seems to be How can I use any of the high  
level Mac OS X timer facilities without using the high level Mac OS X  
timer facilities? for which there is, of course, no answer.


On 4 Dec 2008, at 15:14, Påhl Melin wrote:


2008/12/4 Joseph Kelly [EMAIL PROTECTED]:
I've used both the CF and NS timer apis in many different  
situations without
a hitch. They're fairly reliable. Perhaps you could explain your  
can't use
a runloop restriction -- e.g. if you are writing a daemon or a  
kext, this

is not the list you want to post to.


I'm not writing a daemon or a kext. I'm porting a framework that I've
designed and used on .Net before that will form the foundation of my
architecture for my future Mac OS applications (I'm new to Mac OS
programming). The framework is used for easy communication and
synchronization between threads, processes and computers (with the
same syntax) and make it possible to design an application in small
modules that communicates via messages and it's straightforward to
start with the modules as threads in a single application and then
split into several processes on a computer or ever distribute certain
modules to other computers without changing much (or any) code at all.
But mainly it makes it easier to write efficient multithreaded
applications that work.

I'm very happy with the messaging framework and would like to use it
on Mac OS X as well. Run loops are not compatible with this approach
since my threads need to run forever or block in my framework when
they are waiting for messages (the timers are used to generate timer
messages internally in the framework). The threads are not event
driven and will not return to the run loop.

You might find if you refactor your design a bit, that it will take  
to a

runloop model quite well. In fact, most of the user space IOKit async
routines require that you use a runloop.


I don't want to refactor my design. :-) To do that, I would have
give up the framework design completely. I'm generally happy with the
design just want to make a good port to Mac OS X.

Also, the Mach APIs are not strictly private -- the headers are  
publicly
available. They are subject to change between releases, so if you  
do start
using them, you will need to stay on top of things -- check your  
binaries on

pre-release OS seeds etc.


Okay, thats great to know. But I suppose it's still begging for
trouble, if you can avoid it.


Joe K.

___

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

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

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


String Constant containing 2 ASCII Control Chars

2008-12-04 Thread Jerry Krinock
I'd like to define a global string constant consisting of two ASCII  
start-of-text (STX, 0x02) characters.


The following ^code^ will create such a thing:

NSString* two = [[NSString alloc] initWithFormat:@%C%C, 0x2,  
0x2] ;


and I realize that I could put it in some +initialize method for a  
class that was guaranteed to be created, but that solution is rather  
fragile, non-portable, etc.


I also appreciate that I'm creating an object, but gee it's a really  
simple object, and since Xcode can do this:


NSString* const hello = @Hello ;

Is there a way to put non-printing characters in a constant string  
like that?


Thanks,

Jerry Krinock
___

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

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

2008-12-04 Thread Thomas Brian
On Thu, Dec 4, 2008 at 12:17 PM, Mahaboob [EMAIL PROTECTED] wrote:

 Hi,
 For that I used the code :
 NSDate* theDate = [NSDate dateWithTimeIntervalSinceReferenceDate:0];


Unless I am mistaken, this will create a date set to January 1st, 2001. To
get a date representing now, you can use [NSDate date].
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: String Constant containing 2 ASCII Control Chars

2008-12-04 Thread Jean-Daniel Dupas


Le 4 déc. 08 à 16:42, Jerry Krinock a écrit :

I'd like to define a global string constant consisting of two ASCII  
start-of-text (STX, 0x02) characters.


The following ^code^ will create such a thing:

   NSString* two = [[NSString alloc] initWithFormat:@%C%C, 0x2,  
0x2] ;



and I realize that I could put it in some +initialize method for a  
class that was guaranteed to be created, but that solution is  
rather fragile, non-portable, etc.


I also appreciate that I'm creating an object, but gee it's a really  
simple object, and since Xcode can do this:


NSString* const hello = @Hello ;

Is there a way to put non-printing characters in a constant string  
like that?




Yes, either using octal escape sequence

NSString *two = @\2\2;

or hexa escape sequence

NSString *two = @\x2\x2;



___

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

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

2008-12-04 Thread David Springer
I don't mean to sound patronizing, but unless I have missed some fundamental
premise, didn't you just re-invent DO?  Maybe the right way to port this
framework is to make your API a thin wrapper on top of Obj-C messages, and
your set up a wrapper on top of DO setup.  Just a thought.
- Dave.S

On Thu, Dec 4, 2008 at 8:41 AM, Jeremy Pereira [EMAIL PROTECTED] wrote:

 If I were trying to generate an asynchronous timer event in C I'd probably
 just run a thread in a tight loop calling poll (man 2 poll for details) each
 time round with a timeout equal to your timer interval and no other events.
  And when the poll returns do whatever processing you need on your timer.

 Will that not work for you?

 Otherwise your question seems to be How can I use any of the high level
 Mac OS X timer facilities without using the high level Mac OS X timer
 facilities? for which there is, of course, no answer.

 On 4 Dec 2008, at 15:14, Påhl Melin wrote:

  2008/12/4 Joseph Kelly [EMAIL PROTECTED]:

 I've used both the CF and NS timer apis in many different situations
 without
 a hitch. They're fairly reliable. Perhaps you could explain your can't
 use
 a runloop restriction -- e.g. if you are writing a daemon or a kext,
 this
 is not the list you want to post to.


 I'm not writing a daemon or a kext. I'm porting a framework that I've
 designed and used on .Net before that will form the foundation of my
 architecture for my future Mac OS applications (I'm new to Mac OS
 programming). The framework is used for easy communication and
 synchronization between threads, processes and computers (with the
 same syntax) and make it possible to design an application in small
 modules that communicates via messages and it's straightforward to
 start with the modules as threads in a single application and then
 split into several processes on a computer or ever distribute certain
 modules to other computers without changing much (or any) code at all.
 But mainly it makes it easier to write efficient multithreaded
 applications that work.

 I'm very happy with the messaging framework and would like to use it
 on Mac OS X as well. Run loops are not compatible with this approach
 since my threads need to run forever or block in my framework when
 they are waiting for messages (the timers are used to generate timer
 messages internally in the framework). The threads are not event
 driven and will not return to the run loop.

  You might find if you refactor your design a bit, that it will take to a
 runloop model quite well. In fact, most of the user space IOKit async
 routines require that you use a runloop.


 I don't want to refactor my design. :-) To do that, I would have
 give up the framework design completely. I'm generally happy with the
 design just want to make a good port to Mac OS X.

  Also, the Mach APIs are not strictly private -- the headers are publicly
 available. They are subject to change between releases, so if you do
 start
 using them, you will need to stay on top of things -- check your binaries
 on
 pre-release OS seeds etc.


 Okay, thats great to know. But I suppose it's still begging for
 trouble, if you can avoid it.

  Joe K.

 ___

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

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

 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/adc%40jeremyp.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/dspringer%40google.com

 This email sent to [EMAIL PROTECTED]




-- 
http://go/OnlyCheckEmailTwiceADay - join the movement
___

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

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

2008-12-04 Thread Jon C. Munson II
Just to close the thread...

This problem resolved itself.  I didn't do nothing...

I suspect kaboshed bindings in a window/form.

Peace, Love, and Light,
 

Jon C. Munson II
And Jesus looking upon them saith, With men it is impossible, but not with
God: for with God all things are possible. [Mark 10:27; KJV]
I sign Peace, Love, and Light for at least two reasons.  First, it is my
truest desire for this planet and her people to live in Peace, with Love,
and in the Light of God.  Second, to be an Ascended Master, one must Be.  As
I wish to Be an Ascended Master (someday if not sooner), I must also Be -
thus I choose to Be Peace, Love, and Light as much as I can for everyone and
am therefore reflecting those thoughts to you.

-Original Message-
From: Joseph Kelly [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 03, 2008 4:27 PM
To: [EMAIL PROTECTED]; cocoa dev
Subject: Re: Determining unreleased objects after Quit


On Dec 3, 2008, at 9:06 AM, Randall Meadows wrote:

 On Dec 3, 2008, at 9:38 AM, Jon C. Munson II wrote:

 Namaste!

 In my application, when I choose File-Quit, the application  
 appears to
 terminate.  HOWEVER, it doesn't.  SOMETHING(s) is(are) left  
 unreleased.

 Is there a handy way to determine what the object(s) is(are)?

 When your app quits, all of its memory used it released back to the  
 system.  However, your deallocs and such will NOT be called, since  
 that would be a waste of time since everything's going to be  
 released back to the system anyway.  It's a shortcut, and usually is  
 in your best interest.

 It can, however, bite you in certain situations, specifically non- 
 memory resources that you need to do something with at termination.   
 In my case, I needed to release access to a camera, so I had to do  
 some of my cleanup work in -applicationWillTerminate:.

This is correct. I'm not sure exactly the mechanism -- and I suspect  
it has something to do with Mach ports owned by the process which are  
not shut down correctly -- but I've encountered a case where my app  
appears open in the Dock, but does not appear in the bsd, Process  
Manager, or Mach process lists. This only happens when the app  
terminates abnormally, and our shutdown sequence does not execute.

I've also noticed that aborting a Debug session in Xcode 3.1.1 will  
sometimes result in the app not quite going away, I presume also as a  
result of having mach ports in a weird state.

Joe K.

___

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

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

2008-12-04 Thread Adam R. Maxwell


On Dec 4, 2008, at 4:47 PM, Mahaboob wrote:


Hi,
I need to fire the thread repeatedly in regular time intervals. So I  
used

the timer like:
timer =  [[NSTimer scheduledTimerWithTimeInterval:(double) 
[txtTimeinterval

doubleValue] target:self selector:@selector(myThread:) userInfo:nil
repeats:YES]retain];

It is working but, the thread is fired only after the the time  
interval I
had given. But actually I need to begin the thread in 0Sec and then  
keep the

regular time interval. For that I used the code :
NSDate* theDate = [NSDate dateWithTimeIntervalSinceReferenceDate:0];
[[timer initWithFireDate:theDate interval:(double)[txtTimeinterval
doubleValue] target:self selector:@selector(myThread:) userInfo:nil
repeats:YES]retain];

But it is not firing the thread.
Where I got wrong?


at least the following:

1) you appear to be misusing the initializer; you should have timer =  
[[NSTimer alloc] initWithFireDate...];


2) you should be using theDate = [NSDate dateWithTimeIntervalSinceNow:0]

3) you haven't added the timer to a runloop, so it's never scheduled,  
and will never fire





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: Controlled Font Substitution

2008-12-04 Thread Gerriet M. Denkmann


On 4 Dec 2008, at 01:34, Aki Inoue wrote:

Mac OS X ships with Thonburi as the Thai system font, and that's the  
font usually you get for Thai character substitution.
Yes. And Thonburi is much more readable than Lucida Grande, which was  
used on Tiger.



The font substitution system is applying sophisticated algorithm to  
closely match font traits, and it appears it's causing the random  
fallback.
The most sophisticated algorithm cannot work correctly if supplied  
with wrong data:
starting from Monaco (a mono spaced font) it probably should look for  
another mono spaced font containing Thai characters.
But the Apple supplied Ayuthaya font, which looks very much like a  
mono spaced font to me, has no NSFontMonoSpaceTrait set, and returns  
isFixedPitch = NO.



In the meantime, if you want to control the font substitution  
behavior, you can create fonts with NSFontDescriptor that has custom  
NSFontCascadeListAttribute.


I added the following:

CGFloat size = [ font pointSize ];
	NSFontDescriptor *fode2 = [ NSFontDescriptor fontDescriptorWithName:  
@Ayuthaya size: size ];

NSArray *fodArray = [ NSArray arrayWithObject: fode2 ];
	NSDictionary *fodDict = [ NSDictionary dictionaryWithObject: fodArray  
forKey: NSFontCascadeListAttribute ];	

NSFontDescriptor *fode1 = [ font fontDescriptor ];
	NSFontDescriptor *fode0 = [ fode1 fontDescriptorByAddingAttributes:  
fodDict ];

font = [ NSFont fontWithDescriptor: fode0 size: size ];

and now my app displays readable mono spaced Thai characters.
Thank you very much!


But Console.app and Terminal.app were still using UPC-Angsana.
So I moved the font from ~/Library/Fonts to /ibrary/Fonts which  
obviously changed the order in which fonts were searched.
Now both Console.app and Terminal.app create nice and readable Thai  
characters.



Kind regards,

Gerriet.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Asynchronous timers (without a run loop)

2008-12-04 Thread Julien Jalon
The question itself does not make a lot of sense for me. A timer API is
tightly bound to the underlying framework that is idling your thread.
If the idling API is CFRunLoopRun(), you'd use CFTimers, if your idling API
is select() or kevent(), you'd use their timeout parameters.

So, for what you seem to say, it's your framework responsibility to provide
some asynchronous timer API. If it does not, your only choice is to
simulate the timer using other means:
- the easy one: one thread that sleeps() for each timer then messages back
to your threads
- a more complex one is to use a dedicated thread that will effectively run
a CFRunLoop and bridge your timers over CFTimers.
- you could imagine using signal() +SIGALRM bug using Unix signals here is
really not something you should try to use except if you really know what
you are doing.

-- 
Julien

On Thu, Dec 4, 2008 at 4:14 PM, Påhl Melin [EMAIL PROTECTED] wrote:

 2008/12/4 Joseph Kelly [EMAIL PROTECTED]:
  I've used both the CF and NS timer apis in many different situations
 without
  a hitch. They're fairly reliable. Perhaps you could explain your can't
 use
  a runloop restriction -- e.g. if you are writing a daemon or a kext,
 this
  is not the list you want to post to.

 I'm not writing a daemon or a kext. I'm porting a framework that I've
 designed and used on .Net before that will form the foundation of my
 architecture for my future Mac OS applications (I'm new to Mac OS
 programming). The framework is used for easy communication and
 synchronization between threads, processes and computers (with the
 same syntax) and make it possible to design an application in small
 modules that communicates via messages and it's straightforward to
 start with the modules as threads in a single application and then
 split into several processes on a computer or ever distribute certain
 modules to other computers without changing much (or any) code at all.
 But mainly it makes it easier to write efficient multithreaded
 applications that work.

 I'm very happy with the messaging framework and would like to use it
 on Mac OS X as well. Run loops are not compatible with this approach
 since my threads need to run forever or block in my framework when
 they are waiting for messages (the timers are used to generate timer
 messages internally in the framework). The threads are not event
 driven and will not return to the run loop.

  You might find if you refactor your design a bit, that it will take to a
  runloop model quite well. In fact, most of the user space IOKit async
  routines require that you use a runloop.

 I don't want to refactor my design. :-) To do that, I would have
 give up the framework design completely. I'm generally happy with the
 design just want to make a good port to Mac OS X.

  Also, the Mach APIs are not strictly private -- the headers are publicly
  available. They are subject to change between releases, so if you do
 start
  using them, you will need to stay on top of things -- check your binaries
 on
  pre-release OS seeds etc.

 Okay, thats great to know. But I suppose it's still begging for
 trouble, if you can avoid it.

  Joe K.
 ___

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

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

 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/jjalon%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: Linking CFBundle with static libraries

2008-12-04 Thread Nick Zitzmann


On Dec 4, 2008, at 3:48 AM, frank wrote:

the problem was with the way I was building my libraries; I was  
using the Generate Position-Dependent Code from the GCC 4.0 Code  
Generation options. Once I disabled this my bundle built without  
any problems.



Yeah, that would do it. That option only works with applications; it  
makes libraries unusable.


Nick Zitzmann
http://www.chronosnet.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: Asynchronous timers (without a run loop)

2008-12-04 Thread Joseph Kelly


On Dec 4, 2008, at 7:14 AM, Påhl Melin wrote:


I'm very happy with the messaging framework and would like to use it
on Mac OS X as well. Run loops are not compatible with this approach
since my threads need to run forever or block in my framework when
they are waiting for messages (the timers are used to generate timer
messages internally in the framework).


To give you some perspective, that's exactly what Runloops do. They  
block a thread indefinitely until a message comes in, at which point  
the thread unblocks and begins executing some kind of callback  
routine. When the callback returns, the thread blocks again until the  
next message comes in. Runloops are simply an abstraction that  
associates an arbitrary thread with a set (or sets) of triggers which  
cause the thread to unblock and do something.


So for instance, to give you a top level overview of how this might  
work -- this is a rough C example, but could be adapted to an OOP model:


CFRunLoopRef gWorkerThreadRLoop = NULL; // this could be a global  
variable or a member variable of a C++ or ObjC object.


main(...)
{
	SpawnAThread(MyThreadRoutine);	// you could use pthreads, or  
NSThread, or even Boost threads.

while(gWorkerThreadRLoop == NULL);  // prbly add a timeout / sleep 
here.

// init some other stuff
... Run the Main Thread's Runloop...
		// Something causes us to wake up, so lets forward a message to the  
worker thread:

TriggerAMessage(gWorkerThreadRLoop, msg1);  
TriggerAMessage(gWorkerThreadRLoop, msg2);
...
// time to quit
CFRunLoopStop(gWorkerThreadRLoop)
}

MyThreadRoutine(...)
{
	gWorkerThreadRLoop = CFRunLoopGetCurrent();	// this will  
automatically/implicitly create the runloop associated w/ this thread.

... add the timer and other sources...  
CFRunLoopRun();
... remove my sources / timers...
   gWorkerThreadRLoop = NULL;
}

MsgDispatcher(incomingMsg)	// this gets called on the worker thread in  
response to TriggerAMessage

{
// Dispatch the incomingMsg
}

If this looks suitable, I can give you more details about how to  
implement.


Joe K.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to display simple dialog at application startup?

2008-12-04 Thread Erik Buck
See http://www.stepwise.com/Articles/2006/eb1/index.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]


[NSButtonCell] How to ask for refresh when a window resigns from being the key window

2008-12-04 Thread Stéphane Sudre

I have a subclass of NSButtonCell that uses a customized version of:

- (void) drawImage:(NSImage*) inImage withFrame:(NSRect) inFrame  
inView:(NSView*) inControlView;


for radio buttons.

The issue I have is when the window that contains the cell resigns  
from being the key window:


- If the state of the cell is NSOnState, the cell is refreshed.

- If the state of the cell is NSOffState, the cell is not refreshed  
(this is probably an optimization since in the standard case, the look  
is the same when the window is either key or not).


Problem:


I want the cell to be refreshed even if the state is NSOnState.


Question:
-

Which method should be overwritten to request a refresh whatever the  
state of the cell is?



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Big picture relationships between NSConnection, NSInputStream, NSOutputStream etc

2008-12-04 Thread Michael Ash
On Thu, Dec 4, 2008 at 1:22 AM, Ken Tozier [EMAIL PROTECTED] wrote:
 Thanks Mike

 Still trying to get my head around this stuff, but here's how I interpret
 what I need to do...

 Create a connection to MySQL
#define DEFAULT_MYSQL_PORT_NUMBER   3306
socket  = [[NSSocketPort alloc] initRemoteWithTCPPort:
 DEFAUT_MYSQL_PORT_NUMBER host: @some host];

 Register as the delegate of the port
[socket setDelegate: self];

 Add to run loop
[[NSRunLoop mainRunLoop] addPort: socket forMode:
 NSDefaultRunLoopMode];

 Here's where I lose the thread. As the delegate, do I need to implement
- (void) handlePortMessage:(NSPortMessage *) inPortMessage

 Or, because I'm dealing with something that has no concept of NSPortMessage,
 do I need to use NSInput/NSOutput streams?

Yes. NSPort is part of the Distributed Objects system. It's possible
to use NSPort on its own, but you must use it to talk to another
process which also uses NSPort. It is *possible* to use NSSocketPort
to create a socket which you then communicate with using other
techniques, but you can't use NSSocketPort directly to talk to a
non-Cocoa app.

 If so, where in the process do I
 squeeze those in?

Just replace the above code with code that creates a pair of NSStreams
to your target.

 Also very confused about which stream I would receive
 replies from MySQL (assuming I could successfully connect) If I send a
 message through an NSOutputStream, wouldn't MySQL send the reply back
 through the same stream? I don't see how it could do otherwise as it has no
 idea who the client app is, or how to connect and build it's own NSOutput
 stream with which to reply.

You'll have a pair of NSStreams which wrap the same socket. When you
write to your NSOutputStream the data will be written to the socket,
and when the other end writes to the socket, it will appear on your
NSInputStream.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Live image preview, huge memory usage...

2008-12-04 Thread Erik Buck
See http://theocacao.com/document.page/497
See http://www.wilshipley.com/blog/2005/09/jpeg2000-cool-but-slow.html
See 
http://www.macresearch.org/cocoa-tutorial-image-kit-and-image-browser-views-part-i
See 
http://www.macresearch.org/cocoa-tutorial-image-kit-cover-flow-and-quicklook-doing-things-we-shouldnt-are-too-fun-resist
 
 
 
___

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

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

2008-12-04 Thread Scott Ribe
A few things to note:

As was already pointed out, you meant if(newName != nil) [newName release],
but note that it's not an error to send a message to nil (as long as you're
not using a return value, then there are rules as to whether it's safe or
not), so you could just do [newName release].

Also, retain returns the argument for a good reason, to allow you to write
newName = [[stockName stringValue] retain].

Finally, what if the current value of newName and [stockName stringValue]
are the same instance? Then you're releasing it before you're retaining it.
In this case, stockName has still retained it, so no harm done. But consider
a method like this:

-(void) setSomeValue: (NSString*) newVal {
[curVal release];
curVal = [newVal retain];
}

If you call that with the same value that curVal already has, and no other
code anywhere is holding a retain, then you can wind up dealloc'ing curVal,
which is newVal, before you retain it.

So, a couple of ways to deal with this:

-(void) setSomeValue: (NSString*) newVal {
[curVal autorelease];
curVal = [newVal retain];
}

-(void) setSomeValue: (NSString*) newVal {
if( newVal != curVal ) {
[curVal release];
curVal = [newVal retain];
}
}

Or use properties, or use garbage collection--assuming your project's
targeted versions/platforms will allow you to.

Above all, read this before going any further:

http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Tasks/
MemoryManagementRules.html


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


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Programmatically loading an NSImage via other field

2008-12-04 Thread jmunson

Namaste!

OK, I've been playing around with this for too long now...

NOTHING gets called when text in a control is set via code or a  
mechanism other than strict keyboard/mouse entry by the user from what  
I can determine.  This, in a word, is not good.


I've set up an observer, delegates, and all that, per previous posts  
and only when keys are actually pressed do the delegate methods get  
called.


Also, I've noticed that when the record is moved (either next or  
previous), there is a buffer time between when code executes and the  
interface gets changed.


Thus:

- (IBAction)movePrevious:(id)sender
{
[tblPattern selectPrevious:self];
[btnPrevious setEnabled:[tblPattern canSelectPrevious]];
[self pushPicture];
}

Doesn't work.  The Apple dox state the reason the move action is moved  
to another process is to give the error mechanism a way to respond.


As a consequence, nothing changes and the code executes, then the  
stuff changes.  What happens is the previous image gets loaded as the  
current image, despite what the textfield says.


Not good.

For a simple OnChange thing, this is absolutely frustrating (and has  
resulted in quite a bit of code).


Bottom line is, it looks like I need some way to see changes that  
were made to either the underlying Cell (thinking along the lines of  
display changes) or some other route to take this.


I have three scenarios under which the image needs to get pushed:

1.  When selected from a file.
2.  On Window display - first record is displayed.
3.  When records are scrolled (Move Next/Move Previous).

I've solved #1, though I don't like having to manually push the  
image (meaning I call the pushPicture routine).  2  3 are still  
unsolved at this point.


Any further thoughts???  Anyone else only keep paths to images and  
dynamically load from that data?  Storing the pictures in the data  
structure is not going to happen as they'll take up far too much space  
and suck resources.


Thanks for all the help so far!

Peace, Love, and Light,

/s/ Jon C. Munson II

___

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

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

2008-12-04 Thread Keary Suska


On Dec 4, 2008, at 4:17 AM, Mahaboob wrote:


Hi,
I need to fire the thread repeatedly in regular time intervals. So I  
used

the timer like:
timer =  [[NSTimer scheduledTimerWithTimeInterval:(double) 
[txtTimeinterval

doubleValue] target:self selector:@selector(myThread:) userInfo:nil
repeats:YES]retain];

It is working but, the thread is fired only after the the time  
interval I
had given. But actually I need to begin the thread in 0Sec and then  
keep the

regular time interval. For that I used the code :


Just a note, you don't have to wait for the timer to fire, you can  
call -fire directly right after construction to get 0s fire.


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: Asynchronous timers (without a run loop)

2008-12-04 Thread Michael Ash
On Thu, Dec 4, 2008 at 8:00 AM, Påhl Melin [EMAIL PROTECTED] wrote:
 Yes, I could set up a new thread, handling a list of usleep()
 intervals between the actual timer events but it would be very hard to
 make a reliable, drift-free timer service, handling lots of timer
 events and it would take quite some time to develop a fully functional
 and reliable version. I really hope I don't have to...

You know, if you set up a new thread, then run an NSRunLoop on it and
schedule timers on that, then you will get a reliable, drift-free
timer service, handling lots of timer events, fully functional and
reliable, with approximately zero work on your part.

If you can use a separate thread, you can use a runloop. I don't see
why you're trying to avoid them, perhaps you're unaware of this fact?

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Help Menu Please

2008-12-04 Thread David Blanton

On Tiger I get one Help Menu
On Leopard I get two Help Menus

Has anyone seen this before?
Is there some brain dead thing I am missing?
Am I brain dead?
My boss thinks I am because of this problem.


arrghh!


On Dec 4, 2008, at 12:39 AM, David Blanton wrote:


I have been required to develop and build with Xcode 2.41 on 10.4.11.

In testing on 10.5.5 I get two help menus.

Is there something I need to do for Help on 10.5.x ?


David Blanton





___

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

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

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


This email sent to [EMAIL PROTECTED]




David Blanton





___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Help Menu Please

2008-12-04 Thread I. Savant
  Have you tried searching this list's archives? This is a FAQ.

On Thu, Dec 4, 2008 at 12:36 PM, David Blanton [EMAIL PROTECTED] wrote:
 On Tiger I get one Help Menu
 On Leopard I get two Help Menus

 Has anyone seen this before?
 Is there some brain dead thing I am missing?
 Am I brain dead?
 My boss thinks I am because of this problem.


 arrghh!


 On Dec 4, 2008, at 12:39 AM, David Blanton wrote:

 I have been required to develop and build with Xcode 2.41 on 10.4.11.

 In testing on 10.5.5 I get two help menus.

 Is there something I need to do for Help on 10.5.x ?


 David Blanton





 ___

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

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

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

 This email sent to [EMAIL PROTECTED]



 David Blanton





 ___

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

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

 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/idiotsavant2005%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: Help Menu Please

2008-12-04 Thread jmunson
'twould help to have a little more info on what you are doing, done,  
etc., in order to shed light on your situation...


For instance:  are you creating a menu item called Help, or are you  
sticking with the out-of-the-box menu item?


Peace, Love, and Light,

/s/ Jon C. Munson II

Quoting David Blanton [EMAIL PROTECTED]:


On Tiger I get one Help Menu
On Leopard I get two Help Menus

Has anyone seen this before?
Is there some brain dead thing I am missing?
Am I brain dead?
My boss thinks I am because of this problem.


arrghh!


On Dec 4, 2008, at 12:39 AM, David Blanton wrote:


I have been required to develop and build with Xcode 2.41 on 10.4.11.

In testing on 10.5.5 I get two help menus.

Is there something I need to do for Help on 10.5.x ?


David Blanton





___

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

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

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

This email sent to [EMAIL PROTECTED]




David Blanton





___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/jmunson%40his.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: Help Menu Please

2008-12-04 Thread David Blanton

Out of the box menu with two items:

app help
app register

app help has key equivalent ?


On Leopard I get the Help Menu with Spotlight followed by the two  
aforementioned entries but app help does not have the key equivalent.


Next to this menu I get another Help Menu with only the app  help  
entry and it has the key equivalent.


I did read the release notes for Leopard and while there are a number  
of changes re NSMenu and NSMenuItem nothing seemed to address this  
enigmatic behaviour.






On Dec 4, 2008, at 10:40 AM, [EMAIL PROTECTED] wrote:

'twould help to have a little more info on what you are doing,  
done, etc., in order to shed light on your situation...


For instance:  are you creating a menu item called Help, or are you  
sticking with the out-of-the-box menu item?


Peace, Love, and Light,

/s/ Jon C. Munson II

Quoting David Blanton [EMAIL PROTECTED]:


On Tiger I get one Help Menu
On Leopard I get two Help Menus

Has anyone seen this before?
Is there some brain dead thing I am missing?
Am I brain dead?
My boss thinks I am because of this problem.


arrghh!


On Dec 4, 2008, at 12:39 AM, David Blanton wrote:

I have been required to develop and build with Xcode 2.41 on  
10.4.11.


In testing on 10.5.5 I get two help menus.

Is there something I need to do for Help on 10.5.x ?


David Blanton





___

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

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

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


This email sent to [EMAIL PROTECTED]




David Blanton





___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/jmunson%40his.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/airedale% 
40tularosa.net


This email sent to [EMAIL PROTECTED]




David Blanton





___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Help Menu Please

2008-12-04 Thread David Blanton

No.  I searched Apple Developer. Duh. Will do so now.


On Dec 4, 2008, at 10:38 AM, I. Savant wrote:


  Have you tried searching this list's archives? This is a FAQ.

On Thu, Dec 4, 2008 at 12:36 PM, David Blanton  
[EMAIL PROTECTED] wrote:

On Tiger I get one Help Menu
On Leopard I get two Help Menus

Has anyone seen this before?
Is there some brain dead thing I am missing?
Am I brain dead?
My boss thinks I am because of this problem.


arrghh!


On Dec 4, 2008, at 12:39 AM, David Blanton wrote:

I have been required to develop and build with Xcode 2.41 on  
10.4.11.


In testing on 10.5.5 I get two help menus.

Is there something I need to do for Help on 10.5.x ?


David Blanton





___

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

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

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


This email sent to [EMAIL PROTECTED]




David Blanton





___

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

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

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


This email sent to [EMAIL PROTECTED]






David Blanton





___

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

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

2008-12-04 Thread Mr. Gecko
I'm not needing to know how to draw it, I'm needing to know how to  
make it functional. so if someone clicks and drags it would resize the  
window.


On Dec 3, 2008, at 11:22 PM, Aby wrote:


Hi,

NSDrawNinePartImage may do the job...

Regards
Abin



On 12/4/08, Mr. Gecko [EMAIL PROTECTED] wrote:
Hello, I'm writing a custom window for my application, but I can't  
figure

out how to make a custom resize image... Any help?

Thanks,
Mr. Gecko
___

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

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

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

This email sent to [EMAIL PROTECTED]




--
Aby


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Help Menu Please

2008-12-04 Thread David Blanton

I searched the list archives to no avail.
I do not believe that I am the only one to see this problem ... the  
code is vanilla IB menu stuff




On Dec 4, 2008, at 10:53 AM, David Blanton wrote:


No.  I searched Apple Developer. Duh. Will do so now.


On Dec 4, 2008, at 10:38 AM, I. Savant wrote:


  Have you tried searching this list's archives? This is a FAQ.

On Thu, Dec 4, 2008 at 12:36 PM, David Blanton  
[EMAIL PROTECTED] wrote:

On Tiger I get one Help Menu
On Leopard I get two Help Menus

Has anyone seen this before?
Is there some brain dead thing I am missing?
Am I brain dead?
My boss thinks I am because of this problem.


arrghh!


On Dec 4, 2008, at 12:39 AM, David Blanton wrote:

I have been required to develop and build with Xcode 2.41 on  
10.4.11.


In testing on 10.5.5 I get two help menus.

Is there something I need to do for Help on 10.5.x ?


David Blanton





___

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

Please do not post admin requests or moderator comments to the  
list.

Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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


This email sent to [EMAIL PROTECTED]




David Blanton





___

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

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

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


This email sent to [EMAIL PROTECTED]






David Blanton





___

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

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

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


This email sent to [EMAIL PROTECTED]




David Blanton





___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Help Menu Please

2008-12-04 Thread Jean-Daniel Dupas


Use cocoa builder or Google to search:

http://www.google.com/search?q=duplicate+help+menu+site%3Alists.apple.com

http://www.cocoabuilder.com/archive/message/cocoa/2007/7/30/186910


Le 4 déc. 08 à 19:05, David Blanton a écrit :


I searched the list archives to no avail.
I do not believe that I am the only one to see this problem ... the  
code is vanilla IB menu stuff




On Dec 4, 2008, at 10:53 AM, David Blanton wrote:


No.  I searched Apple Developer. Duh. Will do so now.


On Dec 4, 2008, at 10:38 AM, I. Savant wrote:


 Have you tried searching this list's archives? This is a FAQ.

On Thu, Dec 4, 2008 at 12:36 PM, David Blanton [EMAIL PROTECTED] 
 wrote:

On Tiger I get one Help Menu
On Leopard I get two Help Menus

Has anyone seen this before?
Is there some brain dead thing I am missing?
Am I brain dead?
My boss thinks I am because of this problem.


arrghh!


On Dec 4, 2008, at 12:39 AM, David Blanton wrote:

I have been required to develop and build with Xcode 2.41 on  
10.4.11.


In testing on 10.5.5 I get two help menus.

Is there something I need to do for Help on 10.5.x ?


David Blanton






___

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

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


Weird warning

2008-12-04 Thread development2

Hi,
I am getting some weird warnings that I can't figure out.


/Development/Contracting Code/iTask-iPhone/trunk/iTask/Classes/ 
iTaskAppController.m:103: warning: assignment from distinct Objective- 
C type
		/Development/Contracting Code/iTask-iPhone/trunk/iTask/Classes/ 
iTaskAppController.m:98: warning: 'CalCalendarStore' may not respond  
to '-taskPredicateWithCalendars:'
		/Development/Contracting Code/iTask-iPhone/trunk/iTask/Classes/ 
iTaskAppController.m:98: warning: (Messages without a matching method  
signature




And here is the actual code

	NSPredicate *taskPredicate = [[CalCalendarStore defaultCalendarStore]  
			   taskPredicateWithCalendars:[[CalCalendarStore  
defaultCalendarStore] calendars]];




taskPredicateWithCalendars: is from the class CalCalendarStore so why  
is it saying 'CalCalendarStore' may not respond to '- 
taskPredicateWithCalendars:'



Here is the method declaration in the docs, From the class  
CalCalendarStore:


taskPredicateWithCalendars:
Returns an NSPredicate object that specifies tasks that belong to the  
specified calendars.


+ (NSPredicate *)taskPredicateWithCalendars:(NSArray *)calendars

Parameterscalendars
An array of CalCalendar objects that the tasks must belong to.

Return Value
An NSPredicate object that specifies tasks that belong to the  
specified calendars.


Availability
• Available in Mac OS X v10.5 and later.
Declared InCalCalendarStore.h

Can anyone see what I am doing wrong. I just don't get this and of  
course if I try to debug this, it freezes on that line of code.


Thanks in advance.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Help Menu Please

2008-12-04 Thread jmunson

Hmmm...

Maybe this will help?

http://vgable.com/blog/2008/10/29/two-help-menus/

Peace, Love, and Light,

/s/ Jon C. Munson II

Quoting David Blanton [EMAIL PROTECTED]:


I searched the list archives to no avail.
I do not believe that I am the only one to see this problem ... the
code is vanilla IB menu stuff



On Dec 4, 2008, at 10:53 AM, David Blanton wrote:


No.  I searched Apple Developer. Duh. Will do so now.




___

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

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

2008-12-04 Thread Bill Bumgarner

On Dec 4, 2008, at 10:22 AM, development2 wrote:
Can anyone see what I am doing wrong. I just don't get this and of  
course if I try to debug this, it freezes on that line of code.


You are trying to invoke a class method via an instance of the class.

b.bum

___

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

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


lid open and close notification

2008-12-04 Thread sheen mac
Hi All,

In my app needs lid open and close notification.I used ioreg shell call
for that (ioreg -n IOPMrootDomain | grep AppleClamshellState | sed 's/^.*=//'
).But when lid close and open it return No. Always the clamshellstate is
true.Insomania.kext was loaded before close the lid.

Any other way to get this info?.

Kindly help me.

Thanks In Advance,
Sheen






  
___

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

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

2008-12-04 Thread development2

Duh... OMG.

Sorry about the bandwidth waste, what an idiot I am.


On Dec 4, 2008, at 11:25 AM, Bill Bumgarner wrote:


On Dec 4, 2008, at 10:22 AM, development2 wrote:
Can anyone see what I am doing wrong. I just don't get this and of  
course if I try to debug this, it freezes on that line of code.


You are trying to invoke a class method via an instance of the class.

b.bum




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Cocoa-dev Digest, Vol 5, Issue 2074

2008-12-04 Thread Kirk Kerekes

It is *possible* to use NSSocketPort
to create a socket which you then communicate with using other
techniques, but you can't use NSSocketPort directly to talk to a
non-Cocoa app.


While the documentation used to imply this, it did not appear to be  
true then, and the documentation no longer asserts this. If it was  
ever true, it is unclear when the transition from true to untrue  
occurred, but it appears that it was untrue at least by Tiger. It does  
appear to be one of the most enduring myths about the frameworks,  
perhaps because it seemed so **wrong**.


The current documentation states:

NSSocketPort is a subclass of NSPort that represents a BSD socket. An  
NSSocketPort object can be used as an endpoint for distributed object  
connections or raw messaging


It is indeed possible, and easy, to use NSSocketPort to communicate  
with non-Cocoa applications, in fact one can easily use it to interact  
with sockets on other platforms. I have used it to communicate with  
WINSOCK sockets.





Message: 10
Date: Thu, 4 Dec 2008 11:43:35 -0500
From: Michael Ash [EMAIL PROTECTED]
Subject: Re: Big picture relationships between NSConnection,

Yes. NSPort is part of the Distributed Objects system. It's possible
to use NSPort on its own, but you must use it to talk to another
process which also uses NSPort. It is *possible* to use NSSocketPort
to create a socket which you then communicate with using other
techniques, but you can't use NSSocketPort directly to talk to a
non-Cocoa app.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Help Menu Please

2008-12-04 Thread David Blanton
The cited reference seems to describe my problem.  I am putting up a  
modal registration in windowDidLoad so I am moving that code to  
applicationDidFinishLaunching.  I'll report my results but I am sure  
it will resolve the issue.


Thanks so much for your patience!

On Dec 4, 2008, at 11:25 AM, [EMAIL PROTECTED] wrote:


Hmmm...

Maybe this will help?

http://vgable.com/blog/2008/10/29/two-help-menus/

Peace, Love, and Light,

/s/ Jon C. Munson II

Quoting David Blanton [EMAIL PROTECTED]:


I searched the list archives to no avail.
I do not believe that I am the only one to see this problem ... the
code is vanilla IB menu stuff



On Dec 4, 2008, at 10:53 AM, David Blanton wrote:


No.  I searched Apple Developer. Duh. Will do so now.




___

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

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

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


This email sent to [EMAIL PROTECTED]




David Blanton





___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Programmatically loading an NSImage via other field

2008-12-04 Thread Matt Long

Jon,

I'm not sure I understand the whole problem here, but from your  
initial message I put together a simple demo project that will take  
the input value from a text field and use that as the path for an  
NSImageView. It does it on the fly (e.g. as you type). Here is the  
demo project:


http://www.cimgf.com/files/AutoImageLoad.zip

On first run, use the Browse... button to locate an image and select  
it. The image will display. Then start to backspace from the end of  
the path in the text field and you'll see the image you selected  
disappears. Then type back in what you backspaced out and you'll see  
it reappear. This is all done with the magic of bindings. The text  
field value and the image view's value path are both bound to the same  
string. When the string gets updated, so do both of those fields.  
You'll see the string that is being used for this is a @property of my  
AppDelegate class.


Let me know if you have further questions. I'm a former Windows guy  
myself and can probably help you unlearn what you know as I also had  
to do. ;-)


Best Regards,

-Matt


On Dec 4, 2008, at 10:03 AM, [EMAIL PROTECTED] wrote:


Namaste!

OK, I've been playing around with this for too long now...

NOTHING gets called when text in a control is set via code or a  
mechanism other than strict keyboard/mouse entry by the user from  
what I can determine.  This, in a word, is not good.


I've set up an observer, delegates, and all that, per previous posts  
and only when keys are actually pressed do the delegate methods get  
called.


Also, I've noticed that when the record is moved (either next or  
previous), there is a buffer time between when code executes and  
the interface gets changed.


Thus:

- (IBAction)movePrevious:(id)sender
{
[tblPattern selectPrevious:self];
[btnPrevious setEnabled:[tblPattern canSelectPrevious]];
[self pushPicture];
}

Doesn't work.  The Apple dox state the reason the move action is  
moved to another process is to give the error mechanism a way to  
respond.


As a consequence, nothing changes and the code executes, then the  
stuff changes.  What happens is the previous image gets loaded as  
the current image, despite what the textfield says.


Not good.

For a simple OnChange thing, this is absolutely frustrating (and  
has resulted in quite a bit of code).


Bottom line is, it looks like I need some way to see changes that  
were made to either the underlying Cell (thinking along the lines of  
display changes) or some other route to take this.


I have three scenarios under which the image needs to get pushed:

1.  When selected from a file.
2.  On Window display - first record is displayed.
3.  When records are scrolled (Move Next/Move Previous).

I've solved #1, though I don't like having to manually push the  
image (meaning I call the pushPicture routine).  2  3 are still  
unsolved at this point.


Any further thoughts???  Anyone else only keep paths to images and  
dynamically load from that data?  Storing the pictures in the data  
structure is not going to happen as they'll take up far too much  
space and suck resources.


Thanks for all the help so far!

Peace, Love, and Light,

/s/ Jon C. Munson II


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Programmatically loading an NSImage via other field

2008-12-04 Thread jmunson

Great!  Thanks!

I'll take a look at at it.

I'm still a Windows guy.  Actually, I'm becoming dual-platform.  Now  
that's a scary thought (but quite marketable if need be).  But you are  
probably not in the Maryland area, are ya?


Appreciate the help, I'll grab that zip now.

Peace, Love, and Light,

/s/ Jon C. Munson II

Quoting Matt Long [EMAIL PROTECTED]:


Jon,

I'm not sure I understand the whole problem here, but from your initial
message I put together a simple demo project that will take the input
value from a text field and use that as the path for an NSImageView. It
does it on the fly (e.g. as you type). Here is the demo project:

http://www.cimgf.com/files/AutoImageLoad.zip

On first run, use the Browse... button to locate an image and select
it. The image will display. Then start to backspace from the end of the
path in the text field and you'll see the image you selected
disappears. Then type back in what you backspaced out and you'll see it
reappear. This is all done with the magic of bindings. The text field
value and the image view's value path are both bound to the same
string. When the string gets updated, so do both of those fields.
You'll see the string that is being used for this is a @property of my
AppDelegate class.

Let me know if you have further questions. I'm a former Windows guy
myself and can probably help you unlearn what you know as I also had
to do. ;-)

Best Regards,

-Matt


On Dec 4, 2008, at 10:03 AM, [EMAIL PROTECTED] wrote:


Namaste!

OK, I've been playing around with this for too long now...

NOTHING gets called when text in a control is set via code or a   
mechanism other than strict keyboard/mouse entry by the user from   
what I can determine.  This, in a word, is not good.


I've set up an observer, delegates, and all that, per previous   
posts and only when keys are actually pressed do the delegate   
methods get called.


Also, I've noticed that when the record is moved (either next or   
previous), there is a buffer time between when code executes and   
the interface gets changed.


Thus:

- (IBAction)movePrevious:(id)sender
{
[tblPattern selectPrevious:self];
[btnPrevious setEnabled:[tblPattern canSelectPrevious]];
[self pushPicture];
}

Doesn't work.  The Apple dox state the reason the move action is   
moved to another process is to give the error mechanism a way to   
respond.


As a consequence, nothing changes and the code executes, then the   
stuff changes.  What happens is the previous image gets loaded as   
the current image, despite what the textfield says.


Not good.

For a simple OnChange thing, this is absolutely frustrating (and   
has resulted in quite a bit of code).


Bottom line is, it looks like I need some way to see changes that  
 were made to either the underlying Cell (thinking along the lines   
of display changes) or some other route to take this.


I have three scenarios under which the image needs to get pushed:

1.  When selected from a file.
2.  On Window display - first record is displayed.
3.  When records are scrolled (Move Next/Move Previous).

I've solved #1, though I don't like having to manually push the   
image (meaning I call the pushPicture routine).  2  3 are still   
unsolved at this point.


Any further thoughts???  Anyone else only keep paths to images and   
dynamically load from that data?  Storing the pictures in the data   
structure is not going to happen as they'll take up far too much   
space and suck resources.


Thanks for all the help so far!

Peace, Love, and Light,

/s/ Jon C. Munson II





___

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

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

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

This email sent to [EMAIL PROTECTED]


How to extract individual icons from icns file?

2008-12-04 Thread David
Is there a tool available to extract individual icons from an icns
file? In particular the smaller ones. I've tried several tools but
none of them work with the 16x16 size. I've seen Linux and Windows
tools but no Mac tools. How can that be. Is there a better place for
me to ask this question?

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: Help Menu SOLVED

2008-12-04 Thread David Blanton
Moving the registration modal dialog to applicationDidFinishLaunching  
from windowDidLoad solved the problem.


Thanks all!


On Dec 4, 2008, at 10:53 AM, David Blanton wrote:


No.  I searched Apple Developer. Duh. Will do so now.


On Dec 4, 2008, at 10:38 AM, I. Savant wrote:


  Have you tried searching this list's archives? This is a FAQ.

On Thu, Dec 4, 2008 at 12:36 PM, David Blanton  
[EMAIL PROTECTED] wrote:

On Tiger I get one Help Menu
On Leopard I get two Help Menus

Has anyone seen this before?
Is there some brain dead thing I am missing?
Am I brain dead?
My boss thinks I am because of this problem.


arrghh!


On Dec 4, 2008, at 12:39 AM, David Blanton wrote:

I have been required to develop and build with Xcode 2.41 on  
10.4.11.


In testing on 10.5.5 I get two help menus.

Is there something I need to do for Help on 10.5.x ?


David Blanton





___

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

Please do not post admin requests or moderator comments to the  
list.

Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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


This email sent to [EMAIL PROTECTED]




David Blanton





___

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

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

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


This email sent to [EMAIL PROTECTED]






David Blanton






David Blanton





___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to extract individual icons from icns file?

2008-12-04 Thread Jean-Daniel Dupas


Le 4 déc. 08 à 20:16, David a écrit :


Is there a tool available to extract individual icons from an icns
file? In particular the smaller ones. I've tried several tools but
none of them work with the 16x16 size. I've seen Linux and Windows
tools but no Mac tools. How can that be. Is there a better place for
me to ask this question?

Thanks


What about Preview ?



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to extract individual icons from icns file?

2008-12-04 Thread Randall Meadows

On Dec 4, 2008, at 12:16 PM, David wrote:


Is there a tool available to extract individual icons from an icns
file? In particular the smaller ones. I've tried several tools but
none of them work with the 16x16 size. I've seen Linux and Windows
tools but no Mac tools. How can that be. Is there a better place for
me to ask this question?



/Developer/Applications/Utilities/Icon Composer.app handles all  
sizes.  I think Preview.app does as well.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSSavePanel mishandling extensions

2008-12-04 Thread Corbin Dunn


Le Dec 3, 2008 à 7:11 PM, Kyle Sluder a écrit :

On Wed, Dec 3, 2008 at 10:05 PM, Rob Keniger [EMAIL PROTECTED]  
wrote:

Seems like a good idea to me, you should file a bug.


To be honest, NSSavePanel and NSOpenPanel should be using UTIs for
this by now.  I don't know why they're not.


They are. Only for NSOpenPanel; for the NSSavePanel it doesn't make as  
much sense (in other words, what extension would you want to use given  
a UTI?)


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: Programmatically loading an NSImage via other field

2008-12-04 Thread jmunson

Namaste!

Back so soon...

:)

OK, I took a look a what you have and have some questions.

And, well, h...

I'M A DOPE!!  :D

No questions!

The reason for that is I was under the extremely mistaken impression  
that I couldn't load the ImageView from a simple path via a binding.


I took a look at how you had your ImageView bound and voila!  The  
answer was staring me straight in the face!  ROFL!!!


Can I say OMFG?

Geez...

But I did learn some things along the way so it wasn't a total loss...

I now return you back to your regularly scheduled program...

THANKS!!!

Peace, Love, and Light,

/s/ Jon C. Munson II

p.s. Isn't it always something simple???

Quoting Matt Long [EMAIL PROTECTED]:


Jon,

I'm not sure I understand the whole problem here, but from your initial
message I put together a simple demo project that will take the input
value from a text field and use that as the path for an NSImageView. It
does it on the fly (e.g. as you type). Here is the demo project:

http://www.cimgf.com/files/AutoImageLoad.zip

On first run, use the Browse... button to locate an image and select
it. The image will display. Then start to backspace from the end of the
path in the text field and you'll see the image you selected
disappears. Then type back in what you backspaced out and you'll see it
reappear. This is all done with the magic of bindings. The text field
value and the image view's value path are both bound to the same
string. When the string gets updated, so do both of those fields.
You'll see the string that is being used for this is a @property of my
AppDelegate class.

Let me know if you have further questions. I'm a former Windows guy
myself and can probably help you unlearn what you know as I also had
to do. ;-)

Best Regards,

-Matt


On Dec 4, 2008, at 10:03 AM, [EMAIL PROTECTED] wrote:


Namaste!

OK, I've been playing around with this for too long now...

NOTHING gets called when text in a control is set via code or a   
mechanism other than strict keyboard/mouse entry by the user from   
what I can determine.  This, in a word, is not good.


I've set up an observer, delegates, and all that, per previous   
posts and only when keys are actually pressed do the delegate   
methods get called.


Also, I've noticed that when the record is moved (either next or   
previous), there is a buffer time between when code executes and   
the interface gets changed.


Thus:

- (IBAction)movePrevious:(id)sender
{
[tblPattern selectPrevious:self];
[btnPrevious setEnabled:[tblPattern canSelectPrevious]];
[self pushPicture];
}

Doesn't work.  The Apple dox state the reason the move action is   
moved to another process is to give the error mechanism a way to   
respond.


As a consequence, nothing changes and the code executes, then the   
stuff changes.  What happens is the previous image gets loaded as   
the current image, despite what the textfield says.


Not good.

For a simple OnChange thing, this is absolutely frustrating (and   
has resulted in quite a bit of code).


Bottom line is, it looks like I need some way to see changes that  
 were made to either the underlying Cell (thinking along the lines   
of display changes) or some other route to take this.


I have three scenarios under which the image needs to get pushed:

1.  When selected from a file.
2.  On Window display - first record is displayed.
3.  When records are scrolled (Move Next/Move Previous).

I've solved #1, though I don't like having to manually push the   
image (meaning I call the pushPicture routine).  2  3 are still   
unsolved at this point.


Any further thoughts???  Anyone else only keep paths to images and   
dynamically load from that data?  Storing the pictures in the data   
structure is not going to happen as they'll take up far too much   
space and suck resources.


Thanks for all the help so far!

Peace, Love, and Light,

/s/ Jon C. Munson II





___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to extract individual icons from icns file?

2008-12-04 Thread Misha Gonodanov
where is Icon Composer tool in /Developer/Applications/Utilities  
(Leopard). Tiger had Icon Composer and icns Browser tools in the same  
place


Regards,
Misha

On Dec 4, 2008, at 11:16 AM, David wrote:


Is there a tool available to extract individual icons from an icns
file? In particular the smaller ones. I've tried several tools but
none of them work with the 16x16 size. I've seen Linux and Windows
tools but no Mac tools. How can that be. Is there a better place for
me to ask this question?

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/gonodanov%40apple.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: How to extract individual icons from icns file?

2008-12-04 Thread Jens Bauer

Good old Iconographer (Carbon). Wonderful little app, it's now free.

http://www.mscape.com/


Love,
Jens

On Dec 4, 2008, at 20:16, David wrote:


Is there a tool available to extract individual icons from an icns
file? In particular the smaller ones. I've tried several tools but
none of them work with the 16x16 size. I've seen Linux and Windows
tools but no Mac tools. How can that be. Is there a better place for
me to ask this question?


___

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

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

2008-12-04 Thread Kyle Sluder
On Thu, Dec 4, 2008 at 2:36 PM, Corbin Dunn [EMAIL PROTECTED] wrote:
 They are. Only for NSOpenPanel; for the NSSavePanel it doesn't make as much
 sense (in other words, what extension would you want to use given a UTI?)

If the same UTI maps to multiple extensions, then it shouldn't matter
what extension is used on the filename.  Different kinds of files
should have different UTIs.  If disambiguation is necessary, the Show
Extension checkbox can be used to override the automatic mapping.

--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: NSSavePanel mishandling extensions

2008-12-04 Thread Kyle Sluder
I should probably make crystal clear that I am describing an
enhancement to NSSavePanel's behavior that I'd like to see, not how it
currently works or is documented to work.

--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: lid open and close notification

2008-12-04 Thread Benjamin Dobson

On 4 Dec 2008, at 18:29:26, sheen mac wrote:


Hi All,

In my app needs lid open and close notification.I used ioreg shell  
call
for that (ioreg -n IOPMrootDomain | grep AppleClamshellState | sed  
's/^.*=//'
).But when lid close and open it return No. Always the  
clamshellstate is

true.Insomania.kext was loaded before close the lid.

Any other way to get this info?.

Kindly help me.

Thanks In Advance,
Sheen


I'm not familiar with this, but... how would you know the lid is  
closed? Wouldn't the computer be asleep?

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to extract individual icons from icns file?

2008-12-04 Thread Andy Lee

On Dec 4, 2008, at 2:22 PM, Misha Gonodanov wrote:
where is Icon Composer tool in /Developer/Applications/Utilities  
(Leopard). Tiger had Icon Composer and icns Browser tools in the  
same place


Are you asking where Icon Composer is?  What happens if you type icon  
composer into Spotlight?


--Andy




Regards,
Misha

On Dec 4, 2008, at 11:16 AM, David wrote:


Is there a tool available to extract individual icons from an icns
file? In particular the smaller ones. I've tried several tools but
none of them work with the 16x16 size. I've seen Linux and Windows
tools but no Mac tools. How can that be. Is there a better place for
me to ask this question?

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/gonodanov 
%40apple.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/aglee%40mac.com

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to extract individual icons from icns file?

2008-12-04 Thread I. Savant
On Thu, Dec 4, 2008 at 3:28 PM, Andy Lee [EMAIL PROTECTED] wrote:

 Are you asking where Icon Composer is?  What happens if you type icon
 composer into Spotlight?

  As I recall, the /Developer folder isn't automatically indexed by
Spotlight. At least it didn't used to be. I had to manually ask it to
index. Has that changed?

  Anyway, there are various problems with trying to save images out of
Icon Composer and Preview. Try finding the standard folder icon and
extracting a clean image from it with either of those apps. Go on ...
I'll wait ... :-)

  Artifacts and ugliness. That's what you get.

  A solution the OP might try is to write a quick app using NSImage to
extract the image at the desired size. This shouldn't take an
intermediate Cocoa developer more than twenty minutes, depending on
how involved you get with options.

--
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: lid open and close notification

2008-12-04 Thread Nick Zitzmann


On Dec 4, 2008, at 1:11 PM, Benjamin Dobson wrote:

I'm not familiar with this, but... how would you know the lid is  
closed? Wouldn't the computer be asleep?



There are several situations in Mac OS X where the clamshell can be  
closed and the computer will remain wide awake, or the computer will  
remain asleep when the clamshell is opened. For example, if you have  
an external monitor plugged in and the built-in display turned off,  
then opening and closing the clamshell does not put the computer to  
sleep.


Nick Zitzmann
http://www.chronosnet.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: NSSavePanel mishandling extensions

2008-12-04 Thread Corbin Dunn


Le Dec 4, 2008 à 12:02 PM, Kyle Sluder a écrit :


On Thu, Dec 4, 2008 at 2:36 PM, Corbin Dunn [EMAIL PROTECTED] wrote:
They are. Only for NSOpenPanel; for the NSSavePanel it doesn't make  
as much
sense (in other words, what extension would you want to use given a  
UTI?)


If the same UTI maps to multiple extensions, then it shouldn't matter
what extension is used on the filename.  Different kinds of files
should have different UTIs.  If disambiguation is necessary, the Show
Extension checkbox can be used to override the automatic mapping.


We could do this, and I have thought about it..please log a bug  
request: bugreporter.apple.com, and feel free to send me the radar #.


thanks!
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: How to extract individual icons from icns file?

2008-12-04 Thread Andy Lee

On Dec 4, 2008, at 3:33 PM, I. Savant wrote:


On Thu, Dec 4, 2008 at 3:28 PM, Andy Lee [EMAIL PROTECTED] wrote:

Are you asking where Icon Composer is?  What happens if you type  
icon

composer into Spotlight?


 As I recall, the /Developer folder isn't automatically indexed by
Spotlight. At least it didn't used to be. I had to manually ask it to
index. Has that changed?


I remember something to that effect too, but Spotlight found Icon  
Composer, and I have a fresh OS/DevTools installation.  It also found  
a bunch of other files I just tried.  But my home directory is copied  
from another computer; maybe it contains an index /Developer pref  
that I don't remember setting, or maybe things did indeed change.


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


Animation proxies and Python

2008-12-04 Thread Mani Ghasemlou
Hello list,

I've been unsuccessfully trying to use an animation proxy for an
NSWindow instance using Python:

For example:


def fadeOut(self, window):
  window.animator().setAlphaValue_(0.0)


causes my application to crash.

Bypassing the proxy, however works:


def fadeOut(self, window):
  window.setAlphaValue_(0.0)


Interestingly, if I invoke the setAlphaValue method on the proxy using
the performSelector method, it works:


def fadeOut(self, window):
  windowProxy = window.animator()
  windowProxy.performSelector_('setAlphaValue:')


The above code will cause the window to animate a fade out to blank,
which is expected because I'm not passing in any parameters and it is
assuming an alpha value of nil or 0. (Note that I am aware of
performSelector_withObject_, but it did not work as expected, probably
because the input parameter is a double and not an NSObject).

Question: Is all of this expected behaviour? If so, what is the best
practice for calling methods on proxy objects like this in Python?

Thanks very much in advance!

Regards,
Mani
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to extract individual icons from icns file?

2008-12-04 Thread Michael Ash
On Thu, Dec 4, 2008 at 3:33 PM, I. Savant [EMAIL PROTECTED] wrote:
  Anyway, there are various problems with trying to save images out of
 Icon Composer and Preview. Try finding the standard folder icon and
 extracting a clean image from it with either of those apps. Go on ...
 I'll wait ... :-)

Is this a trick question of some kind? Took me about 60 seconds to
find the icns file, and 5 seconds to open it with Preview:

$ open 
/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/GenericFolderIcon.icns

Then pick the size I want, cmd-C, cmd-N, cmd-S, and save it as the type I want.

  Artifacts and ugliness. That's what you get.

Might be what you get, certainly isn't what I got.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to extract individual icons from icns file?

2008-12-04 Thread I. Savant
On Thu, Dec 4, 2008 at 3:54 PM, Michael Ash [EMAIL PROTECTED] wrote:

 Is this a trick question of some kind?

  Sort of ...

  Artifacts and ugliness. That's what you get.

 Might be what you get, certainly isn't what I got.

  Great. Now open the newly-created file in Photoshop (as if you were
going to do something with it such as creating a branded folder or
something similar). :-)

--
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: Cocoa-dev Digest, Vol 5, Issue 2074

2008-12-04 Thread Michael Ash
On Thu, Dec 4, 2008 at 1:40 PM, Kirk Kerekes [EMAIL PROTECTED] wrote:
 It is *possible* to use NSSocketPort
 to create a socket which you then communicate with using other
 techniques, but you can't use NSSocketPort directly to talk to a
 non-Cocoa app.

 While the documentation used to imply this, it did not appear to be true
 then, and the documentation no longer asserts this. If it was ever true, it
 is unclear when the transition from true to untrue occurred, but it appears
 that it was untrue at least by Tiger. It does appear to be one of the most
 enduring myths about the frameworks, perhaps because it seemed so **wrong**.

 The current documentation states:

 NSSocketPort is a subclass of NSPort that represents a BSD socket. An
 NSSocketPort object can be used as an endpoint for distributed object
 connections or raw messaging

 It is indeed possible, and easy, to use NSSocketPort to communicate with
 non-Cocoa applications, in fact one can easily use it to interact with
 sockets on other platforms. I have used it to communicate with WINSOCK
 sockets.

But raw messaging is not the same as writing raw bytes to a TCP
stream. All that means is that you can use the standard NSPort API as
well as using it to set up an NSConnection.

You say that you've used it to talk to sockets on other platforms.
How? The API is completely non-suitable for it. It doesn't give you a
way to simply read or write streams. Instead it deals with arrays of
messages. This is going to require some sort of custom framing
protocol which means that it's not going to be able to talk to
anything that doesn't also use that custom framing protocol. How do
you get around that limitation?

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to extract individual icons from icns file?

2008-12-04 Thread I. Savant
On Thu, Dec 4, 2008 at 3:58 PM, I. Savant [EMAIL PROTECTED] wrote:

 Might be what you get, certainly isn't what I got.

  Great. Now open the newly-created file in Photoshop (as if you were
 going to do something with it such as creating a branded folder or
 something similar). :-)

  After Mike contacted me off-list to let me know he didn't have
Photoshop but Acorn and others show the image perfectly well, I tried
opening in Pixelmator and it appears just fine there as well.

  So ... this appears to be nothing more than a Photoshop bug! :-)
Sorry for the noise. Most of my graphics work is done in Photoshop, so
I never noticed the artifacts only appeared there.

  Well there you have it, David (OP), copy and paste from the desired
file from Icon Composer or Preview and it should work fine ... as long
as you don't intend to open the result in Photoshop. :-D

--
I.S.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to extract individual icons from icns file?

2008-12-04 Thread Benjamin Dobson


On 4 Dec 2008, at 20:58:29, I. Savant wrote:


 Great. Now open the newly-created file in Photoshop (as if you were
going to do something with it such as creating a branded folder or
something similar). :-)


Yes, I've noticed how bad Photoshop is with TIFFs. In Preview, File »  
Save As » Pretty much anything except TIFF, such as PNG, then open it  
in Photoshop. It's fine.___


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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to extract individual icons from icns file?

2008-12-04 Thread Randall Meadows

On Dec 4, 2008, at 2:08 PM, I. Savant wrote:

On Thu, Dec 4, 2008 at 3:58 PM, I. Savant  
[EMAIL PROTECTED] wrote:



Might be what you get, certainly isn't what I got.


Great. Now open the newly-created file in Photoshop (as if you were
going to do something with it such as creating a branded folder or
something similar). :-)


 After Mike contacted me off-list to let me know he didn't have
Photoshop but Acorn and others show the image perfectly well, I tried
opening in Pixelmator and it appears just fine there as well.

 So ... this appears to be nothing more than a Photoshop bug! :-)
Sorry for the noise. Most of my graphics work is done in Photoshop, so
I never noticed the artifacts only appeared there.

 Well there you have it, David (OP), copy and paste from the desired
file from Icon Composer or Preview and it should work fine ... as long
as you don't intend to open the result in Photoshop. :-D


To throw another monkey wrench into your conclusion, I opened it in PS  
CS3, and it looked just fine.  I did save from Preview as a PNG, dunno  
if format (or version) makes a difference.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to extract individual icons from icns file?

2008-12-04 Thread I. Savant
On Thu, Dec 4, 2008 at 4:12 PM, Randall Meadows [EMAIL PROTECTED] wrote:

 To throw another monkey wrench into your conclusion, I opened it in PS CS3,
 and it looked just fine.  I did save from Preview as a PNG, dunno if format
 (or version) makes a difference.

  Further experimentation at Mike Ash's urging reveals that it is only
with TIFFs with alpha. I'll go out on a limb and theorize that it's
specifically TIFFs with alpha created by Mac OS X's machinery that has
this affect, though that theory is untested.

  Yes, it works just fine with PNGs.

--
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: self = [super init];

2008-12-04 Thread Clark Cox
On Thu, Dec 4, 2008 at 12:53 AM, Stephen J. Butler
[EMAIL PROTECTED] wrote:
 On Thu, Dec 4, 2008 at 2:32 AM, EVS [EMAIL PROTECTED] wrote:
 Thank you, I suppose the reason I find it confusing  is because self is a
 pointer to the current object. If self were to release self ( the current
 object ), while it is being used, I would have guessed that would cause
 problems.

 You can call [self release] as long as you don't access (directly or
 indirectly) self for the rest of the method. So if you keep from
 touching instance variables or calling methods off self then things
 will be fine. And if your caller knows somehow (like checking return
 values, in the case of init) to not reference the released self then
 everything is kosher.

 In fact, the same is true in C++ with this, only a little more
 pathologically so. You're allowed to call non-virtual member functions
 off a bad this pointer because

No, you're not. It is possible that many compilers will let you get
away with it, but it doesn't mean that you're allowed to do it.

 those functions are statically bound.
 Causes confusion in every intro C++ course because students can't
 figure out why their program is crashing in the middle of a method
 call (when they finally access an instance variable off the bad this
 pointer).

 I even saw a horrible design pattern, probably on The Daily WTF, where
 the programmer was doing singletons via something like:

 ((MyClass*)NULL)-getInstance();

 Totally pathological, but nothing technically wrong with it as long as
 you're careful.

No, according to the standard, that is undefined behavior. So not only
pathological, it is also technically wrong :).

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

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to extract individual icons from icns file?

2008-12-04 Thread Jean-Daniel Dupas


Le 4 déc. 08 à 22:18, I. Savant a écrit :

On Thu, Dec 4, 2008 at 4:12 PM, Randall Meadows [EMAIL PROTECTED] 
pc.com wrote:


To throw another monkey wrench into your conclusion, I opened it in  
PS CS3,
and it looked just fine.  I did save from Preview as a PNG, dunno  
if format

(or version) makes a difference.


 Further experimentation at Mike Ash's urging reveals that it is only
with TIFFs with alpha. I'll go out on a limb and theorize that it's
specifically TIFFs with alpha created by Mac OS X's machinery that has
this affect, though that theory is untested.

 Yes, it works just fine with PNGs.


This is a very old and well known issus.

http://www.wodeveloper.com/omniLists/macosx-dev/2002/September/msg00251.html


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to extract individual icons from icns file?

2008-12-04 Thread I. Savant
On Thu, Dec 4, 2008 at 4:51 PM, Jean-Daniel Dupas
[EMAIL PROTECTED] wrote:

 This is a very old and well known issus.

 http://www.wodeveloper.com/omniLists/macosx-dev/2002/September/msg00251.html

  Oddly, I tried the very thing joar suggests in the post you
reference (running the image through tiffutil using -cat) just as I
was testing this today. Didn't fix anything. Same problem.

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


NSArrays and tableView delegates

2008-12-04 Thread Steven Hamilton

Hi folks,
I'm looking for advice on usage of arrays in tableviews.

I have a subclassed NSWindowController. In this class I have a method  
that extracts data from my core data model and formulates an array of  
dictionaries. Also in this class I have the tableview datasource  
methods. The datasource methods use the standard KVC column identifier  
thingies to populate the table. I'm having memory leaks and I'm sure  
its because of the way I'm making the array available to teh data  
source methods.


My interface file looks like this;

@interface MLimportController : NSWindowController {
IBOutlet NSTableView*transactionTable;
IBOutlet NSArrayController *accountsController;

NSMutableArray  *importedTransactions;
NSManagedObject *selectedAccount;
NSNumber *selectedTransferIndex;
}

- (IBAction) recordTransactions:(id)sender;
- (IBAction) deleteSelectedTransactions:(id)sender;
- (void) setAccountSortDescriptors: (NSArray *) descriptors;
- (NSArray *) accountSortDescriptors;
- (void) importFile:(NSString *)aFile;

//delegates
- (int)numberOfRowsInTableView:(NSTableView *)tableView;
- (id)tableView:(NSTableView *)tableView objectValueForTableColumn: 
(NSTableColumn *)tableColumn row:(int)row;
- (void)tableView:(NSTableView *)tableView setObjectValue:(id)newValue  
forTableColumn:(NSTableColumn *)tableColumn row:(int)row;

@end

In the importFile: method is where I build they array  
importedTransactions. However, as it will autorelease I [retain] it so  
its still hanging around for the tableView methods to access it. Is  
this the correct way of doing this? Or should I be declaring the  
NSArray as a @property and using getters/setters to use it?


My memory leak is resulting in importedTransactions always having a  
retainCount of 1, meaning the importController class can never be  
deallocated by my NSDocument, meaning the documentController can never  
close the document properly. I'm sure I'm doing this an ugly way.


(Leopard 10.5.5 with GC 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: custom view binding to NSTreeController

2008-12-04 Thread Rob Keniger


On 05/12/2008, at 1:29 AM, Matthew Johnson wrote:
I agree it's a shame.  There are plenty of examples for simpler  
binding scenarios, but none I have found for custom views binding to  
NSTreeController.  I really appreciate your sample will do something  
similar if I don't find a better way.


You're right that it will be fast for smaller data sets.  The  
problem is that it should be a constant time operation and your code  
is much more expensive than that.  Depending on the implementation  
of removeItemsInArray your code is at least O(n) and it is likely to  
be O(n2). That will not scale to large data sets very well.



I agree. I had a look at a class-dump of AppKit and it doesn't look  
like there's much in there that would help in this. There really needs  
to be a way for NSTreeController's arrangedObjects KVO notifications  
to include the NSTreeNodes that are being added/removed. There seems  
no reason why they couldn't be included in the change dictionary.


I think I'll file a bug against it.

--
Rob Keniger



___

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

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

2008-12-04 Thread Matthew Johnson


On Dec 5, 2008, at 8:23 AM, Rob Keniger wrote:



On 05/12/2008, at 1:29 AM, Matthew Johnson wrote:
I agree it's a shame.  There are plenty of examples for simpler  
binding scenarios, but none I have found for custom views binding  
to NSTreeController.  I really appreciate your sample will do  
something similar if I don't find a better way.


You're right that it will be fast for smaller data sets.  The  
problem is that it should be a constant time operation and your  
code is much more expensive than that.  Depending on the  
implementation of removeItemsInArray your code is at least O(n) and  
it is likely to be O(n2). That will not scale to large data sets  
very well.



I agree. I had a look at a class-dump of AppKit and it doesn't look  
like there's much in there that would help in this. There really  
needs to be a way for NSTreeController's arrangedObjects KVO  
notifications to include the NSTreeNodes that are being added/ 
removed. There seems no reason why they couldn't be included in the  
change dictionary.


I think I'll file a bug against it.



Sounds good.  Let me know what the radar number is and I'll file one  
also and mention your radar.


Thanks,
Matthew

___

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

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

2008-12-04 Thread Ashley Clark

On Dec 3, 2008, at 10:05 PM, Steven Hamilton wrote:


Hi folks,


Hi!

I have a subclassed NSWindowController. In this class I have a  
method that extracts data from my core data model and formulates an  
array of dictionaries. Also in this class I have the tableview  
datasource methods. The datasource methods use the standard KVC  
column identifier thingies to populate the table. I'm having memory  
leaks and I'm sure its because of the way I'm making the array  
available to teh data source methods.


My interface file looks like this;

@interface MLimportController : NSWindowController {
IBOutlet NSTableView*transactionTable;
IBOutlet NSArrayController *accountsController;

NSMutableArray  *importedTransactions;
NSManagedObject *selectedAccount;
NSNumber *selectedTransferIndex;
}

- (IBAction) recordTransactions:(id)sender;
- (IBAction) deleteSelectedTransactions:(id)sender;
- (void) setAccountSortDescriptors: (NSArray *) descriptors;
- (NSArray *) accountSortDescriptors;
- (void) importFile:(NSString *)aFile;

//delegates
- (int)numberOfRowsInTableView:(NSTableView *)tableView;
- (id)tableView:(NSTableView *)tableView objectValueForTableColumn: 
(NSTableColumn *)tableColumn row:(int)row;
- (void)tableView:(NSTableView *)tableView setObjectValue: 
(id)newValue forTableColumn:(NSTableColumn *)tableColumn row:(int)row;

@end

In the importFile: method is where I build they array  
importedTransactions. However, as it will autorelease I [retain] it  
so its still hanging around for the tableView methods to access it.  
Is this the correct way of doing this? Or should I be declaring the  
NSArray as a @property and using getters/setters to use it?


That sounds fine as long as you are releasing it in your -dealloc  
method.


My memory leak is resulting in importedTransactions always having a  
retainCount of 1, meaning the importController class can never be  
deallocated by my NSDocument, meaning the documentController can  
never close the document properly. I'm sure I'm doing this an ugly  
way.


The retainCount of the importedTransactions will not affect whether  
its containing class is deallocated unless one or more items in that  
array have retained the importController class also. If they have then  
you have a circular reference that you'd have to break at some point  
external to -dealloc.



(Leopard 10.5.5 with GC on)


If you're running this program under GC then none of what you said  
makes sense anyway since retain/release/autorelease are all no-ops  
under GC and -dealloc is never called there.


What tool told you that you were having leaks? What information did it  
give you?



Ashley
___

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

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


indexOfObjectIdenticalTo: problem with NSArrayController

2008-12-04 Thread Mikael Wämundson

Hi all.

Since it is good programming to not access an array's content through  
its controller when in the model I'm trying to find a way to get to  
the same object selected in the user interface (i.e. the array  
controller).


In my view I have the array content sorted by binding it to a sort  
descriptor. Thus, the indices of the array and the content of the  
array shown in the view differs.


Now, when a certain object is selected in the view I want to do  
something to this object by accessing it through the original array.  
My first, perhaps foolish, guess would be to use  
indexOfObjectIdenticalTo: or indexOfObject: like this:


int indexOfObject = [theOriginalArray indexOfObjectIdenticalTo:  
[theArrayController selection]];


but this does not work. Looking in the reference I see that  
[theArrayController selection] will return a proxy object. Is this the  
reason my code won't work?


How would you solve this?

/wamund
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Big picture relationships between NSConnection, NSInputStream, NSOutputStream etc

2008-12-04 Thread Ken Tozier

OK. After reading the docs on NSStream, here's what I came up with.

- (BOOL) openStreamsWithMode:(MySQLConnectMode) inMode
{
	[NSStream getStreamsToHost: host port: port inputStream: inStream  
outputStream: outStream];


if ((inStream != nil)  (outStream != nil))
{
connectMode = inMode;

[inStream retain];
[outStream retain];

[inStream setDelegate: self];
[outStream setDelegate: self];

		[inStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:  
NSDefaultRunLoopMode];
		[outStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:  
NSDefaultRunLoopMode];


[inStream open];
[outStream open];

NSLog(@inputStream: %@, outputStream: %@, inStream, 
outStream);

return YES;
}
else
		NSLog(@Failed to open inputStream: %@, outputStream: %@, inStream,  
outStream);


return NO;
}

- (void) stream:(NSStream *) inSender
handleEvent:(NSStreamEvent) inEvent
{
NSLog(@Entered: stream:handleEvent: with sender: %@, inSender);

if (inSender == inStream)
{
switch (inEvent)
{
caseNSStreamEventHasBytesAvailable:

NSLog(@NSStreamEventHasBytesAvailable);
[self readInputStreamData];
break;

caseNSStreamEventErrorOccurred:
NSLog(@NSStreamEventErrorOccurred: 
%@, [inStream streamError]);
break;

caseNSStreamEventEndEncountered:
NSLog(@NSStreamEventEndEncountered);
[self processStreamData];
break;
}

}
}

 I tried it out and got the following printout to the console

 inputStream: NSCFInputStream: 0x13d170, outputStream:  
NSCFOutputStream: 0x13d1e0

 connection: MySQLConnection: 0x824800
 Entered: stream:handleEvent: with sender: NSCFInputStream: 0x13d170
 NSStreamEventErrorOccurred: Error Domain=NSPOSIXErrorDomain Code=61  
Operation could not be completed. Connection refused
 Entered: stream:handleEvent: with sender: NSCFOutputStream:  
0x13d1e0


Which seems to make sense because MySQL requires a handshake and  
NSSocket doesn't know how to respond to that handshake. To perform the  
handshake, it seems I need to descend into BSD sockets.


Looking at the Picture browser example project shows how to set up a  
socket for listening, but not how to set one up to send the initial  
connect request to a remote process


int fdForListening;
struct sockaddr_in  serverAddress;
socklen_t   namelen = 
sizeof(serverAddress);

// In order to use NSFileHandle's acceptConnectionInBackgroundAndNotify
// method, we need to create a file descriptor that is itself a socket,
// bind that socket, and then set it up for listening. At this point,
// it's ready to be handed off to acceptConnectionInBackgroundAndNotify.

if((fdForListening = socket(AF_INET, SOCK_STREAM, 0))  0)
{
memset(serverAddress, 0, sizeof(serverAddress));

serverAddress.sin_family= AF_INET;
serverAddress.sin_addr.s_addr   = htonl(INADDR_ANY);
	serverAddress.sin_port			= 0; // allows the kernel to choose the port  
for us.


	if(bind(fdForListening, (struct sockaddr *) serverAddress,  
sizeof(serverAddress))  0)

{
close(fdForListening);
return;
}

// Find out what port number was chosen for us.
	if(getsockname(fdForListening, (struct sockaddr *) serverAddress,  
namelen)  0)

{
close(fdForListening);
return;
}

chosenPort = ntohs(serverAddress.sin_port);

if(listen(fdForListening, 1) == 0)
{
		handshakeSocket = [[NSFileHandle alloc] initWithFileDescriptor:  
fdForListening closeOnDealloc: YES];

}
}

I gather from that, I need to set the following serverAddress fields  
differently but after looking at in.h none of the INADDR_xxx modes  
jump out at me

serverAddress.sin_family= AF_INET;
serverAddress.sin_addr.s_addr   = htonl(INADDR_ANY);
serverAddress.sin_port			= 0; // allows the kernel to choose the port  
for us.


Which should I use IN_CLASSA_HOST, IN_CLASSB_HOST, other?

How does one set up a file descriptor for an initial connect request  
to a remote process?



Re: indexOfObjectIdenticalTo: problem with NSArrayController

2008-12-04 Thread Ashley Clark

On Dec 4, 2008, at 5:46 PM, Mikael Wämundson wrote:


Hi all.

Since it is good programming to not access an array's content  
through its controller when in the model I'm trying to find a way to  
get to the same object selected in the user interface (i.e. the  
array controller).


In my view I have the array content sorted by binding it to a sort  
descriptor. Thus, the indices of the array and the content of the  
array shown in the view differs.


Now, when a certain object is selected in the view I want to do  
something to this object by accessing it through the original array.  
My first, perhaps foolish, guess would be to use  
indexOfObjectIdenticalTo: or indexOfObject: like this:


int indexOfObject = [theOriginalArray indexOfObjectIdenticalTo:  
[theArrayController selection]];


but this does not work. Looking in the reference I see that  
[theArrayController selection] will return a proxy object. Is this  
the reason my code won't work?


Ask the array controller for its' selectedObjects. This returns an  
array of the selected objects and is not a proxy object like  
selection. Iterate over that array to get the indexes you're  
interested in from your original array.



Ashley___

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

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

2008-12-04 Thread Kirk Kerekes

-[NSSocketPort socket] returns a file descriptor. Write to it.

Init an NSFileHandle with it. (-[NSFileHandle initWithFileDescriptor:])


It's all just sockets/files/descriptors.





But raw messaging is not the same as writing raw bytes to a TCP
stream. All that means is that you can use the standard NSPort API as
well as using it to set up an NSConnection.

You say that you've used it to talk to sockets on other platforms.
How? The API is completely non-suitable for it. It doesn't give you a
way to simply read or write streams. Instead it deals with arrays of
messages. This is going to require some sort of custom framing
protocol which means that it's not going to be able to talk to
anything that doesn't also use that custom framing protocol. How do
you get around that limitation?

Mike


___

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

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

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

This email sent to [EMAIL PROTECTED]


  1   2   >