Re: Core Data: following a relationship to set a transient attribute during awakeFromFetch

2008-12-15 Thread Quincey Morris

On Dec 14, 2008, at 18:25, Steve Mykytyn wrote:

I am using transient attributes as a nice and efficient way to  
display formatted data (with line breaks) in an NSTableView, and am  
running into trouble in my awakeFromFetch: method for a subclass of  
NSManagedObject.


This works fine in the awakeFromFetch: when building a transient  
attribute based on permanent attributes of the object in question, but


I'm trying to follow relationships  to retrieve attributes from  
several other NSManagedObjects.


The relationship is to the correct NSManagedObject, which is a  
fault, as seen here:


12/14/08 5:50:43 PM myApp[14070] after we get it city =  
NSManagedObject: 0x150e4370 (entity: destination_city; id:  
0x150d14e0 x-coredata://E77970B1-4F89-4C1C-B788-334AEEF886EB/destination_city/p22919 
 ; data: fault)


Trying to access attributes of the relation just fails with a  
message like:


12/14/08 5:51:19 PM myApp[14070] *** NSRunLoop ignoring exception  
'statement is still active' that raised during posting of delayed  
perform with target 0x14c90c80 and selector 'invokeWithTarget:'



Sample code:

awakeFromFetch: in my NSManagedObject subclass

NSManagedObject *city = [self valueForKey:@city];
NSManagedObject *state = [self primitiveValueForKey:@state];
NSManagedObject *country = [self primitiveValueForKey:@country];

	// * fails on the next statement - city is there, and  
marked as a default...


NSString *cityName = [city valueForKey:@city_name];
NSString *stateName = [state valueForKey:@state_name];
NSString *countryName = [country valueForKey:@countryName];

	NSString *transient_location = [NSString stringWithFormat:@%@, %...@\n 
%@, cityName, stateName, countryName];



displayPatternValue is much slower than this approach and I don't  
want to denormalize my tables unless I have to do so.


Suggestions?


Core Data appears to be telling you that it can't fault in the other  
objects during awakeFromFetch. The neatest alternative is to implement  
the string formatting in the transient attribute's getter (you don't  
say what is the key of this attribute, so I'll assume location):


+ (NSSet*) keyPathsForValuesAffectingLocation {
	return [NSSet setWithObjects: @city, city.city_name, @state,  
@state.state_name, @country, @country.countryName, nil];

}

- (NSString*) location {
NSManagedObject *city = [self valueForKey:@city];
NSManagedObject *state = [self valueForKey:@state]; 
NSManagedObject *country = [self valueForKey:@country];

NSString *cityName = [city valueForKey:@city_name];
NSString *stateName = [state valueForKey:@state_name];
NSString *countryName = [country valueForKey:@countryName];

	return [NSString stringWithFormat:@%@, %...@\n%@, cityName, stateName,  
countryName];

}

Note that this *appears* to be less efficient, but even if it is, it's  
unlikely to be a performance bottleneck.


It has the advantage of returning the correct result even if the city,  
state or country change.


It also has the advantage of being KVO-compliant for the key  
location with no additional housekeeping code.



___

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

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

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

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


How to get notifications when unexpected network disconnection is occurred?

2008-12-15 Thread norio

I'm sorry to ask you this again.

I don't know if I could have told you my problem correctly, please let  
me tell you again.


1. My app gets NSWorkspaceDidUnmountNotification.
2. Under 10.5, users can handle some actions before the notification  
comes to my app.


I'd like my app to get noticed that a network connection was cut as  
very soon as it occurred.


I don't want to use timer to look at the network port all the time  
while the app runs, if possible.


would you tell me how?

Any suggestion would be very very appreciated.

Thank you,
Norio


___

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

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


Katoeri-Hiragana input underline drawing

2008-12-15 Thread Rimas
Hello,

I am wondering if it is possible to draw this underline manually? I am
talking about underline which is visible when entering text in
Katoeri-Hiragana and characters are in undermined state.
I have tried to use -
(void)drawGlyphsForGlyphRange:(NSRange)glyphsToShow
atPoint:(NSPoint)origin and -
(void)drawBackgroundForGlyphRange:(NSRange)glyphsToShow
atPoint:(NSPoint)origin. But these methods doesn't draw underline.
I have noticed, that marked text range is exactly what I want, but the
problem is - how to know WHEN underline is required? TextView
markedTextAttributes returns dictionary, which has only yellow
background. The same you can see when entering Opt+e, for example.
Looks like this depends on input locale. But I have no idea how
Katoeri-Hiragana should be detected.
Any kind of help is very appreciate.

Regards,
Rimas M.
___

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

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

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

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


Re: encoding/decoding selectors?

2008-12-15 Thread Andy Lee

On Dec 15, 2008, at 8:47 AM, Karan, Cem (Civ, ARL/CISD) wrote:

- (void) encodeWithCoder:(NSCoder *) aCoder
{
	[aCoder encodeObject:NSStringFromSelector(self.selector)  
forKey:@selector];

}

- (id) initWithCoder:(NSCoder *)aDecoder
{
	self.selector = NSSelectorFromString([aDecoder  
decodeObjectForKey:@selector]);

}

Is this the correct method?


I would think so.  The actual bits that go into a SEL are determined  
at runtime, so you can't store those.


--Andy


___

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

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

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

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


Re: Write to file.

2008-12-15 Thread Filip van der Meeren

You are writing to a folder that is under admin rights.
Instead write to the user directory: ~/Library/Preferences/myFile.plist
Or make use of the NSUserDefaults class.

Filip van der Meeren
fi...@code2develop.com
http://www.sourceforge.net/projects/perlmanager
http://www.sourceforge.net/projects/xlinterpreter

On 15 Dec 2008, at 11:25, Macarov Anatoli wrote:

I have got my own bundle that I insert into login window. When login  
window is started up  the bundle  writes necessary parametr into  
file which is situated  in /Library/Preferences/. I try to write in  
the following way:

NSString *Value;
NSDictionary *theDict = [NSDictionary dictionaryWithObjectsAndKeys:  
Value, @Type, nil];
if([theDict writeToFile:@/Library/Preferences/myFile.plist  
atomically:NO]){
NSString *sString = [NSString stringWithFormat:@Saving  
the file Preferences];

const char *err = [sString UTF8String];
syslog(0,err);
}else{
NSString *sString = [NSString stringWithFormat:@There  
was a problem saving the file Preferences];

const char *err = [sString UTF8String];
syslog(0,err);
}

Gives the message Error in Writing. This code works fine  in  
application. What is another way to write into file?




 
Вы уже с Yahoo!?
Испытайте обновленную и улучшенную. Yahoo!  
Почту! http://ru.mail.yahoo.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/filip%40code2develop.com

This email sent to fi...@code2develop.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: More - Safari Download Security Alerts

2008-12-15 Thread Dave

Hi,

I've been trying to use PackageMaker to build an installer without  
much luck, it  seems very flakey. I following the instructions in the  
manual and actually created one usable installer. When it worked it  
created a .mpkg file. I then made some changes and built it again,  
this time it said it couldn't create a .mpkg file but only a .pkg  
file. So I said ok, it then builds ok, but when I run the installer I  
get The installer encountered an unknown error that failed the  
install. Contact the software manufacturer for assistance.


So firstly, what is the difference between a .mpkg file and a .pkg  
file, and how do I select .mpkg? (Since that seemed to work).


I've being experimenting since I wrote the above. My installation  
consists of a folder that contains an application. I want the folder  
to be created in /Applications, however, it doesn't seem to let me  
do this. I end up with just the .app file in /Applications, not a  
folder with the app inside it as I expected. So, how do I get it to  
create a folder that contains my app file?


So I set everything up, an build an installer, and then save the  
project to a .pmdoc file, all seems ok. If I then quit PackageMaker  
and then open the .pmdoc file again and try to build an installer, I  
find that the setting have reverted to before I changed then so I  
have to go thru the whole process again. Is this expected or is it a  
bug or what? For instance, when re-open the .pmdoc file and re-build  
the installer, I get a warning saving that the destination was not  
selected and it will be installed in /. If I set again set it to  
Applications it works again but when I save and re-open project  
file, it setting has reverted back to empty. The same goes for the  
permissions. When I first added the files to the project, I dragged  
in the folder containing the application, I then set the permissions  
to Owner: root, Group: admin as per the manual. Whenever I re-open  
the pm.doc file, the permissions have reverted to back to Owner:  
Dave, Group: admin.


All in all a terrible experience so far, especially since I already  
had it working to everyones satisfaction using the AppleScript(s).


If anyone could shed some light on this I'd be really grateful. I  
really need to get an application/installer out the door ASAP.


Thanks in Advance,
All the Best
Dave

On 12 Dec 2008, at 12:25, Mike Abdullah wrote:

Does your app actually require an installer? If so, use Apple's  
built-in installer application; don't roll your own with  
AppleScript. If an installer is not really needed, just provide the  
application on its own inside the DMG file. Users can drag and drop  
it to their preferred destination.


On 12 Dec 2008, at 11:25, Dave wrote:


Hi,

Thanks for this. I have a little more information in the problem:

The user downloads a ,dmg file, this image contains (among others)  
the following files:


Install.app-- Installation AppleScript.
Cleanup.app   -- AppleScript that is run after the installation  
has completed, (ejects the image etc.)

RealApp.app   -- The Application that is being Installed.

When the user attempts to mount the Image file, the OS displays  
the File downloaded from Internet dialog, this is ok, however,  
after that, when the user launches Install.app a similar dialog  
appears, the same goes for Cleanup.app and for RealApp.app, so  
we get 4 dialogs in total. So my question now is:


Can I disable all but the warning when the disk image is opened?

Thanks a lot
All the Best
Dave

On 11 Dec 2008, at 13:52, Peter Blazejewicz wrote:


hi Dave,
that's not Safari unique feature. That's system-wide component.
In your Xcode documentation window type file quarantine or  
navigate to GuidesSecuritySecurity OverviewSecurity Services  
#File Quarantine


regards,
Peter Blazejewicz

On Dec 11, 2008, at 11:53 AM, Dave wrote:


Hi All,

I have an application that is downloaded from the web by Safari.  
When the user double-clicks on the .dmg file to open the a  
Warning Dialog is displayed. My question is, is there anyway of  
stopping the dialog from appearing? My boss doesn't like it and  
wants me to look into ways of getting rid of it, but I'm not  
sure where to start!


Thanks in Advance, All the Best Dave
Dave



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: How to get notifications when unexpected network disconnection is occurred?

2008-12-15 Thread Ken Thomases

On Dec 15, 2008, at 5:49 AM, norio wrote:


I'm sorry to ask you this again.

I don't know if I could have told you my problem correctly, please  
let me tell you again.


1. My app gets NSWorkspaceDidUnmountNotification.
2. Under 10.5, users can handle some actions before the notification  
comes to my app.


I'd like my app to get noticed that a network connection was cut as  
very soon as it occurred.


NSWorkspaceDidUnmountNotification is about volumes, not the network,  
although if you have a network volume mounted and the connection is  
disrupted, I suppose it will be unmounted.


The Finder and NSWorkspace are both using the Disk Arbitration  
framework to be notified of such events.  There's no way to guarantee  
that your app receives the Disk Arbitration notification before the  
Finder.  Depending on what notification the Finder is using, though,  
it may be at a different point in the sequence.  You could take a look  
at Disk Arbitration to see if registering for certain notifications  
gets you an earlier opportunity to react.  Ultimately though, on a  
multi-processing OS you have no guarantee of being able to complete  
your processing before other applications have an opportunity to do  
some processing of their own.  You should reconsider your design if  
you think you have such a requirement.


You might also take a look at the Network Reachability API http://developer.apple.com/documentation/Networking/Conceptual/SystemConfigFrameworks/SC_ReachConnect/chapter_5_section_4.html 
.  This will notify your app when the system becomes aware of a  
network reachability change.  Note the important caveat: in general,  
it is not possible for one computer to detect if another computer is  
_truly_ reachable over the network.  From http://developer.apple.com/documentation/Networking/Conceptual/SystemConfigFrameworks/SC_ReachConnect/chapter_5_section_2.html 
:


The System Configuration reachability API helps an application  
determine if a remote host is reachable. A remote host is considered  
reachable if a data packet sent to the host can leave the local  
computer, regardless of what ultimately happens to the packet. In  
other words, the reachability of a remote host does not guarantee  
that the host will receive the data.


In practice, when a remote host is deemed reachable, but the packets  
you send to it fail to arrive, the myriad possible reasons for the  
failure fall into two broad categories:


   1. A part of the Internet connection over which you have no  
control is broken. For example, the remote host’s server is down.
   2. A part of your local network infrastructure over which you  
might have control is broken. For example, your modem hasn’t dialed  
or your AirPort base station is turned off.


The reachability API cannot help you with problems in the first  
category. As long as data packets can leave the local machine, the  
remote host is considered reachable. [...]




Good luck,
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


Re: Where is the Computer Image ?

2008-12-15 Thread Benjamin Dobson

