How to show Interface Builder's build warning and messages?

2008-10-29 Thread Oleg Krupnov
Recently I was building my project and saw there were some warnings
and messages regarding a XIB file.

For example, there were warnings that some connection outlets were
broken, and there were messages that some views were clipping their
own content.

After I fixed the connection outlets, the warnings were gone, but the
messages were no longer displayed neither, yet I still wanted to fix
the clipping views too. In other words, if there are no warnings but
only messages in a XIB, the latter are not shown in the build results.

How do I re-show these messages again in IB?

I tried to click "Info" for the XIB in IB, but the list is empty.
___

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

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

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

This email sent to [EMAIL PROTECTED]


file references in CoreData

2008-10-29 Thread Georg Seifert

hello,

I’m very new to CoreData and can’t find anything on this:

I need to store references to local files in CoreData. What is the  
best solution for this. Just now I use plain paths but there has to be  
a better way.


Thanks
Georg___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: filtering a tableView from a pulldown

2008-10-29 Thread Amy Heavey

On 28 Oct 2008, at 16:15, I. Savant wrote:


The pulldown is bound as follows:
content: arrangedObjects[PurchaseOrder Array Controller(NSArray  
Controller)]

content values: Purchase ORder Array Controller
arrangedObjects.orderReference


  These bindings seem fine. How about selection? One of the popup's
selection bindings should be bound to the PurchaseOrder Array
Controller's selection.


The pop up has selectedObject bound to Purchase Order Array  
Controller 2 selection.orderReference


All of this is on a panel that appears when I select a Purchase Order  
and click a Details button. The popup correctly shows the selected  
Purchase Order Order Reference, and lists all of the other Purchase  
orders within it.





The Table view has 6 columns, one of which is the Purchase Order  
number (as

displayed in the pulldown)


  This seems wrong. If your table is intended to display the "line
items" belonging to the order, why have the order number on each line
item?


I don't really need it, I created most of the interface by alt- 
dragging from the data model, and it put it there, at the moment it's  
handy for me to quickly see that it's not working properly, as when  
it is working, all the lines should have the same value there. It's  
not vital for it to be there though,



In any case, you need a *separate* controller to reflect the
line items of the selected order. Create an array controller and set
it up so that it holds your "line item" objects. We'll call it your
"Line Item Array Controller".


OK, I have an Array Controller for that, called Purchase Order Items  
Array Controller.



Its contents should be bound to
PurchaseOrder Array Controller's selection.lineItems (or whatever the
key path is to your order's line items).


At the moment the content Object is bound to selection.orderReference  
of the Purchase Order Array Controller.


I tried to bind the contentArray to that but it threw an error,


  Your table view's columns should each be bound to the Line Item
Array Controller's arrangedObjects.property (where "property" refers
to individual properties such as "item number", "description",
"quantity", etc.).


My Qty table column is bound to Purchase Order Items Array Controller  
arrangedObjects.qty


Then I have other columns:
Vendor SKU -> Purchase Order Items Array Controller  
arrangedObjects.vendorSKU

Product ->
content-> Products Array Controller arrangedObjects
contentValues->Products Array Controller arrangedObjects.sku
		selectedObject->Purchase Order Items Array Controller  
arrangedObjects.product


Purchase Order (not vital) ->
content-> Purchase Order Array Controller arrangedObjects
		contentValues-> Purchase Order Array Controller  
arrangedObjects.orderReference
		selectedObject-> Purchase Order Items Array Controller  
arrangedObjects.purchaseOrder


Shipment
content-> Shipment Array Controller arrangedObjects
		contentValues-> Shipment Array Controller  
arrangedObjects.shipperReference
		selectedObject-> Purchase Order Items Array Controller  
arrangedObjects.shipment


but the panel won't load and displays the following error:

[Session started at 2008-10-29 08:42:05 +.]
2008-10-29 08:42:07.826 powizard[6592] *** NSRunLoop ignoring  
exception '[ valueForUndefinedKey:]: this class  
is not key value coding-compliant for the key qty.' that raised  
during posting of delayed perform with target 16699b0 and selector  
'invokeWithTarget:'
2008-10-29 08:42:07.829 powizard[6592] *** NSRunLoop ignoring  
exception '[ valueForUndefinedKey:]: this class  
is not key value coding-compliant for the key shipment.' that raised  
during posting of delayed perform with target 1669b50 and selector  
'invokeWithTarget:'




  Spend as much time as you can manage reading over the documentation
I sent you previously. If there are things you don't understand, post
your questions back to the list for clarification.



I have read through it, and it's not as much that it doesn't make  
sense, I can see what it's saying, it's applying it that I'm  
struggling with, and I've got both the 2nd and 3rd editions of cocoa  
programming, but the second edition doesnt cover core data as much,  
and the third edition uses leopard, where I am on 10.4, and wanting  
to release for 10.4 too and the IB interface/panels etc are quite  
different,



--
I.S.


Thank you for all your help,

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: file references in CoreData

2008-10-29 Thread Dirkjan Krijnders

Hi,

When using Leopard this is easy: you can store any data type in core  
data using the 'Transformable' type. Use this to store instances of  
NSURL that point to your files see

http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdNSAttributes.html
for more information.

Dirkjan


On Oct 29, 2008, at 9:44 , Georg Seifert wrote:


hello,

I’m very new to CoreData and can’t find anything on this:

I need to store references to local files in CoreData. What is the  
best solution for this. Just now I use plain paths but there has to  
be a better way.


Thanks
Georg___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: file references in CoreData

2008-10-29 Thread I. Savant

On Oct 29, 2008, at 4:44 AM, Georg Seifert wrote:

I need to store references to local files in CoreData. What is the  
best solution for this. Just now I use plain paths but there has to  
be a better way.


  I use the much-lauded BDAlias:

http://eschatologist.net/bDistributed.com/index.html

  I encode it as data and store it that way. Using a transformable  
type as Dirkjan suggested, you can make it as convenient as -URL - 
setURL: and handle the conversion that way.


  URL <--> BDAlias <--> NSData

  This way, you're referencing the file by its ID, not its location.  
If the location changes, your app still knows where it's at (unless it  
is removed from its original volume).


--
I.S.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Message Forwarding Overhead / Performance

2008-10-29 Thread Jean-Daniel Dupas


Le 29 oct. 08 à 04:46, Michael Ash a écrit :


On Tue, Oct 28, 2008 at 6:16 PM, Jerry Krinock <[EMAIL PROTECTED]> wrote:
Roughly, the lesson is: Don't use message forwarding for "actual  
work".  I

was just wondering if anyone had ever found otherwise.


I have to say that this is greatly overstating things. I've used
forwarding for all sorts of real work. What you don't want to do is
put it into a situation where it needs to execute hundreds of
thousands of times a second. But there are a lot of situations which
qualify as "actual work" for which that does not apply.

20us is slow when compared to a normal message send. It's
instantaneous when compared to, say, writing a file to disk. Whether
it's "too slow" depends entirely on what you need.

Mike


And it is heavily used in Cocoa for Distributed object, undo manager,  
and probably more.


Anyway, it's premature optimization. If Shark tell you that  
forwardlyAdd forwarding: is a bottleneck, just override it in your  
parent class to forward the message manually:


-  (void)forwardlyAdd:(int)arg {
[forwardee forwardlyAdd:arg];
}


___

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

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

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

This email sent to [EMAIL PROTECTED]


Path handling routines

2008-10-29 Thread Daniel Luis dos Santos

Hello,

Are there in the Foundation framework (or anywhere else on the Cocoa  
platform) path handling routines (directory extraction, path  
decomposition) ?


Cheers
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: ASL & Unicode in Xcode's Console

2008-10-29 Thread Yvan BARTHÉLEMY

Hi,

A solution for this is to not use directly asl_log, but wrap it to a  
function that will then use asl_log for console, and fprintf for  
logging to stderr (instead of asl_open(stderr)), of course you will  
have to regenerate yourself date, host name, process name, process id  
information if needed when using fprintf.


Regards,
Yvan

Le 28 oct. 08 à 19:01, Karl Moskowski a écrit :

I've been experimenting with replacing my app's logging with Apple  
System Logger. When it comes to multi-byte characters, every thing  
looks OK in Console.app. However, Xcode's console shows things  
incorrectly. It probably won't come up often, but I'm wondering if  
it's fixable.


For example, this bit of code:
NSLog(@"あ");
	aslclient client = asl_open(NULL, NULL, ASL_OPT_STDERR); // add  
STDERR's fd to the connection's set of fds so things show up in  
Xcode's console

asl_log(client, NULL, ASL_LEVEL_ERR, "あ");
asl_close(client);

Results in this output in Xcode:
2008-10-28 13:49:19.767 ASL[3484:10b] あ
Tue Oct 28 13:49:19 iMac.local ASL[3484] : \M-c\M^A\M^B

The call to NSLog displays correctly, but asl_log doesn't.

(In case it doesn't survive email, the character in quotes is  
Hiragana Letter A, from Leopard's Character Palette > East Asian  
Scripts > Hiragana > first character.)


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Path handling routines

2008-10-29 Thread Paul Bruneau


On Oct 29, 2008, at 9:01 AM, Daniel Luis dos Santos wrote:


Hello,

Are there in the Foundation framework (or anywhere else on the Cocoa  
platform) path handling routines (directory extraction, path  
decomposition) ?


Cheers


There are a group of methods in NSString for working with paths.

http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html

And scroll down to "Working with Paths"
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Path handling routines

