Save Images Imported/Dropped To IKImageBrowser

2008-10-31 Thread Chunk 1978
i've been using Apple's ImageBrowser sample code to further understand
the image browser:
http://developer.apple.com/samplecode/ImageBrowser/listing2.html

i'm trying to make the image browser save the images that it displays
by copying any dragged image into it's own folder, and have the image
browser automatically display the contents of that folder whenever the
app launches.

for copying a dragged file into a designated folder (which i would use
to load images on init) i've tried adding the following to the
performDragOperation method, but it doesn't work for me (the desktop
here is just for testing):

if (data)
   {
   NSString *newFolder = @~/Desktop/;
   newFolder = [newFolder stringByExpandingTildeInPath];
   [data writeToFile: newFolder atomically:YES];

next i (think) i would set user defaults on deleting and reordering of
the images, so that the designated folder would also be in sync with
what is actually displayed in the image browser.  and finally, i would
add code to the initialize method that would populate the image
browser with the images that are inside the designated folder (here,
the desktop).

the problem is i'm lost... hah... also, i'm not familiar with
datasources, so i'm not 100% sure i know what it actually is... i'm
assuming the datasource is the URL of the file that is pasted on the
pasteboard during a drag, but that seems temporary, so how can i set
up a permanent datasource??

if anyone can direct me to some sample code that does exactly (or
close to) this, that would be amazing.
___

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

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


Creating NSDecimal

2008-10-31 Thread HAMILTON, Steven
Hi folks,
Can someone tell me how I create an NSDecimal? The  C struct one, not the ObjC 
NSDecimalNumber. For performance and simplicity I'd rather use the C interface 
but for the life of me I can't find out how to actually create one of these and 
assign a value to it.

\\Declare
NSDecimal *decimal;
\\assignfile:///\\assign? Surely its not as simple as this?
decimal = 16.75

Steven Hamilton | Solutions Designer | BT Infrastructure | Business Technology 
| Suncorp | Tel: 07 3135 4684
[EMAIL PROTECTED] | Level 27, Brisbane Square, 266 George Street, Brisbane




This e-mail is sent by Suncorp-Metway Limited ABN 66 010 831 722 or one of its 
related entities Suncorp.
Suncorp may be contacted at Level 18, 36 Wickham Terrace, Brisbane or on 13 11 
55 or at suncorp.com.au.
The content of this e-mail is the view of the sender or stated author and does 
not necessarily reflect the view of Suncorp. The content, including 
attachments, is a confidential communication between Suncorp and the intended 
recipient. If you are not the intended recipient, any use, interference with, 
disclosure or copying of this e-mail, including attachments, is unauthorised 
and expressly prohibited. If you have received this e-mail in error please 
contact the sender immediately and delete the e-mail and any attachments from 
your system.
If this e-mail constitutes a commercial message of a type that you no longer 
wish to receive please reply to this e-mail by typing Unsubscribe in the 
subject line.
___

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

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

2008-10-31 Thread Graham Cox


On 31 Oct 2008, at 5:08 pm, HAMILTON, Steven wrote:


Hi folks,
Can someone tell me how I create an NSDecimal? The  C struct one,  
not the ObjC NSDecimalNumber. For performance and simplicity I'd  
rather use the C interface but for the life of me I can't find out  
how to actually create one of these and assign a value to it.


\\Declare
NSDecimal *decimal;
\\assignfile:///\\assign? Surely its not as simple as this?
decimal = 16.75



It does seem weird that there's no way to create a NSDecimal! I'm  
pretty sure simple assignment won't work.

The only way I can see is something like this:

NSDecimal decimal = [[NSDecimalNumber  
decimalNumberWithString:@16.75] decimalValue];



maybe that helps?

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]


Document dirty state during field edit

2008-10-31 Thread Ashley Clark
I'm pretty sure I've seen someone ask this before but I just can't  
find it in Google. So I'll ask again.


I have undo/redo working throughout my program but I seem to remember  
earlier that upon opening a document and immediately after beginning  
to change the state of a text field that the document dirty status  
would be changed, before an actual undo was registered on the undo  
stack. (As a result of -objectDidBeginEditing:?)


Somehow I've disabled this behavior and for the life of me I can't  
determine what I've done wrong or how to get that behavior back.


Does anyone have any clues?


Ashley Clark

___

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

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

2008-10-31 Thread Roland King
looking at the documentation I think you need to start with an 
NSDecimalNumber then use one of the member functions to convert it to an 
NSDecimal, do the things you want to do on it, and convert it back again.


Remember also that NSDecimal is really just a structure, not an object, 
so when you declare it you'd normally do it on the stack, not as a pointer.


so I think I'd try something like

NSDecimal decinum = [ [ NSDecimalNumber decimalNumberWithMantissa:1675 
exponent:-2 isNegative:NO ] decimalValue ];


I suppose you could try to make one directly by doing

NSDecimal myDec;

then setting myDec._exponent and myDec._mantissa[], if you can figure 
out how it stores its mantissa but that seems to be more work and they 
are private so you'd be opening yourself up to apple changing the whole 
thing later.


HAMILTON, Steven wrote:


Hi folks,
Can someone tell me how I create an NSDecimal? The  C struct one, not the ObjC 
NSDecimalNumber. For performance and simplicity I'd rather use the C interface 
but for the life of me I can't find out how to actually create one of these and 
assign a value to it.

\\Declare
NSDecimal *decimal;
\\assignfile:///\\assign? Surely its not as simple as this?
decimal = 16.75

Steven Hamilton | Solutions Designer | BT Infrastructure | Business Technology 
| Suncorp | Tel: 07 3135 4684
[EMAIL PROTECTED] | Level 27, Brisbane Square, 266 George Street, Brisbane




This e-mail is sent by Suncorp-Metway Limited ABN 66 010 831 722 or one of its related 
entities Suncorp.
Suncorp may be contacted at Level 18, 36 Wickham Terrace, Brisbane or on 13 11 
55 or at suncorp.com.au.
The content of this e-mail is the view of the sender or stated author and does 
not necessarily reflect the view of Suncorp. The content, including 
attachments, is a confidential communication between Suncorp and the intended 
recipient. If you are not the intended recipient, any use, interference with, 
disclosure or copying of this e-mail, including attachments, is unauthorised 
and expressly prohibited. If you have received this e-mail in error please 
contact the sender immediately and delete the e-mail and any attachments from 
your system.
If this e-mail constitutes a commercial message of a type that you no longer 
wish to receive please reply to this e-mail by typing Unsubscribe in the 
subject line.
___

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

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

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

2008-10-31 Thread Andrew Farmer

On 30 Oct 08, at 23:18, Graham Cox wrote:

On 31 Oct 2008, at 5:08 pm, HAMILTON, Steven wrote:

Hi folks,
Can someone tell me how I create an NSDecimal? The  C struct one,  
not the ObjC NSDecimalNumber. For performance and simplicity I'd  
rather use the C interface but for the life of me I can't find out  
how to actually create one of these and assign a value to it.


//Declare
NSDecimal *decimal;
//assign? Surely its not as simple as this?
decimal = 16.75


It does seem weird that there's no way to create a NSDecimal! I'm  
pretty sure simple assignment won't work.


It definitely won't. NSDecimal is a structure something like a  
floating-point value.



The only way I can see is something like this:

NSDecimal decimal = [[NSDecimalNumber  
decimalNumberWithString:@16.75] decimalValue];


maybe that helps?


The other one I was able to find was NSScanner's -scanDecimal: 
(NSDecimal *) method. It's still really weird that there's no method  
to initialize one from (say) an integer, though.

___

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

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

2008-10-31 Thread Graham Cox


On 31 Oct 2008, at 5:21 pm, Roland King wrote:


I suppose you could try to make one directly by doing

NSDecimal myDec;

then setting myDec._exponent and myDec._mantissa[], if you can  
figure out how it stores its mantissa but that seems to be more work  
and they are private so you'd be opening yourself up to apple  
changing the whole thing later.



Note the docs:

Discussion
The fields of NSDecimal are private.





--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: Creating NSDecimal

2008-10-31 Thread Roland King

Graham Cox wrote:



On 31 Oct 2008, at 5:21 pm, Roland King wrote:


I suppose you could try to make one directly by doing

NSDecimal myDec;

then setting myDec._exponent and myDec._mantissa[], if you can  
figure out how it stores its mantissa but that seems to be more work  
and they are private so you'd be opening yourself up to apple  
changing the whole thing later.




Note the docs:

Discussion
The fields of NSDecimal are private.


I did note it, see my message, it says and they are private

___

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

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