The image is already in Cocoa, named NSComputer.

On 15 Dec 2008, at 04:53:12, Gerriet M. Denkmann wrote:


Finder.app can show in its Sidebar an image of a computer.
I want to create a button with this same (or similar) image.

I can use [ sharedWorkspace iconForFile: fullPath ] to get an image  
of a home folder, or of a disk partition.


But I cannot find a computer image. Also looked at Icon Services  
and Utilities Reference but did not find anything there.



Kind regards,

Gerriet.


___

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

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

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

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


Re: Feasibility : setObjectValue: + bindings + Table Column with NSImageCell ??

2008-12-15 Thread Ken Thomases

On Dec 15, 2008, at 5:11 AM, rajesh wrote:

I have a table column(With ImageCell) to be filled with images , I  
have a NSTreeController


Is this a column in an outline view or a table?  NSTreeController is  
intended for an outline view or browser.


which has dictionary for this image ( dictionary has few details ,  
using which I fetch the images )
after binding this column with the said dictionary and running the  
build ,  in run log , I see complaints, that it is expecting an  
NSImage  and hence image don't show up


Well, of course.  How would you expect an NSImageCell to know how to  
draw itself given your dictionary?



previewID has dictionary with it. every other column is fine with  
the binding , except this imageColumn


Well, I don't know what kind of cells you're using in the other  
columns, but I would expect that they would have to be bound to a  
specific key within the dictionary, not the dictionary itself.  If you  
bind to the dictionary itself, a text field (for example) will show  
the contents of the dictionary as given by the -description method.   
That works after a fashion, but is probably not what you really  
intend.



You could implement a custom value transformer to transform your  
dictionary into an image.  However, that seems strange to me.  That  
puts the logic for figuring out the image for one of model elements  
into the view.  It seems to me that such logic belongs in the model.


Why don't you add a property to your model objects (whatever it is  
which has the PreviewID property currently) which gives the desired  
image?  If you're worried about performance considerations, that  
property need not be backed by storage -- it can consist of only a  
getter method which dynamically determines the image to use and  
returns that.  It might use some smart caching technique.


Regards,
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


Re: Where is the Computer Image ?

2008-12-15 Thread John C. Randolph


On Dec 14, 2008, at 8:53 PM, Gerriet M. Denkmann wrote:


Finder.app can show in its Sidebar an image of a computer.
I want to create a button with this same (or similar) image.

I can use [ sharedWorkspace iconForFile: fullPath ] to get an image  
of a home folder, or of a disk partition.


But I cannot find a computer image. Also looked at Icon Services  
and Utilities Reference but did not find anything there.


When I need to do this kind of thing, I use  spotlight to show me all  
the images in /System/Library/ in icon view.


-jcr
___

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

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

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

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


Re: encoding/decoding selectors?

2008-12-15 Thread Jean-Daniel Dupas


Le 15 déc. 08 à 14:47, Karan, Cem (Civ, ARL/CISD) a écrit :

I need to encode/decode an object which has a selector as one of its  
instance variables.  I know that NSCoder doesn't directly support  
this, so my current way of doing things is the following:


- (void) encodeWithCoder:(NSCoder *) aCoder
{
	[aCoder encodeObject:NSStringFromSelector(self.selector)  
forKey:@selector];

}

- (id) initWithCoder:(NSCoder *)aDecoder
{
	self.selector = NSSelectorFromString([aDecoder  
decodeObjectForKey:@selector]);

}

Is this the correct method?

Thanks,
Cem Karan


Look fine. I think this is the way to go.


___

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

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

2008-12-15 Thread Rimas
Hello Gordon,

Have you installed 10.6 to run test?

Regards,
Rimas

NSTextContainer has been broken for some time now and I can't even get
 an acknowledgement from DTS of the bug in spite of the fact that I've had
 others verify it on independent machines using Apple, Inc's own sample code.
 I'm trying (with difficulty) to get 10.6 installed on a separate disk to see
 if the bug is still there.  When the container is expanding, it works.  When
 the container is shrinking, lineFragmentRectForProposedRect goes into an
 infinite loop, ever increasing it's height, which I have to terminate when
 it hits the bottom of the container.  If it is still there in 10.6, I'm
 going to start filing bug reports on it again.
___

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

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

2008-12-15 Thread Bill Bumgarner

On Dec 15, 2008, at 7:29 AM, Dave wrote:
I've being experimenting since I wrote the above. My installation  
consists of a folder that contains an application. I want the folder  
to be created in /Applications, however, it doesn't seem to let me  
do this. I end up with just the .app file in /Applications, not a  
folder with the app inside it as I expected. So, how do I get it to  
create a folder that contains my app file?


Why doesn't drag and drop work?

Does your app *have* to be in /Applications?  If so, that means all  
the users with non-admin accounts won't be able to install the app  
(and if you require read/write to anything in that folder, they can't  
use it either-- nor can multiple users on one machine).


b.bum

___

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

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

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

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


Re: Now contents of the layer not being rotated [was Re: Rotating a CALayer more than once is not working ]

2008-12-15 Thread Gustavo Pizano

Why would it change? The content of the layer is what it displays, the
rotation is part of the overall transform which is how it displays.
The latter won't influence the former.

Think of it like a photo on your desk. (A real physical paper one,
mind.) Now turn it sideways. Did the photo change in any way? No, just
how you see it. Now hold a magnifying glass in front. Still no change.

CALayer is the same. You can move it around and turn it and blow it up
and do various other transformations to it but this all simply
modifies how it is displayed. Its content remains unchanged.


Hi.
Yes in fact while sleeping the other night I thought something similar  
to what you explain me here, thx for the explanation btw.  The problem  
is that after its rotated the user will want to make another drag and  
drop to the same view, so if I take the contents of the layer to set  
the image to be dragged  I will only see one part of the image,  
because the layer its in a Vertical position, and it's content its in  
a horizontal position, So what Im thinking its to do the following in  
the mouseDragged method


1. check if the layer which I took for a the drag operation its  
vertical or horizontal by comparing its width against its height.

2. if So, then  change the contents.  and perform the drag.
3. If no, perform the drag.

so when I lockfocus the image to be drag, it will display a vertical  
or horizontal image, depending on the position of the layer.


some other thing that maybe you know but its not so important, when  
the layer rotate,  once in vertical position the images looks blurred,  
but on horizontal position it doesn't, why is this behavior?..


Thanks for your help.

Gustavo


___

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

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


Write to file.

2008-12-15 Thread Macarov Anatoli
I have got my own bundle that I insert into login window. When login window is 
started up  the bundle  writes necessary parametr into file which is situated  
in /Library/Preferences/. I try to write in the following way:
NSString *Value;        
NSDictionary *theDict = [NSDictionary dictionaryWithObjectsAndKeys: Value, 
@Type, nil];
        if([theDict writeToFile:@/Library/Preferences/myFile.plist 
atomically:NO]){
            NSString *sString = [NSString stringWithFormat:@Saving the file 
Preferences];
            const char *err = [sString UTF8String];
            syslog(0,err);
        }else{
            NSString *sString = [NSString stringWithFormat:@There was a 
problem saving the file Preferences];
            const char *err = [sString UTF8String];
            syslog(0,err);
        }

Gives the message Error in Writing. This code works fine  in application. What 
is another way to write into file?



  
Вы уже с Yahoo!? 
Испытайте обновленную и улучшенную. Yahoo! Почту! http://ru.mail.yahoo.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: Programatically creating windows

2008-12-15 Thread Keary Suska


On Dec 13, 2008, at 9:40 PM, Development wrote:


[mainWindow makeKeyAndOrderFront:self];
[mainWindow setInitialFirstResponder:docView];


Of particular note, -setInitialFirstResponder: should be called before  
the window is placed onscreen, so you should call it before - 
makeKeyAndOrderFront:.


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


Docs on Open GL ES

2008-12-15 Thread ramesh kakula


Hi,

I am looking for the good documentation on the Open GL ES for iPhone,  
if any one have a link or doc please share.


Thanks
Ramesh.

___

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

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


Feasibility : setObjectValue: + bindings + Table Column with NSImageCell ??

2008-12-15 Thread rajesh

Hi all,
w.r.t  one of my earlier post ( subject : Design for showing  
ridiculously huge number of images in Table View )


I have a table column(With ImageCell) to be filled with images , I  
have a NSTreeController which has dictionary for this image  
( dictionary has few details , using which I fetch the images )
after binding this column with the said dictionary and running the  
build ,  in run log , I see complaints, that it is expecting an  
NSImage  and hence image don't show up


 instead using a NSTextField cell ,  I could draw the image myself ,   
I don't think its a good idea because I need to show images  
proportional to their sizes


am I doing a blunder here ? 
 inline: Picture 5.png   , previewID has dictionary with it. every other column is fine  
with the binding , except this imageColumn
Should I work at cell level binding ? like cell's Controller Key with  
'selection' ??


I need to show a image-tool tip when I hover this image  but that  
is future requirement and it can wait for  now...



Thanks in Advance
~Rajesh___

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

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

2008-12-15 Thread Dave


On 15 Dec 2008, at 16:31, Bill Bumgarner wrote:


On Dec 15, 2008, at 7:29 AM, Dave wrote:
I've being experimenting since I wrote the above. My installation  
consists of a folder that contains an application. I want the  
folder to be created in /Applications, however, it doesn't seem  
to let me do this. I end up with just the .app file in / 
Applications, not a folder with the app inside it as I expected.  
So, how do I get it to create a folder that contains my app file?


Why doesn't drag and drop work?


AFAIK it does work, but my boss wants to be able to display a TC  
page etc. and he wants an installer. Also it isn't a straight  
forward .app file, it's an App file that is in a folder that also  
also contains other folders/files.


