String Comparison and return values

2009-05-26 Thread John Ku
I am currently trying to compare two string to see if they're equal to each
other. The two values should be equal but when debugging it's giving me a
false return. What gives?
NSString *itemA = [DictionaryA valueForKey:@"FirstProcessIdentifier"];
NSWorkspace *workSpace = [NSWorkspace sharedWorkspace];
for (NSDictionary *apps in [workSpace launchedApplications]) {
  if ( [itemA isEqualTo: [apps valueForKey:
@"NSApplicationProcessIdentifier"]] ) {
NSLog(@"this should run" );
}
}


the NSString "itemA" should contain for example "312" pid
one of the "[apps valueForKey: @"NSApplicationProcessIdentifier"]" should
also return the same "312"

When I NSLog both, there is a matching set "312", but the if statement is
returning false...any tips?

Thanks,
John
___

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

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

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

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


Re: String Comparison and return values

2009-05-26 Thread Graham Cox


On 26/05/2009, at 5:33 PM, John Ku wrote:


isEqualTo



Try -isEqualToString:


--Graham


___

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

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

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

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


Re: String Comparison and return values

2009-05-26 Thread John Ku
Thanks, but its giving me this error now:

* *** -[NSCFNumber isEqualToString:]: unrecognized selector sent to instance
0x147ee0*

*
*


*-John*

On Tue, May 26, 2009 at 12:40 AM, Graham Cox  wrote:

>
> On 26/05/2009, at 5:33 PM, John Ku wrote:
>
>  isEqualTo
>>
>
>
> Try -isEqualToString:
>
>
> --Graham
>
>
>
___

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

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

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

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


Re: String Comparison and return values

2009-05-26 Thread John Ku
Its weird, I saw isEqualToString from the apple documents too, but don't
understand why it isn't recognized

On Tue, May 26, 2009 at 12:42 AM, John Ku  wrote:

> Thanks, but its giving me this error now:
>
> * *** -[NSCFNumber isEqualToString:]: unrecognized selector sent to
> instance 0x147ee0*
>
> *
> *
>
>
> *-John*
>
> On Tue, May 26, 2009 at 12:40 AM, Graham Cox wrote:
>
>>
>> On 26/05/2009, at 5:33 PM, John Ku wrote:
>>
>>  isEqualTo
>>>
>>
>>
>> Try -isEqualToString:
>>
>>
>> --Graham
>>
>>
>>
>
___

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

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

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

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


Re: String Comparison and return values

2009-05-26 Thread Bill Bumgarner

On May 26, 2009, at 12:46 AM, John Ku wrote:
Its weird, I saw isEqualToString from the apple documents too, but  
don't

understand why it isn't recognized


The error message makes it quite clear


* *** -[NSCFNumber isEqualToString:]: unrecognized selector sent to
instance 0x147ee0*


... one of your "strings" is actually not a string at all.

b.bum

___

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

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

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

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


Re: NSOperation cancellation

2009-05-26 Thread Thomas Engelmeier


Am May 26, 2009 um 1:07 AM schrieb Kyle Sluder:


On Mon, May 25, 2009 at 10:15 AM, Thomas Engelmeier
 wrote:

My op polls isCancelled, returns from main and nothing more happens.





Please post your code, it's the only real way to investigate the issue
(especially since you're using operations/multithreading, where the
errors can be extremely subtle).


You were right. Copy-pasting the relevant code revealed that doing a  
[delegate performSelectorOnMainThread] while the main thread is  
blocked waiting for the last operation to finish is not a good idea ;-)


Thanks,
Thomas
___

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

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

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

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


Re: String Comparison and return values

2009-05-26 Thread John Ku
Oh so the very first return value from a Dictionary is not actually a
string?
NSString *itemA = [DictionaryA valueForKey:@"FirstProcessIdentifier"];

I've check the apple document, valueForKey returns an ID...  so it return an
object? how do I proceed?
If i cast it as NSString it gives me an error.

Thanks,
John




On Tue, May 26, 2009 at 12:48 AM, Bill Bumgarner  wrote:

> On May 26, 2009, at 12:46 AM, John Ku wrote:
>
>> Its weird, I saw isEqualToString from the apple documents too, but don't
>> understand why it isn't recognized
>>
>
> The error message makes it quite clear
>
>  * *** -[NSCFNumber isEqualToString:]: unrecognized selector sent to
>> instance 0x147ee0*
>>
>
> ... one of your "strings" is actually not a string at all.
>
> b.bum
>
>
___

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

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

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

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


Re: String Comparison and return values

2009-05-26 Thread Thomas Davie


Op 26 May 2009, om 09:56 heeft John Ku het volgende geschreven:


Oh so the very first return value from a Dictionary is not actually a
string?
NSString *itemA = [DictionaryA valueForKey:@"FirstProcessIdentifier"];

I've check the apple document, valueForKey returns an ID...  so it  
return an

object? how do I proceed?
If i cast it as NSString it gives me an error.


Simple - sort your type error out!  The dictionary contains at least  
one number.  This means that either you're creating it wrong, or  
you're trying to get values out of it wrong...


In the latter case you might want to try something like

id item = [dictionaryA valueForKey:@"FirstProcessIdentifier"];

if ([item isKindOfClass:[NSString class]])
{
// do stuff
}
else if ([item isKindOfClass:[NSNumber class]])
{
// do other stuff
}
...


Bob
___

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

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

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

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


Re: String Comparison and return values

2009-05-26 Thread John Ku
That seems to make sense to use NSNumber instead of NSString, thanks it
works!

But I would think NSString would accept the return numbers as string and
compare them at the string level, it should work in theory no?  But NSNumber
- isEqualToNumber works great!

Thanks!
On Tue, May 26, 2009 at 12:57 AM, listsapple
wrote:

>
> I wonder if isEqualToNumber is what you need?
>
> bw
>
>
> On 26 May 2009, at 08:46, John Ku wrote:
>
> Its weird, I saw isEqualToString from the apple documents too, but don't
> understand why it isn't recognized
>
> On Tue, May 26, 2009 at 12:42 AM, John Ku  wrote:
>
> Thanks, but its giving me this error now:
>
>
> * *** -[NSCFNumber isEqualToString:]: unrecognized selector sent to
>
> instance 0x147ee0*
>
>
>
___

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

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

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

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


Re: String Comparison and return values

2009-05-26 Thread John Ku
Ahhh, that's a really great tip! Thanks!!Would come in really handy!

On Tue, May 26, 2009 at 1:04 AM, Thomas Davie  wrote:

>
> Op 26 May 2009, om 09:56 heeft John Ku het volgende geschreven:
>
>  Oh so the very first return value from a Dictionary is not actually a
>> string?
>> NSString *itemA = [DictionaryA valueForKey:@"FirstProcessIdentifier"];
>>
>> I've check the apple document, valueForKey returns an ID...  so it return
>> an
>> object? how do I proceed?
>> If i cast it as NSString it gives me an error.
>>
>
> Simple - sort your type error out!  The dictionary contains at least one
> number.  This means that either you're creating it wrong, or you're trying
> to get values out of it wrong...
>
> In the latter case you might want to try something like
>
> id item = [dictionaryA valueForKey:@"FirstProcessIdentifier"];
>
> if ([item isKindOfClass:[NSString class]])
> {
>// do stuff
> }
> else if ([item isKindOfClass:[NSNumber class]])
> {
>// do other stuff
> }
> ...
>
>
> Bob
>
___

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

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

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

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


Re: String Comparison and return values

2009-05-26 Thread Jelle De Laender
A NSNumber has a 'stringValue' method, but I don't know why you want  
to compare them at String-level.


Jelle,

On 26 May 2009, at 10:07, John Ku wrote:

That seems to make sense to use NSNumber instead of NSString, thanks  
it

works!

But I would think NSString would accept the return numbers as string  
and
compare them at the string level, it should work in theory no?  But  
NSNumber

- isEqualToNumber works great!

Thanks!
On Tue, May 26, 2009 at 12:57 AM, listsapple
wrote:



I wonder if isEqualToNumber is what you need?

bw


On 26 May 2009, at 08:46, John Ku wrote:

Its weird, I saw isEqualToString from the apple documents too, but  
don't

understand why it isn't recognized

On Tue, May 26, 2009 at 12:42 AM, John Ku   
wrote:


Thanks, but its giving me this error now:


* *** -[NSCFNumber isEqualToString:]: unrecognized selector sent to

instance 0x147ee0*




___

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

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

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

This email sent to maill...@codingmammoth.com


___

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

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

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

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


Re: String Comparison and return values

2009-05-26 Thread John Ku
Yeah, it seems that the problem exist between chair and keyboard.
Just starting, so I thought I could use NSString for everything. :) Need to
pay attention to types more!

Thanks,

John

On Tue, May 26, 2009 at 1:10 AM, Jelle De Laender <
maill...@codingmammoth.com> wrote:

> A NSNumber has a 'stringValue' method, but I don't know why you want to
> compare them at String-level.
>
> Jelle,
>
>
> On 26 May 2009, at 10:07, John Ku wrote:
>
>  That seems to make sense to use NSNumber instead of NSString, thanks it
>> works!
>>
>> But I would think NSString would accept the return numbers as string and
>> compare them at the string level, it should work in theory no?  But
>> NSNumber
>> - isEqualToNumber works great!
>>
>> Thanks!
>> On Tue, May 26, 2009 at 12:57 AM, listsapple
>> wrote:
>>
>>
>>> I wonder if isEqualToNumber is what you need?
>>>
>>> bw
>>>
>>>
>>> On 26 May 2009, at 08:46, John Ku wrote:
>>>
>>> Its weird, I saw isEqualToString from the apple documents too, but don't
>>> understand why it isn't recognized
>>>
>>> On Tue, May 26, 2009 at 12:42 AM, John Ku  wrote:
>>>
>>> Thanks, but its giving me this error now:
>>>
>>>
>>> * *** -[NSCFNumber isEqualToString:]: unrecognized selector sent to
>>>
>>> instance 0x147ee0*
>>>
>>>
>>>
>>>  ___
>>
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>>
>> http://lists.apple.com/mailman/options/cocoa-dev/maillist%40codingmammoth.com
>>
>> This email sent to maill...@codingmammoth.com
>>
>
>
___

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

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

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

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


Re: [announce] A Core Data tutorial

2009-05-26 Thread Mic Pringle
Hi Mike,

I really enjoyed reading this article. Any ideas on when part 2 will
be available ?

Cheers

-Mic

2009/5/22 Michael Swan :
> Just finished the first in a series of tutorials that takes a Core Data app
> from beginning to end including things like icons, and serial numbers.
>
> http://themikeswan.wordpress.com/2009/05/22/7/
>
> Feel free to let me know what you think. Also there is one feature I want to
> add later that I have not figured out how to do yet so if anyone is
> interested in contributing a bit let me know (I will of course make sure you
> get credit).
>
> Thanks,
> Mike Swan
> ETCP Certified Entertainment Electrician
> http://www.michaelsswan.com
>
> "Every experience in your life is an opportunity to learn something new and
> to make a change for your ultimate benefit."
>
>
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/micpringle%40gmail.com
>
> This email sent to micprin...@gmail.com
>
___

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

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

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

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


Re: How to use CFReadStrem and abort read stream normally?

2009-05-26 Thread Peter Blazejewicz

Hello Chris,

On May 22, 2009, at 5:10 AM, Chris Gardner wrote:



Hi,
I have already read through CFReadStream archives, and still have  
trouble with it.
After CFReadStreamOpen() has been implement and its status is  
kCFStreamEventHasBytesAvailable,
so I can read data from the source.Of course, there's no problem. As  
for the FTP server,

I can connect it by using CFReadStreamCreateWithFTPURL.
Now, I would like to abort/disconnect the read stream when its  
status is kCFStreamEventHasBytesAvailable.

At that time. I will use CFReadStreamClose() and CFRunLoopStop().
As you know, the read stream was availabe in a run loop
where data stream can tranfer from FTP server to destination.
However, I met a terrible problem which show GDB:Program received  
signal:"EXC_BAD_ACCESS" as soon as I do above operation,
also I see the read stream's status become  
kCFStreamEventErrorOccurred.
So my question is...How can I avoid this error and how can I abort  
the read stream normally

when its status is kCFStreamEventHasBytesAvailable.
Your help will be appreciated.
Best Regards.
Chris Wu


have you tried using routine described in docs (unschedule from run  
loop and close stream)?
http://developer.apple.com/documentation/Networking/Conceptual/CFNetwork/CFStreamTasks/CFStreamTasks.html#/ 
/apple_ref/doc/uid/TP3230-62233

e.g.:
CFReadStreamUnscheduleFromRunLoop(myStream, CFRunLoopGetCurrent(),  
kCFRunLoopCommonModes);

CFReadStreamClose(myStream);
CFRelease(myStream);

kind regards,
Peter Blazejewicz
___

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

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

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

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


RE: How to safely break read stream?

2009-05-26 Thread Chris Gardner

Hi GG,

Thanks for your reply.

 

> When you say "resuming to connect the same file", do you mean you're 
> trying to reopen the same CFReadStream that was created earlier and 
> subsequently closed?
> 
> If that's what you're doing, then it won't work. Refer to the docs 
> for CFReadStream:
> 
> http://developer.apple.com/documentation/CoreFoundation/Reference/ 
> CFReadStreamRef/index.html

 

In fact, when I am trying to accomplish the resume function, I do two steps.

Firstly, I will close the CFReadStream with CFReadStreamClose.

Secondly, I will use a new CFReadStream, and perform all the same setup as I 
did before 

to download the same file, meanwhile I am using 
kCFStreamPropertyFTPFileTransferOffset to

offset the length of file data that I have downloaded.

Even though, I still got the error code 530.

And I really hope that you give me some advice to solve the problem when using 
CFReadStream.

You suggest that curl be powered by libcurl for all transfer-related features I 
will consider about it.

