cocoa-dev Mailing List http://lists.apple.com/archives/cocoa-dev/2009/Nov/index.html cocoa-dev Mailing List Sat, 07 Nov 2009 16:00:31 +0000 Re: popup menu entries http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00369.html Reply to list

On Nov 7, 2009, at 5:41 AM, Graham Cox wrote:  
  On 07/11/2009, at 7:19 AM, Carlo Caione wrote:

[...]

Ok, but the problem is not so simple (I think). Actually I have to  
populate the popup menu and, 
according to the choice of the user on this popup, set a string in  
another text field. [...]
]]>
Re: NSString's handling of Unicode extension B (and C) characters http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00368.html Reply to list

[SOLVED]  
 On 2009-11-06, at 12:42 PM, Clark Cox wrote:  
On Fri, Nov 6, 2009 at 5:22 AM, Ryan Homer <email@hidden>  
wrote:

[...]

When you define a string using ü, isn't it stored internally as one  
UTF-16 code unit (not sure if I'm using the notation correctly),   [...]
]]>
Re: Core-Data : how to merge two contexts ? http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00367.html Reply to list

[...]

I'll probably end up using the "merge..." method available but that  
makes me feel bad to save a document automatically when the user  
should be the only one responsible for this. For example, the user  
will not be able to use the "Revert" command from the File menu to   [...]
]]>
Re: Core-Data : how to merge two contexts ? http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00366.html Reply to list

Am 07.11.2009 um 09:39 schrieb Eric Morand:

[...]

EOF is capable of nested editing context. I don’t know if CoreData can  
do that as well. 

 But why don’t you want to save?
If you just want your objects in memory, why use CoreData at all?  
 	atze   [...]
]]>
Re: Core-Data : how to merge two contexts ? http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00365.html Reply to list
[...]

Actually, the change will be promoted only when they are committed to  
the store, and that implies a save on the disk. Or am I wrong ? 

  Eric.
]]>
Re: PolKit for Leopard and later http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00364.html Reply to list
the license Pol has decided to distribute his frameworks under isn’t fodder for the mailing list.


On Nov 5, 2009, at 7:12 AM, Jeremy Pereira wrote:

[...]
]]>
Re: popup menu entries http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00363.html Reply to list

[...]

The obvious answer is to populate the menu in Interface Builder. Why  
can't you do that? 

If the menu is dynamically populated then the title strings should be  
set up using NSLocalizedString or one of its cousins, so that the  
strings originally come from the . [...]
]]>
Re: I need an example of getting the iPhone's current IP address using CFHost http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00362.html Reply to list

+ (void)list 
{ 
	NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; 

	NSMutableDictionary* result = [NSMutableDictionary dictionary]; 
	struct ifaddrs*	addrs; 
	BOOL success = (getifaddrs(&addrs) == 0); 
	if (success) 
	{ 
		const struct ifaddrs* cursor = addrs; 
		while (cursor ! [...]
]]>
popup menu entries http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00361.html Reply to list

Hi, 
in an application I need to populate a popup button with at least  
twenty entries. 
What is the correct place where I have to store labels? 
Can a property list be a good idea or is it better to leave them in  
the .m file? 

 Thanks for your help... [...]
]]>
I need an example of getting the iPhone's current IP address using CFHost http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00360.html Reply to list

I need to get the iPhone's current IP address. I know that CFHost is  
the way to go, since we don't have NSHost. Does anyone have an example  
of how to turn the iPods name to a iPodsName.local? I can't seem to  
find the rules, or the sample code that is mentioned all over the web. [...]
]]>
Re: Core-Data : how to merge two contexts ? http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00359.html Reply to list
Am 06.11.2009 um 17:52 schrieb Eric Morand:

[...]

You copy nothing. 
On save the changes are distributed to every other context that holds  
the object. 
If the object was never in the other context (esp. a new one) you have  
to fetch it anyway. Or you get the NSManagedObjectID and ask the other  
context for the object to that ID. 
The relationships will just be there. 

The NSManagedObjectContext is your scratchpad. If you want something  
inside it fetch it or create it. 
If you change something, the change will be promoted. 

 	atze  
 
]]>
NSXML: Using XPath with namespaces? http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00358.html Reply to list