Does your app *have* to be in /Applications?  If so, that means all  
the users with non-admin accounts won't be able to install the app  
(and if you require read/write to anything in that folder, they  
can't use it either-- nor can multiple users on one machine).


No, it doesn't have to be in /Applications, but this is the  
recommended place to put it if you want it to be accessible to all  
users on the machine, isn't it? If not where does it get stored?  
That's where every other app is stored and it's where it has been  
stored up until now (using the AppleScript Installer) and I haven't  
had any problems reported of people not being able to access it, or  
are you saying it won't be accessible using a PackageMaker installer?


Thanks a lot,
All the Best
Dave


___

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

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


encoding/decoding selectors?

2008-12-15 Thread Karan, Cem (Civ, ARL/CISD)
I need to encode/decode an object which has a selector as one of its instance 
variables.  I know that NSCoder doesn't directly support this, so my current 
way of doing things is the following:

- (void) encodeWithCoder:(NSCoder *) aCoder
{
[aCoder encodeObject:NSStringFromSelector(self.selector) 
forKey:@selector];
}

- (id) initWithCoder:(NSCoder *)aDecoder
{
self.selector = NSSelectorFromString([aDecoder 
decodeObjectForKey:@selector]);
}

Is this the correct method?

Thanks,
Cem Karan
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Feasibility : setObjectValue: + bindings + Table Column with NSImageCell ??

2008-12-15 Thread rajesh


On Dec 15, 2008, at 1:09 PM, Alexander Spohr wrote:

An NSImageCell needs an image. Why would you bind an NSDictionary to  
it?
I have a column with image + text as well , so I  took advantage of  
setting object value as Dictionary
and in the drawWithFrame:(NSRect)cellFrame inView:(NSView  
*)controlView in NSTextFieldCell ,
I got the objectValue ( i.e., dictionary ) and done the necessary  
drawing + text display


I tried following the same approach here as well


And why would you call an ivar holding a dict previewID and not  
previewDict?
I have Framework which returns details of image in Dictionary format  
( like URL etc )
  I am trying  something like , lazy loading of images , because i  
have very large number of images

I load image only when it is required


And why do you call that sometimes PreviewID and sometimes previewID?

It just a identifier ( but binding value is dictionary )

My ultimate question is , can't I take care it like the  
NSTextFieldCell case ?


Thanks
Rajesh





Am 15.12.2008 um 12:11 schrieb rajesh:


Hi all,
w.r.t  one of my earlier post ( subject : Design for showing  
ridiculously huge number of images in Table View )


I have a table column(With ImageCell) to be filled with images , I  
have a NSTreeController which has dictionary for this image  
( dictionary has few details , using which I fetch the images )
after binding this column with the said dictionary and running the  
build ,  in run log , I see complaints, that it is expecting an  
NSImage  and hence image don't show up


instead using a NSTextField cell ,  I could draw the image  
myself ,  I don't think its a good idea because I need to show  
images proportional to their sizes


am I doing a blunder here ?Picture 5.png   , previewID has  
dictionary with it. every other column is fine with the binding ,  
except this imageColumn
Should I work at cell level binding ? like cell's Controller Key  
with 'selection' ??


I need to show a image-tool tip when I hover this image  but  
that is future requirement and it can wait for  now...



Thanks in Advance
~Rajesh___

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

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

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

This email sent to a...@freeport.de


---
Alexander Spohr
Freeport  Soliversum

Fax: +49 40 303 757 99
Web: http://www.freeport.de/
Box: http://dropbox.letsfile.com/02145299-4347-4671-aab9-1d3004eac51d
---





___

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

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


scheme High Level Class and representations

2008-12-15 Thread René v Amerongen

Hi,

What are your idea's to solve this the right way.

I have a class ( high level ) that receives data. The type of data is  
unknown and is only recognisable by an included header inside the data.


This header could be 16 bytes or 32 bytes long. Depending on this  
header I will call a worker.


Because of the extensibility of the HLClass because of new data  
type's, I would like to make that HLClass known about  
DataTypeWorker_xx Classes.
In other words, this High Level Class works in conjunction with  
several representation objects (subclasses of DataTypeWorker), which  
recognisable and manage the actual data.


I hope the purpose is clear.

Now I am filling manually during the HLClass initialisation a  
DatatypeRepresentation array and walk through it for all the  
DataTypeWorker_xx objects.
It works, but I feel I have to much code around and not so dynamic as  
I think it should be with Obj-C.


How does Apple or you doing this ( f.e NSImage and NSString )?
How can I add just a DataTypeWorker_xx.mh ( representations ) to the  
project, with at less code as possible ( read no extra code ) in the  
HLClass, that will be recognised by the Highlevel Class?


Should I, during the initialisation ( initialize ) of the  
representation classes, add the 'classes' to a global dictionary, and  
read this global with the HLClass?
This because I am afraid that it is uncertain which class will be the  
first called, HLClass initialize or initialize of the representation  
DataTypeWorker_xx  Classes!

I want create the objects only at the moment that I really need them.

Is this the way?

Thanks in advance

RvA

___

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

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

2008-12-15 Thread Rimas
I have tried to modify my text container in mentioned method (-
(void)layoutManager:(NSLayoutManager *)layoutManager
didCompleteLayoutForTextContainer:(NSTextContainer *)textContainer
atEnd:(BOOL)layoutFinishedFlag). At a first glance looks like this
works. But I decided to stay on  the earlier way - delay text
container modification in response to
NSTextStorageDidProcessEditingNotification.

Rimas M.
___

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

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

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

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


Re: More - Safari Download Security Alerts

2008-12-15 Thread Devon Ferns
This is OT for the Cocoa list now, but you can set an EULA to be 
displayed when mounting a dmg.  I don't know how since I've never cared 
to check but many apps do it so it's possible.


You could just have the user drag the whole folder to the installation 
directory with an EULA being displayed when mounting the dmg.


Many apps come on a dmg with a background image showing the user that 
they should drag the .app or folder to /Applications to install.


Devon


Dave wrote:


On 15 Dec 2008, at 16:31, Bill Bumgarner wrote:


On Dec 15, 2008, at 7:29 AM, Dave wrote:
I've being experimenting since I wrote the above. My installation 
consists of a folder that contains an application. I want the folder 
to be created in /Applications, however, it doesn't seem to let me 
do this. I end up with just the .app file in /Applications, not a 
folder with the app inside it as I expected. So, how do I get it to 
create a folder that contains my app file?


Why doesn't drag and drop work?


AFAIK it does work, but my boss wants to be able to display a TC page 
etc. and he wants an installer. Also it isn't a straight forward .app 
file, it's an App file that is in a folder that also also contains other 
folders/files.


Does your app *have* to be in /Applications?  If so, that means all 
the users with non-admin accounts won't be able to install the app 
(and if you require read/write to anything in that folder, they can't 
use it either-- nor can multiple users on one machine).


No, it doesn't have to be in /Applications, but this is the 
recommended place to put it if you want it to be accessible to all users 
on the machine, isn't it? If not where does it get stored? That's where 
every other app is stored and it's where it has been stored up until now 
(using the AppleScript Installer) and I haven't had any problems 
reported of people not being able to access it, or are you saying it 
won't be accessible using a PackageMaker installer?


Thanks a lot,
All the Best
Dave


___

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

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

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

This email sent to dfe...@devonferns.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: More - Safari Download Security Alerts

2008-12-15 Thread Graham Lee
On 15/12/2008 17:06, Devon Ferns dfe...@devonferns.com wrote:

 This is OT for the Cocoa list now, but you can set an EULA to be
 displayed when mounting a dmg.  I don't know how since I've never cared
 to check but many apps do it so it's possible.


x-man-page://1/hdiutil

Particularly the 'udifrez' command.

Cheers,
Graham.
--
Graham Lee
Senior Macintosh Software Engineer, Sophos Plc.
+44 1235 540266
http://www.sophos.com/


Sophos Plc, The Pentagon, Abingdon Science Park, Abingdon, OX14 3YP, United 
Kingdom.
Company Reg No 2096520. VAT Reg No GB 348 3873 20.
___

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

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

2008-12-15 Thread Corbin Dunn


On Dec 12, 2008, at 10:44 PM, David Blanton wrote:

Allowing empty selection did not clear the first row being selected.  
Also, calling deselectRow:0 at various time during table load does  
not clear the first row being selected.


Note that Apple has said this is somewhat of a bug and asked that I  
log a bug report.


It depends on your case. If you have a sample project that reproduces  
the problem, please do attach it to a new bug report, and we will look  
into it.


corbin
___

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

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

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

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


Re: Drawing NSTextFieldCell subclass in table view

2008-12-15 Thread Corbin Dunn


On Dec 13, 2008, at 4:03 PM, Iceberg-Dev wrote:



NSTextFieldCell is flipped. This has an impact on the y value. It  
might be the cause of the issue in your case.


This is actually not quite right; the cell doesn't have a flipped  
property. The view does, and NSTableView isFlipped==YES. It would be  
more correct to say the control view which the cell is being drawn  
into is flipped.


corbin
___

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

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

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

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


NSOutline resizing of rows

2008-12-15 Thread Arun
Hi

How can we resize the row height for Items in the NSOuline view so that the
we can make a clear distincton between the groups?

-Arun
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Distributed Objects with Garbage Collection (on PPC)

2008-12-15 Thread Tony Parker

Hi John,

The bug you're referring to (a problem with NSSocketPort and GC)  
should be fixed in 10.5.5.


Thanks,
- Tony Parker
Cocoa Frameworks

On Dec 13, 2008, at 12:46 PM, John Pannell wrote:


Hi Bridger-

I had precisely the same issue some months ago, and wrote to this  
list.  I did get a response off-list from an Apple engineer that  
mentioned that this was a known problem and there was no workaround  
at present.  Not sure if things have changed since then (although  
perhaps they have, as I was seeing the same problem on the Intel  
side as the PPC).  I ended up returning to managing my own memory,  
as I needed the DO in the implementation I was working on.


Anyone have more recent info?

John

Positive Spin Media
http://www.positivespinmedia.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: - [NSBitmapImageRep tiffRepresentation] malloc error

2008-12-15 Thread David Duncan

On Dec 13, 2008, at 6:08 AM, Thomas Clement wrote:


Looks like this is what I need.

Now I also need to read pixel values from images on disk. For the  
same reason I'd like to avoid loading the entire image into memory.
Is it possible to access pixel values piece by piece? I can't find  
how to do that using data providers.



There isn't a direct way to do this unfortunately, as the only way to  
read from a data provider is to obtain the entire data block. Please  
file a bug requesting a solution for this.


The work around is to draw the part of the image you want to work  
with. You can do this with either AppKit or Core Graphics using  
NSBitmapImageRep or a bitmap context (created via  
CGBitmapContextCreate).

--
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: NSOutline resizing of rows

2008-12-15 Thread Corbin Dunn
- (CGFloat)outlineView:(NSOutlineView *)outlineView heightOfRowByItem: 
(id)item AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;


--corbin


On Dec 15, 2008, at 9:32 AM, Arun wrote:


Hi

How can we resize the row height for Items in the NSOuline view so  
that the

we can make a clear distincton between the groups?

-Arun


___

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

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

2008-12-15 Thread Dave

Hi,

I looked at the Man page below, I can't see anything that says  
udifrez. Is this meant for me? I'm not sure what I am supposed to  
do with it.


All the Best
Dave

On 15 Dec 2008, at 17:14, Graham Lee wrote:


On 15/12/2008 17:06, Devon Ferns dfe...@devonferns.com wrote:


This is OT for the Cocoa list now, but you can set an EULA to be
displayed when mounting a dmg.  I don't know how since I've never  
cared

to check but many apps do it so it's possible.



x-man-page://1/hdiutil

Particularly the 'udifrez' command.

Cheers,
Graham.
--
Graham Lee
Senior Macintosh Software Engineer, Sophos Plc.
+44 1235 540266
http://www.sophos.com/


Sophos Plc, The Pentagon, Abingdon Science Park, Abingdon, OX14  
3YP, United Kingdom.

Company Reg No 2096520. VAT Reg No GB 348 3873 20.
___

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

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

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


This email sent to d...@looktowindward.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: CALayer and Memory Management

2008-12-15 Thread David Duncan

On Dec 14, 2008, at 5:08 PM, Dimitri Bouniol wrote:


I'm at a loss when it comes to releasing CALayers.


Read and follow the memory management guidelines, CALayers follow them  
perfectly.
http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Tasks/MemoryManagementRules.html 



Since you can only create a layer with [CALayer layer] (docs advise  
not to use [[CALayer alloc] init])


The only advisory I'm aware of is against -initWithLayer: Could you  
point out where you saw the advisory against -init?



I would assume that the instance is automatically autoreleased.


Yes, a layer obtained via [CALayer layer] is not your responsibility  
to dispose of.


However, after looking through apple's sample code on a menu built  
with core animation, the layers were autoreleased in the dealloc  
method (this doesn't work too well if the layers aren't instance  
variables).


If you've found a bug with Apple Sample Code, then please file a bug  
report against that sample code.


Basically, here's my question: When (if ever) are you supposed to  
(auto)release CALayers?


If you follow the memory management rules, you will be fine.
--
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


View Swapping

2008-12-15 Thread Carmen Cerino Jr.
Howdy,

Are there any guides regarding when it is appropriate to use this technique?

Thanks,
Carmen
___

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

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

2008-12-15 Thread David Duncan

On Dec 15, 2008, at 3:27 AM, ramesh kakula wrote:

I am looking for the good documentation on the Open GL ES for  
iPhone, if any one have a link or doc please share.



Depending on what your really asking for http://khronos.org/opengles/1_X/ 
 might have information useful to you.

--
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: Key-bindings Dictionary Location

2008-12-15 Thread Aki Inoue
The documentation is describing the location of key binding dictionary  
the AppKit framework is using.


It's totally legal for an app to have its own key binding system (just  
like Xcode does) and store the default dictionary somewhere else.


Aki

On 2008/12/12, at 23:12, Dong Feng wrote:


Seems a lot Apple documents say that a key-bindings dictionary should
be located either 1)
/System/Library/Frameworks/AppKit.framework/Resources/ 
StandardKeyBinding.dict,

or 2) ~/Library/KeyBindings/StandardKeyBinding.dict.

However, the dictionary used by Xcode has different filename for case
2, and different location (i.e. both path and filename) for case 1. So
what's the complete rules of locating a key-bindings dictionary?
___

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

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

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

This email sent to a...@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: More - Safari Download Security Alerts

2008-12-15 Thread Philippe Devallois

On 15 déc. 08, at 18:41, Dave wrote:


Hi,

I looked at the Man page below, I can't see anything that says  
udifrez. Is this meant for me? I'm not sure what I am supposed to  
do with it.


All the Best
Dave


http://developer.apple.com/DOCUMENTATION/Darwin/Reference/ManPages/man1/hdiutil.1.html
--
philippe___

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

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

2008-12-15 Thread Mike Abdullah


On 15 Dec 2008, at 16:53, Dave wrote:



On 15 Dec 2008, at 16:31, Bill Bumgarner wrote:


On Dec 15, 2008, at 7:29 AM, Dave wrote:
I've being experimenting since I wrote the above. My installation  
consists of a folder that contains an application. I want the  
folder to be created in /Applications, however, it doesn't seem  
to let me do this. I end up with just the .app file in / 
Applications, not a folder with the app inside it as I expected.  
So, how do I get it to create a folder that contains my app file?


Why doesn't drag and drop work?


AFAIK it does work, but my boss wants to be able to display a TC  
page etc. and he wants an installer. Also it isn't a straight  
forward .app file, it's an App file that is in a folder that also  
also contains other folders/files.


