Re: NSTextField black outline, not drawing in background thread when in a custom NSControl?

2009-09-21 Thread aaron smith
Hey Graham, thanks for the reply. Would you mind glancing at some code
quickly? I've been banging my head against the wall on this one.

Here's my view that builds out a search looking control (extends NSView).
http://pastebin.com/m5fd70532

and here's the code that builds the scale 9 background
http://pastebin.com/m31770882

Here's what the search control looks like (notice the black border and
the cursor are solid black). The cursor doesn't blink.
http://imgur.com/V4yti.png

I've been messing around with my code, trying to figure out where the
problem is being introduced, and it seems it's with
NSDrawNinePartImage (see line 166) - as soon as I comment out that one
line of code, the textfield behaves as expected. But obviously the
background isn't drawn.

It seems like the NSDrawNinePart image is halting a thread that draws
the the NSTextField? When I mouse over and out of the text field
really quickly (triggering the drawRect method) the NSTextField then
draws correctly because it's being called multiple times, causing the
cursor to blink etc.

Argh.
Thanks for any help





On Sun, Sep 20, 2009 at 5:24 AM, Graham Cox  wrote:
>
> On 20/09/2009, at 6:25 PM, aaron smith wrote:
>
>> Even when setting all those to false, I still get this 1px black border.
>
>
> It sounds like the graphics context composite mode is set incorrectly. Try
> looking into that.
>
> --Graham
>
>
>
___

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

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

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

This email sent to arch...@mail-archive.com


Core Data threading fun

2009-09-21 Thread Luke Evans
I have a server app that responds to network requests, making use of a  
Core Data database to serve responses.
Some requests update the database.  I have chosen to allow requests to  
arrive on multiple threads, and intend for these threads to use Core  
Data directly.


In keeping with Core Data's doc related to threading, I have one  
Managed Object Context per thread, and these all share a common  
Persistent Store Coordinator that is managing a SQLite data file.
It's my understanding that this scenario is an acceptable  
configuration, indeed it appears in the Core Data notes on threading  
as the 'preferred option' (q.v. http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CoreData/Articles/cdMultiThreading.html 
).