2008-10-29 Thread Jonathan del Strother
NSString has most of them.  See -[NSString pathComponents], -[NSString
stringByAppendingPathComponent:] etc.

On Wed, Oct 29, 2008 at 1:01 PM, Daniel Luis dos Santos
<[EMAIL PROTECTED]> wrote:
> Hello,
>
> Are there in the Foundation framework (or anywhere else on the Cocoa
> platform) path handling routines (directory extraction, path decomposition)
> ?
>
> Cheers
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/maillist%40steelskies.com
>
> This email sent to [EMAIL PROTECTED]
>
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Open Window from Input Manager

2008-10-29 Thread Daniel
Hi,

thank you for your reply.

Does this mean that I'm trying to loading a NIB file from the bundle
of the running application (in which the input manager has been
loaded)?

NSBundle *bundle = [NSBundle bundleWithIdentifier: @"org.x616c.LMC"];

I've found out how to find the right bundle, but I'm still stuck in
trying to load a window from a NIB file inside my bundle ... can
someone help me?

Best regards,
Daniel

On Wed, Oct 29, 2008 at 4:49 AM,  <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> I'm working on a project for inserting special characters in text
>> fields in all Cocoa apps by means of an Input Manager.
>>
>> After a given trigger/shortcut I have the need to open a window/panel,
>> but I don't get it.
>>
>> I've tried to load a NIB file, but the Console reported
>>
>> -[NSWindowController loadWindow]: failed to load window nib file 'Chooser'
>>
>> Is there another way to do it right? I've basically the need to open a
>> panel/window, change the keyboard focus from the textfield to the
>> opened panel and then continue by closing the panel.
>
> Hard to say if there's another way to do it when we don't know how
> you're doing it now.
>
> At a guess, you're telling Cocoa to look for "Chooser" in the main
> bundle, but you are not the main bundle so this is the wrong place to
> look.
>
> Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: ASL & Unicode in Xcode's Console

2008-10-29 Thread Jason Coco


On Oct 29, 2008, at 09:06 , Yvan BARTHÉLEMY wrote:

A solution for this is to not use directly asl_log, but wrap it to a  
function that will then use asl_log for console, and fprintf for  
logging to stderr (instead of asl_open(stderr)), of course you will  
have to regenerate yourself date, host name, process name, process  
id information if needed when using fprintf.


Yeah, that's basically the solution I used, but didn't really bother  
with re-generating the log information. I also used an undocumented  
call that I found on the asl source code that let me specify the  
encoding that I wanted instead of defaulting to that stupid "visual"  
encoding for the console. But I wrapped the ASL stuff in an Objective- 
C class so I just added code that if the level was ASL_LEVEL_DEBUG and  
NDEBUG wasn't defined, the data went to stderr as well as the logging  
system.


J

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: ASL & Unicode in Xcode's Console

2008-10-29 Thread Sean McBride
On 10/29/08 1:27 AM, Jason Coco said:

 That is no longer necessary in 10.5 / Xcode 3.  You can use
 Unicode in
 string literals in Objective-C.
>>>
>>> Why do you say this? I thought that I may have missed something,
>>> but looking
>>> back through all the documentation, all the warnings about only
>>> including 7-bit ASCII
>>> characters in string literals still exist... even in the most
>>> recent updated documentation.
>>
>> ISTR seeing this in the release notes somewhere, but can't find it
>> now either.  Anyway, see
>>
>> http://lists.apple.com/archives/Cocoa-dev/2008/Apr/msg01885.html
>
>Well, I still can't find anything that says this other than somebody's
>statement on a mailing list...

Aki's not just a 'somebody' but a member of Apple's Cocoa team.  There
are several posts in the archives about this being supported now.  IIRC,
it only works in .m/.mm files, not .c/.cpp.

>the three
>most recently updated documents that apple put out dealing with
>strings all specifically say that string
>literals (CFStringRef, NSConstantString and c style string constants)
>all must be 7-bit ascii encoded

Please file a bug against the docs.

--

Sean McBride, B. Eng [EMAIL PROTECTED]
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Open Window from Input Manager

2008-10-29 Thread Kevin Gessner
Is your spelling right? The method is "loadNibNamed:owner:"; your  
email says "loadNibName:owner:". AppKit should be included in your  
average cocoa program. Also note that it's a class method, not an  
instance method. Not sure what else would be causing it.


-- Kevin

Kevin Gessner
http://www.kevingessner.com
[EMAIL PROTECTED]




On Oct 29, 2008, at 10:25 AM, Daniel wrote:


Hi Kevin,

this seems to be right method, but I don't know how to use the
NSBundle with the AppKit additions ... and therefore I get the
"selector not recognized" error while using the loadNibName:owner:
method.

Best regards and thanks,
Daniel

On Wed, Oct 29, 2008 at 3:06 PM, Kevin Gessner  
<[EMAIL PROTECTED]> wrote:

Would loadNibNamed:owner: in the NSBundle Additions work?
http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSBundle_AppKitAdditions/Reference/Reference.html#/ 
/apple_ref/doc/uid/2401-CJBHHDFC


Pass in an object in your bundle as owner, and it should look in  
your bundle
for the window. Then you can treat the window (and other NIB  
objects) as any

other, through outlets.

HTH,
-- Kevin

Kevin Gessner
http://www.kevingessner.com
[EMAIL PROTECTED]




On Oct 29, 2008, at 9:29 AM, Daniel wrote:


Hi,

thank you for your reply.

Does this mean that I'm trying to loading a NIB file from the bundle
of the running application (in which the input manager has been
loaded)?

NSBundle *bundle = [NSBundle bundleWithIdentifier:  
@"org.x616c.LMC"];


I've found out how to find the right bundle, but I'm still stuck in
trying to load a window from a NIB file inside my bundle ... can
someone help me?

Best regards,
Daniel

On Wed, Oct 29, 2008 at 4:49 AM,  [EMAIL PROTECTED]>

wrote:


Hi,

I'm working on a project for inserting special characters in text
fields in all Cocoa apps by means of an Input Manager.

After a given trigger/shortcut I have the need to open a window/ 
panel,

but I don't get it.

I've tried to load a NIB file, but the Console reported

-[NSWindowController loadWindow]: failed to load window nib file
'Chooser'

Is there another way to do it right? I've basically the need to  
open a

panel/window, change the keyboard focus from the textfield to the
opened panel and then continue by closing the panel.


Hard to say if there's another way to do it when we don't know how
you're doing it now.

At a guess, you're telling Cocoa to look for "Chooser" in the main
bundle, but you are not the main bundle so this is the wrong  
place to

look.

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/kevin%40kevingessner.com

This email sent to [EMAIL PROTECTED]





___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: filtering a tableView from a pulldown

2008-10-29 Thread I. Savant
On Wed, Oct 29, 2008 at 4:49 AM, Amy Heavey <[EMAIL PROTECTED]> wrote:

> The pop up has selectedObject bound to Purchase Order Array Controller 2
> selection.orderReference
...
> At the moment the content Object is bound to selection.orderReference of the
> Purchase Order Array Controller.

  Okay, but what is "orderReference"? Is it an attribute holding the
order number? If so, this is at least part of your problem. You
probably want the *content values* (the strings displayed in the
popup, which represent the actual objects being listed) bound to
arrangedObjects.orderReference, but the selected *object* should
probably not be the order number. The controller key should be the
"selection" but the model key path should be empty. This directly
selects the purchase order object in the array controller.

  The way you have it bound now means that your Line Items
controller's content is the orderReference (which I assume is a
string, given the error you posted previously). A string probably
won't contain a list of line items, right? I assume your PurchaseOrder
entity has a to-many relationship to the line items (we'll call it
"lineItems" for obvious reasons). If this is the case, then your Line
Item controller's content should be bound to the Purchase Order
controller's "selection.lineItems". This means the Line Item
controller's contents points to an NS[Mutable]Set containing the line
items of the selected purchase order.

> I tried to bind the contentArray to that but it threw an error,

  You want the content *set*. To-many relationships in Core Data deal
with NS[Mutable]Sets, not arrays. Both of these points are thoroughly
covered in the documentation, but you have to understand that you're
dealing with two separate mechanisms that happen to be designed to
work well together. This means there are two different areas of the
documentation that you need to read carefully.

> I have read through [the documentation], and it's not as much that it doesn't 
> make sense, I
> can see what it's saying, it's applying it that I'm struggling with ...

  Don't feel bad ... Cocoa Bindings is a deceptively complicated thing
to model mentally. Add Core Data to the mix and it's even harder -
even after you get the hang of it, you can easily keep making the same
mistakes and forgetting the same "gotcha's". NSPopUpButton bindings
alone really get people. That and master/detail setups seem to be the
most confounding topics for those who are just learning.

--
I.S.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: ASL & Unicode in Xcode's Console

2008-10-29 Thread Yvan BARTHÉLEMY
In fact I am very interested about this undocumented call as it is  
painful for me to dig into darwin sources.


Thanks,
Yvan

Le 29 oct. 08 à 14:41, Jason Coco a écrit :



On Oct 29, 2008, at 09:06 , Yvan BARTHÉLEMY wrote:

A solution for this is to not use directly asl_log, but wrap it to  
a function that will then use asl_log for console, and fprintf for  
logging to stderr (instead of asl_open(stderr)), of course you will  
have to regenerate yourself date, host name, process name, process  
id information if needed when using fprintf.


