Re: Override AppleScrollBarVariant on NSScroller?

2008-04-11 Thread David Wilson
On Thu, Apr 10, 2008 at 8:00 AM,  <[EMAIL PROTECTED]> wrote:
> Thanks Mike, adding a default to NSArgumentDomain (i.e. by passing
>  {"-AppleScrollBarVariant", "Single"} to the executable on launch) did
>  the trick.

As others have mentioned... please don't actually do this. The setting
is a system-wide preference for a reason; you should respect the
user's preference rather than forcing something else down their
throat. If there's some reason you think you need to ignore that
preference, you should let the list know, and we might be able to
provide a better way of doing things.

-- 
- David T. Wilson
Princeton Satellite Systems
[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: Question about NSTreeController/NSOutlineView instance cleanup

2008-04-11 Thread mmalc crawford


On Apr 11, 2008, at 12:10 AM, Quincey Morris wrote:
For another thing, assuming you're approaching this using MVC design  
principles, this code gets things exactly backwards -- when setting  
up your data model, you don't make changes to the controller and  
expect them to be reflected in the model -- you make changes in the  
model and let them be reflected (via the controller) in the view.



This is at best misleading.
It is perfectly reasonable to make changes to the controller an expect  
them to be propagated to the underlying model.  You do this. for  
example, when invoking an array controller's add: or insert: method.


It's not clear what the relevance is of mentioning the MVC pattern  
here -- controllers do manipulate the model object graph.



Well, without knowing the details of what you're doing, it's  
impossible to be certain, but this code certainly looks *very*  
wrong. For one thing, 'insertObject' is (according to the  
documentation) for controller subclasses to use to customize their  
own behavior, not for other things to use to insert objects.  
Normally, you don't want to mess with trying to change  
arrangedObjects directly.




On the contrary, insertObject:atArrangedObjectIndex: is provided  
precisely so that you can add an object at a particular location.
See Bookmarks at  for an example.


mmalc

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Question about NSTreeController/NSOutlineView instance cleanup

2008-04-11 Thread Markus Spoettl

On Apr 11, 2008, at 12:10 AM, Quincey Morris wrote:
Well, without knowing the details of what you're doing, it's  
impossible to be certain, but this code certainly looks *very*  
wrong. For one thing, 'insertObject' is (according to the  
documentation) for controller subclasses to use to customize their  
own behavior, not for other things to use to insert objects.  
Normally, you don't want to mess with trying to change  
arrangedObjects directly.


For another thing, assuming you're approaching this using MVC design  
principles, this code gets things exactly backwards -- when setting  
up your data model, you don't make changes to the controller and  
expect them to be reflected in the model -- you make changes in the  
model and let them be reflected (via the controller) in the view.


Again assuming there's nothing very strange intended here, all you  
need to do is update treeContent in a KVO-compliant way, which (in  
the case of arrays) is:


	[[myDocument mutableArrayValueForKey:@"treeContent"]  
addObject:rootnode];


(or some variant such as insertObject...) and the tree controller  
will see the change and update the user interface.


There are also other ways to change treeController in a KVO- 
compliant way, but mutableArrayValueForKey seems the most direct in  
this case.



I got it to work. What you say makes a lot of sense now, thanks very  
much for helping me understand what really was wrong with the code. Of  
course it solved the leaking problem and works really nicely. I'm new  
to the concept that a node (or any object) will change its class to  
something else once added to the KVO structure appropriately and  
"learns" new things as it's added. It's quite cool.


Thanks again!

Regards
Markus

PS: Question remains why Apple doesn't know how to really do this -  
it's the sample project I got this code from.

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

This email sent to [EMAIL PROTECTED]


Re: Override AppleScrollBarVariant on NSScroller?

2008-04-11 Thread Clark Cox
On Wed, Apr 9, 2008 at 11:30 PM, Bill Monk <[EMAIL PROTECTED]> wrote:
>
>  On Apr 9, 2008, at 10:41 PM, Michael Watson <[EMAIL PROTECTED]> wrote:
>
> >
> > I hope it isn't possible. I don't really want applications actively
> > ignoring my scroll bar setting and enforcing its own
> >
> > If suddenly one or two of my apps are  different, it's going to drive me
> > batty as I switch around between apps, and those weird apps are gonna
> > take a quick trip to the trash.
> >
>
>  <> iTunes (recent versions)
>
> >  I prefer them at one end, together, at bottom.
> >
>
>  So does iTunes. It now ignores any other choice. A bug, hopefully, not a
> "feature."

This is not true. iTunes' scrollers will work in either of the
supported configurations.

-- 
Clark S. Cox III
[EMAIL PROTECTED]
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Override AppleScrollBarVariant on NSScroller?

2008-04-11 Thread Michael Watson
Uh, the double both variant isn't available in the GUI, so why would  
you ever complain about an application not supporting it? It's never  
been an official option, just available via an undocumented preference  
value.


The bottom line that you're veering away from is that this guy wants  
to *force* the double variant on users, regardless of the setting the  
user has chosen in the Appearance preferences. iTunes respects the  
setting I chose in the prefs, this guy's app won't. Guess which one is  
being a better citizen.



--
m-s


On 10 Apr, 2008, at 23:24, Bill Monk wrote:


On Apr 10, 2008, at 1:43 AM, Michael Watson wrote:

Not sure what you're talking about.



This:

http://homepage.mac.com/billmonk/clips/scrollbarsTiger.png

http://homepage.mac.com/billmonk/clips/scrollbarsLeopard.png



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSURLConnection doesn't post

2008-04-11 Thread David Wilson
On Fri, Apr 11, 2008 at 1:32 PM, Jean-Daniel Dupas
<[EMAIL PROTECTED]> wrote:

>  NSRunloop documentation disagree:
>  In general, your application does not need to either create or explicitly
> manage NSRunLoop objects. Each NSThread object, including the application's
> main thread, has an NSRunLoop object automatically created for it as needed.
> If you need to access the current thread's run loop, you do so with the
> class method currentRunLoop.

currentRunLoop creates the run loop if necessary; the run loop is not
automatically created at thread start. Also, the run loop must
actually be run, which passes thread control into [NSRunLoop run]- you
can't have a run loop magically running in your thread while you're
doing other things in the thread unless those other things are managed
by the run loop.

-- 
- David T. Wilson
Princeton Satellite Systems
[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: Efficient object wrappers and GC

2008-04-11 Thread David Wilson
On Fri, Apr 11, 2008 at 4:15 PM, Michael Ash <[EMAIL PROTECTED]> wrote:

>  I think it's inherently not possible to do without destroying the
>  speed you're trying to gain. Due to how Apple's collector is
>  implemented, not generating write barriers for stack values, seeing if
>  an object has been stored requires re-scanning all dirty parts of the
>  stack.

If you're not opposed to trading memory for the speed, you can link
the wrapper to the underlying structure to ensure that you create one
and only one wrapper for each underlying data node. The enumerator can
then return the unique wrapper for the appropriate next node. You'll
have to make sure that the GC doesn't think the wrappers are trashable
(toss them all in some storage structure?).

This way you'll pay the speed penalty the first time through, but on
subsequent passes you'll only pay the penalty for nodes that haven't
been seen yet. The actual benefit you get from this depends heavily on
how often you modify the underlying structure, which would require you
to toss out old wrappers for deleted nodes and create new ones for the
not-yet-visited nodes.

-- 
- David T. Wilson
Princeton Satellite Systems
[EMAIL PROTECTED]
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Custom view output to projector

2008-04-11 Thread Michael Vannorsdel
Can you make the application run fullscreen or use a borderless window  
(no titlebar)?  For borderless windows you'll have to programatically  
make it with the NSBorderlessWindowMask mask.



On Apr 11, 2008, at 8:25 PM, Simon wrote:

I'm getting a simple animation programme together for a gig I'm  
playing in at the end of the month, and I'm having difficulty  
working out how to send the animation straight to a projector.


The animation is in a custom view. In the past, I've just dragged  
the window containing the view to the left of my desktop and  
projected that, but the problem is I get the bar at the top of the  
window showing on the projector. Does anyone know how to send the  
custom view image straight out to the projector?


Normally, I use the S-VHS output on my G4 Powerbook to send out the  
signal, though sometimes I use a data connection.


I've tried looking in the mailing list's archives, but couldn't seem  
to find anything. Does anyone have any ideas (or links to sample  
code)?


___

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

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

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

This email sent to [EMAIL PROTECTED]


Custom view output to projector

2008-04-11 Thread Simon

Hi,

I'm getting a simple animation programme together for a gig I'm playing in at 
the end of the month, and I'm having difficulty working out how to send the 
animation straight to a projector.

The animation is in a custom view. In the past, I've just dragged the window 
containing the view to the left of my desktop and projected that, but the 
problem is I get the bar at the top of the window showing on the projector. 
Does anyone know how to send the custom view image straight out to the 
projector?

Normally, I use the S-VHS output on my G4 Powerbook to send out the signal, 
though sometimes I use a data connection.

I've tried looking in the mailing list's archives, but couldn't seem to find 
anything. Does anyone have any ideas (or links to sample code)?

Thanks,

Simon Jones

___
Join Excite! - http://www.excite.com
The most personalized portal on the Web!


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSApplicationMain arguments

2008-04-11 Thread Michael Vannorsdel
BTW, not sure why you're trying to feed in custom args but if it's for  
testing purposes you can tell Xcode what args to pass by getting info  
on your program under Executables and put the launch arguments in there.



On Apr 11, 2008, at 8:01 PM, [EMAIL PROTECTED] wrote:


'm trying to add some launch arguments to my executable by modifying
the arguments passed to main.m, but find that the new arguments are
completely ignored. No matter what I pass to NSApplicationMain the
executable launches with the same old default argsv[]. Is this not the
right approach? Should I rather subclass NSApplication? If so, how?
Any help appreciated. Thanks.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSApplicationMain arguments

2008-04-11 Thread Michael Vannorsdel
If you're using NSProccessInfo to get the args, then changing them at  
runtime won't work as far as I know.  The args are stored before main  
is even called.  I don't think passing args to NSApplicationMain has  
any kind of effect.


Couldn't you just store your custom args in a global and access them  
later when you need them?



On Apr 11, 2008, at 8:01 PM, [EMAIL PROTECTED] wrote:


I'm trying to add some launch arguments to my executable by modifying
the arguments passed to main.m, but find that the new arguments are
completely ignored. No matter what I pass to NSApplicationMain the
executable launches with the same old default argsv[]. Is this not the
right approach? Should I rather subclass NSApplication? If so, how?
Any help appreciated. Thanks.


___

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

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

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

This email sent to [EMAIL PROTECTED]


NSApplicationMain arguments

2008-04-11 Thread slasktrattenator
Hi,

I'm trying to add some launch arguments to my executable by modifying
the arguments passed to main.m, but find that the new arguments are
completely ignored. No matter what I pass to NSApplicationMain the
executable launches with the same old default argsv[]. Is this not the
right approach? Should I rather subclass NSApplication? If so, how?
Any help appreciated. Thanks.

int main(int argc, char *argv[])
{
int new_argc = 2;
char* arg1 = argv[0];
char *new_argv[] = { arg1, "foo", "bar", NULL };

return NSApplicationMain(new_argc,  (const char **) new_argv);
}
___

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

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

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

This email sent to [EMAIL PROTECTED]


struct problem

2008-04-11 Thread Dean Ritchie
I'm trying to develop an app to take in dimensions (rowCount and  
colCount) from an NSForm and set up an NSView subclass to display a  
matrix of squares accordingly.  Here's the action that responds to the  
NSForm:


- (IBAction)setSize:(id)sender
{
NSRect aRect;
//Start with column and row counts from LASize.
LASize = sender;
columnCount = [[LASize cellAtIndex:0] intValue];
rowCount = [[LASize cellAtIndex:1] intValue];
if (columnCount < 5 | rowCount < 5) return; //wait for something better

aRect.origin.x = 310;
aRect.origin.y = 15;
aRect.size.width = columnCount * 5;
aRect.size.height= rowCount * 5;
	theGrid = [[LogicArtMatrix alloc] initWithCol: columnCount row:  
rowCount];
	thePicture=[[LogicArtDisplay alloc] initWithMatrix: theGrid cols:  
columnCount rows: rowCount andRect: aRect];


return;

}

When I stop right after initializing the NSRect local variable, the  
debugger reports miniscule values for the portions of the rectangle,  
like it got overlaid with integers instead of float values.


TIA

Dean Ritchie
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Method Explanation

2008-04-11 Thread Michael Vannorsdel

You have to create actual objects of that class:

MyClass * obj = [[MyClass alloc] init];

then send your '-' messages to that object:

[obj myAction:arg];

You might want to read up some more on object oriented programming so  
you know the difference between an object and its class.  A class is  
basically a template explaining how every object that's made from it  
behaves.



On Apr 11, 2008, at 6:31 PM, Kevin Ferguson wrote:


reetings!

This is a rather odd (and I'm sure simple) question, but I cannot  
seem to find a suitable explanation anywhere I look.


So, my code initializes a menu with an action "myAction:", whose  
target is "myClass".


Now, I've noticed through trial and error that the only way to get  
my method to respond to the menu is to mark the method with a + as  
opposed to a -.

This means my method declaration is now +(void)myAction:(id)sender { }

So, this much I have working. Now, within that method, I  
programmatically create a panel and a few text boxes, along with a  
button with the action "doStuff" whose target is also "myClass". At  
the end of the method, I tell the panel to display, and everything,  
including the button, works fine. (An NSlog put in the doStuff:  
method activates) I noticed that the method that my button calls  
also must have the + to do anything.


However, the moment I try to access any of my objects (the button,  
or text boxes) that I created in the myAction: method, I get a  
warning saying that I'm accessing an instance variable from a class  
method, even though it is declared in the class's header file. As  
such, I can't really interact with it.


Now, I'm entirely self-taught in Cocoa, so this may be something  
more obvious than I think. Is there a reason for this occurrence? I  
assume it's got something to do with the +, but not knowing what the  
+ means, or why my method must be a + to work, I can't really  
determine what to do. Can this be explained at all, or can anyone  
point me to a place that would explain 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]


Method Explanation

2008-04-11 Thread Kevin Ferguson

Greetings!

This is a rather odd (and I'm sure simple) question, but I cannot seem  
to find a suitable explanation anywhere I look.


So, my code initializes a menu with an action "myAction:", whose  
target is "myClass".


Now, I've noticed through trial and error that the only way to get my  
method to respond to the menu is to mark the method with a + as  
opposed to a -.

This means my method declaration is now +(void)myAction:(id)sender { }

So, this much I have working. Now, within that method, I  
programmatically create a panel and a few text boxes, along with a  
button with the action "doStuff" whose target is also "myClass". At  
the end of the method, I tell the panel to display, and everything,  
including the button, works fine. (An NSlog put in the doStuff: method  
activates) I noticed that the method that my button calls also must  
have the + to do anything.


However, the moment I try to access any of my objects (the button, or  
text boxes) that I created in the myAction: method, I get a warning  
saying that I'm accessing an instance variable from a class method,  
even though it is declared in the class's header file. As such, I  
can't really interact with it.


Now, I'm entirely self-taught in Cocoa, so this may be something more  
obvious than I think. Is there a reason for this occurrence? I assume  
it's got something to do with the +, but not knowing what the + means,  
or why my method must be a + to work, I can't really determine what to  
do. Can this be explained at all, or can anyone point me to a place  
that would explain it?


Thanks!
-Kevin
___

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

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

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

This email sent to [EMAIL PROTECTED]


Transparent view click-through

2008-04-11 Thread Greg Hoover

Is there a way to prevent click through on a transparent view?

Greg
___

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

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

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

This email sent to [EMAIL PROTECTED]


Accessing Directory.app shared contacts

2008-04-11 Thread Kyle Sluder
Hey all,

Is there a way to get at the contacts available in Directory.app?  The
disjunction between Directory.app and Address Book.app is infuriating,
to say the least.  I really want to develop a quick-and-dirty in house
contact management app that integrates nicely with all the other
collaboration features, but it looks like I'm going to be crawling
LDAP servers to do so.

Thanks,
--Kyle Sluder
___

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

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

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

This email sent to [EMAIL PROTECTED]


Quartz.framework Catch-22 on Panther

2008-04-11 Thread Nick Nallick
I'm using the Cocoa class QCRenderer after testing for Tiger or  
later.  This means I have to link to Quartz.framework which I do as a  
weak link so I can still start under Panther and test the system  
version before trying to instantiate QCRenderer.  This worked fine  
when building on Tiger.


Unfortunately I've found that when building on Leopard all I have to  
do to crash Cocoa on Panther is add "-weak_framework Quartz" to  
Xcode's "Other Linker Flags".  It's not even necessary to add  
Quartz.framework to my project.  When this linker flag is added the  
following code will crash on Panther on the second line, although it  
seems just about any reference into Cocoa will crash (e.g., @try will  
do it).


NSApplicationLoad();
[NSAutoreleasePool alloc];

Therefore I can't link or weak link my application to  
Quartz.framework.  Is there any way to instantiate QCRenderer without  
doing that?


I guess I could create a private framework to instantiate QCRenderer  
and only load it on Tiger and later, but it seems like there ought to  
be an easier way in Obj-C.


Thanks
Nick Nallick
___

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

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

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 should I go about downloading files

2008-04-11 Thread Scott Anguish


On Apr 10, 2008, at 9:04 PM, Laimonas Simutis wrote:

Hey,

This is my first cocoa projects so I am kind of finding my way around
the framework. The question I have is maybe more related to the design
practices with cocoa.

I make a HTTP call to a server which gives me back a list of urls
pointing to mp3 files. For each url handling I created FileDownloader
class that inside uses NSURLDownload class to download the mp3 file.
All works fine but I have a problem with finding a solution for
"queuing" the downloads. I want to control how many files will be
downloaded concurrently (usually it will be one or two). However right
now what I have is basically this:


Have a look at NSOperation and NSOperationQueue in concert with  
NSURLDownload


this will allow you to do this, as well as change priorities, control  
how many downloads can occur at the same time, etc..


http://developer.apple.com/documentation/Cocoa/Reference/NSOperation_class/index.html#/ 
/apple_ref/doc/uid/TP40004591


http://developer.apple.com/documentation/Cocoa/Reference/NSOperationQueue_class/index.html#/ 
/apple_ref/doc/uid/TP40004592



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Representational State Transfer

2008-04-11 Thread Ken Thomases

On Apr 11, 2008, at 6:08 AM, Jonathan Relf wrote:
I can see that having an NSXMLDocument would allow me to easily read  
in

XML data from a web source using initWithContentsOfURL: but if I'm
wanting make a request of a URL first and then get the XML reply back
into an object, is there a better choice of data structure to use than
NSXMLDocument for sending the initial request to the URL?


I think you probably want to use NSURLConnection and friends to  
accumulate the XML data into an NSMutableData object.  Then,  
initialize an NSXMLDocument with its initWithData:options:error: method.


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]


Panther and Cocoa/Carbon mix; unclickable windows

2008-04-11 Thread Kevin Grant

Are there known issues with "unclickable" Cocoa windows in
Carbon apps on Panther (10.3.9)?  The Carbon windows still
accept events.  On Leopard, with identical code, the Cocoa
windows *do* work correctly in my Carbon app.

I think I'm doing everything I should, e.g. calling
NSApplicationLoad(), creating an auto-release pool.  It
doesn't seem to matter how the window is created; for
instance, "orderFrontStandardAboutPanelWithOptions" makes
an About box, and even this is "unclickable".

Thanks,
Kevin 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: enabling drag and drop in nsoutlineview

2008-04-11 Thread Stephane Huaulme

fixed:

my outlineview datasource outlet was not connected!


On Apr 11, 2008, at 3:12 PM, Stephane Huaulme wrote:

note that i did register my drap and  drop type in awakeFromNib, and  
that code does get executed:
   [outlineView registerForDraggedTypes:[NSArray  
arrayWithObject:myAgendaNodeType]];


however, the following proc:
- (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray  
*)items toPasteboard:(NSPasteboard *)pboard {
never gets called, which is why i suspect something is not set  
properly in the nib.




On Apr 11, 2008, at 2:11 PM, Stephane Huaulme wrote:

i used the abstracttree sample project step by step instructions,  
and i get it to work as expected except when it comes to drap and  
drop.
comparing the nib files between my implementation and the one that  
comes in the sample code, i can't see anything different.


i do expect the drap and drop to require something setup properly  
in the nib file for the outline view, but i just can't find it.

note that i did implement:
- (BOOL)outlineView:(NSOutlineView *)outlineView writeItems: 
(NSArray *)items toPasteboard:(NSPasteboard *)pboard {
- (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id  
)info item:(id)item childIndex:(NSInteger)index {
- (NSDragOperation)outlineView:(NSOutlineView *)outlineView  
validateDrop:(id )info proposedItem:(id)item  
proposedChildIndex:(NSInteger)index {



what am i missing?



___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/stephane%40myhomeoffice.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: Restoring Tiger NSTableView behaviour in Leopard

2008-04-11 Thread Corbin Dunn


Thank you; that fixed it.  Here is my solution (for a 4-column table):

-(void)textDidEndEditing:(NSNotification *)notification
{

NSInteger editedColumn = [self editedColumn];
NSInteger editedRow = [self editedRow];

NSDictionary *userInfo = [notification userInfo];
	int textMovement = [[userInfo valueForKey:@"NSTextMovement"]  
intValue];


if (textMovement == NSTabTextMovement)
{
[super textDidEndEditing:notification];
if (editedColumn == 3)
{   
			// Select row before calling -(void)editColumn:, and then start  
editing
			[self selectRowIndexes:[NSIndexSet indexSetWithIndex:editedRow+1]  
byExtendingSelection:NO];

[self editColumn:0 row:editedRow+1 withEvent:nil 
select:YES];
}
}
else if (textMovement == NSBacktabTextMovement)
{
[super textDidEndEditing:notification];
if (editedColumn == 0)
{
			// Select row before calling -(void)editColumn:, and then start  
editing
			[self selectRowIndexes:[NSIndexSet indexSetWithIndex:editedRow-1]  
byExtendingSelection:NO];

[self editColumn:3 row:editedRow-1 withEvent:nil 
select:YES];
}
}
else
[super textDidEndEditing:notification];



Looks good. You could abstract it using [self numberOfColumns] - 1  
instead of 3. Also, add in bounds checks like if editedRow < ([self  
numberOfRows] - 1) then inc row ... and if editedRow > 0) then dec row.


corbin
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Restoring Tiger NSTableView behaviour in Leopard

2008-04-11 Thread K. Darcy Otto

On 11-Apr-08, at 1:07 PM, Corbin Dunn wrote:



On Apr 11, 2008, at 11:38 AM, K. Darcy Otto wrote:
The application I am working on is essentially one big table, and  
I'd like to restore at least one aspect the default tab behaviour  
that Tiger used when editing tables.  Namely, when the user is at  
the end of the row and hits tab, I'd like editing to begin at the  
beginning of the next row.  I note that here,


http://www.cocoabuilder.com/archive/message/cocoa/2007/10/31/191866

the issue is acknowledged, and a solution proposed.  The solution  
is to subclass NSTableView and implement -(void)textDidEndEditing: 
(NSNotification *)notification, but I'm having a problem with the  
implementation.  Here is what I have so far:


-(void)textDidEndEditing:(NSNotification *)notification
{

NSDictionary *userInfo = [notification userInfo];
	int textMovement = [[userInfo valueForKey:@"NSTextMovement"]  
intValue];


if (textMovement == NSTabTextMovement)
{
// Tab pressed!
[super textDidEndEditing:notification];
}
}

So, I get to "Tab pressed!", but then don't know how to implement  
editing of the first column of the next row.  I think I could do  
this if I could figure out what column had just finished being  
edited.  I suppose I could create a variable in the subclass that  
stores this information when editing begins; but I was thinking  
there should be a property I can just read (and I'm not sure what  
property that is).  When I use -selectedColumn on the NSTableView,  
I don't get anything useful (-1), because apparently no column is  
selected (I do get useful information from -selectedRow; but this  
isn't quite what I need).  Thanks.




Use
- (NSInteger)editedColumn;
- (NSInteger)editedRow;

You can store it off, call super, then begin editing on the next row/ 
column (if it was already at the last column).


corbin


Thank you; that fixed it.  Here is my solution (for a 4-column table):

-(void)textDidEndEditing:(NSNotification *)notification
{

NSInteger editedColumn = [self editedColumn];
NSInteger editedRow = [self editedRow];

NSDictionary *userInfo = [notification userInfo];
int textMovement = [[userInfo valueForKey:@"NSTextMovement"] intValue];

if (textMovement == NSTabTextMovement)
{
[super textDidEndEditing:notification];
if (editedColumn == 3)
{   
			// Select row before calling -(void)editColumn:, and then start  
editing
			[self selectRowIndexes:[NSIndexSet indexSetWithIndex:editedRow+1]  
byExtendingSelection:NO];

[self editColumn:0 row:editedRow+1 withEvent:nil 
select:YES];
}
}
else if (textMovement == NSBacktabTextMovement)
{
[super textDidEndEditing:notification];
if (editedColumn == 0)
{
			// Select row before calling -(void)editColumn:, and then start  
editing
			[self selectRowIndexes:[NSIndexSet indexSetWithIndex:editedRow-1]  
byExtendingSelection:NO];

[self editColumn:3 row:editedRow-1 withEvent:nil 
select:YES];
}
}
else
[super textDidEndEditing:notification];

} // textDidEndEditing

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Utility that lists methods of private framework

2008-04-11 Thread Jean-Daniel Dupas


Le 11 avr. 08 à 22:08, Ryan Chapman a écrit :

Is there a utility that will list the classes/methods of a framework/ 
dynamic

library, whether the library was written using C, Carbon or Cocoa?



A compile C binary does not contains C functions signatures. It  
contains the functions names but neither arguments nor return type.
C++ symbols are mangled using arguments type to allow argument  
overriding, so you can retreive signature from the function name (man c 
++filt)

To list unstripped symbols in a binary, see the nm tools.

Obj-C use a dynamic runtime with dynamic binding, and so, an obj-c  
binary does not need to export methods symbols and need just export  
class names (in fact, the 32 bits runtime unlike the 64 bits one, does  
not allow to declare a class as hidden). But the obj-c runtime need a  
bunch of informations (class descriptions, methods list and  
signatures, etc) that are stored in a special section of any obj-c  
binary. You can read it using otool (otool -ov binaryfile)



Don't hope to get a lots of informations about reverse enginering and  
use of private API on this list.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Utility that lists methods of private framework

2008-04-11 Thread Michael Vannorsdel
I think Omni Group (http://www.omnigroup.com) had a tool called class- 
dump that you could use to get a list of private objc classes and  
methods from binaries including frameworks and libraries.  I don't  
know about C/C++.



On Apr 11, 2008, at 2:08 PM, Ryan Chapman wrote:

Is there a utility that will list the classes/methods of a framework/ 
dynamic

library, whether the library was written using C, Carbon or Cocoa?


___

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

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

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

This email sent to [EMAIL PROTECTED]


NSSearchField and NSArrayController filtering

2008-04-11 Thread Thomas Backman

Hi everybody,
I've got a small app with two tableviews; one with iTunes playlists,  
and one with the tracks in the selected playlist. (Just doing this to  
learn)


I added a NSSearchField to the program, but can't get it to work. Am I  
right that it's meant to be possible to, with 0 lines of code, filter  
out rows that match the search text?

Sure seems so: http://www.borkware.com/quickies/single?id=252

However, I can't get it to work, and it feels like I've tried  
everything (bar writing the code!). I have a playlist controller and a  
track controller. At the moment, the NSSearchField is bound like so:

Predicate -> Bind to: Track controller
Controller  key: filterPredicate
Model Key Path: tracks (what should I put here? tracks is the name of  
the instance var with the track objects (NSDictionaries), but nothing  
seems to help.)

Display name: predicate (what's this?)
Predicate Format: name contains $value (name is a key in the track  
objects)


No matter what I type in the search field, nothing changes. Seems to  
be a complete no-op.


Any ideas?

Oh, and slightly OT: is there some kind of reference to IB where I can  
look up what things like "display name" mean?


TIA,
Thomas
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Efficient object wrappers and GC

2008-04-11 Thread Michael Ash
On Fri, Apr 11, 2008 at 12:53 PM, Alastair Houghton
<[EMAIL PROTECTED]> wrote:
> On 11 Apr 2008, at 16:07, Michael Ash wrote:
> > On Fri, Apr 11, 2008 at 6:04 AM, Alastair Houghton
> > <[EMAIL PROTECTED]> wrote:
> >
> > > Under GC, these kinds of tricks are no longer possible because there is
> no
> > > -retain call any more, so no way to tell if it is safe to re-initialise
> and
> > > return the same wrapper object.
> > >
> > > Aside from re-implementing the data structure itself in ObjC and making
> all
> > > of its nodes objects, which might not be possible in some cases, has
> anyone
> > > thought of an efficient solution to this problem when running under GC?
> > >
> >
> > The obvious technique would be to stop trying to make the optimization
> > implicit and to make it explicit and managed by the caller instead. In
> > other words, you write your API so that it explicitly returns the same
> > object every time you call -nextObject, just with a new state. Then
> > you have a copy method which the caller can use to get a new
> > unchanging object for the case where he wants to keep one around.
> >
>
>  Yes.  It's a shame though because that doesn't really fit with the way
> people expect NSEnumerator to behave.

Honestly the original one doesn't fit either. I expect this code to work:

id a = [enumerator nextObject];
id b = [enumerator nextObject];
assert(a != b);

(Except, of course, for cases where the collection actually does hold
two copies of the same object.)

The very nature of this optimization is such that it's going to
require the calling code to conform to it. The nature of that
conformance varies slightly under GC and under the traditional rules,
but it's there in both cases.

Technically the above may not be legal under the traditional rules
either, depending on how you interpret them. The scenario is similar
to the getter/setter problem of whether an object returned from a
getter is still valid if you then call the setter. But I think the
expectation here is that the object should remain valid even if it may
be technically legal to destroy it.

>  I was really just wondering if someone else had had some stroke of genius
> and come up with a way to do this kind of thing under the GC.  Or if,
> perhaps, it would be worth asking for some new feature as part of the GC to
> help with this kind of problem.

I think it's inherently not possible to do without destroying the
speed you're trying to gain. Due to how Apple's collector is
implemented, not generating write barriers for stack values, seeing if
an object has been stored requires re-scanning all dirty parts of the
stack.

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: enabling drag and drop in nsoutlineview

2008-04-11 Thread Stephane Huaulme
note that i did register my drap and  drop type in awakeFromNib, and  
that code does get executed:
[outlineView registerForDraggedTypes:[NSArray  
arrayWithObject:myAgendaNodeType]];


however, the following proc:
- (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray  
*)items toPasteboard:(NSPasteboard *)pboard {
never gets called, which is why i suspect something is not set  
properly in the nib.




On Apr 11, 2008, at 2:11 PM, Stephane Huaulme wrote:

i used the abstracttree sample project step by step instructions,  
and i get it to work as expected except when it comes to drap and  
drop.
comparing the nib files between my implementation and the one that  
comes in the sample code, i can't see anything different.


i do expect the drap and drop to require something setup properly in  
the nib file for the outline view, but i just can't find it.

note that i did implement:
- (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray  
*)items toPasteboard:(NSPasteboard *)pboard {
- (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id  
)info item:(id)item childIndex:(NSInteger)index {
- (NSDragOperation)outlineView:(NSOutlineView *)outlineView  
validateDrop:(id )info proposedItem:(id)item  
proposedChildIndex:(NSInteger)index {



what am i missing?



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Building a custom Data Detector

2008-04-11 Thread Bill Cheeseman
on 2008-04-11 9:48 AM, Errol Sayre at [EMAIL PROTECTED] wrote:

> I can't seem to find any documentation anywhere, but I'm assuming the
> "data detectors" in Leopard are a resurrection/reincarnation of the
> classic Mac OS Data Detectors...
> 
> Is there an open API for creating these dealies in Leopard? I assume,
> if not, that the standard "file a bug report feature request cause
> Apple can't discuss future stuff" rule applies.

Doesn't this have something to do with Leopard's LatentSemanticMapping
framework?

This was a private framework until Leopard. Apple now hosts a mailing list
for it at .

Not that I have figured out how to use it

--

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

PreFab Software - www.prefabsoftware.com


___

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

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

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

This email sent to [EMAIL PROTECTED]


Utility that lists methods of private framework

2008-04-11 Thread Ryan Chapman
Is there a utility that will list the classes/methods of a framework/dynamic
library, whether the library was written using C, Carbon or Cocoa?
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Restoring Tiger NSTableView behaviour in Leopard

2008-04-11 Thread Corbin Dunn


On Apr 11, 2008, at 11:38 AM, K. Darcy Otto wrote:
The application I am working on is essentially one big table, and  
I'd like to restore at least one aspect the default tab behaviour  
that Tiger used when editing tables.  Namely, when the user is at  
the end of the row and hits tab, I'd like editing to begin at the  
beginning of the next row.  I note that here,


http://www.cocoabuilder.com/archive/message/cocoa/2007/10/31/191866

the issue is acknowledged, and a solution proposed.  The solution is  
to subclass NSTableView and implement -(void)textDidEndEditing: 
(NSNotification *)notification, but I'm having a problem with the  
implementation.  Here is what I have so far:


-(void)textDidEndEditing:(NSNotification *)notification
{

NSDictionary *userInfo = [notification userInfo];
	int textMovement = [[userInfo valueForKey:@"NSTextMovement"]  
intValue];


if (textMovement == NSTabTextMovement)
{
// Tab pressed!
[super textDidEndEditing:notification];
}
}

So, I get to "Tab pressed!", but then don't know how to implement  
editing of the first column of the next row.  I think I could do  
this if I could figure out what column had just finished being  
edited.  I suppose I could create a variable in the subclass that  
stores this information when editing begins; but I was thinking  
there should be a property I can just read (and I'm not sure what  
property that is).  When I use -selectedColumn on the NSTableView, I  
don't get anything useful (-1), because apparently no column is  
selected (I do get useful information from -selectedRow; but this  
isn't quite what I need).  Thanks.




Use
- (NSInteger)editedColumn;
- (NSInteger)editedRow;

You can store it off, call super, then begin editing on the next row/ 
column (if it was already at the last column).


corbin
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: enabling drag and drop in nsoutlineview

2008-04-11 Thread Corbin Dunn


On Apr 11, 2008, at 12:11 PM, Stephane Huaulme wrote:
i used the abstracttree sample project step by step instructions,  
and i get it to work as expected except when it comes to drap and  
drop.
comparing the nib files between my implementation and the one that  
comes in the sample code, i can't see anything different.


i do expect the drap and drop to require something setup properly in  
the nib file for the outline view, but i just can't find it.

note that i did implement:
- (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray  
*)items toPasteboard:(NSPasteboard *)pboard {
- (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id  
)info item:(id)item childIndex:(NSInteger)index {
- (NSDragOperation)outlineView:(NSOutlineView *)outlineView  
validateDrop:(id )info proposedItem:(id)item  
proposedChildIndex:(NSInteger)index {



what am i missing?



Probably a call to outlineView registerForDraggedTypes:

corbin

___

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

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

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

This email sent to [EMAIL PROTECTED]


enabling drag and drop in nsoutlineview

2008-04-11 Thread Stephane Huaulme
i used the abstracttree sample project step by step instructions, and  
i get it to work as expected except when it comes to drap and drop.
comparing the nib files between my implementation and the one that  
comes in the sample code, i can't see anything different.


i do expect the drap and drop to require something setup properly in  
the nib file for the outline view, but i just can't find it.

note that i did implement:
- (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray  
*)items toPasteboard:(NSPasteboard *)pboard {
- (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id  
)info item:(id)item childIndex:(NSInteger)index {
- (NSDragOperation)outlineView:(NSOutlineView *)outlineView  
validateDrop:(id )info proposedItem:(id)item  
proposedChildIndex:(NSInteger)index {



what am i missing?

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Core Data and the Document Dirty indicator

2008-04-11 Thread mmalc crawford


On Apr 11, 2008, at 11:26 AM, Jonathan Waddilove wrote:
Could some kind reader point me in the right direction to fix this  
unwanted behaviour.





mmalc

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Making use of Core 2 features without 64bit addressing

2008-04-11 Thread Michael Vannorsdel
This is great to hear, thanks a lot for the info.  Got the build done,  
just need to test on the Core 2 when I get to work.



On Apr 11, 2008, at 1:39 AM, Clark Cox wrote:

On Thu, Apr 10, 2008 at 10:22 PM, Michael Vannorsdel <[EMAIL PROTECTED] 
> wrote:
Indeed I can do that.  This brings up another question; since  
frameworks and
libs didn't have much 64 bit support in 10.4, is it possible for a  
fat
binary to load the 64 bit image on 10.5 and 32 bit on 10.4?   
Perhaps with
some Info.plist settings.  My instinct says no; 64 bit image will  
be used on

all 64 bit archs regardless of sys version.


Your instinct is, fortunately, wrong in this case.

From :


"To prevent new 64-bit executables from running as 64-bit on version
10.4, Apple changed the CPU subtype for 64-bit executables that depend
on high-level frameworks."

That is, if the 64-bit slices of your application depend on Cocoa,
they will be ignored on Tiger and earlier. Just make sure that the
deployment target of your 64-bit slices is set to 10.5.


___

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

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

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 and the Document Dirty indicator

2008-04-11 Thread I. Savant
>  When a Core Data document is opened initialization adds an entity for the
> basic 'All' smart group. This object is assigned to an in memory store
> (rather than to the persistent document) - I have checked and the 'All' item
> doesn't appear in the saved data.

  ... but a context has changed. That's a change. It can result in an
undo. Period.

>
>  My problem is that adding this item results in the 'dirty' flag being set -
> with the result that the user is prompted to save the document even though
> they have not made any changes.

  This isn't a Core Data problem. It's an Undo Manager problem. See
-[NSUndoManager removeAllActions] ... simply clear the changes when
you're done with your initialization routines.

  You can also temporarily disable and enable undo registration. That
and the method above are covered and easily found in the
documentation.

--
I.S.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Efficient object wrappers and GC

2008-04-11 Thread David Duncan

On Apr 11, 2008, at 10:25 AM, Buddy Kurz wrote:

I'm wondering if it would make sense (or be possible)  to override - 
retain and -release to increment/decrement your own variable in  
addition to using the inherited behavior.  In the GC environment,  
the inherited retain does nothing but in either environment your  
enumerator can detect the retain by checking your variable.



It isn't that the inherited retain(release/retainCount/autorelease) do  
nothing, its that they are no-op'd. They are neutered at the the level  
of message dispatcher which means that under GC your class will  
*never* see these messages.


See 

--
David Duncan
Apple DTS Animation and Printing
[EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Restoring Tiger NSTableView behaviour in Leopard

2008-04-11 Thread K. Darcy Otto
The application I am working on is essentially one big table, and I'd  
like to restore at least one aspect the default tab behaviour that  
Tiger used when editing tables.  Namely, when the user is at the end  
of the row and hits tab, I'd like editing to begin at the beginning of  
the next row.  I note that here,


http://www.cocoabuilder.com/archive/message/cocoa/2007/10/31/191866

the issue is acknowledged, and a solution proposed.  The solution is  
to subclass NSTableView and implement -(void)textDidEndEditing: 
(NSNotification *)notification, but I'm having a problem with the  
implementation.  Here is what I have so far:


-(void)textDidEndEditing:(NSNotification *)notification
{

NSDictionary *userInfo = [notification userInfo];
int textMovement = [[userInfo valueForKey:@"NSTextMovement"] intValue];

if (textMovement == NSTabTextMovement)
{
// Tab pressed!
[super textDidEndEditing:notification];
}
}

So, I get to "Tab pressed!", but then don't know how to implement  
editing of the first column of the next row.  I think I could do this  
if I could figure out what column had just finished being edited.  I  
suppose I could create a variable in the subclass that stores this  
information when editing begins; but I was thinking there should be a  
property I can just read (and I'm not sure what property that is).   
When I use -selectedColumn on the NSTableView, I don't get anything  
useful (-1), because apparently no column is selected (I do get useful  
information from -selectedRow; but this isn't quite what I need).   
Thanks.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSArrayController's "selectionIndex" weirdness

2008-04-11 Thread Quincey Morris


On Apr 11, 2008, at 11:19, Johnny Lundy wrote:

Now I am running into the "View Doesn't Update When Model Is  
Changed" issue that Apple lists under "Troubleshooting Cocoa  
Bindings", in that the array element gets removed by my  
"removeObjectAtIndex: [theIndex integerValue]", but that is  
apparently not KVO-compliant.


...

Can someone point me to an example of using removeObjectAtIndex: and  
having KVO take care of updating the NSTableView? Thanks. I have  
already declared the model array as mutable, @property (readwrite,  
copy) and @synthesize.


If 'someObject' is an instance of the class that has playerArray as a  
property, the KVO-compliant way is:


	[[someObject mutableArrayValueForKey:@"playerArray"]  
removeObjectAtIndex:theWhackedOne];



___

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

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

2008-04-11 Thread Jonathan Waddilove
I have a Core Data app (Document based) which holds three different  
entity types. One of the entity types is used to track details of  
'Smart Groups'.


I now have most of the basic application working. However I do have  
one issue I can't track down.


When a Core Data document is opened initialization adds an entity for  
the basic 'All' smart group. This object is assigned to an in memory  
store (rather than to the persistent document) - I have checked and  
the 'All' item doesn't appear in the saved data.


My problem is that adding this item results in the 'dirty' flag being  
set - with the result that the user is prompted to save the document  
even though they have not made any changes.


I've checked the CoreReceipes sample and of course it's doesn't suffer  
from this problem.


Could some kind reader point me in the right direction to fix this  
unwanted behaviour.



Thanks in advance, Jonathan

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re:NSArrayController's "selectionIndex" weirdness

2008-04-11 Thread Johnny Lundy

On Apr 10, 2008, at 19:09, Quincey Morris wrote:
Thanks a bunch, Quincey.

That worked fine. I was going by NSArrayController's documentation  
that its "selectionIndex" method returned an NSUInteger. Either that  
is wrong or the NSButton wraps it in an object wrapper when it uses  
the "Argument" binding, I guess.


This reduces the code I have to write by a bunch.

Now I am running into the "View Doesn't Update When Model Is Changed"  
issue that Apple lists under "Troubleshooting Cocoa Bindings", in that  
the array element gets removed by my "removeObjectAtIndex: [theIndex  
integerValue]", but that is apparently not KVO-compliant.


I read the suggested text and sample code for proxy collections and so  
forth, but still don't quite get what I am supposed to provide as far  
as accessor methods to get the array to be observed for deletions and  
additions of objects.


The suggested methods refer to adding accessors that use value:forKey,  
but I do not have a key for an array element - all I have is the  
selectionIndex. So I am not clear how to do it. In fact, I guess I  
don't get how value:forKey works with an array at all, since only  
dictionaries have keys.


Can someone point me to an example of using removeObjectAtIndex: and  
having KVO take care of updating the NSTableView? Thanks. I have  
already declared the model array as mutable, @property (readwrite,  
copy) and @synthesize.


Johnny
ATM Software



- (void) nightKill:(NSUInteger) theWhackedOne
{
NSLog(@"SelectionIndex=%@",theWhackedOne);
[playerArray removeObjectAtIndex:theWhackedOne];
return;
}


The array controller is sending you a NSNumber whose value is the
selection index. That's why it NSLogs correctly with the %@ (object)
format specifier.

You need:


- (void) nightKill:(NSNumber *) theWhackedOne
{
NSLog(@"SelectionIndex=%@",theWhackedOne);
[playerArray removeObjectAtIndex:[theWhackedOne integerValue]];
return;
}




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Efficient object wrappers and GC

2008-04-11 Thread Jean-Daniel Dupas


Le 11 avr. 08 à 19:27, Quincey Morris a écrit :



On Apr 11, 2008, at 09:51, Alastair Houghton wrote:

It doesn't, but you might conceivably have methods that take an  
NSEnumerator and do something with the objects it returns.  Hence  
the utility of "nextObject".


Ah, I see - simultaneous cake-having and cake-eating. :)

Isn't this problem similar to the GC-finalize problem, where you  
can't safely do most object resource releasing in finalize, so you  
have to do it earlier. Maybe the answer is the same, you give the  
object an "i'm done with you" method that the user of the object  
calls. After that, you would be able to cache and re-use the object.  
(IOW, I guess, re-invent reference counting for the object.)


It's not a very elegant solution, but the "i'm done with you"  
pattern is sort of in GC class design already.


(Actually, NSEnumerator *might* have one such useful behaviour... I  
haven't tried it, but I wonder if the base class implements the  
fast enumeration protocol by calling -nextObject repeatedly?  Which  
isn't the best way to implement fast enumeration, to be sure, but  
it might still be useful sometimes.)


I think you must be right. IIRC, there's nothing to stop you using  
fast enumeration syntax on a NSEnumerator whose underlying object is  
not fast-enumeration conformable.


NSEnumerator is an abstract class. That's probably what the default  
implementation do, but most of the enumerators returned by Cocoa  
collection probably override this behavior.___


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

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

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 line numbers from an NSString

2008-04-11 Thread Jean-Daniel Dupas


Le 11 avr. 08 à 19:31, j o a r a écrit :



On Apr 11, 2008, at 10:23 AM, allan greenier wrote:
If I have an NSString that is multi lined (say in contains "\n"  
characters)
is there an api call so I can get line 0, line 1, ect? Or should I  
just code that myself?



There is no "NSLineEnumerator" (although that would be a very cool  
addition), you basically have to do it manually.


NSString has a method to help you identify line endings in case you  
have to deal with files that could use different characters /  
character sequences to represent that (\n, \r, et.c.).


j o a r


"NSLineEnumerator" can easily be implemented using an NSScanner and  
the "end of line" character Set.


You didn't miss anything, there is no API to access a line directly  
but you may use the line counting technic described in the "Text  
Layout Programming Guide".


http://developer.apple.com/documentation/Cocoa/Conceptual/TextLayout/Tasks/CountLines.html

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSURLConnection doesn't post

2008-04-11 Thread Jean-Daniel Dupas


Le 11 avr. 08 à 19:14, Tom Harrington a écrit :

On Fri, Apr 11, 2008 at 3:53 AM, Micha Fuhrmann <[EMAIL PROTECTED]>  
wrote:

Ok, I've used - (void)performSelectorOnMainThread:(SEL)aSelector
withObject:(id)arg waitUntilDone:(BOOL)wait and it's fine one, you've
pointed t what was wrong, however I thought that because the method  
sendLogs
was invoqued by an instance that is alive during the whole app  
lifetime it
would be OK. Turns out that NSURLConnections called indirectly by a  
short

time run loop to the main thread doesn't follow up.


Right, the run loop needs to keep going at least until NSURLConnection
is finished.  Although secondary threads don't automatically get run
loops, it's OK to create new run loops in different threads if it's
appropriate to your situation.  Using -performSelectorOnMainThread: is
one way around the problem, but it might make more sense to just give
the thread its own run loop.  It all depends on your app architecture.



NSRunloop documentation disagree:
In general, your application does not need to either create or  
explicitly manage NSRunLoop objects. Each NSThread object, including  
the application’s main thread, has an NSRunLoop object automatically  
created for it as needed. If you need to access the current thread’s  
run loop, you do so with the class method currentRunLoop.


Even CFRunLoop documentation disagree:
There is exactly one run loop per thread. You neither create nor  
destroy a thread’s run loop. Core Foundation automatically creates it  
for you as needed.


___

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

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

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 line numbers from an NSString

2008-04-11 Thread j o a r


On Apr 11, 2008, at 10:23 AM, allan greenier wrote:
If I have an NSString that is multi lined (say in contains "\n"  
characters)
is there an api call so I can get line 0, line 1, ect? Or should I  
just code that myself?



There is no "NSLineEnumerator" (although that would be a very cool  
addition), you basically have to do it manually.


NSString has a method to help you identify line endings in case you  
have to deal with files that could use different characters /  
character sequences to represent that (\n, \r, et.c.).


j o a r


___

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

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

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 line numbers from an NSString

2008-04-11 Thread Paul Bruneau

On Apr 11, 2008, at 1:23 PM, allan greenier wrote:

Greetings,

Have I missed this somewhere in the Cocoa - Foundation api?

If I have an NSString that is multi lined (say in contains "\n"  
characters)
is there an api call so I can get line 0, line 1, ect? Or should I  
just code that myself?


Hi there-

Yes you missed componentsSeparatedByString: in NSString I think.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Efficient object wrappers and GC

2008-04-11 Thread Quincey Morris


On Apr 11, 2008, at 09:51, Alastair Houghton wrote:

It doesn't, but you might conceivably have methods that take an  
NSEnumerator and do something with the objects it returns.  Hence  
the utility of "nextObject".


Ah, I see - simultaneous cake-having and cake-eating. :)

Isn't this problem similar to the GC-finalize problem, where you can't  
safely do most object resource releasing in finalize, so you have to  
do it earlier. Maybe the answer is the same, you give the object an  
"i'm done with you" method that the user of the object calls. After  
that, you would be able to cache and re-use the object. (IOW, I guess,  
re-invent reference counting for the object.)


It's not a very elegant solution, but the "i'm done with you" pattern  
is sort of in GC class design already.


(Actually, NSEnumerator *might* have one such useful behaviour... I  
haven't tried it, but I wonder if the base class implements the fast  
enumeration protocol by calling -nextObject repeatedly?  Which isn't  
the best way to implement fast enumeration, to be sure, but it might  
still be useful sometimes.)


I think you must be right. IIRC, there's nothing to stop you using  
fast enumeration syntax on a NSEnumerator whose underlying object is  
not fast-enumeration conformable.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Efficient object wrappers and GC

2008-04-11 Thread Buddy Kurz
I'm wondering if it would make sense (or be possible)  to override - 
retain and -release to increment/decrement your own variable in  
addition to using the inherited behavior.  In the GC environment, the  
inherited retain does nothing but in either environment your  
enumerator can detect the retain by checking your variable.




On Apr 11, 2008, at 9:53 AM, Alastair Houghton wrote:


On 11 Apr 2008, at 16:07, Michael Ash wrote:


On Fri, Apr 11, 2008 at 6:04 AM, Alastair Houghton
<[EMAIL PROTECTED]> wrote:
Under GC, these kinds of tricks are no longer possible because  
there is no
-retain call any more, so no way to tell if it is safe to re- 
initialise and

return the same wrapper object.

Aside from re-implementing the data structure itself in ObjC and  
making all
of its nodes objects, which might not be possible in some cases,  
has anyone
thought of an efficient solution to this problem when running  
under GC?


The obvious technique would be to stop trying to make the  
optimization
implicit and to make it explicit and managed by the caller instead.  
In
other words, you write your API so that it explicitly returns the  
same

object every time you call -nextObject, just with a new state. Then
you have a copy method which the caller can use to get a new
unchanging object for the case where he wants to keep one around.


Yes.  It's a shame though because that doesn't really fit with the  
way people expect NSEnumerator to behave.


I was really just wondering if someone else had had some stroke of  
genius and come up with a way to do this kind of thing under the  
GC.  Or if, perhaps, it would be worth asking for some new feature  
as part of the GC to help with this kind of problem.


(As I think I mentioned, I'm not actively using the GC in production  
code right now, so this isn't important yet... it's just something I  
thought of.)


Kind regards,

Alastair.

--
http://alastairs-place.net



___

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

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

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


Getting line numbers from an NSString

2008-04-11 Thread allan greenier
Greetings,

Have I missed this somewhere in the Cocoa - Foundation api?

If I have an NSString that is multi lined (say in contains "\n" characters)
is there an api call so I can get line 0, line 1, ect? Or should I just code 
that myself?

Thanks,

Allan
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSURLConnection doesn't post

2008-04-11 Thread Tom Harrington
On Fri, Apr 11, 2008 at 3:53 AM, Micha Fuhrmann <[EMAIL PROTECTED]> wrote:
> Ok, I've used - (void)performSelectorOnMainThread:(SEL)aSelector
> withObject:(id)arg waitUntilDone:(BOOL)wait and it's fine one, you've
> pointed t what was wrong, however I thought that because the method sendLogs
> was invoqued by an instance that is alive during the whole app lifetime it
> would be OK. Turns out that NSURLConnections called indirectly by a short
> time run loop to the main thread doesn't follow up.

Right, the run loop needs to keep going at least until NSURLConnection
is finished.  Although secondary threads don't automatically get run
loops, it's OK to create new run loops in different threads if it's
appropriate to your situation.  Using -performSelectorOnMainThread: is
one way around the problem, but it might make more sense to just give
the thread its own run loop.  It all depends on your app architecture.


-- 
Tom Harrington
[EMAIL PROTECTED]
AIM: atomicbird1
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Efficient object wrappers and GC

2008-04-11 Thread Alastair Houghton

On 11 Apr 2008, at 16:07, Michael Ash wrote:


On Fri, Apr 11, 2008 at 6:04 AM, Alastair Houghton
<[EMAIL PROTECTED]> wrote:
Under GC, these kinds of tricks are no longer possible because  
there is no
-retain call any more, so no way to tell if it is safe to re- 
initialise and

return the same wrapper object.

Aside from re-implementing the data structure itself in ObjC and  
making all
of its nodes objects, which might not be possible in some cases,  
has anyone
thought of an efficient solution to this problem when running under  
GC?


The obvious technique would be to stop trying to make the optimization
implicit and to make it explicit and managed by the caller instead. In
other words, you write your API so that it explicitly returns the same
object every time you call -nextObject, just with a new state. Then
you have a copy method which the caller can use to get a new
unchanging object for the case where he wants to keep one around.


Yes.  It's a shame though because that doesn't really fit with the way  
people expect NSEnumerator to behave.


I was really just wondering if someone else had had some stroke of  
genius and come up with a way to do this kind of thing under the GC.   
Or if, perhaps, it would be worth asking for some new feature as part  
of the GC to help with this kind of problem.


(As I think I mentioned, I'm not actively using the GC in production  
code right now, so this isn't important yet... it's just something I  
thought of.)


Kind regards,

Alastair.

--
http://alastairs-place.net



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Efficient object wrappers and GC

2008-04-11 Thread Alastair Houghton

On 11 Apr 2008, at 17:26, Quincey Morris wrote:


On Apr 11, 2008, at 08:07, Michael Ash wrote:

The obvious technique would be to stop trying to make the  
optimization
implicit and to make it explicit and managed by the caller instead.  
In
other words, you write your API so that it explicitly returns the  
same

object every time you call -nextObject, just with a new state. Then
you have a copy method which the caller can use to get a new
unchanging object for the case where he wants to keep one around.


Furthermore, if the "new state" just consists of a pointer to a C  
structure, the caller never needs to bother keeping the object  
around, but can just keep the structure pointer.


That would be true, if you wanted to expose the underlying data  
structure directly.  I can think of many cases where that's  
undesirable though.


Alternatively, since it's necessary to write a custom NSEnumerator  
subclass for this, why not just write a new CEnumerator class that  
returns 'nextStruct' instead of 'nextObject'? It's not like  
NSEnumerator actually implements any behavior that you can inherit  
anyway.


It doesn't, but you might conceivably have methods that take an  
NSEnumerator and do something with the objects it returns.  Hence the  
utility of "nextObject".


(Actually, NSEnumerator *might* have one such useful behaviour... I  
haven't tried it, but I wonder if the base class implements the fast  
enumeration protocol by calling -nextObject repeatedly?  Which isn't  
the best way to implement fast enumeration, to be sure, but it might  
still be useful sometimes.)


Kind regards,

Alastair.

--
http://alastairs-place.net



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Efficient object wrappers and GC

2008-04-11 Thread Quincey Morris


On Apr 11, 2008, at 08:07, Michael Ash wrote:


The obvious technique would be to stop trying to make the optimization
implicit and to make it explicit and managed by the caller instead. In
other words, you write your API so that it explicitly returns the same
object every time you call -nextObject, just with a new state. Then
you have a copy method which the caller can use to get a new
unchanging object for the case where he wants to keep one around.


Furthermore, if the "new state" just consists of a pointer to a C  
structure, the caller never needs to bother keeping the object around,  
but can just keep the structure pointer.


Alternatively, since it's necessary to write a custom NSEnumerator  
subclass for this, why not just write a new CEnumerator class that  
returns 'nextStruct' instead of 'nextObject'? It's not like  
NSEnumerator actually implements any behavior that you can inherit  
anyway.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Question about NSTreeController/NSOutlineView instance cleanup

2008-04-11 Thread Markus Spoettl

On Apr 11, 2008, at 12:10 AM, Quincey Morris wrote:
Well, without knowing the details of what you're doing, it's  
impossible to be certain, but this code certainly looks *very*  
wrong. For one thing, 'insertObject' is (according to the  
documentation) for controller subclasses to use to customize their  
own behavior, not for other things to use to insert objects.  
Normally, you don't want to mess with trying to change  
arrangedObjects directly.


For another thing, assuming you're approaching this using MVC design  
principles, this code gets things exactly backwards -- when setting  
up your data model, you don't make changes to the controller and  
expect them to be reflected in the model -- you make changes in the  
model and let them be reflected (via the controller) in the view.


Again assuming there's nothing very strange intended here, all you  
need to do is update treeContent in a KVO-compliant way, which (in  
the case of arrays) is:


	[[myDocument mutableArrayValueForKey:@"treeContent"]  
addObject:rootnode];


(or some variant such as insertObject...) and the tree controller  
will see the change and update the user interface.


There are also other ways to change treeController in a KVO- 
compliant way, but mutableArrayValueForKey seems the most direct in  
this case.



OK, thanks for the input, I'll try make sense of all this later today.  
The NSTreeController/structure code was copied/used from the Apple- 
supplied sample project SourceView


  http://developer.apple.com/samplecode/SourceView

and I thought they would know what they're doing. I'm not sure what to  
think now. Anyway, thanks again!


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

This email sent to [EMAIL PROTECTED]


Re: Building a custom Data Detector

2008-04-11 Thread Joe Ranieri


On Apr 11, 2008, at 09:48, Errol Sayre wrote:
I can't seem to find any documentation anywhere, but I'm assuming  
the "data detectors" in Leopard are a resurrection/reincarnation of  
the classic Mac OS Data Detectors...


Is there an open API for creating these dealies in Leopard? I  
assume, if not, that the standard "file a bug report feature request  
cause Apple can't discuss future stuff" rule applies.



It is a private framework and has no public API. Please create the  
radar ticket.


Joe Ranieri
Lead Magician, Alacatia Labs, Inc.
http://alacatia.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: custom dragging destination feedback in an NSTableView

2008-04-11 Thread Corbin Dunn


On Apr 11, 2008, at 7:10 AM, Martin Redington wrote:


It's not the dragged image I'm concerned about - I know how to  
change/customise that.


By "dragging destination feedback", I mean the black border that  
gets drawn around the row of the destination table that I'm about to  
drop on. I'd like to stop the tableview drawing that, and draw  
something more pleasing myself ...


It seems like everyone has been complaining about this lately :)

You must not be using Leopard -- we made it look better on Leopard.  
There is no public way to do what you want, and people have overridden  
private methods to control the drawing. See http://katidev.com/blog/2008/02/22/styling-an-nstableview-dttah/ 
 for one of the latest examples. Apple does not endorse overriding  
private methods, as your code may stop working in future releases.


If you haven't already done so, please log a bug requesting the  
ability to customize this drawing (if you have found a need to do so).


-corbin


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Highlight color of a NSTableView row

2008-04-11 Thread Corbin Dunn



1. Subclass NSCell, NSTextFieldCell, or whatever other cell you want.
2. Override:

- (NSColor *)highlightColorWithFrame:(NSRect)cellFrame inView: 
(NSView *)controlView


and return nil.


How would I go about subclassing NSTextFieldCell & NSImageCell and  
then using these cell with my NSTableView?


It's pretty easy. Create a subclass of each, override the method. In  
IB 3 on Leopard, select the cell, goto the info for it, and change the  
class to be your new class. I know that's pretty vague, and if you  
want more detailed steps, let me know. If you are using Tiger, it's a  
little different.


corbin
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Highlight color of a NSTableView row

2008-04-11 Thread Corbin Dunn


On Apr 10, 2008, at 5:41 PM, Eric Gorr wrote:


On Apr 10, 2008, at 8:28 PM, Corbin Dunn wrote:

If you're targeting Leopard, there is an NSTableView method you  
can override for this (a public one!)


-(void)highlightSelectionInClipRect:(NSRect)theClipRect


Ideally this should be the only method you have to override for  
Tiger also. You may have to coordinate with the cell (or use a  
custom cell) to get the cell to not draw a conflicting highlight  
(hence, that is why some people say to override  
_highlightColorForCell: -- this color isn't used by NSTableView --  
it is used by the cell)


The only information I am displaying in the cells is text and, for  
one column only, a NSImage. Does this mean I can avoid using a  
custom cell?


If you want custom highlighting, unfortunately you need a custom cell.



How would I go about coordinating with the cell?

You have to actually draw the highlights, it's not simply a  
matter of setting the color.  If you look at the post Ben linked  
to, there is sample code you can download that will show you what  
to do.




The problem I am having with this is that it is leaving white  
spaces between the columns, which correspond to where the grid  
lines would be - I have them turned off. Is there anything I can  
do about that?





 NSRect aRowRect = NSInsetRect([self rectOfRow:aRow], 2, 1);


Your insetting the width and height, hence you get spacing.


I'm insetting the rect of the entire row...there shouldn't be any  
spaces between the columns, just some extra space left at the  
beginning and end of the row.




Good point! I don't know what I was thinking -- that should work. If  
you are seeing spaces between them, then it does sound like you  
accidentally have grids turned on.


corbin
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Tips to deploy applications to multiple Mac OS X versions

2008-04-11 Thread Michael Ash
On Fri, Apr 11, 2008 at 10:25 AM, Steve Christensen <[EMAIL PROTECTED]> wrote:
> > > And unhappy programmers.  My estimate is that supporting 10.3-10.5
> increases my development + testing + bug-fixing time increases by a factor
> of 1.5 over what it would be if it was 10.5 only, plus the penalty that I
> simply forego some features which are not practical to implement or disable
> in 10.3, and not worth the time to split off into my "Tiger" bundle.
> > >
> > > I recommend that you explain to your requirments guru(s) the high cost
> of 10.3-10.5 support and ask them to reconsider if you really need to do
> this, Lorenzo.
> > >
> >
>
>  The "unhappy programmers" part is really irrelevant. If your user base is
> distributed among a reasonable set of OS versions, why should they be
> foreced to upgrade to the latest OS just so your workload is smaller? For
> example, I would think you'd expect to be supporting Tiger for some time
> yet, just because of the percentage of users who have it installed...

Taking this logic to its extreme, you should ensure that your
application works all the way back to 10.0. There must be somebody out
there who's still using it, after all.

Back to reality, the "unhappy programmers" part is completely
relevant, it's just badly phrased. Better phrasing is to state that
programmer effort is limited and putting that effort into supporting
older OSes stops being an effective investment at a certain point.
Exactly how far back to go will depend on your available time and the
distribution of your users, but it would be a perfectly rational
decision today to decide that you will be Leopard-only, because you'll
provide more benefit to your users by concentrating on that than you
would by allowing them to continue using Tiger.

Certainly you should support older OSes when you can, but programmer
time is the most precious resource you have, and managing it
effectively is the key element when making this sort of decision.

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: Efficient object wrappers and GC

2008-04-11 Thread Michael Ash
On Fri, Apr 11, 2008 at 6:04 AM, Alastair Houghton
<[EMAIL PROTECTED]> wrote:
>  Under GC, these kinds of tricks are no longer possible because there is no
> -retain call any more, so no way to tell if it is safe to re-initialise and
> return the same wrapper object.
>
>  Aside from re-implementing the data structure itself in ObjC and making all
> of its nodes objects, which might not be possible in some cases, has anyone
> thought of an efficient solution to this problem when running under GC?

The obvious technique would be to stop trying to make the optimization
implicit and to make it explicit and managed by the caller instead. In
other words, you write your API so that it explicitly returns the same
object every time you call -nextObject, just with a new state. Then
you have a copy method which the caller can use to get a new
unchanging object for the case where he wants to keep one around.

Unfortunately questions like "does anyone have a reference to this
object", while answerable, are too expensive to ask on a regular basis
under GC. The GC gets efficiency by asking this question on a bulk
basis once a bunch of objects have built up. Doing it for one object
in a tight loop would completely destroy whatever efficiency you're
gaining, and a whole lot more besides.

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: Tips to deploy applications to multiple Mac OS X versions

2008-04-11 Thread Steve Christensen

On Apr 10, 2008, at 9:37 PM, Michael Ash wrote:

On Apr 10, 2008, at 9:26 PM, Jerry Krinock wrote:

On Apr 9, 2008, at 11:08 PM, Ben Lachman wrote:

On Apr 9, 2008, at 3:27 PM, David Duncan wrote:


Typically you would only use 1 target. Use the SDK to the OS  
whose API your are targeting (such as the 10.5 SDK). Then set the  
deployment target to the minimum version you wish to run on  
(example, 10.3). Finally, you would do runtime checks for API  
availability.


That's fine if the classes exist in all the OS versions, but more  
commonly you'll want to use complete classes that are not  
available in earlier SDK, of which there are many, especially in  
Leopard.  Code instantiating such classes must be put in separate  
bundles that are loaded when the user activates a Tiger/Leopard- 
only feature that requires instantiating a Tiger/Leopard-only class.


This is only true if you are subclassing these classes. If you're  
only

messaging/instantiating them, then you can use NSClassFromString
instead of the raw class name to safely reference them without  
blowing

up on the OSes that don't have them.


Right, and you could wrap the Leopard-only code in its own function  
( BOOL UseSomeLeopardOnlyFeature(...) ) so you only have to deal with  
the implementation details in one place, and possibly deal gracefully  
with failure by its callers.


This is totally true.  Multiple binaries make unhappy users. Of  
course buggy cross-version binaries make unhappy users too.


And unhappy programmers.  My estimate is that supporting 10.3-10.5  
increases my development + testing + bug-fixing time increases by a  
factor of 1.5 over what it would be if it was 10.5 only, plus the  
penalty that I simply forego some features which are not practical  
to implement or disable in 10.3, and not worth the time to split  
off into my "Tiger" bundle.


I recommend that you explain to your requirments guru(s) the high  
cost of 10.3-10.5 support and ask them to reconsider if you really  
need to do this, Lorenzo.


The "unhappy programmers" part is really irrelevant. If your user base  
is distributed among a reasonable set of OS versions, why should they  
be foreced to upgrade to the latest OS just so your workload is  
smaller? For example, I would think you'd expect to be supporting  
Tiger for some time yet, just because of the percentage of users who  
have it installed...


steve

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: custom dragging destination feedback in an NSTableView

2008-04-11 Thread Martin Redington


It's not the dragged image I'm concerned about - I know how to change/ 
customise that.


By "dragging destination feedback", I mean the black border that gets  
drawn around the row of the destination table that I'm about to drop  
on. I'd like to stop the tableview drawing that, and draw something  
more pleasing myself ...



On 11 Apr 2008, at 14:05, Jerry Krinock wrote:

On 2008 Apr, 11, at 4:15, Martin Redington wrote:

The standard dragging feedback is rather ugly to start off  
with...I could spot any obvious way to customise this feedback


I'm not sure what you consider to be ugly, but if, instead of a  
static image as suggested by Stéphane, you need something you can  
change programmatically, consider a borderless window as was done  
here...


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

___

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

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

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


Building a custom Data Detector

2008-04-11 Thread Errol Sayre
I can't seem to find any documentation anywhere, but I'm assuming the  
"data detectors" in Leopard are a resurrection/reincarnation of the  
classic Mac OS Data Detectors...


Is there an open API for creating these dealies in Leopard? I assume,  
if not, that the standard "file a bug report feature request cause  
Apple can't discuss future stuff" rule applies.


TIA

Errol
___

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

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

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, Threads and Document based app

2008-04-11 Thread Jeff LaMarche


On Apr 11, 2008, at 2:37 AM, Thomas T wrote:


- How can I create objects in my nsoperation when I don't have a
persistent store yet. I really couldn't ask the user to save the
document before beginning the download.
- In document based apps - how should I create my second
NSManagedObject context for use in my nsoperation?


Unfortunately, the only option I can think of is that you're going to  
have to use performSelector:onMainThread: to actually do the inserts  
and updates on the main thread, perhaps caching data and only passing  
it periodically to the main thread. You'll have to be careful, as this  
could potentially push a lot of work onto your main thread and result  
in the Spinning Beachball of Death if you're not careful. I would  
suggest opening an enhancement request using Apple's Bug Reporter.  
This is clearly a design issue that is going to affect more and more  
people as time goes by and more projects adopt Core Data. Apple is not  
likely to change it unless they hear from us that we're unhappy with it.


Another option would be to use callbacks instead of synchronous  
communications in a thread, which would put your code to download the  
data on the main thread. I've done this in a Core Data  (non document- 
based) app that I'm working on. It adds some complexity to the code,  
but it works.  I'll admit that it was a lot of work getting it to  
perform well, though. My original code created a lot of  
NSManagedObjects in the callback, and that was causing the Spinning  
Beach Ball of Death to come up and make the app basically unusable  
during the download.  I had to switch to basically storing all the  
downloaded data as an NSArray of non-managed objects, and then storing  
the array as a single custom attribute. It was less than ideal -  
worked out well in that case because I didn't really need managed  
objects for all the downloaded data, but I can imagine many cases  
where that wouldn't have been an option.


Jeff

 
___


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

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

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

This email sent to [EMAIL PROTECTED]


Re: Multiple NSViews

2008-04-11 Thread I. Savant
On Fri, Apr 11, 2008 at 8:55 AM, Lorenzo <[EMAIL PROTECTED]> wrote:
> I have defined an NSView "info view" on IB.
>  This view contains several NSTextFields.
>  Now I want to programmatically create copies of this view and attach them to
>  the objects on my window. So if on my window I have 10 objects, I should see
>  the 10 objects, each one having its "info view". Each view reports
>  information about each object on the screen.
>  What's the best way to do that?

  If you're targeting Leopard, you could always use NSCollectionView -
it's perfectly suited for what you're trying to do (so long as the
views are of homogenous size).

  Otherwise, it's easiest to put your view in its own separate nib,
then load an instance in each time you need it.

http://cocoadevcentral.com/articles/64.php

--
I.S.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: custom dragging destination feedback in an NSTableView

2008-04-11 Thread Jerry Krinock

On 2008 Apr, 11, at 4:15, Martin Redington wrote:

The standard dragging feedback is rather ugly to start off with...I  
could spot any obvious way to customise this feedback


I'm not sure what you consider to be ugly, but if, instead of a static  
image as suggested by Stéphane, you need something you can change  
programmatically, consider a borderless window as was done here...


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

___

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

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

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

This email sent to [EMAIL PROTECTED]


Multiple NSViews

2008-04-11 Thread Lorenzo
I have defined an NSView "info view" on IB.
This view contains several NSTextFields.
Now I want to programmatically create copies of this view and attach them to
the objects on my window. So if on my window I have 10 objects, I should see
the 10 objects, each one having its "info view". Each view reports
information about each object on the screen.
What's the best way to do that?


Best Regards
-- 
Lorenzo
email: [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CoreAnimation in a modal window

2008-04-11 Thread Pierre Bernard

Hi!

It appears that I need to "push" the NSRunLoop in default mode rather  
than modal for NSAnimationContext to work:


[[NSRunLoop currentRunLoop] 
acceptInputForMode:NSDefaultRunLoopMode

beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];


Pierre

On 10 Apr 2008, at 17:33, Pierre Bernard wrote:


Hi!

I am trying to do some nice drawing using CoreAnimation. It all  
works fine, except for a long series of "CoreAnimation: rendering  
error 500" messages.


However, as soon as I try to use my window in the context of a modal  
session, only the background is draw. The actual animated layers are  
missing.


What am I doing wrong?

- (NSUInteger)beginModalWindow:(NSWindow *)modalWindow
{
NSModalSession currentModalWindowSession;

	if ([[modalWindow delegate]  
respondsToSelector:@selector(windowWillBeginModal:)]) {

[[modalWindow delegate] windowWillBeginModal:modalWindow];
}

[modalWindow makeKeyAndOrderFront:self];

	if ([[modalWindow delegate]  
respondsToSelector:@selector(windowDidBeginModal:)]) {

[[modalWindow delegate] windowDidBeginModal:modalWindow];
}

	currentModalWindowSession = [NSApp  
beginModalSessionForWindow:modalWindow];


NSUInteger result = NSOKButton;

while(1) {
		NSInteger response = [NSApp  
runModalSession:currentModalWindowSession];


if (response == NSRunAbortedResponse) {
result = NSCancelButton;
}

if (response != NSRunContinuesResponse) {
break;
}
}

[NSApp endModalSession:currentModalWindowSession];

	if ([[modalWindow delegate]  
respondsToSelector:@selector(windowWillEndModal:)]) {

[[modalWindow delegate] windowWillEndModal:modalWindow];
}

[modalWindow orderOut:self];

	if ([[modalWindow delegate]  
respondsToSelector:@selector(windowDidEndModal:)]) {

[[modalWindow delegate] windowDidEndModal:modalWindow];
}

return result;
}

Best,
Pierre Bernard

---
Pierre Bernard
http://www.bernard-web.com/pierre
http://www.houdah.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/i_love_my%40mac.com

This email sent to [EMAIL PROTECTED]


---
Pierre Bernard
http://www.bernard-web.com/pierre
http://www.houdah.com





smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: custom dragging destination feedback in an NSTableView

2008-04-11 Thread Stéphane


On Apr 11, 2008, at 1:15 PM, Martin Redington wrote:



I have two NSTableViews, whose items have a parent-child relationship.

I would like to be able to drag the children into the parent table  
view, to change their parent (think dragging mail messages between  
folders).


The standard dragging feedback is rather ugly to start off with,  
and doesn't play nicely with variations in intercell spacing (I  
have zero intercell spacing in my parent table).


I could spot any obvious way to customise this feedback in the docs/ 
archives/google search. Can anyone point me in the right direction  
for this (I need to support both Tiger and Leopard)


You can specify which image to use for a drag. Look for this in  
NSView class reference.





___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Tight loop processing

2008-04-11 Thread Bill Garrison


On Apr 11, 2008, at 7:35 AM, Don Arnel wrote:

Actually, while reading up on NSThread I cam across NSOperation  
which appears to spawn a new thread but is supposedly much cleaner  
to work with. It definately does the job for me. Thanks everyone for  
your help with this problem.


NSOperation doesn't spawn any threads on its own.   If you add one to  
an NSOperationQueue, the queue will spawn a thread and run your  
operation in it.


NSOperations by themselves are just neat little objects for  
partitioning work.  They don't know anything about threads by  
themselves.  E.g. you could use an NSOperation subclass by itself to  
spawn a process to do some work.


I think NSOperation is nifty, but that's just my opinion.

Bill
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Tight loop processing

2008-04-11 Thread Don Arnel
Actually, while reading up on NSThread I cam across NSOperation which  
appears to spawn a new thread but is supposedly much cleaner to work  
with. It definately does the job for me. Thanks everyone for your help  
with this problem.


- Don


On Apr 10, 2008, at 5:13 PM, Wade Tregaskis wrote:

Threads are almost always the right way to do what the OP wants.   
The problem as was presented is that there's some work to do, which  
happens to be dividable into N segments.  There were no bounds  
placed on how long it takes to run any individual segment.  And even  
if there were, they'd probably be wrong - just about anything your  
code does can be delayed unexpectedly in weird and wonderful ways.


No, the correct approach is to do your work on a separate thread.   
In Leopard you can send messages between threads trivially using  
performSelector:onThread:withObject:waitUntilDone:, which makes it  
very simple to tell your worker thread to stop, or send results &  
status back to the main thread, etc.


It's worth doing this properly if only for the sake of learning how  
to do it.  Concurrency is the way of the future, like it or not, and  
threads are the primary way to get that concurrency.  They're more  
resistant to numerous failure modes (such as unexpected blocking,  
excessively long work periods, and more) and they scale better - you  
can do other stuff, you could run two threads concurrently to do a  
second set of work, etc.  And, naturally, they give you performance  
scaling that is potentially even better than linear.


Sorry if that all sounds a bit pious, but I personally feel it's  
really important that people don't try to use crutches like timers  
or delayed performs, that are only going to be a liability sooner or  
later.


Wade

___

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

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

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

This email sent to [EMAIL PROTECTED]


custom dragging destination feedback in an NSTableView

2008-04-11 Thread Martin Redington


I have two NSTableViews, whose items have a parent-child relationship.

I would like to be able to drag the children into the parent table  
view, to change their parent (think dragging mail messages between  
folders).


The standard dragging feedback is rather ugly to start off with, and  
doesn't play nicely with variations in intercell spacing (I have zero  
intercell spacing in my parent table).


I could spot any obvious way to customise this feedback in the docs/ 
archives/google search. Can anyone point me in the right direction  
for this (I need to support both Tiger and Leopard)


  cheers,
   m.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Representational State Transfer

2008-04-11 Thread Jonathan Relf
Hi,

I'm trying to get my head around how to approach implementing a REST
(representational state transfer) interface in Cocoa. 

I can see that having an NSXMLDocument would allow me to easily read in
XML data from a web source using initWithContentsOfURL: but if I'm
wanting make a request of a URL first and then get the XML reply back
into an object, is there a better choice of data structure to use than
NSXMLDocument for sending the initial request to the URL? 

I guess this nut has been cracked with sending and receiving with Ajax
but I'm struggling to find Cocoa resources for either REST or Ajax.
Willing to research, learn and digest, just needing a point in the right
direction.

 

Cheers,

Jonathan



Jonathan Relf
Software Developer
Esendex Ltd

T: +44 (0)115 852 5762
F: +44 (0)115 852 5757
Email: mailto:[EMAIL PROTECTED]
Web: http://www.esendex.com/
Blog: http://www.mindthe.net/devices

Esendex: Every Message Matters




 
Confidentiality: This e-mail (and any associated files) is intended only for 
the use of cocoa-dev@lists.apple.com and may contain information that is 
confidential, subject to copyright or constitutes a trade secret. If you are 
not cocoa-dev@lists.apple.com you are hereby notified that any disclosure, 
copying or distribution of this message, or files associated with this message, 
is strictly prohibited. If you have received this message in error, please 
notify us immediately by replying to the message and then delete it from your 
computer. Messages sent to and from us may be monitored. The views expressed in 
this message are those of the author Jonathan Relf and do not necessarily 
represent the views of Esendex Ltd.
 
Security: This e-mail and any attachments are believed to be free from any 
virus but it is the responsibility of the recipient to ensure this is so. 
E-mail is not a 100% secure communications medium. We recommend you observe 
this when e-mailing us.
 
Esendex Ltd is a limited company registered in the UK, with company number 
04217280 and having its registered office at 32a Stoney Street • Nottingham • 
NG1 1LL • United Kingdom.
 
[v1.1 EN]


___

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

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

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

This email sent to [EMAIL PROTECTED]


RE: NSTableView - hiding columns

2008-04-11 Thread Valentin Dan
 

Actually … you might be right :-)

 

___

Valentin Dan, Software Developer Direct: +1 905 886 1833 
ext.3047   

Email: HYPERLINK "mailto:[EMAIL PROTECTED]"[EMAIL PROTECTED] 
Office: +40 356-710158

Masstech Group Inc.  Fax:+40 256-220912

HYPERLINK "http://www.masstechgroup.com/"http://www.masstechgroup.com 

 

THIS MESSAGE IS INTENDED ONLY FOR THE ADDRESSEE. IT MAY CONTAIN PRIVILEGED OR 
CONFIDENTIAL INFORMATION.ANY UNAUTHORIZED DISCLOSURE IS STRICTLY PROHIBITED.IF 
YOU HAVE RECEIVED THIS MESSAGE IN ERROR, PLEASE NOTIFY US IMMEDIATELY SO THAT 
WE MAY CORRECT THE RECORDS. PLEASE THEN DELETE THE ORIGINAL MESSAGE. THANK YOU.

 

 

   _  

From: Valentin Dan 
Sent: 11 aprilie 2008 14:01
To: 'Ian Jackson'
Cc: CocoaDev list
Subject: RE: NSTableView - hiding columns

 

I could do that if all the columns I wanted to hide were at the end of the 
column list … but if I remove a column in the middle and do not reflect that 
change in the dataSource it uses, the columns after it will contain wrong data.

 

___

Valentin Dan, Software Developer Direct: +1 905 886 1833 
ext.3047   

Email: HYPERLINK "mailto:[EMAIL PROTECTED]"[EMAIL PROTECTED] 
Office: +40 356-710158

Masstech Group Inc.  Fax:+40 256-220912

HYPERLINK "http://www.masstechgroup.com/"http://www.masstechgroup.com 

 

THIS MESSAGE IS INTENDED ONLY FOR THE ADDRESSEE. IT MAY CONTAIN PRIVILEGED OR 
CONFIDENTIAL INFORMATION.ANY UNAUTHORIZED DISCLOSURE IS STRICTLY PROHIBITED.IF 
YOU HAVE RECEIVED THIS MESSAGE IN ERROR, PLEASE NOTIFY US IMMEDIATELY SO THAT 
WE MAY CORRECT THE RECORDS. PLEASE THEN DELETE THE ORIGINAL MESSAGE. THANK YOU.

 

 

   _  

From: Ian Jackson [mailto:[EMAIL PROTECTED] 
Sent: 11 aprilie 2008 13:55
To: Valentin Dan
Cc: CocoaDev list
Subject: Re: NSTableView - hiding columns

 

What is the effect of using:

 

- (void)removeTableColumn:(HYPERLINK 
"file:///Developer\\Documentation\\DocSets\\com.apple.ADC_Reference_Library.CoreReference.docset\\Contents\\Resources\\Documents\\documentation\\Cocoa\\Reference\\ApplicationKit\\Classes\\NSTableColumn_Class\\Reference\\Reference.html#//apple_ref/doc/c_ref/NSTableColumn"NSTableColumn
 *)aTableColumn   ?

 

I assume this just removes the column and doesn't affect the datasource. And 
you can use the corresponding method:

 

- (void)addTableColumn:(HYPERLINK 
"file:///Developer\\Documentation\\DocSets\\com.apple.ADC_Reference_Library.CoreReference.docset\\Contents\\Resources\\Documents\\documentation\\Cocoa\\Reference\\ApplicationKit\\Classes\\NSTableColumn_Class\\Reference\\Reference.html#//apple_ref/doc/c_ref/NSTableColumn"NSTableColumn
 *)aColumn

 

When the need arises to reshow it.

 

Ian.

 

 

On 11/04/2008, at 10:28 PM, Valentin Dan wrote:

 


The number of columns is dynamic as are the columns I need to hide ... it all 
depends on the settings & access rights of the user.

___
Valentin Dan, Software Developer Direct: +1 905 886 1833 
ext.3047   
Email: HYPERLINK "mailto:[EMAIL PROTECTED]"[EMAIL PROTECTED] 
Office: +40 356-710158
Masstech Group Inc.  Fax:+40 256-220912
HYPERLINK "http://www.masstechgroup.com"http://www.masstechgroup.com 

THIS MESSAGE IS INTENDED ONLY FOR THE ADDRESSEE. IT MAY CONTAIN PRIVILEGED OR 
CONFIDENTIAL INFORMATION.ANY UNAUTHORIZED DISCLOSURE IS STRICTLY PROHIBITED.IF 
YOU HAVE RECEIVED THIS MESSAGE IN ERROR, PLEASE NOTIFY US IMMEDIATELY SO THAT 
WE MAY CORRECT THE RECORDS. PLEASE THEN DELETE THE ORIGINAL MESSAGE. THANK YOU.





 


No virus found in this incoming message.
Checked by AVG.
Version: 7.5.519 / Virus Database: 269.22.12/1372 - Release Date: 10.04.2008 
17:36



No virus found in this outgoing message.
Checked by AVG.
Version: 7.5.519 / Virus Database: 269.22.12/1372 - Release Date: 10.04.2008 
17:36



No virus found in this outgoing message.
Checked by AVG. 
Version: 7.5.519 / Virus Database: 269.22.12/1372 - Release Date: 10.04.2008 
17:36
 
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTableView - hiding columns

2008-04-11 Thread Ian Jackson

What is the effect of using:

- (void)removeTableColumn:(NSTableColumn *)aTableColumn   ?

I assume this just removes the column and doesn't affect the  
datasource. And you can use the corresponding method:


- (void)addTableColumn:(NSTableColumn *)aColumn

When the need arises to reshow it.

Ian.


On 11/04/2008, at 10:28 PM, Valentin Dan wrote:



The number of columns is dynamic as are the columns I need to  
hide ... it all depends on the settings & access rights of the user.


___
Valentin Dan, Software Developer Direct: +1 905 886  
1833 ext.3047
Email: [EMAIL PROTECTED] Office: +40  
356-710158
Masstech Group Inc.  Fax:+40  
256-220912

http://www.masstechgroup.com

THIS MESSAGE IS INTENDED ONLY FOR THE ADDRESSEE. IT MAY CONTAIN  
PRIVILEGED OR CONFIDENTIAL INFORMATION.ANY UNAUTHORIZED DISCLOSURE  
IS STRICTLY PROHIBITED.IF YOU HAVE RECEIVED THIS MESSAGE IN ERROR,  
PLEASE NOTIFY US IMMEDIATELY SO THAT WE MAY CORRECT THE RECORDS.  
PLEASE THEN DELETE THE ORIGINAL MESSAGE. THANK YOU.




-Original Message-
From: Ian Jackson [mailto:[EMAIL PROTECTED]
Sent: 11 aprilie 2008 13:26
To: Valentin Dan
Subject: Re: NSTableView - hiding columns

Can't you just set the number of columns you want for your table in  
IB?


Ian.

On 11/04/2008, at 7:37 PM, Valentin Dan wrote:


Hi,



I have a table view that has visible vertical lines between columns.
I’m trying to hide a column and I’m probably / certainly going about
it the wrong way.



Currently the only way I found to hide it was to set it’s width &
minimum width to 0 (I still need to work with it’s data in the
background, I just don’t want the user to see the column so deleting
it from the dataSource is not an option).



The problem here is that the vertical lines do not disappear and
although the width is 0, a small space remains and the aspect of
multiple vertical column separators in the middle of the list is not
pleasant.



Is there a better way to do this?



Thanks !



___

Valentin Dan, Software Developer Direct: +1 905 886
1833 ext.3047

Email: HYPERLINK "mailto:[EMAIL PROTECTED]"[EMAIL PROTECTED]
Office: +40 356-710158

Masstech Group Inc.  Fax:+40
256-220912

HYPERLINK "http://www.masstechgroup.com/"http://www.masstechgroup.com



THIS MESSAGE IS INTENDED ONLY FOR THE ADDRESSEE. IT MAY CONTAIN
PRIVILEGED OR CONFIDENTIAL INFORMATION.ANY UNAUTHORIZED DISCLOSURE
IS STRICTLY PROHIBITED.IF YOU HAVE RECEIVED THIS MESSAGE IN ERROR,
PLEASE NOTIFY US IMMEDIATELY SO THAT WE MAY CORRECT THE RECORDS.
PLEASE THEN DELETE THE ORIGINAL MESSAGE. THANK YOU.








No virus found in this outgoing message.
Checked by AVG.
Version: 7.5.519 / Virus Database: 269.22.12/1372 - Release Date:
10.04.2008 17:36

___

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

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

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

This email sent to [EMAIL PROTECTED]



No virus found in this incoming message.
Checked by AVG.
Version: 7.5.519 / Virus Database: 269.22.12/1372 - Release Date:  
10.04.2008 17:36



No virus found in this outgoing message.
Checked by AVG.
Version: 7.5.519 / Virus Database: 269.22.12/1372 - Release Date:  
10.04.2008 17:36




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTableView - hiding columns

2008-04-11 Thread Laurent Cerveau
On 10.5 you should b able to hide directly (NSTableColumn setHidden  
method). . Otherwise the best way is to keep an NSArray around (for  
example in a subclass of NSTableView) where you add the column you  
want to hide. Then when you hide a column you add it to this array and  
delete it from the tableColumns array.  As it is retained in your  
array you do not need to recreate everything each time and simply swap  
it between the 2 NSArray


HTH

laurent

On Apr 11, 2008, at 9:37 AM, Valentin Dan wrote:


Hi,



I have a table view that has visible vertical lines between columns.  
I’m trying to hide a column and I’m probably / certainly going about  
it the wrong way.




Currently the only way I found to hide it was to set it’s width &  
minimum width to 0 (I still need to work with it’s data in the  
background, I just don’t want the user to see the column so deleting  
it from the dataSource is not an option).




The problem here is that the vertical lines do not disappear and  
although the width is 0, a small space remains and the aspect of  
multiple vertical column separators in the middle of the list is not  
pleasant.




Is there a better way to do this?



Thanks !



___

Valentin Dan, Software Developer Direct: +1 905 886  
1833 ext.3047


Email: HYPERLINK "mailto:[EMAIL PROTECTED]"[EMAIL PROTECTED] 
 Office: +40 356-710158


Masstech Group Inc.  Fax:+40  
256-220912


HYPERLINK "http://www.masstechgroup.com/"http://www.masstechgroup.com



THIS MESSAGE IS INTENDED ONLY FOR THE ADDRESSEE. IT MAY CONTAIN  
PRIVILEGED OR CONFIDENTIAL INFORMATION.ANY UNAUTHORIZED DISCLOSURE  
IS STRICTLY PROHIBITED.IF YOU HAVE RECEIVED THIS MESSAGE IN ERROR,  
PLEASE NOTIFY US IMMEDIATELY SO THAT WE MAY CORRECT THE RECORDS.  
PLEASE THEN DELETE THE ORIGINAL MESSAGE. THANK YOU.









No virus found in this outgoing message.
Checked by AVG.
Version: 7.5.519 / Virus Database: 269.22.12/1372 - Release Date:  
10.04.2008 17:36


___

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

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

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


Efficient object wrappers and GC

2008-04-11 Thread Alastair Houghton

Hi all,

On a number of occasions I've found myself in a situation where I have  
a data structure (often a complex one) that is implemented in C, but  
for which I want an ObjC wrapper.  As an example, let's consider a  
tree of nodes.


Now, obviously it would be good to provide NSEnumerator subclasses to  
iterate over the data structure.  But -nextObject returns an ObjC  
object, so that means writing a node wrapper class too.


Unfortunately if you do that naïvely, iterating over the data  
structure will create the same number of temporary objects as the  
structure has nodes.


When running without GC, there is a simple "fix" for this, which is to  
re-use the existing object unless it has been -retained by something  
else.  i.e. only create objects if someone is storing references to  
them.  This way, only a single wrapper object is needed in 99.9% of  
cases.  Obviously this is not perfect; for instance, if you wanted to  
iterate and remember one of the objects for use in a subsequent  
iteration, you must retain the reference (even if you immediately  
autorelease it), to stop the enumerator from re-using the object.  But  
it works well enough.


Under GC, these kinds of tricks are no longer possible because there  
is no -retain call any more, so no way to tell if it is safe to re- 
initialise and return the same wrapper object.


Aside from re-implementing the data structure itself in ObjC and  
making all of its nodes objects, which might not be possible in some  
cases, has anyone thought of an efficient solution to this problem  
when running under GC?


(I should say that I'm not actively using GC myself in any production  
code.  I'm just curious to know if anyone has solved this for the GC  
case.)


Kind regards,

Alastair.

--
http://alastairs-place.net


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSURLConnection doesn't post

2008-04-11 Thread Micha Fuhrmann
Ok, I've used - (void)performSelectorOnMainThread:(SEL)aSelector  
withObject:(id)arg waitUntilDone:(BOOL)wait and it's fine one, you've  
pointed t what was wrong, however I thought that because the method  
sendLogs was invoqued by an instance that is alive during the whole  
app lifetime it would be OK. Turns out that NSURLConnections called  
indirectly by a short time run loop to the main thread doesn't follow  
up.


Thanks


On 11 avr. 08, at 11:03, Matt Burnett wrote:

Are you calling test: or sendLogs in a thread which doesnt have a  
active run loop, or a thread that will soon terminate? Either one  
will cause issues for NSURLConnections.


On Apr 10, 2008, at 7:27 AM, Micha Fuhrmann wrote:


Hi there,

I'm running into a problem with NSURLConnection and I can't solve  
it, any help greatly appreciated.


in my main (Shared Instance) class i have the following code to  
post crash logs:


- (IBAction)test:(id)sender{

[self sendLogs];
}

- (void)sendLogs
{
NSMutableString* logsPath = [[NSMutableString alloc]init];
[logsPath appendString:[[NSBundle mainBundle]bundlePath]];
[logsPath appendString:@"/Contents/logs/"];
NSDate *currentDate = [NSDate date];
	NSString * theTime = [[currentDate dateWithCalendarFormat:@"%Y-%m- 
%d %H:%M:%S" timeZone:[NSTimeZone localTimeZone]]description];

NSFileManager *manager = [NSFileManager defaultManager];
bool doesTheLogsFolderExist = [manager fileExistsAtPath:logsPath];
NSMutableString * theDate = [[NSMutableString alloc]init];
[theDate appendString:@"error_"];
	[theDate appendString:[[currentDate dateWithCalendarFormat:@"%d_%m_ 
%Y" timeZone:[NSTimeZone localTimeZone]]description]];

[theDate appendString:@".log"];
[logsPath appendString:theDate];
	NSString* theXmlAsString = [NSString  
stringWithContentsOfFile:logsPath encoding:NSUTF8StringEncoding  
error:NULL];
	NSXMLDocument* theLogsXmlData = [[NSXMLDocument alloc]  
initWithXMLString:theXmlAsString options:NSXMLDocumentTidyHTML  
error:nil];
	NSString* content = [@"xmlData=" stringByAppendingString: 
[theLogsXmlData XMLString]];
	NSURL* url = [NSURL URLWithString:@"http://www.theappstore.net/support/logs_reports.php 
"];
	NSMutableURLRequest* urlRequest = [[NSMutableURLRequest alloc]  
initWithURL:url];

[urlRequest setHTTPMethod:@"POST"];
	[urlRequest setHTTPBody:[content  
dataUsingEncoding:NSUTF8StringEncoding]];
	NSURLConnection *connectionResponse = [[NSURLConnection alloc]  
initWithRequest:urlRequest delegate:self];

}

- (void)connection:(NSURLConnection *)connection didReceiveData: 
(NSData *)data


{
	NSString* thhhe = [[NSString alloc]initWithData:data  
encoding:NSASCIIStringEncoding];

}

Now if I place a button on my interface and call test everything is  
fine, the post is submitted and the delegate method is called.  
Suffice I call the test method from another class and nothing gets  
posted (break points show me the sendLogs method is indeed called),  
the didReceiveData method is not called either. I've looked into  
adding the NSURLConnection into an array so it wouldn't be scraped,  
created a separate send class just for the post etc. to no avail, I  
really don't know what I'm doing wrong.


Any help very much appreciated.

Micha
___

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

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

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

This email sent to [EMAIL PROTECTED]




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Singletons on Leopard with GC

2008-04-11 Thread Citizen
Apple has added a comment about garbage-collected singletons in its  
Cocoa Fundamentals Guide:

http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/chapter_3_section_10.html

Basically you create a singleton as shown in the guide's example, but  
in a garbage-collected environment you can leave out implementing the  
release, retain, retainCount, and autorelease methods.


If you follow the Apple example you will need to implement a class  
factory method, allocWithZone: and copyWithZone.


- Dave

On 10 Apr 2008, at 22:11, Karl Moskowski wrote:

I have a couple of classes for which I'd like to use the singleton  
pattern.


I read some of the old posts on this list and at cocoadev.com about  
approaches to take. They mention Apple's recommendations about  
overriding retain, release, etc. to essentially turn them into no- 
ops. However, they're from pre-Leopard days, and in a GC-required  
app, the compiler automatically no-ops those methods.


I'm currently using something like this code in my implementations:

static MyClass *sharedInstance;
+ (MyClass *)sharedInstance {
if (!sharedInstance)
sharedInstance = [[self alloc] init];
return sharedInstance;
}

- (id)init {
if (!sharedInstance)
sharedInstance = [super init];
return sharedInstance;
}

My goal is to ensure that [MyClass sharedInstance] and [[MyClass  
alloc] init] return the same singleton object. Furthermore, I'd like  
to ensure that an object instantiated in a NIB is the sharedInstance  
too. So far, it seems to work, but I'm afraid I've missed something.


Any suggestions? Thanks.


Karl Moskowski <[EMAIL PROTECTED]>
Voodoo Ergonomics Inc. 

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/citizen%40zenopolis.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: NSURLConnection doesn't post

2008-04-11 Thread Matt Burnett
Are you calling test: or sendLogs in a thread which doesnt have a  
active run loop, or a thread that will soon terminate? Either one will  
cause issues for NSURLConnections.


On Apr 10, 2008, at 7:27 AM, Micha Fuhrmann wrote:


Hi there,

I'm running into a problem with NSURLConnection and I can't solve  
it, any help greatly appreciated.


in my main (Shared Instance) class i have the following code to post  
crash logs:


- (IBAction)test:(id)sender{

[self sendLogs];
}

- (void)sendLogs
{
NSMutableString* logsPath = [[NSMutableString alloc]init];
[logsPath appendString:[[NSBundle mainBundle]bundlePath]];
[logsPath appendString:@"/Contents/logs/"];
NSDate *currentDate = [NSDate date];
	NSString * theTime = [[currentDate dateWithCalendarFormat:@"%Y-%m- 
%d %H:%M:%S" timeZone:[NSTimeZone localTimeZone]]description];

NSFileManager *manager = [NSFileManager defaultManager];
bool doesTheLogsFolderExist = [manager fileExistsAtPath:logsPath];
NSMutableString * theDate = [[NSMutableString alloc]init];
[theDate appendString:@"error_"];
	[theDate appendString:[[currentDate dateWithCalendarFormat:@"%d_%m_ 
%Y" timeZone:[NSTimeZone localTimeZone]]description]];

[theDate appendString:@".log"];
[logsPath appendString:theDate];
	NSString* theXmlAsString = [NSString  
stringWithContentsOfFile:logsPath encoding:NSUTF8StringEncoding  
error:NULL];
	NSXMLDocument* theLogsXmlData = [[NSXMLDocument alloc]  
initWithXMLString:theXmlAsString options:NSXMLDocumentTidyHTML  
error:nil];
	NSString* content = [@"xmlData=" stringByAppendingString: 
[theLogsXmlData XMLString]];
	NSURL* url = [NSURL URLWithString:@"http://www.theappstore.net/support/logs_reports.php 
"];
	NSMutableURLRequest* urlRequest = [[NSMutableURLRequest alloc]  
initWithURL:url];

[urlRequest setHTTPMethod:@"POST"];
	[urlRequest setHTTPBody:[content  
dataUsingEncoding:NSUTF8StringEncoding]];
	NSURLConnection *connectionResponse = [[NSURLConnection alloc]  
initWithRequest:urlRequest delegate:self];

}

- (void)connection:(NSURLConnection *)connection didReceiveData: 
(NSData *)data


{
	NSString* thhhe = [[NSString alloc]initWithData:data  
encoding:NSASCIIStringEncoding];

}

Now if I place a button on my interface and call test everything is  
fine, the post is submitted and the delegate method is called.  
Suffice I call the test method from another class and nothing gets  
posted (break points show me the sendLogs method is indeed called),  
the didReceiveData method is not called either. I've looked into  
adding the NSURLConnection into an array so it wouldn't be scraped,  
created a separate send class just for the post etc. to no avail, I  
really don't know what I'm doing wrong.


Any help very much appreciated.

Micha
___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSURLConnection doesn't post

2008-04-11 Thread Micha Fuhrmann

Tom, thanks for your reply.

from my understanding in my case the Object that's initiated the  
NSURLConnection is my shared instance since the call comes from the  
outside through the - (IBAction)test:(id)sender that then initiates  
the NSURLConnection with sendLogs. So if an object calls "test", is  
NSURLConnection "owned" by this particular object? It doesn't make  
sense to me, the shared instance should be the only owner since the  
sendLogs is called be itself, although via "test" that indeed can be  
called from the outside.


I've also played around with NSThread and no go. Going to have to be  
creative here...


On 10 avr. 08, at 18:34, Tom Harrington wrote:

On Thu, Apr 10, 2008 at 6:27 AM, Micha Fuhrmann <[EMAIL PROTECTED]>  
wrote:
Now if I place a button on my interface and call test everything is  
fine,
the post is submitted and the delegate method is called. Suffice I  
call the
test method from another class and nothing gets posted (break  
points show me
the sendLogs method is indeed called), the didReceiveData method is  
not
called either. I've looked into adding the NSURLConnection into an  
array so
it wouldn't be scraped, created a separate send class just for the  
post etc.

to no avail, I really don't know what I'm doing wrong.


When you call -sendLogs from another class, does the run loop have the
chance to run, or does the code block, or busy-wait, or something else
that might prevent it from running?  You'll need a working run loop
for NSURLConnection to successfully post the data and call its
delegate methods.

Also, is it possible that when -sendLogs is called from another class,
it's also called from a separate thread?  NSURLConnection's delegate
methods are called on the same thread that initiated the connection,
and if you've started a different thread, you have to create your own
run loop.

--
Tom Harrington
[EMAIL PROTECTED]
AIM: atomicbird1
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/michaf%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: Making use of Core 2 features without 64bit addressing

2008-04-11 Thread Clark Cox
On Thu, Apr 10, 2008 at 10:22 PM, Michael Vannorsdel <[EMAIL PROTECTED]> wrote:
> Indeed I can do that.  This brings up another question; since frameworks and
> libs didn't have much 64 bit support in 10.4, is it possible for a fat
> binary to load the 64 bit image on 10.5 and 32 bit on 10.4?  Perhaps with
> some Info.plist settings.  My instinct says no; 64 bit image will be used on
> all 64 bit archs regardless of sys version.

Your instinct is, fortunately, wrong in this case.

>From 
>:

"To prevent new 64-bit executables from running as 64-bit on version
10.4, Apple changed the CPU subtype for 64-bit executables that depend
on high-level frameworks."

That is, if the 64-bit slices of your application depend on Cocoa,
they will be ignored on Tiger and earlier. Just make sure that the
deployment target of your 64-bit slices is set to 10.5.




>
>
>
>  On Apr 10, 2008, at 5:31 PM, Clark Cox wrote:
>
>
> > Are you sure that you have to use the 10.4 SDK? Just use the 10.5 SDK,
> > but set the deployment target to 10.4 for your 32-bit architectures.
> >
> > Alternatively, you could probably use different SDK's for different
> > architectures. Your i386 and/or ppc builds can use the 10.4 SDK, while
> > your x86_64 and/or ppc64 builds can use the 10.5 SDK.
> >
>
>
>  ___
>
>  Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
>  Please do not post admin requests or moderator comments to the list.
>  Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
>  Help/Unsubscribe/Update your Subscription:
>  http://lists.apple.com/mailman/options/cocoa-dev/clarkcox3%40gmail.com
>
>  This email sent to [EMAIL PROTECTED]
>



-- 
Clark S. Cox III
[EMAIL PROTECTED]
___

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

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

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

This email sent to [EMAIL PROTECTED]


NSTableView - hiding columns

2008-04-11 Thread Valentin Dan
Hi,

 

I have a table view that has visible vertical lines between columns. I’m trying 
to hide a column and I’m probably / certainly going about it the wrong way. 

 

Currently the only way I found to hide it was to set it’s width & minimum width 
to 0 (I still need to work with it’s data in the background, I just don’t want 
the user to see the column so deleting it from the dataSource is not an option).

 

The problem here is that the vertical lines do not disappear and although the 
width is 0, a small space remains and the aspect of multiple vertical column 
separators in the middle of the list is not pleasant.

 

Is there a better way to do this?

 

Thanks !

 

___

Valentin Dan, Software Developer Direct: +1 905 886 1833 
ext.3047   

Email: HYPERLINK "mailto:[EMAIL PROTECTED]"[EMAIL PROTECTED] 
Office: +40 356-710158

Masstech Group Inc.  Fax:+40 256-220912

HYPERLINK "http://www.masstechgroup.com/"http://www.masstechgroup.com 

 

THIS MESSAGE IS INTENDED ONLY FOR THE ADDRESSEE. IT MAY CONTAIN PRIVILEGED OR 
CONFIDENTIAL INFORMATION.ANY UNAUTHORIZED DISCLOSURE IS STRICTLY PROHIBITED.IF 
YOU HAVE RECEIVED THIS MESSAGE IN ERROR, PLEASE NOTIFY US IMMEDIATELY SO THAT 
WE MAY CORRECT THE RECORDS. PLEASE THEN DELETE THE ORIGINAL MESSAGE. THANK YOU.

 

 

 


No virus found in this outgoing message.
Checked by AVG. 
Version: 7.5.519 / Virus Database: 269.22.12/1372 - Release Date: 10.04.2008 
17:36
 
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Question about NSTreeController/NSOutlineView instance cleanup

2008-04-11 Thread Quincey Morris


On Apr 10, 2008, at 23:01, Markus Spoettl wrote:

Yes that must be it. I'm not sure how I manage to do that, though.  
Basically what I do is this:


 NSIndexPath *location = [NSIndexPath indexPathWithIndex: 
[treeContent count]];


 TreeNode *rootnode = [[TreeNode alloc] init];
 ... set treenode properties ...

 [treeController insertObject:rootnode  
atArrangedObjectIndexPath:location];


 ... do something that involves rootnode like adding sub-nodes ...

 [rootnode release]

The treeController will retain rootnode at the time insertObject is  
called and also adds rootnode to treeContent. Again, at least that's  
what I thought. There is no other place in the code that deals with  
or releases/retains TreeNode objects.


Well, without knowing the details of what you're doing, it's  
impossible to be certain, but this code certainly looks *very* wrong.  
For one thing, 'insertObject' is (according to the documentation) for  
controller subclasses to use to customize their own behavior, not for  
other things to use to insert objects. Normally, you don't want to  
mess with trying to change arrangedObjects directly.


For another thing, assuming you're approaching this using MVC design  
principles, this code gets things exactly backwards -- when setting up  
your data model, you don't make changes to the controller and expect  
them to be reflected in the model -- you make changes in the model and  
let them be reflected (via the controller) in the view.


Again assuming there's nothing very strange intended here, all you  
need to do is update treeContent in a KVO-compliant way, which (in the  
case of arrays) is:


	[[myDocument mutableArrayValueForKey:@"treeContent"]  
addObject:rootnode];


(or some variant such as insertObject...) and the tree controller will  
see the change and update the user interface.


There are also other ways to change treeController in a KVO-compliant  
way, but mutableArrayValueForKey seems the most direct in this case.


P.S. Your retain/release stuff is fine as is.


___

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

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

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

This email sent to [EMAIL PROTECTED]