I'm calling -[NSXMLElement nodesForXPath:error:] to find stuff in an  
XML document. It works great, until I try to find elements that use a  
namespace prefix; then it won't find them unless I put the exact same  
prefix in the query. That's a bad solution, though, because the prefix   [...]
]]>
Bundle versioning http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00357.html Reply to list

I'm having a hard time with versions and iPhone apps (and iTunes). I'm  
working on a new version of my app. I'd like to distribute it to a few  
testers. I would like the version string to reflect the beta nature of  
the build: 1.1b1. 

But iTunes doesn't respect version strings in that format. [...]
]]>
Re: bindings question http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00356.html Reply to list

[...]

In MVC style, you would have a controller that observes for value  
changes and then calls the appropriate methods on the view. You could  
add bindings support in your view, but you would still need a  
controller and this approach might be more work than it is worth   [...]
]]>
bindings question http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00355.html Reply to list

Hi all,

I have a NSView subclass that displays a graphical representation of my model.

The model is described by some numerical values, which are entered into text fields.

As each text field is edited, the graphical representation should be redrawn to reflect the new value. [...]
]]>
Re: NSTextView won't update via NSThread http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00354.html Reply to list

[...]

Multithreading, as a general problem, is HARD. To do what you're
suggesting ("just do what I'm asking") the framework would have to
lock all of these things:

- NSTextView instance
- NSTextStorage instance
- NSMutableString instance

How is it supposed to do that? [...]
]]>
Re: NSTextView won't update via NSThread http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00353.html Reply to list

[...]

Thread-safety of a complex system is hugely more complicated than just  
managing "calling it multiple times". It's nightmarishly complex, and  
generally just not worth it. Cocoa takes the approach that asynchrony  
is a better approach than promiscuous multithreading — most tasks like   [...]
]]>
Re: NSTextView won't update via NSThread http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00352.html Reply to list

On Nov 6, 2009, at 5:09 AM, Ken Thomases wrote:  
 On Nov 5, 2009, at 6:20 AM, Dalton Hamilton wrote:

[...]

Well, I would think Cocoa would let me manage whether I'm calling it  
multiple times and just do what I'm asking. 
So, I now I'm trying to set an NSLock, then call the worker Thread and   [...]
]]>
Re: cocoabuilder server down? http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00351.html Reply to list
[...]

It does seem to be down at the moment
(http://downforeveryoneorjustme.com/CocoaBuilder.com) and as best I
can tell it's been down for a week now... Based on my limited
attempts.

There are plenty of other archives though! :)

Matt
]]>
cocoabuilder server down? http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00350.html Reply to list
Folks;  
 Is the cocoabuilder server having problems?
I haven't been able to access it for at least 2 days.  
 Steve  
 
]]>
Core Data Migration String to Int32 http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00349.html Reply to list

Hi Developers,  
I am currently having problems creating the data model for my  
application since I want to convert a String to an Int32. 
The value expression should be sth. like this (pseudo-code): 

 if ($source.name == "First name") return 1;
else if ($source. [...]
]]>
Re: Window setTitle Ignored at Launch? http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00348.html Reply to list
[...]

Set a breakpoint at the top of this method.
Is the method called at launch time?
If so, is 'box' or 'w' nil?  
 —Jens
]]>
Re: NSString's handling of Unicode extension B (and C) characters http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00347.html Reply to list

[...]

I'm referring to decomposition.

[...]

And any code that is indexing a Unicode string *must* be prepared to
accept both decomposed and precomposed forms.

[...]

Then you need to be very careful how you define "character".

Is "ü" a single character, or two characters? [...]
]]>
Window setTitle Ignored at Launch? http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00346.html Reply to list

i'm following hillegass' "view swapping" (chapter 29), concerning the
NSViewController.  i can successfully display the proper view at launch
(based on the index of an NSMutableArray), but i cannot set the window's
title using the same index?  the window loads as "Untitled", which is it's [...]
]]>
Re: Core-Data : how to merge two contexts ? http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00345.html Reply to list

Hi mmalc,  
 Thanks for your help.  
This is what I feared : I have to copy manually the object from the  
editing context to the main one. 

What will happen with relationships ? Let's say we have a one-to-one  
relationship between the Product entity and the Family entity and that   [...]
]]>
Re: NSOperationQueue for NSXMLParser object http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00344.html Reply to list