2008-10-31 Thread Scott Anguish
is this performance you've measured? or performance you're thinking  
might be a problem?



On 31-Oct-08, at 2:08 AM, HAMILTON, Steven wrote:

 For performance and simplicity I'd rather use the C interface but  
for the life of me I can't find out how to actually create one of  
these and assign a value to it.


___

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

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

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

This email sent to [EMAIL PROTECTED]


NSRuleEditor/NSPredicateEditor selected rows

2008-10-31 Thread Houdah - ML Pierre Bernard

Hi!

NSRuleEditor has the concept of selected rows in its API. I however  
see no visual clues of which rows are selected.


Is it possible to subclass whatever cell view is used by the rule  
editor to add such a visual clue?


Pierre

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Creating NSDecimal

2008-10-31 Thread Ken Thomases

On Oct 31, 2008, at 1:24 AM, Andrew Farmer wrote:


On 30 Oct 08, at 23:18, Graham Cox wrote:

On 31 Oct 2008, at 5:08 pm, HAMILTON, Steven wrote:

Hi folks,
Can someone tell me how I create an NSDecimal? The  C struct one,  
not the ObjC NSDecimalNumber. For performance and simplicity I'd  
rather use the C interface but for the life of me I can't find out  
how to actually create one of these and assign a value to it.


//Declare
NSDecimal *decimal;
//assign? Surely its not as simple as this?
decimal = 16.75


It does seem weird that there's no way to create a NSDecimal! I'm  
pretty sure simple assignment won't work.


It definitely won't. NSDecimal is a structure something like a  
floating-point value.



The only way I can see is something like this:

NSDecimal decimal = [[NSDecimalNumber  
decimalNumberWithString:@16.75] decimalValue];


maybe that helps?


The other one I was able to find was NSScanner's -scanDecimal: 
(NSDecimal *) method. It's still really weird that there's no method  
to initialize one from (say) an integer, though.


NSNumber has a -decimalValue method, which is probably much simpler to  
use than either of the string-based methods (NSScanner or  
NSDecimalNumber).


Cheers,
Ken

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Porting from Windows to Mac

2008-10-31 Thread Jean-Daniel Dupas


Le 30 oct. 08 à 23:49, Stefan Werner a écrit :



I would also recommend that you start over with the design of your  
GUI, for
the sensibilities and design principles of Mac OS X are very  
different. This

difference is exacerbated if you consider the age of MFC...


You are aware that MFC (1992) is younger than NextStep (1988)? ;-)
And if age is a criteria, we should always prefer Carbon over Posix.


Yes, but is older than the OpenStep specification (1993) that is the  
true ancestor of Cocoa.



___

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

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

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

This email sent to [EMAIL PROTECTED]


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

2008-10-31 Thread Negm-Awad Amin
In many cases this are no warnings but notices. You can switch them  
off in Xcode, if you want to:

http://www.cocoading.de/webspace/IBC%20Notices.tiff

Cheers

Am Mi,29.10.2008 um 08:39 schrieb 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/negm-awad%40cocoading.de

This email sent to [EMAIL PROTECTED]


Amin Negm-Awad
[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: Compare images in Cocoa

2008-10-31 Thread Karan, Cem (Civ, ARL/CISD)
On Thu, 30 Oct 2008 20:21:47 -0700, Pierce Freeman wrote:

 Hi everyone. I am wondering if there is some way to compare 
 two images in Cocoa, and then somehow spit out a percent of 
 how similar they are. The only way I could think of is 
 comparing every pixel, but this seems like it would take a 
 long time, and even so I have no idea how to go about doing that.
 
 Thanks for your help. 

If you're willing to force someone to look at the image, you can get away with 
a really fast hack; use coreimage to do a Difference Blend Mode merge between 
the two images.  If they are identical, the resulting image will be black.  
Anywhere the images are different, you'll get colors.  As others have 
mentioned, this trick will not work if the images are different sizes, 
misaligned, rotated, different resolutions, etc.  It is similar to what Beyond 
Compare does when it compares images (although IIRC it uses XOR on each pixel, 
not difference), and is only really good for quickly checking what changed 
between two images that are already fairly similar (which is handy if you want 
to know what modifications your artist did to the resources you have in your 
application).

Good luck,
Cem Karan
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Delegation across thread

2008-10-31 Thread Andre Masse
Thanks a lot for your very clear explanation Michael. Looks like  
performSelectorOnMainThread: will be the way to go.


Thanks again,

Andre Masse

On Oct 31, 2008, at 00:41, Michael Ash wrote:


It's important to remember that delegate is just a design pattern,
not a language feature. A delegate is just a defined set of messages
that you send to an object in certain situations. When it comes to
threads, they behave just like any other messages, because they are
just regular messages.

So what happens when you send a delegate message on a secondary
thread? Same thing as when you send any other message: the
corresponding method gets invoked synchronously on the same thread.
(I.e. you call it directly.)

This can be bad. If you're going to do this then your delegate needs
to be prepared to receive delegate messages on secondary threads, and
that can sometimes be annoying. Sometimes it's entirely reasonable. It
really depends on your situation. If your situation is such that it's
unreasonable, the solution is easy: just use
performSelectorOnMainThread: to ship the delegate message back to the
main thread where it can be invoked in a better place. If you want to
invoke it on some thread other than the main thread then Cocoa
provides a fair number of inter-thread communication techniques that
you can use. Ignore the fact that this is a delegate and just see
how and where you want to send your message.


___

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

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


NSTokenField drag and drop

2008-10-31 Thread Chris Idou

I uploaded a mini project here:

http://idisk.mac.com/chris.bitmead-Public?view=web

Can anyone tell me why writeRepresentedObjects isn't called on the 
TokenDelegate when you drag a token from one field to the other?


  
___

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

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

2008-10-31 Thread Raj
Hi All

I have a client server based application. I want to use spotlight search
capabilities to search the server content. Can anyone answer the following
questions for me?
1. How can I make spotlight search using my application rather than
searching for the document files. i.e. when someone types something in
spotlight field, I internally search for that text in my server and return
the results.
2. Add a new category of the result set to the spotlight drop-down in the
name of my application.

Thanks in advance.

R A 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: When and how often do you mix C++ with Objective C in your project?

2008-10-31 Thread Stefan Werner


On Oct 31, 2008, at 12:33 AM, Boon Chew wrote:

I am a newbie to the cocoa world (PC - Mac switcher).  I have a  
fair amount of experience coding in C and C++ and I am just getting  
into Obj C now.  Right now I am trying to learn the language idioms  
and patterns in the Obj C world, specifically, when do you find  
yourself mixing C++ code with your Obj C code in your project?  How  
often do you do that? What's the pros and cons of doing that?


I tend to use a lot of C++ for performance, features and portability  
reasons. The parts of Objective-C I need are then most of the time  
in .mm files which often contain a C++ class using Objective-C  
functionality.


New projects that are not performance-critical and are not likely to  
get ported anywhere else except OS X, those I tend to start in  
Objective-C.


-Stefan
___

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

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


Resorting NSOutlineView rows in response to edits

2008-10-31 Thread Ken Tozier

Hi

I have a dynamically generated NSOutlineView that displays Projects  
and pages like so


project name
page 1
page 2
page 3
page 4
page 5

I got the page number editing working and it triggers other events  
(like writing the new page number to an SQL database) but I can't get  
the NSOutlineView to reorder the pages. Say the user changes page 4  
to page 10, I want the new ordering to be


project name
page 1
page 2
page 3
page 5
page 10

I'm able to reorder the items in the data source in response to edits,  
but the NSOutlineView doesn't seem to notice the change. The data  
source has no knowledge of the NSTreeController so it can't call the  
controllers rearrangeObjects


Is there an available binding that will automatically trigger a  
reorder event on the NSTreeController? If so, how would I go abut  
setting this up programatically


Thanks for any 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: Compare images in Cocoa

2008-10-31 Thread Pierce Freeman
I kind of figured it was complex, but not THIS complex.  Would you by any
chance have a link to a research paper - Though I highly doubt it ;) - that
would have something like this in it.

Does anyone think that there is some open-source way to accomplish it?


Sincerely,

Pierce F.


