Re: Bindings Concept Question

2008-06-21 Thread Ken Thomases

On Jun 21, 2008, at 12:16 AM, Alex Wait wrote:

When the app starts, I see the data as expected. However, when I  
call my add

function, which gets the strings from the textFields and makes the
new Data object and adds it to the array, I do not see it in the  
table.


Without seeing your add method, I can't be sure but I can guess at the  
problem.  I suspect you're modifying the mutable array in a manner  
which does not send out the proper KVO (key-value observing)  
notifications.


I'll quote myself from an earlier thread http://lists.apple.com/archives/cocoa-dev/2008/May/msg01031.html 
:



There are two common misconceptions [...]:

1) KVO is not for observing properties, as such.  It's for observing  
the object which _has_ the property.  To put it another way: I don't  
observe the number, I observe the controller for changes in its  
number property.


2) A property is _not_ the ivar.  The ivar, if it exists at all, is  
an implementation detail of how the class implements the property.   
A property is part of the interface of the object.  You will find it  
much easier if you conceptualize a property as the set of KVC- 
conforming methods in the object's interface.  A key is a string  
naming or identifying a property.  (Yes, KVC and KVO provide built- 
in support for properties which don't have accessor methods.  They  
will access the ivar directly.  However, this is just a convenience  
and a fall-back position.  It doesn't materially change how you  
should conceptualize properties.)


To illustrate:

@interface Foo : NSObject
{
NSNumber* number;   //  --  This is NOT the property
}

// _These_ are the property:
- (NSNumber*) number;
- (void) setNumber:(NSNumber*)newNumber;

@end


// ... in some other code somewhere

Foo* myFoo = /* ... */
[myFoo addObserver:self forKeyPath:@number];

This object (self) is observing the myFoo object for changes in its  
number property.


[...]  Often people have a class with an NSMutableArray ivar, and  
they get confused as to why modifications that they make directly to  
that ivar (as by -addObject:, for example) don't result in KVO  
notifications and updates to the bound GUI elements.  The reason is  
that nothing is observing that array.  They are observing the owning  
object for changes of the property for which that ivar is backing  
storage.


The array does not (and can not) send out KVO notifications.  For  
one thing, it doesn't know what object owns it nor what property it  
represents.  The owning object is what sends out the KVO  
notifications.  In order for it to do that, the owning object must  
be messaged.  It might be messaged with a KVC-conforming setter such  
as setKey: or insertObject:inKeyAtIndex:, in which case KVO  
hooks into those methods using low-level techniques of the Objective- 
C runtime (isa-swizzling).  Or, it might be messaged with will/ 
didChange:valuesAtIndexes:forKey:.  One way or another, though, the  
owning object has to be messaged if it is to produce KVO  
notifications.


KVO does provide the -mutableArrayValueForKey... methods to create a  
proxy object which you can treat as a mutable array but which  
messages the owning object to carry out the actual modifications.   
In that way, the owning object is able to send out KVO notifications  
as necessary.  (Even if the proxy ends up accessing the ivar  
directly, it still messages the owning object with -will/ 
didChange:valuesAtIndexes:forKey:.)


I hope that makes it clearer.

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]


Re: SplashScreen issues

2008-06-21 Thread Damien Cooke

Jens,
You make an excellent point.  My app does take too long to load.  Once  
I get closer to release I will see what I can do to reduce the load  
time.  Perhaps move some stuff out of the MainMenu.xib.


Thanks for your assistance.

Regards
Damien

On 21/06/2008, at 9:11 AM, Jens Alfke wrote:



On 20 Jun '08, at 4:13 PM, Damien Cooke wrote:

When creating a splash screen what condition do you use to decide  
when to close your splash screen?  Is there some obvious event that  
is triggered that I can use?


Your app delegate's -applicationDidFinishLaunching: method is  
probably the best place. That's the final callback you're going to  
get from NSApplication during the launch process; it happens after  
any documents/URLs are opened.


do I use [window orderOut:self] to close it? Or is there a better  
way?


That's how you close a window.

That said, I think splash screens are largely unnecessary. Often the  
presence of a splash screen is a sign that the app launches too  
slowly. Notice that Photoshop Elements 6 has a splash screen, which  
stays up for about 30 seconds while it launches, and helpfully shows  
the names of all the things it's loading. By comparison, Pixelmator  
comes up in about three seconds on my machine, without showing a  
splash screen. Guess which app I'm more likely to use?


—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: Race in Apple's NSTreeContoller/NSOutlineView

2008-06-21 Thread Godfrey van der Linden

Ok I gave up.  No response was expected and I received what I expected.

I suspect, but can't prove it, that there is a subtle race in the  
NSTreeContoller's bindings when the view that it is defined is is  
loaded late by programtically adding its outline view as a sub view of  
some container view.  I ran my program twice and a differnt outline  
view populated both times.


I no longer trust the treecontroller/outlineview bindings, they appear  
to be broken on multi-cpu machines, even though my client code does  
not have any explicit threads launched.


As I really needed filtering I decided that I may as well roll my own  
data source for the outline view.  Is the NSTreeController really  
ready for primetime with CoreData on an MP box?


Godfrey van der Linden

On 2008-06-20, at 12:49 , Godfrey van der Linden wrote:

Ok, this bug is thread related.  I suspected that this was the case  
earlier since the problem is non-deterministic.  Now I'm pretty sure.


The bug I have specified below DOES NOT OCCUR on a powerbook.  Now  
combining non-determinism with only occurring on an iMac CoreDuo.   
I'm not much of a user land programmer yet but my 10 years of kernel  
experience says that somebody got a lock wrong somewhere.


Are there any engineers out there interested in tracking this down?   
If not I'm probably not going to bother to write up a bug report due  
to a total lack of interest.


Godfrey van der Linden

On 2008-06-20, at 8:13 AM, Godfrey van der Linden wrote:

This is a resend of the previous email with a more accurate title  
and better organised detail.


This bug is blowing my mind as the behaviour is not deterministic.

I have three outline views that are contained in 2 different  
NSViewControlled sub-xibs which get loaded into the a place holder  
view in the main persistent document window.  The outlines views  
are only *occasionally* updated when new data is loaded into their  
NSTreeControllers.


Failed attempts to localise the bug:-
1 Call reloadData many times from many different places.
2 In primary document xib add a debug window which displays the  
contents of the managed object context using parallel tree  
controller and outline views, the debug window is updated fine.
3 In primary document xib, replace NSViewController architecture  
with direct outline views connected to the debug window's tree  
controller.  Both the debug window and the direct outline views  
updated.
4 Bind the sub-xibs outline view to the primary document window's  
tree controllers.  Debug window updates correctly but sub-xibs  
outline views don't!


The sub-xib bindings are through the NSViewControllers  
representedObject, which gets set not at awakeFromNib time but  
later when the subview is activated.


Finally the non deterministic behaviour is that rarely one of the  
two outline views, thought not always the same one, does get data  
updates and once that happens that outline view seems fine thought  
the other one still has no data.


So far I haven't tested the code on a single processor machine. My  
code, however, does not explicitly launch any threads.


___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


How do I draw text on a custom button?

2008-06-21 Thread Michael A. Crawford
I'm using a CustomView that inherits from NSButton.  I have no problem  
drawing the graphical representation of the button in the view but it  
is not immediately obvious to me how to draw text.  setTitle does not  
work with my custom button.  Can you point me to some examples?  Here  
is the code:


#import Cocoa/Cocoa.h

@interface TwoStateButton : NSButton
{}

@end

- (void)drawRect:(NSRect)rect
{
// draw initial black button
NSRect bounds = [self bounds];
[[NSColor blackColor] set];
[NSBezierPath fillRect:bounds];

// draw green LED inset in button (grey if not on)
bounds.origin.x += (bounds.size.width * 0.25) / 2;
bounds.origin.y += bounds.size.height * 0.25;
bounds.size.width *= 0.75;
bounds.size.height *=  0.25;

if ( NSOnState == [self state] )
{
[[NSColor greenColor] set];
}
else
{
[[NSColor lightGrayColor] set];
}

[NSBezierPath fillRect:bounds];
[self setTitle:@NDB];
}

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Fundamental mistake in my understanding of use of classes/instances/encapsulation/messaging

2008-06-21 Thread Jason Wiggins
The program *does* actually work (ref. the console output shown  
before. The line with View... is the output from the View Class  
instance method and the line with Controller... is the output from  
the Controller Class instance method). The popup button is connected  
to both Controller and View Classes.


I've read what you've said Graham and I understand what you're saying  
and where my thinking has been incorrect. But in saying that, I still  
don't understand why I can't instantiate another class connected to a  
popup button from my controller and then use a method such as  
[[viewClassInstance popUpButton] indexOfSelectedItem];  ?


Why do I always get 0 logged from and returned from the View class?  
The only way it seems to work is if I connect all my widgets to the  
Controller Class. Is there no way of getting another class to do the  
dirty work and return the expected values? In my test case, both  
Controller and View are connected to the same popup button, but I get  
different results from the two classes.


Regards,
Jason


On 21/06/2008, at 3:19 PM, Graham Cox wrote:

You observation is helpful. I thought that I needed to create a  
view class. I also thought that with this view class it would have  
an IBAction (the popup button connected to this) with a switch  
function, with each case setting an ivar which would be returned to  
the controller class through getter in the controller when the  
button was pressed. I you get what I mean. Am I going the long way  
round by doing this?

So have I gone too far with the idea of abstraction?
By your observation, I should lose the view class I created and  
connect an IBAction in the controller to the popup button?



Looking at your nib file (which at least I can open), the pop-up  
button is not connected to anything at all, which is probably why  
it's not doing anything.


Also, you have a generic custom object set to View. That's  
incorrect - Views are any specific widget or control (in fact any  
NSView subclass) that you use in IB, so your Button and the Pop-up  
are already views. You don't need to instantiate one as a standalone  
custom object - remove it.


Your pop-up button should send its action to the controller. That's  
where the popUpChoice: method (or whatever) would go. You don't  
need a View object as you have created it. The controller in turn  
will invoke methods on the model to set its state. Generally  
controllers contain lots of glue code which interprets stuff  
coming from the views (controls) and translate that to state changes  
in the data model, and vice versa.