OK, here comes the problem (!)...
One type of request can change the name of an object.  The handler for  
this request (using its thread's own MOC):
1. Fetches the required object by persistent ID (i.e. stringified  
NSManagedObjectID).

2. Changes the value of the 'name' property on the fetched object
3. Commits the change by calling 'save' on the MOC

Unfortunately, while this works some of the time, I have a situation  
where a subsequent other request (possibly on another thread) sees the  
old name of this object.  This request gets 'all' the entities of this  
type and sends properties (such as name) back.


I'm pretty sure my MOC handling per thread is good.  I be checking  
that, but lets assume this is the case.


I have a number of questions arising from both the Core Data docs, and  
my own ignorance as to what exactly Core Data will be doing in a "MOC- 
per-thread, shared coordinator" configuration.


1. Sharing the Coordinator
This seems to be 'encouraged' (or at least permitted as the 'preferred  
option').  However, there are some passages in the docs that, while  
not exactly contradictory, cause me to wonder what the 'best' thing to  
do is:


...
A persistent store coordinator provides to its managed object contexts  
the façade of one virtual store.
For completely concurrent operations you need a different coordinator  
for each thread.


...

There are three patterns you can adopt to support multi-threading in a  
Core Data application; in order of preference they are:


Create a separate managed object context for each thread and share a  
single persistent store coordinator.
If you need to “pass” managed objects between threads, you just pass  
their object IDs.


If you want to aggregate a number of operations in one context  
together as if a virtual single transaction, you can lock the  
persistent store coordinator to prevent other managed object contexts  
using the persistent store coordinator over the scope of several  
operations.


...

Should I have a PSC per thread too?  If so, will they behave correctly  
talking to the same SQLite data file?
With a shared PSC, should I lock this whenever a write is being  
performed (at least)?



2. Locking the MOC
There is talk that locking the MOC, even one that is private to a  
thread, will engender 'thread friendly' behaviour in the PSC:


...
Typically you lock the context or coordinator using tryLock or lock.  
If you do this, the framework will ensure that what it does behind the  
scenes is also thread-safe. For example, if you create one context per  
thread, but all pointing to the same persistent store coordinator,  
Core Data takes care of accessing the coordinator in a thread-safe way  
(NSManagedObjectContext's lock and unlockmethods handle recursivity).

...

Should I lock the MOC, or just the PSC (see 1)?
Would this really fix my experience of changes not appearing on other  
threads anyway?



3. Changes propagating back to other MOCs looking at the same data
I assume Core Data is smart enough to realise that an attribute value  
change in a Managed Object cached in one thread's MOC, should be  
reflected on (or at least invalidate old data in) another Managed  
Object instance representing the same data in another MOC.  At the  
very least, I think I'd expect a new fetch request that has this  
object in the result set would cause data changed in the persistent  
store to show up properly on the object.


The best guess I have right now is that some kind of MOC-related  
caching is causing problems.  Both queries have separate MOCs, and do  
fresh look-ups when a request comes in, yet (apparently) a  
successfully saved change in one MOC (the method succeeds without  
error) is not reflected in a different MOC.  There is actually no  
system pressure when I'm experiencing the problem at the moment, I'm  
the only user although my serial requests are being handled by  
different threads (ergo MOCs).


Is there anything that comes to mind that I'm apparently not doing,  
which would be needed for states cached in different MOCs to be  
properly synchronised?



Well, thanks if you're taken the time to read that little lot.
If you have any insights too I'd be obliged!


Cheers

-- Luk

Re: Core Data threading fun

2009-09-21 Thread Kyle Sluder
Have you remembered to merge changes whenever a thread's MOC posts
NSManagedObjectContextDidSaveNotification?  If the objects which are
seeing the stale properties haven't been faulted out or hit their
staleness interval, you will see this behavior.

Take a look at the NSManagedObject methods
-mergeChangesFromContextDidSaveNotification: and
-refreshObject:mergeChanges: for more info.

--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 arch...@mail-archive.com


Re: favicon of address

2009-09-21 Thread Jean-Daniel Dupas
As not everybody like the nasty ico file format, some web developer  
are nice enough to use 32 bits PNG.




So, without page content, I don't see how you would now where the  
favicon is.


Le 21 sept. 2009 à 01:11, Mike Abdullah a écrit :

The best engineered approach would probably be to load the page up  
into a WebView, BUT use the WebResourceLoadDelegate to stop it  
wasting time downloading any resource that isn't the favicon. But if  
it isn't critical, then downloading favicon.ico should probably be  
enough.


On 20 Sep 2009, at 19:53, Mitchell Livingston wrote:


Hey,

I want to get the favicon of a URL address, but don't actually need  
any of the page's content. Is there an efficient way to do this  
besides hammering the site for this info? This image isn't  
critical, so something that works "most of the time" should be fine.


Thanks,
Mitch
___

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

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

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

This email sent to cocoa...@mikeabdullah.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/devlists%40shadowlab.org

This email sent to devli...@shadowlab.org



-- Jean-Daniel




___

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

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

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

This email sent to arch...@mail-archive.com


enable/disable/check file Sharing from code

2009-09-21 Thread Georg Seifert

Hi,

Is there a way to enable and disable file sharing from code.

I only found this:
/usr/sbin/AppleFileServer
It seems to work but if I use it, the Sharing prefPane does not show  
the enabled state.


And is there a way to check if file sharing is running?

Are there recommended approaches to switch the other sharing services  
(internet, printer, Screen sharing) from code.


Thanks
Georg
___

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

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

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

This email sent to arch...@mail-archive.com


NSURLConnection inserting Accept-Language and Accept headers

2009-09-21 Thread Michael C . Silva
Is there anyway to completely remove these headers from being inserted  
by NSURLConnection?


They are not present in my NSMutableURLRequest, but show up in the  
stream sent out by the NSURLConnection.  I see no way to control this.


Thanks,
Mike
___

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

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

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

This email sent to arch...@mail-archive.com


Help needed with orientation to bindings

2009-09-21 Thread Graham Cox

Hi all,

So far I haven't used bindings to any serious extent, but I thought it  
was about time I got with the program.


As luck would have it, one of my interfaces is showing some slightly  
buggy behaviour, so I thought it might be an opportunity to replace  
its implementation with a bindings-based one, as a learning exercise.  
Since this seemed a straightforward application, initially it seemed  
an ideal choice to start with.


Unfortunately, I've already got my head tangled up in trying to  
understand the "big picture". I'm hoping someone can help me  
disentangle. I'm pretty comfortable with KVC, KVO and the basics of  
what bindings are, the problem is knowing exactly what I need to apply  
it to my situation.


So, I have objects that can be selected. None, one or many objects  
might be in the selection. The current selection is available as an  
array property in the base controller (NSWindowController subclass) of  
this particular UI. Each selected object has a dictionary of  
associated data. It is this data I wish to edit via a table view with  
columns for keys and values. This seems like a perfect fit for  
NSDictionaryController. Where I'm having trouble is understanding how  
to deal with multiple selections (that is, multiple dictionaries  
presented by the main selection, not multiple selections in the table  
view - in fact the table view selection is largely unused). If there  
is a single selection, all well and good - looks like  
NSDictionaryController is a good fit out of the box. But for multiple  
selections, I'm less clear. I do need to be able to present in the UI  
effectively a merger of all the selected dictionaries, with all keys  
shown across the selection. Where multiple objects have the same key,  
this is one table row, either showing  in the value  
column for that row, or the value if it's the same for all objects.  
Editing the value sets the values against that key for all objects,  
including adding that key/value to dictionaries for selected objects  
that currently lack it. I'm sort of thinking that I need two  
controllers, a bit like the Attacker/Weapon example in the  
documentation - but I can't be sure because not enough stuff is clear  
in my head, and besides, all the actual selection code is handled  
externally - I just have a -selection property returning the objects.


If I can progress on the first part, the next problem is representing  
the data type of the key/value pair. A given key will be associated  
with a definite data type - string, integer, real or boolean value.  
Ideally I'd like to add the appropriate cell type to the table row for  
the 'type' column. My current classically implemented UI doesn't do  
this at all, so this would be a new feature. It's very similar to the  
tables displayed by the plist editor application. Looking at  
NSDictionaryController it seems as if the only thing I can do for  
added values is set a string using -setInitialValue:, so I'm not sure  
how to handle the different data types.


Can anyone point me where I need to be pointed?

--Graham


___

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

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

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

This email sent to arch...@mail-archive.com


[OT] Re: enable/disable/check file Sharing from code

2009-09-21 Thread Alastair Houghton

On 21 Sep 2009, at 10:50, Georg Seifert wrote:


Is there a way to enable and disable file sharing from code.

I only found this:
/usr/sbin/AppleFileServer
It seems to work but if I use it, the Sharing prefPane does not show  
the enabled state.


And is there a way to check if file sharing is running?

Are there recommended approaches to switch the other sharing  
services (internet, printer, Screen sharing) from code.


This isn't really the right place to ask this question, since it isn't  
Cocoa related; maybe darwin-dev or somewhere would be better?


Just to give some useful pointers, it *used* to be the case that a lot  
of this was controlled by /etc/hostconfig and SystemStarter, but now  
it's largely done with launchd.  You might have some luck with the  
launchctl command, maybe something like


  launchctl load -w /System/Library/LaunchDaemons/ 
com.apple.AppleFIleServer.plist


However, as I say, this is the wrong place to discuss this kind of  
thing.


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 arch...@mail-archive.com


Core Data memory not freed after reset

2009-09-21 Thread Sebastian Morsch

Hi,

in my SQLite backed Core Data app, a search action fetches from a  
large number of objects (>1.000.000) only to show them in a table.  
When the user exits search mode (search string empty), I'd like to  
free the managed objects to restore the app's normal memory footprint.  
I do that by resetting the managed context, but it doesn't seem to  
work, physical memory stays where it was when the fetch was completed.  
Strangely, in ObjectAlloc instrument I can see the fetched objects  
being deallocated, but the physical memory still peaks.


Here's the search action:

- (IBAction)search:(id)sender {

NSString *searchString = [sender stringValue];
NSManagedObjectContext *moc = [self managedObjectContext];

if ([searchString length]) {

// Reveal the file table
[self showFileTable:YES];

// Fetch
NSFetchRequest *request = [[[NSFetchRequest alloc] init] 
autorelease];

		NSEntityDescription *entity = [NSEntityDescription  
entityForName:@"BackupFile" inManagedObjectContext:moc];

[request setEntity:entity];
		[request setPredicate:[NSPredicate predicateWithFormat:@"sourcePath  
CONTAINS[c] %@", searchString]];


// Do the fetch
		NSArray *fetchedObjects = [moc executeFetchRequest:request  
error:NULL];

[fileArrayController setContent:fetchedObjects];

} else {

// Hide the file table
[self showFileTable:NO];

[fileArrayController setContent:nil];
[moc reset];
}
}


Any ideas how I can get my nice seven-point-something MB footprint back?


Thanks,
Sebastian



___

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

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

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

This email sent to arch...@mail-archive.com


Re: Help needed with orientation to bindings

2009-09-21 Thread Keary Suska

On Sep 21, 2009, at 6:20 AM, Graham Cox wrote:

So, I have objects that can be selected. None, one or many objects  
might be in the selection. The current selection is available as an  
array property in the base controller (NSWindowController subclass)  
of this particular UI. Each selected object has a dictionary of  
associated data. It is this data I wish to edit via a table view  
with columns for keys and values. This seems like a perfect fit for  
NSDictionaryController. Where I'm having trouble is understanding  
how to deal with multiple selections (that is, multiple dictionaries  
presented by the main selection, not multiple selections in the  
table view - in fact the table view selection is largely unused). If  
there is a single selection, all well and good - looks like  
NSDictionaryController is a good fit out of the box. But for  
multiple selections, I'm less clear. I do need to be able to present  
in the UI effectively a merger of all the selected dictionaries,  
with all keys shown across the selection. Where multiple objects  
have the same key, this is one table row, either showing values> in the value column for that row, or the value if it's the  
same for all objects. Editing the value sets the values against that  
key for all objects, including adding that key/value to dictionaries  
for selected objects that currently lack it. I'm sort of thinking  
that I need two controllers, a bit like the Attacker/Weapon example  
in the documentation - but I can't be sure because not enough stuff  
is clear in my head, and besides, all the actual selection code is  
handled externally - I just have a -selection property returning the  
objects.


Bindings don't handle aggregate/coalesce. You will need to do that  
yourself in the main or a mediating model. Observe the controller's  
selection (or table view notifications) to update on the fly.


If I can progress on the first part, the next problem is  
representing the data type of the key/value pair. A given key will  
be associated with a definite data type - string, integer, real or  
boolean value. Ideally I'd like to add the appropriate cell type to  
the table row for the 'type' column. My current classically  
implemented UI doesn't do this at all, so this would be a new  
feature. It's very similar to the tables displayed by the plist  
editor application. Looking at NSDictionaryController it seems as if  
the only thing I can do for added values is set a string using - 
setInitialValue:, so I'm not sure how to handle the different data  
types.


Also not a bindings-supported behavior. Implement table view delegate  
methods to provide cells on the fly. You can apply formatters or  
transformers to force default values (if you can't do that at the  
model level).


HTH,

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

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Optimizing Enormous lists in NSBrowser

2009-09-21 Thread Scott Ribe
> For normal-sized directories, this works pretty well.  However, in
> my "worst-case" scenario of a flat directory containing 1 million
> files...

Depending on what your purpose here is, you might also benchmark how the
Finder handles increasingly large directories, and set that as the bar to
match or beat somewhat. In other words, if a directory is so large that it's
impractical to use in the Finder, do you really need to be fast at that
size?

-- 
Scott Ribe
scott_r...@killerbytes.com
http://www.killerbytes.com/
(303) 722-0567 voice


___

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

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

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

This email sent to arch...@mail-archive.com


Any way to tell why a window is closing?

2009-09-21 Thread Scott Ribe
Within -windowWillClose, I need to know whether or not the user clicked the
close button on the window.

Please note: this is not for some crazy un-Mac-like UI idea, it is for
debugging purposes.

-- 
Scott Ribe
scott_r...@killerbytes.com
http://www.killerbytes.com/
(303) 722-0567 voice


___

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

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

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

This email sent to arch...@mail-archive.com


Re: enable/disable/check file Sharing from code

2009-09-21 Thread James Bucanek
Georg Seifert  wrote (Monday, 
September 21, 2009 2:50 AM +0200):



Is there a way to enable and disable file sharing from code.


Almost all background services are universally controlled by 
launchd. See man launchctl, launchd, et al.


--
James Bucanek

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Optimizing Enormous lists in NSBrowser

2009-09-21 Thread Dave DeLong
That's a great question.  Simple tests show that Finder can handle a  
folder of a million files in about 2-3 minutes (more than twice as  
fast as what I described in my original email).


Dave

On Sep 21, 2009, at 9:01 AM, Scott Ribe wrote:


For normal-sized directories, this works pretty well.  However, in
my "worst-case" scenario of a flat directory containing 1 million
files...


Depending on what your purpose here is, you might also benchmark how  
the
Finder handles increasingly large directories, and set that as the  
bar to
match or beat somewhat. In other words, if a directory is so large  
that it's
impractical to use in the Finder, do you really need to be fast at  
that

size?

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Any way to tell why a window is closing?

2009-09-21 Thread Uli Kusterer


On 21.09.2009, at 17:15, Scott Ribe wrote:

Within -windowWillClose, I need to know whether or not the user  
clicked the

close button on the window.

Please note: this is not for some crazy un-Mac-like UI idea, it is for
debugging purposes.



 For debugging, you could probably walk the view hierarchy of your  
window (upwards from the content view to its superview etc.) and find  
the close button widget. Or actually, I vaguely remember there may be  
an API for getting the close button these days.


 Once you have the close button, you could change its action to point  
to a method of your making, and then from that call the original action.


Cheers,
-- Uli Kusterer
"The witnesses of TeachText are everywhere..."



___

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

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

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

This email sent to arch...@mail-archive.com


Re: Optimizing Enormous lists in NSBrowser

2009-09-21 Thread Graham Cox


On 22/09/2009, at 1:20 AM, Dave DeLong wrote:

Simple tests show that Finder can handle a folder of a million files  
in about 2-3 minutes



That's still effectively unusable.

Ideally if the list can't display more than, say 50 files at a time  
(depends on how big your screen is, etc), then it shouldn't touch more  
than 50 files on disk. It has never really managed that however, and  
maybe there are fundamental limitations in the file system that  
prevent it optimising to that extent.


As a user I'd never put more than 1000 files in a folder if I can help  
it, and that's well up from what you could practically achieve on Mac  
OS 9-.


--Graham


___

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

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

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

This email sent to arch...@mail-archive.com


Re: Any way to tell why a window is closing?

2009-09-21 Thread Randall Meadows

On Sep 21, 2009, at 9:15 AM, Scott Ribe wrote:

Within -windowWillClose, I need to know whether or not the user  
clicked the

close button on the window.


I think you can get the instance of the button, can't you? Then set a  
custom action on 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 arch...@mail-archive.com


Re: Help needed with orientation to bindings

2009-09-21 Thread Graham Cox


On 22/09/2009, at 12:55 AM, Keary Suska wrote:

Bindings don't handle aggregate/coalesce. You will need to do that  
yourself in the main or a mediating model. Observe the controller's  
selection (or table view notifications) to update on the fly.


Ah, OK. That's perhaps why I couldn't see how to do it with  
bindings ;-) This is already what my 'classic' datasource approach is  
doing, so maybe after all I might as well stick with it. Doesn't look  
like bindings will help give me much for free in this case.


Also not a bindings-supported behavior. Implement table view  
delegate methods to provide cells on the fly. You can apply  
formatters or transformers to force default values (if you can't do  
that at the model level).


Ditto. If I'm having to deal with this in the table delegate I may as  
well stick to my current design which does other things that way.


Thanks - even when the answer is 'can't really be done', it's useful  
to know, and exactly what I was after.


--Graham

___

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

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

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

This email sent to arch...@mail-archive.com


an app that never quits

2009-09-21 Thread Erick Calder
I want to write a daemon for the iPhone.  my goal is to record the  
orientation of the phone across time for later analysis.  I am unsure  
how this could be done since it seems only one application gets to run  
at a time i.e. when the user takes a call my program quits.


can this be done?

thank you - e
___

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

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

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

This email sent to arch...@mail-archive.com


Tablet events from ordinary touchpad?

2009-09-21 Thread Sander Stoks

Hello all,

In a program I'm writing, I'm getting nice results from my Wacom  
tablet.  However, I can't discern between "ordinary" mouse drags (via  
the trackpad on my MBP) and "real" Wacom events.  The reason I want to  
do this is because the normal mouse events seem to have a bogus  
"pressure" value (less than 1) so my brush strokes are way too light  
when using the mouse.


I obviously tried this:

-(void)mouseDown:(NSEvent*)event
{
NSPoint p = [self convertPoint:[event locationInWindow] fromView:nil];
Event e;// my own event type, not relevant to the discussion
e.point = *(CGPoint*)&p;
NSPoint tilt = [event tilt];
	e.tilt = [event subtype] == NSTabletPointEventSubtype ? *(CGPoint*) 
&tilt : CGPointMake(0, 0);
	e.pressure = [event subtype] == NSTabletPointEventSubtype ? [event  
pressure] : 1.0;

DocModel *doc = [self docModel];
doc->MouseDown(e);
}

but for some reason, the event subtype is always  
NSTabletPointEventSubtype.


I tried overriding tabletProximity, but it never gets called.

I'm kind of stuck here, so I'm hoping you can provide me with some  
pointers...


Many thanks in advance,
Sander Stoks
___

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

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

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

This email sent to arch...@mail-archive.com


Capturing content programatically

2009-09-21 Thread Achint Sandhu

Hi,

	Is there a way to programatically capture content from different  
applications in osx. As an example, I'd like to be able to get a  
webarchive of the current web page being displayed in safari.


	I know this can be done with applescript, but I'm not sure how to go  
about doing this in cocoa/obj-c.


	I'm essentially trying to do something similar to the way eaglefilter  
captures web pages and other content (the F1 trick).


	I've tried searching google, but I suspect I'm probably using the  
wrong search string / keywords.


Any pointers would be greatly appreciated.

Thank You.

Cheers,
Achint

___

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

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

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

This email sent to arch...@mail-archive.com


Class for external monitor?

2009-09-21 Thread Jacob Schwartz

Hey everyone,

I'm new to this mailing list and also new to objective-c/cocoa  
programming. I've gone through a book I picked up and I wanted to try  
to make a simple, run in the background application. To get to the  
point, I was looking through the documentation was looking for some  
class that would act as a reference to an external monitor or whatever  
is plugged into a laptops DVI port. My search came up empty, but I was  
hoping you guys could point me in the right direction. Thanks


-Jake
___

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

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

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

This email sent to arch...@mail-archive.com


/Library/Preferences Writable By Everyone

2009-09-21 Thread Ken J.
Hello all, this is a question regarding to the permission set on
/Library/Preferences in Leopard.

I ran this code as a non-admin user: (I am strict to myself to not use
admin accounts other then installs/updates.)
CFPreferencesSetValue(keyName, valueString, appID,
  kCFPreferencesAnyUser, 
kCFPreferencesCurrentHost);
BOOL success = CFPreferencesSynchronize(appID,

kCFPreferencesAnyUser,

kCFPreferencesCurrentHost);
if (success) NSLog(@"Preferences synchronized.");

The result:
2009-09-20 02:11:16.002 aups[1945:10b] Preferences synchronized.

What I was trying to do was to save a global parameter for my app that
is only modifiable by Admin rights. However, this was just a
proof-of-concept process and have not ran any code as Admin just yet.

I did a lot of research and was confident that this would NOT write
the plist file since it requires an Admin-user for an AnyUser domain.
But it is now in the /Library/Preferences as "com.example.test.plist"
and is the case with all the non-admin account I tried on my Leopard
iMac.
So I checked the folder permission to find out it's:
drwxrwxrwx   67 root admin  2278 Sep 20 02:35 Preferences

I ran repair permissions but that did not change anything.
Can anyone confirm this is in fact the default permission and the
CFPreferences utilities behave such?
Or is this a known bug?

Thanks.

-- 
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 arch...@mail-archive.com


Architecture for concurrent network client

2009-09-21 Thread Sixten Otto
I'm trying to work out in my head the best way to structure a Cocoa
app that's essentially a concurrent download manager. There's a server
the app talks to, the user makes a big list of things to pull down,
and the app processes that list. (It's not using HTTP or FTP, so I
can't use the URL-loading system; I'll be talking across socket
connections.)

This is basically the classic producer-consumer pattern. The trick is
that the number of consumers is fixed, and they're persistent. The
server sets a strict limit on the number of simultaneous connections
that can be open (though usually at least two), and opening new
connections is expensive, so in an ideal world, the same N connections
are open for the lifetime of the app.

I've looked over the Apple's Concurrency Programming Guide
(http://developer.apple.com/mac/library/documentation/General/Conceptual/ConcurrencyProgrammingGuide/Introduction/Introduction.html),
and done some searching around on web and Stack Overflow, but not
finding a lot of information that seems directly applicable, because
of those constraints.

One way to approach this might be to create N threads, each of which
would "own" a connection, and wait on the request queue, blocking if
it's empty. Since the number of connections will never be huge, this
is not unreasonable in terms of actual system overhead. But
conceptually, it seems like Cocoa must offer a more elegant solution.

It seems like I could use an NSOperationQueue, and call
setMaxConcurrentOperationCount: with the number of connections. Then I
just toss the download requests into that queue. But I'm not sure, in
that case, how to manage the connections themselves. (Just put them on
a stack, and rely on the queue to ensure I don't over/under-run? Throw
in a dispatch semaphore along with the stack?)

I'd been thinking that Grand Central Dispatch might open up some other
ways of tackling this, but at first blush, it doesn't seem like it.
GCD's flagship ability to dynamically scale concurrency (mentioned,
for example, in Apple's guide's recommendations on Changing
Producer-Consumer Implementations) doesn't actually help me. But I've
just scratched the surface of reading about it.

Can anyone recommend other lines of inquiry? Or good examples of this
kind of concurrent operation?

Sixten
___

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

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

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

This email sent to arch...@mail-archive.com


getting started on bindings => problems with NSMutableArray - NSArrayController - NSTableView

2009-09-21 Thread Colin Howarth

Hi all,

I've tried various searches, Apple documentation and example code, but  
my code stubbornly refuses to work :-(


I'm trying to do this in conjunction with Interface Builder...


I have an instance of an NSMutableArray of LensElements in my  
AppDelegate.


I have an NSArrayController in the MainMenu.xib IB window.

My main window has an NSTableView.

I'd like the NSTableView to display the data of the array of  
LensElements. Later I'd like to be able to drag elements within my  
custom LensView, and have this update the TableView. Also, changing  
data within the TableView should update the LensView. But, for now,  
I'd be happy if the Table would simply display the data. (g)


It's really frustrating. The examples I find either don't seem to fit  
what I'd like to do (NSMutableArray - NSArrayController -  
NSTableView). And/or they use ancient versions of IB (which keeps  
changing). Or they don't use IB at all. Or, like me, they just mention  
some settings, but ignore others - like "Table View Attributes >>  
Control >> State: Enabled" or "Array Controller Attributes >> Object  
Controller >> Editable (yes)". Sometimes I see columns bound.  
Sometimes ControllerKey is "selections" sometimes it's  
"arrangedObjects". And nothing works. The documentation only makes  
sense when you know exactly what it's talking about. :-(



Please unconfuse me. I only need to get "into" this once, then I'll be  
OK. Honest.




In Interface Builder:

###

Trace App Delegate Connections:
Referencing Bindings:
elements --- Content Array / Array Controller


###

Table Column (position) Attributes:
Table Column:
Title: Z position
Identifier: position

Table Column (position) Bindings:
Value:
Bind To: Array Controller
Controller Key: selection   // tried arrangedObjects
Model Key Path: position

Table Column (position) Connections:
Bindings:
 Value -- Array Controller / selection.position

###

Array Controller Attributes:
Object Controller:
Mode: "Class"
Class Name: "LensElement"

Array Controller Bindings:
Controller Content:
Bind To: Trace App Delegate
Model Key Path: elements

Array Controller Connections:
Bindings:
Content Array --- Trace App Delegate / elements
Referencing Bindings:
selection.position --- Value / Table Column (position)
selection.radius --- Value / Table Column (radius)

###


Here are the snippets of code (#imports etc included).

The app compiles without errors or warnings and runs fine. All my  
views and buttons etc show up fine, but the NSTableView doesn't show  
any content. Well, it did once, when there was only one LensElement in  
the array :-) I then added another, as you can see below, and it  
stopped showing anything. I removed it again and it hasn't worked  
since... (???)



### LensElement.h 

@interface LensElement : NSObject
{
NSNumber*position;
NSNumber*radius;
}

@property (copy, nonatomic) NSNumber*position;
@property (copy, nonatomic) NSNumber*radius;

@end

### LensElement.m 

@implementation LensElement

@synthesize	position;// creates the proper getter and  
setter methods?

@synthesize radius;

@end

### TraceAppDelegate.h# ###

@interface TraceAppDelegate : NSObject  {
NSWindow*window;
NSMutableArray  *elements;
NSArrayController   *ctrlr;
}

@property (assign) IBOutlet NSWindow *window;
@property (assign) NSMutableArray  *elements;

@end

### TraceAppDelegate.m ###

@implementation TraceAppDelegate

@synthesize window;// creates the proper getter and setter  
methods?

@synthesize elements;

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {

	LensElement		*element = [[LensElement alloc] init];		// this is  
just for testing...

LensElement *element2 = [[LensElement alloc] init];

	elements = [[NSMutableArray alloc] initWithObjects:element, element2,  
nil];


	[element setValue: [NSNumber numberWithDouble: 5.0]  
forKey:@"position"];

[element setValue: [NSNumber numberWithDouble: 10.0] forKey:@"radius"];

	[element2 setValue: [NSNumber numberWithDouble: 6.0]  
forKey:@"position"];
	[element2 setValue: [NSNumber numberWithDouble: -15.0]  
forKey:@"radius

Job Posting: Experienced Cocoa User Interface Developer (full time position, New York City)

2009-09-21 Thread boxworkjobs


Boxwork is seeking an experienced UI developer with Cocoa experience  
to augment its digital capture software team. The developer will  
design interfaces to manage complex color and image manipulation tasks.





Responsibilities:

• Participate in design activities with team members
• Discuss requirements with end users
	• Implement, test, debug, document and integrate new User Interface  
components into existing code base


Requirements:

• Very good knowledge of Cocoa/Objective-C, at least 3 year experience
• Must have worked on shipping Cocoa products
• Experience with Quartz
• Experience with customizing Cocoa controls
• Passion for user interface
• Knowledge of Apple Human Interface Guidelines
	• Ability to work on-location in Manhattan (no off-site consultants  
please)


Useful experience:

• OpenGL
• Sketch and wireframe possible user interfaces
• Subversion or git

Job Benefits (beside the industry standards):

	• Be part of a small team of experienced developers who enjoy  
creative freedom.

• Work in a large, bright Manhattan office.
	• Contribute to an exciting product that will be publicly launched to  
change the world of digital photography.


Who is Boxwork:

Boxwork is the digital division of Box, a multimedia company  founded  
by Pascal Dangin, that combines technical innovation and artistic  
sensibility. Using customized tools we offer a full suite of creative  
services from digital capture and image fabrication to exhibition and  
book publishing. Work by Box regularly appears on the covers and pages  
of major publications, television and cable networks, in fine art  
books and museums as well as some of the world's leading advertising  
campaigns.


Boxwork includes an internal research and development team that acts  
as a think tank to create novel solutions for internal and external  
production and administrative challenges. Our expert programmers,  
engineers and technicians work side by side to quickly turn ideas into  
realities. As a result we have several software and hardware products  
that have given us a range of tools to address digital capture,  
digital asset management, workflow oversight, color profiling, color  
enhancement and color management. We see these tools as a  
differentiator that keeps Box continually on the forefront of the  
industry.


Please send your resumes to:

boxworkj...@boxstudios.com


Boxwork (a division of Box)
412 West 14th street
New York, NY 10014

On moderator request: all replies to this e-mail off-list please.


___

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

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

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

This email sent to arch...@mail-archive.com


Re: an app that never quits

2009-09-21 Thread Dave DeLong
Unless you're running your app on a jailbroken iPhone, or you leave  
your app running all the time, what you are asking is not possible.


IIRC, when the user takes a call, your app does not necessarily  
terminated, but the user can choose to switch to the phone app, which  
would kill your app.


Dave

On Sep 19, 2009, at 1:07 AM, Erick Calder wrote:

I want to write a daemon for the iPhone.  my goal is to record the  
orientation of the phone across time for later analysis.  I am  
unsure how this could be done since it seems only one application  
gets to run at a time i.e. when the user takes a call my program  
quits.


can this be done?

thank you - e

___

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

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

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

This email sent to arch...@mail-archive.com


Re: an app that never quits

2009-09-21 Thread BJ Homer
On Sat, Sep 19, 2009 at 1:07 AM, Erick Calder  wrote:

> I want to write a daemon for the iPhone.  my goal is to record the
> orientation of the phone across time for later analysis.  I am unsure how
> this could be done since it seems only one application gets to run at a time
> i.e. when the user takes a call my program quits.
>
> can this be done?
>

Not without jailbreaking; you simply can't write background apps on the
iPhone.  I'm not sure if you could do it on a jailbroken phone, since I've
never played with one.

-BJ
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Any way to tell why a window is closing?

2009-09-21 Thread Scott Ribe
> I think you can get the instance of the button, can't you? Then set a
> custom action on it.

And...

> Or actually, I vaguely remember there may be
> an API for getting the close button these days.

Ah, I see standardWindowButton now. I'd never noticed that when looking (I
think it didn't register with me that the "Managing Title Bars" section was
the relevant one). 

Thanks.

 
-- 
Scott Ribe
scott_r...@killerbytes.com
http://www.killerbytes.com/
(303) 722-0567 voice


___

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

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

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

This email sent to arch...@mail-archive.com


Re: Class for external monitor?

2009-09-21 Thread Graham Cox


On 20/09/2009, at 5:09 AM, Jacob Schwartz wrote:

I was looking through the documentation was looking for some class  
that would act as a reference to an external monitor or whatever is  
plugged into a laptops DVI port. My search came up empty, but I was  
hoping you guys could point me in the right direction.



NSScreen


--Graham
___

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

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

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

This email sent to arch...@mail-archive.com


Re: /Library/Preferences Writable By Everyone

2009-09-21 Thread Glenn L. Austin

On Sep 20, 2009, at 3:00 AM, Ken J. wrote:


So I checked the folder permission to find out it's:
drwxrwxrwx   67 root admin  2278 Sep 20 02:35 Preferences



Mine is:
drwxrwxr-x  113 root  admin  3842 Sep 21 08:10 /Library/Preferences

--
Glenn L. Austin, Computer Wizard and Race Car Driver <><




___

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

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

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

This email sent to arch...@mail-archive.com


Re: Class for external monitor?

2009-09-21 Thread Scott Ribe
Well I don't think there's a way to directly ask for "the external monitor",
but look at NSScreen first.

Remember, on Mac it is easy to move the menu bar to whatever screen you
want. So do you really want "the external monitor", or do you want "the
monitor without the menu bar"? The second one is easy, main vs non-main. The
first might require you to dig into lower-level CGxxx or IOxxx APIs.


-- 
Scott Ribe
scott_r...@killerbytes.com
http://www.killerbytes.com/
(303) 722-0567 voice


___

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

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

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

This email sent to arch...@mail-archive.com


Re: Optimizing Enormous lists in NSBrowser

2009-09-21 Thread Jean-Francois Dontigny
Hi,

I don't know how helpful to you this could be, but you might want to take a
look at: 
http://developer.apple.com/mac/library/documentation/Performance/Conceptual/
FileSystem/FileSystem.html#//apple_ref/doc/uid/1161

You might be able to salvage something from the samples there.

JFD


On 9/17/09 5:32 PM, "Dave DeLong"  wrote:

> Hi everyone,
> 
> I'm recreating a Finder-like column view fro browsing the disk, and
> I've come up against some optimization impasses.
> 
> First off, I'm using passive-loading, so that I only load information
> regarding an item once I get the browser:willDisplayCell: message.
> This works wonderfully for lazy loading.
> 
> My problem lies before that.  I'm trying to mimic the Finder, so I
> want to not show hidden files if they're not visible in Finder.  When
> I obtain a directory listing via NSFileManager, it includes everything
> (including hidden files).  Once I get that listing, I filter it based
> with an "isFileVisible = YES" predicate, which calls an -[NSString
> isFileVisible] method I've implemented in a category.  This method
> checks the three standard ways of hiding a file to determine its
> visibility (prefixed with ".", a flipped invisible bit, or listing it
> in /.hidden [which is deprecated, but I need to support older systems]).
> 
> Once I've filtered the array, I sort it using a custom
> "compareLikeFinder:" method, which sorts items into the same order as
> they appear in Finder.
> 
> For normal-sized directories, this works pretty well.  However, in my
> "worst-case" scenario of a flat directory containing 1 million files,
> I've found that it takes 34.8 seconds to retrieve a full directory
> listing (so I know how many to return in
> browser:numberOfRowsInColumn:), 301.5 seconds to filter the array, and
> another 73.6 seconds to sort it.
> 
> Believe it or not, this is actually better than the current
> implementation, but I'd like to do even better.  On that note, here
> are my questions:
> 
> 1.  How can I obtain a count of files in a directory without
> retrieving the actual listing of contents?  (I can scan through the
> folder and count by just grabbing catalog infos myself, but is there a
> faster way?)
> 2.  How can I retrieve the name of the nth item in a directory without
> retrieving the actual listing of contents?
> 
> Thanks!
> 
> Dave DeLong
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/jean-francois.dontigny%40radi
> alpoint.com
> 
> This email sent to jean-francois.donti...@radialpoint.com
> 
> 
> ***
> 
> This e-mail and its attachments are confidential, legally privileged, may be
> subject to copyright and sent solely for the attention of the addressee(s).
> Any unauthorized use or disclosure is prohibited. Statements and opinions
> expressed in this e-mail may not represent those of Radialpoint.
> 
> Le contenu de ce courriel est confidentiel, privil�gi� et peut �tre soumis �
> des droits d'auteur. Il est envoy� � l'intention exclusive de son ou de ses
> destinataires. Il est interdit de l'utiliser ou de le divulguer sans
> autorisation. Les opinions exprim�es dans le pr�sent courriel peuvent diverger
> de celles de Radialpoint.



***

This e-mail and its attachments are confidential, legally privileged, may be 
subject to copyright and sent solely for the attention of the addressee(s).
Any unauthorized use or disclosure is prohibited. Statements and opinions 
expressed in this e-mail may not represent those of Radialpoint.

Le contenu de ce courriel est confidentiel, privil�gi� et peut �tre soumis � 
des droits d'auteur. Il est envoy� � l'intention exclusive de son ou de ses
destinataires. Il est interdit de l'utiliser ou de le divulguer sans 
autorisation. Les opinions exprim�es dans le pr�sent courriel peuvent diverger 
de celles de Radialpoint.
___

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

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

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

This email sent to arch...@mail-archive.com


Re: an app that never quits

2009-09-21 Thread Clark Cox
On Sat, Sep 19, 2009 at 9:07 AM, Erick Calder  wrote:
> I want to write a daemon for the iPhone.  my goal is to record the
> orientation of the phone across time for later analysis.  I am unsure how
> this could be done since it seems only one application gets to run at a time
> i.e. when the user takes a call my program quits.
>
> can this be done?

No, it cannot.

-- 
Clark S. Cox III
clarkc...@gmail.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 arch...@mail-archive.com


Re: getting started on bindings => problems with NSMutableArray - NSArrayController - NSTableView

2009-09-21 Thread Sean Kline
It does not appear that you have a dataSource.  You need to implement:
 - (int)numberOfRowsInTableView:(NSTable View *)aTableView ;
- (id)tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex;

- Sean

On Sun, Sep 20, 2009 at 4:51 PM, Colin Howarth  wrote:

> Hi all,
>
> I've tried various searches, Apple documentation and example code, but my
> code stubbornly refuses to work :-(
>
> I'm trying to do this in conjunction with Interface Builder...
>
>
> I have an instance of an NSMutableArray of LensElements in my AppDelegate.
>
> I have an NSArrayController in the MainMenu.xib IB window.
>
> My main window has an NSTableView.
>
> I'd like the NSTableView to display the data of the array of LensElements.
> Later I'd like to be able to drag elements within my custom LensView, and
> have this update the TableView. Also, changing data within the TableView
> should update the LensView. But, for now, I'd be happy if the Table would
> simply display the data. (g)
>
> It's really frustrating. The examples I find either don't seem to fit what
> I'd like to do (NSMutableArray - NSArrayController - NSTableView). And/or
> they use ancient versions of IB (which keeps changing). Or they don't use IB
> at all. Or, like me, they just mention some settings, but ignore others -
> like "Table View Attributes >> Control >> State: Enabled" or "Array
> Controller Attributes >> Object Controller >> Editable (yes)". Sometimes I
> see columns bound. Sometimes ControllerKey is "selections" sometimes it's
> "arrangedObjects". And nothing works. The documentation only makes sense
> when you know exactly what it's talking about. :-(
>
>
> Please unconfuse me. I only need to get "into" this once, then I'll be OK.
> Honest.
>
>
>
> In Interface Builder:
>
> ###
>
> Trace App Delegate Connections:
>Referencing Bindings:
>elements --- Content Array / Array Controller
>
>
> ###
>
> Table Column (position) Attributes:
>Table Column:
>Title: Z position
>Identifier: position
>
> Table Column (position) Bindings:
>Value:
>Bind To: Array Controller
>Controller Key: selection   // tried
> arrangedObjects
>Model Key Path: position
>
> Table Column (position) Connections:
>Bindings:
> Value -- Array Controller / selection.position
>
> ###
>
> Array Controller Attributes:
>Object Controller:
>Mode: "Class"
>Class Name: "LensElement"
>
> Array Controller Bindings:
>Controller Content:
>Bind To: Trace App Delegate
>Model Key Path: elements
>
> Array Controller Connections:
>Bindings:
>Content Array --- Trace App Delegate / elements
>Referencing Bindings:
>selection.position --- Value / Table Column (position)
>selection.radius --- Value / Table Column (radius)
>
> ###
>
>
> Here are the snippets of code (#imports etc included).
>
> The app compiles without errors or warnings and runs fine. All my views and
> buttons etc show up fine, but the NSTableView doesn't show any content.
> Well, it did once, when there was only one LensElement in the array :-) I
> then added another, as you can see below, and it stopped showing anything. I
> removed it again and it hasn't worked since... (???)
>
>
> ### LensElement.h 
>
> @interface LensElement : NSObject
> {
>NSNumber*position;
>NSNumber*radius;
> }
>
> @property (copy, nonatomic) NSNumber*position;
> @property (copy, nonatomic) NSNumber*radius;
>
> @end
>
> ### LensElement.m 
>
> @implementation LensElement
>
> @synthesize position;
> // creates the proper getter and
> setter methods?
> @synthesize radius;
>
> @end
>
> ### TraceAppDelegate.h# ###
>
> @interface TraceAppDelegate : NSObject  {
>NSWindow*window;
>NSMutableArray  *elements;
>NSArrayController   *ctrlr;
> }
>
> @property (assign) IBOutlet NSWindow *window;
> @property (assign) NSMutableArray  *elements;
>
> @end
>
> ### TraceAppDelegate.m ###
>
> @implementation TraceAppDelegate
>
> @synthesize window;
> // creates the proper getter and setter
> methods?
> @synthesize elements;
>
> - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
>
>LensElement  

Re: Capturing content programatically

2009-09-21 Thread Jens Alfke


On Sep 19, 2009, at 8:09 AM, Achint Sandhu wrote:

	Is there a way to programatically capture content from different  
applications in osx.


Not in general. It depends on how scriptable the application is.

As an example, I'd like to be able to get a webarchive of the  
current web page being displayed in safari.
	I know this can be done with applescript, but I'm not sure how to  
go about doing this in cocoa/obj-c.


Look at the Scripting Bridge, or NSAppleScript.

—Jens___

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

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

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

This email sent to arch...@mail-archive.com


Re: Class for external monitor?

2009-09-21 Thread Uli Kusterer

On 19.09.2009, at 21:09, Jacob Schwartz wrote:
I'm new to this mailing list and also new to objective-c/cocoa  
programming. I've gone through a book I picked up and I wanted to  
try to make a simple, run in the background application.


 Look at the list of Info.plist keys to see how to do a background app.

To get to the point, I was looking through the documentation was  
looking for some class that would act as a reference to an external  
monitor or whatever is plugged into a laptops DVI port. My search  
came up empty, but I was hoping you guys could point me in the right  
direction. Thanks



 Depends on what you really want to do. Since you didn't say, I can  
only provide vague clues and hints: There is NSScreen and  
CGDirectDisplay &co. If you want lower-level info, you'll be going a  
lot lower level and looking at IOKit.


Cheers,
-- Uli Kusterer
"The witnesses of TeachText are everywhere..."



___

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

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

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

This email sent to arch...@mail-archive.com


Re: Capturing content programatically

2009-09-21 Thread Randall Meadows

On Sep 19, 2009, at 9:09 AM, Achint Sandhu wrote:


Hi,

	Is there a way to programatically capture content from different  
applications in osx. As an example, I'd like to be able to get a  
webarchive of the current web page being displayed in safari.


	I know this can be done with applescript, but I'm not sure how to  
go about doing this in cocoa/obj-c.


If it can be done in AppleScript, then you can probably use Scripting  
Bridge--sorry, "Apple Event Bridge"--if you want to stay in "Cocoa/ 
Objective-C".


___

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

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

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

This email sent to arch...@mail-archive.com


Re: Core Data memory not freed after reset

2009-09-21 Thread Quincey Morris

On Sep 21, 2009, at 05:40, Sebastian Morsch wrote:

in my SQLite backed Core Data app, a search action fetches from a  
large number of objects (>1.000.000) only to show them in a table.  
When the user exits search mode (search string empty), I'd like to  
free the managed objects to restore the app's normal memory  
footprint. I do that by resetting the managed context, but it  
doesn't seem to work, physical memory stays where it was when the  
fetch was completed. Strangely, in ObjectAlloc instrument I can see  
the fetched objects being deallocated, but the physical memory still  
peaks.


Core Data has (or, I should say, had, since I haven't investigated the  
behavior in Snow Leopard) its own internal in-memory cache of object  
and attribute data, which means that, up to a point, data from a  
persistent store is in memory twice. AFAICT there's no way of  
unloading or controlling this cache, which has a maximum size that  
Core Data chooses.


So you can get back the memory occupied by the objects themselves (and  
their attribute value objects), but your memory footprint could stick  
at a couple of hundred MB. You could just ignore the issue (the  
footprint won't grow beyond certain point, so it's sort of harmless),  
or try some of the fetch performance optimization techniques described  
in the Core Data documentation to see if you can keep unwanted  
information out of the cache from the beginning.



___

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

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

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

This email sent to arch...@mail-archive.com


Re: Architecture for concurrent network client

2009-09-21 Thread Jens Alfke


On Sep 20, 2009, at 8:43 AM, Sixten Otto wrote:


One way to approach this might be to create N threads, each of which
would "own" a connection, and wait on the request queue


You don't need concurrency or threads to handle socket connections.  
The 'Mac way' is to use asynchronous I/O, hooking up the socket  
connections to the runloop and getting callbacks when data is available.


Doing direct socket networking in Cocoa is a bit of a mess since there  
aren't Objective-C APIs for everything you need to do, and the  
callbacks can be unintuitive. Apple has a sample called CocoaEcho that  
demonstrates it, and I wrote a little open-source framework called  
MYNetwork that provides a higher-level abstraction.


—Jens___

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

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

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

This email sent to arch...@mail-archive.com


Re: Any way to tell why a window is closing?

2009-09-21 Thread Jens Alfke


On Sep 21, 2009, at 8:15 AM, Scott Ribe wrote:

Within -windowWillClose, I need to know whether or not the user  
clicked the

close button on the window.


Well, if the user clicked the close button your -windowShouldClose  
delegate method will be called first. You could set a flag in there,  
perhaps.


—Jens___

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

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

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

This email sent to arch...@mail-archive.com


Re: Optimizing Enormous lists in NSBrowser

2009-09-21 Thread Jens Alfke


On Sep 21, 2009, at 8:28 AM, Graham Cox wrote:

Ideally if the list can't display more than, say 50 files at a time  
(depends on how big your screen is, etc), then it shouldn't touch  
more than 50 files on disk. It has never really managed that  
however, and maybe there are fundamental limitations in the file  
system that prevent it optimising to that extent.


The biggest problem is sorting, I think. The Unix filesystem APIs  
don't define any ordering for the items in a directory, so you have to  
assume items will be returned in random order. Since your list is  
presumably sorted, at least by name, that means you can't just read  
the first 50 items from the directory's catalog and display them. You  
have to read every entry so you can sort them all.


(In practice, the HFS+ filesystem does return filenames in  
alphabetical order, although I think it's just sorted by Unicode  
codepoint, which for non-ascii characters isn't going to be the  
correct localized sort order. And you still have to be able to handle  
other filesystems as found on memory cards and file servers...)


—Jens___

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

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

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

This email sent to arch...@mail-archive.com


Re: NSURLConnection inserting Accept-Language and Accept headers

2009-09-21 Thread Jens Alfke


On Sep 21, 2009, at 5:08 AM, Michael C.Silva wrote:

Is there anyway to completely remove these headers from being  
inserted by NSURLConnection?
They are not present in my NSMutableURLRequest, but show up in the  
stream sent out by the NSURLConnection.  I see no way to control this.


I don't know. If you don't get an answer here, try the macnetworkprog  
list. The NSURLXXX classes are a thin wrapper around the CFNetwork  
framework, and the CFNetwork engineers tend not to be on this list  
because they don't work on Cocoa stuff directly.


—Jens___

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

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

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

This email sent to arch...@mail-archive.com


Oh notification, where are you?

2009-09-21 Thread Michael Thon
When I instantiate and run an NSMetadataQuery on the main thread I can  
register for, and receive its notifications, but when I try to run the  
same code on a separate thread it seems like the notifications are not  
being delivered.  I assumed that NSMetadataQuery was still delivering  
its notifications on the main thread so I tried to set the window  
controller as an observer for the query notifications, like so:


NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc addObserver:self
   selector:@selector(sendNotification:)
   name:@"NSMetadataQueryDidFinishGatheringNotification"
 object:nil];
[myThread start];

In the sendNotification: method I send the notification to the other  
thread using performSelector: onThread: however sendNotification: is  
never even called.  Either the notifications are not, in fact being  
sent to the main thread or I'm doing something else wrong.  There is  
probably something basic about threads or notifications that I don't  
understand but I have run out of ideas about what to try next.


___

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

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

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

This email sent to arch...@mail-archive.com


Re: favicon of address

2009-09-21 Thread Jens Alfke



The best engineered approach would probably be to load the page up  
into a WebView, BUT use the WebResourceLoadDelegate to stop it  
wasting time downloading any resource that isn't the favicon.


WebView has a lot of overhead! It would be much more efficient to just  
use NSXMLDocument to download and parse the HTML. Using the XPath  
accessor methods in NSXML you can very easily search for that  
particular link and extract its URL.


It shouldn't take more than three or four lines of code if you don't  
mind doing it synchronously; if you want async, then use an  
NSURLRequest to download the HTML and pass the resulting data to  
NSXMLDocument.


—Jens___

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

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

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

This email sent to arch...@mail-archive.com


Re: Menu shortcuts without modifiers?

2009-09-21 Thread Uli Kusterer

On 18.09.2009, at 23:07, Peter Ammon wrote:
For key events without modifiers, like hitting the spacebar, the  
first responder of the key window should get first crack via  
keyDown:.  So I'm not sure why you're seeing the behavior you  
describe.  I wrote a quick test with a focused text field in the key  
window and a main menu item with Space as its key equivalent, and  
the text field "won" for spacebar.


Can you post the backtrace of the call to the action method of your  
menu item?  It's possible it's being invoked from some place other  
than -[NSApplication handleKeyEquivalent:].



Peter,

 sorry, I must have had a brainfart. The space key works just fine.  
It's the left and right arrow keys where the menu gets first shot  
instead of the text field. I actually rewrote the windows I thought  
were still Carbon a while ago. Must be all the pre-Macoun conference  
hoo-hah that I forgot about that.


Cheers,
-- Uli Kusterer
Sole Janitor
http://www.the-void-software.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 arch...@mail-archive.com


Re: getting started on bindings => problems with NSMutableArray - NSArrayController - NSTableView

2009-09-21 Thread Quincey Morris

On Sep 20, 2009, at 13:51, Colin Howarth wrote:

It's really frustrating. The examples I find either don't seem to  
fit what I'd like to do (NSMutableArray - NSArrayController -  
NSTableView). And/or they use ancient versions of IB (which keeps  
changing). Or they don't use IB at all. Or, like me, they just  
mention some settings, but ignore others - like "Table View  
Attributes >> Control >> State: Enabled" or "Array Controller  
Attributes >> Object Controller >> Editable (yes)". Sometimes I see  
columns bound. Sometimes ControllerKey is "selections" sometimes  
it's "arrangedObjects". And nothing works. The documentation only  
makes sense when you know exactly what it's talking about. :-(


Use arrangedObjects, not selection. You'd bind to  
arrayController.selection if you were doing a master-detail kind of  
interface. In your case, you're showing all of the  
"arranged" (possibly sorted and filtered) content, hence  
arrayController.arrangedObjects.


You have another problem. Your array controller is going to get  
unarchived before the flow of control reaches  
applicationDidFinishLaunching and your content array is created. That  
means the array controller's content is nil, and that's never going to  
change because you're updating the "elements" property non-KVO- 
compliantly in applicationDidFinishLaunching.


In the short term you could try re-setting the array controller's  
content array programmatically at the end of  
applicationDidFinishLaunching. That's not really the correct answer,  
though. The correct answer probably involves moving your window to its  
own XIB file, and sorting out your KVO compliance issues.



___

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

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

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

This email sent to arch...@mail-archive.com


Re: Capturing content programatically

2009-09-21 Thread Mike Abdullah


On 19 Sep 2009, at 16:09, Achint Sandhu wrote:


Hi,

	Is there a way to programatically capture content from different  
applications in osx. As an example, I'd like to be able to get a  
webarchive of the current web page being displayed in safari.


	I know this can be done with applescript, but I'm not sure how to  
go about doing this in cocoa/obj-c.


There's your answer. To target AppleScript from a Cocoa app use the  
Scripting Bridge or NSAppleScript.


	I'm essentially trying to do something similar to the way  
eaglefilter captures web pages and other content (the F1 trick).


	I've tried searching google, but I suspect I'm probably using the  
wrong search string / keywords.


Any pointers would be greatly appreciated.

Thank You.

Cheers,
Achint

___

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

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

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

This email sent to cocoa...@mikeabdullah.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 arch...@mail-archive.com


Re: /Library/Preferences Writable By Everyone

2009-09-21 Thread Alastair Houghton

On 20 Sep 2009, at 11:00, Ken J. wrote:


I did a lot of research and was confident that this would NOT write
the plist file since it requires an Admin-user for an AnyUser domain.
But it is now in the /Library/Preferences as "com.example.test.plist"
and is the case with all the non-admin account I tried on my Leopard
iMac.
So I checked the folder permission to find out it's:
drwxrwxrwx   67 root admin  2278 Sep 20 02:35 Preferences

I ran repair permissions but that did not change anything.
Can anyone confirm this is in fact the default permission and the
CFPreferences utilities behave such?
Or is this a known bug?


Most likely it's a result of a broken third-party software installer  
changing the permissions on your /Library/Preferences folder.  Mine is  
drwxrwxr-x, which is what I'd expect.


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 arch...@mail-archive.com


Re: enable/disable/check file Sharing from code

2009-09-21 Thread Georg Seifert



Is there a way to enable and disable file sharing from code.


Almost all background services are universally controlled by  
launchd. See man launchctl, launchd, et al.


This is not exactly my problem. I can start file sharing with just  
calling "/usr/sbin/AppleFileServer". My question was how to to it that  
would also check the checkbox and respect the settings in the sharing  
pane (enable afs, smb and ftp it is selected in "Options...").


regards
Georg
___

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

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

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

This email sent to arch...@mail-archive.com


Re: /Library/Preferences Writable By Everyone

2009-09-21 Thread Jeff Johnson

On Sep 20, 2009, at 5:00 AM, Ken J. wrote:


I did a lot of research and was confident that this would NOT write
the plist file since it requires an Admin-user for an AnyUser domain.
But it is now in the /Library/Preferences as "com.example.test.plist"
and is the case with all the non-admin account I tried on my Leopard
iMac.
So I checked the folder permission to find out it's:
drwxrwxrwx   67 root admin  2278 Sep 20 02:35 Preferences

I ran repair permissions but that did not change anything.
Can anyone confirm this is in fact the default permission and the
CFPreferences utilities behave such?
Or is this a known bug?


Hi Ken.

On one Leopard volume, my permissions are the same as yours. On  
another Leopard volume, however, and on Snow Leopard and Tiger  
volumes, the permissions are drwxrwxr-x, as expected. I suspect,  
therefore, that some installer messed up the permissions.


This is probably off-topic for the cocoa-dev list now, but I'd be  
happy to try to isolate the installer with you off-list.


-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 arch...@mail-archive.com


Re: Class for external monitor?

2009-09-21 Thread Jacob Schwartz
Yeah, monitor without menu bar will work great, thank you and thanks  
to Graham,


-Jake

On Sep 21, 2009, at 11:55 AM, Scott Ribe wrote:

Well I don't think there's a way to directly ask for "the external  
monitor",

but look at NSScreen first.

Remember, on Mac it is easy to move the menu bar to whatever screen  
you
want. So do you really want "the external monitor", or do you want  
"the
monitor without the menu bar"? The second one is easy, main vs non- 
main. The

first might require you to dig into lower-level CGxxx or IOxxx APIs.


--
Scott Ribe
scott_r...@killerbytes.com
http://www.killerbytes.com/
(303) 722-0567 voice




___

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

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

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

This email sent to arch...@mail-archive.com


Re: Oh notification, where are you?

2009-09-21 Thread Jerry Krinock


On 2009 Sep 21, at 09:31, Michael Thon wrote:

In the sendNotification: method I send the notification to the other  
thread using performSelector: onThread: however sendNotification: is  
never even called.  Either the notifications are not, in fact being  
sent to the main thread or I'm doing something else wrong.  There is  
probably something basic about threads or notifications that I don't  
understand but I have run out of ideas about what to try next.


Sending a notification to the other thread may be complicated than  
that.  Have you read this? ...


http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Notifications/Articles/Threading.html#/ 
/apple_ref/doc/uid/20001289


By the way, I have *not* read that, because whenever I've wanted to  
post a notification across threads, I'd look at how long that was, how  
much code there was, and decided to use a different approach :)


___

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

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

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

This email sent to arch...@mail-archive.com


Re: Printing to NSData

2009-09-21 Thread David Duncan

On Sep 18, 2009, at 8:35 PM, Gerriet M. Denkmann wrote:


Is this a bug or did I miss some magical incantation here?



No incantation you've missed. Unless you want to do the pagination and  
assembly yourself (you probably don't) you will have to write to file  
and create a new PDF from it. I would test this to see how bad it  
actually is however.

--
David Duncan
Apple DTS Animation and Printing

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Core Data threading fun

2009-09-21 Thread Luke Evans

Hi Kyle,

Actually that's exactly what the doctor ordered (I think).
I had missed this facet of using Core Data in across multiple threads.

So, thank you very much.  I'm sure you have saved me a lot of time.

One last question comes to mind:
As the NSManagedObjectContextDidSaveNotification will be posted on the  
main thread, is it safe to do a - 
mergeChangesFromContextDidSaveNotification: on the main thread for any  
given MOC?
My guess is no - unless the MOC has internal synchronisation for all  
its work that this method also makes use of, then there's nothing to  
stop the owning thread from updating the MOC while it's being updated  
in this way.
The obvious way to deal with that would be to perform the  
"mergeChanges" on the owning thread, but that will require an  
appropriate runloop on each thread.


-- Luke

On 2009-09-21, at 1:31 AM, Kyle Sluder wrote:


Have you remembered to merge changes whenever a thread's MOC posts
NSManagedObjectContextDidSaveNotification?  If the objects which are
seeing the stale properties haven't been faulted out or hit their
staleness interval, you will see this behavior.

Take a look at the NSManagedObject methods
-mergeChangesFromContextDidSaveNotification: and
-refreshObject:mergeChanges: for more info.

--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 arch...@mail-archive.com


Re: Optimizing Enormous lists in NSBrowser

2009-09-21 Thread Alastair Houghton

On 21 Sep 2009, at 17:27, Jens Alfke wrote:

(In practice, the HFS+ filesystem does return filenames in  
alphabetical order, although I think it's just sorted by Unicode  
codepoint,


It's a little more complicated in practice; case-insensitive HFS+  
sorts by means of a case-insensitive comparison that's defined in the  
spec.  Case-sensitive HFS+ sorts by UTF-16 code unit.


However, you can't rely on this behaviour, since as you rightly point  
out, other filesystems may return filenames in any order.  And, of  
course, case-sensitive HFS+ sorts differently from case-insensitive.


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 arch...@mail-archive.com


Debugging IB 3.2 problem

2009-09-21 Thread Robert Mullen
I have a problem with IB 3.2 in one of my plugins. I get the following  
error message:


 ibtool failed with exception: Some objects didn't get the  
ibBeginArchivingDocument:withContext: callback. A class has probably  
overriden the method without calling through to super.


I don't want a solution to my problem necessarily as much as I would  
like to know how to go about tracking this down. I am using three  
custom IB plugins and one has a bit of a dubious history in my project  
already. I have tried to open up the XIB in question to see the error  
but it does not show up until and attempt is made to save. I wonder if  
it is possible that one of these plugins has emitted XML into the XIB  
that it then failed to cleanup and if that could be the source of my  
problem. I have looked at the XML but it is pretty arcane and  
interwoven so surgery at that level is a somewhat daunting prospect.  
Any tips or tools that might help me figure out what is going on?


TIA
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Tablet events from ordinary touchpad?

2009-09-21 Thread Sander Stoks

Hello all,

Thanks to the Event Taps Testbench by PreFab Software (thanks, Bill) I  
was able to confirm that the tablet was indeed sending out different  
events.  The pressure value was correctly set to 1.0 by the "ordinary  
mouse" events (it was a typo elsewhere that caused my  
misinterpretation).


However, I'm still not getting the tabletProximity: event in my  
NSView.  In the Event Tabs Testbench I do see it.  Is there anything  
special I must do to my NSView to receive these tablet-only events?


Thanks,
Sander
___

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

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

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

This email sent to arch...@mail-archive.com


[OT] Re: enable/disable/check file Sharing from code

2009-09-21 Thread Alastair Houghton

On 21 Sep 2009, at 17:56, Georg Seifert wrote:

This is not exactly my problem. I can start file sharing with just  
calling "/usr/sbin/AppleFileServer". My question was how to to it  
that would also check the checkbox and respect the settings in the  
sharing pane (enable afs, smb and ftp it is selected in "Options...").


It's already been pointed out that this is off-topic for cocoa-dev; it  
isn't a question about Cocoa.


Moreover, as you've already been told twice now, the answer to your  
question is launchctl.  You shouldn't *be* starting AFS by executing  
the binary from /usr/sbin.


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 arch...@mail-archive.com


NSManagedObject Initialization Methods Not Called

2009-09-21 Thread Richard Somers
I have a core data document based application. When a file on the disk  
is opened -awakeFromInsert and -awakeFromFetch are never called for  
one of my NSManagedObject objects.


Why is not one of these methods getting called when the object is  
loaded into memory from disk?


Richard

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Debugging IB 3.2 problem

2009-09-21 Thread Jonathan Hess


On Sep 21, 2009, at 11:54 AM, Robert Mullen wrote:

I have a problem with IB 3.2 in one of my plugins. I get the  
following error message:


ibtool failed with exception: Some objects didn't get the  
ibBeginArchivingDocument:withContext: callback. A class has probably  
overriden the method without calling through to super.


I don't want a solution to my problem necessarily as much as I would  
like to know how to go about tracking this down. I am using three  
custom IB plugins and one has a bit of a dubious history in my  
project already. I have tried to open up the XIB in question to see  
the error but it does not show up until and attempt is made to save.  
I wonder if it is possible that one of these plugins has emitted XML  
into the XIB that it then failed to cleanup and if that could be the  
source of my problem. I have looked at the XML but it is pretty  
arcane and interwoven so surgery at that level is a somewhat  
daunting prospect. Any tips or tools that might help me figure out  
what is going on?


Hey Robert -

I might try opening the document, deleting all of the objects from one  
3rd party plug-in, and saving to see if it reproduces. Repeat this  
with each plug-in and see if you find that one of the objects from one  
of the plug-ins is causing the failure. That assertion failure would  
indicate that the plug-in is using private Interface Builder API, and  
isn't using it properly. If the problem isn't caused by one of the  
third part plug-ins, I would file a bug at http://bugreport.apple.com/.


Jon Hess



TIA
___

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

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

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

This email sent to jh...@apple.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 arch...@mail-archive.com


Re: Class for external monitor?

2009-09-21 Thread Uli Kusterer

Am 21.09.2009 um 19:08 schrieb Jacob Schwartz:
Yeah, monitor without menu bar will work great, thank you and thanks  
to Graham,


 Keep in mind that there may be more than two screens. Put a second  
GPU in a Mac Pro and you can already have 4 screens.


Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Architecture for concurrent network client

2009-09-21 Thread Sixten Otto
On Mon, Sep 21, 2009 at 12:20 PM, Jens Alfke  wrote:
> You don't need concurrency or threads to handle socket connections. The 'Mac
> way' is to use asynchronous I/O, hooking up the socket connections to the
> runloop and getting callbacks when data is available.

That's true, and I knew better than that. For the actual I/O part of
this, I'm definitely planning to let the system handle all of the
asynchronicity as you suggest. That seems to be pretty well-traveled
ground in terms of discussion and code libraries, so I'm hopeful I can
work that out on my own. :-)

I don't think that that gets me out of the problem I was really trying
to ask about, though, which is how to manage getting the work from the
(single) queue of requests from the user to the exactly N persistent
connections available to the application. Somehow I need to track
which/how many connections are idle, and dequeue requests to those
connections.

Sorry for muddying the waters!

Sixten
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Capturing content programatically

2009-09-21 Thread Achint Sandhu

Thanks to everyone for the prompt response.

I'll proceed with the NSAppleScript approach as I'd originally planned.

Cheers,
Achint

On 2009-09-21, at 12:36 PM, Mike Abdullah wrote:



On 19 Sep 2009, at 16:09, Achint Sandhu wrote:


Hi,

	Is there a way to programatically capture content from different  
applications in osx. As an example, I'd like to be able to get a  
webarchive of the current web page being displayed in safari.


	I know this can be done with applescript, but I'm not sure how to  
go about doing this in cocoa/obj-c.


There's your answer. To target AppleScript from a Cocoa app use the  
Scripting Bridge or NSAppleScript.


	I'm essentially trying to do something similar to the way  
eaglefilter captures web pages and other content (the F1 trick).


	I've tried searching google, but I suspect I'm probably using the  
wrong search string / keywords.


Any pointers would be greatly appreciated.

Thank You.

Cheers,
Achint

___

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

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

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

This email sent to cocoa...@mikeabdullah.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 arch...@mail-archive.com


Re: an app that never quits

2009-09-21 Thread Erick Calder

On Sep 21, 2009, at 8:54 AM, Greg Reichow wrote:


Possible - yes
Possible without violating your developer agreement - No


ok, perhaps there's another way I can solve my problem.  I have a  
little app called Trapster that uses something called "push  
technology"... I think what it means is that some server can send my  
app a signal and even though the app isn't running all the time, it  
gets woken up and responds to the message... can anyone point me to a  
howto?  it will be a less than desirable solution but maybe it could  
work for me.


So, shorter version would just be no.  You could only do this while  
the app is active; it is not possible to have a background daemon.


Not really a cocoa question anyhow for this list; checkout the  
iphone developer forums for more info


I actually looked for iPhone specific mailing lists ( but didn't find  
any and since it seemed to me that iPhone development is actually  
Cocoa development, I asked here... if you could point me to the  
location of the iPhone mailing lists I'd appreciate it.  I looked here:


http://lists.apple.com/mailman/listinfo

but the only iPhone list I found had to do with some government thing.



Greg

On Sep 19, 2009, at 3:07 PM, Erick Calder wrote:

I want to write a daemon for the iPhone.  my goal is to record the  
orientation of the phone across time for later analysis.  I am  
unsure how this could be done since it seems only one application  
gets to run at a time i.e. when the user takes a call my program  
quits.


can this be done?

thank you - e
___

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

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

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

This email sent to gdr3...@mac.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 arch...@mail-archive.com


Why am I always getting the linker error: 'duplicate symbol'...?

2009-09-21 Thread Frederick C. Lee
I'm trying to replace #define directives with c datatype directives.Example:

(1) #define x 123

versus...

(2) const unsigned x = 123;

I place this at the top of the .h (or .m) file, outside of any class or
method as stand alone.

However, every time I try to use the (2) declaration (within a .h file) the
linker gives the error: 'duplicate symbol _x in '

I tried placing the (2) declaration at the top of a .m or .c file, but I get
the same linker error.

I've declared global constants in another application without a problem.

I've checked the compiler type within the build: gcc 4.2

What am I doing wrong?
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Core Data threading fun

2009-09-21 Thread Kyle Sluder
On Mon, Sep 21, 2009 at 11:43 AM, Luke Evans  wrote:
> As the NSManagedObjectContextDidSaveNotification will be posted on the main
> thread, is it safe to do a -mergeChangesFromContextDidSaveNotification: on
> the main thread for any given MOC?

This led to confusion a few months ago.  I filed a documentation bug
about it, which is still open (rdar://problem/6933634).

Ben Trumbull answered in
http://www.cocoabuilder.com/archive/message/cocoa/2009/5/29/237809.
Short answer: the objects are thread-safe.

--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 arch...@mail-archive.com


Re: an app that never quits

2009-09-21 Thread Sixten Otto
On Mon, Sep 21, 2009 at 4:15 PM, Erick Calder  wrote:
> ok, perhaps there's another way I can solve my problem.  I have a little app
> called Trapster that uses something called "push technology"... I think what
> it means is that some server can send my app a signal and even though the
> app isn't running all the time, it gets woken up and responds to the
> message... can anyone point me to a howto?

The Push Notification Service Programming Guide is here:
  
http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Introduction/Introduction.html

Be advised, though, that push notifications are really directed at the
*user*. Yes, the alerts you can push provide a convenient way for the
user to start up your app (and your app is specifically informed of
that), but this isn't like waking up a daemon process on the device.
Your app can still only run in the foreground, and only at the
discretion of the user, and will still be quit when the user is done
with it. (Users can also turn off the push alerts entirely.)

Sixten
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Why am I always getting the linker error: 'duplicate symbol'...?

2009-09-21 Thread Kyle Sluder
On Mon, Sep 21, 2009 at 1:19 PM, Frederick C. Lee
 wrote:
> I place this at the top of the .h (or .m) file, outside of any class or
> method as stand alone.
>
> However, every time I try to use the (2) declaration (within a .h file) the
> linker gives the error: 'duplicate symbol _x in '

Think about it: every time the preprocessor transcludes your header
file into a translation unit, it's going to emit another symbol
declaration.  The linker is going to try to combine all your compiled
object files, each one declaring its own "x".

You might want to review your favorite C documentation.  I always preferred K&R.

--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 arch...@mail-archive.com


Re: Tablet events from ordinary touchpad?

2009-09-21 Thread Uli Kusterer

Am 21.09.2009 um 21:05 schrieb Sander Stoks:
However, I'm still not getting the tabletProximity: event in my  
NSView.  In the Event Tabs Testbench I do see it.  Is there anything  
special I must do to my NSView to receive these tablet-only events?


 I don't think there was anything special needed. See if anything in  
this article from when I last did pressure-sensitivity helps:


http://zathras.de/blog-wacom-pens-stirring-cocoa.htm

For one thing, it has a link to WACOM sample code that may be useful.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://groups.yahoo.com/group/mac-gui-dev/

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Architecture for concurrent network client

2009-09-21 Thread Jens Alfke


On Sep 21, 2009, at 10:14 AM, Sixten Otto wrote:


I don't think that that gets me out of the problem I was really trying
to ask about, though, which is how to manage getting the work from the
(single) queue of requests from the user to the exactly N persistent
connections available to the application. Somehow I need to track
which/how many connections are idle, and dequeue requests to those
connections.


Just keep a mutable array of free connections.
When a request arrives, and a connection is free, give it to the first  
free connection and remove the connection from the array.
Or if there aren't any free connections, add the request to a queue  
(another mutable array).
When a connection finishes its work, re-add it to the array, and if  
there are requests waiting in the queue, remove the oldest one and  
give it to the connection.


Do you have control over the protocol used by the server? There are  
more efficient ways to do this, like multiplexing multiple requests  
over a socket. (The BLIP protocol in MYNetwork does that; you can run  
any number of parallel messages over one socket at once.)


—Jens___

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

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

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

This email sent to arch...@mail-archive.com


Re: Why am I always getting the linker error: 'duplicate symbol'...?

2009-09-21 Thread Jens Alfke


On Sep 21, 2009, at 1:24 PM, Kyle Sluder wrote:

You might want to review your favorite C documentation.  I always  
preferred K&R.


Specifically, look up the keyword "extern" in the index.

—Jens___

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

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

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

This email sent to arch...@mail-archive.com


Re: Problem with fontDescriptorWithFontAttributes:

2009-09-21 Thread Laurent Daudelin

On Sep 19, 2009, at 00:03, John C. Randolph wrote:



Looks like NSFontColorAttribute is deprecated after 10.4.   Try  
NSForegroundColorAttributeName instead.


-jcr





John, I just tried this:

NSFontDescriptor *currentFontDescriptor = [[self font] fontDescriptor];
NSMutableDictionary *fontAttributes = [NSMutableDictionary  
dictionaryWithDictionary:[currentFontDescriptor fontAttributes]];

if ([self isEnabled])
	[fontAttributes setObject:[NSColor blackColor]  
forKey:NSForegroundColorAttributeName];

else
	[fontAttributes setObject:[NSColor lightGrayColor]  
forKey:NSForegroundColorAttributeName];
currentFontDescriptor = [NSFontDescriptor  
fontDescriptorWithFontAttributes:fontAttributes];
NSFont *fontToUse = [NSFont fontWithDescriptor:currentFontDescriptor  
size:[[self font] pointSize]];


With no result:

(gdb) po currentFontDescriptor
NSCTFontDescriptor <0x4a75e0> = {
NSColor = NSCalibratedWhiteColorSpace 0.67 1;
NSFontNameAttribute = LucidaGrande;
NSFontSizeAttribute = 11;
}
(gdb) po [fontToUse fontDescriptor]
NSCTFontDescriptor <0x457af0> = {
NSFontNameAttribute = LucidaGrande;
NSFontSizeAttribute = 11;
}

Why is the font ignoring the NSColor attribute?
-Laurent.
--
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://nemesys.dyndns.org
Logiciels Nemesys Software  
laurent.daude...@verizon.net
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Why am I always getting the linker error: 'duplicate symbol'...?

2009-09-21 Thread Frederick C. Lee
I suspected such.Thanks to all.

I'm assuming 'const ' is better then the compiler directive
'#define', due to the use of the compiler
for more-efficient code.   Hence the attempt.

Regards,

Ric.

On Mon, Sep 21, 2009 at 2:00 PM, Jens Alfke  wrote:

>
> On Sep 21, 2009, at 1:24 PM, Kyle Sluder wrote:
>
>  You might want to review your favorite C documentation.  I always
>> preferred K&R.
>>
>
> Specifically, look up the keyword "extern" in the index.
>
> —Jens
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Why am I always getting the linker error: 'duplicate symbol'...?

2009-09-21 Thread Jesper Storm Bache
"In C, the default storage class of a non-local c o n s t is extern  
and in C++ it is static."
(the quote is from: http://www.research.att.com/~bs/examples_short.pdf)
My guess is that your "other" application may have used C++.

Therefore when you declare a const variable in a header in C you  
create storage in each compilation unit (.m or .c file) that you  
include the header in.
Multiple storage for the same name => duplicate symbols linker error.

You could possibly simply prefix your const declaration with "static"  
as in "static const unsigned x = 123;". THis still creates storage,  
and if you want compile time only constants, then you may consider  
staying with define or using a C++ compiler.

Jesper

On Sep 21, 2009, at 1:19 PM, Frederick C. Lee wrote:

> I'm trying to replace #define directives with c datatype  
> directives.Example:
>
> (1) #define x 123
>
> versus...
>
> (2) const unsigned x = 123;
>
> I place this at the top of the .h (or .m) file, outside of any class  
> or
> method as stand alone.
>
> However, every time I try to use the (2) declaration (within a .h  
> file) the
> linker gives the error: 'duplicate symbol _x in '
>
> I tried placing the (2) declaration at the top of a .m or .c file,  
> but I get
> the same linker error.
>
> I've declared global constants in another application without a  
> problem.
>
> I've checked the compiler type within the build: gcc 4.2
>
> What am I doing wrong?
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/jsbache%40adobe.com
>
> This email sent to jsba...@adobe.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 arch...@mail-archive.com


Re: Tablet events from ordinary touchpad?

2009-09-21 Thread Raleigh Ledet
Tablet proximity events are sent to the first responder of the window  
the cursor is over. Which is probably not what you want. You have two  
options:
1) On 10.6, add a local event monitor to catch proximity events  
directly by the objects that care.
2) Create your own NSApplication subclass and override sendEvent:.  
When you find a tabletProximity event, wrap it up in your own  
notification and post that. All objects that care about the proximity   
should listen for your notification instead of the tabletProximity:  
responder method.


-raleigh


On Sep 21, 2009, at 1:40 PM, Uli Kusterer wrote:


Am 21.09.2009 um 21:05 schrieb Sander Stoks:
However, I'm still not getting the tabletProximity: event in my  
NSView.  In the Event Tabs Testbench I do see it.  Is there  
anything special I must do to my NSView to receive these tablet- 
only events?


I don't think there was anything special needed. See if anything in  
this article from when I last did pressure-sensitivity helps:


http://zathras.de/blog-wacom-pens-stirring-cocoa.htm

For one thing, it has a link to WACOM sample code that may be useful.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://groups.yahoo.com/group/mac-gui-dev/

___

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

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

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

This email sent to le...@apple.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 arch...@mail-archive.com


Re: Problem with fontDescriptorWithFontAttributes:

2009-09-21 Thread Kyle Sluder
Fonts really don't have colors.  I don't know why NSFontColorAttribute
is defined in NSFontDescriptor.h, but none of the other attributed
string attributes are in there.

Why are you trying to attach a color to a font?

--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 arch...@mail-archive.com


Re: Why am I always getting the linker error: 'duplicate symbol'...?

2009-09-21 Thread Jens Alfke


On Sep 21, 2009, at 2:15 PM, Frederick C. Lee wrote:

I'm assuming 'const ' is better then the compiler  
directive '#define', due to the use of the compiler

for more-efficient code.   Hence the attempt.


It depends. In C, a const variable of a primitive type like an integer  
is less efficient than a #define. The problem is that it ends up being  
treated as a regular global variable (except its value can't be  
changed). In C++, though, const primitives are optimized away just as  
a #define would be, and can be declared without an 'extern' in a header.


(If you want, you can get the C++ semantics by using Objective-C++,  
i.e. changing the suffix of your source files to .mm.)


—Jens___

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

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

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

This email sent to arch...@mail-archive.com


Re: Problem with fontDescriptorWithFontAttributes:

2009-09-21 Thread Laurent Daudelin

On Sep 21, 2009, at 14:23, Kyle Sluder wrote:


Fonts really don't have colors.  I don't know why NSFontColorAttribute
is defined in NSFontDescriptor.h, but none of the other attributed
string attributes are in there.

Why are you trying to attach a color to a font?

--Kyle Sluder


Simple: I want to set the font as a gray to show that the text field  
cell is disabled, e.g. cannot be selected.



-Laurent.
--
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://nemesys.dyndns.org
Logiciels Nemesys Software  
laurent.daude...@verizon.net
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Problem with fontDescriptorWithFontAttributes:

2009-09-21 Thread Kyle Sluder
On Mon, Sep 21, 2009 at 2:29 PM, Laurent Daudelin
 wrote:
> Simple: I want to set the font as a gray to show that the text field cell is
> disabled, e.g. cannot be selected.

Okay, what you really want to do is set the
NSForegroundColorAttributeName of the attributed string that's being
drawn.

http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Conceptual/AttributedStrings/AttributedStrings.html

--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 arch...@mail-archive.com


Re: Core Data threading fun

2009-09-21 Thread Luke Evans

Thanks again Kyle.

Great that -mergeChangesFromContextDidSaveNotification: does the Right  
Thing vis-a-vis working across threads.  Would be a little awkward to  
keep it happy otherwise.  Kudos to the Core Data folks (especially  
since the more I learn about Core Data the more I realise just what a  
complex beast it is!).


On 2009-09-21, at 1:21 PM, Kyle Sluder wrote:

On Mon, Sep 21, 2009 at 11:43 AM, Luke Evans   
wrote:
As the NSManagedObjectContextDidSaveNotification will be posted on  
the main
thread, is it safe to do a - 
mergeChangesFromContextDidSaveNotification: on

the main thread for any given MOC?


This led to confusion a few months ago.  I filed a documentation bug
about it, which is still open (rdar://problem/6933634).

Ben Trumbull answered in
http://www.cocoabuilder.com/archive/message/cocoa/2009/5/29/237809.
Short answer: the objects are thread-safe.

--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 arch...@mail-archive.com


Re: Architecture for concurrent network client

2009-09-21 Thread Sixten Otto
On Mon, Sep 21, 2009 at 4:58 PM, Jens Alfke  wrote:
>> connections available to the application. Somehow I need to track
>> which/how many connections are idle, and dequeue requests to those
>> connections.
>
> Just keep a mutable array of free connections.

As I think about it more, I think you may be right.

I think I got stuck thinking that access to this stuff was going to
need to be thread-safe, for some reason. (Maybe because I was worried
about overhead in initiating the download blocking the UI?) But if the
I/O handling is all asynchronous, then it's probably the case that the
access to the connection pool can all happen on the main thread:
- When the user adds a download request: if there are available
connections, dequeue one and give it the request; otherwise enqueue
the request.
- When a request completes: if there are queued requests, dequeue one
and give it to the connection; otherwise, enqueue the connection.

> Do you have control over the protocol used by the server?

No. And, in actual fact, it's NNTP, which is about as far from
"efficient" as you're gonna get. (I left that part out because I
didn't want to sidetrack too much into the I/O specifics.)

Sixten
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Why am I always getting the linker error: 'duplicate symbol'...?

2009-09-21 Thread Frederick C. Lee
This is for an iPhone application, using ObjC code with access to C-level
functions and primitive data types.The original primitive types are either
double, float, sci notiation(E) or unsigned int.
So there's a lot of:
#define de2ra 1.74532925E-2   // Degrees to Radians.
#define pi   3.1415926535898 // Pi.

I had thought using static const vs #define would be more-efficient for
computing & storage...
... so I've read.

But if #define is efficient enough, it's easier just to keep the #define
statements.

Ric.



On Mon, Sep 21, 2009 at 2:27 PM, Jens Alfke  wrote:

>
> On Sep 21, 2009, at 2:15 PM, Frederick C. Lee wrote:
>
>  I'm assuming 'const ' is better then the compiler directive
>> '#define', due to the use of the compiler
>> for more-efficient code.   Hence the attempt.
>>
>
> It depends. In C, a const variable of a primitive type like an integer is
> less efficient than a #define. The problem is that it ends up being treated
> as a regular global variable (except its value can't be changed). In C++,
> though, const primitives are optimized away just as a #define would be, and
> can be declared without an 'extern' in a header.
>
> (If you want, you can get the C++ semantics by using Objective-C++, i.e.
> changing the suffix of your source files to .mm.)
>
> —Jens
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Why am I always getting the linker error: 'duplicate symbol'...?

2009-09-21 Thread Greg Guerin

Frederick C. Lee wrote:


I'm assuming 'const ' is better then the compiler directive
'#define', due to the use of the compiler
for more-efficient code.   Hence the attempt.



Is your code currently bogged down loading #defined literal values?   
If not, then why pursue efficiency, as opposed to not fixing it if it  
ain't broken?


  -- GG

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Problem with fontDescriptorWithFontAttributes:

2009-09-21 Thread Steve Christensen

On Sep 21, 2009, at 2:29 PM, Laurent Daudelin wrote:


On Sep 21, 2009, at 14:23, Kyle Sluder wrote:

Fonts really don't have colors.  I don't know why  
NSFontColorAttribute

is defined in NSFontDescriptor.h, but none of the other attributed
string attributes are in there.

Why are you trying to attach a color to a font?

--Kyle Sluder


Simple: I want to set the font as a gray to show that the text  
field cell is disabled, e.g. cannot be selected.


Yes, but a font describes essentially the shape of all the glyphs.  
When it comes time to draw it, -then- you apply characteristics like  
color, but to the string you're trying to draw, not to the font.


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 arch...@mail-archive.com


Re: Handling mouse events in NSCell's?

2009-09-21 Thread Lee Ann Rucker


On Sep 18, 2009, at 1:21 PM, aaron smith wrote:


Ken, Yeah I read the docs. I can't figure out how to get the
-stopTracking:at:inView:mouseIsUp: method to fire.

Should I just be able to define that method and receive use that
method when the mouse is up?  Or do I have to use a combination of the
mouse tracking methods available. I've tried both and can't figure out
why that method does not fire.

These are just some random tests to see the order of how I should call
the methods. But I can't figure out why that stop method won't fire.
Any help would  be much appreciated.

- (BOOL)startTrackingAt:(NSPoint)startPoint inView:(NSView  
*)controlView {

printf("START TRACKING\n");
return NO;
}


- (BOOL)trackMouse:(NSEvent *)theEvent inRect:(NSRect)cellFrame
ofView:(NSView *)controlView untilMouseUp:(BOOL)untilMouseUp {
printf("TRACK");
	if([self  
startTrackingAt:NSMakePoint(cellFrame.origin.x,cellFrame.origin.y)

inView:controlView]) {
  //call the continue tracking method here
 return YES;
}
return YES;
}


trackMouse calls the other three; by subclassing it, you've overridden  
the code that calls them.
Also your startTrackingAt should return YES; you want it to respond to  
mouse events.
Either subclass the three methods (easy), or subclass trackMouse (only  
if you need serious customization); you generally don't need both.







- (BOOL)continueTracking:(NSPoint)lastPoint at:(NSPoint)currentPoint
inView:(NSView *)controlView {
printf("CONTINUE\n");
return YES;
}

- (void)stopTracking:(NSPoint)lastPoint at:(NSPoint)stopPoint
inView:(NSView *)controlView mouseIsUp:(BOOL)flag {
printf("STOP TRACKING");
}




On Fri, Sep 18, 2009 at 10:11 AM, Raleigh Ledet   
wrote:
I  agree with Ken and strongly encourage you to use the three  
tracking

methods already defined in the NSCell documentation

raleigh.

On Sep 18, 2009, at 2:12 AM, Ken Ferry wrote:


Hi Aaron,
You should take a look at the NSCell

docs

.

-Ken
trackMouse:inRect:ofView:untilMouseUp:
Discussion

This method is *generally not overridden* because the default
implementation
invokes other NSCell methods that can be overridden to handle  
specific
events in a dragging session. This method’s return value depends  
on the *
untilMouseUp* flag. If *untilMouseUp* is set to YES, this method  
returns

YES if
the mouse button goes up while the cursor is anywhere; NO,  
otherwise. If *
untilMouseUp* is set to NO, this method returns YES if the mouse  
button

goes
up while the cursor is within *cellFrame*; NO, otherwise.

This method first invokes

*startTrackingAt:inView:*.
If that method returns YES, then as mouse-dragged events are  
intercepted,

*

continueTracking:at:inView:*

is
invoked until either the method returns NO or the mouse is released.
Finally,
*stopTracking:at:inView:mouseIsUp:*

is
invoked if the mouse is released. If *untilMouseUp* is YES, it’s  
invoked

when the mouse button goes up while the cursor is anywhere. If
*untilMouseUp
* is NO, it’s invoked when the mouse button goes up while the  
cursor is
within *cellFrame*. You usually override one or more of these  
methods to

respond to specific mouse events.


On Fri, Sep 18, 2009 at 1:33 AM, aaron smith <
beingthexemplaryli...@gmail.com> wrote:


What's the proper way of handling simple mouse events in NSCell's?
Like mouseUp, mouseDown, etc.

I see that an NSControl implements NSResponder, but wasn't sure if
that's the right way to do it. Because of the fact that tables  
usually
use cell's rather than a control. I've also been looking at the  
method

trackMouse:inRect:ofView:untilMouseUp: but this method doesn't ever
get fired when the mouse is up.

Any ideas?
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/kenferry%40gmail.com

This email sent to kenfe...@gmail.com


___

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

Re: Why am I always getting the linker error: 'duplicate symbol'...?

2009-09-21 Thread Frederick C. Lee
I've been reading C & C++ conflicts in from a URL link to
...examples_short.pdf.It appears you're right.

The hassles of using 'const' & 'static' versus #define <> just isn't worth
pursuing.
I'll stick to the #define stmt and keep it simple.

Ric.


On Mon, Sep 21, 2009 at 2:40 PM, Greg Guerin  wrote:

> Frederick C. Lee wrote:
>
>  I'm assuming 'const ' is better then the compiler directive
>> '#define', due to the use of the compiler
>> for more-efficient code.   Hence the attempt.
>>
>
>
> Is your code currently bogged down loading #defined literal values?  If
> not, then why pursue efficiency, as opposed to not fixing it if it ain't
> broken?
>
>  -- GG
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/amourinetech%40gmail.com
>
> This email sent to amourinet...@gmail.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 arch...@mail-archive.com


Re: NSManagedObject Initialization Methods Not Called

2009-09-21 Thread Mike Abdullah

More information please. What store type are you using?

On 21 Sep 2009, at 20:12, Richard Somers wrote:

I have a core data document based application. When a file on the  
disk is opened -awakeFromInsert and -awakeFromFetch are never called  
for one of my NSManagedObject objects.


Why is not one of these methods getting called when the object is  
loaded into memory from disk?


Richard

___

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

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

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

This email sent to cocoa...@mikeabdullah.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 arch...@mail-archive.com


Re: Problem with fontDescriptorWithFontAttributes:

2009-09-21 Thread Laurent Daudelin


On Sep 21, 2009, at 14:47, Steve Christensen wrote:


On Sep 21, 2009, at 2:29 PM, Laurent Daudelin wrote:


On Sep 21, 2009, at 14:23, Kyle Sluder wrote:

Fonts really don't have colors.  I don't know why  
NSFontColorAttribute

is defined in NSFontDescriptor.h, but none of the other attributed
string attributes are in there.

Why are you trying to attach a color to a font?

--Kyle Sluder


Simple: I want to set the font as a gray to show that the text  
field cell is disabled, e.g. cannot be selected.


Yes, but a font describes essentially the shape of all the glyphs.  
When it comes time to draw it, -then- you apply characteristics like  
color, but to the string you're trying to draw, not to the font.


steve



Yes, that makes sense. I was just distracted with those APIs in  
NSFont, I guess...


-Laurent.
--
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://nemesys.dyndns.org
Logiciels Nemesys Software  
laurent.daude...@verizon.net
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries


___

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

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

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

This email sent to arch...@mail-archive.com


Re: Problem with fontDescriptorWithFontAttributes:

2009-09-21 Thread Laurent Daudelin

On Sep 21, 2009, at 14:30, Kyle Sluder wrote:


On Mon, Sep 21, 2009 at 2:29 PM, Laurent Daudelin
 wrote:
Simple: I want to set the font as a gray to show that the text  
field cell is

disabled, e.g. cannot be selected.


Okay, what you really want to do is set the
NSForegroundColorAttributeName of the attributed string that's being
drawn.

http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Conceptual/AttributedStrings/AttributedStrings.html

--Kyle Sluder


That works, Kyle, thanks!

-Laurent.
--
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://nemesys.dyndns.org
Logiciels Nemesys Software  
laurent.daude...@verizon.net
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries


___

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

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

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

This email sent to arch...@mail-archive.com


FileManager Problem Post OS X 10.6 Installation

2009-09-21 Thread dct
Prior to installing OS X 10.6 and Xcode 3.2 (64-bit), a bit of  
FileManager code for replacing one file with another, to wit:
   if( [mgr fileExistsAtPath:path1] ) [mgr removeFileAtPath:path1  
handler:nil];

   [mgr movePath:path0 toPath:path1 handler:nil];
run without any problem.

With the new OS X and Xcode I changed the code to:
   if( [mgr fileExistsAtPath:path1] ) [mgr removeItemAtPath:path1  
error:NULL];

   [mgr moveItemAtPath:path0 toPath:path1 error:NULL];
which fails in that:
  a. FileManager is aware of a file at the new location, i.e.,
   (BOOL)fileOK = [mgr fileExistsAtPath:path1];  equals YES, but
  b. the file now at path1 is empty, i.e.,
(int)nn = [hndl1 seekToEndOfFile];  equals 0
 whereas the original File at path0 contained several thousand  
bytes.


Am I missing something?  Don Thompson
___

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

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

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

This email sent to arch...@mail-archive.com


CARenderer Example

2009-09-21 Thread Christopher J Kemsley

Hi all,

I've been trying to make a class to record CALayers and their  
animations to QuickTime movies.


I've only found two ways to do this:


Poll and renderInContext

I can have a timer running at some rate, and I use that to tell the  
layer's presentationLayer renderInContext:(someBitmapContext). This  
does not work with CAShapeLayer or any other OpenGL layer.



Use CARenderer

This should work for what I need, but I don't know anything about  
OpenGL and need to have this recorder object by... tomorrow...



Does anyone know of - or could anyone create - a very simple example  
of efficiently doing the following:?


• Creating an OpenGL offscreen context;
• Create the CARenderer, setup for the context;

(loop, or something:)
• Drawing animations to the context, while
• Capturing context as a bitmap, and
• Writing image to quicktime file; then,

• Clean up


I've been searching for this for about four days now and have turned  
up very little. All of Apple's docs [that I've found] on OpenGL assume  
that I am already an experienced OpenGL programmer, which I am not. I  
really don't care about OpenGL right now, I just need to record this  
layer.


I would greatly appreciate any help anyone could 
provide!___

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

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

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

This email sent to arch...@mail-archive.com


Strategies for tracking a tricky (typing) slowdown/lag bug

2009-09-21 Thread Keith Blount
Hi,

This is most probably going to come across as a dumb question to the more 
hardened developers here, but I am a little stumped right now and pulling my 
hair out so please forgive any obtuseness on my part.

My app uses a heavily modified version of the OS X text system and has some 
typing lag issues. Generally it has always been fine, but in some circumstances 
typing would slow down (sometimes this is in part  attributable to the fault of 
the OS X text system itself, which can slow to a crawl when trying to deal with 
even a few thousand words of justified text, but mostly it seems to be the 
result of a combination of factors in the highly customised and subclassed 
version of the text system my app uses). This problem has been exacerbated by 
Snow Leopard, so I have spent the last week running tests and optimising - 
Shark, Leaks, ObjectAlloc and so forth have all helped me find problem areas in 
my code that I have been able to optimise little by little.

However, even after all these texts, I have one particular situation where 
typing slows down to a crawl and none of the tools I am using seem to help me 
find the problem, even after re-reading the docs and online tutorials on Shark 
and Instruments and memory bug tracking in Cocoa; I’m at the stage where I feel 
like dowsing for bad code might be my only option. This is the situation:

• My app has a full screen typing mode. When you first start using it, typing 
is fine.
• After typing about 2,000 words in this mode, typing gets slower and slower. 
By 3,000 words it’s unbearable.
• If you quit the app and re-launch it, and continue typing at the end of that 
2-3,000 word document, typing is fast again - but when you’ve added another 2 
or 3,000 words, it slows right back down again.

Given that it gets slower over time and with typing, but clears out as soon as 
it’s quit and re-launched, I figured this must be a memory problem, but Leaks 
doesn’t seem to give me any useful information - there are no significant 
spikes and most areas of code in Leaks, ObjectAlloc and Shark bring up are 
system-related (sendEvent:, interpretKeys:, _redisplayRecursiveRect... etc - 
Leaks mainly reports NSTextInputContext’s -handleEvent:); barely any of my own 
code is attributed, even though it is clearly the culprit. Moreover the traces 
during slowdown don’t seem any different than during speedy typing (though that 
is perhaps unsurprising).

So, my no doubt ridiculously basic question is: how do I go about tracking a 
tricky bug or memory problem like this, where the main tools don’t seem to be 
giving any useful results? As I say, I have revised my memory of the docs on 
these tools, but no doubt I’ve missed something obvious somewhere, in which 
case I would be grateful if someone could slap me on the forehead and tell me 
to RTFM with a link to TFM. :)

Any pointers much appreciated.

Many thanks and all the best,
Keith



___

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

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

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

This email sent to arch...@mail-archive.com


Re: getting started on bindings => problems with NSMutableArray - NSArrayController - NSTableView

2009-09-21 Thread Colin Howarth

On 21 Sep, 2009, at 18:36, Quincey Morris wrote:


On Sep 20, 2009, at 13:51, Colin Howarth wrote:

It's really frustrating. The examples I find either don't seem to  
fit what I'd like to do (NSMutableArray - NSArrayController -  
NSTableView). And/or they use ancient versions of IB (which keeps  
changing). Or they don't use IB at all. Or, like me, they just  
mention some settings, but ignore others - like "Table View  
Attributes >> Control >> State: Enabled" or "Array Controller  
Attributes >> Object Controller >> Editable (yes)". Sometimes I see  
columns bound. Sometimes ControllerKey is "selections" sometimes  
it's "arrangedObjects". And nothing works. The documentation only  
makes sense when you know exactly what it's talking about. :-(


Use arrangedObjects, not selection. You'd bind to  
arrayController.selection if you were doing a master-detail kind of  
interface. In your case, you're showing all of the  
"arranged" (possibly sorted and filtered) content, hence  
arrayController.arrangedObjects.


Got it.

You have another problem. Your array controller is going to get  
unarchived before the flow of control reaches  
applicationDidFinishLaunching and your content array is created.  
That means the array controller's content is nil, and that's never  
going to change because you're updating the "elements" property non- 
KVO-compliantly in applicationDidFinishLaunching.


Perfect analysis. :-) Thanks.

I moved the content array creation to 'init'  and it worked.
I then used

el_ptr = [elements objectAtIndex:0];
[el_ptr setPosition: [NSNumber numberWithDouble: 8.0]];

to set values in applicationDidFinishLaunching. And that works too. So  
now I can get rid of all that debugging code, and do it properly :-) I  
think I can just use scalars (doubles) instead of NSNumbers, no?