On 10/30/08 10:04 PM, Graham Cox [EMAIL PROTECTED] wrote:

 
 On 31 Oct 2008, at 2:21 pm, Pierce Freeman wrote:
 
 Hi everyone. I am wondering if there is some way to compare two
 images in
 Cocoa, and then somehow spit out a percent of how similar they are.
 The only
 way I could think of is comparing every pixel, but this seems like
 it would
 take a long time, and even so I have no idea how to go about doing
 that.
 
 
 It's non-trivial. Comparing each pixel doesn't really work. You could
 have two identical images but if one was shifted by just 1 pixel,
 you'd have almost no match even though to the eye they'd look the
 same. You can compare images for equality this way, but not similarity
 (i.e. if they are absolutely identical in every way you can tell, but
 the smallest difference means no match at all).
 
 Researchers have been looking into this sort of thing for years. There
 are ways to do it, but it requires some pretty heavy lifting in terms
 of breaking down an image into features then finding whether those
 same features can be found in the second image, regardless of how
 those features might have been transformed in size, position or angle.
 You can then come up with a figure for the number of feature matches
 and how these are different, and so arrive at a figure for the overall
 similarity of the two images. So, it can be done but you'll need to
 look at some serious academic papers to get a flavour for what's
 involved - it's almost verging on AI.
 
 Good luck ;-)
 
 cheers, 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: Parsing xml files in Cocoa applications

2008-10-31 Thread Dave DeLong
Our local CocoaHeads group had a presentation on XML parsing this  
month in Cocoa.  We should be getting our screencasts and slides  
online in the next day or two.  I'll let you know when they're up.


Dave DeLong

On Oct 31, 2008, at 8:56 AM, Nicko van Someren wrote:


On 30 Oct 2008, at 09:29, Paul Reilly wrote:

There is also some good sample code on the iPhone Developer site,  
called

SeismicXML which shows how to parse an XML document.


It is worth noting that while the event-driven NSXMLParser class is  
available on the iPhone, NXSMLDocument and its friends for the XML  
DOM are NOT available on the iPhone.  If you have existing code that  
uses NSXMLDocument which you want to port to the iPhone you shall  
need to rework the code or write classes to emulate the necessary  
functionality.


Unless you know that you need to keep all the information in your  
XML document for use later you can usually save quite a lot of space  
by using the event model and being careful which parts of the data  
you bother keeping.  I suspect that in the memory-constrained world  
of the iPhone this was the rationale behind forcing people to use  
the event-driven model.  You do however need to be cautious when  
using the event driven parser in a memory-constrained environment to  
make sure that you don't leave lots of objects in the auto-release  
pool after your event calls.  If you have a large document which you  
parse and filter down to some much smaller data set but on the way  
leave a lot of trash in the auto-release pool you can find the  
iPhone app running out of memory before you've finished parsing the  
document.  If you are unsure you can always push a local auto- 
release pool at the start of each of the event callbacks which do  
any hard work and pop them again before you return from the callback.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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-31 Thread Devon Ferns
NSXMLParser is also good if you don't know or don't care what the order 
of the elements are in your XML file.


Devon

Nicko van Someren wrote:

It is worth noting that while the event-driven NSXMLParser class is 
available on the iPhone, NXSMLDocument and its friends for the XML DOM 
are NOT available on the iPhone.  If you have existing code that uses 
NSXMLDocument which you want to port to the iPhone you shall need to 
rework the code or write classes to emulate the necessary functionality.


Unless you know that you need to keep all the information in your XML 
document for use later you can usually save quite a lot of space by 
using the event model and being careful which parts of the data you 
bother keeping.  I suspect that in the memory-constrained world of the 
iPhone this was the rationale behind forcing people to use the 
event-driven model.  You do however need to be cautious when using the 
event driven parser in a memory-constrained environment to make sure 
that you don't leave lots of objects in the auto-release pool after your 
event calls.  If you have a large document which you parse and filter 
down to some much smaller data set but on the way leave a lot of trash 
in the auto-release pool you can find the iPhone app running out of 
memory before you've finished parsing the document.  If you are unsure 
you can always push a local auto-release pool at the start of each of 
the event callbacks which do any hard work and pop them again before you 
return from the callback.


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/dferns%40devonferns.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]


windowDidExpose: When called?

2008-10-31 Thread Claus Atzenbeck

Hi all:

I need a delegate that gets called whenever the window appears on the 
screen. The opposite of windowWillClose:, so to say.


However,
- (void)windowDidExpose:(NSNotification *)notification
does not get called via any of the following methods:

[windowController showWindow:self];
[[windowController window] orderFront:self];
[[windowController window] orderBack:self];

The delegate works; for example, windowWillClose: gets called.

Any idea?

Cheers,
Claus
___

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

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

2008-10-31 Thread Bill Bumgarner

On Oct 31, 2008, at 1:21 AM, Jean-Daniel Dupas wrote:

Le 30 oct. 08 à 23:49, Stefan Werner a écrit :
I would also recommend that you start over with the design of your  
GUI, for
the sensibilities and design principles of Mac OS X are very  
different. This

difference is exacerbated if you consider the age of MFC...

You are aware that MFC (1992) is younger than NextStep (1988)? ;-)
And if age is a criteria, we should always prefer Carbon over Posix.


Yes, but is older than the OpenStep specification (1993) that is the  
true ancestor of Cocoa.


NeXTSTEP is the true ancestor of Cocoa.  The NeXTSTEP APIs were quite  
similar to OpenStep (of which, of course, Cocoa evolved out of).


There is relevance to Cocoa-dev here, assuming that an understanding  
of history helps you.


The shift from NeXTSTEP to OpenStep was really focused on a several of  
areas of change.


- The memory management model moved from a classic straight alloc /  
free model -- literally, objects implemented -free and you called that  
directly to tear down and deallocate the object -- to a reference  
counted model using -retain/-release/-autorelease.


- Much of what had been straight C APIs were replaced with classes and  
methods on said classes.  User Defaults functions moved to  
NSUserDefaults, for example.   File management, archiving, and a  
number of other fundamental subsystems were moved to Objective-C.


- NSString was added, along with NSDate and NSNumber, and the NEXTSTEP  
collection classes (List and HashTable) were retired in favor of  
NSDictionary, NSArray, and NSSet.   List and HashTable supported non- 
ObjC types, but this greatly limited their capabilities.   The new  
collection classes -- what you have today -- were pure object contains  
and, thus, operations like archiving, KVC, etc...  were enabled.


- In general, much of what had been code that every developer  
seemingly needed to write over and over were captured as general  
purpose, reusable, APIs.


When OpenStep was released, it contained a porting toolkit that would  
run through an application's source and convert it to use the new APIs.


Trivia:  Andrew Stone's Create -- www.stone.com -- is the only Cocoa  
application (that I'm aware of) that has run on every single release  
of Mac OS X, OpenStep, NeXTSTEP, or derivatives (including Sun's NEO)  
as well as on every processor for which support shipped -- m68k, i386/ 
mach, i386/windows, SPARC/mach, SPARC/solaris, PA-RISC, PPC, and maybe  
some I'm forgetting.


(Before joining Apple, one of my last contracts involved porting a  
750,000 line Objective-C++ application from NS 3.3 to Mac OS X 10.2  
[Jaguar].  It was actually quite a bit of fun and required effectively  
porting to OpenStep 4.2, then Rhapsody DR1, then Mac OS X Beta, then  
-- finally -- Mac OS X 10.2.   By doing this, I was able to port the  
rather complex NIBs, including custom palette support, from NS 3.3 to  
MOSX 10.2, taking advantage of the compatibility archive support in  
AppKit/IB at each stop to preserve the NIBs.  Thank goodness for  
Virtual PC!)


b.bum



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: Compare images in Cocoa

2008-10-31 Thread Nicko van Someren

On 31 Oct 2008, at 03:21, Pierce Freeman wrote:

Hi everyone. I am wondering if there is some way to compare two  
images in
Cocoa, and then somehow spit out a percent of how similar they are.  
The only
way I could think of is comparing every pixel, but this seems like  
it would
take a long time, and even so I have no idea how to go about doing  
that.


This very much depends on the type of differences you are expecting.   
The first thing to note is that you can't do this without accessing  
every pixel in both images, but there are library functions for  
applying functions to 2-d arrays of pixels in CoreImage and deeper  
down in the veclib and vImage frameworks.  If you are just expecting  
the images to be largely the same but some pixels to be different then  
simply using CoreImage to produce a bitmap based on the pixel  
differences is pretty easy and very fast.


If you expect images to be the same scale but differ in (a) some  
pixels' values, (b) brightness and/or contrast or (c) parts of the  
image are translated, then in general the first thing to do apply a  
convolution function with the two images as inputs.  The mathematics  
are sticky but OS X includes library functions to do it for you.  Try  
looking on Google for terms like image convolution, motion detection,  
motion compensation, etc.  Basically you'll get an output from the  
convolution where the strength of the spike in the middle of the  
output represents how similar the parts of the image that have not  
moved are to each other.  Where parts of the image have been  
translated from one image to the other you will get an output spike  
offset from the centre by the movement vector, the size of spike  
representing the size of the area that moved.


If you expect that between your two images some parts will be scaled  
as well as translated then the whole problem gets much more complex,  
so you might want to avoid these cases :-)


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]