The problem may be that the NSOperationQueue releases your NSOperation  
once the main method ends. If you don't retain it elsewhere, the  
parser tries to fire delegate methods on a released object. Sounds  
like you need to make your NSOperation concurrent (which, IMHO, is a  
misnomer). [...]
]]>
Re: Core-Data : how to merge two contexts ? http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00343.html Reply to list
[...]

This is illustrated in the documentation:

[...]
]]>
Core-Data : how to merge two contexts ? http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00342.html Reply to list

Hi guys,  
Apple keeps on talking about Core-Data managed object contexts as  
"scratchpads". I'm trying to use them as such but face a lot of  
problem when it comes to merge contexts between each others once I  
want to "submit" the modifications that lies in the scratchpad. [...]
]]>
Re: Very, Very Simple iPhone SDK Question http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00341.html Reply to list

You could write pre-processor macros to handle all your NS* methods
and typedef NSPoint, etc. to their respective core graphics
implementations so you don't need to maintain two code bases.

-Brian



On Fri, Nov 6, 2009 at 10:53 AM, Matt Neuburg <email@hidden> wrote:

[...] [...]
]]>
Re: NSCoder and CGColorRef http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00340.html Reply to list
On Thu, 05 Nov 2009 18:59:34 -0500, Alexander Cohen

[...]

If you're on iPhone, just pop it into a UIColor and now you can archive it.
m.

]]>
Re: Very, Very Simple iPhone SDK Question http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00339.html Reply to list

On Thu, 5 Nov 2009 06:56:45 -0400, Patrick William Walker

[...]

It's because none of those things exist on iPhone. You have to switch to
using stuff like CGPoint, CGRect, and CGPath (although in fact for the
latter you're likely to use the CGContext... commands and not save a path at
all). [...]
]]>
Re: NSString's handling of Unicode extension B (and C) characters http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00338.html Reply to list

[...]

No, it doesn't.  NSString is a container for UTF-16 *code units*, not  
code points, and not grapheme clusters, and its methods reflect that  
design choice (so -length is the length in UTF-16 code units, and the  
indices are indices in UTF-16 code units too). [...]
]]>
Re: NSString's handling of Unicode extension B (and C) characters http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00337.html Reply to list
On 2009-11-05, at 1:59 PM, Douglas Davidson wrote:  
 On Nov 5, 2009, at 10:42 AM, Clark Cox wrote:

[...]

NSString already treats many composed characters as a grapheme  
cluster, such as accented characters. This made me think that it would  
also treat the Chinese character as one character regardless of its  
internally represented storage.

[...]

While Chinese characters exhibit similar properties, being composed of  
"parts" from the language perspective, parts which are most times  
characters themselves, Unicode has never treated Chinese characters as  
the composition of such, but rather as separate character in its own  
right. In other words, there is no decomposition of a Chinese  
character such as you can do with é, for example. I believe this is  
the same for Japanese kanji as well.

[...]
]]>
Re: NSString's handling of Unicode extension B (and C) characters http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00336.html Reply to list

On 2009-11-05, at 1:42 PM, Clark Cox wrote:  
On Thu, Nov 5, 2009 at 8:04 AM, Ryan Homer <email@hidden>  
wrote:

[...]

Are you referring to the alternate form muessen or the decomposed  
form? While the decomposed form would have a length > 6, the string   [...]
]]>
Re: IKImageBrowserView and reordering http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00335.html Reply to list

I have found a partial solution, which is enough for my needs. Instead
of passing an empty dictionary to -enterFullscreen:withOptions, you
tell it to disable the dock and the menu bar. The result is a view in
fullscreen, and reordering magically works. [...]
]]>
(no subject) http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00334.html Reply to list
http://sites.google.com/site/ymtxjasazk/nc7nnoouyi


]]>
Re: NSTextView won't update via NSThread http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00333.html Reply to list
[...]

Because everything in AppKit is thread-unsafe, unless specifically marked safe.
]]>
Re: NSTextView won't update via NSThread http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00332.html Reply to list

[...]

Yes, because Cocoa generally doesn't support manipulating the GUI from  
any thread other than the main thread. 

 Read through this:
http://developer.apple.com/mac/library/documentation/cocoa/Conceptual/Multithreading/Introduction/Introduction. [...]
]]>
Re: Very, Very Simple iPhone SDK Question http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00331.html Reply to list
Hi,

You need to use CG**** structs on iPhone. CGPoint, CGRect... Don't forget
different make function naming conventions either: NSMakeRect -> CGRectMake.