BTW

	[elements objectAtIndex:0] setPosition: [NSNumber numberWithDouble:  
8.0]];


appears to confuse the compiler. It warns:

##
Multiple methods named '-setPosition:' found
Using '-(void)setPosition:(CGPoint)_value'
Also found '-(void)setPosition:(NSNumber *)_value'

which, of course, results in an error:

Incompatible types for argument 1 of 'setPosition:'
##


This is interesting (the compiler only knows that 'elements' is an  
NSMutableArray. Not what it's an array of.)
I think it's interesting because it *assumes* I want -(void) 
setPosition:(CGPoint)_value.


While Aaron Hillegass assures me that I *will* love Cocoa (eventually)  
it appears to me that the combination of dynamic type resolving (?) at  
runtime AND Interface Builder, where you don't have explicit code to  
look at, makes it really difficult for the compiler to do its good old  
fashioned job of checking for MISTAKES. And, yes, Cocoa and IB makes  
me feel stupid sometimes :-)



In the short term you could try re-setting the array controller's  
content array programmatically at the end of  
applicationDidFinishLaunching. That's not really the correct answer,  
though. The correct answer probably involves moving your window to  
its own XIB file, and sorting out your KVO compliance issues.


I think I have the KVC/KVO sorted. What's the advantage to having  
multiple XIB files? Does it speed up the initial startup (if things  
are only loaded when needed)? I admit I find it (mildly) irritating  
that the single XIB I have is called MainMenu.xib ...