Re: Compare images in Cocoa

2008-10-31 Thread Brian Stern


On Oct 30, 2008, at 11:21 PM, Pierce Freeman wrote:

Hi everyone. I am wondering if there is some way to compare two  
images in
Cocoa, and then somehow spit out a percent of how similar they are.  
The only
way I could think of is comparing every pixel, but this seems like  
it would
take a long time, and even so I have no idea how to go about doing  
that.


Thanks for your help.


You don't say what you want this number for.  Are you trying to tell  
if two images of faces are of the same person?  Two images of  
buildings are of the same building?  Two images have similar colors in  
them?


FWIW, iterating over all the pixels in an image and doing some kind of  
simple math on the pixel values will not be very time-consuming.   
There are lots of Photoshop filters that do this and are very fast.


One thought that comes to mind is to calculate the histogram for the  
two images and compare them.  This could give a kind of simplistic %  
difference.



--
Brian Stern
[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]


How to read proxy username and password?

2008-10-31 Thread Mark Allan
Hi all,

I've got an application which uses a third party command line tool to download 
some files from the web.  Unfortunately, the command line tool won't work with 
a proxy server unless the proxy settings are written in clear text (ugly but 
nothing I can do about that) in a config file.  The config file itself is 
read/write only by root, so it's not *quite* as hideous as it could be ;-)

Anyway, writing to the config file isn't a problem.  My question is how can I 
read the System proxy username and password settings from within my application 
in order to be able to write them to the file?

I've searched through the mailing list archives and had a look at the 
SystemConfiguration Framework API but still can't quite find what I'm looking 
for.  The closest thing I can see is SCDynamicStoreCopyProxies but that only 
returns the following keys in the dictionary:
kSCPropNetProxiesExceptionsList
kSCPropNetProxiesHTTPEnable
kSCPropNetProxiesHTTPProxy
kSCPropNetProxiesHTTPPort
kSCPropNetProxiesHTTPSEnable
kSCPropNetProxiesHTTPSProxy
kSCPropNetProxiesHTTPSPort
kSCPropNetProxiesFTPEnable
kSCPropNetProxiesFTPProxy
kSCPropNetProxiesFTPPort
kSCPropNetProxiesFTPPassive
none of which is what I'm looking for.

Can anyone help please?

Thanks,
Mark
___

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

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

2008-10-31 Thread j o a r


On Oct 31, 2008, at 8:23 AM, Claus Atzenbeck wrote:

I need a delegate that gets called whenever the window appears on  
the screen. The opposite of windowWillClose:, so to say.


However,
- (void)windowDidExpose:(NSNotification *)notification
does not get called via any of the following methods:

[windowController showWindow:self];
[[windowController window] orderFront:self];
[[windowController window] orderBack:self];

The delegate works; for example, windowWillClose: gets called.



I think that you will need to use NSWindow / NSPanel subclasses to  
accomplish this. That's at least how I've solved that problem in the  
past.


If you'd like to see this capability added to NSWindow, I suggest that  
you file an enhancement request. It will be flagged as a duplicate,  
but it would still be useful - by showing interest, it's more likely  
that it will be prioritized.


j o a r


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTextView actions

2008-10-31 Thread Randall Meadows

On Oct 30, 2008, at 7:34 PM, Randall Meadows wrote:

On Oct 30, 2008, at 7:23 PM, Randall Meadows wrote:

When I hit, for example, the Page Up area of the scroll bar, it  
animates to it's new position; my reflection updates only a very  
small portion of this change.  It doesn't at all when I hit the  
Page Up key, though.  Is the animation process taking long enough  
that the very next line of code is executed before it's done, and  
therefore I don't capture any (or most) of the scroll?  If so, is  
there some deterministic way I can tell when the scroll animation  
has completed, so I can update my view?


Just for grins, I changed my call to update the reflection to use

performSelector:withObject:afterDelay:

instead, and while that does help the paging issue, it completely  
breaks dragging the knob; doing that now, it doesn't update at all  
until I release the mouse to end the drag.


It also did nothing when I press the Page Up/Dn or arrow keys,  
either.  So that's obviously not the solution.


I'll point out that the Use smooth scrolling setting in the  
Appearance prefpane makes a difference.  With smooth scrolling off,  
any change to the scroll bar is handled correctly; with it on, I get  
the behavior I describe above.


I'd love to figure out to work around this.  Anyone?


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]


Simple Flipbook Animation?

2008-10-31 Thread Jeshua Lacock


Hello,

I think I must be missing something obvious. I have looked over all of  
the CoreAnimation documentation, and I don't see a convenient way to  
flip through frames.


Basically I have an NSArray populated with 45 NSImages. I just want to  
flip through them. Can anyone offer a recommendation?



Thank you,

Jeshua Lacock
Founder/Programmer
3DTOPO Incorporated
http://3DTOPO.com
Phone: 877.240.1364

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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-31 Thread Joel Norvell
Dear Cocoa-dev People,

I wanted to thank everyone for their helpful replies to my question: How to 
save metadata for a PDF file?

Graham, thank you for confirming and clarifying the Cocoa way.  Your caveat 
(problem with other pdf readers) was also well taken!

Ricky, thank you for your trenchant analysis and commentary.  The reification 
of your suggested approach, by mentioning the TextEdit example, was way 
helpful! 

Michael, you've identified additional (and compelling) approaches that I'd have 
never quantified on my own!  They bear looking into; part of my continuing 
Cocoa education :-)

Dave, you know a lot about the PDF format!  Thanks for quantifing a PDF 
compatible way to append metadata to a PDF!

Jeff, you also know a lot about the PDF format!  Thanks for clarifying another 
PDF compatible way to append metadata to a PDF!

Marcel, thanks for your reply!

My conclusion is that The Cocoa Way would be to use NSFileWrappers.  (Not to 
deprecate the suggested PDF approaches – there's nothing wrong with them.)  
I've looked at using NSFileWrappers, but still have some questions.  My plan is 
to take them to NSCoder Night (in Campbell) and flesh out the recipe, part of 
my ongoing Cocoa education :-)

As an aside, I want to strongly recommend Eric Buck's Cocoa Design Patterns 
which led me toward the NSFileWrapper approach in the first place!  (It's 
available through Safari Books Online Rough Cuts.)

Many thanks,
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: Simple Flipbook Animation?

2008-10-31 Thread Matt Long
Look at overriding the layer transition. You can use a page curl  
filter, if that's your desired effect, to transition changes to the  
layer's content property.


- Create a CATransition object.
- Create a CIFilter that implements a page curl (Check out Apple's  
Core Image Filters docs and sample code).

- Set the transition object's filter parameter to your CIFilter
- Add the transtion to the layer actions for the key content

Then, whenever you set your layer's content parameter to the next  
image, it will use that transition instead of the default fade. This  
of course assumes that you know you need to convert your NSImages to  
CGImageRefs first since the content property cannot be set with an  
NSImage. Let me know if you need clarification.


-Matt


On Oct 31, 2008, at 10:51 AM, Jeshua Lacock wrote:



Hello,

I think I must be missing something obvious. I have looked over all  
of the CoreAnimation documentation, and I don't see a convenient way  
to flip through frames.


Basically I have an NSArray populated with 45 NSImages. I just want  
to flip through them. Can anyone offer a recommendation?



Thank you,

Jeshua Lacock
Founder/Programmer
3DTOPO Incorporated
http://3DTOPO.com
Phone: 877.240.1364


___

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

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


NSNetService won't resolve

2008-10-31 Thread Benjámin Salánki

Hi all,

I have an NSNetService enabled app that acts as both the client and  
the server on the same machine.
My problem is that once I register the service I create and I want to  
set up the connection the aNetService returned has an empty array for  
the addresses in


- (void)netServiceBrowser:(NSNetServiceBrowser *)aNetServiceBrowser
   didFindService:(NSNetService *)aNetService
   moreComing:(BOOL)moreComing

now if I call

[aNetService setDelegate:self];
[aNetService resolveWithTimeout:5.0];

neither  - (void)netServiceDidResolveAddress:(NSNetService *)sender  
nor - (void)netService:(NSNetService *)sender didNotResolve: 
(NSDictionary *)errorDict get called even though I set the delegate  
and everything.
I have written some Bonjour based applications before all based on  
Apple's Picture sharing sample code and I have not faced this problem  
before.