Best Regards,

Chris.

_
Invite your mail contacts to join your friends list with Windows Live Spaces. 
It's easy!
http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us
___

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

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

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

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


RE: How to use CFReadStrem and abort read stream normally?

2009-05-26 Thread Chris Gardner

Hi peter,
I have read the docs ,and when stopping the read stream, I do use the 
functions, as your said,below
CFReadStreamUnscheduleFromRunLoop(myStream, CFRunLoopGetCurrent(), 
kCFRunLoopCommonModes);
CFReadStreamClose(myStream);
CFRelease(myStream);
According to the docs, it can be safely stop the read stream,
and it's supposed to continue downloading the same file if I have created a new 
read stream
to download the same file.But it disappointed me.
If you have any other suggestions, please inform me.
Best Regards,
Chris
 


CC: cocoa-dev@lists.apple.com
From: peter.blazejew...@gmail.com
To: chrisgard...@live.com
Subject: Re: How to use CFReadStrem and abort read stream normally?
Date: Tue, 26 May 2009 11:42:22 +0200

Hello Chris,



On May 22, 2009, at 5:10 AM, Chris Gardner wrote:


Hi,
I have already read through CFReadStream archives, and still have trouble with 
it.
After CFReadStreamOpen() has been implement and its status is 
kCFStreamEventHasBytesAvailable,
so I can read data from the source.Of course, there's no problem. As for the 
FTP server, 
I can connect it by using CFReadStreamCreateWithFTPURL.
Now, I would like to abort/disconnect the read stream when its status is 
kCFStreamEventHasBytesAvailable.
At that time. I will use CFReadStreamClose() and CFRunLoopStop(). 
As you know, the read stream was availabe in a run loop 
where data stream can tranfer from FTP server to destination.
However, I met a terrible problem which show GDB:Program received 
signal:"EXC_BAD_ACCESS" as soon as I do above operation,
also I see the read stream's status become kCFStreamEventErrorOccurred.
So my question is...How can I avoid this error and how can I abort the read 
stream normally 
when its status is kCFStreamEventHasBytesAvailable.
Your help will be appreciated.
Best Regards.
Chris Wu


have you tried using routine described in docs (unschedule from run loop and 
close 
stream)?http://developer.apple.com/documentation/Networking/Conceptual/CFNetwork/CFStreamTasks/CFStreamTasks.html#//apple_ref/doc/uid/TP3230-62233e.g.:CFReadStreamUnscheduleFromRunLoop(myStream,
 CFRunLoopGetCurrent(), kCFRunLoopCommonModes);CFReadStreamClose(myStream);

CFRelease(myStream);
kind regards,Peter Blazejewicz
_
Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.

http://www.microsoft.com/windows/windowslive/products/photos.aspx___

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

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

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

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


Core data, bindings and multiple view NIBs

2009-05-26 Thread Tomaž Kragelj

Hi all

I'm (again) banging my head with a single window, multiple views app  
using core data. Each of my view is implemented within it's own NIB  
and handled by a NSViewController subclass. The views share the same  
data from the same MOC. Using the following core data model I cannot  
bind the data as I want:


Group <--->> Item

My intention is to show the list of items that belong to selected  
group. To do that, I add two NSArrayControllers to MainMenu.nib and  
setup their bindings, then expose the controllers through IBOutlet to  
my app delegate. This works as expected. Then I use a separate NIB  
with the view which handles the list of all groups. It also contains  
it's own NSArrayController instance (dragged from the palette) which  
is bound to the "master" controller from the app delegate. This works,  
it even supports binding the selection. However I'm not able to do the  
same for the items view (again in it's own NIB, handled by it's own  
NSViewController subclass) - the closest solution I came to was that  
ALL items for ALL groups were shown, however adding new ones (saving  
actually) failed since their group relation was not set...


I'm sure I'm missing something, can someone point me to a proper  
direction?

Thanks, Tom
___

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

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

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

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


How to check whether a application is launch or not...?

2009-05-26 Thread Anshul jain

HI All,
At the starting of my application i am trying to find  
out whether Time machine is launched or not. I tried to use  
NSWorkSpace API  launchedApplications
 but i get every application that is launched except Time  
Machine. Is there a Problem in my approach. or there is other way to  
do it.



Regards,
Anshul jain




___

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

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

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

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


Re: How to safely break read stream?

2009-05-26 Thread Christian Weykopf


Am 26.05.2009 um 05:51 schrieb Chris Gardner:




To: cocoa-dev@lists.apple.com
From: glgue...@amug.org
Date: Mon, 25 May 2009 10:46:40 -0700
Subject: Re: How to safely break read stream?

Chris Gardner wrote:


I create a read stream with CFReadStreamOpen(),
but I don't know how to safely break it.
Eagerly waiting for your reply.



Eagerly waiting for your explanation of what you mean by "break".

Do you mean "to interrupt normal reading"?

Do you mean "to separate into sections"?

Do you mean something else?

Please describe what you are doing with the read stream, and what you
want to accomplish. Then describe what "break" means in reference to
the rest of what you are doing.

-- GG





Hi GG,
Thanks for your reply.
In your mailing list, you suggest me demonstrating what I want to do,
so now I am describing it in detail, please see below.
I want to receive data from FTP servers over a network with CFFTP API,
and can safely stop transferring data at any time.

Firstly, create the stream using CFReadStreamCreateWithFTPURL().
Secondly, set up my callbacks with CFReadStreamSetClient().
Thirdly, add it to the run-loop with  
CFReadStreamScheduleWithRunLoop().

Finally, open the stream with CFReadStreamOpen().
I'll get call-backs when information is available to be read.

I can accomplish receiving data from FTP servers successfully.
When transferring data, I stop it using  
CFReadStreamUnscheduleFromRunLoop()

and CFReadStreamClose().
When I am resuming to connect the same file in FTP servers, I always  
get
the same problem which show error code 530 that meams user not  
logged in.

However, I can connect other files in FTP servers successfully.

I guess the reason why I can not connect the same file again is that  
I did not

interupt the read stream safely.

So my question is...How can I resume to connect and receive data  
from the same file

in FTP servers or how can I interupt the read stream safely.

Here is my msn identifier chrisgard...@live.com if you could add me.
Waiting for your reply.

Best Regards,
Chris.


Hi Chris

maybe this post is related to your problem.


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


How to check whether a application is launch or not...?

2009-05-26 Thread Anshul jain

HI All,
At the starting of my application i am trying to find  
out whether Time machine is launched or not. I tried to use  
NSWorkSpace API  launchedApplications
 but i get every application that is launched except Time  
Machine. Is there a Problem in my approach. or there is other way to  
do it.



Regards,
Anshul jain




___

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

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

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

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


Displaying a number with Quartz

2009-05-26 Thread Pierre Berloquin
Hi
I need to display an int with  CGContextShowTextAtPoint
that only accepts char arrays.
How do I go about it ?
I can't find how to convert an int into a char* in objective-C !!

Thanks
Pierre
___

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

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

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

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


Re: Underlining a Tab item label

2009-05-26 Thread Shlok Datye
You can subclass NSTabViewItem, override its drawLabel:inRect:, and  
put your custom drawing code there.


Shlok Datye
Coding Turtle
http://codingturtle.com


On 25.05.2009, at 18:41, David Alter wrote:

With NSTabView I can set the font of the NSTabViewItem label. Is  
there a way
to make it underlined? I have always done this with the  
NSAttributeString in
the past. However I do not see how I can get access to the attribute  
string

for the NSTabViewItem label.
thank for the help
-dave

___

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

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

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

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


NSWindow in threads

2009-05-26 Thread Mattias Jansson


I'm trying to create a window from code in a thread created with NSThread 
detachNewThreadSelector:toTarget:withObject


The main thread simply calls NSApplicationMain

The window is created with
[[NSWindow alloc] initWithContentRect:rect 
styleMask:(NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask) 
backing:NSBackingStoreRetained defer:YES]


The window has an empty view set with
setContentView:[[NSView alloc] initWithFrame:[window 
contentRectForFrameRect:[window frame]]


However, the titlebar is not redrawn correctly, and the standard buttons 
(zoom, close) does not redraw their active states when mouse moves over 
them but remain greyed out. They do respond to click events though.


I've been reading the API docs but I can't figure out what I've missed in 
order to get the window drawing the title bar correctly. Any ideas?


___

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

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

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

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


Re: String Comparison and return values

2009-05-26 Thread Rainer Brockerhoff
At 01:06 -0700 26/05/09, cocoa-dev-requ...@lists.apple.com wrote:
>From: Thomas Davie 
>To: John Ku 
>References: 
>   <298ad53c-ec5e-4519-bbba-61a13ca9c...@bigpond.com>
>   
>   
>   <7e0b7c90-a346-431f-8220-c8eccafd9...@mac.com>
>   
>In-Reply-To: 
>Date: Tue, 26 May 2009 10:04:15 +0200
>Message-ID: <11f773a4-ad73-423c-847a-2d5fa8f80...@gmail.com>
>
>Op 26 May 2009, om 09:56 heeft John Ku het volgende geschreven:
>
>>Oh so the very first return value from a Dictionary is not actually a
>>string?
>>NSString *itemA = [DictionaryA valueForKey:@"FirstProcessIdentifier"];
>>
>>I've check the apple document, valueForKey returns an ID...  so it return an
>>object? how do I proceed?
>>If i cast it as NSString it gives me an error.
>
>Simple - sort your type error out!  The dictionary contains at least one 
>number.  This means that either you're creating it wrong, or you're trying to 
>get values out of it wrong...
>
>In the latter case you might want to try something like
>
>id item = [dictionaryA valueForKey:@"FirstProcessIdentifier"];
>
>if ([item isKindOfClass:[NSString class]])
>{
>   // do stuff
>}
>else if ([item isKindOfClass:[NSNumber class]])
>{
>   // do other stuff
>}
>...

It appears that one of the items can be an NSString and the other an NSNumber, 
so none of the standard comparisons will work directly.

Instead of testing what kind of class each is, I'd try something like
if ([itemA intValue] == [itemB intValue]) ...

since both NSString and NSNumber will respond to intValue, that should work.

-- 
Rainer Brockerhoff  
Belo Horizonte, Brazil
"In the affairs of others even fools are wise
 In their own business even sages err."
Weblog: http://www.brockerhoff.net/bb/viewtopic.php
___

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

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

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

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


Re: Displaying a number with Quartz

2009-05-26 Thread Alexander Spohr

sprintf



Am 25.05.2009 um 09:16 schrieb Pierre Berloquin:


Hi
I need to display an int with  CGContextShowTextAtPoint
that only accepts char arrays.
How do I go about it ?
I can't find how to convert an int into a char* in objective-C !!

Thanks
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/atze%40freeport.de

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


___

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

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

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

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


what am I missing with NSString ?

2009-05-26 Thread vinai

Hi Folks,

I think I am missing something really basic here with NSString.  I am trying to 
store the path of a user-selected file (from an NSOpenPanel) internally so 
other routines can act on the data within the file.  Here's the relevant 
section of code:

if ([oPanel runModalForDirectory:nil file:nil types:nil] == NSOKButton)
{
NSArray * files = [oPanel filenames];

/* Process files */

for( i = 0; i < [files count]; i++ )
{
[rawFileName initWithString: [[files objectAtIndex:i] 
stringByStandardizingPath]];
NSLog(@"Logging the file name variable");
NSLog(rawFileName);

NSLog(@"Logging the called file path object directly");
NSLog([[files objectAtIndex:i] stringByStandardizingPath]);
}
}

and this is the output from that section of code:

2009-05-26 09:18:41.931 REMI[19710:807] Logging the file name variable
2009-05-26 09:18:41.932 REMI[19710:807] Logging the called file path object 
directly
2009-05-26 09:18:41.932 REMI[19710:807] 
/Users/vinai/Desktop/rawTestData/P04608.7

rawFileName is declared to be an NSString * in my object's header file. So why 
does printing out the string returned by the stringByStandardizingPath function 
work okay, but not when initializing an NSString * variable with it ?  What 
would I need to rawFileName so it can be used by other methods in my object ?

Thanks much all.

vinai



  
___

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

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

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

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


Re: Displaying a number with Quartz

2009-05-26 Thread Michael Vannorsdel
NSString's stringWithFormat:, or using sprintf/asprintf with the %d  
format:


char * str;

if(asprintf(&str, "%d", intval) < 0)
//error

CGContextShowTextAtPoint...

free(str);

or if you know the possible max size of the text:

char strbuffer[MAX];

if(snprintf(strbuffer, MAX, "%d", intval) < 0)
//error

CGContextShowTextAtPoint...


On May 25, 2009, at 1:16 AM, Pierre Berloquin wrote:


I need to display an int with  CGContextShowTextAtPoint
that only accepts char arrays.
How do I go about it ?
I can't find how to convert an int into a char* in objective-C !!


___

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

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

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

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


Re: what am I missing with NSString ?

2009-05-26 Thread Michael Vannorsdel
rawFileName = [[NSString alloc] initWithString:[[files  
objectAtIndex:i] stringByStandardizingPath]];


Be sure to release rawFileName before you replace it with a new path.


On May 26, 2009, at 7:33 AM, vinai wrote:

think I am missing something really basic here with NSString.  I am  
trying to store the path of a user-selected file (from an  
NSOpenPanel) internally so other routines can act on the data within  
the file.  Here's the relevant section of code:


   if ([oPanel runModalForDirectory:nil file:nil types:nil] ==  
NSOKButton)

   {
   NSArray * files = [oPanel filenames];

   /* Process files */

   for( i = 0; i < [files count]; i++ )
   {
   [rawFileName initWithString: [[files objectAtIndex:i]  
stringByStandardizingPath]];

   NSLog(@"Logging the file name variable");
   NSLog(rawFileName);

   NSLog(@"Logging the called file path object directly");
   NSLog([[files objectAtIndex:i] stringByStandardizingPath]);
   }
   }

and this is the output from that section of code:

2009-05-26 09:18:41.931 REMI[19710:807] Logging the file name variable
2009-05-26 09:18:41.932 REMI[19710:807] Logging the called file path  
object directly
2009-05-26 09:18:41.932 REMI[19710:807] /Users/vinai/Desktop/ 
rawTestData/P04608.7


rawFileName is declared to be an NSString * in my object's header  
file. So why does printing out the string returned by the  
stringByStandardizingPath function work okay, but not when  
initializing an NSString * variable with it ?  What would I need to  
rawFileName so it can be used by other methods in my object ?


Thanks much all.


___

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

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

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

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


Re: what am I missing with NSString ?

2009-05-26 Thread Volker in Lists

Hi,

from the code listed I cannot tell if you alloc'ed memory for your  
NSString at all?


What is the goal you try to achieve? If you just want to store a  
single file path... with a global NSString do as along the lines of:


[rawFileName release];
rawFileName = [[NSString alloc] initWithString:[[files  
objectAtIndex:i] stringByStandardizingPath]]];


