Cocoa : Drag/ drop from a table view onto a NSTextfield

2008-07-13 Thread vibhatha v
Hi,

I wanted some inputs regarding drag/ drop functionality in cocoa.
I have two scenarios as below:

1. I have a text field and a table view in 2 different windows.
I drag and drop a row from the table view to the textfield.
Now, after drop, i would want to have a database transaction.
I would want to validate the text that i have dropped onto the text field,
and save the text that i have dropped onto the text field in the database.
Could you please let me know as to which method can i use to tell me that
the drop has been completed? So that i can do my front end validations on
the text that i have dropped.
2. Suppose a text is already present in a text field. Now, since the text
field is editable, i can drag and drop another row of the table view onto
this text field.
 Now, the new text would be superimposed on the old text in the text field.
Is there a way, i can prevent this from happening?


Thanks and Regards,
Vibhatha
___

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

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

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

This email sent to [EMAIL PROTECTED]


Google map view in my iPhone application

2008-07-13 Thread Devraj Mukherjee
Hi all,

I am trying to explore the iPhone SDK. In my application I wish to use
a Google map with visual markers to represent contact details. Do I
just use a Web Browser component to display the map? Or is there a
better of approaching this?

Thanks for your time.

-- 
"I never look back darling, it distracts from the now", Edna Mode (The
Incredibles)
___

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

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

2008-07-13 Thread Lorenzo
Hi,
I need to execute a method only after a thread has been executed.
I guess I have to lock that thread but I don't know how.
The thread I should lock comes from a timer

timer = [[NSTimer scheduledTimerWithTimeInterval:timeInterval
target:self selector:@selector(UpdateWindow:)
userInfo:nil repeats:YES] retain];
[[NSRunLoop currentRunLoop] addTimer:timer
forMode:NSEventTrackingRunLoopMode];
[[NSRunLoop currentRunLoop] addTimer:timer
forMode:NSModalPanelRunLoopMode];


So only when UpdateWindow as been executed I have to delete an object and
prevent to work with a null pointer. Any suggestion?