Is there something obvious I'm missing here?

Thanks for any input on this matter.

Ben
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Document dirty state during field edit

2008-10-31 Thread Ashley Clark

On Oct 31, 2008, at 1:19 AM, Ashley Clark wrote:

I'm pretty sure I've seen someone ask this before but I just can't  
find it in Google. So I'll ask again.


I have undo/redo working throughout my program but I seem to  
remember earlier that upon opening a document and immediately after  
beginning to change the state of a text field that the document  
dirty status would be changed, before an actual undo was registered  
on the undo stack. (As a result of -objectDidBeginEditing:?)


Somehow I've disabled this behavior and for the life of me I can't  
determine what I've done wrong or how to get that behavior back.


Does anyone have any clues?


After a lot of stepping through the debugger I've seen that in new  
NSDocument based projects that edits happening through a controller  
send an -objectDidBeginEditing: to the NSDocument object via  
[NSValueBinder _startChanging].


In my project though, for some reason I have yet to uncover,  
NSValueBinder's _startChanging method checks to see if my  
NSWindowController subclass responds to objectDidBeginEditing: when  
that returns NO it stops looking and never checks my document  
subclass. If I implement objectDidBeginEditing and  
objectDidEndEditing: and have them forward those messages on to my  
document the document dirty state is represented correctly as it is in  
a new project.


So, this suggests that somehow I've mucked up the responder chain  
between my window controller and my document but I don't see anywhere  
where I might have done something like that. To be honest though, I'm  
not sure that I'd know how to without reading up a lot more on the  
responder chain anyway. Before I read up on the responder chain to see  
what I might have done, does anyone know if I'm on the right track here?



Ashley

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Simple Flipbook Animation?

2008-10-31 Thread Jeshua Lacock


On Oct 31, 2008, at 11:07 AM, douglas welton wrote:

Did you take a look at using the NSAnimation class?  The delegate  
would be a good place to swap up one image for another in a display  
view.



Thanks for your help Douglas.

Yes, that was the first class I looked at.

I guess it is not clear to me how to swap images with it. Most of the  
sample code I have seen shows a start frame and end frame with a start  
value and end value, then creates the frames in between.


Do you know where there is any sample code?


Thanks,

Jeshua Lacock
Founder/Programmer
3DTOPO Incorporated
http://3DTOPO.com
Phone: 877.240.1364

___

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

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

2008-10-31 Thread Jeshua Lacock


On Oct 31, 2008, at 11:33 AM, Matt Long wrote:

Look at overriding the layer transition. You can use a page curl  
filter, if that's your desired effect, to transition changes to the  
layer's content property.


- Create a CATransition object.
- Create a CIFilter that implements a page curl (Check out Apple's  
Core Image Filters docs and sample code).

- Set the transition object's filter parameter to your CIFilter
- Add the transtion to the layer actions for the key content

Then, whenever you set your layer's content parameter to the next  
image, it will use that transition instead of the default fade. This  
of course assumes that you know you need to convert your NSImages to  
CGImageRefs first since the content property cannot be set with an  
NSImage. Let me know if you need clarification.



Hi Matt,

Thanks for the information.

I guess that is part of my confusion. I don't want any effects or  
transitions. I just want to play back my frames (like at 30 frames per  
second)



Thanks,

Jeshua Lacock
Founder/Programmer
3DTOPO Incorporated
http://3DTOPO.com
Phone: 877.240.1364

___

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

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

2008-10-31 Thread douglas welton

Jeshua,

disclaimer I have no idea what you are actually doing in your code,  
so any advice i give below is pure speculation/disclaimer


Let's say you have an array of NSImages and an NSImageView to display  
them in.


I would create the animation, set a collection of progress marks, and  
use the delegate method -animation:didReachProgressMark: to set the  
NSImageView to the appropriate NSImage for the progress mark.


if you want to use CALayers, you'll need to convert your NSImages to  
CGImageRefs, set up your animation, and then use the delegate method  
to set the content property of the target layer.


hope that helps,

regards,

douglas



On Oct 31, 2008, at 1:48 PM, Jeshua Lacock wrote:



On Oct 31, 2008, at 11:07 AM, douglas welton wrote:

Did you take a look at using the NSAnimation class?  The delegate  
would be a good place to swap up one image for another in a display  
view.



Thanks for your help Douglas.

Yes, that was the first class I looked at.

I guess it is not clear to me how to swap images with it. Most of  
the sample code I have seen shows a start frame and end frame with a  
start value and end value, then creates the frames in between.


Do you know where there is any sample code?


Thanks,

Jeshua Lacock
Founder/Programmer
3DTOPO Incorporated
http://3DTOPO.com
Phone: 877.240.1364



___

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

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

2008-10-31 Thread John Harper

Hi,

I described how to do this using a CAKeyframeAnimation in a previous  
thread:


http://www.cocoabuilder.com/archive/message/cocoa/2008/8/3/214715

John


On Oct 31, 2008, at 9:51 AM, Jeshua Lacock wrote:



Hello,

I think I must be missing something obvious. I have looked over all  
of the CoreAnimation documentation, and I don't see a convenient way  
to flip through frames.


Basically I have an NSArray populated with 45 NSImages. I just want  
to flip through them. Can anyone offer a recommendation?



Thank you,

Jeshua Lacock
Founder/Programmer
3DTOPO Incorporated
http://3DTOPO.com
Phone: 877.240.1364

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/jsh%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: Simple Flipbook Animation?

2008-10-31 Thread Jeshua Lacock


On Oct 31, 2008, at 12:13 PM, John Harper wrote:

I described how to do this using a CAKeyframeAnimation in a previous  
thread:


http://www.cocoabuilder.com/archive/message/cocoa/2008/8/3/214715



Thanks John!

Awesome! That looks just like what the doctor ordered!

Going to plug it in right now...


Thanks again,

Jeshua Lacock
Founder/Programmer
3DTOPO Incorporated
http://3DTOPO.com
Phone: 877.240.1364

___

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

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

2008-10-31 Thread Michael Ash
On Fri, Oct 31, 2008 at 11:23 AM, Claus Atzenbeck
[EMAIL PROTECTED] wrote:
 Hi all:

 I need a delegate that gets called whenever the window appears on the
 screen. The opposite of windowWillClose:, so to say.

 However,
 - (void)windowDidExpose:(NSNotification *)notification
 does not get called via any of the following methods:

 [windowController showWindow:self];
 [[windowController window] orderFront:self];
 [[windowController window] orderBack:self];

 The delegate works; for example, windowWillClose: gets called.

The delegate method is a shortcut for registering for
NSWindowDidExposeNotification. The documentation for that starts out
with Posted whenever a portion of a nonretained NSWindow object is
exposed.

Since you essentially never want to use a nonretained window and are
almost certainly not using one here, this notification never gets
posted.

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]


NSData dataWithContentsOfFile - freeWhenDone:NO ?

2008-10-31 Thread jeffs87

Hi,

I'm using [NSData dataWithContentsOfFile] to load an AIFF file.  I was 
wondering if there is a way to make it freeWhenDone:NO so I can delete 
the NSData object and keep the bytes.  Audio files can be pretty big so 
I was hoping to avoid having to copy the bytes if possible.


thanks
Jeff



___

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

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

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

This email sent to [EMAIL PROTECTED]


Detecting when NSComboBox text changed by list

2008-10-31 Thread James Walker
How can I be notified when the text of an NSComboBox is changed by 
choosing something from the list?  Oddly, my controlTextDidChange: 
delegate method is not called in that case, though it is called if I 
type in the field.  None of the NSComboBox notifications or delegate 
methods look appropriate.

--
  James W. Walker, Innoventive Software LLC
  http://www.frameforge3d.com/
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSData dataWithContentsOfFile - freeWhenDone:NO ?

2008-10-31 Thread Sherm Pendley
On Fri, Oct 31, 2008 at 3:02 PM, [EMAIL PROTECTED] wrote:


 I'm using [NSData dataWithContentsOfFile] to load an AIFF file.  I was
 wondering if there is a way to make it freeWhenDone:NO so I can delete the
 NSData object and keep the bytes.  Audio files can be pretty big so I was
 hoping to avoid having to copy the bytes if possible.


There's no easy method that I can see. That said, why not just keep the
object? Given the size of the audio data, the handful of additional bytes
used by the object's ivars seems pretty insignificant.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSData dataWithContentsOfFile - freeWhenDone:NO ?

2008-10-31 Thread David Duncan

On Oct 31, 2008, at 12:02 PM, [EMAIL PROTECTED] wrote:

I'm using [NSData dataWithContentsOfFile] to load an AIFF file.  I  
was wondering if there is a way to make it freeWhenDone:NO so I can  
delete the NSData object and keep the bytes.  Audio files can be  
pretty big so I was hoping to avoid having to copy the bytes if  
possible.



Another question might be to ask why are you trying to load the entire  
file into memory? If its of any significant length then that is quite  
a large allocation...

--
David Duncan
Apple DTS Animation and Printing

___

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

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

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

This email sent to [EMAIL PROTECTED]


NSSecureTextField and umlauts

2008-10-31 Thread Peter Alshuth

Hi all,

I am having a problem with the NSSecureTextField and umlauts. If I  
type in 'OPTION u a' for 'ä' I get only the regular character back  
('a'). I unchecked the box Only Roman Characters in the IB but nothing  
changed. Is this a limitation of this password field? Do I have to use  
a regular NSTextField and change the character that gets displayed  
with a bullet symbol by myself instead?


Thanks for any help,

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]


NSArrayController and Auto Rearrange Content

2008-10-31 Thread Ashley Clark
I have a subclass of NSTableView that I use that allows the use of the  
return key during a field edit to move to the next row and begin  
editing. This works fine _unless_ the field I'm editing happens to be  
one that NSArrayController is observing and thus causes a  
rearrangeObjects call. When this happens my table view loses focus and  
its' textDidEndEditing: method is never called.


This happens even if the field in question is no longer the primary  
sort criteria. Turning off the auto rearrange content support of  
NSArrayController fixes it and calls my subclasses textDidEndEditing:  
method.


Has anyone else seen this and found a way to keep the focus on the  
table view after its' contents are rearranged like this?



Ashley

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Detecting when NSComboBox text changed by list

2008-10-31 Thread Dave Fernandes

delegate method: comboBoxSelectionDidChange

On Oct 31, 2008, at 3:34 PM, James Walker wrote:

How can I be notified when the text of an NSComboBox is changed by  
choosing something from the list?  Oddly, my controlTextDidChange:  
delegate method is not called in that case, though it is called if  
I type in the field.  None of the NSComboBox notifications or  
delegate methods look appropriate.

--
  James W. Walker, Innoventive Software LLC
  http://www.frameforge3d.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/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]


Number in NSString to int.

2008-10-31 Thread Adam Penny

Hi there,

I'm trying to process a MAC Address into Hex so I was going to do  
something like.


NSArray *macArray=[[NSArray alloc] init];
macArray=[mac componentsSeparatedByString:@:];
for (int i=0; i  [macArray count] ;  i++)
{
	//somehow need to get an int called dec from the number in the  
NSString then...

NSString *hex=stringWithFormat:@%x,dec;
[macArray[i] autorelease];
macArray[i]=hex;

}

My main question is how to get an int from an NSString, but also, if  
you could have a look at the rest of the contents of the for loop I'd  
be grateful as I'm sure I'm making a pigs ear of the memory management  
there. Sort of had a feeling that it would be autorelease as I thought  
that the substrings in the array would be the responsibility of the  
array rather than me, but other than that I was a bit boggled.


Thank you all.

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]


Padding Zeros...

2008-10-31 Thread Jean-Nicolas Jolivet
I'm having an interesting problem... I'm trying to format a number with 
padding zeros but I can't figure out how to do it in this particular 
situation.


I know I can use a formatted string with something like  
[stringWithFormat:@%03d, 5], which would result in 005 but the problem 
in this particular case is that the number of padding zeros (3 in my 
example) is a variable defined by the user... (let's say it resides in 
an int variable named int paddingZeros)


Is there an easy way I can pad a number with a variable amount of zeros?

Jean-Nicolas Jolivet
___

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

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

2008-10-31 Thread James Walker

Kyle Sluder wrote:

On Fri, Oct 31, 2008 at 4:14 PM, James Walker [EMAIL PROTECTED] wrote:

At step 2, comboBoxSelectionDidChange is called, but the text field has not
yet changed.


Actually, it has changed.  Look into the NSEditor and
NSEditorRegistration protocols.


Huh?  I'm staring at the combo box and I can see that the text has not 
changed.  In fact at that point, it is still possible to dismiss the 
list without changing the text.


Actually, things seem to be even worse than I indicated in my previous 
message.  The comboBoxWillDismiss may come before or after the text 
change, depending on whether the selection is made with the return key 
or the mouse.


Maybe what I'll do is give up on finding out immediately that the text 
has changed, and watch for controlTextDidEndEditing instead.  I'm not 
sure, but maybe that's similar to what you meant about NSEditor.

--
  James W. Walker, Innoventive Software LLC
  http://www.frameforge3d.com/
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Padding Zeros...

2008-10-31 Thread Ken Thomases

On Oct 31, 2008, at 4:52 PM, Jean-Nicolas Jolivet wrote:

I'm having an interesting problem... I'm trying to format a number  
with padding zeros but I can't figure out how to do it in this  
particular situation.


I know I can use a formatted string with something like   
[stringWithFormat:@%03d, 5], which would result in 005 but the  
problem in this particular case is that the number of padding zeros  
(3 in my example) is a variable defined by the user... (let's say it  
resides in an int variable named int paddingZeros)


Is there an easy way I can pad a number with a variable amount of  
zeros?


I don't remember off-hand if this is supported by NSString, but printf  
and friends supports (%0*d, paddingZeros, 5).


That is, put an asterisk in place of the field width and then supply  
it as an argument.


Cheers,
Ken

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Padding Zeros...

2008-10-31 Thread Shawn Erickson
On Fri, Oct 31, 2008 at 2:52 PM, Jean-Nicolas Jolivet
[EMAIL PROTECTED] wrote:
 I'm having an interesting problem... I'm trying to format a number with
 padding zeros but I can't figure out how to do it in this particular
 situation.

 I know I can use a formatted string with something like
  [stringWithFormat:@%03d, 5], which would result in 005 but the problem in
 this particular case is that the number of padding zeros (3 in my example)
 is a variable defined by the user... (let's say it resides in an int
 variable named int paddingZeros)

 Is there an easy way I can pad a number with a variable amount of zeros?