Does your app *have* to be in /Applications?  If so, that means all  
the users with non-admin accounts won't be able to install the app  
(and if you require read/write to anything in that folder, they  
can't use it either-- nor can multiple users on one machine).


No, it doesn't have to be in /Applications, but this is the  
recommended place to put it if you want it to be accessible to all  
users on the machine, isn't it? If not where does it get stored?  
That's where every other app is stored and it's where it has been  
stored up until now (using the AppleScript Installer) and I haven't  
had any problems reported of people not being able to access it, or  
are you saying it won't be accessible using a PackageMaker installer?


But consider a user who ISN'T an administrator, or who wants to the  
run/install the application just for themselves, not all people.  
They'd want to place your application somewhere else. e.g. ~/ 
Applications/
Drag and drop gives them the freedom to choose. (On a personal note, I  
like to test applications from within the DMG before installing if  
possible too).


With a TC page, you could also make that part of your app and display  
it on the first launch.


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


Re: More - Safari Download Security Alerts

2008-12-15 Thread Bill Bumgarner

On Dec 15, 2008, at 8:53 AM, Dave wrote:

Why doesn't drag and drop work?


AFAIK it does work, but my boss wants to be able to display a TC  
page etc. and he wants an installer. Also it isn't a straight  
forward .app file, it's an App file that is in a folder that also  
also contains other folders/files.


As others have indicated, a TC page on mounting of the DMG is likely  
easier.


Does your app *have* to be in /Applications?  If so, that means all  
the users with non-admin accounts won't be able to install the app  
(and if you require read/write to anything in that folder, they  
can't use it either-- nor can multiple users on one machine).


No, it doesn't have to be in /Applications, but this is the  
recommended place to put it if you want it to be accessible to all  
users on the machine, isn't it? If not where does it get stored?  
That's where every other app is stored and it's where it has been  
stored up until now (using the AppleScript Installer) and I haven't  
had any problems reported of people not being able to access it, or  
are you saying it won't be accessible using a PackageMaker installer?


(This is actually on topic for Cocoa...)

/Applications is fine if you want the application to be accessible to  
all users on the machine.  The issues are:


(1) Your application should not write any user-specific data anywhere  
within /Applications (including inside the .app wrapper obviously).
That is, /Applications should be treated as read-only beyond initial  
installation (many advanced users -- myself included -- run with their  
primary account not having administrator rights.)


(2) Non-administrative users would not be able to install your  
application, if it is required to be in /Applications (which it  
doesn't sound like it is).   Drag-n-drop is easier for non-admin users  
to deal with.


b.bum

___

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

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

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

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


Re: NSOutline resizing of rows

2008-12-15 Thread Arun
Hi,

Thanks for the sugussion..it worked for me.
Is there any way in which we can add an empty row at the end of each group?

-Arun

On Mon, Dec 15, 2008 at 11:10 PM, Corbin Dunn corb...@apple.com wrote:

 - (CGFloat)outlineView:(NSOutlineView *)outlineView
 heightOfRowByItem:(id)item AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;

 --corbin



 On Dec 15, 2008, at 9:32 AM, Arun wrote:

  Hi

 How can we resize the row height for Items in the NSOuline view so that
 the
 we can make a clear distincton between the groups?

 -Arun



___

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

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


NSOutline : NSTableViewSelectionHighlightStyleSourceList

2008-12-15 Thread Arun
Hi,

I noticed that NSTableViewSelectionHighlightStyleSourceList will only work
in Leopard onwards.
What is the equivalent in tiger?

-Arun
___

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

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

2008-12-15 Thread Jean-Daniel Dupas


Le 15 déc. 08 à 18:49, Carmen Cerino Jr. a écrit :


Howdy,

Are there any guides regarding when it is appropriate to use this  
technique?


Thanks,
Carmen


Generaly people prefere to use tabless tabview.


___

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

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

2008-12-15 Thread Jean-Daniel Dupas


Le 15 déc. 08 à 19:04, Bill Bumgarner a écrit :


On Dec 15, 2008, at 8:53 AM, Dave wrote:

Why doesn't drag and drop work?


AFAIK it does work, but my boss wants to be able to display a TC  
page etc. and he wants an installer. Also it isn't a straight  
forward .app file, it's an App file that is in a folder that also  
also contains other folders/files.


As others have indicated, a TC page on mounting of the DMG is  
likely easier.




Just to give an pointer about this:

http://developer.apple.com/documentation/developertools/conceptual/SoftwareDistribution/Containers/chapter_3_section_4.html


___

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

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

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

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


Re: More - Safari Download Security Alerts

2008-12-15 Thread Dave


On 15 Dec 2008, at 17:59, Mike Abdullah wrote:



On 15 Dec 2008, at 16:53, Dave wrote:



On 15 Dec 2008, at 16:31, Bill Bumgarner wrote:


On Dec 15, 2008, at 7:29 AM, Dave wrote:
I've being experimenting since I wrote the above. My  
installation consists of a folder that contains an application.  
I want the folder to be created in /Applications, however, it  
doesn't seem to let me do this. I end up with just the .app file  
in /Applications, not a folder with the app inside it as I  
expected. So, how do I get it to create a folder that contains  
my app file?


Why doesn't drag and drop work?


AFAIK it does work, but my boss wants to be able to display a  
TC page etc. and he wants an installer. Also it isn't a  
straight forward .app file, it's an App file that is in a folder  
that also also contains other folders/files.


Does your app *have* to be in /Applications?  If so, that means  
all the users with non-admin accounts won't be able to install  
the app (and if you require read/write to anything in that  
folder, they can't use it either-- nor can multiple users on one  
machine).


No, it doesn't have to be in /Applications, but this is the  
recommended place to put it if you want it to be accessible to all  
users on the machine, isn't it? If not where does it get stored?  
That's where every other app is stored and it's where it has been  
stored up until now (using the AppleScript Installer) and I  
haven't had any problems reported of people not being able to  
access it, or are you saying it won't be accessible using a  
PackageMaker installer?


But consider a user who ISN'T an administrator, or who wants to the  
run/install the application just for themselves, not all people.  
They'd want to place your application somewhere else. e.g. ~/ 
Applications/
Drag and drop gives them the freedom to choose. (On a personal  
note, I like to test applications from within the DMG before  
installing if possible too).


With a TC page, you could also make that part of your app and  
display it on the first launch.


But that isn't the requirement, we just want it installed in / 
Applications and accessible to all users, that's it!


All the Best
Dave


___

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

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

2008-12-15 Thread Dave


On 15 Dec 2008, at 18:04, Bill Bumgarner wrote:


On Dec 15, 2008, at 8:53 AM, Dave wrote:

Why doesn't drag and drop work?


AFAIK it does work, but my boss wants to be able to display a  
TC page etc. and he wants an installer. Also it isn't a  
straight forward .app file, it's an App file that is in a folder  
that also also contains other folders/files.


As others have indicated, a TC page on mounting of the DMG is  
likely easier.


Does your app *have* to be in /Applications?  If so, that means  
all the users with non-admin accounts won't be able to install  
the app (and if you require read/write to anything in that  
folder, they can't use it either-- nor can multiple users on one  
machine).


No, it doesn't have to be in /Applications, but this is the  
recommended place to put it if you want it to be accessible to all  
users on the machine, isn't it? If not where does it get stored?  
That's where every other app is stored and it's where it has been  
stored up until now (using the AppleScript Installer) and I  
haven't had any problems reported of people not being able to  
access it, or are you saying it won't be accessible using a  
PackageMaker installer?


(This is actually on topic for Cocoa...)

/Applications is fine if you want the application to be accessible  
to all users on the machine.  The issues are:


(1) Your application should not write any user-specific data  
anywhere within /Applications (including inside the .app wrapper  
obviously).   That is, /Applications should be treated as read-only  
beyond initial installation (many advanced users -- myself included  
-- run with their primary account not having administrator rights.)


It doesn't write any user specific data within /Applications, any  
files it does create and in the current users home folder, in a  
folder for the Application.




(2) Non-administrative users would not be able to install your  
application, if it is required to be in /Applications (which it  
doesn't sound like it is).   Drag-n-drop is easier for non-admin  
users to deal with.


Only admin's are required to install the App.

All the Best
Dave


___

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

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


Manual Core Data schema migration in -[NSPersistentDocument configurePersistentStoreCoordinatorForURL:ofType:...] without document changed error?

2008-12-15 Thread Barry Wark
The data model for my Core Data document-based app (10.5 only) is in a
framework, so automatic schema upgrades using a Core Data mapping
model don't appear to work. It appears that the Core Data machinery
doesn't find the appropriate data models or mapping model when they
are not in the app's main bundle. So, instead of using the automatic
migration, I'm running a migration manually in
configurePersistentStoreCoordinatorForURL:ofType:... in my
NSPersistenDocument subclass (code below). I migrate the persistent
store to a temporary file and then overwrite the existing file if the
migration succeeds. The document then presents an error with the
message This document's file has been changed by another application
since you opened or saved it. when I try to save. As others on this
list have pointed out, this is due to my modification of the
document's file behind its back. I tried updating the document's
file modification date, as shown below, but I then get an error dialog
with the message The location of the document test.ovproj cannot be
determined. when I try to save. I'm less sure of the reason for this
error, but trading one unnecessary message (in this case) for an other
isn't quite what I was going for.

Can anyone offer some guidance? Is there a way to manually upgrade the
schema for a document's persistent store without triggering one of
these (in _this_ case unnecessary) warnings?

thanks,
Barry


code for upgrading the data store in my subclasses
-configurePersistentStoreCoordinatorForURL:ofType:... :

if(upgradeNeeded) {
NSManagedObjectModel *sourceModel = [NSManagedObjectModel
mergedModelFromBundles:VUIModelBundles()

 forStoreMetadata:meta];

if(sourceModel == nil) {
*error = [NSError errorWithDomain:VUIErrorDomain
code:VUICoreDataErrorCode localizedReason:BWLocalizedString(@Unable
to find original data model for project.)];
return NO;
}

NSManagedObjectModel *destinationModel = [self managedObjectModel];

NSMigrationManager *migrationManager =
[[NSMigrationManager alloc] initWithSourceModel:sourceModel
destinationModel:destinationModel];
NSMappingModel *mappingModel = [NSMappingModel
mappingModelFromBundles:VUIModelBundles()

forSourceModel:sourceModel

destinationModel:destinationModel];
if(mappingModel == nil) {
*error = [NSError errorWithDomain:VUIErrorDomain
code:VUICoreDataErrorCode localizedReason:BWLocalizedString(@Unable
to find mapping model to convert project to most recent project
format.)];
return NO;
}

@try {
//move file to backup
NSAssert([url isFileURL], @store url is not a file URL);

NSString *tmpPath = [NSString tempFilePath];
id storeType = [meta objectForKey:NSStoreTypeKey];
if(![migrationManager migrateStoreFromURL:url
 type:storeType
  options:storeOptions
 withMappingModel:mappingModel
 toDestinationURL:[NSURL
fileURLWithPath:tmpPath]
  destinationType:storeType
   destinationOptions:storeOptions
error:error]) {

return NO;
} else {
//replace old with new
if(![[NSFileManager defaultManager]
removeItemAtPath:[url path] error:error] ||
   ![[NSFileManager defaultManager]
moveItemAtPath:tmpPath toPath:[url path] error:error]) {
return NO;
}

// update document file modification date to
prevent warning (#292)
NSDate *newModificationDate = [[[NSFileManager
defaultManager] fileAttributesAtPath:[url path] traverseLink:NO]
objectForKey:NSFileModificationDate];
[self setFileModificationDate:newModificationDate];
}
}
@finally {
[migrationManager release];
}
}
}

return [super configurePersistentStoreCoordinatorForURL:url
ofType:fileType modelConfiguration:configuration
storeOptions:storeOptions error:error];
___

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

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

2008-12-15 Thread Clark Cox
On Mon, Dec 15, 2008 at 7:52 AM, Benjamin Dobson
importedfromsp...@googlemail.com wrote:
 The image is already in Cocoa, named NSComputer.

Don't use that name directly in your code, it's best to use the named
constant: NSImageNameComputer.

-- 
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: NSOutline resizing of rows

2008-12-15 Thread Corbin Dunn
Your datasource would have to return that; it is up to your model to  
do this. Or, return a large row height for the last item in your  
group, and override -frameOfCellAtColumn:row: and return a smaller row  
for the cell to draw in.


-corbin

On Dec 15, 2008, at 10:05 AM, Arun wrote:


Hi,

Thanks for the sugussion..it worked for me.
Is there any way in which we can add an empty row at the end of each  
group?


-Arun

On Mon, Dec 15, 2008 at 11:10 PM, Corbin Dunn corb...@apple.com  
wrote:
- (CGFloat)outlineView:(NSOutlineView *)outlineView  
heightOfRowByItem:(id)item AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;


--corbin



On Dec 15, 2008, at 9:32 AM, Arun wrote:

Hi

How can we resize the row height for Items in the NSOuline view so  
that the

we can make a clear distincton between the groups?

-Arun




___

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

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

2008-12-15 Thread Corbin Dunn


On Dec 15, 2008, at 10:10 AM, Arun wrote:


Hi,

I noticed that NSTableViewSelectionHighlightStyleSourceList will  
only work

in Leopard onwards.
What is the equivalent in tiger?


There is none; you would have to implement it by hand.

corbin


___

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

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

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

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


What is the default type for an integer literal (as relates to its use in NSLog)?

2008-12-15 Thread Stuart Malin
I am trying to be 32/64 bit clean in some new code that I am  
writing. When I declare some integer values, say for named option  
values as shown here, what is the type that the compiler assigns to  
these values?


enum {
SomeOptionValue = 1,
AnotherOptionValue  = 2,
};

The type matters to the construction of an NSLog statement. If the  
type is NSInteger, then it seems the best way (for 32/64 bit  
compatibility) to display its value is:


NSLog(@SomeOptionValue = %ld, (long) SomeOptionValue);

Or so I conclude from reading:
[1] String Format Specifiers
http://developer.apple.com/documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html

[2] 64-Bit Transition Guide: Type Specifiers
http://developer.apple.com/documentation/Cocoa/Conceptual/Cocoa64BitGuide/ConvertingExistingApp/chapter_4_section_3.html

Separately, from a space efficiency perspective, would it be better in  
the case of having a small set of option values to force the type to  
be an unsigned int? That is, if I have a method that takes such an  
option, which of the following method signatures is nowadays preferred?


- (void) someMethodWithOption:(unsigned int)optionValue;

- (void) someMethodWithOption:(NSInteger)optionValue;






___

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

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

2008-12-15 Thread douglas welton

Hi Carmen,

your questions is kinda non-specific...  a non-specific answer might  
be that NSViewController might be of some help to you.


A more specific answer might be forthcoming if you could elaborate on  
what you mean by view swapping.  Are you talking about swapping views  
between windows?  Are you talking about a geometry swapping where, for  
example, the subviews within a split view change places?  Are the  
swapped views the same size or different?  etc...


regards,

douglas


On Dec 15, 2008, at 12:49 PM, Carmen Cerino Jr. wrote:


Howdy,

Are there any guides regarding when it is appropriate to use this  
technique?


Thanks,
Carmen

___

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

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

2008-12-15 Thread Michael Ash
On Mon, Dec 15, 2008 at 1:35 PM, Clark Cox clarkc...@gmail.com wrote:
 On Mon, Dec 15, 2008 at 7:52 AM, Benjamin Dobson
 importedfromsp...@googlemail.com wrote:
 The image is already in Cocoa, named NSComputer.

 Don't use that name directly in your code, it's best to use the named
 constant: NSImageNameComputer.

Note that in this case, the major reason to use the constant is not
present: The constant is guaranteed to resolve to @NSComputer, so
it's safe to use it that way. (This is done so that these images can
be used in nibs. Without guaranteed names you'd have to set them up in
code later.)

This guarantee does not apply to string constants in general, of
course! These NSImage constants are specifically guaranteed in the
docs. Other constants aren't, so if you look up what they point to and
use that string directly, you could break at any time!

Of course you're still correct that it's best to use the constant in
your code, simply because it's less typo-prone and works better with
various code editing tools. I just wanted to point out that it's not a
compatibility issue the way it is with others.

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


Re: What is the default type for an integer literal (as relates to its use in NSLog)?

2008-12-15 Thread Michael Ash
On Mon, Dec 15, 2008 at 2:35 PM, Stuart Malin stu...@zhameesha.com wrote:
 I am trying to be 32/64 bit clean in some new code that I am writing. When
 I declare some integer values, say for named option values as shown here,
 what is the type that the compiler assigns to these values?

 enum {
SomeOptionValue = 1,
AnotherOptionValue  = 2,
 };

From reading the summaries in a google search for c enum type, it
would appear that they are of type int.

 Separately, from a space efficiency perspective, would it be better in the
 case of having a small set of option values to force the type to be an
 unsigned int? That is, if I have a method that takes such an option, which
 of the following method signatures is nowadays preferred?

 - (void) someMethodWithOption:(unsigned int)optionValue;

 - (void) someMethodWithOption:(NSInteger)optionValue;

From a space efficiency perspective it's completely irrelevant. Larger
parameters take up at worst very little space, and may take up none at
all depending on your architecture's alignment and minimum size
policies.

If you follow Apple's lead on this, they use typedefs to NSInteger for
enumerators.

Personally I prefer to use the enum itself, or a typedef of it. This
provides additional information about the type to the compiler and the
debugger which allow the former to produce more useful diagnostics and
the latter to produce more useful output.

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


Re: What is the default type for an integer literal (as relates to its use in NSLog)?

2008-12-15 Thread Nick Zitzmann


On Dec 15, 2008, at 12:35 PM, Stuart Malin wrote:

I am trying to be 32/64 bit clean in some new code that I am  
writing. When I declare some integer values, say for named option  
values as shown here, what is the type that the compiler assigns to  
these values?


enum {
SomeOptionValue = 1,
AnotherOptionValue  = 2,
};



Enums are 32-bit constant integers by default. Typedef enums are 32- 
bit variable integers. This has not changed in the transition, mainly  
because it says in the ANSI C spec that they are the same size as int.  
Apple worked around this by making the old typedef enums in the Tiger  
SDK into typedef NSIntegers.


Separately, from a space efficiency perspective, would it be better  
in the case of having a small set of option values to force the type  
to be an unsigned int? That is, if I have a method that takes such  
an option, which of the following method signatures is nowadays  
preferred?


- (void) someMethodWithOption:(unsigned int)optionValue;

- (void) someMethodWithOption:(NSInteger)optionValue;


Neither. :) You should instead use:

- (void)someMethodWithOption:(NSUInteger)optionValue;

Note the U in NSUInteger means unsigned. But you should not use  
unsigned int anymore, because it will truncate 64-bit integers, which  
may lead to problems. For example, if you're working with the return  
value of -[NSArray indexOfObject:], the value of NSNotFound changed  
between 32-bit and 64-bit, and your code needs to be ready for this.


(Oh, and if you require an argument that is guaranteed to be no larger  
than 32 bits in size, then you should use u_int32_t, not unsigned int.)


I'd suggest turning on the implicit 64-to-32 conversion warning, then  
build. That will tell you where there may be trouble.


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

___

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

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

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

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


Re: What is the default type for an integer literal (as relates to its use in NSLog)?

2008-12-15 Thread Stuart Malin

On Dec 15, 2008, at 10:00 AM, Nick Zitzmann wrote:





On Dec 15, 2008, at 12:35 PM, Stuart Malin wrote:

I am trying to be 32/64 bit clean in some new code that I am  
writing. When I declare some integer values, say for named option  
values as shown here, what is the type that the compiler assigns to  
these values?


enum {
SomeOptionValue = 1,
AnotherOptionValue  = 2,
};



Enums are 32-bit constant integers by default. Typedef enums are 32- 
bit variable integers. This has not changed in the transition,  
mainly because it says in the ANSI C spec that they are the same  
size as int. Apple worked around this by making the old typedef  
enums in the Tiger SDK into typedef NSIntegers.




Separately, from a space efficiency perspective, would it be better  
in the case of having a small set of option values to force the  
type to be an unsigned int? That is, if I have a method that takes  
such an option, which of the following method signatures is  
nowadays preferred?


- (void) someMethodWithOption:(unsigned int)optionValue;

- (void) someMethodWithOption:(NSInteger)optionValue;


Neither. :) You should instead use:

- (void)someMethodWithOption:(NSUInteger)optionValue;


duh!  I mixed apples (unsigned) and oranges (integers). My bad.

Note the U in NSUInteger means unsigned. But you should not use  
unsigned int anymore, because it will truncate 64-bit integers,  
which may lead to problems. For example, if you're working with the  
return value of -[NSArray indexOfObject:], the value of NSNotFound  
changed between 32-bit and 64-bit, and your code needs to be ready  
for this.


(Oh, and if you require an argument that is guaranteed to be no  
larger than 32 bits in size, then you should use u_int32_t, not  
unsigned int.)


I'd suggest turning on the implicit 64-to-32 conversion warning,  
then build. That will tell you where there may be trouble.


Thanks for this tip.
I have set GCC_WAR_64_TO_32_BIT_CONVERSION to YES.



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


Furthering along the path of getting this right:

If I want to use typedef so that I can enforce the type supplied to a  
method, I can declare the option values as:


typedef enum {
SomeOptionValue   = 1,
AnotherOptionValue = 2
} MyOptionValue;

and define a method that takes the option as a parameter

- (void) someMethodWithOption:(MyOptionValue)optionVlaue;

Question: Should I force MyOptionValue to be an NSUInteger? If so, how  
would I achieve that? (Sorry, my C is weak).


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: What is the default type for an integer literal (as relates to its use in NSLog)?

2008-12-15 Thread Nick Zitzmann


On Dec 15, 2008, at 1:39 PM, Stuart Malin wrote:


and define a method that takes the option as a parameter

- (void) someMethodWithOption:(MyOptionValue)optionVlaue;

Question: Should I force MyOptionValue to be an NSUInteger? If so,  
how would I achieve that? (Sorry, my C is weak).



It depends. On one hand, I see no reason not to just keep that 32-bit  
(unless you have a very good reason), but if you do so, and you pass  
in, say, menu tags, then you'll have to cast the return value or else  
that warning I mentioned earlier will sound. OTOH, you won't have to  
cast anything if you make it an NSInteger typedef, but you do lose the  
warning that would normally appear if not all cases are handled in a  
switch. So which is more important to you?


If you want to make an NS(U)Integer typedef, then you do what Apple  
does:


enum
{
YOBlahBlah = 0,
YOBlahBlah2
};
typedef NSUInteger YourOptions;

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

___

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

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

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

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


Re: What is the default type for an integer literal (as relates to its use in NSLog)?

2008-12-15 Thread Stuart Malin


On Dec 15, 2008, at 10:50 AM, Nick Zitzmann wrote:


On Dec 15, 2008, at 1:39 PM, Stuart Malin wrote:


and define a method that takes the option as a parameter

- (void) someMethodWithOption:(MyOptionValue)optionVlaue;

Question: Should I force MyOptionValue to be an NSUInteger? If so,  
how would I achieve that? (Sorry, my C is weak).



It depends. On one hand, I see no reason not to just keep that 32- 
bit (unless you have a very good reason), but if you do so, and you  
pass in, say, menu tags, then you'll have to cast the return value  
or else that warning I mentioned earlier will sound. OTOH, you won't  
have to cast anything if you make it an NSInteger typedef, but you  
do lose the warning that would normally appear if not all cases are  
handled in a switch. So which is more important to you?


If you want to make an NS(U)Integer typedef, then you do what Apple  
does:


enum
{
YOBlahBlah = 0,
YOBlahBlah2
};
typedef NSUInteger YourOptions;


Yes, but then I lose the compile-time enforcement that only defined  
values are supplied (as is achieved with typedef enum).  So, as you  
suggest, I see no reason not to leave as 32-bit. Yet Apple doesn't...  
is there an advantage to their approach (other than the type being  
unsigned)?


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: What is the default type for an integer literal (as relates to its use in NSLog)?

2008-12-15 Thread Nick Zitzmann


On Dec 15, 2008, at 2:06 PM, Stuart Malin wrote:

Yes, but then I lose the compile-time enforcement that only defined  
values are supplied (as is achieved with typedef enum).  So, as you  
suggest, I see no reason not to leave as 32-bit. Yet Apple  
doesn't... is there an advantage to their approach (other than the  
type being unsigned)?