Of course that will give you the last of the selected files stored in  
the rawFileName string object. Alternatively you can use a mutable  
string and replace the contents with the selected filename.


Maybe that helps to point you in the right directions ...

Volker


Am 26.05.2009 um 15:33 schrieb vinai:



Hi Folks,

I think I am missing something really basic here with NSString.  I  
am trying to store the path of a user-selected file (from an  
NSOpenPanel) internally so other routines can act on the data within  
the file.  Here's the relevant section of code:


   if ([oPanel runModalForDirectory:nil file:nil types:nil] ==  
NSOKButton)

   {
   NSArray * files = [oPanel filenames];

   /* Process files */

   for( i = 0; i < [files count]; i++ )
   {
   [rawFileName initWithString: [[files objectAtIndex:i]  
stringByStandardizingPath]];

   NSLog(@"Logging the file name variable");
   NSLog(rawFileName);

   NSLog(@"Logging the called file path object directly");
   NSLog([[files objectAtIndex:i] stringByStandardizingPath]);
   }
   }

and this is the output from that section of code:

2009-05-26 09:18:41.931 REMI[19710:807] Logging the file name variable
2009-05-26 09:18:41.932 REMI[19710:807] Logging the called file path  
object directly
2009-05-26 09:18:41.932 REMI[19710:807] /Users/vinai/Desktop/ 
rawTestData/P04608.7


rawFileName is declared to be an NSString * in my object's header  
file. So why does printing out the string returned by the  
stringByStandardizingPath function work okay, but not when  
initializing an NSString * variable with it ?  What would I need to  
rawFileName so it can be used by other methods in my object ?


Thanks much all.

vinai




___

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

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

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

This email sent to volker_li...@ecoobs.de


___

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

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

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

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


[OT] default boot device

2009-05-26 Thread Тимофей Даньшин

Hello.
I installed another version of MacOS X in a separate partition of my  
hard disc. And now whenever i start the computer, it boots from that  
partition by default (unless i press option to select the partition to  
boot from this time). How can i permanently change the primary boot  
device to my initial one?

Sorry if this is too off-topic.

Thanks in advance,
Timofey.
___

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

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

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

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


Core Animation faulty behaviour?

2009-05-26 Thread Boris Prohaska
Hi guys... i'm new to Core Animation. What i want is a simple dissolve  
between two images. In the Code below you can see what i'm doing.


//self = a NSButton subclass
recordButton = [CALayer layer];
[self setWantsLayer:YES];

[self.layer addSublayer:recordButton];
//init the Dissolve filter
CIFilter* filter = [CIFilter filterWithName:@"CIDissolveTransition"];

[filter setDefaults];
//load my 2 images
	[filter setValue:[CIImage imageWithContentsOfURL:[NSURL  
fileURLWithPath:[[NSBundle mainBundle]  
pathForResource:@"button_record_low" ofType:@"png"]]]  
forKey:kCIInputImageKey];
	[filter setValue:[CIImage imageWithContentsOfURL:[NSURL  
fileURLWithPath:[[NSBundle mainBundle]  
pathForResource:@"button_record_high" ofType:@"png"]]]  
forKey:kCIInputTargetImageKey];

[filter setName:@"pulse"];
//set the filters to the button
[recordButton setFilters:[NSArray arrayWithObject:filter]];

//setup an animation
CABasicAnimation* pulseAnimation = [CABasicAnimation animation];
//manipulate the inputtime
pulseAnimation.keyPath = @"filters.pulse.inputTime";
//we go the whole way...
pulseAnimation.fromValue = [NSNumber numberWithFloat:0.];
pulseAnimation.toValue = [NSNumber numberWithFloat:1.];
//..for one second
pulseAnimation.duration = 1.;
//..indefinitly
pulseAnimation.repeatCount = 1e100f;
//we want, that it revereses..
pulseAnimation.autoreverses = YES;
//set the timingfunction we want..
	pulseAnimation.timingFunction = [CAMediaTimingFunction  
functionWithName:kCAMediaTimingFunctionEaseInEaseOut];

//start the animation.
[recordButton addAnimation:pulseAnimation forKey:@"pulseAnimation"];

What i expect is, that the dissolve will go from "button_record_low"  
to "button_record_high". What i get is that it goes from "nothing" to  
"button_record_high". What am i doing wrong?


Thanks in advance
Boris

___

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

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

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

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


Re: what am I missing with NSString ?

2009-05-26 Thread Ken Thomases

On May 26, 2009, at 8:33 AM, vinai wrote:


I think I am missing something really basic here with NSString.


Actually, it seems you're missing stuff much more basic than that.   
You seem to not understand the difference between a pointer and an  
object (which a pointer might point to).



   if ([oPanel runModalForDirectory:nil file:nil types:nil] ==  
NSOKButton)

   {
   NSArray * files = [oPanel filenames];

   /* Process files */

   for( i = 0; i < [files count]; i++ )
   {
   [rawFileName initWithString: [[files objectAtIndex:i]  
stringByStandardizingPath]];


This is very atypical.  You should not be init-ing an object except  
immediately upon allocating it.  Typically, this is done in an  
expression which combines the +alloc message with a -init... message.   
So, for example:


		rawFileName = [[NSString alloc] initWithString: [[files  
objectAtIndex:i] stringByStandardizingPath]];


That bring us to issues of memory management, for which you should  
read the memory management guide.  In this case, you would have to  
make sure you release the object pointed to by rawFileName when you're  
done with it.


However, why are you attempting to init another object, at all?  The  
expression [[files objectAtIndex:i] stringByStandardizingPath] returns  
a pointer to a string object, already.  There's a pretty good chance  
that you can just make use of that string object directly.  If you  
need to keep it around, you could retain it and then release it later.



   NSLog(@"Logging the file name variable");
   NSLog(rawFileName);

   NSLog(@"Logging the called file path object directly");
   NSLog([[files objectAtIndex:i] stringByStandardizingPath]);
   }
   }

and this is the output from that section of code:

2009-05-26 09:18:41.931 REMI[19710:807] Logging the file name variable
2009-05-26 09:18:41.932 REMI[19710:807] Logging the called file path  
object directly
2009-05-26 09:18:41.932 REMI[19710:807] /Users/vinai/Desktop/ 
rawTestData/P04608.7


rawFileName is declared to be an NSString * in my object's header  
file.


And here is why I think you misunderstand the difference between a  
pointer and an object which it might point to.


Having declared a pointer as an instance variable means that each of  
your objects has a pointer.  It does not mean that each of your  
objects has a string object.  Unless you explicitly assign that  
pointer to point to something, it points to nothing.


So why does printing out the string returned by the  
stringByStandardizingPath function work okay, but not when  
initializing an NSString * variable with it ?


You did not initialize the rawFileName variable with the above code.   
You attempted to initialize the object to which rawFileName pointed.   
There are two problems: 1) rawFileName points to nothing, and 2) if it  
did point to something, that object should have already been  
initialized and you're not allowed to initialize it again.


You can choose a couple of alternative approaches:

*) You could change what rawFileName points to by assigning it the  
address of a different object.  If you do that, be sure to get memory  
management right.
*) You could have rawFileName point to a mutable string object, and  
change the content of that string object.  That's different from  
attempting to reinitialize the object.


Regards,
Ken

___

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

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

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

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


NULL Outlets in one file work in another

2009-05-26 Thread Walker Argendeli
I have a App_Delegate file.  In applicationDidFinishLaunch:, I  
instantiate a FirstLaunch object and call its start method.  The weird  
thing is that this method, which access several IBOutlets, seems to be  
working with null outlets.  All the connections are right in IB, and  
yet the outlets are null.  I put the method inside App_Delegate.m and  
set the same connections, and the outlets work fine.  I've been  
staring at the files for an hour, trying to figure out where I went  
wrong.  The connections are the same, the headers have the same ivars,  
and yet in one file, the outlets work fin, and in another they're null.


Thanks,
- Walker Argendeli

___

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

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

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

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


Re: [OT] default boot device

2009-05-26 Thread Jean-Daniel Dupas


Le 26 mai 09 à 15:43, Тимофей Даньшин a écrit :


Hello.
I installed another version of MacOS X in a separate partition of my  
hard disc. And now whenever i start the computer, it boots from that  
partition by default (unless i press option to select the partition  
to boot from this time). How can i permanently change the primary  
boot device to my initial one?

Sorry if this is too off-topic.


cocoa-dev is not the only way to search info on the web…

Try the Help menu on your computer.



___

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

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

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

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


Re: NSWindow in threads

2009-05-26 Thread Mike Abdullah
You've missed the big warning somewhere in the docs that most of  
AppKit is not threadsafe. Why do you want to create a window on  
another thread? What is wrong with doing it on the main thread?


On 26 May 2009, at 10:51, Mattias Jansson wrote:



I'm trying to create a window from code in a thread created with  
NSThread detachNewThreadSelector:toTarget:withObject


The main thread simply calls NSApplicationMain

The window is created with
[[NSWindow alloc] initWithContentRect:rect styleMask: 
(NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask| 
NSResizableWindowMask) backing:NSBackingStoreRetained defer:YES]


The window has an empty view set with
setContentView:[[NSView alloc] initWithFrame:[window  
contentRectForFrameRect:[window frame]]


However, the titlebar is not redrawn correctly, and the standard  
buttons (zoom, close) does not redraw their active states when mouse  
moves over them but remain greyed out. They do respond to click  
events though.


I've been reading the API docs but I can't figure out what I've  
missed in order to get the window drawing the title bar correctly.  
Any ideas?


___

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

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

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

This email sent to cocoa...@mikeabdullah.net


___

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

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

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

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


Re: Threads and retain/release

2009-05-26 Thread Dave DeLong
DOH!  Funny thing is, I read that sentence a couple days ago in the docs, but 
only registered the "retains the ... argument" bit at the time (because that's 
what I was looking for).

You're right.  That makes everything *much* simpler.

Lesson learned... again... when in doubt, read the documentation.  =P

Thanks!

Dave
 
On Tuesday, May 26, 2009, at 09:07AM, "Michael Ash"  
wrote:
>
>NSThread retains the target and argument of the thread until the
>thread terminates.
___

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

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

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

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


Re: NULL Outlets in one file work in another

2009-05-26 Thread Walker Argendeli

Typos on my part
It's applicationDidFinishLaunching:
That delegate method is in the file App_Delegate.m, which is the  
App_Delegate file.

The App_Delegate file is a delegate of the app.

Basically, I have some code working with outlets.
If I put it as a method in App_Delegate, it works.  I call it like  
this from applicationDidFinishLaunching:

[self doStuff];

If I move the doStuff method to the FirstLaunch.m file and call that  
method, again, from applicationDidFinishLaunching, it doesn't work:

FirstLaunch *thing = [[FirstLaunch alloc]  init];
[thing doStuff];

So in App_Delegate's applicationDidFInishLaunching method, I have  
something that looks like this:

[self doStuff];
FirstLaunch *thing = [[FirstLaunch alloc]  init];
[thing doStuff];
And either the first line is commented out or the last two are  
commented out.  The method they are calling is the same, just located  
in different files.  Both App_Delegate and FirstLaunch have the Outlet  
ivars connected in IB and give no warnings or errors.


Thanks for your help,
- Walker Argendeli

On May 26, 2009, at 10:45 AM, Volker in Lists wrote:


Hi,

are you using - (void)applicationDidFinishLaunch:(NSNotification  
*)aNotification or - (void)applicationDidFinishLaunching: 
(NSNotification *)aNotification ? The first is not a valid delegate  
method, the second is. Have you connected your AppDelegate as  
delegate of your app - can it receive the notification at all?


And can you clarify on the difference of an App_Delegate file vs.  
App_Delegate.m ?


Cheers,
Volker


Am 26.05.2009 um 16:17 schrieb Walker Argendeli:

I have a App_Delegate file.  In applicationDidFinishLaunch:, I  
instantiate a FirstLaunch object and call its start method.  The  
weird thing is that this method, which access several IBOutlets,  
seems to be working with null outlets.  All the connections are  
right in IB, and yet the outlets are null.  I put the method inside  
App_Delegate.m and set the same connections, and the outlets work  
fine.  I've been staring at the files for an hour, trying to figure  
out where I went wrong.  The connections are the same, the headers  
have the same ivars, and yet in one file, the outlets work fin, and  
in another they're null.


Thanks,
- Walker Argendeli

___

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

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

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

This email sent to volker_li...@ecoobs.de




___

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

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

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

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


Re: warning 'NSEvent' may not respond to '+eventWithEventRef:'

2009-05-26 Thread Bill Cheeseman

I sent this reply to Ken but neglected to send it to the list.

On May 26, 2009, at 12:52 AM, Ken Tozier wrote:


'm getting a warning when calling NSEvent's eventWithEventRef

NSEvent *event  = [NSEvent eventWithEventRef: ref];

I include Appkit and Carbon in the file where this warning appears

#import 
#import 

And the documentation doesn't say this is an obsolete method


That method was introduced in Leopard to enable you to augment what  
you can do with the NSEvent API by getting the CGEventRef opaque  
object that lies behind the NSEvent object. Once you have the  
CGEventRef object, you can use the Quartz Event Taps API to do things  
that aren't available in NSEvent. Event taps are documented in Apple's  
"Quartz Event Taps Reference" document. Download my free Event Taps  
Testbench application at prefabsoftware.com/eventtapstestbench for  
more information.


To answer your question, add this line to your code file:

#import 

I forget whether you have to link to Carbon, but I don't think so --  
unless you need it for some other reason.


--

Bill Cheeseman
b...@cheeseman.name
___

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

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

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

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


Re: NULL Outlets in one file work in another

2009-05-26 Thread Volker in Lists

Hi,

are you using - (void)applicationDidFinishLaunch:(NSNotification  
*)aNotification or - (void)applicationDidFinishLaunching: 
(NSNotification *)aNotification ? The first is not a valid delegate  
method, the second is. Have you connected your AppDelegate as delegate  
of your app - can it receive the notification at all?


And can you clarify on the difference of an App_Delegate file vs.  
App_Delegate.m ?


Cheers,
Volker


Am 26.05.2009 um 16:17 schrieb Walker Argendeli:

I have a App_Delegate file.  In applicationDidFinishLaunch:, I  
instantiate a FirstLaunch object and call its start method.  The  
weird thing is that this method, which access several IBOutlets,  
seems to be working with null outlets.  All the connections are  
right in IB, and yet the outlets are null.  I put the method inside  
App_Delegate.m and set the same connections, and the outlets work  
fine.  I've been staring at the files for an hour, trying to figure  
out where I went wrong.  The connections are the same, the headers  
have the same ivars, and yet in one file, the outlets work fin, and  
in another they're null.


Thanks,
- Walker Argendeli

___

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

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

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

This email sent to volker_li...@ecoobs.de


___

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

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

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

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


Re: Displaying a number with Quartz

2009-05-26 Thread Sean McBride
Never ever use sprintf for anything.  See here for why:




On 5/26/09 3:26 PM, Alexander Spohr said:

>sprintf
>
>
>
>Am 25.05.2009 um 09:16 schrieb Pierre Berloquin:
>
>> Hi
>> I need to display an int with  CGContextShowTextAtPoint
>> that only accepts char arrays.
>> How do I go about it ?
>> I can't find how to convert an int into a char* in objective-C !!

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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

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

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


Re: what am I missing with NSString ?

2009-05-26 Thread vinai


Hi All,

Thanks so much to Micheal, Volker, and esp. to Ken for the pointer/object 
refresher.

I think my mistake came from thinking that NSString's initWithString method did 
memory allocation as well, and would create a new object in one swell foop. ;-) 
 From my own trials and failures, and from what you all are saying - this is 