Best Regards
-- 
Lorenzo
email: [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: NSTimer and NSLock

2008-07-13 Thread Simone Tellini


Il giorno 13/lug/08, alle ore 12:13, Lorenzo ha scritto:


   timer = [[NSTimer scheduledTimerWithTimeInterval:timeInterval
   target:self selector:@selector(UpdateWindow:)
   userInfo:nil repeats:YES] retain];
   [[NSRunLoop currentRunLoop] addTimer:timer
   forMode:NSEventTrackingRunLoopMode];
   [[NSRunLoop currentRunLoop] addTimer:timer
   forMode:NSModalPanelRunLoopMode];


So only when UpdateWindow as been executed I have to delete an  
object and

prevent to work with a null pointer. Any suggestion?



what prevents you from calling the method at the end of UpdateWindow?

--
Simone Tellini
http://tellini.info



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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 : Drag/ drop from a table view onto a NSTextfield

2008-07-13 Thread Marco Masser

1. I have a text field and a table view in 2 different windows.
I drag and drop a row from the table view to the textfield.
Now, after drop, i would want to have a database transaction.
I would want to validate the text that i have dropped onto the text  
field,
and save the text that i have dropped onto the text field in the  
database.
Could you please let me know as to which method can i use to tell me  
that
the drop has been completed? So that i can do my front end  
validations on

the text that i have dropped.


Take a look at the Drag and Drop Programming Topics for Cocoa  
Programming Guide:
http://developer.apple.com/documentation/Cocoa/Conceptual/DragandDrop/Concepts/dragdestination.html#/ 
/apple_ref/doc/uid/2977-BAJBJFBG


All the messages sent to the drag receiver are listed there. For your  
database transaction, -concludeDragOperation: seems to be reasonable.


2. Suppose a text is already present in a text field. Now, since the  
text
field is editable, i can drag and drop another row of the table view  
onto

this text field.
Now, the new text would be superimposed on the old text in the text  
field.

Is there a way, i can prevent this from happening?


The -prepareForDragOperation: and/or -performDragOperation: are the  
methods you'd place the handling of that into. You need an IBOutlet to  
your text field to store the string that is already entered and  
somehow merge it with the string coming from the drag operation.


Marco
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Design Question: Where to observe using KVO?

2008-07-13 Thread Patrick Mau
Ken Thomases wrote:

> How about a dictionary whose keys are NSValues representing the
> objects?  For each object, the value from the dictionary would be an
> NSMutableArray whose elements are the key paths being observed on that
> object.
> 
> // ...
> NSValue* objectKey = [NSValue valueWithNonretainedObject:object];
> NSMutableArray* keyPaths = [observers objectForKey:objectKey];
> if (!keyPaths)
> {
> keyPaths = [NSMutableArray array];
> [observers setObject:keyPaths forKey:objectKey];
> }
> [keyPaths addObject:keyPath];

Hi Ken

Do you think that observing lots of objects with lots
of keypaths is a good idea anyway?

Maybe I'm considering my first approch again, using only key-value
coding inside the view and move the observing somewhere else ...

What I like about your idea is the use of

 [NSValue valueWithNonretainedObject:object];

I didn't know that. I'm quite new to coocoa, but not to programming.

Since the number of keypaths for each object is constant, I might
decide using a custom bitmap object as the value part in the
dictionary. That bitmap would indicate which keypath is being observed.

Thanks a lot.
Patrick


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Trigonometric Problem, Particularly tan() Function

2008-07-13 Thread Patrick Walker
I can't post the whole thing because it's sort of large and  
"integrated" but here is what I have originally done.


float radians;

radians = ([entryField floatValue] * M_PI / 180);
[outField setFloatValue:tan(radians)];

A simple solution could involve using another trigonometgric  
implementation available to Xcode.  The question is are there any  
other than the numerical method "math.h" versions?   That's not so bad  
because I can simply trap +- 90 and +-270 angles but I am trying to  
get as much speed.


My other problems seems to be -2877334 itself.  To me, that appears to  
be a rather strange value for a floating point number, esp. when  
cos(pi/2) is returning near-zero (an "e-08") number as well.


Thanks for the replies.

On 13-Jul-08, at 2:06 AM, Jens Alfke wrote:



On 12 Jul '08, at 9:43 PM, Patrick Walker wrote:

Everthing appears to be fine when going from 0 to 45 degrees but at  
90 degrees, the tangent returns -22877334.


That's not what I get. I just compiled and ran:
printf("tan(90) = %g\n", tan(M_PI/2));
which printed:
tan(90) = 1.63312e+16

Which is not infinity, but close enough, given that π/2 can't be  
represented precisely in floating-point arithmetic.


I think you need to show us the code you're using, as there seems to  
be something wrong with it.


—Jens


___

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

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

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

This email sent to [EMAIL PROTECTED]


Remove overlap on NSBezierPath

2008-07-13 Thread Georg Seifert

Hello,

I don’t know if this is the right place to ask ...

How I can merge to bezierPaths  and remove the overlap in Cocoa. Does  
anyone has exerience with this or can point me to some information?


Thanks in advance
Georg___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Trigonometric Problem, Particularly tan() Function

2008-07-13 Thread Michael Hall


On Jul 13, 2008, at 8:30 AM, Patrick Walker wrote:


My other problems seems to be -2877334 itself.  To me, that appears  
to be a rather strange value for a floating point number


Tan^-1 on -2877334 on my trusty TI-36X Solar shows that as -89.975

Mike Hallhallmike at att dot net
http://www.geocities.com/mik3hall
http://sourceforge.net/projects/macnative



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Trigonometric Problem, Particularly tan() Function

2008-07-13 Thread Michael Vannorsdel
I don't think it's the cause but you should probably use tanf to avoid  
value casting to and from a double.



On Jul 13, 2008, at 7:30 AM, Patrick Walker wrote:

I can't post the whole thing because it's sort of large and  
"integrated" but here is what I have originally done.


   float radians;

   radians = ([entryField floatValue] * M_PI / 180);
   [outField setFloatValue:tan(radians)];

A simple solution could involve using another trigonometgric  
implementation available to Xcode.  The question is are there any  
other than the numerical method "math.h" versions?   That's not so  
bad because I can simply trap +- 90 and +-270 angles but I am trying  
to get as much speed.


My other problems seems to be -2877334 itself.  To me, that appears  
to be a rather strange value for a floating point number, esp. when  
cos(pi/2) is returning near-zero (an "e-08") number as well.


Thanks for the replies.


___

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

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

2008-07-13 Thread Stefan Arentz


On Jul 13, 2008, at 12:46 AM, Jens Alfke wrote:



On 12 Jul '08, at 7:50 PM, Stefan Arentz wrote:

I would like to use text labels that turn into editable text fields  
when you click them. Like Address Book has when you edit an address  
card. Does anyone know how those work? Is it a matter of flipping  
the editable property or are those custom controls?


You can implement a text field like that fairly easily; I have one  
that's a subclass of NSTextField overriding two methods (see below).


What Address Book does is a different matter. The card is, I  
believe, a single NSTextView with some tricky delegate methods that  
control what ranges of the text are editable and selectable.


—Jens

- (void) mouseDown: (NSEvent*)event
{
   if( ! [self isEditable] ) {
   [self setBezeled: YES];
   [self setDrawsBackground: YES];
   [self setEditable: YES];
   self.frame = NSInsetRect(self.frame, -2, -3);
   [self.window makeFirstResponder: self];
   }
}

- (BOOL)sendAction:(SEL)theAction to:(id)theTarget
{
   if( [self isEditable] ) {
   [self setEditable: NO];
   [self setDrawsBackground: NO];
   [self setBezeled: NO];
   self.frame = NSInsetRect(self.frame, 2, 3);
   }
   return [super sendAction: theAction to: theTarget];
}


Thanks Jens. That looks like a good start.

I did remember where I found some more 'official' code now btw. It was  
part of a Cocoa Techniques session at WWDC 2003. I did attend that  
WWDC but I can't find that code in my ADC account anymore. I guess it  
is too old. Does anyone still have a copy of that code? Or was it ever  
put on a developer DVD?


 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: Trigonometric Problem, Particularly tan() Function

2008-07-13 Thread Michael Ash
On Sun, Jul 13, 2008 at 9:30 AM, Patrick Walker
<[EMAIL PROTECTED]> wrote:
> I can't post the whole thing because it's sort of large and "integrated" but
> here is what I have originally done.
>
>float radians;
>
>radians = ([entryField floatValue] * M_PI / 180);
>[outField setFloatValue:tan(radians)];

Floats have 23 bits of accuracy. As I stated earlier, your result is
accurate to roughly 25 bits. I think this is rather better than you
should dream to hope for.

> A simple solution could involve using another trigonometgric implementation
> available to Xcode.  The question is are there any other than the numerical
> method "math.h" versions?   That's not so bad because I can simply trap +-
> 90 and +-270 angles but I am trying to get as much speed.

Your result is more accurate than you deserve to have. Switching to
another implementation is not going to solve the fundamental problem
that you're using numbers that are inherently inaccurate. You're
already as close as you're going to get with floats.

> My other problems seems to be -2877334 itself.  To me, that appears to be a
> rather strange value for a floating point number, esp. when cos(pi/2) is
> returning near-zero (an "e-08") number as well.

I don't understand what's so strange about it. The limit of tan(x) as
x approaches pi/2 from the right is negative infinity. Thus you would
expect to get very large negative numbers if you are close to pi/2 but
slightly beyond it. Which is exactly what you're giving it and exactly
what you're getting.

To repeat myself, floating point numbers are inherently inaccurate.
They aren't perfect mathematical functions. The functions themselves,
and the numbers going into them, are approximations. Your result is
already perfectly accurate to the limit of the data type you're using.

If you can state why this result is bad and what behavior you require,
maybe we can suggest how to obtain it. If you just need pi/2 to
produce NaN or INFINITY, you'll need to decide how much slop on either
side you're willing to accept, then manually check for that value with
that much slop.

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: NSTimer and NSLock

2008-07-13 Thread Michael Ash
On Sun, Jul 13, 2008 at 6:13 AM, Lorenzo <[EMAIL PROTECTED]> wrote:
> Hi,
> I need to execute a method only after a thread has been executed.
> I guess I have to lock that thread but I don't know how.
> The thread I should lock comes from a timer

Timers have nothing to do with threads. All code in a timer executes
in the thread associated with the runloop that they are scheduled in;
in this case, this is most likely the main thread. As such, NSLock is
unnecessary, as you have no other thread.

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: Design Question: Where to observe using KVO?

2008-07-13 Thread Ken Thomases

On Jul 11, 2008, at 2:45 AM, Patrick Mau wrote:


Do you think that observing lots of objects with lots
of keypaths is a good idea anyway?


Honestly, I've forgotten the original design issues you're considering.

If you need to observe lots of objects and key paths to achieve your  
purposes, then do that.


Of course, it can't hurt to consider some alternatives, like  
Notifications.  See the Cocoa Fundamentals Guide for some other  
possibilities.


One technique with KVO to reduce the number of keys that you need to  
observe on an object is to create a new property which acts as a  
single thing to observe which stands for a constellation of other  
properties.  Often, if one object is observing many properties of  
another object, there is one abstract concept that it's really  
interested in.  It's observing the many properties because it has too- 
intimate knowledge of the inner workings of the other object -- the  
classes are too closely coupled.  Instead of the observed object  
presenting an abstract concept as a whole thing, it's exposing the  
implementation details from which that whole is composed.  That forces  
the observer to pay attention to all of those details.


In such cases, you should use +keyPathsForValuesAffectingValueForKey:  
(Leopard and later) or  
+setKeys:triggerChangeNotificationsForDependentKey: (if you need to  
deploy to earlier OS versions) to teach KVO which detail properties  
comprise the whole-concept property, so change notifications in one  
cause change notifications of the other.




Since the number of keypaths for each object is constant, I might
decide using a custom bitmap object as the value part in the
dictionary. That bitmap would indicate which keypath is being  
observed.


Sounds like premature optimization to me.  *shrug*

Cheers,
Ken
___

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

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

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

This email sent to [EMAIL PROTECTED]


[NSDate +dateWithNaturalLanguageString] question

2008-07-13 Thread Jamie Phelps
Hi, all. I searched the archives regarding this method and didn't find  
anything applicable. Sorry if this has been covered.


Is there some list of acceptable strings for  
+dateWithNaturalLanguageString:? I am trying to set my Core Data  
entity's expirationDate attribute's default value to "four months from  
today" but it just returns the current date each time. Here are the  
strings I have tried:


"in four months"
"four months from now"
"four months from today"

I also tried the same strings in -awakeFromInsert to no avail.

This is on Leopard so perhaps it behaves differently than in Tiger? If  
anyone has an idea or direction to where I could find a list of  
acceptable strings, I'd greatly appreciate it.


Thanks!
JP
___

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

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

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

This email sent to [EMAIL PROTECTED]


Responder Chain Patching

2008-07-13 Thread Keith Duncan
I'm working with NSViewController to create a workflow of controllers.  
I'm trying to patch the controller into the responder chain so that I  
can implement action methods in the specific controllers and in the  
window controller.


I'm using the following code in an attempt to create a responder chain  
like this:


ButtonView -> ContainerView -> MyViewController -> WindowContentView - 
> Window -> WindowController -> etc...


- (void)setViewController:(TLViewController *)controller {
if (_viewController != controller) {
[_viewController release];
_viewController = [controller retain];
_viewController.controller = self;

[self setActiveContentView:[_viewController view]];

// Patch into the responder chain
// This must be done after the view has a superview
		[_viewController setNextResponder:[[_viewController view]  
nextResponder]];

[[_viewController view] setNextResponder:_viewController];
}
}

However, it isn't working. The view controller doesn't receive any  
messages so I've clearly overlooked something. I've confirmed in GDB  
that all the -nextResponders are set correctly; I just can't figure it  
out. I've also confirmed using -targetForAction:to:from: that the view  
controller isn't returned as the target. Implementing the methods in  
the window controller work and it's returned as the target as expected.


Keith Duncan
[EMAIL PROTECTED], 33software.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: [NSDate +dateWithNaturalLanguageString] question

2008-07-13 Thread Jamie Phelps
Well, I worked it out using NSCalendarDate's - 
dateByAddingYears:months:days:hours:minutes:seconds: but I'd still be  
curious as to why the natural language I was trying to use didn't  
work...


JP

On Jul 13, 2008, at 10:44 AM, Jamie Phelps wrote:

Hi, all. I searched the archives regarding this method and didn't  
find anything applicable. Sorry if this has been covered.


Is there some list of acceptable strings for  
+dateWithNaturalLanguageString:? I am trying to set my Core Data  
entity's expirationDate attribute's default value to "four months  
from today" but it just returns the current date each time. Here are  
the strings I have tried:


"in four months"
"four months from now"
"four months from today"

I also tried the same strings in -awakeFromInsert to no avail.

This is on Leopard so perhaps it behaves differently than in Tiger?  
If anyone has an idea or direction to where I could find a list of  
acceptable strings, I'd greatly appreciate it.


Thanks!
JP


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: [NSDate +dateWithNaturalLanguageString] question

2008-07-13 Thread Keith Duncan

I worked it out using NSCalendarDate [...]


From the docs:

Important: Use of NSCalendarDate strongly discouraged. It is not  
deprecated yet, however it may be in the next major OS release after  
Mac OS X v10.5. For calendrical calculations, you should use  
suitable combinations of NSCalendar, NSDate, and NSDateComponents,  
as described in Calendars inDates and Times Programming Topics for  
Cocoa.


The problem is that NSCalendarDate uses the gregorian calendar  
exclusively. It's simple enough to do what you want using NSCalendar,  
NSDateComponents and NSDate.


Code typed in Mail:

NSDateComponents *components = [[NSDateComponents alloc] init];
[components setMonth:4];

NSDate *now = [NSDate date];
NSDate *later = [[NSCalendar currentCalendar]  
dateByAddingComponents:components toDate:now options:0];


Keith Duncan
[EMAIL PROTECTED], 33software.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: garbage collection and NSConnection

2008-07-13 Thread Marcel Weiher


On Jul 12, 2008, at 13:42 , Michael Ash wrote:



http://www.opensource.apple.com/darwinsource/projects/apsl/CF-476.10/CFRuntime.h

typedef struct __CFRuntimeBase {
   uintptr_t _cfisa;
   uint8_t _cfinfo[4];
#if __LP64__
   uint32_t _rc;
#endif
} CFRuntimeBase;

I guess this isn't the right one, then.


If you look at the corresponding CFRuntime.c file, I think you'll find  
that there is logic there for treating part of the _cfinfo as a retain  
count (look for _CFRetain() )



To Gary, about 16-bit refcounts, I'd imagine that there's some logic
in there where if you hit 0x, it considers that to be a flag to
use an external refcount instead, at the cost of some speed.


Yep.  Inline reference counts are an optimization, as such they need  
to cater to the common case, not to the outliers (which still have to  
be handled correctly, but don't need to be as fast).


Cheers,

Marcel

___

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

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

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

This email sent to [EMAIL PROTECTED]


Webkit and image redirects

2008-07-13 Thread Rod Schmidt
I have an embedded webkit in my app. In my HTML that I display in the  
webview I have an image that refers to an image a Backpack web page.  
In Safari when you type in the URL for this image it gets redirected  
to another image that is stored on the Amazon web service. However, in  
my webview the image doesn't get redirected and hence doesn't get  
displayed. Here's what I get back in the response header fields:


"Cache-Control" = "no-cache";
Connection = "Keep-Alive";
"Content-Length" = 1712;
"Content-Type" = "text/html; charset=utf-8";
Date = "Sun, 13 Jul 2008 16:35:08 GMT";
"Keep-Alive" = "timeout=5, max=63";
Server = "Mongrel 1.1.5";
Status = "404 Not Found";

You can see that I get back a not found error and the content I get  
back is basically an error page saying I entered the wrong URL.


I'm guessing I'm missing something but I don't know what that is.  
Maybe Authentication? When I enter the URL in Safari it works without  
any Authentication. Maybe some cookies are missing?


Can anybody give me some ideas and/or point me to some docs that might  
help.


Thanks,

Rod Schmidt
infiniteNIL Software
___

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

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

2008-07-13 Thread em
 Jens--that's an awfully nice piece of work on the web-site that you pointed me 
to.
Thanks.  I hope your 'lost connection iPhone-->mac gets resolved'.  Oh, and I
couldn't overlook the 'iPhone build entry'.   I'm kicking myself for missing 
out on
the iPhone dev stuff.  I downloaded the SDK and I even own an iPod Touch, but
I'm trying to remain focussed on establishing a neighborcentric desktop.   Even
this 'triangulating webcams' is a distraction--albeit a pleasant one.

I was thinking of initially pointing three cameras at a rubik's cube--using the 
cube as a totem.  I was thinking front, right, left placement--90 degrees, 3-4 
feet away.  I was wondering how to modify the 'fast user switching' transition, 
so that it would animate in the same direction as the  rubik's cube, but 
limited to fixed axis, perpendicular motion--i.e.--rotate in 4 directions  
left, right,up(forward),down(backward).  Currently, fast user switching 
corresponds to only 'left'.  This might be a good start.  Who knows,
later, maybe after lunch, I can have them triangulated over a larger scene with 
more freedom of movement.  I have hopes of freeing myself from a really cheap
mouse (it was free--included with the iMacs) and doing exercises--keeps my neck 
from getting stiff and I have trouble sitting still when I hear the great stuff 
from iTunes.  I don't know about the rest of you, but little Roscoe, my anime 
chimpanzee fell off his chair the first time that he looked at the fast user 
switching--"hey where'd that go?--well, he didn't actually say that, but I 
could tell that's what he was thinking. 

Stefan--thanks for your reply.
I would agree with you totally.  10MB, in the present context of this brief 
conversation really is not small--but, if you'll forgive my poetic license, it's
smaller than it was yesterday, bigger than it will be tomorrow.  Capt. Grace 
Murray
Hopper gave a wonderful lecture illustrating a related point--or so Gramps 
tells me.
Gramps tells me that 10MB would have been 60 boxes of 'punched cards'.
My dad tells me that this was the capacity of the internal drive on the Lisa.
A 10MB hard drive today would be considered miniscule, but, since I was 
mentioning 'strings'--one would have to spend a long time at a keyboard before
generating a 10MB text message.  I don't think that the entire archive of 
textual content of this rather active list comes anywhere near to 10MB.
By the same token--an uncompressed 1920x1200 32-bit screenful of pixels is
close to 9MB, by my calculation.  (A picture is worth a thousand words...hmm.)
Some Hollywood stills are "beyond words" and these have provided me with
great personal pleasure--I am hesitant to share these with friends because of 
copyright restrictions.

I was thinking of moving the rubik's cube off to the left, outside of my 
desktop.  I may
convert it to a shrine with appropriate controlled lighting, so that I can't 
ignore where it is currently positioned and to ensure that my el-cheapo web 
cams can
detect its orientation, hopefully with minimum latency.  I don't know if it 
will match
my expectations--I've never tried this before.  I have decided against using 
MPI.

I believe that's a small letter 'b' in Gigabit, so it's really ~120MB.  I have 
no reason
to doubt you when you mention '1 sec,'' even tho this is slightly slower than 
the
'theoretical stated Gigabit maximum (more than a factor of 10).'  Personally, I 
doubt
whether even this speed could be achieved without a constant connection 
(NSStream? and sockets?).  This (local network performance) is an area in which 
I have very liittle practical experience.  I just installed a time capsule last 
week and I've been doing some preliminary testing.  As a matter of fact, I know 
so little about
network details that I've just checked my 'switch' and noticed that it is 
labelled as a
'eight port 10/100Mbs Ethernet switch'.  Is this "Gigabit" ethernet?  Time 
Capsule,
G5 iMac and all my mac minis support this, so this is the last 'X factor'. 

Well, I'm signing off.  I just heard the lovable Gov. Schwarrtznegger say in 
passing, as if it was common knowledge, '...since California is the most 
important state'.
I mean, he didn't even bother to say "arguably,' so I won't argue nor quibble.
How come I'm not from the most important state?  I want to be from the most 
important state.  Whatsa matta wit Illinois? (hint, the 's' is silent--Illinois 
does not 
rhyme with 'Beach Boys."  It does rhyme with 'please don't annoy'. The correct 
pronunciation (it's a French word) is probably closer to illy-nwah--but that 
certainly won't get you any street-cred anywhere on this planet:-)

Sorry for any comments that were 'painfully obvious'. I welcome any 'debugging' 
of my statements--I always try to practice
egoless 'programming'--this is very hard--generally it runs contrary to human 
nature.

Again, a most sincere thanks for the people who took time from their busy 
schedules to comment.  I wish I could express the plea

Re: Servicing Core Animations?

2008-07-13 Thread I. Savant

 I welcome any feedback, mockery, etc.


  Feedback I can give, mockery requires creativity which I'm fresh  
out of today ... long day yesterday. ;-)


If I use the option in (1) below, it works fine. If I use the option  
in (2), which is what I WANT to use, no animation occurs until after  
the mouseup happens.


  Okay, I can't say for sure (because I've not done what you're  
doing), but short-circuiting the run loop in this way can have some  
strange (though not altogether unexpected) side-effects.


  What happens if you use -mouseDragged: via the "three-method"  
approach below? That is, update the position of your button *once* on - 
mouseDown: and *once* on -mouseDragged:?


  The three-method approach:

http://developer.apple.com/documentation/Cocoa/Conceptual/EventOverview/HandlingMouseEvents/chapter_5_section_4.html#/ 
/apple_ref/doc/uid/1060i-CH6-SW3


  I suspect the animation machinery will work as expected but I could  
be wrong. :-) I still have yet to do anything fancy with it.


--
I.S.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [NSDate +dateWithNaturalLanguageString] question

2008-07-13 Thread Phil

On Jul 13, 2008, at 12:05 PM, Keith Duncan wrote:

The problem is that NSCalendarDate uses the gregorian calendar  
exclusively


I must be out of the loop on the population of developers and/or users  
complaining about this.  If the issue is the reliance on the Gregorian  
calendar, where's the push for this coming from?  Perhaps Apple sees  
the Genealogy/Ancient History/Religion as the next killer app  
category?  Sarcasm aside, I'd really like to understand what *common*  
modern uses there are for non-Gregorian calendars that make what  
appears to be an ongoing push away from easy so worthwhile.


Thanks,
Phil
___

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

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

2008-07-13 Thread Jens Alfke


On 13 Jul '08, at 6:43 AM, Georg Seifert wrote:

How I can merge to bezierPaths  and remove the overlap in Cocoa.  
Does anyone has exerience with this or can point me to some  
information?


That's a rather difficult bit of computational geometry. AFAIK,  
CoreGraphics doesn't have anything that does that.


(Back in 1994 I implemented code for doing boolean union/intersection  
operations on arbitrary polygons, which is a simplified case of what  
you're asking. It was extremely difficult, even though I was only  
implementing an already-published algorithm. I don't recommend it.)


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Trigonometric Problem, Particularly tan() Function

2008-07-13 Thread Jens Alfke


On 13 Jul '08, at 7:10 AM, Michael Vannorsdel wrote:

I don't think it's the cause but you should probably use tanf to  
avoid value casting to and from a double.


Rather, he should be using double instead of float, since he needs  
more precision. As one of the other Michaels on this thread pointed  
out, floats only have 23 bits of precision in the mantissa, while  
doubles have something like 47.


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Webkit and image redirects

2008-07-13 Thread Jens Alfke


On 13 Jul '08, at 9:49 AM, Rod Schmidt wrote:

I have an embedded webkit in my app. In my HTML that I display in  
the webview I have an image that refers to an image a Backpack web  
page. In Safari when you type in the URL for this image it gets  
redirected to another image that is stored on the Amazon web  
service. However, in my webview the image doesn't get redirected and  
hence doesn't get displayed.


Compare the HTTP requests as sent by your app vs. Safari. The best way  
to do this is by using tcpflow to log traffic to port 80.


(Unfortunately tcpflow still doesn't ship with Mac OS. Try googling  
"tcpflow mac" to find a Mac installer; or you can use macports or fink  
to install it. I highly recommend having tcpflow if you're doing any  
development that sends HTTP requests!)


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: [NSDate +dateWithNaturalLanguageString] question

2008-07-13 Thread Jens Alfke


On 13 Jul '08, at 10:52 AM, Phil wrote:

I'd really like to understand what *common* modern uses there are  
for non-Gregorian calendars


Are you serious? A large fraction of the world's population uses other  
calendars. From the Wikipedia entry "Calendar":


While the Gregorian calendar is widely used in Israel's business and  
day-to-day affairs, the Hebrew calendar, used by Jews worldwide for  
religious and cultural affairs, also influences civil matters in  
Israel (such as national holidays) and can be used there for  
business dealings (such as for the dating of checks).
The Persian calendar is used in Iran and Afghanistan. The Islamic  
calendar is used by most non-Persian Muslims worldwide. The  
Chinese,Hebrew, Hindu, and Julian calendars are widely used for  
religious and/or social purposes. The Ethiopian calendar or Ethiopic  
calendar is the principal calendar used in Ethiopia and Eritrea. In  
Thailand, where the Thai solar calendar is used, the months and days  
have adopted the western standard, although the years are still  
based on the traditional Buddhist calendar.
Even where there is a commonly used calendar such as the Gregorian  
calendar, alternate calendars may also be used, such as a fiscal  
calendar or the astronomical year numbering system[1].


Add that up and it's probably over 75% of the world's population using  
other calendars, at least for non-business purposes.


Hardcoding the Gregorian calendar is a serious internationalization  
problem, just like hardcoding the Roman alphabet or left-to-right text  
layout or octagonal red stop-sign icons.


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Trigonometric Problem, Particularly tan() Function

2008-07-13 Thread Bill Monk


On Jul 13, 2008 10:30:27 -0300, Patrick Walker  
<[EMAIL PROTECTED]> wrote:



 float radians;

 radians = ([entryField floatValue] * M_PI / 180);
 [outField setFloatValue:tan(radians)];



tan() takes a double and returns a double. Your code above truncates  
doubles three different ways - the input, the intermediate  
calculation, and the result. Instead, try something like


double_t input = [inputField doubleValue];
double_t radians = input * pi / 180;
double_t output = tan(radians);
if /* output is "near" infinity */
[outputField setStringValue:@"INFINITY"];
else
[outputField setDoubleValue:output];



My other problems seems to be -2877334 itself.


This is happening because

float radians = 90 * M_PI / 180; // == 1.57079637, truncated from  
1.5707963267948966


double result = tan(radians); // == -22877332.428856459 (with )

but you essentially do

float truncatedResult = tan(pi/2); // == -22877332, truncated from  
-22877332.428856459




The question is are there any
other than the numerical method "math.h" versions?


Instead of , you can use  along with the '-llibm'  
compiler flag to get the IEEE trig functions. It won't fix the  
truncation problem. But it does define "pi" (nice) and gives a  
slightly different result


double result = tan(pi/2); // == 1.633123935319537e+16

just on the other side of infinity from the -22877332.428856459  
obtained with . Both are "wrong" but surely "close enough"; at  
any rate about the best you can hope for.


BTW the Mac OS X Numerics manual at
 (see pages 2-8 and 9-35)  
indicates this should return a proper IEEE +INFINITY (0x7F80,  
binary 0111 1000  ). Theoretically you should  
then be able recognize those values and display text like "INFINITY"  
to the user.


I say "theoretically" because, while it's supposed to work that way  
(and I recall it did under OS8/8/7) it doesn't necessarily seem to  
anymore, given Intel and who knows what else. At least that's what  
I've seen - I asked a similar question about cos() a while back:



http://lists.apple.com/archives/xcode-users/2006/Jun/msg00453.html



This answer from one of the Apple numerics guys seems relevant:

...how come the results of cos( pi/2 ) don't agree with the  
behavior documented in PowerPC Numerics, page 148? Am I doing  
something else wrong? Googling, I see that some other math libs  
(Java, for instance) document that one should -not- expect cos( pi/  
2 ) to equal exactly zero. This is at variance with what PowerPC  
Numerics says OS X does, however.


C) If the behavior documented in PowerPC Numerics doesn't actually  
occur, what's the proper thing to do? The app has some fairly heavy  
arithmetic going on, with the results displayed to the user both  
graphically in text form. Should it round before drawing? Round  
before displaying text? Both? What have others done in this situation?


M_PI_2 (converted to double) is only an approximation to pi/2. It  
is actually (and approximately) 6.1e-17 smaller than pi/2. The next  
higher value which a 64 bit IEEE number can represent is  
approximately 1.6e-16 bigger than pi/2.


It turns out that in the neighborhood of pi/2, cos(x) can be very  
closely approximated by this simple linear function:


cos(x) =~  pi/2 - x

(derivation available upon request)

Plugging M_PI_2 into this approximation to cos(x) yields the result  
you report: 6.1e-17. Using nextafter() to find the next  
representable number above M_PI_2 and calling cos() on that number  
yields approximately -1.6e-16 (again predicted by the linear  
approximation to cos(x)).


The answer you're getting is a more accurate answer than 0 would be.


This suggests that what you're seeing is because pi/2, not being  
exactly expressible on a computer, is a slightly inaccurate argument  
to tan(). The result is accurate for the binary representation of pi/ 
2,  but that representation of pi/2 is, unavoidably, not a perfect  
right angle.


Or, to paraphrase the last sentence in the quote above, the answer  
you're getting (or will get, once you fix the truncation issues) is a  
more accurate answer than "infinity" would be.


If the result "close enough" to infinity for your purposes, just  
display "infinity" as text, or round it off to some reasonable number  
of digits so the user can see it's "close enough." This is really no  
different than what a printed trig table does - make the values look  
nice once a certain threshold is passed.


___

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

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

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

SOAP server framework?

2008-07-13 Thread Stefan

Hi,

could anybody provide a pointer to a SOAP server framework - one with  
low impedance gap regarding ObjC/Cocoa?


While there is much Java stuff available, I wonder why Apple never  
provided a SOAP server
implementation or a real Cocoa SOAP implementation. Well, maybe  
developers could use

DO instead of SOAP

Kind regards,

Stefan
___

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

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

2008-07-13 Thread Michael Ash
On Sun, Jul 13, 2008 at 12:29 PM, Marcel Weiher <[EMAIL PROTECTED]> wrote:
>
> On Jul 12, 2008, at 13:42 , Michael Ash wrote:
>
http://www.opensource.apple.com/darwinsource/projects/apsl/CF-476.10/CFRuntime.h
>>
>> typedef struct __CFRuntimeBase {
>>   uintptr_t _cfisa;
>>   uint8_t _cfinfo[4];
>> #if __LP64__
>>   uint32_t _rc;
>> #endif
>> } CFRuntimeBase;
>>
>> I guess this isn't the right one, then.
>
> If you look at the corresponding CFRuntime.c file, I think you'll find that
> there is logic there for treating part of the _cfinfo as a retain count
> (look for _CFRetain() )

So it does. That'll teach me to take CF structures at face value. Thanks.

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: importing sqlite data into a core data "database"

2008-07-13 Thread John Velman
On Sat, Jul 12, 2008 at 08:25:39PM -0700, John Velman wrote:
> Thanks, Chris,
> 
> Using the SQLite 3 api as you suggest sounds good, but there are a couple

--[snip]

Thanks to all who responded.  Things are much clearer now.   

Just a word about third party software.  I didn't mean to denegrate it!  I
use and love a good deal of third party software.   My problem with the
wrappers for SQLite was more that in addition to bing third party many are
old, documentation is sparse (and I'm novice with Cocoa), and using them
seems to put too many links in the chain -- additional places for
misunderstandings (on my part) that will slow me down.  I think I can deal
with the SQLite 3 API directly, for what I need.

Best,

John V.
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: [NSDate +dateWithNaturalLanguageString] question

2008-07-13 Thread Phil


On Jul 13, 2008, at 2:50 PM, Jens Alfke wrote:



On 13 Jul '08, at 10:52 AM, Phil wrote:

I'd really like to understand what *common* modern uses there are  
for non-Gregorian calendars


Are you serious? A large fraction of the world's population uses  
other calendars. From the Wikipedia entry "Calendar":




Apparently ignorant, but quite serious.

While the Gregorian calendar is widely used in Israel's business  
and day-to-day affairs, the Hebrew calendar, used by Jews worldwide  
for religious and cultural affairs, also influences civil matters  
in Israel (such as national holidays) and can be used there for  
business dealings (such as for the dating of checks).
The Persian calendar is used in Iran and Afghanistan. The Islamic  
calendar is used by most non-Persian Muslims worldwide. The  
Chinese,Hebrew, Hindu, and Julian calendars are widely used for  
religious and/or social purposes. The Ethiopian calendar or  
Ethiopic calendar is the principal calendar used in Ethiopia and  
Eritrea. In Thailand, where the Thai solar calendar is used, the  
months and days have adopted the western standard, although the  
years are still based on the traditional Buddhist calendar.
Even where there is a commonly used calendar such as the Gregorian  
calendar, alternate calendars may also be used, such as a fiscal  
calendar or the astronomical year numbering system[1].


Add that up and it's probably over 75% of the world's population  
using other calendars, at least for non-business purposes.




So I'm just be trapped in my own perspective/needs on this (i.e. when  
I read the 'business and day-to-day affairs' comment on the Hebrew  
calendar I think 'that's well over 90% of the use cases I can think of  
using the Gregorian calendar.')  OK, I'll quit complaining and quietly  
(re)implement what I need for my purposes.


Hardcoding the Gregorian calendar is a serious internationalization  
problem, just like hardcoding the Roman alphabet or left-to-right  
text layout or octagonal red stop-sign icons.


—Jens



I appreciate you taking the time to explain that this really is an  
issue for some folks as I didn't appreciate it as being as important  
as it apparently is.


Thanks,
Phil___

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

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

2008-07-13 Thread StaS Bandol


Hi Chris,

Thank you for your response:

My 192.168.1.2 processor can understand standard TCP/IP protocol and  
is located in my local network.
So , this 192.168.1.2 is a server in my communication and are always  
listening the port 8000 , and my app will be the client which shall  
open a socket and send him a command (a string "ping" for example).  
After that the server will send a response to my client ("pong" will  
be response to "ping")


"Note that @"http://192.168.1.2"; is a URL, not a host name.  Just  
use the host name portion of the URL." - so i shall use  
@"192.168.1.2" instead of @"http://192.168.1.2";?


Im not sure if i know how to send a predefined string ( "ping" in  
this case) to my server , that why i have used

[NSInputStream *iStream = [NSString stringWithFormat:@"ping"];

If i will use
NSInputStream *iStream = nil;
then how can i asign a string("ping") to iStream .?

Thank you very much!
StaS



On 13 Jul, 2008, at 2:35 AM, Chris Hanson wrote:


On Jul 12, 2008, at 5:22 PM, StaS Bandol wrote:


I have a basic(for most of you) question.
I´m trying to make a very simple app that will have 1 button (for  
example) and when its pushed the app will create a socket  
connection with a host and will send it a message(command).


To head this off at the pass, if you want to use HTTP there are  
easier ways than writing your own raw HTTP support.  You can use  
the NSURL... classes to do all such communication, provided your  
server speaks standard HTTP.



- (IBAction)reset:(id)sender
{
 [textField setStringValue:@"Testing Socket"];



NSString *urlStr = [sender stringValue];
 if (![urlStr isEqualToString:@""]) {

 NSURL *website = [NSURL URLWithString: @"http://192.168.1.2";];
 if (!website) {
 NSLog(@"%@ is not a valid URL");
 return;
 }
NSHost *host = [NSHost hostWithName:@"http://192.168.1.2";];


Note that @"http://192.168.1.2"; is a URL, not a host name.  Just  
use the host name portion of the URL.



NSInputStream *iStream = [NSString stringWithFormat:@"ping"];
NSOutputStream *oStream = [NSString stringWithFormat:@"ping"];


These lines are bogus as you're assigning an NSString instance to  
variables that are claimed to point to NSInputStream and  
NSOutputStream objects.  If you want to set them to some initial  
value, set them to nil.




 [NSStream getStreamsToHost:host port:8000 inputStream:&iStream
  outputStream:&oStream];
 [iStream retain];
[oStream retain];
 [iStream setDelegate:self];
 [oStream setDelegate:self];
 [iStream scheduleInRunLoop:[NSRunLoop currentRunLoop]
   forMode:NSDefaultRunLoopMode];
 [oStream scheduleInRunLoop:[NSRunLoop currentRunLoop]
   forMode:NSDefaultRunLoopMode];
 [iStream open];
 [oStream open];
 }


}



@end




but my 192.168.1.1 still not recieve nothing...
where i'm wrong?


You register your instance as a delegate for the input and output  
streams, do you actually send any data to your host once the output  
stream is opened?  If you don't, then the host won't receive  
anything.  Your delegate object should be sent appropriate messages  
when events occur on the streams, such as the streams opening or  
closing or having data available.


Of course, all of this will be different if you just use the  
NSURL... classes to handle the HTTP communication on your behalf,  
as I recommend above.  It will probably be a lot easier to get  
right, and handle lots of the little details for you.


-- Chris





___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Quick look preview multipage rich text -- NSPrintOperation inconsistency

2008-07-13 Thread Philip Dow

I have a filed a report, Bug ID# 6072333.

~Phil

On Jul 11, 2008, at 1:02 PM, Julien Jalon wrote:




On Fri, Jul 11, 2008 at 8:00 PM, Philip Dow <[EMAIL PROTECTED]> wrote:

That's right, I realized after posting the message that I should  
have boiled it down to the following:



+ (NSPrintOperation  
*)PDFOperationWithView:insideRect:toData:printInfo:
This operation produces a single page of PDF no matter what print  
settings I pass in, one very long page.


+ (NSPrintOperation *)printOperationWithView:printInfo:aPrintInfo
This operation when set to write the data to disk correctly produces  
a paginated document.


It's like the NSPrintOperation methods do not allow you to create a  
multi-page PDF in memory. You have to write it to disk first.


I did take a look at the output in both operations, and that's  
exactly what happens. The fist op gives you one long page of pdf,  
which is unreadable when scaled to fit inside the quicklook preview.  
The second op gives you what you expect.


I suppose I could use the second operation and then read back in the  
correctly paginated pdf, but then I'm writing out to the hard disk  
any time the user wants to quicklook my document. This seems like a  
terrible waste of resources.



Please, don't do that as your plug-in really should avoid doing  
anything but reading stuff on disk. Maybe someone from the AppKit  
team will be able to find the source of your problem.


--
Julien




Journler Developer
[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]


Creating the app menu from scratch

2008-07-13 Thread Jim Crafton
I'd like to be able to create an application's menu from scratch,
without a nib file. I'm having problems doing so, I've looked around
and seen some different code samples but nothing seems to work
correctly.

The simplest case:
int main(int argc, char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

NSApplication* app = [NSApplication sharedApplication];
NSMenu* appMenu = [[NSMenu alloc] initWithTitle:@"My App"];
[appMenu addItemWithTitle:@"Item 1" action:nil keyEquivalent:@""];


NSMenu* menu = [[NSMenu alloc] initWithTitle: @""];
NSMenuItem* mi = [menu addItemWithTitle:@"" action:nil 
keyEquivalent:@""];
[mi setSubmenu:appMenu];

//[NSApp performSelector:NSSelectorFromString(@"setAppleMenu:")
withObject:menu];
//[app setAppleMenu:menu];

[app setMainMenu:menu];


[[NSApplication sharedApplication] run];
 [pool release];
return 0;
}

Assuming my project is called "test7", this sort of works. It ends up
creating a menu item and a sub menu, but there's *still* a "test7"
menu item, just before the Apple menu item on the menu bar. Is there
something I'm missing? If I try and call setAppleMenu, that does
nothing. Is this even possible? Some of the code sample's I saw (from
several years ago) made references to functions in the NSMenu class
that don't seem to exist anymore, i.e. :

[self setMainMenu: [NSMenu menuWithTitle: @"" submenus: [NSArray
arrayWithObjects:
   [self applicationMenu],
   [self editMenu],
   [self windowMenu],
   [self helpMenu],
   nil]]];

There doesn't seem to be a menuWithTitle static class function
anymore, or at least it's not documented.

I tried searching the mailing list but the searches kept failing, so
I'm emailing the list directly.

Thanks

Jim
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Why aren't my bindings firing?

2008-07-13 Thread Hamish Allan
In subsequent discussion off-list, Mmalc has made it known to me that
in questioning Scott's statements that Key-Value Binding and Cocoa
Bindings are the same thing -- or rather, in failing to capitulate to
his insistence that Ron made the identical claim -- I have caused him
considerable physical and mental distress, undermined his character,
brought him into disrepute, defamed him, devalued him, and damaged
him; and that my behaviour was inexcusable, contemptible,
reprehensible and truly obnoxious.

I had no idea that it was possible to cause such calamity to a
person's reputation simply by disagreeing with them in a public forum;
let alone to cause them physical distress by doing so. I must
therefore apologise for this, and implore anyone reading the thread to
allay mmalc's concerns by making up their own mind rather than
arbitrarily choosing my interpretation of events over Scott's.

Hamish

On Wed, Jul 2, 2008 at 5:31 PM, Scott Anguish <[EMAIL PROTECTED]> wrote:

> Key value Binding and Cocoa Bindings are the same thing.
>
> Key-Value Binding is implemented at the foundation level.  Cocoa Bindings is
> the name used for the additional features (controllers, views that support
> bindings, etc..) which is implemented at the AppKit level.
>
> So there is no distinction.
___

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

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

2008-07-13 Thread Jens Alfke


On 13 Jul '08, at 12:15 PM, Stefan wrote:

could anybody provide a pointer to a SOAP server framework - one  
with low impedance gap regarding ObjC/Cocoa?


It's possible that WebObjects has SOAP support, but I don't know for  
sure.


While there is much Java stuff available, I wonder why Apple never  
provided a SOAP server

implementation or a real Cocoa SOAP implementation.


SOAP is by now primarily an enterprise technology; outside that  
environment REST is predominating. (Note that version 2.0 of Ruby On  
Rails removes the SOAP support but enhances REST.) Apple hasn't put  
much priority on enterprise developer technologies (see also the lack  
of ODBC adapters in Cocoa.) There is some client side support in CF,  
though.


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Setting Up Socket Streams

2008-07-13 Thread Jens Alfke


On 13 Jul '08, at 1:46 PM, StaS Bandol wrote:

"Note that @"http://192.168.1.2"; is a URL, not a host name.  Just  
use the host name portion of the URL." - so i shall use  
@"192.168.1.2" instead of @"http://192.168.1.2";?




Yes. Nearly any API that takes a domain name also accepts the numeric  
"dotted-quad" form.



then how can i asign a string("ping") to iStream .?



The input stream is where you receive data from. It's input for your  
process. You output data to the output stream. If you look at the API  
of NSOutputStream you'll see a -write:maxLength: method.


I really think you need to [re]read the documentation for the stream  
classes. You should also look at the CocoaEcho sample, which  
demonstrates how to do pretty much exactly what you want. You cannot  
just make stuff up and hope it works.


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Webkit and image redirects

2008-07-13 Thread Rod Schmidt
I tried that and that lead me to change the User-Agent header to  
AppleWebKit. Now I get a redirect and here are the headers I get back:


"Cache-Control" = "no-cache";
Connection = close;
"Content-Length" = 136;
"Content-Type" = "text/html; charset=utf-8";
Date = "Sun, 13 Jul 2008 21:34:53 GMT";
Location = "http://artorius.backpackit.com/images/0185/6042/thumbnail.jpg/as/6.jpg 
";

Server = "Mongrel 1.1.5";
Status = "302 Found";
"X-Runtime" = "0.00300";

Unfortunately it still doesn't work because the Location header  
redirects me to the same place as my original request. Why would it do  
that?


Rod

On Jul 13, 2008, at 12:42 PM, Jens Alfke wrote:



On 13 Jul '08, at 9:49 AM, Rod Schmidt wrote:

I have an embedded webkit in my app. In my HTML that I display in  
the webview I have an image that refers to an image a Backpack web  
page. In Safari when you type in the URL for this image it gets  
redirected to another image that is stored on the Amazon web  
service. However, in my webview the image doesn't get redirected  
and hence doesn't get displayed.


Compare the HTTP requests as sent by your app vs. Safari. The best  
way to do this is by using tcpflow to log traffic to port 80.


(Unfortunately tcpflow still doesn't ship with Mac OS. Try googling  
"tcpflow mac" to find a Mac installer; or you can use macports or  
fink to install it. I highly recommend having tcpflow if you're  
doing any development that sends HTTP requests!)


—Jens


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Creating the app menu from scratch

2008-07-13 Thread Jeff Johnson

Jim,

I wrote a series of 6 posts on my blog exploring this subject.

http://lapcatsoftware.com/blog/?s=working+without+a+nib

There are code samples for both Tiger and Leopard.

-Jeff


On Jul 13, 2008, at 4:01 PM, Jim Crafton wrote:


I'd like to be able to create an application's menu from scratch,
without a nib file. I'm having problems doing so, I've looked around
and seen some different code samples but nothing seems to work
correctly.

The simplest case:
int main(int argc, char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

NSApplication* app = [NSApplication sharedApplication];
NSMenu* appMenu = [[NSMenu alloc] initWithTitle:@"My App"];
[appMenu addItemWithTitle:@"Item 1" action:nil keyEquivalent:@""];


NSMenu* menu = [[NSMenu alloc] initWithTitle: @""];
	NSMenuItem* mi = [menu addItemWithTitle:@"" action:nil  
keyEquivalent:@""];

[mi setSubmenu:appMenu];

//[NSApp performSelector:NSSelectorFromString(@"setAppleMenu:")
withObject:menu];
//[app setAppleMenu:menu];

[app setMainMenu:menu];


[[NSApplication sharedApplication] run];
 [pool release];
return 0;
}