There is, but only if you're making a framework (or several) that has  
to stand the test of time. Some of the enums, particularly bit masks,  
may need more space in the future as new features are added to the OS,  
in which case having it 64-bit up front on 64-bit operating systems  
preserves compatibility. If you look at the NSEvent masks, it looks  
like they're almost there...


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

___

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

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

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

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


NSURLConnection NSInputStream issue

2008-12-15 Thread David LeBer

Hello all,

I have a requirement where I need to send a chunked file (about 2MB at  
a time) to a server. Each chunk is embedded as a base64 encoded string  
in the body of an HTML POST request.


I'm working on a proof of concept dev spike and I've got this code  
which fails:


- (void) callUploadAssetChunk
{
   NSString *contentString = [[NSString alloc]  
initWithFormat:@contactInfoXML=%@mediaValueID=%@hash=%@chunkIndex= 
%dchunk=%@,

  [self contactInfoXML],
  [[self currentAsset] mediaValueId],
  [[[self currentAsset]  
currentUploadChunk] chunkHash],
  [[[self currentAsset]  
currentUploadChunk] chunkIndex],
  [[[self currentAsset]  
currentUploadChunk] encodedChunkData]];


   NSData *contentData = [ NSData dataWithBytes: [ contentString  
UTF8String ] length: [ contentString length ] ];


   NSString *path = [NSString stringWithFormat:@%@/ 
UploadAssetChunk, kWebMethodsFull];


   NSURL *url = [[NSURL alloc] initWithScheme:kURLScheme host: 
[uploadUrl stringValue] path:path];


   NSMutableURLRequest *request = [[NSMutableURLRequest alloc]  
initWithURL:url];


   [request setHTTPMethod: @POST];

   NSInputStream *dataStream = [NSInputStream  
inputStreamWithData:contentData];


   [request setHTTPBodyStream:dataStream];

   [self setChunkUploadConnection:[NSURLConnection  
connectionWithRequest:request delegate:self]];


   [url release];
   [request release];
}