Custom views are often created, but not in the way you've done it.  
Instead you drag a custom view to a window (typically) and set its  
class. However at this stage I don't think you need to know about  
this.



Graham



On 21 Jun 2008, at 2:56 pm, Jason Wiggins wrote:

Thanks Henry for your response. I'll have to read that a couple  
times to let it sink into my thick skull. Not sure why the DL link  
is zero length. Here is a better link: http://members.optusnet.com.au/jwiggins/xcode/TestCase.zip
The reason I connected things in the way I did was to understand  
what was and wasn't happening. But then again, as stated, I'm doing  
something fundamentally wrong.




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Fundamental mistake in my understanding of use of classes/instances/encapsulation/messaging

2008-06-21 Thread Jason Wiggins

Hi Nathan,

1. Noted with thanks.
2. I have realised that as it's not actually connected to anything in  
the NIB. The only objects that need to instantiated in the NIB are  
classes that require hooking up in IB?
3. This was a quick and dirty app to understand the popup button thing  
and I knowingly disregarded memory management, but thanks for the  
pointers nonetheless.

4.  I will have a think and give these a go.

Regards,
Jason.


On 21/06/2008, at 6:43 PM, Nathan Kinsinger wrote:



On Jun 20, 2008, at 6:48 AM, Jason Wiggins wrote:


Hi everyone,


snip



Any help would be greatly appreciated.

Jason


Some pointers,

1) As has been stated already you don't need the View object at all.  
In this case the Window holds your view (if you look at the Nib in  
outline mode and open the content triangle for the Window object you  
will see that it has a Content View which holds your NSButton and  
NSPopUpButton).


2) You don't need the Model object in the NIB. The Controller object  
creates a model instance in it's -awakeFromNib method. The objects  
you add to the Nib are instantiated when the Nib is loaded so there  
ends up being two Model objects and the one in the Nib is just  
wasting memory since nothing else refers to it.


With the exception of the first three items (File's Owner, First  
Responder and Application) the objects in the Nib are objects that  
will be created when it loads. In your example the MainMenu, Window,  
Font Manager and your Controller are all objects that are  
instantiated when the app runs. You don't need to add objects/ 
classes to the Nib just because they are in your app, only if you  
need/want to have them created for you. The Controller should be in  
the Nib in this case, you need it to be created in order to create  
the Model object and to interact with the view objects already in  
the Nib.


3) You should add a dealloc method to your Model object, it should  
release the dataString ivar. Read up on memory managment:
http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Concepts/ObjectOwnership.html#/ 
/apple_ref/doc/uid/2043


In other memory management issues, the setDataString: method of  
Model needs to properly release the old string object before  
overwriting with the new string, otherwise you are leaking memory by  
not releasing the old string (you should check that the new string  
is not the same string object as the old one first). Read up on  
accessor methods:
http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmAccessorMethods.html#/ 
/apple_ref/doc/uid/TP40003539


4) Just some things to think about/try. You don't need the button to  
read the popup's value, you can set an action to the NSPopUpButton  
in the same way that you did for the NSButton, then when the user  
selects an item the method is called right then. Try creating a new  
IBAction method for the popup and in it set a different value to the  
dataString of modelInstance for each menu item in the popup. This  
more directly models the behavior of a controller, that is it  
changes the model based on user input. Maybe add an NSTextField to  
the window and when the Model changes it's dataString it tells the  
Controller which then updates the text field. Now you have a  
controller changing the view based on changes in the model.


Good luck and have fun :)
--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: How do I draw text on a custom button?

2008-06-21 Thread John C. Randolph

Michael,

By implementing -drawRect: in your view class, you become responsible  
for all drawing in that view.  The code below doesn't attempt to draw  
the text, it only sets a value.


To draw text in the current drawing context, see the - 
drawAtPoint:withAttributes: method of NSString for one way to to do so.


I won't go into the intricacies of NSControl and NSCell just yet.

-jcr


On Jun 21, 2008, at 12:44 AM, Michael A. Crawford wrote:

I'm using a CustomView that inherits from NSButton.  I have no  
problem drawing the graphical representation of the button in the  
view but it is not immediately obvious to me how to draw text.   
setTitle does not work with my custom button.  Can you point me to  
some examples?  Here is the code:


#import Cocoa/Cocoa.h

@interface TwoStateButton : NSButton
{}

@end

- (void)drawRect:(NSRect)rect
{
// draw initial black button
NSRect bounds = [self bounds];
[[NSColor blackColor] set];
[NSBezierPath fillRect:bounds];

// draw green LED inset in button (grey if not on)
bounds.origin.x += (bounds.size.width * 0.25) / 2;
bounds.origin.y += bounds.size.height * 0.25;
bounds.size.width *= 0.75;
bounds.size.height *=  0.25;

if ( NSOnState == [self state] )
{
[[NSColor greenColor] set];
}
else
{
[[NSColor lightGrayColor] set];
}

[NSBezierPath fillRect:bounds];
[self setTitle:@NDB];
}

___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Race in Apple's NSTreeContoller/NSOutlineView

2008-06-21 Thread John C. Randolph


On Jun 21, 2008, at 12:44 AM, Godfrey van der Linden wrote:

Ok I gave up.  No response was expected and I received what I  
expected.



Godfrey,

Being a former Apple engineer, you should know as well as any of us  
that nobody is assigned to glean bug reports from the mailing lists.   
Until and unless you file this in Radar, it's not a bug, it's just a  
gripe.


-jcr
___

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

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

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

This email sent to [EMAIL PROTECTED]


CoreData local and on server sync

2008-06-21 Thread René v Amerongen

Dear All,

Does someone has any experience about having a local data store which  
is syncing wit the server store using Coredata?


We have a few 300+ laptop users and 50+ desktop users who are working  
in the same database.


Now I have to make a similar database but then that the Laptop users  
can work offline.
I would like to have them sync their local copy with the server when  
they are online again.


Is this possible with Coredata and SQL? Does someone has suggestions  
in this directions?


Thanks

Rene





___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CoreData local and on server sync

2008-06-21 Thread John C. Randolph


On Jun 21, 2008, at 3:33 AM, René v Amerongen wrote:


Dear All,

Does someone has any experience about having a local data store  
which is syncing wit the server store using Coredata?


Rene,

This is not what CoreData is intended to do.  CoreData is for local  
storage of object maps, and really doesn't deal with the issues of  
database synchronization across multiple users on multiple hosts.


I would recommend looking into OpenBase and FrontBase, which are both  
SQL database products that offer an Objective-C API.


-jcr

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Bindings Concept Question

2008-06-21 Thread mmalc Crawford


On Jun 20, 2008, at 10:16 PM, Alex Wait wrote:

When the app starts, I see the data as expected. However, when I  
call my add

function, which gets the strings from the textFields and makes the
new Data object and adds it to the array, I do not see it in the  
table.



http://homepage.mac.com/mmalc/CocoaExamples/controllers.html
Programmatic modifications to arrays not noticed by table view

mmalc

___

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

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

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

This email sent to [EMAIL PROTECTED]


NSPanel should not close on command-W

2008-06-21 Thread Georg Seifert

Hello,

I just added a panel to my program. I do not want that the panel  
closes on command-W. I did setBecomesKeyOnlyIfNeeded:YES. So It does  
not close if there is a document window. But if the last one is closed  
(with keyboard: command-W) also the panel closes.


How do I prevent this?

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


cutting an image into multiple images

2008-06-21 Thread Dharmendra
Hi,
I am trying to get a user-defined image in specific format (m x nm) and want
to generate an array with count n containing m x m sized images. I have
written the following code, but would like to know if there is better way to
do the same:

m=...;

NSImage *userImage=[[NSImage alloc] initWithContentsOfFile:@xxx.gif];

unsigned int n=[userImage size].width/m;

NSMutableArray *images = [NSMutableArray arrayWithCapacity:n];

for(i=0;in;i++) {

NSImage *testImage=[[NSImage alloc] initWithSize:NSMakeSize(m,m)];

[testImage lockFocus];

[userImage drawInRect:NSMakeRect(0,0,m,m) fromRect:NSMakeRect(m*i,0,m,m)
operation:NSCompositeSourceOver fraction:1.0];

[testImage unlockFocus];

[images addObject:testImage];

}
___

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

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

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

This email sent to [EMAIL PROTECTED]


Why does this https post request always return 404 Not Found