Yeah, that's basically the solution I used, but didn't really bother  
with re-generating the log information. I also used an undocumented  
call that I found on the asl source code that let me specify the  
encoding that I wanted instead of defaulting to that stupid "visual"  
encoding for the console. But I wrapped the ASL stuff in an  
Objective-C class so I just added code that if the level was  
ASL_LEVEL_DEBUG and NDEBUG wasn't defined, the data went to stderr  
as well as the logging system.


J


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Open Window from Input Manager

2008-10-29 Thread Michael Ash
On Wed, Oct 29, 2008 at 9:29 AM, Daniel <[EMAIL PROTECTED]> wrote:
> Hi,
>
> thank you for your reply.
>
> Does this mean that I'm trying to loading a NIB file from the bundle
> of the running application (in which the input manager has been
> loaded)?
>
> NSBundle *bundle = [NSBundle bundleWithIdentifier: @"org.x616c.LMC"];
>
> I've found out how to find the right bundle, but I'm still stuck in
> trying to load a window from a NIB file inside my bundle ... can
> someone help me?

Your last post indicated an NSWindowController being used to load the
nib. I am not 100% sure on this (please post your code when you have
question!) but that's how it appeared.

If so, then you should be able to get things working by using a custom
subclass of NSWindowController that's in your bundle.
NSWindowController is, I think, smart enough to look in the same
bundle as the class of the object doing the loading.

Failing that, rather than using -initWithWindowNibName:, use
-initWithWindowNibPath:owner: which allows you to specify a full path.
NSBundle can get you a full path for any resource file.

If you want to load the nib manually (not recommended, always use
NSWindowController or NSViewController to load nibs) then you can use
the NSNib class, or one of the NSBundle extensions in NSNibLoading.h.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: ASL & Unicode in Xcode's Console

2008-10-29 Thread Karl Moskowski

On Oct 29, 2008, at 09:41 , Jason Coco wrote:


On Oct 29, 2008, at 09:06 , Yvan BARTHÉLEMY wrote:

> A solution for this is to not use directly asl_log, but wrap it to a
> function that will then use asl_log for console, and fprintf for
> logging to stderr (instead of asl_open(stderr)), of course you will
> have to regenerate yourself date, host name, process name, process
> id information if needed when using fprintf.


Yeah, that's basically the solution I used, but didn't really bother
with re-generating the log information. I also used an undocumented
call that I found on the asl source code that let me specify the
encoding that I wanted instead of defaulting to that stupid "visual"
encoding for the console. But I wrapped the ASL stuff in an Objective-
C class so I just added code that if the level was ASL_LEVEL_DEBUG and
NDEBUG wasn't defined, the data went to stderr as well as the logging
system.


I too put the logging in a wrapper class, with a method that does the  
heavy lifting and a few macros that simplify its use. Now, instead  
using ASL_OPT_STDERR, I just fprintf nicely formatted messages to  
stderr.


To make sure that there's no duplication of messages in the Console, I  
wrapped the fprintf section in a conditional to ensure it's a tty.  
Now, when Xcode runs the app, logging is echoed to Xcode's console. It  
also has the advantage that Debug-level messages show up in the  
console, but syslog's filters prevent them from making it to the  
system log. (I got the idea from  .)


// ASLogger.h

#define ASLog(c, s, l,...) [ASLogger logTo:(c) level:l  
sourceFile:__FILE__ lineNumber:__LINE__ format:(s), ##__VA_ARGS__]
#define ASLogError(c, s, ...) ASLog((c), (s), ASL_LEVEL_ERR,  
##__VA_ARGS__)
#define ASLogNotice(c, s, ...) ASLog((c), (s), ASL_LEVEL_NOTICE,  
##__VA_ARGS__)
#define ASLogDebug(c, s, ...) ASLog((c), (s), ASL_LEVEL_DEBUG,  
##__VA_ARGS__)


// ASLogger.m

+ (void) logTo:(aslclient)client level:(NSInteger)level sourceFile: 
(char *)sourceFile lineNumber:(NSUInteger)lineNumber format:(NSString  
*)format, ... {

va_list ap;
va_start(ap,format);
	NSMutableString *message = [[NSMutableString alloc]  
initWithFormat:format arguments:ap];

va_end(ap);
[message appendFormat:@" [%u]", lineNumber];
asl_log(client, NULL, level, [message UTF8String]);
if (isatty(fileno(stderr))) {
		NSString *now = [[NSCalendarDate calendarDate]  
descriptionWithCalendarFormat:@"%a %b %d %H:%M:%S"];

fprintf(stderr, "%s %s:%u <%s> %s\r\n",
[now UTF8String], [[[NSString stringWithUTF8String:sourceFile]  
lastPathComponent] UTF8String],

lineNumber, [self aslLevelToString:level], 
[message UTF8String]);
fflush(stderr);
}
}

+ (const char *)aslLevelToString:(int) level {
switch (level) {
case ASL_LEVEL_EMERG:   return ASL_STRING_EMERG;
case ASL_LEVEL_ALERT:   return ASL_STRING_ALERT;
case ASL_LEVEL_CRIT:return ASL_STRING_CRIT;
case ASL_LEVEL_ERR: return ASL_STRING_ERR;
case ASL_LEVEL_WARNING: return ASL_STRING_WARNING;
case ASL_LEVEL_NOTICE:  return ASL_STRING_NOTICE;
case ASL_LEVEL_INFO:return ASL_STRING_INFO;
default:return ASL_STRING_DEBUG;
}
}


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



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Open Window from Input Manager

2008-10-29 Thread Daniel
I finally got it! :-)


NSBundle *bundle = [NSBundle bundleWithIdentifier: @"org.x616c.LMC"];
NSWindowController *controller = [[NSWindowController 
alloc]
initWithWindowNibPath: [NSString
stringWithFormat:@"%@/Contents/Resources/Chooser.nib", [bundle
bundlePath]] owner: self];
[controller showWindow:self];


thank all for the help!

Daniel

On Wed, Oct 29, 2008 at 4:25 PM, Michael Ash <[EMAIL PROTECTED]> wrote:
> On Wed, Oct 29, 2008 at 9:29 AM, Daniel <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> thank you for your reply.
>>
>> Does this mean that I'm trying to loading a NIB file from the bundle
>> of the running application (in which the input manager has been
>> loaded)?
>>
>> NSBundle *bundle = [NSBundle bundleWithIdentifier: @"org.x616c.LMC"];
>>
>> I've found out how to find the right bundle, but I'm still stuck in
>> trying to load a window from a NIB file inside my bundle ... can
>> someone help me?
>
> Your last post indicated an NSWindowController being used to load the
> nib. I am not 100% sure on this (please post your code when you have
> question!) but that's how it appeared.
>
> If so, then you should be able to get things working by using a custom
> subclass of NSWindowController that's in your bundle.
> NSWindowController is, I think, smart enough to look in the same
> bundle as the class of the object doing the loading.
>
> Failing that, rather than using -initWithWindowNibName:, use
> -initWithWindowNibPath:owner: which allows you to specify a full path.
> NSBundle can get you a full path for any resource file.
>
> If you want to load the nib manually (not recommended, always use
> NSWindowController or NSViewController to load nibs) then you can use
> the NSNib class, or one of the NSBundle extensions in NSNibLoading.h.
>
> 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/daniel.rampanelli%40gmail.com
>
> This email sent to [EMAIL PROTECTED]
>
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Open Window from Input Manager

2008-10-29 Thread Douglas Davidson


On Oct 29, 2008, at 9:16 AM, Daniel wrote:


[NSString
stringWithFormat:@"%@/Contents/Resources/Chooser.nib", [bundle
bundlePath]]


I'm afraid I missed the start of this discussion, but this snippet is  
wrong.  It should be [bundle pathForResource:@"Chooser" ofType:@"nib"].


Douglas Davidson

___

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

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

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

This email sent to [EMAIL PROTECTED]


How do I call a function when my preference pane bundle closes?

2008-10-29 Thread Adam Penny

Hi there,

I want to save preferences when the user either closes the preference  
pane window, clicks the show all button or quits system preferences.  
Can I just put the method call in the -(void)dealloc or is this a bad  
idea?


Thanks,

Adam
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Path handling routines

2008-10-29 Thread Jamie Hardt


On Oct 29, 2008, at 6:01 AM, Daniel Luis dos Santos wrote:


Hello,

Are there in the Foundation framework (or anywhere else on the Cocoa  
platform) path handling routines (directory extraction, path  
decomposition) ?



NSString has several methods for extracting the basename, directory  
name, extension etc.


• + pathWithComponents:
• – pathComponents
• – completePathIntoString:caseSensitive:matchesIntoArray:filterTypes:
• – fileSystemRepresentation
• – getFileSystemRepresentation:maxLength:
• – isAbsolutePath
• – lastPathComponent
• – pathExtension
• – stringByAbbreviatingWithTildeInPath
• – stringByAppendingPathComponent:
• – stringByAppendingPathExtension:
• – stringByDeletingLastPathComponent
• – stringByDeletingPathExtension
• – stringByExpandingTildeInPath
• – stringByResolvingSymlinksInPath
• – stringByStandardizingPath
• – stringsByAppendingPaths:

The safest way of turning argv[i] into an NSString is with  
NSFileManager, thus:


NSString *path = [[NSFileManager defaultManager]  
stringWithFileSystemRepresentation:argv[i] length:strlen(argv[i])];



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Path handling routines

2008-10-29 Thread Douglas Davidson


On Oct 29, 2008, at 9:24 AM, Jamie Hardt wrote:

The safest way of turning argv[i] into an NSString is with  
NSFileManager, thus:


NSString *path = [[NSFileManager defaultManager]  
stringWithFileSystemRepresentation:argv[i] length:strlen(argv[i])];


The best way to turn an arbitrary C string path into an NSString is  
via NSFileManager, but for arguments specifically one can use  
NSProcessInfo to obtain them as an array of NSStrings directly.


Douglas Davidson

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How do I call a function when my preference pane bundle closes?

2008-10-29 Thread Jason Coco


On Oct 29, 2008, at 12:22 , Adam Penny wrote:


Hi there,

I want to save preferences when the user either closes the  
preference pane window, clicks the show all button or quits system  
preferences. Can I just put the method call in the -(void)dealloc or  
is this a bad idea?


This is a bad idea. -(void)dealloc may never be called. You should do  
this in your pref pane subclass in the -(void)didUnselect or - 
(void)willUnselect functions.


J

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: How do I call a function when my preference pane bundle closes?

2008-10-29 Thread Adam Penny
Thank you Jamie and Jason. Jamie's email has just panicked me as I've  
been using CFPreferences rather than NSUserDefaults. It's a system  
preference pane and I understood that CFPreferences was the way to do  
this. The documents for CFPreferences kept on saying not to  
synchronize regularly, so I thought that when synching when the window  
closed would be a good option.


That said, if I'm on the wrong track I can always change my strategy  
if there's a better way I missed?


Adam
On Oct29, 2008, at 5:38 PM, Jason Coco wrote:



On Oct 29, 2008, at 12:22 , Adam Penny wrote:


Hi there,

I want to save preferences when the user either closes the  
preference pane window, clicks the show all button or quits system  
preferences. Can I just put the method call in the -(void)dealloc  
or is this a bad idea?


This is a bad idea. -(void)dealloc may never be called. You should  
do this in your pref pane subclass in the -(void)didUnselect or - 
(void)willUnselect functions.


J


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How do I call a function when my preference pane bundle closes?

2008-10-29 Thread Nick Zitzmann


On Oct 29, 2008, at 10:22 AM, Adam Penny wrote:

I want to save preferences when the user either closes the  
preference pane window, clicks the show all button or quits system  
preferences. Can I just put the method call in the -(void)dealloc or  
is this a bad idea?



Bad idea. -dealloc is reserved for nullifying pointers in other  
objects, releasing objects, etc. Your idea will also break if the pane  
never gets deallocated, and will also fail if preference panes ever  
support GC in the future. I would recommend just setting preferences  
as you go; this is not an expensive thing to do.


Nick Zitzmann


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to show Interface Builder's build warning and messages?

2008-10-29 Thread Sean McBride
On 10/29/08 9:39 AM, Oleg Krupnov said:

>Recently I was building my project and saw there were some warnings
>and messages regarding a XIB file.
>
>For example, there were warnings that some connection outlets were
>broken, and there were messages that some views were clipping their
>own content.
>
>After I fixed the connection outlets, the warnings were gone, but the
>messages were no longer displayed neither, yet I still wanted to fix
>the clipping views too. In other words, if there are no warnings but
>only messages in a XIB, the latter are not shown in the build results.
>
>How do I re-show these messages again in IB?
>
>I tried to click "Info" for the XIB in IB, but the list is empty.

This would be better on the Xcode list, but...

Have you looked at IB's Preferences > Alerts?

--

Sean McBride, B. Eng [EMAIL PROTECTED]
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: file references in CoreData

2008-10-29 Thread Sean McBride
On 10/29/08 7:02 AM, I. Savant said:

>> I need to store references to local files in CoreData. What is the
>> best solution for this. Just now I use plain paths but there has to
>> be a better way.
>
>   I use the much-lauded BDAlias:
>
>http://eschatologist.net/bDistributed.com/index.html

Another option is NDAlias:


Last I checked, BDAlias does not support garbage collection and 64bit,
which NDAlias does.

--

Sean McBride, B. Eng [EMAIL PROTECTED]
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: ASL & Unicode in Xcode's Console

2008-10-29 Thread Aki Inoue

Sean,

Thanks for following up to my comment 8-).

Yes, we do support non-ASCII characters in CFString/NSString literals  
with the compiler shipped with Xcode 3.0 and later.
The compiler does recognize the CFSTR() macro in non-Objc source files  
and both the macro and @"" notion in ObjC files.


The documentation is not updated to reflect the new functionality,  
yet.  Filing bugs would certainly help.


Note I realized that some of you might have experienced issues  
embedding non-ASCII characters even with Xcode 3.x compilers earlier  
this year.
The functionality was not enabled for some beta versions of a certain  
SDK we're not supposed to discuss here 9-)


Aki
"the man behind NSString/CFString Unicode magic"

On 2008/10/29, at 7:16, Sean McBride wrote:


On 10/29/08 1:27 AM, Jason Coco said:


That is no longer necessary in 10.5 / Xcode 3.  You can use
Unicode in
string literals in Objective-C.


Why do you say this? I thought that I may have missed something,
but looking
back through all the documentation, all the warnings about only
including 7-bit ASCII
characters in string literals still exist... even in the most
recent updated documentation.


ISTR seeing this in the release notes somewhere, but can't find it
now either.  Anyway, see

http://lists.apple.com/archives/Cocoa-dev/2008/Apr/msg01885.html


Well, I still can't find anything that says this other than  
somebody's

statement on a mailing list...


Aki's not just a 'somebody' but a member of Apple's Cocoa team.  There
are several posts in the archives about this being supported now.   
IIRC,

it only works in .m/.mm files, not .c/.cpp.


the three
most recently updated documents that apple put out dealing with
strings all specifically say that string
literals (CFStringRef, NSConstantString and c style string constants)
all must be 7-bit ascii encoded


Please file a bug against the docs.

--

Sean McBride, B. Eng [EMAIL PROTECTED]
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

Please do not post admin requests or moderator comments to the list.
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 [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: file references in CoreData

2008-10-29 Thread I. Savant
On Wed, Oct 29, 2008 at 1:15 PM, Sean McBride <[EMAIL PROTECTED]> wrote:

> Last I checked, BDAlias does not support garbage collection and 64bit,
> which NDAlias does.

  Good catch. Looks like I might need to update my own code in the
next few months. :-)

--
I.S.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Is there an equivalent to std::min/std::max for Cocoa programmer's

2008-10-29 Thread Michael A. Crawford

-Michael

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: How do I call a function when my preference pane bundle closes?

2008-10-29 Thread Jamie Hardt

On Oct 29, 2008, at 9:47 AM, Adam Penny wrote:

Thank you Jamie and Jason. Jamie's email has just panicked me as  
I've been using CFPreferences rather than NSUserDefaults. It's a  
system preference pane and I understood that CFPreferences was the  
way to do this. The documents for CFPreferences kept on saying not  
to synchronize regularly, so I thought that when synching when the  
window closed would be a good option.


That said, if I'm on the wrong track I can always change my strategy  
if there's a better way I missed?


If you're doing a Cocoa application, NSUserDefaults and its friends  
are definitely the simpler way to go, but they both work.



Jamie Hardt
The Sound Department
http://www.soundepartment.com/
http://www.imdb.com/name/nm0362504/

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: file references in CoreData

2008-10-29 Thread Paul Thomas
I'm currently working on a system that uses NDAlias (http://codebeach.org/code/show/34 
) in a CoreData store. It works pretty well in that the user can move  
the files around when the app isn't running and (so long as they stay  
on the same volume) it'll find them again when it wakes up.