In looking at the wire, I see the HTTP headers go by, but there is no  
body content. If I bypass the NSInputStream with the NSData and replace:


[request setHTTPBodyStream:dataStream];

With:

[request setHTTPBody:contentData];

Everything works fine.

I am testing with an NSInputStream because I'd like to be able to  
query it to get an upload progress for the user. So, it looks like I  
am either misreading the NSURL* API (possible) or missing something  
obvious in creating the NSInputStream (also possible). If anyone has  
any suggestions, I'd love to hear it.


It is so frustratingly close. If it weren't for those darn needy users  
and their dislike of not knowing what was going on, I'd be done now :-)


;david

--
David LeBer
Codeferous Software
'co-def-er-ous' adj. Literally 'code-bearing'
site:   http://codeferous.com
blog:   http://davidleber.net
profile:http://www.linkedin.com/in/davidleber
twitter:http://twitter.com/rebeld
--
Toronto Area Cocoa / WebObjects developers group:
http://tacow.org




;david

--
David LeBer
Codeferous Software
'co-def-er-ous' adj. Literally 'code-bearing'
site:   http://codeferous.com
blog:   http://davidleber.net
profile:http://www.linkedin.com/in/davidleber
twitter:http://twitter.com/rebeld
--
Toronto Area Cocoa / WebObjects developers group:
http://tacow.org




___

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

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


Double KVO notification

2008-12-15 Thread Randall Meadows
I'm trying to track down (in a project I inherited, not wrote) why a  
KVO notification is being sent twice.  The reason I care is because,  
the table contains a variety of types of data, and for one particular  
type of data I need to do something special when it is selected, and  
then revert that when any other type of data is selected, and this  
double-notification is screwing things up.


Here's the stack trace:

-[CLController observeValueForKeyPath:ofObject:change:context:] at  
CLController.m:448

NSKVONotify
-[NSObject(NSKeyValueObservingPrivate)  
_notifyObserversForKeyPath:change:]

-[NSController _notifyObserversForKeyPath:change:]
-[NSController didChangeValueForKey:]
-[NSTreeController  
_didChangeValuesForArrangedKeys:objectKeys:indexPathKeys:]
-[NSTreeController  
_selectObjectsAtIndexPathsNoCopy:avoidsEmptySelection:sendObserverNotifications 
:]
-[NSTreeController  
_selectObjectsAtIndexPaths:avoidsEmptySelection:sendObserverNotifications 
:]

-[NSTreeController setSelectionIndexPaths:]
-[NSObject(NSKeyValueCoding) setValue:forKey:]
-[NSObject(NSKeyValueCoding) setValue:forKeyPath:]
-[NSBinder  
_setValue:forKeyPath:ofObject:mode:validateImmediately:raisesForNotApplicableKeys:error 
:]

-[NSBinder setValue:forBinding:error:]
-[NSOutlineViewBinder tableView:didChangeToSelectedRowIndexes:]
-[_NSBindingAdaptor tableView:didChangeToSelectedRowIndexes:]
-[NSTableView _enableSelectionPostingAndPost]
-[NSTableView mouseDown:]
-[NSOutlineView mouseDown:]
-[NSWindow sendEvent:]
-[NSApplication sendEvent:]
-[NSApplication run]
NSApplicationMain
main at main.m:13

Notice my code only shows up at the last call, in response to the  
notification; the keyPath for each notification is the same.


Can anyone give me any tips on how to track down why this notification  
is being sent twice?


Thanks!
randy
___

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

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

2008-12-15 Thread David Duncan

On Dec 15, 2008, at 12:47 PM, Thomas Clement wrote:

The work around is to draw the part of the image you want to work  
with. You can do this with either AppKit or Core Graphics using  
NSBitmapImageRep or a bitmap context (created via  
CGBitmapContextCreate).


Alright but how am I suppose to draw a part of the image without  
loading the whole image from disk first?
Creating a NSBitmapImageRep requires creating a NSData with the  
whole image.
I tried using CGBitmapContextCreate but I got a malloc error again  
when calling CGContextDrawImage (passing a small rect to draw).



If you use the bitmap context method, then you create a context that  
is the size of the image data that you want (so if you want a 20x20  
section of the image, you create a 20x20 context) then draw the whole  
image to it. If you use ImageIO to load the image, then it will only  
load portion of the image required to draw that area. In order to get  
the correct part of the image, you would need to translate the context  
(via CGContextTranslateCTM for example) to position the image correctly.


I think this is described (perhaps not in total) in the Quartz 2D  
Programming Guide http://developer.apple.com/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_intro/chapter_1_section_1.html 
 so you should have a look there.

--
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: Docs on Open GL ES

2008-12-15 Thread Toporek, Chuck
If you're looking for a book on OpenGL ES, there's always this:

  - OpenGL ES 2.0 Programming Guide
http://tinyurl.com/63nlax (link to Amazon.com)

It isn't specific to iPhone development, but should give you a good handle
on what's there.

Chuck


On 12/15/08 6:27 AM, ramesh kakula ramesh.kak...@prithvisolutions.com
wrote:

 
 Hi,
 
 I am looking for the good documentation on the Open GL ES for iPhone,
 if any one have a link or doc please share.
 
 Thanks
 Ramesh.
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/chuck.toporek%40pearson.com
 
 This email sent to chuck.topo...@pearson.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: Double KVO notification

2008-12-15 Thread Ken Thomases

On Dec 15, 2008, at 3:48 PM, Randall Meadows wrote:

I'm trying to track down (in a project I inherited, not wrote) why a  
KVO notification is being sent twice.  The reason I care is because,  
the table contains a variety of types of data, and for one  
particular type of data I need to do something special when it is  
selected, and then revert that when any other type of data is  
selected, and this double-notification is screwing things up.


You can't use KVO that way.  There's no way to guarantee you don't get  
double notifications.


Use the table view delegate methods to keep track of the selection,  
although even then you'll have to tolerate being informed more than  
once of a given selection being made.


Regards,
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


CoreData mystery: configuration used to open the store is incompatible...

2008-12-15 Thread Houdah - ML Pierre Bernard

Hi!

I am puzzled! I have run into this weirdest problem. It only happens  
if I target Tiger.


I am working on an update to HoudahGeo and suddenly, my current build  
refuses to open documents. This includes both existing documents and  
documents created by the running application. The error is:


Error Domain=NSCocoaErrorDomain Code=134020 UserInfo=0x2b7b10 The  
model configuration used to open the store is incompatible with the  
one that was used to create the store.
NSUnderlyingException = Can't find table for entity MovieReference in  
database at URL file://localhost/Users/pierre/Desktop/HoudahGeo-Leopard.hgeo 
;


There is no MovieReference entity in the model. There never was.  
Actually I have seen the same message with varying entity names. I  
believe they are taken from other applications.


BTW, the model has not been updated in over a year. And most certainly  
not between saving and attempting to reopen using the same running  
application.


The stack is:

#0  0x96da7e17 in objc_exception_throw
#1  0x9496344b in -[NSSQLCore _ensureDatabaseMatchesModel]
#2  0x94962b35 in -[NSSQLCore load:]
#3	0x94958732 in -[NSPersistentStoreCoordinator  
addPersistentStoreWithType:configuration:URL:options:error:]
#4	0x915f5fe9 in -[NSPersistentDocument  
configurePersistentStoreCoordinatorForURL:ofType:modelConfiguration:storeOptions:error 
:]
#5	0x915f6fab in - 
[NSPersistentDocument(NSPersistentDocumentDeprecated)  
configurePersistentStoreCoordinatorForURL:ofType:error:]

#6  0x915f63b6 in -[NSPersistentDocument readFromURL:ofType:error:]
#7  0x41c2 in -[Document readFromURL:ofType:error:] at Document.m:177
#8  0x913f16c6 in -[NSDocument initWithContentsOfURL:ofType:error:]
#9	0x913c1274 in -[NSDocumentController  
makeDocumentWithContentsOfURL:ofType:error:]
#10	0x913c0898 in -[NSDocumentController  
openDocumentWithContentsOfURL:display:error:]



This only happens when I target Tiger. When I target Leopard with the  
same code all works fine.

It occurs on both 10.5.5 and 10.5.6

When I compile an older version of the project, it works just fine.  
Thus I broke something with my recent changes. Yet I have no idea  
what. I did not touch the model.


Pierre
___

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

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


proper way to release a static NSMutableDictionary?

2008-12-15 Thread John Michael Zorko


Hello, all ...

Imagine this:

static NSMutableDictionary *lookup = [NSMutableDictionary new];

... now imagine a situation where I need to clear that dictionary.  If  
I call


[lookup release];
lookup = [NSMutableDictionary new];

... it will obviously be faster than coding a for loop and removing  
each object in the dictionary, but since it was declared as static,  
which is safer?


Regards,

John

Falling You - exploring the beauty of voice and sound
http://www.fallingyou.com




___

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

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

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

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


RE: NSFilenamesPboardType for copy/paste and not just drag drop

2008-12-15 Thread Ling Li
I have exactly same issue :) With my testing code, I am pretty sure that Finder 
supports promised
Drag/drop, but does not support promised file copy/paste. With 
NSFilenamePboardType, Finder
should be able to do copy/paste. Did you call  [pboard 
setPropertyList:forType:] after put data
into pasteboard? Can you paste your code here?

 -Original Message-
 From: cocoa-dev-bounces+lingli=vmware@lists.apple.com 
 [mailto:cocoa-dev-bounces+lingli=vmware@lists.apple.com] 
 On Behalf Of Cocoa Dummy
 Sent: Friday, December 12, 2008 8:15 PM
 To: cocoa-dev@lists.apple.com
 Subject: NSFilenamesPboardType for copy/paste and not just drag drop
 
 Hello, I am attempting to implement a Copy from my 
 application for files
 on a remote server that are displayed in a listview.  This is 
 an ftp type client.  I cannot seem to implement these file 
 copies from my app to where you can paste them in finder, 
 though similar attempts work for drag/drop.
  I initialliy tried NSFilesPromisePboardType as the type 
 for the pasteboard, which would be ideal, but I could not get 
 it to work.  I then tried NSFilenamesPboardType; Paste 
 would not show up in finder menus, but I could paste the 
 filenames into TextEdit. These both work for drag/drop.
 Are they not supported for copy/paste operations?
 
 
 Thanks,
 Sean
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/lingli%40vmware.com
 
 This email sent to lin...@vmware.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: proper way to release a static NSMutableDictionary?

2008-12-15 Thread Randall Meadows


On Dec 15, 2008, at 3:54 PM, John Michael Zorko wrote:



Hello, all ...

Imagine this:

static NSMutableDictionary *lookup = [NSMutableDictionary new];

... now imagine a situation where I need to clear that dictionary.


[lookup removeAllObjects];

is probably your best choice.


If I call

[lookup release];
lookup = [NSMutableDictionary new];

... it will obviously be faster than coding a for loop and removing  
each object in the dictionary,


Maybe marginally; that release is going to cause a -release to be sent  
to every object in the dictionary anyway, although Apple's  
implementation is likely optimized.


My suggestion above prevents another object creation.


but since it was declared as static, which is safer?


I don't think safety matters either way, in this case.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: proper way to release a static NSMutableDictionary?

2008-12-15 Thread Ashley Clark

On Dec 15, 2008, at 4:54 PM, John Michael Zorko wrote:


Hello, all ...

Imagine this:

static NSMutableDictionary *lookup = [NSMutableDictionary new];

... now imagine a situation where I need to clear that dictionary.   
If I call


[lookup release];
lookup = [NSMutableDictionary new];

... it will obviously be faster than coding a for loop and removing  
each object in the dictionary, but since it was declared as static,  
which is safer?


As long as you are not retaining the objects referenced in the  
dictionary elsewhere, then when the dictionary is deallocated, all of  
its' referenced objects will be released. Whether the dictionary was  
declared static or not does not affect its' contents.


I don't know of any reason to ever iterate over a dictionary removing  
its' elements before you release it unless you are intending on saving  
copies of those elements elsewhere.



Ashley
___

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

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

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

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


Re: proper way to release a static NSMutableDictionary?

2008-12-15 Thread Charles Steinman
- Original Message 
 From: John Michael Zorko jmzo...@mac.com
 To: cocoa-dev@lists.apple.com
 Sent: Monday, December 15, 2008 2:54:46 PM
 Subject: proper way to release a static NSMutableDictionary?
 
 
 Hello, all ...
 
 Imagine this:
 
 static NSMutableDictionary *lookup = [NSMutableDictionary new];
 
 ... now imagine a situation where I need to clear that dictionary.  If I call
 
 [lookup release];
 lookup = [NSMutableDictionary new];
 
 ... it will obviously be faster than coding a for loop and removing each 
 object 
 in the dictionary, but since it was declared as static, which is safer?


I don't see what being declared static has to do with it. As long as multiple 
threads don't touch the variable and nothing caches the value, both ways are 
equally safe. Otherwise, neither way is necessarily safe. Of course, if you 
want to clear the dictionary, it seems simplest just to do [lookup 
removeAllObjects].