definitely not the case.

> However, why are you attempting to init another object, at
> all?  The expression [[files objectAtIndex:i]
> stringByStandardizingPath] returns a pointer to a string
> object, already.  There's a pretty good chance that you
> can just make use of that string object directly.  If
> you need to keep it around, you could retain it and then
> release it later.

This is the approach I tried, and it seems to satisfy my requirement of having 
the file name available internally to other routines.  I have now encountered 
other problems further downstream in my pipeline, but c'est la vie ...

Again, thanks all - very, very much!

cheers
vinai



  
___

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

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

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

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


Re: Displaying a number with Quartz

2009-05-26 Thread Sean McBride
On 5/26/09 5:12 PM, Alexander Spohr said:

>> Never ever use sprintf for anything.
>
>If you use "%d" and know it will be an int? You know how many chars
>you'll have at max, no buffer-overflow possible. (You might argue
>here, that at some time we will habe 128-bit ints, but hey you should
>recode your app then anyway or just have a buffer large enough to
>handle that right at the start)
>
>And yes - you are right, use snprintf instead... int might become 256
>bit.

You can use sprintf safely if you're very careful, I suppose, but using
snprintf is not harder and so much safer.  sprintf is just not worth the risk.

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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

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

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


Re: NSWindow in threads

2009-05-26 Thread Joar Wingfors


On 26 maj 2009, at 08.03, Mike Abdullah wrote:

Wow, I had no idea of this particular aspect of the rules. My  
suspicion is this exists to accomodate Cocoa's ability to use window  
objects for caching a view's contents to an image. Maybe the act of  
showing a window is what is breaking on a secondary thread.



Perhaps so. While the guidelines states that it's safe to create the  
window, that still leaves basically everything else in the NSWindow  
API off bounds for use from background threads - including calling "- 
orderFront:" to show the window.


The general recommendation has to be to only manipulate the UI from  
the main thread. With a few exceptions, the thread safety guidelines  
are currently not detailed enough to allow for anything else.


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


Re: Core data, bindings and multiple view NIBs

2009-05-26 Thread Keary Suska

On May 26, 2009, at 5:21 AM, Tomaž Kragelj wrote:

I'm (again) banging my head with a single window, multiple views app  
using core data. Each of my view is implemented within it's own NIB  
and handled by a NSViewController subclass. The views share the same  
data from the same MOC. Using the following core data model I cannot  
bind the data as I want:


Group <--->> Item

My intention is to show the list of items that belong to selected  
group. To do that, I add two NSArrayControllers to MainMenu.nib and  
setup their bindings, then expose the controllers through IBOutlet  
to my app delegate. This works as expected. Then I use a separate  
NIB with the view which handles the list of all groups. It also  
contains it's own NSArrayController instance (dragged from the  
palette) which is bound to the "master" controller from the app  
delegate. This works, it even supports binding the selection.  
However I'm not able to do the same for the items view (again in  
it's own NIB, handled by it's own NSViewController subclass) - the  
closest solution I came to was that ALL items for ALL groups were  
shown, however adding new ones (saving actually) failed since their  
group relation was not set...


I'm sure I'm missing something, can someone point me to a proper  
direction?


How are you binding the "item" array controller? It has to be bound to  
the group list array controller or to a property of the app delegate  
that depends on its selection.


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

___

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

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

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

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


Re: NSWindow in threads

2009-05-26 Thread Michael Ash
On Tue, May 26, 2009 at 10:51 AM, Joar Wingfors  wrote:
> Your comment is correct in general, but according to the thread safety
> guidelines you're supposed to be able to create windows on background
> threads:
>
> 

I love that section of the docs. It starts off saying that this
activity is safe. And then it says,

"There is some possibility that window objects may leak in an
application that deals with a lot of windows concurrently."

To me, the conclusion to draw from that is that it really isn't safe,
no matter what Apple says about it. If something can go wrong if
there's too much concurrency, it's not really thread safe!

(Obviously a simple leak would not explain the problem the OP is
seeing, though.)

Mike
___

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

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

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

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


Re: [OT] default boot device

2009-05-26 Thread M Pulis
become familiar with system preferences. learn the mac before  
programming the mac.


Sent from my iPhone

On May 26, 2009, at 6:43 AM, Тимофей Даньшин  
 wrote:



Hello.
I installed another version of MacOS X in a separate partition of my  
hard disc. And now whenever i start the computer, it boots from that  
partition by default (unless i press option to select the partition  
to boot from this time). How can i permanently change the primary  
boot device to my initial one?

Sorry if this is too off-topic.

Thanks in advance,
Timofey.
___

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

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

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

This email sent to tooth...@fastq.com

___

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

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

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

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


Re: Displaying a number with Quartz

2009-05-26 Thread Alexander Spohr

Am 26.05.2009 um 17:00 schrieb Sean McBride:


Never ever use sprintf for anything.


If you use "%d" and know it will be an int? You know how many chars  
you’ll have at max, no buffer-overflow possible. (You might argue  
here, that at some time we will habe 128-bit ints, but hey you should  
recode your app then anyway or just have a buffer large enough to  
handle that right at the start)


And yes - you are right, use snprintf instead... int might become 256  
bit.





See here for why:




On 5/26/09 3:26 PM, Alexander Spohr said:


sprintf



Am 25.05.2009 um 09:16 schrieb Pierre Berloquin:


Hi
I need to display an int with  CGContextShowTextAtPoint
that only accepts char arrays.
How do I go about it ?
I can't find how to convert an int into a char* in objective-C !!


___

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

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

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

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


Re: System Preference like App

2009-05-26 Thread cocoa learner
Yha Uli. That's what I have also experienced.But what kind of cell? That's I
have not yet figured out. Probably I need some more time to get that
knowledge. :-)

I am really thankful for your help.
Cocoa.learner


On Sun, May 24, 2009 at 9:13 PM, Uli Kusterer
wrote:

> On 24.05.2009, at 16:22, cocoa learner wrote:
>
>> I tried but getting the following error -
>> "Stub implementation of -setTarget by NSCell does nothing."
>>
>
>  NSImageCell is a subclass of NSCell. Seems it does not support
> setTarget/setAction. If you want to get informed of clicks in your icons you
> need to use another class (i.e. another kind of cell).
>
>
>>
>  Re-read my earlier messages to you, I already provided you with the
> solution.
>
>
> Cheers,
> -- Uli Kusterer
> "The Witnesses of TeachText are everywhere..."
> http://www.zathras.de
>
>
>
>
>
>
___

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

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

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

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


What information does NSFont -description convey?

2009-05-26 Thread Ross Carter

NSFont -description returns a string like this:

"HoeflerText-Regular 12.00 pt. P [] (0x012c18d0) fobj=0x0133bdf0,  
spc=3.00";


The first two items are obvious. What's in the rest of the string?

Thanks,
Ross
___

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

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

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

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


Re: Displaying a number with Quartz

2009-05-26 Thread Pierre Berloquin
Finally, thanks to Alexander, my pure Objective C solution is
NSString *S = [[NSString alloc] initWithFormat:@"%i", i];
const char *text = [S UTF8String];

and no warning this time except that I should learn more about C

Thanks
Pierre

2009/5/26 Sean McBride 

> On 5/26/09 5:12 PM, Alexander Spohr said:
>
> >> Never ever use sprintf for anything.
> >
> >If you use "%d" and know it will be an int? You know how many chars
> >you'll have at max, no buffer-overflow possible. (You might argue
> >here, that at some time we will habe 128-bit ints, but hey you should
> >recode your app then anyway or just have a buffer large enough to
> >handle that right at the start)
> >
> >And yes - you are right, use snprintf instead... int might become 256
> >bit.
>
> You can use sprintf safely if you're very careful, I suppose, but using
> snprintf is not harder and so much safer.  sprintf is just not worth the
> risk.
>
> --
> 
> Sean McBride, B. Eng s...@rogue-research.com
> Rogue Researchwww.rogue-research.com
> Mac Software Developer  Montréal, Québec, Canada
>
>
>


-- 
Blogs : http://bibliobs.nouvelobs.com/blog/jeux-litteraires
   http://pierre-berloquin.blogspot.com/

Développement durable des neurones par le jeu de réflexion
www.crealude.net

Sustainable development of neurones through mind games
www.crealude.net/us

Que fait-on pour les mal-codants ?
___

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

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

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

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


Threads and retain/release

2009-05-26 Thread Dave DeLong
Hey everyone,

I'm working on an app that needs to work on 10.4 and is multi-threaded.  One of 
the nice things about 10.5 is the ability to create NSThread objects in ways 
other than [NSThread detachNewThreadSelector...];  Since that option isn't 
available to me, here's what I've decided to do:

I've created an NSObject subclass called "DDThread".  DDThread has a start and 
cancel method (just like NSThread), and a BOOL ivar to indicated the thread's 
cancelled state.  Messaging DDThread to -start will (internally) call the 
[NSThread detachNewThreadSelector...] method.  This runs one of DDThread's 
private methods, which loops as long as the DDThread isn't cancelled.

All of this works fine.  My question has to do with memory management and 
thread cleanup.

The docs indicate that when one detaches a new thread selector, an 
NSAutoreleasePool should be created.  My question is:  is it safe to call [self 
release] after the pool is destroyed?  Here's why I think I need to do this:  
In another object, I store DDThreads in an NSMutableArray, so that I can find 
them if I need to cancel one.  I retrieve it from the array, tell it to 
-cancel, and remove it from the array.  However, if the DDThread is in the 
middle of its processing loop, it won't know that it has cancelled until it 
comes around on the next circuit, at which point it exits the loop, cleans up 
some stuff, and terminates the thread (by exiting the method).