I'm using mogenerator (http://rentzsch.com/code/mogenerator), so I set  
the attribute to the 'Transformable' and add to the user info (in the  
user tab of the model editor the key: 'attributeValueClassName' and  
value: 'NDAlias'. I also had to modify the standard template to  
#import "NDAlias.h" which is a little hacky - but I didn't have time  
to follow it up.


If you do use NDAlias, keep in mind that the factory you will most  
likely use +[NDAlias aliasFromPath] only creates a minimal alias that  
doesn't follow moved files (and seems a little pointless to me!) so  
use one of the other methods (where you specify a relative path).


pt.

P.S. if you use mogenerator and find an elegant fix for the missing  
header problem, please submit a patch to the author so we can all  
benefit.




On 29 Oct 2008, at 08:44, Georg Seifert wrote:


hello,

I’m very new to CoreData and can’t find anything on this:

I need to store references to local files in CoreData. What is the  
best solution for this. Just now I use plain paths but there has to  
be a better way.


Thanks
Georg___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: file references in CoreData

2008-10-29 Thread Uli Kusterer

On 29.10.2008, at 09:59, Dirkjan Krijnders wrote:
When using Leopard this is easy: you can store any data type in core  
data using the 'Transformable' type. Use this to store instances of  
NSURL that point to your files see

http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdNSAttributes.html
for more information.



 I'd recommend going for an Alias Record instead. URLs are just as  
fragile as file paths. NDAlias or BDAlias can be serialized to NSData.  
Keep the path as a backup, but really, recovering files across  
restarts and tracking them even if the user moves them or the drive  
gets mounted under a different mount point is a job for Aliases.


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





___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: file references in CoreData

2008-10-29 Thread Sean McBride
On 10/29/08 11:05 AM, Paul Thomas said:

>I'm currently working on a system that uses NDAlias (http://
>codebeach.org/code/show/34
>) in a CoreData store. It works pretty well in that the user can move
>the files around when the app isn't running and (so long as they stay
>on the same volume) it'll find them again when it wakes up.
>
>I'm using mogenerator (http://rentzsch.com/code/mogenerator), so I set
>the attribute to the 'Transformable' and add to the user info (in the
>user tab of the model editor the key: 'attributeValueClassName' and
>value: 'NDAlias'. I also had to modify the standard template to
>#import "NDAlias.h" which is a little hacky - but I didn't have time
>to follow it up.

We do exactly the same.

>P.S. if you use mogenerator and find an elegant fix for the missing
>header problem, please submit a patch to the author so we can all
>benefit.

We have submitted such a patch, but the author is busy of late, though
I'm confident he'll eventually incorporate it.

In the meantime, I suggest you import NDAlias.h into your prefix header,
that way you don't need to edit the machine files.

--

Sean McBride, B. Eng [EMAIL PROTECTED]
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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

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

This email sent to [EMAIL PROTECTED]


How to get CGScreenRegisterMoveCallback working?

2008-10-29 Thread Steve McLeod
Hi list,

I am a complete Objective-C/Cocoa/Xcode novice, so please be gentle if my
mistake is dead obvious.

I am trying to detect whether any window moves on the screen. As far as I
can tell CGScreenRegisterMoveCallback should let me do this. But in the
little test code below, which registers callbacks then waits 20 seconds, I
never see the message "Updated" or "Refreshed". The code builds and runs
without warnings.

Any ideas?

Many thanks,

Steve McLeod
---
#import 
#import 

void MyScreenRefreshCallback (CGRectCount count, const CGRect * rectArray,
void * userParameter){
NSLog(@"Refreshed");
}

void MyScreenUpdateMoveCallback (CGScreenUpdateMoveDelta delta, size_t
count, const CGRect * rectArray, void * userParameter) {
NSLog(@"Updated");
}

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

NSLog(@"Started");

CGRegisterScreenRefreshCallback(MyScreenRefreshCallback, NULL);
CGScreenRegisterMoveCallback(MyScreenUpdateMoveCallback, NULL);

sleep(20);

[pool drain];
return 0;
}
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to get CGScreenRegisterMoveCallback working?

2008-10-29 Thread Nick Zitzmann


On Oct 29, 2008, at 12:00 PM, Steve McLeod wrote:

I am trying to detect whether any window moves on the screen. As far  
as I
can tell CGScreenRegisterMoveCallback should let me do this. But in  
the
little test code below, which registers callbacks then waits 20  
seconds, I
never see the message "Updated" or "Refreshed". The code builds and  
runs

without warnings.

Any ideas?



You need to create and run a run loop.

Nick Zitzmann


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to get CGScreenRegisterMoveCallback working?

2008-10-29 Thread Steve McLeod
Thanks Nick,

I tried creating a RunLoop, that runs for 10 seconds, but I still had no
joy. I guess I'm still making beginner mistakes. Any ideas from the code
below, which now has a RunLoop?

#import 
#import 

void MyScreenRefreshCallback (CGRectCount count, const CGRect * rectArray,
void * userParameter){
NSLog(@"Refreshed");
}

void MyScreenUpdateMoveCallback (CGScreenUpdateMoveDelta delta, size_t
count, const CGRect * rectArray, void * userParameter) {
NSLog(@"Updated");
}

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

NSLog(@"Started");

CGRegisterScreenRefreshCallback(MyScreenRefreshCallback, NULL);
CGScreenRegisterMoveCallback(MyScreenUpdateMoveCallback, NULL);

NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
[runLoop runUntilDate:[NSDate dateWithTimeIntervalSinceNow: 10]];

NSLog(@"Finished");

[pool drain];
return 0;
}



2008/10/29 Nick Zitzmann <[EMAIL PROTECTED]>

>
> On Oct 29, 2008, at 12:00 PM, Steve McLeod wrote:
>
>  I am trying to detect whether any window moves on the screen. As far as I
>> can tell CGScreenRegisterMoveCallback should let me do this. But in the
>> little test code below, which registers callbacks then waits 20 seconds, I
>> never see the message "Updated" or "Refreshed". The code builds and runs
>> without warnings.
>>
>> Any ideas?
>>
>
>
> You need to create and run a run loop.
>
> Nick Zitzmann
> 
>
>
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: ASL & Unicode in Xcode's Console

2008-10-29 Thread Ken Ferry
When a method is undocumented, that means it isn't part of the
interface that is stable from release to release.

If that function is removed from the OS, and you reference it in your
binary, your app will not launch.

-Ken

On Wed, Oct 29, 2008 at 7:53 AM, Yvan BARTHÉLEMY <[EMAIL PROTECTED]> wrote:
> In fact I am very interested about this undocumented call as it is painful
> for me to dig into darwin sources.
>
> Thanks,
> Yvan
>
> Le 29 oct. 08 à 14:41, Jason Coco a écrit :
>
>>
>> On Oct 29, 2008, at 09:06 , Yvan BARTHÉLEMY wrote:
>>
>>> A solution for this is to not use directly asl_log, but wrap it to a
>>> function that will then use asl_log for console, and fprintf for logging to
>>> stderr (instead of asl_open(stderr)), of course you will have to regenerate
>>> yourself date, host name, process name, process id information if needed
>>> when using fprintf.
>>
>> Yeah, that's basically the solution I used, but didn't really bother with
>> re-generating the log information. I also used an undocumented call that I
>> found on the asl source code that let me specify the encoding that I wanted
>> instead of defaulting to that stupid "visual" encoding for the console. But
>> I wrapped the ASL stuff in an Objective-C class so I just added code that if
>> the level was ASL_LEVEL_DEBUG and NDEBUG wasn't defined, the data went to
>> stderr as well as the logging system.
>>
>> J
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> 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 [EMAIL PROTECTED]
>
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to get CGScreenRegisterMoveCallback working?

2008-10-29 Thread Nick Zitzmann


On Oct 29, 2008, at 12:50 PM, Steve McLeod wrote:

I tried creating a RunLoop, that runs for 10 seconds, but I still  
had no
joy. I guess I'm still making beginner mistakes. Any ideas from the  
code

below, which now has a RunLoop?



One other thing you might need to do is get a window server  
connection, which you can do by calling NSApplicationLoad() at the  
start of your program.


Nick Zitzmann


___

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

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

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

This email sent to [EMAIL PROTECTED]


Unhilite a window title bar?

2008-10-29 Thread James Walker
Is there a way to remove the hilite from a Cocoa window, so that it no 
longer looks active, without making some other Cocoa window main or key? 
   Sending the window resignMainWindow and resignKeyWindow doesn't do it.


No doubt that sounds like a strange question.  I'm looking for a 
workaround to a Carbon/Cocoa integration bug.

--
  James W. Walker, Innoventive Software LLC
  
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Problem with NSData to NSString to NSData

2008-10-29 Thread Joel Norvell
Dear Cocoa-dev People,

First, I wanted to thank Aki Inoue and Rob Keniger for pointing out the problem 
with my NSData->NSString->NSData approach.

As an alternative, would it be fruitful to use a Directory Wrapper to represent 
the data as two files; one the metadata and the other the pdf?  Then I could 
work with the metadata file, but just display the pdf file.

In the "What could go wrong here?" department, would my compound file end up 
behaving like a directory (or worse)?

Many thanks,
Joel Norvell


On 2008/10/28, at 21:43, Joel Norvell <> wrote:

> Dear Cocoa-dev People,
>
> I have a file with some metadata prepended to a pdf.
>
> I want to strip the metadata off and display the pdf.
>
> I was trying to do this:
>
> - (void) loadFromPath: (NSString *) path
> {
>  NSData *myData = [NSData dataWithContentsOfFile:path];
>
>  NSString *myStr = [[NSString alloc] initWithData:pdfData
>  encoding:NSASCIIStringEncoding];
>
>  // I strip off the metadata here, leaving the pdfStr.
>
>  // Nothing I've tried here has worked:
>  NSData * myNewData = [pdfStr dataUsingEncoding: ???];
>
>  // Display the pdf here...
> }
>
> How can I get this to work?
>
> Sincerely,
>
> Joel Norvell
>
>




  
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Problem with NSData to NSString to NSData

2008-10-29 Thread Graham Cox


On 30 Oct 2008, at 7:46 am, Joel Norvell wrote:

As an alternative, would it be fruitful to use a Directory Wrapper  
to represent the data as two files; one the metadata and the other  
the pdf?  Then I could work with the metadata file, but just display  
the pdf file.


In the "What could go wrong here?" department, would my compound  
file end up behaving like a directory (or worse)?


What could be worse? ;-) As long as you set the "package" bit it will  
look like a file, as least on OS X. On other file systems it will look  
like a directory.


The problem I think is that your file would cease to be directly  
openable by any other program that reads PDFs unless they are aware of  
your package layout, or can drill down into packages, which isn't  
common.


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 [EMAIL PROTECTED]


Re: Open Window from Input Manager

2008-10-29 Thread Daniel
wow, now it my code looks much nicer :-)

thank you very much!

Daniel

On Wed, Oct 29, 2008 at 5:20 PM, Douglas Davidson <[EMAIL PROTECTED]> wrote:
>
> On Oct 29, 2008, at 9:16 AM, Daniel wrote:
>
>> [NSString
>> stringWithFormat:@"%@/Contents/Resources/Chooser.nib", [bundle
>> bundlePath]]
>
> I'm afraid I missed the start of this discussion, but this snippet is wrong.
>  It should be [bundle pathForResource:@"Chooser" ofType:@"nib"].
>
> Douglas Davidson
>
>
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Is there an equivalent to std::min/std::max for Cocoa programmer's