Cheers,
Chuck


  
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: CoreData mystery: configuration used to open the store is incompatible...

2008-12-15 Thread Melissa J. Turner
There was a change between Tiger and Leopard in the way  
NSPersistentDocument loaded its model.


If you have a document created on Tiger, the model is created using  
[NSManagedObjectModel mergedModelFromBundles: [NSBundle allBundles]],  
and on Leopard, with [NSManagedObjectModel mergedModelFromBundles:  
nil]. The problem with the first version is, as you've seen, as more  
and more frameworks start to include bundles, the model gets polluted  
with entities from things you don't care about.


There's a check done at runtime to see which version you were compiled  
on, so you get the same runtime behavior for applications that were  
compiled and linked on Tiger that depended on the original behavior,  
but if you recompile on Leopard, you get the later, safer behavior.


See:
http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSPersistentDocument_Class/Reference/Reference.html#//apple_ref/occ/instm/NSPersistentDocument/managedObjectModel

Cheers,
+Melissa

On Dec 15, 2008, at 14:52, Houdah - ML Pierre Bernard wrote:


Hi!

I am puzzled! I have run into this weirdest problem. It only happens  
if I target Tiger.


I am working on an update to HoudahGeo and suddenly, my current  
build refuses to open documents. This includes both existing  
documents and documents created by the running application. The  
error is:


Error Domain=NSCocoaErrorDomain Code=134020 UserInfo=0x2b7b10 The  
model configuration used to open the store is incompatible with the  
one that was used to create the store.
NSUnderlyingException = Can't find table for entity MovieReference  
in database at URL file://localhost/Users/pierre/Desktop/HoudahGeo-Leopard.hgeo;


There is no MovieReference entity in the model. There never was.  
Actually I have seen the same message with varying entity names. I  
believe they are taken from other applications.


BTW, the model has not been updated in over a year. And most  
certainly not between saving and attempting to reopen using the same  
running application.


The stack is:

#0  0x96da7e17 in objc_exception_throw
#1  0x9496344b in -[NSSQLCore _ensureDatabaseMatchesModel]
#2  0x94962b35 in -[NSSQLCore load:]
#3	0x94958732 in -[NSPersistentStoreCoordinator  
addPersistentStoreWithType:configuration:URL:options:error:]
#4	0x915f5fe9 in -[NSPersistentDocument  
configurePersistentStoreCoordinatorForURL:ofType:modelConfiguration:storeOptions:error 
:]
#5	0x915f6fab in -[NSPersistentDocument 
(NSPersistentDocumentDeprecated)  
configurePersistentStoreCoordinatorForURL:ofType:error:]

#6  0x915f63b6 in -[NSPersistentDocument readFromURL:ofType:error:]
#7	0x41c2 in -[Document readFromURL:ofType:error:] at Document.m: 
177

#8  0x913f16c6 in -[NSDocument initWithContentsOfURL:ofType:error:]
#9	0x913c1274 in -[NSDocumentController  
makeDocumentWithContentsOfURL:ofType:error:]
#10	0x913c0898 in -[NSDocumentController  
openDocumentWithContentsOfURL:display:error:]



This only happens when I target Tiger. When I target Leopard with  
the same code all works fine.

It occurs on both 10.5.5 and 10.5.6

When I compile an older version of the project, it works just fine.  
Thus I broke something with my recent changes. Yet I have no idea  
what. I did not touch the model.


Pierre
___

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

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

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

This email sent to mjtur...@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: controlTextDidChange for UITextField?

2008-12-15 Thread Ricky Sharp


On Dec 14, 2008, at 5:15 PM, Debajit Adhikary wrote:


Is there any way to call a method each time the text of a UITextField
changes?
controlTextDidChange does not seem to exist for UITextField's


You'd be better served by using the appropriate forums for UIKit- 
related questions.


But for this specific case, please search the docs for UITextField.   
Hint: Look at the corresponding UITextFieldDelegate protocol reference.


___
Ricky A. Sharp mailto:rsh...@instantinteractive.com
Instant Interactive(tm)   http://www.instantinteractive.com



___

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

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

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

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


Re: proper way to release a static NSMutableDictionary?

2008-12-15 Thread John Michael Zorko


Ashley,


Imagine this:

static NSMutableDictionary *lookup = [NSMutableDictionary new];

... now imagine a situation where I need to clear that dictionary.   
If I call


[lookup release];
lookup = [NSMutableDictionary new];

... it will obviously be faster than coding a for loop and removing  
each object in the dictionary, but since it was declared as static,  
which is safer?


As long as you are not retaining the objects referenced in the  
dictionary elsewhere, then when the dictionary is deallocated, all  
of its' referenced objects will be released. Whether the dictionary  
was declared static or not does not affect its' contents.


I'm not concerned about the contents per se -- i'm concerned about  
releasing something I declared as static, just to create it again  
later.  Part of me is saying just release the dictionary's contents,  
not the dictionary itself.


Regards,

John


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: proper way to release a static NSMutableDictionary?

2008-12-15 Thread Andrew Farmer

On 15 Dec 08, at 14:54, John Michael Zorko wrote:

Imagine this:

static NSMutableDictionary *lookup = [NSMutableDictionary new];

... now imagine a situation where I need to clear that dictionary.   
If I call


[lookup release];
lookup = [NSMutableDictionary new];

... it will obviously be faster than coding a for loop and removing  
each object in the dictionary, but since it was declared as static,  
which is safer?


Neither. All that static means on a global variable is that the  
symbol isn't visible from other source files. It has no bearing  
whatsoever on the contents of that variable.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: proper way to release a static NSMutableDictionary?

2008-12-15 Thread Graham Cox


On 16 Dec 2008, at 10:27 am, John Michael Zorko wrote:

I'm not concerned about the contents per se -- i'm concerned about  
releasing something I declared as static, just to create it again  
later.  Part of me is saying just release the dictionary's  
contents, not the dictionary itself.



Can you explain why you think this a problem? I often release and  
recreate static objects, at other times I also just remove all the  
contents. It depends what you're trying to do. The 'static' nature of  
an object doesn't seem relevant, but you didn't really give enough  
context.


If you do release the object and don't immediately recreate it, I  
would set the variable to nil however - that way you can tell that you  
need to recreate the object.


Also, I this won't work:


static NSMutableDictionary *lookup = [NSMutableDictionary new];


You'll get the error 'initializer is not constant'

You can't run code as part of a static initializer, you can only  
assign a constant value. So usually you'd do this:


static NSMutableDictionary* lookup = nil;

Then when you first use the dictionary, detect nil and allocate it then.

hth,

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: proper way to release a static NSMutableDictionary?

2008-12-15 Thread Ken Thomases

On Dec 15, 2008, at 5:33 PM, Andrew Farmer wrote:


On 15 Dec 08, at 14:54, John Michael Zorko wrote:

Imagine this:

static NSMutableDictionary *lookup = [NSMutableDictionary new];

... now imagine a situation where I need to clear that dictionary.   
If I call


[lookup release];
lookup = [NSMutableDictionary new];

... it will obviously be faster than coding a for loop and removing  
each object in the dictionary, but since it was declared as static,  
which is safer?


Neither. All that static means on a global variable is that the  
symbol isn't visible from other source files. It has no bearing  
whatsoever on the contents of that variable.


Although all global variables have static storage, quite aside from  
the static keyword.


Perhaps John is confused about what is static in this case, though.   
The storage for lookup, which is a pointer, is static.  The mutable  
dictionary object it points to, though, is not.  It's allocated from  
the heap.


I'm guessing that John is coming from C++ where you can truly have  
statically allocated objects.  If you do that, then it's wrong to use  
the delete operator on such an object.  But that's not analogous to  
this case.


Regards,
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


Re: Where is the Computer Image ?

2008-12-15 Thread Gerriet M. Denkmann


On 15 Dec 2008, at 19:24, John C. Randolph wrote:



On Dec 14, 2008, at 8:53 PM, Gerriet M. Denkmann wrote:


Finder.app can show in its Sidebar an image of a computer.
I want to create a button with this same (or similar) image.

I can use [ sharedWorkspace iconForFile: fullPath ] to get an image  
of a home folder, or of a disk partition.


But I cannot find a computer image. Also looked at Icon Services  
and Utilities Reference but did not find anything there.


When I need to do this kind of thing, I use  spotlight to show me  
all the images in /System/Library/ in icon view.


Well, I looked at Finders Search For - All Images (some 18000 images)  
but did not see a computer.


If the documentation for [NSImage imageNamed:] would have mentioned  
that image names are to be found in the Constants section, this would  
have helped a lot.
But it only says that it will: Search the Application Kit framework  
for a shared image with the specified name.

So I looked in the Application Kit framework, but did not find anything.

Kind regards,

Gerriet.

___

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

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

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

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


Re: Where is the Computer Image ?

2008-12-15 Thread Brandon Walkin
The image is in /System/Library/CoreServices/CoreTypes.bundle/Contents/ 
Resources


On 15-Dec-08, at 12:00 PM, Gerriet M. Denkmann wrote:



On 15 Dec 2008, at 19:24, John C. Randolph wrote:



On Dec 14, 2008, at 8:53 PM, Gerriet M. Denkmann wrote:


Finder.app can show in its Sidebar an image of a computer.
I want to create a button with this same (or similar) image.

I can use [ sharedWorkspace iconForFile: fullPath ] to get an  
image of a home folder, or of a disk partition.


But I cannot find a computer image. Also looked at Icon Services  
and Utilities Reference but did not find anything there.


When I need to do this kind of thing, I use  spotlight to show me  
all the images in /System/Library/ in icon view.


Well, I looked at Finders Search For - All Images (some 18000  
images) but did not see a computer.


If the documentation for [NSImage imageNamed:] would have mentioned  
that image names are to be found in the Constants section, this  
would have helped a lot.
But it only says that it will: Search the Application Kit framework  
for a shared image with the specified name.
So I looked in the Application Kit framework, but did not find  
anything.


Kind regards,

Gerriet.

___

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

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

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

This email sent to bwal...@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


Core Data binary data optimization(s)

2008-12-15 Thread Nathan Vander Wilt
Thanks to some patient help from this list, I now have a working Core  
Data model. One object in the model is basically a glorified vector  
polygon — an array of point structures that contain a about a dozen  
doubles each. I insert a lot of these polygon objects, and often need  
to draw all of them very quickly.


I originally included the point structures themselves in the model,  
with a to-many relationship from each polygon to the points, and  
sorted the points to their proper order in memory when necessary. This  
was a bit slow, as Core Data seemed to fault each point object  
individually, resulting in a lot of query overhead. So I switched my  
polygon objects to have only one attribute: binary data for the point.  
I thought this would result in significant speedup, but Core Data  
faults my objects so often that now I spend even more time unarchiving  
each polygon's point data than it took to read each point's row in  
from the database!


I've thought about caching the result of my get all polygons fetch  
to speed up redrawing, plus further optimizing my archiving code to  
help initial load and final save speed. If I do this, my thought was  
to watch the MOCObjectsDidChange notification for inserted/deleted  
objects and update my cache when necessary. (By my understanding, the  
updated objects will already be updated at my cached pointers.) This  
seems a little icky, though. Does Core Data provide a cleaner way of  
efficiently keeping a fetch result up-to-date?


Another issue with dealing with the points via a binary data archive  
is the wasted memory. These polygons would be immutable if Core Data  
allowed such a thing, so it seems especially wasteful to keep the  
unarchived copy of the point array and the persistent data blob both  
in memory. If I model a (prefetched) to-one relationship to the  
polygon's binary data instead of an attribute, and [moc  
refreshObject:binaryData mergeChanges:NO] once unarchived, will this  
make it fairly likely I'll only have my unarchived copy of the point  
array data in memory?


Or are the the above optimizations a bad approach to solving this  
problem? I'd like to get a little closer to the terabyte sized  
database with billions of rows/tables/columns advertised in the  
performance section, but it seems that statement assumes I'm fetching  
only a small fraction of those rows at once. For flat primitive data  
like this, is it possible to get performance closer to a raw push of  
the data to/from disk with Core Data?


thanks,
-natevw___

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

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

2008-12-15 Thread Rob Keniger


On 16/12/2008, at 4:00 AM, Gerriet M. Denkmann wrote:

Well, I looked at Finders Search For - All Images (some 18000  
images) but did not see a computer.


If the documentation for [NSImage imageNamed:] would have mentioned  
that image names are to be found in the Constants section, this  
would have helped a lot.
But it only says that it will: Search the Application Kit framework  
for a shared image with the specified name.
So I looked in the Application Kit framework, but did not find  
anything.



In general you should always use the system-provided named images  
rather than using an image file on disk. I agree that the  
documentation could be more specific about where to find the image  
names, perhaps you could file a bug against the documentation?


You can find a comprehensive list of named images in NSImage.h.

--
Rob Keniger



___

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

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

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

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


Re: Where is the Computer Image ?