By removing it from the array, the DDThread technically should be immediately 
deallocated (since nothing else retains it).  Since there's another thread 
involved (the DDThread's busy loop), I can't have it be destroyed (the loop 
MUST clean up some stuff), hence my desire for the DDThread to retain itself 
until the busy loop has time to do its thing.

So again, is it safe for me to call [self release]; outside the scope of the 
NSAutoreleasePool?  AFAICT, I can't [self release] before releasing the pool, 
since that would destroy the object, rendering the remainder of the method 
(like releasing the pool) somewhat invalid (please correct me if I'm wrong).

Thanks!

Dave DeLong
___

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

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

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

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


Re: Threads and retain/release

2009-05-26 Thread Michael Ash
On Tue, May 26, 2009 at 10:41 AM, Dave DeLong  wrote:
> All of this works fine.  My question has to do with memory management and 
> thread cleanup.

I'm snipping out most of your message because I think that all will
make sense once you know this one fact:

NSThread retains the target and argument of the thread until the
thread terminates.

Since NSThread takes ownership of those objects when you create the
thread, you can rely on them to stay alive as long as the thread is
running. Thus, perform memory management as usual, and don't worry
about your thread object getting deallocated before you finish
executing the thread, because it can't happen unless you've violated
the memory-management rules and over-released something.

Mike
___

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

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

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

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


Re: NULL Outlets in one file work in another

2009-05-26 Thread Greg Guerin

Walker Argendeli wrote:

So in App_Delegate's applicationDidFInishLaunching method, I have  
something that looks like this:

[self doStuff];
FirstLaunch *thing = [[FirstLaunch alloc] init];
[thing doStuff];
And either the first line is commented out or the last two are  
commented out. The method they are calling is the same, just  
located in different files. Both App_Delegate and FirstLaunch have  
the Outlet ivars connected in IB and give no warnings or errors.



Use the debugger.

Set a breakpoint on doStuff, then look at the state of the outlets.

Where do the problematic outlets exist: in App_Delegate or in  
FirstLaunch?


If they are in App_Delegate, is IB connecting to those, or is it  
connecting to ones in App_Delegate?  How does FirstLaunch get a  
reference to App_Delegate, in order to access its outlets?


Is IB creating an instance of FirstLaunch and setting its outlets?   
If so, then your use of [[FirstLaunch alloc] init] is wrong, because  
it creates a new empty FirstLaunch that has never had its outlets  
filled in.


  -- GG

___

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

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

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

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


Re: NSWindow in threads

2009-05-26 Thread Joar Wingfors


On 26 maj 2009, at 07.27, Mike Abdullah wrote:

You've missed the big warning somewhere in the docs that most of  
AppKit is not threadsafe. Why do you want to create a window on  
another thread? What is wrong with doing it on the main thread?



Mike,

Your comment is correct in general, but according to the thread safety  
guidelines you're supposed to be able to create windows on background  
threads:





That said, it seems that it's not safe to create views on background  
threads, so that's at least one thing that's not right in the few  
lines of code that was quoted.


Mattias: You should review the thread safety documentation carefully,  
and consider if you're in compliance or not. Note that if something  
isn't called out to be safe to use on background threads, you should  
assume that it's not. The creation of you UI isn't typically thread  
safe, and it's also in general not the type of work that you'd need to  
offload to background threads. It's probably better to set up the UI  
on the main thread, and only perform work for your underlying data  
model in the background - That's likely where you have most need for  
computing power in any case.


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


Re: How to check whether a application is launch or not...?

2009-05-26 Thread Michael Ash
On Tue, May 26, 2009 at 7:33 AM, Anshul jain
 wrote:
> HI All,
>                At the starting of my application i am trying to find out
> whether Time machine is launched or not. I tried to use NSWorkSpace API
>  launchedApplications
>             but i get every application that is launched except Time
> Machine. Is there a Problem in my approach. or there is other way to do it.

NSWorkspace will not list background-only applications. Use the Carbon
Process Manager instead.

Mike
___

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

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

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

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


Re: NSWindow in threads

2009-05-26 Thread Mike Abdullah


On 26 May 2009, at 15:51, Joar Wingfors wrote:



On 26 maj 2009, at 07.27, Mike Abdullah wrote:

You've missed the big warning somewhere in the docs that most of  
AppKit is not threadsafe. Why do you want to create a window on  
another thread? What is wrong with doing it on the main thread?



Mike,

Your comment is correct in general, but according to the thread  
safety guidelines you're supposed to be able to create windows on  
background threads:





That said, it seems that it's not safe to create views on background  
threads, so that's at least one thing that's not right in the few  
lines of code that was quoted.


Wow, I had no idea of this particular aspect of the rules. My  
suspicion is this exists to accomodate Cocoa's ability to use window  
objects for caching a view's contents to an image. Maybe the act of  
showing a window is what is breaking on a secondary thread.


___

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

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

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

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


Re: [OT] default boot device

2009-05-26 Thread I. Savant
2009/5/26 Тимофей Даньшин :

> I installed another version of MacOS X in a separate partition of my hard
> disc. And now whenever i start the computer, it boots from that partition by
> default (unless i press option to select the partition to boot from this
> time). How can i permanently change the primary boot device to my initial
> one?
> Sorry if this is too off-topic.

  If you know it's off-topic, then you know you're breaking the list
rules, so don't post. We're not your general technical support list.

--
I.S.
___

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

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

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

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


Re: Displaying a number with Quartz

2009-05-26 Thread Ken Thomases

On May 26, 2009, at 11:13 AM, Pierre Berloquin wrote:


Finally, thanks to Alexander, my pure Objective C solution is
NSString *S = [[NSString alloc] initWithFormat:@"%i", i];
const char *text = [S UTF8String];


Don't forget, after you're through with S:

 [S release];

Or, you could use [NSString stringWithFormat:@"%i", i] to create the  
string without taking on the responsibility for later releasing it.


(Also, 'S' as the name for a local variable doesn't follow typical  
Cocoa naming conventions.)


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


Re: String Comparison and return values

2009-05-26 Thread Kirk Kerekes

Consider the pattern:

[[thing description] isEqualToString: someString];

All objects will return a string for description. Whether it is  
meaningful in your terms is a whole other issue.


NSNumber will return a sensible numeric string.
NSString will return itself.

Generally, property-list objects (other than NSData) will return  
something generically useful in response to -description.


Note the NSStringFrom... functions for converting points, ranges, etc  
into strings and back again.


It is a good discipline to stick to property list objects for files  
when reasonable.




Also note that -[NSString rangeOfString:options] can be wrapped in a  
category on NSString to provide a handy -[NSString compare].


@implementation NSString (contains)

- (BOOL) contains:(NSString *) s
{ // loose compare
	return [self rangeOfString: s options:  
NSCaseInsensitiveSearch].location != NSNotFound;

}

- (BOOL) containsPrecisely:(NSString *) s
{ // exact compare
	return [self rangeOfString: s options: NSLiteralSearch].location !=  
NSNotFound;

}

@end

___

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

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

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

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


Re: Displaying a number with Quartz

2009-05-26 Thread Pierre Berloquin
Yes you are right, we work with limited memory and I should be release
minded and watch my variables. But didn't I read somewhere an advice against
oneliners to skip the releases?
Pierre

2009/5/26 Ken Thomases 

> On May 26, 2009, at 11:13 AM, Pierre Berloquin wrote:
>
>  Finally, thanks to Alexander, my pure Objective C solution is
>> NSString *S = [[NSString alloc] initWithFormat:@"%i", i];
>> const char *text = [S UTF8String];
>>
>
> Don't forget, after you're through with S:
>
> [S release];
>
> Or, you could use [NSString stringWithFormat:@"%i", i] to create the
> string without taking on the responsibility for later releasing it.
>
> (Also, 'S' as the name for a local variable doesn't follow typical Cocoa
> naming conventions.)
>
> Cheers,
> Ken
>
>


-- 
Blogs : http://bibliobs.nouvelobs.com/blog/jeux-litteraires
   http://pierre-berloquin.blogspot.com/

Développement durable des neurones par le jeu de réflexion
www.crealude.net

Sustainable development of neurones through mind games
www.crealude.net/us

Que fait-on pour les mal-codants ?
___

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

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

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

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


How to draw background image in my app window

2009-05-26 Thread cocoa learner
Hi all,
How to draw background image in my app window?

I have found a way but not sure whether that's correct. So here is my way of
doing -

1>. Get a window from IB Library.
2>. Drag NSImage item from IB Library on window.
3>. Make it the size of window.
4>. Now drag and drop the NSTextField to the window.

And I am done with the desired job.

Is it a correct way of doing things???

If wrong then please guide me to achieve the goal.

Regards
Cocoa.learner.
___

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

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

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

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


Re: NULL Outlets in one file work in another

2009-05-26 Thread Greg Guerin

I wrote:

If they are in App_Delegate, is IB connecting to those, or is it  
connecting to ones in App_Delegate?



but meant to write:

If they are in App_Delegate, is IB connecting to those, or is it  
connecting to ones in FirstLaunch?


  -- GG

___

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

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

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

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


Re: Displaying a number with Quartz

2009-05-26 Thread Gunnar Proppe

Actually, your pure Objective C version would be to use NSString's 
drawAtPoint:withAttributes instead of converting to a char* and using 
CGContextShowTextAtPoint.

http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSString_AppKitAdditions/Reference/Reference.html

Gunnar


- Original Message 
> From: Pierre Berloquin 
> To: Sean McBride 
> Cc: cocoa-dev@lists.apple.com
> Sent: Tuesday, May 26, 2009 9:13:26 AM
> Subject: Re: Displaying a number with Quartz
> 
> Finally, thanks to Alexander, my pure Objective C solution is
> NSString *S = [[NSString alloc] initWithFormat:@"%i", i];
> const char *text = [S UTF8String];
> 
> and no warning this time except that I should learn more about C
> 
> Thanks
> Pierre
> 
> 2009/5/26 Sean McBride 
> 
> > On 5/26/09 5:12 PM, Alexander Spohr said:
> >
> > >> Never ever use sprintf for anything.
> > >
> > >If you use "%d" and know it will be an int? You know how many chars
> > >you'll have at max, no buffer-overflow possible. (You might argue
> > >here, that at some time we will habe 128-bit ints, but hey you should
> > >recode your app then anyway or just have a buffer large enough to
> > >handle that right at the start)
> > >
> > >And yes - you are right, use snprintf instead... int might become 256
> > >bit.
> >
> > You can use sprintf safely if you're very careful, I suppose, but using
> > snprintf is not harder and so much safer.  sprintf is just not worth the
> > risk.
> >
> > --
> > 
> > Sean McBride, B. Engs...@rogue-research.com
> > Rogue Researchwww.rogue-research.com
> > Mac Software Developer  Montréal, Québec, Canada
> >
> >
> >
> 
> 
> -- 
> Blogs : http://bibliobs.nouvelobs.com/blog/jeux-litteraires
>   http://pierre-berloquin.blogspot.com/
> 
> Développement durable des neurones par le jeu de réflexion
> www.crealude.net
> 
> Sustainable development of neurones through mind games
> www.crealude.net/us
> 
> Que fait-on pour les mal-codants ?
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/tonecluster%40yahoo.com
> 
> This email sent to toneclus...@yahoo.com




___

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

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

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

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


Re: How to draw background image in my app window

2009-05-26 Thread Nick Zitzmann


On May 26, 2009, at 11:04 AM, cocoa learner wrote:


How to draw background image in my app window?


You could change the window's content view using -setContentView: to a  
view that will draw a background image, such as NSImageView... Of  
course, if you have any other controls in the content view that is  
being replaced, then they'll be lost.


Nick Zitzmann






___

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

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

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

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


Re: Displaying a number with Quartz

2009-05-26 Thread Ken Thomases

On May 26, 2009, at 11:58 AM, Pierre Berloquin wrote:

Yes you are right, we work with limited memory and I should be  
release minded and watch my variables.
But didn't I read somewhere an advice against oneliners to skip the  
releases?


It's a trade-off of best efficiency vs. developer convenience and code  
readability.


If you're developing for the iPhone, then you should prefer taking  
explicit responsibility and controlling memory more actively.


If you're developing for the Mac, you have fewer constraints.  On the  
theory that every line/statement/expression you don't write is one  
less opportunity for making an error, you might very well prefer the  
"one-liner".


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


[ANN] CocoaHeads Paris #3 - 27th of May (tomorrow)

2009-05-26 Thread Guillaume Cerquant

Hi,

A quick note to let you know that the third session of CocoaHeads  
Paris will meet tomorrow (wednesday, 27th of May, at 7pm).


Presentations will be:

* FScript, by its creator, Philippe Mougin
www.fscript.org

* Osculator, a software for making sound and vision with new controllers
www.osculator.net


All details available at
www.cocoaheads.org/fr/Paris

Subscribe to Google Group for being notified of future events.
http://groups.google.com/group/cocoaheads-paris

See you tomorrow.

--
Guillaume, for MacMation
www.macmation.com/TimeBoxed
___

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

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

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

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


Re: String Comparison and return values

2009-05-26 Thread Shawn Erickson
On Tue, May 26, 2009 at 9:56 AM, Kirk Kerekes  wrote:
> Consider the pattern:
>
> [[thing description] isEqualToString: someString];
>
> All objects will return a string for description. Whether it is meaningful
> in your terms is a whole other issue.
>
> NSNumber will return a sensible numeric string.
> NSString will return itself.
>
> Generally, property-list objects (other than NSData) will return something
> generically useful in response to -description.

You really shouldn't use the string from -[NSObject description] for
anything other then logging or via the debugger.

You should instead use a common form/representation when doing
comparisons across objects of different classes.

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


Re: NSPredicateEditorRowTemplate, NSPopupButton and bindings

2009-05-26 Thread Peter Ammon

Hi Martin,

Yes, that's right.

More generally, any changes to the popups after calling  
setRowTemplates: are likely to be futile.  This is because the real  
popup buttons displayed in an NSPredicateEditor are not the same popup  
buttons returned from your NSPredicateEditorRowTemplate's - 
templateViews method.  Instead, they are a conglomerate of all the  
popups at the same index in all the templates.  NSPredicateEditor does  
not notice when the template popups change, though this might be a  
nice thing to add at some point in the future.


Hope this helps,

-Peter



On May 25, 2009, at 7:57 AM, Martin Stanley wrote:


Peter,

Thanks for your response (I was hoping you would notice my post :-).

My interpretation of your response is as follows:
1- Cocoa bindings are not supported for popup views that are used in  
a NSPredicateRowtemplate, even if I am careful to make sure that the  
view is re-bound (via copyWithZone) when NSPredicateEditor creates  
its copies. This is true in spite of the fact that I managed to fill  
the popup via bindings upon initial creation.
2- One needs to observe the appropriate objects using KVO and then  
take the steps you outlined below in order to ensure that the popup  
has current values.


Can you please confirm my understanding?

Thanks,
Martin


On 22-May-09, at 10:55 PM, Peter Ammon wrote:



On May 22, 2009, at 9:37 AM, Martin Stanley wrote:

I've finally got the hang of NSPredicateEditor and custom  
NSPredicateEditorRowTemplates. (It sure took a while and many,  
many searches and head-scratchings). However, I am stuck on one  
thing and I suspect that the problem might lie in the  
NSPredicateEditor code itself; hence this post.


Here is what I am trying to do:

I have a Core Data document-based application for managing Tasks  
(to-do items). I am using NSPredicateEditor to manage a set of  
user-defined Smart Groups. I want the user to be able to build a  
predicate based on a choice from a popup button. For example the  
(sub-)predicate might look like this:

 status == "Not Started"

Implementing this is straightforward enough, but I the wrinkle is  
that want the right hand side of the expression to come from a  
core data entity. So, no problem, when I create the NSPopUpButton  
(in my custom NSPredicateEditorRowTemplate class) I simply fill  
the menuitems from the appropriate array controller, which in turn  
gets its data from the Core Data entity. After much learning and  
experimenting, this now works. All is well.


So, then I realize that if (in another window) the user edits the  
Core Data entity in question, the changes are not reflected in the  
NSPredicateEditor popup. Okay, this seems like a candidate for  
cocoa bindings. Again, after much searching and experimentation I  
come up the following:


Hi Martin,

NSPredicateEditor does not support editing the popups like this.   
What you should do, when the available values in the popup need to  
change, is create a new NSPredicateEditorRowTemplate that reflects  
the change, and set it on the NSPredicateEditor in place of the old  
one, with setRowTemplates:


I think you may also need to save off the predicate editor's object  
value first, and then set it back on after calling setRowTemplates:.




___

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

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

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

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


Re: How to safely break read stream?

2009-05-26 Thread Greg Guerin

Chris Gardner wrote:


Firstly, I will close the CFReadStream with CFReadStreamClose.
Secondly, I will use a new CFReadStream, and perform all the same  
setup as I did before
to download the same file, meanwhile I am using  
kCFStreamPropertyFTPFileTransferOffset to

offset the length of file data that I have downloaded.



You should have included that in your earlier description.  It would  
have saved some time.



At this point it's not clear whether the CFReadStream functions doing  
the right thing or not.


Christian Weykopf's link to:

http://lists.apple.com/archives/macnetworkprog/2009/Jan/msg00010.html

may or may not be relevant, because that post uses NSURLConnection.


I suggest treating the CFReadStream and all its related CF functions  
as a black box, and looking directly at its inputs and outputs on the  
network.  That is, use a tool like Interarchy to watch network  
traffic as you run your code, then compare to what the FTP RFC says  
it should be doing.  Tell Interarchy to watch all traffic on the  
active network interface, including TCP protocol packets, as those  
will show you important details of when and how connections are made.


You will need some understanding of the FTP protocol, and you will  
need to know some details of how TCP/IP works.


The goal is to figure out exactly what CFReadStream is doing to  
establish or restart the FTP connection.  If it does the wrong thing  
with the TCP connections or the FTP protocol, then you are probably  
wasting your time trying to figure out how to make it work correctly.



Finally, your question is fundamentally a networking question, not a  
Cocoa question.  You might get better advice by asking on a list  
where this is on-topic, such as macnetworkprog.  CFReadStream isn't  
Cocoa, and even if it were, there's likely a greater concentration of  
network expertise on macnetworkprog than there is here.



___

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

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

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

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


Adding a Timer to a Thread

2009-05-26 Thread Andreas Grosam


What would you suggest is the preferred way to add a timer to a  
different running thread?



Normally, I would use:

NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
[runLoop addTimer:aTimer forMode:NSDefaultRunLoopMode];


However, this requires that it will be invoked from the context of the  
target thread. How do I get the runLoop for any other than the current  
thread?



Guess, I have to use  
performSelector:onThread:withObject:waitUntilDone:modes:




Thanks for hints.


Regards
Andreas



___

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

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

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

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


Re: Adding a Timer to a Thread

2009-05-26 Thread Jean-Daniel Dupas


Le 26 mai 09 à 20:15, Andreas Grosam a écrit :



What would you suggest is the preferred way to add a timer to a  
different running thread?



Normally, I would use:

   NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
   [runLoop addTimer:aTimer forMode:NSDefaultRunLoopMode];


However, this requires that it will be invoked from the context of  
the target thread. How do I get the runLoop for any other than the  
current thread?


NSRunLoop is not thread safe, so you don't get it. Even is it was  
possible, you would not be able to use it.


That said, CFRunLoop is thread safe.

You can retrieve it using - 
performSelector:onThread:withObject:waitUntilDone:modes passing a  
mutable object as argument (an MutableArray for example) which will be  
used to store the return value (your CFRunLoop).


- (void)retrieveCurrentRunLoop:(NSMutableArray *)array {
[array addObject:(id)CFRunLoopGetCurrent()];
}

___

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

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

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

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


Call for submissions for a forthcoming book

2009-05-26 Thread Mike Mangino
Hi everyone, I cleared this message with the list owners. If you are  
interested in submitting a response, please send it to submissions@  
iphonerecipesbook.com. Please DO NOT reply to the list.




In just over a year since the iPhone API was released, we’ve seen some  
incredible applications created. It’s clear that there are some really  
sharp developers in the iPhone community.


Do you have a really cool solution to a common problem? We’d love to  
hear it. We’re looking for bite sized recipes for our “iPhone Recipes”  
book to be published by the Pragmatic Bookshelf and edited by Mark  
Bates and Mike Mangino. This is your opportunity to show your chops to  
the community as a whole. In particular, we’re looking for easily  
understandable, general purpose recipes that aren’t already well  
documented.


To propose a recipe idea, here’s what we need from you:

A paragraph or two describing the problem that the recipe solves.
A sentence or two indicating what the solution will be.
The OS version(s) to which the recipe applies.

You should already have working code. You can send some along if it  
helps convey your idea.


Email your idea to us at submissi...@iphonerecipesbook.com by June  
15th (or sooner!) for recipes that target only OS 2.2 features. If  
your recipe uses features of OS 3.0, please hold on to it until the  
NDA has been lifted. We’re targeting a July 1st deadline for OS 3.0  
recipes, but we may need to delay that. We’ll let you know if we can  
use your recpie by June 25th. After that, you’ll work with Mark and  
Mike to get your recipe written and included in the book!


If your recipe is selected, your name, bio, and a link to your site/ 
blog will appear in the book. You’ll also receive a complimentary copy  
of the book, of course.


We look forward to working with you!

Mark Bates and Mike Mangino

--
Mike Mangino
http://www.elevatedrails.com



___

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

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

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

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


Re: Threads and retain/release

2009-05-26 Thread Dave DeLong

DOH!  Funny thing is, I read that sentence a couple days ago in the docs, but 
only registered the "retains the ... argument" bit at the time (because that's 
what I was looking for).

You're right.  That makes everything *much* simpler.

Lesson learned... again... when in doubt, read the documentation.  =P

Thanks!

Dave
 
On Tuesday, May 26, 2009, at 09:07AM, "Michael Ash"  
wrote:
>
>NSThread retains the target and argument of the thread until the
>thread terminates.
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kwan%40media.mit.edu

This email sent to k...@media.mit.edu



___

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

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

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

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


Re: Adding a Timer to a Thread

2009-05-26 Thread Ken Thomases

On May 26, 2009, at 1:27 PM, Jean-Daniel Dupas wrote:



Le 26 mai 09 à 20:15, Andreas Grosam a écrit :



What would you suggest is the preferred way to add a timer to a  
different running thread?



Normally, I would use:

  NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
  [runLoop addTimer:aTimer forMode:NSDefaultRunLoopMode];


However, this requires that it will be invoked from the context of  
the target thread. How do I get the runLoop for any other than the  
current thread?


NSRunLoop is not thread safe, so you don't get it. Even is it was  
possible, you would not be able to use it.


That said, CFRunLoop is thread safe.

You can retrieve it using - 
performSelector:onThread:withObject:waitUntilDone:modes passing a  
mutable object as argument (an MutableArray for example) which will  
be used to store the return value (your CFRunLoop).


- (void)retrieveCurrentRunLoop:(NSMutableArray *)array {
[array addObject:(id)CFRunLoopGetCurrent()];
}


Bleah.  If you're going to interact directly with another thread using  
-performSelector:onThread:..., don't ask it for its run loop and then  
manipulate that.  Just tell it to install the timer on its own run  
loop.  In that case, you can use NSRunLoop just fine.


Regards,
Ken

___

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

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

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

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


Re: what am I missing with NSString ?

2009-05-26 Thread Jeffrey Oleander

> On Tue, 2009/05/26, Volker in Lists  wrote:
> From: Volker in Lists 
> Subject: Re: what am I missing with NSString ?
> To: "vinai" 
> Cc: Cocoa-dev@lists.apple.com
> Date: Tuesday, 2009 May 26, 08:41
> from the code listed I cannot tell if you alloc'ed memory
> for your NSString at all?
> 
> What is the goal you try to achieve? If you just want to
> store a single file path... with a global NSString do as
> along the lines of:
> 
> [rawFileName release];
> rawFileName = [[NSString alloc] initWithString:[[files
> objectAtIndex:i] stringByStandardizingPath]]];