2008-10-29 Thread Jean-Daniel Dupas

MIN(), MAX() (from Foundation/NSObjCRuntime.h) ?


Le 29 oct. 08 à 18:26, Michael A. Crawford a écrit :


-Michael___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Problem with NSData to NSString to NSData

2008-10-29 Thread Ricky Sharp


On Oct 29, 2008, at 3:46 PM, Joel Norvell wrote:


Dear Cocoa-dev People,

First, I wanted to thank Aki Inoue and Rob Keniger for pointing out  
the problem with my NSData->NSString->NSData approach.


As an alternative, would it be fruitful to use a Directory Wrapper  
to represent the data as two files; one the metadata and the other  
the pdf?  Then I could work with the metadata file, but just display  
the pdf file.


In the "What could go wrong here?" department, would my compound  
file end up behaving like a directory (or worse)?



From your original implementation of putting the metadata directly  
into the PDF file, you'll now end up with obviously a proprietary  
file.  i.e. No application that works with PDF will be able to work  
with that file.


By having a separate file, things can become fragile.  However, the  
solution here is to use a package type for a custom document.  Just as  
TextEdit does for the rtfd type.


Your "package" folder would then contain the original PDF and a  
separate file (or files) for your metadata.


This document type would most likely not be openable in any app that  
opens PDF (unless their open dialogs have the 'allow navigation of  
packages' option set).  But, advanced users could your package via  
Finder and work with the PDF directly if they need to.


___
Ricky A. Sharp mailto:[EMAIL PROTECTED]
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 [EMAIL PROTECTED]


[MEET] CocoaHeads Mac Developer Meetings

2008-10-29 Thread Stephen Zyszkiewicz

Greetings,

CocoaHeads is an international Mac programmer's group.  We specialize
in Cocoa, but everything Mac programming related is welcome.

Why Should I Attend?
Meeting other Mac OS X developers in person is both fun and immensely
useful. There's no better way to learn Cocoa or get help with problems
than being around other people who are writing Mac software.

We usually have several Cocoa experts hanging around that are happy to
answer whatever questions they can. Bring your laptop and any code
you're working on.

Everyone is Welcome
Meetings are free and open to the public. Feel free to drop in even if
you've never attended or aren't currently using Cocoa. We usually have
a few new faces, so don't worry about being the odd one out.

Upcoming meetings:
Canada
Ottawa/Gatineau- Thursday November 13, 2008 08:00 PM EDT.

Germany
Berlin- Thursday November 13, 2008 07:00 PM CEST.
Bonn- Thursday November 20, 2008 07:00 PM CEST.

Sweden
Stockholm- Monday November 03, 2008 07:30 PM CEST.

United Kingdom
Swindon- Monday November 03, 2008 09:00 PM BST.

United States
Boston- Thursday November 13, 2008 07:00 PM EDT.
Boulder- Tuesday November 11, 2008 08:00 PM MDT.
Colorado Springs- Thursday November 13, 2008 07:00 PM MST.
Des Monies- Thursday November 13, 2008 07:00 PM CST.
Fort Lauderdale- Sunday November 16, 2008 08:00 PM EDT.
Minneapolis- Thursday November 13, 2008 06:00 PM CST.
Philadelphia- Thursday November 13, 2008 07:00 PM EDT.
Provo- Thursday November 13, 2008 07:00 PM MST.
St. Louis- Saturday November 22, 2008 02:00 PM CST.


Please check the web site at  for more
information including last-minute changes. Some chapters may have yet
to post their meeting for this month.


Steve
Silicon Valley CocoaHeads

___

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

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

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

This email sent to [EMAIL PROTECTED]


What's wrong with this font thing?

2008-10-29 Thread Randall Meadows
OK, I have to assume that I'm doing something really wrong here, but  
man, I sure can't see it.  Maybe my understanding is out of whack,  
maybe some kind soul will show me the light... (Sorry for the length,  
I'm trying to include all relevant information up front.)


I am attempting to replicate an API call that is available on another  
platform, but not on Mac OS X.  The call in question takes a string, a  
font, a width, and reduces the font size (if necessary) theoretically  
applied to that string such that when drawn, that string would occupy  
no more than the specified width (down to a mimimum font size also  
specified), and then returns the adjusted font size as well as the  
NSSize that the string would occupy if it were to be drawn with that  
font at that adjusted size.


Here is my version of that routine:

- (NSSize)sizeWithFont:(NSFont *)font
   minFontSize:(CGFloat)minFontSize
actualFontSize:(CGFloat *)actualFontSize
  forWidth:(CGFloat)width
{
   CGFloat pointSize = [font pointSize];
   NSDictionary   *attrs = [NSDictionary dictionaryWithObject:font  
forKey:NSFontAttributeName];

   NSSize thisSize = [self sizeWithAttributes:attrs];

   if (width > 0) {
  while (pointSize >= minFontSize) {
 attrs = [NSDictionary dictionaryWithObject:[NSFont  
fontWithName:[font fontName]
 
size:pointSize]
  
forKey:NSFontAttributeName];

 thisSize = [self sizeWithAttributes:attrs];
 if (thisSize.width <= width) {
break;
 }
 pointSize -= 1.0;
  }
   }

   if (actualFontSize != NULL) {
  *actualFontSize = (pointSize > minFontSize) ? pointSize :  
minFontSize;

   }

   return thisSize;
}

The font in question at this particular juncture is Arial Bold (NSFont  
= "Arial-BoldMT 16.00 pt. P [] (0x16274640) fobj=0x16262bc0,  
spc=4.45"; says gdb when I 'po font').  The font is originally  
retrieved by doing "[NSFont fontWithName:@"Arial-BoldMT" size:16.0]".


If I start out at a size 20, here are the resulting sizes for a given  
string:


At 20, height = 23
At 19, height = 22
At 18, height = 21
At 17, height = 20
At 16, height = 18
At 15, height = 21
At 14, height = 20
At 13, height = 19
At 12, height = 18

I forced that routine to start at 20 for debugging purposes; the  
actual font sent in is of size 16, the minimum is 12, and in fact, at  
12 the string fits into the specified width.


However, when I draw the string at the reduced size using - 
drawInRect:withAttributes:, the baseline of the string moves; I wanted  
to adjust for that by using the difference in heights from drawing it  
big versus drawing it reduced, but there is no difference in heights  
between 16 and 12.  That boggles my mind.


Why does the height suddenly jump UP going from 16 down to 15 points?
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: What's wrong with this font thing?

2008-10-29 Thread Graham Cox


On 30 Oct 2008, at 9:45 am, Randall Meadows wrote:


Why does the height suddenly jump UP going from 16 down to 15 points?




I'm not sure, but could it be that there are thresholds where a  
different master font is used? As you cross the threshold the system  
decides to base the font on a different master.


A different solution if you know you are just displaying the text is  
to convert the glyphs to a path and simply scale the path to fit. That  
way you can scale it utterly smoothly with no jumps or sudden change  
in appearance.


But if you wish to stick with using the Font Manager, wouldn't you be  
better off doing a binary search for the right size? Gradually  
shrinking the font to fit could end up being slow especially as there  
may be all sorts of font loading/caching going on in the font manager.  
A binary search would also allow you to start at any size and  
*increase* the font size if necessary as well as decrease it, as well  
as being the fastest way to get there. Just a thought.


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 [EMAIL PROTECTED]


Re: What's wrong with this font thing?

2008-10-29 Thread Randall Meadows

On Oct 29, 2008, at 4:59 PM, Graham Cox wrote:


On 30 Oct 2008, at 9:45 am, Randall Meadows wrote:


Why does the height suddenly jump UP going from 16 down to 15 points?


I'm not sure, but could it be that there are thresholds where a  
different master font is used? As you cross the threshold the system  
decides to base the font on a different master.


Quite possible, I'm not that font-smart.

A different solution if you know you are just displaying the text is  
to convert the glyphs to a path and simply scale the path to fit.  
That way you can scale it utterly smoothly with no jumps or sudden  
change in appearance.


Interesting idea, I'll look into that.

But if you wish to stick with using the Font Manager, wouldn't you  
be better off doing a binary search for the right size? Gradually  
shrinking the font to fit could end up being slow especially as  
there may be all sorts of font loading/caching going on in the font  
manager. A binary search would also allow you to start at any size  
and *increase* the font size if necessary as well as decrease it, as  
well as being the fastest way to get there. Just a thought.


In my case, I don't care to upsize, and the most times that loop will  
run is 14, so I'm not too terribly concerned about performance.  I'm  
way more concerned about quality, which I'm not satisfied at all with  
right now, so maybe the glyphs thing will pan out.


Off to check it out...
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 [EMAIL PROTECTED]


Re: What's wrong with this font thing?

2008-10-29 Thread Peter Ammon


On Oct 29, 2008, at 3:45 PM, Randall Meadows wrote:

OK, I have to assume that I'm doing something really wrong here, but  
man, I sure can't see it.  Maybe my understanding is out of whack,  
maybe some kind soul will show me the light... (Sorry for the  
length, I'm trying to include all relevant information up front.)


I am attempting to replicate an API call that is available on  
another platform, but not on Mac OS X.  The call in question takes a  
string, a font, a width, and reduces the font size (if necessary)  
theoretically applied to that string such that when drawn, that  
string would occupy no more than the specified width (down to a  
mimimum font size also specified), and then returns the adjusted  
font size as well as the NSSize that the string would occupy if it  
were to be drawn with that font at that adjusted size.


Trying to find the right font size to just fit the text seems a bit  
archaic.  Here is a different approach:


- Measure the string with some font
- Divide the space available by the measured width to find the scale  
factor

- Use CGContextScaleCTM() to apply the scale to the current transform
- Draw the string with that font.  It will scale nicely and fit into  
the available space.


-Peter

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Is there an equivalent to std::min/std::max for Cocoa programmer's

2008-10-29 Thread Michael A. Crawford
Thank you.  I did try to find these using the help feature in Xcode  
and the documentation that is included with Xcode but I did not get a  
hit.  I also tried spotlight but no-joy.  What is the best way to find  
equivalent methods like these?  Most of my experience is in coding for  
POSIX/Linux/Unix and Win32/.NET.  Though I could have included the C++  
standard library, I think it is probably wise not to mix this with  
Cocoa.


-Michael

On Oct 29, 2008, at 11:51 AM, Jean-Daniel Dupas wrote:


MIN(), MAX() (from Foundation/NSObjCRuntime.h) ?


Le 29 oct. 08 à 18:26, Michael A. Crawford a écrit :


-Michael___

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

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

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

This email sent to [EMAIL PROTECTED]






smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Is there an equivalent to std::min/std::max for Cocoa programmer's

2008-10-29 Thread Michael A. Crawford
These are template methods that are included as part of the C++  
standard library.  They will take any type that supports comparison  
operators, both arguments must be of the same type.


-Michael

On Oct 29, 2008, at 10:43 AM, Stig Brautaset wrote:

it would help if you explained what these functions (I'm assuming  
they are functions) do. Do they work on a list, or do they just take  
two arguments, for example?


On 29 Oct 2008, at 17:26, Michael A. Crawford wrote:


-Michael___

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

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

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

This email sent to [EMAIL PROTECTED]


Stig
--
http://code.brautaset.org
http://devblog.brautaset.org








smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Is there an equivalent to std::min/std::max for Cocoa programmer's

2008-10-29 Thread Nick Zitzmann


On Oct 29, 2008, at 5:19 PM, Michael A. Crawford wrote:

Thank you.  I did try to find these using the help feature in Xcode  
and the documentation that is included with Xcode but I did not get  
a hit.  I also tried spotlight but no-joy.  What is the best way to  
find equivalent methods like these?


AFAICT, those macros aren't documented. File a bug report.

Most of my experience is in coding for POSIX/Linux/Unix and  
Win32/.NET.  Though I could have included the C++ standard library,  
I think it is probably wise not to mix this with Cocoa.



You can use the C++ standard library in Cocoa if you wish, but you  
must use ObjC++ if you do so.


Nick Zitzmann


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: What's wrong with this font thing?

2008-10-29 Thread Buddy Kurz
- Divide the space available by the measured width to find the scale  
factor


You can also use the scale factor to create a new font with a  
fractional size.


I have the same problem for a terminal emulator - I need the largest  
fixed font that will fit in a particular character spacing.  When I  
resize the window the sizes jump all over the place and the font is  
clearly changing in subtle ways.



On Oct 29, 2008, at 4:15 PM, Peter Ammon wrote:



On Oct 29, 2008, at 3:45 PM, Randall Meadows wrote:

OK, I have to assume that I'm doing something really wrong here,  
but man, I sure can't see it.  Maybe my understanding is out of  
whack, maybe some kind soul will show me the light... (Sorry for  
the length, I'm trying to include all relevant information up front.)


I am attempting to replicate an API call that is available on  
another platform, but not on Mac OS X.  The call in question takes  
a string, a font, a width, and reduces the font size (if necessary)  
theoretically applied to that string such that when drawn, that  
string would occupy no more than the specified width (down to a  
mimimum font size also specified), and then returns the adjusted  
font size as well as the NSSize that the string would occupy if it  
were to be drawn with that font at that adjusted size.


Trying to find the right font size to just fit the text seems a bit  
archaic.  Here is a different approach:


- Measure the string with some font
- Divide the space available by the measured width to find the scale  
factor

- Use CGContextScaleCTM() to apply the scale to the current transform
- Draw the string with that font.  It will scale nicely and fit into  
the available space.


-Peter

___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: What's wrong with this font thing?

2008-10-29 Thread Randall Meadows

On Oct 29, 2008, at 5:15 PM, Peter Ammon wrote:

Trying to find the right font size to just fit the text seems a bit  
archaic.  Here is a different approach:


- Measure the string with some font
- Divide the space available by the measured width to find the scale  
factor

- Use CGContextScaleCTM() to apply the scale to the current transform
- Draw the string with that font.  It will scale nicely and fit into  
the available space.


Doing that also shifts the rect that I'm trying to draw into.  I'm  
doing multiple NSString drawInRect:withAttributes: calls, all within a  
single view.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Problem with NSData to NSString to NSData

2008-10-29 Thread Michael Ash
On Wed, Oct 29, 2008 at 4:46 PM, Joel Norvell <[EMAIL PROTECTED]> wrote:
> Dear Cocoa-dev People,
>
> First, I wanted to thank Aki Inoue and Rob Keniger for pointing out the 
> problem with my NSData->NSString->NSData approach.
>
> As an alternative, would it be fruitful to use a Directory Wrapper to 
> represent the data as two files; one the metadata and the other the pdf?  
> Then I could work with the metadata file, but just display the pdf file.
>
> In the "What could go wrong here?" department, would my compound file end up 
> behaving like a directory (or worse)?

Depending on your goals, there may be better alternatives.

If you don't care about having this PDF file be readable by other
programs (like your initial PDF-and-metadata-appended-together format
wouldn't be) then you just need a better metadata+PDF format. I'd
suggest a property list for this. Create an NSDictionary. For one key,
perhaps called @"pdfdata", set the PDF data as the value. Use one or
more other keys for your metadata. Be sure to keep this as property
list objects, which are approximately limited to dictionaries, arrays,
strings, NSData, NSNumber, and NSDate. Then use
NSPropertyListSerialization to read and write the dictionary to
serialized form. If you do this, note that the XML format will expand
your data by a factor of 33% as it gets stored base64 encoded. The
binary format does not suffer from this, as the data gets stored
directly (obviously with some framing around it, but no constant
expansion). This could be important if your PDF data is potentially
enormous.

If you want your PDF to be readable by other apps then another thing
you could do is to use extended attributes. These store metadata at
the filesystem level, which can be read and written using getxattr()
and setxattr(). (They have man pages if you want more info.) Beware
that there is an annoyingly small limit on the size of extended
attributes, something around 4kB. So while this is a good solution if
your metadata is small, it's a pain to use if it's potentially large.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: What's wrong with this font thing?

2008-10-29 Thread Graham Cox


On 30 Oct 2008, at 10:37 am, Randall Meadows wrote:

Doing that also shifts the rect that I'm trying to draw into.  I'm  
doing multiple NSString drawInRect:withAttributes: calls, all within  
a single view.



Remember that transforms are always relative to the view's origin, so  
just scaling will move the rect. You have to transform to the origin,  
scale, then transform back to where you want to draw the text. If you  
were using NSAffineTransform it would go like this:


(warning: typed in Mail)

NSAffineTransform* transform = [NSAffineTransform transform];
[transform translateXBy:myRect.origin.x yBy:myRect.origin.y];
[transform scaleXBy:myScaleFactor yBy:myScaleFactor];
[transform translateXBy:-myRect.origin.x yBy:-myRect.origin.y];
[transform concat];

If using the CTM methods in Core Graphics, there are equivalent  
functions. This assumes that the rect's origin is where the text  
origin is, I can't remember if that's actually the case, but if it  
isn't then just translate to the necessary point and back.


You need to save/restore the graphics state around each drawing call.

(BTW Peter's approach is a good one, much easier than converting the  
glyphs to a path, but with identical results).


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 [EMAIL PROTECTED]


Re: What's wrong with this font thing?

2008-10-29 Thread Aki Inoue
The "threshold" being discussed here is the boundary between the  
screen font vs printer font in NSFont jargon.


For font size smaller than 16pt, we automatically substitute the  
default printer font to its corresponding screen font.

The metrics gap is caused by the substitution.

You can disable the auto-substitution with  
NSStringDrawingDisableScreenFontSubstitution flag.


When you change the scale/font size, the baseline shifts naturally  
when you layout from the top.
In order to keep it fixed at the baseline, you need to layout/render  
on it.

-drawInRect:withAttributes: always render from the top.

To render with the baseline, use -drawWithRect:options:attributes:.

Aki

On 2008/10/29, at 16:37, Randall Meadows wrote:


On Oct 29, 2008, at 5:15 PM, Peter Ammon wrote:

Trying to find the right font size to just fit the text seems a bit  
archaic.  Here is a different approach:


- Measure the string with some font
- Divide the space available by the measured width to find the  
scale factor

- Use CGContextScaleCTM() to apply the scale to the current transform
- Draw the string with that font.  It will scale nicely and fit  
into the available space.


Doing that also shifts the rect that I'm trying to draw into.  I'm  
doing multiple NSString drawInRect:withAttributes: calls, all within  
a single view.

___

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

Please do not post admin requests or moderator comments to the list.
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 [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTableColumn unbindable when NSSegmentedCell is used?

2008-10-29 Thread Dave Fernandes

If you google "NSSegmentedCell bindings", the first search result is
http://developer.apple.com/documentation/Cocoa/Reference/ 
CocoaBindingsRef/BindingsText/NSSegmentedCell.html


I'm guessing you want selectedIndex or selectedLabel or selectedTag.


On Oct 29, 2008, at 2:23 AM, Mike Laurence wrote:


Hello,

I'm migrating a non-binding version of an NSTableView over to a binded
version. In the non-binding version (using a data source), one of  
my table

columns used a subclass of NSSegmentedCell, and I merely overrode
setObjectValue in order to capture the data and set the number of  
segments,

their labels, etc.

In the binded version, I have successfully converted all of the  
text field

cells - each NSTableColumn has a 'value' binding, which I set to
[controller.arrangedObjects.key], and I'm able to see all of my  
text data
just fine. However, the NSTableColumn containing my NSSegmentedCell  
subclass
mysteriously lacks a 'value' binding, and I'm unable to fathom how  
to set

the data inside of it.

Can anyone point me to the correct way to bind my arrangedObjects  
to those

NSSegmentedCells?

Thanks very much!

Regards,
Mike Laurence
___

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

Please do not post admin requests or moderator comments to the list.
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.fernandes% 
40utoronto.ca


This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Static text over an image

2008-10-29 Thread Andre Masse

Hi,

I want to have text over an image. Even though I set it up in IB (move  
image to the back, bring the label to the front), the label is always  
drawn behind the image. Is there a setting to be set in IB for that or  
do I have to draw the text myself?


Thanks,

Andre Masse
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Static text over an image

2008-10-29 Thread Andrew Merenbach

On Oct 29, 2008, at 9:48 PM, Andre Masse wrote:


Hi,

I want to have text over an image. Even though I set it up in IB  
(move image to the back, bring the label to the front), the label is  
always drawn behind the image. Is there a setting to be set in IB  
for that or do I have to draw the text myself?


Thanks,

Andre Masse


Hi, Andre,

What operating system are you deploying to, and which SDK are you  
linking against?  If you're using anything before Leopard, you're out  
of luck with your present method, as clipping was not enforced among  
sibling views prior to 10.5.  There might possibly be caveats using  
10.5, as well, although I'm not versed enough to know what they are --  
hopefully someone with more experience, in this particular issue, will  
be able to chime in.


Cheers,
Andrew



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Problem with NSData to NSString to NSData

2008-10-29 Thread Marcel Weiher



On Oct 29, 2008, at 1:46 PM, Joel Norvell wrote:

First, I wanted to thank Aki Inoue and Rob Keniger for pointing out  
the problem with my NSData->NSString->NSData approach.


As an alternative, would it be fruitful to use a Directory Wrapper  
to represent the data as two files; one the metadata and the other  
the pdf?  Then I could work with the metadata file, but just display  
the pdf file.


In the "What could go wrong here?" department, would my compound  
file end up behaving like a directory (or worse)?


PDF has various facilities for storing your metadata inside the PDF  
file, why not use one of those?


Marcel

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Static text over an image

2008-10-29 Thread Rob Keniger


On 30/10/2008, at 2:48 PM, Andre Masse wrote:

I want to have text over an image. Even though I set it up in IB  
(move image to the back, bring the label to the front), the label is  
always drawn behind the image. Is there a setting to be set in IB  
for that or do I have to draw the text myself?



Try double-clicking the Image view in IB, which will move IB's "active  
selection" to the view itself. If you now drag a text field to the  
image, it will be placed as a subview of the NSImageView and always  
display in front.


--
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 [EMAIL PROTECTED]


Re: Static text over an image

2008-10-29 Thread Brandon Walkin
I've seen it happen a few times where views will be layered in the  
reverse order that they're set to in IB. Try moving the label behind  
the image and see if that gives you the desired result.


Cheers,
Brandon

On 30-Oct-08, at 12:48 AM, Andre Masse wrote:


Hi,

I want to have text over an image. Even though I set it up in IB  
(move image to the back, bring the label to the front), the label is  
always drawn behind the image. Is there a setting to be set in IB  
for that or do I have to draw the text myself?


Thanks,

Andre Masse
___

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

Please do not post admin requests or moderator comments to the list.
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 [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Parsing xml files in Cocoa applications

2008-10-29 Thread Arnab Ganguly
Hi All,
How do I read, parse xml files in Cocoa App ?Any standard parser is
available?
Thanks in advance
Regards
Arnab
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: inter-object communication

2008-10-29 Thread Nicko van Someren

On 29 Oct 2008, at 06:30, Charles Steinman wrote:

From: Albert Jordan <[EMAIL PROTECTED]>

What is the recommended way for Object B to inform Object A that it  
is

done processing a request for the following scenario?

Object A has a list of phone numbers to send SMS messages
Object B implements sending an SMS message to a given phone number
I think a delegate is the usual Cocoa pattern for this kind of  
situation. You could have Object B send Object A an - 
objectB:didSendSMSMessage:toNumber: message or something along those  
lines.


A delegate certainly seems to be the appropriate model here; delegates  
work well when there is usually one, and never more than one, object  
interested in the information.  If you have a situation where there  
might well me more than one or less than one interested object (e.g.  
object B noticed that the phone that might send the message has been  
disconnected) then posting a notification might be a better model; any  
interested party can then subscribe to that notification.


Cheers,
Nicko

___

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

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

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

This email sent to [EMAIL PROTECTED]


interface builder and nsarraycontroller binding newbie question

2008-10-29 Thread Bob Henkel
Hello,

I'm pretty new to the OSX and really new to Cocoa.

With the disclaimer aside

For one my first learning projects I started to follow a tutorial that
has me making use of a nsarraycontroller in IB and using bindings to
bind an nsarraycontroller to a Employee class I created.

CLASS Employee
name
salary
-(void)giveRandomSalary

I first setup my nsarraycontroller to the Employee class and then bind
the name and salary values to an nstableview with two columns. I also
added two buttons to the window a insert and a delete button. These
are used to invoke the nsarraycontroller's add and delete methods to
add and remove Employee objects contained in nsarraycontroller.  This
all works just fine and makes sense.

What I want to do now is invoke a method on the object I have selected
in nstableview by clicking a third button labeled Random Salary which
will call the method giveRandomSalary that I created in my Employee
class. The job of this method is just to set the Salary to a random
value. My issue is how do I invoke the method for the Employee object
?  Hopefully I'm not to far off path with what I'm trying to do. Any
help would be great.

Thanks
Bob
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Problem with NSData to NSString to NSData

2008-10-29 Thread Dave Geering
> From your original implementation of putting the metadata directly into the 
> PDF file, you'll now end up with obviously a proprietary file.  i.e. No 
> application that works with PDF will be able to work with that file.

That is not at all true. You can embed the data into a PDF stream but
never reference it. You'll have to check for an available stream ID
and also correct the cross reference table. You could in fact leave
the original cross reference table intact, add a new stream with your
metadata after the original %%EOF marker, construct the
cross-reference table with only one entry (the stream containing the
metadata), and adding another %%EOF marker. This is perfectly legit
PDF and in fact is the recommended way to use incremental updates as
per page 70 of the PDF reference.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Problem with NSData to NSString to NSData

2008-10-29 Thread Jeff Dutky
On Wed, Oct 29, 2008 at 4:46 PM, Joel Norvell <[EMAIL PROTECTED]> wrote:
> Dear Cocoa-dev People,
>
> First, I wanted to thank Aki Inoue and Rob Keniger for pointing out the 
> problem with my NSData->NSString->NSData approach.
>
> As an alternative, would it be fruitful to use a Directory Wrapper to 
> represent the data as two files; one the metadata and the other the pdf?  
> Then I could work with the metadata file, but just display the pdf file.
>
> In the "What could go wrong here?" department, would my compound file end up 
> behaving like a directory (or worse)?

Better yet, why not just insert the metadata into the PDF directly as comments?
The PDF format is basically a postscript file (with some missing
features and, I think, optional compression) and you should be able to
insert comments (lines starting with %%) after the first line (which
is a required header comment) with no problem.

Reliably detecting PDF files that contain your meta data and
extracting it may be a bit of a challenge, in the general case, but
not really all that hard. Before writing a lot of custom code to do
this, I'd have a look at the documentation for PDFKit and PDFDocument.

you can get references on the PDF format here:

http://www.adobe.com/devnet/pdf/pdf_reference_archive.html

-- Jeff Dutky
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Parsing xml files in Cocoa applications

2008-10-29 Thread Nick Zitzmann


On Oct 29, 2008, at 3:28 AM, Arnab Ganguly wrote:


How do I read, parse xml files in Cocoa App ?Any standard parser is
available?



Did you see the documentation for the NSXML family of classes?

Nick Zitzmann




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Is there an equivalent to std::min/std::max for Cocoa programmer's

2008-10-29 Thread Michael A. Crawford

Done.  See radar 6331394.

-Michael

On Oct 29, 2008, at 1:27 PM, Nick Zitzmann wrote:



On Oct 29, 2008, at 5:19 PM, Michael A. Crawford wrote:

Thank you.  I did try to find these using the help feature in Xcode  
and the documentation that is included with Xcode but I did not get  
a hit.  I also tried spotlight but no-joy.  What is the best way to  
find equivalent methods like these?


AFAICT, those macros aren't documented. File a bug report.

Most of my experience is in coding for POSIX/Linux/Unix and  
Win32/.NET.  Though I could have included the C++ standard library,  
I think it is probably wise not to mix this with Cocoa.



You can use the C++ standard library in Cocoa if you wish, but you  
must use ObjC++ if you do so.


Nick Zitzmann






smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]