Karolis,
Cheers

On Thu, Nov 5, 2009 at 4:56 AM, Patrick William Walker <

[...]
]]>
NSPanel show/hide notifications http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00330.html Reply to list

Hi,

I'm writing a Cocoa UI for an AudioUnit plug-in, based on a custom
NSView. Some host apps load such plug-ins within an NSPanel, or at
least a window with the hidesOnDeactivate property set to YES.

I'm trying to get notification when the panel is hidden and shown. [...]
]]>
Porting non-Mac OS X app to Cocoa http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00329.html Reply to list

Hi,

I have been working on a somewhat game engine (not really, but acts
like one) and currently involved in porting this to different
platforms. The engine works perfectly fine on Linux, FreeBSD and
Windows so far.

It is comprised of following parts:
1. Entry point (e.g. main or WinMain)
2. [...]
]]>
NSTextView won't update via NSThread http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00328.html Reply to list

Hello, I'm doing the below and when I call the  -runTask: method is  
called from the main run loop (no threading) with 

 		[self runTask:self];  
  the NSTextView updates great; however, when I call -runTask via  
		[NSThread detachNewThreadSelector:@selector(runTask:) toTarget:self   [...]
]]>
Very, Very Simple iPhone SDK Question http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00327.html Reply to list

Why do I get an "Expected specified-qualifier-list before NSPoint"  
when trying to port of my model classes from Cocoa to iPhone SDK?   
I've been reading through the documentation and haven't really found  
much to explain why I'm getting errors when using other things like   [...]
]]>
Re: [Moderator] Re: Apple Remote Control Wrapper sends same button ID for all buttons. http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00326.html Reply to list
it’s quite possible that the library he’s using is public API, and if so, my apologies.

however, every other wrapper has been using private API. Unfortunately, moderation doesn’t provide the time to examine code posted on third party blogs. The fact that the class is called “Apple Remote” doesn’t exactly give you any indication that it isn’t on one of the third party libs that do use hacks.

[...]

If it is, great. my apologies to Harry. Kudos to Martin (with the exception of the class naming)

[...]

that examining code on unlinked website isn’t something that volunteer moderation offers time for.
]]>
Re: [Moderator] Re: Apple Remote Control Wrapper sends same button ID for all buttons. http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00325.html Reply to list

[...]

What private API is used? All I saw in the code were documented  
IOKit calls. I thought that if something's obviously is exposed via  
public API like IOKit, it would be considered public API. 

 I'm not trying to be contrary or anything, I'm simply trying to   [...]
]]>
Subtle differences in the implementation of the Foundation framework on iPhone and OSX http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00324.html Reply to list

Hello there,

Thought I'll share a little observation I just made, and that cost me about
an hour to debug. This is in hope that, using my experience, you may check
for similar bugs.

Look at this piece of code:

///

 NSNumberFormatter * nf = [[[NSNumberFormatter alloc] init] autorelease];

 [ [...]
]]>
Re: IBOutlet getting messed up in the runtime http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00323.html Reply to list

And yes, it was the obvious assign rather than retain.  
 Thank you!  
 Ben  
 On Nov 5, 2009, at 5:46 PM, Jonathan del Strother wrote:  
 How is your bad IBOutlet declared?  Does it have a @property
declaration that's using 'assign' rather than 'retain', perhaps? [...]
]]>
Re: Bulletproof way to create a new CGBitmapContext from an existing image? http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00322.html Reply to list

Hi Steve and David,  
Thank you both for your comments; they were very helpful. I had  
thought that I had to match the context to the image I was going to  
use, but that's clearly wrong. I had missed that link to the supported  
pixel formats - that's very informative. [...]
]]>
Re: NSTreeController, Core Data and root objects http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00321.html Reply to list
[...]

Good question, I haven't tested that but I will do so.

[...]

The root object is indeed unchanging. You're right, caching the object would be an improvement on the fetch.

I'll proceed with this and see if I have any problems.

Many thanks,

]]>
Re: NSOperationQueue for NSXMLParser object http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg00320.html Reply to list

Hi Chris,

[...]

How large are the XML files?  Does each contain multiple animation  
steps or just one?

[...]

Do your stalls happen because of the parsing or because of the  
downloading?   The fact that you are using -initWithURL: suggests that  
your stalls may be because of downloading, as -[ [...]
]]>