The NSString reference suggests that it will return an 
object.  Since it's an instance method and not a class
method, this suggests that an alloced string must be
the receiver.

"Returns an NSString object initialized by copying
 the characters from another given string.
- (id)initWithString:(NSString *)aString
"

OTOH, stringWithString is a class method, suggesting
that it must be sent to NSString and it will take 
care of the alloc:

"Returns a string created by copying the characters
 from another given string.
+ (id)stringWithString:(NSString *)aString
"




  
___

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

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

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

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


Re: Adding a Timer to a Thread

2009-05-26 Thread Andreas Grosam


On May 26, 2009, at 8:53 PM, Ken Thomases wrote:


On May 26, 2009, at 1:27 PM, Jean-Daniel Dupas wrote:



Le 26 mai 09 à 20:15, Andreas Grosam a écrit :



What would you suggest is the preferred way to add a timer to a  
different running thread?



Normally, I would use:

 NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
 [runLoop addTimer:aTimer forMode:NSDefaultRunLoopMode];


However, this requires that it will be invoked from the context of  
the target thread. How do I get the runLoop for any other than the  
current thread?


NSRunLoop is not thread safe, so you don't get it. Even is it was  
possible, you would not be able to use it.


That said, CFRunLoop is thread safe.

You can retrieve it using - 
performSelector:onThread:withObject:waitUntilDone:modes passing a  
mutable object as argument (an MutableArray for example) which will  
be used to store the return value (your CFRunLoop).


- (void)retrieveCurrentRunLoop:(NSMutableArray *)array {
[array addObject:(id)CFRunLoopGetCurrent()];
}


Bleah.  If you're going to interact directly with another thread  
using -performSelector:onThread:..., don't ask it for its run loop  
and then manipulate that.  Just tell it to install the timer on its  
own run loop.  In that case, you can use NSRunLoop just fine.


Regards,
Ken




Thank you for your replies.

Yes, I thought it could work as Ken suggested. Now I'm going to try  
this:


- (void) runTimer:(NSTimer*)aTimer
{
if ([NSThread currentThread] == self.thread) {
[[NSRunLoop currentRunLoop] addTimer:aTimer  
forMode:NSDefaultRunLoopMode];

}
else {
[self performSelector:@selector(runTimer:)  
onThread:self.thread withObject:aTimer waitUntilDone:NO];

}
}



Regards
Andreas


___

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

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

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

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


[Moderator] Re: [OT] default boot device

2009-05-26 Thread Scott Anguish

Please, do _not_ post Off-Topic messages to this list.

Prefixing a message with [OT] should be an IMMEDIATE indicator that it  
should not be posted here.


moderator

On 2009-05-26, at 9:43 AM, Тимофей Даньшин wrote:



Hello.
I installed another version of MacOS X in a separate partition of my  
hard disc. And now whenever i start the computer, it boots from that  
partition by default (unless i press option to select the partition  
to boot from this time). How can i permanently change the primary  
boot device to my initial one?

Sorry if this is too off-topic.


___

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

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

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

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


Recommendations to Reading the Xcode in built Documentation to the fullest effect

2009-05-26 Thread colo
I want to really get Cocoa and iphone methods etc... so I find myself
in the Docs every other minute. But I find that it's kinda wonky to
see where things subclass from or what goes with what as examples. I
know there was some sort of guide to navigating it and learning from
it better.

Do you know of such a resource? Tried google. Still trying. Good
stuff, but nothing concrete yet.
___

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

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

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

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


Class Design for delegate, outlets, and mouse events

2009-05-26 Thread Walker Argendeli

Here's a simplification:

I have an application with several buttons. If it is the first time  
the application is launching, I want to do some special things. In my  
AppController class, which is a delegate of NSApp, I use the delegate  
method -applicationDidFinishLaunching: to perform the test. After I've  
detected that it is the first time, I first want to access some  
IBOutlets. Then, I'd like to be able to get mouse events for each  
button, so that I can do other things.


I can't figure out want to do with the classes. I'd like to make a new  
class (FirstLaunch) for the first launch, but I'm not sure what to  
call from AppDelegate. Also, to get mouse events, shouldn't I be a  
sublass of the buttons, and considering that I have multiple buttons,  
I'm confused. I could probably tackle these issues one-by-one, but  
taken all together, they're confusing me.


Broken down, I need to access & manipulate IBOutlets I have set in IB,  
determine when buttons are clicked (and which button was clicked). I'd  
like to be able to do this from another class so as to not clutter up  
the AppDelegate.


Thanks for the help!


- Walker Argendeli

___

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

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

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

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


Bound NSPopUpButton + null at the beginning

2009-05-26 Thread Stamenkovic Florijan

Hi all,


I am trying to figure out how to properly accomplish the following,  
and after reading docs, references and googling, I am still stuck. Any  
help appreciated:


1. Have an NSPopUp, "Contents" and "Content values" bound to an  
NSArrayController's "arrangedObjects" and "arrangedObjects.name",  
respectively.
2. Have the window title bound to the NSArrayController  
"selection.name", and have a replacement string in case of no(null)  
selection, or empty selection

3. Have a selectable null at the beginning of the popup.

I have two possible solutions, but both are flawed.

1. Bind the NSPopUp's selected index to NSArrayController's selected  
index. Use "Inserts Null Placeholder" in the Contents binding to make  
sure I get a selectable null at the beginning of the popup. The  
problem is that if I at some point choose the null in the popup, the  
window title does not get updated with the replacement string, and I  
get a log statement:


[ setNilValueForKey]: could not set nil as  
the value for the key selectionIndex.


2. To work around this, I tried adding an [NSNull null] at the  
beginning of the NSArrayController's contents array. And deselect the  
"Inserts Null Placeholder" in popup's contents binding. This solves  
the selectionIndex issue, but it introduces a different problem. Now  
if I select the null in the popup, my window title does not get  
updated with the replacement string, but with the "" text. It  
seems that [NSNull null] is not seen as something to be replaced with  
the Null replacement string. I also get a log statement:


Cannot create NSArray from object  of class NSNull


Is there an elegant way of dealing with this? I am thinking that  
somehow it should be possible to bind the popup selected value  
directly to the controller's selection. Then I could use the approach  
described under (1), but avoid the index issue. However, I can't seem  
to do that. The "Selected object" binding of the popup seems to be  
incompatible with the NSArrayController "selection", as the  
NSArrayController seems to wrap the selection in a proxy. The  
NSArrayController's "selectedObjects" deals with NSArrays, not  
individual values. Perhaps if I used a custom value converter that  
converts from NSArray* to it's object at 0 index? Or is there a better  
solution?


Sorry if this is something obvious, but I am missing it.

Thanks in advance,
F
___

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

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

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

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


Re: Recommendations to Reading the Xcode in built Documentation to the fullest effect

2009-05-26 Thread jonat...@mugginsoft.com


On 26 May 2009, at 21:48, colo wrote:


I want to really get Cocoa and iphone methods etc... so I find myself
in the Docs every other minute. But I find that it's kinda wonky to
see where things subclass from or what goes with what as examples. I
know there was some sort of guide to navigating it and learning from
it better.


You could try AppKiDo
http://homepage.mac.com/aglee/downloads/appkido.html

The Apple documentation style does get some getting use to but I would  
stick with it.

The more you use it the more you get out of it eventually.


Do you know of such a resource? Tried google. Still trying. Good
stuff, but nothing concrete yet.
___

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

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

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

This email sent to jonat...@mugginsoft.com


Jonathan Mitchell

Central Conscious Unit
http://www.mugginsoft.com




___

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

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

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

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


Re: Recommendations to Reading the Xcode in built Documentation to the fullest effect

2009-05-26 Thread David LeBer


On 26-May-09, at 4:48 PM, colo wrote:


I want to really get Cocoa and iphone methods etc... so I find myself
in the Docs every other minute. But I find that it's kinda wonky to
see where things subclass from or what goes with what as examples. I
know there was some sort of guide to navigating it and learning from
it better.

Do you know of such a resource? Tried google. Still trying. Good
stuff, but nothing concrete yet.


Not sure what you are looking for exactly, but the Foundation and  
AppKit pdfs available at the links below have class hierarchy diagrams  
in their introduction that might be helpful.






And I like AppKiDo for browsing the api



;david

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




___

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

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

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

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


Reading an AliasHandle from a Finder alias file

2009-05-26 Thread Erg Consultant
Is there a way to read AliasHandle data from an OS X Finder alias file - sort 
of like the way one could create an AliasHandle in memory in the old days by 
reading a alias resource from OS 9 alias files?

The Alias Manager APIs only seem to provide routines for determining if a file 
is an alias, or for resolving it - but not for creating an AliasHandle from the 
contents of an alias file directly. 

FSFollowFinderAlias kind of does what I want, but not really. If I read the 
entire data fork of a Finder alias will the read data be a valid AliasRecord or 
do I need to do some further manipulation on the read data?
Thanks,

Erg



  
___

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

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

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

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


Re: Recommendations to Reading the Xcode in built Documentation to the fullest effect

2009-05-26 Thread Nathan
I used to have the same issue, and AppKiDo was recommended to me as  
well. But it's not built into Xcode like Apple's stuff, and it doesn't  
recieve doc changes instantly. Plus, it takes a little while to load  
which is always annoying. I went back to Apple's stuff and found that  
after awhile it worked fine. Class hierarchy-wise, it's just a matter  
of learning it and using common sense. Also, at the top of each class  
doc there's a list of superclasses, in order. So I would stick with  
Apple for a little longer and see if you can't learn to work with it.


Good luck, Nate

On May 26, 2009, at 4:48 PM, colo  wrote:


I want to really get Cocoa and iphone methods etc... so I find myself
in the Docs every other minute. But I find that it's kinda wonky to
see where things subclass from or what goes with what as examples. I
know there was some sort of guide to navigating it and learning from
it better.

Do you know of such a resource? Tried google. Still trying. Good
stuff, but nothing concrete yet.
___

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

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

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


This email sent to lipton_lo...@mac.com

___

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

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

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

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


Re: Reading an AliasHandle from a Finder alias file

2009-05-26 Thread Sean McBride
On 5/26/09 2:13 PM, Erg Consultant said:

>Is there a way to read AliasHandle data from an OS X Finder alias file -
>sort of like the way one could create an AliasHandle in memory in the
>old days by reading a alias resource from OS 9 alias files?
>
>The Alias Manager APIs only seem to provide routines for determining if
>a file is an alias, or for resolving it - but not for creating an
>AliasHandle from the contents of an alias file directly.
>
>FSFollowFinderAlias kind of does what I want, but not really. If I read
>the entire data fork of a Finder alias will the read data be a valid
>AliasRecord or do I need to do some further manipulation on the read data?

You should ask on the Carbon list.

In any case, maybe NDAlias does want you need:


--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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

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

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


Re: Reading an AliasHandle from a Finder alias file

2009-05-26 Thread Greg Guerin

Erg Consultant wrote:


FSFollowFinderAlias kind of does what I want, but not really.



Then please explain what you really want to do, and why  
FSFollowFinderAlias doesn't meet those needs.


Be specific.


If I read the entire data fork of a Finder alias will the read data  
be a valid AliasRecord or do I need to do some further manipulation  
on the read data?



Not even close.  A Finder alias file has nothing in the data fork.   
It's all in the resource fork.  As resources.  In the normal resource- 
file way.


  -- GG

___

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

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

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

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


Re: Recommendations to Reading the Xcode in built Documentation to the fullest effect

2009-05-26 Thread WT
I too tried AppKiDo and eventually went back to XCode's built-in  
documentation tool. My only peeve with XCode's doc tool is that  
copying and pasting code from the doc pages sometimes introduces non- 
ascii characters onto my source files. I use an external editor  
(BBEdit), rather than XCode's own, so I can't use XCode's code- 
completion feature. That, in fact, is something I wish BBEdit's  
integration with XCode would provide as well, but that's a peeve for  
another list entirely.


Wagner

On May 26, 2009, at 11:20 PM, Nathan wrote:

I used to have the same issue, and AppKiDo was recommended to me as  
well. But it's not built into Xcode like Apple's stuff, and it  
doesn't recieve doc changes instantly. Plus, it takes a little while  
to load which is always annoying. I went back to Apple's stuff and  
found that after awhile it worked fine. Class hierarchy-wise, it's  
just a matter of learning it and using common sense. Also, at the  
top of each class doc there's a list of superclasses, in order. So I  
would stick with Apple for a little longer and see if you can't  
learn to work with it.


Good luck, Nate

On May 26, 2009, at 4:48 PM, colo  wrote:


I want to really get Cocoa and iphone methods etc... so I find myself
in the Docs every other minute. But I find that it's kinda wonky to
see where things subclass from or what goes with what as examples. I
know there was some sort of guide to navigating it and learning from
it better.

Do you know of such a resource? Tried google. Still trying. Good
stuff, but nothing concrete yet.

___

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

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

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

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


Re: Class Design for delegate, outlets, and mouse events

2009-05-26 Thread Shlok Datye
To determine whether the app is launching for the first time, you can  
put a boolean called "firstLaunch" into the user defaults. It would  
have a factory default of YES and could be changed to NO inside of  
applicationDidFinishLaunching:.


As for the buttons, are you sure you want to detect mouse events on  
them? Will setting their targets and actions, and possibly determining  
which button was clicked using the actions' "sender" arguments, not  
suffice? If not, I believe you will have to subclass NSButton to  
override the mouse event-handling methods.


Shlok Datye
Coding Turtle
http://codingturtle.com


On 26.05.2009, at 20:47, Walker Argendeli wrote:


Here's a simplification:

I have an application with several buttons. If it is the first time  
the application is launching, I want to do some special things. In  
my AppController class, which is a delegate of NSApp, I use the  
delegate method -applicationDidFinishLaunching: to perform the test.  
After I've detected that it is the first time, I first want to  
access some IBOutlets. Then, I'd like to be able to get mouse events  
for each button, so that I can do other things.


I can't figure out want to do with the classes. I'd like to make a  
new class (FirstLaunch) for the first launch, but I'm not sure what  
to call from AppDelegate. Also, to get mouse events, shouldn't I be  
a sublass of the buttons, and considering that I have multiple  
buttons, I'm confused. I could probably tackle these issues one-by- 
one, but taken all together, they're confusing me.


Broken down, I need to access & manipulate IBOutlets I have set in  
IB, determine when buttons are clicked (and which button was  
clicked). I'd like to be able to do this from another class so as to  
not clutter up the AppDelegate.


Thanks for the help!


- Walker Argendeli



___

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

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

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

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


Re: NULL Outlets in one file work in another

2009-05-26 Thread Andy Lee
I don't have time to go into detail, but I think you need to  
understand what happens when nibs are loaded and how that's different  
from instantiating an object with alloc/init.


On May 26, 2009, at 11:26 AM, Walker Argendeli wrote:


Typos on my part
It's applicationDidFinishLaunching:
That delegate method is in the file App_Delegate.m, which is the  
App_Delegate file.

The App_Delegate file is a delegate of the app.

Basically, I have some code working with outlets.
If I put it as a method in App_Delegate, it works.  I call it like  
this from applicationDidFinishLaunching:

[self doStuff];



If I move the doStuff method to the FirstLaunch.m file and call that  
method, again, from applicationDidFinishLaunching, it doesn't work:

FirstLaunch *thing = [[FirstLaunch alloc]  init];
[thing doStuff];


Here you've created a brand new instance of FirstLaunch.  Its outlets  
are not set because this instance was not loaded from the nib.


So in App_Delegate's applicationDidFInishLaunching method, I have  
something that looks like this:

[self doStuff];
FirstLaunch *thing = [[FirstLaunch alloc]  init];
[thing doStuff];
And either the first line is commented out or the last two are  
commented out.  The method they are calling is the same, just  
located in different files.


If you delete a method from one class and paste into another class it  
is not "the same."  You really need to understand this.  Honestly, I'd  
like to explain further but have to run.  The key (IIUC) is that  
you've created two instances of FirstLaunch and you're not getting why  
one has outlets connected and the other doesn't.


--Andy


 Both App_Delegate and FirstLaunch have the Outlet ivars connected  
in IB and give no warnings or errors.


Thanks for your help,
- Walker Argendeli

On May 26, 2009, at 10:45 AM, Volker in Lists wrote:


Hi,

are you using - (void)applicationDidFinishLaunch:(NSNotification  
*)aNotification or - (void)applicationDidFinishLaunching: 
(NSNotification *)aNotification ? The first is not a valid delegate  
method, the second is. Have you connected your AppDelegate as  
delegate of your app - can it receive the notification at all?


And can you clarify on the difference of an App_Delegate file vs.  
App_Delegate.m ?


Cheers,
Volker


Am 26.05.2009 um 16:17 schrieb Walker Argendeli:

I have a App_Delegate file.  In applicationDidFinishLaunch:, I  
instantiate a FirstLaunch object and call its start method.  The  
weird thing is that this method, which access several IBOutlets,  
seems to be working with null outlets.  All the connections are  
right in IB, and yet the outlets are null.  I put the method  
inside App_Delegate.m and set the same connections, and the  
outlets work fine.  I've been staring at the files for an hour,  
trying to figure out where I went wrong.  The connections are the  
same, the headers have the same ivars, and yet in one file, the  
outlets work fin, and in another they're null.


Thanks,
- Walker Argendeli

___

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

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

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

This email sent to volker_li...@ecoobs.de




___

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

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

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

This email sent to ag...@mac.com


___

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

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

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

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


Re: Recommendations to Reading the Xcode in built Documentation to the fullest effect

2009-05-26 Thread Mark Allan
I had the same problems with AppKiDo and eventually went back to  
Apple's online docs too.  They're definitely the most up-to-date  
version you're going to find anywhere, and when you've got your own  
way of using it, it works really well.  I tend to keep the main  
framework reference pages open and then middle-click the classname I'm  
interested in so that it opens in a new tab and I can quickly jump  
back and forth between the class listing and others I might be  
interested in...but that's just me.