man printf  A field width or precision may be `*' instead of a
digit string.  In this case an argument supplies the field width or
precision.

[NSString stringWithFormat:@%0*d, 3, 5]

-Shawn
___

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

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

2008-10-31 Thread Jean-Nicolas Jolivet

Thanks a lot guys,  %0*d  did the trick! :)

Jean-Nicolas Jolivet


Jean-Nicolas Jolivet wrote:
I'm having an interesting problem... I'm trying to format a number 
with padding zeros but I can't figure out how to do it in this 
particular situation.


I know I can use a formatted string with something like  
[stringWithFormat:@%03d, 5], which would result in 005 but the 
problem in this particular case is that the number of padding zeros (3 
in my example) is a variable defined by the user... (let's say it 
resides in an int variable named int paddingZeros)


Is there an easy way I can pad a number with a variable amount of zeros?

Jean-Nicolas Jolivet
___

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

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

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


Re: How to read proxy username and password?

2008-10-31 Thread Colin Barrett
Is it possible they're stored in Keychain?

-Colin

On Fri, Oct 31, 2008 at 4:09 PM, Mark Allan [EMAIL PROTECTED] wrote:
 Hi all,

 I've got an application which uses a third party command line tool to 
 download some files from the web.  Unfortunately, the command line tool won't 
 work with a proxy server unless the proxy settings are written in clear text 
 (ugly but nothing I can do about that) in a config file.  The config file 
 itself is read/write only by root, so it's not *quite* as hideous as it could 
 be ;-)

 Anyway, writing to the config file isn't a problem.  My question is how can I 
 read the System proxy username and password settings from within my 
 application in order to be able to write them to the file?

 I've searched through the mailing list archives and had a look at the 
 SystemConfiguration Framework API but still can't quite find what I'm looking 
 for.  The closest thing I can see is SCDynamicStoreCopyProxies but that only 
 returns the following keys in the dictionary:
kSCPropNetProxiesExceptionsList
kSCPropNetProxiesHTTPEnable
kSCPropNetProxiesHTTPProxy
kSCPropNetProxiesHTTPPort
kSCPropNetProxiesHTTPSEnable
kSCPropNetProxiesHTTPSProxy
kSCPropNetProxiesHTTPSPort
kSCPropNetProxiesFTPEnable
kSCPropNetProxiesFTPProxy
kSCPropNetProxiesFTPPort
kSCPropNetProxiesFTPPassive
 none of which is what I'm looking for.

 Can anyone help please?

 Thanks,
 Mark
 ___

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

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

 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/dogcow%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: NSRuleEditor/NSPredicateEditor selected rows

2008-10-31 Thread Peter Ammon


On Oct 31, 2008, at 12:17 AM, Houdah - ML Pierre Bernard wrote:


Hi!

NSRuleEditor has the concept of selected rows in its API. I however  
see no visual clues of which rows are selected.


Is it possible to subclass whatever cell view is used by the rule  
editor to add such a visual clue?


Pierre


Selected rows turned out to be confusing for users, so we removed it  
from the art but didn't get around to updating the API.  We may add  
selection again in the future, but for now you shouldn't depend on it.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Tracking changes to NSTableView datasource

2008-10-31 Thread Andre Masse

Hi,

I have a datasource for an NSTableView which is a NSMutableArray (call  
it mainArray for the moment) and I'm not sure which way is better to  
manage add, update and delete rows. I can use either one array for  
each of those cases or add a field to the mainArray (like 1 for new, 2  
for update) and only one array for the records to delete (I'm using a  
back-end database). The first problem with the former is if (when) the  
user add a row and modify it later on (but before any updates to the  
back-end are done) I will need to check if its a new row (by quering  
the newRows array) and then not add it to the update array if it is.  
Not counting keeping both array content in sync... With the later,  
only checking the field will tell me if its a new row or not. At this  
point, I prefer the second method and can't see too many problems with  
it... Now, how you guys handle these kind of things?


Any ideas, suggestions?

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: API to get command line parameters

2008-10-31 Thread Ken Thomases

On Oct 31, 2008, at 6:18 PM, Daniel Luis dos Santos wrote:

Once browsing the documentation found that there is something that  
does it. NSUserDefaults or NSApplication, I can't remember which if  
any of those  or how ?


-[NSProcessInfo arguments]

Cheers,
Ken

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to read proxy username and password?

2008-10-31 Thread Mark Allan

Gah I feel like such a numpty now!  Yes, that's exactly where it's stored.

Thank you!

Mark

At 3:31 pm -0700 31/10/2008, Colin Barrett wrote:

Is it possible they're stored in Keychain?

-Colin

  Anyway, writing to the config file isn't a problem.  My question 
is how can I read the System proxy username and password settings 
from within my application in order to be able to write them to the 
file?



___

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

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

2008-10-31 Thread Michael Ash
On Thu, Oct 30, 2008 at 10:16 PM, Colin Barrett [EMAIL PROTECTED] wrote:
 On Thu, Oct 30, 2008 at 5:30 PM, Michael Ash [EMAIL PROTECTED] wrote:
 Based on the state of the program when it crashes, it appears that the
 problem is caused by a race condition which occasionally causes two of
 the worker threads that NSOperationQueue spawns to dequeue and execute
 the same NSOperation. Since an NSOperation is only supposed to run
 once, things fall down go boom. This is just a theory, mind, and I'm
 not sure of it yet.

 I'm not sure it would help, but it might. You could try using the
 dependency mechanism in addition to setting maxConcurrentOperations to
 1. Keep track of the last NSOperation in your for loop and assign in
 as you go.

 If that fixes it, it could be a race in maxConcurrentOperations.

 This is all highly speculative.

Thanks for the suggestion. I tried it out and it still crashes with
that same exception. I even tried it without setting the
maxConcurrentOperations and it still crashed. When I tried it in the
case where the operations get enqueued in a separate thread instead of
from the operation method, then it still crashed but took a long time
(5-10 minutes, didn't count exactly) to do so. So it would seem that
this helps somehow but not quite enough.

This last case is particularly scary to me. I'm not doing anything
that NSOperationQueue isn't explicitly set up for. I'm just posting
NSOperations to queues that have been created and are sitting in
memory. I'm not fiddling with the maxConcurrentOperations, I'm not
doing anything weird like enqueueing a new operation from the middle
of an existing one, I'm just spawning some threads which post
operations to queues and let them run. And it *still* crashes.

I hate to make this sort of sweeping pronouncement because it seems
like a great way to end up looking like a fool, but at this point I
can only conclude that NSOperationQueue is fundamentally broken and
should not be used until this problem is fixed. Of course I would love
to be wrong.

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]


Localization of Cocoa-Xib for a Newbie

2008-10-31 Thread Roman Fischer

Hi,

I want to try Localization of a XIB, but I have problems:

I have the following Equipment:

- MacOS 10.5.5
- MacOS is runnig in German
- System-Preference Languages are (in order): German, English,...
- XCode 3.1.1

I make the following steps:

1. I Make a new Cocoa-Application project
2. I open the English-MainMenue.xib (doubleclick in Xcode starts  
Interfacebuilder) and put a label my English text into the window.  
Save it, Close IB.
3. In XCode I use Get Info of the English-MainMenue.xib and add  
Localization for German.
4.  I open the English-MainMenue.xib (doubleclick in Xcode starts  
Interfacebuilder). I use Open Localization to get to the German- 
MainMenue.xib. Here I change the label to my German text. Save it.  
Close IB.
5. Build and run my application. Starting my App I get the label my  
English text, but my prefered language is German!!


Additional steps.

6. I create in the group Resources a File Localizable.strings. I write  
into it:

   myHello = Englisch Hello;
7. In XCode I use Get Info of the Localizable.strings , use  make  
Localizeable and  add Localization  for German.

8. I change the content of the german Localizable.string to
   myHello = German Hallo;
9. I put the following line into my main.m:
NSLog(NSLocalizedString(@myHello,nil));
10 I build and run my application again. The results are:

 - in my application window there is still my English text
 - but in the console  window I found German Hallo

So it seems clear to me that my created application knows that it  
should use the german localization, but it uses the wrong localization  
of the XIB files.


Any clues about the mistake I made?

Regards

Roman Fischer

___

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

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


Can NSURLConnection use Proxy Server?

2008-10-31 Thread malcom

Hello Lists,
I'm using NSURLConnection and NSURLRequest to make connection to a  
server. Now I would to implement Proxy server connection but I cannot  
find something about it inside the docs. Anyone can point to me to the  
right way?

Thanks a lot.
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Localization of Cocoa-Xib for a Newbie

2008-10-31 Thread Roman Fischer


Hi,

I made an intesting experiment:

1. I opened the application package that Xcode had created.
2. Inside there I opened Contents - Resources - German.lproj -  
MainMenu.xib using IB and saved it at the same place as MainMenu.nib
3. Started the application package again and I got my german text  
displayed.


So Xcode did not automatically  create my MainMenu.nib for the german  
localization. I ealier realized that when I click onto the german  
.xib  in Xcode I see the xml-file content, but when clicking on the  
english .xib I don't  see. IB also only opens the english .xib  
starting from Xcode 3.1.1.


My conclusion: This behaviour of Xcode could be:

- a matter of configuration of Xocde (but how)?
- a matter of remove an reinstall Xcode
- simply a bug in Xcode 3.1.1
- anything else ;-)

Any ideas?

Regards

Roman Fischer


Am 31.10.2008 um 22:27 schrieb Roman Fischer:


Thank you for your response,

I try to be as exact as I can:

1. I open the Folder of my XCode-Project  using the Finder:  
Projectname - build - debug. There I find the application package
2. In the application package I find: Contents - Resources -  
German.lproj - MainMenu.xib


So there is no de.lproj there is German.lproj and there ist no  
MainMenu.nib there is a MainMenu.xib. I can open the MainMenu.xib  
using IB and see my german text inside. But when I start the app in  
the Projectname - build - debug  folder the english text is  
displayed to me.


Regards,

Roman Fischer


Am 31.10.2008 um 22:02 schrieb Ken Thomases:


On Oct 31, 2008, at 7:17 AM, Roman Fischer wrote:

So it seems clear to me that my created application knows that  
it should use the german localization, but it uses the wrong  
localization of the XIB files.


Any clues about the mistake I made?


In the built application, is there a MainMenu.nib in the de.lproj  
subfolder of the Resources folder?


Regards,
Ken





___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Localization of Cocoa-Xib for a Newbie

2008-10-31 Thread Roman Fischer

Hello Ken,

Thank you for REALLY GREAT  hint:

The english MainMenue.xib has the File Type file.xib but the  
localized version for german is sourcecode.xib. I changed it to  
file.xib , rebuilt the app and it runs as expected.


So I think there is a small bug XCode 3.1.1 to assign the wrong file- 
type to the localized .xib (maybe there is a reason to do so, but I  
cannot imagine ;-)


Regards

Roman

Am 31.10.2008 um 23:05 schrieb Ken Thomases:


On Oct 31, 2008, at 4:27 PM, Roman Fischer wrote:


Thank you for your response,

I try to be as exact as I can:

1. I open the Folder of my XCode-Project  using the Finder:  
Projectname - build - debug. There I find the application package
2. In the application package I find: Contents - Resources -  
German.lproj - MainMenu.xib


So there is no de.lproj there is German.lproj


Ah, sorry, my mistake.


and there ist no MainMenu.nib there is a MainMenu.xib.


That seems to be the source of your problem.  It appears that Xcode  
is not compiling your .xib to a .nib as it should be.  I haven't  
worked with .xibs yet, but I know that built applications should not  
have .xibs in them.


I think the problem may be in the file type that Xcode thinks is  
assigned for the German.xib.  In the file list, disclose the .xib to  
see both localizations.  Get Info on the English localization and  
the German localization and compare.  Make sure that both indicate  
File Type: file.xib.


If that's not the problem, bring this back up on the Xcode-users list.

Good luck,
Ken



___

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

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

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

This email sent to [EMAIL PROTECTED]


[OT] Install Issues

2008-10-31 Thread J. Todd Slack

Hi All,

Creating an installer on Leopard 10.5.5 for 10.4 and 10.5.

Everything is fine, the installer runs and my Applications folder  
shows modified at the time I ran the installer, but the app does not  
show up.


I *thought* it might be the 'relocatable' issue, but nothing shows up  
under the Contents Tab when I select the .app to change relocatable to  
NO.


It is a Java jar that was packaged into a .app and has worked great,  
now we wish to provide an installer.


Any thoughts?

-Jason
___

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

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

2008-10-31 Thread Peter Ammon


On Oct 31, 2008, at 5:33 PM, John Joyce wrote:


This may be a pointless and silly question, but
is Delegation faster than Notification (generally) ?


Delegation allows you to check if the client is interested, via  
respondsToSelector:.  If the delegate does not implement the method  
(or there is no delegate), then you may be able to save some work.   
There's no equivalent way to tell if any object is listening for a  
notification.


Though sometimes whether the object notifies is controllable, as in  
[NSView setPostsFrameChangedNotification:]


-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: Can NSURLConnection use Proxy Server?

2008-10-31 Thread J. Scott Tury


On Oct 31, 2008, at 8:42 PM, Nick Zitzmann [EMAIL PROTECTED] wrote:


On Oct 31, 2008, at 10:05 AM, malcom wrote:


I'm using NSURLConnection and NSURLRequest to make connection to a
server. Now I would to implement Proxy server connection but I
cannot find something about it inside the docs. Anyone can point to
me to the right way?



NSURLConnection does this automatically if you have a proxy server set
up in your network preferences.



While this is correct that the NSURLConnection will handle proxy  
settings set for the system as a whole, I do not believe that this  
was the question malcom was asking.


If you have one type of connection you need to make through an HTTP  
proxy, the default NSURLConnection does not provide an interface to  
do this.  Underneath its using the lower level C-based  
CFURLConnection classes, and if you can parse through the API's  
enough you'll see that you can get the data blob BEFORE it's actually  
sent out the wire, and modify it into an HTTP Proxy request.  (Please  
see the RFC on how to make an HTTP Proxy request if you don't know.)


But it's not a trivial task, but you can do it.

Scott
___

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

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


Finder like wrapping + truncation

2008-10-31 Thread Mudi Dandan

Hi,

I'm needing a hand with this. I'm trying to emulate the wrapping and  
truncation for icon labels in Finder's icon view.


My first question is: is there any method around for making a string  
to line wrap, and to truncate the second line if it is too long  (like  
on the right hand image in the screenshot). Is this supported in an API?


The second questions is: can the NSAttributedString render  the  
background for the text  like the ones on the screenshots or is it  
something I have to draw myself?


here's the screenshot:
http://www.binarynights.com/images/Screenshot.png
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Tracking changes to NSTableView datasource

2008-10-31 Thread Andre Masse
Sorry for the confusion. English is not my natural language and it's  
been a long week :-) Also the subject should really be about  
synchronizing data in the table view with a database back-end. This  
the tracking changes I need to work on.


I'll try to make this clearer. As an analogy, let's say my form is  
like an invoice except that is often modified by the user. The user  
can add, update or delete rows in the UI and I need to update these  
changes to the database at the commit phase (when the user press the  
OK button). I need to identify what the user did to be able to reflect  
theses changes back to the database. If the user delete a row, I need  
to remove it from the table view and track this action somehow to  
update the back-end later. Same for adding or updating rows.


Hope I'm less confuse with this message. Can't do much about my  
English though...


Thanks for your reply Graham,

Andre Masse


On Oct 31, 2008, at 19:11, Graham Cox wrote:



To be honest I can hardly follow this at all.

You say:


I have a datasource for an NSTableView which is a NSMutableArray


This can't be, since NSMutableArray doesn't implement the  
NSTableDataSource protocol. So what I'm assuming you've actually got  
is a controller in between the two. That being the case, your  
controller should do the work. When the user adds a row, the  
controller adds the row to the data model and updates the table. If  
the data is updated, the controller notices the change (using some  
means, notifications or KVO for example) and updates the table.. and  
so on. It's standard MVC and highly applicable in most cases of a  
table hooked to an array. You could use NSArrayController to give  
you much of this for free.


Your situation *may* be more complicated - you certainly made it  
sound complicated - but is it?


n.b. if you're concerned about discovering what changed between one  
array and another, a possible easy way to do this is to create a  
NSSet from each one and subtract them.


___

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

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

2008-10-31 Thread Adam R. Maxwell


On Oct 31, 2008, at 6:39 PM, Mudi Dandan wrote:


Hi,

I'm needing a hand with this. I'm trying to emulate the wrapping and  
truncation for icon labels in Finder's icon view.


My first question is: is there any method around for making a string  
to line wrap, and to truncate the second line if it is too long   
(like on the right hand image in the screenshot). Is this supported  
in an API?


It's supported as of 10.5.  See  
NSStringDrawingTruncatesLastVisibleLine in NSStringDrawing.h, along  
with appropriate NSParagraphStyle options.


The second questions is: can the NSAttributedString render  the  
background for the text  like the ones on the screenshots or is it  
something I have to draw myself?


I think you'll have to draw that yourself.

--
Adam



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: Finder like wrapping + truncation

2008-10-31 Thread Mudi Dandan

Thanks Adam, works grate!
There is only one little flaw that it always truncates the tail and I  
don't see a way to change this.


On Nov 1, 2008, at 2:50 AM, Adam R. Maxwell wrote:



On Oct 31, 2008, at 6:39 PM, Mudi Dandan wrote:


Hi,

I'm needing a hand with this. I'm trying to emulate the wrapping  
and truncation for icon labels in Finder's icon view.


My first question is: is there any method around for making a  
string to line wrap, and to truncate the second line if it is too  
long  (like on the right hand image in the screenshot). Is this  
supported in an API?


It's supported as of 10.5.  See  
NSStringDrawingTruncatesLastVisibleLine in NSStringDrawing.h, along  
with appropriate NSParagraphStyle options.


The second questions is: can the NSAttributedString render  the  
background for the text  like the ones on the screenshots or is it  
something I have to draw myself?


I think you'll have to draw that yourself.

--
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: Finder like wrapping + truncation

2008-10-31 Thread Adam R. Maxwell


On Oct 31, 2008, at 7:20 PM, Mudi Dandan wrote:


Thanks Adam, works grate!
There is only one little flaw that it always truncates the tail and  
I don't see a way to change this.


Did you try setting NSLineBreakByTruncatingMiddle on your  
NSParagraphStyle?  I don't recall trying that with  
NSStringDrawingTruncatesLastVisibleLine myself, but it should work.


--
Adam



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]

Gradient panel

2008-10-31 Thread David
Is there an easy way to instantiate a Cocoa panel with a gradient background?

Are there any code samples?

Is NSGradient the key? Any examples of how you hook this in with a
panel or window?

Thanks
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Gradient panel

2008-10-31 Thread Chris Hanson

On Oct 31, 2008, at 8:28 PM, David wrote:


Is NSGradient the key? Any examples of how you hook this in with a
panel or window?


NSGradient is, as you say, the key.

Remember that drawing in Cocoa takes place in a view; from that  
perspective, Cocoa panel with a gradient background isn't really a  
well-formed concept, because it's assuming the panel draws rather than  
its content view.


So just create your own custom subclass of NSView in which you  
override -drawRect: to render an NSGradient, and use an instance of it  
as your window/panel's content view.  Or even just put it within your  
window/panel's content view, covering 100% of its area, with its  
springs and struts set appropriately.


  -- Chris

___

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

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