2008-06-21 Thread an0
- (void) login
{
NSString *userName = [[userNameField stringValue]

stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSString *password = [[passwordField stringValue]

stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

NSURL *url = [NSURL URLWithString:@https://secure.del.icio.us/login;];
NSMutableURLRequest *urlRequest = [NSMutableURLRequest
   requestWithURL:url

cachePolicy:NSURLRequestReturnCacheDataElseLoad
   timeoutInterval:30];
[urlRequest setHTTPMethod:@POST];
NSString *body = [NSString stringWithFormat:
  @user_name=%@
  @password=%@,
  userName, password];
[urlRequest setHTTPBody:[body dataUsingEncoding:NSUTF8StringEncoding]];

NSLog(@request: [EMAIL PROTECTED]@\n%@,
  [urlRequest URL],
  [urlRequest HTTPMethod],
  [[[NSString alloc] initWithData:[urlRequest HTTPBody]
 encoding:NSUTF8StringEncoding] autorelease]);

NSData *urlData;
NSURLResponse *response;
NSError *error;
urlData = [NSURLConnection sendSynchronousRequest:urlRequest
returningResponse:response
error:error];
if (!urlData) {
NSAlert *alert = [NSAlert alertWithError:error];
[alert runModal];
return;
}

// Parse the login result
NSString *loginResult = [[[NSString alloc] initWithData:urlData

encoding:NSUTF8StringEncoding]
 autorelease];
NSLog(@login result: %@, loginResult);
}

Is there anything special about https requests in Cocoa that I must
learn? Since I've verified that sending http requests in this manner
is perfectly OK, and accessing https://secure.del.icio.us/login in web
browsers goes well.
If anyone could tell me anything that I've missed here, I'll very much
appreciate 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: getting the selected object from an NSTableView causes problems

2008-06-21 Thread Daniel Richman
Thanks! I don't know why they introduced NSInteger. It sounds like it 
would be a subclass of NSNumber.


That didn't seem to be the problem, though. The program still crashes 
only when you aren't deleting the first item. I made a movie of it; it's 
at http://danielrichman.com/tmp/ToDoList_Problem.mov .


Thanks,
Daniel


Graham Cox wrote:

I ran into a very similar problem just today.

There is an error in your code though, unrelated to my problem, but is 
probably yours:



int selectedRow = [((NSNumber *)[tableView selectedRow]) intValue];



-selectedRow simply returns an int, so all that casting to an 
NSNumber* and fetching its -intValue is bogus. You want:


int selectedRow = [tableView selectedRow];

(Aside: I think the addition in Leopard of the NSInteger data type is 
confusing a lot of people - it's just a typedef for 'int', it's not an 
object, and definitely not an NSNumber. But I've seen a few errors 
confusing the two lately that didn't seem to happen before).


hth,


Graham




On 21 Jun 2008, at 12:51 pm, Daniel Richman wrote:

I've got an NSTableView that displays the data in an NSMutableArray. 
(The program is a to-do list.) I just tried adding a function to 
allow you to delete an item: you select the item in the table and 
then click delete. My code is as follows:


- (IBAction)deleteItem:(id)sender
{
  int selectedRow = [((NSNumber *)[tableView selectedRow]) intValue];
  NSLog(@Selected row is %d, selectedRow);
if (selectedRow != -1) {
  NSLog(@Deleting '%@', [toDoList objectAtIndex:selectedRow]);
  [toDoList removeObjectAtIndex:selectedRow];
  [tableView reloadData];
  }
}

The problem is that if I try to delete any item other than the very 
first one (index 0), the program crashes. I did some log work, which 
revealed that the first line is causing problems (int 
selectedRow...). But that doesn't explain why the deleting the first 
item works ok. I'm stumped. Any ideas?



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: getting the selected object from an NSTableView causes problems

2008-06-21 Thread Charles Srstka

Don't do this:

NSLog(@selected row: %@, [tableView selectedRow]);

Instead, do this:

NSLog(@selected row: %u, [tableView selectedRow]);

Trying to interpret an int as an object is what's causing your crash.

Charles

On Jun 21, 2008, at 10:13 AM, Daniel Richman wrote:

Thanks! I don't know why they introduced NSInteger. It sounds like  
it would be a subclass of NSNumber.


That didn't seem to be the problem, though. The program still  
crashes only when you aren't deleting the first item. I made a movie  
of it; it's at http://danielrichman.com/tmp/ToDoList_Problem.mov .


Thanks,
Daniel


Graham Cox wrote:

I ran into a very similar problem just today.

There is an error in your code though, unrelated to my problem, but  
is probably yours:



int selectedRow = [((NSNumber *)[tableView selectedRow]) intValue];



-selectedRow simply returns an int, so all that casting to an  
NSNumber* and fetching its -intValue is bogus. You want:


int selectedRow = [tableView selectedRow];

(Aside: I think the addition in Leopard of the NSInteger data type  
is confusing a lot of people - it's just a typedef for 'int', it's  
not an object, and definitely not an NSNumber. But I've seen a few  
errors confusing the two lately that didn't seem to happen before).


hth,


Graham




On 21 Jun 2008, at 12:51 pm, Daniel Richman wrote:

I've got an NSTableView that displays the data in an  
NSMutableArray. (The program is a to-do list.) I just tried adding  
a function to allow you to delete an item: you select the item in  
the table and then click delete. My code is as follows:


- (IBAction)deleteItem:(id)sender
{
 int selectedRow = [((NSNumber *)[tableView selectedRow]) intValue];
 NSLog(@Selected row is %d, selectedRow);
   if (selectedRow != -1) {
 NSLog(@Deleting '%@', [toDoList objectAtIndex:selectedRow]);
 [toDoList removeObjectAtIndex:selectedRow];
 [tableView reloadData];
 }
}

The problem is that if I try to delete any item other than the  
very first one (index 0), the program crashes. I did some log  
work, which revealed that the first line is causing problems (int  
selectedRow...). But that doesn't explain why the deleting the  
first item works ok. I'm stumped. Any ideas?



___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40charlessoft.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: getting the selected object from an NSTableView causes problems

2008-06-21 Thread Daniel Richman

That's it! Thanks!

Daniel


Charles Srstka wrote:

Don't do this:

NSLog(@selected row: %@, [tableView selectedRow]);

Instead, do this:

NSLog(@selected row: %u, [tableView selectedRow]);

Trying to interpret an int as an object is what's causing your crash.

Charles

On Jun 21, 2008, at 10:13 AM, Daniel Richman wrote:

Thanks! I don't know why they introduced NSInteger. It sounds like it 
would be a subclass of NSNumber.


That didn't seem to be the problem, though. The program still crashes 
only when you aren't deleting the first item. I made a movie of it; 
it's at http://danielrichman.com/tmp/ToDoList_Problem.mov .


Thanks,
Daniel


Graham Cox wrote:

I ran into a very similar problem just today.

There is an error in your code though, unrelated to my problem, but 
is probably yours:



int selectedRow = [((NSNumber *)[tableView selectedRow]) intValue];



-selectedRow simply returns an int, so all that casting to an 
NSNumber* and fetching its -intValue is bogus. You want:


int selectedRow = [tableView selectedRow];

(Aside: I think the addition in Leopard of the NSInteger data type 
is confusing a lot of people - it's just a typedef for 'int', it's 
not an object, and definitely not an NSNumber. But I've seen a few 
errors confusing the two lately that didn't seem to happen before).


hth,


Graham




On 21 Jun 2008, at 12:51 pm, Daniel Richman wrote:

I've got an NSTableView that displays the data in an 
NSMutableArray. (The program is a to-do list.) I just tried adding 
a function to allow you to delete an item: you select the item in 
the table and then click delete. My code is as follows:


- (IBAction)deleteItem:(id)sender
{
 int selectedRow = [((NSNumber *)[tableView selectedRow]) intValue];
 NSLog(@Selected row is %d, selectedRow);
   if (selectedRow != -1) {
 NSLog(@Deleting '%@', [toDoList objectAtIndex:selectedRow]);
 [toDoList removeObjectAtIndex:selectedRow];
 [tableView reloadData];
 }
}

The problem is that if I try to delete any item other than the very 
first one (index 0), the program crashes. I did some log work, 
which revealed that the first line is causing problems (int 
selectedRow...). But that doesn't explain why the deleting the 
first item works ok. I'm stumped. Any ideas?



___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40charlessoft.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: NSPanel should not close on command-W

2008-06-21 Thread Keary Suska
6/21/08 7:02 AM, also sprach [EMAIL PROTECTED]:

 I just added a panel to my program. I do not want that the panel
 closes on command-W. I did setBecomesKeyOnlyIfNeeded:YES. So It does
 not close if there is a document window. But if the last one is closed
 (with keyboard: command-W) also the panel closes.
 
 How do I prevent this?

I am not sure I understand the exact issue, so I will suggest a few options.

1. You can disable the close button on the panel, which should prevent it
being closed by the menu, but also prevents it from being closed at all.
Useful if you have (or are willing to implement) a show/hide toggle menu for
the panel.

2. If you just don't want the panel to respond to the close menu, simply
implement -validateUserInterfaceItem: in an appropriate place in the
responder chain. The side effect here is that the close menu item will be
disabled any time the panel is key, which is probably OK as you have it set
up at the moment.

3. If you meant to say that when you close the last document window that the
panel closes at the same time, then I am not sure what that would mean other
than something is rather wrong.

Just a general note: if the (red) close button on the panel is enabled,
users may expect that command-W will close it when it is made key. There may
also be a HIG issue with this.

HTH,

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


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSPanel should not close on command-W

2008-06-21 Thread Georg Seifert



I just added a panel to my program. I do not want that the panel
closes on command-W. I did setBecomesKeyOnlyIfNeeded:YES. So It does
not close if there is a document window. But if the last one is  
closed

(with keyboard: command-W) also the panel closes.

How do I prevent this?


I am not sure I understand the exact issue, so I will suggest a few  
options.


1. You can disable the close button on the panel, which should  
prevent it
being closed by the menu, but also prevents it from being closed at  
all.
Useful if you have (or are willing to implement) a show/hide toggle  
menu for

the panel.

2. If you just don't want the panel to respond to the close menu,  
simply

implement -validateUserInterfaceItem: in an appropriate place in the
responder chain. The side effect here is that the close menu item  
will be
disabled any time the panel is key, which is probably OK as you have  
it set

up at the moment.

3. If you meant to say that when you close the last document window  
that the
panel closes at the same time, then I am not sure what that would  
mean other

than something is rather wrong.

Just a general note: if the (red) close button on the panel is  
enabled,
users may expect that command-W will close it when it is made key.  
There may

also be a HIG issue with this.

HTH,

Thanks for you suggestions.

I use the panel as a palette. Something like the systems font chooser.  
They have the close button enabled, but do not responde to close  
commands from the keyboard.


I could implement windowShouldClose: in the delegate but I do not  
know the source of the close event.


G
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSPanel should not close on command-W

2008-06-21 Thread Marco Masser
I just added a panel to my program. I do not want that the panel  
closes on command-W. I did setBecomesKeyOnlyIfNeeded:YES. So It does  
not close if there is a document window. But if the last one is  
closed (with keyboard: command-W) also the panel closes.


I'm taking a stab in the dark here, but could it be that your panel is  
in the same nib file as your document window? If it should be a  
document-independent inspector-kind panel you probably should put it  
in its own nib file.


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: NSPanel should not close on command-W

2008-06-21 Thread Keary Suska
6/21/08 11:10 AM, also sprach [EMAIL PROTECTED]:

 I use the panel as a palette. Something like the systems font chooser.
 They have the close button enabled, but do not responde to close
 commands from the keyboard.

Using TextEdit as an example, the font panel *will* close on command-w, if
it becomes key. It is just that it won't become key unless/until all
document windows are closed. This is the expected behavior I was talking
about.
 
 I could implement windowShouldClose: in the delegate but I do not
 know the source of the close event.

I think the other responder has your answer, *if* the issue is that your
panel always closes when your last document window is closed. If your panel
is in the document's nib, it may be getting disposed of. The only way to
stop that is to move the panel  related objects to a separate nib.

Best,

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


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Bindings Concept Question

2008-06-21 Thread Alex Wait
Ok. Pretty deep topic and I'm working to wrap my head around it.

I have taken the liberty to paste my addData method that is called when the
button is pressed (it's at the end of the message).

I have tried to, in my init method, to do this

id proxy = [controller mutableArrayValueForKey:@arrayOfData];

I have also tried using the values firstName and lastName which are the
properties of my Data class. controller is a pointer
to my array controller.

however proxy is nil. In a reponse, I read that
KVO does provide the -mutableArrayValueForKey... methods to create a proxy
object which you can treat as a mutable array but which messages the owning
object to carry out the actual modifications.  In that way, the owning
object is able to send out KVO notifications as necessary.  (Even if the
proxy ends up accessing the ivar directly, it still messages the owning
object with -will/didChange:valuesAtIndexes

 :forKey:.)


If I am able to get a proxy object, can I do modifications and still have
KVO notifications sent?
After reading the responses I am sure that this method is not adding the
data in the way that means KVO notifciations would be sent.


ADD METHOD

-(void)addData: (id) sender
{

NSString* newFirst = [firstNameField stringValue];
NSString* newLast = [lastNameField stringValue];
Data* newData = [[Data alloc]init];

[newData setValue:newFirst forKey:@firstName];
[newData setValue:newLast forKey:@lastName];


[arrayOfData addObject:newData];

if (table != nil)
NSLog(@num is %d, [arrayOfData count]);

[table reloadData];

}




On Sat, Jun 21, 2008 at 4:40 AM, mmalc Crawford [EMAIL PROTECTED]
wrote:


 On Jun 20, 2008, at 10:16 PM, Alex Wait wrote:

  When the app starts, I see the data as expected. However, when I call my
 add
 function, which gets the strings from the textFields and makes the
 new Data object and adds it to the array, I do not see it in the table.

  http://homepage.mac.com/mmalc/CocoaExamples/controllers.html
 Programmatic modifications to arrays not noticed by table view

 mmalc




-- 
If you can't be kind, at least have the decency to be vague.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSPanel should not close on command-W

2008-06-21 Thread Georg Seifert
I use the panel as a palette. Something like the systems font  
chooser.

They have the close button enabled, but do not responde to close
commands from the keyboard.


Using TextEdit as an example, the font panel *will* close on command- 
w, if

it becomes key. It is just that it won't become key unless/until all
document windows are closed. This is the expected behavior I was  
talking

about.


I cannot reproduce this. If I close all documents in Textedit (or any  
other Mac-App) the font panel stays there and I get a NSBeep on  
hitting command-w.


G
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSPanel should not close on command-W

2008-06-21 Thread Jason Stephenson

Georg Seifert wrote:


I cannot reproduce this. If I close all documents in Textedit (or any 
other Mac-App) the font panel stays there and I get a NSBeep on hitting 
command-w.


According to what I read in the docs and what I've experienced in my own 
applications, panels don't respond to Command-W. They will close if you 
hit the ESC key.


Also, I do believe that if your panel is in the nib with your window 
controller's window (in a document-based application that would be 
MyDocument.nib), then the panel will close when the last window 
referencing the nib is closed, because the window controller is 
responsible for tearing down the top level objects loaded from the nib, 
which MyDocument : NSDocument will do, and any custom window controller 
should do by sending itself -autorelease in -windowWillClose.


So, I think, as Marco Masser has already mentioned, that if you want 
your panel to be independent of your document window's window 
controller, you'll need to put the panel in its own nib and load it 
independently.


You *might* be able to do some magic in your window controller's 
-windowWillClose method to give your panel a new owner. I don't know for 
sure: I haven't actually tried this.


HtH,
Jason
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSPanel should not close on command-W

2008-06-21 Thread Georg Seifert

I wrote this earlier but send it directly to Marco.
pleas excuse my carelessness.

I just added a panel to my program. I do not want that the panel  
closes on command-W. I did setBecomesKeyOnlyIfNeeded:YES. So It  
does not close if there is a document window. But if the last one  
is closed (with keyboard: command-W) also the panel closes.


I'm taking a stab in the dark here, but could it be that your panel  
is in the same nib file as your document window? If it should be a  
document-independent inspector-kind panel you probably should put it  
in its own nib file.


I think I was unclear: I did not ment, that the panel closes with the  
last window, but reacts to command-w if the last window is closed.


And of course, the panel is in a different nib than the document window.

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: NSPanel should not close on command-W

2008-06-21 Thread Andrew Merenbach

On Jun 21, 2008, at 11:00 AM, Georg Seifert wrote:

I use the panel as a palette. Something like the systems font  
chooser.

They have the close button enabled, but do not responde to close
commands from the keyboard.


Using TextEdit as an example, the font panel *will* close on  
command-w, if

it becomes key. It is just that it won't become key unless/until all
document windows are closed. This is the expected behavior I was  
talking

about.


I cannot reproduce this. If I close all documents in Textedit (or  
any other Mac-App) the font panel stays there and I get a NSBeep on  
hitting command-w.


Hi!  If you click on the Font panel's title bar before you hit command- 
w, you will see it activate -- then, when you do hit command-w, it  
*will* close.  Thus it does indeed respond to the keyboard shortcut.   
Perhaps you can work some magic with -(BOOL)canBecomeKeyWindow or - 
(BOOLcanBecomeMainWindow?


Cheers,
Andrew


smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Application Main window not appearing on application launch

2008-06-21 Thread Clayton Leitch
Core data document application:  I edited the MyDocument.nib file to  
add a few fields to one view and now when I start the application, the  
main window does not appear.  Also, the new menu fails to produce a  
window.  What caused this and how do I avoid it.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: getting the selected object from an NSTableView causes problems

2008-06-21 Thread Nick Zitzmann


On Jun 21, 2008, at 9:13 AM, Daniel Richman wrote:

Thanks! I don't know why they introduced NSInteger. It sounds like  
it would be a subclass of NSNumber.



They did that so that NSData, etc. can hold a 63-bit amount of data in  
64-bit applications while not shattering backward compatibility in 32- 
bit applications. Likewise, CGFloat was added so that 64-bit  
applications can use double-precision floating point for drawing while  
not shattering backward compatibility.


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




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: getting the selected object from an NSTableView causes problems

2008-06-21 Thread Daniel Richman

Ah. So the typedef changes depending on the platform.

Interesting, thanks.


Nick Zitzmann wrote:


On Jun 21, 2008, at 9:13 AM, Daniel Richman wrote:

Thanks! I don't know why they introduced NSInteger. It sounds like it 
would be a subclass of NSNumber.



They did that so that NSData, etc. can hold a 63-bit amount of data in 
64-bit applications while not shattering backward compatibility in 
32-bit applications. Likewise, CGFloat was added so that 64-bit 
applications can use double-precision floating point for drawing while 
not shattering backward compatibility.


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





___

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

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

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

This email sent to [EMAIL PROTECTED]


Leopard-specific functionality in non–Leopard -only project

2008-06-21 Thread Jacob Bandes-Storch
I'm working on a project (with another developer) that will target  
OSes older than 10.5, and I'd like to use the Leopard-only NSWindow  
method -setCollectionBehavior:. As far as I know, the best way to do  
this is to check for the method using -respondsToSelector:. I need to  
use the enum type NSWindowCollectionBehavior. When I try this, I get  
an error saying error: 'NSWindowCollectionBehaviorCanJoinAllSpaces'  
undeclared (first use in this function) and a warning warning:  
'NSWindow' may not respond to '-setCollectionBehavior:'. This is  
because I'm using the 10.4 SDK... I've read in some places to set the  
Cross-develop using target SDK setting of the project to 10.5, but  
that setting is not available in the General tab of the project info.  
Does anyone know how to do this properly without angering the compiler?

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Leopard-specific functionality in non–L eopard-only project

2008-06-21 Thread Mark Munz
The trick is to set the SDK to 10.5 and then in the target build settings, set:

Mac OS X Deployment Target to Mac OS X 10.4.
(under Deployment)

You'll want to set it for all your configurations: (Debug, Release, etc)

On Sat, Jun 21, 2008 at 12:51 PM, Jacob Bandes-Storch
[EMAIL PROTECTED] wrote:
 I'm working on a project (with another developer) that will target OSes
 older than 10.5, and I'd like to use the Leopard-only NSWindow method
 -setCollectionBehavior:. As far as I know, the best way to do this is to
 check for the method using -respondsToSelector:. I need to use the enum type
 NSWindowCollectionBehavior. When I try this, I get an error saying error:
 'NSWindowCollectionBehaviorCanJoinAllSpaces' undeclared (first use in this
 function) and a warning warning: 'NSWindow' may not respond to
 '-setCollectionBehavior:'. This is because I'm using the 10.4 SDK... I've
 read in some places to set the Cross-develop using target SDK setting of
 the project to 10.5, but that setting is not available in the General tab of
 the project info. Does anyone know how to do this properly without angering
 the compiler?
 ___

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

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

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

 This email sent to [EMAIL PROTECTED]




-- 
Mark Munz
unmarked software
http://www.unmarked.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: Leopard-specific functionality in non–L eopard-only project

2008-06-21 Thread Jacob
Alright, thanks, but will that work if someone tries to use the project for
development who's not on 10.5?


On Sat, Jun 21, 2008 at 1:01 PM, Mark Munz [EMAIL PROTECTED] wrote:

 The trick is to set the SDK to 10.5 and then in the target build settings,
 set:

 Mac OS X Deployment Target to Mac OS X 10.4.
 (under Deployment)

 You'll want to set it for all your configurations: (Debug, Release, etc)

 On Sat, Jun 21, 2008 at 12:51 PM, Jacob Bandes-Storch
 [EMAIL PROTECTED] wrote:
  I'm working on a project (with another developer) that will target OSes
  older than 10.5, and I'd like to use the Leopard-only NSWindow method
  -setCollectionBehavior:. As far as I know, the best way to do this is to
  check for the method using -respondsToSelector:. I need to use the enum
 type
  NSWindowCollectionBehavior. When I try this, I get an error saying
 error:
  'NSWindowCollectionBehaviorCanJoinAllSpaces' undeclared (first use in
 this
  function) and a warning warning: 'NSWindow' may not respond to
  '-setCollectionBehavior:'. This is because I'm using the 10.4 SDK...
 I've
  read in some places to set the Cross-develop using target SDK setting
 of
  the project to 10.5, but that setting is not available in the General tab
 of
  the project info. Does anyone know how to do this properly without
 angering
  the compiler?

___

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

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

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

This email sent to [EMAIL PROTECTED]


Application Main window not appearing on application launch (updated)

2008-06-21 Thread Clayton Leitch
Core data document application:  I edited the MyDocument.nib file to  
add a few fields to one view and now when I start the application, the  
main window does not appear.  Also, the new menu fails to produce a  
window.  What caused this and how do I avoid it.  More information:   
The console tells me I have a key coding problem with an NSTextView.   
I went through all the NSTextViews and made sure they were correct.   
Problem still exists.  Text from console show below.


[Session started at 2008-06-21 16:15:30 -0400.]
2008-06-21 16:15:30.322 SoftCopyContract[1055:10b] [NSTextView  
0x1ab8b0 valueForUndefinedKey:]: this class is not key value coding- 
compliant for the key value.
2008-06-21 16:15:30.419 SoftCopyContract[1055:10b] [NSTextView  
0x282fee0 valueForUndefinedKey:]: this class is not key value coding- 
compliant for the key value.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Leopard-specific functionality in non–L eopard-only project

2008-06-21 Thread Mark Munz
If you're sharing the project between developers, they both need to be
using the same SDK (ie. 10.5 in this example). The end product will
run on both 10.4 and 10.5, but the development has to be done on a
10.5 machine (you can't develop for future OS's from an older OS).

Another option (for someone working with others on an older OS) might
be to create a Leopard-only bundle. You could then write the Leopard
only code using the SDK at 10.5, deployment on 10.4 and then load the
bundle under 10.5 and access it that way. Your 10.4 developer won't be
able to compile it, but he could still build the main project, which
would have the SDK at 10.4.

Everyone being on 10.5 is a much better option and the cost of
upgrading is easily made up for by the simpler development approach
(unless there is a specific reason why the person can't upgrade to
10.5).

Mark

On Sat, Jun 21, 2008 at 1:09 PM, Jacob [EMAIL PROTECTED] wrote:
 Alright, thanks, but will that work if someone tries to use the project for
 development who's not on 10.5?


 On Sat, Jun 21, 2008 at 1:01 PM, Mark Munz [EMAIL PROTECTED] wrote:

 The trick is to set the SDK to 10.5 and then in the target build settings,
 set:

 Mac OS X Deployment Target to Mac OS X 10.4.
 (under Deployment)

 You'll want to set it for all your configurations: (Debug, Release, etc)

 On Sat, Jun 21, 2008 at 12:51 PM, Jacob Bandes-Storch
 [EMAIL PROTECTED] wrote:
  I'm working on a project (with another developer) that will target OSes
  older than 10.5, and I'd like to use the Leopard-only NSWindow method
  -setCollectionBehavior:. As far as I know, the best way to do this is to
  check for the method using -respondsToSelector:. I need to use the enum
 type
  NSWindowCollectionBehavior. When I try this, I get an error saying
 error:
  'NSWindowCollectionBehaviorCanJoinAllSpaces' undeclared (first use in
 this
  function) and a warning warning: 'NSWindow' may not respond to
  '-setCollectionBehavior:'. This is because I'm using the 10.4 SDK...
 I've
  read in some places to set the Cross-develop using target SDK setting
 of
  the project to 10.5, but that setting is not available in the General tab
 of
  the project info. Does anyone know how to do this properly without
 angering
  the compiler?

 ___

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

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

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

 This email sent to [EMAIL PROTECTED]




-- 
Mark Munz
unmarked software
http://www.unmarked.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: Leopard-specific functionality in non–Le opard-only project

2008-06-21 Thread Michael Ash
On Sat, Jun 21, 2008 at 3:51 PM, Jacob Bandes-Storch [EMAIL PROTECTED] wrote:
 I'm working on a project (with another developer) that will target OSes
 older than 10.5, and I'd like to use the Leopard-only NSWindow method
 -setCollectionBehavior:. As far as I know, the best way to do this is to
 check for the method using -respondsToSelector:. I need to use the enum type
 NSWindowCollectionBehavior. When I try this, I get an error saying error:
 'NSWindowCollectionBehaviorCanJoinAllSpaces' undeclared (first use in this
 function) and a warning warning: 'NSWindow' may not respond to
 '-setCollectionBehavior:'. This is because I'm using the 10.4 SDK... I've
 read in some places to set the Cross-develop using target SDK setting of
 the project to 10.5, but that setting is not available in the General tab of
 the project info. Does anyone know how to do this properly without angering
 the compiler?

Just copy the enum's value into your own code. There is no risk of
binary compatibility problems in this scenario because that's what the
compiler does when it sees an enum anyway. You don't want to copy the
value of, say, an NSString constant whose value isn't exposed in the
header, but any number you see defined in the header is fair game.

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: Application Main window not appearing on application launch (updated)

2008-06-21 Thread Quincey Morris


On Jun 21, 2008, at 13:17, Clayton Leitch wrote:

Core data document application:  I edited the MyDocument.nib file to  
add a few fields to one view and now when I start the application,  
the main window does not appear.  Also, the new menu fails to  
produce a window.  What caused this


The errors listed in the log caused the windows not to open. The  
errors listed in the log were caused by something sending value keys  
to NSTextView objects, which don't have a value property.



and how do I avoid it.


Don't send value keys to NSTextView objects.

The most likely cause is that your bindings are wrong. For example,  
you might have bound something to the text views instead of binding  
the text views to something.


Look for places in MyDocument.nib where you used value as a key/ 
keypath. If there are any, those places are probably wrong.


More information:  The console tells me I have a key coding problem  
with an NSTextView.  I went through all the NSTextViews and made  
sure they were correct.  Problem still exists.  Text from console  
show below.


[Session started at 2008-06-21 16:15:30 -0400.]
2008-06-21 16:15:30.322 SoftCopyContract[1055:10b] [NSTextView  
0x1ab8b0 valueForUndefinedKey:]: this class is not key value coding- 
compliant for the key value.
2008-06-21 16:15:30.419 SoftCopyContract[1055:10b] [NSTextView  
0x282fee0 valueForUndefinedKey:]: this class is not key value  
coding-compliant for the key value.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Leopard-specific functionality in non–L eopard-only project

2008-06-21 Thread Mike Abdullah
If you're desperate to stick with the 10.4 SDK, I'd suggest the best  
approach is just to create your own header that mimics the method. So  
you'd end up with something like:


@interface NSWindow (LeopardOnlyMethods)
- (void)setCollectionBehavior:(int)behavior;
@end

...
[window setCollectionBehavior:1];



Mike.

On 21 Jun 2008, at 20:51, Jacob Bandes-Storch wrote:

I'm working on a project (with another developer) that will target  
OSes older than 10.5, and I'd like to use the Leopard-only NSWindow  
method -setCollectionBehavior:. As far as I know, the best way to do  
this is to check for the method using -respondsToSelector:. I need  
to use the enum type NSWindowCollectionBehavior. When I try this, I  
get an error saying error:  
'NSWindowCollectionBehaviorCanJoinAllSpaces' undeclared (first use  
in this function) and a warning warning: 'NSWindow' may not  
respond to '-setCollectionBehavior:'. This is because I'm using the  
10.4 SDK... I've read in some places to set the Cross-develop using  
target SDK setting of the project to 10.5, but that setting is not  
available in the General tab of the project info. Does anyone know  
how to do this properly without angering the compiler?

___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Application Main window not appearing on application launch

2008-06-21 Thread Omar Qazi


On Jun 21, 2008, at 12:18 PM, Clayton Leitch wrote:

Core data document application:  I edited the MyDocument.nib file to  
add a few fields to one view and now when I start the application,  
the main window does not appear.  Also, the new menu fails to  
produce a window.  What caused this and how do I avoid it.



Select the window in interface builder and make sure the Show window  
at launch checkbox is checked.


Omar Qazi
Hello, Galaxy!
1.310.294.1593



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: Application Main window not appearing on application launch

2008-06-21 Thread Omar Qazi


On Jun 21, 2008, at 2:05 PM, Omar Qazi wrote:



On Jun 21, 2008, at 12:18 PM, Clayton Leitch wrote:

Core data document application:  I edited the MyDocument.nib file  
to add a few fields to one view and now when I start the  
application, the main window does not appear.  Also, the new menu  
fails to produce a window.  What caused this and how do I avoid it.


Read your updated email. Ignore what I just said.

Omar Qazi
Hello, Galaxy!
1.310.294.1593



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]

Core Data : BlogDemo tutorial : I must have missed something, but I don't know what...

2008-06-21 Thread John Joyce
I just worked through the BlogDemo core data app tutorial. The Topics
panel loads of course, but none of the Topics functionality is there.
I'm sure I've missed something, or mis-connected something, but I cannot
seem to find it...

When I run the demo app, I'm getting the following :
[Session started at 2008-06-21 16:27:03 -0500.]
2008-06-21 16:27:05.212 BlogDemo[1180] *** NSRunLoop ignoring exception
'[NSManagedObject 0x3434e0 valueForUndefinedKey:]: this class is not key
value coding-compliant for the key topic.' that raised during posting of
delayed perform with target 3c4ac0 and selector 'invokeWithTarget:'
2008-06-21 16:27:05.244 BlogDemo[1180] *** NSRunLoop ignoring exception
'Cannot perform operation since entity with name '(null)' cannot be found'
that raised during posting of delayed perform with target 3c4c80 and
selector 'invokeWithTarget:'

Any ideas from this as to what I fumbled? Everything else is working.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: cutting an image into multiple images

2008-06-21 Thread douglas a. welton
Depending on what you are going to do with the sub-images once you  
create them, you might want to consider using a CIImage with the  
CICrop core image filter.


On Jun 21, 2008, at 9:41 AM, Dharmendra wrote:


Hi,
I am trying to get a user-defined image in specific format (m x nm)  
and want
to generate an array with count n containing m x m sized images. I  
have
written the following code, but would like to know if there is  
better way to

do the same:

m=...;

NSImage *userImage=[[NSImage alloc]  
initWithContentsOfFile:@xxx.gif];


unsigned int n=[userImage size].width/m;

NSMutableArray *images = [NSMutableArray arrayWithCapacity:n];

for(i=0;in;i++) {

NSImage *testImage=[[NSImage alloc] initWithSize:NSMakeSize(m,m)];

[testImage lockFocus];

[userImage drawInRect:NSMakeRect(0,0,m,m) fromRect:NSMakeRect(m*i, 
0,m,m)

operation:NSCompositeSourceOver fraction:1.0];

[testImage unlockFocus];

[images addObject:testImage];

}
___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Save animation to QuickTime movie?

2008-06-21 Thread douglas a. welton
I would suggest that you take a look at the sample code for  
CocoaMovieCreate and MakeEffectMovie.  If an off the shelf product  
can't help you (Have you tried using AppleScript with QT Player to  
accomplish your goal?), then these two examples should give you enough  
of the basics to get you through the process of creating your own  
application.


regards,

douglas


On Jun 20, 2008, at 10:24 PM, Yung-Luen Lan wrote:


Hi Rick,

Thanks, it's a good suggestion, but not my case.
The problem is, I have to batch convert thousands of slideshows.
The text information is not just subtitle, I have to highlight
different portion of text depend on time.
For example, text in parenthesis need to be highlighted:

00:13 (AA)AA  
00:15 (AAA)A  
00:16 ( B)BBB 

I don't think iMove or QT text track could do this.

Regards,
yllan

On Sat, Jun 21, 2008 at 5:44 AM, Rick Sustek [EMAIL PROTECTED]  
wrote:
Depending on exactly what you have in mind, you may be better  
served by not

doing programming at all.
For example, use iPhoto or iMovie, or a billion other products to  
produce

the basic slide show image track into a QT mov file.
Then add the text overlays via another step with another tool, such  
as

titling within iMovie, or text tracks in QT Player Pro, or

Just a suggestion!
-Rick



___
Do not post admin requests to the list. They will be ignored.
QuickTime-API mailing list  ([EMAIL PROTECTED])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quicktime-api/douglas_welton%40earthlink.net

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Core Data : BlogDemo tutorial : I must have missed something, but I don't know what...

2008-06-21 Thread Jens Alfke


On 21 Jun '08, at 2:40 PM, John Joyce wrote:

2008-06-21 16:27:05.212 BlogDemo[1180] *** NSRunLoop ignoring  
exception
'[NSManagedObject 0x3434e0 valueForUndefinedKey:]: this class is  
not key
value coding-compliant for the key topic.' that raised during  
posting of

delayed perform with target 3c4ac0 and selector 'invokeWithTarget:'


This shows that an exception got raised, which is likely to screw up  
anything past that point. The message shows that something tried to  
access the value for key topic on a managed object that didn't  
support it.


[Or is the key name really topic. with a period? I'm not sure  
whether the period in the message is part of the key name. Try  
searching for topic. in your code to see if you have a spurious  
period.]


If that doesn't narrow it down enough, set a breakpoint at  
objc_exception_throw (using the breakpoints window) to find out  
exactly where the exception gets thrown.


—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: SplashScreen issues

2008-06-21 Thread Jens Alfke


On 21 Jun '08, at 12:10 AM, Damien Cooke wrote:

You make an excellent point.  My app does take too long to load.   
Once I get closer to release I will see what I can do to reduce the  
load time.  Perhaps move some stuff out of the MainMenu.xib.


You've currently got a chicken-and-egg problem, then, because the  
splash screen needs to be in MainMenu.xib and won't be displayed until  
it loads...


Have you tried profiling your application's launch time with Shark?  
It's pretty easy to do, and the results might surprise you. Sometimes  
it's something quite unexpected that's taking up the excess time.


—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: CoreData local and on server sync

2008-06-21 Thread Jens Alfke


On 21 Jun '08, at 3:33 AM, René v Amerongen wrote:

Now I have to make a similar database but then that the Laptop users  
can work offline.
I would like to have them sync their local copy with the server when  
they are online again.


Is this possible with Coredata and SQL? Does someone has suggestions  
in this directions?


CoreData doesn't support any database servers, only sqlite, which  
operates on local database files.


Of course you can write your own code that takes a local CoreData  
store and a remote database server, and compares and syncs the data;  
but you're on your own in building that. You'll need a 3rd party  
library to even talk to the server.


—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: Why does this https post request always return 404 Not Found

2008-06-21 Thread Jens Alfke
This is pretty weird. After some experimenting, I narrowed it down to  
the value of the User-Agent header. I think the del.icio.us server is  
checking that header and returning a 404 if it doesn't like it. And it  
doesn't seem to like CFNetwork's default user-agent header, though it  
likes Safari and curl.


You can programmatically set the User-Agent header value to Mozilla/ 
5.0 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/525.18  
(KHTML, like Gecko) Version/3.1.1 Safari/525.20 and the result should  
work.


On the other hand, why are you trying to log into del.icio.us using  
forms and cookies as though you were a web browser? That site already  
has a pretty comprehensive API for applications to access it; you  
should use that instead. (That may in fact be what they're trying to  
tell you by blocking your request.)


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

How to hide the divider in a collapsed NSSplitView pane

2008-06-21 Thread Markus Spoettl

Hello List,

  I've done a lot of testing and googling but I can't figure out how  
or even if it is possible to completely hide a divider of a NSSplitView.


Suppose I have a split view setup like this:

   A  B
|--|--|

B is collapsible through a button, not through dragging (there is a  
min and max constraint on the divider too). I have a button that  
toggles the view from collapsed to expanded and back. However, when  
view is collapsed the divider is still visible on the right edge of  
the split view.


I've tried sizing the subviews myself in my own custom SplitView  
subclass - not using NSSplitView's -setPosition: - but even that  
doesn't help. The splitview somehow adjusts the the frames after they  
have been set so the divider stays visible, not matter what you do.


Instruments is an example of an app that has splitters that work like  
I want it. The Extended Details pane toggles on and off using a button  
(on the bottom toolbar). When collapsed there is no divider visible  
and you can expand it by using the button only.


Is that something I can do with NSSplitView? If so, how?

Regards
Markus
--
__
Markus Spoettl



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: Bindings Concept Question

2008-06-21 Thread Ken Thomases

On Jun 21, 2008, at 12:49 PM, Alex Wait wrote:


I have tried to, in my init method, to do this

id proxy = [controller mutableArrayValueForKey:@arrayOfData];

I have also tried using the values firstName and lastName which  
are the

properties of my Data class. controller is a pointer
to my array controller.


In the init method of the same class which holds the arrayOfData  
property?  If so, then you want to send mutableArrayValueForKey: to  
self, not to controller.


If you're thinking of using the resulting proxy during the init  
method, then that's not necessary.  Until the object is initialized,  
it can't have any observers.


If you're planning to keep the proxy around for use during addData:,  
then you'd need to store it in an instance variable rather than a  
local variable and, if you're not using garbage collection, retain  
it.  (I figure you probably know about the instance vs. local thing,  
but just thought I'd be thorough.)




however proxy is nil.


Hmm.  That's odd.  I wouldn't think that method would be capable of  
returning nil.  It's documented as succeeding or throwing an  
exception.  I suspect controller is nil at this point, and messages  
to nil generally result in nil.  This is probably a case of an outlet  
configured in a nib, which is not set up at init time.  It's connected  
after init and before -awakeFromNib.


Since controller isn't the proper receiver of this message anyway, no  
need to worry too deeply about this.  Send the message to self, and  
this will probably work itself out.



If I am able to get a proxy object, can I do modifications and still  
have

KVO notifications sent?


Yup, that's what it's for.  If you do the modifications to the proxy,  
KVO notifications will be sent.



After reading the responses I am sure that this method is not adding  
the

data in the way that means KVO notifciations would be sent.


Correct, the implementation you posted would fail to send KVO  
notifications.


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]


Re: cutting an image into multiple images

2008-06-21 Thread Ken Thomases

On Jun 21, 2008, at 8:41 AM, Dharmendra wrote:

I am trying to get a user-defined image in specific format (m x nm)  
and want
to generate an array with count n containing m x m sized images. I  
have
written the following code, but would like to know if there is  
better way to

do the same:


Rather than using NSImage, which is really about drawing, you might  
consider using NSBitmapImageRep directly.  Initialize the source from  
the file data.  Then, initialize each sub-image using one of the  
initWithBitmapDataPlanes:... methods, obtaining the arguments by  
querying the source and performing a bit of math on the planes value.


That said, read the caveat in the NSBitmapImageRep class overview:


Alpha Premultiplication
If a coverage (alpha) plane exists, a bitmap’s color components are  
premultiplied with it. If you modify the contents of the bitmap, you  
are therefore responsible for premultiplying the data. For this  
reason, though, if you want to manipulate the actual data, an  
NSBitmapImageRep object is not recommended for storage. If you need  
to work with unpremultiplied data, you should use Quartz,  
specifically CGImageCreate with kCGImageAlphaLast.




That caveat would apply to NSImage, too, because it's based on  
NSBitmapImageRep.


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]


Data backend for larger apps

2008-06-21 Thread Devraj Mukherjee
Hi all,

I have gathered that Core Data (as brilliant as it is) doesn't yet
support client/server databases. I am writing an application which
will be installed on multiple machines but would like share the single
data source.

Since there will be large amount of data the thought at this stage is
to use something like MySQL obviously at the risk of not being able to
use some so cool as CoreData. Are there any suggestions as to what the
best way to approach this problem is.

I am certain I am not the first one to ask this question but can't
find any valuable clues.

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


Warnings in Interface Builder

2008-06-21 Thread Alex Wait
Is there any way to quiet Interface Builder about my using an Array
Controller and button styles not avaiable on all OS X versions?

It's extremely annoying. :)

Alex

-- 
If you can't be kind, at least have the decency to be vague.
___

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

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

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

This email sent to [EMAIL PROTECTED]


strikethrough in text displayed

2008-06-21 Thread Daniel Richman

Hi All,

I was wondering if there's any way to put a strikethrough in text the 
program generates to put on screen (not something the user enters). For 
example, in HTML (I know this is a long way from that), you can use the 
strike and /strike tags. Is there anything to do that in Cocoa?


Thanks,
Daniel
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Warnings in Interface Builder

2008-06-21 Thread Aron Nopanen
Click the 'info' button on the main NIB window, and set the deployment  
target appropriately?


-A

On 22/06/2008, at 12:11 PM, Alex Wait wrote:


Is there any way to quiet Interface Builder about my using an Array
Controller and button styles not avaiable on all OS X versions?

It's extremely annoying. :)

Alex

--
If you can't be kind, at least have the decency to be vague.
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/ardnopes%40yahoo.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: Warnings in Interface Builder

2008-06-21 Thread Alex Wait
Thanks guys. I was being a bit of a dunce there. :)

On Sat, Jun 21, 2008 at 5:19 PM, Aron Nopanen [EMAIL PROTECTED] wrote:

 Click the 'info' button on the main NIB window, and set the deployment
 target appropriately?

 -A


 On 22/06/2008, at 12:11 PM, Alex Wait wrote:

  Is there any way to quiet Interface Builder about my using an Array
 Controller and button styles not avaiable on all OS X versions?

 It's extremely annoying. :)

 Alex

 --
 If you can't be kind, at least have the decency to be vague.
 ___

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

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

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

 This email sent to [EMAIL PROTECTED]





-- 
If you can't be kind, at least have the decency to be vague.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: strikethrough in text displayed

2008-06-21 Thread Adam R. Maxwell


On Jun 21, 2008, at 5:17 PM, Daniel Richman wrote:

I was wondering if there's any way to put a strikethrough in text  
the program generates to put on screen (not something the user  
enters). For example, in HTML (I know this is a long way from that),  
you can use the strike and /strike tags. Is there anything to do  
that in Cocoa?


You can do this with NSAttributedString.  Check the docs for   
NSStrikethroughStyleAttributeName.


--
adam
___

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

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

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

This email sent to [EMAIL PROTECTED]


No File Opening Aftering adding a file Type

2008-06-21 Thread Alex Wait
I was following my book to the letter (Cocoa Programming for Mac OS X 3rd
edition) and I added the file type as it instructed.

Now when I start my program Open and Save are grayed out and I get this
error

2008-06-21 17:44:13.117 RaiseMan[6870:10b] The RaiseMan Doc type doesn't map
to any NSDocumentClass.

How did this happen?
(File is here
http://rapidshare.com/files/124129258/RaiseMan_2.zip.html)


-- 
If you can't be kind, at least have the decency to be vague.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSKeyedArchiver finishEncoding takes forever

2008-06-21 Thread Adam R. Maxwell


On Jun 18, 2008, at 7:08 PM, Markus Spoettl wrote:


On Jun 18, 2008, at 5:04 PM, Adam R. Maxwell wrote:
It's not recommended, but have you tried using old-style archiving  
as another approach?  It used to be considerably faster than keyed  
archiving under some circumstances.



I have thought about trying this until I read it's deprecated since  
10.2. Also they don't play well with changes to the data structure,  
both very good reasons to stay away.


Apple still requires NSArchiver for NSPortCoder (Distributed Objects),  
so it can't be completely deprecated.  I agree that it doesn't play  
well with changes to the data structure, but you'd only have to  
implement it for the object with doubles as ivars, and still use  
NSKeyedArchiver for the rest (example follows).


Not that you should do this, now that you've found another solution; I  
was mainly curious to see if you saw any performance benefit from it,  
and too lazy to write a test case and profile it for myself :).


--
adam

#import Foundation/Foundation.h

@interface TestObject : NSObject NSCoding
{
double a;
double b;
}
@end

@implementation TestObject

- (id)init
{
static double x = 0;
self = [super init];
if (self) {
a = x++;
b = x++;
}
return self;
}

- (NSString *)description
{
return [NSString stringWithFormat:@%@, a = %.3f, b = %.3f,  
[super description], a, b];

}

- (id)initWithCoder:(NSCoder *)coder
{
self = [super init];
if (self) {
[coder decodeValueOfObjCType:@encode(double) at:a];
[coder decodeValueOfObjCType:@encode(double) at:b];
}
return self;
}

- (void)encodeWithCoder:(NSCoder *)coder
{
[coder encodeValueOfObjCType:@encode(double) at:a];
[coder encodeValueOfObjCType:@encode(double) at:b];
}

@end

@interface ParentObject: NSObject NSCoding
{
TestObject *child;
}
@end

@implementation ParentObject

- (id)init
{
self = [super init];
if (self) {
child = [TestObject new];
}
return self;
}

- (void)dealloc
{
[child release];
[super dealloc];
}

- (id)initWithCoder:(NSCoder *)coder
{
self = [super init];
if (self)
child = [[coder decodeObjectForKey:@child] retain];
return self;
}

- (void)encodeWithCoder:(NSCoder *)coder
{
[coder encodeObject:child forKey:@child];
}

- (NSString *)description
{
return [NSString stringWithFormat:@%@: child = %@, [super  
description], child];

}

@end

int main (int argc, char const *argv[])
{
NSAutoreleasePool *pool = [NSAutoreleasePool new];

NSMutableArray *a = [NSMutableArray array];

int i;
for (i = 0; i  10; i++) {
ParentObject *obj = [ParentObject new];
[a addObject:obj];
[obj release];
}

NSLog(@1: %@, a);

NSData *d = [NSKeyedArchiver archivedDataWithRootObject:a];

NSLog(@archived to %d bytes, [d length]);

NSArray *b = [NSKeyedUnarchiver unarchiveObjectWithData:d];

NSLog(@2: %@, b);

[pool release];
return 0;
}
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to hide the divider in a collapsed NSSplitView pane

2008-06-21 Thread Milen Dzhumerov

Hi Markus,

AppKit release notes say this:

A common UI pattern now is to provide a button to show and hide one  
subview or another of a split view, and completely hide the divider  
when the subview between it and the edge of the window is hidden. To  
make it easy for you to do this there is a new - 
splitView:shouldHideDividerAtIndex: delegate method you can implement.


M

On 21 Jun 2008, at 23:38, Markus Spoettl wrote:


Hello List,

 I've done a lot of testing and googling but I can't figure out how  
or even if it is possible to completely hide a divider of a  
NSSplitView.


Suppose I have a split view setup like this:

  A  B
|--|--|

B is collapsible through a button, not through dragging (there is a  
min and max constraint on the divider too). I have a button that  
toggles the view from collapsed to expanded and back. However, when  
view is collapsed the divider is still visible on the right edge of  
the split view.


I've tried sizing the subviews myself in my own custom SplitView  
subclass - not using NSSplitView's -setPosition: - but even that  
doesn't help. The splitview somehow adjusts the the frames after  
they have been set so the divider stays visible, not matter what you  
do.


Instruments is an example of an app that has splitters that work  
like I want it. The Extended Details pane toggles on and off using a  
button (on the bottom toolbar). When collapsed there is no divider  
visible and you can expand it by using the button only.


Is that something I can do with NSSplitView? If so, how?

Regards
Markus
--
__
Markus Spoettl

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/md207%40doc.ic.ac.uk

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: PDFKit guidance

2008-06-21 Thread Adam R. Maxwell


On Jun 20, 2008, at 12:53 PM, John Calhoun wrote:



On Jun 20, 2008, at 5:21 AM, Adam R. Maxwell wrote:
If you want to draw in memory, I think you have to drop down to  
Quartz; using PDFKit would likely be easier, but it looks like you  
can only specify a Quartz filter when saving to a file?.


I think there may be some confusion with regards to drawing

Antonio is correct that PDFPage has a -[drawWithBox:] method that is  
used not simply for displaying to screen but also for rendering into  
a PDF context for saving to file as well.  So, you can still use  
PDFPage, override -[drawWithBox:] in an app that has no intention of  
displaying the PDF to screen.


The saving method is in PDFDocument.  When called it walks through  
each PDFPage in the document and calls it to render into a PDF  
context.  (Printing within PDF Kit does something similar, BTW.)   
Optionally too, you can pass a QuartzFilter to the save method in  
PDFDocument and get, for example, grayscale output.


You can also do something similar in Quartz with CGPDFDocumentRefs  
and CGPDFPageRefs.  The QuartzFilter stuff should work for  
CGContexts as well.


There is I think a perception that PDF Kit is only for displaying  
PDF's and I like to try to dispell that when I can. :-)


I appreciated Antonio's (and your) reminder :).  If I understand  
correctly, the OP could create a PDF context with  
kCGPDFXDestinationOutputProfile set to a grayscale profile, set it as  
the current context with [NSGraphicsContext setCurrentContext:], then  
draw each PDFPage into it.  Would you still have to use  
CGContextBeginPage/CGContextEndPage in that case, or is there an  
easier way to draw all pages of a PDFDocument into a given context?   
There's an obvious advantage in using PDFKit if you're saving to disk,  
but I'm curious to know if there's a distinct advantage in using it to  
draw to memory.  Subclassing PDFPage apparently requires 10.5, also,  
unless I'm missing something.


thanks,
adam
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to hide the divider in a collapsed NSSplitView pane

2008-06-21 Thread Markus Spoettl

Hi Milen,

On Jun 21, 2008, at 6:21 PM, Milen Dzhumerov wrote:
A common UI pattern now is to provide a button to show and hide one  
subview or another of a split view, and completely hide the divider  
when the subview between it and the edge of the window is hidden. To  
make it easy for you to do this there is a new - 
splitView:shouldHideDividerAtIndex: delegate method you can  
implement.



Ahhh. That's great, I just tried. Thanks so much for the tip!

Regards
Markus
--
__
Markus Spoettl



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: How to hide the divider in a collapsed NSSplitView pane

2008-06-21 Thread Markus Spoettl

On Jun 21, 2008, at 5:53 PM, Andreas Mayer wrote:

The documentation for NSSplitView says:


dividerThickness
Returns the thickness of the divider.

- (CGFloat)dividerThickness

Discussion
You can subclass NSSplitView and override this method to change the  
divider’s size, if necessary.



I guess I didn't think of that, thanks for the tip. There's actually a  
better way that Milen pointed out, though.


Regards
Markus
--
__
Markus Spoettl



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: Race in Apple's NSTreeContoller/NSOutlineView

2008-06-21 Thread Chris Hanson

On Jun 19, 2008, at 7:49 PM, Godfrey van der Linden wrote:

The sub-xib bindings are through the NSViewControllers  
representedObject, which gets set not at awakeFromNib time but later  
when the subview is activated.


What do your bindings look like?

If you have an outline view managed by an NSTreeController in your  
xib, I'd expect you to have (1) your outline view's column's value  
bound through your NSTreeController's arrangedObjects; (2) your  
NSTreeController's contentObject, contentArray, or contentSet  
bound through your File's Owner's representedObject; (3) your  
NSTreeController set to use entity mode; and (4) your  
NSTreeController's managedObjectContext bound to something appropriate.


#3  4 above are optional if you don't rely on the NSTreeController to  
instantiate your model objects.


Is this about how you have your bindings configured now, or are they  
set up differently?


  -- 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: Bindings Concept Question

2008-06-21 Thread Chris Hanson

On Jun 21, 2008, at 10:49 AM, Alex Wait wrote:


I have tried to, in my init method, to do this

id proxy = [controller mutableArrayValueForKey:@arrayOfData];


Your init method of what class?

Does controller have an arrayOfData property, or does the object  
you're making that call from?



-(void)addData: (id) sender
{

   NSString* newFirst = [firstNameField stringValue];
   NSString* newLast = [lastNameField stringValue];
   Data* newData = [[Data alloc]init];

   [newData setValue:newFirst forKey:@firstName];
   [newData setValue:newLast forKey:@lastName];


   [arrayOfData addObject:newData];


That right there is your problem.  You are modifying the array itself,  
not the property, so it is not posting KVO notifications.


Replace that with

[[self mutableArrayValueForKey:@arrayOfData] addObject:newData];

and observer notifications will be sent.

It's also good to be in the practice -- even when creating example,  
test, or throwaway projects -- of using good names for your properties  
and classes.  You can use Xcode's refactoring support to easily change  
the name of the Data class to Person, the arrayOfData property  
to people, and the newData local variable to newPerson.


Your code will read much more clearly that way:  For example, you  
won't be misled to thinking that the underlying array should post  
notifications for changes made to it, because it's the property you  
really want notifications for.


  --- 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: CoreData local and on server sync

2008-06-21 Thread Chris Hanson

On Jun 21, 2008, at 3:33 AM, René v Amerongen wrote:

Does someone has any experience about having a local data store  
which is syncing wit the server store using Coredata?


We have a few 300+ laptop users and 50+ desktop users who are  
working in the same database.


Now I have to make a similar database but then that the Laptop users  
can work offline.
I would like to have them sync their local copy with the server when  
they are online again.


Is this possible with Coredata and SQL? Does someone has suggestions  
in this directions?


Core Data doesn't do this out of the box.  What you can do is create a  
server back-end that the front-end applications synchronize with.   
You'll have to implement both the server and the synchronization logic  
yourself, but two-way/multi-way synchronization are themselves  
actually well-traveled computer science problems.


Data Synchronization
http://en.wikipedia.org/wiki/Data_Synchronization

Category: Data Synchronization
http://en.wikipedia.org/wiki/Category:Data_synchronization

You'll need to ensure that each entity whose instances you want to  
synchronize has an additional sync ID property that is set to a UUID  
or something equivalent, and implement one of the standard sync  
algorithms.  Communication with a back-end server that implements a  
REST-style protocol using Cocoa is very simple as well.


The advantage of doing this is that you can still get all of the  
benefits of Core Data for work on local systems, and just treat the  
local Core Data persistent store as a cache for the user's interaction  
with the server.  (In other words, it makes offline/disconnected use  
of the application feasible.)


Of course you still have to write code to do this, but at least you  
don't have to switch the application that runs on end-user systems  
completely away from Core Data to use hand-generated SQL.


  -- Chris

PS - As always, if there are capabilities you'd like to see in Core  
Data or elsewhere in Cocoa, please file a feature/enhancement request  
at http://bugreport.apple.com/.  Feature and enhancement requests  
are particularly useful if you describe a bit about why you'd like  
what you're suggesting -- what you'd do with it, what your business  
case or user base is (300+ laptop users and 50+ desktop users), and  
so on.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CoreData local and on server sync

2008-06-21 Thread Chris Hanson

On Jun 21, 2008, at 3:18 PM, Jens Alfke wrote:

Of course you can write your own code that takes a local CoreData  
store and a remote database server, and compares and syncs the data;  
but you're on your own in building that. You'll need a 3rd party  
library to even talk to the server.


In this day and age, I'd be more likely to write a simple server-side  
app that allows the user to interact with the data via a REST API  
using XML or JSON.  WebObjects, Ruby on Rails, etc. make this fairly  
straightforward.  (I think there are plug-ins for Rails that let you  
do this pretty much out of the box, atop ActiveRecord.)


That way you can keep all SQL etc. on the server, and out of the Cocoa  
application.  You also don't have to maintain a constant connection to  
the server, potentially improving scalability.


At that point, it becomes a matter of implementing one of the standard  
data synchronization algorithms in the desktop application.


  -- 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: How to hide the divider in a collapsed NSSplitView pane

2008-06-21 Thread Andreas Mayer


Am 22.06.2008 um 03:58 Uhr schrieb Markus Spoettl:


There's actually a better way that Milen pointed out, though.


If you don't need to support systems earlier than 10.5, yes.


Andreas
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to hide the divider in a collapsed NSSplitView pane

2008-06-21 Thread Markus Spoettl

On Jun 21, 2008, at 7:53 PM, Andreas Mayer wrote:

There's actually a better way that Milen pointed out, though.


If you don't need to support systems earlier than 10.5, yes.


Yes, that's right. I forgot to mention that.

Regards
Markus
--
__
Markus Spoettl



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]

Storing an unsignedLongLong

2008-06-21 Thread Adam Thorsen
I'm attempting to store an unsigned long long (stored in memory in an  
NSNumber) in user defaults, but it appears to be truncated upon  
retrieval.  This may have something to do with the fact that I'm using  
the setInteger method of NSUserDefaults to write the unsigned long  
long value.  However, there appears to be no other way to set an  
integer in user defaults.  Is there another technique I can use within  
the Cocoa API?


Thanks,
-Adam
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Bindings Concept Question

2008-06-21 Thread Scott Anguish
and this is the first FAQ in the Cocoa Bindings Programming Guide  
documentation



On Jun 21, 2008, at 10:12 PM, Chris Hanson wrote:


  [arrayOfData addObject:newData];


That right there is your problem.  You are modifying the array  
itself, not the property, so it is not posting KVO notifications.


Replace that with

   [[self mutableArrayValueForKey:@arrayOfData] addObject:newData];

and observer notifications will be sent.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Storing an unsignedLongLong

2008-06-21 Thread Andrew Farmer

On 21 Jun 08, at 21:59, Adam Thorsen wrote:
I'm attempting to store an unsigned long long (stored in memory in  
an NSNumber) in user defaults, but it appears to be truncated upon  
retrieval.  This may have something to do with the fact that I'm  
using the setInteger method of NSUserDefaults to write the unsigned  
long long value.


It probably does! On most 32-bit systems, long longs are 64 bits wide,  
while integers are 32 bits.


However, there appears to be no other way to set an integer in user  
defaults.  Is there another technique I can use within the Cocoa API?


How about [[NSUserDefaults standardUserDefaults] setObject:myNSNumber  
forKey:key] ?

___

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

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

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 does this https post request always return 404 Not Found

2008-06-21 Thread an0
Cool, it works. Thanks a lot.
But as to APIs, I really can't find the login API, or I would of
course use that instead of posting forms.
Can you tell me where the login API is?

On Sun, Jun 22, 2008 at 6:32 AM, Jens Alfke [EMAIL PROTECTED] wrote:
 This is pretty weird. After some experimenting, I narrowed it down to the
 value of the User-Agent header. I think the del.icio.us server is checking
 that header and returning a 404 if it doesn't like it. And it doesn't seem
 to like CFNetwork's default user-agent header, though it likes Safari and
 curl.

 You can programmatically set the User-Agent header value to Mozilla/5.0
 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/525.18 (KHTML, like
 Gecko) Version/3.1.1 Safari/525.20 and the result should work.

 On the other hand, why are you trying to log into del.icio.us using forms
 and cookies as though you were a web browser? That site already has a pretty
 comprehensive API for applications to access it; you should use that
 instead. (That may in fact be what they're trying to tell you by blocking
 your request.)

 —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: CoreData local and on server sync

2008-06-21 Thread René v Amerongen


Op 22 jun 2008, om 00:18 heeft Jens Alfke het volgende geschreven:



On 21 Jun '08, at 3:33 AM, René v Amerongen wrote:

Now I have to make a similar database but then that the Laptop  
users can work offline.
I would like to have them sync their local copy with the server  
when they are online again.


Is this possible with Coredata and SQL? Does someone has  
suggestions in this directions?


CoreData doesn't support any database servers, only sqlite, which  
operates on local database files.


Of course you can write your own code that takes a local CoreData  
store and a remote database server, and compares and syncs the data;  
but you're on your own in building that. You'll need a 3rd party  
library to even talk to the server.


—Jens



The way that I did before was, creating my own local database, en then  
when there was a change, replicate the changed data, using DO, to the  
server.


But then I have to keep things in memory.

I was hoping for new ideas or that In the Snow version  was something  
new.
I guess the way to go is, use a local SQL store with CoreData, and  
replicate the changed data from local to the server using DO.

The server will also have coredata using SQL.
But what should I do?

1. The server should have multiply network entries/connections, but  
only one entry to the coredata  SQL


2. The server should have multiply network entries/connections, and  
equal multiply entries to the coredata  SQL - will coredata keep the  
data uptodate from different read/write requests ( entries) of the  
same data? If f.e one connection do a request for data A and change  
something of data A, that a second connection who want also read Data  
A get the update data?


Rene___

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

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

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

This email sent to [EMAIL PROTECTED]