2008-12-15 Thread Klaus Backert


On 15.12.2008, at 18:00, Gerriet M. Denkmann wrote:

If the documentation for [NSImage imageNamed:] would have mentioned  
that image names are to be found in the Constants section, this  
would have helped a lot.
But it only says that it will: Search the Application Kit framework  
for a shared image with the specified name.


The documentation says, the *method* [NSImage imageNamed:] searches,  
among other locations, in the AppKit framework (which is rather  
voluminous). This is not ment for you, I think ;-)


So I looked in the Application Kit framework, but did not find  
anything.


The document says, declared in NSImage.h, and the constants are  
there. It's often worthwhile to look into the header file.


Kind regards
Klaus

___

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

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


NSOutlineView assertion failure on collapse

2008-12-15 Thread Roland Rabien
I'm having an NSOutlineView Assertion Failure on collapse if the selected
item is a child (or child of child, etc) of the item that is being
collapsed. Has anyone else had this problem? I've searched the list all the
related posts seem to indicate threading is the cause, but my application
isn't using any threads. I'm using XCode 3.1 and targeting 10.5 (Intel). I
never call reloadData on my NSOutLineView, so it's data should be constant.
Any ideas?

 Assertion failure in -[NSOutlineView
_expandItemEntry:expandChildren:startLevel:](),
/SourceCache/AppKit/AppKit-949.35/TableView.subproj/NSOutlineView.m:1003*


#0 0x92a42c66 in -[NSException raise]

#1 0x9259ef22 in -[NSOutlineView collapseItem:collapseChildren:]

#2 0x92306c9a in -[NSOutlineView
_doUserExpandOrCollapseOfItem:isExpand:optionKeyWasDown:]

#3 0x9230679e in -[NSOutlineView mouseTracker:didStopTrackingWithEvent:]

#4 0x923065ce in -[NSMouseTracker stopTrackingWithEvent:]

#5 0x92278d03 in -[NSMouseTracker trackWithEvent:inView:withDelegate:]

#6 0x921bdb54 in -[NSOutlineView mouseDown:]

#7 0x9216476b in -[NSWindow sendEvent:]

#8 0x92131311 in -[NSApplication sendEvent:]

#9 0x9208ed0f in -[NSApplication run]

#10 0x9205bf14 in NSApplicationMain

#11 0x1c70 in main at main.m:13
___

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

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


Main Thread autorelease pool, memory usage question?

2008-12-15 Thread Chad Podoski
I have a process that is uploading images.  My issue is as following,  
when uploading a large number of images and my application does not  
have focus, memory usage continues to climb until it is maxed out,  
causing the app to hang/crash.  On the other hand, if the app has  
focus and the user clicks anywhere in the app, memory is released and  
memory usage stays low.  While this is occurring in the main thread,  
the actually connection work is being done in a separate thread (via  
ConnectionKit).  The action of the user clicking in the app appears to  
trigger an interrupt, allowing memory to be released or the main  
thread to manage its autorelease pools. Couple of questions:


1) Why is the main thread not managing the autorelease pool(s) without  
this user interrupt?
2) Is there a way to trigger the main thread to cleanup its  
autorelease pools?
3) If not, is there a way to simulate the user click or trigger the  
same underlying reaction to it, programmatically?

4) Am I completely off base with my hypothesis?

Thanks,
Chad
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: proper way to release a static NSMutableDictionary?

2008-12-15 Thread Michael Ash
On Mon, Dec 15, 2008 at 5:54 PM, John Michael Zorko jmzo...@mac.com wrote:

 Hello, all ...

 Imagine this:

 static NSMutableDictionary *lookup = [NSMutableDictionary new];

 ... now imagine a situation where I need to clear that dictionary.  If I
 call

 [lookup release];
 lookup = [NSMutableDictionary new];

 ... it will obviously be faster than coding a for loop and removing each
 object in the dictionary,

1) What makes it obvious?

2) Why do you care?

 but since it was declared as static, which is
 safer?

The static declaration is irrelevant. That just modifies where and how
the pointer gets stored. Memory management of the object itself is the
same as anything else. If you just want to empty out the dictionary,
[lookup removeAllObjects] seems like the nicest way to me, but use
whatever technique you like best.

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


Re: Main Thread autorelease pool, memory usage question?

2008-12-15 Thread Ken Ferry
No, you're on target.

The thing to understand is that the implementation of the main event
loop is basically this:

while (1) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSEvent *event = [self nextEventMatchingMask…];
[self sendEvent:event];
[pool drain];
}

The key part is the call to next_EVENT_matchingMask.  That means that
if there are no literal NSEvents to process, that call will never
return, and the autorelease pool will never drain.  An NSTimer firing
does not involve a literal NSEvent, and that method won't return.

You can work around it by posting an application defined event at the
end of whatever code you have that you'd expect to behave like an
event with respect to pool draining.  You should also consider filing
a bug that something or other ought to be making an autorelease pool
if you can figure out what 'something' is.

For example, someone filed a bug like that for timer firing, and as of
(I believe) 10.5, there's an explicit autorelease pool in the
timer-firing code.  So timers shouldn't be a problem.  But there may
be other kinds of run loop sources that don't have explicit pools,
particularly if you start using CF stuff since CF is below the concept
of autorelease pools.

-Ken

On Mon, Dec 15, 2008 at 6:53 PM, Chad Podoski c...@bluelavatech.com wrote:
 I have a process that is uploading images.  My issue is as following, when
 uploading a large number of images and my application does not have focus,
 memory usage continues to climb until it is maxed out, causing the app to
 hang/crash.  On the other hand, if the app has focus and the user clicks
 anywhere in the app, memory is released and memory usage stays low.  While
 this is occurring in the main thread, the actually connection work is being
 done in a separate thread (via ConnectionKit).  The action of the user
 clicking in the app appears to trigger an interrupt, allowing memory to be
 released or the main thread to manage its autorelease pools. Couple of
 questions:

 1) Why is the main thread not managing the autorelease pool(s) without this
 user interrupt?
 2) Is there a way to trigger the main thread to cleanup its autorelease
 pools?
 3) If not, is there a way to simulate the user click or trigger the same
 underlying reaction to it, programmatically?
 4) Am I completely off base with my hypothesis?

 Thanks,
 Chad
 ___

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

 Please do not post admin requests or moderator comments to the list.
 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.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Main Thread autorelease pool, memory usage question?

2008-12-15 Thread Michael Ash
On Mon, Dec 15, 2008 at 9:53 PM, Chad Podoski c...@bluelavatech.com wrote:
 I have a process that is uploading images.  My issue is as following, when
 uploading a large number of images and my application does not have focus,
 memory usage continues to climb until it is maxed out, causing the app to
 hang/crash.  On the other hand, if the app has focus and the user clicks
 anywhere in the app, memory is released and memory usage stays low.  While
 this is occurring in the main thread, the actually connection work is being
 done in a separate thread (via ConnectionKit).  The action of the user
 clicking in the app appears to trigger an interrupt, allowing memory to be
 released or the main thread to manage its autorelease pools. Couple of
 questions:

 1) Why is the main thread not managing the autorelease pool(s) without this
 user interrupt?
 2) Is there a way to trigger the main thread to cleanup its autorelease
 pools?
 3) If not, is there a way to simulate the user click or trigger the same
 underlying reaction to it, programmatically?
 4) Am I completely off base with my hypothesis?

In order, because it's dumb, post a dummy NSEvent, no need, and you're right on.

This is a *very* longstanding AppKit bug and at this point I guess
it's never going to get fixed.

Details on exactly what's going on and how to work around it here:

http://www.mikeash.com/?page=pyblog/more-fun-with-autorelease.html

The good news is that the workaround is really easy. The bad news is
that you need it at all.

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


Re: proper way to release a static NSMutableDictionary?

2008-12-15 Thread Andy Lee

On Dec 15, 2008, at 6:27 PM, John Michael Zorko wrote:
I'm not concerned about the contents per se -- i'm concerned about  
releasing something I declared as static, just to create it again  
later.


Creating and re-creating objects is in itself nothing to be afraid  
of.  It happens all the time.


The main relevant difference between the two approaches -- (1) empty  
the existing dictionary, or (2) release the existing dictionary and  
make a new dictionary -- is that in the latter case, it's conceivable  
that some object or thread might be caching a stale reference to the  
old dictionary.  This might or might not be a real concern in your  
specific app.


I wonder if you are concerned not because 'lookup' is static (which  
has a specific meaning), but because the variable is globally visible  
and is referred to all over the place, and therefore possibly at  
greater risk for the stale-reference problem?  But if that's your  
concern, then you've answered your own question: just go with [lookup  
removeAllObjects].


--Andy

 Part of me is saying just release the dictionary's contents, not  
the dictionary itself.


Regards,

John


___

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

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

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

This email sent to ag...@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


Swap subviews of NSSplitView?

2008-12-15 Thread Matt
I have an NSSplitView, divided vertically, with two table views. In a
certain instance I need to have a custom view class appear in place of
the right-hand NSTableView, retaining its auto-resizing and
spilt-view-resizing functionality. I need to be able to swap the
NSTableView (inside of the split view) for this custom view back and
forth as needed.

I searched for the solution but only found references to NSViews
-replaceSubview: with:, and it isn't working for me. Is this the
proper method to be using for such a task or should I be doing
something different?

Thanks very much in advance,
-Matt
___

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

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

2008-12-15 Thread Ben Trumbull

This was a bit slow, as Core Data seemed to fault each point object
individually, resulting in a lot of query overhead.


The performance chapter in the Core Data Programming Guide does  
address this specifically.


but Core Data faults my objects so often that now I spend even more  
time unarchiving

each polygon's point data than it took to read each point's row in
from the database!


Core Data is doing what you asked it to do.  If there's a lot of  
faulting, then either you need to prefetch as described in the  
programming guide, or you are throwing away results too quickly.   
Instrument's Core Data template can help you find where your code  
instigates excessive faulting.  The stack back trace for events in  
Instruments is a great way to find issues.  Simply walk up the back  
trace into you get to a frame in your code, and consider why it's  
triggering the work underneath it.


If after you've gather Instruments data you believe your code is doing  
the right thing, that would be worth a trip to bugreport.apple.com



I've thought about caching the result of my get all polygons fetch
to speed up redrawing, plus further optimizing my archiving code to
help initial load and final save speed


Each executeFetchRequest is an I/O.  Core Data expects you to cache  
the results.  This may be how a misalignment of expectations has  
occurred.  If you want a hash table, Foundation offers an excellent  
general purpose one, and Core Foundation provides extensive  
customization in its dictionary callbacks.


This seems a little icky, though. Does Core Data provide a cleaner  
way of

efficiently keeping a fetch result up-to-date?


There's no live fetch request.  That would make an excellent  
enhancement request at bugreport.apple.com



 If I model a (prefetched) to-one relationship to the
polygon's binary data instead of an attribute, and [moc
refreshObject:binaryData mergeChanges:NO] once unarchived, will this
make it fairly likely I'll only have my unarchived copy of the point
array data in memory?



Yes, for large binary datas that is the canonical solution.  If it's  
very small, then it may not be worth the effort.


For flat primitive data like this, is it possible to get performance  
closer to a raw push of

the data to/from disk with Core Data?


You could write your own NSValueTransformer that doesn't need to copy/ 
transmogrify the bytes.  Double scalar bytes are architecture  
dependent, though, so that may not be useful.  However, for a long  
sequence of doubles, even with a copy, you can probably do a lot  
better than NSKeyedArchiver of an NSArray of NSNumber.  doubles are 8  
bytes and NSNumber 16, so you'll have to put some effort into failing  
to do 2x better.


In theory, if the binary data were large enough, I'd suggest storing  
it as a memory mapped file, and just keeping the URL in the database.   
But the lower bound on that is in the 16-32KB range (e.g. at some  
point it's worse to make a separate file, and that point is  8K)


The marketing number for raw push speed of the disk is for large  
quantities of sequential I/O.  And the OS is optimized to hell and  
back for it.  You won't see anything remotely like that with a  
relational database, even high end commercial client server ones.  You  
can get closer with special purpose streaming APIs for dedicated  
BLOBs.  On the flip side, good luck asking the file system for a non- 
path query in the millisecond response range.  How many seconds/ 
minutes does it take to search by file metadata or file contents ?   
Compare that to a database query, and the FS gets crushed.


Databases and file systems are intended to solve different problems.   
A full text index like Spotlight or SearchKit is intended to solve yet  
another problem.  And something like memcached yet another.  The world  
has a lot of problems.


Coincidentally, those sequential I/O chunks are in the MB+ range, and  
work quite neatly for memory mapped files trick ...


- 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


Swap subviews of NSSplitView? (SOLVED)

2008-12-15 Thread Matt
I swear it never fails, I post here and then 10 minutes later figure
out the answer. I had forgotten that the NSTableView was inside of a
NSScrollView, which was the view I needed to move in and out.
replaceSubview works fine now.

Sorry for the noise.

-Matt
___

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

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