Assuming my project is called "test7", this sort of works. It ends up
creating a menu item and a sub menu, but there's *still* a "test7"
menu item, just before the Apple menu item on the menu bar. Is there
something I'm missing? If I try and call setAppleMenu, that does
nothing. Is this even possible? Some of the code sample's I saw (from
several years ago) made references to functions in the NSMenu class
that don't seem to exist anymore, i.e. :

[self setMainMenu: [NSMenu menuWithTitle: @"" submenus: [NSArray
arrayWithObjects:
   [self applicationMenu],
   [self editMenu],
   [self windowMenu],
   [self helpMenu],
   nil]]];

There doesn't seem to be a menuWithTitle static class function
anymore, or at least it's not documented.

I tried searching the mailing list but the searches kept failing, so
I'm emailing the list directly.

Thanks

Jim


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: SOAP server framework?

2008-07-13 Thread Stefan

Am 13.07.2008 um 23:08 schrieb Jens Alfke:



On 13 Jul '08, at 12:15 PM, Stefan wrote:

could anybody provide a pointer to a SOAP server framework - one  
with low impedance gap regarding ObjC/Cocoa?


It's possible that WebObjects has SOAP support, but I don't know for  
sure.


While there is much Java stuff available, I wonder why Apple never  
provided a SOAP server