Thanks for the help.
___

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

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

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

This email sent to arch...@mail-archive.com


Redraw layer during animation

2009-09-21 Thread Dave Keck
Hey list,

I have a layer that draws its content based on its bounds size, and
I'm animating this layer's size using a CABasicAnimation. I've set the
layer's needsDisplayOnBoundsChange = YES.

During the course of the scaling animation, though, the layer is not
redrawn. Instead, its cached content (before the animation began) is
scaled, which doesn't look great. As best as I can tell, there's no
way to force a layer to be redrawn during an animation. (Performance
isn't an issue in this case - just a few shapes.)

I've started looking into implementing a custom CIFilter - which
apparently are redrawn during animations and such - but this solution
is looking ugly. Alternatively, I could set up a timer and animate the
layer's size manually, but I'm hoping for a better solution.

Any thoughts?

Thanks!

David
___

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

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

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

This email sent to arch...@mail-archive.com


re: Core Data memory not freed after reset

2009-09-21 Thread Ben Trumbull

in my SQLite backed Core Data app, a search action fetches from a
large number of objects (>1.000.000) only to show them in a table.
When the user exits search mode (search string empty), I'd like to
free the managed objects to restore the app's normal memory footprint.
I do that by resetting the managed context, but it doesn't seem to
work, physical memory stays where it was when the fetch was completed.
Strangely, in ObjectAlloc instrument I can see the fetched objects
being deallocated, but the physical memory still peaks.


If ObjectAlloc shows the fetched objects being deallocated, but top  
shows a large RSIZE, and the heap command shows a very large heap  
thats most unused, then you're doing everything you can on the  
deallocation side.  There is a difference between heap size, and VM  
allocated address space.  This issue is caught at the boundary, where  
the malloc system won't aggressively deallocate address space after  
the memory using it has been deallocated.  It doesn't, because as a  
general rule that's a net loss.  So your only choice is to either (a)  
not worry about it or (b) reduce peak memory.  (b) reducing the heap  
high watermark is a separate problem than simply freeing all the  
memory you allocate.  Reducing peak memory will have many other  
performance benefits besides making your RSIZE look pretty.


If you're using an NSArrayController in Entity mode, you can turn on  
Use Lazy Fetching.  You'll want to disable auto-rearrange content.   
This works on 10.5.  On 10.6 and iPhoneOS, you have more options,  
including using Batched Fetching on the fetch request with - 
setFetchBatchSize.  This will make a vast reduction in peak memory  
when working with such a large result set.   Working with 1 million  
objects like this will take ~16MB of RAM.


- Ben

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Core Data memory not freed after reset

2009-09-21 Thread Ben Trumbull

Core Data has (or, I should say, had, since I haven't investigated the
behavior in Snow Leopard) its own internal in-memory cache of object
and attribute data, which means that, up to a point, data from a
persistent store is in memory twice. AFAICT there's no way of
unloading or controlling this cache, which has a maximum size that
Core Data chooses.

So you can get back the memory occupied by the objects themselves (and
their attribute value objects), but your memory footprint could stick
at a couple of hundred MB. You could just ignore the issue (the
footprint won't grow beyond certain point, so it's sort of harmless),
or try some of the fetch performance optimization techniques described
in the Core Data documentation to see if you can keep unwanted
information out of the cache from the beginning.


The caching is happening at the NSPersistentStoreCoordinator level,  
and is shared copy-on-write with the managed objects themselves (e.g.  
faulting the same object in multiple MOCs will reuse the same string  
data).  The raw column data is not duplicated in memory.  The cache  
entries are deallocated after the managed object representing that row  
is deallocated, and at certain other times involving faulting.  Simply  
releasing the last managed object representing that row is enough.   
You may need to call -processPendingChanges to purge anything that as  
accumulated as ready to be disposed to encourage this to happen sooner  
if you find it's taking too long.


- Ben

___

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

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

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

This email sent to arch...@mail-archive.com


re: Core Data threading fun

2009-09-21 Thread Ben Trumbull

I have a server app that responds to network requests, making use of a
Core Data database to serve responses.
Some requests update the database.  I have chosen to allow requests to
arrive on multiple threads, and intend for these threads to use Core
Data directly.

In keeping with Core Data's doc related to threading, I have one
Managed Object Context per thread, and these all share a common
Persistent Store Coordinator that is managing a SQLite data file.
It's my understanding that this scenario is an acceptable
configuration, indeed it appears in the Core Data notes on threading
as the 'preferred option' (q.v. 
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CoreData/Articles/cdMultiThreading.html
).

OK, here comes the problem (!)...
One type of request can change the name of an object.  The handler for
this request (using its thread's own MOC):
1. Fetches the required object by persistent ID (i.e. stringified
NSManagedObjectID).


Why stringify it ?  NSManagedObjectIDs are immutable and you can just  
pass them between threads.



2. Changes the value of the 'name' property on the fetched object
3. Commits the change by calling 'save' on the MOC

Unfortunately, while this works some of the time, I have a situation
where a subsequent other request (possibly on another thread) sees the
old name of this object.  This request gets 'all' the entities of this
type and sends properties (such as name) back.


You can merge the changes into that context explicitly, or refetch the  
objects.



Should I have a PSC per thread too?  If so, will they behave correctly
talking to the same SQLite data file?
With a shared PSC, should I lock this whenever a write is being
performed (at least)?


Per-thread PSCs doesn't sound like what you want.  You probably want  
the simpler shared PSC configuration for now.  When you share a PSC  
between threads, the key point is to lock it whenever you message that  
PSC directly yourself.  Typically, that's adding and removing  
persistent stores.  It's easier to do that at init time, and leave the  
configuration stack after you start spawning threads.  Core Data  
assumes responsibility for locking the PSC if we ever send ObjC  
messages to it.




2. Locking the MOC
There is talk that locking the MOC, even one that is private to a
thread, will engender 'thread friendly' behaviour in the PSC:

...
Typically you lock the context or coordinator using tryLock or lock.
If you do this, the framework will ensure that what it does behind the
scenes is also thread-safe. For example, if you create one context per
thread, but all pointing to the same persistent store coordinator,
Core Data takes care of accessing the coordinator in a thread-safe way
(NSManagedObjectContext's lock and unlockmethods handle recursivity).
...

Should I lock the MOC, or just the PSC (see 1)?
Would this really fix my experience of changes not appearing on other
threads anyway?


No, if you find yourself locking MOCs, you're almost certainly doing  
something wrong.



3. Changes propagating back to other MOCs looking at the same data
I assume Core Data is smart enough to realise that an attribute value
change in a Managed Object cached in one thread's MOC, should be
reflected on (or at least invalidate old data in) another Managed
Object instance representing the same data in another MOC.  At the
very least, I think I'd expect a new fetch request that has this
object in the result set would cause data changed in the persistent
store to show up properly on the object.


We don't automate this step, although there is API to assist you.  We  
try as much as possible to never change the state of your objects out  
from underneath you (e.g. push state).  The reason for that is how  
complex things become when that local MOC has pending edits.  Do we  
overwrite it out from underneath you ?  Or not update it, but update  
other unchanged objects (seemingly randomly).  There isn't a clear  
paradigm for coordinating these kinds of push changes between the  
framework and your code.  So instead we follow something like a  
principle of least surprise mates with lesser evil.


Basically, Core Data uses the poll model.  State may change, but only  
because you did something to ask us to do that.  Like refetch the  
objects, use a staleness interval, or call -mergeChanges...


- Ben

___

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

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

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

This email sent to arch...@mail-archive.com


Re: FileManager Problem Post OS X 10.6 Installation

2009-09-21 Thread Jens Alfke


On Sep 21, 2009, at 3:26 PM, dct wrote:

Prior to installing OS X 10.6 and Xcode 3.2 (64-bit), a bit of  
FileManager code for replacing one file with another, to wit:
  if( [mgr fileExistsAtPath:path1] ) [mgr removeFileAtPath:path1  
handler:nil];

  [mgr movePath:path0 toPath:path1 handler:nil];
run without any problem.


That algorithm does have a race condition, in that another thread/ 
process can create a file at that path in between the first and second  
line, causing the move to fail.


If you do this using the Unix rename() call, the item at the  
destination will be deleted if it exists, making the first line  
unnecessary (and making the whole operation atomic.) It won't work if  
the move is cross-volume or if the item at the destination is a  
directory, though.


Otherwise, the safest approach is probably something like
while( movePath fails because there's something at the destination) {
remove the item at the destination;
if the remove failed, return an error
}


With the new OS X and Xcode I changed the code to:
  if( [mgr fileExistsAtPath:path1] ) [mgr removeItemAtPath:path1  
error:NULL];

  [mgr moveItemAtPath:path0 toPath:path1 error:NULL];


That looks like comparable code to the original version; I'd expect it  
to work the same way...



which fails in that:
 a. FileManager is aware of a file at the new location, i.e.,
  (BOOL)fileOK = [mgr fileExistsAtPath:path1];  equals YES, but
 b. the file now at path1 is empty, i.e.,
   (int)nn = [hndl1 seekToEndOfFile];  equals 0
whereas the original File at path0 contained several thousand  
bytes.


Weird. Are you sure the -removeItemAtPath call succeeded? You're not  
checking the return value or error. It could fail if you don't have  
write permission for the file or the parent directory, for instance.


Have you single-stepped through this code and used a shell to look at  
what's going on in the filesystem after each call?


—Jens___

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

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

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

This email sent to arch...@mail-archive.com


Re: FileManager Problem Post OS X 10.6 Installation

2009-09-21 Thread Greg Guerin

Don Thompson wrote:


With the new OS X and Xcode I changed the code to:
if( [mgr fileExistsAtPath:path1] ) [mgr removeItemAtPath:path1  
error:NULL];

[mgr moveItemAtPath:path0 toPath:path1 error:NULL];
which fails in that:
a. FileManager is aware of a file at the new location, i.e.,
(BOOL)fileOK = [mgr fileExistsAtPath:path1]; equals YES, but
b. the file now at path1 is empty, i.e.,
(int)nn = [hndl1 seekToEndOfFile]; equals 0
whereas the original File at path0 contained several thousand bytes.



How do you know the original file at path0 contained several thousand  
bytes?


Is there a possibility it was a file with an empty data-fork but a  
non-empty resource fork?


Also, if the old code ran without any problem, why change it?

  -- GG

___

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

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

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

This email sent to arch...@mail-archive.com


  1   2   >