FWIW, I initially came from a Java background and something I still  
really miss from the JavaDoc style API documentation is the group of  
sections entitled "Methods inherited from XYZ".  Those sections make  
it incredibly easy to see at a glance what methods/messages your class  
supports without having to load the docs for each of the superclasses  
in turn until you find (or don't as the case may be!) what you're  
looking for.


Mark


On 26 May 2009, at 10:20 pm, Nathan wrote:
I used to have the same issue, and AppKiDo was recommended to me as  
well. But it's not built into Xcode like Apple's stuff, and it  
doesn't recieve doc changes instantly. Plus, it takes a little while  
to load which is always annoying. I went back to Apple's stuff and  
found that after awhile it worked fine. Class hierarchy-wise, it's  
just a matter of learning it and using common sense. Also, at the  
top of each class doc there's a list of superclasses, in order. So I  
would stick with Apple for a little longer and see if you can't  
learn to work with it.


Good luck, Nate

On May 26, 2009, at 4:48 PM, colo  wrote:


I want to really get Cocoa and iphone methods etc... so I find myself
in the Docs every other minute. But I find that it's kinda wonky to
see where things subclass from or what goes with what as examples. I
know there was some sort of guide to navigating it and learning from
it better.

Do you know of such a resource? Tried google. Still trying. Good
stuff, but nothing concrete yet.
___

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

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

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

This email sent to lipton_lo...@mac.com

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/markjallan%40blueyonder.co.uk

This email sent to markjal...@blueyonder.co.uk




___

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

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

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

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


Re: Recommendations to Reading the Xcode in built Documentation to the fullest effect

2009-05-26 Thread Alex Kac
YES! I've been missing that for a long time. Couldn't put my finger on  
it until you said it. Bugreporter.apple.com time.


On May 26, 2009, at 6:28 PM, Mark Allan wrote:

FWIW, I initially came from a Java background and something I still  
really miss from the JavaDoc style API documentation is the group of  
sections entitled "Methods inherited from XYZ".  Those sections make  
it incredibly easy to see at a glance what methods/messages your  
class supports without having to load the docs for each of the  
superclasses in turn until you find (or don't as the case may be!)  
what you're looking for.


Mark


Alex Kac - President and Founder
Web Information Solutions, Inc.

"Champions aren't made in the gyms. Champions are made from something  
they have deep inside of them - a desire, a dream, a vision. They have  
last-minute stamina, they have to be a little faster, they have to  
have the skill, and the will. But the will must be stronger than the  
skill."

-- Muhammad Ali





___

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

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

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

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


Re: Recommendations to Reading the Xcode in built Documentation to the fullest effect

2009-05-26 Thread mmalc Crawford


On May 26, 2009, at 4:28 PM, Mark Allan wrote:

FWIW, I initially came from a Java background and something I still  
really miss from the JavaDoc style API documentation is the group of  
sections entitled "Methods inherited from XYZ".  Those sections make  
it incredibly easy to see at a glance what methods/messages your  
class supports without having to load the docs for each of the  
superclasses in turn until you find (or don't as the case may be!)  
what you're looking for.





You can use Xcode's Class Browser for this (Project > Class Browser).
(Set the configuration option to include inherited members.)

mmalc

___

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

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

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

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


NSColorPanel flat out lies

2009-05-26 Thread Seth Willits


I have a color well, which I am clicking on, and whenever I change the  
color in the color panel, the color panel sends a changeColor: message  
down the responder chain. Every time.


I *don't* want this, because it's sending changeColor to the wrong  
object. It's a bit long-winded to explain, but it boils down to the  
fact that I have this color well bound to a color property in a model  
object and I don't want any actions sent.


So I read the docs:

"When you select a color in the color panel, NSColorPanel sends its  
action to its target, provided that neither the action nor the target  
is nil."



Ok, so I figured the color panel must have changeColor: set as its  
action. I went to inspect what it was set to but... YOU CAN'T. There  
is no -target or -action method in NSColorPanel. *lovely*. So I tried  
setting both to nil in my controller, and tried it again... Same deal.  
changeColor: is being called.


So I figured it must be the color well which is setting the action  
when the color well becomes active. So I created a custom color well  
subclass, and did:


- (void)activate:(BOOL)exclusive;
{
[super activate:exclusive];
[[NSColorPanel sharedColorPanel] setTarget:nil];
[[NSColorPanel sharedColorPanel] setAction:nil];
}


... which should hopefully fix the problem. It doesn't. changeColor:  
is *STILL* called.


What the heck do I have to do to make it NOT send an action message?


--
Seth Willits



___

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

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

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

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


Re: NSColorPanel flat out lies

2009-05-26 Thread Alexander Heinz
NSColorWell is a subclass of NSControl. It should respond to  
setTarget:. Just use that.


HTH,
Alex Heinz

On May 26, 2009, at 8:11 PM, Seth Willits wrote:



I have a color well, which I am clicking on, and whenever I change  
the color in the color panel, the color panel sends a changeColor:  
message down the responder chain. Every time.


I *don't* want this, because it's sending changeColor to the wrong  
object. It's a bit long-winded to explain, but it boils down to the  
fact that I have this color well bound to a color property in a  
model object and I don't want any actions sent.


So I read the docs:

"When you select a color in the color panel, NSColorPanel sends its  
action to its target, provided that neither the action nor the  
target is nil."



Ok, so I figured the color panel must have changeColor: set as its  
action. I went to inspect what it was set to but... YOU CAN'T. There  
is no -target or -action method in NSColorPanel. *lovely*. So I  
tried setting both to nil in my controller, and tried it again...  
Same deal. changeColor: is being called.


So I figured it must be the color well which is setting the action  
when the color well becomes active. So I created a custom color well  
subclass, and did:


- (void)activate:(BOOL)exclusive;
{
[super activate:exclusive];
[[NSColorPanel sharedColorPanel] setTarget:nil];
[[NSColorPanel sharedColorPanel] setAction:nil];
}


... which should hopefully fix the problem. It doesn't. changeColor:  
is *STILL* called.


What the heck do I have to do to make it NOT send an action message?


--
Seth Willits



___

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

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

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

This email sent to ahei...@johnshopkins.edu


___

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

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

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

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


Re: NSColorPanel flat out lies

2009-05-26 Thread Alexander Heinz

I'm sorry, I misread; you're talking about NSColorPanel.

You might try sending setContinous:NO to the color panel.

Hope that helps,
Alex Heinz

On May 26, 2009, at 8:54 PM, Alexander Heinz wrote:

NSColorWell is a subclass of NSControl. It should respond to  
setTarget:. Just use that.


HTH,
Alex Heinz

On May 26, 2009, at 8:11 PM, Seth Willits wrote:



I have a color well, which I am clicking on, and whenever I change  
the color in the color panel, the color panel sends a changeColor:  
message down the responder chain. Every time.


I *don't* want this, because it's sending changeColor to the wrong  
object. It's a bit long-winded to explain, but it boils down to the  
fact that I have this color well bound to a color property in a  
model object and I don't want any actions sent.


So I read the docs:

"When you select a color in the color panel, NSColorPanel sends its  
action to its target, provided that neither the action nor the  
target is nil."



Ok, so I figured the color panel must have changeColor: set as its  
action. I went to inspect what it was set to but... YOU CAN'T.  
There is no -target or -action method in NSColorPanel. *lovely*. So  
I tried setting both to nil in my controller, and tried it again...  
Same deal. changeColor: is being called.


So I figured it must be the color well which is setting the action  
when the color well becomes active. So I created a custom color  
well subclass, and did:


- (void)activate:(BOOL)exclusive;
{
[super activate:exclusive];
[[NSColorPanel sharedColorPanel] setTarget:nil];
[[NSColorPanel sharedColorPanel] setAction:nil];
}


... which should hopefully fix the problem. It doesn't.  
changeColor: is *STILL* called.


What the heck do I have to do to make it NOT send an action message?


--
Seth Willits


___

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

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

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

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


Re: NSColorPanel flat out lies

2009-05-26 Thread Graham Cox


On 27/05/2009, at 10:11 AM, Seth Willits wrote:

I have a color well, which I am clicking on, and whenever I change  
the color in the color panel, the color panel sends a changeColor:  
message down the responder chain. Every time.


I *don't* want this, because it's sending changeColor to the wrong  
object. It's a bit long-winded to explain, but it boils down to the  
fact that I have this color well bound to a color property in a  
model object and I don't want any actions sent.



If your color well is first responder, then it can swallow the - 
changeColor: message. If it isn't then it shouldn't be responding to  
the color panel anyway?


--Graham


___

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

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

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

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


Re: NSColorPanel flat out lies

2009-05-26 Thread Seth Willits

On May 26, 2009, at 6:15 PM, Graham Cox wrote:

I have a color well, which I am clicking on, and whenever I change  
the color in the color panel, the color panel sends a changeColor:  
message down the responder chain. Every time.


I *don't* want this, because it's sending changeColor to the wrong  
object. It's a bit long-winded to explain, but it boils down to the  
fact that I have this color well bound to a color property in a  
model object and I don't want any actions sent.


If your color well is first responder, then it can swallow the - 
changeColor: message. If it isn't then it shouldn't be responding to  
the color panel anyway?




Color wells don't become first responder when you click on them. They  
just become "active". Stick a color well on a window next to a text  
view. The text view always remains first responder when you click on  
the color well.




On May 26, 2009, at 5:58 PM, Alexander Heinz wrote:


You might try sending setContinous:NO to the color panel.



Nope. That simply changes whether the color is changed while the user  
drags the mouse in the color picker. changeColor: is still sent at the  
beginning and end.





Also, setting the NSColorPanel's target and selector to a valid object  
and selector, that action is called in *addition* to changeColor:. So  
it seems NSColorPanel will always send changeColor: up the responder  
chain AND then call the action on the specified target/selector  
according to the rules in the docs.


I actually just found this being described in a subsection of the  
color programming guide. changeColor: is also in the color panel's  
reference, but it's listed under Delegate Methods and simply has a  
note saying it's sent to first responder, not a designated delegate.



So... my bad.

I really don't like the design of NSColorPanel and NSFontPanel. It's  
not like I can come up with an undeniably better architecture, but the  
existing ones sure do have some major annoyances whenever I need to  
use them.



I'll have to rethink this some more.


--
Seth Willits



___

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

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

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

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


Re: Displaying a number with Quartz

2009-05-26 Thread Pierre Berloquin
That would mean dropping all the niceties of Quartz that lets me draw
outlined text, for one.

2009/5/26 Gunnar Proppe 

>
> Actually, your pure Objective C version would be to use NSString's
> drawAtPoint:withAttributes instead of converting to a char* and using
> CGContextShowTextAtPoint.
>
>
> http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSString_AppKitAdditions/Reference/Reference.html
>
> Gunnar
>
>
> - Original Message 
> > From: Pierre Berloquin 
> > To: Sean McBride 
> > Cc: cocoa-dev@lists.apple.com
> > Sent: Tuesday, May 26, 2009 9:13:26 AM
> > Subject: Re: Displaying a number with Quartz
> >
> > Finally, thanks to Alexander, my pure Objective C solution is
> > NSString *S = [[NSString alloc] initWithFormat:@"%i", i];
> > const char *text = [S UTF8String];
> >
> > and no warning this time except that I should learn more about C
> >
> > Thanks
> > Pierre
> >
> > 2009/5/26 Sean McBride
> >
> > > On 5/26/09 5:12 PM, Alexander Spohr said:
> > >
> > > >> Never ever use sprintf for anything.
> > > >
> > > >If you use "%d" and know it will be an int? You know how many chars
> > > >you'll have at max, no buffer-overflow possible. (You might argue
> > > >here, that at some time we will habe 128-bit ints, but hey you should
> > > >recode your app then anyway or just have a buffer large enough to
> > > >handle that right at the start)
> > > >
> > > >And yes - you are right, use snprintf instead... int might become 256
> > > >bit.
> > >
> > > You can use sprintf safely if you're very careful, I suppose, but using
> > > snprintf is not harder and so much safer.  sprintf is just not worth
> the
> > > risk.
> > >
> > > --
> > > 
> > > Sean McBride, B. Engs...@rogue-research.com
> > > Rogue Researchwww.rogue-research.com
> > > Mac Software Developer  Montréal, Québec, Canada
> > >
> > >
> > >
> >
> >
> > --
> > Blogs : http://bibliobs.nouvelobs.com/blog/jeux-litteraires
> >   http://pierre-berloquin.blogspot.com/
> >
> > Développement durable des neurones par le jeu de réflexion
> > www.crealude.net
> >
> > Sustainable development of neurones through mind games
> > www.crealude.net/us
> >
> > Que fait-on pour les mal-codants ?
> > ___
> >
> > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> >
> > Please do not post admin requests or moderator comments to the list.
> > Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> >
> > Help/Unsubscribe/Update your Subscription:
> > http://lists.apple.com/mailman/options/cocoa-dev/tonecluster%40yahoo.com
> >
> > This email sent to toneclus...@yahoo.com
>
>
>
>
>


-- 
Blogs : http://bibliobs.nouvelobs.com/blog/jeux-litteraires
   http://pierre-berloquin.blogspot.com/

Développement durable des neurones par le jeu de réflexion
www.crealude.net

Sustainable development of neurones through mind games
www.crealude.net/us

Que fait-on pour les mal-codants ?
___

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

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

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

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


Re: Displaying a number with Quartz

2009-05-26 Thread Graham Cox


On 27/05/2009, at 12:24 PM, Pierre Berloquin wrote:


That would mean dropping all the niceties of Quartz that lets me draw
outlined text, for one.



That's not the case. The attributes you pass in - 
drawAtPoint:withAttributes: can include outlines  
(NSStrokeWidthAttributeName) in different colours  
(NSStrokeColorAttributeName), shadows (NSShadowAttributeName),  
underlines and strikethroughs, all in different colours from the main  
text fill.


Furthermore, the CGContextShowText... methods accept a C string  
argument, so they can't cope with unicode. Neither can they apply  
attributes in ranges. Both issues are entirely solved by  
NSAttributedString. This class has infinitely more "niceties" than raw  
Quartz text.


--Graham


___

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

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

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

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


Filling a Bezier path with a texture

2009-05-26 Thread Development
I have a tiny little texture image that I want to use to fill a bezier  
path The problem is that I cannot seem to figure out how to use the  
image to fill the path. It's a curved path basically a hill and the  
texture is grass. Any ideas? Any one know of a bit of example code  
that might help me figure this out?



Thanks
April.
___

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

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

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

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


  1   2   >