implementation or a real Cocoa SOAP implementation.


SOAP is by now primarily an enterprise technology;


Yes, but I don't see, why this is an argument against implementing it  
in OS X.


Anyway, I found the csoap lib [http://csoap.sourceforge.net/], which  
compiles and installes

on OS X and includes a simple HTTP server, which ships SOAP messages.

Except I haven't played with it, it might be a way to go.

Thx and kind regards,

Stefan
___

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

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

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

This email sent to [EMAIL PROTECTED]


Custom NSCells

2008-07-13 Thread Paul Williams
Hi,

I am trying to find a way where I can use a NSTableView to display a list of
buttons(NSButtonCell) which can be hidden depending on the state of the
program.
I have tried using a custom NSCells, but the only object I can can pass to
my custom cell is a NSCFBoolean.
Is there a way I can pass more information to my custom cell so I can have a
button which can be set to On,Off or hidden.

Thanks
Paul Williams
___

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

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

2008-07-13 Thread John Zorko


Stefan,

Though it's not ObjC, i've used gSOAP in several projects for SOAP  
clients and servers.  If you have a WSDL, it will generate either a C  
or C++ interface (your choice) from it.  Otherwise, it will generate  
the WSDL given a header file that you define.


Regards,

John

Falling You - exploring the beauty of voice and sound
http://www.fallingyou.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: Remove overlap on NSBezierPath

2008-07-13 Thread Graham Cox
Are you talking about performing union, intersection, difference (i.e.  
"set" operations)? If so, this is not a simple problem. Cocoa doesn't  
have anything built in to do it, and in fact there is no known general  
solution for arbitrary bezier curves (though there are plenty of  
practical/heuristic methods that work for most practically useful  
cases, and I for one would love to see these as part of CG, as they  
are part of Java, Flash, etc).


In the meantime, there is a general solution for vector paths (i.e.  
paths that consist of short straight line segments) and you can  
flatten a bezier path to one of these easily. One of the best  
implementations I've run across is General Polygon Clipper by Alan  
Murta (http://www.cs.man.ac.uk/~toby/alan/software/) - free for non- 
comercial use but not for commercial use. I have written some  
straightforward categories on NSBezierPath that translate  
NSBezierpaths to and from GPC's internal representation and also  
provide some high-level methods to directly perform set operations.  
This code is part of DrawKit (http://apptree.net/drawkitmain.htm) and  
also covered on CocoaDev here:


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

hth,


Graham



On 13 Jul 2008, at 11:43 pm, Georg Seifert wrote:


Hello,

I don’t know if this is the right place to ask ...

How I can merge to bezierPaths  and remove the overlap in Cocoa.  
Does anyone has exerience with this or can point me to some  
information?


Thanks in advance
Georg___

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

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

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


[Moderator] Re: Why aren't my bindings firing?

2008-07-13 Thread Scott Anguish

Your message is entirely off topic and totally inappropriate.

I can't see how anyone on the list could feel this was an appropriate  
response.


On Jul 13, 2008, at 5:06 PM, Hamish Allan wrote:





This isn't relevant and is personal information that should not be  
posted.. Whether about me, or someone else, this will absolute NOT be  
tolerated.



I had no idea that it was possible to cause such calamity to a
person's reputation simply by disagreeing with them in a public  
forum;


Continued misrepresentation of ANY list user's position, is  
inappropriate. Disagreement is not.




let alone to cause them physical distress by doing so. I must
therefore apologise for this, and implore anyone reading the thread  
to

allay mmalc's concerns by making up their own mind rather than
arbitrarily choosing my interpretation of events over Scott's.



This is harassment, plain and simple.

Behavior such as this is not appropriate for any forum.

This thread is closed.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: [NSDate +dateWithNaturalLanguageString] question

2008-07-13 Thread Deborah Goldsmith
The Thai, Hebrew, and Islamic calendars are quite important in the  
software market, and there is one other that Jens didn't mention: the  
Japanese calendar. The Japanese era system is heavily used in Japan: http://en.wikipedia.org/wiki/Japanese_era_name


While the months and days of the Japanese calendar match the Gregorian  
calendar, the years and eras do not, and you need NSCalendar to handle  
that.


Mac OS X 10.5 supports Gregorian, Japanese, Thai, Hebrew, and Islamic  
(two kinds) calendars.


Deborah Goldsmith
Apple Inc.
[EMAIL PROTECTED]

On Jul 13, 20 Heisei, at 13:41, Phil wrote:



On Jul 13, 2008, at 2:50 PM, Jens Alfke wrote:



On 13 Jul '08, at 10:52 AM, Phil wrote:

I'd really like to understand what *common* modern uses there are  
for non-Gregorian calendars


Are you serious? A large fraction of the world's population uses  
other calendars. From the Wikipedia entry "Calendar":




Apparently ignorant, but quite serious.

While the Gregorian calendar is widely used in Israel's business  
and day-to-day affairs, the Hebrew calendar, used by Jews  
worldwide for religious and cultural affairs, also influences  
civil matters in Israel (such as national holidays) and can be  
used there for business dealings (such as for the dating of checks).
The Persian calendar is used in Iran and Afghanistan. The Islamic  
calendar is used by most non-Persian Muslims worldwide. The  
Chinese,Hebrew, Hindu, and Julian calendars are widely used for  
religious and/or social purposes. The Ethiopian calendar or  
Ethiopic calendar is the principal calendar used in Ethiopia and  
Eritrea. In Thailand, where the Thai solar calendar is used, the  
months and days have adopted the western standard, although the  
years are still based on the traditional Buddhist calendar.
Even where there is a commonly used calendar such as the Gregorian  
calendar, alternate calendars may also be used, such as a fiscal  
calendar or the astronomical year numbering system[1].


Add that up and it's probably over 75% of the world's population  
using other calendars, at least for non-business purposes.




So I'm just be trapped in my own perspective/needs on this (i.e.  
when I read the 'business and day-to-day affairs' comment on the  
Hebrew calendar I think 'that's well over 90% of the use cases I can  
think of using the Gregorian calendar.')  OK, I'll quit complaining  
and quietly (re)implement what I need for my purposes.


Hardcoding the Gregorian calendar is a serious internationalization  
problem, just like hardcoding the Roman alphabet or left-to-right  
text layout or octagonal red stop-sign icons.


—Jens



I appreciate you taking the time to explain that this really is an  
issue for some folks as I didn't appreciate it as being as important  
as it apparently is.


Thanks,
Phil___

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

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

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

2008-07-13 Thread Scott Anguish
Have a look at /Developer/Examples/AppKit/SimpleBrowser and  
DragNDropOutlineView


both of these implement cells that show more information.


On Jul 13, 2008, at 6:59 PM, Paul Williams wrote:


Hi,

I am trying to find a way where I can use a NSTableView to display a  
list of
buttons(NSButtonCell) which can be hidden depending on the state of  
the

program.
I have tried using a custom NSCells, but the only object I can can  
pass to

my custom cell is a NSCFBoolean.
Is there a way I can pass more information to my custom cell so I  
can have a

button which can be set to On,Off or hidden.



___

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

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

2008-07-13 Thread Matt Neuburg
On Sun, 13 Jul 2008 16:48:45 +0100, Keith Duncan <[EMAIL PROTECTED]> said:
>I'm working with NSViewController to create a workflow of controllers.
>I'm trying to patch the controller into the responder chain so that I
>can implement action methods in the specific controllers and in the
>window controller.
>
>I'm using the following code in an attempt to create a responder chain
>like this:
>
>ButtonView -> ContainerView -> MyViewController -> WindowContentView -
> > Window -> WindowController -> etc...
>
>- (void)setViewController:(TLViewController *)controller {
> if (_viewController != controller) {
>  [_viewController release];
>  _viewController = [controller retain];
>  _viewController.controller = self;
>  
>  [self setActiveContentView:[_viewController view]];
>  
>  // Patch into the responder chain
>  // This must be done after the view has a superview
>  [_viewController setNextResponder:[[_viewController view]
>nextResponder]];
>  [[_viewController view] setNextResponder:_viewController];
> }
>}
>
>However, it isn't working. The view controller doesn't receive any
>messages

This might not be of any help, because I know nothing whatever about
NSViewController or why you'd want to insert one into the responder chain
(and whether that's okay or necessary to do). But I *am* a *huge* fan of
inserting stuff into the responder chain - it's something I do all the time.
And when I do it, I patch the chain in opposite order.

For example, in several of my apps I inject an NSResponder subclass instance
after an NSTableView (so, between the table view and the window - actually,
it's between the table view's containing scrollview and the window). And
here's how the code goes (I use awakeFromNib and keep an instance of my
NSResponder subclass in the nib, so that I am guaranteed of having just one
and of having everything hook up at the appropriate moment):

- (void) awakeFromNib {
NSResponder* r = [[myTableView enclosingScrollView] nextResponder];
[[myTableView enclosingScrollView] setNextResponder: self];
[self setNextResponder: r];
}

It might help or it might make no difference at all, but that's the kind of
thing that works for me... m.

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




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: SOAP server framework?

2008-07-13 Thread Devon Ferns

Check out nusoap which is a php soap framework/library.
It's really easy to set up your own soap functions on the server and  
it generates the WSDL file for you dynamicall


Devon

On 13-Jul-08, at 6:34 PM, Stefan wrote:


Am 13.07.2008 um 23:08 schrieb Jens Alfke:



On 13 Jul '08, at 12:15 PM, Stefan wrote:

could anybody provide a pointer to a SOAP server framework - one  
with low impedance gap regarding ObjC/Cocoa?


It's possible that WebObjects has SOAP support, but I don't know  
for sure.


While there is much Java stuff available, I wonder why Apple never  
provided a SOAP server

implementation or a real Cocoa SOAP implementation.


SOAP is by now primarily an enterprise technology;


Yes, but I don't see, why this is an argument against implementing  
it in OS X.


Anyway, I found the csoap lib [http://csoap.sourceforge.net/], which  
compiles and installes

on OS X and includes a simple HTTP server, which ships SOAP messages.

Except I haven't played with it, it might be a way to go.

Thx and kind regards,

Stefan
___

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

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

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

This email sent to [EMAIL PROTECTED]




smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Creating the app menu from scratch

2008-07-13 Thread Jim Crafton
Thanks, that looks pretty much exactly what I'm after. The only
question I had was that this seems to be specific to the 10.5 Obj
runtime, is there a way to do this on 10.4 or even 10.3.9? Also is
this "safe", exchanging class methods like this seems pretty wild,
I've not seen something like this before in other languages.

Cheers

Jim

On Sun, Jul 13, 2008 at 6:19 PM, Jeff Johnson
<[EMAIL PROTECTED]> wrote:
> Jim,
>
> I wrote a series of 6 posts on my blog exploring this subject.
>
> http://lapcatsoftware.com/blog/?s=working+without+a+nib
>
> There are code samples for both Tiger and Leopard.
>
> -Jeff
>
>
> On Jul 13, 2008, at 4:01 PM, Jim Crafton wrote:
>
>> I'd like to be able to create an application's menu from scratch,
>> without a nib file. I'm having problems doing so, I've looked around
>> and seen some different code samples but nothing seems to work
>> correctly.
>>
>> The simplest case:
>> int main(int argc, char *argv[])
>> {
>>NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
>>
>>NSApplication* app = [NSApplication sharedApplication];
>>NSMenu* appMenu = [[NSMenu alloc] initWithTitle:@"My App"];
>>[appMenu addItemWithTitle:@"Item 1" action:nil keyEquivalent:@""];
>>
>>
>>NSMenu* menu = [[NSMenu alloc] initWithTitle: @""];
>>NSMenuItem* mi = [menu addItemWithTitle:@"" action:nil
>> keyEquivalent:@""];
>>[mi setSubmenu:appMenu];
>>
>>//[NSApp performSelector:NSSelectorFromString(@"setAppleMenu:")
>> withObject:menu];
>>//[app setAppleMenu:menu];
>>
>>[app setMainMenu:menu];
>>
>>
>>[[NSApplication sharedApplication] run];
>> [pool release];
>>return 0;
>> }
>>
>> Assuming my project is called "test7", this sort of works. It ends up
>> creating a menu item and a sub menu, but there's *still* a "test7"
>> menu item, just before the Apple menu item on the menu bar. Is there
>> something I'm missing? If I try and call setAppleMenu, that does
>> nothing. Is this even possible? Some of the code sample's I saw (from
>> several years ago) made references to functions in the NSMenu class
>> that don't seem to exist anymore, i.e. :
>>
>> [self setMainMenu: [NSMenu menuWithTitle: @"" submenus: [NSArray
>> arrayWithObjects:
>>   [self applicationMenu],
>>   [self editMenu],
>>   [self windowMenu],
>>   [self helpMenu],
>>   nil]]];
>>
>> There doesn't seem to be a menuWithTitle static class function
>> anymore, or at least it's not documented.
>>
>> I tried searching the mailing list but the searches kept failing, so
>> I'm emailing the list directly.
>>
>> Thanks
>>
>> Jim
>>
>
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Remove overlap on NSBezierPath

2008-07-13 Thread David Duncan

On Jul 13, 2008, at 6:43 AM, Georg Seifert wrote:


I don’t know if this is the right place to ask ...

How I can merge to bezierPaths  and remove the overlap in Cocoa.  
Does anyone has exerience with this or can point me to some  
information?



Now one thing that no one has really asked is, do you need a  
mathematical representation of this, or just a graphical representation?


If you just need a graphical representation, then you might be able to  
do this by drawing both beziers and then manipulating the blend mode  
to draw what you want. I haven't tried this myself, and I haven't  
thought too much about it beyond that it might be easier in the  
graphical domain, but if all you need is graphics, then consider the  
issue to be a graphical one rather than a mathematical one.

--
David Duncan
Apple DTS Animation and Printing
[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: [NSDate +dateWithNaturalLanguageString] question

2008-07-13 Thread Nick Zitzmann


On Jul 13, 2008, at 6:47 PM, Deborah Goldsmith wrote:

Mac OS X 10.5 supports Gregorian, Japanese, Thai, Hebrew, and  
Islamic (two kinds) calendars.



What's the NSCalendar identifier for the Thai calendar? I don't see  
one documented in the NSLocale docs.


Nick Zitzmann





___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Creating the app menu from scratch

2008-07-13 Thread Bill Bumgarner

On Jul 13, 2008, at 8:16 PM, Jim Crafton wrote:

Thanks, that looks pretty much exactly what I'm after. The only
question I had was that this seems to be specific to the 10.5 Obj
runtime, is there a way to do this on 10.4 or even 10.3.9? Also is
this "safe", exchanging class methods like this seems pretty wild,
I've not seen something like this before in other languages.


What are you trying to do?

Trying to write Cocoa applications without using NIB files and other  
standard mechanisms is quite difficult and the need is exceedingly rare.


And, no, exchanging class methods is not a typical pattern to be  
employed when developing a Cocoa application. In particular, replacing  
or exchanging method implementations found in Apple frameworks is  
completely unsupported and will quite likely break in the future.


b.bum



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Custom NSCells

2008-07-13 Thread Michael Ash
On Sun, Jul 13, 2008 at 6:59 PM, Paul Williams <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am trying to find a way where I can use a NSTableView to display a list of
> buttons(NSButtonCell) which can be hidden depending on the state of the
> program.
> I have tried using a custom NSCells, but the only object I can can pass to
> my custom cell is a NSCFBoolean.
> Is there a way I can pass more information to my custom cell so I can have a
> button which can be set to On,Off or hidden.

There are two ways to give more information to your custom cell:

- Use an NSDictionary or an instance of a custom class as your object
value. If you're using a data source, return this object in your
objectValueForTableColumn method. If you're using bindings, bind the
array to a key path which produces this object. In both cases, this
dictionary or custom object will be passed to your cell's
-setObjectValue: method, and then you can do whatever you want with
its contents.

- Implement the willDisplayCell delegate method. This method is called
just before the cell is displayed, and at that point you can do
whatever you want to it based on the column/row information provided.
Depending on exactly what you need, you may not even need to implement
an NSCell subclass if you use this approach, if you can customize
NSButtonCell sufficiently.

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: Custom NSCells

2008-07-13 Thread Matt Neuburg
On Mon, 14 Jul 2008 10:59:44 +1200, "Paul Williams" <[EMAIL PROTECTED]> said:
>Hi,
>
>I am trying to find a way where I can use a NSTableView to display a list of
>buttons(NSButtonCell) which can be hidden depending on the state of the
>program.
>I have tried using a custom NSCells, but the only object I can can pass to
>my custom cell is a NSCFBoolean.
>Is there a way I can pass more information to my custom cell so I can have a
>button which can be set to On,Off or hidden.

I think a typical approach is to implement
tableView:willDisplayCell:forTableColumn:row: in the table view's delegate.
m.

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




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Creating the app menu from scratch

2008-07-13 Thread Michael Ash
On Sun, Jul 13, 2008 at 5:01 PM, Jim Crafton <[EMAIL PROTECTED]> wrote:
> I'd like to be able to create an application's menu from scratch,
> without a nib file.

Can you elaborate on why? Most of the time from what I've seen, when
people think they need to do this, they really don't. For example:

- People making games want to control everything. It works just as
well if you make a little NSApp delegate object in the MainMenu.nib
and take control from there.

- People implementing a framework that needs to create everything
programmatically. Instead of going without a nib, create a stub
MainMenu.nib which contains as little as possible but still gets your
program up and running. At that point you can then customize the menu
and everything else in code.

- If you're making a naked binary, there's might be no good place to
put the nib. This case is a little trickier, but you can work around
it. You can do this by taking advantage of the fact that the NSNib
class supports NSCoding. Make a little helper tool that loads the nib
using NSNib, serializes it with NSKeyedArchiver, and then writes the
data into something readable. (If you're embedding into your source,
you can have it output C char array syntax.) Then your main binary can
load that data into an NSData, reconstitute the NSNib object from it,
and load it.

- Learning. Occasionally somebody decides that building a nibless
application is the best way to learn about Cocoa. From what I've seen
it's really just a very complicated way to learn about a bunch of
painful, otherwise-useless aspects of Cocoa.

I'm sure we can help you out if you want more information about any of
the above propositions.

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: [NSDate +dateWithNaturalLanguageString] question

2008-07-13 Thread Deborah Goldsmith

On Jul 13, 2008, at 8:34 PM, Nick Zitzmann wrote:
What's the NSCalendar identifier for the Thai calendar? I don't see  
one documented in the NSLocale docs.


NSBuddhistCalendar

Deborah Goldsmith
Apple Inc.
[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: Remove overlap on NSBezierPath

2008-07-13 Thread Graham Cox
If all you need is a fill, and a union, it's trivial just to paint two  
paths one on top of the other. If one path completely surrounds the  
other you can get a difference effect by appending the paths and using  
the appropriate winding rule. XOR likewise. But these are about the  
only situations you can handle with Cocoa/Quartz as it stands.


Stroking paths that intersect in any way generally can't be done.  
Finding the intersection of two paths can't be done.


If you wanted to perform the rasterization of the paths yourself there  
are more options, but that's a pretty hefty task (using anti-grain  
geometry or similar) to take on just to gain some peripheral  
functionality.


Since apps like Adobe Illustrator and Flash can perform these  
operations on bezier paths, clearly there are methods that exist for  
doing it, even though the mathematicians claim otherwise (what they  
are claiming is the lack of a general all-purpose solution to the  
arbitrary intersection of bezier paths, but for real-world graphics  
there wouldn't be too many pathological cases to worry about).


I'd love to see these features added to Cocoa, as it would open up the  
ability to compete with the likes of Adobe to us ordinary mortals in  
some areas, and for anyone but Adobe, I can't see how that can be a  
bad thing.


cheers, Graham


On 14 Jul 2008, at 1:28 pm, David Duncan wrote:


On Jul 13, 2008, at 6:43 AM, Georg Seifert wrote:


I don’t know if this is the right place to ask ...

How I can merge to bezierPaths  and remove the overlap in Cocoa.  
Does anyone has exerience with this or can point me to some  
information?



Now one thing that no one has really asked is, do you need a  
mathematical representation of this, or just a graphical  
representation?


If you just need a graphical representation, then you might be able  
to do this by drawing both beziers and then manipulating the blend  
mode to draw what you want. I haven't tried this myself, and I  
haven't thought too much about it beyond that it might be easier in  
the graphical domain, but if all you need is graphics, then consider  
the issue to be a graphical one rather than a mathematical one.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Creating the app menu from scratch

2008-07-13 Thread Jim Crafton
> Can you elaborate on why? Most of the time from what I've seen, when
> people think they need to do this, they really don't. For example:

Sure, I'm porting a framework over to OS X. The framework (in C++),
doesn't use NIBs, but does (obviously) use menu items and thus I need
to be able to populate the menu bar. I had figured populating it
programmatically wouldn't be this difficult. The framework libs will
exist as OS X Frameworks, and I wasn't sure if I can have nib's in the
Framework binary. Everything else in Cocoa seems relatively
straightforward, I'm not sure why menus are such a big deal.

> - People implementing a framework that needs to create everything
> programmatically. Instead of going without a nib, create a stub
> MainMenu.nib which contains as little as possible but still gets your
> program up and running. At that point you can then customize the menu
> and everything else in code.

This is my case. I'll try and look into that. Any examples like this
around (keeping in mind that this eventually has to exist inside of a
Framework as opposed to an app)?

Cheers

Jim
___

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

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

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

This email sent to [EMAIL PROTECTED]


NSUserDefaultsController, when does value change?

2008-07-13 Thread James W. Walker
I have a preferences dialog that I'm using with an  
NSUserDefaultsController instance, my first use of bindings, and it  
works.  But I want to post a notification when a certain setting  
changes.  In my method that shows the dialog, I record the old value  
of the setting.  In my action method for the OK button, I send a save  
message to the defaults controller  (the "applies immediately" option  
is off), send a synchronize message to the NSUserDefaults, then check  
the value of the setting and compare it to the old value.  But the  
value has not changed!  It obviously gets changed at some point,  
because the next time I bring up the dialog, the new value has is  
there.  What am I missing?

___

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

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

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

This email sent to [EMAIL PROTECTED]


IKImageBrowserView aspect ratio

2008-07-13 Thread Chilton Webb
Hi,

I have a lot of 4:3 ratio images I'd like to line up with IKImageBrowserView. 
Unfortunately, the default configuration forces all of the IKImageBrowserView 
cells to be square. Is there a way to set the aspect ratio of the 
IKImageBrowserView cells?

Thank you,
-Chilton Webb
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Creating the app menu from scratch

2008-07-13 Thread Bill Bumgarner

On Jul 13, 2008, at 9:25 PM, Jim Crafton wrote:

Can you elaborate on why? Most of the time from what I've seen, when
people think they need to do this, they really don't. For example:

Sure, I'm porting a framework over to OS X. The framework (in C++),
doesn't use NIBs, but does (obviously) use menu items and thus I need
to be able to populate the menu bar. I had figured populating it
programmatically wouldn't be this difficult. The framework libs will
exist as OS X Frameworks, and I wasn't sure if I can have nib's in the
Framework binary. Everything else in Cocoa seems relatively
straightforward, I'm not sure why menus are such a big deal.


Your application's menu isn't that big of a deal, but your  
application's integration with Mac OS X is a very big deal and that is  
most of the battle of doing "nib less" development.   It is much more  
than just populating the main menu.   Specifically, the application  
wrapper -- the .app -- typically contains all kinds of metadata that  
is used by Mac OS X to integrate the application into the system, both  
from the Finder's perspective and when the application is run.


How do you bootstrap the framework?  I.e. what executable is run that  
uses the resources from the framework?  That is the most likely place  
to stick the MainMenu.nib and let Cocoa bootstrap the normal way.



- People implementing a framework that needs to create everything
programmatically. Instead of going without a nib, create a stub
MainMenu.nib which contains as little as possible but still gets your
program up and running. At that point you can then customize the menu
and everything else in code.


This is my case. I'll try and look into that. Any examples like this
around (keeping in mind that this eventually has to exist inside of a
Framework as opposed to an app)?


Sure.  Create a new Cocoa Application project in Xcode.  That is about  
the most minimal example of a working standard Cocoa application  
available.


From there, it would simply be a matter of:

- creating an Application Delegate object

- responding to -applicationWillFinishLaunching: or - 
applicationDidFinishLaunching:


- grabbing whatever is needed from your framework and populating the  
menu bar


b.bum



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Remove overlap on NSBezierPath

2008-07-13 Thread Brett Powley
How I can merge to bezierPaths  and remove the overlap in Cocoa.  
Does anyone has exerience with this or can point me to some  
information?


It's not going to solve this problem generally for you, but you could  
start with the code provided generously by Omni:


http://www.omnigroup.com/developer/

and in particular, the NSBezierPath-OAExtensions category in  
OmniAppKit/OpenStepExtensions, which provides a few extra useful  
functions for operating on Bezier curves.


Cheers,
Brett


___

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

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

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

This email sent to [EMAIL PROTECTED]


NSViewController and View Swapping

2008-07-13 Thread Brad Gibbs
I'm trying to create a Cocoa app with a single window with a number of  
views that get swapped in and out, using an NSViewController for each  
of the views.


I have a series of buttons along the bottom of the UI in a custom  
view, and another custom view above the row of buttons.  When button A  
is pressed, view A should appear in the custom view above the row of  
buttons, and button A should be turned on.  When button B is pressed,  
view A should be replaced by View B, button A should turn off and  
button B should turn on.  Ultimately, I'd like to do this with an  
animation (view A fades out and view B fades in).  For now, I'd be  
happy just replacing A with B.


I haven't been able to find much in the documentation about  
NSViewController for Cocoa.  I have the Hillegass book, but the view  
swapping example in Chapter 29 is done with a document-based  
application and the views there are contained in an NSBox:


...
NSView *v = [vc view];
[box setContentView:v];
...

I don't know Cocoa well enough to adapt this example for a non- 
document-based application without an NSBox.  Could someone please  
point me to documentation for NSViewController, other than the  
NSViewController Reference, or provide me with a quick explanation or  
example code that will do this?  I've read through the Katidev blog on  
XSViewController and XSWindowController, but, again, that's a document- 
based example, and it doesn't explicitly provide methods for replacing  
one view with another.



Thanks in advance.

Brad
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: [NSDate +dateWithNaturalLanguageString] question

2008-07-13 Thread Charles Srstka

On Jul 13, 2008, at 7:47 PM, Deborah Goldsmith wrote:

The Thai, Hebrew, and Islamic calendars are quite important in the  
software market, and there is one other that Jens didn't mention:  
the Japanese calendar. The Japanese era system is heavily used in  
Japan: http://en.wikipedia.org/wiki/Japanese_era_name


While the months and days of the Japanese calendar match the  
Gregorian calendar, the years and eras do not, and you need  
NSCalendar to handle that.


Mac OS X 10.5 supports Gregorian, Japanese, Thai, Hebrew, and  
Islamic (two kinds) calendars.


What I don't get is why there can't just be a  
+dateWithYear:month:day:hour:minute:second:timeZone:calendar: method  
to replace the current  
+dateWithYear:month:day:hour:minute:second:timeZone: one instead of  
having to deal with three different classes just to do a simple task  
that used to require only one class method. You'd just put the  
calendar you wanted to use in the last parameter (or pass nil to just  
use the current calendar) and it would do the right thing. Granted,  
this seems like the sort of thing that would be pretty easy to do with  
a category on NSDate, but I'm just curious why it wasn't included with  
the standard distribution.


Charles
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Remove overlap on NSBezierPath

2008-07-13 Thread Jens Alfke


On 13 Jul '08, at 9:14 PM, Graham Cox wrote:

Since apps like Adobe Illustrator and Flash can perform these  
operations on bezier paths, clearly there are methods that exist for  
doing it, even though the mathematicians claim otherwise (what they  
are claiming is the lack of a general all-purpose solution to the  
arbitrary intersection of bezier paths, but for real-world graphics  
there wouldn't be too many pathological cases to worry about).



What the mathematicians balk at isn't the pathological cases; rather,  
getting exact results.


It's not possible to find the exact points of intersection of cubic  
curves, because it requires factoring a sixth-order polynomial, for  
which there are no known general techniques. The best you can do is to  
find approximations, using algorithms like Newton's Method. You can  
make the approximations as precise as you need by increasing the  
number of iterations. That's what existing programs do.


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Is there any way to show disclosure button always closed in NSOutlineView

2008-07-13 Thread Aman Alam
I am working on a project that needs the disclosure button of NSOutlineView 
always closed whether its row are expanded or not.


Does anyone know that how to do that? 


___

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

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

2008-07-13 Thread Nathan Kinsinger


On Jul 13, 2008, at 11:15 PM, Brad Gibbs wrote:

I'm trying to create a Cocoa app with a single window with a number  
of views that get swapped in and out, using an NSViewController for  
each of the views.


I have a series of buttons along the bottom of the UI in a custom  
view, and another custom view above the row of buttons.  When button  
A is pressed, view A should appear in the custom view above the row  
of buttons, and button A should be turned on.  When button B is  
pressed, view A should be replaced by View B, button A should turn  
off and button B should turn on.  Ultimately, I'd like to do this  
with an animation (view A fades out and view B fades in).  For now,  
I'd be happy just replacing A with B.


I haven't been able to find much in the documentation about  
NSViewController for Cocoa.  I have the Hillegass book, but the view  
swapping example in Chapter 29 is done with a document-based  
application and the views there are contained in an NSBox:


...
NSView *v = [vc view];
[box setContentView:v];
...

I don't know Cocoa well enough to adapt this example for a non- 
document-based application without an NSBox.  Could someone please  
point me to documentation for NSViewController, other than the  
NSViewController Reference, or provide me with a quick explanation  
or example code that will do this?  I've read through the Katidev  
blog on XSViewController and XSWindowController, but, again, that's  
a document-based example, and it doesn't explicitly provide methods  
for replacing one view with another.



Thanks in advance.

Brad


There is an example at:
http://developer.apple.com/samplecode/ViewController/index.html

Also what you are describing sounds a lot like an NSTabView with the  
style set to Bottom Tabs. Try creating one in IB and playing with it.  
Also look at:

http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/TabView/TabView.html
and an example with animation at:
http://developer.apple.com/samplecode/Reducer/index.html

--Nathan
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSViewController and View Swapping

2008-07-13 Thread Brad Gibbs

Thanks for the quick response and the links.

NSTabView with tabs on the bottom is exactly what I'm looking for,  
except, I'm writing a fullscreen app with stylized NSImage buttons,  
rather than tabs.  I'm still looking through the ViewController sample  
code.  Given the number of single window apps out there today, it  
seems like swapping views should be one of those common things that is  
easy to accomplish with Cocoa, rather than an uncommon thing that's  
merely possible...




On Jul 13, 2008, at 10:46 PM, Nathan Kinsinger wrote:



On Jul 13, 2008, at 11:15 PM, Brad Gibbs wrote:

I'm trying to create a Cocoa app with a single window with a number  
of views that get swapped in and out, using an NSViewController for  
each of the views.


I have a series of buttons along the bottom of the UI in a custom  
view, and another custom view above the row of buttons.  When  
button A is pressed, view A should appear in the custom view above  
the row of buttons, and button A should be turned on.  When button  
B is pressed, view A should be replaced by View B, button A should  
turn off and button B should turn on.  Ultimately, I'd like to do  
this with an animation (view A fades out and view B fades in).  For  
now, I'd be happy just replacing A with B.


I haven't been able to find much in the documentation about  
NSViewController for Cocoa.  I have the Hillegass book, but the  
view swapping example in Chapter 29 is done with a document-based  
application and the views there are contained in an NSBox:


...
NSView *v = [vc view];
[box setContentView:v];
...

I don't know Cocoa well enough to adapt this example for a non- 
document-based application without an NSBox.  Could someone please  
point me to documentation for NSViewController, other than the  
NSViewController Reference, or provide me with a quick explanation  
or example code that will do this?  I've read through the Katidev  
blog on XSViewController and XSWindowController, but, again, that's  
a document-based example, and it doesn't explicitly provide methods  
for replacing one view with another.



Thanks in advance.

Brad


There is an example at:
http://developer.apple.com/samplecode/ViewController/index.html

Also what you are describing sounds a lot like an NSTabView with the  
style set to Bottom Tabs. Try creating one in IB and playing with  
it. Also look at:

http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/TabView/TabView.html
and an example with animation at:
http://developer.apple.com/samplecode/Reducer/index.html

--Nathan


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [NSDate +dateWithNaturalLanguageString] question

2008-07-13 Thread Deborah Goldsmith

On Jul 13, 2008, at 10:34 PM, Charles Srstka wrote:
What I don't get is why there can't just be a  
+dateWithYear:month:day:hour:minute:second:timeZone:calendar: method  
to replace the current  
+dateWithYear:month:day:hour:minute:second:timeZone: one instead of  
having to deal with three different classes just to do a simple task  
that used to require only one class method. You'd just put the  
calendar you wanted to use in the last parameter (or pass nil to  
just use the current calendar) and it would do the right thing.  
Granted, this seems like the sort of thing that would be pretty easy  
to do with a category on NSDate, but I'm just curious why it wasn't  
included with the standard distribution.


Different calendars have different components. Several require an era,  
which would just be a nuisance for others. How you create a date  
depends a lot on where the data to create it is coming form.


You can use dateWithString: if you have data in guaranteed-Gregorian  
format. CFCalendarComposeAbsoluteTime also works somewhat the way you  
suggest. Finally, if it's a localized text date, you can use  
NSDateFormatter or CFDateFormatter to parse it.


If you would like to see a different kind of API added, please file an  
enhancement request.


Deborah Goldsmith
Apple Inc.
[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: Creating the app menu from scratch

2008-07-13 Thread Jeff Johnson
The code I gave in Part 6 is only for Leopard. However, the code I  
gave in Part 5 is for Tiger. It should also work for 32-bit Leopard  
as well as Panther, though I've never tested on Panther.


Note that my code is at present just a proof of concept. I'm not  
making any recommendations about whether or not you should use it.  
That's up to you to decide.


-Jeff


On Jul 13, 2008, at 10:16 PM, Jim Crafton wrote:


Thanks, that looks pretty much exactly what I'm after. The only
question I had was that this seems to be specific to the 10.5 Obj
runtime, is there a way to do this on 10.4 or even 10.3.9? Also is
this "safe", exchanging class methods like this seems pretty wild,
I've not seen something like this before in other languages.

Cheers

Jim

On Sun, Jul 13, 2008 at 6:19 PM, Jeff Johnson
<[EMAIL PROTECTED]> wrote:

Jim,

I wrote a series of 6 posts on my blog exploring this subject.

http://lapcatsoftware.com/blog/?s=working+without+a+nib

There are code samples for both Tiger and Leopard.

-Jeff


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Creating the app menu from scratch

2008-07-13 Thread Jeff Johnson

On Jul 13, 2008, at 10:37 PM, Bill Bumgarner wrote:

And, no, exchanging class methods is not a typical pattern to be  
employed when developing a Cocoa application. In particular,  
replacing or exchanging method implementations found in Apple  
frameworks is completely unsupported and will quite likely break in  
the future.


b.bum


I fully admit that the use of the private methods -[NSApplication  
setAppleMenu:] and -[NSMenu _setMenuName:] is completely unsupported  
and may break in the future, though I hope that they don't and that  
in fact Apple provides public API for this functionality.


On the other hand, the function method_exchangeImplementations() just  
became public API in Leopard, so I don't see how that can break  
anytime soon. It's not much different than subclassing or  
'categorizing'.


-Jeff

___

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

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

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

This email sent to [EMAIL PROTECTED]